From 85600e87cd8e4e413510096f52f94086e08d5b8f Mon Sep 17 00:00:00 2001 From: lafita Date: Mon, 30 Jan 2017 16:40:05 +0100 Subject: [PATCH] Solve scoring ties with NOPRED General solution for DNA helix described in #161 --- .../eppic/assembly/CrystalAssemblies.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/eppic-cli/src/main/java/eppic/assembly/CrystalAssemblies.java b/eppic-cli/src/main/java/eppic/assembly/CrystalAssemblies.java index c1880a2f5..dd99f80c1 100644 --- a/eppic-cli/src/main/java/eppic/assembly/CrystalAssemblies.java +++ b/eppic-cli/src/main/java/eppic/assembly/CrystalAssemblies.java @@ -587,19 +587,36 @@ public void score() { indx++; } + // This is done when multiple assemblies are high scoring + indx = 0; + List indices = new ArrayList(); + 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)