Combine variant records from different sources
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).
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.
Two or more variant sets to combine.
A combined VCF.
java -jar GenomeAnalysisTK.jar \ -T CombineVariants \ -R reference.fasta \ --variant input1.vcf \ --variant input2.vcf \ -o output.vcf \ -genotypeMergeOptions UNIQUIFY
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
These Read Filters are automatically applied to the data by the Engine before processing by CombineVariants.
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 | 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 |
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.
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
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
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
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:
FilteredRecordMergeType KEEP_IF_ANY_UNFILTERED
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:
GenotypeMergeType NA
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
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
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 [ [ -∞ ∞ ] ]
File to which variants should be written
VariantContextWriter stdout
Emit interesting sites requiring complex compatibility merging to file
boolean false
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
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
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
VCF files to merge together
R List[RodBindingCollection[VariantContext]] NA