Filtering for Homozygous Variants

AmandaAmanda North CarolinaMember

Hello,

I am trying to use an or statement to select for homozygous opposite genotypes between two samples in select variants. I have tried some variations but never been able to get what I am looking for in the outcome. Can you please advise what is going wrong here.

Options in use are:
-env -noTrim --selectTypeToExclude INDEL -select 'vc.getGenotype("SampleA").isHomVar() || vc.getGenotype("SampleA").isHomRef()' --selectexpressions "AF==0.500" --restrictAllelesTo BIALLELIC

If I can select for either HomVar or HomRef for that sample, then the AF should take care of ensuring the second sample is homozygous for the opposite genotype with the AF.

Thank you,
Amanda

Best Answer

Answers

  • AmandaAmanda North CarolinaMember

    PS - I know that I can do this in two steps and combine then sort the resulting output, but I would like to understand why and perhaps it's a bug that will not allow both filters to occur at the same time.
    Thank you!

  • SheilaSheila Broad InstituteMember, Broadie, Moderator

    @Amanda
    Hi Amanda,

    I'm a little confused about what you are trying to do. Can you post an example of what exactly you would like?

    For example, do you want to select sites where sample A has 0/0 and sample B has 1/1. And, you also want to select sites where sample A has 1/1 and sample B has 0/0?

    Thanks,
    Sheila

  • AmandaAmanda North CarolinaMember

    Hi Sheila,

    Since I'm back on for another question, I just saw this response.

    Yes that is exactly what I was trying to do, but I obviously solved it and not sure how I did since it has been some time. If you have a suggestion I can try that if I need to do it again.

    Best,
    Amanda

  • SheilaSheila Broad InstituteMember, Broadie, Moderator

    @Amanda
    Hi Amanda,

    I think you were on the right track in your first post. Instead of using 'vc.getGenotype("SampleA").isHomVar() || vc.getGenotype("SampleA").isHomRef()' together, you would use 'vc.getGenotype("SampleA").isHomVar() && vc.getGenotype("SampleB").isHomRef()' || 'vc.getGenotype("SampleB").isHomVar() && vc.getGenotype("SampleA").isHomRef()'

    So, you would get the two combinations you want (A hom var and B hom ref or B hom var and A hom ref).

    I hope that helps.

    -Sheila

  • SheilaSheila Broad InstituteMember, Broadie, Moderator

    @mmats010
    Hi,

    Yes, that is correct. You can do it in two lines instead of an "or" statement :smile:

    Thanks,
    Sheila

Sign In or Register to comment.