diff --git a/main.c b/main.c index c7c152a..56d2afc 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ #include "mmpriv.h" #include "getopt.h" -#define MM_VERSION "2.2-r462-dirty" +#define MM_VERSION "2.2-r463-dirty" #ifdef __linux__ #include @@ -40,6 +40,7 @@ static struct option long_options[] = { { "multi", optional_argument, 0, 0 }, { "no-long-join", no_argument, 0, 0 }, { "seed", required_argument, 0, 0 }, + { "print-2nd", optional_argument, 0, 0 }, { "help", no_argument, 0, 'h' }, { "max-intron-len", required_argument, 0, 'G' }, { "version", no_argument, 0, 'V' }, @@ -124,6 +125,10 @@ int main(int argc, char *argv[]) if (optarg == 0 || strcmp(optarg, "yes") == 0 || strcmp(optarg, "y") == 0) opt.flag |= MM_F_MULTI_SEG; else opt.flag &= ~MM_F_MULTI_SEG; + } else if (c == 0 && long_idx ==17) { // --print-2nd + if (optarg == 0 || strcmp(optarg, "yes") == 0 || strcmp(optarg, "y") == 0) + opt.flag &= ~MM_F_NO_PRINT_2ND; + else opt.flag |= MM_F_NO_PRINT_2ND; } else if (c == 'V') { puts(MM_VERSION); return 0; diff --git a/map.c b/map.c index b6ea3d8..3a9e3a0 100644 --- a/map.c +++ b/map.c @@ -80,7 +80,7 @@ int mm_set_opt(const char *preset, mm_idxopt_t *io, mm_mapopt_t *mo) mo->min_dp_max = 200; } else if (strcmp(preset, "short") == 0 || strcmp(preset, "sr") == 0) { io->is_hpc = 0, io->k = 21, io->w = 11; - mo->flag |= MM_F_SR | MM_F_MULTI_SEG; + mo->flag |= MM_F_SR | MM_F_MULTI_SEG | MM_F_NO_PRINT_2ND; mo->pe_ori = 0<<1|1; // FR mo->a = 2, mo->b = 8, mo->q = 12, mo->e = 2, mo->q2 = 32, mo->e2 = 1; mo->max_gap = 200; @@ -452,6 +452,9 @@ static void *worker_pipeline(void *shared, int step, void *in) mm_bseq1_t *t = &s->seq[i]; for (j = 0; j < s->n_reg[i]; ++j) { mm_reg1_t *r = &s->reg[i][j]; + assert(!r->sam_pri || r->id == r->parent); + if ((p->opt->flag & MM_F_NO_PRINT_2ND) && r->id != r->parent) + continue; if (p->opt->flag & MM_F_OUT_SAM) mm_write_sam(&p->str, mi, t, r, s->n_reg[i], s->reg[i]); else diff --git a/minimap.h b/minimap.h index ef93024..51a0742 100644 --- a/minimap.h +++ b/minimap.h @@ -19,6 +19,7 @@ #define MM_F_NO_SAM_SQ 0x800 #define MM_F_SR 0x1000 #define MM_F_MULTI_SEG 0x2000 +#define MM_F_NO_PRINT_2ND 0x4000 #define MM_IDX_MAGIC "MMI\2"