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.structures.JalviewStructureDisplayI;
25 import jalview.bin.Cache;
26 import jalview.datamodel.AlignmentI;
27 import jalview.datamodel.HiddenColumns;
28 import jalview.datamodel.PDBEntry;
29 import jalview.datamodel.SearchResultMatchI;
30 import jalview.datamodel.SearchResultsI;
31 import jalview.datamodel.SequenceFeature;
32 import jalview.datamodel.SequenceI;
33 import jalview.gui.Preferences;
34 import jalview.gui.StructureViewer.ViewerType;
35 import jalview.httpserver.AbstractRequestHandler;
36 import jalview.io.DataSourceType;
37 import jalview.structure.AtomSpec;
38 import jalview.structure.StructureMappingcommandSet;
39 import jalview.structure.StructureSelectionManager;
40 import jalview.structures.models.AAStructureBindingModel;
41 import jalview.util.MessageManager;
44 import java.io.FileOutputStream;
45 import java.io.IOException;
46 import java.io.PrintWriter;
47 import java.net.BindException;
48 import java.util.ArrayList;
49 import java.util.BitSet;
50 import java.util.Collections;
51 import java.util.Iterator;
52 import java.util.LinkedHashMap;
53 import java.util.List;
56 import ext.edu.ucsf.rbvi.strucviz2.ChimeraManager;
57 import ext.edu.ucsf.rbvi.strucviz2.ChimeraModel;
58 import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
59 import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
61 public abstract class JalviewChimeraBinding extends AAStructureBindingModel
63 public static final String CHIMERA_FEATURE_GROUP = "Chimera";
65 // Chimera clause to exclude alternate locations in atom selection
66 private static final String NO_ALTLOCS = "&~@.B-Z&~@.2-9";
68 private static final boolean debug = false;
70 private static final String PHOSPHORUS = "P";
72 private static final String ALPHACARBON = "CA";
75 * Object through which we talk to Chimera
77 private ChimeraManager chimeraManager;
80 * Object which listens to Chimera notifications
82 private AbstractRequestHandler chimeraListener;
85 * Map of ChimeraModel objects keyed by PDB full local file name
87 private Map<String, List<ChimeraModel>> chimeraMaps = new LinkedHashMap<>();
89 String lastHighlightCommand;
91 private Thread chimeraMonitor;
94 * Open a PDB structure file in Chimera and set up mappings from Jalview.
96 * We check if the PDB model id is already loaded in Chimera, if so don't reopen
97 * it. This is the case if Chimera has opened a saved session file.
102 public boolean openFile(PDBEntry pe)
104 String file = pe.getFile();
107 List<ChimeraModel> modelsToMap = new ArrayList<>();
108 List<ChimeraModel> oldList = chimeraManager.getModelList();
109 boolean alreadyOpen = false;
112 * If Chimera already has this model, don't reopen it, but do remap it.
114 for (ChimeraModel open : oldList)
116 if (open.getModelName().equals(pe.getId()))
119 modelsToMap.add(open);
124 * If Chimera doesn't yet have this model, ask it to open it, and retrieve
125 * the model name(s) added by Chimera.
129 chimeraManager.openModel(file, pe.getId(), ModelType.PDB_MODEL);
130 if (chimeraManager.isChimeraX())
133 * ChimeraX hack: force chimera model name to pdbId
135 int modelNumber = chimeraMaps.size() + 1;
136 String command = "setattr #" + modelNumber + " models name "
138 executeCommand(command, false);
139 modelsToMap.add(new ChimeraModel(pe.getId(), ModelType.PDB_MODEL,
145 * Chimera: query for actual models and find the one with
146 * matching model name - set in viewer.openModel()
148 List<ChimeraModel> newList = chimeraManager.getModelList();
149 // JAL-1728 newList.removeAll(oldList) does not work
150 for (ChimeraModel cm : newList)
152 if (cm.getModelName().equals(pe.getId()))
160 chimeraMaps.put(file, modelsToMap);
162 if (getSsm() != null)
164 getSsm().addStructureViewerListener(this);
167 } catch (Exception q)
169 log("Exception when trying to open model " + file + "\n"
184 public JalviewChimeraBinding(StructureSelectionManager ssm,
185 PDBEntry[] pdbentry, SequenceI[][] sequenceIs,
186 DataSourceType protocol)
188 super(ssm, pdbentry, sequenceIs, protocol);
189 chimeraManager = new ChimeraManager(new StructureManager(true));
190 String viewerType = Cache.getProperty(Preferences.STRUCTURE_DISPLAY);
191 chimeraManager.setChimeraX(ViewerType.CHIMERAX.name().equals(viewerType));
192 setStructureCommands(new ChimeraCommands());
196 * Starts a thread that waits for the Chimera process to finish, so that we can
197 * then close the associated resources. This avoids leaving orphaned Chimera
198 * viewer panels in Jalview if the user closes Chimera.
200 protected void startChimeraProcessMonitor()
202 final Process p = chimeraManager.getChimeraProcess();
203 chimeraMonitor = new Thread(new Runnable()
212 JalviewStructureDisplayI display = getViewer();
215 display.closeViewer(false);
217 } catch (InterruptedException e)
219 // exit thread if Chimera Viewer is closed in Jalview
223 chimeraMonitor.start();
227 * Start a dedicated HttpServer to listen for Chimera notifications, and tell it
230 public void startChimeraListener()
234 chimeraListener = new ChimeraListener(this);
235 chimeraManager.startListening(chimeraListener.getUri());
236 } catch (BindException e)
239 "Failed to start Chimera listener: " + e.getMessage());
244 * Close down the Jalview viewer and listener, and (optionally) the associated
247 public void closeViewer(boolean closeChimera)
249 getSsm().removeStructureViewerListener(this, this.getStructureFiles());
252 chimeraManager.exitChimera();
254 if (this.chimeraListener != null)
256 chimeraListener.shutdown();
257 chimeraListener = null;
259 chimeraManager = null;
261 if (chimeraMonitor != null)
263 chimeraMonitor.interrupt();
265 releaseUIResources();
272 public String superposeStructures(AlignmentI[] _alignment,
273 int[] _refStructure, HiddenColumns[] _hiddenCols)
275 StringBuilder allComs = new StringBuilder(128);
276 String[] files = getStructureFiles();
278 if (!waitForFileLoad(files))
284 StringBuilder selectioncom = new StringBuilder(256);
285 boolean chimeraX = chimeraManager.isChimeraX();
286 for (int a = 0; a < _alignment.length; a++)
288 int refStructure = _refStructure[a];
289 AlignmentI alignment = _alignment[a];
290 HiddenColumns hiddenCols = _hiddenCols[a];
292 if (refStructure >= files.length)
294 System.err.println("Ignoring invalid reference structure value "
300 * 'matched' bit i will be set for visible alignment columns i where
301 * all sequences have a residue with a mapping to the PDB structure
303 BitSet matched = new BitSet();
304 for (int m = 0; m < alignment.getWidth(); m++)
306 if (hiddenCols == null || hiddenCols.isVisible(m))
312 SuperposeData[] structures = new SuperposeData[files.length];
313 for (int f = 0; f < files.length; f++)
315 structures[f] = new SuperposeData(alignment.getWidth());
319 * Calculate the superposable alignment columns ('matched'), and the
320 * corresponding structure residue positions (structures.pdbResNo)
322 int candidateRefStructure = findSuperposableResidues(alignment,
323 matched, structures);
324 if (refStructure < 0)
327 * If no reference structure was specified, pick the first one that has
328 * a mapping in the alignment
330 refStructure = candidateRefStructure;
333 int nmatched = matched.cardinality();
336 return MessageManager.formatMessage("label.insufficient_residues",
341 * Generate select statements to select regions to superimpose structures
343 String[] selcom = new String[files.length];
344 for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
346 final int modelNo = pdbfnum + (chimeraX ? 1 : 0);
347 // todo correct resolution to model number
348 String chainCd = "." + structures[pdbfnum].chain;
351 StringBuilder molsel = new StringBuilder();
354 molsel.append("/" + structures[pdbfnum].chain + ":");
357 int nextColumnMatch = matched.nextSetBit(0);
358 while (nextColumnMatch != -1)
360 int pdbResNum = structures[pdbfnum].pdbResNo[nextColumnMatch];
361 if (lpos != pdbResNum - 1)
364 * discontiguous - append last residue now
368 molsel.append(String.valueOf(lpos));
371 molsel.append(chainCd);
380 * extending a contiguous run
385 * start the range selection
387 molsel.append(String.valueOf(lpos));
393 nextColumnMatch = matched.nextSetBit(nextColumnMatch + 1);
397 * and terminate final selection
401 molsel.append(String.valueOf(lpos));
404 molsel.append(chainCd);
407 if (molsel.length() > 1)
409 selcom[pdbfnum] = molsel.toString();
410 selectioncom.append("#").append(String.valueOf(modelNo));
413 selectioncom.append(":");
415 selectioncom.append(selcom[pdbfnum]);
416 // selectioncom.append(" ");
417 if (pdbfnum < files.length - 1)
419 selectioncom.append("|");
424 selcom[pdbfnum] = null;
428 StringBuilder command = new StringBuilder(256);
429 for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
431 final int modelNo = pdbfnum + (chimeraX ? 1 : 0);
432 if (pdbfnum == refStructure || selcom[pdbfnum] == null
433 || selcom[refStructure] == null)
437 if (command.length() > 0)
443 * Form Chimera match command, from the 'new' structure to the
444 * 'reference' structure e.g. (50 residues, chain B/A, alphacarbons):
446 * match #1:1-30.B,81-100.B@CA #0:21-40.A,61-90.A@CA
449 * https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/match.html
451 command.append(chimeraX ? "align " : "match ");
452 command.append(getModelSpec(modelNo));
457 command.append(selcom[pdbfnum]);
458 command.append("@").append(
459 structures[pdbfnum].isRna ? PHOSPHORUS : ALPHACARBON);
460 // JAL-1757 exclude alternate CA locations - ChimeraX syntax tbd
463 command.append(NO_ALTLOCS);
465 command.append(chimeraX ? " toAtoms " : " ")
466 .append(getModelSpec(refStructure + (chimeraX ? 1 : 0)));
471 command.append(selcom[refStructure]);
472 command.append("@").append(
473 structures[refStructure].isRna ? PHOSPHORUS : ALPHACARBON);
476 command.append(NO_ALTLOCS);
479 if (selectioncom.length() > 0)
483 System.out.println("Select regions:\n" + selectioncom.toString());
485 "Superimpose command(s):\n" + command.toString());
487 // allComs.append("~display all; ");
490 // allComs.append("show ").append(selectioncom.toString())
491 // .append(" pbonds");
495 // allComs.append("chain @CA|P; ribbon ");
496 // allComs.append(selectioncom.toString());
498 if (allComs.length() > 0) {
501 allComs.append(command.toString());
506 if (selectioncom.length() > 0)
508 // TODO: visually distinguish regions that were superposed
509 if (selectioncom.substring(selectioncom.length() - 1).equals("|"))
511 selectioncom.setLength(selectioncom.length() - 1);
515 System.out.println("Select regions:\n" + selectioncom.toString());
517 allComs.append(";~display all; ");
520 allComs.append("show @CA|P pbonds; show ")
521 .append(selectioncom.toString()).append(" ribbons; view");
525 allComs.append("chain @CA|P; ribbon ; focus");
526 allComs.append(selectioncom.toString());
528 // allComs.append("; ~display all; chain @CA|P; ribbon ")
529 // .append(selectioncom.toString()).append("; focus");
530 List<String> chimeraReplies = executeCommand(allComs.toString(),
532 for (String reply : chimeraReplies)
534 if (reply.toLowerCase().contains("unequal numbers of atoms"))
544 * Helper method to construct model spec in Chimera format:
546 * <li>#0 (#1 etc) for a PDB file with no sub-models</li>
547 * <li>#0.1 (#1.1 etc) for a PDB file with sub-models</li>
549 * Note for now we only ever choose the first of multiple models. This
550 * corresponds to the hard-coded Jmol equivalent (compare {1.1}). Refactor in
551 * future if there is a need to select specific sub-models.
556 protected String getModelSpec(int pdbfnum)
558 if (pdbfnum < 0 || pdbfnum >= getPdbCount())
560 return "#" + pdbfnum; // temp hack for ChimeraX
564 * For now, the test for having sub-models is whether multiple Chimera
565 * models are mapped for the PDB file; the models are returned as a response
566 * to the Chimera command 'list models type molecule', see
567 * ChimeraManager.getModelList().
569 List<ChimeraModel> maps = chimeraMaps.get(getStructureFiles()[pdbfnum]);
570 boolean hasSubModels = maps != null && maps.size() > 1;
571 return "#" + String.valueOf(pdbfnum) + (hasSubModels ? ".1" : "");
575 * Launch Chimera, unless an instance linked to this object is already
576 * running. Returns true if Chimera is successfully launched, or already
577 * running, else false.
581 public boolean launchChimera()
583 if (chimeraManager.isChimeraLaunched())
588 boolean launched = chimeraManager.launchChimera(
589 StructureManager.getChimeraPaths(chimeraManager.isChimeraX()));
592 startChimeraProcessMonitor();
596 log("Failed to launch Chimera!");
602 * Answers true if the Chimera process is still running, false if ended or not
607 public boolean isChimeraRunning()
609 return chimeraManager.isChimeraLaunched();
613 * Send a command to Chimera, and optionally log and return any responses.
619 public List<String> executeCommand(final String command,
622 if (chimeraManager == null || command == null)
624 // ? thread running after viewer shut down
627 List<String> reply = null;
628 // trim command or it may never find a match in the replyLog!!
629 List<String> lastReply = chimeraManager
630 .sendChimeraCommand(command.trim(), getResponse);
636 log("Response from command ('" + command + "') was:\n" + lastReply);
644 * Send a Chimera command asynchronously in a new thread. If the progress
645 * message is not null, display this message while the command is executing.
650 protected abstract void sendAsynchronousCommand(String command,
656 protected void executeWhenReady(String command)
659 executeCommand(command, false);
663 private void waitForChimera()
665 while (chimeraManager != null && chimeraManager.isBusy())
670 } catch (InterruptedException q)
677 public synchronized String[] getStructureFiles()
679 if (chimeraManager == null)
681 return new String[0];
684 return chimeraMaps.keySet()
685 .toArray(modelFileNames = new String[chimeraMaps.size()]);
689 * Construct and send a command to highlight zero, one or more atoms. We do this
690 * by sending an "rlabel" command to show the residue label at that position.
693 public void highlightAtoms(List<AtomSpec> atoms)
695 if (atoms == null || atoms.size() == 0)
700 boolean forChimeraX = chimeraManager.isChimeraX();
701 StringBuilder cmd = new StringBuilder(128);
702 boolean first = true;
703 boolean found = false;
705 for (AtomSpec atom : atoms)
707 int pdbResNum = atom.getPdbResNum();
708 String chain = atom.getChain();
709 String pdbfile = atom.getPdbFile();
710 List<ChimeraModel> cms = chimeraMaps.get(pdbfile);
711 if (cms != null && !cms.isEmpty())
715 cmd.append(forChimeraX ? "label #" : "rlabel #");
724 cmd.append(cms.get(0).getModelNumber())
725 .append("/").append(chain).append(":").append(pdbResNum);
729 cmd.append(cms.get(0).getModelNumber())
730 .append(":").append(pdbResNum);
731 if (!chain.equals(" ") && !forChimeraX)
733 cmd.append(".").append(chain);
739 String command = cmd.toString();
742 * avoid repeated commands for the same residue
744 if (command.equals(lastHighlightCommand))
750 * unshow the label for the previous residue
752 if (lastHighlightCommand != null)
754 chimeraManager.sendChimeraCommand("~" + lastHighlightCommand, false);
758 chimeraManager.sendChimeraCommand(command, false);
760 this.lastHighlightCommand = command;
764 * Query Chimera for its current selection, and highlight it on the alignment
766 public void highlightChimeraSelection()
769 * Ask Chimera for its current selection
771 List<String> selection = chimeraManager.getSelectedResidueSpecs();
774 * Parse model number, residue and chain for each selected position,
775 * formatted as #0:123.A or #1.2:87.B (#model.submodel:residue.chain)
777 List<AtomSpec> atomSpecs = convertStructureResiduesToAlignment(
781 * Broadcast the selection (which may be empty, if the user just cleared all
784 getSsm().mouseOverStructure(atomSpecs);
788 * Converts a list of Chimera atomspecs to a list of AtomSpec representing the
789 * corresponding residues (if any) in Jalview
791 * @param structureSelection
794 protected List<AtomSpec> convertStructureResiduesToAlignment(
795 List<String> structureSelection)
797 boolean chimeraX = chimeraManager.isChimeraX();
798 List<AtomSpec> atomSpecs = new ArrayList<>();
799 for (String atomSpec : structureSelection)
803 AtomSpec spec = AtomSpec.fromChimeraAtomspec(atomSpec, chimeraX);
804 String pdbfilename = getPdbFileForModel(spec.getModelNumber());
805 spec.setPdbFile(pdbfilename);
807 } catch (IllegalArgumentException e)
809 System.err.println("Failed to parse atomspec: " + atomSpec);
819 protected String getPdbFileForModel(int modelId)
822 * Work out the pdbfilename from the model number
824 String pdbfilename = modelFileNames[0];
825 findfileloop: for (String pdbfile : this.chimeraMaps.keySet())
827 for (ChimeraModel cm : chimeraMaps.get(pdbfile))
829 if (cm.getModelNumber() == modelId)
831 pdbfilename = pdbfile;
839 private void log(String message)
841 System.err.println("## Chimera log: " + message);
845 * Ask Chimera to save its session to the given file. Returns true if
846 * successful, else false.
851 public boolean saveSession(String filepath)
853 if (isChimeraRunning())
856 * Chimera: https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/save.html
857 * ChimeraX: https://www.cgl.ucsf.edu/chimerax/docs/user/commands/save.html
859 String command = isChimeraX() ? "save session " : "save ";
860 List<String> reply = chimeraManager.sendChimeraCommand(command + filepath,
862 if (reply.contains("Session written"))
869 .error("Error saving Chimera session: " + reply.toString());
876 * Ask Chimera to open a session file. Returns true if successful, else false.
877 * The filename must have a .py (Chimera) or .cxs (ChimeraX) extension for
878 * this command to work.
883 public boolean openSession(String filepath)
886 * Chimera: https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/open.html
887 * ChimeraX: https://www.cgl.ucsf.edu/chimerax/docs/user/commands/open.html
889 executeCommand("open " + filepath, true);
890 // todo: test for failure - how?
895 * Send a 'show' command for all atoms in the currently selected columns
897 * TODO: pull up to abstract structure viewer interface
901 public void highlightSelection(AlignmentViewPanel vp)
903 List<Integer> cols = vp.getAlignViewport().getColumnSelection()
905 AlignmentI alignment = vp.getAlignment();
906 StructureSelectionManager sm = getSsm();
907 for (SequenceI seq : alignment.getSequences())
910 * convert selected columns into sequence positions
912 int[] positions = new int[cols.size()];
914 for (Integer col : cols)
916 positions[i++] = seq.findPosition(col);
918 sm.highlightStructure(this, seq, positions);
923 * Constructs and send commands to Chimera to set attributes on residues for
924 * features visible in Jalview
929 public int sendFeaturesToViewer(AlignmentViewPanel avp)
931 // TODO refactor as required to pull up to an interface
932 String[] files = getStructureFiles();
938 StructureMappingcommandSet commandSet = ChimeraCommands
939 .getSetAttributeCommandsForFeatures(getSsm(), files,
940 getSequence(), avp, chimeraManager.isChimeraX());
941 String[] commands = commandSet.commands;
942 if (commands.length > 10)
944 sendCommandsByFile(commands);
948 for (String command : commands)
950 sendAsynchronousCommand(command, null);
953 return commands.length;
957 * Write commands to a temporary file, and send a command to Chimera to open the
958 * file as a commands script. For use when sending a large number of separate
959 * commands would overload the REST interface mechanism.
963 protected void sendCommandsByFile(String[] commands)
965 boolean toChimeraX = chimeraManager.isChimeraX();
968 File tmp = File.createTempFile("chim", toChimeraX ? ".cxc" : ".com");
970 PrintWriter out = new PrintWriter(new FileOutputStream(tmp));
971 for (String command : commands)
973 out.println(command);
977 String path = tmp.getAbsolutePath();
978 String command = "open " + (toChimeraX ? "" : "cmd:") + path;
979 sendAsynchronousCommand(command, null);
980 } catch (IOException e)
982 System.err.println("Sending commands to Chimera via file failed with "
988 * Get Chimera residues which have the named attribute, find the mapped
989 * positions in the Jalview sequence(s), and set as sequence features
992 * @param alignmentPanel
994 public void copyStructureAttributesToFeatures(String attName,
995 AlignmentViewPanel alignmentPanel)
997 // todo pull up to AAStructureBindingModel (and interface?)
1000 * ask Chimera to list residues with the attribute, reporting its value
1002 // this alternative command
1003 // list residues spec ':*/attName' attr attName
1004 // doesn't report 'None' values (which is good), but
1005 // fails for 'average.bfactor' (which is bad):
1007 String cmd = "list residues attr '" + attName + "'";
1008 List<String> residues = executeCommand(cmd, true);
1010 boolean featureAdded = createFeaturesForAttributes(attName, residues);
1013 alignmentPanel.getFeatureRenderer().featuresAdded();
1018 * Create features in Jalview for the given attribute name and structure
1022 * The residue list should be 0, 1 or more reply lines of the format:
1023 * residue id #0:5.A isHelix -155.000836316 index 5
1025 * residue id #0:6.A isHelix None
1032 protected boolean createFeaturesForAttributes(String attName,
1033 List<String> residues)
1035 boolean featureAdded = false;
1036 String featureGroup = getViewerFeatureGroup();
1037 boolean chimeraX = chimeraManager.isChimeraX();
1039 for (String residue : residues)
1041 AtomSpec spec = null;
1042 String[] tokens = residue.split(" ");
1043 if (tokens.length < 5)
1047 String atomSpec = tokens[2];
1048 String attValue = tokens[4];
1051 * ignore 'None' (e.g. for phi) or 'False' (e.g. for isHelix)
1053 if ("None".equalsIgnoreCase(attValue)
1054 || "False".equalsIgnoreCase(attValue))
1061 spec = AtomSpec.fromChimeraAtomspec(atomSpec, chimeraX);
1062 } catch (IllegalArgumentException e)
1064 System.err.println("Problem parsing atomspec " + atomSpec);
1068 String chainId = spec.getChain();
1069 String description = attValue;
1070 float score = Float.NaN;
1073 score = Float.valueOf(attValue);
1074 description = chainId;
1075 } catch (NumberFormatException e)
1077 // was not a float value
1080 String pdbFile = getPdbFileForModel(spec.getModelNumber());
1081 spec.setPdbFile(pdbFile);
1083 List<AtomSpec> atoms = Collections.singletonList(spec);
1086 * locate the mapped position in the alignment (if any)
1088 SearchResultsI sr = getSsm()
1089 .findAlignmentPositionsForStructurePositions(atoms);
1092 * expect one matched alignment position, or none
1093 * (if the structure position is not mapped)
1095 for (SearchResultMatchI m : sr.getResults())
1097 SequenceI seq = m.getSequence();
1098 int start = m.getStart();
1099 int end = m.getEnd();
1100 SequenceFeature sf = new SequenceFeature(attName, description,
1101 start, end, score, featureGroup);
1102 // todo: should SequenceFeature have an explicit property for chain?
1103 // note: repeating the action shouldn't duplicate features
1104 featureAdded |= seq.addSequenceFeature(sf);
1107 return featureAdded;
1111 * Answers the feature group name to apply to features created in Jalview from
1112 * Chimera attributes
1116 protected String getViewerFeatureGroup()
1118 // todo pull up to interface
1119 return CHIMERA_FEATURE_GROUP;
1123 public int getModelNoForFile(String pdbFile)
1125 List<ChimeraModel> foundModels = chimeraMaps.get(pdbFile);
1126 if (foundModels != null && !foundModels.isEmpty())
1128 return foundModels.get(0).getModelNumber();
1134 * Answers a (possibly empty) list of attribute names in Chimera[X], excluding
1135 * any which were added from Jalview
1139 public List<String> getChimeraAttributes()
1141 List<String> atts = chimeraManager.getAttrList();
1142 Iterator<String> it = atts.iterator();
1143 while (it.hasNext())
1145 if (it.next().startsWith(ChimeraCommands.NAMESPACE_PREFIX))
1148 * attribute added from Jalview - exclude it
1156 public boolean isChimeraX()
1158 return chimeraManager.isChimeraX();