[Bioperl-l] Bug? Features with similar ranges, different IDs are considered overlapping

Chris Fields cjfields at illinois.edu
Mon Aug 16 14:02:15 EDT 2010


All,

This is in reference to a bug report I filed a while back.  In the below test script, two features with the same start/end are compared.  If the features have the same seq_id(), overlap succeeds.  If the seq_id is changed (e.g. is on another chromosome, for instance), the overlap still succeeds.  

The question is: is this a bug?  My vote would be 'yes', but there have been various arguments to say it's not.  

chris

(maybe I'll make this a regular thing on the list, just to hash out some of the edge cases I run into periodically)

=========================================

#!/usr/bin/perl -w

use strict;
use warnings;
use Test::More;
use Bio::SeqFeature::Generic;

my ( $feat1, $feat2 );

$feat1 = Bio::SeqFeature::Generic->new(
    -start  => 40,
    -end    => 80,
    -strand => 1,
    -seq_id => 'ABC123',
);

is $feat1->start,  40,       'start of feature location';
is $feat1->end,    80,       'end of feature location';
is $feat1->seq_id, 'ABC123', 'seq_id';

$feat2 = Bio::SeqFeature::Generic->new(
    -start  => 40,
    -end    => 80,
    -strand => 1,
    -seq_id => 'ABC123',
);

is $feat2->start,  40,       'start of feature location';
is $feat2->end,    80,       'end of feature location';
is $feat2->seq_id, 'ABC123', 'seq_id';

# Generic features with same Seq ID should overlap
ok( $feat2->overlaps($feat1), 'feat2 overlaps feat1' );

# Generic features with different Seq IDs shouldn't overlap
is( $feat2->seq_id('XYZ678'), 'XYZ678', 'change seq_id' );

# this currently fails
ok( !( $feat2->overlaps($feat1), 'feat2 doesn\'t overlap feat1' ) );

done_testing();




More information about the Bioperl-l mailing list