Package htsjdk.variant.vcf

# Class VCFUtils

java.lang.Object
htsjdk.variant.vcf.VCFUtils

public class VCFUtils extends Object

## Constructor Summary

Constructors
Constructor
Description
`VCFUtils()`

## Method Summary

Modifier and Type
Method
Description
`static File`
`createTemporaryIndexedVcfFile(String prefix, String suffix)`
This method creates a temporary VCF file and its appropriately named index file, and will delete them on exit.
`static File`
`createTemporaryIndexedVcfFromInput(File vcfFile, String tempFilePrefix)`
This method makes a copy of the input VCF and creates an index file for it in the same location.
`static List<VCFContigHeaderLine>`
`makeContigHeaderLines(SAMSequenceDictionary refDict, File referenceFile)`
Create VCFHeaderLines for each refDict entry, and optionally the assembly if referenceFile != null
`static double`
`parseVcfDouble(String str)`
Parses a String as a Double, being tolerant for case-insensitive NaN and Inf/Infinity.
`static Set<VCFHeaderLine>`
`smartMergeHeaders(Collection<VCFHeader> headers, boolean emitWarnings)`
`static VCFHeader`
`withUpdatedContigs(VCFHeader oldHeader, File referenceFile, SAMSequenceDictionary refDict)`
Add / replace the contig header lines in the VCFHeader with the in the reference file and master reference dictionary
`static Set<VCFHeaderLine>`
`withUpdatedContigsAsLines(Set<VCFHeaderLine> oldLines, File referenceFile, SAMSequenceDictionary refDict)`
`static Set<VCFHeaderLine>`
`withUpdatedContigsAsLines(Set<VCFHeaderLine> oldLines, File referenceFile, SAMSequenceDictionary refDict, boolean referenceNameOnly)`

### Methods inherited from class java.lang.Object

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

## Constructor Details

### VCFUtils

public VCFUtils()

## Method Details

### smartMergeHeaders

public static Set<VCFHeaderLine> smartMergeHeaders(Collection<VCFHeader> headers, boolean emitWarnings) throws IllegalStateException

Throws:
  `IllegalStateException`

### withUpdatedContigs

public static VCFHeader withUpdatedContigs(VCFHeader oldHeader, File referenceFile, SAMSequenceDictionary refDict)
Add / replace the contig header lines in the VCFHeader with the in the reference file and master reference dictionary

Parameters:
  `oldHeader` - the header to update
  `referenceFile` - the file path to the reference sequence used to generate this vcf
  `refDict` - the SAM formatted reference sequence dictionary

### withUpdatedContigsAsLines

public static Set<VCFHeaderLine> withUpdatedContigsAsLines(Set<VCFHeaderLine> oldLines, File referenceFile, SAMSequenceDictionary refDict)

### withUpdatedContigsAsLines

public static Set<VCFHeaderLine> withUpdatedContigsAsLines(Set<VCFHeaderLine> oldLines, File referenceFile, SAMSequenceDictionary refDict, boolean referenceNameOnly)

### makeContigHeaderLines

public static List<VCFContigHeaderLine> makeContigHeaderLines(SAMSequenceDictionary refDict, File referenceFile)
Create VCFHeaderLines for each refDict entry, and optionally the assembly if referenceFile != null

Parameters:
  `refDict` - reference dictionary
  `referenceFile` - for assembly name. May be null
Returns:
  list of vcf contig header lines

### createTemporaryIndexedVcfFile

public static File createTemporaryIndexedVcfFile(String prefix, String suffix) throws IOException
This method creates a temporary VCF file and its appropriately named index file, and will delete them on exit.

Parameters:
  `prefix` - - The prefix string to be used in generating the file's name; must be at least three characters long
  `suffix` - - The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used
Returns:
  A File object referencing the newly created temporary VCF file
Throws:
  `IOException` - - if a file could not be created.

### createTemporaryIndexedVcfFromInput

public static File createTemporaryIndexedVcfFromInput(File vcfFile, String tempFilePrefix) throws IOException
This method makes a copy of the input VCF and creates an index file for it in the same location. This is done so that we don't need to store the index file in the same repo The copy of the input is done so that it and its index are in the same directory which is typically required.

Parameters:
  `vcfFile` - the vcf file to index
Returns:
  File a vcf file (index file is created in same path).
Throws:
  `IOException`

### parseVcfDouble

public static double parseVcfDouble(String str)
Parses a String as a Double, being tolerant for case-insensitive NaN and Inf/Infinity.