X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPCAPanel.java;h=ea4f44e2f7bc3ab40aee3dd63439053f70fbba44;hb=0b23947e2cdcd704d3f313b23ba271e43d097344;hp=371528aa9fcf5d46fa583c3594f803330dfc116f;hpb=ddf4180014d2316824c4ecd4bcbbe20be4033d43;p=jalview.git diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 371528a..ea4f44e 100755 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -44,7 +44,7 @@ public class PCAPanel extends GPCAPanel implements Runnable int top; RotatableCanvas rc; AlignViewport av; - String [] seqstrings; + AlignmentView seqstrings; SequenceI [] seqs; /** @@ -59,9 +59,8 @@ public class PCAPanel extends GPCAPanel implements Runnable boolean sameLength = true; - seqstrings = av.getSelectionAsString(); - - if (av.getSelectionGroup() == null) + seqstrings = av.getAlignmentView(av.getSelectionGroup()!=null); + if(av.getSelectionGroup()==null) { seqs = av.alignment.getSequencesArray(); } @@ -69,12 +68,12 @@ public class PCAPanel extends GPCAPanel implements Runnable { seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment); } - - int length = seqs[0].getLength(); + SeqCigar sq[]=seqstrings.getSequences(); + int length = sq[0].getWidth(); for (int i = 0; i < seqs.length; i++) { - if (seqs[i].getLength() != length) + if (sq[i].getWidth() != length) { sameLength = false; break; @@ -123,7 +122,7 @@ public class PCAPanel extends GPCAPanel implements Runnable public void run() { try{ - pca = new PCA(seqstrings); + pca = new PCA(seqstrings.getSequenceStrings(' ')); pca.run(); // Now find the component coordinates @@ -257,18 +256,62 @@ public class PCAPanel extends GPCAPanel implements Runnable public void originalSeqData_actionPerformed(ActionEvent e) { - CutAndPasteTransfer cap = new CutAndPasteTransfer(); - for (int i = 0; i < seqs.length; i++) + // this was cut'n'pasted from the equivalent TreePanel method - we should make this an abstract function of all jalview analysis windows + if (seqstrings==null) { - cap.appendText(new jalview.util.Format("%-" + 15 + "s").form( - seqs[i].getName())); - cap.appendText(" " + seqstrings[i] + "\n"); - + jalview.bin.Cache.log.info("Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action."); + return; } + // 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 yields unaligned seqs) + // or create a selection box around columns in alignment view + // test Alignment(SeqCigar[]) + Object[] alAndColsel = seqstrings.getAlignmentAndColumnSelection(av. + getGapCharacter()); + + + if (alAndColsel != null && alAndColsel[0]!=null) + { + // AlignmentOrder origorder = new AlignmentOrder(alAndColsel[0]); + + Alignment al = new Alignment((SequenceI[]) alAndColsel[0]); + Alignment dataset = av.getAlignment().getDataset(); + if (dataset != null) + { + al.setDataset(dataset); + } + + if (true) + { + // make a new frame! + AlignFrame af = new AlignFrame(al, (ColumnSelection) alAndColsel[1], + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT +); + + //>>>This is a fix for the moment, until a better solution is found!!<<< + // af.getFeatureRenderer().transferSettings(alignFrame.getFeatureRenderer()); + + // af.addSortByOrderMenuItem(ServiceName + " Ordering", + // msaorder); + + Desktop.addInternalFrame(af, "Original Data for " + this.title, + AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); + } + } + /* CutAndPasteTransfer cap = new CutAndPasteTransfer(); + for (int i = 0; i < seqs.length; i++) + { + cap.appendText(new jalview.util.Format("%-" + 15 + "s").form( + seqs[i].getName())); + cap.appendText(" " + seqstrings[i] + "\n"); - Desktop.addInternalFrame(cap, "Original Data", - 400, 400); + } + Desktop.addInternalFrame(cap, "Original Data", + 400, 400); + */ }