2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.ext.rbvi.chimera;
23 import jalview.api.AlignmentViewPanel;
24 import jalview.api.FeatureRenderer;
25 import jalview.api.SequenceRenderer;
26 import jalview.api.structures.JalviewStructureDisplayI;
27 import jalview.bin.Cache;
28 import jalview.datamodel.AlignmentI;
29 import jalview.datamodel.ColumnSelection;
30 import jalview.datamodel.PDBEntry;
31 import jalview.datamodel.SequenceI;
32 import jalview.httpserver.AbstractRequestHandler;
33 import jalview.io.DataSourceType;
34 import jalview.schemes.ColourSchemeI;
35 import jalview.schemes.ResidueProperties;
36 import jalview.structure.AtomSpec;
37 import jalview.structure.StructureMappingcommandSet;
38 import jalview.structure.StructureSelectionManager;
39 import jalview.structures.models.AAStructureBindingModel;
40 import jalview.util.MessageManager;
42 import java.awt.Color;
43 import java.net.BindException;
44 import java.util.ArrayList;
45 import java.util.Hashtable;
46 import java.util.LinkedHashMap;
47 import java.util.List;
50 import ext.edu.ucsf.rbvi.strucviz2.ChimeraManager;
51 import ext.edu.ucsf.rbvi.strucviz2.ChimeraModel;
52 import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
53 import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
55 public abstract class JalviewChimeraBinding extends AAStructureBindingModel
57 // Chimera clause to exclude alternate locations in atom selection
58 private static final String NO_ALTLOCS = "&~@.B-Z&~@.2-9";
60 private static final String COLOURING_CHIMERA = MessageManager
61 .getString("status.colouring_chimera");
63 private static final boolean debug = false;
65 private static final String PHOSPHORUS = "P";
67 private static final String ALPHACARBON = "CA";
69 private List<String> chainNames = new ArrayList<String>();
71 private Hashtable<String, String> chainFile = new Hashtable<String, String>();
74 * Object through which we talk to Chimera
76 private ChimeraManager viewer;
79 * Object which listens to Chimera notifications
81 private AbstractRequestHandler chimeraListener;
84 * set if chimera state is being restored from some source - instructs binding
85 * not to apply default display style when structure set is updated for first
88 private boolean loadingFromArchive = false;
91 * flag to indicate if the Chimera viewer should ignore sequence colouring
92 * events from the structure manager because the GUI is still setting up
94 private boolean loadingFinished = true;
96 public String fileLoadingError;
99 * Map of ChimeraModel objects keyed by PDB full local file name
101 private Map<String, List<ChimeraModel>> chimeraMaps = new LinkedHashMap<String, List<ChimeraModel>>();
104 * the default or current model displayed if the model cannot be identified
105 * from the selection message
107 private int frameNo = 0;
109 private String lastCommand;
111 String lastHighlightCommand;
114 * incremented every time a load notification is successfully handled -
115 * lightweight mechanism for other threads to detect when they can start
116 * referring to new structures.
118 private long loadNotifiesHandled = 0;
120 private Thread chimeraMonitor;
123 * Open a PDB structure file in Chimera and set up mappings from Jalview.
125 * We check if the PDB model id is already loaded in Chimera, if so don't
126 * reopen it. This is the case if Chimera has opened a saved session file.
131 public boolean openFile(PDBEntry pe)
133 String file = pe.getFile();
136 List<ChimeraModel> modelsToMap = new ArrayList<ChimeraModel>();
137 List<ChimeraModel> oldList = viewer.getModelList();
138 boolean alreadyOpen = false;
141 * If Chimera already has this model, don't reopen it, but do remap it.
143 for (ChimeraModel open : oldList)
145 if (open.getModelName().equals(pe.getId()))
148 modelsToMap.add(open);
153 * If Chimera doesn't yet have this model, ask it to open it, and retrieve
154 * the model name(s) added by Chimera.
158 viewer.openModel(file, pe.getId(), ModelType.PDB_MODEL);
159 List<ChimeraModel> newList = viewer.getModelList();
160 // JAL-1728 newList.removeAll(oldList) does not work
161 for (ChimeraModel cm : newList)
163 if (cm.getModelName().equals(pe.getId()))
170 chimeraMaps.put(file, modelsToMap);
172 if (getSsm() != null)
174 getSsm().addStructureViewerListener(this);
175 // ssm.addSelectionListener(this);
176 FeatureRenderer fr = getFeatureRenderer(null);
184 } catch (Exception q)
186 log("Exception when trying to open model " + file + "\n"
201 public JalviewChimeraBinding(StructureSelectionManager ssm,
202 PDBEntry[] pdbentry, SequenceI[][] sequenceIs, DataSourceType protocol)
204 super(ssm, pdbentry, sequenceIs, protocol);
205 viewer = new ChimeraManager(new StructureManager(true));
209 * Starts a thread that waits for the Chimera process to finish, so that we
210 * can then close the associated resources. This avoids leaving orphaned
211 * Chimera viewer panels in Jalview if the user closes Chimera.
213 protected void startChimeraProcessMonitor()
215 final Process p = viewer.getChimeraProcess();
216 chimeraMonitor = new Thread(new Runnable()
225 JalviewStructureDisplayI display = getViewer();
228 display.closeViewer(false);
230 } catch (InterruptedException e)
232 // exit thread if Chimera Viewer is closed in Jalview
236 chimeraMonitor.start();
240 * Start a dedicated HttpServer to listen for Chimera notifications, and tell
241 * it to start listening
243 public void startChimeraListener()
247 chimeraListener = new ChimeraListener(this);
248 viewer.startListening(chimeraListener.getUri());
249 } catch (BindException e)
251 System.err.println("Failed to start Chimera listener: "
257 * Construct a title string for the viewer window based on the data Jalview
263 public String getViewerTitle(boolean verbose)
265 return getViewerTitle("Chimera", verbose);
269 * Tells Chimera to display only the specified chains
273 public void showChains(List<String> toshow)
276 * Construct a chimera command like
278 * ~display #*;~ribbon #*;ribbon :.A,:.B
280 StringBuilder cmd = new StringBuilder(64);
281 boolean first = true;
282 for (String chain : toshow)
284 int modelNumber = getModelNoForChain(chain);
285 String showChainCmd = modelNumber == -1 ? "" : modelNumber + ":."
286 + chain.split(":")[1];
291 cmd.append(showChainCmd);
296 * could append ";focus" to this command to resize the display to fill the
297 * window, but it looks more helpful not to (easier to relate chains to the
300 final String command = "~display #*; ~ribbon #*; ribbon :"
302 sendChimeraCommand(command, false);
306 * Close down the Jalview viewer and listener, and (optionally) the associated
309 public void closeViewer(boolean closeChimera)
311 getSsm().removeStructureViewerListener(this, this.getPdbFile());
314 viewer.exitChimera();
316 if (this.chimeraListener != null)
318 chimeraListener.shutdown();
319 chimeraListener = null;
324 if (chimeraMonitor != null)
326 chimeraMonitor.interrupt();
328 releaseUIResources();
331 public void colourByChain()
333 colourBySequence = false;
334 sendAsynchronousCommand("rainbow chain", COLOURING_CHIMERA);
338 * Constructs and sends a Chimera command to colour by charge
340 * <li>Aspartic acid and Glutamic acid (negative charge) red</li>
341 * <li>Lysine and Arginine (positive charge) blue</li>
342 * <li>Cysteine - yellow</li>
343 * <li>all others - white</li>
346 public void colourByCharge()
348 colourBySequence = false;
349 String command = "color white;color red ::ASP;color red ::GLU;color blue ::LYS;color blue ::ARG;color yellow ::CYS";
350 sendAsynchronousCommand(command, COLOURING_CHIMERA);
354 * Construct and send a command to align structures against a reference
355 * structure, based on one or more sequence alignments
358 * an array of alignments to process
359 * @param _refStructure
360 * an array of corresponding reference structures (index into pdb
361 * file array); if a negative value is passed, the first PDB file
362 * mapped to an alignment sequence is used as the reference for
365 * an array of corresponding hidden columns for each alignment
367 public void superposeStructures(AlignmentI[] _alignment,
368 int[] _refStructure, ColumnSelection[] _hiddenCols)
370 StringBuilder allComs = new StringBuilder(128);
371 String[] files = getPdbFile();
373 if (!waitForFileLoad(files))
379 StringBuilder selectioncom = new StringBuilder(256);
380 for (int a = 0; a < _alignment.length; a++)
382 int refStructure = _refStructure[a];
383 AlignmentI alignment = _alignment[a];
384 ColumnSelection hiddenCols = _hiddenCols[a];
386 if (refStructure >= files.length)
388 System.err.println("Ignoring invalid reference structure value "
394 * 'matched' array will hold 'true' for visible alignment columns where
395 * all sequences have a residue with a mapping to the PDB structure
397 boolean matched[] = new boolean[alignment.getWidth()];
398 for (int m = 0; m < matched.length; m++)
400 matched[m] = (hiddenCols != null) ? hiddenCols.isVisible(m) : true;
403 SuperposeData[] structures = new SuperposeData[files.length];
404 for (int f = 0; f < files.length; f++)
406 structures[f] = new SuperposeData(alignment.getWidth());
410 * Calculate the superposable alignment columns ('matched'), and the
411 * corresponding structure residue positions (structures.pdbResNo)
413 int candidateRefStructure = findSuperposableResidues(alignment,
414 matched, structures);
415 if (refStructure < 0)
418 * If no reference structure was specified, pick the first one that has
419 * a mapping in the alignment
421 refStructure = candidateRefStructure;
425 for (boolean b : matched)
434 // TODO: bail out here because superposition illdefined?
438 * Generate select statements to select regions to superimpose structures
440 String[] selcom = new String[files.length];
441 for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
443 String chainCd = "." + structures[pdbfnum].chain;
446 StringBuilder molsel = new StringBuilder();
447 for (int r = 0; r < matched.length; r++)
451 int pdbResNum = structures[pdbfnum].pdbResNo[r];
452 if (lpos != pdbResNum - 1)
455 * discontiguous - append last residue now
459 molsel.append(String.valueOf(lpos));
460 molsel.append(chainCd);
468 * extending a contiguous run
473 * start the range selection
475 molsel.append(String.valueOf(lpos));
485 * and terminate final selection
489 molsel.append(String.valueOf(lpos));
490 molsel.append(chainCd);
492 if (molsel.length() > 1)
494 selcom[pdbfnum] = molsel.toString();
495 selectioncom.append("#").append(String.valueOf(pdbfnum))
497 selectioncom.append(selcom[pdbfnum]);
498 selectioncom.append(" ");
499 if (pdbfnum < files.length - 1)
501 selectioncom.append("| ");
506 selcom[pdbfnum] = null;
510 StringBuilder command = new StringBuilder(256);
511 for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
513 if (pdbfnum == refStructure || selcom[pdbfnum] == null
514 || selcom[refStructure] == null)
518 if (command.length() > 0)
524 * Form Chimera match command, from the 'new' structure to the
525 * 'reference' structure e.g. (50 residues, chain B/A, alphacarbons):
527 * match #1:1-30.B,81-100.B@CA #0:21-40.A,61-90.A@CA
530 * https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/match.html
532 command.append("match ").append(getModelSpec(pdbfnum)).append(":");
533 command.append(selcom[pdbfnum]);
534 command.append("@").append(
535 structures[pdbfnum].isRna ? PHOSPHORUS : ALPHACARBON);
536 // JAL-1757 exclude alternate CA locations
537 command.append(NO_ALTLOCS);
538 command.append(" ").append(getModelSpec(refStructure)).append(":");
539 command.append(selcom[refStructure]);
540 command.append("@").append(
541 structures[refStructure].isRna ? PHOSPHORUS : ALPHACARBON);
542 command.append(NO_ALTLOCS);
544 if (selectioncom.length() > 0)
548 System.out.println("Select regions:\n" + selectioncom.toString());
549 System.out.println("Superimpose command(s):\n"
550 + command.toString());
552 allComs.append("~display all; chain @CA|P; ribbon ")
553 .append(selectioncom.toString())
554 .append(";" + command.toString());
557 if (selectioncom.length() > 0)
559 // TODO: visually distinguish regions that were superposed
560 if (selectioncom.substring(selectioncom.length() - 1).equals("|"))
562 selectioncom.setLength(selectioncom.length() - 1);
566 System.out.println("Select regions:\n" + selectioncom.toString());
568 allComs.append("; ~display all; chain @CA|P; ribbon ")
569 .append(selectioncom.toString()).append("; focus");
570 sendChimeraCommand(allComs.toString(), false);
576 * Helper method to construct model spec in Chimera format:
578 * <li>#0 (#1 etc) for a PDB file with no sub-models</li>
579 * <li>#0.1 (#1.1 etc) for a PDB file with sub-models</li>
581 * Note for now we only ever choose the first of multiple models. This
582 * corresponds to the hard-coded Jmol equivalent (compare {1.1}). Refactor in
583 * future if there is a need to select specific sub-models.
588 protected String getModelSpec(int pdbfnum)
590 if (pdbfnum < 0 || pdbfnum >= getPdbCount())
596 * For now, the test for having sub-models is whether multiple Chimera
597 * models are mapped for the PDB file; the models are returned as a response
598 * to the Chimera command 'list models type molecule', see
599 * ChimeraManager.getModelList().
601 List<ChimeraModel> maps = chimeraMaps.get(getPdbFile()[pdbfnum]);
602 boolean hasSubModels = maps != null && maps.size() > 1;
603 return "#" + String.valueOf(pdbfnum) + (hasSubModels ? ".1" : "");
607 * Launch Chimera, unless an instance linked to this object is already
608 * running. Returns true if Chimera is successfully launched, or already
609 * running, else false.
613 public boolean launchChimera()
615 if (viewer.isChimeraLaunched())
620 boolean launched = viewer.launchChimera(StructureManager
624 startChimeraProcessMonitor();
628 log("Failed to launch Chimera!");
634 * Answers true if the Chimera process is still running, false if ended or not
639 public boolean isChimeraRunning()
641 return viewer.isChimeraLaunched();
645 * Send a command to Chimera, and optionally log any responses.
650 public void sendChimeraCommand(final String command, boolean logResponse)
654 // ? thread running after viewer shut down
657 viewerCommandHistory(false);
658 if (lastCommand == null || !lastCommand.equals(command))
660 // trim command or it may never find a match in the replyLog!!
661 List<String> lastReply = viewer.sendChimeraCommand(command.trim(),
663 if (logResponse && debug)
665 log("Response from command ('" + command + "') was:\n" + lastReply);
668 viewerCommandHistory(true);
669 lastCommand = command;
673 * Send a Chimera command asynchronously in a new thread. If the progress
674 * message is not null, display this message while the command is executing.
679 protected abstract void sendAsynchronousCommand(String command,
683 * colour any structures associated with sequences in the given alignment
684 * using the getFeatureRenderer() and getSequenceRenderer() renderers but only
685 * if colourBySequence is enabled.
687 public void colourBySequence(boolean showFeatures,
688 jalview.api.AlignmentViewPanel alignmentv)
690 if (!colourBySequence || !loadingFinished)
694 if (getSsm() == null)
698 String[] files = getPdbFile();
700 SequenceRenderer sr = getSequenceRenderer(alignmentv);
702 FeatureRenderer fr = null;
705 fr = getFeatureRenderer(alignmentv);
707 AlignmentI alignment = alignmentv.getAlignment();
709 for (jalview.structure.StructureMappingcommandSet cpdbbyseq : getColourBySequenceCommands(
710 files, sr, fr, alignment))
712 for (String command : cpdbbyseq.commands)
714 sendAsynchronousCommand(command, COLOURING_CHIMERA);
726 protected StructureMappingcommandSet[] getColourBySequenceCommands(
727 String[] files, SequenceRenderer sr, FeatureRenderer fr,
728 AlignmentI alignment)
730 return ChimeraCommands.getColourBySequenceCommand(getSsm(), files,
731 getSequence(), sr, fr, alignment);
737 protected void executeWhenReady(String command)
740 sendChimeraCommand(command, false);
744 private void waitForChimera()
746 while (viewer != null && viewer.isBusy())
751 } catch (InterruptedException q)
757 // End StructureListener
758 // //////////////////////////
761 * returns the current featureRenderer that should be used to colour the
768 public abstract FeatureRenderer getFeatureRenderer(
769 AlignmentViewPanel alignment);
772 * instruct the Jalview binding to update the pdbentries vector if necessary
773 * prior to matching the viewer's contents to the list of structure files
774 * Jalview knows about.
776 public abstract void refreshPdbEntries();
778 private int getModelNum(String modelFileName)
780 String[] mfn = getPdbFile();
785 for (int i = 0; i < mfn.length; i++)
787 if (mfn[i].equalsIgnoreCase(modelFileName))
796 * map between index of model filename returned from getPdbFile and the first
797 * index of models from this file in the viewer. Note - this is not trimmed -
798 * use getPdbFile to get number of unique models.
800 private int _modelFileNameMap[];
802 // ////////////////////////////////
803 // /StructureListener
805 public synchronized String[] getPdbFile()
809 return new String[0];
812 return chimeraMaps.keySet().toArray(
813 modelFileNames = new String[chimeraMaps.size()]);
817 * returns the current sequenceRenderer that should be used to colour the
824 public abstract SequenceRenderer getSequenceRenderer(
825 AlignmentViewPanel alignment);
828 * Construct and send a command to highlight zero, one or more atoms. We do
829 * this by sending an "rlabel" command to show the residue label at that
833 public void highlightAtoms(List<AtomSpec> atoms)
835 if (atoms == null || atoms.size() == 0)
840 StringBuilder cmd = new StringBuilder(128);
841 boolean first = true;
842 boolean found = false;
844 for (AtomSpec atom : atoms)
846 int pdbResNum = atom.getPdbResNum();
847 String chain = atom.getChain();
848 String pdbfile = atom.getPdbFile();
849 List<ChimeraModel> cms = chimeraMaps.get(pdbfile);
850 if (cms != null && !cms.isEmpty())
854 cmd.append("rlabel #").append(cms.get(0).getModelNumber())
862 cmd.append(pdbResNum);
863 if (!chain.equals(" "))
865 cmd.append(".").append(chain);
870 String command = cmd.toString();
873 * avoid repeated commands for the same residue
875 if (command.equals(lastHighlightCommand))
881 * unshow the label for the previous residue
883 if (lastHighlightCommand != null)
885 viewer.sendChimeraCommand("~" + lastHighlightCommand, false);
889 viewer.sendChimeraCommand(command, false);
891 this.lastHighlightCommand = command;
895 * Query Chimera for its current selection, and highlight it on the alignment
897 public void highlightChimeraSelection()
900 * Ask Chimera for its current selection
902 List<String> selection = viewer.getSelectedResidueSpecs();
905 * Parse model number, residue and chain for each selected position,
906 * formatted as #0:123.A or #1.2:87.B (#model.submodel:residue.chain)
908 List<AtomSpec> atomSpecs = new ArrayList<AtomSpec>();
909 for (String atomSpec : selection)
911 int colonPos = atomSpec.indexOf(":");
914 continue; // malformed
917 int hashPos = atomSpec.indexOf("#");
918 String modelSubmodel = atomSpec.substring(hashPos + 1, colonPos);
919 int dotPos = modelSubmodel.indexOf(".");
923 modelId = Integer.valueOf(dotPos == -1 ? modelSubmodel
924 : modelSubmodel.substring(0, dotPos));
925 } catch (NumberFormatException e)
927 // ignore, default to model 0
930 String residueChain = atomSpec.substring(colonPos + 1);
931 dotPos = residueChain.indexOf(".");
932 int pdbResNum = Integer.parseInt(dotPos == -1 ? residueChain
933 : residueChain.substring(0, dotPos));
935 String chainId = dotPos == -1 ? "" : residueChain
936 .substring(dotPos + 1);
939 * Work out the pdbfilename from the model number
941 String pdbfilename = modelFileNames[frameNo];
942 findfileloop: for (String pdbfile : this.chimeraMaps.keySet())
944 for (ChimeraModel cm : chimeraMaps.get(pdbfile))
946 if (cm.getModelNumber() == modelId)
948 pdbfilename = pdbfile;
953 atomSpecs.add(new AtomSpec(pdbfilename, chainId, pdbResNum, 0));
957 * Broadcast the selection (which may be empty, if the user just cleared all
960 getSsm().mouseOverStructure(atomSpecs);
963 private void log(String message)
965 System.err.println("## Chimera log: " + message);
968 private void viewerCommandHistory(boolean enable)
970 // log("(Not yet implemented) History "
971 // + ((debug || enable) ? "on" : "off"));
974 public long getLoadNotifiesHandled()
976 return loadNotifiesHandled;
979 public void setJalviewColourScheme(ColourSchemeI cs)
981 colourBySequence = false;
988 // Chimera expects RBG values in the range 0-1
989 final double normalise = 255D;
990 viewerCommandHistory(false);
991 StringBuilder command = new StringBuilder(128);
993 List<String> residueSet = ResidueProperties.getResidues(isNucleotide(),
995 for (String res : residueSet)
997 Color col = cs.findColour(res.charAt(0));
998 command.append("color " + col.getRed() / normalise + ","
999 + col.getGreen() / normalise + "," + col.getBlue()
1000 / normalise + " ::" + res + ";");
1003 sendAsynchronousCommand(command.toString(), COLOURING_CHIMERA);
1004 viewerCommandHistory(true);
1008 * called when the binding thinks the UI needs to be refreshed after a Chimera
1009 * state change. this could be because structures were loaded, or because an
1010 * error has occurred.
1012 public abstract void refreshGUI();
1015 public void setLoadingFromArchive(boolean loadingFromArchive)
1017 this.loadingFromArchive = loadingFromArchive;
1022 * @return true if Chimeral is still restoring state or loading is still going
1023 * on (see setFinsihedLoadingFromArchive)
1026 public boolean isLoadingFromArchive()
1028 return loadingFromArchive && !loadingFinished;
1032 * modify flag which controls if sequence colouring events are honoured by the
1033 * binding. Should be true for normal operation
1035 * @param finishedLoading
1038 public void setFinishedLoadingFromArchive(boolean finishedLoading)
1040 loadingFinished = finishedLoading;
1044 * Send the Chimera 'background solid <color>" command.
1047 * ://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/background
1051 public void setBackgroundColour(Color col)
1053 viewerCommandHistory(false);
1054 double normalise = 255D;
1055 final String command = "background solid " + col.getRed() / normalise
1056 + "," + col.getGreen() / normalise + "," + col.getBlue()
1058 viewer.sendChimeraCommand(command, false);
1059 viewerCommandHistory(true);
1063 * Ask Chimera to save its session to the given file. Returns true if
1064 * successful, else false.
1069 public boolean saveSession(String filepath)
1071 if (isChimeraRunning())
1073 List<String> reply = viewer.sendChimeraCommand("save " + filepath,
1075 if (reply.contains("Session written"))
1082 .error("Error saving Chimera session: " + reply.toString());
1089 * Ask Chimera to open a session file. Returns true if successful, else false.
1090 * The filename must have a .py extension for this command to work.
1095 public boolean openSession(String filepath)
1097 sendChimeraCommand("open " + filepath, true);
1098 // todo: test for failure - how?
1103 * Send a 'focus' command to Chimera to recentre the visible display
1105 public void focusView()
1107 sendChimeraCommand("focus", false);
1111 * Send a 'show' command for all atoms in the currently selected columns
1113 * TODO: pull up to abstract structure viewer interface
1117 public void highlightSelection(AlignmentViewPanel vp)
1119 List<Integer> cols = vp.getAlignViewport().getColumnSelection()
1121 AlignmentI alignment = vp.getAlignment();
1122 StructureSelectionManager sm = getSsm();
1123 for (SequenceI seq : alignment.getSequences())
1126 * convert selected columns into sequence positions
1128 int[] positions = new int[cols.size()];
1130 for (Integer col : cols)
1132 positions[i++] = seq.findPosition(col);
1134 sm.highlightStructure(this, seq, positions);
1140 public List<String> getChainNames()
1145 public Hashtable<String, String> getChainFile()
1150 public List<ChimeraModel> getChimeraModelByChain(String chain)
1152 return chimeraMaps.get(chainFile.get(chain));
1155 public int getModelNoForChain(String chain)
1157 List<ChimeraModel> foundModels = getChimeraModelByChain(chain);
1158 if (foundModels != null && !foundModels.isEmpty())
1160 return foundModels.get(0).getModelNumber();