super(pdbsForFile, superposeAdded, theSeqs, ap);
}
+ /**
+ * Constructor given a session file to be loaded
+ *
+ * @param chimeraSessionFile
+ * @param alignPanel
+ * @param pdbArray
+ * @param seqsArray
+ * @param colourByChimera
+ * @param colourBySequence
+ * @param newViewId
+ */
+ public ChimeraXViewFrame(String chimeraSessionFile,
+ AlignmentPanel alignPanel, PDBEntry[] pdbArray,
+ SequenceI[][] seqsArray, boolean colourByChimera,
+ boolean colourBySequence, String newViewId)
+ {
+ super(chimeraSessionFile, alignPanel, pdbArray, seqsArray,
+ colourByChimera, colourBySequence, newViewId);
+ }
+
@Override
public ViewerType getViewerType()
{
import jalview.datamodel.features.FeatureMatcherI;
import jalview.datamodel.features.FeatureMatcherSet;
import jalview.datamodel.features.FeatureMatcherSetI;
+import jalview.ext.rbvi.chimera.JalviewChimeraBinding;
import jalview.ext.varna.RnaModel;
import jalview.gui.AlignFrame;
import jalview.gui.AlignViewport;
import jalview.gui.AlignmentPanel;
import jalview.gui.AppVarna;
import jalview.gui.ChimeraViewFrame;
+import jalview.gui.ChimeraXViewFrame;
import jalview.gui.Desktop;
+import jalview.gui.JalviewChimeraXBindingModel;
import jalview.gui.JvOptionPane;
import jalview.gui.OOMWarning;
import jalview.gui.PCAPanel;
* From 2.9: stateData.type contains JMOL or CHIMERA, data is in jar entry
* "viewer_"+stateData.viewId
*/
- String viewerType = stateData.getType();
- if (ViewerType.CHIMERA.toString().equals(viewerType))
- {
- createChimeraViewer(viewerData, af, jprovider);
- }
- if (ViewerType.PYMOL.toString().equals(viewerType))
+ ViewerType viewerType = ViewerType.valueOf(stateData.getType());
+ try
{
- createPymolViewer(viewerData, af, jprovider);
- }
- else
+ switch (viewerType)
+ {
+ case CHIMERA:
+ createChimeraViewer(viewerData, af, jprovider, false);
+ break;
+ case CHIMERAX:
+ createChimeraViewer(viewerData, af, jprovider, true);
+ break;
+ case PYMOL:
+ createPymolViewer(viewerData, af, jprovider);
+ break;
+ case JMOL:
+ createJmolViewer(viewerData, af, jprovider);
+ }
+ } catch (IllegalArgumentException | NullPointerException e)
{
- /*
- * else Jmol (if pre-2.9, stateData contains JMOL state string)
- */
- createJmolViewer(viewerData, af, jprovider);
+ Cache.log.error(
+ "Invalid structure viewer type: " + stateData.getType());
}
}
/**
- * Create a new Chimera viewer.
+ * Create a new Chimera or ChimeraX viewer
*
* @param data
* @param af
* @param jprovider
+ * @param isChimeraX
*/
protected void createChimeraViewer(
Entry<String, StructureViewerModel> viewerData, AlignFrame af,
- jarInputStreamProvider jprovider)
+ jarInputStreamProvider jprovider, boolean isChimeraX)
{
StructureViewerModel data = viewerData.getValue();
String chimeraSessionFile = data.getStateData();
* 'uniquified' sviewid used to reconstruct the viewer here
*/
String viewerJarEntryName = getViewerJarEntryName(data.getViewId());
+ String extension = isChimeraX
+ ? JalviewChimeraXBindingModel.CHIMERAX_SESSION_EXTENSION
+ : JalviewChimeraBinding.CHIMERA_SESSION_EXTENSION;
chimeraSessionFile = copyJarEntry(jprovider, viewerJarEntryName,
- "chimera", ".py");
+ "chimera", extension);
Set<Entry<File, StructureData>> fileData = data.getFileData()
.entrySet();
.toArray(new SequenceI[allseqs.size()][]);
String newViewId = viewerData.getKey();
- ChimeraViewFrame cvf = new ChimeraViewFrame(chimeraSessionFile,
- af.alignPanel, pdbArray, seqsArray, colourByChimera,
- colourBySequence, newViewId);
+ ChimeraViewFrame cvf = isChimeraX
+ ? new ChimeraXViewFrame(chimeraSessionFile, af.alignPanel,
+ pdbArray, seqsArray, colourByChimera, colourBySequence,
+ newViewId)
+ : new ChimeraViewFrame(chimeraSessionFile, af.alignPanel,
+ pdbArray, seqsArray, colourByChimera, colourBySequence,
+ newViewId);
cvf.setSize(data.getWidth(), data.getHeight());
cvf.setLocation(data.getX(), data.getY());
}