{"action":"created","issue":{"url":"https://api.github.com/repos/biojava/biojava/issues/355","labels_url":"https://api.github.com/repos/biojava/biojava/issues/355/labels{/name}","comments_url":"https://api.github.com/repos/biojava/biojava/issues/355/comments","events_url":"https://api.github.com/repos/biojava/biojava/issues/355/events","html_url":"https://github.com/biojava/biojava/issues/355","id":122569766,"number":355,"title":"org.biojava.nbio.genome.parsers.gff.Location union() and intersect() do not work as described in API","user":{"login":"josemduarte","id":6000474,"avatar_url":"https://avatars.githubusercontent.com/u/6000474?v=3","gravatar_id":"","url":"https://api.github.com/users/josemduarte","html_url":"https://github.com/josemduarte","followers_url":"https://api.github.com/users/josemduarte/followers","following_url":"https://api.github.com/users/josemduarte/following{/other_user}","gists_url":"https://api.github.com/users/josemduarte/gists{/gist_id}","starred_url":"https://api.github.com/users/josemduarte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josemduarte/subscriptions","organizations_url":"https://api.github.com/users/josemduarte/orgs","repos_url":"https://api.github.com/users/josemduarte/repos","events_url":"https://api.github.com/users/josemduarte/events{/privacy}","received_events_url":"https://api.github.com/users/josemduarte/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/biojava/biojava/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-16T18:14:39Z","updated_at":"2015-12-16T20:36:12Z","closed_at":null,"body":"From Christopher Gillies in biojava-l:\r\n\r\nI am using version 4.1.0 and I am getting some unexpected behavior from the Location class.\r\n\r\nPlease see the unit test below. The union operator returns 51227381 as the bioEnd() but it should be 51227382.\r\n\r\n```java\r\nLocation l1 = Location.fromBio(51227320, 51227381, '+');\r\nLocation l2 = Location.fromBio(51227323, 51227382, '+');\r\n\r\nLocation union = l1.union(l2);\r\nassertEquals(51227320,union.bioStart());\r\nassertEquals(51227382,union.bioEnd());\r\n```\r\n\r\n\r\n\r\nThe 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?\r\n\r\n```java\r\nLocation l1 = Location.fromBio(100, 200, '+');\r\nLocation l2 = Location.fromBio(1, 99, '+');\r\nLocation intersection = l1.intersection(l2);\r\nassertNull(intersection);\r\n```"},"comment":{"url":"https://api.github.com/repos/biojava/biojava/issues/comments/165237241","html_url":"https://github.com/biojava/biojava/issues/355#issuecomment-165237241","issue_url":"https://api.github.com/repos/biojava/biojava/issues/355","id":165237241,"user":{"login":"josemduarte","id":6000474,"avatar_url":"https://avatars.githubusercontent.com/u/6000474?v=3","gravatar_id":"","url":"https://api.github.com/users/josemduarte","html_url":"https://github.com/josemduarte","followers_url":"https://api.github.com/users/josemduarte/followers","following_url":"https://api.github.com/users/josemduarte/following{/other_user}","gists_url":"https://api.github.com/users/josemduarte/gists{/gist_id}","starred_url":"https://api.github.com/users/josemduarte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josemduarte/subscriptions","organizations_url":"https://api.github.com/users/josemduarte/orgs","repos_url":"https://api.github.com/users/josemduarte/repos","events_url":"https://api.github.com/users/josemduarte/events{/privacy}","received_events_url":"https://api.github.com/users/josemduarte/received_events","type":"User","site_admin":false},"created_at":"2015-12-16T20:36:12Z","updated_at":"2015-12-16T20:36:12Z","body":"What happens is that `Location.fromBio` converts `start`, `end` coordinates to `start-1` and `end` (in case above it would be `l1=99,200`, `l2=0,99`). Based on that then there is an overlap on 99 for your test case above. Could that be the desired behaviour? I don't really know enough about this part of Biojava to judge. "}}