public final class MultiVariantDataSource extends java.lang.Object implements GATKDataSource<htsjdk.variant.variantcontext.VariantContext>, java.lang.AutoCloseable
setIntervalsForTraversal(List)
. Traversal
by a set of intervals requires the files to have been indexed using the bundled tool IndexFeatureFile.
The set of intervals provided MUST be non-overlapping and sorted in increasing order of start position.
-Targeted queries by one interval at a time. This also requires the files to have been indexed using
the bundled tool IndexFeatureFile. Targeted queries by one interval at a time are unaffected by
any intervals for full traversal set via setIntervalsForTraversal(List)
.Constructor and Description |
---|
MultiVariantDataSource(java.util.List<FeatureInput<htsjdk.variant.variantcontext.VariantContext>> featureInputs,
int queryLookaheadBases)
Creates a MultiVariantDataSource backed by the provided FeatureInputs.
|
MultiVariantDataSource(java.util.List<FeatureInput<htsjdk.variant.variantcontext.VariantContext>> featureInputs,
int queryLookaheadBases,
int cloudPrefetchBuffer,
int cloudIndexPrefetchBuffer,
java.nio.file.Path reference,
boolean skipDictionaryValidation)
Creates a MultiVariantDataSource backed by the provided FeatureInputs.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Permanently close this data source, invalidating any open iteration over it, and making it invalid for future
iterations and queries.
|
htsjdk.variant.vcf.VCFHeader |
getHeader()
Gets the merged header associated with this data source
|
java.lang.String |
getName()
Get the logical name of this data source.
|
java.util.SortedSet<java.lang.String> |
getSamples()
Return lexicographically sorted set of uniquified sample names merged from across input data sources
|
htsjdk.samtools.SAMSequenceDictionary |
getSequenceDictionary()
Returns the aggregate sequence dictionary for this source of Variants.
|
java.util.Iterator<htsjdk.variant.variantcontext.VariantContext> |
iterator()
Gets an iterator over all variants in this data source, restricting traversal to variants
overlapping our intervals if intervals were provided via
setIntervalsForTraversal(List)
Calling this method invalidates (closes) any previous iterator obtained from this method. |
java.util.Iterator<htsjdk.variant.variantcontext.VariantContext> |
query(SimpleInterval interval)
Gets an iterator over all Variants in this data source that overlap the provided interval.
|
void |
setIntervalsForTraversal(java.util.List<SimpleInterval> intervals)
Restricts traversals of this data source via
iterator() to only return variants that overlap the provided
intervals. |
public MultiVariantDataSource(java.util.List<FeatureInput<htsjdk.variant.variantcontext.VariantContext>> featureInputs, int queryLookaheadBases)
featureInputs
- List of FeatureInputqueryLookaheadBases
- look ahead this many bases during queries that produce cache missespublic MultiVariantDataSource(java.util.List<FeatureInput<htsjdk.variant.variantcontext.VariantContext>> featureInputs, int queryLookaheadBases, int cloudPrefetchBuffer, int cloudIndexPrefetchBuffer, java.nio.file.Path reference, boolean skipDictionaryValidation)
featureInputs
- List of FeatureInputqueryLookaheadBases
- look ahead this many bases during queries that produce cache missescloudPrefetchBuffer
- MB size of caching/prefetching wrapper for the data, if on Google Cloud (0 to disable).cloudIndexPrefetchBuffer
- MB size of caching/prefetching wrapper for the index, if on Google Cloud (0 to disable).reference
- reference to use when creating FeatureDataSources, may be null, only needed by GenomicsDBpublic htsjdk.samtools.SAMSequenceDictionary getSequenceDictionary()
public htsjdk.variant.vcf.VCFHeader getHeader()
public void setIntervalsForTraversal(java.util.List<SimpleInterval> intervals)
iterator()
to only return variants that overlap the provided
intervals. Calls to query(SimpleInterval)
are not affected by these intervals.
Intervals MUST be non-overlapping and sorted in order of increasing start position, otherwise traversal
results will be incorrect.
Passing in a null or empty interval List clears the intervals for traversal, making future iterations
over this data source unrestricted by intervals.intervals
- Our next full traversal will return only variants overlapping these intervalspublic java.util.Iterator<htsjdk.variant.variantcontext.VariantContext> iterator()
setIntervalsForTraversal(List)
Calling this method invalidates (closes) any previous iterator obtained from this method.iterator
in interface java.lang.Iterable<htsjdk.variant.variantcontext.VariantContext>
setIntervalsForTraversal(List)
(if intervals were provided)public java.util.Iterator<htsjdk.variant.variantcontext.VariantContext> query(SimpleInterval interval)
setIntervalsForTraversal(List)
.
Requires the backing files to have been indexed using the IndexFeatureFile tool, and to
be sorted in increasing order of start position for each contig.
Query results are cached to improve the performance of future queries during typical access
patterns. See notes to the class as a whole for a description of the caching strategy.
Calling this method potentially invalidates (closes) any other open iterator obtained
from this data source via a call to iterator()
query
in interface GATKDataSource<htsjdk.variant.variantcontext.VariantContext>
interval
- retrieve all Variants overlapping this intervalpublic java.lang.String getName()
public void close()
close
in interface java.lang.AutoCloseable
public java.util.SortedSet<java.lang.String> getSamples()