CombineVariants

Combine variant records from different sources

Category Variant Manipulation Tools

Traversal LocusWalker

PartitionBy LOCUS


Overview

CombineVariants reads in variants records from separate ROD (Reference-Ordered Data) sources and combines them into a single VCF. Any number of sources can be input. This tool aims to fulfill two main possible use cases, reflected by the two combination options (MERGE and UNION), for merging records at the variant level (the first 8 fields of the VCF) or at the genotype level (the rest).

  • MERGE: combines multiple variant records present at the same site in the different input sources into a single variant record in the output. If sample names overlap, then they are "uniquified" by default, which means a suffix is appended to make them unique. Note that in version 3.3, the automatic uniquifying was disabled (unintentionally), and required setting `-genotypeMergeOptions UNIQUIFY` manually.
  • UNION: assumes that each ROD source represents the same set of samples (although this is not enforced). It uses the priority list (if provided) to emit a single record instance at every position represented in the input RODs.

By default, the input sets will be named variants, variants2, variants3, and so on. You can override this by providing an explicit name tag for each input, using the syntax " -V:name,format". Each input tagged in this way will be labeled as such in the output (i.e., set=name rather than set=variants2). For example, you could specify a set of control samples as " -V:control,vcf my_control_samples.vcf", and the resulting VCF records would contain the annotation "set=control" in the INFO field. It is strongly recommended to provide explicit names in this way when a rod priority list is provided.

CombineVariants will emit a record for every site that was present in any of your input VCF files, and will annotate (in the set attribute in the INFO field) whether the record had a PASS or FILTER status in each input ROD . In effect, CombineVariants always produces a union of the input VCFs. However, any part of the Venn of the merged VCFs can be extracted using JEXL expressions on the set attribute using SelectVariants. If you want to extract just the records in common between two VCFs, you would first run CombineVariants on the two files to generate a single VCF and then run SelectVariants to extract the common records with `-select 'set == "Intersection"'`, as worked out in the detailed example in the documentation guide.

Input

Two or more variant sets to combine.

Output

A combined VCF.

Usage examples

 

Merge two separate callsets

 java -jar GenomeAnalysisTK.jar \
   -T CombineVariants \
   -R reference.fasta \
   --variant input1.vcf \
   --variant input2.vcf \
   -o output.vcf \
   -genotypeMergeOptions UNIQUIFY
 

Get the union of calls made on the same samples

 java -jar GenomeAnalysisTK.jar \
   -T CombineVariants \
   -R reference.fasta \
   --variant:foo input1.vcf \
   --variant:bar input2.vcf \
   -o output.vcf \
   -genotypeMergeOptions PRIORITIZE \
   -priority foo,bar
 

Caveats

  • This tool is not intended to manipulate GVCFS! To combine GVCF files output for different samples by HaplotypeCaller, use CombineGVCFs.
  • To join intermediate VCFs produced by running jobs in parallel by interval (e.g. by chromosome) from the same sample, use CatVariants.

Additional notes

  • Using this tool's multi-threaded parallelism capability is particularly useful when converting from VCF to BCF2, which can be time-consuming. In this case each thread spends CPU time doing the conversion, and the GATK engine is smart enough to merge the partial BCF2 blocks together efficiently. However, since this merge runs in only one thread, you can quickly reach diminishing returns with the number of parallel threads. In our hands, `-nt 4` works well but `-nt 8` tends to be be too much.
  • Since GATK 2.1, when merging multiple VCF records at a site, the combined VCF record has the QUAL of the first VCF record with a non-MISSING QUAL value. The previous behavior was to take the max QUAL, which could result in strange downstream confusion

Additional Information

Read filters

These Read Filters are automatically applied to the data by the Engine before processing by CombineVariants.

Parallelism options

This tool can be run in multi-threaded mode using this option.

Window size

This tool uses a sliding window on the reference.

  • Window start: -50 bp before the locus
  • Window stop: 50 bp after the locus

Command-line Arguments

Engine arguments

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.

CombineVariants specific arguments

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 VCF files to merge together
Optional Outputs
--out
 -o
stdout File to which variants should be written
Optional Parameters
--filteredrecordsmergetype
 -filteredRecordsMergeType
KEEP_IF_ANY_UNFILTERED Determines how we should handle records seen at the same site in the VCF, but with different FILTER fields
--genotypemergeoption
 -genotypeMergeOptions
NA Determines how we should merge genotype records for samples shared across the ROD files
--minimumN
 -minN
1 Minimum number of input files the site must be observed in to be included
--rod_priority_list
 -priority
NA Ordered list specifying priority for merging
--setKey
set Key name for the set attribute
Optional Flags
--assumeIdenticalSamples
false Assume input VCFs have identical sample sets and disjoint calls
--excludeNonVariants
 -env
