[Biojava-l] org.biojava.nbio.genome.parsers.gff.Location union() and intersect() do not work as described in API

Christopher Gillies cgillies at umich.edu
Wed Dec 16 15:45:30 UTC 2015


Hi biojava,

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);

Thanks,

Chris


More information about the Biojava-l mailing list