Clover icon

Coverage Report

  1. Project Clover database Thu Nov 28 2024 11:45:30 GMT
  2. Package jalview.gui

File JalviewChimeraXBindingModel.java

 

Coverage histogram

../../img/srcFileCovDistChart0.png
63% of files have more coverage

Code metrics

0
13
9
1
124
70
9
0.69
1.44
9
1

Classes

Class Line # Actions
JalviewChimeraXBindingModel 37 13 9
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
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.
11    *
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.
16    *
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.
20    */
21    package jalview.gui;
22   
23    import java.util.List;
24   
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;
36   
 
37    public class JalviewChimeraXBindingModel extends JalviewChimeraBindingModel
38    {
39    public static final String CHIMERAX_SESSION_EXTENSION = ".cxs";
40   
 
41  0 toggle public JalviewChimeraXBindingModel(ChimeraViewFrame chimeraViewFrame,
42    StructureSelectionManager ssm, PDBEntry[] pdbentry,
43    SequenceI[][] sequenceIs, DataSourceType protocol)
44    {
45  0 super(chimeraViewFrame, ssm, pdbentry, sequenceIs, protocol);
46  0 setStructureCommands(new ChimeraXCommands());
47    }
48   
 
49  0 toggle @Override
50    protected List<String> getChimeraPaths()
51    {
52  0 return StructureManager.getChimeraPaths(true);
53    }
54   
 
55  0 toggle @Override
56    protected void addChimeraModel(PDBEntry pe,
57    List<ChimeraModel> modelsToMap)
58    {
59    /*
60    * ChimeraX hack: force chimera model name to pdbId here
61    */
62  0 int modelNumber = chimeraMaps.size() + 1;
63  0 String command = "setattr #" + modelNumber + " models name "
64    + pe.getId();
65  0 executeCommand(new StructureCommand(command), false);
66  0 modelsToMap.add(new ChimeraModel(pe.getId(), ModelType.PDB_MODEL,
67    modelNumber, 0));
68    }
69   
70    /**
71    * {@inheritDoc}
72    *
73    * @return
74    */
 
75  0 toggle @Override
76    protected String getCommandFileExtension()
77    {
78  0 return ".cxc";
79    }
80   
81    /**
82    * Returns the file extension to use for a saved viewer session file (.cxs)
83    *
84    * @return
85    * @see https://www.cgl.ucsf.edu/chimerax/docs/user/commands/save.html#sesformat
86    */
 
87  0 toggle @Override
88    public String getSessionFileExtension()
89    {
90  0 return CHIMERAX_SESSION_EXTENSION;
91    }
92   
 
93  0 toggle @Override
94    public String getHelpURL()
95    {
96  0 return "http://www.rbvi.ucsf.edu/chimerax/docs/user/index.html";
97    }
98   
 
99  0 toggle @Override
100    protected ViewerType getViewerType()
101    {
102  0 return ViewerType.CHIMERAX;
103    }
104   
 
105  0 toggle @Override
106    protected String getModelId(int pdbfnum, String file)
107    {
108  0 return String.valueOf(pdbfnum + 1);
109    }
110   
111    /**
112    * Returns a model of the structure positions described by the ChimeraX format
113    * atomspec
114    *
115    * @param atomSpec
116    * @return
117    */
 
118  0 toggle @Override
119    protected AtomSpec parseAtomSpec(String atomSpec)
120    {
121  0 return AtomSpec.fromChimeraXAtomspec(atomSpec);
122    }
123   
124    }