From 8b54e964e6e3b724fb6c4453d7a401aefa03f4a6 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 24 May 2024 16:18:49 +0100 Subject: [PATCH] JAL-4159 peek in a Jalview project's PCA viewer's title to decide if it is a "pasimap" viewer or some other Pcaviewer... --- src/jalview/project/Jalview2XML.java | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index 1b458ad..f304d03 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -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 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 pcaviewers = model.getPcaViewer(); for (PcaViewer viewer : pcaviewers) { + if (!isPasimap(viewer)) + { + continue; + } String modelName = viewer.getScoreModelName(); /* SimilarityParamsI params = new SimilarityParams( -- 1.7.10.2