[BioPython] How to test Sequence objects for equality?

Iddo Friedberg idoerg at gmail.com
Sat Mar 29 13:24:03 UTC 2008


Tal,

Seq types do not support a comparison function. The reason is that it is not
very common  to perform a 100% identity on two sequences.  You can just
extract the strings and compare.


The more common case is seqeunce alignment, and Biopython does support that.
You can use Bio.pairwise2 (documentation in the module source code, not in
the cookbook). Or for multiple alignments you can call ClustalX externally
(the tutorial / cookbook explains that).

HTH,

Iddo

On Sat, Mar 29, 2008 at 5:38 AM, Tal Einat <taleinat at gmail.com> wrote:

> Hello,
>
> I'm new to BioPython, but I've managed to stumble in my very first
> steps. Could someone help explain this behavior?
>
> >>> from Bio.Seq import Seq
> >>> from Bio.Alphabet import IUPAC
> >>> Seq('A', IUPAC.unambiguous_dna) == Seq('A', IUPAC.unambiguous_dna)
> False
> >>>
>
> My current goal is to search for (possibly ambiguous) matching
> sequences in an efficient manner, but I haven't found docs or a
> tutorial which cover this.
>
> (WinXP SP2, Python2.5, BioPython 1.45)
>
> - Tal
> _______________________________________________
> BioPython mailing list  -  BioPython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
>



-- 

Iddo Friedberg, Ph.D.
CALIT2, mail code 0440
University of California, San Diego
9500 Gilman Drive
La Jolla, CA 92093-0440, USA
T: +1 (858) 534-0570
T: +1 (858) 646-3100 x3516
http://iddo-friedberg.org



More information about the Biopython mailing list