{"action":"created","comment":{"url":"https://api.github.com/repos/broadinstitute/gatk/pulls/comments/42186662","id":42186662,"diff_hunk":"@@ -0,0 +1,125 @@\n+package org.broadinstitute.hellbender.tools.spark.transforms.bqsr;\n+\n+import htsjdk.samtools.SAMFileHeader;\n+import htsjdk.samtools.SAMSequenceDictionary;\n+import org.apache.spark.broadcast.Broadcast;\n+import org.broadinstitute.hellbender.engine.ReadContextData;\n+import org.broadinstitute.hellbender.engine.ReferenceDataSource;\n+import org.broadinstitute.hellbender.engine.ReferenceMemorySource;\n+import org.broadinstitute.hellbender.engine.ContextShard;\n+import org.broadinstitute.hellbender.engine.spark.AuthHolder;\n+import org.broadinstitute.hellbender.utils.gcs.BucketUtils;\n+import org.broadinstitute.hellbender.utils.read.GATKRead;\n+import org.broadinstitute.hellbender.utils.read.ReadUtils;\n+import org.broadinstitute.hellbender.utils.recalibration.BaseRecalibrationEngine;\n+import org.broadinstitute.hellbender.utils.recalibration.QuantizationInfo;\n+import org.broadinstitute.hellbender.utils.recalibration.RecalUtils;\n+import org.broadinstitute.hellbender.utils.recalibration.RecalibrationArgumentCollection;\n+import org.broadinstitute.hellbender.utils.recalibration.RecalibrationTables;\n+import org.broadinstitute.hellbender.utils.recalibration.covariates.StandardCovariateList;\n+import org.broadinstitute.hellbender.utils.reference.ReferenceBases;\n+import org.broadinstitute.hellbender.utils.variant.Variant;\n+\n+import java.io.FileNotFoundException;\n+import java.io.IOException;\n+import java.io.OutputStream;\n+import java.io.PrintStream;\n+import java.io.Serializable;\n+import java.util.ArrayList;\n+import java.util.Iterator;\n+\n+/**\n+ * A lightweight wrapper over BaseRecalibrationEngine to make it easier to use from Spark.\n+ * Takes in reads + contextual data (overlapping reference bases and variants), spits out RecalibrationTables.\n+ */\n+public final class BaseRecalibratorEngineSpark implements Serializable {\n+    private static final long serialVersionUID = 1L;\n+\n+    private Broadcast<SAMFileHeader> headerView;\n+    private transient SAMFileHeader header;\n+    private Broadcast<SAMSequenceDictionary> referenceSequenceDictionaryView;","path":"src/main/java/org/broadinstitute/hellbender/tools/spark/transforms/bqsr/BaseRecalibratorEngineSpark.java","position":40,"original_position":40,"commit_id":"83deaa7a5f2bac45869060395707b0bd6f5c4f32","original_commit_id":"83deaa7a5f2bac45869060395707b0bd6f5c4f32","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":"View -> Broadcast","created_at":"2015-10-15T22:02:20Z","updated_at":"2015-10-15T22:02:20Z","html_url":"https://github.com/broadinstitute/gatk/pull/987#discussion_r42186662","pull_request_url":"https://api.github.com/repos/broadinstitute/gatk/pulls/987","_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/comments/42186662"},"html":{"href":"https://github.com/broadinstitute/gatk/pull/987#discussion_r42186662"},"pull_request":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/987"}}},"pull_request":{"url":"https://api.github.com/repos/broadinstitute/gatk/pulls/987","id":47217863,"html_url":"https://github.com/broadinstitute/gatk/pull/987","diff_url":"https://github.com/broadinstitute/gatk/pull/987.diff","patch_url":"https://github.com/broadinstitute/gatk/pull/987.patch","issue_url":"https://api.github.com/repos/broadinstitute/gatk/issues/987","number":987,"state":"open","locked":false,"title":"Spark Optimized BaseRecalibrator","user":{"login":"jean-philippe-martin","id":10458949,"avatar_url":"https://avatars.githubusercontent.com/u/10458949?v=3","gravatar_id":"","url":"https://api.github.com/users/jean-philippe-martin","html_url":"https://github.com/jean-philippe-martin","followers_url":"https://api.github.com/users/jean-philippe-martin/followers","following_url":"https://api.github.com/users/jean-philippe-martin/following{/other_user}","gists_url":"https://api.github.com/users/jean-philippe-martin/gists{/gist_id}","starred_url":"https://api.github.com/users/jean-philippe-martin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jean-philippe-martin/subscriptions","organizations_url":"https://api.github.com/users/jean-philippe-martin/orgs","repos_url":"https://api.github.com/users/jean-philippe-martin/repos","events_url":"https://api.github.com/users/jean-philippe-martin/events{/privacy}","received_events_url":"https://api.github.com/users/jean-philippe-martin/received_events","type":"User","site_admin":false},"body":"This code (building off of Louis' fixes) adds the following:\r\n\r\n * AuthHolder, a replacement for the PipelineOptions. It stores the authentication info we need for GCS and supports both API_KEY and client-secrets.json. I adapted a few classes to accept an AuthHolder.\r\n\r\n * BaseRecalibratorOptimizedSpark, a port of the \"shard\" approach I first did on the Dataflow side. Note that currently this code only performs reasonably for small inputs if you specify -L on the command line (for large inputs it doesn't matter).\r\n\r\n","created_at":"2015-10-08T23:10:13Z","updated_at":"2015-10-15T22:02:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"209aec48d88ee310c5b50a4129339eb98111356c","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":null,"commits_url":"https://api.github.com/repos/broadinstitute/gatk/pulls/987/commits","review_comments_url":"https://api.github.com/repos/broadinstitute/gatk/pulls/987/comments","review_comment_url":"https://api.github.com/repos/broadinstitute/gatk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/broadinstitute/gatk/issues/987/comments","statuses_url":"https://api.github.com/repos/broadinstitute/gatk/statuses/83deaa7a5f2bac45869060395707b0bd6f5c4f32","head":{"label":"broadinstitute:jp_spark_br","ref":"jp_spark_br","sha":"83deaa7a5f2bac45869060395707b0bd6f5c4f32","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}","created_at":"2014-12-02T20:50:36Z","updated_at":"2015-10-13T18:11:50Z","pushed_at":"2015-10-15T19:24:41Z","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":47745,"stargazers_count":31,"watchers_count":31,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":227,"forks":9,"open_issues":227,"watchers":31,"default_branch":"master"}},"base":{"label":"broadinstitute:master","ref":"master","sha":"9c9292423a73fd04b0fd7a3bc47c2f242a6aeaf1","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}","created_at":"2014-12-02T20:50:36Z","updated_at":"2015-10-13T18:11:50Z","pushed_at":"2015-10-15T19:24:41Z","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":47745,"stargazers_count":31,"watchers_count":31,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":227,"forks":9,"open_issues":227,"watchers":31,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/987"},"html":{"href":"https://github.com/broadinstitute/gatk/pull/987"},"issue":{"href":"https://api.github.com/repos/broadinstitute/gatk/issues/987"},"comments":{"href":"https://api.github.com/repos/broadinstitute/gatk/issues/987/comments"},"review_comments":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/987/comments"},"review_comment":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/broadinstitute/gatk/pulls/987/commits"},"statuses":{"href":"https://api.github.com/repos/broadinstitute/gatk/statuses/83deaa7a5f2bac45869060395707b0bd6f5c4f32"}}}}