Class BQSRReadTransformer

java.lang.Object
org.broadinstitute.hellbender.transformers.BQSRReadTransformer
All Implemented Interfaces:
Serializable, Function<GATKRead,GATKRead>, UnaryOperator<GATKRead>, ReadTransformer, SerializableFunction<GATKRead,GATKRead>

public final class BQSRReadTransformer extends Object implements ReadTransformer
See Also:
  • Constructor Details

    • BQSRReadTransformer

      public BQSRReadTransformer(htsjdk.samtools.SAMFileHeader header, File bqsrRecalFile, ApplyBQSRArgumentCollection args)
      Constructor using a GATK Report file
      Parameters:
      header - header for the reads
      bqsrRecalFile - a GATK Report file containing the recalibration information
      args - ApplyBQSR args
    • BQSRReadTransformer

      public BQSRReadTransformer(htsjdk.samtools.SAMFileHeader header, RecalibrationReport recalInfo, ApplyBQSRArgumentCollection args)
      Constructor using a RecalibrationReport
      Parameters:
      header - header for the reads
      recalInfo - the output of BaseRecalibration, containing the recalibration information
      args - a set of arguments to control how bqsr is applied
  • Method Details

    • apply

      public GATKRead apply(GATKRead originalRead)
      Recalibrates the base qualities of a read

      It updates the base qualities of the read with the new recalibrated qualities (for all event types)

      Implements a serial recalibration of the reads using the combinational table. First, we perform a positional recalibration, and then a subsequent dinuc correction.

      Given the full recalibration table, we perform the following preprocessing steps:

      - calculate the global quality score shift across all data [DeltaQ] - calculate for each of cycle and dinuc the shift of the quality scores relative to the global shift -- i.e., DeltaQ(dinuc) = Sum(pos) Sum(Qual) Qempirical(pos, qual, dinuc) - Qreported(pos, qual, dinuc) / Npos * Nqual - The final shift equation is:

      Qrecal = Qreported + DeltaQ + DeltaQ(pos) + DeltaQ(dinuc) + DeltaQ( ... any other covariate ... )

      Specified by:
      apply in interface Function<GATKRead,GATKRead>
      Specified by:
      apply in interface SerializableFunction<GATKRead,GATKRead>
      Parameters:
      originalRead - the read to recalibrate
    • hierarchicalBayesianQualityEstimate

      public static double hierarchicalBayesianQualityEstimate(double epsilon, RecalDatum empiricalQualRG, RecalDatum empiricalQualQS, RecalDatum... empiricalQualCovs)
    • constructStaticQuantizedMapping

      public static byte[] constructStaticQuantizedMapping(List<Integer> staticQuantizedQuals, boolean roundDown)
      Constructs an array that maps particular quantized values to a rounded value in staticQuantizedQuals Rounding is done in probability space. When roundDown is true, we simply round down to the nearest available qual in staticQuantizedQuals
      Parameters:
      staticQuantizedQuals - the list of qualities to round to
      roundDown - round down if true, round to nearest (in probability space) otherwise
      Returns:
      Array where index representing the quality score to be mapped and the value is the rounded quality score