From 04f660fd8c37622a5ac04cfb4f799f993ca09d1c Mon Sep 17 00:00:00 2001 From: chhylp123 Date: Fri, 24 Feb 2023 00:36:52 -0500 Subject: [PATCH] bug fixed for mask calculation --- CommandLines.h | 2 +- Correct.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++-------- inter.cpp | 4 +++- 3 files changed, 49 insertions(+), 10 deletions(-) diff --git a/CommandLines.h b/CommandLines.h index 6862eb2..10c6d3b 100644 --- a/CommandLines.h +++ b/CommandLines.h @@ -5,7 +5,7 @@ #include #include -#define HA_VERSION "0.18.8-r525" +#define HA_VERSION "0.18.9-r527" #define VERBOSE 0 diff --git a/Correct.cpp b/Correct.cpp index e1f6615..216131b 100644 --- a/Correct.cpp +++ b/Correct.cpp @@ -18617,7 +18617,18 @@ void ul_lalign(overlap_region_alloc* ol, Candidates_list *cl, const ul_idx_t *ur if(ol->length <= 0) return; } else { // fprintf(stderr, "-[M::%s] on::%lu\n", __func__, ol->length); - if(ol->length <= 1) return; + if(ol->length <= 1) { + if(ol->length == 1) { + window_list *p; + z = &(ol->list[0]); z->w_list.n = 0; + kv_pushp(window_list, z->w_list, &p); + memset(p, 0, sizeof((*p))); + p->x_start = z->x_pos_s; p->x_end = z->x_pos_e+1; p->clen = 0; + z->align_length = z->overlapLen = z->x_pos_e+1-z->x_pos_s; + z->non_homopolymer_errors = 0; + } + return; + } ///coordinates for all intervals with cov > 1 copy_asg_arr(iidx, hap->snp_srt); copy_asg_arr(buf, v_idx->a); copy_asg_arr(buf1, (*stb)); // fprintf(stderr, "\n[M::%s] iidx_n::%ld\n", __func__, (int64_t)iidx.n); @@ -21022,7 +21033,7 @@ bit_extz_t *exz, double e_rate, int64_t w_l, uint64_t ql, uint64_t rid, uint64_t int64_t aux_n = aux_o->w_list.n; - // if(z->x_id == 29033 && z->y_id == 21307) { + // if(z->x_id == 77960 && z->y_id == 27340) { // fprintf(stderr, "\n[M::%s]\tutg%.6u%c\txl::%u\tx::[%u,\t%u)\t%c\tutg%.6u%c\tyl::%u\ty::[%u,\t%u)\n", // __func__, // z->x_id+1, "lc"[udb->ug->u.a[z->x_id].circ], udb->ug->u.a[z->x_id].len, z->x_pos_s, z->x_pos_e+1, @@ -21046,7 +21057,7 @@ bit_extz_t *exz, double e_rate, int64_t w_l, uint64_t ql, uint64_t rid, uint64_t rechain_aln(z, cl, aux_o, i, w_l, udb, NULL, NULL, qstr, tu, exz, e_rate, ql, tl, khit, rid); } - // if(z->x_id == 29033 && z->y_id == 21307) { + // if(z->x_id == 77960 && z->y_id == 27340) { // fprintf(stderr, "\n[M::%s]\tutg%.6u%c\txl::%u\tx::[%u,\t%u)\t%c\tutg%.6u%c\tyl::%u\ty::[%u,\t%u)\n", // __func__, // z->x_id+1, "lc"[udb->ug->u.a[z->x_id].circ], udb->ug->u.a[z->x_id].len, z->x_pos_s, z->x_pos_e+1, @@ -21086,7 +21097,7 @@ bit_extz_t *exz, double e_rate, int64_t w_l, uint64_t ql, uint64_t rid, uint64_t } z->non_homopolymer_errors = zerr; - // if(z->x_id == 29033 && z->y_id == 21307) { + // if(z->x_id == 77960 && z->y_id == 27340) { // fprintf(stderr, "\n[M::%s]\tutg%.6u%c\txl::%u\tx::[%u,\t%u)\t%c\tutg%.6u%c\tyl::%u\ty::[%u,\t%u)\n", // __func__, // z->x_id+1, "lc"[udb->ug->u.a[z->x_id].circ], udb->ug->u.a[z->x_id].len, z->x_pos_s, z->x_pos_e+1, @@ -21308,12 +21319,13 @@ void ug_lalign(overlap_region_alloc* ol, Candidates_list *cl, const ul_idx_t *ur rr = gen_extend_err_exz(z, uref, NULL, NULL, in/**qu->seq**/, tu->seq, exz, NULL/**v_idx?v_idx->a.a:NULL**/, w.window_length, -1, err, (e_max+0.000001), &re); z->is_match = 0;///must be here; - // if(sid == 7 && z->y_id == 135) { - // fprintf(stderr, "===utg%.6u%c\t%u\t%u\t%u\t%c\tutg%.6u%c\t%u\t%u\t%u\talign_length::%u\terr::%f\trr::%f\twn::%u\n", + // if(z->x_id == 77960 && z->y_id == 27340) { + // fprintf(stderr, "+utg%.6u%c\t%u\t%u\t%u\t%c\tutg%.6u%c\t%u\t%u\t%u\talign_length::%u\terr::%f\trr::%f\twn::%u\tk::%lu\ti::%lu\n", // z->x_id+1, "lc"[uref->ug->u.a[z->x_id].circ], uref->ug->u.a[z->x_id].len, // z->x_pos_s, z->x_pos_e+1, "+-"[z->y_pos_strand], // z->y_id+1, "lc"[uref->ug->u.a[z->y_id].circ], uref->ug->u.a[z->y_id].len, - // z->y_pos_s, z->y_pos_e+1, z->align_length, err, rr, (uint32_t)z->w_list.n/**gen_nkhits(cl, z)**/); + // z->y_pos_s, z->y_pos_e+1, z->align_length, err, rr, (uint32_t)z->w_list.n/**gen_nkhits(cl, z)**/, + // k, i); // } if (rr <= err) { if(k != i) { @@ -21327,18 +21339,39 @@ void ug_lalign(overlap_region_alloc* ol, Candidates_list *cl, const ul_idx_t *ur } ol->length = k; + // if(sid == 77960) { + // fprintf(stderr, "+utg%.6ld%c\tol->length::%lu\n", sid+1, "lc"[uref->ug->u.a[sid].circ], ol->length); + // } if(ol->length <= 0) return; } else { - if(ol->length <= 1) return; + // if(ol->length <= 1) return; + if(ol->length <= 0) return; if(qu) { resize_UC_Read(qu, ql); qu->length = ql; memcpy(qu->seq, qstr, ql); in = qu->seq; } for (i = k = 0; i < ol->length; i++) { z = &(ol->list[i]); + // if(z->x_id == 77960 && z->y_id == 27340) { + // fprintf(stderr, "-1-utg%.6u%c\t%u\t%u\t%u\t%c\tutg%.6u%c\t%u\t%u\t%u\talign_length::%u\terr::%f\twn::%u\tk::%lu\ti::%lu\n", + // z->x_id+1, "lc"[uref->ug->u.a[z->x_id].circ], uref->ug->u.a[z->x_id].len, + // z->x_pos_s, z->x_pos_e+1, "+-"[z->y_pos_strand], + // z->y_id+1, "lc"[uref->ug->u.a[z->y_id].circ], uref->ug->u.a[z->y_id].len, + // z->y_pos_s, z->y_pos_e+1, z->align_length, err, (uint32_t)z->w_list.n/**gen_nkhits(cl, z)**/, + // k, i); + // } if(!ul_raw_aln(z, cl, uref, in/**qu->seq**/, tu, exz, err, wl, ql, sid, khit, aux_o)) { z->is_match = 0; continue; } + + // if(z->x_id == 77960 && z->y_id == 27340) { + // fprintf(stderr, "-2-utg%.6u%c\t%u\t%u\t%u\t%c\tutg%.6u%c\t%u\t%u\t%u\talign_length::%u\terr::%f\twn::%u\tk::%lu\ti::%lu\n", + // z->x_id+1, "lc"[uref->ug->u.a[z->x_id].circ], uref->ug->u.a[z->x_id].len, + // z->x_pos_s, z->x_pos_e+1, "+-"[z->y_pos_strand], + // z->y_id+1, "lc"[uref->ug->u.a[z->y_id].circ], uref->ug->u.a[z->y_id].len, + // z->y_pos_s, z->y_pos_e+1, z->align_length, err, (uint32_t)z->w_list.n/**gen_nkhits(cl, z)**/, + // k, i); + // } if(k != i) { t = ol->list[k]; ol->list[k] = ol->list[i]; @@ -21348,5 +21381,9 @@ void ug_lalign(overlap_region_alloc* ol, Candidates_list *cl, const ul_idx_t *ur k++; } ol->length = k; + + // if(sid == 77960) { + // fprintf(stderr, "-utg%.6ld%c\tol->length::%lu\n", sid+1, "lc"[uref->ug->u.a[sid].circ], ol->length); + // } } } \ No newline at end of file diff --git a/inter.cpp b/inter.cpp index 1feca0a..ff689e0 100644 --- a/inter.cpp +++ b/inter.cpp @@ -11228,7 +11228,7 @@ int64_t cal_exact_batch(overlap_region *z, ul_ov_t *sa, uint64_t sn, int64_t yle } if((*q0l) >= (z->x_pos_e+1-z->x_pos_s) && (*t0l) >= (z->y_pos_e+1-z->y_pos_s)) { - // if((!(((*q0l) == (*q1l)) && ((*t0l) == (*t1l)) && (err0 == err1))) || (!(err0 == tot))) { + // if((!(((*q0l) == (*q1l)) && ((*t0l) == (*t1l)) && (err0 == err1)))/** || (!(err0 == tot))**/) { // fprintf(stderr, "[M::%s]\tutg%.6u%c\txl::%u\tx::[%u,\t%u)\t%c\tutg%.6u%c\tyl::%u\ty::[%u,\t%u)\terr::%u\twn::%u\n", // __func__, // z->x_id+1, "lc"[ug->u.a[z->x_id].circ], ug->u.a[z->x_id].len, z->x_pos_s, z->x_pos_e+1, @@ -11703,6 +11703,8 @@ static void worker_for_graph_bin(void *data, long i, int tid) // callback for kt seq = b->self_read.seq; } + // if(i!=77960) return; + // asprintf(&as, "\n[M::%s] rid::%ld, len::%lu, name::%.*s\n", __func__, s->id+i, s->len[i], (int32_t)UL_INF.nid.a[s->id+i].n, UL_INF.nid.a[s->id+i].a); // push_vlog(&(overall_zdbg->a[s->id+i]), as); free(as); as = NULL;