diff --git a/python/obitools3/apps/optiongroups/__init__.py b/python/obitools3/apps/optiongroups/__init__.py new file mode 100644 index 0000000..e2adef6 --- /dev/null +++ b/python/obitools3/apps/optiongroups/__init__.py @@ -0,0 +1,50 @@ +def addInputOption(optionManager): + + group = optionManager.add_argument_group("Restriction to a sub-part options", + "Allow to limit analysis to a sub-part of the data file") + + group.add_argument('--skip', + action="store", dest="skip", + metavar='', + default=None, + type='int', + help="skip the N first sequences") + + group.add_argument('--only', + action="store", dest="only", + metavar='', + default=None, + type='int', + help="treat only N sequences") + + group = optionManager.add_argument_group("Input format options", + "If not specified, a test is done to determine the file format") + + group.add_argument('--skip-on-error', + action="store_true", dest="skiperror", + default=False, + help="Skip sequence entries with parse error") + + group.add_argument('--quality-sanger', + action="store_const", dest="seqinformat", + default=None, + const='sanger', + help="Input file is in sanger fastq nucleic format (standard fastq)") + + group.add_argument('--quality-solexa', + action="store_const", dest="seqinformat", + default=None, + const='solexa', + help="Input file is in fastq nucleic format produced by solexa sequencer") + + group.add_argument('--nuc', + action="store_const", dest="moltype", + default=None, + const='nuc', + help="Input file contains nucleic sequences") + + group.add_argument('--prot', + action="store_const", dest="moltype", + default=None, + const='pep', + help="Input file contains protein sequences") diff --git a/python/obitools3/commands/grep.pyx b/python/obitools3/commands/grep.pyx index ff656f5..eebaac6 100644 --- a/python/obitools3/commands/grep.pyx +++ b/python/obitools3/commands/grep.pyx @@ -4,6 +4,8 @@ from obitools3.apps.progress cimport ProgressBar # @UnresolvedImport from obitools3.dms.dms import DMS # TODO cimport doesn't work from obitools3.dms.view.view import View, Line_selection # TODO cimport doesn't work + +from obitools3.apps.optiongroups import addInputOption from functools import reduce import time @@ -14,6 +16,8 @@ default_config = { 'inputview' : None, } def addOptions(parser): + + addInputOption(parser) # TODO put this common group somewhere else but I don't know where group=parser.add_argument_group('DMS and view options')