command-line option to control CIGAR output

This commit is contained in:
Heng Li 2017-06-26 11:41:09 -04:00
parent 24d7f7f8b1
commit 640b1a1727
3 changed files with 10 additions and 5 deletions

9
main.c
View File

@ -9,7 +9,7 @@
#include "minimap.h" #include "minimap.h"
#include "mmpriv.h" #include "mmpriv.h"
#define MM_VERSION "2.0-r36-pre" #define MM_VERSION "2.0-r74-pre"
void liftrlimit() void liftrlimit()
{ {
@ -54,7 +54,7 @@ int main(int argc, char *argv[])
mm_realtime0 = realtime(); mm_realtime0 = realtime();
mm_mapopt_init(&opt); mm_mapopt_init(&opt);
while ((c = getopt(argc, argv, "w:k:B:b:t:r:f:Vv:Ng:I:d:ST:s:Dx:Hp:m:z:F:")) >= 0) { while ((c = getopt(argc, argv, "w:k:B:b:t:r:f:Vv:Ng:I:d:ST:s:Dx:Hcp:m:z:F:")) >= 0) {
if (c == 'w') w = atoi(optarg); if (c == 'w') w = atoi(optarg);
else if (c == 'k') k = atoi(optarg); else if (c == 'k') k = atoi(optarg);
else if (c == 'b') b = atoi(optarg); else if (c == 'b') b = atoi(optarg);
@ -68,6 +68,7 @@ int main(int argc, char *argv[])
else if (c == 'N') keep_name = 0; else if (c == 'N') keep_name = 0;
else if (c == 'p') opt.pri_ratio = atof(optarg); else if (c == 'p') opt.pri_ratio = atof(optarg);
else if (c == 'm') opt.mask_level = atof(optarg); else if (c == 'm') opt.mask_level = atof(optarg);
else if (c == 'c') opt.flag |= MM_F_CIGAR;
else if (c == 'D') opt.flag |= MM_F_NO_SELF; else if (c == 'D') opt.flag |= MM_F_NO_SELF;
else if (c == 'S') opt.flag |= MM_F_AVA | MM_F_NO_SELF; else if (c == 'S') opt.flag |= MM_F_AVA | MM_F_NO_SELF;
else if (c == 'T') opt.sdust_thres = atoi(optarg); else if (c == 'T') opt.sdust_thres = atoi(optarg);
@ -86,7 +87,7 @@ int main(int argc, char *argv[])
if (c == 'B') mini_batch_size = (uint64_t)(x + .499); if (c == 'B') mini_batch_size = (uint64_t)(x + .499);
else batch_size = (uint64_t)(x + .499); else batch_size = (uint64_t)(x + .499);
} else if (c == 'F') { } else if (c == 'F') {
if (strcmp(optarg, "sam") == 0) opt.flag |= MM_F_OUT_SAM; if (strcmp(optarg, "sam") == 0) opt.flag |= MM_F_OUT_SAM | MM_F_CIGAR;
else if (strcmp(optarg, "paf") == 0) opt.flag &= ~MM_F_OUT_SAM; else if (strcmp(optarg, "paf") == 0) opt.flag &= ~MM_F_OUT_SAM;
else { else {
fprintf(stderr, "[E::%s] unknown output format '%s'\n", __func__, optarg); fprintf(stderr, "[E::%s] unknown output format '%s'\n", __func__, optarg);
@ -125,6 +126,8 @@ int main(int argc, char *argv[])
fprintf(stderr, " -x STR preset (recommended to be applied before other options) []\n"); fprintf(stderr, " -x STR preset (recommended to be applied before other options) []\n");
fprintf(stderr, " ava10k: -Sw5 -L100 -m0 (PacBio/ONT all-vs-all read mapping)\n"); fprintf(stderr, " ava10k: -Sw5 -L100 -m0 (PacBio/ONT all-vs-all read mapping)\n");
fprintf(stderr, " Input/Output:\n"); fprintf(stderr, " Input/Output:\n");
fprintf(stderr, " -F STR output format: sam or paf [paf]\n");
fprintf(stderr, " -c output CIGAR in PAF\n");
fprintf(stderr, " -t INT number of threads [%d]\n", n_threads); fprintf(stderr, " -t INT number of threads [%d]\n", n_threads);
// fprintf(stderr, " -B NUM process ~NUM bp in each mini-batch [100M]\n"); // fprintf(stderr, " -B NUM process ~NUM bp in each mini-batch [100M]\n");
// fprintf(stderr, " -v INT verbose level [%d]\n", mm_verbose); // fprintf(stderr, " -v INT verbose level [%d]\n", mm_verbose);

3
map.c
View File

@ -290,7 +290,8 @@ mm_reg1_t *mm_map_frag(const mm_mapopt_t *opt, const mm_idx_t *mi, mm_tbuf_t *b,
regs = mm_gen_reg(qlen, n_u, u, a); regs = mm_gen_reg(qlen, n_u, u, a);
*n_regs = n_u; *n_regs = n_u;
mm_select_sub(opt->mask_level, opt->pri_ratio, n_regs, regs, b->km); mm_select_sub(opt->mask_level, opt->pri_ratio, n_regs, regs, b->km);
regs = mm_align_skeleton(b->km, opt, mi, qlen, seq, n_regs, regs, a); if (opt->flag & MM_F_CIGAR)
regs = mm_align_skeleton(b->km, opt, mi, qlen, seq, n_regs, regs, a);
// free // free
kfree(b->km, a); kfree(b->km, a);

View File

@ -9,7 +9,8 @@
#define MM_F_NO_SELF 0x01 #define MM_F_NO_SELF 0x01
#define MM_F_AVA 0x02 #define MM_F_AVA 0x02
#define MM_F_OUT_SAM 0x04 #define MM_F_CIGAR 0x04
#define MM_F_OUT_SAM 0x08
#define MM_IDX_MAGIC "MMI\2" #define MM_IDX_MAGIC "MMI\2"