/// <summary> /// http://www.broadinstitute.org/gsa/wiki/index.php/Understanding_the_Unified_Genotyper%27s_VCF_files /// See section on Strand Bias /// </summary> // From GATK source: //double forwardLod = forwardLog10PofF + reverseLog10PofNull - overallLog10PofF; //double reverseLod = reverseLog10PofF + forwardLog10PofNull - overallLog10PofF; // //// strand score is max bias between forward and reverse strands //double strandScore = Math.max(forwardLod, reverseLod); // //// rescale by a factor of 10 //strandScore *= 10.0; // //attributes.put("SB", strandScore); private static double[] AssignBiasScore(StrandBiasStats overallStats, StrandBiasStats fwdStats, StrandBiasStats rvsStats) { var forwardBias = (fwdStats.ChanceVarFreqGreaterThanZero * rvsStats.ChanceFalsePos) / overallStats.ChanceVarFreqGreaterThanZero; var reverseBias = (rvsStats.ChanceVarFreqGreaterThanZero * fwdStats.ChanceFalsePos) / overallStats.ChanceVarFreqGreaterThanZero; var p = Math.Max(forwardBias, reverseBias); return(new[] { p, MathOperations.PtoGATKBiasScale(p) }); }