[Biojava-l] 3D viewing?

Egon Willighagen e.willighagen at science.ru.nl
Tue Jan 11 06:24:40 EST 2005


On Tuesday 11 January 2005 11:49 am, Tom Oinn wrote:
> Andreas Prlic wrote:
> > I am the person who contributed the biojava - structure classes. As it
> > turns out I am a very happy Jmol user already for quite a while now!  :-)
>
> Seconded - Jmol is very cool and surprisingly easy to integrate if you
> have PDB format data lying around somewhere in your code. I believe it
> supports other structure formats as well although I've never used them.

Hi Tom,

I'm actually one of the Jmol developers (though we should thank Miguel for the 
excellent 3D rendering of proteins), but was actually refering to a tighter 
integration of BioJava and Jmol...

On http://wiki.jmol.org/JmolCdkIntegration there is this code fragment:

===================================
public void viewCDKModel(ChemFile aCDKChemFileObject) {
  JmolPanel jmolPanel = new JmolPanel();
  contentPane.add(jmolPanel);
        
  JmolViewer viewer = jmolPanel.getViewer();
  viewer.openClientFile("", "", aCDKChemFileObject);
}

class JmolPanel extends JPanel {
  JmolViewer viewer;
  JmolAdapter adapter;
  JmolPanel() {
    // use CDK IO
    adapter = new CdkJmolAdapter(null);
    viewer = new JmolViewer(this, adapter);
  }
}
===================================

And I was wondering about a JmolAdapter implementation for BioJava...
So that it would be possible to do:

===================================
public void viewBioJavaModel(Sequence sequence) {
  JmolPanel jmolPanel = new JmolPanel();
  contentPane.add(jmolPanel);
        
  JmolViewer viewer = jmolPanel.getViewer();
  viewer.openClientFile("", "", sequence);
}

class JmolPanel extends JPanel {
  JmolViewer viewer;
  JmolAdapter adapter;
  JmolPanel() {
    // use CDK IO
    adapter = new BioJavaJmolAdapter(null);
    viewer = new JmolViewer(this, adapter);
  }
}
===================================

Or some BioJava class instead of Sequence...

This would remove the serialization to PDB, and allow new possibilities... for 
which we might need to extend the model adapter, but that's no issue...

Egon


More information about the Biojava-l mailing list