Package htsjdk.variant.vcf
Class VCFUtils
java.lang.Object
htsjdk.variant.vcf.VCFUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 != nullstatic 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 dictionarystatic Set<VCFHeaderLine>
withUpdatedContigsAsLines
(Set<VCFHeaderLine> oldLines, File referenceFile, SAMSequenceDictionary refDict) static Set<VCFHeaderLine>
withUpdatedContigsAsLines
(Set<VCFHeaderLine> oldLines, File referenceFile, SAMSequenceDictionary refDict, boolean referenceNameOnly)
-
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 updatereferenceFile
- the file path to the reference sequence used to generate this vcfrefDict
- 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 dictionaryreferenceFile
- for assembly name. May be null- Returns:
- list of vcf contig header lines
-
createTemporaryIndexedVcfFile
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 longsuffix
- - 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
Parses a String as a Double, being tolerant for case-insensitive NaN and Inf/Infinity.
-