{"action":"created","comment":{"url":"https://api.github.com/repos/ARTbio/tools-artbio/pulls/comments/91318265","pull_request_review_id":11823130,"id":91318265,"diff_hunk":"@@ -0,0 +1,140 @@\n+#!/usr/bin/env python\n+#  (c) 2012 - Ryan M. Layer\n+#  Hall Laboratory\n+#  Quinlan Laboratory\n+#  Department of Computer Science\n+#  Department of Biochemistry and Molecular Genetics\n+#  Department of Public Health Sciences and Center for Public Health Genomics,\n+#  University of Virginia\n+#  rl6sf@virginia.edu\n+\n+import sys\n+import numpy as np\n+from operator import itemgetter\n+from optparse import OptionParser\n+\n+# some constants for sam/bam field ids\n+SAM_FLAG = 1\n+SAM_REFNAME = 2\n+SAM_MATE_REFNAME = 6\n+SAM_ISIZE = 8\n+\n+parser = OptionParser()\n+\n+parser.add_option(\"-r\",\n+    \"--read_length\",\n+    type=\"int\",\n+    dest=\"read_length\",\n+    help=\"Read length\")\n+\n+parser.add_option(\"-X\",\n+    dest=\"X\",\n+    type=\"int\",\n+    help=\"Number of stdevs from mean to extend\")\n+\n+parser.add_option(\"-N\",\n+    dest=\"N\",\n+    type=\"int\",\n+    help=\"Number to sample\")\n+\n+parser.add_option(\"-o\",\n+    dest=\"output_file\",\n+    help=\"Output file\")\n+\n+parser.add_option(\"-m\",\n+    dest=\"mads\",\n+    type=\"int\",\n+    default=10,\n+    help=\"Outlier cutoff in # of median absolute deviations (unscaled, upper only)\")\n+\n+def unscaled_upper_mad(xs):\n+    \"\"\"Return a tuple consisting of the median of xs followed by the\n+    unscaled median absolute deviation of the values in xs that lie\n+    above the median.\n+    \"\"\"\n+    med = np.median(xs)\n+    return med, np.median(xs[xs > med] - med)\n+\n+\n+(options, args) = parser.parse_args()\n+\n+if not options.read_length:\n+    parser.error('Read length not given')\n+\n+if not options.X:\n+    parser.error('X not given')\n+\n+if not options.N:\n+    parser.error('N not given')\n+\n+if not options.output_file:\n+    parser.error('Output file not given')\n+\n+\n+required = 97\n+restricted = 3484\n+flag_mask = required | restricted\n+\n+L = []\n+c = 0\n+\n+for l in sys.stdin:\n+    if c >= options.N:\n+        break\n+\n+    A = l.rstrip().split('\\t')\n+    flag = int(A[SAM_FLAG])\n+    refname = A[SAM_REFNAME]\n+    mate_refname = A[SAM_MATE_REFNAME]\n+    isize = int(A[SAM_ISIZE])\n+\n+    want = mate_refname == \"=\" and flag & flag_mask == required and isize >= 0\n+    if want:\n+        c += 1\n+        L.append(isize)\n+\n+# warn if very few elements in distribution\n+min_elements = 1000\n+if len(L) < min_elements:\n+    sys.stderr.write(\"Warning: only %s elements in distribution (min: %s)\\n\" % (len(L), min_elements))\n+    mean = \"NA\"\n+    stdev = \"NA\"\n+\n+else:\n+    # Remove outliers\n+    L = np.array(L)\n+    L.sort()\n+    med, umad = unscaled_upper_mad(L)\n+    upper_cutoff = med + options.mads * umad\n+    L = L[L < upper_cutoff]\n+    new_len = len(L)\n+    removed = c - new_len\n+    sys.stderr.write(\"Removed %d outliers with isize >= %d\\n\" %","path":"tools/lumpy/pairend_distro.py","position":112,"original_position":112,"commit_id":"66d42b0d63ff5d72c6611106ed3366a58c73a55d","original_commit_id":"66d42b0d63ff5d72c6611106ed3366a58c73a55d","user":{"login":"mvdbeek","id":6804901,"avatar_url":"https://avatars.githubusercontent.com/u/6804901?v=3","gravatar_id":"","url":"https://api.github.com/users/mvdbeek","html_url":"https://github.com/mvdbeek","followers_url":"https://api.github.com/users/mvdbeek/followers","following_url":"https://api.github.com/users/mvdbeek/following{/other_user}","gists_url":"https://api.github.com/users/mvdbeek/gists{/gist_id}","starred_url":"https://api.github.com/users/mvdbeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvdbeek/subscriptions","organizations_url":"https://api.github.com/users/mvdbeek/orgs","repos_url":"https://api.github.com/users/mvdbeek/repos","events_url":"https://api.github.com/users/mvdbeek/events{/privacy}","received_events_url":"https://api.github.com/users/mvdbeek/received_events","type":"User","site_admin":false},"body":"I would add `<command detect_errors=\"exit_code\">`, so that this doesn't result in red datasets","created_at":"2016-12-07T15:38:01Z","updated_at":"2016-12-07T15:38:01Z","html_url":"https://github.com/ARTbio/tools-artbio/pull/99#discussion_r91318265","pull_request_url":"https://api.github.com/repos/ARTbio/tools-artbio/pulls/99","_links":{"self":{"href":"https://api.github.com/repos/ARTbio/tools-artbio/pulls/comments/91318265"},"html":{"href":"https://github.com/ARTbio/tools-artbio/pull/99#discussion_r91318265"},"pull_request":{"href":"https://api.github.com/repos/ARTbio/tools-artbio/pulls/99"}}},"pull_request":{"url":"https://api.github.com/repos/ARTbio/tools-artbio/pulls/99","id":96941765,"html_url":"https://github.com/ARTbio/tools-artbio/pull/99","diff_url":"https://github.com/ARTbio/tools-artbio/pull/99.diff","patch_url":"https://github.com/ARTbio/tools-artbio/pull/99.patch","issue_url":"https://api.github.com/repos/ARTbio/tools-artbio/issues/99","number":99,"state":"open","locked":false,"title":"Lumpy","user":{"login":"drosofff","id":11705625,"avatar_url":"https://avatars.githubusercontent.com/u/11705625?v=3","gravatar_id":"","url":"https://api.github.com/users/drosofff","html_url":"https://github.com/drosofff","followers_url":"https://api.github.com/users/drosofff/followers","following_url":"https://api.github.com/users/drosofff/following{/other_user}","gists_url":"https://api.github.com/users/drosofff/gists{/gist_id}","starred_url":"https://api.github.com/users/drosofff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drosofff/subscriptions","organizations_url":"https://api.github.com/users/drosofff/orgs","repos_url":"https://api.github.com/users/drosofff/repos","events_url":"https://api.github.com/users/drosofff/events{/privacy}","received_events_url":"https://api.github.com/users/drosofff/received_events","type":"User","site_admin":false},"body":"I first decent release of my lumpy wrapper searching for structural variations","created_at":"2016-12-07T15:12:04Z","updated_at":"2016-12-07T15:38:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d45c604db29beac34b0e27ff528400d3fd4a2cd7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ARTbio/tools-artbio/pulls/99/commits","review_comments_url":"https://api.github.com/repos/ARTbio/tools-artbio/pulls/99/comments","review_comment_url":"https://api.github.com/repos/ARTbio/tools-artbio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ARTbio/tools-artbio/issues/99/comments","statuses_url":"https://api.github.com/repos/ARTbio/tools-artbio/statuses/66d42b0d63ff5d72c6611106ed3366a58c73a55d","head":{"label":"ARTbio:lumpy","ref":"lumpy","sha":"66d42b0d63ff5d72c6611106ed3366a58c73a55d","user":{"login":"ARTbio","id":13965324,"avatar_url":"https://avatars.githubusercontent.com/u/13965324?v=3","gravatar_id":"","url":"https://api.github.com/users/ARTbio","html_url":"https://github.com/ARTbio","followers_url":"https://api.github.com/users/ARTbio/followers","following_url":"https://api.github.com/users/ARTbio/following{/other_user}","gists_url":"https://api.github.com/users/ARTbio/gists{/gist_id}","starred_url":"https://api.github.com/users/ARTbio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARTbio/subscriptions","organizations_url":"https://api.github.com/users/ARTbio/orgs","repos_url":"https://api.github.com/users/ARTbio/repos","events_url":"https://api.github.com/users/ARTbio/events{/privacy}","received_events_url":"https://api.github.com/users/ARTbio/received_events","type":"Organization","site_admin":false},"repo":{"id":41668246,"name":"tools-artbio","full_name":"ARTbio/tools-artbio","owner":{"login":"ARTbio","id":13965324,"avatar_url":"https://avatars.githubusercontent.com/u/13965324?v=3","gravatar_id":"","url":"https://api.github.com/users/ARTbio","html_url":"https://github.com/ARTbio","followers_url":"https://api.github.com/users/ARTbio/followers","following_url":"https://api.github.com/users/ARTbio/following{/other_user}","gists_url":"https://api.github.com/users/ARTbio/gists{/gist_id}","starred_url":"https://api.github.com/users/ARTbio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARTbio/subscriptions","organizations_url":"https://api.github.com/users/ARTbio/orgs","repos_url":"https://api.github.com/users/ARTbio/repos","events_url":"https://api.github.com/users/ARTbio/events{/privacy}","received_events_url":"https://api.github.com/users/ARTbio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ARTbio/tools-artbio","description":"Collection of galaxy tools developed by the artbio-platform at the IBPS (Institut de Biologie Paris-Seine)","fork":false,"url":"https://api.github.com/repos/ARTbio/tools-artbio","forks_url":"https://api.github.com/repos/ARTbio/tools-artbio/forks","keys_url":"https://api.github.com/repos/ARTbio/tools-artbio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ARTbio/tools-artbio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ARTbio/tools-artbio/teams","hooks_url":"https://api.github.com/repos/ARTbio/tools-artbio/hooks","issue_events_url":"https://api.github.com/repos/ARTbio/tools-artbio/issues/events{/number}","events_url":"https://api.github.com/repos/ARTbio/tools-artbio/events","assignees_url":"https://api.github.com/repos/ARTbio/tools-artbio/assignees{/user}","branches_url":"https://api.github.com/repos/ARTbio/tools-artbio/branches{/branch}","tags_url":"https://api.github.com/repos/ARTbio/tools-artbio/tags","blobs_url":"https://api.github.com/repos/ARTbio/tools-artbio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ARTbio/tools-artbio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ARTbio/tools-artbio/git/refs{/sha}","trees_url":"https://api.github.com/repos/ARTbio/tools-artbio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ARTbio/tools-artbio/statuses/{sha}","languages_url":"https://api.github.com/repos/ARTbio/tools-artbio/languages","stargazers_url":"https://api.github.com/repos/ARTbio/tools-artbio/stargazers","contributors_url":"https://api.github.com/repos/ARTbio/tools-artbio/contributors","subscribers_url":"https://api.github.com/repos/ARTbio/tools-artbio/subscribers","subscription_url":"https://api.github.com/repos/ARTbio/tools-artbio/subscription","commits_url":"https://api.github.com/repos/ARTbio/tools-artbio/commits{/sha}","git_commits_url":"https://api.github.com/repos/ARTbio/tools-artbio/git/commits{/sha}","comments_url":"https://api.github.com/repos/ARTbio/tools-artbio/comments{/number}","issue_comment_url":"https://api.github.com/repos/ARTbio/tools-artbio/issues/comments{/number}","contents_url":"https://api.github.com/repos/ARTbio/tools-artbio/contents/{+path}","compare_url":"https://api.github.com/repos/ARTbio/tools-artbio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ARTbio/tools-artbio/merges","archive_url":"https://api.github.com/repos/ARTbio/tools-artbio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ARTbio/tools-artbio/downloads","issues_url":"https://api.github.com/repos/ARTbio/tools-artbio/issues{/number}","pulls_url":"https://api.github.com/repos/ARTbio/tools-artbio/pulls{/number}","milestones_url":"https://api.github.com/repos/ARTbio/tools-artbio/milestones{/number}","notifications_url":"https://api.github.com/repos/ARTbio/tools-artbio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ARTbio/tools-artbio/labels{/name}","releases_url":"https://api.github.com/repos/ARTbio/tools-artbio/releases{/id}","deployments_url":"https://api.github.com/repos/ARTbio/tools-artbio/deployments","created_at":"2015-08-31T09:49:28Z","updated_at":"2016-11-06T23:31:34Z","pushed_at":"2016-12-07T15:12:04Z","git_url":"git://github.com/ARTbio/tools-artbio.git","ssh_url":"git@github.com:ARTbio/tools-artbio.git","clone_url":"https://github.com/ARTbio/tools-artbio.git","svn_url":"https://github.com/ARTbio/tools-artbio","homepage":null,"size":20261,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":9,"forks":5,"open_issues":9,"watchers":3,"default_branch":"master"}},"base":{"label":"ARTbio:master","ref":"master","sha":"166bdc624b795d07f6514313afad0643a0c932fd","user":{"login":"ARTbio","id":13965324,"avatar_url":"https://avatars.githubusercontent.com/u/13965324?v=3","gravatar_id":"","url":"https://api.github.com/users/ARTbio","html_url":"https://github.com/ARTbio","followers_url":"https://api.github.com/users/ARTbio/followers","following_url":"https://api.github.com/users/ARTbio/following{/other_user}","gists_url":"https://api.github.com/users/ARTbio/gists{/gist_id}","starred_url":"https://api.github.com/users/ARTbio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARTbio/subscriptions","organizations_url":"https://api.github.com/users/ARTbio/orgs","repos_url":"https://api.github.com/users/ARTbio/repos","events_url":"https://api.github.com/users/ARTbio/events{/privacy}","received_events_url":"https://api.github.com/users/ARTbio/received_events","type":"Organization","site_admin":false},"repo":{"id":41668246,"name":"tools-artbio","full_name":"ARTbio/tools-artbio","owner":{"login":"ARTbio","id":13965324,"avatar_url":"https://avatars.githubusercontent.com/u/13965324?v=3","gravatar_id":"","url":"https://api.github.com/users/ARTbio","html_url":"https://github.com/ARTbio","followers_url":"https://api.github.com/users/ARTbio/followers","following_url":"https://api.github.com/users/ARTbio/following{/other_user}","gists_url":"https://api.github.com/users/ARTbio/gists{/gist_id}","starred_url":"https://api.github.com/users/ARTbio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARTbio/subscriptions","organizations_url":"https://api.github.com/users/ARTbio/orgs","repos_url":"https://api.github.com/users/ARTbio/repos","events_url":"https://api.github.com/users/ARTbio/events{/privacy}","received_events_url":"https://api.github.com/users/ARTbio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ARTbio/tools-artbio","description":"Collection of galaxy tools developed by the artbio-platform at the IBPS (Institut de Biologie Paris-Seine)","fork":false,"url":"https://api.github.com/repos/ARTbio/tools-artbio","forks_url":"https://api.github.com/repos/ARTbio/tools-artbio/forks","keys_url":"https://api.github.com/repos/ARTbio/tools-artbio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ARTbio/tools-artbio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ARTbio/tools-artbio/teams","hooks_url":"https://api.github.com/repos/ARTbio/tools-artbio/hooks","issue_events_url":"https://api.github.com/repos/ARTbio/tools-artbio/issues/events{/number}","events_url":"https://api.github.com/repos/ARTbio/tools-artbio/events","assignees_url":"https://api.github.com/repos/ARTbio/tools-artbio/assignees{/user}","branches_url":"https://api.github.com/repos/ARTbio/tools-artbio/branches{/branch}","tags_url":"https://api.github.com/repos/ARTbio/tools-artbio/tags","blobs_url":"https://api.github.com/repos/ARTbio/tools-artbio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ARTbio/tools-artbio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ARTbio/tools-artbio/git/refs{/sha}","trees_url":"https://api.github.com/repos/ARTbio/tools-artbio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ARTbio/tools-artbio/statuses/{sha}","languages_url":"https://api.github.com/repos/ARTbio/tools-artbio/languages","stargazers_url":"https://api.github.com/repos/ARTbio/tools-artbio/stargazers","contributors_url":"https://api.github.com/repos/ARTbio/tools-artbio/contributors","subscribers_url":"https://api.github.com/repos/ARTbio/tools-artbio/subscribers","subscription_url":"https://api.github.com/repos/ARTbio/tools-artbio/subscription","commits_url":"https://api.github.com/repos/ARTbio/tools-artbio/commits{/sha}","git_commits_url":"https://api.github.com/repos/ARTbio/tools-artbio/git/commits{/sha}","comments_url":"https://api.github.com/repos/ARTbio/tools-artbio/comments{/number}","issue_comment_url":"https://api.github.com/repos/ARTbio/tools-artbio/issues/comments{/number}","contents_url":"https://api.github.com/repos/ARTbio/tools-artbio/contents/{+path}","compare_url":"https://api.github.com/repos/ARTbio/tools-artbio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ARTbio/tools-artbio/merges","archive_url":"https://api.github.com/repos/ARTbio/tools-artbio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ARTbio/tools-artbio/downloads","issues_url":"https://api.github.com/repos/ARTbio/tools-artbio/issues{/number}","pulls_url":"https://api.github.com/repos/ARTbio/tools-artbio/pulls{/number}","milestones_url":"https://api.github.com/repos/ARTbio/tools-artbio/milestones{/number}","notifications_url":"https://api.github.com/repos/ARTbio/tools-artbio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ARTbio/tools-artbio/labels{/name}","releases_url":"https://api.github.com/repos/ARTbio/tools-artbio/releases{/id}","deployments_url":"https://api.github.com/repos/ARTbio/tools-artbio/deployments","created_at":"2015-08-31T09:49:28Z","updated_at":"2016-11-06T23:31:34Z","pushed_at":"2016-12-07T15:12:04Z","git_url":"git://github.com/ARTbio/tools-artbio.git","ssh_url":"git@github.com:ARTbio/tools-artbio.git","clone_url":"https://github.com/ARTbio/tools-artbio.git","svn_url":"https://github.com/ARTbio/tools-artbio","homepage":null,"size":20261,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":9,"forks":5,"open_issues":9,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ARTbio/tools-artbio/pulls/99"},"html":{"href":"https://github.com/ARTbio/tools-artbio/pull/99"},"issue":{"href":"https://api.github.com/repos/ARTbio/tools-artbio/issues/99"},"comments":{"href":"https://api.github.com/repos/ARTbio/tools-artbio/issues/99/comments"},"review_comments":{"href":"https://api.github.com/repos/ARTbio/tools-artbio/pulls/99/comments"},"review_comment":{"href":"https://api.github.com/repos/ARTbio/tools-artbio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ARTbio/tools-artbio/pulls/99/commits"},"statuses":{"href":"https://api.github.com/repos/ARTbio/tools-artbio/statuses/66d42b0d63ff5d72c6611106ed3366a58c73a55d"}}}}
{"actor":{"display_login":"mvdbeek"}}