[BioPython] The count method of a Seq (or MutableSeq) object

Peter biopython at maubp.freeserve.co.uk
Fri Mar 6 15:46:19 UTC 2009


On Fri, Mar 6, 2009 at 3:34 PM, Bruce Southey <bsouthey at gmail.com> wrote:
>>
>> For codon counting NEITHER the current non-overlapping count nor the
>> suggested overlapping count would be suitable.  So this doesn't really
>> affect the overlapping versus non-overlapping debate.
>>
>> Peter
>
> With due respect, this does not make any sense.
>
> If it is a cDNA then I can count say the different Lysine codons to find any
> usage bias using seq.count('AAA')/ (seq.count('AAA')+seq.count('AAG').
> (Actually I am more interested in the occurrence of specific multiple codons
> than single codons.)

If you have the (short) CDS "TAAAAAAAAAAG" which codes for "LKKK",
then the codon count for "AAA" is 2 and the codon count for "AAG" is
1.

Using the (standard python) non overlapping count method,
"TAAAAAAAAAAG".count("AAA") = 3 and "TAAAAAAAAAAG".count("AAG") = 1
which does not do what you want.

Using a hypothetical overlapping count method,
"TAAAAAAAAAAG".overlapping_count("AAA") = 8 and
"TAAAAAAAAAAG".overlapping_count("AAG") = 1 which does not do what you
want.

i.e. As I said, for codon counting NEITHER the current non-overlapping
count nor the suggested overlapping count would be suitable.

You seem to be asking for something different - a codon counting
method, which is a special case of a non-overlapping count.

Peter




More information about the Biopython mailing list