If you happen to see a question you know the answer to, please do chime in and help your fellow community members. We encourage our fourm members to be more involved, jump in and help out your fellow researchers with their questions. GATK forum is a community forum and helping each other with using GATK tools and research is the cornerstone of our success as a genomics research community.We appreciate your help!

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.
We will be out of the office on October 14, 2019, due to the U.S. holiday. We will return to monitoring the forum on October 15.

Filtering on allele balance by sample using jexl


I would like to filter my variants using the SelectVariants walker but it throws an error when I try to filter on allele balance by sample. The jexl expression I use is:


error is:
unknown, ambiguous or inaccessible method getAB

Is there any way of filtering on this parameter?

Best wishes,



  • KathKath Member

    Hmm, but I can select variants based on other annotations in the genotype field eg. PL, and DP.

  • pdexheimerpdexheimer ✭✭✭✭ Member ✭✭✭✭

    The issue here is that you're directly accessing the Genotype object that the data are stored in, and calling Java methods on that object. Several are predefined, like getPL(), getDP(), getAD(), etc. But there is no getAB(). It's possible the getExtendedAttribute() method will do what you want - I think your JEXL will look like: vc.getGenotype("sample").getExtendedAttribute("AB") > 0.25

    There may be some issues with type conversion here, and I don't know how to force a type in JEXL. If that doesn't work for you, try vc.getGenotype("sample").getAttributeAsDouble("AB", 0.0) > 0.25 - this method is marked Deprecated, but I think it will force the conversion for you. The extra 0.0 is a default value in case the annotation doesn't exist

  • Geraldine_VdAuweraGeraldine_VdAuwera admin Cambridge, MAMember, Administrator, Broadie admin

    Sorry, I responded much too shortly. I meant to say that, for most genotype annotations there are no built-in functions to select on them, apart from the few that are special-cased as @pdexheimer correctly pointed out, but we are looking to add built-ins for all the annotations available through GATK.

    The proposed JEXL may work (if yes, please post so here to let other users know) but ultimately we want to make it easier for people to manipulate variants without having to resort to this.

Sign In or Register to comment.