bug fixed

This commit is contained in:
chhylp123
2021-04-17 00:31:19 -04:00
parent efacf8e796
commit 4bc43cec92
3 changed files with 88 additions and 42 deletions
+4 -4
View File
@@ -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) 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; ma_ug_t *bub_ug = bub->b_ug;
asg_t *bsg = bub->b_g; asg_t *bsg = bub->b_g;
uint32_t k, i, v, n_vx, new_bub; 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); 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); ///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) 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); 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); update_trans_g(idx, &k_trans, &bub);
/*******************************for debug************************************/ /*******************************for debug************************************/
mc_solve(NULL, NULL, &k_trans, idx->ug, idx->read_g, 0.8, R_INF.trio_flag, 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************************************/ /*******************************for debug************************************/
label_unitigs_sm(s->s, idx->ug); label_unitigs_sm(s->s, idx->ug);
/** /**
+83 -21
View File
@@ -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 .SH NAME
.PP .PP
@@ -349,11 +349,7 @@ RNG seed [11].
.SH OUTPUTS .SH OUTPUTS
.PP .PP
Without trio partition options In general, hifiasm generates the following assembly graphs in the GFA format:
.B -1
and
.BR -2 ,
hifiasm generates the following assembly graphs in the GFA format:
.RS 2 .RS 2
.TP 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 assembly graph of alternate contigs. This graph consists of all assemblies that
are discarded in primary contig graph. are discarded in primary contig graph.
.TP
*
.IR prefix .hap*.p_ctg.gfa:
phased contig graph. This graph keeps the phased assembly.
.RE .RE
.PP .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 .RS 2
.TP 2 .TP 2
* *
.IR prefix .dip.r_utg.gfa: .IR prefix .dip.hap1.p_ctg.gfa:
haplotype-resolved raw unitig graph. This graph keeps all haplotype information. phased paternal/haplotype1 contig graph keeping the phased
.TP
*
.IR prefix .hap1.p_ctg.gfa:
phased paternal/haplotype1 contig graph. This graph keeps the phased
paternal/haplotype1 assembly. paternal/haplotype1 assembly.
.TP .TP
* *
.IR prefix .hap2.p_ctg.gfa: .IR prefix .dip.hap2.p_ctg.gfa:
phased maternal/haplotype2 contig graph. This graph keeps the phased phased maternal/haplotype2 contig graph keeping the phased
maternal/haplotype2 assembly. maternal/haplotype2 assembly.
.RE .RE
.PP .PP
With Hi-C partition, hifiasm outputs the assembly graphs like trio partition, With Hi-C partition options, hifiasm outputs:
but with additional prefix
.B [hic]. .RS 2
In this mode, hifiasm keeps Hi-C alignment results and Hi-C index in two bin .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: files:
.B *hic.lk.bin .B *hic.lk.bin
and and
.B *hic.tlb.bin. .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 .RE
+1 -17
View File
@@ -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; b->cc_edge.n = 0;
for (i = 0; i < b->cc_size; ++i) {///how many nodes for (i = 0; i < b->cc_size; ++i) {///how many nodes
uint32_t k = (uint32_t)ma->cc[b->cc_off + i];///node id 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(b->s[k] == 0) break;
} }
if(i >= b->cc_size) 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; uint32_t j, k, n_iter = 0;
t_w_t sc_opt = -(1<<30), sc;///problem-w t_w_t sc_opt = -(1<<30), sc;///problem-w
b->cc_off = cc_off, b->cc_size = cc_size; b->cc_off = cc_off, b->cc_size = cc_size;
if (b->cc_size < 2) return 0; if (b->cc_size < 2) return 0;
// print_sc(opt, mg->e, b, sc_opt, (uint32_t)-1); // print_sc(opt, mg->e, b, sc_opt, (uint32_t)-1);
sc_opt = mc_init_spin(opt, mg->e, b); sc_opt = mc_init_spin(opt, mg->e, b);
if (b->cc_size == 2) return 0; 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) 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(); double index_time = yak_realtime();
uint32_t st, i; uint32_t st, i;
mc_svaux_t *b; mc_svaux_t *b;
mc_bp_t *bp = NULL; mc_bp_t *bp = NULL;
fprintf(stderr, "#######1#######\n");
mc_g_cc(mg->e); mc_g_cc(mg->e);
fprintf(stderr, "#######2#######\n");
b = mc_svaux_init(mg, opt->seed); 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); if(bub) bp = mc_bp_t_init(mg->e, b, bub, asm_opt.thread_num);
fprintf(stderr, "#######4#######\n");
/*******************************for debug************************************/ /*******************************for debug************************************/
if(bp) if(bp)
{ {
mc_init_spin_all(opt, mg, b); mc_init_spin_all(opt, mg, b);
mc_solve_bp(bp); mc_solve_bp(bp);
} }
fprintf(stderr, "#######5#######\n");
/*******************************for debug************************************/ /*******************************for debug************************************/
// fprintf(stderr, "\n\n\n\n\n*************beg-[M::%s::score->%f] ==> Partition\n", __func__, mc_score_all(mg->e, b)); // 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) { 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, "##############end-[M::%s::score->%f] ==> Partition\n", __func__, mc_score_all(mg->e, b));
fprintf(stderr, "#######6#######\n");
if(bp) mc_solve_bp(bp); if(bp) mc_solve_bp(bp);
fprintf(stderr, "#######7#######\n");
///mc_write_info(g, b); ///mc_write_info(g, b);
mc_svaux_destroy(b); mc_svaux_destroy(b);
fprintf(stderr, "#######8#######\n");
if(bp) destroy_mc_bp_t(&bp); if(bp) destroy_mc_bp_t(&bp);
fprintf(stderr, "#######9#######\n");
fprintf(stderr, "[M::%s::%.3f] ==> Partition\n", __func__, yak_realtime()-index_time); 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) 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; mc_opt_t opt;
fprintf(stderr, "*****0******\n");
mc_opt_init(&opt, asm_opt.n_perturb, asm_opt.f_perturb, asm_opt.seed); 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); 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); update_mc_edges(mg, ovlp, ta, t_ch, f_rate, is_sys);
fprintf(stderr, "*****3******\n");
///debug_mc_g_t(mg); ///debug_mc_g_t(mg);
mc_solve_core(&opt, mg, bub); mc_solve_core(&opt, mg, bub);
fprintf(stderr, "*****4******\n");
if((asm_opt.flag & HA_F_PARTITION) && t_ch) if((asm_opt.flag & HA_F_PARTITION) && t_ch)
{ {