Commit 4bd345c4 by Eric Coissac

Add automanagement of input and output format

parent 8a77bf46
#!/usr/local/bin/python
from obitools.options import getOptionManager
from obitools.options.bioseqfilter import addSequenceFilteringOptions
from obitools.options.bioseqfilter import filterGenerator
from obitools.format.options import addInOutputOption, printOutput
if __name__=='__main__':
optionParser = getOptionManager([addSequenceFilteringOptions,addInOutputOption])
(options, entries) = optionParser()
goodFasta = filterGenerator(options)
for seq in entries:
if goodFasta(seq):
printOutput(options,seq.complement())
else:
printOutput(options,seq)
\ No newline at end of file
#!/usr/local/bin/python
'''
Created on 1 nov. 2009
@author: coissac
'''
from obitools.options import getOptionManager
from obitools.format.options import addInOutputOption
def addCountOptions(optionManager):
optionManager.add_option('-s','--sequence',
action="store_true", dest="sequence",
default=False,
help="Print the count of differentes sequences"
)
optionManager.add_option('-a','--all',
action="store_true", dest="all",
default=False,
help="Print the count of all sequences"
)
if __name__ == '__main__':
optionParser = getOptionManager([addCountOptions,addInOutputOption])
(options, entries) = optionParser()
count1=0
count2=0
for s in entries:
count1+=1
if 'count' in s:
count2+=s['count']
else:
count2+=1
if options.all==options.sequence:
print count1,count2
elif options.all:
print count2
else:
print count1
\ No newline at end of file
#!/usr/local/bin/python
'''
Created on 27 avr. 2010
@author: coissac
'''
from obitools.format.options import addInOutputOption, printOutput
from obitools.options import getOptionManager
from obitools.options.bioseqfilter import addSequenceFilteringOptions
from obitools.options.bioseqfilter import sequenceFilterIteratorGenerator
if __name__=='__main__':
optionParser = getOptionManager([addSequenceFilteringOptions,addInOutputOption])
(options, entries) = optionParser()
goodSeq = sequenceFilterIteratorGenerator(options)
for seq in goodSeq(entries):
printOutput(options,seq)
#!/usr/local/bin/python
'''
Created on 15 dec. 2009
@author: coissac
'''
import sys
from obitools.format.options import addInOutputOption, printOutput
from obitools.options import getOptionManager
def addHeadOptions(optionManager):
optionManager.add_option('-n','--sequence-count',
action="store", dest="count",
metavar="###",
type="int",
default=10,
help="Count of first sequences to print")
if __name__ == '__main__':
optionParser = getOptionManager([addHeadOptions,addInOutputOption])
(options, entries) = optionParser()
i=0
for s in entries:
if i < options.count:
printOutput(options,s)
i+=1
else:
sys.exit(0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment