[Biopython] PWM using gapped alignments

Peter Cock p.j.a.cock at googlemail.com
Thu Jul 28 16:54:40 UTC 2011


On Thu, Jul 28, 2011 at 5:28 PM, Chris Gowen <gowencm at vcu.edu> wrote:
> Hello all,
>
> We are trying to perform pwm calculations using the Motif.pwm() function,
> and many of our alignments have gaps, which raise KeyError when it tries the
> key '-'. I am fairly inexperienced with this analysis technique, but from
> looking at the source, it seems the error itself may be avoided by adding a
> line before line 97 to skip that letter in the calculation. Would this mess
> up the calculation for the pwm scores? Has anyone dealt with this problem in
> a more clever way?
>
> Thanks for any advise you can offer.
>
> Best,
> Chris Gowen

Which alphabet are you using? My guess is you didn't have a gapped
alphabet.

As an aside, making the Seq object test this has certain appeal but
would impose a performance penalty.

Peter



More information about the Biopython mailing list