Class ExamplePartialReadWalker
java.lang.Object
org.broadinstitute.hellbender.cmdline.CommandLineProgram
org.broadinstitute.hellbender.engine.GATKTool
org.broadinstitute.hellbender.engine.WalkerBase
org.broadinstitute.hellbender.engine.ReadWalker
org.broadinstitute.hellbender.engine.PartialReadWalker
org.broadinstitute.hellbender.tools.examples.ExamplePartialReadWalker
- All Implemented Interfaces:
org.broadinstitute.barclay.argparser.CommandLinePluginProvider
Example/toy program that prints reads from the provided file or files with corresponding reference bases
(if a reference is provided). Intended to show how to implement the ReadWalker interface.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.broadinstitute.hellbender.cmdline.CommandLineProgram
CommandLineProgram.AutoCloseableNoCheckedExceptions
-
Field Summary
FieldsFields inherited from class org.broadinstitute.hellbender.engine.ReadWalker
FEATURE_CACHE_LOOKAHEAD
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 TypeMethodDescriptionvoid
apply
(GATKRead read, ReferenceContext referenceContext, FeatureContext featureContext) Process an individual read (with optional contextual information).void
This method is called by the GATK framework at the end of theGATKTool.doWork()
template method.void
Operations performed just prior to the start of traversal.protected boolean
shouldExitEarly
(GATKRead read) Method to be overridden by the implementation class to determine when to stop the read stream traversalMethods inherited from class org.broadinstitute.hellbender.engine.PartialReadWalker
traverse
Methods inherited from class org.broadinstitute.hellbender.engine.ReadWalker
getDefaultReadFilters, getProgressMeterRecordLabel, onShutdown, onStartup, requiresReads, resetReadsDataSource
Methods inherited from class org.broadinstitute.hellbender.engine.WalkerBase
directlyAccessEngineFeatureManager, directlyAccessEngineReadsDataSource, directlyAccessEngineReferenceDataSource
Methods inherited from class org.broadinstitute.hellbender.engine.GATKTool
addFeatureInputsAfterInitialization, bamIndexCachingShouldBeEnabled, createSAMWriter, createVCFWriter, createVCFWriter, createVCFWriter, disableProgressMeter, doWork, getBestAvailableSequenceDictionary, getDefaultCloudIndexPrefetchBufferSize, getDefaultCloudPrefetchBufferSize, 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, onTraversalSuccess, requiresFeatures, requiresIntervals, 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
-
Field Details
-
FULL_NAME_STOP_ON_READ_NAME
- See Also:
-
stopOnReadName
@Argument(fullName="stop-on-read-name", doc="stop when a read by this name is encountered") public String stopOnReadName
-
-
Constructor Details
-
ExamplePartialReadWalker
public ExamplePartialReadWalker()
-
-
Method Details
-
onTraversalStart
public void onTraversalStart()Description copied from class:GATKTool
Operations performed just prior to the start of traversal. Should be overridden by tool authors who need to process arguments local to their tool or perform other kinds of local initialization. Default implementation does nothing.- Overrides:
onTraversalStart
in classGATKTool
-
apply
Description copied from class:ReadWalker
Process an individual read (with optional contextual information). 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. TODO: Determine whether and to what degree the GATK engine should provide a reduce operation TODO: to complement this operation. At a minimum, we should make apply() return a value to TODO: discourage statefulness in walkers, but how this value should be handled is TBD.- Specified by:
apply
in classReadWalker
- Parameters:
read
- current readreferenceContext
- Reference bases spanning the current read. 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 read's interval by invokingReferenceContext.setWindow(int, int)
on this object before callingReferenceContext.getBases()
featureContext
- Features spanning the current read. 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).
-
closeTool
public void closeTool()Description copied from class:GATKTool
This method is called by the GATK framework at the end of theGATKTool.doWork()
template method. It is called regardless of whether theGATKTool.traverse()
has succeeded or not. It is called after theGATKTool.onTraversalSuccess()
has completed (successfully or not) but before theGATKTool.doWork()
method returns. In other words, on successful runs bothGATKTool.onTraversalSuccess()
andGATKTool.closeTool()
will be called (in this order) while on failed runs (whenGATKTool.traverse()
causes an exception), onlyGATKTool.closeTool()
will be called. The default implementation does nothing. Subclasses should override this method to close any resources that must be closed regardless of the success of traversal. -
shouldExitEarly
Description copied from class:PartialReadWalker
Method to be overridden by the implementation class to determine when to stop the read stream traversal- Specified by:
shouldExitEarly
in classPartialReadWalker
- Parameters:
read
- - the read to be processed next (in case it is needed)- Returns:
- boolean indicator: true means stop!
-