Tuesday, January 24, 2012

CAS support in chemkit

I added a new line format plugin to chemkit which can convert from a CAS number to a chemical structure via PubChem. The implementation was roughly a dozen lines of code and made use of the chemkit::PubChem class in the chemkit-web library.

This new plugin implements the chemkit::LineFormat interface just like the SMILES and InChI line formats and can be used in the same way. For example, to create a guanine molecule from its CAS number (108-95-2) one can simply use:

  chemkit::Molecule guanine("108-95-2", "cas");

This also works with the chemkit-translate command line application which allows users to easily convert between CAS numbers and any other molecular line format (e.g. SMILES, InChI, InChIKey) as follows:

  chemkit-translate -icas -osmiles 108-95-2

Which will output:
 
  Oc1ccccc1

Let me know what you think!

No comments:

Post a Comment