From 64091a76a5abac6ab6522e2e5e1c5265a0dd7fea Mon Sep 17 00:00:00 2001 From: chhylp123 Date: Wed, 19 Jul 2023 19:11:37 -0400 Subject: [PATCH] fix filter_short_ulalignments --- CommandLines.h | 2 +- inter.cpp | 42 +++++++++++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/CommandLines.h b/CommandLines.h index 6cfa400..8a1f66e 100644 --- a/CommandLines.h +++ b/CommandLines.h @@ -5,7 +5,7 @@ #include #include -#define HA_VERSION "0.19.5-r592" +#define HA_VERSION "0.19.5-r593" #define VERBOSE 0 diff --git a/inter.cpp b/inter.cpp index b093f6a..f20ef20 100644 --- a/inter.cpp +++ b/inter.cpp @@ -17891,11 +17891,12 @@ static void filter_short_ulalignments(void *data, long i, int tid) // callback f a = UL_INF.a[i].bb.a; a_n = UL_INF.a[i].bb.n; for (k = a_n - 1; k >= 0; k--) { - // if(i == 1126) { - // fprintf(stderr, "[M::%s::id->%ld::rlen->%u] (%ld) utg%.6dl, q::[%u, %u), t::[%u, %u), pidx::%u, aidx::%u, pdis::%u\n", - // __func__, i, UL_INF.a[i].rlen, k, (int32_t)a[k].hid+1, a[k].qs, a[k].qe, a[k].ts, a[k].te, a[k].pidx, a[k].aidx, a[k].pdis); - // } p = &(a[k]); + // if(i == 338344) { + // fprintf(stderr, "+[M::%s::id->%ld::rlen->%u::glen->%u] (%ld) utg%.6dl, q::[%u, %u), t::[%u, %u), pidx::%u, aidx::%u, pdis::%u, a[k].base::%u, a[k].el::%u, a[k].pchain::%u\n", + // __func__, i, UL_INF.a[i].rlen, ug->u.a[p->hid].len, k, (int32_t)a[k].hid+1, a[k].qs, a[k].qe, a[k].ts, a[k].te, a[k].pidx, a[k].aidx, a[k].pdis, + // a[k].base, a[k].el, a[k].pchain); + // } if(p->base || (!p->el) || (!p->pchain)) continue; if(p->pidx == (uint32_t)-1) { if(!ugl_cover_check(p->ts, p->te, &(ug->u.a[p->hid]))) { @@ -17928,9 +17929,32 @@ static void filter_short_ulalignments(void *data, long i, int tid) // callback f for (k = a_n - 1; k >= 0; k--) { p = &(a[k]); if(p->base || (!p->el) || (!p->pchain)) continue; - // if(i == 1126) { - // fprintf(stderr, "-[M::%s::id->%ld::rlen->%u] (%ld) utg%.6dl, q::[%u, %u), t::[%u, %u), pidx::%u, aidx::%u, pdis::%u\n", - // __func__, i, UL_INF.a[i].rlen, k, (int32_t)a[k].hid+1, a[k].qs, a[k].qe, a[k].ts, a[k].te, a[k].pidx, a[k].aidx, a[k].pdis); + if(p->pidx != (uint32_t)-1) { + if((a[p->pidx].aidx != ((uint32_t)k)) && (a[p->pidx].aidx == ((uint32_t)-1))) { + p->pidx = (uint32_t)-1; + } else { + assert(a[p->pidx].aidx == (uint32_t)k); + assert(a[p->pidx].pchain); + } + } + if(p->aidx != (uint32_t)-1) { + if((a[p->aidx].pidx != (uint32_t)k) && (a[p->aidx].pidx == ((uint32_t)-1))) { + p->aidx = (uint32_t)-1; + } else { + assert(a[p->aidx].pidx == (uint32_t)k); + assert(a[p->aidx].pchain); + } + + } + } + + for (k = a_n - 1; k >= 0; k--) { + p = &(a[k]); + if(p->base || (!p->el) || (!p->pchain)) continue; + // if(i == 338344) { + // fprintf(stderr, "-[M::%s::id->%ld::rlen->%u::glen->%u] (%ld) utg%.6dl, q::[%u, %u), t::[%u, %u), pidx::%u, aidx::%u, pdis::%u, a[k].base::%u, a[k].el::%u, a[k].pchain::%u\n", + // __func__, i, UL_INF.a[i].rlen, ug->u.a[p->hid].len, k, (int32_t)a[k].hid+1, a[k].qs, a[k].qe, a[k].ts, a[k].te, a[k].pidx, a[k].aidx, a[k].pdis, + // a[k].base, a[k].el, a[k].pchain); // } if(p->pidx != (uint32_t)-1) { // if(!(a[p->pidx].aidx == (uint32_t)k)) { @@ -17941,6 +17965,10 @@ static void filter_short_ulalignments(void *data, long i, int tid) // callback f assert(a[p->pidx].pchain); } if(p->aidx != (uint32_t)-1) { + // if(a[p->aidx].pidx != (uint32_t)k) { + // fprintf(stderr, "[M::%s::id->%ld] name::%.*s, a_n::%ld, p->aidx::%u, p->pidx::%u, a[p->aidx].pidx::%u\n", __func__, i, (int32_t)UL_INF.nid.a[i].n, UL_INF.nid.a[i].a, a_n, + // p->aidx, p->pidx, a[p->aidx].pidx); + // } assert(a[p->aidx].pidx == (uint32_t)k); assert(a[p->aidx].pchain); }