public int ComputeQScore(QScoreMethod qscoreMethod)
{
double score;
int qscore;
switch (qscoreMethod)
{
case QScoreMethod.LogisticGermline:
// Logistic model using a new selection of features. Gives ROC curve area 0.921
score = -5.0123;
score += GetQScorePredictor(QScorePredictor.LogBinCount) * 4.9801;
score += GetQScorePredictor(QScorePredictor.ModelDistance) * -5.5472;
score += GetQScorePredictor(QScorePredictor.DistanceRatio) * -1.7914;
score = Math.Exp(score);
score = score / (score + 1);
// Transform probability into a q-score:
qscore = (int)(Math.Round(-10 * Math.Log10(1 - score)));
qscore = Math.Min(40, qscore);
qscore = Math.Max(2, qscore);
return qscore;
case QScoreMethod.Logistic:
// Logistic model using a new selection of features. Gives ROC curve area 0.8289
score = -0.5143;
score += GetQScorePredictor(QScorePredictor.LogBinCount) * 0.8596;
score += GetQScorePredictor(QScorePredictor.ModelDistance) * -50.4366;
score += GetQScorePredictor(QScorePredictor.DistanceRatio) * -0.6511;
score = Math.Exp(score);
score = score / (score + 1);
// Transform probability into a q-score:
qscore = (int)(Math.Round(-10 * Math.Log10(1 - score)));
qscore = Math.Min(60, qscore);
qscore = Math.Max(2, qscore);
return qscore;
case QScoreMethod.BinCountLinearFit:
if (this.BinCount >= 100)
return 61;
else
return (int)Math.Round(-10 * Math.Log10(1 - 1 / (1 + Math.Exp(0.5532 - this.BinCount * 0.147))), 0, MidpointRounding.AwayFromZero);
case QScoreMethod.GeneralizedLinearFit: // Generalized linear fit with linear transformation to QScore
double linearFit = -3.65
- 1.12 * GetQScorePredictor(QScorePredictor.LogBinCount)
+ 3.89 * GetQScorePredictor(QScorePredictor.ModelDistance)
+ 0.47 * GetQScorePredictor(QScorePredictor.MajorChromosomeCount)
- 0.68 * GetQScorePredictor(QScorePredictor.MafMean)
- 0.25 * GetQScorePredictor(QScorePredictor.LogMafCv);
score = -11.9 - 11.4 * linearFit; // Scaling to achieve 2 <= qscore <= 61
score = Math.Max(2, score);
score = Math.Min(61, score);
return (int)Math.Round(score, 0, MidpointRounding.AwayFromZero);
default:
throw new Exception("Unhandled qscore method");
}
}