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.
23 import java.util.List;
25 import ext.edu.ucsf.rbvi.strucviz2.ChimeraModel;
26 import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
27 import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType;
28 import jalview.datamodel.PDBEntry;
29 import jalview.datamodel.SequenceI;
30 import jalview.ext.rbvi.chimera.ChimeraXCommands;
31 import jalview.gui.StructureViewer.ViewerType;
32 import jalview.io.DataSourceType;
33 import jalview.structure.AtomSpec;
34 import jalview.structure.StructureCommand;
35 import jalview.structure.StructureSelectionManager;
37 public class JalviewChimeraXBindingModel extends JalviewChimeraBindingModel
39 public static final String CHIMERAX_SESSION_EXTENSION = ".cxs";
41 public JalviewChimeraXBindingModel(ChimeraViewFrame chimeraViewFrame,
42 StructureSelectionManager ssm, PDBEntry[] pdbentry,
43 SequenceI[][] sequenceIs, DataSourceType protocol)
45 super(chimeraViewFrame, ssm, pdbentry, sequenceIs, protocol);
46 setStructureCommands(new ChimeraXCommands());
50 protected List<String> getChimeraPaths()
52 return StructureManager.getChimeraPaths(true);
56 protected void addChimeraModel(PDBEntry pe,
57 List<ChimeraModel> modelsToMap)
60 * ChimeraX hack: force chimera model name to pdbId here
62 int modelNumber = chimeraMaps.size() + 1;
63 String command = "setattr #" + modelNumber + " models name "
65 executeCommand(new StructureCommand(command), false);
66 modelsToMap.add(new ChimeraModel(pe.getId(), ModelType.PDB_MODEL,
76 protected String getCommandFileExtension()
82 * Returns the file extension to use for a saved viewer session file (.cxs)
85 * @see https://www.cgl.ucsf.edu/chimerax/docs/user/commands/save.html#sesformat
88 public String getSessionFileExtension()
90 return CHIMERAX_SESSION_EXTENSION;
94 public String getHelpURL()
96 return "http://www.rbvi.ucsf.edu/chimerax/docs/user/index.html";
100 protected ViewerType getViewerType()
102 return ViewerType.CHIMERAX;
106 protected String getModelId(int pdbfnum, String file)
108 return String.valueOf(pdbfnum + 1);
112 * Returns a model of the structure positions described by the ChimeraX format
119 protected AtomSpec parseAtomSpec(String atomSpec)
121 return AtomSpec.fromChimeraXAtomspec(atomSpec);