label.autoadd_temp = Add Temperature Factor annotation to alignment
label.structure_viewer = Default structure viewer
label.double_click_to_browse = Double-click to browse for file
-label.chimera_path = Path to Chimera program
+label.chimera_path = Path to Chimera(X) program
label.chimera_path_tip = Jalview will first try any path entered here, else standard installation locations.<br>Double-click to browse for file.
label.invalid_chimera_path = Chimera path not found or not executable
label.chimera_missing = Chimera structure viewer not found.<br/>Please enter the path to Chimera (if installed),<br/>or download and install UCSF Chimera.
List<String> selectedResidues = new ArrayList<>();
/*
- * skip for now if ChimeraX - times out
+ * skip for now if ChimeraX - request times out
*/
if (isChimeraX)
{
{
return isChimeraX;
}
+
+ public void setChimeraX(boolean b)
+ {
+ isChimeraX = b;
+ }
}
StructureSettings defaultSettings = null;
// TODO: [Optional] Change priority of Chimera paths
- public static List<String> getChimeraPaths()
+ public static List<String> getChimeraPaths(boolean isChimeraX)
{
List<String> pathList = new ArrayList<>();
/*
* Jalview addition: check if path set in user preferences.
*/
- String userPath = Cache.getDefault(Preferences.CHIMERA_PATH, null);
+ String userPath = Cache
+ .getDefault(isChimeraX ? Preferences.CHIMERAX_PATH
+ : Preferences.CHIMERA_PATH, null);
if (userPath != null)
{
pathList.add(0, userPath);
}
+ // FIXME get an updated StructureManager for code for ChimeraX paths
+ String chimera = isChimeraX ? "ChimeraX" : "chimera";
+
// Add default installation paths
String os = System.getProperty("os.name");
if (os.startsWith("Linux"))
{
- pathList.add("/usr/local/chimera/bin/chimera");
- pathList.add("/usr/local/bin/chimera");
- pathList.add("/usr/bin/chimera");
- pathList.add(System.getProperty("user.home") + "/opt/bin/chimera");
+ pathList.add("/usr/local/chimera/bin/" + chimera);
+ pathList.add("/usr/local/bin/" + chimera);
+ pathList.add("/usr/bin/" + chimera);
+ pathList.add(System.getProperty("user.home") + "/opt/bin/" + chimera);
}
else if (os.startsWith("Windows"))
{
for (String version : new String[] { "1.11", "1.11.1", "1.11.2",
"1.12", "1.12.1", "1.12.2", "1.13" })
{
- pathList.add(root + "\\Chimera " + version + "\\bin\\chimera");
+ pathList.add(root + "\\Chimera " + version + "\\bin\\" + chimera);
pathList.add(
- root + "\\Chimera " + version + "\\bin\\chimera.exe");
+ root + "\\Chimera " + version + "\\bin\\" + chimera
+ + ".exe");
}
}
}
else if (os.startsWith("Mac"))
{
- pathList.add("/Applications/Chimera.app/Contents/MacOS/chimera");
+ pathList.add("/Applications/Chimera.app/Contents/MacOS/" + chimera);
}
return pathList;
}
import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
+import jalview.gui.Preferences;
+import jalview.gui.StructureViewer.ViewerType;
import jalview.httpserver.AbstractRequestHandler;
import jalview.io.DataSourceType;
import jalview.schemes.ColourSchemeI;
{
super(ssm, pdbentry, sequenceIs, protocol);
viewer = new ChimeraManager(new StructureManager(true));
+ String viewerType = Cache.getProperty(Preferences.STRUCTURE_DISPLAY);
+ viewer.setChimeraX(ViewerType.CHIMERAX.name().equals(viewerType));
+
}
/**
return true;
}
- boolean launched = viewer
- .launchChimera(StructureManager.getChimeraPaths());
+ boolean launched = viewer.launchChimera(
+ StructureManager.getChimeraPaths(viewer.isChimeraX()));
if (launched)
{
startChimeraProcessMonitor();
public static final String CHIMERA_PATH = "CHIMERA_PATH";
+ public static final String CHIMERAX_PATH = "CHIMERAX_PATH";
+
public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
addSecondaryStructure.setEnabled(structSelected);
addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false));
addTempFactor.setEnabled(structSelected);
- structViewer.setSelectedItem(
- Cache.getDefault(STRUCTURE_DISPLAY, ViewerType.JMOL.name()));
- chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, ""));
+ String viewerType = Cache.getDefault(STRUCTURE_DISPLAY, ViewerType.JMOL.name());
+ structViewer.setSelectedItem(viewerType);
+ boolean isChimeraX = viewerType.equals(ViewerType.CHIMERAX.name());
+ if (viewerType.equals(ViewerType.JMOL.name()))
+ {
+ chimeraPath.setText("");
+ }
+ else
+ {
+ chimeraPath.setText(Cache
+ .getDefault(isChimeraX ? CHIMERAX_PATH : CHIMERA_PATH, ""));
+ }
chimeraPath.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- validateChimeraPath();
+ if (validateChimeraPath())
+ {
+ Cache.setProperty(structViewer.getSelectedItem()
+ .equals(ViewerType.CHIMERAX.name())
+ ? CHIMERAX_PATH
+ : CHIMERA_PATH, chimeraPath.getText());
+ }
}
});
doReset.addActionListener(onReset);
// filter to display only custom urls
- final RowFilter<TableModel, Object> customUrlFilter = new RowFilter<TableModel, Object>()
+ final RowFilter<TableModel, Object> customUrlFilter = new RowFilter<>()
{
@Override
public boolean include(
Boolean.toString(structFromPdb.isSelected()));
Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY,
structViewer.getSelectedItem().toString());
- Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText());
+ boolean isChimeraX = structViewer.getSelectedItem().toString()
+ .equals(ViewerType.CHIMERAX.name());
+ Cache.setOrRemove(isChimeraX ? CHIMERAX_PATH : CHIMERA_PATH,
+ chimeraPath.getText());
Cache.applicationProperties.setProperty("MAP_WITH_SIFTS",
Boolean.toString(siftsMapping.isSelected()));
SiftsSettings.setMapWithSifts(siftsMapping.isSelected());
}
/**
- * If Chimera is selected, check it can be found on default or user-specified
- * path, if not show a warning/help dialog.
+ * If Chimera or ChimeraX is selected, check it can be found on default or
+ * user-specified path, if not show a warning/help dialog.
*/
@Override
protected void structureViewer_actionPerformed(String selectedItem)
{
- if (!selectedItem.equals(ViewerType.CHIMERA.name()))
+ if (selectedItem.equals(ViewerType.JMOL.name()))
{
+ chimeraPath.setEnabled(false);
return;
}
boolean found = false;
+ chimeraPath.setEnabled(true);
/*
* Try user-specified and standard paths for Chimera executable.
*/
- List<String> paths = StructureManager.getChimeraPaths();
+ boolean isChimeraX = selectedItem.equals(ViewerType.CHIMERAX.name());
+ chimeraPath.setText(Cache
+ .getDefault(isChimeraX ? CHIMERAX_PATH : CHIMERA_PATH, ""));
+
+ List<String> paths = StructureManager.getChimeraPaths(isChimeraX);
paths.add(0, chimeraPath.getText());
for (String path : paths)
{
public enum ViewerType
{
- JMOL, CHIMERA
+ JMOL, CHIMERA, CHIMERAX
};
/**
{
sview = new AppJmol(ap, superposeAdded, pdbsForFile, theSeqs);
}
- else if (viewerType.equals(ViewerType.CHIMERA))
+ else if (viewerType.equals(ViewerType.CHIMERA)
+ || viewerType.equals(ViewerType.CHIMERAX))
{
sview = new ChimeraViewFrame(pdbsForFile, superposeAdded, theSeqs,
ap);
{
sview = new AppJmol(pdb, seqsForPdb, null, ap);
}
- else if (viewerType.equals(ViewerType.CHIMERA))
+ else if (viewerType.equals(ViewerType.CHIMERA)
+ || viewerType.equals(ViewerType.CHIMERAX))
{
sview = new ChimeraViewFrame(pdb, seqsForPdb, null, ap);
}
structureTab.setBorder(new TitledBorder(
MessageManager.getString("label.structure_options")));
structureTab.setLayout(null);
- final int width = 400;
+ final int width = 420;
final int height = 22;
final int lineSpacing = 25;
int ypos = 15;
viewerLabel.setFont(LABEL_FONT);
viewerLabel.setHorizontalAlignment(SwingConstants.LEFT);
viewerLabel.setText(MessageManager.getString("label.structure_viewer"));
- viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
+ viewerLabel.setBounds(new Rectangle(10, ypos, 220, height));
structureTab.add(viewerLabel);
structViewer.setFont(LABEL_FONT);
- structViewer.setBounds(new Rectangle(160, ypos, 120, height));
+ structViewer.setBounds(new Rectangle(180, ypos, 120, height));
structViewer.addItem(ViewerType.JMOL.name());
structViewer.addItem(ViewerType.CHIMERA.name());
+ structViewer.addItem(ViewerType.CHIMERAX.name());
structViewer.addActionListener(new ActionListener()
{
@Override
pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
pathLabel.setText(MessageManager.getString("label.chimera_path"));
- pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
+ pathLabel.setBounds(new Rectangle(10, ypos, 160, height));
structureTab.add(pathLabel);
chimeraPath.setFont(LABEL_FONT);
final String tooltip = JvSwingUtils.wrapTooltip(true,
MessageManager.getString("label.chimera_path_tip"));
chimeraPath.setToolTipText(tooltip);
- chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
+ chimeraPath.setBounds(new Rectangle(180, ypos, 300, height));
chimeraPath.addMouseListener(new MouseAdapter()
{
@Override
MessageManager.getString("label.mapping_method"));
mmTitledBorder.setTitleFont(LABEL_FONT);
mappingPanel.setBorder(mmTitledBorder);
- mappingPanel.setBounds(new Rectangle(10, ypos, 452, 45));
+ mappingPanel.setBounds(new Rectangle(10, ypos, 472, 45));
// GridLayout mappingLayout = new GridLayout();
mappingPanel.setLayout(new GridLayout());
mappingPanel.add(nwMapping);
ypos += lineSpacing;
FTSDataColumnPreferences docFieldPref = new FTSDataColumnPreferences(
PreferenceSource.PREFERENCES, PDBFTSRestClient.getInstance());
- docFieldPref.setBounds(new Rectangle(10, ypos, 450, 120));
+ docFieldPref.setBounds(new Rectangle(10, ypos, 470, 120));
structureTab.add(docFieldPref);
return structureTab;
final StructureManager structureManager = new StructureManager(true);
ChimeraManager cm = new ChimeraManager(structureManager);
assertTrue("Couldn't launch chimera",
- cm.launchChimera(StructureManager.getChimeraPaths()));
+ cm.launchChimera(StructureManager.getChimeraPaths(false)));
assertTrue(cm.isChimeraLaunched()); // Chimera process is alive
// int n=0;
// not sure of the point of this is unless the tester is loading models