X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Frbvi%2Fchimera%2FJalviewChimeraBinding.java;fp=src%2Fjalview%2Fext%2Frbvi%2Fchimera%2FJalviewChimeraBinding.java;h=327d787a4898aecde131f5d9232d547fa3d71258;hb=260f6abfaaafac067d5bda703e5b21be480bcc8f;hp=501e34550923c97a273c9f1873f372f1beaa6bd3;hpb=ee778ac34b35c8d8fef03f1f3a58efb7d5be650a;p=jalview.git diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index 501e345..327d787 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -41,6 +41,7 @@ import jalview.util.MessageManager; import java.awt.Color; import java.net.BindException; import java.util.ArrayList; +import java.util.Hashtable; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -64,6 +65,10 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel private static final String ALPHACARBON = "CA"; + private List chainNames = new ArrayList(); + + private Hashtable chainFile = new Hashtable(); + /* * Object through which we talk to Chimera */ @@ -194,10 +199,9 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel * @param protocol */ public JalviewChimeraBinding(StructureSelectionManager ssm, - PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains, - String protocol) + PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String protocol) { - super(ssm, pdbentry, sequenceIs, chains, protocol); + super(ssm, pdbentry, sequenceIs, protocol); viewer = new ChimeraManager(new StructureManager(true)); } @@ -277,11 +281,14 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel boolean first = true; for (String chain : toshow) { + int modelNumber = getModelNoForChain(chain); + String showChainCmd = modelNumber == -1 ? "" : modelNumber + ":." + + chain.split(":")[1]; if (!first) { cmd.append(","); } - cmd.append(":.").append(chain); + cmd.append(showChainCmd); first = false; } @@ -290,7 +297,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel * window, but it looks more helpful not to (easier to relate chains to the * whole) */ - final String command = "~display #*; ~ribbon #*; ribbon " + final String command = "~display #*; ~ribbon #*; ribbon :" + cmd.toString(); sendChimeraCommand(command, false); } @@ -801,18 +808,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel { return new String[0]; } - // if (modelFileNames == null) - // { - // Collection chimodels = viewer.getChimeraModels(); - // _modelFileNameMap = new int[chimodels.size()]; - // int j = 0; - // for (ChimeraModel chimodel : chimodels) - // { - // String mdlName = chimodel.getModelName(); - // } - // modelFileNames = new String[j]; - // // System.arraycopy(mset, 0, modelFileNames, 0, j); - // } return chimeraMaps.keySet().toArray( modelFileNames = new String[chimeraMaps.size()]); @@ -1105,35 +1100,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel } /** - * Returns a list of chains mapped in this viewer. Note this list is not - * currently scoped per structure. - * - * @return - */ - public List getChainNames() - { - List names = new ArrayList(); - String[][] allNames = getChains(); - if (allNames != null) - { - for (String[] chainsForPdb : allNames) - { - if (chainsForPdb != null) - { - for (String chain : chainsForPdb) - { - if (chain != null && !names.contains(chain)) - { - names.add(chain); - } - } - } - } - } - return names; - } - - /** * Send a 'focus' command to Chimera to recentre the visible display */ public void focusView() @@ -1168,4 +1134,30 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel sm.highlightStructure(this, seq, positions); } } + + @Override + public List getChainNames() + { + return chainNames; + } + + public Hashtable getChainFile() + { + return chainFile; + } + + public List getChimeraModelByChain(String chain) + { + return chimeraMaps.get(chainFile.get(chain)); + } + + public int getModelNoForChain(String chain) + { + List foundModels = getChimeraModelByChain(chain); + if (foundModels != null && !foundModels.isEmpty()) + { + return foundModels.get(0).getModelNumber(); + } + return -1; + } }