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