path-max and path-min to avoid misassemblies

This commit is contained in:
chhylp123
2023-03-13 11:13:57 -04:00
parent 3407c7029e
commit f67faa9c34
4 changed files with 34 additions and 9 deletions
+13
View File
@@ -58,6 +58,9 @@ static ko_longopt_t long_options[] = {
{ "prt-raw", ko_no_argument, 343},
{ "integer-correct", ko_required_argument, 344},
{ "dbg-ovec", ko_no_argument, 345},
{ "path-max", ko_required_argument, 346},
{ "path-min", ko_required_argument, 347},
// { "path-round", ko_required_argument, 348},
{ 0, 0, 0 }
};
@@ -160,6 +163,12 @@ void Print_H(hifiasm_opt_t* asm_opt)
fprintf(stderr, " error rate of Ultra-Long reads [%.3g]\n", asm_opt->ul_error_rate);
fprintf(stderr, " --ul-tip INT\n");
fprintf(stderr, " remove tip unitigs composed of <=INT reads for the UL assembly [%d]\n", asm_opt->max_short_ul_tip);
fprintf(stderr, " --path-max FLOAT\n");
fprintf(stderr, " max path drop ratio [%.2g]; higher number may make the assembly cleaner\n", asm_opt->max_path_drop_rate);
fprintf(stderr, " but may lead to more misassemblies\n");
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, " --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");
@@ -271,6 +280,8 @@ void init_opt(hifiasm_opt_t* asm_opt)
asm_opt->prt_dbg_gfa = 0;
asm_opt->integer_correct_round = 0;
asm_opt->dbg_ovec_cal = 0;
asm_opt->min_path_drop_rate = 0.2;
asm_opt->max_path_drop_rate = 0.6;
}
void destory_enzyme(enzyme* f)
@@ -807,6 +818,8 @@ int CommandLine_process(int argc, char *argv[], hifiasm_opt_t* asm_opt)
else if (c == 343) asm_opt->prt_dbg_gfa = 1;
else if (c == 344) asm_opt->integer_correct_round = atol(opt.arg);
else if (c == 345) asm_opt->dbg_ovec_cal = 1;
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 == 'l') { ///0: disable purge_dup; 1: purge containment; 2: purge overlap
asm_opt->purge_level_primary = asm_opt->purge_level_trio = atoi(opt.arg);
}
+4 -1
View File
@@ -5,7 +5,7 @@
#include <pthread.h>
#include <stdint.h>
#define HA_VERSION "0.19.0-r558"
#define HA_VERSION "0.19.1-r559"
#define VERBOSE 0
@@ -104,6 +104,9 @@ typedef struct {
float purge_simi_thres;
float trans_base_rate;
float trans_base_rate_sec;
float min_path_drop_rate;
float max_path_drop_rate;
// uint64_t path_clean_round;
///float purge_simi_rate_hic;
+9
View File
@@ -34019,6 +34019,15 @@ ma_sub_t **coverage_cut_ptr, int debug_g)
output_contig_graph_primary_pre(sg, coverage_cut, o_file, sources, reverse_sources,
asm_opt.small_pop_bubble_size, asm_opt.max_short_tip, ruIndex, max_hang_length, mini_overlap_length, &uopt);
// if(asm_opt.ar) {
// char *op_file = get_outfile_name(o_file);
// ul_clean_gfa(&uopt, sg, sources, reverse_sources, ruIndex, clean_round, min_ovlp_drop_ratio, max_ovlp_drop_ratio,
// 0.6, asm_opt.max_short_tip, gap_fuzz, &b_mask_t, 0/**!!asm_opt.ar**/, ha_opt_triobin(&asm_opt), UL_COV_THRES, op_file);
// output_contig_graph_primary_pre(sg, coverage_cut, op_file, sources, reverse_sources,
// asm_opt.small_pop_bubble_size, asm_opt.max_short_tip, ruIndex, max_hang_length, mini_overlap_length, &uopt);
// free(op_file);
// }
/**
if (asm_opt.flag & HA_F_VERBOSE_GFA)
{
+8 -8
View File
@@ -15934,11 +15934,11 @@ void u2g_clean(ul_resolve_t *uidx, ulg_opt_t *ulopt, uint32_t keep_raw_utg, uint
// char sb[1000];
// output_integer_graph(uidx, iug, "ig_h0", 0);
// fprintf(stderr, "\n[M::%s::] max_path_drop_ratio::%f, min_path_drop_ratio::%f\n", __func__, ulopt->max_path_drop_ratio, ulopt->min_path_drop_ratio);
for (ss = 0; ss < 2; ss++) {
for (i = 0, drop = ulopt->min_path_drop_ratio; i < ulopt->clean_round; i++, drop += step) {
if(drop > ulopt->max_path_drop_ratio) drop = ulopt->max_path_drop_ratio;
// fprintf(stderr, "\n[M::%s::] Starting round-%ld, drop::%f\n", __func__, i, drop);
// fprintf(stderr, "[M::%s::] Starting round-%ld, drop::%f\n", __func__, i, drop);
cnt = 1; topo_level = 2; mm_tip = ulopt->max_tip;
while (cnt) {
cnt = 0;
@@ -17246,11 +17246,11 @@ ul_renew_t *ropt, const char *bin_file, uint64_t free_uld, uint64_t is_bridg, ui
// fprintf(stderr, "2[M::%s]\n", __func__);
// exit(1);
char* gfa_name = NULL; MALLOC(gfa_name, strlen(o_file)+strlen(bin_file)+50);
sprintf(gfa_name, "%s.%s", o_file, bin_file);
print_debug_gfa(sg, init_ug, uopt->coverage_cut, gfa_name, uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 0, 0, 0);
print_debug_gfa(sg, init_ug, uopt->coverage_cut, gfa_name, uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 0, 0, 1);
free(gfa_name);
// char* gfa_name = NULL; MALLOC(gfa_name, strlen(o_file)+strlen(bin_file)+50);
// sprintf(gfa_name, "%s.%s", o_file, bin_file);
// print_debug_gfa(sg, init_ug, uopt->coverage_cut, gfa_name, uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 0, 0, 0);
// print_debug_gfa(sg, init_ug, uopt->coverage_cut, gfa_name, uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 0, 0, 1);
// free(gfa_name);
filter_sg_by_ug(sg, init_ug, uopt);
@@ -17274,7 +17274,7 @@ ul_renew_t *ropt, const char *bin_file, uint64_t free_uld, uint64_t is_bridg, ui
// }
ul_re_correct(uidx, asm_opt.integer_correct_round/**3**/);
init_ulg_opt_t(&uu, uopt, clean_round, 0.2, 0.6, min_ovlp_drop_ratio, max_ovlp_drop_ratio, 0.55, max_tip, max_ul_tip, b_mask_t, is_trio);
init_ulg_opt_t(&uu, uopt, clean_round, asm_opt.min_path_drop_rate, asm_opt.max_path_drop_rate, min_ovlp_drop_ratio, max_ovlp_drop_ratio, 0.55, max_tip, max_ul_tip, b_mask_t, is_trio);
// print_debug_gfa(sg, init_ug, uopt->coverage_cut, "UL.debug0", uopt->sources, uopt->ruIndex, uopt->max_hang, uopt->min_ovlp, 0, 0, 1);
/**ul2ul_idx_t *u2o = **/gen_ul2ul(uidx, uopt, &uu, 0, is_bridg);
// print_ul_alignment(init_ug, &UL_INF, 47072, "after-3");