Module fastaLength
[hide private]
[frames] | no frames]

Source Code for Module fastaLength

 1  #!/usr/local/bin/python 
 2  """\ 
 3  ------------------------------------------------------- 
 4   fastalength.py 
 5  ------------------------------------------------------- 
 6   
 7  fastaLength.py [-h|--help] <fastafile>" 
 8   
 9      add length data on all sequences in the fasta file. 
10   
11  ------------------------------------------------------- 
12  -h    --help                       : print this help 
13  ------------------------------------------------------- 
14  """ 
15   
16  import fileinput 
17   
18  from obitools.fasta import fastaIterator,writeFasta 
19  from obitools.utils import checkHelpOption 
20       
21   
22  if __name__=='__main__': 
23       
24      checkHelpOption(__doc__) 
25   
26      fasta = fastaIterator(fileinput.input()) 
27       
28      for seq in fasta: 
29              seq['seqLength']=str(len(seq)) 
30              print writeFasta(seq) 
31