{"action":"created","comment":{"url":"https://api.github.com/repos/broadinstitute/gatk/pulls/comments/66310111","id":66310111,"diff_hunk":"@@ -0,0 +1,108 @@\n+package org.broadinstitute.hellbender.engine;\n+\n+import htsjdk.tribble.Feature;\n+import htsjdk.tribble.FeatureCodec;\n+import org.broadinstitute.hellbender.exceptions.UserException;\n+import org.broadinstitute.hellbender.utils.SimpleInterval;\n+\n+import java.io.File;\n+import java.util.Collections;\n+import java.util.stream.StreamSupport;\n+\n+/**\n+ * General Feature walker.\n+ * <p>\n+ *     For tools that iterate along a list of features.\n+ * </p>\n+ *\n+ * @param <F> the driving feature type.\n+ */\n+public abstract class FeatureWalker<F extends Feature> extends GATKTool {\n+\n+    private FeatureDataSource<F> drivingFeatures;\n+\n+    @Override\n+    void initializeFeatures() {\n+        features = new FeatureManager(this);\n+        initializeDrivingFeatures();\n+    }\n+\n+    @SuppressWarnings(\"unchecked\")\n+    private void initializeDrivingFeatures() {\n+        final File drivingFile = getDrivingFeatureFile();\n+        final FeatureCodec<? extends Feature, ?> codec = FeatureManager.getCodecForFile(drivingFile);\n+        if (isAcceptableFeatureType(codec.getFeatureType())) {\n+            drivingFeatures = new FeatureDataSource<>(drivingFile, (FeatureCodec<F, ?>)codec);\n+\n+            final FeatureInput<F> drivingFeaturesInput = new FeatureInput<>(\"drivingVariantFile\", Collections.emptyMap(), drivingFile);\n+            features.addToFeatureSources(0, drivingFeaturesInput, codec.getFeatureType());\n+        } else {\n+            throw new UserException(\"File \" + drivingFile + \" contains features of the wrong type.\");\n+        }\n+\n+        if ( hasIntervals() ) {\n+            drivingFeatures.setIntervalsForTraversal(intervalsForTraversal);\n+        }\n+    }\n+\n+    protected abstract boolean isAcceptableFeatureType(Class<? extends Feature> featureType);\n+\n+    /**\n+     * Implementation of variant-based traversal.\n+     * Subclasses can override to provide their own behavior but default implementation should be suitable for most uses.\n+     */\n+    @Override\n+    public void traverse() {\n+        // Process each variant in the input stream.\n+        StreamSupport.stream(drivingFeatures.spliterator(), false)\n+                .forEach(feature -> {\n+                    final SimpleInterval variantInterval = new SimpleInterval(feature);\n+                    apply(feature,\n+                            new ReadsContext(reads, variantInterval),\n+                            new ReferenceContext(reference, variantInterval),\n+                            new FeatureContext(features, variantInterval));\n+                    progressMeter.update(feature);\n+                });\n+    }\n+\n+    /**\n+     * Process an individual variant. Must be implemented by tool authors.\n+     * In general, tool authors should simply stream their output from apply(), and maintain as little internal state\n+     * as possible.\n+     *\n+     * @param feature Current variant being processed.\n+     * @param readsContext Reads overlapping the current variant. Will be an empty, but non-null, context object\n+     *                     if there is no backing source of reads data (in which case all queries on it will return\n+     *                     an empty array/iterator)\n+     * @param referenceContext Reference bases spanning the current variant. Will be an empty, but non-null, context object\n+     *                         if there is no backing source of reference data (in which case all queries on it will return\n+     *                         an empty array/iterator). Can request extra bases of context around the current read's interval","path":"src/main/java/org/broadinstitute/hellbender/engine/FeatureWalker.java","position":79,"original_position":79,"commit_id":"355bf766c65ce6b700f47499f38fc995255eb07c","original_commit_id":"355bf766c65ce6b700f47499f38fc995255eb07c","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":"done","created_at":"2016-06-08T18:17:52Z","updated_at":"2016-06-08T18:17:52Z","html_url":"https://github.com/broadinstitute/gatk/pull/1888#discussion_r66310111","pull_request_url":"https://api.github.com/repos/broadinstitute/gatk/pulls/1888","_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/comments/66310111"},"html":{"href":"https://github.com/broadinstitute/gatk/pull/1888#discussion_r66310111"},"pull_request":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/1888"}}},"pull_request":{"url":"https://api.github.com/repos/broadinstitute/gatk/pulls/1888","id":72922579,"html_url":"https://github.com/broadinstitute/gatk/pull/1888","diff_url":"https://github.com/broadinstitute/gatk/pull/1888.diff","patch_url":"https://github.com/broadinstitute/gatk/pull/1888.patch","issue_url":"https://api.github.com/repos/broadinstitute/gatk/issues/1888","number":1888,"state":"open","locked":false,"title":"moved FeatureWalker and TSV code from protected","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":"partially addressed https://github.com/broadinstitute/gatk/issues/1427 (let's do this in a few steps to minimize risk)\r\n\r\n@droazen have a look\r\n(will remove them from protected when this is merged and we're reved up)","created_at":"2016-06-07T18:14:52Z","updated_at":"2016-06-08T18:17:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"374b9b90f0777856bca546c808edf8b2d31f6398","assignee":{"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},"milestone":null,"commits_url":"https://api.github.com/repos/broadinstitute/gatk/pulls/1888/commits","review_comments_url":"https://api.github.com/repos/broadinstitute/gatk/pulls/1888/comments","review_comment_url":"https://api.github.com/repos/broadinstitute/gatk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/broadinstitute/gatk/issues/1888/comments","statuses_url":"https://api.github.com/repos/broadinstitute/gatk/statuses/355bf766c65ce6b700f47499f38fc995255eb07c","head":{"label":"broadinstitute:ak_movedFromProtected_TSV_FeatureWalker","ref":"ak_movedFromProtected_TSV_FeatureWalker","sha":"355bf766c65ce6b700f47499f38fc995255eb07c","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":"gatk","full_name":"broadinstitute/gatk","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/gatk","description":"GATK4 development","fork":false,"url":"https://api.github.com/repos/broadinstitute/gatk","forks_url":"https://api.github.com/repos/broadinstitute/gatk/forks","keys_url":"https://api.github.com/repos/broadinstitute/gatk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broadinstitute/gatk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broadinstitute/gatk/teams","hooks_url":"https://api.github.com/repos/broadinstitute/gatk/hooks","issue_events_url":"https://api.github.com/repos/broadinstitute/gatk/issues/events{/number}","events_url":"https://api.github.com/repos/broadinstitute/gatk/events","assignees_url":"https://api.github.com/repos/broadinstitute/gatk/assignees{/user}","branches_url":"https://api.github.com/repos/broadinstitute/gatk/branches{/branch}","tags_url":"https://api.github.com/repos/broadinstitute/gatk/tags","blobs_url":"https://api.github.com/repos/broadinstitute/gatk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broadinstitute/gatk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broadinstitute/gatk/git/refs{/sha}","trees_url":"https://api.github.com/repos/broadinstitute/gatk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broadinstitute/gatk/statuses/{sha}","languages_url":"https://api.github.com/repos/broadinstitute/gatk/languages","stargazers_url":"https://api.github.com/repos/broadinstitute/gatk/stargazers","contributors_url":"https://api.github.com/repos/broadinstitute/gatk/contributors","subscribers_url":"https://api.github.com/repos/broadinstitute/gatk/subscribers","subscription_url":"https://api.github.com/repos/broadinstitute/gatk/subscription","commits_url":"https://api.github.com/repos/broadinstitute/gatk/commits{/sha}","git_commits_url":"https://api.github.com/repos/broadinstitute/gatk/git/commits{/sha}","comments_url":"https://api.github.com/repos/broadinstitute/gatk/comments{/number}","issue_comment_url":"https://api.github.com/repos/broadinstitute/gatk/issues/comments{/number}","contents_url":"https://api.github.com/repos/broadinstitute/gatk/contents/{+path}","compare_url":"https://api.github.com/repos/broadinstitute/gatk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broadinstitute/gatk/merges","archive_url":"https://api.github.com/repos/broadinstitute/gatk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broadinstitute/gatk/downloads","issues_url":"https://api.github.com/repos/broadinstitute/gatk/issues{/number}","pulls_url":"https://api.github.com/repos/broadinstitute/gatk/pulls{/number}","milestones_url":"https://api.github.com/repos/broadinstitute/gatk/milestones{/number}","notifications_url":"https://api.github.com/repos/broadinstitute/gatk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broadinstitute/gatk/labels{/name}","releases_url":"https://api.github.com/repos/broadinstitute/gatk/releases{/id}","deployments_url":"https://api.github.com/repos/broadinstitute/gatk/deployments","created_at":"2014-12-02T20:50:36Z","updated_at":"2016-05-25T16:03:17Z","pushed_at":"2016-06-08T18:08:53Z","git_url":"git://github.com/broadinstitute/gatk.git","ssh_url":"git@github.com:broadinstitute/gatk.git","clone_url":"https://github.com/broadinstitute/gatk.git","svn_url":"https://github.com/broadinstitute/gatk","homepage":"","size":112561,"stargazers_count":71,"watchers_count":71,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":369,"forks":28,"open_issues":369,"watchers":71,"default_branch":"master"}},"base":{"label":"broadinstitute:master","ref":"master","sha":"02499bc17b761750efa1091732e67c7d5315cb0b","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":"gatk","full_name":"broadinstitute/gatk","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/gatk","description":"GATK4 development","fork":false,"url":"https://api.github.com/repos/broadinstitute/gatk","forks_url":"https://api.github.com/repos/broadinstitute/gatk/forks","keys_url":"https://api.github.com/repos/broadinstitute/gatk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/broadinstitute/gatk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/broadinstitute/gatk/teams","hooks_url":"https://api.github.com/repos/broadinstitute/gatk/hooks","issue_events_url":"https://api.github.com/repos/broadinstitute/gatk/issues/events{/number}","events_url":"https://api.github.com/repos/broadinstitute/gatk/events","assignees_url":"https://api.github.com/repos/broadinstitute/gatk/assignees{/user}","branches_url":"https://api.github.com/repos/broadinstitute/gatk/branches{/branch}","tags_url":"https://api.github.com/repos/broadinstitute/gatk/tags","blobs_url":"https://api.github.com/repos/broadinstitute/gatk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/broadinstitute/gatk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/broadinstitute/gatk/git/refs{/sha}","trees_url":"https://api.github.com/repos/broadinstitute/gatk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/broadinstitute/gatk/statuses/{sha}","languages_url":"https://api.github.com/repos/broadinstitute/gatk/languages","stargazers_url":"https://api.github.com/repos/broadinstitute/gatk/stargazers","contributors_url":"https://api.github.com/repos/broadinstitute/gatk/contributors","subscribers_url":"https://api.github.com/repos/broadinstitute/gatk/subscribers","subscription_url":"https://api.github.com/repos/broadinstitute/gatk/subscription","commits_url":"https://api.github.com/repos/broadinstitute/gatk/commits{/sha}","git_commits_url":"https://api.github.com/repos/broadinstitute/gatk/git/commits{/sha}","comments_url":"https://api.github.com/repos/broadinstitute/gatk/comments{/number}","issue_comment_url":"https://api.github.com/repos/broadinstitute/gatk/issues/comments{/number}","contents_url":"https://api.github.com/repos/broadinstitute/gatk/contents/{+path}","compare_url":"https://api.github.com/repos/broadinstitute/gatk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/broadinstitute/gatk/merges","archive_url":"https://api.github.com/repos/broadinstitute/gatk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/broadinstitute/gatk/downloads","issues_url":"https://api.github.com/repos/broadinstitute/gatk/issues{/number}","pulls_url":"https://api.github.com/repos/broadinstitute/gatk/pulls{/number}","milestones_url":"https://api.github.com/repos/broadinstitute/gatk/milestones{/number}","notifications_url":"https://api.github.com/repos/broadinstitute/gatk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/broadinstitute/gatk/labels{/name}","releases_url":"https://api.github.com/repos/broadinstitute/gatk/releases{/id}","deployments_url":"https://api.github.com/repos/broadinstitute/gatk/deployments","created_at":"2014-12-02T20:50:36Z","updated_at":"2016-05-25T16:03:17Z","pushed_at":"2016-06-08T18:08:53Z","git_url":"git://github.com/broadinstitute/gatk.git","ssh_url":"git@github.com:broadinstitute/gatk.git","clone_url":"https://github.com/broadinstitute/gatk.git","svn_url":"https://github.com/broadinstitute/gatk","homepage":"","size":112561,"stargazers_count":71,"watchers_count":71,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":369,"forks":28,"open_issues":369,"watchers":71,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/1888"},"html":{"href":"https://github.com/broadinstitute/gatk/pull/1888"},"issue":{"href":"https://api.github.com/repos/broadinstitute/gatk/issues/1888"},"comments":{"href":"https://api.github.com/repos/broadinstitute/gatk/issues/1888/comments"},"review_comments":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/1888/comments"},"review_comment":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/1888/commits"},"statuses":{"href":"https://api.github.com/repos/broadinstitute/gatk/statuses/355bf766c65ce6b700f47499f38fc995255eb07c"}}}}
{"actor":{"display_login":"akiezun"}}