X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fext%2Frbvi%2Fchimera%2FJalviewChimeraBinding.java;h=3498f239ab9929b7d8f11ddd69808fbc2098ac99;hb=ec1c914a99011e20634fbff19df71e2627766dfd;hp=44bcbe40432599fdc0bfb3b3c6b059de7dd3e881;hpb=2d62933ef95beb94c1ec2444bcced4a3a7ec42c0;p=jalview.git diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index 44bcbe4..3498f23 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -40,6 +40,7 @@ import jalview.structure.StructureMappingcommandSet; import jalview.structure.StructureSelectionManager; import jalview.structures.models.AAStructureBindingModel; import jalview.util.MessageManager; +import jalview.util.StructureCommands; import java.awt.Color; import java.io.File; @@ -76,8 +77,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel private static final String ALPHACARBON = "CA"; - private List chainNames = new ArrayList<>(); - private Hashtable chainFile = new Hashtable<>(); /* @@ -648,37 +647,26 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel String progressMsg); /** - * Sends a set of colour commands to the structure viewer + * Constructs a set of colour commands and sends them to the structure viewer * - * @param colourBySequenceCommands + * @param viewPanel */ @Override - protected void colourBySequence( - StructureMappingcommandSet[] colourBySequenceCommands) + protected void colourBySequence(AlignmentViewPanel viewPanel) { - for (StructureMappingcommandSet cpdbbyseq : colourBySequenceCommands) + Map colourMap = StructureCommands + .buildColoursMap(this, viewPanel); + + String[] commands = ChimeraCommands + .getColourBySequenceCommand(colourMap, this); + + for (String command : commands) { - for (String command : cpdbbyseq.commands) - { - sendAsynchronousCommand(command, COLOURING_CHIMERA); - } + sendAsynchronousCommand(command, COLOURING_CHIMERA); } } /** - * @param files - * @param viewPanel - * @return - */ - @Override - protected StructureMappingcommandSet[] getColourBySequenceCommands( - String[] files, AlignmentViewPanel viewPanel) - { - return ChimeraCommands.getColourBySequenceCommand(files, viewPanel, - this); - } - - /** * @param command */ protected void executeWhenReady(String command) @@ -1021,20 +1009,9 @@ 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 - */ - @Override - public List getChainNames() - { - return chainNames; - } - - /** * Send a 'focus' command to Chimera to recentre the visible display */ + @Override public void focusView() { sendChimeraCommand("focus", false); @@ -1298,7 +1275,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel cmd.append("ribbon ").append(atomSpec); if (!isShowAlignmentOnly()) { - cmd.append("chain @CA|P; ribbon"); + cmd.append("; chain @CA|P"); } if (refocus) { @@ -1306,4 +1283,18 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel } sendChimeraCommand(cmd.toString(), false); } + + @Override + public int getModelForPdbFile(String fileName, int fileIndex) + { + if (chimeraMaps.containsKey(fileName)) + { + List models = chimeraMaps.get(fileName); + if (!models.isEmpty()) + { + return models.get(0).getModelNumber(); + } + } + return -1; + } }