The current GATK version is 3.7-0
Examples: Monday, today, last week, Mar 26, 3/26/04

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Powered by Vanilla. Made with Bootstrap.
GATK 3.7 is here! Be sure to read the Version Highlights and optionally the full Release Notes.
Register now for the upcoming GATK Best Practices workshop, Feb 20-22 in Leuven, Belgium. Open to all comers! More info and signup at

Using SelectVariants to output "PASS" records

WaltLWaltL Member Posts: 10
edited January 2013 in Ask the GATK team

I have completed filtering my SNP data using VariantFiltration, and now I want to use SelectVariants to output all calls marked "PASS" in the FILTER field. I used the following script, but only the header information writes to the output file.

java -Xmx20g -jar GenomeAnalysisTK.jar -T SelectVariants -R HC.fa --variant HC.SNPs.filtered.vcf -select "FILTER == 'PASS'" -o HC.SNPs.passed.vcf

My input file contains many records that should evaluate as true. Any idea why this doesn't this work?

Post edited by Geraldine_VdAuwera on


  • ebanksebanks Broad InstituteMember, Administrator, Broadie, Moderator, Dev Posts: 698 admin

    PASS means that the record is not filtered at all, so that expression won't work. You will need to use a more advanced JEXL expression (checking whether the VariantContext is filtered or not). See the docs of using JEXL expressions for more details.

    Eric Banks, PhD -- Director, Data Sciences and Data Engineering, Broad Institute of Harvard and MIT

  • WaltLWaltL Member Posts: 10

    I did look at this JEXL doc first:, and that's why I used the above expression, e.g. "MY_STRING_KEY == 'foo'"

    So, are you saying that a string designating a filtered record should work in this context? Because it does not. For example, I have a filter field name called LowQual, and if I run the cmd using - select "Filter == 'LowQual'" it also only returns just the header info.

    VariantContext is only mentioned under the "More Complex JEXL Magic" ("not for the faint of heart") section. Perhaps this could be updated somewhere to reflect that if one wants to select subsets of records based on their FILTER field entries, it cannot be done using the general expression given to select strings. I would think that filtering data followed by selecting only those that pass the filtering process would be a fairly common thing to want to do. Perhaps not...

    In any case, if anyone else wants to do this, here's an expression to select all of your PASS records:

    -select 'vc.isNotFiltered()'

  • Geraldine_VdAuweraGeraldine_VdAuwera Administrator, Dev Posts: 10,993 admin

    Filtering then selecting what passes can more easily be done by directly selecting on whatever parameter you're using to filter...

    But generally the problem is that JEXL is a slippery topic. There's a lot of "it depends what you're trying to do", and we have a lot of other, more straightforward docs that need to be updated/spruced up. It'll be a while before we get around to revamping the JEXL doc, sorry. So, posting your solution is definitely helpful and we thank you for doing so!

    Geraldine Van der Auwera, PhD

Sign In or Register to comment.