false Exclude sites where no variation is present after merging
--filteredAreUncalled
false Treat filtered variants as uncalled
--mergeInfoWithMaxAC
false Use the INFO content of the record with the highest AC
--minimalVCF
false Emit a sites-only file
--printComplexMerges
false Emit interesting sites requiring complex compatibility merging to file
--suppressCommandLineHeader
false Do not output the command line to the header

Argument details

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.


--assumeIdenticalSamples / -assumeIdenticalSamples

Assume input VCFs have identical sample sets and disjoint calls
This option allows you to perform a simple merge (concatenation) to combine the VCFs, drastically reducing runtime. Note that in many cases where you think you want to use this option, you may want to check out the CatVariants tool instead, because CatVariants provides the same functionality, but does so even more efficiently.

boolean  false


--excludeNonVariants / -env

Exclude sites where no variation is present after merging
Exclude sites that do not contain any called ALT alleles in the merged callset. The evaluation is made after the merging procedure is complete.

boolean  false


--filteredAreUncalled / -filteredAreUncalled

Treat filtered variants as uncalled
If enabled, this flag causes filtered variants (i.e. variant records where the FILTER field is populated by something other than PASS or a dot) to be omitted from the output.

boolean  false


--filteredrecordsmergetype / -filteredRecordsMergeType

Determines how we should handle records seen at the same site in the VCF, but with different FILTER fields

The --filteredrecordsmergetype argument is an enumerated type (FilteredRecordMergeType), which can have one of the following values:

KEEP_IF_ANY_UNFILTERED
Union - leaves the record if any record is unfiltered.
KEEP_IF_ALL_UNFILTERED
Requires all records present at site to be unfiltered. VCF files that don't contain the record don't influence this.
KEEP_UNCONDITIONAL
If any record is present at this site (regardless of possibly being filtered), then all such records are kept and the filters are reset.

FilteredRecordMergeType  KEEP_IF_ANY_UNFILTERED


--genotypemergeoption / -genotypeMergeOptions

Determines how we should merge genotype records for samples shared across the ROD files

The --genotypemergeoption argument is an enumerated type (GenotypeMergeType), which can have one of the following values:

UNIQUIFY
Make all sample genotypes unique by file. Each sample shared across RODs gets named sample.ROD.
PRIORITIZE
Take genotypes in priority order (see the priority argument).
UNSORTED
Take the genotypes in any order.
REQUIRE_UNIQUE
Require that all samples/genotypes be unique between all inputs.

GenotypeMergeType  NA


--mergeInfoWithMaxAC / -mergeInfoWithMaxAC

Use the INFO content of the record with the highest AC
By default, the INFO field of the merged variant record only contains the INFO field attributes for which all original overlapping records had the same values. Discordant attributes are therefore discarded. This flag allows you to override that behavior and simply copy over the INFO field contents of whichever record had the highest AC value.

boolean  false


--minimalVCF / -minimalVCF

Emit a sites-only file
If this flag is enabled, the INFO, FORMAT and sample-level (genotype) fields will not be emitted to the output file.

boolean  false


--minimumN / -minN

Minimum number of input files the site must be observed in to be included
Sites that are present in fewer than this number of inputs will be ignored. This is a convenient way to build a collection of common variants and exclude rare variants.

int  1  [ [ -∞  ∞ ] ]


--out / -o

File to which variants should be written

VariantContextWriter  stdout


--printComplexMerges / -printComplexMerges

Emit interesting sites requiring complex compatibility merging to file

boolean  false


--rod_priority_list / -priority

Ordered list specifying priority for merging
Refers to the merging priority behavior described in the tool documentation regarding the choice of which record gets emitted when taking the union of variants that contain genotypes. The list must be passed as a comma-separated string listing the names of the variant input files. The list must be complete and include all variant inputs that are being provided to the tool. Use name tags for best results.

String  NA


--setKey / -setKey

Key name for the set attribute
Key used in the INFO key=value tag emitted describing which set(s) the combined record came from (e.g. set=control). This provides the option to override the default naming, so instead of set=control you could have it be origin=control, or any other word you want that is not already an INFO field attribute. Set this to 'null' if you don't want the set attribute emitted at all.

String  set


--suppressCommandLineHeader / -suppressCommandLineHeader

Do not output the command line to the header
By default, this tool writes the command line that was used in the header of the output VCF file. This flag enables you to override that behavior . This is most often useful when combining variants for dozens or hundreds of smaller VCFs iteratively, to avoid cluttering the header with a lot of command lines.

boolean  false


--variant / -V

VCF files to merge together

R List[RodBindingCollection[VariantContext]]  NA


Return to top


See also GATK Documentation Index | Tool Docs Index | Support Forum

GATK version 3.8-0-ge9d806836 built at 2017/07/29 01:40:22.