From 776853458a1fc9713d2d9286944a7b627fdce50a Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 4 Jun 2015 14:01:27 +0100 Subject: [PATCH] JAL-1743 View Chain sub-menu now being populated --- src/jalview/gui/ChimeraViewFrame.java | 36 ++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) 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. * -- 1.7.10.2