private static final String ALPHACARBON = "CA";
+ private List<String> chainNames = new ArrayList<String>();
+
+ private Hashtable<String, String> chainFile = new Hashtable<String, String>();
++
/*
* Object through which we talk to Chimera
*/
* @param protocol
*/
public JalviewChimeraBinding(StructureSelectionManager ssm,
- PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains,
- String protocol)
+ PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String protocol)
{
- super(ssm, pdbentry, sequenceIs, chains, protocol);
+ super(ssm, pdbentry, sequenceIs, protocol);
- viewer = new ChimeraManager(
- new ext.edu.ucsf.rbvi.strucviz2.StructureManager(true));
+ viewer = new ChimeraManager(new StructureManager(true));
+ }
+
+ /**
+ * Starts a thread that waits for the Chimera process to finish, so that we
+ * can then close the associated resources. This avoids leaving orphaned
+ * Chimera viewer panels in Jalview if the user closes Chimera.
+ */
+ protected void startChimeraProcessMonitor()
+ {
+ final Process p = viewer.getChimeraProcess();
+ chimeraMonitor = new Thread(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ p.waitFor();
+ JalviewStructureDisplayI display = getViewer();
+ if (display != null)
+ {
+ display.closeViewer(false);
+ }
+ } catch (InterruptedException e)
+ {
+ // exit thread if Chimera Viewer is closed in Jalview
+ }
+ }
+ });
+ chimeraMonitor.start();
}
/**
}
/**
-- * Returns a list of chains mapped in this viewer. Note this list is not
-- * currently scoped per structure.
-- *
-- * @return
-- */
-
- /**
- public List<String> getChainNames()
- {
- List<String> names = new ArrayList<String>();
- String[][] allNames = getChains();
- if (allNames != null)
- {
- for (String[] chainsForPdb : allNames)
- {
- if (chainsForPdb != null)
- {
- for (String chain : chainsForPdb)
- {
- if (chain != null && !names.contains(chain))
- {
- names.add(chain);
- }
- }
- }
- }
- }
- return names;
- }
-
- /**
* Send a 'focus' command to Chimera to recentre the visible display
*/
public void focusView()
sm.highlightStructure(this, seq, positions);
}
}
+
-
+ @Override
+ public List<String> getChainNames()
+ {
+ return chainNames;
+ }
+
+ public Hashtable<String, String> getChainFile()
+ {
+ return chainFile;
+ }
+
+ public List<ChimeraModel> getChimeraModelByChain(String chain)
+ {
+ return chimeraMaps.get(chainFile.get(chain));
+ }
+
+ public int getModelNoForChain(String chain)
+ {
+ List<ChimeraModel> foundModels = getChimeraModelByChain(chain);
+ if (foundModels != null && !foundModels.isEmpty())
+ {
+ return foundModels.get(0).getModelNumber();
+ }
+ return -1;
+ }
}
* @param protocol
*/
public AAStructureBindingModel(StructureSelectionManager ssm,
- PDBEntry[] pdbentry, SequenceI[][] sequenceIs,
- String protocol)
- PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains,
- String protocol)
++ PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String protocol)
{
this.ssm = ssm;
this.sequence = sequenceIs;
}
/**
+ * Returns a list of chains mapped in this viewer.
+ *
+ * @return
+ */
+ public abstract List<String> getChainNames();
+
++ /**
+ * Returns the Jalview panel hosting the structure viewer (if any)
+ *
+ * @return
+ */
+ public JalviewStructureDisplayI getViewer()
+ {
+ return null;
+ }
}