public final class FeatureManager
extends java.lang.Object
implements java.lang.AutoCloseable
GATKConfig.codec_packages()
in the config file to discover what codecs are available
to decode Feature-containing files.
Then, given a tool instance, it discovers what FeatureInput argument fields are declared in the
tool's class hierarchy (and associated ArgumentCollections), and for each argument actually specified
by the user on the command line, determines the type of the file and the codec required to decode it,
creates a FeatureDataSource for that file, and adds it to a query-able resource pool.
Clients can then call #getFeatures(FeatureInput, SimpleInterval)
to query the data source for
a particular FeatureInput over a specific interval.Constructor and Description |
---|
FeatureManager(CommandLineProgram toolInstance)
Create a FeatureManager given a CommandLineProgram tool instance, discovering all FeatureInput
arguments in the tool and creating query-able FeatureDataSources for them.
|
FeatureManager(CommandLineProgram toolInstance,
int featureQueryLookahead)
Create a FeatureManager given a CommandLineProgram tool instance, discovering all FeatureInput
arguments in the tool and creating query-able FeatureDataSources for them.
|
FeatureManager(CommandLineProgram toolInstance,
int featureQueryLookahead,
int cloudPrefetchBuffer,
int cloudIndexPrefetchBuffer)
Create a FeatureManager given a CommandLineProgram tool instance, discovering all FeatureInput
arguments in the tool and creating query-able FeatureDataSources for them.
|
FeatureManager(CommandLineProgram toolInstance,
int featureQueryLookahead,
int cloudPrefetchBuffer,
int cloudIndexPrefetchBuffer,
GenomicsDBOptions gdbOptions)
Create a FeatureManager given a CommandLineProgram tool instance, discovering all FeatureInput
arguments in the tool and creating query-able FeatureDataSources for them.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Permanently closes this manager by closing all backing data sources
|
void |
dumpAllFeatureCacheStats() |
java.util.List<htsjdk.samtools.SAMSequenceDictionary> |
getAllSequenceDictionaries()
Returns the sequence dictionaries associated with all feature sources.
|
java.util.List<htsjdk.variant.vcf.VCFHeader> |
getAllVariantHeaders()
This method finds and returns all of the variant headers from the feature sources.
|
static htsjdk.tribble.FeatureCodec<? extends htsjdk.tribble.Feature,?> |
getCodecForFile(java.nio.file.Path featurePath)
Utility method that determines the correct codec to use to read Features from the provided file.
|
static htsjdk.tribble.FeatureCodec<? extends htsjdk.tribble.Feature,?> |
getCodecForFile(java.nio.file.Path featurePath,
java.lang.Class<? extends htsjdk.tribble.Feature> featureType)
Utility method that determines the correct codec to use to read Features from the provided file,
optionally considering only codecs that produce a particular type of Feature.
|
<T extends htsjdk.tribble.Feature> |
getFeatureIterator(FeatureInput<T> featureDescriptor)
Given a FeatureInput argument field from our tool, returns an iterator to its features starting
from the first one.
|
<T extends htsjdk.tribble.Feature> |
getFeatures(FeatureInput<T> featureDescriptor,
htsjdk.samtools.util.Locatable interval)
Given a FeatureInput argument field from our tool, queries the data source for that FeatureInput
over the specified interval, and returns a List of the Features overlapping that interval from
that data source.
|
<T extends htsjdk.tribble.Feature> |
getHeader(FeatureInput<T> featureDescriptor)
Get the header associated with a particular FeatureInput
|
java.util.List<htsjdk.samtools.SAMSequenceDictionary> |
getVariantSequenceDictionaries()
Returns the list of sequence dictionaries retrieved from the VCF headers of variant Feature inputs.
|
boolean |
isEmpty()
Does this manager have no sources of Features to query?
|
static boolean |
isFeatureFile(java.nio.file.Path file) |
public FeatureManager(CommandLineProgram toolInstance)
FeatureDataSource
.toolInstance
- Instance of the tool to be run (potentially containing one or more FeatureInput arguments)
Must have undergone command-line argument parsing and argument value injection already.public FeatureManager(CommandLineProgram toolInstance, int featureQueryLookahead)
FeatureDataSource
.toolInstance
- Instance of the tool to be run (potentially containing one or more FeatureInput arguments)
Must have undergone command-line argument parsing and argument value injection already.featureQueryLookahead
- When querying FeatureDataSources, cache this many extra bases of context beyond
the end of query intervals in anticipation of future queries (>= 0).public FeatureManager(CommandLineProgram toolInstance, int featureQueryLookahead, int cloudPrefetchBuffer, int cloudIndexPrefetchBuffer)
FeatureDataSource
.toolInstance
- Instance of the tool to be run (potentially containing one or more FeatureInput arguments)
Must have undergone command-line argument parsing and argument value injection already.featureQueryLookahead
- When querying FeatureDataSources, cache this many extra bases of context beyond
the end of query intervals in anticipation of future queries (>= 0).cloudPrefetchBuffer
- 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).public FeatureManager(CommandLineProgram toolInstance, int featureQueryLookahead, int cloudPrefetchBuffer, int cloudIndexPrefetchBuffer, GenomicsDBOptions gdbOptions)
FeatureDataSource
.toolInstance
- Instance of the tool to be run (potentially containing one or more FeatureInput arguments)
Must have undergone command-line argument parsing and argument value injection already.featureQueryLookahead
- When querying FeatureDataSources, cache this many extra bases of context beyond
the end of query intervals in anticipation of future queries (>= 0).cloudPrefetchBuffer
- 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).gdbOptions
- settings for GenomicsDB to use when reading from a GenomicsDB workspacepublic void dumpAllFeatureCacheStats()
public boolean isEmpty()
public java.util.List<htsjdk.variant.vcf.VCFHeader> getAllVariantHeaders()
public java.util.List<htsjdk.samtools.SAMSequenceDictionary> getVariantSequenceDictionaries()
public java.util.List<htsjdk.samtools.SAMSequenceDictionary> getAllSequenceDictionaries()
public <T extends htsjdk.tribble.Feature> java.util.List<T> getFeatures(FeatureInput<T> featureDescriptor, htsjdk.samtools.util.Locatable interval)
T
- type of Feature in the source represented by featureDescriptorfeatureDescriptor
- FeatureInput argument from our tool representing the Feature source to queryinterval
- interval to query over (returned Features will overlap this interval)public <T extends htsjdk.tribble.Feature> java.util.Iterator<T> getFeatureIterator(FeatureInput<T> featureDescriptor)
Warning!: calling this method a second time on the same FeatureInput
on the same FeatureManager instance will invalidate (close) the iterator returned from
the first call.
An exception will be thrown if the FeatureInput
provided did not come from the tool that this
manager was initialized with, or was not an @Argument-annotated field in the tool
(or parent classes).
T
- type of Feature in the source represented by featureDescriptorfeatureDescriptor
- FeatureInput argument from our tool representing the Feature source to querynull
, a iterator to all the features in the backing data source.GATKException
- if the feature-descriptor is not found in the manager or is null
.public <T extends htsjdk.tribble.Feature> java.lang.Object getHeader(FeatureInput<T> featureDescriptor)
T
- type of Feature in our FeatureInputfeatureDescriptor
- the FeatureInput whose header we want to retrievepublic static htsjdk.tribble.FeatureCodec<? extends htsjdk.tribble.Feature,?> getCodecForFile(java.nio.file.Path featurePath)
FeatureCodec.canDecode(String)
method
in order to be considered as candidates for decoding the file.
Throws an exception if no suitable codecs are found (this is a user error, since the file is of
an unsupported format), or if more than one codec claims to be able to decode the file (this is
a configuration error on the codec authors' part).featurePath
- path for which to find the right codecpublic static htsjdk.tribble.FeatureCodec<? extends htsjdk.tribble.Feature,?> getCodecForFile(java.nio.file.Path featurePath, java.lang.Class<? extends htsjdk.tribble.Feature> featureType)
FeatureCodec.canDecode(String)
method
in order to be considered as candidates for decoding the file, and must produce
Features of the specified type if featureType is non-null.
Throws an exception if no suitable codecs are found (this is a user error, since the file is of
an unsupported format), or if more than one codec claims to be able to decode the file (this is
a configuration error on the codec authors' part).featurePath
- Path for which to find the right codecfeatureType
- If specified, consider only codecs that produce Features of this type. May be null,
in which case all codecs are considered.public static boolean isFeatureFile(java.nio.file.Path file)
file
- file to checkpublic void close()
close
in interface java.lang.AutoCloseable