Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (28 sloc) 665 Bytes
#!/usr/bin/python
from collections import OrderedDict
value,key="",""
s=OrderedDict({})
with open("rosalind_long.txt","rU") as f:
for x in f:
if x[0]!=">":
value=value+x.strip()
else:
if key!="": s[key]=value
key=x[1:].strip()
value=""
s[key]=value
strs=s.values()
while len(strs)>1:
h=strs.pop()
print len(h)
k=h[0:400]
for i,x in enumerate(strs):
j=x.find(k)
if j>=0:
if len(h)+j>len(x):
strs[i]=x[0:j]+h
strs.insert(0,strs.pop(i))
break
else:
strs.insert(0,h)
print strs[0]
You can’t perform that action at this time.