I have a file that contains two sequences. I have a program that could read all sequences, combine them together, and display the length of both sequences together. Now I want to display the length individually. The two sequences are separated by the symbol >.
Example:
SEQ1 >ATGGGACTAGCAGT
SEQ2 >AGGATGATGAGTGA
Program:
#!usr/bin/python
import re
fh=open('clostp1.fa','r')
count=0
content=fh.readlines()
fh.close()
seq=''
patt=re.compile('>(.*?)')
for item in content:
m=patt.match(item)
if not m:
s=item.replace('\n','')
seq=seq+s
seq=seq.replace('\s','')
print seq
print 'The length of the coding sequence of the bacillus'
print len(seq)