From: gmungoc Date: Mon, 7 May 2018 09:22:56 +0000 (+0100) Subject: JAL-1767 JAL-2647 hide 'Input Data..' for PCA loaded from project X-Git-Tag: Release_2_11_1_0~78^2~9^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=88e9d982ef43c740e3f29b34156f4f57836a84e3;p=jalview.git JAL-1767 JAL-2647 hide 'Input Data..' for PCA loaded from project --- diff --git a/src/jalview/appletgui/PCAPanel.java b/src/jalview/appletgui/PCAPanel.java index 105aa78..7c0dfa9 100644 --- a/src/jalview/appletgui/PCAPanel.java +++ b/src/jalview/appletgui/PCAPanel.java @@ -279,7 +279,7 @@ public class PCAPanel extends EmbmenuFrame { } ; - Object[] alAndColsel = pcaModel.getSeqtrings() + Object[] alAndColsel = pcaModel.getInputData() .getAlignmentAndHiddenColumns(gc); if (alAndColsel != null && alAndColsel[0] != null) diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index c725db8..e4a53ef 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -5961,6 +5961,11 @@ public class Jalview2XML panel.pcaModel.setPCA(pca); /* + * we haven't saved the input data! (JAL-2647 to do) + */ + panel.setInputData(null); + + /* * add the sequence points for the PCA display */ List seqPoints = new ArrayList<>(); diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 2ecdb82..f0ba274 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -277,12 +277,15 @@ public class PCAPanel extends GPCAPanel printer.start(); } + /** + * If available, shows the data which formed the inputs for the PCA as a new + * alignment + */ @Override public void originalSeqData_actionPerformed() { - // this was cut'n'pasted from the equivalent TreePanel method - we should - // make this an abstract function of all jalview analysis windows - if (pcaModel.getSeqtrings() == null) + // JAL-2647 disabled after load from project (until save to project done) + if (pcaModel.getInputData() == null) { Cache.log.info( "Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action."); @@ -290,7 +293,7 @@ public class PCAPanel extends GPCAPanel } // decide if av alignment is sufficiently different to original data to // warrant a new window to be created - // create new alignmnt window with hidden regions (unhiding hidden regions + // create new alignment window with hidden regions (unhiding hidden regions // yields unaligned seqs) // or create a selection box around columns in alignment view // test Alignment(SeqCigar[]) @@ -304,7 +307,7 @@ public class PCAPanel extends GPCAPanel { } - Object[] alAndColsel = pcaModel.getSeqtrings() + Object[] alAndColsel = pcaModel.getInputData() .getAlignmentAndHiddenColumns(gc); if (alAndColsel != null && alAndColsel[0] != null) @@ -726,4 +729,17 @@ public class PCAPanel extends GPCAPanel { showLabels.setSelected(show); } + + /** + * Sets the input data used to calculate the PCA. This is provided for + * 'restore from project', which does not currently support this (AL-2647), so + * sets the value to null, and hides the menu option for "Input Data...". J + * + * @param data + */ + public void setInputData(AlignmentView data) + { + pcaModel.setInputData(data); + originalSeqData.setVisible(data != null); + } } diff --git a/src/jalview/jbgui/GPCAPanel.java b/src/jalview/jbgui/GPCAPanel.java index bd45bc2..122ad0f 100755 --- a/src/jalview/jbgui/GPCAPanel.java +++ b/src/jalview/jbgui/GPCAPanel.java @@ -62,6 +62,8 @@ public class GPCAPanel extends JInternalFrame protected JPanel statusPanel = new JPanel(); + protected JMenuItem originalSeqData; + /** * Constructor */ @@ -238,7 +240,7 @@ public class GPCAPanel extends JInternalFrame bgcolour_actionPerformed(); } }); - JMenuItem originalSeqData = new JMenuItem(); + originalSeqData = new JMenuItem(); originalSeqData.setText(MessageManager.getString("label.input_data")); originalSeqData.addActionListener(new ActionListener() { diff --git a/src/jalview/viewmodel/PCAModel.java b/src/jalview/viewmodel/PCAModel.java index a4f57be..1693294 100644 --- a/src/jalview/viewmodel/PCAModel.java +++ b/src/jalview/viewmodel/PCAModel.java @@ -37,7 +37,7 @@ public class PCAModel /* * inputs */ - private final AlignmentView seqstrings; + private AlignmentView inputData; private final SequenceI[] seqs; @@ -72,7 +72,7 @@ public class PCAModel public PCAModel(AlignmentView seqData, SequenceI[] sqs, boolean nuc, ScoreModelI modelName, SimilarityParamsI params) { - seqstrings = seqData; + inputData = seqData; seqs = sqs; nucleotide = nuc; scoreModel = modelName; @@ -85,7 +85,7 @@ public class PCAModel */ public void calculate() { - pca = new PCA(seqstrings, scoreModel, similarityParams); + pca = new PCA(inputData, scoreModel, similarityParams); pca.run(); // executes in same thread, wait for completion // Now find the component coordinates @@ -166,9 +166,14 @@ public class PCAModel return pca.getDetails(); } - public AlignmentView getSeqtrings() + public AlignmentView getInputData() { - return seqstrings; + return inputData; + } + + public void setInputData(AlignmentView data) + { + inputData = data; } public String getPointsasCsv(boolean transformed, int xdim, int ydim,