Class AbstractProgressLogger

java.lang.Object
htsjdk.samtools.util.AbstractProgressLogger
All Implemented Interfaces:
ProgressLoggerInterface
Direct Known Subclasses:
ProgressLogger

public abstract class AbstractProgressLogger extends Object implements ProgressLoggerInterface
Abstract implementation of a Little progress logging class to facilitate consistent output of useful information when progressing through a stream of SAM records. Concrete subclasses must provide the logger
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractProgressLogger(String noun, String verb, int n)
    Construct an AbstractProgressLogger.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the count of records processed.
    long
    Returns the number of seconds since progress tracking began.
    boolean
    log()
    Logs the last last record if it wasn't previously logged.
    protected abstract void
    log(String... message)
    Log a message to whatever logger is being used
    boolean
    Records that a given record has been processed and triggers logging if necessary.
    boolean
    record(SAMRecord... recs)
    Records multiple SAMRecords and triggers logging if necessary.
    boolean
    record(String chrom, int pos)
     
    protected boolean
    record(String chrom, int pos, String rname)
     
    void
    Resets the start time to now and the number of records to zero.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractProgressLogger

      protected AbstractProgressLogger(String noun, String verb, int n)
      Construct an AbstractProgressLogger. This must be called by any subclasses
      Parameters:
      n - the frequency with which to output (i.e. every N records)
      verb - the verb to log, e.g. "Processed, Read, Written".
      noun - the noun to use when logging, e.g. "Records, Variants, Loci"
  • Method Details

    • log

      protected abstract void log(String... message)
      Log a message to whatever logger is being used
      Parameters:
      message - a message to be logged by the logger (recommended output level is INFO or the equivalent)
    • log

      public boolean log()
      Logs the last last record if it wasn't previously logged.
      Returns:
      boolean true if logging was triggered, false otherwise
    • record

      protected boolean record(String chrom, int pos, String rname)
    • record

      public boolean record(String chrom, int pos)
      Specified by:
      record in interface ProgressLoggerInterface
    • record

      public boolean record(SAMRecord rec)
      Records that a given record has been processed and triggers logging if necessary.
      Specified by:
      record in interface ProgressLoggerInterface
      Returns:
      boolean true if logging was triggered, false otherwise
    • record

      public boolean record(SAMRecord... recs)
      Records multiple SAMRecords and triggers logging if necessary.
      Specified by:
      record in interface ProgressLoggerInterface
    • getCount

      public long getCount()
      Returns the count of records processed.
    • getElapsedSeconds

      public long getElapsedSeconds()
      Returns the number of seconds since progress tracking began.
    • reset

      public void reset()
      Resets the start time to now and the number of records to zero.
      Specified by:
      reset in interface ProgressLoggerInterface