X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Fjmol%2FJalviewJmolBinding.java;h=8cecf6eba5f3d47abb24fbe2590fd6c5003df90f;hb=6bf5604d306cbcd55289639967411ddbafcac682;hp=d3177228ff0cf05ca2b3e7c83231718856fbdf8c;hpb=e34c8452beda2cf80c2a3224f236d3096db69ae9;p=jalview.git diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index d317722..8cecf6e 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -27,13 +27,13 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.HiddenColumns; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; +import jalview.ext.rbvi.chimera.AtomSpecModel; import jalview.gui.IProgressIndicator; import jalview.io.DataSourceType; import jalview.io.StructureFile; import jalview.schemes.ColourSchemeI; import jalview.schemes.ResidueProperties; import jalview.structure.AtomSpec; -import jalview.structure.StructureMappingcommandSet; import jalview.structure.StructureSelectionManager; import jalview.structures.models.AAStructureBindingModel; import jalview.util.MessageManager; @@ -476,14 +476,14 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } Thread colourby = null; + /** * Sends a set of colour commands to the structure viewer * - * @param colourBySequenceCommands + * @param commands */ @Override - protected void colourBySequence( - final StructureMappingcommandSet[] colourBySequenceCommands) + protected void colourBySequence(final String[] commands) { if (colourby != null) { @@ -495,12 +495,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel @Override public void run() { - for (StructureMappingcommandSet cpdbbyseq : colourBySequenceCommands) + for (String cmd : commands) { - for (String cbyseq : cpdbbyseq.commands) - { - executeWhenReady(cbyseq); - } + executeWhenReady(cmd); } } }); @@ -513,11 +510,12 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel * @return */ @Override - protected StructureMappingcommandSet[] getColourBySequenceCommands( + protected String[] getColourBySequenceCommands( String[] files, AlignmentViewPanel viewPanel) { - return JmolCommands.getColourBySequenceCommand(getSsm(), files, - this, viewPanel); + Map map = buildColoursMap(viewPanel); + + return JmolCommands.getColourBySequenceCommand(map); } /** @@ -1417,7 +1415,36 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel @Override public void showStructures(AlignViewportI av, boolean refocus) { - // TODO show Jmol structure optionally restricted to visible alignment - // and/or selected chains + StringBuilder cmd = new StringBuilder(128); + + if (isShowAlignmentOnly()) + { + cmd.append("hide *;"); + + AtomSpecModel model = getShownResidues(av); + String atomSpec = JmolCommands.getAtomSpec(model); + + cmd.append("display ").append(atomSpec); + } + else + { + cmd.append("display *"); + } + cmd.append("; cartoon"); + if (refocus) + { + cmd.append("; zoom 100"); + } + evalStateCommand(cmd.toString()); + } + + /** + * Answers a Jmol syntax style structure model specification. Model number 0, 1, + * 2... is formatted as "1.1", "2.1", "3.1" etc. + */ + @Override + public String getModelSpec(int model) + { + return String.valueOf(model + 1) + ".1"; } }