Skip to content

Commit

Permalink
Merge pull request #163 from lafita/assemblyScore
Browse files Browse the repository at this point in the history
Assembly scoring: fix #158 and solve ties in assembly scoring #161
  • Loading branch information
josemduarte authored Jan 30, 2017
2 parents 8f7c9f5 + 85600e8 commit b8246a6
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 17 deletions.
25 changes: 21 additions & 4 deletions eppic-cli/src/main/java/eppic/assembly/CrystalAssemblies.java
Original file line number Diff line number Diff line change
Expand Up @@ -587,19 +587,36 @@ public void score() {
indx++;
}

// This is done when multiple assemblies are high scoring
indx = 0;
List<Integer> indices = new ArrayList<Integer>();
for (Assembly a:uniques) {
if (a.getScore() == maxScore){
indices.add(indx);
}
indx++;
}

// Warn if low probability density of valid assemblies
if (sumProbs < 0.5) {
logger.warn("The total probability of valid assemblies is only {}. "
+ "Assembly ennumeration may be incomplete.", String.format("%.2f", sumProbs));
}

// Do not normalize the score (easy to do afterwards though)
// Do not normalize the score (easy to do afterwards in the DB though)
//for (Assembly a:uniques)
// a.normalizeScore(sumProbs);

// 3 Assign the BIO call to the highest probability
if (uniques.size() > 0)
uniques.get(maxIndx).setCall(CallType.BIO);
// 3 Assign the BIO call to the highest probability, if unique assembly
if (uniques.size() > 0) {
if (indices.size() == 1) {
uniques.get(maxIndx).setCall(CallType.BIO);
} else {
for (Integer i:indices) {
uniques.get(i).setCall(CallType.NO_PREDICTION);
}
}
}

// 4 Compute call confidence
for (Assembly a:uniques)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class CombinedClusterPredictor implements InterfaceTypePredictor {
private CallType call;
private String callReason;

private double probability;
private double confidence;
private double probability = 0.5;
private double confidence = 0.5;


public CombinedClusterPredictor(List<CombinedPredictor> lcp) {
Expand All @@ -35,12 +35,16 @@ public void computeScores() {

// 1) BIO call
if (probability > 0.5) {
callReason = String.format("P(BIO) = %.2f > 0.5", probability);
callReason = String.format(
"Probability of the interface being biologically relevant is %.2f.",
probability);
call = CallType.BIO;
}
}
// 2) XTAL call
else if (probability <= 0.5) {
callReason = String.format("P(BIO) = %.2f < 0.5", probability);
callReason = String.format(
"Probability of the interface being biologically relevant is %.2f.",
probability);
call = CallType.CRYSTAL;
}

Expand Down Expand Up @@ -69,7 +73,7 @@ public double getScore() {
}

@Override
public double getScore1() {
public double getScore1() {
return SCORE_UNASSIGNED;
}

Expand All @@ -93,7 +97,7 @@ private void calcConfidence() {
confidence = 1 - probability;
break;
case NO_PREDICTION:
confidence = CONFIDENCE_UNASSIGNED;
confidence = 0.5;

}

Expand Down
16 changes: 10 additions & 6 deletions eppic-cli/src/main/java/eppic/predictors/CombinedPredictor.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public class CombinedPredictor implements InterfaceTypePredictor {

private CallType call;

private double probability;
private double confidence;
private double probability = 0.5;
private double confidence = 0.5;

public CombinedPredictor(InterfaceEvolContext iec,
GeometryPredictor gp, EvolCoreRimPredictor ecrp, EvolCoreSurfacePredictor ecsp) {
Expand Down Expand Up @@ -106,7 +106,7 @@ public void computeScores() {
LOGGER.info("Interface {} is not protein in either side, can't score it",iec.getInterface().getId());
callReason = "Both sides are not protein, can't score";
call = CallType.NO_PREDICTION;
probability = -1;
probability = 0.5;
return;
}

Expand All @@ -115,12 +115,16 @@ public void computeScores() {

// 1) BIO call
if (probability > 0.5) {
callReason = String.format("P(BIO) = %.2f > 0.5", probability);
callReason = String.format(
"Probability of the interface being biologically relevant is %.2f.",
probability);
call = CallType.BIO;
}
// 2) XTAL call
else if (probability <= 0.5) {
callReason = String.format("P(BIO) = %.2f < 0.5", probability);
callReason = String.format(
"Probability of the interface being biologically relevant is %.2f.",
probability);
call = CallType.CRYSTAL;
}

Expand Down Expand Up @@ -186,7 +190,7 @@ private void calcConfidence() {
confidence = 1 - probability;
break;
case NO_PREDICTION:
confidence = CONFIDENCE_UNASSIGNED;
confidence = 0.5;

}

Expand Down

0 comments on commit b8246a6

Please sign in to comment.