Class VCFUtils


  • public class VCFUtils
    extends Object
    • Constructor Detail

      • VCFUtils

        public VCFUtils()
    • Method Detail

      • 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
      • 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