[ADD] Groups in In/Out options help display
This commit is contained in:
@ -32,6 +32,9 @@ from obitools.format.sequence import skipOnErrorIterator
|
|||||||
from obitools import BioSequence
|
from obitools import BioSequence
|
||||||
from obitools.utils import FakeFile
|
from obitools.utils import FakeFile
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def binarySequenceIterator(lineiterator):
|
def binarySequenceIterator(lineiterator):
|
||||||
|
|
||||||
f = FakeFile(lineiterator)
|
f = FakeFile(lineiterator)
|
||||||
@ -48,112 +51,121 @@ def binarySequenceIterator(lineiterator):
|
|||||||
|
|
||||||
|
|
||||||
def addInputFormatOption(optionManager):
|
def addInputFormatOption(optionManager):
|
||||||
optionManager.add_option('--genbank',
|
|
||||||
|
group = optionManager.add_option_group("Input Format Options",
|
||||||
|
"If not specified, a test is done to determine the file format")
|
||||||
|
|
||||||
|
group.add_option('--genbank',
|
||||||
action="store_const", dest="seqinformat",
|
action="store_const", dest="seqinformat",
|
||||||
default=None,
|
default=None,
|
||||||
const='genbank',
|
const='genbank',
|
||||||
help="input file is in genbank format")
|
help="input file is in genbank format")
|
||||||
optionManager.add_option('--embl',
|
group.add_option('--embl',
|
||||||
action="store_const", dest="seqinformat",
|
action="store_const", dest="seqinformat",
|
||||||
default=None,
|
default=None,
|
||||||
const='embl',
|
const='embl',
|
||||||
help="input file is in embl format")
|
help="input file is in embl format")
|
||||||
|
|
||||||
optionManager.add_option('--skip-on-error',
|
group.add_option('--skip-on-error',
|
||||||
action="store_true", dest="skiperror",
|
action="store_true", dest="skiperror",
|
||||||
default=False,
|
default=False,
|
||||||
help="skip sequence entries with parse error")
|
help="skip sequence entries with parse error")
|
||||||
|
|
||||||
optionManager.add_option('--fasta',
|
group.add_option('--fasta',
|
||||||
action="store_const", dest="seqinformat",
|
action="store_const", dest="seqinformat",
|
||||||
default=None,
|
default=None,
|
||||||
const='fasta',
|
const='fasta',
|
||||||
help="input file is in fasta nucleic format (including obitools fasta extentions)")
|
help="input file is in fasta nucleic format (including obitools fasta extentions)")
|
||||||
|
|
||||||
optionManager.add_option('--ecopcr',
|
group.add_option('--ecopcr',
|
||||||
action="store_const", dest="seqinformat",
|
action="store_const", dest="seqinformat",
|
||||||
default=None,
|
default=None,
|
||||||
const='ecopcr',
|
const='ecopcr',
|
||||||
help="input file is in ecopcr format")
|
help="input file is in ecopcr format")
|
||||||
|
|
||||||
optionManager.add_option('--raw-fasta',
|
group.add_option('--raw-fasta',
|
||||||
action="store_const", dest="seqinformat",
|
action="store_const", dest="seqinformat",
|
||||||
default=None,
|
default=None,
|
||||||
const='rawfasta',
|
const='rawfasta',
|
||||||
help="input file is in fasta format (but more tolerant to format variant)")
|
help="input file is in fasta format (but more tolerant to format variant)")
|
||||||
|
|
||||||
# optionManager.add_option('--fna',
|
# group.add_option('--fna',
|
||||||
# action="store_const", dest="seqinformat",
|
# action="store_const", dest="seqinformat",
|
||||||
# default=None,
|
# default=None,
|
||||||
# const='fna',
|
# const='fna',
|
||||||
# help="input file is in fasta nucleic format produced by 454 sequencer pipeline")
|
# help="input file is in fasta nucleic format produced by 454 sequencer pipeline")
|
||||||
#
|
#
|
||||||
# optionManager.add_option('--qual',
|
# group.add_option('--qual',
|
||||||
# action="store", dest="withqualfile",
|
# action="store", dest="withqualfile",
|
||||||
# type='str',
|
# type='str',
|
||||||
# default=None,
|
# default=None,
|
||||||
# help="Specify the name of a quality file produced by 454 sequencer pipeline")
|
# help="Specify the name of a quality file produced by 454 sequencer pipeline")
|
||||||
|
|
||||||
optionManager.add_option('--sanger',
|
group.add_option('--sanger',
|
||||||
action="store_const", dest="seqinformat",
|
action="store_const", dest="seqinformat",
|
||||||
default=None,
|
default=None,
|
||||||
const='sanger',
|
const='sanger',
|
||||||
help="input file is in sanger fastq nucleic format (standard fastq)")
|
help="input file is in sanger fastq nucleic format (standard fastq)")
|
||||||
|
|
||||||
optionManager.add_option('--solexa',
|
group.add_option('--solexa',
|
||||||
action="store_const", dest="seqinformat",
|
action="store_const", dest="seqinformat",
|
||||||
default=None,
|
default=None,
|
||||||
const='solexa',
|
const='solexa',
|
||||||
help="input file is in fastq nucleic format produced by solexa sequencer")
|
help="input file is in fastq nucleic format produced by solexa sequencer")
|
||||||
|
|
||||||
optionManager.add_option('--illumina',
|
#===========================================================================
|
||||||
action="store_const", dest="seqinformat",
|
# group.add_option('--illumina',
|
||||||
default=None,
|
# action="store_const", dest="seqinformat",
|
||||||
const='illumina',
|
# default=None,
|
||||||
help="input file is in fastq nucleic format produced by old solexa sequencer")
|
# const='illumina',
|
||||||
|
# help="input file is in fastq nucleic format produced by old solexa sequencer")
|
||||||
|
#===========================================================================
|
||||||
|
|
||||||
optionManager.add_option('--nuc',
|
group.add_option('--nuc',
|
||||||
action="store_const", dest="moltype",
|
action="store_const", dest="moltype",
|
||||||
default=None,
|
default=None,
|
||||||
const='nuc',
|
const='nuc',
|
||||||
help="input file is nucleic sequences")
|
help="input file is nucleic sequences")
|
||||||
optionManager.add_option('--prot',
|
group.add_option('--prot',
|
||||||
action="store_const", dest="moltype",
|
action="store_const", dest="moltype",
|
||||||
default=None,
|
default=None,
|
||||||
const='pep',
|
const='pep',
|
||||||
help="input file is protein sequences")
|
help="input file is protein sequences")
|
||||||
|
|
||||||
|
|
||||||
def addOutputFormatOption(optionManager):
|
def addOutputFormatOption(optionManager):
|
||||||
|
|
||||||
|
group = optionManager.add_option_group("Output Format Options")
|
||||||
|
|
||||||
|
|
||||||
# optionManager.add_option('-B','--bin-output',
|
# optionManager.add_option('-B','--bin-output',
|
||||||
# action="store_const", dest="output",
|
# action="store_const", dest="output",
|
||||||
# default=None,
|
# default=None,
|
||||||
# const=dump,
|
# const=dump,
|
||||||
# help="output sequences in binary format")
|
# help="output sequences in binary format")
|
||||||
optionManager.add_option('--fastq-output',
|
group.add_option('--fastq-output',
|
||||||
action="store_const", dest="output",
|
action="store_const", dest="output",
|
||||||
default=None,
|
default=None,
|
||||||
const=formatFastq,
|
const=formatFastq,
|
||||||
help="output sequences in sanger fastq format")
|
help="output sequences in sanger fastq format")
|
||||||
optionManager.add_option('--fasta-output',
|
group.add_option('--fasta-output',
|
||||||
action="store_const", dest="output",
|
action="store_const", dest="output",
|
||||||
default=None,
|
default=None,
|
||||||
const=formatFasta,
|
const=formatFasta,
|
||||||
help="output sequences in obitools fasta format")
|
help="output sequences in obitools fasta format")
|
||||||
optionManager.add_option('--sap-output',
|
group.add_option('--sap-output',
|
||||||
action="store_const", dest="output",
|
action="store_const", dest="output",
|
||||||
default=None,
|
default=None,
|
||||||
const=formatSAPFastaGenerator,
|
const=formatSAPFastaGenerator,
|
||||||
help="output sequences in sap fasta format")
|
help="output sequences in sap fasta format")
|
||||||
optionManager.add_option('--strict-sap',
|
group.add_option('--strict-sap',
|
||||||
action='store_true',dest='strictsap',
|
action='store_true',dest='strictsap',
|
||||||
default=False,
|
default=False,
|
||||||
help="Print sequences in upper case (default is lower case)")
|
help="Print sequences in upper case (default is lower case)")
|
||||||
optionManager.add_option('--ecopcrDB-output',
|
group.add_option('--ecopcrDB-output',
|
||||||
action="store", dest="ecopcroutput",
|
action="store", dest="ecopcroutput",
|
||||||
default=None,
|
default=None,
|
||||||
help="output sequences in ecopcr database format")
|
help="output sequences in ecopcr database format")
|
||||||
optionManager.add_option('--uppercase',
|
group.add_option('--uppercase',
|
||||||
action='store_true',dest='uppercase',
|
action='store_true',dest='uppercase',
|
||||||
default=False,
|
default=False,
|
||||||
help="Print sequences in upper case (default is lower case)")
|
help="Print sequences in upper case (default is lower case)")
|
||||||
|
@ -7,7 +7,6 @@ import sys
|
|||||||
from logging import debug
|
from logging import debug
|
||||||
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from optparse import OptionGroup
|
|
||||||
from optparse import IndentedHelpFormatter
|
from optparse import IndentedHelpFormatter
|
||||||
|
|
||||||
from obitools.utils import universalOpen
|
from obitools.utils import universalOpen
|
||||||
@ -38,6 +37,7 @@ class ObiHelpFormatter (IndentedHelpFormatter):
|
|||||||
"%*s* %s *" % (self.current_indent, "", heading),
|
"%*s* %s *" % (self.current_indent, "", heading),
|
||||||
"%*s%s\n" % (self.current_indent, "", '*'*(len(heading)+4))))
|
"%*s%s\n" % (self.current_indent, "", '*'*(len(heading)+4))))
|
||||||
|
|
||||||
|
|
||||||
def getOptionManager(optionDefinitions,entryIterator=None,progdoc=None,checkFormat=False):
|
def getOptionManager(optionDefinitions,entryIterator=None,progdoc=None,checkFormat=False):
|
||||||
'''
|
'''
|
||||||
Build an option manager function. that is able to parse
|
Build an option manager function. that is able to parse
|
||||||
|
Reference in New Issue
Block a user