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.bin.Cache;
27 import jalview.datamodel.AlignmentI;
28 import jalview.datamodel.ColumnSelection;
29 import jalview.datamodel.PDBEntry;
30 import jalview.datamodel.SequenceI;
31 import jalview.httpserver.AbstractRequestHandler;
32 import jalview.schemes.ColourSchemeI;
33 import jalview.schemes.ResidueProperties;
34 import jalview.structure.AtomSpec;
35 import jalview.structure.StructureMappingcommandSet;
36 import jalview.structure.StructureSelectionManager;
37 import jalview.structures.models.AAStructureBindingModel;
38 import jalview.util.MessageManager;
40 import java.awt.Color;
41 import java.net.BindException;
42 import java.util.ArrayList;
43 import java.util.LinkedHashMap;
44 import java.util.List;
47 import ext.edu.ucsf.rbvi.strucviz2.ChimeraManager;
48 import ext.edu.ucsf.rbvi.strucviz2.ChimeraModel;
49 import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
50 import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
52 public abstract class JalviewChimeraBinding extends AAStructureBindingModel
54 // Chimera clause to exclude alternate locations in atom selection
55 private static final String NO_ALTLOCS = "&~@.B-Z&~@.2-9";
57 private static final String COLOURING_CHIMERA = MessageManager
58 .getString("status.colouring_chimera");
60 private static final boolean debug = false;
62 private static final String PHOSPHORUS = "P";
64 private static final String ALPHACARBON = "CA";
67 * Object through which we talk to Chimera
69 private ChimeraManager viewer;
72 * Object which listens to Chimera notifications
74 private AbstractRequestHandler chimeraListener;
77 * set if chimera state is being restored from some source - instructs binding
78 * not to apply default display style when structure set is updated for first
81 private boolean loadingFromArchive = false;
84 * flag to indicate if the Chimera viewer should ignore sequence colouring
85 * events from the structure manager because the GUI is still setting up
87 private boolean loadingFinished = true;
89 public String fileLoadingError;
92 * Map of ChimeraModel objects keyed by PDB full local file name
94 private Map<String, List<ChimeraModel>> chimeraMaps = new LinkedHashMap<String, List<ChimeraModel>>();
97 * the default or current model displayed if the model cannot be identified
98 * from the selection message
100 private int frameNo = 0;
102 private String lastCommand;
105 * current set of model filenames loaded
107 String[] modelFileNames = null;
109 String lastHighlightCommand;
112 * incremented every time a load notification is successfully handled -
113 * lightweight mechanism for other threads to detect when they can start
114 * referring to new structures.
116 private long loadNotifiesHandled = 0;
119 * Open a PDB structure file in Chimera and set up mappings from Jalview.
121 * We check if the PDB model id is already loaded in Chimera, if so don't
122 * reopen it. This is the case if Chimera has opened a saved session file.
127 public boolean openFile(PDBEntry pe)
129 String file = pe.getFile();
132 List<ChimeraModel> modelsToMap = new ArrayList<ChimeraModel>();
133 List<ChimeraModel> oldList = viewer.getModelList();
134 boolean alreadyOpen = false;
137 * If Chimera already has this model, don't reopen it, but do remap it.
139 for (ChimeraModel open : oldList)
141 if (open.getModelName().equals(pe.getId()))
144 modelsToMap.add(open);
149 * If Chimera doesn't yet have this model, ask it to open it, and retrieve
150 * the model name(s) added by Chimera.
154 viewer.openModel(file, pe.getId(), ModelType.PDB_MODEL);
155 List<ChimeraModel> newList = viewer.getModelList();
156 // JAL-1728 newList.removeAll(oldList) does not work
157 for (ChimeraModel cm : newList)
159 if (cm.getModelName().equals(pe.getId()))
166 chimeraMaps.put(file, modelsToMap);
168 if (getSsm() != null)
170 getSsm().addStructureViewerListener(this);
171 // ssm.addSelectionListener(this);
172 FeatureRenderer fr = getFeatureRenderer(null);
180 } catch (Exception q)
182 log("Exception when trying to open model " + file + "\n"
198 public JalviewChimeraBinding(StructureSelectionManager ssm,
199 PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains,
202 super(ssm, pdbentry, sequenceIs, chains, protocol);
203 viewer = new ChimeraManager(
204 new ext.edu.ucsf.rbvi.strucviz2.StructureManager(true));
208 * Start a dedicated HttpServer to listen for Chimera notifications, and tell
209 * it to start listening
211 public void startChimeraListener()
215 chimeraListener = new ChimeraListener(this);
216 viewer.startListening(chimeraListener.getUri());
217 } catch (BindException e)
219 System.err.println("Failed to start Chimera listener: "
225 * Construct a title string for the viewer window based on the data Jalview
231 public String getViewerTitle(boolean verbose)
233 return getViewerTitle("Chimera", verbose);
237 * Tells Chimera to display only the specified chains
241 public void showChains(List<String> toshow)
244 * Construct a chimera command like
246 * ~display #*;~ribbon #*;ribbon :.A,:.B
248 StringBuilder cmd = new StringBuilder(64);
249 boolean first = true;
250 for (String chain : toshow)
256 cmd.append(":.").append(chain);
261 * could append ";focus" to this command to resize the display to fill the
262 * window, but it looks more helpful not to (easier to relate chains to the
265 final String command = "~display #*; ~ribbon #*; ribbon "
267 sendChimeraCommand(command, false);
271 * Close down the Jalview viewer and listener, and (optionally) the associated
274 public void closeViewer(boolean closeChimera)
276 getSsm().removeStructureViewerListener(this, this.getPdbFile());
279 viewer.exitChimera();
281 if (this.chimeraListener != null)
283 chimeraListener.shutdown();
284 chimeraListener = null;
289 releaseUIResources();
292 public void colourByChain()
294 colourBySequence = false;
295 sendAsynchronousCommand("rainbow chain", COLOURING_CHIMERA);
299 * Constructs and sends a Chimera command to colour by charge
301 * <li>Aspartic acid and Glutamic acid (negative charge) red</li>
302 * <li>Lysine and Arginine (positive charge) blue</li>
303 * <li>Cysteine - yellow</li>
304 * <li>all others - white</li>
307 public void colourByCharge()
309 colourBySequence = false;
310 String command = "color white;color red ::ASP;color red ::GLU;color blue ::LYS;color blue ::ARG;color yellow ::CYS";
311 sendAsynchronousCommand(command, COLOURING_CHIMERA);
315 * Construct and send a command to align structures against a reference
316 * structure, based on one or more sequence alignments
319 * an array of alignments to process
320 * @param _refStructure
321 * an array of corresponding reference structures (index into pdb
322 * file array); if a negative value is passed, the first PDB file
323 * mapped to an alignment sequence is used as the reference for
326 * an array of corresponding hidden columns for each alignment
328 public void superposeStructures(AlignmentI[] _alignment,
329 int[] _refStructure, ColumnSelection[] _hiddenCols)
331 StringBuilder allComs = new StringBuilder(128);
332 String[] files = getPdbFile();
334 if (!waitForFileLoad(files))
340 StringBuilder selectioncom = new StringBuilder(256);
341 for (int a = 0; a < _alignment.length; a++)
343 int refStructure = _refStructure[a];
344 AlignmentI alignment = _alignment[a];
345 ColumnSelection hiddenCols = _hiddenCols[a];
347 if (refStructure >= files.length)
349 System.err.println("Ignoring invalid reference structure value "
355 * 'matched' array will hold 'true' for visible alignment columns where
356 * all sequences have a residue with a mapping to the PDB structure
358 boolean matched[] = new boolean[alignment.getWidth()];
359 for (int m = 0; m < matched.length; m++)
361 matched[m] = (hiddenCols != null) ? hiddenCols.isVisible(m) : true;
364 SuperposeData[] structures = new SuperposeData[files.length];
365 for (int f = 0; f < files.length; f++)
367 structures[f] = new SuperposeData(alignment.getWidth());
371 * Calculate the superposable alignment columns ('matched'), and the
372 * corresponding structure residue positions (structures.pdbResNo)
374 int candidateRefStructure = findSuperposableResidues(alignment,
375 matched, structures);
376 if (refStructure < 0)
379 * If no reference structure was specified, pick the first one that has
380 * a mapping in the alignment
382 refStructure = candidateRefStructure;
386 for (boolean b : matched)
395 // TODO: bail out here because superposition illdefined?
399 * Generate select statements to select regions to superimpose structures
401 String[] selcom = new String[files.length];
402 for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
404 String chainCd = "." + structures[pdbfnum].chain;
407 StringBuilder molsel = new StringBuilder();
408 for (int r = 0; r < matched.length; r++)
412 int pdbResNum = structures[pdbfnum].pdbResNo[r];
413 if (lpos != pdbResNum - 1)
416 * discontiguous - append last residue now
420 molsel.append(String.valueOf(lpos));
421 molsel.append(chainCd);
429 * extending a contiguous run
434 * start the range selection
436 molsel.append(String.valueOf(lpos));
446 * and terminate final selection
450 molsel.append(String.valueOf(lpos));
451 molsel.append(chainCd);
453 if (molsel.length() > 1)
455 selcom[pdbfnum] = molsel.toString();
456 selectioncom.append("#").append(String.valueOf(pdbfnum))
458 selectioncom.append(selcom[pdbfnum]);
459 selectioncom.append(" ");
460 if (pdbfnum < files.length - 1)
462 selectioncom.append("| ");
467 selcom[pdbfnum] = null;
471 StringBuilder command = new StringBuilder(256);
472 for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
474 if (pdbfnum == refStructure || selcom[pdbfnum] == null
475 || selcom[refStructure] == null)
479 if (command.length() > 0)
485 * Form Chimera match command, from the 'new' structure to the
486 * 'reference' structure e.g. (50 residues, chain B/A, alphacarbons):
488 * match #1:1-30.B,81-100.B@CA #0:21-40.A,61-90.A@CA
491 * https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/match.html
493 command.append("match ").append(getModelSpec(pdbfnum)).append(":");
494 command.append(selcom[pdbfnum]);
495 command.append("@").append(
496 structures[pdbfnum].isRna ? PHOSPHORUS : ALPHACARBON);
497 // JAL-1757 exclude alternate CA locations
498 command.append(NO_ALTLOCS);
499 command.append(" ").append(getModelSpec(refStructure)).append(":");
500 command.append(selcom[refStructure]);
501 command.append("@").append(
502 structures[refStructure].isRna ? PHOSPHORUS : ALPHACARBON);
503 command.append(NO_ALTLOCS);
505 if (selectioncom.length() > 0)
509 System.out.println("Select regions:\n" + selectioncom.toString());
510 System.out.println("Superimpose command(s):\n"
511 + command.toString());
513 allComs.append("~display all; chain @CA|P; ribbon ")
514 .append(selectioncom.toString())
515 .append(";" + command.toString());
518 if (selectioncom.length() > 0)
520 // TODO: visually distinguish regions that were superposed
521 if (selectioncom.substring(selectioncom.length() - 1).equals("|"))
523 selectioncom.setLength(selectioncom.length() - 1);
527 System.out.println("Select regions:\n" + selectioncom.toString());
529 allComs.append("; ~display all; chain @CA|P; ribbon ")
530 .append(selectioncom.toString()).append("; focus");
531 sendChimeraCommand(allComs.toString(), false);
537 * Helper method to construct model spec in Chimera format:
539 * <li>#0 (#1 etc) for a PDB file with no sub-models</li>
540 * <li>#0.1 (#1.1 etc) for a PDB file with sub-models</li>
542 * Note for now we only ever choose the first of multiple models. This
543 * corresponds to the hard-coded Jmol equivalent (compare {1.1}). Refactor in
544 * future if there is a need to select specific sub-models.
549 protected String getModelSpec(int pdbfnum)
551 if (pdbfnum < 0 || pdbfnum >= getPdbCount())
557 * For now, the test for having sub-models is whether multiple Chimera
558 * models are mapped for the PDB file; the models are returned as a response
559 * to the Chimera command 'list models type molecule', see
560 * ChimeraManager.getModelList().
562 List<ChimeraModel> maps = chimeraMaps.get(getPdbFile()[pdbfnum]);
563 boolean hasSubModels = maps != null && maps.size() > 1;
564 return "#" + String.valueOf(pdbfnum) + (hasSubModels ? ".1" : "");
568 * Launch Chimera, unless an instance linked to this object is already
569 * running. Returns true if chimera is successfully launched, or already
570 * running, else false.
574 public boolean launchChimera()
576 if (!viewer.isChimeraLaunched())
578 return viewer.launchChimera(StructureManager.getChimeraPaths());
580 if (viewer.isChimeraLaunched())
584 log("Failed to launch Chimera!");
589 * Answers true if the Chimera process is still running, false if ended or not
594 public boolean isChimeraRunning()
596 return viewer.isChimeraLaunched();
600 * Send a command to Chimera, and optionally log any responses.
605 public void sendChimeraCommand(final String command, boolean logResponse)
609 // ? thread running after viewer shut down
612 viewerCommandHistory(false);
613 if (lastCommand == null || !lastCommand.equals(command))
615 // trim command or it may never find a match in the replyLog!!
616 List<String> lastReply = viewer.sendChimeraCommand(command.trim(),
618 if (logResponse && debug)
620 log("Response from command ('" + command + "') was:\n" + lastReply);
623 viewerCommandHistory(true);
624 lastCommand = command;
628 * Send a Chimera command asynchronously in a new thread. If the progress
629 * message is not null, display this message while the command is executing.
634 protected abstract void sendAsynchronousCommand(String command,
638 * colour any structures associated with sequences in the given alignment
639 * using the getFeatureRenderer() and getSequenceRenderer() renderers but only
640 * if colourBySequence is enabled.
642 public void colourBySequence(boolean showFeatures,
643 jalview.api.AlignmentViewPanel alignmentv)
645 if (!colourBySequence || !loadingFinished)
649 if (getSsm() == null)
653 String[] files = getPdbFile();
655 SequenceRenderer sr = getSequenceRenderer(alignmentv);
657 FeatureRenderer fr = null;
660 fr = getFeatureRenderer(alignmentv);
662 AlignmentI alignment = alignmentv.getAlignment();
664 for (jalview.structure.StructureMappingcommandSet cpdbbyseq : getColourBySequenceCommands(
665 files, sr, fr, alignment))
667 for (String command : cpdbbyseq.commands)
669 sendAsynchronousCommand(command, COLOURING_CHIMERA);
681 protected StructureMappingcommandSet[] getColourBySequenceCommands(
682 String[] files, SequenceRenderer sr, FeatureRenderer fr,
683 AlignmentI alignment)
685 return ChimeraCommands.getColourBySequenceCommand(getSsm(), files,
686 getSequence(), sr, fr, alignment);
692 protected void executeWhenReady(String command)
695 sendChimeraCommand(command, false);
699 private void waitForChimera()
701 while (viewer != null && viewer.isBusy())
706 } catch (InterruptedException q)
712 // End StructureListener
713 // //////////////////////////
716 * returns the current featureRenderer that should be used to colour the
723 public abstract FeatureRenderer getFeatureRenderer(
724 AlignmentViewPanel alignment);
727 * instruct the Jalview binding to update the pdbentries vector if necessary
728 * prior to matching the viewer's contents to the list of structure files
729 * Jalview knows about.
731 public abstract void refreshPdbEntries();
733 private int getModelNum(String modelFileName)
735 String[] mfn = getPdbFile();
740 for (int i = 0; i < mfn.length; i++)
742 if (mfn[i].equalsIgnoreCase(modelFileName))
751 * map between index of model filename returned from getPdbFile and the first
752 * index of models from this file in the viewer. Note - this is not trimmed -
753 * use getPdbFile to get number of unique models.
755 private int _modelFileNameMap[];
757 // ////////////////////////////////
758 // /StructureListener
760 public synchronized String[] getPdbFile()
764 return new String[0];
766 // if (modelFileNames == null)
768 // Collection<ChimeraModel> chimodels = viewer.getChimeraModels();
769 // _modelFileNameMap = new int[chimodels.size()];
771 // for (ChimeraModel chimodel : chimodels)
773 // String mdlName = chimodel.getModelName();
775 // modelFileNames = new String[j];
776 // // System.arraycopy(mset, 0, modelFileNames, 0, j);
779 return chimeraMaps.keySet().toArray(
780 modelFileNames = new String[chimeraMaps.size()]);
784 * returns the current sequenceRenderer that should be used to colour the
791 public abstract SequenceRenderer getSequenceRenderer(
792 AlignmentViewPanel alignment);
795 * Construct and send a command to highlight zero, one or more atoms. We do
796 * this by sending an "rlabel" command to show the residue label at that
800 public void highlightAtoms(List<AtomSpec> atoms)
802 if (atoms == null || atoms.size() == 0)
807 StringBuilder cmd = new StringBuilder(128);
808 boolean first = true;
809 boolean found = false;
811 for (AtomSpec atom : atoms)
813 int pdbResNum = atom.getPdbResNum();
814 String chain = atom.getChain();
815 String pdbfile = atom.getPdbFile();
816 List<ChimeraModel> cms = chimeraMaps.get(pdbfile);
817 if (cms != null && !cms.isEmpty())
821 cmd.append("rlabel #").append(cms.get(0).getModelNumber())
829 cmd.append(pdbResNum);
830 if (!chain.equals(" "))
832 cmd.append(".").append(chain);
837 String command = cmd.toString();
840 * avoid repeated commands for the same residue
842 if (command.equals(lastHighlightCommand))
848 * unshow the label for the previous residue
850 if (lastHighlightCommand != null)
852 viewer.sendChimeraCommand("~" + lastHighlightCommand, false);
856 viewer.sendChimeraCommand(command, false);
858 this.lastHighlightCommand = command;
862 * Query Chimera for its current selection, and highlight it on the alignment
864 public void highlightChimeraSelection()
867 * Ask Chimera for its current selection
869 List<String> selection = viewer.getSelectedResidueSpecs();
872 * Parse model number, residue and chain for each selected position,
873 * formatted as #0:123.A or #1.2:87.B (#model.submodel:residue.chain)
875 List<AtomSpec> atomSpecs = new ArrayList<AtomSpec>();
876 for (String atomSpec : selection)
878 int colonPos = atomSpec.indexOf(":");
881 continue; // malformed
884 int hashPos = atomSpec.indexOf("#");
885 String modelSubmodel = atomSpec.substring(hashPos + 1, colonPos);
886 int dotPos = modelSubmodel.indexOf(".");
890 modelId = Integer.valueOf(dotPos == -1 ? modelSubmodel
891 : modelSubmodel.substring(0, dotPos));
892 } catch (NumberFormatException e)
894 // ignore, default to model 0
897 String residueChain = atomSpec.substring(colonPos + 1);
898 dotPos = residueChain.indexOf(".");
899 int pdbResNum = Integer.parseInt(dotPos == -1 ? residueChain
900 : residueChain.substring(0, dotPos));
902 String chainId = dotPos == -1 ? "" : residueChain
903 .substring(dotPos + 1);
906 * Work out the pdbfilename from the model number
908 String pdbfilename = modelFileNames[frameNo];
909 findfileloop: for (String pdbfile : this.chimeraMaps.keySet())
911 for (ChimeraModel cm : chimeraMaps.get(pdbfile))
913 if (cm.getModelNumber() == modelId)
915 pdbfilename = pdbfile;
920 atomSpecs.add(new AtomSpec(pdbfilename, chainId, pdbResNum, 0));
924 * Broadcast the selection (which may be empty, if the user just cleared all
927 getSsm().mouseOverStructure(atomSpecs);
930 private void log(String message)
932 System.err.println("## Chimera log: " + message);
935 private void viewerCommandHistory(boolean enable)
937 // log("(Not yet implemented) History "
938 // + ((debug || enable) ? "on" : "off"));
941 public long getLoadNotifiesHandled()
943 return loadNotifiesHandled;
946 public void setJalviewColourScheme(ColourSchemeI cs)
948 colourBySequence = false;
955 // Chimera expects RBG values in the range 0-1
956 final double normalise = 255D;
957 viewerCommandHistory(false);
958 StringBuilder command = new StringBuilder(128);
960 List<String> residueSet = ResidueProperties.getResidues(isNucleotide(),
962 for (String res : residueSet)
964 Color col = cs.findColour(res.charAt(0));
965 command.append("color " + col.getRed() / normalise + ","
966 + col.getGreen() / normalise + "," + col.getBlue()
967 / normalise + " ::" + res + ";");
970 sendAsynchronousCommand(command.toString(), COLOURING_CHIMERA);
971 viewerCommandHistory(true);
975 * called when the binding thinks the UI needs to be refreshed after a Chimera
976 * state change. this could be because structures were loaded, or because an
977 * error has occurred.
979 public abstract void refreshGUI();
982 public void setLoadingFromArchive(boolean loadingFromArchive)
984 this.loadingFromArchive = loadingFromArchive;
989 * @return true if Chimeral is still restoring state or loading is still going
990 * on (see setFinsihedLoadingFromArchive)
993 public boolean isLoadingFromArchive()
995 return loadingFromArchive && !loadingFinished;
999 * modify flag which controls if sequence colouring events are honoured by the
1000 * binding. Should be true for normal operation
1002 * @param finishedLoading
1005 public void setFinishedLoadingFromArchive(boolean finishedLoading)
1007 loadingFinished = finishedLoading;
1011 * Send the Chimera 'background solid <color>" command.
1014 * ://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/background
1018 public void setBackgroundColour(Color col)
1020 viewerCommandHistory(false);
1021 double normalise = 255D;
1022 final String command = "background solid " + col.getRed() / normalise
1023 + "," + col.getGreen() / normalise + "," + col.getBlue()
1025 viewer.sendChimeraCommand(command, false);
1026 viewerCommandHistory(true);
1030 * Ask Chimera to save its session to the given file. Returns true if
1031 * successful, else false.
1036 public boolean saveSession(String filepath)
1038 if (isChimeraRunning())
1040 List<String> reply = viewer.sendChimeraCommand("save " + filepath,
1042 if (reply.contains("Session written"))
1049 .error("Error saving Chimera session: " + reply.toString());
1056 * Ask Chimera to open a session file. Returns true if successful, else false.
1057 * The filename must have a .py extension for this command to work.
1062 public boolean openSession(String filepath)
1064 sendChimeraCommand("open " + filepath, true);
1065 // todo: test for failure - how?
1070 * Returns a list of chains mapped in this viewer. Note this list is not
1071 * currently scoped per structure.
1075 public List<String> getChainNames()
1077 List<String> names = new ArrayList<String>();
1078 String[][] allNames = getChains();
1079 if (allNames != null)
1081 for (String[] chainsForPdb : allNames)
1083 if (chainsForPdb != null)
1085 for (String chain : chainsForPdb)
1087 if (chain != null && !names.contains(chain))
1099 * Send a 'focus' command to Chimera to recentre the visible display
1101 public void focusView()
1103 sendChimeraCommand("focus", false);
1107 * Send a 'show' command for all atoms in the currently selected columns
1109 * TODO: pull up to abstract structure viewer interface
1113 public void highlightSelection(AlignmentViewPanel vp)
1115 List<Integer> cols = vp.getAlignViewport().getColumnSelection()
1117 AlignmentI alignment = vp.getAlignment();
1118 StructureSelectionManager sm = getSsm();
1119 for (SequenceI seq : alignment.getSequences())
1122 * convert selected columns into sequence positions
1124 int[] positions = new int[cols.size()];
1126 for (Integer col : cols)
1128 positions[i++] = seq.findPosition(col);
1130 sm.highlightStructure(this, seq, positions);