From 13981404e2e6ebee8c48cf63146de228ea4cf369 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Mon, 5 Nov 2018 11:43:10 -0500 Subject: [PATCH] r876: skip DP if taking too much RAM (#259) --- align.c | 5 ++++- main.c | 4 +++- minimap.h | 1 + minimap2.1 | 5 +++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/align.c b/align.c index ee4157e..25b19d0 100644 --- a/align.c +++ b/align.c @@ -300,7 +300,10 @@ static void mm_align_pair(void *km, const mm_mapopt_t *opt, int qlen, const uint for (i = 0; i < qlen; ++i) fputc("ACGTN"[qseq[i]], stderr); fputc('\n', stderr); } - if (opt->flag & MM_F_SPLICE) + if (opt->max_sw_mat > 0 && (int64_t)tlen * qlen > opt->max_sw_mat) { + ksw_reset_extz(ez); + ez->zdropped = 1; + } else if (opt->flag & MM_F_SPLICE) ksw_exts2_sse(km, qlen, qseq, tlen, tseq, 5, mat, opt->q, opt->e, opt->q2, opt->noncan, zdrop, flag, ez); else if (opt->q == opt->q2 && opt->e == opt->e2) ksw_extz2_sse(km, qlen, qseq, tlen, tseq, 5, mat, opt->q, opt->e, w, zdrop, end_bonus, flag, ez); diff --git a/main.c b/main.c index c24048b..237d8c6 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ #include "mmpriv.h" #include "ketopt.h" -#define MM_VERSION "2.13-r875-dirty" +#define MM_VERSION "2.13-r876-dirty" #ifdef __linux__ #include @@ -60,6 +60,7 @@ static ko_longopt_t long_options[] = { { "split-prefix", ko_required_argument, 334 }, { "no-end-flt", ko_no_argument, 335 }, { "hard-mask-level",ko_no_argument, 336 }, + { "cap-sw-mat", ko_required_argument, 337 }, { "help", ko_no_argument, 'h' }, { "max-intron-len", ko_required_argument, 'G' }, { "version", ko_no_argument, 'V' }, @@ -190,6 +191,7 @@ int main(int argc, char *argv[]) else if (c == 334) opt.split_prefix = o.arg; // --split-prefix else if (c == 335) opt.flag |= MM_F_NO_END_FLT; // --no-end-flt else if (c == 336) opt.flag |= MM_F_HARD_MLEVEL; // --hard-mask-level + else if (c == 337) opt.max_sw_mat = mm_parse_num(o.arg); // --cap-sw-mat else if (c == 314) { // --frag yes_or_no(&opt, MM_F_FRAG_MODE, o.longidx, o.arg, 1); } else if (c == 315) { // --secondary diff --git a/minimap.h b/minimap.h index 20328c8..652e62a 100644 --- a/minimap.h +++ b/minimap.h @@ -139,6 +139,7 @@ typedef struct { int32_t mid_occ; // ignore seeds with occurrences above this threshold int32_t max_occ; int mini_batch_size; // size of a batch of query bases to process in parallel + int64_t max_sw_mat; const char *split_prefix; } mm_mapopt_t; diff --git a/minimap2.1 b/minimap2.1 index 1d0c146..a05542e 100644 --- a/minimap2.1 +++ b/minimap2.1 @@ -373,6 +373,11 @@ It helps to avoid tiny terminal exons. [6] .B --no-end-flt Don't filter seeds towards the ends of chains before performing base-level alignment. +.TP +.BI --cap-sw-mat \ NUM +Skip alignment if the DP matrix size is above +.IR NUM . +Set 0 to disable [0]. .SS Input/output options .TP 10 .B -a