{"action":"created","comment":{"url":"https://api.github.com/repos/genome/genome/pulls/comments/54498284","id":54498284,"diff_hunk":"@@ -118,4 +144,135 @@ sub _calculate_haploid_coverage {\n     return 1;\n }\n \n+\n+sub output_metrics_as_tsv {\n+    my $self = shift;\n+    my $qc_metric_results = shift;\n+    \n+    my @headers = qw/\n+                       sample_name\n+                       build_id\n+                       instrument_data_count\n+                       instrument_data_ids\n+                       bam_path\n+                       pf_reads\n+                       aligned_bases\n+                       alignment_rate\n+                       duplication_rate\n+                       first_of_pair_mismatch_rate\n+                       second_of_pair_mismatch_rate\n+                       microarray_chipmix\n+                       microarray_freemix\n+                   /;\n+\n+    # The results themselves have a type, eg. wgs or exome\n+    # Rather than relying on a user input profile, could use the result type instead\n+    my @data;\n+    if ($self->_tsv_output_profile eq 'wgs') {\n+        #TODO: Add additional WGS specific metrics?\n+        push @headers, qw/\n+                             chipmix\n+                             freemix\n+                             haploid_coverage\n+                         /;\n+        for my $qc_metric_result (@$qc_metric_results) {\n+            my $data = $self->_base_hash_ref_for_qc_metric_result($qc_metric_result);\n+            $data->{'chipmix'} = $qc_metric_result->{ALL}->{CHIPMIX};\n+            $data->{'freemix'} = $qc_metric_result->{ALL}->{FREEMIX};\n+            $data->{'haploid_coverage'} = $qc_metric_result->{HAPLOID_COVERAGE};\n+            $self->_add_microarray_vbid_result_metrics_to_hash_ref($qc_metric_result,$data);\n+            push @data, $data;\n+        }\n+    } elsif ($self->_tsv_output_profile eq 'exome') {\n+        push @headers, qw/\n+                             mean_target_coverage\n+                             pct_usable_bases_on_target\n+                             pct_target_bases_20x\n+                             pct_exc_off_target\n+                             pct_exc_dupe\n+                             pct_exc_overlap\n+                             pct_exc_mapq\n+                             pct_exc_baseq\n+                         /;\n+        for my $qc_metric_result(@$qc_metric_results) {\n+            my $data = $self->_base_hash_ref_for_qc_metric_result($qc_metric_result);\n+            $data->{'mean_target_coverage'} = $qc_metric_result->{MEAN_TARGET_COVERAGE};\n+            $data->{'pct_usable_bases_on_target'} = $qc_metric_result->{PCT_USABLE_BASES_ON_TARGET};\n+            $data->{'pct_target_bases_20x'} = $qc_metric_result->{PCT_TARGET_BASES_20X};\n+            $data->{'pct_exc_off_target'} = $qc_metric_result->{PCT_EXC_OFF_TARGET};\n+            $data->{'pct_exc_dupe'} = $qc_metric_result->{PCT_EXC_DUPE};\n+            $data->{'pct_exc_overlap'} = $qc_metric_result->{PCT_EXC_OVERLAP};\n+            $data->{'pct_exc_mapq'} = $qc_metric_result->{PCT_EXC_MAPQ};\n+            $data->{'pct_exc_baseq'} = $qc_metric_result->{PCT_EXC_BASEQ};","path":"lib/perl/Genome/Qc/Command/BuildMetrics.pm","position":140,"original_position":140,"commit_id":"867eab97034b39817768d3c51064e1607eeb0b06","original_commit_id":"867eab97034b39817768d3c51064e1607eeb0b06","user":{"login":"tmooney","id":187262,"avatar_url":"https://avatars.githubusercontent.com/u/187262?v=3","gravatar_id":"","url":"https://api.github.com/users/tmooney","html_url":"https://github.com/tmooney","followers_url":"https://api.github.com/users/tmooney/followers","following_url":"https://api.github.com/users/tmooney/following{/other_user}","gists_url":"https://api.github.com/users/tmooney/gists{/gist_id}","starred_url":"https://api.github.com/users/tmooney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmooney/subscriptions","organizations_url":"https://api.github.com/users/tmooney/orgs","repos_url":"https://api.github.com/users/tmooney/repos","events_url":"https://api.github.com/users/tmooney/events{/privacy}","received_events_url":"https://api.github.com/users/tmooney/received_events","type":"User","site_admin":false},"body":"These could be:\r\n```perl\r\nfor my $column (@headers) {\r\n  $data->{$column} = $qc_metric_result->{uc $column};\r\n}\r\n```","created_at":"2016-02-29T23:28:11Z","updated_at":"2016-02-29T23:28:11Z","html_url":"https://github.com/genome/genome/pull/1285#discussion_r54498284","pull_request_url":"https://api.github.com/repos/genome/genome/pulls/1285","_links":{"self":{"href":"https://api.github.com/repos/genome/genome/pulls/comments/54498284"},"html":{"href":"https://github.com/genome/genome/pull/1285#discussion_r54498284"},"pull_request":{"href":"https://api.github.com/repos/genome/genome/pulls/1285"}}},"pull_request":{"url":"https://api.github.com/repos/genome/genome/pulls/1285","id":61117553,"html_url":"https://github.com/genome/genome/pull/1285","diff_url":"https://github.com/genome/genome/pull/1285.diff","patch_url":"https://github.com/genome/genome/pull/1285.patch","issue_url":"https://api.github.com/repos/genome/genome/issues/1285","number":1285,"state":"open","locked":false,"title":"Qc build metric report","user":{"login":"jasonwalker80","id":884229,"avatar_url":"https://avatars.githubusercontent.com/u/884229?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonwalker80","html_url":"https://github.com/jasonwalker80","followers_url":"https://api.github.com/users/jasonwalker80/followers","following_url":"https://api.github.com/users/jasonwalker80/following{/other_user}","gists_url":"https://api.github.com/users/jasonwalker80/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonwalker80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonwalker80/subscriptions","organizations_url":"https://api.github.com/users/jasonwalker80/orgs","repos_url":"https://api.github.com/users/jasonwalker80/repos","events_url":"https://api.github.com/users/jasonwalker80/events{/privacy}","received_events_url":"https://api.github.com/users/jasonwalker80/received_events","type":"User","site_admin":false},"body":"Additional option to output metrics as TSV.  Two profiles, one for WGS and one for exome, that determine the output columns for each config type.","created_at":"2016-02-29T17:56:35Z","updated_at":"2016-02-29T23:28:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be65563cf2c069cb3e44b1e1ba5e79eedf04b4fd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/genome/genome/pulls/1285/commits","review_comments_url":"https://api.github.com/repos/genome/genome/pulls/1285/comments","review_comment_url":"https://api.github.com/repos/genome/genome/pulls/comments{/number}","comments_url":"https://api.github.com/repos/genome/genome/issues/1285/comments","statuses_url":"https://api.github.com/repos/genome/genome/statuses/867eab97034b39817768d3c51064e1607eeb0b06","head":{"label":"jasonwalker80:qc_build_metric_report","ref":"qc_build_metric_report","sha":"867eab97034b39817768d3c51064e1607eeb0b06","user":{"login":"jasonwalker80","id":884229,"avatar_url":"https://avatars.githubusercontent.com/u/884229?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonwalker80","html_url":"https://github.com/jasonwalker80","followers_url":"https://api.github.com/users/jasonwalker80/followers","following_url":"https://api.github.com/users/jasonwalker80/following{/other_user}","gists_url":"https://api.github.com/users/jasonwalker80/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonwalker80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonwalker80/subscriptions","organizations_url":"https://api.github.com/users/jasonwalker80/orgs","repos_url":"https://api.github.com/users/jasonwalker80/repos","events_url":"https://api.github.com/users/jasonwalker80/events{/privacy}","received_events_url":"https://api.github.com/users/jasonwalker80/received_events","type":"User","site_admin":false},"repo":{"id":24192531,"name":"genome","full_name":"jasonwalker80/genome","owner":{"login":"jasonwalker80","id":884229,"avatar_url":"https://avatars.githubusercontent.com/u/884229?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonwalker80","html_url":"https://github.com/jasonwalker80","followers_url":"https://api.github.com/users/jasonwalker80/followers","following_url":"https://api.github.com/users/jasonwalker80/following{/other_user}","gists_url":"https://api.github.com/users/jasonwalker80/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonwalker80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonwalker80/subscriptions","organizations_url":"https://api.github.com/users/jasonwalker80/orgs","repos_url":"https://api.github.com/users/jasonwalker80/repos","events_url":"https://api.github.com/users/jasonwalker80/events{/privacy}","received_events_url":"https://api.github.com/users/jasonwalker80/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jasonwalker80/genome","description":"49","fork":true,"url":"https://api.github.com/repos/jasonwalker80/genome","forks_url":"https://api.github.com/repos/jasonwalker80/genome/forks","keys_url":"https://api.github.com/repos/jasonwalker80/genome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jasonwalker80/genome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jasonwalker80/genome/teams","hooks_url":"https://api.github.com/repos/jasonwalker80/genome/hooks","issue_events_url":"https://api.github.com/repos/jasonwalker80/genome/issues/events{/number}","events_url":"https://api.github.com/repos/jasonwalker80/genome/events","assignees_url":"https://api.github.com/repos/jasonwalker80/genome/assignees{/user}","branches_url":"https://api.github.com/repos/jasonwalker80/genome/branches{/branch}","tags_url":"https://api.github.com/repos/jasonwalker80/genome/tags","blobs_url":"https://api.github.com/repos/jasonwalker80/genome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jasonwalker80/genome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jasonwalker80/genome/git/refs{/sha}","trees_url":"https://api.github.com/repos/jasonwalker80/genome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jasonwalker80/genome/statuses/{sha}","languages_url":"https://api.github.com/repos/jasonwalker80/genome/languages","stargazers_url":"https://api.github.com/repos/jasonwalker80/genome/stargazers","contributors_url":"https://api.github.com/repos/jasonwalker80/genome/contributors","subscribers_url":"https://api.github.com/repos/jasonwalker80/genome/subscribers","subscription_url":"https://api.github.com/repos/jasonwalker80/genome/subscription","commits_url":"https://api.github.com/repos/jasonwalker80/genome/commits{/sha}","git_commits_url":"https://api.github.com/repos/jasonwalker80/genome/git/commits{/sha}","comments_url":"https://api.github.com/repos/jasonwalker80/genome/comments{/number}","issue_comment_url":"https://api.github.com/repos/jasonwalker80/genome/issues/comments{/number}","contents_url":"https://api.github.com/repos/jasonwalker80/genome/contents/{+path}","compare_url":"https://api.github.com/repos/jasonwalker80/genome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jasonwalker80/genome/merges","archive_url":"https://api.github.com/repos/jasonwalker80/genome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jasonwalker80/genome/downloads","issues_url":"https://api.github.com/repos/jasonwalker80/genome/issues{/number}","pulls_url":"https://api.github.com/repos/jasonwalker80/genome/pulls{/number}","milestones_url":"https://api.github.com/repos/jasonwalker80/genome/milestones{/number}","notifications_url":"https://api.github.com/repos/jasonwalker80/genome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jasonwalker80/genome/labels{/name}","releases_url":"https://api.github.com/repos/jasonwalker80/genome/releases{/id}","deployments_url":"https://api.github.com/repos/jasonwalker80/genome/deployments","created_at":"2014-09-18T15:00:23Z","updated_at":"2014-10-23T17:11:01Z","pushed_at":"2016-02-29T20:37:53Z","git_url":"git://github.com/jasonwalker80/genome.git","ssh_url":"git@github.com:jasonwalker80/genome.git","clone_url":"https://github.com/jasonwalker80/genome.git","svn_url":"https://github.com/jasonwalker80/genome","homepage":"","size":177070,"stargazers_count":0,"watchers_count":0,"language":"Perl","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"genome:master","ref":"master","sha":"a333a65be00a0d46c22c34df09853573bc47d974","user":{"login":"genome","id":318108,"avatar_url":"https://avatars.githubusercontent.com/u/318108?v=3","gravatar_id":"","url":"https://api.github.com/users/genome","html_url":"https://github.com/genome","followers_url":"https://api.github.com/users/genome/followers","following_url":"https://api.github.com/users/genome/following{/other_user}","gists_url":"https://api.github.com/users/genome/gists{/gist_id}","starred_url":"https://api.github.com/users/genome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genome/subscriptions","organizations_url":"https://api.github.com/users/genome/orgs","repos_url":"https://api.github.com/users/genome/repos","events_url":"https://api.github.com/users/genome/events{/privacy}","received_events_url":"https://api.github.com/users/genome/received_events","type":"Organization","site_admin":false},"repo":{"id":23442737,"name":"genome","full_name":"genome/genome","owner":{"login":"genome","id":318108,"avatar_url":"https://avatars.githubusercontent.com/u/318108?v=3","gravatar_id":"","url":"https://api.github.com/users/genome","html_url":"https://github.com/genome","followers_url":"https://api.github.com/users/genome/followers","following_url":"https://api.github.com/users/genome/following{/other_user}","gists_url":"https://api.github.com/users/genome/gists{/gist_id}","starred_url":"https://api.github.com/users/genome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genome/subscriptions","organizations_url":"https://api.github.com/users/genome/orgs","repos_url":"https://api.github.com/users/genome/repos","events_url":"https://api.github.com/users/genome/events{/privacy}","received_events_url":"https://api.github.com/users/genome/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/genome/genome","description":"Core modules used by the GMS","fork":false,"url":"https://api.github.com/repos/genome/genome","forks_url":"https://api.github.com/repos/genome/genome/forks","keys_url":"https://api.github.com/repos/genome/genome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/genome/genome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/genome/genome/teams","hooks_url":"https://api.github.com/repos/genome/genome/hooks","issue_events_url":"https://api.github.com/repos/genome/genome/issues/events{/number}","events_url":"https://api.github.com/repos/genome/genome/events","assignees_url":"https://api.github.com/repos/genome/genome/assignees{/user}","branches_url":"https://api.github.com/repos/genome/genome/branches{/branch}","tags_url":"https://api.github.com/repos/genome/genome/tags","blobs_url":"https://api.github.com/repos/genome/genome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/genome/genome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/genome/genome/git/refs{/sha}","trees_url":"https://api.github.com/repos/genome/genome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/genome/genome/statuses/{sha}","languages_url":"https://api.github.com/repos/genome/genome/languages","stargazers_url":"https://api.github.com/repos/genome/genome/stargazers","contributors_url":"https://api.github.com/repos/genome/genome/contributors","subscribers_url":"https://api.github.com/repos/genome/genome/subscribers","subscription_url":"https://api.github.com/repos/genome/genome/subscription","commits_url":"https://api.github.com/repos/genome/genome/commits{/sha}","git_commits_url":"https://api.github.com/repos/genome/genome/git/commits{/sha}","comments_url":"https://api.github.com/repos/genome/genome/comments{/number}","issue_comment_url":"https://api.github.com/repos/genome/genome/issues/comments{/number}","contents_url":"https://api.github.com/repos/genome/genome/contents/{+path}","compare_url":"https://api.github.com/repos/genome/genome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/genome/genome/merges","archive_url":"https://api.github.com/repos/genome/genome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/genome/genome/downloads","issues_url":"https://api.github.com/repos/genome/genome/issues{/number}","pulls_url":"https://api.github.com/repos/genome/genome/pulls{/number}","milestones_url":"https://api.github.com/repos/genome/genome/milestones{/number}","notifications_url":"https://api.github.com/repos/genome/genome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/genome/genome/labels{/name}","releases_url":"https://api.github.com/repos/genome/genome/releases{/id}","deployments_url":"https://api.github.com/repos/genome/genome/deployments","created_at":"2014-08-28T20:59:19Z","updated_at":"2016-02-02T21:16:18Z","pushed_at":"2016-02-29T20:54:35Z","git_url":"git://github.com/genome/genome.git","ssh_url":"git@github.com:genome/genome.git","clone_url":"https://github.com/genome/genome.git","svn_url":"https://github.com/genome/genome","homepage":"","size":186691,"stargazers_count":11,"watchers_count":11,"language":"Perl","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":44,"mirror_url":null,"open_issues_count":10,"forks":44,"open_issues":10,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/genome/genome/pulls/1285"},"html":{"href":"https://github.com/genome/genome/pull/1285"},"issue":{"href":"https://api.github.com/repos/genome/genome/issues/1285"},"comments":{"href":"https://api.github.com/repos/genome/genome/issues/1285/comments"},"review_comments":{"href":"https://api.github.com/repos/genome/genome/pulls/1285/comments"},"review_comment":{"href":"https://api.github.com/repos/genome/genome/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/genome/genome/pulls/1285/commits"},"statuses":{"href":"https://api.github.com/repos/genome/genome/statuses/867eab97034b39817768d3c51064e1607eeb0b06"}}}}