searching for proteins with specific pattern in uniprot_sprot.dat using python results should include overlapped patterns and pattern start and end positions
I'm using python2 and i want to pull down all proteins ids in uniprot_sprot.fasta that have this pattern with there positions within sequence, however I faced problems especially with getting all patterns including the overlapped ones. Help appreciated and i want to say that I have very little experience in python
import re
import sys
x=sys.argv[1] .................. x= "[SR][SR]"
with (open("uniprot_sprot.fasta", 'r')) as fi:
out = {}
name = ""
for line in fi:
print line.split()
if (line.startswith(">>>")):
name = line[3:]
out[name] = []
print name
else:
match= re.compile(x)
for match in re.finditer(x, line):
out[name].append(match)
print (out)
• 1,917 views
•
link
0 answers
No answers yet.
Log in to answer this question.