Closeable
, AutoCloseable
, Iterable<VariantContext>
public class VCFFileReader extends Object implements Closeable, Iterable<VariantContext>
Constructor | Description |
---|---|
VCFFileReader(File file) |
Constructs a VCFFileReader that requires the index to be present.
|
VCFFileReader(File file,
boolean requireIndex) |
Allows construction of a VCFFileReader that will or will not assert the presence of an index as desired.
|
VCFFileReader(File file,
File indexFile) |
Constructs a VCFFileReader with a specified index.
|
VCFFileReader(File file,
File indexFile,
boolean requireIndex) |
Allows construction of a VCFFileReader with a specified index file.
|
VCFFileReader(Path path) |
Constructs a VCFFileReader that requires the index to be present.
|
VCFFileReader(Path path,
boolean requireIndex) |
Allows construction of a VCFFileReader that will or will not assert the presence of an index as desired.
|
VCFFileReader(Path path,
Path indexPath) |
Constructs a VCFFileReader with a specified index.
|
VCFFileReader(Path path,
Path indexPath,
boolean requireIndex) |
Allows construction of a VCFFileReader with a specified index path.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
static IntervalList |
fromVcf(VCFFileReader vcf) |
Converts a vcf to an IntervalList.
|
static IntervalList |
fromVcf(VCFFileReader vcf,
boolean includeFiltered) |
Converts a vcf to an IntervalList.
|
static IntervalList |
fromVcf(File file) |
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 |
fromVcf(File file,
boolean includeFiltered) |
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.
|
VCFHeader |
getFileHeader() |
Returns the VCFHeader associated with this VCF/BCF file.
|
static SAMSequenceDictionary |
getSequenceDictionary(File file) |
Returns the SAMSequenceDictionary from the provided VCF file.
|
static SAMSequenceDictionary |
getSequenceDictionary(Path path) |
Returns the SAMSequenceDictionary from the provided VCF file.
|
static boolean |
isBCF(File file) |
Returns true if the given file appears to be a BCF file.
|
static boolean |
isBCF(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(String chrom,
int start,
int end) |
Queries for records overlapping the region specified.
|
IntervalList |
toIntervalList() |
Converts a vcf to an IntervalList.
|
IntervalList |
toIntervalList(boolean includeFiltered) |
|
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.
|
static IntervalList |
toIntervalList(Path path,
boolean includeFiltered) |
forEach, spliterator
public VCFFileReader(File file)
public VCFFileReader(File file, File indexFile)
public VCFFileReader(File file, boolean requireIndex)
public VCFFileReader(File file, File indexFile, boolean requireIndex)
public VCFFileReader(Path path)
public VCFFileReader(Path path, Path indexPath)
public VCFFileReader(Path path, boolean requireIndex)
public static boolean isBCF(File file)
public static boolean isBCF(Path path)
public static SAMSequenceDictionary getSequenceDictionary(File file)
public static SAMSequenceDictionary getSequenceDictionary(Path path)
public static IntervalList toIntervalList(Path path)
path
- public static IntervalList toIntervalList(Path path, boolean includeFiltered)
public static IntervalList fromVcf(File file)
file
- public static IntervalList fromVcf(File file, boolean includeFiltered)
file
- public IntervalList toIntervalList()
public IntervalList toIntervalList(boolean includeFiltered)
public static IntervalList fromVcf(VCFFileReader vcf)
vcf
- the vcfReader to be used for the conversionpublic static IntervalList fromVcf(VCFFileReader vcf, boolean includeFiltered)
vcf
- the vcfReader to be used for the conversionpublic VCFHeader getFileHeader()
public CloseableIterator<VariantContext> iterator()
iterator
in interface Iterable<VariantContext>
public CloseableIterator<VariantContext> query(String chrom, int start, int end)
chrom
- the chomosome to querystart
- query interval startend
- query interval endpublic void close()
close
in interface AutoCloseable
close
in interface Closeable
public boolean isQueryable()
query(String, int, int)
can be successful