Package picard.vcf

Class RenameSampleInVcf


  • @DocumentedFeature
    public class RenameSampleInVcf
    extends CommandLineProgram
    Renames a sample within a VCF or BCF.

    Summary

    This tool enables the user to rename a sample in either a VCF or BCF file. It is intended to change the name of a sample in a VCF prior to merging with VCF files in which one or more samples have similar names. Note that the input VCF file must be single-sample VCF and that the NEW_SAMPLE_NAME argument is required.

    Inputs

    • Input single-sample VCF or BCF file.
    • Output single-sample VCF or BCF file.
    • New name to give sample in output VCF.
    • [Optional] Existing name of sample in VCF; if provided, asserts that that is the name of the extant sample name.

    Usage example:

         java -jar picard.jar RenameSampleInVcf \
         INPUT=input_variants.vcf \
         OUTPUT=output_variants.vcf \
         NEW_SAMPLE_NAME=sample
     

    Notes

    The input VCF (or BCF) must be single-sample.
    • Field Detail

      • INPUT

        @Argument(shortName="I",
                  doc="Input single sample VCF or BCF file.")
        public File INPUT
      • OUTPUT

        @Argument(shortName="O",
                  doc="Output single sample VCF.")
        public File OUTPUT
      • OLD_SAMPLE_NAME

        @Argument(doc="Existing name of sample in VCF; if provided, asserts that that is the name of the extant sample name",
                  optional=true)
        public String OLD_SAMPLE_NAME
      • NEW_SAMPLE_NAME

        @Argument(doc="New name to give sample in output VCF.")
        public String NEW_SAMPLE_NAME
    • Constructor Detail

      • RenameSampleInVcf

        public RenameSampleInVcf()
    • Method Detail

      • main

        public static void main​(String[] args)
      • 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.