JAL-4114 only rank model qualities that are computed with the same method, and uprank...
authorJim Procter <j.procter@dundee.ac.uk>
Fri, 20 Jan 2023 17:53:48 +0000 (17:53 +0000)
committerJim Procter <j.procter@dundee.ac.uk>
Fri, 20 Jan 2023 17:54:51 +0000 (17:54 +0000)
src/jalview/gui/structurechooser/TDBResultAnalyser.java

index fcc1ffe..e817b26 100644 (file)
@@ -61,6 +61,8 @@ public class TDBResultAnalyser
 
   private int idx_mqual;
 
+  private int idx_mqualtype;
+
   private int idx_resol;
 
   /**
@@ -91,6 +93,7 @@ public class TDBResultAnalyser
     idx_mprov = lastTdbRequest.getFieldIndex("Provider");
     idx_mqual = lastTdbRequest.getFieldIndex("Confidence");
     idx_resol = lastTdbRequest.getFieldIndex("Resolution");
+    idx_mqualtype = lastTdbRequest.getFieldIndex("Confidence Score Type");
   }
 
   /**
@@ -168,6 +171,8 @@ public class TDBResultAnalyser
         int o2_cat = scoreCategory((String) o2data[idx_mcat]);
         String o2_prov = ((String) o2data[idx_mprov])
                 .toUpperCase(Locale.ROOT);
+        String o1_qualtype = (String) o1data[idx_mqualtype],
+                o2_qualtype = (String) o2data[idx_mqualtype];
 
         if (o1_cat == o2_cat)
         {
@@ -209,6 +214,19 @@ public class TDBResultAnalyser
               }
               else
               {
+                // RANK ON QUALITY - DOWNRANK THOSE WITH NO QUALITY MEASURE
+                if (eitherNull(idx_mqualtype, o1data, o2data))
+                {
+                  return nonNullFirst(idx_mqualtype, o1data, o2data);
+                }
+                // ONLY COMPARE LIKE QUALITY SCORES
+                if (!o1_qualtype.equals(o2_qualtype))
+                {
+                  // prefer LDDT measure over others
+                  return "pLDDT".equals(o1_prov) ? -1
+                          : "pLDDT".equals(o2_prov) ? 1 : 0;
+                }
+                // OR NO VALUE FOR THE QUALITY
                 if (eitherNull(idx_mqual, o1data, o2data))
                 {
                   return nonNullFirst(idx_mqual, o1data, o2data);