{"action":"created","comment":{"url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls/comments/41570930","id":41570930,"diff_hunk":"@@ -272,11 +272,20 @@ static Status translate_genotypes(const genotyper_config& cfg, const unified_sit\n     // reference allele maps if it contains the unified site\n     range rng(record);\n     allele_mapping.push_back(rng.contains(site.pos) ? 0 : -1);\n-\n-    // map the bcf1_t alt alleles according to unification\n-    for (int i = 1; i < record->n_allele; i++) {\n-        auto p = site.unification.find(make_pair(rng.beg, string(record->d.allele[i])));\n-        allele_mapping.push_back(p != site.unification.end() ? p->second : -1);\n+    // if reference alleles are different, the same alt allele\n+    // DNA sequence may have different meaning and cannot be translated\n+    // directly as is.\n+    bool isIdenticalRef = site.pos.size() == rng.size();","path":"src/genotyper.cc","position":12,"original_position":12,"commit_id":"f7a0fc553e717830a5b70b03c407646b38f6e81a","original_commit_id":"f7a0fc553e717830a5b70b03c407646b38f6e81a","user":{"login":"yifei-men","id":13123683,"avatar_url":"https://avatars.githubusercontent.com/u/13123683?v=3","gravatar_id":"","url":"https://api.github.com/users/yifei-men","html_url":"https://github.com/yifei-men","followers_url":"https://api.github.com/users/yifei-men/followers","following_url":"https://api.github.com/users/yifei-men/following{/other_user}","gists_url":"https://api.github.com/users/yifei-men/gists{/gist_id}","starred_url":"https://api.github.com/users/yifei-men/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yifei-men/subscriptions","organizations_url":"https://api.github.com/users/yifei-men/orgs","repos_url":"https://api.github.com/users/yifei-men/repos","events_url":"https://api.github.com/users/yifei-men/events{/privacy}","received_events_url":"https://api.github.com/users/yifei-men/received_events","type":"User","site_admin":false},"body":"Got it, I think that's a lot more straightforward of a check.","created_at":"2015-10-08T21:23:32Z","updated_at":"2015-10-08T21:23:32Z","html_url":"https://github.com/dnanexus-rnd/GLnexus/pull/28#discussion_r41570930","pull_request_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls/comments/41570930"},"html":{"href":"https://github.com/dnanexus-rnd/GLnexus/pull/28#discussion_r41570930"},"pull_request":{"href":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls/28","id":47097340,"html_url":"https://github.com/dnanexus-rnd/GLnexus/pull/28","diff_url":"https://github.com/dnanexus-rnd/GLnexus/pull/28.diff","patch_url":"https://github.com/dnanexus-rnd/GLnexus/pull/28.patch","issue_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/issues/28","number":28,"state":"open","locked":false,"title":"In translate_genotypes, check for changes in REF allele.","user":{"login":"yifei-men","id":13123683,"avatar_url":"https://avatars.githubusercontent.com/u/13123683?v=3","gravatar_id":"","url":"https://api.github.com/users/yifei-men","html_url":"https://github.com/yifei-men","followers_url":"https://api.github.com/users/yifei-men/followers","following_url":"https://api.github.com/users/yifei-men/following{/other_user}","gists_url":"https://api.github.com/users/yifei-men/gists{/gist_id}","starred_url":"https://api.github.com/users/yifei-men/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yifei-men/subscriptions","organizations_url":"https://api.github.com/users/yifei-men/orgs","repos_url":"https://api.github.com/users/yifei-men/repos","events_url":"https://api.github.com/users/yifei-men/events{/privacy}","received_events_url":"https://api.github.com/users/yifei-men/received_events","type":"User","site_admin":false},"body":"## Problem that this PR addresses\r\nIn cases where the REF allele in the unified site differs from the original input (g)vcf, the ALT allele, when lifted over, may carry a different genomic meaning. This is especially problematic for indels.\r\n\r\nThis commit checks for changes in the REF allele and in the cases where the REF differs, all ALT calls in the original (g)vcf is deemed to be untranslatable and are genotyped as no-calls.\r\n\r\nI'm also sneaking in a batch correction for typos relating to misplaced brackets around `bcf_gt_allele` in `REQUIRE` statements, which I discovered when adding in my own tests in similar formats. The misplaced bracket causes a subtle situation that doesn't execute the expected test conditions. Fortunately, this correction did not create any test failures, so the genotyping behavior has been performing as expected.\r\n\r\n## Example\r\nTest added, as inspired by real-life observation of inaccurate GLnexus genotype translation.\r\n\r\n### Input\r\nIn the file Joint_A.gvcf, we note that the original input has 2 ALT calls at site *A:1000*, `A` and `ATGTG` associated with the REF `ATGTGTG`. We can interpret this as Joint_A has 1 TGTGTG deletion allele and 1 TG deletion allele at this site.\r\n \r\n### Allele discovery and unification\r\nAllele discovery and unification will return REF = `ATG` and ALT=`ATGTG`, which are the 2 most frequent alleles across the 4 gvcf joint-genotyped. \r\n\r\n### Output\r\nBefore this patch, we would expect GLnexus to output, for Joint_A, an ALT call of `ATGTG` and a loss of the original call of `A`. Note however, that the ALT call of `ATGTG`, when associated with the REF of `ATG`, indicates a `TG` insertion, which is different from the original input meaning of a `TG` deletion, and thus incorrect.\r\n\r\nThis patch will interpret both ALT calls in Joint_A to be untranslatable and thus we expect 2 no-calls at the unified site.\r\n\r\n## Next steps\r\nCreate a more clever translate_genotype routine which can understand the context of the changing REF allele and translate input ALTs to unified alleles correctly, retaining the appropriate indel/point mutation semantic meaning.","created_at":"2015-10-07T23:55:27Z","updated_at":"2015-10-08T21:23:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ecfec8b6598627cf80973ff5f781c8c0bf2d4eb8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls/28/commits","review_comments_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls/28/comments","review_comment_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/issues/28/comments","statuses_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/statuses/f7a0fc553e717830a5b70b03c407646b38f6e81a","head":{"label":"dnanexus-rnd:translate-genotype-REF-check","ref":"translate-genotype-REF-check","sha":"f7a0fc553e717830a5b70b03c407646b38f6e81a","user":{"login":"dnanexus-rnd","id":11299902,"avatar_url":"https://avatars.githubusercontent.com/u/11299902?v=3","gravatar_id":"","url":"https://api.github.com/users/dnanexus-rnd","html_url":"https://github.com/dnanexus-rnd","followers_url":"https://api.github.com/users/dnanexus-rnd/followers","following_url":"https://api.github.com/users/dnanexus-rnd/following{/other_user}","gists_url":"https://api.github.com/users/dnanexus-rnd/gists{/gist_id}","starred_url":"https://api.github.com/users/dnanexus-rnd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnanexus-rnd/subscriptions","organizations_url":"https://api.github.com/users/dnanexus-rnd/orgs","repos_url":"https://api.github.com/users/dnanexus-rnd/repos","events_url":"https://api.github.com/users/dnanexus-rnd/events{/privacy}","received_events_url":"https://api.github.com/users/dnanexus-rnd/received_events","type":"Organization","site_admin":false},"repo":{"id":33585912,"name":"GLnexus","full_name":"dnanexus-rnd/GLnexus","owner":{"login":"dnanexus-rnd","id":11299902,"avatar_url":"https://avatars.githubusercontent.com/u/11299902?v=3","gravatar_id":"","url":"https://api.github.com/users/dnanexus-rnd","html_url":"https://github.com/dnanexus-rnd","followers_url":"https://api.github.com/users/dnanexus-rnd/followers","following_url":"https://api.github.com/users/dnanexus-rnd/following{/other_user}","gists_url":"https://api.github.com/users/dnanexus-rnd/gists{/gist_id}","starred_url":"https://api.github.com/users/dnanexus-rnd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnanexus-rnd/subscriptions","organizations_url":"https://api.github.com/users/dnanexus-rnd/orgs","repos_url":"https://api.github.com/users/dnanexus-rnd/repos","events_url":"https://api.github.com/users/dnanexus-rnd/events{/privacy}","received_events_url":"https://api.github.com/users/dnanexus-rnd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dnanexus-rnd/GLnexus","description":"Scalable datastore for population genome sequencing, with on-demand joint genotyping","fork":false,"url":"https://api.github.com/repos/dnanexus-rnd/GLnexus","forks_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/forks","keys_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/teams","hooks_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/hooks","issue_events_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/issues/events{/number}","events_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/events","assignees_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/assignees{/user}","branches_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/branches{/branch}","tags_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/tags","blobs_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/git/refs{/sha}","trees_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/statuses/{sha}","languages_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/languages","stargazers_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/stargazers","contributors_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/contributors","subscribers_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/subscribers","subscription_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/subscription","commits_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/commits{/sha}","git_commits_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/git/commits{/sha}","comments_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/comments{/number}","issue_comment_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/issues/comments{/number}","contents_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/contents/{+path}","compare_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/merges","archive_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/downloads","issues_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/issues{/number}","pulls_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls{/number}","milestones_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/milestones{/number}","notifications_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/labels{/name}","releases_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/releases{/id}","created_at":"2015-04-08T05:05:05Z","updated_at":"2015-09-19T20:39:38Z","pushed_at":"2015-10-08T19:49:29Z","git_url":"git://github.com/dnanexus-rnd/GLnexus.git","ssh_url":"git@github.com:dnanexus-rnd/GLnexus.git","clone_url":"https://github.com/dnanexus-rnd/GLnexus.git","svn_url":"https://github.com/dnanexus-rnd/GLnexus","homepage":"","size":4585,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":2,"default_branch":"master"}},"base":{"label":"dnanexus-rnd:master","ref":"master","sha":"a4ec63b6f33aa821ee9cbbe3d1be786f2ed80452","user":{"login":"dnanexus-rnd","id":11299902,"avatar_url":"https://avatars.githubusercontent.com/u/11299902?v=3","gravatar_id":"","url":"https://api.github.com/users/dnanexus-rnd","html_url":"https://github.com/dnanexus-rnd","followers_url":"https://api.github.com/users/dnanexus-rnd/followers","following_url":"https://api.github.com/users/dnanexus-rnd/following{/other_user}","gists_url":"https://api.github.com/users/dnanexus-rnd/gists{/gist_id}","starred_url":"https://api.github.com/users/dnanexus-rnd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnanexus-rnd/subscriptions","organizations_url":"https://api.github.com/users/dnanexus-rnd/orgs","repos_url":"https://api.github.com/users/dnanexus-rnd/repos","events_url":"https://api.github.com/users/dnanexus-rnd/events{/privacy}","received_events_url":"https://api.github.com/users/dnanexus-rnd/received_events","type":"Organization","site_admin":false},"repo":{"id":33585912,"name":"GLnexus","full_name":"dnanexus-rnd/GLnexus","owner":{"login":"dnanexus-rnd","id":11299902,"avatar_url":"https://avatars.githubusercontent.com/u/11299902?v=3","gravatar_id":"","url":"https://api.github.com/users/dnanexus-rnd","html_url":"https://github.com/dnanexus-rnd","followers_url":"https://api.github.com/users/dnanexus-rnd/followers","following_url":"https://api.github.com/users/dnanexus-rnd/following{/other_user}","gists_url":"https://api.github.com/users/dnanexus-rnd/gists{/gist_id}","starred_url":"https://api.github.com/users/dnanexus-rnd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnanexus-rnd/subscriptions","organizations_url":"https://api.github.com/users/dnanexus-rnd/orgs","repos_url":"https://api.github.com/users/dnanexus-rnd/repos","events_url":"https://api.github.com/users/dnanexus-rnd/events{/privacy}","received_events_url":"https://api.github.com/users/dnanexus-rnd/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dnanexus-rnd/GLnexus","description":"Scalable datastore for population genome sequencing, with on-demand joint genotyping","fork":false,"url":"https://api.github.com/repos/dnanexus-rnd/GLnexus","forks_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/forks","keys_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/teams","hooks_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/hooks","issue_events_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/issues/events{/number}","events_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/events","assignees_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/assignees{/user}","branches_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/branches{/branch}","tags_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/tags","blobs_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/git/refs{/sha}","trees_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/statuses/{sha}","languages_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/languages","stargazers_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/stargazers","contributors_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/contributors","subscribers_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/subscribers","subscription_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/subscription","commits_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/commits{/sha}","git_commits_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/git/commits{/sha}","comments_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/comments{/number}","issue_comment_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/issues/comments{/number}","contents_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/contents/{+path}","compare_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/merges","archive_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/downloads","issues_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/issues{/number}","pulls_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls{/number}","milestones_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/milestones{/number}","notifications_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/labels{/name}","releases_url":"https://api.github.com/repos/dnanexus-rnd/GLnexus/releases{/id}","created_at":"2015-04-08T05:05:05Z","updated_at":"2015-09-19T20:39:38Z","pushed_at":"2015-10-08T19:49:29Z","git_url":"git://github.com/dnanexus-rnd/GLnexus.git","ssh_url":"git@github.com:dnanexus-rnd/GLnexus.git","clone_url":"https://github.com/dnanexus-rnd/GLnexus.git","svn_url":"https://github.com/dnanexus-rnd/GLnexus","homepage":"","size":4585,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls/28"},"html":{"href":"https://github.com/dnanexus-rnd/GLnexus/pull/28"},"issue":{"href":"https://api.github.com/repos/dnanexus-rnd/GLnexus/issues/28"},"comments":{"href":"https://api.github.com/repos/dnanexus-rnd/GLnexus/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dnanexus-rnd/GLnexus/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/dnanexus-rnd/GLnexus/statuses/f7a0fc553e717830a5b70b03c407646b38f6e81a"}}}}