This commit is contained in:
chhylp123
2021-02-02 13:15:59 -05:00
parent 167f880377
commit d4be231329
+8 -4
View File
@@ -49,6 +49,7 @@ typedef struct {
int32_t pre; int32_t pre;
int32_t n_thread; int32_t n_thread;
int64_t chunk_size; int64_t chunk_size;
int adaLen;
} yak_copt_t; } yak_copt_t;
void yak_copt_init(yak_copt_t *o) void yak_copt_init(yak_copt_t *o)
@@ -598,7 +599,9 @@ static void *worker_count(void *data, int step, void *in) // callback for kt_pip
} }
} else { } else {
while ((ret = kseq_read(p->ks)) >= 0) { while ((ret = kseq_read(p->ks)) >= 0) {
int l = p->ks->seq.l; int l = (int)(p->ks->seq.l) - (int)(p->opt->adaLen) - (int)(p->opt->adaLen);
if(l <= 0) continue;
if (p->n_seq >= 1<<28) { if (p->n_seq >= 1<<28) {
fprintf(stderr, "ERROR: this implementation supports no more than %d reads\n", 1<<28); fprintf(stderr, "ERROR: this implementation supports no more than %d reads\n", 1<<28);
exit(1); exit(1);
@@ -612,9 +615,9 @@ static void *worker_count(void *data, int step, void *in) // callback for kt_pip
int i, n_N; int i, n_N;
assert(l == (int)p->rs_out->read_length[p->n_seq]); assert(l == (int)p->rs_out->read_length[p->n_seq]);
for (i = n_N = 0; i < l; ++i) // count number of ambiguous bases for (i = n_N = 0; i < l; ++i) // count number of ambiguous bases
if (seq_nt4_table[(uint8_t)p->ks->seq.s[i]] >= 4) if (seq_nt4_table[(uint8_t)p->ks->seq.s[i+p->opt->adaLen]] >= 4)
++n_N; ++n_N;
ha_compress_base(Get_READ(*p->rs_out, p->n_seq), p->ks->seq.s, l, &p->rs_out->N_site[p->n_seq], n_N); ha_compress_base(Get_READ(*p->rs_out, p->n_seq), p->ks->seq.s+p->opt->adaLen, l, &p->rs_out->N_site[p->n_seq], n_N);
memcpy(&p->rs_out->name[p->rs_out->name_index[p->n_seq]], p->ks->name.s, p->ks->name.l); memcpy(&p->rs_out->name[p->rs_out->name_index[p->n_seq]], p->ks->name.s, p->ks->name.l);
} }
} }
@@ -625,7 +628,7 @@ static void *worker_count(void *data, int step, void *in) // callback for kt_pip
REALLOC(s->seq, s->m_seq); REALLOC(s->seq, s->m_seq);
} }
MALLOC(s->seq[s->n_seq], l); MALLOC(s->seq[s->n_seq], l);
memcpy(s->seq[s->n_seq], p->ks->seq.s, l); memcpy(s->seq[s->n_seq], p->ks->seq.s+p->opt->adaLen, l);
s->len[s->n_seq++] = l; s->len[s->n_seq++] = l;
++p->n_seq; ++p->n_seq;
s->sum_len += l; s->sum_len += l;
@@ -833,6 +836,7 @@ ha_ct_t *ha_count(const hifiasm_opt_t *asm_opt, int flag, ha_pt_t *p0, const voi
///for ha_pt_gen, shoud be 0 ///for ha_pt_gen, shoud be 0
opt.bf_shift = flag & HAF_COUNT_EXACT? 0 : asm_opt->bf_shift; opt.bf_shift = flag & HAF_COUNT_EXACT? 0 : asm_opt->bf_shift;
opt.n_thread = asm_opt->thread_num; opt.n_thread = asm_opt->thread_num;
opt.adaLen = asm_opt->adapterLen;
///asm_opt->num_reads is the number of fastq files ///asm_opt->num_reads is the number of fastq files
for (i = 0; i < asm_opt->num_reads; ++i) for (i = 0; i < asm_opt->num_reads; ++i)
h = yak_count(&opt, asm_opt->read_file_names[i], flag|HAF_CREATE_NEW, p0, h, flt_tab, rs, &n_seq); h = yak_count(&opt, asm_opt->read_file_names[i], flag|HAF_CREATE_NEW, p0, h, flt_tab, rs, &n_seq);