Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (19 sloc) 391 Bytes
from suffix import *
from math import log
with open("rosalind_ling.txt","rU") as f:
s=f.readline().strip()
#s='ATTTGGATT'
n=SuffixTree(s)
p=0
b=0
for x in n.edges.values():
p=p+x.length+1
k=int(log(len(s))/log(4))
for y in xrange(1,k+1):
print 4**y
b=b+4**y
for y in xrange(k+1,len(s)+1):
print len(s)+1-y
b=b+len(s)+1-y
print p,b
print float(p)/float(b)
You can’t perform that action at this time.