From: Jim Procter Date: Thu, 23 May 2024 17:23:50 +0000 (+0100) Subject: JAL-4423 provide option in calc dialog to re-use the existing MSA rather than compute... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3d119bcaf73c4dbbb1a6c4899614001993b57466;p=jalview.git JAL-4423 provide option in calc dialog to re-use the existing MSA rather than compute pairwise alignments for pasimap --- diff --git a/src/jalview/analysis/PaSiMap.java b/src/jalview/analysis/PaSiMap.java index 86888ee..2d015ce 100755 --- a/src/jalview/analysis/PaSiMap.java +++ b/src/jalview/analysis/PaSiMap.java @@ -52,6 +52,8 @@ public class PaSiMap implements Runnable final private int openCost = 100; final private int extendCost = 5; + + boolean dontRealign = false; /* * outputs @@ -313,4 +315,9 @@ public class PaSiMap implements Runnable { return dim; } + + public void setDontRealign(boolean dontRealign) + { + this.dontRealign = dontRealign; + } } diff --git a/src/jalview/gui/CalculationChooser.java b/src/jalview/gui/CalculationChooser.java index 3775c47..c22c4ba 100644 --- a/src/jalview/gui/CalculationChooser.java +++ b/src/jalview/gui/CalculationChooser.java @@ -133,6 +133,8 @@ public class CalculationChooser extends JPanel private JCheckBox matchGaps; + private JCheckBox reuseAlignment; + private JCheckBox includeGappedColumns; private JCheckBox shorterSequence; @@ -308,6 +310,15 @@ public class CalculationChooser extends JPanel paramsPanel.add(shorterSequence); /* + * pasimap parameters + */ + reuseAlignment = new JCheckBox("Use aligned similarity"); + reuseAlignment.setSelected(false); + reuseAlignment.setVisible(false); + scoreModelPanel.add(reuseAlignment); + + + /* * OK / Cancel buttons */ calculate = new JButton(MessageManager.getString("action.calculate")); @@ -395,6 +406,7 @@ public class CalculationChooser extends JPanel boolean checkAverageDistance = checkEnabled(averageDistance, size, MIN_TREE_SELECTION); + reuseAlignment.setVisible(checkPasimap); if (checkPca || checkPasimap || checkNeighbourJoining || checkAverageDistance) { calculate.setToolTipText(null); @@ -771,6 +783,7 @@ public class CalculationChooser extends JPanel * construct the panel and kick off its calculation thread */ pasimapPanel = new PaSiMapPanel(af.alignPanel, modelName); + pasimapPanel.setUseAlignment(reuseAlignment.isSelected()); new Thread(pasimapPanel).start(); } diff --git a/src/jalview/gui/PaSiMapPanel.java b/src/jalview/gui/PaSiMapPanel.java index 4a2d19d..2b6bc14 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 boolean useObservedAlignment; + /** * Constructor given sequence data, a similarity (or distance) score model * name, and score calculation parameters @@ -132,7 +134,7 @@ public class PaSiMapPanel extends GPaSiMapPanel ScoreModelI scoreModel = ScoreModels.getInstance() .getScoreModel(modelName, ap); setPasimapModel( - new PaSiMapModel(av, seqs, nucleotide, scoreModel)); + new PaSiMapModel(av, seqs, nucleotide, useObservedAlignment, scoreModel)); PaintRefresher.Register(this, av.getSequenceSetId()); setRotatableCanvas(new RotatableCanvas(alignPanel)); @@ -215,6 +217,7 @@ public class PaSiMapPanel extends GPaSiMapPanel GAP_OPEN_COST, GAP_EXTEND_COST, false); System.out.println(pap != null); setPairwiseAlignPanel(pap); + getPasimapModel().setUseObservedAlignment(useObservedAlignment); getPasimapModel().calculate(pap); xCombobox.setSelectedIndex(0); @@ -879,4 +882,13 @@ public class PaSiMapPanel extends GPaSiMapPanel { return progressBar.getProgressBar(id); } + + /** + * enable or disable the pairwise alignment step + * @param selected + */ + public void setUseAlignment(boolean selected) + { + useObservedAlignment = selected; + } } diff --git a/src/jalview/viewmodel/PaSiMapModel.java b/src/jalview/viewmodel/PaSiMapModel.java index a0e5174..d2caa47 100644 --- a/src/jalview/viewmodel/PaSiMapModel.java +++ b/src/jalview/viewmodel/PaSiMapModel.java @@ -49,6 +49,8 @@ public class PaSiMapModel private ScoreModelI scoreModel; private boolean nucleotide = false; + + private boolean dontRealign = false; /* * outputs @@ -69,12 +71,13 @@ public class PaSiMapModel * @param modelName * @param params */ - public PaSiMapModel(AlignmentViewport seqData, SequenceI[] sqs, boolean nuc, + public PaSiMapModel(AlignmentViewport seqData, SequenceI[] sqs, boolean nuc, boolean dontRealign, ScoreModelI modelName) { inputData = seqData; seqs = sqs; nucleotide = nuc; + this.dontRealign = dontRealign; scoreModel = modelName; } @@ -85,6 +88,7 @@ public class PaSiMapModel public void calculate(PairwiseAlignPanel pap) { pasimap = new PaSiMap(inputData, scoreModel, pap); + pasimap.setDontRealign(dontRealign); pasimap.run(); // executes in same thread, wait for completion // Now find the component coordinates @@ -258,4 +262,9 @@ public class PaSiMapModel { pasimap = data; } + + public void setUseObservedAlignment(boolean useObservedAlignment) + { + dontRealign = useObservedAlignment; + } }