diff --git a/Assembly.cpp b/Assembly.cpp index e75b287..577978b 100644 --- a/Assembly.cpp +++ b/Assembly.cpp @@ -1156,11 +1156,13 @@ int ha_assemble(void) if (asm_opt.load_index_from_disk && load_all_data_from_disk(&R_INF.paf, &R_INF.reverse_paf, asm_opt.output_file_name)) { ovlp_loaded = 1; fprintf(stderr, "[M::%s::%.3f*%.2f] ==> loaded corrected reads and overlaps from disk\n", __func__, yak_realtime(), yak_cpu_usage()); - trio_partition(); + if (!(asm_opt.flag & HA_F_SKIP_TRIOBIN)) trio_partition(); + if (asm_opt.flag & HA_F_WRITE_EC) Output_corrected_reads(); + if (asm_opt.flag & HA_F_WRITE_PAF) Output_PAF(); } if (!ovlp_loaded) { // construct hash table for high occurrence k-mers - if (!asm_opt.no_kmer_flt) { + if (!(asm_opt.flag & HA_F_NO_KMER_FLT)) { ha_flt_tab = ha_ft_gen(&asm_opt, &R_INF, &hom_cov); ha_opt_update_cov(&asm_opt, hom_cov); } @@ -1175,7 +1177,7 @@ int ha_assemble(void) asm_opt.num_bases, asm_opt.num_corrected_bases, asm_opt.num_recorrected_bases); fprintf(stderr, "[M::%s] size of buffer: %.3fGB\n", __func__, asm_opt.mem_buf / 1073741824.0); } - //Output_corrected_reads(); + if (asm_opt.flag & HA_F_WRITE_EC) Output_corrected_reads(); fprintf(stderr, "[M::%s::%.3f*%.2f] ==> written corrected reads to disk\n", __func__, yak_realtime(), yak_cpu_usage()); // overlap between corrected reads ha_opt_reset_to_round(&asm_opt, asm_opt.number_of_round); @@ -1184,7 +1186,7 @@ int ha_assemble(void) yak_cpu_usage(), yak_peakrss_in_gb()); ha_print_ovlp_stat(R_INF.paf, R_INF.reverse_paf, R_INF.total_reads); ha_ft_destroy(ha_flt_tab); - //Output_PAF(); + if (asm_opt.flag & HA_F_WRITE_PAF) Output_PAF(); trio_partition(); } build_string_graph_without_clean(asm_opt.min_overlap_coverage, R_INF.paf, R_INF.reverse_paf, diff --git a/CommandLines.cpp b/CommandLines.cpp index ec55c95..5ff1472 100644 --- a/CommandLines.cpp +++ b/CommandLines.cpp @@ -1,9 +1,9 @@ -#include "CommandLines.h" #include #include #include -#include "ketopt.h" #include +#include "CommandLines.h" +#include "ketopt.h" #define DEFAULT_OUTPUT "hifiasm.asm" @@ -12,6 +12,9 @@ hifiasm_opt_t asm_opt; static ko_longopt_t long_options[] = { { "version", ko_no_argument, 300 }, { "dbg-gfa", ko_no_argument, 301 }, + { "write-paf", ko_no_argument, 302 }, + { "write-ec", ko_no_argument, 303 }, + { "skip-triobin", ko_no_argument, 304 }, { 0, 0, 0 } }; @@ -58,6 +61,7 @@ void Print_H(hifiasm_opt_t* asm_opt) void init_opt(hifiasm_opt_t* asm_opt) { + asm_opt->flag = 0; asm_opt->coverage = -1; asm_opt->num_reads = 0; asm_opt->read_file_names = NULL; @@ -69,8 +73,6 @@ void init_opt(hifiasm_opt_t* asm_opt) asm_opt->k_mer_length = 51; asm_opt->mz_win = 51; asm_opt->bf_shift = 37; - asm_opt->no_HPC = 0; - asm_opt->no_kmer_flt = 0; asm_opt->high_factor = 5.0f; asm_opt->max_n_chain = 100; asm_opt->k_mer_min_freq = 3; @@ -92,7 +94,6 @@ void init_opt(hifiasm_opt_t* asm_opt) asm_opt->max_short_tip = 3; asm_opt->min_cnt = 2; asm_opt->mid_cnt = 5; - asm_opt->verbose_gfa = 0; } void destory_opt(hifiasm_opt_t* asm_opt) @@ -331,7 +332,7 @@ int CommandLine_process(int argc, char *argv[], hifiasm_opt_t* asm_opt) else if (c == 'i') asm_opt->load_index_from_disk = 0; else if (c == 'w') asm_opt->mz_win = atoi(opt.arg); else if (c == 'D') asm_opt->high_factor = atof(opt.arg); - else if (c == 'F') asm_opt->no_kmer_flt = 1; + else if (c == 'F') asm_opt->flag |= HA_F_NO_KMER_FLT; else if (c == 'N') asm_opt->max_n_chain = atoi(opt.arg); else if (c == 'a') asm_opt->clean_round = atoi(opt.arg); else if (c == 'z') asm_opt->adapterLen = atoi(opt.arg); @@ -345,7 +346,10 @@ int CommandLine_process(int argc, char *argv[], hifiasm_opt_t* asm_opt) else if (c == 'p') asm_opt->small_pop_bubble_size = atoll(opt.arg); else if (c == 'm') asm_opt->large_pop_bubble_size = atoll(opt.arg); else if (c == 'n') asm_opt->max_short_tip = atoll(opt.arg); - else if (c == 301) asm_opt->verbose_gfa = 1; + else if (c == 301) asm_opt->flag |= HA_F_VERBOSE_GFA; + else if (c == 302) asm_opt->flag |= HA_F_WRITE_PAF; + else if (c == 303) asm_opt->flag |= HA_F_WRITE_EC; + else if (c == 304) asm_opt->flag |= HA_F_SKIP_TRIOBIN; else if (c == ':') { fprintf(stderr, "[ERROR] missing option argument in \"%s\"\n", argv[opt.i - 1]); diff --git a/CommandLines.h b/CommandLines.h index db3caba..14d68cd 100644 --- a/CommandLines.h +++ b/CommandLines.h @@ -3,11 +3,19 @@ #include -#define HA_VERSION "0.3.0-dirty-r207" +#define HA_VERSION "0.3.0-dirty-r211" #define VERBOSE 0 +#define HA_F_NO_HPC 0x1 +#define HA_F_NO_KMER_FLT 0x2 +#define HA_F_VERBOSE_GFA 0x4 +#define HA_F_WRITE_EC 0x8 +#define HA_F_WRITE_PAF 0x10 +#define HA_F_SKIP_TRIOBIN 0x20 + typedef struct { + int flag; int num_reads; char** read_file_names; char* output_file_name; @@ -18,8 +26,6 @@ typedef struct { int k_mer_length; int mz_win; int bf_shift; - int no_HPC; - int no_kmer_flt; float high_factor; // coverage cutoff set to high_factor*hom_cov int max_n_chain; // fall-back max number of chains to consider int k_mer_min_freq; @@ -37,7 +43,6 @@ typedef struct { int max_short_tip; int min_cnt; int mid_cnt; - int verbose_gfa; float max_hang_rate; float min_drop_rate; diff --git a/Hash_Table.cpp b/Hash_Table.cpp index 1c83cc0..82994dd 100644 --- a/Hash_Table.cpp +++ b/Hash_Table.cpp @@ -3,9 +3,6 @@ #include #include #include "Hash_Table.h" -#include "Process_Read.h" -#include "Correct.h" -#include "CommandLines.h" #include "ksort.h" pthread_mutex_t output_mutex; diff --git a/Makefile b/Makefile index 67ae5ac..1cb14d0 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ CommandLines.o: CommandLines.h ketopt.h Correct.o: Correct.h Hash_Table.h htab.h Process_Read.h Overlaps.h kvec.h Correct.o: kdq.h CommandLines.h Levenshtein_distance.h POA.h Assembly.h Hash_Table.o: Hash_Table.h htab.h Process_Read.h Overlaps.h kvec.h kdq.h -Hash_Table.o: CommandLines.h Correct.h Levenshtein_distance.h POA.h ksort.h +Hash_Table.o: CommandLines.h ksort.h Levenshtein_distance.o: Levenshtein_distance.h Output.o: Output.h CommandLines.h Overlaps.o: Overlaps.h kvec.h kdq.h ksort.h Process_Read.h CommandLines.h @@ -50,7 +50,7 @@ POA.o: CommandLines.h Correct.h Levenshtein_distance.h Process_Read.o: Process_Read.h Overlaps.h kvec.h kdq.h CommandLines.h Purge_Dups.o: ksort.h Purge_Dups.h kvec.h kdq.h Overlaps.h Hash_Table.h Purge_Dups.o: htab.h Process_Read.h CommandLines.h Correct.h -Purge_Dups.o: Levenshtein_distance.h POA.h +Purge_Dups.o: Levenshtein_distance.h POA.h kthread.h Trio.o: khashl.h kthread.h Process_Read.h Overlaps.h kvec.h kdq.h Trio.o: CommandLines.h htab.h anchor.o: htab.h Process_Read.h Overlaps.h kvec.h kdq.h CommandLines.h diff --git a/Overlaps.cpp b/Overlaps.cpp index e938e40..f1b90bf 100644 --- a/Overlaps.cpp +++ b/Overlaps.cpp @@ -26466,7 +26466,7 @@ ma_sub_t **coverage_cut_ptr, int debug_g) asg_arc_del_simple_circle_untig(sources, coverage_cut, sg, 100, 0); - if (asm_opt.verbose_gfa) + if (asm_opt.flag & HA_F_VERBOSE_GFA) { /*******************************for debug***************************************/ write_debug_graph(sg, sources, coverage_cut, output_file_name, n_read, reverse_sources, ruIndex); @@ -26545,7 +26545,7 @@ long long bubble_dist, int read_graph, int write) ///actually min_thres = asm_opt.max_short_tip + 1 there are asm_opt.max_short_tip reads min_thres = asm_opt.max_short_tip + 1; - if (asm_opt.verbose_gfa) + if (asm_opt.flag & HA_F_VERBOSE_GFA) { if(load_debug_graph(&sg, &sources, &coverage_cut, output_file_name, &reverse_sources, &ruIndex)) { diff --git a/anchor.cpp b/anchor.cpp index 3ba73cd..a46a39b 100644 --- a/anchor.cpp +++ b/anchor.cpp @@ -62,7 +62,7 @@ void ha_get_new_candidates(ha_abuf_t *ab, int64_t rid, UC_Read *ucr, overlap_reg ab->mz.n = 0, ab->n_a = 0; // get the list of anchors - ha_sketch(ucr->seq, ucr->length, asm_opt.mz_win, asm_opt.k_mer_length, 0, !asm_opt.no_HPC, &ab->mz, ha_flt_tab); + ha_sketch(ucr->seq, ucr->length, asm_opt.mz_win, asm_opt.k_mer_length, 0, !(asm_opt.flag & HA_F_NO_HPC), &ab->mz, ha_flt_tab); if (ab->mz.m > ab->old_mz_m) { ab->old_mz_m = ab->mz.m; REALLOC(ab->seed, ab->old_mz_m); diff --git a/htab.cpp b/htab.cpp index 0be5e80..0c44400 100644 --- a/htab.cpp +++ b/htab.cpp @@ -721,7 +721,7 @@ ha_ct_t *ha_count(const hifiasm_opt_t *asm_opt, int flag, ha_pt_t *p0, const voi } yak_copt_init(&opt); opt.k = asm_opt->k_mer_length; - opt.is_HPC = !asm_opt->no_HPC; + opt.is_HPC = !(asm_opt->flag&HA_F_NO_HPC); opt.w = flag & HAF_COUNT_ALL? 1 : asm_opt->mz_win; opt.bf_shift = flag & HAF_COUNT_EXACT? 0 : asm_opt->bf_shift; opt.n_thread = asm_opt->thread_num;