Package picard.analysis.directed

## Class TargetMetricsCollector<METRIC_TYPE extends MultilevelMetrics>

- java.lang.Object
- - picard.metrics.MultiLevelCollector<BEAN,​HKEY,​htsjdk.samtools.SAMRecord>
  - - picard.metrics.SAMRecordMultiLevelCollector<METRIC_TYPE,​Integer>
    - - picard.analysis.directed.TargetMetricsCollector<METRIC_TYPE>

- 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).

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `TargetMetricsCollector.Coverage` | A simple class that is used to store the coverage information about an interval.
    `class` | `TargetMetricsCollector.PerUnitTargetMetricCollector` | Collect the Target Metrics for one unit of "accumulation" (i.e.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `NEAR_PROBE_DISTANCE_DEFAULT` | Default distance for a read to be considered "selected".

    - ### Fields inherited from class picard.metrics.MultiLevelCollector

      `UNKNOWN`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---

    `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, boolean includeIndels, int coverageCap, int sampleSize)`

    `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)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract METRIC_TYPE` | `convertMetric​(TargetMetrics targetMetrics)` |
    `htsjdk.samtools.util.Histogram<Integer>` | `getBaseQualityHistogram()` |
    `htsjdk.samtools.util.Histogram<Integer>` | `getDepthHistogram()` |
    `int` | `getNearProbeDistance()` | Gets the distance that is allowed between a read and the nearest probe for it to be considered "near probe" and "selected.
    `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
    `protected PerUnitMetricCollector<METRIC_TYPE,​Integer,​htsjdk.samtools.SAMRecord>` | `makeAllReadCollector()` |
    `protected PerUnitMetricCollector<METRIC_TYPE,​Integer,​htsjdk.samtools.SAMRecord>` | `makeChildCollector​(String sample, String library, String readGroup)` | Construct a PerUnitMetricCollector with the given arguments.

    `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.

    `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.
    `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.

    - ### Methods inherited from class picard.metrics.SAMRecordMultiLevelCollector

      `makeArg`

    - ### Methods inherited from class picard.metrics.MultiLevelCollector

      `acceptRecord, addAllLevelsToFile, finish, getAllReadsCollector, makeLibraryCollector, makeReadGroupCollector, makeSampleCollector, setup`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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,
                                        boolean includeIndels,
                                        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.

    - #### convertMetric

          public abstract METRIC_TYPE convertMetric​(TargetMetrics targetMetrics)

    - #### 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.<targetKeys[i]> is assigned to outputMetrics.<outputKeys[i]>
      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

    - #### makeAllReadCollector

          protected PerUnitMetricCollector<METRIC_TYPE,​Integer,​htsjdk.samtools.SAMRecord> makeAllReadCollector()

      Overrides:
        `makeAllReadCollector` in class `MultiLevelCollector<METRIC_TYPE extends MultilevelMetrics,​Integer,​htsjdk.samtools.SAMRecord>`

    - #### getBaseQualityHistogram

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

    - #### getDepthHistogram

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