Skip to content
Permalink
6d5cc671f5
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
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)