Cython: rearranged input and output format options to have both and

updated commands accordingly
This commit is contained in:
Celine Mercier
2018-10-17 11:19:48 +02:00
parent e6bbe13d81
commit 58589e04be
11 changed files with 120 additions and 77 deletions

View File

@ -7,7 +7,7 @@ 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")
"Allows to limit analysis to a sub-part of the input")
group.add_argument('--skip',
action="store", dest="obi:skip",
@ -22,61 +22,55 @@ def __addInputOption(optionManager):
default=None,
type=int,
help="treat only N sequences")
group.add_argument('--na-string',
action="store", dest="obi:nastring",
default="NA",
type=str,
help="String associated to Non Available (NA) values")
def __addSequenceInputOption(optionManager):
group = optionManager.add_argument_group("Input format options for sequence files")
def __addImportInputOption(optionManager):
group = optionManager.add_argument_group("Input format options for imported files")
group.add_argument('--fasta',
action="store_const", dest="obi:format",
group.add_argument('--fasta-input',
action="store_const", dest="obi:inputformat",
default=None,
const=b'fasta',
help="Input file is in sanger fasta format")
group.add_argument('--fastq',
action="store_const", dest="obi:format",
group.add_argument('--fastq-input',
action="store_const", dest="obi:inputformat",
default=None,
const=b'fastq',
help="Input file is in fastq format")
group.add_argument('--embl',
action="store_const", dest="obi:format",
group.add_argument('--embl-input',
action="store_const", dest="obi:inputformat",
default=None,
const=b'embl',
help="Input file is in embl nucleic format")
group.add_argument('--genbank',
action="store_const", dest="obi:format",
group.add_argument('--genbank-input',
action="store_const", dest="obi:inputformat",
default=None,
const=b'genbank',
help="Input file is in genbank nucleic format")
group.add_argument('--ngsfilter',
action="store_const", dest="obi:format",
group.add_argument('--ngsfilter-input',
action="store_const", dest="obi:inputformat",
default=None,
const=b'ngsfilter',
help="Input file is an ngsfilter file")
group.add_argument('--ecopcr-result',
action="store_const", dest="obi:format",
group.add_argument('--ecopcr-result-input',
action="store_const", dest="obi:inputformat",
default=None,
const=b'ecopcr',
help="Input file is the result of an ecoPCR (version 2)")
group.add_argument('--ecoprimers-result',
action="store_const", dest="obi:format",
group.add_argument('--ecoprimers-result-input',
action="store_const", dest="obi:inputformat",
default=None,
const=b'ecoprimers',
help="Input file is the result of an ecoprimers")
group.add_argument('--tabular',
action="store_const", dest="obi:format",
group.add_argument('--tabular-input',
action="store_const", dest="obi:inputformat",
default=None,
const=b'tabular',
help="Input file is a tabular file")
@ -114,6 +108,13 @@ def __addSequenceInputOption(optionManager):
default=None,
const=b'pep',
help="Input file contains protein sequences")
group.add_argument('--input-na-string',
action="store", dest="obi:inputnastring",
default="NA",
type=str,
help="String associated with Non Available (NA) values in the input")
def __addTabularInputOption(optionManager):
group = optionManager.add_argument_group("Input format options for tabular files")
@ -151,7 +152,17 @@ def __addTabularInputOption(optionManager):
type=str,
help="Lines starting by this char are considered as comment")
def __addTaxonomyInputOption(optionManager):
def __addTaxdumpInputOption(optionManager): # TODO maybe not the best way to do it
group = optionManager.add_argument_group("Input format options for taxdump")
group.add_argument('--taxdump',
action="store_true", dest="obi:taxdump",
default=False,
help="Whether the input is a taxdump")
def __addTaxonomyOption(optionManager):
group = optionManager.add_argument_group("Input format options for taxonomy")
group.add_argument('--taxonomy',
@ -161,46 +172,46 @@ def __addTaxonomyInputOption(optionManager):
#TODO option bool to download taxo if URI doesn't exist
def __addTaxdumpInputOption(optionManager):
group = optionManager.add_argument_group("Input format options for taxdump")
group.add_argument('--taxdump',
action="store_true", dest="obi:taxdump",
default=False,
help="Whether the input is a taxdump")
def addMinimalInputOption(optionManager):
__addInputOption(optionManager)
def addSequenceInputOption(optionManager):
def addImportInputOption(optionManager):
__addInputOption(optionManager)
__addSequenceInputOption(optionManager)
__addImportInputOption(optionManager)
def addTabularInputOption(optionManager):
#__addInputOption(optionManager) # TODO discuss conflict
__addTabularInputOption(optionManager)
def addTaxonomyInputOption(optionManager):
__addTaxonomyInputOption(optionManager)
def addTaxonomyOption(optionManager):
__addTaxonomyOption(optionManager)
def addTaxdumpInputOption(optionManager):
__addTaxdumpInputOption(optionManager)
def addAllInputOption(optionManager):
__addInputOption(optionManager)
__addSequenceInputOption(optionManager)
__addImportInputOption(optionManager)
__addTabularInputOption(optionManager)
__addTaxonomyInputOption(optionManager)
__addTaxonomyOption(optionManager)
__addTaxdumpInputOption(optionManager)
def __addOutputOption(optionManager):
optionManager.add_argument(
dest='obi:outputURI',
metavar='OUTPUT',
help='Data destination URI')
group = optionManager.add_argument_group("Management of DMS for output")
def __addDMSOutputOption(optionManager):
group = optionManager.add_argument_group("Output options for DMS data")
group.add_argument('--no-create-dms',
action="store_true", dest="obi:nocreatedms",
@ -218,5 +229,44 @@ def __addOutputOption(optionManager):
"is greater than N, the values are stored as character strings")
def __addExportOutputOption(optionManager):
group = optionManager.add_argument_group("Output format options for exported files")
group.add_argument('--fasta-output',
action="store_const", dest="obi:outputformat",
default=None,
const=b'fasta',
help="Output file is in sanger fasta format")
group.add_argument('--fastq-output',
action="store_const", dest="obi:outputformat",
default=None,
const=b'fastq',
help="Output file is in fastq format")
group.add_argument('--print-na',
action="store_true", dest="obi:printna",
default=False,
help="Print Non Available (NA) values in the output")
group.add_argument('--output-na-string',
action="store", dest="obi:outputnastring",
default="NA",
type=str,
help="String associated with Non Available (NA) values in the output")
def addMinimalOutputOption(optionManager):
__addOutputOption(optionManager)
__addDMSOutputOption(optionManager)
def addExportOutputOption(optionManager):
__addOutputOption(optionManager)
__addExportOutputOption(optionManager)
def addAllOutputOption(optionManager):
__addOutputOption(optionManager)
__addDMSOutputOption(optionManager)
__addExportOutputOption(optionManager)