From ae2adf04d4d73c59898ac8c7f01f2f68773176b0 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Thu, 5 Oct 2017 15:39:26 -0400 Subject: [PATCH] r476: multi-file fragment mode working --- main.c | 13 ++++++++----- map.c | 1 + minimap.h | 2 ++ minimap2.1 | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 9088a29..197653d 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ #include "mmpriv.h" #include "getopt.h" -#define MM_VERSION "2.2-r475-dirty" +#define MM_VERSION "2.2-r476-dirty" #ifdef __linux__ #include @@ -37,7 +37,7 @@ static struct option long_options[] = { { "cost-non-gt-ag", required_argument, 0, 0 }, { "no-long-join", no_argument, 0, 0 }, { "sr", no_argument, 0, 0 }, - { "multi", optional_argument, 0, 0 }, + { "frag", optional_argument, 0, 0 }, { "print-2nd", optional_argument, 0, 0 }, { "cs", optional_argument, 0, 0 }, { "help", no_argument, 0, 'h' }, @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) else if (c == 0 && long_idx ==11) opt.noncan = atoi(optarg); // --cost-non-gt-ag else if (c == 0 && long_idx ==12) opt.flag |= MM_F_NO_LJOIN; // --no-long-join else if (c == 0 && long_idx ==13) opt.flag |= MM_F_SR; // --sr - else if (c == 0 && long_idx == 14) { // --multi + else if (c == 0 && long_idx == 14) { // --frag if (optarg == 0 || strcmp(optarg, "yes") == 0 || strcmp(optarg, "y") == 0) opt.flag |= MM_F_MULTI_SEG; else opt.flag &= ~MM_F_MULTI_SEG; @@ -267,8 +267,11 @@ int main(int argc, char *argv[]) __func__, realtime() - mm_realtime0, cputime() / (realtime() - mm_realtime0), mi->n_seq); if (argc != optind + 1) mm_mapopt_update(&opt, mi); if (mm_verbose >= 3) mm_idx_stat(mi); - for (i = optind + 1; i < argc; ++i) - mm_map_file(mi, argv[i], &opt, n_threads); + if (opt.flag & MM_F_MULTI_SEG) + mm_map_file_multi_seg(mi, argc - (optind + 1), (const char**)&argv[optind + 1], &opt, n_threads); + else + for (i = optind + 1; i < argc; ++i) + mm_map_file(mi, argv[i], &opt, n_threads); mm_idx_destroy(mi); } mm_idx_reader_close(idx_rdr); diff --git a/map.c b/map.c index a8a1ed0..595214d 100644 --- a/map.c +++ b/map.c @@ -490,6 +490,7 @@ int mm_map_file_multi_seg(const mm_idx_t *idx, int n_segs, const char **fn, cons pipeline_t pl; if (n_segs < 1) return -1; memset(&pl, 0, sizeof(pipeline_t)); + pl.n_fp = n_segs; pl.fp = (mm_bseq_file_t**)calloc(n_segs, sizeof(mm_bseq_file_t*)); for (i = 0; i < n_segs; ++i) { pl.fp[i] = mm_bseq_open(fn[i]); diff --git a/minimap.h b/minimap.h index aa7a098..eb11282 100644 --- a/minimap.h +++ b/minimap.h @@ -258,6 +258,8 @@ mm_reg1_t *mm_map(const mm_idx_t *mi, int l_seq, const char *seq, int *n_regs, m */ int mm_map_file(const mm_idx_t *idx, const char *fn, const mm_mapopt_t *opt, int n_threads); +int mm_map_file_multi_seg(const mm_idx_t *idx, int n_segs, const char **fn, const mm_mapopt_t *opt, int n_threads); + // deprecated APIs for backward compatibility void mm_mapopt_init(mm_mapopt_t *opt); mm_idx_t *mm_idx_build(const char *fn, int w, int k, int is_hpc, int n_threads); diff --git a/minimap2.1 b/minimap2.1 index 4cea3f7..b914413 100644 --- a/minimap2.1 +++ b/minimap2.1 @@ -348,7 +348,7 @@ tag ignores introns to demote hits to pseudogenes. Short single-end reads without splicing .RB ( -k21 .B -w11 -A2 -B8 -O12,32 -E2,1 -r50 -p.5 -N20 -f1000,5000 -n2 -m20 -s40 -g200 -.B -K50m --multi +.B -K50m --frag .BR --sr ). .RE .SS Miscellaneous options