{"action":"created","comment":{"url":"https://api.github.com/repos/hammerlab/cohorts/pulls/comments/68824817","id":68824817,"diff_hunk":"@@ -533,8 +547,34 @@ def _load_single_patient_variants(self, patient, variant_type, merge_type, filte\n             merged_variants = self._merge_variant_collections(dict(variant_collections), merge_type)\n \n         self.save_to_cache(merged_variants, self.cache_names[\"variant\"], patient.id, cached_file_name)\n-\n-        return filter_variants_with_metadata(merged_variants, filter_fn)\n+        return on_return(merged_variants)\n+\n+    def _filter_variants_to_expressed(self, variants, patient, variant_type, merge_type):\n+        \"\"\"Given a VariantCollection, filters that collection to only expressed variants.\"\"\"\n+        if len(variants) == 0:\n+            return variants\n+\n+        expressed_variants = []\n+        expressed_metadata = {}\n+        # TODO: we're currently using the same isovar cache that we use for expressed\n+        # neoantigen prediction; so we pass in the same epitope lengths.\n+        # This is hacky and should be addressed.\n+        df_isovar = self._load_single_patient_isovar(patient=patient,\n+                                                     variants=variants,\n+                                                     epitope_lengths=[8, 9, 10, 11],\n+                                                     variant_type=variant_type,\n+                                                     merge_type=merge_type)\n+        for i, row in df_isovar.iterrows():\n+            genome = variants[0].ensembl\n+            variant = Variant(contig=row[\"chr\"],\n+                              start=row[\"pos\"],\n+                              ref=row[\"ref\"],\n+                              alt=row[\"alt\"],\n+                              ensembl=genome)\n+            if variant in variants:","path":"cohorts/load.py","position":91,"original_position":91,"commit_id":"394dd61aaeb81757b46d04409e930d159641d0af","original_commit_id":"394dd61aaeb81757b46d04409e930d159641d0af","user":{"login":"tavinathanson","id":322932,"avatar_url":"https://avatars.githubusercontent.com/u/322932?v=3","gravatar_id":"","url":"https://api.github.com/users/tavinathanson","html_url":"https://github.com/tavinathanson","followers_url":"https://api.github.com/users/tavinathanson/followers","following_url":"https://api.github.com/users/tavinathanson/following{/other_user}","gists_url":"https://api.github.com/users/tavinathanson/gists{/gist_id}","starred_url":"https://api.github.com/users/tavinathanson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tavinathanson/subscriptions","organizations_url":"https://api.github.com/users/tavinathanson/orgs","repos_url":"https://api.github.com/users/tavinathanson/repos","events_url":"https://api.github.com/users/tavinathanson/events{/privacy}","received_events_url":"https://api.github.com/users/tavinathanson/received_events","type":"User","site_admin":false},"body":"As opposed to caching the output? Yeah, I wanted to try to simplify by not caching this.","created_at":"2016-06-28T19:22:03Z","updated_at":"2016-06-28T19:22:03Z","html_url":"https://github.com/hammerlab/cohorts/pull/67#discussion_r68824817","pull_request_url":"https://api.github.com/repos/hammerlab/cohorts/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/hammerlab/cohorts/pulls/comments/68824817"},"html":{"href":"https://github.com/hammerlab/cohorts/pull/67#discussion_r68824817"},"pull_request":{"href":"https://api.github.com/repos/hammerlab/cohorts/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/hammerlab/cohorts/pulls/67","id":75522395,"html_url":"https://github.com/hammerlab/cohorts/pull/67","diff_url":"https://github.com/hammerlab/cohorts/pull/67.diff","patch_url":"https://github.com/hammerlab/cohorts/pull/67.patch","issue_url":"https://api.github.com/repos/hammerlab/cohorts/issues/67","number":67,"state":"open","locked":false,"title":"Filter to expressed variants","user":{"login":"tavinathanson","id":322932,"avatar_url":"https://avatars.githubusercontent.com/u/322932?v=3","gravatar_id":"","url":"https://api.github.com/users/tavinathanson","html_url":"https://github.com/tavinathanson","followers_url":"https://api.github.com/users/tavinathanson/followers","following_url":"https://api.github.com/users/tavinathanson/following{/other_user}","gists_url":"https://api.github.com/users/tavinathanson/gists{/gist_id}","starred_url":"https://api.github.com/users/tavinathanson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tavinathanson/subscriptions","organizations_url":"https://api.github.com/users/tavinathanson/orgs","repos_url":"https://api.github.com/users/tavinathanson/repos","events_url":"https://api.github.com/users/tavinathanson/events{/privacy}","received_events_url":"https://api.github.com/users/tavinathanson/received_events","type":"User","site_admin":false},"body":"In this PR:\r\n\r\n* Factored some of the `df_isovar` logic out of `load_neoantigens` into a separate `_load_single_patient_isovar`, to use it outside the neoantigen context.\r\n* Added `_filter_variants_to_expressed` to filter out any variant that isn't present in the `isovar` `DataFrame`.\r\n* Randomly made it into this branch: parameterizing `variant_qc_filter`.\r\n\r\n@arahuja ","created_at":"2016-06-28T18:00:31Z","updated_at":"2016-06-28T19:22:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ad711cedb2399de9e8deafb5d843735488946e1e","assignee":{"login":"arahuja","id":455755,"avatar_url":"https://avatars.githubusercontent.com/u/455755?v=3","gravatar_id":"","url":"https://api.github.com/users/arahuja","html_url":"https://github.com/arahuja","followers_url":"https://api.github.com/users/arahuja/followers","following_url":"https://api.github.com/users/arahuja/following{/other_user}","gists_url":"https://api.github.com/users/arahuja/gists{/gist_id}","starred_url":"https://api.github.com/users/arahuja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arahuja/subscriptions","organizations_url":"https://api.github.com/users/arahuja/orgs","repos_url":"https://api.github.com/users/arahuja/repos","events_url":"https://api.github.com/users/arahuja/events{/privacy}","received_events_url":"https://api.github.com/users/arahuja/received_events","type":"User","site_admin":false},"assignees":[{"login":"arahuja","id":455755,"avatar_url":"https://avatars.githubusercontent.com/u/455755?v=3","gravatar_id":"","url":"https://api.github.com/users/arahuja","html_url":"https://github.com/arahuja","followers_url":"https://api.github.com/users/arahuja/followers","following_url":"https://api.github.com/users/arahuja/following{/other_user}","gists_url":"https://api.github.com/users/arahuja/gists{/gist_id}","starred_url":"https://api.github.com/users/arahuja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arahuja/subscriptions","organizations_url":"https://api.github.com/users/arahuja/orgs","repos_url":"https://api.github.com/users/arahuja/repos","events_url":"https://api.github.com/users/arahuja/events{/privacy}","received_events_url":"https://api.github.com/users/arahuja/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/hammerlab/cohorts/pulls/67/commits","review_comments_url":"https://api.github.com/repos/hammerlab/cohorts/pulls/67/comments","review_comment_url":"https://api.github.com/repos/hammerlab/cohorts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hammerlab/cohorts/issues/67/comments","statuses_url":"https://api.github.com/repos/hammerlab/cohorts/statuses/394dd61aaeb81757b46d04409e930d159641d0af","head":{"label":"hammerlab:expressed_mutations","ref":"expressed_mutations","sha":"394dd61aaeb81757b46d04409e930d159641d0af","user":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"repo":{"id":53869966,"name":"cohorts","full_name":"hammerlab/cohorts","owner":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hammerlab/cohorts","description":"Utilities for analyzing mutations and neoepitopes in patient cohorts","fork":false,"url":"https://api.github.com/repos/hammerlab/cohorts","forks_url":"https://api.github.com/repos/hammerlab/cohorts/forks","keys_url":"https://api.github.com/repos/hammerlab/cohorts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hammerlab/cohorts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hammerlab/cohorts/teams","hooks_url":"https://api.github.com/repos/hammerlab/cohorts/hooks","issue_events_url":"https://api.github.com/repos/hammerlab/cohorts/issues/events{/number}","events_url":"https://api.github.com/repos/hammerlab/cohorts/events","assignees_url":"https://api.github.com/repos/hammerlab/cohorts/assignees{/user}","branches_url":"https://api.github.com/repos/hammerlab/cohorts/branches{/branch}","tags_url":"https://api.github.com/repos/hammerlab/cohorts/tags","blobs_url":"https://api.github.com/repos/hammerlab/cohorts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hammerlab/cohorts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hammerlab/cohorts/git/refs{/sha}","trees_url":"https://api.github.com/repos/hammerlab/cohorts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hammerlab/cohorts/statuses/{sha}","languages_url":"https://api.github.com/repos/hammerlab/cohorts/languages","stargazers_url":"https://api.github.com/repos/hammerlab/cohorts/stargazers","contributors_url":"https://api.github.com/repos/hammerlab/cohorts/contributors","subscribers_url":"https://api.github.com/repos/hammerlab/cohorts/subscribers","subscription_url":"https://api.github.com/repos/hammerlab/cohorts/subscription","commits_url":"https://api.github.com/repos/hammerlab/cohorts/commits{/sha}","git_commits_url":"https://api.github.com/repos/hammerlab/cohorts/git/commits{/sha}","comments_url":"https://api.github.com/repos/hammerlab/cohorts/comments{/number}","issue_comment_url":"https://api.github.com/repos/hammerlab/cohorts/issues/comments{/number}","contents_url":"https://api.github.com/repos/hammerlab/cohorts/contents/{+path}","compare_url":"https://api.github.com/repos/hammerlab/cohorts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hammerlab/cohorts/merges","archive_url":"https://api.github.com/repos/hammerlab/cohorts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hammerlab/cohorts/downloads","issues_url":"https://api.github.com/repos/hammerlab/cohorts/issues{/number}","pulls_url":"https://api.github.com/repos/hammerlab/cohorts/pulls{/number}","milestones_url":"https://api.github.com/repos/hammerlab/cohorts/milestones{/number}","notifications_url":"https://api.github.com/repos/hammerlab/cohorts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hammerlab/cohorts/labels{/name}","releases_url":"https://api.github.com/repos/hammerlab/cohorts/releases{/id}","deployments_url":"https://api.github.com/repos/hammerlab/cohorts/deployments","created_at":"2016-03-14T15:52:59Z","updated_at":"2016-05-06T18:34:33Z","pushed_at":"2016-06-28T18:09:48Z","git_url":"git://github.com/hammerlab/cohorts.git","ssh_url":"git@github.com:hammerlab/cohorts.git","clone_url":"https://github.com/hammerlab/cohorts.git","svn_url":"https://github.com/hammerlab/cohorts","homepage":null,"size":182,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":13,"forks":2,"open_issues":13,"watchers":2,"default_branch":"master"}},"base":{"label":"hammerlab:master","ref":"master","sha":"5b1eaf6fc5e662ed2a5cb2e10b64c89ca06e4a81","user":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"repo":{"id":53869966,"name":"cohorts","full_name":"hammerlab/cohorts","owner":{"login":"hammerlab","id":6563873,"avatar_url":"https://avatars.githubusercontent.com/u/6563873?v=3","gravatar_id":"","url":"https://api.github.com/users/hammerlab","html_url":"https://github.com/hammerlab","followers_url":"https://api.github.com/users/hammerlab/followers","following_url":"https://api.github.com/users/hammerlab/following{/other_user}","gists_url":"https://api.github.com/users/hammerlab/gists{/gist_id}","starred_url":"https://api.github.com/users/hammerlab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hammerlab/subscriptions","organizations_url":"https://api.github.com/users/hammerlab/orgs","repos_url":"https://api.github.com/users/hammerlab/repos","events_url":"https://api.github.com/users/hammerlab/events{/privacy}","received_events_url":"https://api.github.com/users/hammerlab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hammerlab/cohorts","description":"Utilities for analyzing mutations and neoepitopes in patient cohorts","fork":false,"url":"https://api.github.com/repos/hammerlab/cohorts","forks_url":"https://api.github.com/repos/hammerlab/cohorts/forks","keys_url":"https://api.github.com/repos/hammerlab/cohorts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hammerlab/cohorts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hammerlab/cohorts/teams","hooks_url":"https://api.github.com/repos/hammerlab/cohorts/hooks","issue_events_url":"https://api.github.com/repos/hammerlab/cohorts/issues/events{/number}","events_url":"https://api.github.com/repos/hammerlab/cohorts/events","assignees_url":"https://api.github.com/repos/hammerlab/cohorts/assignees{/user}","branches_url":"https://api.github.com/repos/hammerlab/cohorts/branches{/branch}","tags_url":"https://api.github.com/repos/hammerlab/cohorts/tags","blobs_url":"https://api.github.com/repos/hammerlab/cohorts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hammerlab/cohorts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hammerlab/cohorts/git/refs{/sha}","trees_url":"https://api.github.com/repos/hammerlab/cohorts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hammerlab/cohorts/statuses/{sha}","languages_url":"https://api.github.com/repos/hammerlab/cohorts/languages","stargazers_url":"https://api.github.com/repos/hammerlab/cohorts/stargazers","contributors_url":"https://api.github.com/repos/hammerlab/cohorts/contributors","subscribers_url":"https://api.github.com/repos/hammerlab/cohorts/subscribers","subscription_url":"https://api.github.com/repos/hammerlab/cohorts/subscription","commits_url":"https://api.github.com/repos/hammerlab/cohorts/commits{/sha}","git_commits_url":"https://api.github.com/repos/hammerlab/cohorts/git/commits{/sha}","comments_url":"https://api.github.com/repos/hammerlab/cohorts/comments{/number}","issue_comment_url":"https://api.github.com/repos/hammerlab/cohorts/issues/comments{/number}","contents_url":"https://api.github.com/repos/hammerlab/cohorts/contents/{+path}","compare_url":"https://api.github.com/repos/hammerlab/cohorts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hammerlab/cohorts/merges","archive_url":"https://api.github.com/repos/hammerlab/cohorts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hammerlab/cohorts/downloads","issues_url":"https://api.github.com/repos/hammerlab/cohorts/issues{/number}","pulls_url":"https://api.github.com/repos/hammerlab/cohorts/pulls{/number}","milestones_url":"https://api.github.com/repos/hammerlab/cohorts/milestones{/number}","notifications_url":"https://api.github.com/repos/hammerlab/cohorts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hammerlab/cohorts/labels{/name}","releases_url":"https://api.github.com/repos/hammerlab/cohorts/releases{/id}","deployments_url":"https://api.github.com/repos/hammerlab/cohorts/deployments","created_at":"2016-03-14T15:52:59Z","updated_at":"2016-05-06T18:34:33Z","pushed_at":"2016-06-28T18:09:48Z","git_url":"git://github.com/hammerlab/cohorts.git","ssh_url":"git@github.com:hammerlab/cohorts.git","clone_url":"https://github.com/hammerlab/cohorts.git","svn_url":"https://github.com/hammerlab/cohorts","homepage":null,"size":182,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":13,"forks":2,"open_issues":13,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hammerlab/cohorts/pulls/67"},"html":{"href":"https://github.com/hammerlab/cohorts/pull/67"},"issue":{"href":"https://api.github.com/repos/hammerlab/cohorts/issues/67"},"comments":{"href":"https://api.github.com/repos/hammerlab/cohorts/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/hammerlab/cohorts/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/hammerlab/cohorts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hammerlab/cohorts/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/hammerlab/cohorts/statuses/394dd61aaeb81757b46d04409e930d159641d0af"}}}}
{"actor":{"display_login":"tavinathanson"}}