Class VCFFileReader

    • Constructor Detail

      • VCFFileReader

        public VCFFileReader​(File file)
        Constructs a VCFFileReader that requires the index to be present.
      • VCFFileReader

        public VCFFileReader​(File file,
                             File indexFile)
        Constructs a VCFFileReader with a specified index.
      • VCFFileReader

        public VCFFileReader​(File file,
                             boolean requireIndex)
        Allows construction of a VCFFileReader that will or will not assert the presence of an index as desired.
      • VCFFileReader

        public VCFFileReader​(File file,
                             File indexFile,
                             boolean requireIndex)
        Allows construction of a VCFFileReader with a specified index file.
      • VCFFileReader

        public VCFFileReader​(Path path)
        Constructs a VCFFileReader that requires the index to be present.
      • VCFFileReader

        public VCFFileReader​(Path path,
                             Path indexPath)
        Constructs a VCFFileReader with a specified index.
      • VCFFileReader

        public VCFFileReader​(Path path,
                             boolean requireIndex)
        Allows construction of a VCFFileReader that will or will not assert the presence of an index as desired.
      • VCFFileReader

        public VCFFileReader​(Path path,
                             Path indexPath,
                             boolean requireIndex)
        Allows construction of a VCFFileReader with a specified index path.
    • Method Detail

      • isBCF

        public static boolean isBCF​(File file)
        Returns true if the given file appears to be a BCF file.
      • isBCF

        public static boolean isBCF​(Path path)
        Returns true if the given path appears to be a BCF file.
      • getSequenceDictionary

        public static SAMSequenceDictionary getSequenceDictionary​(File file)
        Returns the SAMSequenceDictionary from the provided VCF file.
      • getSequenceDictionary

        public static SAMSequenceDictionary getSequenceDictionary​(Path path)
        Returns the SAMSequenceDictionary from the provided VCF file.
      • toIntervalList

        public static IntervalList toIntervalList​(Path path)
        Parse a VCF file and convert to an IntervalList The name field of the IntervalList is taken from the ID field of the variant, if it exists. if not, creates a name of the format interval-n where n is a running number that increments only on un-named intervals
        Parameters:
        path - a VCF
        Returns:
      • toIntervalList

        public static IntervalList toIntervalList​(Path path,
                                                  boolean includeFiltered)
      • fromVcf

        @Deprecated
        public static IntervalList fromVcf​(File file)
        Deprecated.
        since July 2018 use toIntervalList(Path) instead
        Parse a VCF file and convert to an IntervalList The name field of the IntervalList is taken from the ID field of the variant, if it exists. if not, creates a name of the format interval-n where n is a running number that increments only on un-named intervals
        Parameters:
        file - a VCF
        Returns:
        an IntervalList
      • fromVcf

        @Deprecated
        public static IntervalList fromVcf​(File file,
                                           boolean includeFiltered)
        Deprecated.
        since July 2018 use toIntervalList(Path, boolean) instead
        Parse a VCF file and convert to an IntervalList The name field of the IntervalList is taken from the ID field of the variant, if it exists. if not, creates a name of the format interval-n where n is a running number that increments only on un-named intervals
        Parameters:
        file -
        Returns:
      • toIntervalList

        public IntervalList toIntervalList()
        Converts the underlying VCFFileReader to an IntervalList. The name field of the IntervalList is taken from the ID field of the variant, if it exists. If not, creates a name of the format 'interval-n' where n is a running number that increments on un-named intervals. Will use the "END" tag in the INFO field as the end of the interval (if exists).
        Returns:
        an IntervalList constructed from input vcf
      • toIntervalList

        public IntervalList toIntervalList​(boolean includeFiltered)
      • fromVcf

        @Deprecated
        public static IntervalList fromVcf​(VCFFileReader vcf)
        Deprecated.
        since July 2018 since use toIntervalList(VCFFileReader) instead
        Converts a vcf to an IntervalList. The name field of the IntervalList is taken from the ID field of the variant, if it exists. If not, creates a name of the format interval-n where n is a running number that increments only on un-named intervals. Will use a "END" tag in the INFO field as the end of the interval (if exists).
        Parameters:
        vcf - the vcfReader to be used for the conversion
        Returns:
        an IntervalList constructed from input vcf
      • toIntervalList

        public static IntervalList toIntervalList​(VCFFileReader vcf)
        Converts a vcf to an IntervalList. The name field of the IntervalList is taken from the ID field of the variant, if it exists. If not, creates a name of the format interval-n where n is a running number that increments only on un-named intervals. Will use a "END" tag in the INFO field as the end of the interval (if exists).
        Parameters:
        vcf - the vcfReader to be used for the conversion
        Returns:
        an IntervalList constructed from input vcf
      • fromVcf

        @Deprecated
        public static IntervalList fromVcf​(VCFFileReader vcf,
                                           boolean includeFiltered)
        Deprecated.
        since July 2018 since use toIntervalList(VCFFileReader, boolean) instead
        Converts a vcf to an IntervalList. The name field of the IntervalList is taken from the ID field of the variant, if it exists. If not, creates a name of the format interval-n where n is a running number that increments only on un-named intervals. Will use a "END" tag in the INFO field as the end of the interval (if exists).
        Parameters:
        vcf - the vcfReader to be used for the conversion
        Returns:
        an IntervalList constructed from input vcf
      • toIntervalList

        public static IntervalList toIntervalList​(VCFFileReader vcf,
                                                  boolean includeFiltered)
        Converts a VCFFileReader to an IntervalList. The name field of the IntervalList is taken from the ID field of the variant, if it exists. If not, creates a name of the format interval-n where n is a running number that increments only on un-named intervals. Will use a "END" tag in the INFO field as the end of the interval (if exists).
        Parameters:
        vcf - the vcfReader to be used for the conversion
        Returns:
        an IntervalList constructed from input vcf
      • getFileHeader

        public VCFHeader getFileHeader()
        Returns the VCFHeader associated with this VCF/BCF file.
      • query

        public CloseableIterator<VariantContext> query​(String chrom,
                                                       int start,
                                                       int end)
        Queries for records overlapping the region specified. Note that this method requires VCF files with an associated index. If no index exists a TribbleException will be thrown.
        Parameters:
        chrom - the chomosome to query
        start - query interval start
        end - query interval end
        Returns:
        non-null iterator over VariantContexts
      • query

        public CloseableIterator<VariantContext> query​(Locatable locatable)
        Queries for records overlapping the Locatable specified. Note that this method requires VCF files with an associated index. If no index exists a TribbleException will be thrown.
        Returns:
        non-null iterator over VariantContexts
      • isQueryable

        public boolean isQueryable()
        A method to check if the reader is query-able, i.e. if a call to query(String, int, int) can be successful
        Returns:
        true if the reader can be queried, i.e. if the underlying Tribble reader is queryable.