Depth-First
Cheminformatics in Context
Reading SMILES with MX
Wednesday December 03, 2008
The latest release of MX, the Java toolkit for cheminformatics, now supports reading a subset of SMILES strings. Although incomplete, full support for this feature is planned within a few releases.
To get an idea of how to use the new SMILES reader, we can use interactive JRuby. Assuming we've downloaded the mx-0.105.0 jarfile to our working directory, we can use:
$ jirb irb(main):001:0> require 'mx-0.105.0.jar' => true irb(main):002:0> import com.metamolecular.mx.io.daylight.SMILESReader => Java::ComMetamolecularMxIoDaylight::SMILESReader irb(main):003:0> bromobenzene = SMILESReader.read 'C1=CC=CC=C1Br' => #<Java::ComMetamolecularMxModel::DefaultMolecule:0x8a2023 @java_object=com.metamolecular.mx.model.DefaultMolecule@182a70> irb(main):004:0> bromobenzene.count_atoms => 7 irb(main):005:0> bromobenzene.get_atom(6).get_symbol => "Br"
blog comments powered by Disqus
Comments
© 2006-2010 Richard L. Apodaca | Content Licensed CC 3.0 BY-SA