Commit 85897a23 authored by Mikael Boden's avatar Mikael Boden

guide.py

parent 8625943a
......@@ -169,7 +169,7 @@ class Alignment():
return len(self.seqs)
def __getitem__(self, ndx):
return self.seqs[ndx]
def calcDistances(self, measure, a=1.0):
def calcDistances(self, measure = 'fractional', a=1.0):
""" Calculate the evolutionary distance between all pairs of sequences
in this alignment, using the given measure. Measure can be one of
'fractional', 'poisson', 'gamma', 'jc' or 'k2p'. If 'gamma' or 'k2p' is
......@@ -201,7 +201,7 @@ class Alignment():
L += 1
if seqA[k] != seqB[k]:
D += 1
p = float(D)/L
p = D / L
# Now calculate the specified measure based on p
if measure == 'fractional':
dist = p
......@@ -214,7 +214,7 @@ class Alignment():
symbolsPerLine = 60
maxNameLength = self.namelen + 1
mystring = u''
wholeRows = self.alignlen / symbolsPerLine
wholeRows = self.alignlen // symbolsPerLine
for i in range(wholeRows):
for j in range(len(self.seqs)):
mystring += self.seqs[j].name.ljust(maxNameLength) + u' '
......@@ -235,7 +235,7 @@ class Alignment():
html = u''.ljust(self.namelen) + u' '
for i in range(self.alignlen - 1):
if (i+1) % 10 == 0:
html += str(i/10+1)[-1]
html += str(i//10+1)[-1]
else:
html += ' '
html += u'%s\n' % (self.alignlen)
......@@ -504,7 +504,7 @@ def readClustalString(string, alphabet):
continue
sections = line.split()
name, seq = sections[0:2]
if seqs.has_key(name):
if name in seqs:
seqs[name] += seq
else:
seqs[name] = seq
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment