1 package jalview.structure;
7 import jalview.api.AlignmentViewPanel;
8 import jalview.datamodel.SequenceI;
11 * Methods that generate commands that can be sent to a molecular structure
12 * viewer program (e.g. Jmol, Chimera, ChimeraX)
17 public interface StructureCommandsI
20 * Returns the command to colour by chain
24 StructureCommandI colourByChain();
27 * Returns the command to colour residues using a charge-based scheme:
29 * <li>Aspartic acid and Glutamic acid (negative charge) red</li>
30 * <li>Lysine and Arginine (positive charge) blue</li>
31 * <li>Cysteine - yellow</li>
32 * <li>all others - white</li>
37 List<StructureCommandI> colourByCharge();
40 * Returns the command to colour residues with the colours provided in the
41 * map, one per three letter residue code
46 List<StructureCommandI> colourByResidues(Map<String, Color> colours);
49 * Returns the command to set the background colour of the structure viewer
54 StructureCommandI setBackgroundColour(Color col);
57 * Returns commands to colour mapped residues of structures according to
58 * Jalview's colouring (including feature colouring if applied). Parameter is
59 * a map from Color to a model of all residues assigned that colour.
65 List<StructureCommandI> colourBySequence(
66 Map<Object, AtomSpecModel> colourMap);
69 * Returns a command to centre the display in the structure viewer
73 StructureCommandI focusView();
76 * Returns a command to show only the selected chains. The items in the input
77 * list should be formatted as "modelid:chainid".
82 List<StructureCommandI> showChains(List<String> toShow);
85 * Returns a command to superpose structures by closest positioning of
86 * residues in {@code atomSpec} to the corresponding residues in
87 * {@code refAtoms}. If wanted, this may include commands to visually
88 * highlight the residues that were used for the superposition.
94 List<StructureCommandI> superposeStructures(AtomSpecModel refAtoms,
95 AtomSpecModel atomSpec);
98 * Returns a command to open a file of commands at the given path
103 StructureCommandI openCommandFile(String path);
106 * Returns a command to save the current viewer session state to the given
112 StructureCommandI saveSession(String filepath);
115 * Returns a representation of the atom set represented by the model, in
116 * viewer syntax format. If {@code alphaOnly} is true, this is restricted to
117 * Alpha Carbon (peptide) or Phosphorous (rna) only
123 String getAtomSpec(AtomSpecModel model, boolean alphaOnly);
126 * Returns the lowest model number used by the structure viewer (likely 0 or
131 // TODO remove by refactoring so command generation is purely driven by
132 // AtomSpecModel objects derived in the binding classes?
133 int getModelStartNo();
136 * Returns command(s) to show only the backbone of the peptide (cartoons in
137 * Jmol, chain in Chimera)
141 List<StructureCommandI> showBackbone();
144 * Returns a command to open a file at the given path
149 // refactor if needed to distinguish loading data or session files
150 StructureCommandI loadFile(String file);
153 * Returns commands to set atom attributes or properties, given a map of
154 * Jalview features as {featureType, {featureValue, AtomSpecModel}}. The
155 * assumption is that one command can be constructed for each feature type and
156 * value combination, to apply it to one or more residues.
158 * @param featureValues
161 List<StructureCommandI> setAttributes(
162 Map<String, Map<Object, AtomSpecModel>> featureValues);