66#include "mmpriv.h"
77#include "getopt.h"
88
9- #define MM_VERSION "2.7-r670 -dirty"
9+ #define MM_VERSION "2.7-r671 -dirty"
1010
1111#ifdef __linux__
1212#include <sys/resource.h>
@@ -28,7 +28,7 @@ static struct option long_options[] = {
2828 { "seed" , required_argument , 0 , 0 },
2929 { "no-kalloc" , no_argument , 0 , 0 },
3030 { "print-qname" , no_argument , 0 , 0 },
31- { "no-self" , no_argument , 0 , 0 },
31+ { "no-self" , no_argument , 0 , 'D' },
3232 { "print-seeds" , no_argument , 0 , 0 },
3333 { "max-chain-skip" , required_argument , 0 , 0 },
3434 { "min-dp-len" , required_argument , 0 , 0 },
@@ -37,17 +37,19 @@ static struct option long_options[] = {
3737 { "cost-non-gt-ag" , required_argument , 0 , 'C' },
3838 { "no-long-join" , no_argument , 0 , 0 },
3939 { "sr" , no_argument , 0 , 0 },
40- { "frag" , optional_argument , 0 , 0 },
41- { "secondary" , optional_argument , 0 , 0 },
40+ { "frag" , required_argument , 0 , 0 },
41+ { "secondary" , required_argument , 0 , 0 },
4242 { "cs" , optional_argument , 0 , 0 },
4343 { "end-bonus" , required_argument , 0 , 0 },
4444 { "no-pairing" , no_argument , 0 , 0 },
45- { "splice-flank" , optional_argument , 0 , 0 },
45+ { "splice-flank" , required_argument , 0 , 0 },
4646 { "idx-no-seq" , no_argument , 0 , 0 },
4747 { "end-seed-pen" , required_argument , 0 , 0 }, // 21
4848 { "for-only" , no_argument , 0 , 0 }, // 22
4949 { "rev-only" , no_argument , 0 , 0 }, // 23
50- { "heap-sort" , optional_argument , 0 , 0 }, // 24
50+ { "heap-sort" , required_argument , 0 , 0 }, // 24
51+ { "all-chain" , no_argument , 0 , 'P' },
52+ { "dual" , required_argument , 0 , 0 }, // 26
5153 { "help" , no_argument , 0 , 'h' },
5254 { "max-intron-len" , required_argument , 0 , 'G' },
5355 { "version" , no_argument , 0 , 'V' },
@@ -70,9 +72,22 @@ static inline int64_t mm_parse_num(const char *str)
7072 return (int64_t )(x + .499 );
7173}
7274
75+ static inline void yes_or_no (mm_mapopt_t * opt , int flag , int long_idx , const char * arg , int yes_to_set )
76+ {
77+ if (yes_to_set ) {
78+ if (strcmp (arg , "yes" ) == 0 || strcmp (arg , "y" ) == 0 ) opt -> flag |= flag ;
79+ else if (strcmp (arg , "no" ) == 0 || strcmp (arg , "n" ) == 0 ) opt -> flag &= ~flag ;
80+ else fprintf (stderr , "[WARNING]\033[1;31m option '--%s' only accepts 'yes' or 'no'.\033[0m\n" , long_options [long_idx ].name );
81+ } else {
82+ if (strcmp (arg , "yes" ) == 0 || strcmp (arg , "y" ) == 0 ) opt -> flag &= ~flag ;
83+ else if (strcmp (arg , "no" ) == 0 || strcmp (arg , "n" ) == 0 ) opt -> flag |= flag ;
84+ else fprintf (stderr , "[WARNING]\033[1;31m option '--%s' only accepts 'yes' or 'no'.\033[0m\n" , long_options [long_idx ].name );
85+ }
86+ }
87+
7388int main (int argc , char * argv [])
7489{
75- const char * opt_str = "2aSw :k:K:t:r:f:Vv:g:G:I:d:XT:s:x:Hcp:M:n:z:A:B:O:E:m:N:Qu:R:hF:LC:" ;
90+ const char * opt_str = "2aSDw :k:K:t:r:f:Vv:g:G:I:d:XT:s:x:Hcp:M:n:z:A:B:O:E:m:N:Qu:R:hF:LC:" ;
7691 mm_mapopt_t opt ;
7792 mm_idxopt_t ipt ;
7893 int i , c , n_threads = 3 , long_idx ;
@@ -111,7 +126,9 @@ int main(int argc, char *argv[])
111126 else if (c == 'p' ) opt .pri_ratio = atof (optarg );
112127 else if (c == 'M' ) opt .mask_level = atof (optarg );
113128 else if (c == 'c' ) opt .flag |= MM_F_OUT_CG | MM_F_CIGAR ;
114- else if (c == 'X' ) opt .flag |= MM_F_AVA | MM_F_NO_SELF ;
129+ else if (c == 'D' ) opt .flag |= MM_F_NO_DIAG ;
130+ else if (c == 'P' ) opt .flag |= MM_F_ALL_CHAINS ;
131+ else if (c == 'X' ) opt .flag |= MM_F_ALL_CHAINS | MM_F_NO_DIAG | MM_F_NO_DUAL | MM_F_NO_LJOIN ; // -D -P --no-long-join --dual=no
115132 else if (c == 'a' ) opt .flag |= MM_F_OUT_SAM | MM_F_CIGAR ;
116133 else if (c == 'Q' ) opt .flag |= MM_F_NO_QUAL ;
117134 else if (c == 'Y' ) opt .flag |= MM_F_SOFTCLIP ;
@@ -133,7 +150,6 @@ int main(int argc, char *argv[])
133150 else if (c == 0 && long_idx == 2 ) opt .seed = atoi (optarg ); // --seed
134151 else if (c == 0 && long_idx == 3 ) mm_dbg_flag |= MM_DBG_NO_KALLOC ; // --no-kalloc
135152 else if (c == 0 && long_idx == 4 ) mm_dbg_flag |= MM_DBG_PRINT_QNAME ; // --print-qname
136- else if (c == 0 && long_idx == 5 ) opt .flag |= MM_F_NO_SELF ; // --no-self
137153 else if (c == 0 && long_idx == 6 ) mm_dbg_flag |= MM_DBG_PRINT_QNAME | MM_DBG_PRINT_SEED , n_threads = 1 ; // --print-seed
138154 else if (c == 0 && long_idx == 7 ) opt .max_chain_skip = atoi (optarg ); // --max-chain-skip
139155 else if (c == 0 && long_idx == 8 ) opt .min_ksw_len = atoi (optarg ); // --min-dp-len
@@ -148,13 +164,9 @@ int main(int argc, char *argv[])
148164 else if (c == 0 && long_idx == 22 ) opt .flag |= MM_F_FOR_ONLY ; // --for-only
149165 else if (c == 0 && long_idx == 23 ) opt .flag |= MM_F_REV_ONLY ; // --rev-only
150166 else if (c == 0 && long_idx == 14 ) { // --frag
151- if (optarg == 0 || strcmp (optarg , "yes" ) == 0 || strcmp (optarg , "y" ) == 0 )
152- opt .flag |= MM_F_FRAG_MODE ;
153- else opt .flag &= ~MM_F_FRAG_MODE ;
167+ yes_or_no (& opt , MM_F_FRAG_MODE , long_idx , optarg , 1 );
154168 } else if (c == 0 && long_idx == 15 ) { // --secondary
155- if (optarg == 0 || strcmp (optarg , "yes" ) == 0 || strcmp (optarg , "y" ) == 0 )
156- opt .flag &= ~MM_F_NO_PRINT_2ND ;
157- else opt .flag |= MM_F_NO_PRINT_2ND ;
169+ yes_or_no (& opt , MM_F_NO_PRINT_2ND , long_idx , optarg , 0 );
158170 } else if (c == 0 && long_idx == 16 ) { // --cs
159171 opt .flag |= MM_F_OUT_CS | MM_F_CIGAR ;
160172 if (optarg == 0 || strcmp (optarg , "short" ) == 0 ) {
@@ -167,13 +179,11 @@ int main(int argc, char *argv[])
167179 fprintf (stderr , "[WARNING]\033[1;31m --cs only takes 'short' or 'long'. Invalid values are assumed to be 'short'.\033[0m\n" );
168180 }
169181 } else if (c == 0 && long_idx == 19 ) { // --splice-flank
170- if (optarg == 0 || strcmp (optarg , "yes" ) == 0 || strcmp (optarg , "y" ) == 0 )
171- opt .flag |= MM_F_SPLICE_FLANK ;
172- else opt .flag &= ~MM_F_SPLICE_FLANK ;
182+ yes_or_no (& opt , MM_F_SPLICE_FLANK , long_idx , optarg , 1 );
173183 } else if (c == 0 && long_idx == 24 ) { // --heap-sort
174- if ( optarg == 0 || strcmp ( optarg , "yes" ) == 0 || strcmp ( optarg , "y" ) == 0 )
175- opt . flag |= MM_F_HEAP_SORT ;
176- else opt . flag &= ~ MM_F_HEAP_SORT ;
184+ yes_or_no ( & opt , MM_F_HEAP_SORT , long_idx , optarg , 1 );
185+ } else if ( c == 0 && long_idx == 26 ) { // --dual
186+ yes_or_no ( & opt , MM_F_NO_DUAL , long_idx , optarg , 0 ) ;
177187 } else if (c == 'S' ) {
178188 opt .flag |= MM_F_OUT_CS | MM_F_CIGAR | MM_F_OUT_CS_LONG ;
179189 if (mm_verbose >= 2 )
@@ -261,8 +271,8 @@ int main(int argc, char *argv[])
261271 fprintf (fp_help , " map-ont: -k15 (Oxford Nanopore vs reference mapping)\n" );
262272 fprintf (fp_help , " asm5: -k19 -w19 -A1 -B19 -O39,81 -E3,1 -s200 -z200 (asm to ref mapping; break at 5%% div.)\n" );
263273 fprintf (fp_help , " asm10: -k19 -w19 -A1 -B9 -O16,41 -E2,1 -s200 -z200 (asm to ref mapping; break at 10%% div.)\n" );
264- fprintf (fp_help , " ava-pb: -Hk19 -w5 -Xp0 -m100 -g10000 --max-chain-skip 25 (PacBio read overlap)\n" );
265- fprintf (fp_help , " ava-ont: -k15 -w5 -Xp0 -m100 -g10000 --max-chain-skip 25 (ONT read overlap)\n" );
274+ fprintf (fp_help , " ava-pb: -Hk19 -Xw5 -m100 -g10000 --max-chain-skip 25 (PacBio read overlap)\n" );
275+ fprintf (fp_help , " ava-ont: -k15 -Xw5 -m100 -g10000 --max-chain-skip 25 (ONT read overlap)\n" );
266276 fprintf (fp_help , " splice: long-read spliced alignment (see minimap2.1 for details)\n" );
267277 fprintf (fp_help , " sr: short single-end reads without splicing (see minimap2.1 for details)\n" );
268278 fprintf (fp_help , "\nSee `man ./minimap2.1' for detailed description of command-line options.\n" );
0 commit comments