JAL-4159 peek in a Jalview project's PCA viewer's title to decide if it is a "pasimap...
authorJim Procter <jprocter@dundee.ac.uk>
Fri, 24 May 2024 15:18:49 +0000 (16:18 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Fri, 24 May 2024 15:18:49 +0000 (16:18 +0100)
src/jalview/project/Jalview2XML.java

index 1b458ad..f304d03 100644 (file)
@@ -1435,14 +1435,14 @@ public class Jalview2XML
             savePCA(panel, object);
           }
         }
-       if (frame instanceof PaSiMapPanel)
-       {
-         PaSiMapPanel panel = (PaSiMapPanel) frame;
-         if (panel.getAlignViewport().getAlignment() == jal)
-         {
-           savePaSiMap(panel, object);
-         }
-       }
+        if (frame instanceof PaSiMapPanel)
+        {
+          PaSiMapPanel panel = (PaSiMapPanel) frame;
+          if (panel.getAlignViewport().getAlignment() == jal)
+          {
+            savePaSiMap(panel, object);
+          }
+        }
       }
     }
 
@@ -1997,6 +1997,7 @@ public class Jalview2XML
    */
   protected void savePaSiMap(PaSiMapPanel panel, JalviewModel object)
   {
+    // TODO: this should be merged with above savePCAPanel - otherwise it is essentially redundant code
     try
     {
       PcaViewer viewer = new PcaViewer();
@@ -2028,7 +2029,8 @@ public class Jalview2XML
       viewer.setShowLabels(panel.getRotatableCanvas().isShowLabels());
       viewer.setLinkToAllViews(
               panel.getRotatableCanvas().isApplyToAllViews());
-      /*
+      /* NOT FOR PASIMAP CALCULATIONS
+       * 
       SimilarityParamsI sp = pasimapModel.getSimilarityParameters();
       viewer.setIncludeGaps(sp.includeGaps());
       viewer.setMatchGaps(sp.matchGaps());
@@ -6592,6 +6594,10 @@ public class Jalview2XML
       List<PcaViewer> pcaviewers = model.getPcaViewer();
       for (PcaViewer viewer : pcaviewers)
       {
+        if (isPasimap(viewer))
+        {
+          continue;
+        }
         String modelName = viewer.getScoreModelName();
         SimilarityParamsI params = new SimilarityParams(
                 viewer.isIncludeGappedColumns(), viewer.isMatchGaps(),
@@ -6701,6 +6707,11 @@ public class Jalview2XML
     }
   }
 
+  private boolean isPasimap(PcaViewer viewer)
+  {
+    return viewer.getTitle().toLowerCase(Locale.ROOT)
+    .startsWith("pasimap");
+  }
   /**
    * Loads any saved PaSiMAp viewers using the function from PCA
    * 
@@ -6714,6 +6725,10 @@ public class Jalview2XML
       List<PcaViewer> pcaviewers = model.getPcaViewer();
       for (PcaViewer viewer : pcaviewers)
       {
+        if (!isPasimap(viewer))
+        {
+          continue;
+        }
         String modelName = viewer.getScoreModelName();
         /*
         SimilarityParamsI params = new SimilarityParams(