From af4a464ed5537d777ec821929704e9169d8fba9e Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 25 Sep 2012 15:21:04 +0100 Subject: [PATCH] JAL-1031 JAL-1032 if selection is non-null but empty, then calculate PCA or tree over whole view --- src/jalview/appletgui/PCAPanel.java | 5 +++-- src/jalview/appletgui/TreePanel.java | 8 +++++--- src/jalview/gui/AlignFrame.java | 2 +- src/jalview/gui/PCAPanel.java | 6 +++--- src/jalview/gui/TreePanel.java | 8 +++++--- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/jalview/appletgui/PCAPanel.java b/src/jalview/appletgui/PCAPanel.java index 44711d7..ff8b506 100755 --- a/src/jalview/appletgui/PCAPanel.java +++ b/src/jalview/appletgui/PCAPanel.java @@ -55,11 +55,12 @@ public class PCAPanel extends EmbmenuFrame implements Runnable, } this.av = av; + boolean selected=av.getSelectionGroup()!=null && av.getSelectionGroup().getSize()>0; AlignmentView seqstrings = av - .getAlignmentView(av.getSelectionGroup() != null); + .getAlignmentView(selected); boolean nucleotide = av.getAlignment().isNucleotide(); SequenceI[] seqs; - if (av.getSelectionGroup() == null) + if (!selected) { seqs = av.getAlignment().getSequencesArray(); } diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java index aa57908..ec2512f 100644 --- a/src/jalview/appletgui/TreePanel.java +++ b/src/jalview/appletgui/TreePanel.java @@ -199,9 +199,11 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, { int start, end; SequenceI[] seqs; - AlignmentView seqStrings = av.getAlignmentView(av - .getSelectionGroup() != null); - if (av.getSelectionGroup() == null) + boolean selview=(av + .getSelectionGroup() != null) && (av + .getSelectionGroup().getSize()>1); + AlignmentView seqStrings = av.getAlignmentView(selview); + if (!selview) { start = 0; end = av.getAlignment().getWidth(); diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 8396e6a..39884ce 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -3668,7 +3668,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { TreePanel tp; - if (viewport.getSelectionGroup() != null) + if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup().getSize()>0) { if (viewport.getSelectionGroup().getSize() < 3) { diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index ad7d1fd..bafacc5 100755 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -63,12 +63,12 @@ public class PCAPanel extends GPCAPanel implements Runnable, this.ap = ap; boolean sameLength = true; - + boolean selected=av.getSelectionGroup()!=null && av.getSelectionGroup().getSize()>0; AlignmentView seqstrings = av - .getAlignmentView(av.getSelectionGroup() != null); + .getAlignmentView(selected); boolean nucleotide = av.getAlignment().isNucleotide(); SequenceI[] seqs; - if (av.getSelectionGroup() == null) + if (!selected) { seqs = av.getAlignment().getSequencesArray(); } diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 14802e7..60557ca 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -273,9 +273,11 @@ public class TreePanel extends GTreePanel { int start, end; SequenceI[] seqs; - AlignmentView seqStrings = av.getAlignmentView(av - .getSelectionGroup() != null); - if (av.getSelectionGroup() == null) + boolean selview=av + .getSelectionGroup() != null & av + .getSelectionGroup().getSize()>1; + AlignmentView seqStrings = av.getAlignmentView(selview); + if (!selview) { start = 0; end = av.getAlignment().getWidth(); -- 1.7.10.2