From: jprocter Date: Sat, 9 Jul 2011 11:12:47 +0000 (+0100) Subject: refactored from PopupMenu (for JAL-860) X-Git-Tag: Release_2_7~139 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1b3b9ada9b959de9d66b1d477bb155a0c6668c8e;p=jalview.git refactored from PopupMenu (for JAL-860) --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index e9b0873..b658ffb 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -4517,10 +4517,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, int l = 0, c = pdbfn.indexOf("."); while (mtch == null && c != -1) { - while ((c = pdbfn.indexOf(".", l)) > l) + do { l = c; - } + } while ((c = pdbfn.indexOf(".", l)) > l); if (l > -1) { pdbfn = pdbfn.substring(0, l); diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index af3ab95..26fb890 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -2248,4 +2248,38 @@ public class AlignViewport implements SelectionSource, VamsasSource { return StructureSelectionManager.getStructureSelectionManager(Desktop.instance); } + + /** + * + * @param pdbEntries + * @return a series of SequenceI arrays, one for each PDBEntry, listing which sequence in the alignment holds a reference to it + */ + public SequenceI[][] collateForPDB(PDBEntry[] pdbEntries) + { + ArrayList seqvectors = new ArrayList(); + for (PDBEntry pdb: pdbEntries) { + ArrayList seqs = new ArrayList(); + for (int i = 0; i < alignment.getHeight(); i++) + { + Vector pdbs = alignment.getSequenceAt(i) + .getDatasetSequence().getPDBId(); + if (pdbs == null) + continue; + SequenceI sq; + for (int p = 0; p < pdbs.size(); p++) + { + PDBEntry p1 = (PDBEntry) pdbs.elementAt(p); + if (p1.getId().equals(pdb.getId())) + { + if (!seqs.contains(sq=alignment.getSequenceAt(i))) + seqs.add(sq); + + continue; + } + } + } + seqvectors.add(seqs.toArray(new SequenceI[seqs.size()])); + } + return seqvectors.toArray(new SequenceI[seqvectors.size()][]); + } }