Filter variant calls based on INFO and FORMAT annotations
This tool is designed for hard-filtering variant calls based on certain criteria. Records are hard-filtered by changing the value in the FILTER field to something other than PASS. Filtered records will be preserved in the output unless their removal is requested in the command line.
The most common way of specifying filtering criteria is by using JEXL queries. See the article on JEXL expressions in the documentation Guide for detailed information and examples.
A variant set to filter.
A filtered VCF.
java -jar GenomeAnalysisTK.jar \ -T VariantFiltration \ -R reference.fasta \ -o output.vcf \ --variant input.vcf \ --filterExpression "AB < 0.2 || MQ0 > 50" \ --filterName "SomeFilterName"
when you run {@link VariantFiltration} with a command that includes multiple logical parts, each part of the command is applied individually to the original form of the VCF record. Say you ran a VF command that includes three parts: one applies some genotype filters, another applies setFilterGtToNoCall (which changes sample genotypes to ./. whenever a sample has a genotype-level FT annotation), and yet another one filters sites based on whether any samples have a no-call there. You might think that such a command would allow you to filter sites based on sample-level annotations in one go. However, that would only work if the parts of the command were applied internally in series (like a pipeline) but that's not the case; they are applied in parallel to the same original record. So unfortunately, to achieve the desired result, these filters should be applied as separate commands.
These Read Filters are automatically applied to the data by the Engine before processing by VariantFiltration.
This tool can be run in multi-threaded mode using this option.
This tool uses a sliding window on the reference.
All tools inherit arguments from the GATK Engine' "CommandLineGATK" argument collection, which can be used to modify various aspects of the tool's function. For example, the -L argument directs the GATK engine to restrict processing to specific genomic intervals; or the -rf argument allows you to apply certain read filters to exclude some of the data from the analysis.
This table summarizes the command-line arguments that are specific to this tool. For more details on each argument, see the list further down below the table or click on an argument name to jump directly to that entry in the list.
Argument name(s) | Default value | Summary | |
---|---|---|---|
Required Inputs | |||
--variant -V |
NA | Input VCF file | |
Optional Inputs | |||
--mask |
none | Input ROD mask | |
Optional Outputs | |||
--out -o |
stdout | File to which variants should be written | |
Optional Parameters | |||
--clusterSize -cluster |
3 | The number of SNPs which make up a cluster | |
--clusterWindowSize -window |
0 | The window size (in bases) in which to evaluate clustered SNPs | |
--filterExpression -filter |
[] | One or more expression used with INFO fields to filter | |
--filterName |
[] | Names to use for the list of filters | |
--genotypeFilterExpression -G_filter |
[] | One or more expression used with FORMAT (sample/genotype-level) fields to filter (see documentation guide for more info) | |
--genotypeFilterName -G_filterName |
[] | Names to use for the list of sample/genotype filters (must be a 1-to-1 mapping); this name is put in the FILTER field for variants that get filtered | |
--maskExtension -maskExtend |
0 | How many bases beyond records from a provided 'mask' rod should variants be filtered | |
--maskName |
Mask | The text to put in the FILTER field if a 'mask' rod is provided and overlaps with a variant call | |
Optional Flags | |||
--filterNotInMask |
false | Filter records NOT in given input mask. | |
--invalidatePreviousFilters |
false | Remove previous filters applied to the VCF | |
--invertFilterExpression -invfilter |
false | Invert the selection criteria for --filterExpression | |
--invertGenotypeFilterExpression -invG_filter |
false | Invert the selection criteria for --genotypeFilterExpression | |
--missingValuesInExpressionsShouldEvaluateAsFailing |
false | When evaluating the JEXL expressions, missing values should be considered failing the expression | |
--setFilteredGtToNocall |
false | Set filtered genotypes to no-call |
Arguments in this list are specific to this tool. Keep in mind that other arguments are available that are shared with other tools (e.g. command-line GATK arguments); see Inherited arguments above.
The number of SNPs which make up a cluster
Works together with the {@code --clusterWindowSize} argument.
Integer 3 [ [ -∞ ∞ ] ]
The window size (in bases) in which to evaluate clustered SNPs
Works together with the {@code --clusterWindowSize} argument. To disable the clustered SNP filter, set this value to less than 1.
Integer 0 [ [ -∞ ∞ ] ]
One or more expression used with INFO fields to filter
VariantFiltration accepts any number of JEXL expressions (so you can have two named filters by using
{@code --filterName One --filterExpression "X < 1" --filterName Two --filterExpression "X > 2"}).
ArrayList[String] []
Names to use for the list of filters
This name is put in the
FILTERfield for variants that get filtered. Note that there must be a 1-to-1 mapping between filter expressions and filter names.
ArrayList[String] []
Filter records NOT in given input mask.
By default, if the {@code -mask} argument is used, any variant falling in a mask will be filtered.
If this argument is used, logic is reversed, and variants falling outside a given mask will be filtered.
Use case is, for example, if we have an interval list or BED file with "good" sites.
Note that it is up to the user to adapt the name of the mask to make it clear that the reverse logic was used
(e.g. if masking against Hapmap, use {@code -maskName=hapmap} for the normal masking and {@code -maskName=not_hapmap} for the reverse masking).
boolean false
One or more expression used with FORMAT (sample/genotype-level) fields to filter (see documentation guide for more info)
Similar to the
INFOfield based expressions, but used on the
FORMAT(genotype) fields instead. {@link VariantFiltration} will add the sample-level
FTtag to the
FORMATfield of filtered samples (this does not affect the record's
FILTERtag). One can filter normally based on most fields (e.g. {@code "GQ < 5.0"}), but the
GT(genotype) field is an exception. We have put in convenience methods so that one can now filter out hets ({@code "isHet == 1"}), refs ({@code "isHomRef == 1"}), or homs ({@code "isHomVar == 1"}). Also available are expressions {@code isCalled}, {@code isNoCall}, {@code isMixed}, and {@code isAvailable}, in accordance with the methods of the {@link Genotype} object.
ArrayList[String] []
Names to use for the list of sample/genotype filters (must be a 1-to-1 mapping); this name is put in the FILTER field for variants that get filtered
Similar to the
INFOfield based expressions, but used on the
FORMAT(genotype) fields instead.
ArrayList[String] []
Remove previous filters applied to the VCF
Invalidate previous filters applied to the {@link VariantContext}, applying only the filters here.
boolean false
Invert the selection criteria for --filterExpression
Invert the selection criteria for {@code --filterExpression}.
boolean false
Invert the selection criteria for --genotypeFilterExpression
Invert the selection criteria for {@code --genotypeFilterExpression}.
boolean false
Input ROD mask
Any variant which overlaps entries from the provided mask rod will be filtered. If the user wants logic to be reversed,
i.e. filter variants that do not overlap with provided mask, then argument {@code -filterNotInMask} can be used.
Note that it is up to the user to adapt the name of the mask to make it clear that the reverse logic was used
(e.g. if masking against Hapmap, use {@code -maskName=hapmap} for the normal masking and {@code -maskName=not_hapmap} for the reverse masking).
This argument supports reference-ordered data (ROD) files in the following formats: BCF2, BEAGLE, BED, BEDTABLE, EXAMPLEBINARY, GELITEXT, RAWHAPMAP, REFSEQ, SAMPILEUP, SAMREAD, TABLE, VCF, VCF3
RodBinding[Feature] none
How many bases beyond records from a provided 'mask' rod should variants be filtered
Integer 0 [ [ -∞ ∞ ] ]
The text to put in the FILTER field if a 'mask' rod is provided and overlaps with a variant call
When using the {@code -mask} argument, the {@code maskName} will be annotated in the variant record.
Note that when using the {@code -filterNotInMask} argument to reverse the masking logic,
it is up to the user to adapt the name of the mask to make it clear that the reverse logic was used
(e.g. if masking against Hapmap, use {@code -maskName=hapmap} for the normal masking and {@code -maskName=not_hapmap} for the reverse masking).
String Mask
When evaluating the JEXL expressions, missing values should be considered failing the expression
By default, if JEXL cannot evaluate your expression for a particular record because one of the annotations is not present, the whole expression evaluates as
PASSing. Use this argument to have it evaluate as failing filters instead for these cases.
Boolean false
File to which variants should be written
VariantContextWriter stdout
Set filtered genotypes to no-call
If this argument is provided, set filtered genotypes to no-call (./.).
boolean false
Input VCF file
Variants from this VCF file are used by this tool as input.
The file must at least contain the standard VCF header lines, but
can be empty (i.e., no variants are contained in the file).
This argument supports reference-ordered data (ROD) files in the following formats: BCF2, VCF, VCF3
R RodBinding[VariantContext] NA