Skip to content

Commit

Permalink
Merge pull request #503 from chhylp123/hifiasm_dev_debug
Browse files Browse the repository at this point in the history
disable multiple assertions
  • Loading branch information
chhylp123 committed Aug 17, 2023
2 parents 30d2ee0 + 858b95a commit 94a284b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CommandLines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static ko_longopt_t long_options[] = {
{ "path-max", ko_required_argument, 346},
{ "path-min", ko_required_argument, 347},
{ "trio-dual", ko_no_argument, 348},
{ "ul-cut", ko_required_argument, 349},
// { "path-round", ko_required_argument, 348},
{ 0, 0, 0 }
};
Expand Down Expand Up @@ -174,6 +175,8 @@ void Print_H(hifiasm_opt_t* asm_opt)
fprintf(stderr, " --path-min FLOAT\n");
fprintf(stderr, " min path drop ratio [%.2g]; higher number may make the assembly cleaner\n", asm_opt->min_path_drop_rate);
fprintf(stderr, " but may lead to more misassemblies\n");
fprintf(stderr, " --ul-cut INT\n");
fprintf(stderr, " filter out <INT UL reads during the UL assembly [%d]\n", asm_opt->ul_min_base);
// fprintf(stderr, " --low-het enable it for genomes with very low het heterozygosity rate (<0.0001%%)\n");

fprintf(stderr, "Example: ./hifiasm -o NA12878.asm -t 32 NA12878.fq.gz\n");
Expand Down Expand Up @@ -290,6 +293,7 @@ void init_opt(hifiasm_opt_t* asm_opt)
asm_opt->hifi_pst_join = 1;
asm_opt->ul_pst_join = 1;
asm_opt->trio_cov_het_ovlp = -1;
asm_opt->ul_min_base = 0;
}

void destory_enzyme(enzyme* f)
Expand Down Expand Up @@ -835,6 +839,7 @@ int CommandLine_process(int argc, char *argv[], hifiasm_opt_t* asm_opt)
else if (c == 346) asm_opt->max_path_drop_rate = atof(opt.arg);
else if (c == 347) asm_opt->min_path_drop_rate = atof(opt.arg);
else if (c == 348) asm_opt->trio_cov_het_ovlp = 1;
else if (c == 349) asm_opt->ul_min_base = atol(opt.arg);
else if (c == 'l') { ///0: disable purge_dup; 1: purge containment; 2: purge overlap
asm_opt->purge_level_primary = asm_opt->purge_level_trio = atoi(opt.arg);
}
Expand Down
3 changes: 2 additions & 1 deletion CommandLines.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <pthread.h>
#include <stdint.h>

#define HA_VERSION "0.19.5-r593"
#define HA_VERSION "0.19.6-r595"

#define VERBOSE 0

Expand Down Expand Up @@ -146,6 +146,7 @@ typedef struct {
int32_t integer_correct_round;
uint8_t dbg_ovec_cal;
uint8_t hifi_pst_join, ul_pst_join;
uint32_t ul_min_base;
} hifiasm_opt_t;

extern hifiasm_opt_t asm_opt;
Expand Down
16 changes: 7 additions & 9 deletions inter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12692,7 +12692,7 @@ static void *worker_ul_scall_pipeline(void *data, int step, void *in) // callbac
s->opt = p->opt; s->uu = p->uu; s->uopt = p->uopt; s->rg = p->rg;
while ((ret = kseq_read(p->ks)) >= 0)
{
if (p->ks->seq.l < (uint64_t)p->opt->k) continue;
if ((p->ks->seq.l < (uint64_t)p->opt->k) || (p->ks->seq.l < asm_opt.ul_min_base)) continue;
if (s->n == s->m) {
s->m = s->m < 16? 16 : s->m + (s->n>>1);
REALLOC(s->len, s->m);
Expand Down Expand Up @@ -12823,7 +12823,7 @@ static void *worker_ul_rescall_pipeline(void *data, int step, void *in) // callb
s->opt = p->opt; s->uu = p->uu; s->uopt = p->uopt; s->rg = p->rg; s->mm = p->mm;
while ((ret = kseq_read(p->ks)) >= 0)
{
if (p->ks->seq.l < (uint64_t)p->opt->k) continue;
if ((p->ks->seq.l < (uint64_t)p->opt->k) || (p->ks->seq.l < asm_opt.ul_min_base)) continue;
if (s->n == s->m) {
s->m = s->m < 16? 16 : s->m + (s->n>>1);
REALLOC(s->len, s->m);
Expand Down Expand Up @@ -15956,7 +15956,7 @@ uint32_t refine_rid_chain(const asg_t *rg, mg_tbuf_t *b, ul_vec_t *rch, uint64_t
{
if(rch->bb.n == 1 && rch->bb.a[0].base) return 1;///no alignment
if(rch->bb.n == 0) return 1;///no alignment
uint64_t i, m, c[2], nc, cc, ni[2];
uint64_t i, m, c[2], nc, cc/**, ni[2]**/;
for (i = c[1] = rch->bb.n-1, m = nc = 0; i != (uint32_t)-1; i = rch->bb.a[i].pidx) {
m++; c[0] = i; if(!(rg->seq[rch->bb.a[i].hid].del)) nc++;
}
Expand All @@ -15967,16 +15967,14 @@ uint32_t refine_rid_chain(const asg_t *rg, mg_tbuf_t *b, ul_vec_t *rch, uint64_t
if(rg->seq[rch->bb.a[i].hid].del) cc++;
else break;
}
ni[1] = i;
// ni[1] = i;
for (i = c[0]; i != (uint32_t)-1; i = rch->bb.a[i].aidx) {
if(rg->seq[rch->bb.a[i].hid].del) cc++;
else break;
}
ni[0] = i;
// ni[0] = i;
if(nc + cc == m) return 1;
assert(ni[1] > ni[0] && ni[0] != (uint32_t)-1 && ni[1] != (uint32_t)-1);
// fprintf(stderr, "[M::%s::%.*s(id:%ld), len:%u] aln::%lu, m::%lu, nc::%lu, cc::%lu\n", __func__,
// UL_INF.nid.a[ulid].n, UL_INF.nid.a[ulid].a, ulid, rch->rlen, (uint64_t)rch->bb.n, m, nc, cc);
// assert(ni[1] > ni[0] && ni[0] != (uint32_t)-1 && ni[1] != (uint32_t)-1);
return 2;
}
return 0;
Expand Down Expand Up @@ -16042,7 +16040,7 @@ uint32_t refine_contain_consensus_chain(const asg_t *rg, ul_vec_t *rch, R_to_U *
if(!is_end) continue;
i = m = k; occ = 0;
while (i != ((uint32_t)-1)) {
assert(bu->a[i] == ((uint64_t)-1));
//assert(bu->a[i] == ((uint64_t)-1));
if(rg->seq[rch->bb.a[i].hid].del) {
if(occ > 1) {
bu->a[m] = occ;
Expand Down

0 comments on commit 94a284b

Please sign in to comment.