Skip to content

Commit

Permalink
Consistent handling of mixed case in both C and Python PWM code
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjc committed Jul 12, 2013
1 parent e13c97a commit 0cab00c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Bio/motifs/matrix.py
Expand Up @@ -346,6 +346,8 @@ def calculate(self, sequence):
if sequence.alphabet!=IUPAC.unambiguous_dna:
raise ValueError("Wrong alphabet! Use only with DNA sequences")

#TODO - Force uppercase here and optimise switch statement in C
#by assuming upper case?
sequence = str(sequence)
m = self.length
n = len(sequence)
Expand All @@ -356,6 +358,8 @@ def calculate(self, sequence):
import _pwm
except ImportError:
# use the slower Python code otherwise
#The C code handles mixed case so Python version must too:
sequence = sequence.upper()
for i in xrange(n-m+1):
score = 0.0
for position in xrange(m):
Expand Down

0 comments on commit 0cab00c

Please sign in to comment.