{"action":"created","comment":{"url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls/comments/178303767","pull_request_review_id":108342568,"id":178303767,"diff_hunk":"@@ -111,15 +123,48 @@ def assess_sample(self, sample):\n \n         # Artifacts that pass the review\n         pass_artifacts = [a for a in artifacts if a.udf.get('RE Review status') == 'pass']\n-\n         # Artifacts that fail the review\n         fail_artifacts = [a for a in artifacts if a.udf.get('RE Review status') == 'fail']\n+        # Artifacts that are new\n+        new_artifacts = [a for a in pass_artifacts if a.udf.get('RE previous Useable') not in ['yes', 'no']]\n+\n+        # skip samples which have been delivered, mark any new REs as such, not changing older RE comments\n+        if self.delivered(sample.name):\n+            for a in new_artifacts:\n+                a.udf['RE Useable Comment'] = 'AR: Delivered'\n+                a.udf['RE Useable'] = 'no'\n+\n+            for a in pass_artifacts + fail_artifacts:\n+                if a.udf.get('RE previous Useable Comment') and a.udf.get('RE previous Useable'):\n+                    a.udf['RE Useable Comment'] = a.udf.get('RE previous Useable Comment')\n+                    a.udf['RE Useable'] = a.udf.get('RE previous Useable')\n+\n+            artifacts_to_upload.update(artifacts)\n+            return artifacts_to_upload\n+\n+        # skip samples which have been processed, mark any new REs as such, not changing older RE comments\n+        if self.processed(sample.name):\n+            for a in pass_artifacts + fail_artifacts:\n+                if a.udf.get('RE previous Useable Comment') and a.udf.get('RE previous Useable'):\n+                    a.udf['RE Useable Comment'] = a.udf.get('RE previous Useable Comment')\n+                    a.udf['RE Useable'] = a.udf.get('RE previous Useable')\n \n-        target_yield = float(sample.udf.get('Yield for Quoted Coverage (Gb)'))\n-        good_re_yield = sum([float(a.udf.get('RE Yield Q30')) for a in pass_artifacts])\n+            for a in new_artifacts:\n+                a.udf['RE Useable Comment'] = 'AR: Sample already processed'\n+                a.udf['RE Useable'] = 'no'\n+\n+            artifacts_to_upload.update(artifacts)\n+            return artifacts_to_upload\n+\n+        target_yield = float(sample.udf.get('Required Yield (Gb)'))\n+        good_re_yield = sum([float(a.udf.get('RE Yield')) for a in pass_artifacts])\n+\n+        # Increase target coverage by 5% to resolve borderline cases\n+        target_coverage = 1.05 * sample.udf.get('Coverage (X)')\n+        obtained_coverage = float(sum([a.udf.get('RE Coverage') for a in pass_artifacts]))\n \n         # Just the right amount of good yield: take it all\n-        if target_yield < good_re_yield < target_yield * 2:\n+        if target_yield < good_re_yield < target_yield * 2 or obtained_coverage > target_coverage:","path":"scripts/populate_review_step.py","position":107,"original_position":107,"commit_id":"0c608c8c5d4646e5dd73099dce8e24d0b11554b7","original_commit_id":"0c608c8c5d4646e5dd73099dce8e24d0b11554b7","user":{"login":"mwhamgenomics","id":12951686,"avatar_url":"https://avatars2.githubusercontent.com/u/12951686?v=4","gravatar_id":"","url":"https://api.github.com/users/mwhamgenomics","html_url":"https://github.com/mwhamgenomics","followers_url":"https://api.github.com/users/mwhamgenomics/followers","following_url":"https://api.github.com/users/mwhamgenomics/following{/other_user}","gists_url":"https://api.github.com/users/mwhamgenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/mwhamgenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mwhamgenomics/subscriptions","organizations_url":"https://api.github.com/users/mwhamgenomics/orgs","repos_url":"https://api.github.com/users/mwhamgenomics/repos","events_url":"https://api.github.com/users/mwhamgenomics/events{/privacy}","received_events_url":"https://api.github.com/users/mwhamgenomics/received_events","type":"User","site_admin":false},"body":"Can we test this? (i.e, where a sample can pass on either yield or coverage)","created_at":"2018-03-30T14:45:29Z","updated_at":"2018-03-30T14:52:50Z","html_url":"https://github.com/EdinburghGenomics/clarity_scripts/pull/44#discussion_r178303767","pull_request_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls/44","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls/comments/178303767"},"html":{"href":"https://github.com/EdinburghGenomics/clarity_scripts/pull/44#discussion_r178303767"},"pull_request":{"href":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls/44"}}},"pull_request":{"url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls/44","id":171405518,"html_url":"https://github.com/EdinburghGenomics/clarity_scripts/pull/44","diff_url":"https://github.com/EdinburghGenomics/clarity_scripts/pull/44.diff","patch_url":"https://github.com/EdinburghGenomics/clarity_scripts/pull/44.patch","issue_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/issues/44","number":44,"state":"open","locked":false,"title":"Change sample assessment rules","user":{"login":"katieemelianova","id":8308682,"avatar_url":"https://avatars3.githubusercontent.com/u/8308682?v=4","gravatar_id":"","url":"https://api.github.com/users/katieemelianova","html_url":"https://github.com/katieemelianova","followers_url":"https://api.github.com/users/katieemelianova/followers","following_url":"https://api.github.com/users/katieemelianova/following{/other_user}","gists_url":"https://api.github.com/users/katieemelianova/gists{/gist_id}","starred_url":"https://api.github.com/users/katieemelianova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katieemelianova/subscriptions","organizations_url":"https://api.github.com/users/katieemelianova/orgs","repos_url":"https://api.github.com/users/katieemelianova/repos","events_url":"https://api.github.com/users/katieemelianova/events{/privacy}","received_events_url":"https://api.github.com/users/katieemelianova/received_events","type":"User","site_admin":false},"body":"Change the criteria for reviewing run elements so that it is more accurate. Previously using Yield Q30 which caused some samples to be inaccurately reviewed automatically\r\nfixes #40 ","created_at":"2018-02-26T15:24:39Z","updated_at":"2018-03-30T14:52:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f585abc35c10d351e0d8aa5452e9304ffac5f3ef","assignee":null,"assignees":[],"requested_reviewers":[{"login":"tcezard","id":650891,"avatar_url":"https://avatars0.githubusercontent.com/u/650891?v=4","gravatar_id":"","url":"https://api.github.com/users/tcezard","html_url":"https://github.com/tcezard","followers_url":"https://api.github.com/users/tcezard/followers","following_url":"https://api.github.com/users/tcezard/following{/other_user}","gists_url":"https://api.github.com/users/tcezard/gists{/gist_id}","starred_url":"https://api.github.com/users/tcezard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcezard/subscriptions","organizations_url":"https://api.github.com/users/tcezard/orgs","repos_url":"https://api.github.com/users/tcezard/repos","events_url":"https://api.github.com/users/tcezard/events{/privacy}","received_events_url":"https://api.github.com/users/tcezard/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls/44/commits","review_comments_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls/44/comments","review_comment_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/issues/44/comments","statuses_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/statuses/0c608c8c5d4646e5dd73099dce8e24d0b11554b7","head":{"label":"EdinburghGenomics:change_sample_assessmen_rules","ref":"change_sample_assessmen_rules","sha":"0c608c8c5d4646e5dd73099dce8e24d0b11554b7","user":{"login":"EdinburghGenomics","id":12951724,"avatar_url":"https://avatars0.githubusercontent.com/u/12951724?v=4","gravatar_id":"","url":"https://api.github.com/users/EdinburghGenomics","html_url":"https://github.com/EdinburghGenomics","followers_url":"https://api.github.com/users/EdinburghGenomics/followers","following_url":"https://api.github.com/users/EdinburghGenomics/following{/other_user}","gists_url":"https://api.github.com/users/EdinburghGenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/EdinburghGenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EdinburghGenomics/subscriptions","organizations_url":"https://api.github.com/users/EdinburghGenomics/orgs","repos_url":"https://api.github.com/users/EdinburghGenomics/repos","events_url":"https://api.github.com/users/EdinburghGenomics/events{/privacy}","received_events_url":"https://api.github.com/users/EdinburghGenomics/received_events","type":"Organization","site_admin":false},"repo":{"id":50435598,"name":"clarity_scripts","full_name":"EdinburghGenomics/clarity_scripts","owner":{"login":"EdinburghGenomics","id":12951724,"avatar_url":"https://avatars0.githubusercontent.com/u/12951724?v=4","gravatar_id":"","url":"https://api.github.com/users/EdinburghGenomics","html_url":"https://github.com/EdinburghGenomics","followers_url":"https://api.github.com/users/EdinburghGenomics/followers","following_url":"https://api.github.com/users/EdinburghGenomics/following{/other_user}","gists_url":"https://api.github.com/users/EdinburghGenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/EdinburghGenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EdinburghGenomics/subscriptions","organizations_url":"https://api.github.com/users/EdinburghGenomics/orgs","repos_url":"https://api.github.com/users/EdinburghGenomics/repos","events_url":"https://api.github.com/users/EdinburghGenomics/events{/privacy}","received_events_url":"https://api.github.com/users/EdinburghGenomics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/EdinburghGenomics/clarity_scripts","description":"API and EPP scripts  ","fork":false,"url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts","forks_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/forks","keys_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/teams","hooks_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/hooks","issue_events_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/issues/events{/number}","events_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/events","assignees_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/assignees{/user}","branches_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/branches{/branch}","tags_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/tags","blobs_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/languages","stargazers_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/stargazers","contributors_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/contributors","subscribers_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/subscribers","subscription_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/subscription","commits_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/contents/{+path}","compare_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/merges","archive_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/downloads","issues_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/issues{/number}","pulls_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/labels{/name}","releases_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/releases{/id}","deployments_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/deployments","created_at":"2016-01-26T14:54:00Z","updated_at":"2018-03-26T10:04:27Z","pushed_at":"2018-03-30T14:35:29Z","git_url":"git://github.com/EdinburghGenomics/clarity_scripts.git","ssh_url":"git@github.com:EdinburghGenomics/clarity_scripts.git","clone_url":"https://github.com/EdinburghGenomics/clarity_scripts.git","svn_url":"https://github.com/EdinburghGenomics/clarity_scripts","homepage":null,"size":533,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":12,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":12,"watchers":0,"default_branch":"master"}},"base":{"label":"EdinburghGenomics:master","ref":"master","sha":"57d8c8da1958bf1f5769d385c5d679ab4b012294","user":{"login":"EdinburghGenomics","id":12951724,"avatar_url":"https://avatars0.githubusercontent.com/u/12951724?v=4","gravatar_id":"","url":"https://api.github.com/users/EdinburghGenomics","html_url":"https://github.com/EdinburghGenomics","followers_url":"https://api.github.com/users/EdinburghGenomics/followers","following_url":"https://api.github.com/users/EdinburghGenomics/following{/other_user}","gists_url":"https://api.github.com/users/EdinburghGenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/EdinburghGenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EdinburghGenomics/subscriptions","organizations_url":"https://api.github.com/users/EdinburghGenomics/orgs","repos_url":"https://api.github.com/users/EdinburghGenomics/repos","events_url":"https://api.github.com/users/EdinburghGenomics/events{/privacy}","received_events_url":"https://api.github.com/users/EdinburghGenomics/received_events","type":"Organization","site_admin":false},"repo":{"id":50435598,"name":"clarity_scripts","full_name":"EdinburghGenomics/clarity_scripts","owner":{"login":"EdinburghGenomics","id":12951724,"avatar_url":"https://avatars0.githubusercontent.com/u/12951724?v=4","gravatar_id":"","url":"https://api.github.com/users/EdinburghGenomics","html_url":"https://github.com/EdinburghGenomics","followers_url":"https://api.github.com/users/EdinburghGenomics/followers","following_url":"https://api.github.com/users/EdinburghGenomics/following{/other_user}","gists_url":"https://api.github.com/users/EdinburghGenomics/gists{/gist_id}","starred_url":"https://api.github.com/users/EdinburghGenomics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EdinburghGenomics/subscriptions","organizations_url":"https://api.github.com/users/EdinburghGenomics/orgs","repos_url":"https://api.github.com/users/EdinburghGenomics/repos","events_url":"https://api.github.com/users/EdinburghGenomics/events{/privacy}","received_events_url":"https://api.github.com/users/EdinburghGenomics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/EdinburghGenomics/clarity_scripts","description":"API and EPP scripts  ","fork":false,"url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts","forks_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/forks","keys_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/teams","hooks_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/hooks","issue_events_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/issues/events{/number}","events_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/events","assignees_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/assignees{/user}","branches_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/branches{/branch}","tags_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/tags","blobs_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/languages","stargazers_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/stargazers","contributors_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/contributors","subscribers_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/subscribers","subscription_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/subscription","commits_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/contents/{+path}","compare_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/merges","archive_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/downloads","issues_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/issues{/number}","pulls_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/labels{/name}","releases_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/releases{/id}","deployments_url":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/deployments","created_at":"2016-01-26T14:54:00Z","updated_at":"2018-03-26T10:04:27Z","pushed_at":"2018-03-30T14:35:29Z","git_url":"git://github.com/EdinburghGenomics/clarity_scripts.git","ssh_url":"git@github.com:EdinburghGenomics/clarity_scripts.git","clone_url":"https://github.com/EdinburghGenomics/clarity_scripts.git","svn_url":"https://github.com/EdinburghGenomics/clarity_scripts","homepage":null,"size":533,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":12,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":12,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls/44"},"html":{"href":"https://github.com/EdinburghGenomics/clarity_scripts/pull/44"},"issue":{"href":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/issues/44"},"comments":{"href":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/issues/44/comments"},"review_comments":{"href":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls/44/comments"},"review_comment":{"href":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/pulls/44/commits"},"statuses":{"href":"https://api.github.com/repos/EdinburghGenomics/clarity_scripts/statuses/0c608c8c5d4646e5dd73099dce8e24d0b11554b7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mwhamgenomics"}}