Test-drive the GATK tools and Best Practices pipelines on Terra

Check out this blog post to learn how you can get started with GATK and try out the pipelines in preconfigured workspaces (with a user-friendly interface!) without having to install anything.

SelectVariants JEXL expression not working as intended

mmats010mmats010 Riverside CAMember

I am trying to select all variants that are homozygous/polymorphic in either of two samples in my multisample vcf file. For example, Sample1 might be T/T (hom reference) while sample2 might be A/A (hom variant). To do so, I use the following code:

java -Xmx20g -jar $GATK -T SelectVariants -R $REF  \
-V multisample.vcf \
-o out.vcf \
-select "'vc.getGenotype("sample1").isHomRef()' && 'vc.getGenotype("sample2").isHomVar()'"

However, the resulting out.vcf file still contains heterozygous calls for sample1 or sample2. I don't get any error messages, the tools just seems to ignore the command.

I am using version 3.6.

Any help insight would be appreciated.


Best Answers


  • mmats010mmats010 Riverside CAMember
    Accepted Answer

    Figured out my problem. There were too many enclosing marks (" and ').

    Working code looks like:
    -select 'vc.getGenotype("sample1").isHomRef() && vc.getGenotype("sample2").isHomVar()'

    With, of course, "&&" being "&&" due to the markdown formatting here.

Sign In or Register to comment.