Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assembly scoring: fix #158 and solve ties in assembly scoring #161 #163

Merged
merged 3 commits into from
Jan 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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){
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I use some epsilon for the comparison, or do we trust score differences even if they are very tiny?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say we should do this for strict ties only (those comparing as equals), let's trust the tiny differences to do the sorting job otherwise.

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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What call should we assign to all the assemblies with the same high score? Here I choose NOPRED.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we use BIO for several assemblies? Is that possible? or would something else break because of that?

Otherwise if we don't want to do several BIOs, then I'd rather go for a strategy like @sbliven proposed: choose the one with lowest stoichiometry.

Copy link
Member Author

@lafita lafita Jan 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot recall anything that would break if two assemblies are assigned as BIO, I am OK with this solution. The only problem I can see is with the user interpretation, maybe we should think what does a user expect or show a help message for such cases.

}
}
}

// 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