From a51b5f709d28d8a25a3c2c4596cbe086aa34ea43 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 7 Aug 2024 17:16:25 +0100 Subject: [PATCH] JAL-4447 standardised title formula for reporting score model and other parameters for pairwise alignment, PCA, tree, and Pasimap --- src/jalview/gui/AlignFrame.java | 8 ++++---- src/jalview/gui/CalculationChooser.java | 9 ++++++--- src/jalview/gui/PCAPanel.java | 11 ++++++++--- src/jalview/gui/PaSiMapPanel.java | 11 +++++++++-- src/jalview/gui/PairwiseAlignPanel.java | 2 +- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 7f6646f..797e7ec 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -3963,7 +3963,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, tp = new TreePanel(alignPanel, type, modelName, options); - frameTitle = formCalculationTitle(tp.getPanelTitle(),onSelection, viewport.getViewName(),this.title); + frameTitle = formCalculationTitle(tp.getPanelTitle(),onSelection,this.title); Desktop.addInternalFrame(tp, frameTitle, 600, 500); } @@ -3976,8 +3976,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, * @param title - alignment frame title * @return (?on region) from (?viewName of) alignment name */ - private String formCalculationTitle(String panelTitle, - boolean onSelection, String viewName, String title) + public String formCalculationTitle(String panelTitle, + boolean onSelection, String title) { String frameTitle = panelTitle; @@ -3985,7 +3985,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, frameTitle += " from "; - if (viewName!=null) + if (viewport.getViewName()!=null) { frameTitle += viewport.getViewName() + " of "; } diff --git a/src/jalview/gui/CalculationChooser.java b/src/jalview/gui/CalculationChooser.java index 711cac8..bd3c960 100644 --- a/src/jalview/gui/CalculationChooser.java +++ b/src/jalview/gui/CalculationChooser.java @@ -749,13 +749,16 @@ public class CalculationChooser extends JPanel @Override public void run() { + String pairwise_alignment_title = af.formCalculationTitle( + MessageManager.getString("action.pairwise_alignment") + + " with " + sm.getName(), + af.getViewport().getSelectionGroup() != null, + af.getTitle()); JInternalFrame frame = new JInternalFrame(); frame.setFrameIcon(null); frame.setContentPane( new PairwiseAlignPanel(af.getViewport(), (ScoreMatrix) sm)); - Desktop.addInternalFrame(frame, - MessageManager.getString("action.pairwise_alignment"), 600, - 500); + Desktop.addInternalFrame(frame, pairwise_alignment_title, 600, 500); } }).start(); } diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 3f103e2..570fc5d 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -82,6 +82,7 @@ public class PCAPanel extends GPCAPanel private boolean working; + String newPcaTitle = null; /** * Constructor given sequence data, a similarity (or distance) score model * name, and score calculation parameters @@ -127,6 +128,12 @@ public class PCAPanel extends GPCAPanel .getScoreModel(modelName, ap); setPcaModel( new PCAModel(seqstrings, seqs, nucleotide, scoreModel, params)); + + newPcaTitle = alignPanel.alignFrame.formCalculationTitle( + MessageManager.formatMessage("label.calc_title", "PCA", + getPcaModel().getScoreModelName()), + selected, ap.alignFrame.getTitle()); + PaintRefresher.Register(this, av.getSequenceSetId()); setRotatableCanvas(new RotatableCanvas(alignPanel)); @@ -209,9 +216,7 @@ public class PCAPanel extends GPCAPanel repaint(); if (getParent() == null) { - Desktop.addInternalFrame(this, - MessageManager.formatMessage("label.calc_title", "PCA", - getPcaModel().getScoreModelName()), + Desktop.addInternalFrame(this, newPcaTitle, 475, 450); this.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); } diff --git a/src/jalview/gui/PaSiMapPanel.java b/src/jalview/gui/PaSiMapPanel.java index bf965a5..bb7bf11 100644 --- a/src/jalview/gui/PaSiMapPanel.java +++ b/src/jalview/gui/PaSiMapPanel.java @@ -92,6 +92,8 @@ public class PaSiMapPanel extends GPaSiMapPanel private boolean working; + private String newPasimapTitle; + /** * Constructor given sequence data, a similarity (or distance) score model * name, and score calculation parameters @@ -132,6 +134,12 @@ public class PaSiMapPanel extends GPaSiMapPanel ScoreModelI scoreModel = ScoreModels.getInstance() .getScoreModel(modelName, ap); setPasimapModel(new PaSiMapModel(av, seqs, nucleotide, scoreModel)); + + newPasimapTitle = alignPanel.alignFrame.formCalculationTitle( + MessageManager.formatMessage("label.calc_title", "PaSiMap", + scoreModel.getName()), + selected, ap.alignFrame.getTitle()); + PaintRefresher.Register(this, av.getSequenceSetId()); setRotatableCanvas(new RotatableCanvas(alignPanel)); @@ -266,8 +274,7 @@ public class PaSiMapPanel extends GPaSiMapPanel if (!getPasimapModel().isCancelled() && getParent() == null) { Desktop.addInternalFrame(this, - MessageManager.formatMessage("label.calc_title", "PaSiMap", - ap.alignFrame.getTitle()), + newPasimapTitle, 475, 450); this.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); } diff --git a/src/jalview/gui/PairwiseAlignPanel.java b/src/jalview/gui/PairwiseAlignPanel.java index e9b5ffa..bffaec5 100755 --- a/src/jalview/gui/PairwiseAlignPanel.java +++ b/src/jalview/gui/PairwiseAlignPanel.java @@ -335,7 +335,7 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel double totscore) { System.out - .println("Pairwise alignment scaled similarity score matrix"+getPairwiseSimscoresAsString()+"\n"); + .println("Pairwise alignment scaled similarity score matrix "+getPairwiseSimscoresAsString()+"\n"); for (int i = 0; i < seqs.length; i++) { -- 1.7.10.2