From: gmungoc Date: Thu, 4 Jun 2015 13:01:27 +0000 (+0100) Subject: JAL-1743 View Chain sub-menu now being populated X-Git-Tag: Release_2_10_0~636 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=776853458a1fc9713d2d9286944a7b627fdce50a;p=jalview.git JAL-1743 View Chain sub-menu now being populated --- diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index fdc7d0b..a803c40 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -328,8 +328,10 @@ public class ChimeraViewFrame extends StructureViewerBase { createProgressBar(); + String[][] chains = extractChains(seqs); jmb = new JalviewChimeraBindingModel(this, - ap.getStructureSelectionManager(), pdbentrys, seqs, null, null); + ap.getStructureSelectionManager(), pdbentrys, seqs, chains, + null); addAlignmentPanel(ap); useAlignmentPanelForColourbyseq(ap); if (pdbentrys.length > 1) @@ -356,6 +358,38 @@ public class ChimeraViewFrame extends StructureViewerBase } /** + * Retrieve chains for sequences by inspecting their PDB refs. The hope is + * that the first will be to the sequence's own chain. Really need a more + * managed way of doing this. + * + * @param seqs + * @return + */ + protected String[][] extractChains(SequenceI[][] seqs) + { + String[][] chains = new String[seqs.length][]; + for (int i = 0; i < seqs.length; i++) + { + chains[i] = new String[seqs[i].length]; + int seqno = 0; + for (SequenceI seq : seqs[i]) + { + String chain = null; + if (seq.getDatasetSequence() != null) + { + Vector pdbrefs = seq.getDatasetSequence().getPDBId(); + if (pdbrefs != null && pdbrefs.size() > 0) + { + chain = pdbrefs.get(0).getChainCode(); + } + } + chains[i][seqno++] = chain; + } + } + return chains; + } + + /** * create a new viewer containing several structures superimposed using the * given alignPanel. *