GitHub PullRequestReviewCommentEvent at 2014-12-19 14:50:30
Repository: ngi_visualizations
Actor: guillermo-carrasco
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls/comments/22107621","id":22107621,"diff_hunk":"@@ -45,21 +45,43 @@ def plot_coverage_histogram (coverage_data, output_fn='coverage', min_x='0', max\n                 (coverage, count) = line.split(None, 1)\n                 coverage = int(round(float(coverage)))\n                 count = float(count)\n-                totalcounts += count\n-                sumcoverage += (count * coverage)\n-                if (min_x is None or coverage >= min_x) and (max_x is None or coverage <= max_x):\n-                    x.append(coverage)\n-                    y.append(count)\n+                counts[coverage] = count\n+                \n \n     except IOError as e:\n         logging.error(\"Could not load input file: {}\".format(fn))\n         raise IOError(e)\n-        \n+    \n+    # Find mean\n+    num_counts = sum(counts.values())\n+    mean_coverage = sum([cou * cov for (cou, cov) in counts.iteritems()]) / num_counts\n+    \n+    # Find median\n+    cum_counts = 0\n+    median_coverage = None\n+    for thiscov, thiscount in counts.iteritems():\n+        cum_counts += thiscount\n+        if cum_counts >= num_counts/2:\n+            median_coverage = thiscov\n+            break\n+    \n+    # Set max_x automatically if we want to\n+    if max_x == False and median_coverage is not None:","path":"ngi_visualizations/qualimap/coverage_histogram.py","position":60,"original_position":60,"commit_id":"173d94cbe3f92ddcdb3e2b98d5083ac54487933c","original_commit_id":"173d94cbe3f92ddcdb3e2b98d5083ac54487933c","user":{"login":"guillermo-carrasco","id":1574147,"avatar_url":"https://avatars.githubusercontent.com/u/1574147?v=3","gravatar_id":"","url":"https://api.github.com/users/guillermo-carrasco","html_url":"https://github.com/guillermo-carrasco","followers_url":"https://api.github.com/users/guillermo-carrasco/followers","following_url":"https://api.github.com/users/guillermo-carrasco/following{/other_user}","gists_url":"https://api.github.com/users/guillermo-carrasco/gists{/gist_id}","starred_url":"https://api.github.com/users/guillermo-carrasco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guillermo-carrasco/subscriptions","organizations_url":"https://api.github.com/users/guillermo-carrasco/orgs","repos_url":"https://api.github.com/users/guillermo-carrasco/repos","events_url":"https://api.github.com/users/guillermo-carrasco/events{/privacy}","received_events_url":"https://api.github.com/users/guillermo-carrasco/received_events","type":"User","site_admin":false},"body":"sure :+1: ","created_at":"2014-12-19T14:50:30Z","updated_at":"2014-12-19T14:50:30Z","html_url":"https://github.com/SciLifeLab/ngi_visualizations/pull/18#discussion_r22107621","pull_request_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls/comments/22107621"},"html":{"href":"https://github.com/SciLifeLab/ngi_visualizations/pull/18#discussion_r22107621"},"pull_request":{"href":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls/18","id":26374615,"html_url":"https://github.com/SciLifeLab/ngi_visualizations/pull/18","diff_url":"https://github.com/SciLifeLab/ngi_visualizations/pull/18.diff","patch_url":"https://github.com/SciLifeLab/ngi_visualizations/pull/18.patch","issue_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/issues/18","number":18,"state":"open","locked":false,"title":"Better qualimap axes","user":{"login":"ewels","id":465550,"avatar_url":"https://avatars.githubusercontent.com/u/465550?v=3","gravatar_id":"","url":"https://api.github.com/users/ewels","html_url":"https://github.com/ewels","followers_url":"https://api.github.com/users/ewels/followers","following_url":"https://api.github.com/users/ewels/following{/other_user}","gists_url":"https://api.github.com/users/ewels/gists{/gist_id}","starred_url":"https://api.github.com/users/ewels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewels/subscriptions","organizations_url":"https://api.github.com/users/ewels/orgs","repos_url":"https://api.github.com/users/ewels/repos","events_url":"https://api.github.com/users/ewels/events{/privacy}","received_events_url":"https://api.github.com/users/ewels/received_events","type":"User","site_admin":false},"body":"Main change here is that the x axis for most qualimap plots is now determined automatically when run without an explicit parameter, instead of using a hard default. How this is decided varies on the type of data, typically `2 x median` value or something similar. This code is entirely self contained now, so much better than earlier attempts at doing this.\r\n\r\nSecond small change is the addition of `plot.close()` statements. This makes no difference when run on the command line, but when the function is imported into another script and used to generate a lot of plots it dramatically improves memory usage.","created_at":"2014-12-19T14:31:17Z","updated_at":"2014-12-19T14:50:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a335d1d69e1a0c075101cf39ea3f17876a57251c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls/18/commits","review_comments_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls/18/comments","review_comment_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls/comments/{number}","comments_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/issues/18/comments","statuses_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/statuses/173d94cbe3f92ddcdb3e2b98d5083ac54487933c","head":{"label":"ewels:master","ref":"master","sha":"173d94cbe3f92ddcdb3e2b98d5083ac54487933c","user":{"login":"ewels","id":465550,"avatar_url":"https://avatars.githubusercontent.com/u/465550?v=3","gravatar_id":"","url":"https://api.github.com/users/ewels","html_url":"https://github.com/ewels","followers_url":"https://api.github.com/users/ewels/followers","following_url":"https://api.github.com/users/ewels/following{/other_user}","gists_url":"https://api.github.com/users/ewels/gists{/gist_id}","starred_url":"https://api.github.com/users/ewels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewels/subscriptions","organizations_url":"https://api.github.com/users/ewels/orgs","repos_url":"https://api.github.com/users/ewels/repos","events_url":"https://api.github.com/users/ewels/events{/privacy}","received_events_url":"https://api.github.com/users/ewels/received_events","type":"User","site_admin":false},"repo":{"id":21644809,"name":"ngi_visualizations","full_name":"ewels/ngi_visualizations","owner":{"login":"ewels","id":465550,"avatar_url":"https://avatars.githubusercontent.com/u/465550?v=3","gravatar_id":"","url":"https://api.github.com/users/ewels","html_url":"https://github.com/ewels","followers_url":"https://api.github.com/users/ewels/followers","following_url":"https://api.github.com/users/ewels/following{/other_user}","gists_url":"https://api.github.com/users/ewels/gists{/gist_id}","starred_url":"https://api.github.com/users/ewels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewels/subscriptions","organizations_url":"https://api.github.com/users/ewels/orgs","repos_url":"https://api.github.com/users/ewels/repos","events_url":"https://api.github.com/users/ewels/events{/privacy}","received_events_url":"https://api.github.com/users/ewels/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ewels/ngi_visualizations","description":"Next-Gen Sequencing Visualisation Scripts.","fork":false,"url":"https://api.github.com/repos/ewels/ngi_visualizations","forks_url":"https://api.github.com/repos/ewels/ngi_visualizations/forks","keys_url":"https://api.github.com/repos/ewels/ngi_visualizations/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ewels/ngi_visualizations/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ewels/ngi_visualizations/teams","hooks_url":"https://api.github.com/repos/ewels/ngi_visualizations/hooks","issue_events_url":"https://api.github.com/repos/ewels/ngi_visualizations/issues/events{/number}","events_url":"https://api.github.com/repos/ewels/ngi_visualizations/events","assignees_url":"https://api.github.com/repos/ewels/ngi_visualizations/assignees{/user}","branches_url":"https://api.github.com/repos/ewels/ngi_visualizations/branches{/branch}","tags_url":"https://api.github.com/repos/ewels/ngi_visualizations/tags","blobs_url":"https://api.github.com/repos/ewels/ngi_visualizations/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ewels/ngi_visualizations/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ewels/ngi_visualizations/git/refs{/sha}","trees_url":"https://api.github.com/repos/ewels/ngi_visualizations/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ewels/ngi_visualizations/statuses/{sha}","languages_url":"https://api.github.com/repos/ewels/ngi_visualizations/languages","stargazers_url":"https://api.github.com/repos/ewels/ngi_visualizations/stargazers","contributors_url":"https://api.github.com/repos/ewels/ngi_visualizations/contributors","subscribers_url":"https://api.github.com/repos/ewels/ngi_visualizations/subscribers","subscription_url":"https://api.github.com/repos/ewels/ngi_visualizations/subscription","commits_url":"https://api.github.com/repos/ewels/ngi_visualizations/commits{/sha}","git_commits_url":"https://api.github.com/repos/ewels/ngi_visualizations/git/commits{/sha}","comments_url":"https://api.github.com/repos/ewels/ngi_visualizations/comments{/number}","issue_comment_url":"https://api.github.com/repos/ewels/ngi_visualizations/issues/comments/{number}","contents_url":"https://api.github.com/repos/ewels/ngi_visualizations/contents/{+path}","compare_url":"https://api.github.com/repos/ewels/ngi_visualizations/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ewels/ngi_visualizations/merges","archive_url":"https://api.github.com/repos/ewels/ngi_visualizations/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ewels/ngi_visualizations/downloads","issues_url":"https://api.github.com/repos/ewels/ngi_visualizations/issues{/number}","pulls_url":"https://api.github.com/repos/ewels/ngi_visualizations/pulls{/number}","milestones_url":"https://api.github.com/repos/ewels/ngi_visualizations/milestones{/number}","notifications_url":"https://api.github.com/repos/ewels/ngi_visualizations/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ewels/ngi_visualizations/labels{/name}","releases_url":"https://api.github.com/repos/ewels/ngi_visualizations/releases{/id}","created_at":"2014-07-09T08:25:16Z","updated_at":"2014-12-19T14:25:42Z","pushed_at":"2014-12-19T14:25:42Z","git_url":"git://github.com/ewels/ngi_visualizations.git","ssh_url":"git@github.com:ewels/ngi_visualizations.git","clone_url":"https://github.com/ewels/ngi_visualizations.git","svn_url":"https://github.com/ewels/ngi_visualizations","homepage":null,"size":2286,"stargazers_count":1,"watchers_count":1,"language":"Perl","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"SciLifeLab:master","ref":"master","sha":"a7cd617aaefcf680226aba284042e9dc146f8c28","user":{"login":"SciLifeLab","id":713611,"avatar_url":"https://avatars.githubusercontent.com/u/713611?v=3","gravatar_id":"","url":"https://api.github.com/users/SciLifeLab","html_url":"https://github.com/SciLifeLab","followers_url":"https://api.github.com/users/SciLifeLab/followers","following_url":"https://api.github.com/users/SciLifeLab/following{/other_user}","gists_url":"https://api.github.com/users/SciLifeLab/gists{/gist_id}","starred_url":"https://api.github.com/users/SciLifeLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SciLifeLab/subscriptions","organizations_url":"https://api.github.com/users/SciLifeLab/orgs","repos_url":"https://api.github.com/users/SciLifeLab/repos","events_url":"https://api.github.com/users/SciLifeLab/events{/privacy}","received_events_url":"https://api.github.com/users/SciLifeLab/received_events","type":"Organization","site_admin":false},"repo":{"id":21646224,"name":"ngi_visualizations","full_name":"SciLifeLab/ngi_visualizations","owner":{"login":"SciLifeLab","id":713611,"avatar_url":"https://avatars.githubusercontent.com/u/713611?v=3","gravatar_id":"","url":"https://api.github.com/users/SciLifeLab","html_url":"https://github.com/SciLifeLab","followers_url":"https://api.github.com/users/SciLifeLab/followers","following_url":"https://api.github.com/users/SciLifeLab/following{/other_user}","gists_url":"https://api.github.com/users/SciLifeLab/gists{/gist_id}","starred_url":"https://api.github.com/users/SciLifeLab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SciLifeLab/subscriptions","organizations_url":"https://api.github.com/users/SciLifeLab/orgs","repos_url":"https://api.github.com/users/SciLifeLab/repos","events_url":"https://api.github.com/users/SciLifeLab/events{/privacy}","received_events_url":"https://api.github.com/users/SciLifeLab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SciLifeLab/ngi_visualizations","description":"Next-Gen Sequencing Visualisation Scripts.","fork":true,"url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations","forks_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/forks","keys_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/teams","hooks_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/hooks","issue_events_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/issues/events{/number}","events_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/events","assignees_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/assignees{/user}","branches_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/branches{/branch}","tags_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/tags","blobs_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/git/refs{/sha}","trees_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/statuses/{sha}","languages_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/languages","stargazers_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/stargazers","contributors_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/contributors","subscribers_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/subscribers","subscription_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/subscription","commits_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/commits{/sha}","git_commits_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/git/commits{/sha}","comments_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/comments{/number}","issue_comment_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/issues/comments/{number}","contents_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/contents/{+path}","compare_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/merges","archive_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/downloads","issues_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/issues{/number}","pulls_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls{/number}","milestones_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/milestones{/number}","notifications_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/labels{/name}","releases_url":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/releases{/id}","created_at":"2014-07-09T09:11:16Z","updated_at":"2014-12-11T11:20:38Z","pushed_at":"2014-12-11T11:20:38Z","git_url":"git://github.com/SciLifeLab/ngi_visualizations.git","ssh_url":"git@github.com:SciLifeLab/ngi_visualizations.git","clone_url":"https://github.com/SciLifeLab/ngi_visualizations.git","svn_url":"https://github.com/SciLifeLab/ngi_visualizations","homepage":null,"size":1989,"stargazers_count":4,"watchers_count":4,"language":"Perl","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls/18"},"html":{"href":"https://github.com/SciLifeLab/ngi_visualizations/pull/18"},"issue":{"href":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/issues/18"},"comments":{"href":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/SciLifeLab/ngi_visualizations/statuses/173d94cbe3f92ddcdb3e2b98d5083ac54487933c"}}}}