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

Giovanni Marco Dall'Olio dalloliogm at gmail.com
Thu Mar 5 15:10:59 UTC 2009


On Thu, Mar 5, 2009 at 4:05 PM, Peter <biopython at maubp.freeserve.co.uk> wrote:
> 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


Imho this is the best solution. If I can say, I expect a .count()
method to act like the homonymous method in python strings.

A good doctest example (similar to the existing one) would be nice, too.


>
> Peter
> _______________________________________________
> BioPython mailing list  -  BioPython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
>



-- 

My blog on bioinformatics (now in English): http://bioinfoblog.it




More information about the Biopython mailing list