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

Peter biopython at maubp.freeserve.co.uk
Thu Mar 5 15:05:39 UTC 2009


On Thu, Mar 5, 2009 at 2:49 PM, Michiel de Hoon <mjldehoon at yahoo.com> wrote:
>
>
> I vote (b).
> Another option is to continue to use count() for a Python-style count,
> and to add a new method that does a overlapping-type count. For this
> new method we'd need a clear but short name, and I can't think of
> anything now.
>
> --Michiel.

Did you like plan (c), which preserves the Python string style count
as the default but offers the non-overlapping count via an optional
argument?

i.e.
>>> from Bio.Seq import Seq
>>> nuc = Seq("AAAA")
>>> nuc.count("AA") #default is non-overlapping
2
>>> nuc.count("AA", overlap=True)
3
>>> nuc.count("AA", overlap=False)
2

Peter



More information about the Biopython mailing list