Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (24 sloc) 519 Bytes
import string
mers=set()
edges=set()
nodes=set()
edict=dict()
#RC=string.maketrans('CAGT','GTCA')
with open("rosalind_pcov.txt","rU") as f:
for line in f:
mers.add(line.strip())
# mers.add(line.strip().translate(RC)[::-1])
n=len(line.strip())
for x in mers:
nodes.add(x[0:n-1])
nodes.add(x[1:n])
edges.add((x[0:n-1],x[1:n]))
edict[x[0:n-1]]=x[1:n]
x=list(nodes)[0]
y=edict[x]
s=x
while y!=x:
print y
s=s+y[-1]
y=edict[y]
print s[:-(n-2)]
You can’t perform that action at this time.