Skip to content

org.biojava.nbio.genome.parsers.gff.Location union() and intersect() do not work as described in API #355

@josemduarte

Description

@josemduarte

From Christopher Gillies in biojava-l:

I am using version 4.1.0 and I am getting some unexpected behavior from the Location class.

Please see the unit test below. The union operator returns 51227381 as the bioEnd() but it should be 51227382.

Location l1 = Location.fromBio(51227320, 51227381, '+');
Location l2 = Location.fromBio(51227323, 51227382, '+');

Location union = l1.union(l2);
assertEquals(51227320,union.bioStart());
assertEquals(51227382,union.bioEnd());

The documentation for the intersection method says that it will return null when there is no overlap for two locations, but the code appears to fail for boundary conditions. The following unit test fails. Shouldn’t the intersection method return null for this test case?

Location l1 = Location.fromBio(100, 200, '+');
Location l2 = Location.fromBio(1, 99, '+');
Location intersection = l1.intersection(l2);
assertNull(intersection);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBugs and bugfixes

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions