Class TargetMetricsCollector<METRIC_TYPE extends MultilevelMetrics>

  • Direct Known Subclasses:
    HsMetricCollector, TargetedPcrMetricsCollector

    public abstract class TargetMetricsCollector<METRIC_TYPE extends MultilevelMetrics>
    extends SAMRecordMultiLevelCollector<METRIC_TYPE,​Integer>
    TargetMetrics, are metrics to measure how well we hit specific targets (or baits) when using a targeted sequencing process like hybrid selection or Targeted PCR Techniques (TSCA). TargetMetrics at the moment are the metrics that are shared by both HybridSelection and TargetedPcrMetrics. TargetMetricsCollector collects for a run these common metrics and can be sub-classed to provide metrics more specific to a targeted sequencing run. Note: Probe is the name I've used to indicate the bait set or amplicon set (e.g. the individual technological units used to target specific sites).
    • Field Detail

      • NEAR_PROBE_DISTANCE_DEFAULT

        public static final int NEAR_PROBE_DISTANCE_DEFAULT
        Default distance for a read to be considered "selected".
        See Also:
        Constant Field Values
    • Constructor Detail

      • TargetMetricsCollector

        public TargetMetricsCollector​(Set<MetricAccumulationLevel> accumulationLevels,
                                      List<htsjdk.samtools.SAMReadGroupRecord> samRgRecords,
                                      htsjdk.samtools.reference.ReferenceSequenceFile refFile,
                                      File perTargetCoverage,
                                      File perBaseCoverage,
                                      htsjdk.samtools.util.IntervalList targetIntervals,
                                      htsjdk.samtools.util.IntervalList probeIntervals,
                                      String probeSetName,
                                      int nearProbeDistance,
                                      int minimumMappingQuality,
                                      int minimumBaseQuality,
                                      boolean clipOverlappingReads,
                                      int coverageCap,
                                      int sampleSize)
      • TargetMetricsCollector

        public TargetMetricsCollector​(Set<MetricAccumulationLevel> accumulationLevels,
                                      List<htsjdk.samtools.SAMReadGroupRecord> samRgRecords,
                                      htsjdk.samtools.reference.ReferenceSequenceFile refFile,
                                      File perTargetCoverage,
                                      File perBaseCoverage,
                                      htsjdk.samtools.util.IntervalList targetIntervals,
                                      htsjdk.samtools.util.IntervalList probeIntervals,
                                      String probeSetName,
                                      int nearProbeDistance,
                                      int minimumMappingQuality,
                                      int minimumBaseQuality,
                                      boolean clipOverlappingReads,
                                      boolean noSideEffects,
                                      int coverageCap,
                                      int sampleSize)
    • Method Detail

      • getNearProbeDistance

        public int getNearProbeDistance()
        Gets the distance that is allowed between a read and the nearest probe for it to be considered "near probe" and "selected.
      • setNearProbeDistance

        public void setNearProbeDistance​(int nearProbeDistance)
        Sets the distance that is allowed between a read and the nearest probe for it to be considered "near probe" and "selected.
      • setNoSideEffects

        public void setNoSideEffects​(boolean value)
        In the case of ignoring bases in overlapping reads from the same template, we choose to internally modify the SAM record's CIGAR to clip overlapping bases. We can either to modify the passed-in record (a side-effect), or modify a an internally clone of the record (no side-effect). Due to the overhead of cloning a SAMRecord object, we may see significant slow down of the performance to ensure there are no side effects. Therefore, users of this collector who do not care if the record passed to MultiLevelCollector.acceptRecord(htsjdk.samtools.SAMRecord, htsjdk.samtools.reference.ReferenceSequence) is modified can pass in false to this method to realize performance gains.
        Parameters:
        value - the boolean value to set.
      • getNumBasesPassingMinimumBaseQuality

        public static int getNumBasesPassingMinimumBaseQuality​(htsjdk.samtools.SAMRecord record,
                                                               htsjdk.samtools.AlignmentBlock block,
                                                               int minimumBaseQuality)
        Get the the number of bases in the given alignment block and record that have base quality greater or equal to the minimum
      • reflectiveCopy

        protected static <MT extends htsjdk.samtools.metrics.MetricBase> void reflectiveCopy​(TargetMetrics targetMetrics,
                                                                                             MT outputMetrics,
                                                                                             String[] targetKeys,
                                                                                             String[] outputKeys)
        Since the targeted metrics (HsMetrics, TargetedPcrMetrics,...) share many of the same values as TargetMetrics, this copy will copy all public attributes in targetMetrics to the outputMetrics' attributes of the same name. If no matching attribute exists in the outputMetrics or the attribute of the target metrics class also is found in targetKeys then it's value is not copied. Further more, targetKeys and outputKeys are attribute name arrays synchronized by the index. For each target key, targetMetrics. is assigned to outputMetrics.
        Type Parameters:
        MT - The type of metric of outputMetrics
        Parameters:
        targetMetrics - A metric with values to be copied
        outputMetrics - A metrics intended to receive values from targetMetrics
        targetKeys - Specific names of attributes of targetMetrics to copy to outputMetrics, each key has a corresponding one in outputKeys
        outputKeys - Specific names of the destination attributes of outputMetrics that will be filled with values of outputMetrics, each key has a corresponding one in targetKeys
      • makeChildCollector

        protected PerUnitMetricCollector<METRIC_TYPE,​Integer,​htsjdk.samtools.SAMRecord> makeChildCollector​(String sample,
                                                                                                                       String library,
                                                                                                                       String readGroup)
        Description copied from class: MultiLevelCollector
        Construct a PerUnitMetricCollector with the given arguments.
        Specified by:
        makeChildCollector in class MultiLevelCollector<METRIC_TYPE extends MultilevelMetrics,​Integer,​htsjdk.samtools.SAMRecord>
        Parameters:
        sample - If aggregating by ALL_READS this will be null, otherwise the sample that will be used to identify this collector
        library - If aggregating by SAMPLE this will be null, otherwise the library that will be used to identify this collector
        readGroup - If aggregating by LIBRARY this will be null, otherwise the readGroup that will be used to identify this collector
        Returns:
        A PerUnitMetricCollector parameterized by the given arguments
      • getBaseQualityHistogram

        public htsjdk.samtools.util.Histogram<Integer> getBaseQualityHistogram()
      • getDepthHistogram

        public htsjdk.samtools.util.Histogram<Integer> getDepthHistogram()