[Bioperl-l] question about in-between overlapping exact location
hlapp at gmx.net
Wed May 6 07:54:14 EDT 2009
This sounds like a bug to me - the location type should be taken into
account, shouldn't it?
Would you mind submitting this (and a patch if you have one :) to
On May 6, 2009, at 12:17 AM, George Hartzell wrote:
> Jason Stajich writes:
>> George -
>> I don't think the location type is taken into account in the overlap
>> code testing code. Would you expect 2..3 and 3..5 to overlap?
>> On May 5, 2009, at 2:42 PM, George Hartzell wrote:
>>> I was surprised to see that:
>>> $ins = Bio::Location::Simple->new(-start => 2,
>>> -end => 3,
>>> -location_type => 'IN-BETWEEN',
>>> $start = Bio::Location::Simple->new(-start => 3,
>>> -end => 5);
>>> print "Wow!\n" if $start->overlaps($ins);
>>> To my mind they would only overlap if the insertion were 3^4 or 4^5.
>>> Is my mental model of in-between's overlapping exact's wrong, or
>>> the code be improved (I'm happy to make a change, but...)?
> Yep, I'd expect them to overlap.
> 1 2 3 4 5
> A T
> T A A
> I'm trying to ask a question like the following. Given a location
> that describes an e.g. start codon (3..5) and a description of a
> mutation, does the mutation cause a change in the ATG. Substitutions
> are described with exact locations (change bases 3..4 from AT to TA)
> and insertions are modeled as in-between locations (insert G at 3^4).
> 1 2 3 4 5 6
> A T G
> T G C C
> Given 3..5, I can just ask if 3..4 overlaps it (yes), if 3 overlaps it
> (yes) and if 3^4 overlaps it (yes). For things to work out this
> easily, 2^3 shouldn't overlap (an insertion there wouldn't change the
> I can get the in-between to work by using RangeI->contains, but then I
> end up with 1..4 not "causing a change".
> I've ended up with a two part if() that checks the location_type and
> uses ->overlap() or ->contains() so that it works out.
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
: Hilmar Lapp -:- Durham, NC -:- hlapp at gmx dot net :
More information about the Bioperl-l