Class IntervalWalker
java.lang.Object
org.broadinstitute.hellbender.cmdline.CommandLineProgram
org.broadinstitute.hellbender.engine.GATKTool
org.broadinstitute.hellbender.engine.WalkerBase
org.broadinstitute.hellbender.engine.IntervalWalker
- All Implemented Interfaces:
org.broadinstitute.barclay.argparser.CommandLinePluginProvider
- Direct Known Subclasses:
ExampleIntervalWalker
An IntervalWalker is a tool that processes a single interval at a time, with the ability to query
optional overlapping sources of reads, reference data, and/or variants/features.
The current implementation uses no caching, and so will likely only provide acceptable performance
if intervals are spaced sufficiently far apart that few records (reads, etc.) will overlap more than
one interval. Performance will likely be poor given a large set of small, nearby intervals, but we
will address this issue when porting this traversal to dataflow.
IntervalWalker authors must implement the apply() method to process each interval, and may optionally implement
onTraversalStart() and/or onTraversalSuccess(). See the
ExampleIntervalWalker
tool for an example.-
Nested Class Summary
Nested classes/interfaces inherited from class org.broadinstitute.hellbender.cmdline.CommandLineProgram
CommandLineProgram.AutoCloseableNoCheckedExceptions
-
Field Summary
Fields inherited from class org.broadinstitute.hellbender.engine.GATKTool
addOutputSAMProgramRecord, addOutputVCFCommandLine, cloudIndexPrefetchBuffer, cloudPrefetchBuffer, createOutputBamIndex, createOutputBamMD5, createOutputVariantIndex, createOutputVariantMD5, disableBamIndexCaching, features, intervalArgumentCollection, lenientVCFProcessing, outputSitesOnlyVCFs, progressMeter, readArguments, referenceArguments, SECONDS_BETWEEN_PROGRESS_UPDATES_NAME, seqValidationArguments
Fields inherited from class org.broadinstitute.hellbender.cmdline.CommandLineProgram
GATK_CONFIG_FILE, logger, NIO_MAX_REOPENS, NIO_PROJECT_FOR_REQUESTER_PAYS, QUIET, specialArgumentsCollection, tmpDir, useJdkDeflater, useJdkInflater, VERBOSITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
apply
(SimpleInterval interval, ReadsContext readsContext, ReferenceContext referenceContext, FeatureContext featureContext) Process an individual interval.protected final void
Close data sources.protected final void
Initialize data sources.boolean
Does this tool require intervals? Traversals types and/or tools that do should override to return true.void
traverse()
A complete traversal from start to finish.Methods inherited from class org.broadinstitute.hellbender.engine.WalkerBase
directlyAccessEngineFeatureManager, directlyAccessEngineReadsDataSource, directlyAccessEngineReferenceDataSource
Methods inherited from class org.broadinstitute.hellbender.engine.GATKTool
addFeatureInputsAfterInitialization, bamIndexCachingShouldBeEnabled, closeTool, createSAMWriter, createVCFWriter, createVCFWriter, createVCFWriter, disableProgressMeter, doWork, getBestAvailableSequenceDictionary, getDefaultCloudIndexPrefetchBufferSize, getDefaultCloudPrefetchBufferSize, getDefaultReadFilters, getDefaultToolVCFHeaderLines, getDefaultVariantAnnotationGroups, getDefaultVariantAnnotations, getGenomicsDBOptions, getHeaderForFeatures, getHeaderForReads, getHeaderForSAMWriter, getMasterSequenceDictionary, getPluginDescriptors, getReferenceDictionary, getSequenceDictionaryValidationArgumentCollection, getToolName, getTransformedReadStream, getTraversalIntervals, getUserSuppliedIntervals, hasFeatures, hasReads, hasReference, hasUserSuppliedIntervals, initializeProgressMeter, makePostReadFilterTransformer, makePreReadFilterTransformer, makeReadFilter, makeSamReaderFactory, makeVariantAnnotations, onTraversalStart, onTraversalSuccess, requiresFeatures, requiresReads, requiresReference, transformTraversalIntervals, useVariantAnnotations
Methods inherited from class org.broadinstitute.hellbender.cmdline.CommandLineProgram
customCommandLineValidation, getCommandLine, getCommandLineParser, getDefaultHeaders, getMetricsFile, getSupportInformation, getToolkitName, getToolkitShortName, getToolStatusWarning, getUsage, getVersion, instanceMain, instanceMainPostParseArgs, isBetaFeature, isExperimentalFeature, parseArgs, printLibraryVersions, printSettings, printStartupMessage, runTool, setDefaultHeaders, warnOnToolStatus
-
Constructor Details
-
IntervalWalker
public IntervalWalker()
-
-
Method Details
-
requiresIntervals
public boolean requiresIntervals()Description copied from class:GATKTool
Does this tool require intervals? Traversals types and/or tools that do should override to return true.- Overrides:
requiresIntervals
in classGATKTool
- Returns:
- true if this tool requires intervals, otherwise false
-
getProgressMeterRecordLabel
- Overrides:
getProgressMeterRecordLabel
in classGATKTool
- Returns:
- String label to use for records in progress meter output. Defaults to
ProgressMeter.DEFAULT_RECORD_LABEL
, but tools may override to provide a more appropriate label (like "reads" or "regions")
-
onStartup
protected final void onStartup()Initialize data sources. Marked final so that tool authors don't override it. Tool authors should override onTraversalSuccess() instead. -
traverse
public void traverse()A complete traversal from start to finish. Tool authors who wish to "roll their own" traversal from scratch can extend this class directly and implement this method. Walker authors should instead extend a Walker class and implement the Walker-appropriate apply() method, since the Walker base classes implement the various kinds of traversals for you. Implementation of interval-based traversal. NOTE: You should only overridetraverse()
if you are writing a new walker base class in the engine package that extends this class. It is not meant to be overridden by tools outside of the engine package. -
apply
public abstract void apply(SimpleInterval interval, ReadsContext readsContext, ReferenceContext referenceContext, FeatureContext featureContext) Process an individual interval. Must be implemented by tool authors. In general, tool authors should simply stream their output from apply(), and maintain as little internal state as possible.- Parameters:
interval
- Current interval being processed.readsContext
- Reads overlapping the current interval. Will be an empty, but non-null, context object if there is no backing source of reads data (in which case all queries on it will return an empty array/iterator)referenceContext
- Reference bases spanning the current interval. Will be an empty, but non-null, context object if there is no backing source of reference data (in which case all queries on it will return an empty array/iterator). Can request extra bases of context around the current interval by invokingReferenceContext.setWindow(int, int)
on this object before callingReferenceContext.getBases()
featureContext
- Features spanning the current interval. Will be an empty, but non-null, context object if there is no backing source of Feature data (in which case all queries on it will return an empty List).
-
onShutdown
protected final void onShutdown()Close data sources. Marked final so that tool authors don't override it. Tool authors should override onTraversalSuccess() instead.- Overrides:
onShutdown
in classGATKTool
-