public class VCFFileReader extends java.lang.Object implements java.io.Closeable, java.lang.Iterable<VariantContext>
Constructor and Description |
---|
VCFFileReader(java.io.File file)
Constructs a VCFFileReader that requires the index to be present.
|
VCFFileReader(java.io.File file,
boolean requireIndex)
Allows construction of a VCFFileReader that will or will not assert the presence of an index as desired.
|
VCFFileReader(java.io.File file,
java.io.File indexFile)
Constructs a VCFFileReader with a specified index.
|
VCFFileReader(java.io.File file,
java.io.File indexFile,
boolean requireIndex)
Allows construction of a VCFFileReader with a specified index file.
|
VCFFileReader(java.nio.file.Path path)
Constructs a VCFFileReader that requires the index to be present.
|
VCFFileReader(java.nio.file.Path path,
boolean requireIndex)
Allows construction of a VCFFileReader that will or will not assert the presence of an index as desired.
|
VCFFileReader(java.nio.file.Path path,
java.nio.file.Path indexPath)
Constructs a VCFFileReader with a specified index.
|
VCFFileReader(java.nio.file.Path path,
java.nio.file.Path indexPath,
boolean requireIndex)
Allows construction of a VCFFileReader with a specified index path.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
static IntervalList |
fromVcf(java.io.File file)
Deprecated.
since July 2018 use
toIntervalList(Path) instead |
static IntervalList |
fromVcf(java.io.File file,
boolean includeFiltered)
Deprecated.
since July 2018 use
toIntervalList(Path, boolean) instead |
static IntervalList |
fromVcf(VCFFileReader vcf)
Deprecated.
since July 2018 since use
toIntervalList(VCFFileReader) instead |
static IntervalList |
fromVcf(VCFFileReader vcf,
boolean includeFiltered)
Deprecated.
since July 2018 since use
toIntervalList(VCFFileReader, boolean) instead |
VCFHeader |
getFileHeader()
Returns the VCFHeader associated with this VCF/BCF file.
|
static SAMSequenceDictionary |
getSequenceDictionary(java.io.File file)
Returns the SAMSequenceDictionary from the provided VCF file.
|
static SAMSequenceDictionary |
getSequenceDictionary(java.nio.file.Path path)
Returns the SAMSequenceDictionary from the provided VCF file.
|
static boolean |
isBCF(java.io.File file)
Returns true if the given file appears to be a BCF file.
|
static boolean |
isBCF(java.nio.file.Path path)
Returns true if the given path appears to be a BCF file.
|
boolean |
isQueryable()
A method to check if the reader is query-able, i.e.
|
CloseableIterator<VariantContext> |
iterator()
Returns an iterator over all records in this VCF/BCF file.
|
CloseableIterator<VariantContext> |
query(Locatable locatable)
Queries for records overlapping the
Locatable specified. |
CloseableIterator<VariantContext> |
query(java.lang.String chrom,
int start,
int end)
Queries for records overlapping the region specified.
|
IntervalList |
toIntervalList()
Converts the underlying VCFFileReader to an IntervalList.
|
IntervalList |
toIntervalList(boolean includeFiltered) |
static IntervalList |
toIntervalList(java.nio.file.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.
|
static IntervalList |
toIntervalList(java.nio.file.Path path,
boolean includeFiltered) |
static IntervalList |
toIntervalList(VCFFileReader vcf)
Converts a vcf to an IntervalList.
|
static IntervalList |
toIntervalList(VCFFileReader vcf,
boolean includeFiltered)
Converts a
VCFFileReader to an IntervalList. |
static java.util.Iterator<Interval> |
toIntervals(VCFFileReader vcf,
boolean includeFiltered)
Converts a
VCFFileReader to an Iterator
The name field of the Interval is taken from the ID field
of the variant, if it exists. |
public VCFFileReader(java.io.File file)
public VCFFileReader(java.io.File file, java.io.File indexFile)
public VCFFileReader(java.io.File file, boolean requireIndex)
public VCFFileReader(java.io.File file, java.io.File indexFile, boolean requireIndex)
public VCFFileReader(java.nio.file.Path path)
public VCFFileReader(java.nio.file.Path path, java.nio.file.Path indexPath)
public VCFFileReader(java.nio.file.Path path, boolean requireIndex)
public VCFFileReader(java.nio.file.Path path, java.nio.file.Path indexPath, boolean requireIndex)
public static boolean isBCF(java.io.File file)
public static boolean isBCF(java.nio.file.Path path)
public static SAMSequenceDictionary getSequenceDictionary(java.io.File file)
public static SAMSequenceDictionary getSequenceDictionary(java.nio.file.Path path)
public static IntervalList toIntervalList(java.nio.file.Path path)
path
- a VCFpublic static IntervalList toIntervalList(java.nio.file.Path path, boolean includeFiltered)
@Deprecated public static IntervalList fromVcf(java.io.File file)
toIntervalList(Path)
insteadfile
- a VCFIntervalList
@Deprecated public static IntervalList fromVcf(java.io.File file, boolean includeFiltered)
toIntervalList(Path, boolean)
insteadfile
- public IntervalList toIntervalList()
public IntervalList toIntervalList(boolean includeFiltered)
@Deprecated public static IntervalList fromVcf(VCFFileReader vcf)
toIntervalList(VCFFileReader)
insteadvcf
- the vcfReader to be used for the conversionpublic static IntervalList toIntervalList(VCFFileReader vcf)
vcf
- the vcfReader to be used for the conversion@Deprecated public static IntervalList fromVcf(VCFFileReader vcf, boolean includeFiltered)
toIntervalList(VCFFileReader, boolean)
insteadvcf
- the vcfReader to be used for the conversionpublic static IntervalList toIntervalList(VCFFileReader vcf, boolean includeFiltered)
VCFFileReader
to an IntervalList. The name field of the Interval 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).vcf
- the vcfReader to be used for the conversionpublic static java.util.Iterator<Interval> toIntervals(VCFFileReader vcf, boolean includeFiltered)
VCFFileReader
to an Iterator
The name field of the Interval 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).vcf
- the vcfReader to be used for the conversionpublic VCFHeader getFileHeader()
public CloseableIterator<VariantContext> iterator()
iterator
in interface java.lang.Iterable<VariantContext>
public CloseableIterator<VariantContext> query(java.lang.String chrom, int start, int end)
chrom
- the chomosome to querystart
- query interval startend
- query interval endpublic CloseableIterator<VariantContext> query(Locatable locatable)
Locatable
specified.
Note that this method requires VCF files with an associated index. If no index exists a TribbleException will be thrown.public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public boolean isQueryable()
query(String, int, int)
can be successful