Add support for inverting phase of genotypes with setGT plugin#2367
Merged
pd3 merged 1 commit intosamtools:developfrom Mar 5, 2025
Merged
Add support for inverting phase of genotypes with setGT plugin#2367pd3 merged 1 commit intosamtools:developfrom
pd3 merged 1 commit intosamtools:developfrom
Conversation
pd3
reviewed
Feb 24, 2025
| " X .. allele with bigger read depth as determined from FMT/AD\n" | ||
| " p .. phase genotype (0/1 becomes 0|1)\n" | ||
| " u .. unphase genotype and sort by allele (1|0 becomes 0/1)\n" | ||
| " i .. inverse phase of genotype (0|1 becomes 1|0)\n" |
Member
There was a problem hiding this comment.
I am not a native speaker, but I think a better description would be "invert the genotype phase"
pd3
reviewed
Feb 24, 2025
| return changed; | ||
| } | ||
|
|
||
| // inverse phase for a single sample, ngts is the ploidy |
Member
There was a problem hiding this comment.
invert, not inverse, here and everywhere..
Member
|
Thank you for the pull request. Please add a test, see |
Contributor
Author
|
@pd3 thank you for your response, I fixed the language and added a test case. Best regards, |
pd3
approved these changes
Mar 5, 2025
Member
|
Thank you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello,
I added an option to invert the phase of diploid genotypes in the setGT plugin.
So
0|1becomes1|0.This is useful when one wants to invert the whole phase of a file, or selected samples, or based on a filter.
The function only inverts the phase of diploid genotypes (checks
ngt==2and ifbcf_int32_vector_endis present).Phase flag is set correctly per BCF specs. Note unphased genotypes are also swapped so
0/1becomes1/0.I hope we can get this merged, let me know if there are any changes you would like me to make.
Best regards,
Rick