{"action":"created","comment":{"url":"https://api.github.com/repos/hammerlab/biokepi/pulls/comments/56046160","id":56046160,"diff_hunk":"@@ -24,6 +24,48 @@ let create_dict ~(run_with:Machine.t) fasta =\n       on_failure_activate (Remove.file ~run_with dest);\n     ]\n \n+(* Sort the given VCF.\n+\n+- [?sequence_dict] A sequence dictionary by which the VCF will be sorted.\n+*)\n+let sort_vcf ~(run_with:Machine.t) ?(sequence_dict) input_vcf =\n+  let open KEDSL in\n+  let picard = Machine.get_tool run_with Tool.Default.picard in\n+  let sequence_name =\n+    match sequence_dict with\n+    | None -> \"default\"\n+    | Some d -> Filename.basename d#product#path\n+  in\n+  let src = input_vcf#product#path in\n+  let input_vcf_base = Filename.basename src in\n+  let dest =\n+    sprintf \"%s.sorted-by-%s.vcf\"\n+      (Filename.chop_suffix src \".vcf\") sequence_name in\n+  let name = sprintf \"picard-sort-vcf-%s-by-%s\" input_vcf_base sequence_name in\n+  let sequence_dict_opt =\n+    match sequence_dict with\n+    | None -> \"\"\n+    | Some d -> sprintf \"SEQUENCE_DICTIONARY= %s\" (Filename.quote d#product#path)\n+  in\n+  let sequence_dict_edge =\n+    match sequence_dict with\n+    | None -> []\n+    | Some d -> [depends_on d]\n+  in\n+  let program =\n+    Program.(Tool.(init picard) &&\n+             (shf \"java -jar $PICARD_JAR CreateSequenceDictionary %s I= %s O= %s\"","path":"src/lib/picard.ml","position":null,"original_position":34,"commit_id":"126864b4b41aa67d817e6ca3628991a1a6aed514","original_commit_id":"d3e507bcf094e5c6dfcce17843e0c7966ecf0486","user":{"login":"ihodes","id":167803,"avatar_url":"https://avatars.githubusercontent.com/u/167803?v=3","gravatar_id":"","url":"https://api.github.com/users/ihodes","html_url":"https://github.com/ihodes","followers_url":"https://api.github.com/users/ihodes/followers","following_url":"https://api.github.com/users/ihodes/following{/other_user}","gists_url":"https://api.github.com/users/ihodes/gists{/gist_id}","starred_url":"https://api.github.com/users/ihodes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ihodes/subscriptions","organizations_url":"https://api.github.com/users/ihodes/orgs","repos_url":"https://api.github.com/users/ihodes/repos","events_url":"https://api.github.com/users/ihodes/events{/privacy}","received_events_url":"https://api.github.com/users/ihodes/received_events","type":"User","site_admin":false},"body":"Ah yes, thank you! Fixed.","created_at":"2016-03-14T17:59:56Z","updated_at":"2016-03-14T17:59:56Z","html_url":"https://github.com/hammerlab/biokepi/pull/169#discussion_r56046160","pull_request_url":"https://api.github.com/repos/hammerlab/biokepi/pulls/169","_links":{"self":{"href":"https://api.github.com/repos/hammerlab/biokepi/pulls/comments/56046160"},"html":{"href":"https://github.com/hammerlab/biokepi/pull/169#discussion_r56046160"},"pull_request":{"href":"https://api.github.com/repos/hammerlab/biokepi/pulls/169"}}},"pull_request":{"url":"https://api.github.com/repos/hammerlab/biokepi/pulls/169","id":62783049,"html_url":"https://github.com/hammerlab/biokepi/pull/169","diff_url":"https://github.com/hammerlab/biokepi/pull/169.diff","patch_url":"https://github.com/hammerlab/biokepi/pull/169.patch","issue_url":"https://api.github.com/repos/hammerlab/biokepi/issues/169","number":169,"state":"open","locked":false,"title":"Add Picard.sort_vcf","user":{"login":"ihodes","id":167803,"avatar_url":"https://avatars.githubusercontent.com/u/167803?v=3","gravatar_id":"","url":"https://api.github.com/users/ihodes","html_url":"https://github.com/ihodes","followers_url":"https://api.github.com/users/ihodes/followers","following_url":"https://api.github.com/users/ihodes/following{/other_user}","gists_url":"https://api.github.com/users/ihodes/gists{/gist_id}","starred_url":"https://api.github.com/users/ihodes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ihodes/subscriptions","organizations_url":"https://api.github.com/users/ihodes/orgs","repos_url":"https://api.github.com/users/ihodes/repos","events_url":"https://api.github.com/users/ihodes/events{/privacy}","received_events_url":"https://api.github.com/users/ihodes/received_events","type":"User","site_admin":false},"body":"This is necessary for some Picard tools requiring contigs to appear in\r\nthe same order in both the reference and a VCF like dbSNP.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"35\" align=\"absmiddle\" alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/hammerlab/biokepi/169)\n<!-- Reviewable:end -->\n","created_at":"2016-03-14T17:09:31Z","updated_at":"2016-03-14T17:59:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d3c5e3699331c96d97391a5b4ec7dd7a036cacc","assignee":{"login":"smondet","id":617111,"avatar_url":"https://avatars.githubusercontent.com/u/617111?v=3","gravatar_id":"","url":"https://api.github.com/users/smondet","html_url":"https://github.com/smondet","followers_url":"https://api.github.com/users/smondet/followers","following_url":"https://api.github.com/users/smondet/following{/other_user}","gists_url":"https://api.github.com/users/smondet/gists{/gist_id}","starred_url":"https://api.github.com/users/smondet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smondet/subscriptions","organizations_url":"https://api.github.com/users/smondet/orgs","repos_url":"https://api.github.com/users/smondet/repos","events_url":"https://api.github.com/users/smondet/events{/privacy}","received_events_url":"https://api.github.com/users/smondet/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/hammerlab/biokepi/pulls/169/commits","review_comments_url":"https://api.github.com/repos/hammerlab/biokepi/pulls/169/comments","review_comment_url":"https://api.github.com/repos/hammerlab/biokepi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hammerlab/biokepi/issues/169/comments","statuses_url":"https://api.github.com/repos/hammerlab/biokepi/statuses/126864b4b41aa67d817e6ca3628991a1a6aed514","head":{"label":"hammerlab:add-picard-sort-vcf","ref":"add-picard-sort-vcf","sha":"126864b4b41aa67d817e6ca3628991a1a6aed514","user":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"repo":{"id":28102309,"name":"biokepi","full_name":"hammerlab/biokepi","owner":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hammerlab/biokepi","description":"Bioinformatics Ketrew Pipelines","fork":false,"url":"https://api.github.com/repos/hammerlab/biokepi","forks_url":"https://api.github.com/repos/hammerlab/biokepi/forks","keys_url":"https://api.github.com/repos/hammerlab/biokepi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hammerlab/biokepi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hammerlab/biokepi/teams","hooks_url":"https://api.github.com/repos/hammerlab/biokepi/hooks","issue_events_url":"https://api.github.com/repos/hammerlab/biokepi/issues/events{/number}","events_url":"https://api.github.com/repos/hammerlab/biokepi/events","assignees_url":"https://api.github.com/repos/hammerlab/biokepi/assignees{/user}","branches_url":"https://api.github.com/repos/hammerlab/biokepi/branches{/branch}","tags_url":"https://api.github.com/repos/hammerlab/biokepi/tags","blobs_url":"https://api.github.com/repos/hammerlab/biokepi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hammerlab/biokepi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hammerlab/biokepi/git/refs{/sha}","trees_url":"https://api.github.com/repos/hammerlab/biokepi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hammerlab/biokepi/statuses/{sha}","languages_url":"https://api.github.com/repos/hammerlab/biokepi/languages","stargazers_url":"https://api.github.com/repos/hammerlab/biokepi/stargazers","contributors_url":"https://api.github.com/repos/hammerlab/biokepi/contributors","subscribers_url":"https://api.github.com/repos/hammerlab/biokepi/subscribers","subscription_url":"https://api.github.com/repos/hammerlab/biokepi/subscription","commits_url":"https://api.github.com/repos/hammerlab/biokepi/commits{/sha}","git_commits_url":"https://api.github.com/repos/hammerlab/biokepi/git/commits{/sha}","comments_url":"https://api.github.com/repos/hammerlab/biokepi/comments{/number}","issue_comment_url":"https://api.github.com/repos/hammerlab/biokepi/issues/comments{/number}","contents_url":"https://api.github.com/repos/hammerlab/biokepi/contents/{+path}","compare_url":"https://api.github.com/repos/hammerlab/biokepi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hammerlab/biokepi/merges","archive_url":"https://api.github.com/repos/hammerlab/biokepi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hammerlab/biokepi/downloads","issues_url":"https://api.github.com/repos/hammerlab/biokepi/issues{/number}","pulls_url":"https://api.github.com/repos/hammerlab/biokepi/pulls{/number}","milestones_url":"https://api.github.com/repos/hammerlab/biokepi/milestones{/number}","notifications_url":"https://api.github.com/repos/hammerlab/biokepi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hammerlab/biokepi/labels{/name}","releases_url":"https://api.github.com/repos/hammerlab/biokepi/releases{/id}","deployments_url":"https://api.github.com/repos/hammerlab/biokepi/deployments","created_at":"2014-12-16T19:19:07Z","updated_at":"2016-03-05T20:47:57Z","pushed_at":"2016-03-14T17:49:46Z","git_url":"git://github.com/hammerlab/biokepi.git","ssh_url":"git@github.com:hammerlab/biokepi.git","clone_url":"https://github.com/hammerlab/biokepi.git","svn_url":"https://github.com/hammerlab/biokepi","homepage":null,"size":609,"stargazers_count":16,"watchers_count":16,"language":"OCaml","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":63,"forks":1,"open_issues":63,"watchers":16,"default_branch":"master"}},"base":{"label":"hammerlab:master","ref":"master","sha":"10223ec9baffa50b94785444ced2477e51b4f883","user":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"repo":{"id":28102309,"name":"biokepi","full_name":"hammerlab/biokepi","owner":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hammerlab/biokepi","description":"Bioinformatics Ketrew Pipelines","fork":false,"url":"https://api.github.com/repos/hammerlab/biokepi","forks_url":"https://api.github.com/repos/hammerlab/biokepi/forks","keys_url":"https://api.github.com/repos/hammerlab/biokepi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hammerlab/biokepi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hammerlab/biokepi/teams","hooks_url":"https://api.github.com/repos/hammerlab/biokepi/hooks","issue_events_url":"https://api.github.com/repos/hammerlab/biokepi/issues/events{/number}","events_url":"https://api.github.com/repos/hammerlab/biokepi/events","assignees_url":"https://api.github.com/repos/hammerlab/biokepi/assignees{/user}","branches_url":"https://api.github.com/repos/hammerlab/biokepi/branches{/branch}","tags_url":"https://api.github.com/repos/hammerlab/biokepi/tags","blobs_url":"https://api.github.com/repos/hammerlab/biokepi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hammerlab/biokepi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hammerlab/biokepi/git/refs{/sha}","trees_url":"https://api.github.com/repos/hammerlab/biokepi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hammerlab/biokepi/statuses/{sha}","languages_url":"https://api.github.com/repos/hammerlab/biokepi/languages","stargazers_url":"https://api.github.com/repos/hammerlab/biokepi/stargazers","contributors_url":"https://api.github.com/repos/hammerlab/biokepi/contributors","subscribers_url":"https://api.github.com/repos/hammerlab/biokepi/subscribers","subscription_url":"https://api.github.com/repos/hammerlab/biokepi/subscription","commits_url":"https://api.github.com/repos/hammerlab/biokepi/commits{/sha}","git_commits_url":"https://api.github.com/repos/hammerlab/biokepi/git/commits{/sha}","comments_url":"https://api.github.com/repos/hammerlab/biokepi/comments{/number}","issue_comment_url":"https://api.github.com/repos/hammerlab/biokepi/issues/comments{/number}","contents_url":"https://api.github.com/repos/hammerlab/biokepi/contents/{+path}","compare_url":"https://api.github.com/repos/hammerlab/biokepi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hammerlab/biokepi/merges","archive_url":"https://api.github.com/repos/hammerlab/biokepi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hammerlab/biokepi/downloads","issues_url":"https://api.github.com/repos/hammerlab/biokepi/issues{/number}","pulls_url":"https://api.github.com/repos/hammerlab/biokepi/pulls{/number}","milestones_url":"https://api.github.com/repos/hammerlab/biokepi/milestones{/number}","notifications_url":"https://api.github.com/repos/hammerlab/biokepi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hammerlab/biokepi/labels{/name}","releases_url":"https://api.github.com/repos/hammerlab/biokepi/releases{/id}","deployments_url":"https://api.github.com/repos/hammerlab/biokepi/deployments","created_at":"2014-12-16T19:19:07Z","updated_at":"2016-03-05T20:47:57Z","pushed_at":"2016-03-14T17:49:46Z","git_url":"git://github.com/hammerlab/biokepi.git","ssh_url":"git@github.com:hammerlab/biokepi.git","clone_url":"https://github.com/hammerlab/biokepi.git","svn_url":"https://github.com/hammerlab/biokepi","homepage":null,"size":609,"stargazers_count":16,"watchers_count":16,"language":"OCaml","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":63,"forks":1,"open_issues":63,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hammerlab/biokepi/pulls/169"},"html":{"href":"https://github.com/hammerlab/biokepi/pull/169"},"issue":{"href":"https://api.github.com/repos/hammerlab/biokepi/issues/169"},"comments":{"href":"https://api.github.com/repos/hammerlab/biokepi/issues/169/comments"},"review_comments":{"href":"https://api.github.com/repos/hammerlab/biokepi/pulls/169/comments"},"review_comment":{"href":"https://api.github.com/repos/hammerlab/biokepi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hammerlab/biokepi/pulls/169/commits"},"statuses":{"href":"https://api.github.com/repos/hammerlab/biokepi/statuses/126864b4b41aa67d817e6ca3628991a1a6aed514"}}}}