1 package jalview.structure;
8 * Methods that generate commands that can be sent to a molecular structure
9 * viewer program (e.g. Jmol, Chimera, ChimeraX)
14 public interface StructureCommandsI
17 * Returns the command to colour by chain
21 StructureCommandI colourByChain();
24 * Returns the command to colour residues using a charge-based scheme:
26 * <li>Aspartic acid and Glutamic acid (negative charge) red</li>
27 * <li>Lysine and Arginine (positive charge) blue</li>
28 * <li>Cysteine - yellow</li>
29 * <li>all others - white</li>
34 List<StructureCommandI> colourByCharge();
37 * Returns the command to colour residues with the colours provided in the
38 * map, one per three letter residue code
43 List<StructureCommandI> colourByResidues(Map<String, Color> colours);
46 * Returns the command to set the background colour of the structure viewer
51 StructureCommandI setBackgroundColour(Color col);
54 * Returns commands to colour mapped residues of structures according to
55 * Jalview's colouring (including feature colouring if applied). Parameter is
56 * a map from Color to a model of all residues assigned that colour.
62 List<StructureCommandI> colourBySequence(
63 Map<Object, AtomSpecModel> colourMap);
66 * Returns a command to centre the display in the structure viewer
70 StructureCommandI focusView();
73 * Returns a command to show only the selected chains. The items in the input
74 * list should be formatted as "modelid:chainid".
79 List<StructureCommandI> showChains(List<String> toShow);
82 * Returns a command to superpose structures by closest positioning of
83 * residues in {@code atomSpec} to the corresponding residues in
84 * {@code refAtoms}. If wanted, this may include commands to visually
85 * highlight the residues that were used for the superposition.
91 List<StructureCommandI> superposeStructures(AtomSpecModel refAtoms,
92 AtomSpecModel atomSpec);
95 * Returns a command to open a file of commands at the given path
100 StructureCommandI openCommandFile(String path);
103 * Returns a command to save the current viewer session state to the given
109 StructureCommandI saveSession(String filepath);
112 * Returns a representation of the atom set represented by the model, in
113 * viewer syntax format. If {@code alphaOnly} is true, this is restricted to
114 * Alpha Carbon (peptide) or Phosphorous (rna) only
120 String getAtomSpec(AtomSpecModel model, boolean alphaOnly);
123 * Returns the lowest model number used by the structure viewer (likely 0 or
128 // TODO remove by refactoring so command generation is purely driven by
129 // AtomSpecModel objects derived in the binding classes?
130 int getModelStartNo();
133 * Returns command(s) to show only the backbone of the peptide (cartoons in
134 * Jmol, chain in Chimera)
138 List<StructureCommandI> showBackbone();
141 * Returns a command to open a file at the given path
146 // refactor if needed to distinguish loading data or session files
147 StructureCommandI loadFile(String file);
150 * Returns commands to set atom attributes or properties, given a map of
151 * Jalview features as {featureType, {featureValue, AtomSpecModel}}. The
152 * assumption is that one command can be constructed for each feature type and
153 * value combination, to apply it to one or more residues.
155 * @param featureValues
158 List<StructureCommandI> setAttributes(
159 Map<String, Map<Object, AtomSpecModel>> featureValues);
162 * Returns command to open a saved structure viewer session file, or null if
168 StructureCommandI openSession(String filepath);
171 * Returns a command to ask the viewer to close down
175 StructureCommandI closeViewer();
178 * Returns one or more commands to ask the viewer to notify model or selection
179 * changes to the given uri. Returns null if this is not supported by the
185 List<StructureCommandI> startNotifications(String uri);
188 * Returns one or more commands to ask the viewer to stop notifying model or
189 * selection changes. Returns null if this is not supported by the structure
194 List<StructureCommandI> stopNotifications();
197 * Returns a command to ask the viewer for its current residue selection, or
198 * null if no such command is supported
202 StructureCommandI getSelectedResidues();
205 * Returns a command to list the unique names of residue attributes, or null
206 * if no such command is supported
210 StructureCommandI listResidueAttributes();
213 * Returns a command to list residues with an attribute of the given name,
214 * with attribute value, or null if no such command is supported
218 StructureCommandI getResidueAttributes(String attName);