diff --git a/main.c b/main.c index 9d11102c..d9de40da 100644 --- a/main.c +++ b/main.c @@ -65,6 +65,7 @@ static ko_longopt_t long_options[] = { { "max-chain-iter", ko_required_argument, 339 }, { "junc-bed", ko_required_argument, 340 }, { "junc-bonus", ko_required_argument, 341 }, + { "sam-hit-only", ko_no_argument, 342 }, { "help", ko_no_argument, 'h' }, { "max-intron-len", ko_required_argument, 'G' }, { "version", ko_no_argument, 'V' }, @@ -207,6 +208,7 @@ int main(int argc, char *argv[]) else if (c == 337) opt.max_sw_mat = mm_parse_num(o.arg); // --cap-sw-mat else if (c == 338) opt.max_qlen = mm_parse_num(o.arg); // --max-qlen else if (c == 340) junc_bed = o.arg; // --junc-bed + else if (c == 342) opt.flag |= MM_F_SAM_HIT_ONLY; // --sam-hit-only 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/map.c b/map.c index 41de91e0..3a800a16 100644 --- a/map.c +++ b/map.c @@ -589,7 +589,7 @@ static void *worker_pipeline(void *shared, int step, void *in) mm_write_paf3(&p->str, mi, t, r, km, p->opt->flag, s->rep_len[i]); mm_err_puts(p->str.s); } - } else if (p->opt->flag & (MM_F_OUT_SAM|MM_F_PAF_NO_HIT)) { // output an empty hit, if requested + } else if (p->opt->flag & ((MM_F_OUT_SAM&!MM_F_SAM_HIT_ONLY)|MM_F_PAF_NO_HIT)) { // output an empty hit, if requested if (p->opt->flag & MM_F_OUT_SAM) mm_write_sam3(&p->str, mi, t, i - seg_st, -1, s->n_seg[k], &s->n_reg[seg_st], (const mm_reg1_t*const*)&s->reg[seg_st], km, p->opt->flag, s->rep_len[i]); else diff --git a/minimap.h b/minimap.h index 993b008a..ac00f584 100644 --- a/minimap.h +++ b/minimap.h @@ -33,8 +33,9 @@ #define MM_F_COPY_COMMENT 0x2000000 #define MM_F_EQX 0x4000000 // use =/X instead of M #define MM_F_PAF_NO_HIT 0x8000000 // output unmapped reads to PAF -#define MM_F_NO_END_FLT 0x10000000 -#define MM_F_HARD_MLEVEL 0x20000000 +#define MM_F_SAM_HIT_ONLY 0x10000000 // output only mapped reads to SAM +#define MM_F_NO_END_FLT 0x20000000 +#define MM_F_HARD_MLEVEL 0x40000000 #define MM_I_HPC 0x1 #define MM_I_NO_SEQ 0x2 diff --git a/minimap2.1 b/minimap2.1 index 99cab5c2..a136fc0c 100644 --- a/minimap2.1 +++ b/minimap2.1 @@ -489,6 +489,9 @@ In PAF, output unmapped queries; the strand and the reference name fields are set to `*'. Warning: some paftools.js commands may not work with such output for the moment. .TP +.B --sam-hit-only +In SAM, only output mapped queries. +.TP .B --version Print version number to stdout .SS Preset options