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!

You can opt in to receive email notifications, for example when your questions get answered or when there are new announcements, by following the instructions given here.

#### ☞ Did you remember to?

1. Search using the upper-right search box, e.g. using the error message.
3. Include tool and Java versions.
4. Tell us whether you are following GATK Best Practices.
5. Include relevant details, e.g. platform, DNA- or RNA-Seq, WES (+capture kit) or WGS (PCR-free or PCR+), paired- or single-end, read length, expected average coverage, somatic data, etc.
6. For tool errors, include the error stacktrace as well as the exact command.
7. For format issues, include the result of running ValidateSamFile for BAMs or ValidateVariants for VCFs.
8. For weird results, include an illustrative example, e.g. attach IGV screenshots according to Article#5484.
9. For a seeming variant that is uncalled, include results of following Article#1235.

#### ☞ Formatting tip!

Wrap blocks of code, error messages and BAM/VCF snippets--especially content with hashes (#)--with lines with three backticks (  ) each to make a code block as demonstrated here.

GATK 3.7 is here! Be sure to read the Version Highlights and optionally the full Release Notes.

# VariantFiltration and SelectVariants

Member Posts: 8
edited January 2013

I am trying to filter variant calls which have "GQ>=20.0".

GATK SelectVariants, gives no error but gives only the header in the output file

java -Xmx2g -jar ~/GenomeAnalysisTKLite-2.1-8-gbb7f038/GenomeAnalysisTKLite.jar -R xxx -T SelectVariants --variant xxx.var.flt.vcf -o xxx.vcf -select "GQ &gt;= 20.0"


So, I tried using VariantFiltration followed by SelectVariants. The variant filtration seems to work fine adding FT tag to the format field. And then I am trying to get records having FT tag using the following commands

java -Xmx2g -jar ~/GenomeAnalysisTKLite-2.1-8-gbb7f038/GenomeAnalysisTKLite.jar -R xxx -T VariantFiltration --variant xxx.var.flt.vcf -o xxx_filtered.vcf --genotypeFilterExpression "GQ &gt;= 20.0" --genotypeFilterName "qual_1_filters"

java -Xmx4g -jar ~/GenomeAnalysisTKLite-2.1-8-gbb7f038/GenomeAnalysisTKLite.jar -T SelectVariants -R xxx --variant xxx_filtered.vcf -select 'vc.hasAttribute("FT")' -o xxx_qual20.vcf
`

but I only get header in the output vcf file.

I am not sure if this is the right approach. Any help would be appreciated.

Post edited by Geraldine_VdAuwera on

The simplest approach is the one in your first command; that should work. Have you looked at the article on JEXL expressions to find out what may be messing it up?

Geraldine Van der Auwera, PhD

• Member Posts: 8

I did check out the article on JEXL expressions.GQ is not a missing field, so all my records should have it.I don't find anything wrong with the expression "GQ >= 20.0".

• Member, Dev Posts: 544 ✭✭✭✭

I'm pretty sure SelectVariants can only select on variant-level annotations (in the INFO field) - GQ is specified at the sample level (FORMAT field). I think your second approach is close, but the filters added by "VariantFiltration --genotypeFilter" are sample-level (they're added to the FORMAT field), so you still can't select on them.

To my knowledge, there's no way to do what you want in the GATK. The appropriate place would be in SelectVariants, but there would also have to be thresholding logic in there (do you select if you see it in 1 sample? 10%? 90%?). I think your best bet is probably to write a Perl filter

• Member Posts: 8

I am working on single sample data.So,I don't see a way to set thresholds. I guess the best bet would be to write a script.Thanks for the help.

• Member Posts: 7

Dear Geraldine....I also am having the same problem. I have a .vcf file containing three samples obtained with the CombineVariants. I checked out the final .vcf and in the INFO field I have "set=variant" , I am trying to SelectVariants on the basis of this expression with the following command line:

java -Xmx4g -jar /home/cox/GenomeAnalysisTK-2.3-9-ge5ebf34/GenomeAnalysisTK.jar -R hg19.fa -T SelectVariants --variant input.vcf -select “set=variant” -o output.vcf

This gives no error but gives only the header in the output file .....what am I doing wrong?