X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignViewport.java;h=2e1a4e0251b169ff68777dbcd96b75fcc2984d90;hb=621a628afc1f6ee7a2778b9d0ae2729b88fe5bfd;hp=d4ba5eae69dad4b57ff26efb783afb33910bd380;hpb=bd56b8fb21d730b15bb759c529990d244cafbe37;p=jalview.git diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index d4ba5ea..2e1a4e0 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -1133,8 +1133,116 @@ public class AlignViewport hasHiddenRows = false; } + public void showAllHiddenSeqs() + { + alignment.getHiddenSequences().showAll(); + hasHiddenRows = false; + } + public int adjustForHiddenSeqs(int alignmentIndex) { return alignment.getHiddenSequences().adjustForHiddenSeqs(alignmentIndex); } + + /** + * This method returns the a new SequenceI [] with + * the selection sequence and start and end points adjusted + * @return String[] + */ + public SequenceI[] getSelectionAsNewSequence() + { + SequenceI[] sequences; + + if (selectionGroup == null) + sequences = alignment.getSequencesArray(); + else + sequences = selectionGroup.getSelectionAsNewSequences(alignment); + + return sequences; + } + + + /** + * This method returns the visible selected area as text, as + * seen on the GUI, ie if columns are hidden they will not + * be returned in the result. + * Use this for calculating trees, PCA, redundancy etc on views + * which contain hidden columns. + * @return String[] + */ + public String [] getSelectionAsString() + { + String [] selection = null; + SequenceI [] seqs= null; + int i, iSize; + int start = 0, end = 0; + if(selectionGroup!=null) + { + iSize = selectionGroup.getSize(false); + seqs = selectionGroup.getSequencesInOrder(alignment); + start = selectionGroup.getStartRes(); + end = selectionGroup.getEndRes()+1; + } + else + { + iSize = alignment.getHeight(); + seqs = alignment.getSequencesArray(); + end = alignment.getWidth(); + } + + selection = new String[iSize]; + + + for(i=0; iblockEnd) + { + break; + } + + + visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd)); + + blockStart = hideEnd+1; + blockEnd = end; + } + + if(end>blockStart) + visibleSeq.append(seqs[i].getSequence(blockStart, end)); + + selection[i] = visibleSeq.toString(); + } + else + { + selection[i] = seqs[i].getSequence(start, end); + } + + // System.out.println(seqs[i].getName()+"\t"+ selection[i]); + } + + return selection; + } }