{"action":"created","comment":{"url":"https://api.github.com/repos/qiime2/q2-demux/pulls/comments/80123100","id":80123100,"diff_hunk":"@@ -48,6 +52,47 @@ def __next__(self):\n         return next(self.barcode_generator), next(self.sequence_generator)\n \n \n+def summary(output_dir: str, data: SingleLanePerSampleSingleEndFastqDirFmt) \\\n+        -> None:\n+    per_sample_fastqs = list(data.sequences.iter_views(FastqGzFormat))\n+    per_sample_fastq_counts = {}\n+    for per_sample_fastq in per_sample_fastqs:\n+        seqs = skbio.io.read(per_sample_fastq[1].open(),\n+                             format='fastq',\n+                             phred_offset=33, compression='gzip',\n+                             constructor=skbio.DNA)\n+        count = 0\n+        for seq in seqs:\n+            count += 1\n+        per_sample_fastq_counts[per_sample_fastq[0]] = count\n+\n+    result = pd.Series(per_sample_fastq_counts)\n+    result.sort_values(inplace=True, ascending=False)\n+    result.to_csv(os.path.join(output_dir,\n+                  'per-sample-fastq-counts.csv'))\n+    ax = sns.distplot(result, kde=False)\n+    ax.set_xlabel('Number of sequences')\n+    ax.set_xlabel('Frequency')\n+    fig = ax.get_figure()\n+    fig.savefig(os.path.join(output_dir, 'demultiplex-summary.png'))\n+    fig.savefig(os.path.join(output_dir, 'demultiplex-summary.pdf'))\n+    with open(os.path.join(output_dir, 'index.html'), 'w') as fh:\n+        fh.write('<html><body>\\n')\n+        fh.write(' <h1>Demultiplexed sequence counts summary</h1>\\n')\n+        fh.write(' Minimum: %d<br>\\n' % result.min())\n+        fh.write(' Median: %d<br>\\n' % result.max())\n+        fh.write(' Mean: %1.3f<br>\\n' % result.mean())\n+        fh.write(' Maximum: %1.3f<br>\\n' % result.median())\n+        fh.write(' Total number of sequences demultiplexed: %d<p>\\n\\n' %\n+                 result.sum())\n+        fh.write(' <img src=\"demultiplex-summary.png\"><br>\\n')\n+        fh.write(' <a href=\"demultiplex-summary.pdf\">PDF</a><p>\\n\\n')\n+        fh.write(' <h1>Demultiplexed sequence counts detail</h1>\\n')","path":"q2_demux/_demux.py","position":58,"original_position":58,"commit_id":"6b15616101bc7d73367053263f63e6e3a55236a2","original_commit_id":"6b15616101bc7d73367053263f63e6e3a55236a2","user":{"login":"jairideout","id":1847232,"avatar_url":"https://avatars.githubusercontent.com/u/1847232?v=3","gravatar_id":"","url":"https://api.github.com/users/jairideout","html_url":"https://github.com/jairideout","followers_url":"https://api.github.com/users/jairideout/followers","following_url":"https://api.github.com/users/jairideout/following{/other_user}","gists_url":"https://api.github.com/users/jairideout/gists{/gist_id}","starred_url":"https://api.github.com/users/jairideout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jairideout/subscriptions","organizations_url":"https://api.github.com/users/jairideout/orgs","repos_url":"https://api.github.com/users/jairideout/repos","events_url":"https://api.github.com/users/jairideout/events{/privacy}","received_events_url":"https://api.github.com/users/jairideout/received_events","type":"User","site_admin":false},"body":"We think this header makes more sense, given the series column names:\r\n\r\n\"Per-sample sequence counts\"","created_at":"2016-09-22T19:56:16Z","updated_at":"2016-09-22T19:59:14Z","html_url":"https://github.com/qiime2/q2-demux/pull/2#discussion_r80123100","pull_request_url":"https://api.github.com/repos/qiime2/q2-demux/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/qiime2/q2-demux/pulls/comments/80123100"},"html":{"href":"https://github.com/qiime2/q2-demux/pull/2#discussion_r80123100"},"pull_request":{"href":"https://api.github.com/repos/qiime2/q2-demux/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/qiime2/q2-demux/pulls/2","id":86212917,"html_url":"https://github.com/qiime2/q2-demux/pull/2","diff_url":"https://github.com/qiime2/q2-demux/pull/2.diff","patch_url":"https://github.com/qiime2/q2-demux/pull/2.patch","issue_url":"https://api.github.com/repos/qiime2/q2-demux/issues/2","number":2,"state":"open","locked":false,"title":"adds a summary visualizer","user":{"login":"gregcaporaso","id":192372,"avatar_url":"https://avatars.githubusercontent.com/u/192372?v=3","gravatar_id":"","url":"https://api.github.com/users/gregcaporaso","html_url":"https://github.com/gregcaporaso","followers_url":"https://api.github.com/users/gregcaporaso/followers","following_url":"https://api.github.com/users/gregcaporaso/following{/other_user}","gists_url":"https://api.github.com/users/gregcaporaso/gists{/gist_id}","starred_url":"https://api.github.com/users/gregcaporaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregcaporaso/subscriptions","organizations_url":"https://api.github.com/users/gregcaporaso/orgs","repos_url":"https://api.github.com/users/gregcaporaso/repos","events_url":"https://api.github.com/users/gregcaporaso/events{/privacy}","received_events_url":"https://api.github.com/users/gregcaporaso/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-21T18:08:19Z","updated_at":"2016-09-22T19:59:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b7d5090ad991d8431b7a574ba2df471c3d2e6491","assignee":{"login":"thermokarst","id":274668,"avatar_url":"https://avatars.githubusercontent.com/u/274668?v=3","gravatar_id":"","url":"https://api.github.com/users/thermokarst","html_url":"https://github.com/thermokarst","followers_url":"https://api.github.com/users/thermokarst/followers","following_url":"https://api.github.com/users/thermokarst/following{/other_user}","gists_url":"https://api.github.com/users/thermokarst/gists{/gist_id}","starred_url":"https://api.github.com/users/thermokarst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thermokarst/subscriptions","organizations_url":"https://api.github.com/users/thermokarst/orgs","repos_url":"https://api.github.com/users/thermokarst/repos","events_url":"https://api.github.com/users/thermokarst/events{/privacy}","received_events_url":"https://api.github.com/users/thermokarst/received_events","type":"User","site_admin":false},"assignees":[{"login":"thermokarst","id":274668,"avatar_url":"https://avatars.githubusercontent.com/u/274668?v=3","gravatar_id":"","url":"https://api.github.com/users/thermokarst","html_url":"https://github.com/thermokarst","followers_url":"https://api.github.com/users/thermokarst/followers","following_url":"https://api.github.com/users/thermokarst/following{/other_user}","gists_url":"https://api.github.com/users/thermokarst/gists{/gist_id}","starred_url":"https://api.github.com/users/thermokarst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thermokarst/subscriptions","organizations_url":"https://api.github.com/users/thermokarst/orgs","repos_url":"https://api.github.com/users/thermokarst/repos","events_url":"https://api.github.com/users/thermokarst/events{/privacy}","received_events_url":"https://api.github.com/users/thermokarst/received_events","type":"User","site_admin":false},{"login":"jairideout","id":1847232,"avatar_url":"https://avatars.githubusercontent.com/u/1847232?v=3","gravatar_id":"","url":"https://api.github.com/users/jairideout","html_url":"https://github.com/jairideout","followers_url":"https://api.github.com/users/jairideout/followers","following_url":"https://api.github.com/users/jairideout/following{/other_user}","gists_url":"https://api.github.com/users/jairideout/gists{/gist_id}","starred_url":"https://api.github.com/users/jairideout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jairideout/subscriptions","organizations_url":"https://api.github.com/users/jairideout/orgs","repos_url":"https://api.github.com/users/jairideout/repos","events_url":"https://api.github.com/users/jairideout/events{/privacy}","received_events_url":"https://api.github.com/users/jairideout/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/qiime2/q2-demux/pulls/2/commits","review_comments_url":"https://api.github.com/repos/qiime2/q2-demux/pulls/2/comments","review_comment_url":"https://api.github.com/repos/qiime2/q2-demux/pulls/comments{/number}","comments_url":"https://api.github.com/repos/qiime2/q2-demux/issues/2/comments","statuses_url":"https://api.github.com/repos/qiime2/q2-demux/statuses/6b15616101bc7d73367053263f63e6e3a55236a2","head":{"label":"gregcaporaso:summary-viz","ref":"summary-viz","sha":"6b15616101bc7d73367053263f63e6e3a55236a2","user":{"login":"gregcaporaso","id":192372,"avatar_url":"https://avatars.githubusercontent.com/u/192372?v=3","gravatar_id":"","url":"https://api.github.com/users/gregcaporaso","html_url":"https://github.com/gregcaporaso","followers_url":"https://api.github.com/users/gregcaporaso/followers","following_url":"https://api.github.com/users/gregcaporaso/following{/other_user}","gists_url":"https://api.github.com/users/gregcaporaso/gists{/gist_id}","starred_url":"https://api.github.com/users/gregcaporaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregcaporaso/subscriptions","organizations_url":"https://api.github.com/users/gregcaporaso/orgs","repos_url":"https://api.github.com/users/gregcaporaso/repos","events_url":"https://api.github.com/users/gregcaporaso/events{/privacy}","received_events_url":"https://api.github.com/users/gregcaporaso/received_events","type":"User","site_admin":false},"repo":{"id":68643442,"name":"q2-demux","full_name":"gregcaporaso/q2-demux","owner":{"login":"gregcaporaso","id":192372,"avatar_url":"https://avatars.githubusercontent.com/u/192372?v=3","gravatar_id":"","url":"https://api.github.com/users/gregcaporaso","html_url":"https://github.com/gregcaporaso","followers_url":"https://api.github.com/users/gregcaporaso/followers","following_url":"https://api.github.com/users/gregcaporaso/following{/other_user}","gists_url":"https://api.github.com/users/gregcaporaso/gists{/gist_id}","starred_url":"https://api.github.com/users/gregcaporaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregcaporaso/subscriptions","organizations_url":"https://api.github.com/users/gregcaporaso/orgs","repos_url":"https://api.github.com/users/gregcaporaso/repos","events_url":"https://api.github.com/users/gregcaporaso/events{/privacy}","received_events_url":"https://api.github.com/users/gregcaporaso/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gregcaporaso/q2-demux","description":"Map sequence barcodes to sample identifiers. ","fork":true,"url":"https://api.github.com/repos/gregcaporaso/q2-demux","forks_url":"https://api.github.com/repos/gregcaporaso/q2-demux/forks","keys_url":"https://api.github.com/repos/gregcaporaso/q2-demux/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gregcaporaso/q2-demux/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gregcaporaso/q2-demux/teams","hooks_url":"https://api.github.com/repos/gregcaporaso/q2-demux/hooks","issue_events_url":"https://api.github.com/repos/gregcaporaso/q2-demux/issues/events{/number}","events_url":"https://api.github.com/repos/gregcaporaso/q2-demux/events","assignees_url":"https://api.github.com/repos/gregcaporaso/q2-demux/assignees{/user}","branches_url":"https://api.github.com/repos/gregcaporaso/q2-demux/branches{/branch}","tags_url":"https://api.github.com/repos/gregcaporaso/q2-demux/tags","blobs_url":"https://api.github.com/repos/gregcaporaso/q2-demux/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gregcaporaso/q2-demux/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gregcaporaso/q2-demux/git/refs{/sha}","trees_url":"https://api.github.com/repos/gregcaporaso/q2-demux/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gregcaporaso/q2-demux/statuses/{sha}","languages_url":"https://api.github.com/repos/gregcaporaso/q2-demux/languages","stargazers_url":"https://api.github.com/repos/gregcaporaso/q2-demux/stargazers","contributors_url":"https://api.github.com/repos/gregcaporaso/q2-demux/contributors","subscribers_url":"https://api.github.com/repos/gregcaporaso/q2-demux/subscribers","subscription_url":"https://api.github.com/repos/gregcaporaso/q2-demux/subscription","commits_url":"https://api.github.com/repos/gregcaporaso/q2-demux/commits{/sha}","git_commits_url":"https://api.github.com/repos/gregcaporaso/q2-demux/git/commits{/sha}","comments_url":"https://api.github.com/repos/gregcaporaso/q2-demux/comments{/number}","issue_comment_url":"https://api.github.com/repos/gregcaporaso/q2-demux/issues/comments{/number}","contents_url":"https://api.github.com/repos/gregcaporaso/q2-demux/contents/{+path}","compare_url":"https://api.github.com/repos/gregcaporaso/q2-demux/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gregcaporaso/q2-demux/merges","archive_url":"https://api.github.com/repos/gregcaporaso/q2-demux/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gregcaporaso/q2-demux/downloads","issues_url":"https://api.github.com/repos/gregcaporaso/q2-demux/issues{/number}","pulls_url":"https://api.github.com/repos/gregcaporaso/q2-demux/pulls{/number}","milestones_url":"https://api.github.com/repos/gregcaporaso/q2-demux/milestones{/number}","notifications_url":"https://api.github.com/repos/gregcaporaso/q2-demux/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gregcaporaso/q2-demux/labels{/name}","releases_url":"https://api.github.com/repos/gregcaporaso/q2-demux/releases{/id}","deployments_url":"https://api.github.com/repos/gregcaporaso/q2-demux/deployments","created_at":"2016-09-19T20:25:11Z","updated_at":"2016-09-20T19:32:37Z","pushed_at":"2016-09-22T19:35:21Z","git_url":"git://github.com/gregcaporaso/q2-demux.git","ssh_url":"git@github.com:gregcaporaso/q2-demux.git","clone_url":"https://github.com/gregcaporaso/q2-demux.git","svn_url":"https://github.com/gregcaporaso/q2-demux","homepage":null,"size":66,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"qiime2:master","ref":"master","sha":"cb236cbb7fb411682a6b12aae386ed19b165d92f","user":{"login":"qiime2","id":18176583,"avatar_url":"https://avatars.githubusercontent.com/u/18176583?v=3","gravatar_id":"","url":"https://api.github.com/users/qiime2","html_url":"https://github.com/qiime2","followers_url":"https://api.github.com/users/qiime2/followers","following_url":"https://api.github.com/users/qiime2/following{/other_user}","gists_url":"https://api.github.com/users/qiime2/gists{/gist_id}","starred_url":"https://api.github.com/users/qiime2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qiime2/subscriptions","organizations_url":"https://api.github.com/users/qiime2/orgs","repos_url":"https://api.github.com/users/qiime2/repos","events_url":"https://api.github.com/users/qiime2/events{/privacy}","received_events_url":"https://api.github.com/users/qiime2/received_events","type":"Organization","site_admin":false},"repo":{"id":68643014,"name":"q2-demux","full_name":"qiime2/q2-demux","owner":{"login":"qiime2","id":18176583,"avatar_url":"https://avatars.githubusercontent.com/u/18176583?v=3","gravatar_id":"","url":"https://api.github.com/users/qiime2","html_url":"https://github.com/qiime2","followers_url":"https://api.github.com/users/qiime2/followers","following_url":"https://api.github.com/users/qiime2/following{/other_user}","gists_url":"https://api.github.com/users/qiime2/gists{/gist_id}","starred_url":"https://api.github.com/users/qiime2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qiime2/subscriptions","organizations_url":"https://api.github.com/users/qiime2/orgs","repos_url":"https://api.github.com/users/qiime2/repos","events_url":"https://api.github.com/users/qiime2/events{/privacy}","received_events_url":"https://api.github.com/users/qiime2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/qiime2/q2-demux","description":"Map sequence barcodes to sample identifiers. ","fork":false,"url":"https://api.github.com/repos/qiime2/q2-demux","forks_url":"https://api.github.com/repos/qiime2/q2-demux/forks","keys_url":"https://api.github.com/repos/qiime2/q2-demux/keys{/key_id}","collaborators_url":"https://api.github.com/repos/qiime2/q2-demux/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/qiime2/q2-demux/teams","hooks_url":"https://api.github.com/repos/qiime2/q2-demux/hooks","issue_events_url":"https://api.github.com/repos/qiime2/q2-demux/issues/events{/number}","events_url":"https://api.github.com/repos/qiime2/q2-demux/events","assignees_url":"https://api.github.com/repos/qiime2/q2-demux/assignees{/user}","branches_url":"https://api.github.com/repos/qiime2/q2-demux/branches{/branch}","tags_url":"https://api.github.com/repos/qiime2/q2-demux/tags","blobs_url":"https://api.github.com/repos/qiime2/q2-demux/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/qiime2/q2-demux/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/qiime2/q2-demux/git/refs{/sha}","trees_url":"https://api.github.com/repos/qiime2/q2-demux/git/trees{/sha}","statuses_url":"https://api.github.com/repos/qiime2/q2-demux/statuses/{sha}","languages_url":"https://api.github.com/repos/qiime2/q2-demux/languages","stargazers_url":"https://api.github.com/repos/qiime2/q2-demux/stargazers","contributors_url":"https://api.github.com/repos/qiime2/q2-demux/contributors","subscribers_url":"https://api.github.com/repos/qiime2/q2-demux/subscribers","subscription_url":"https://api.github.com/repos/qiime2/q2-demux/subscription","commits_url":"https://api.github.com/repos/qiime2/q2-demux/commits{/sha}","git_commits_url":"https://api.github.com/repos/qiime2/q2-demux/git/commits{/sha}","comments_url":"https://api.github.com/repos/qiime2/q2-demux/comments{/number}","issue_comment_url":"https://api.github.com/repos/qiime2/q2-demux/issues/comments{/number}","contents_url":"https://api.github.com/repos/qiime2/q2-demux/contents/{+path}","compare_url":"https://api.github.com/repos/qiime2/q2-demux/compare/{base}...{head}","merges_url":"https://api.github.com/repos/qiime2/q2-demux/merges","archive_url":"https://api.github.com/repos/qiime2/q2-demux/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/qiime2/q2-demux/downloads","issues_url":"https://api.github.com/repos/qiime2/q2-demux/issues{/number}","pulls_url":"https://api.github.com/repos/qiime2/q2-demux/pulls{/number}","milestones_url":"https://api.github.com/repos/qiime2/q2-demux/milestones{/number}","notifications_url":"https://api.github.com/repos/qiime2/q2-demux/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/qiime2/q2-demux/labels{/name}","releases_url":"https://api.github.com/repos/qiime2/q2-demux/releases{/id}","deployments_url":"https://api.github.com/repos/qiime2/q2-demux/deployments","created_at":"2016-09-19T20:19:21Z","updated_at":"2016-09-22T17:23:36Z","pushed_at":"2016-09-22T19:35:22Z","git_url":"git://github.com/qiime2/q2-demux.git","ssh_url":"git@github.com:qiime2/q2-demux.git","clone_url":"https://github.com/qiime2/q2-demux.git","svn_url":"https://github.com/qiime2/q2-demux","homepage":null,"size":59,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/qiime2/q2-demux/pulls/2"},"html":{"href":"https://github.com/qiime2/q2-demux/pull/2"},"issue":{"href":"https://api.github.com/repos/qiime2/q2-demux/issues/2"},"comments":{"href":"https://api.github.com/repos/qiime2/q2-demux/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/qiime2/q2-demux/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/qiime2/q2-demux/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/qiime2/q2-demux/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/qiime2/q2-demux/statuses/6b15616101bc7d73367053263f63e6e3a55236a2"}}}}
{"actor":{"display_login":"jairideout"}}