[Biopython-dev] [biopython-dev] SeqFeature comparison for equality

Peter Cock p.j.a.cock at googlemail.com
Mon Oct 17 15:03:15 EDT 2011


2011/10/17 Joshua Ismael Haase Hernández <hahj87 at gmail.com>:
>
>
> El 17 de octubre de 2011 13:07, Peter Cock <p.j.a.cock at googlemail.com>
> escribió:
>>
>> 2011/10/17 Joshua Ismael Haase Hernández <hahj87 at gmail.com>:
>> > ...
>> >
>> > This positions would be the same:
>> >
>> > OneOfPosition(5, 11, 15),
>> > ExactPosition(11),
>> > AfterPosition(4),
>> > BeforePosition(16),
>> > WithinPosition(5, 16),
>>
>> I don't understand what you are asking here. Those
>> positions do not look the same to me.
>>
>
> They are not *exactly* the same, but besides
> AfterPosition and BeforePosition,
> ExactPosition(11) is included in OneOfPosition(5, 11, 15),
> ExactPosition(11) is after AfterPosition(4)
> ExactPosition(11) is before BeforePosition(16)
> ExactPosition(11) is included in WithinPosition(5, 16)
> All positions in OneOfPosition are before BeforePosition,
> after AfterPosition, within WithinPosition, and includes
> ExactPosition.
> Al positions in WithinPosition are after AfterPosition,
> before BeforePosition.
> BeforePosition and AfterPosition can't be equal.
>

It might help it you wrote these out explicitly,
e.g. currently:

    >>> from Bio.SeqFeature import *
    >>> a = BeforePosition(10)
    >>> b = AfterPosition(10)
    >>> a == b == 10
    True

Currently BeforePosition and AfterPosition act like
the integer position for comparison etc. I find this
reasonable given we have to treat them as the
integer for things like extracting the sequence.

> How should I name the TestCases?
>

Something like test_SeqFeature.py and using
unittest. Most existing tests in this area are in
doctests and test_SeqIO_feature.py

Peter



More information about the Biopython-dev mailing list