2008/03/26

Five Open Tools for 2D Structure Layout (aka Structure Diagram Generation)

Five Open Tools for 2D Structure Layout (aka Structure Diagram Generation)

Good summary of several alternatives. I've been using CDK of late, but am partial to tools written for CPython. I wonder if any of the alternatives make it as easy to extract coordinates as does CDK?

3 comments:

Noel O'Boyle said...

I'd say that Pybel is pretty easy to use for extracting coordinates (but I'm a bit biased). It's available for CPython, but (soon I hope) will be available for Jython also.

Mitch said...

Sorry, my writing is sloppy as always :) I should have written that I wonder if any of the alternatives makes (2D) coordinate generation as easy as does CDK.

Do you know offhand if there's a way to do this with Pybel or some other CPython package?

Noel O'Boyle said...

Well, I've been looking into adding this to Pybel through an interface to BKChem. So stay tuned. In the meanwhile, you can use it right away if you install BKChem.

The author has seen me some code to illustrate the API. You'll have to adjust the import statements, and set PYTHONPATH and so on, add the bin directory to the PATH (if on windows), but the general idea works:

import oasa

mol = oasa.molecule()
for symbol in ["C","N","C","C"]:
a = mol.create_vertex()
a.symbol = symbol
mol.add_vertex( a)
e = mol.create_edge()
e.order = 1
mol.add_edge( 0, 1, e)
mol.add_edge( 1, 2) # default edge is created
mol.add_edge( 1, 3)
oasa.coords_generator.calculate_coords( mol, bond_length=30)
oasa.cairo_out.mol_to_png( mol, "out.png")