1 package jalview.structure;
3 import jalview.api.AlignmentViewPanel;
4 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 * Data bean class to simplify parameterisation in superposeStructures
22 public class SuperposeData
24 public String filename;
28 public String chain = "";
33 * The pdb residue number (if any) mapped to columns of the alignment
35 public int[] pdbResNo; // or use SparseIntArray?
43 * width of alignment (number of columns that may potentially
44 * participate in superposition)
46 * structure viewer model number
48 public SuperposeData(int width, int model)
50 pdbResNo = new int[width];
56 * Returns the command to colour by chain
60 String colourByChain();
63 * Returns the command to colour residues using a charge-based scheme:
65 * <li>Aspartic acid and Glutamic acid (negative charge) red</li>
66 * <li>Lysine and Arginine (positive charge) blue</li>
67 * <li>Cysteine - yellow</li>
68 * <li>all others - white</li>
73 String colourByCharge();
76 * Returns the command to colour residues with the colours provided in the
77 * map, one per three letter residue code
82 String colourByResidues(Map<String, Color> colours);
85 * Returns the command to set the background colour of the structure viewer
90 String setBackgroundColour(Color col);
93 * Returns commands to colour mapped residues of structures according to
94 * Jalview's colouring (including feature colouring if applied). Parameter is
95 * a map from Color to a model of all residues assigned that colour.
101 String[] colourBySequence(Map<Object, AtomSpecModel> colourMap);
104 * Returns a command to centre the display in the structure viewer
111 * Returns a command to show only the selected chains. The items in the input
112 * list should be formatted as "modelno:chainid".
117 String showChains(List<String> toShow);
120 * Returns zero, one or more commands to set attributes on mapped residues in
121 * the structure viewer for any features present and displayed in Jalview
129 String[] setAttributesForFeatures(StructureSelectionManager ssm,
130 String[] files, SequenceI[][] sequence, AlignmentViewPanel avp);
133 * Returns a command to superpose structures by closest positioning of
134 * residues in {@code atomSpec} to the corresponding residues in {@ refAtoms}.
135 * If wanted, this may include commands to visually highlight the residues
136 * that were used for the superposition.
142 String superposeStructures(AtomSpecModel refAtoms,
143 AtomSpecModel atomSpec);
146 * Returns a command to open a file of commands at the given path
151 String openCommandFile(String path);
154 * Returns a command to save the current viewer session state to the given
160 String saveSession(String filepath);
163 * Returns a representation of the atom set represented by the model, in
164 * viewer syntax format. If {@code alphaOnly} is true, this is restricted to
165 * Alpha Carbon (peptide) or Phosphorous (rna) only
171 String getAtomSpec(AtomSpecModel model, boolean alphaOnly);
174 * Returns the lowest model number used by the structure viewer (likely 0 or
179 // TODO remove by refactoring so command generation is purely driven by
180 // AtomSpecModel objects derived in the binding classes?
181 int getModelStartNo();
184 * Show only the backbone of the peptide (cartoons in Jmol, chain in Chimera)
188 String showBackbone();