# Class RenameSampleInVcf

java.lang.Object
picard.cmdline.CommandLineProgram
picard.vcf.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 Summary

Fields
Modifier and Type
Field
Description
`File`
`INPUT`
`String`
`NEW_SAMPLE_NAME`
`String`
`OLD_SAMPLE_NAME`
`File`
`OUTPUT`

### Fields inherited from class CommandLineProgram

`COMPRESSION_LEVEL, CREATE_INDEX, CREATE_MD5_FILE, MAX_ALLOWABLE_ONE_LINE_SUMMARY_LENGTH, MAX_RECORDS_IN_RAM, QUIET, REFERENCE_SEQUENCE, referenceSequence, specialArgumentsCollection, SYNTAX_TRANSITION_URL, TMP_DIR, USE_JDK_DEFLATER, USE_JDK_INFLATER, VALIDATION_STRINGENCY, VERBOSITY`

## Constructor Summary

Constructors
Constructor
Description
`RenameSampleInVcf()`

## Method Summary

Modifier and Type
Method
Description
`protected int`
`doWork()`
Do the work after command line has been parsed.

### Methods inherited from class CommandLineProgram

`checkRInstallation, customCommandLineValidation, getCommandLine, getCommandLineParser, getCommandLineParserForArgs, getDefaultHeaders, getFaqLink, getMetricsFile, getPGRecord, getStandardUsagePreamble, getStandardUsagePreamble, getVersion, hasWebDocumentation, instanceMain, instanceMainWithExit, makeReferenceArgumentCollection, parseArgs, requiresReference, setDefaultHeaders, useLegacyParser`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### 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 Details

### RenameSampleInVcf

public RenameSampleInVcf()

## Method Details

### 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.