public BaseAndQualityAndPosition(int position, int insertSizeRelativeToPosition, BaseAndQuality BandQ) { this.BaseWithQuality = BandQ; this.Position = position; this.InsertPositionPassedRefPosition = (ushort) insertSizeRelativeToPosition; }
public BaseAndQualityAndPosition(int position, int insertSizeRelativeToPosition, BaseAndQuality BandQ) { this.BaseWithQuality = BandQ; this.Position = position; this.InsertPositionPassedRefPosition = (ushort)insertSizeRelativeToPosition; }
/// <summary> /// Calculates the conditional probability that a base comes from each of A, C, G, T /// based on the observed read and quality and current parameter settings. /// </summary> /// <returns>The gonditional probabilities.</returns> /// <param name="freqs">Freqs.</param> /// <param name="data">Data.</param> /// <param name="bp">Bp.</param> private static double updateConditionalProbabilities(BasePairFrequencies freqs, double[] data, BaseAndQuality bp) { //Calculate conditional probability that the base comes from the observed base. double probRight = BaseQualityUtils.GetCorrectProbability(bp.PhredScore); double probWrong = .333333333 * BaseQualityUtils.GetErrorProbability(bp.PhredScore); double totProb = 0.0; for (int i = 0; i < data.Length; i++) { var freq = freqs.Frequencies[i]; if (freq != 0.0) { double prob = freq * (i == bp.Base ? probRight : probWrong); totProb += prob; data[i] = prob; } } for (int i = 0; i < data.Length; i++) { data[i] /= totProb; } return(Math.Log(totProb)); }