Package picard.vcf

Class MergeVcfs


  • @DocumentedFeature
    public class MergeVcfs
    extends CommandLineProgram
    Combines multiple variant files into a single variant file.

    Inputs

    • One or more input file in VCF format (can be gzipped, i.e. ending in ".vcf.gz", or binary compressed, i.e. ending in ".bcf").
    • Optionally a sequence dictionary file (typically name ending in .dict) if the input VCF does not contain a complete contig list and if the output index is to be created (true by default).

    The input variant data must adhere to the following rules:

    • If there are samples, those must be the same across all input files.
    • Input file headers must be contain compatible declarations for common annotations (INFO, FORMAT fields) and filters.
    • Input files variant records must be sorted by their contig and position following the sequence dictionary provided or the header contig list.

    You can either directly specify the list of files by specifying INPUT multiple times, or provide a list in a file with name ending in ".list" to INPUT.

    Outputs

    A VCF sorted (i) according to the dictionary and (ii) by coordiante.

    Usage examples

    Example 1:

    We combine several variant files in different formats, where at least one of them contains the contig list in its header.
         java -jar picard.jar MergeVcfs \
              I=input_variants.01.vcf \
              I=input_variants.02.vcf.gz \
              O=output_variants.vcf.gz
     

    Example 2:

    Similar to example 1 but we use an input list file to specify the input files:
         java -jar picard.jar MergeVcfs \
              I=input_variant_files.list \
              O=output_variants.vcf.gz
     
    Since:
    1.0.1
    • Field Detail

      • INPUT

        @Argument(shortName="I",
                  doc="VCF or BCF input files (File format is determined by file extension), or a file having a \'.list\' suffix containing the path to the files, one per line.",
                  minElements=1)
        public List<PicardHtsPath> INPUT
      • OUTPUT

        @Argument(shortName="O",
                  doc="The merged VCF or BCF file. File format is determined by file extension.")
        public File OUTPUT
      • SEQUENCE_DICTIONARY

        @Argument(shortName="D",
                  doc="The index sequence dictionary to use instead of the sequence dictionary in the input files",
                  optional=true)
        public PicardHtsPath SEQUENCE_DICTIONARY
      • COMMENT

        @Argument(doc="Comment(s) to include in the merged output file\'s header.",
                  optional=true,
                  shortName="CO")
        public List<String> COMMENT
    • Constructor Detail

      • MergeVcfs

        public MergeVcfs()
    • Method Detail

      • doWork

        protected int doWork()
        Description copied from class: CommandLineProgram
        Do the work after command line has been parsed. RuntimeException may be thrown by this method, and are reported appropriately.
        Specified by:
        doWork in class CommandLineProgram
        Returns:
        program exit status.