{"action":"created","comment":{"url":"https://api.github.com/repos/broadinstitute/hellbender/pulls/comments/28072035","id":28072035,"diff_hunk":"@@ -289,74 +290,28 @@ public GenomeLoc parseGenomeLoc(final String str) {\n         // 'chr2', 'chr2:1000000' or 'chr2:1,000,000-2,000,000'\n         //System.out.printf(\"Parsing location '%s'%n\", str);\n \n-        String contig = null;\n-        int start = 1;\n-        int stop = -1;\n-\n-        final int colonIndex = str.lastIndexOf(\":\");\n-        if(colonIndex == -1) {\n-            contig = str.substring(0, str.length());  // chr1\n-            stop = Integer.MAX_VALUE;\n-        } else {\n-            contig = str.substring(0, colonIndex);\n-            final int dashIndex = str.indexOf('-', colonIndex);\n-            try {\n-                if(dashIndex == -1) {\n-                    if(str.charAt(str.length() - 1) == '+') {\n-                        start = parsePosition(str.substring(colonIndex + 1, str.length() - 1));  // chr:1+\n-                        stop = Integer.MAX_VALUE;\n-                    } else {\n-                        start = parsePosition(str.substring(colonIndex + 1));   // chr1:1\n-                        stop = start;\n-                    }\n-                } else {\n-                    start = parsePosition(str.substring(colonIndex + 1, dashIndex));  // chr1:1-1\n-                    stop = parsePosition(str.substring(dashIndex + 1));\n-                }\n-            } catch(Exception e) {\n-                throw new UserException.MalformedGenomeLoc(\"Failed to parse Genome Location string: \" + str, e);\n-            }\n-        }\n-\n-        // is the contig valid?\n-        if (!contigIsInDictionary(contig))\n-            throw new UserException.MalformedGenomeLoc(\"Contig '\" + contig + \"' does not match any contig in the GATK sequence dictionary derived from the reference; are you sure you are using the correct reference fasta file?\");\n-\n-        if (stop == Integer.MAX_VALUE)\n-            // lookup the actually stop position!\n-            stop = getContigInfo(contig).getSequenceLength();\n-\n-        return createGenomeLoc(contig, getContigIndex(contig), start, stop, true);\n-    }\n+        try {\n+            final Locatable locatable = new SimpleInterval(str);\n+            final String contig = locatable.getContig();\n+            final int start = locatable.getStart();\n+            int stop = locatable.getEnd();\n \n-    /**\n-     * Parses a number like 1,000,000 into a long.\n-     * @param pos\n-     */\n-    protected int parsePosition(final String pos) {\n-        if(pos.indexOf('-') != -1) {\n-            throw new NumberFormatException(\"Position: '\" + pos + \"' can't contain '-'.\" );\n-        }\n+            if (!contigIsInDictionary(contig)) {\n+                throw new UserException.MalformedGenomeLoc(\"Contig '\" + contig + \"' does not match any contig in the GATK sequence dictionary derived from the reference; are you sure you are using the correct reference fasta file?\");\n+            }\n \n-        if(pos.indexOf(',') != -1) {\n-            final StringBuilder buffer = new StringBuilder();\n-            for(int i = 0; i < pos.length(); i++) {\n-                final char c = pos.charAt(i);\n-\n-                if(c == ',') {\n-                    continue;\n-                } else if(c < '0' || c > '9') {\n-                    throw new NumberFormatException(\"Position: '\" + pos + \"' contains invalid chars.\" );\n-                } else {\n-                    buffer.append(c);\n-                }\n+            if (stop == Integer.MAX_VALUE) {\n+                // lookup the actually stop position!","path":"src/main/java/org/broadinstitute/hellbender/utils/GenomeLocParser.java","position":82,"original_position":82,"commit_id":"fb2cf30a1895da25f3053262ca142153b2e6928e","original_commit_id":"fb2cf30a1895da25f3053262ca142153b2e6928e","user":{"login":"droazen","id":798637,"avatar_url":"https://avatars.githubusercontent.com/u/798637?v=3","gravatar_id":"","url":"https://api.github.com/users/droazen","html_url":"https://github.com/droazen","followers_url":"https://api.github.com/users/droazen/followers","following_url":"https://api.github.com/users/droazen/following{/other_user}","gists_url":"https://api.github.com/users/droazen/gists{/gist_id}","starred_url":"https://api.github.com/users/droazen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droazen/subscriptions","organizations_url":"https://api.github.com/users/droazen/orgs","repos_url":"https://api.github.com/users/droazen/repos","events_url":"https://api.github.com/users/droazen/events{/privacy}","received_events_url":"https://api.github.com/users/droazen/received_events","type":"User","site_admin":false},"body":"actually -> actual","created_at":"2015-04-09T15:27:00Z","updated_at":"2015-04-09T15:27:00Z","html_url":"https://github.com/broadinstitute/hellbender/pull/363#discussion_r28072035","pull_request_url":"https://api.github.com/repos/broadinstitute/hellbender/pulls/363","_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/hellbender/pulls/comments/28072035"},"html":{"href":"https://github.com/broadinstitute/hellbender/pull/363#discussion_r28072035"},"pull_request":{"href":"https://api.github.com/repos/broadinstitute/hellbender/pulls/363"}}},"pull_request":{"url":"https://api.github.com/repos/broadinstitute/hellbender/pulls/363","id":32921614,"html_url":"https://github.com/broadinstitute/hellbender/pull/363","diff_url":"https://github.com/broadinstitute/hellbender/pull/363.diff","patch_url":"https://github.com/broadinstitute/hellbender/pull/363.patch","issue_url":"https://api.github.com/repos/broadinstitute/hellbender/issues/363","number":363,"state":"open","locked":false,"title":"codecs cleanup + tests","user":{"login":"akiezun","id":1993519,"avatar_url":"https://avatars.githubusercontent.com/u/1993519?v=3","gravatar_id":"","url":"https://api.github.com/users/akiezun","html_url":"https://github.com/akiezun","followers_url":"https://api.github.com/users/akiezun/followers","following_url":"https://api.github.com/users/akiezun/following{/other_user}","gists_url":"https://api.github.com/users/akiezun/gists{/gist_id}","starred_url":"https://api.github.com/users/akiezun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akiezun/subscriptions","organizations_url":"https://api.github.com/users/akiezun/orgs","repos_url":"https://api.github.com/users/akiezun/repos","events_url":"https://api.github.com/users/akiezun/events{/privacy}","received_events_url":"https://api.github.com/users/akiezun/received_events","type":"User","site_admin":false},"body":"closes #230\r\n\r\ndeleted useless codecs, left only TableCodec (per @ldgauthier's request), removed GenomeLoc (and reference dependency), simplified parsing code and added tests for the codec (and corresponding TableFeature)\r\n\r\n@droazen please review","created_at":"2015-04-09T03:04:46Z","updated_at":"2015-04-09T15:27:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07fc1fd62c7daed9399edb456d7918f6dd5350c9","assignee":{"login":"droazen","id":798637,"avatar_url":"https://avatars.githubusercontent.com/u/798637?v=3","gravatar_id":"","url":"https://api.github.com/users/droazen","html_url":"https://github.com/droazen","followers_url":"https://api.github.com/users/droazen/followers","following_url":"https://api.github.com/users/droazen/following{/other_user}","gists_url":"https://api.github.com/users/droazen/gists{/gist_id}","starred_url":"https://api.github.com/users/droazen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droazen/subscriptions","organizations_url":"https://api.github.com/users/droazen/orgs","repos_url":"https://api.github.com/users/droazen/repos","events_url":"https://api.github.com/users/droazen/events{/privacy}","received_events_url":"https://api.github.com/users/droazen/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/broadinstitute/hellbender/milestones/2","html_url":"https://github.com/broadinstitute/hellbender/milestones/BlobFish","labels_url":"https://api.github.com/repos/broadinstitute/hellbender/milestones/2/labels","id":900747,"number":2,"title":"BlobFish","description":"","creator":{"login":"akiezun","id":1993519,"avatar_url":"https://avatars.githubusercontent.com/u/1993519?v=3","gravatar_id":"","url":"https://api.github.com/users/akiezun","html_url":"https://github.com/akiezun","followers_url":"https://api.github.com/users/akiezun/followers","following_url":"https://api.github.com/users/akiezun/following{/other_user}","gists_url":"https://api.github.com/users/akiezun/gists{/gist_id}","starred_url":"https://api.github.com/users/akiezun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akiezun/subscriptions","organizations_url":"https://api.github.com/users/akiezun/orgs","repos_url":"https://api.github.com/users/akiezun/repos","events_url":"https://api.github.com/users/akiezun/events{/privacy}","received_events_url":"https://api.github.com/users/akiezun/received_events","type":"User","site_admin":false},"open_issues":17,"closed_issues":36,"state":"open","created_at":"2014-12-11T17:34:44Z","updated_at":"2015-04-09T14:39:44Z","due_on":"2015-04-10T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/broadinstitute/hellbender/pulls/363/commits","review_comments_url":"https://api.github.com/repos/broadinstitute/hellbender/pulls/363/comments","review_comment_url":"https://api.github.com/repos/broadinstitute/hellbender/pulls/comments{/number}","comments_url":"https://api.github.com/repos/broadinstitute/hellbender/issues/363/comments","statuses_url":"https://api.github.com/repos/broadinstitute/hellbender/statuses/fb2cf30a1895da25f3053262ca142153b2e6928e","head":{"label":"broadinstitute:ak_codecs","ref":"ak_codecs","sha":"fb2cf30a1895da25f3053262ca142153b2e6928e","user":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"repo":{"id":27452807,"name":"hellbender","full_name":"broadinstitute/hellbender","owner":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/broadinstitute/hellbender","description":"GATK4 - the (eventually) public parts","fork":false,"url":"https://api.github.com/repos/broadinstitute/hellbender","forks_url":"https://api.github.com/repos/broadinstitute/hellbender/forks","keys_url":"https://api.github.com/repos/broadinstitute/hellbender/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broadinstitute/hellbender/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broadinstitute/hellbender/teams","hooks_url":"https://api.github.com/repos/broadinstitute/hellbender/hooks","issue_events_url":"https://api.github.com/repos/broadinstitute/hellbender/issues/events{/number}","events_url":"https://api.github.com/repos/broadinstitute/hellbender/events","assignees_url":"https://api.github.com/repos/broadinstitute/hellbender/assignees{/user}","branches_url":"https://api.github.com/repos/broadinstitute/hellbender/branches{/branch}","tags_url":"https://api.github.com/repos/broadinstitute/hellbender/tags","blobs_url":"https://api.github.com/repos/broadinstitute/hellbender/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broadinstitute/hellbender/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broadinstitute/hellbender/git/refs{/sha}","trees_url":"https://api.github.com/repos/broadinstitute/hellbender/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broadinstitute/hellbender/statuses/{sha}","languages_url":"https://api.github.com/repos/broadinstitute/hellbender/languages","stargazers_url":"https://api.github.com/repos/broadinstitute/hellbender/stargazers","contributors_url":"https://api.github.com/repos/broadinstitute/hellbender/contributors","subscribers_url":"https://api.github.com/repos/broadinstitute/hellbender/subscribers","subscription_url":"https://api.github.com/repos/broadinstitute/hellbender/subscription","commits_url":"https://api.github.com/repos/broadinstitute/hellbender/commits{/sha}","git_commits_url":"https://api.github.com/repos/broadinstitute/hellbender/git/commits{/sha}","comments_url":"https://api.github.com/repos/broadinstitute/hellbender/comments{/number}","issue_comment_url":"https://api.github.com/repos/broadinstitute/hellbender/issues/comments{/number}","contents_url":"https://api.github.com/repos/broadinstitute/hellbender/contents/{+path}","compare_url":"https://api.github.com/repos/broadinstitute/hellbender/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broadinstitute/hellbender/merges","archive_url":"https://api.github.com/repos/broadinstitute/hellbender/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broadinstitute/hellbender/downloads","issues_url":"https://api.github.com/repos/broadinstitute/hellbender/issues{/number}","pulls_url":"https://api.github.com/repos/broadinstitute/hellbender/pulls{/number}","milestones_url":"https://api.github.com/repos/broadinstitute/hellbender/milestones{/number}","notifications_url":"https://api.github.com/repos/broadinstitute/hellbender/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broadinstitute/hellbender/labels{/name}","releases_url":"https://api.github.com/repos/broadinstitute/hellbender/releases{/id}","created_at":"2014-12-02T20:50:36Z","updated_at":"2015-04-09T14:19:20Z","pushed_at":"2015-04-09T14:39:39Z","git_url":"git://github.com/broadinstitute/hellbender.git","ssh_url":"git@github.com:broadinstitute/hellbender.git","clone_url":"https://github.com/broadinstitute/hellbender.git","svn_url":"https://github.com/broadinstitute/hellbender","homepage":"","size":26427,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":163,"forks":0,"open_issues":163,"watchers":0,"default_branch":"master"}},"base":{"label":"broadinstitute:master","ref":"master","sha":"5ae760af85bb3d488a17052da56ddc38b974ae61","user":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"repo":{"id":27452807,"name":"hellbender","full_name":"broadinstitute/hellbender","owner":{"login":"broadinstitute","id":393552,"avatar_url":"https://avatars.githubusercontent.com/u/393552?v=3","gravatar_id":"","url":"https://api.github.com/users/broadinstitute","html_url":"https://github.com/broadinstitute","followers_url":"https://api.github.com/users/broadinstitute/followers","following_url":"https://api.github.com/users/broadinstitute/following{/other_user}","gists_url":"https://api.github.com/users/broadinstitute/gists{/gist_id}","starred_url":"https://api.github.com/users/broadinstitute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/broadinstitute/subscriptions","organizations_url":"https://api.github.com/users/broadinstitute/orgs","repos_url":"https://api.github.com/users/broadinstitute/repos","events_url":"https://api.github.com/users/broadinstitute/events{/privacy}","received_events_url":"https://api.github.com/users/broadinstitute/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/broadinstitute/hellbender","description":"GATK4 - the (eventually) public parts","fork":false,"url":"https://api.github.com/repos/broadinstitute/hellbender","forks_url":"https://api.github.com/repos/broadinstitute/hellbender/forks","keys_url":"https://api.github.com/repos/broadinstitute/hellbender/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broadinstitute/hellbender/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broadinstitute/hellbender/teams","hooks_url":"https://api.github.com/repos/broadinstitute/hellbender/hooks","issue_events_url":"https://api.github.com/repos/broadinstitute/hellbender/issues/events{/number}","events_url":"https://api.github.com/repos/broadinstitute/hellbender/events","assignees_url":"https://api.github.com/repos/broadinstitute/hellbender/assignees{/user}","branches_url":"https://api.github.com/repos/broadinstitute/hellbender/branches{/branch}","tags_url":"https://api.github.com/repos/broadinstitute/hellbender/tags","blobs_url":"https://api.github.com/repos/broadinstitute/hellbender/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broadinstitute/hellbender/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broadinstitute/hellbender/git/refs{/sha}","trees_url":"https://api.github.com/repos/broadinstitute/hellbender/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broadinstitute/hellbender/statuses/{sha}","languages_url":"https://api.github.com/repos/broadinstitute/hellbender/languages","stargazers_url":"https://api.github.com/repos/broadinstitute/hellbender/stargazers","contributors_url":"https://api.github.com/repos/broadinstitute/hellbender/contributors","subscribers_url":"https://api.github.com/repos/broadinstitute/hellbender/subscribers","subscription_url":"https://api.github.com/repos/broadinstitute/hellbender/subscription","commits_url":"https://api.github.com/repos/broadinstitute/hellbender/commits{/sha}","git_commits_url":"https://api.github.com/repos/broadinstitute/hellbender/git/commits{/sha}","comments_url":"https://api.github.com/repos/broadinstitute/hellbender/comments{/number}","issue_comment_url":"https://api.github.com/repos/broadinstitute/hellbender/issues/comments{/number}","contents_url":"https://api.github.com/repos/broadinstitute/hellbender/contents/{+path}","compare_url":"https://api.github.com/repos/broadinstitute/hellbender/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broadinstitute/hellbender/merges","archive_url":"https://api.github.com/repos/broadinstitute/hellbender/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broadinstitute/hellbender/downloads","issues_url":"https://api.github.com/repos/broadinstitute/hellbender/issues{/number}","pulls_url":"https://api.github.com/repos/broadinstitute/hellbender/pulls{/number}","milestones_url":"https://api.github.com/repos/broadinstitute/hellbender/milestones{/number}","notifications_url":"https://api.github.com/repos/broadinstitute/hellbender/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broadinstitute/hellbender/labels{/name}","releases_url":"https://api.github.com/repos/broadinstitute/hellbender/releases{/id}","created_at":"2014-12-02T20:50:36Z","updated_at":"2015-04-09T14:19:20Z","pushed_at":"2015-04-09T14:39:39Z","git_url":"git://github.com/broadinstitute/hellbender.git","ssh_url":"git@github.com:broadinstitute/hellbender.git","clone_url":"https://github.com/broadinstitute/hellbender.git","svn_url":"https://github.com/broadinstitute/hellbender","homepage":"","size":26427,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":163,"forks":0,"open_issues":163,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/hellbender/pulls/363"},"html":{"href":"https://github.com/broadinstitute/hellbender/pull/363"},"issue":{"href":"https://api.github.com/repos/broadinstitute/hellbender/issues/363"},"comments":{"href":"https://api.github.com/repos/broadinstitute/hellbender/issues/363/comments"},"review_comments":{"href":"https://api.github.com/repos/broadinstitute/hellbender/pulls/363/comments"},"review_comment":{"href":"https://api.github.com/repos/broadinstitute/hellbender/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/broadinstitute/hellbender/pulls/363/commits"},"statuses":{"href":"https://api.github.com/repos/broadinstitute/hellbender/statuses/fb2cf30a1895da25f3053262ca142153b2e6928e"}}}}