Hi,

I've developped, based on several example of Rajarshin Guha/test code,  
some snippets that, based on a string representing a MDL molecule,  
convert it to the CDK format and display it in a JTable as 2D structure.

First of all, the 2D depiction seems to be slightly broken: sometimes  
two atoms overlap, making one of them disapearing (it can be seen when  
resizing the Jtable column for example). Anyone knows about that? Is  
the code bellow up to date? Should I use any other class etc. ?

Next, how does the generation of 2D coordinates works when 2D  
coordinates are already set? (ie. Z = 0) There is nothing in the  
documentation about that.

Also, I found the way to read MDL quite complex, at least in  
appearance. Besides, I've been told that this code is not intended to  
be run on a large dataset.

In my program, I will have to load a huge set of molecule, and 500 of  
them will be displayed in a JTable as described bellow... I haven't  
tested yet to open such a number of molecules, so I was wondering if  
there could be any performance issue using the following 2D  
depiction/drawing code and MDL reading? And if so, if there is any way  
to improve it?

Finally, I will have to display 3D molecules too. Currently, It  
appears the CDK alone can't do that, to I guess I've to check JMol,  
and I just wanted to confirm that ;)

Ok that will be it for now. Sorry for all those questions... And many  
thanks in advance for your answers.


************
2D Depiction
************

Renderer2DModel r2dm;
Java2DRenderer renderer;
(...)
molecule = AtomContainerManipulator.removeHydrogens(mol);
CDKHueckelAromaticityDetector.detectAromaticity(molecule);

StructureDiagramGenerator sdg = new StructureDiagramGenerator();
sdg.setMolecule((IMolecule) molecule);
sdg.generateCoordinates();
molecule = sdg.getMolecule();

r2dm.setDrawNumbers(false);
r2dm.set (...)

GeometryTools.translateAllPositive(molecule);
GeometryTools.center(molecule, getPreferredSize());
repaint() ;

// Next in paint, I call:
renderer.paintMolecule(molecule, (Graphics2D) g, getBounds());

************
MDL reading
************

MDLV2000Reader reader = new MDLV2000Reader(new StringReader(v)) ;
ChemFile chemFile = (ChemFile) reader.read(new ChemFile());
IChemModel model = chemFile.getChemSequence(0).getChemModel(0);
model.getMoleculeSet().getAtomContainer(0) ;


-- 
Vincent Le Guilloux

Phd Student - ICOA - UMR CNRS 6005
Div. of chemoinformatic and molecular modeling.
University of Orléans
Phone: ++33 2 38 49 45 77
Fax  : ++33 2 38 41 72 81



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to