Class IntervalWalker

All Implemented Interfaces:
org.broadinstitute.barclay.argparser.CommandLinePluginProvider
Direct Known Subclasses:
ExampleIntervalWalker

public abstract class IntervalWalker extends WalkerBase
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.
  • 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 class GATKTool
      Returns:
      true if this tool requires intervals, otherwise false
    • getProgressMeterRecordLabel

      public String getProgressMeterRecordLabel()
      Overrides:
      getProgressMeterRecordLabel in class GATKTool
      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.
      Overrides:
      onStartup in class GATKTool
    • 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 override traverse() 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.
      Specified by:
      traverse in class GATKTool
    • 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 invoking ReferenceContext.setWindow(int, int) on this object before calling ReferenceContext.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 class GATKTool