From aa003a6777e69d6fb258540166b7c1fd343098c3 Mon Sep 17 00:00:00 2001 From: Luan Nguyen Date: Fri, 21 Jun 2024 12:23:33 +1000 Subject: [PATCH] Compar: In CuppaData, added key() implementation and updated displayValue() --- .../com/hartwig/hmftools/compar/cuppa/CuppaComparer.java | 2 +- .../java/com/hartwig/hmftools/compar/cuppa/CuppaData.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/compar/src/main/java/com/hartwig/hmftools/compar/cuppa/CuppaComparer.java b/compar/src/main/java/com/hartwig/hmftools/compar/cuppa/CuppaComparer.java index ba6ce903b1..fb6737525c 100644 --- a/compar/src/main/java/com/hartwig/hmftools/compar/cuppa/CuppaComparer.java +++ b/compar/src/main/java/com/hartwig/hmftools/compar/cuppa/CuppaComparer.java @@ -51,7 +51,7 @@ public boolean processSample(final String sampleId, final List mismatc @Override public List comparedFieldNames() { - return Lists.newArrayList(FLD_TOP_CANCER_TYPE, FLD_PROBABILITY, FLD_CLASSIFIER_NAME); + return Lists.newArrayList(FLD_TOP_CANCER_TYPE, FLD_PROBABILITY); } @Override diff --git a/compar/src/main/java/com/hartwig/hmftools/compar/cuppa/CuppaData.java b/compar/src/main/java/com/hartwig/hmftools/compar/cuppa/CuppaData.java index 1dd99b4b51..36dc4c9c87 100644 --- a/compar/src/main/java/com/hartwig/hmftools/compar/cuppa/CuppaData.java +++ b/compar/src/main/java/com/hartwig/hmftools/compar/cuppa/CuppaData.java @@ -36,7 +36,7 @@ public CuppaData(final CuppaPredictionEntry predictionEntry) @Override public String key() { - return ""; + return String.format("%s;%s", PredictionEntry.DataType, PredictionEntry.ClassifierName); } @Override @@ -45,7 +45,6 @@ public List displayValues() List values = Lists.newArrayList(); values.add(format("%s", PredictionEntry.CancerType)); values.add(format("%.3f", PredictionEntry.DataValue)); - values.add(format("%s", PredictionEntry.ClassifierName)); return values; } @@ -56,6 +55,9 @@ public List displayValues() public boolean matches(final ComparableItem other) { final CuppaData otherCuppaData = (CuppaData) other; + + // Match by DataType in case we want to compare other DataTypes (e.g. 'feat_contrib' and 'sig_quantile') in the future + // Currently only support 'prob' DataType return otherCuppaData.PredictionEntry.DataType.equals(PredictionEntry.DataType) & otherCuppaData.PredictionEntry.ClassifierName.equals(PredictionEntry.ClassifierName); } @@ -69,7 +71,6 @@ public Mismatch findMismatch(final ComparableItem other, final MatchLevel matchL checkDiff(diffs, FLD_TOP_CANCER_TYPE, PredictionEntry.CancerType, otherCuppaData.PredictionEntry.CancerType); checkDiff(diffs, FLD_PROBABILITY, PredictionEntry.DataValue, otherCuppaData.PredictionEntry.DataValue, thresholds); - checkDiff(diffs, FLD_CLASSIFIER_NAME, PredictionEntry.ClassifierName.toString(), otherCuppaData.PredictionEntry.ClassifierName.toString()); return !diffs.isEmpty() ? new Mismatch(this, other, VALUE, diffs) : null; }