From 4bc43cec92e99a5e2a21c8e6ad4374e81438f17b Mon Sep 17 00:00:00 2001 From: chhylp123 Date: Sat, 17 Apr 2021 00:31:19 -0400 Subject: [PATCH] bug fixed --- hic.cpp | 8 ++--- hifiasm.1 | 104 +++++++++++++++++++++++++++++++++++++++++++----------- rcut.cpp | 18 +--------- 3 files changed, 88 insertions(+), 42 deletions(-) diff --git a/hic.cpp b/hic.cpp index b0599d5..f1513eb 100644 --- a/hic.cpp +++ b/hic.cpp @@ -7406,7 +7406,7 @@ void update_bsg(asg_t *bsg, kvec_asg_arc_t_warp* edges) void resolve_bubble_chain_tangle(ma_ug_t* ug, bubble_type* bub) { - double index_time = yak_realtime(); + // double index_time = yak_realtime(); ma_ug_t *bub_ug = bub->b_ug; asg_t *bsg = bub->b_g; uint32_t k, i, v, n_vx, new_bub; @@ -7575,7 +7575,7 @@ void resolve_bubble_chain_tangle(ma_ug_t* ug, bubble_type* bub) kv_destroy(res_btg.a); kv_destroy(res_utg.a); kv_destroy(edges.a); ///print_debug_bubble_graph(bub, ug, asm_opt.output_file_name); - fprintf(stderr, "[M::%s::%.3f]\n", __func__, yak_realtime()-index_time); + // fprintf(stderr, "[M::%s::%.3f]\n", __func__, yak_realtime()-index_time); } void update_bubble_chain(ma_ug_t* ug, bubble_type* bub, uint32_t is_middle, uint32_t is_end) @@ -13931,11 +13931,11 @@ int hic_short_align(const enzyme *fn1, const enzyme *fn2, ha_ug_index* idx) } renew_kv_u_trans(&k_trans, &link, &sl.hits, &(idx->t_ch->k_trans), idx, &bub, s->s, 0); - // if(bub.round_id == 0) init_phase(idx, &k_trans, &bub, s); + if(bub.round_id == 0) init_phase(idx, &k_trans, &bub, s); update_trans_g(idx, &k_trans, &bub); /*******************************for debug************************************/ mc_solve(NULL, NULL, &k_trans, idx->ug, idx->read_g, 0.8, R_INF.trio_flag, - (bub.round_id == 0? 1 : 0), s->s, 0, /**&bub**/NULL); + /**(bub.round_id == 0? 1 : 0)**/0, s->s, 0, /**&bub**/NULL); /*******************************for debug************************************/ label_unitigs_sm(s->s, idx->ug); /** diff --git a/hifiasm.1 b/hifiasm.1 index 6247ddf..75914e0 100644 --- a/hifiasm.1 +++ b/hifiasm.1 @@ -1,4 +1,4 @@ -.TH hifiasm 1 "20 Mar 2021" "hifiasm-0.14.2 (r315)" "Bioinformatics tools" +.TH hifiasm 1 "16 April 2021" "hifiasm-0.15 (r327)" "Bioinformatics tools" .SH NAME .PP @@ -349,11 +349,7 @@ RNG seed [11]. .SH OUTPUTS .PP -Without trio partition options -.B -1 -and -.BR -2 , -hifiasm generates the following assembly graphs in the GFA format: +In general, hifiasm generates the following assembly graphs in the GFA format: .RS 2 .TP 2 @@ -380,40 +376,106 @@ assembly graph of primary contigs. This graph collapses different haplotypes. assembly graph of alternate contigs. This graph consists of all assemblies that are discarded in primary contig graph. +.TP +* +.IR prefix .hap*.p_ctg.gfa: +phased contig graph. This graph keeps the phased assembly. + .RE .PP -With trio partition, hifiasm outputs the following assembly graphs: +Hifiasm outputs +.B *.r_utg.gfa +and +.B *.p_utg.gfa +in any cases. +Specifically, hifiasm outputs the following assembly graphs +with trio-binning options: .RS 2 .TP 2 * -.IR prefix .dip.r_utg.gfa: -haplotype-resolved raw unitig graph. This graph keeps all haplotype information. - -.TP -* -.IR prefix .hap1.p_ctg.gfa: -phased paternal/haplotype1 contig graph. This graph keeps the phased +.IR prefix .dip.hap1.p_ctg.gfa: +phased paternal/haplotype1 contig graph keeping the phased paternal/haplotype1 assembly. .TP * -.IR prefix .hap2.p_ctg.gfa: -phased maternal/haplotype2 contig graph. This graph keeps the phased +.IR prefix .dip.hap2.p_ctg.gfa: +phased maternal/haplotype2 contig graph keeping the phased maternal/haplotype2 assembly. .RE .PP -With Hi-C partition, hifiasm outputs the assembly graphs like trio partition, -but with additional prefix -.B [hic]. -In this mode, hifiasm keeps Hi-C alignment results and Hi-C index in two bin +With Hi-C partition options, hifiasm outputs: + +.RS 2 +.TP 2 +* +.IR prefix .hic.p_ctg.gfa: +assembly graph of primary contigs. This graph collapses different haplotypes. + +.TP +* +.IR prefix .hic.hap1.p_ctg.gfa: +phased contig graph where each contig is fully phased. + +.TP +* +.IR prefix .hic.hap2.p_ctg.gfa: +phased contig graph where each contig is fully phased. +.RE + + +.PP +Hifiasm keeps Hi-C alignment results and Hi-C index in two bin files: .B *hic.lk.bin and .B *hic.tlb.bin. -Rerunning hifiasm with different Hi-C reads needs to delete these bin files. +Rerunning hifiasm with different Hi-C reads needs to delete these bin files +or enable +.BR -i . +.RE + +.PP +Hifiasm generates the following assembly graphs only with HiFi reads: + +.RS 2 +.TP 2 +* +.IR prefix .p_ctg.gfa: +assembly graph of primary contigs. This graph collapses different haplotypes. + +.TP +* +.IR prefix .bp.hap1.p_ctg.gfa: +balanced contig graph where each contig is partially phased. + +.TP +* +.IR prefix .bp.hap2.p_ctg.gfa: +balanced contig graph where each contig is partially phased. +.RE + +.PP +If the option +.BR -p +or +.BR --primary +is specified, hifiasm outputs: + +.RS 2 +.TP 2 +* +.IR prefix .p_ctg.gfa: +assembly graph of primary contigs. This graph collapses different haplotypes. + +.TP +* +.IR prefix .a_ctg.gfa: +assembly graph of alternate contigs. This graph consists of all assemblies that +are discarded in primary contig graph. .RE diff --git a/rcut.cpp b/rcut.cpp index 5cda882..51b5e0c 100644 --- a/rcut.cpp +++ b/rcut.cpp @@ -842,6 +842,7 @@ t_w_t mc_init_spin(const mc_opt_t *opt, const mc_match_t *ma, mc_svaux_t *b) b->cc_edge.n = 0; for (i = 0; i < b->cc_size; ++i) {///how many nodes uint32_t k = (uint32_t)ma->cc[b->cc_off + i];///node id + b->cc_node[i] = k; if(b->s[k] == 0) break; } if(i >= b->cc_size) @@ -1234,10 +1235,8 @@ uint32_t mc_solve_cc(const mc_opt_t *opt, const mc_g_t *mg, mc_svaux_t *b, uint3 { uint32_t j, k, n_iter = 0; t_w_t sc_opt = -(1<<30), sc;///problem-w - b->cc_off = cc_off, b->cc_size = cc_size; if (b->cc_size < 2) return 0; - // print_sc(opt, mg->e, b, sc_opt, (uint32_t)-1); sc_opt = mc_init_spin(opt, mg->e, b); if (b->cc_size == 2) return 0; @@ -1305,25 +1304,19 @@ void mc_init_spin_all(const mc_opt_t *opt, mc_g_t *mg, mc_svaux_t *b) void mc_solve_core(const mc_opt_t *opt, mc_g_t *mg, bubble_type* bub) { - fprintf(stderr, "#######0#######\n"); double index_time = yak_realtime(); uint32_t st, i; mc_svaux_t *b; mc_bp_t *bp = NULL; - fprintf(stderr, "#######1#######\n"); mc_g_cc(mg->e); - fprintf(stderr, "#######2#######\n"); b = mc_svaux_init(mg, opt->seed); - fprintf(stderr, "#######3#######\n"); if(bub) bp = mc_bp_t_init(mg->e, b, bub, asm_opt.thread_num); - fprintf(stderr, "#######4#######\n"); /*******************************for debug************************************/ if(bp) { mc_init_spin_all(opt, mg, b); mc_solve_bp(bp); } - fprintf(stderr, "#######5#######\n"); /*******************************for debug************************************/ // fprintf(stderr, "\n\n\n\n\n*************beg-[M::%s::score->%f] ==> Partition\n", __func__, mc_score_all(mg->e, b)); for (st = 0, i = 1; i <= mg->e->n_seq; ++i) { @@ -1333,14 +1326,10 @@ void mc_solve_core(const mc_opt_t *opt, mc_g_t *mg, bubble_type* bub) } } // fprintf(stderr, "##############end-[M::%s::score->%f] ==> Partition\n", __func__, mc_score_all(mg->e, b)); - fprintf(stderr, "#######6#######\n"); if(bp) mc_solve_bp(bp); - fprintf(stderr, "#######7#######\n"); ///mc_write_info(g, b); mc_svaux_destroy(b); - fprintf(stderr, "#######8#######\n"); if(bp) destroy_mc_bp_t(&bp); - fprintf(stderr, "#######9#######\n"); fprintf(stderr, "[M::%s::%.3f] ==> Partition\n", __func__, yak_realtime()-index_time); } @@ -1450,16 +1439,11 @@ void p_nodes(mc_g_t *mg, trans_chain* t_ch, uint8_t* trio_flag) void mc_solve(hap_overlaps_list* ovlp, trans_chain* t_ch, kv_u_trans_t *ta, ma_ug_t *ug, asg_t *read_g, double f_rate, uint8_t* trio_flag, uint32_t renew_s, int8_t *s, uint32_t is_sys, bubble_type* bub) { mc_opt_t opt; - fprintf(stderr, "*****0******\n"); mc_opt_init(&opt, asm_opt.n_perturb, asm_opt.f_perturb, asm_opt.seed); - fprintf(stderr, "*****1******\n"); mc_g_t *mg = init_mc_g_t(ug, read_g, s, renew_s); - fprintf(stderr, "*****2******\n"); update_mc_edges(mg, ovlp, ta, t_ch, f_rate, is_sys); - fprintf(stderr, "*****3******\n"); ///debug_mc_g_t(mg); mc_solve_core(&opt, mg, bub); - fprintf(stderr, "*****4******\n"); if((asm_opt.flag & HA_F_PARTITION) && t_ch) {