Developer:Perl Tutorial

This tutorial is aimed at developers looking to use Open Babel with Perl and the Chemistry::OpenBabel module. It will focus on the object-oriented application programmers' interface (API). There is also documentation on the full API. Although Open Babel is written in C++, it also has bindings to Perl and Python programming languages.

Output Molecular Weight for a Multi-Molecule SDF File

Let's say we want to print out the molecular weights of every molecule in an SD file. Why? Well, we might want to plot a histogram of the distribution, or see whether the average of the distribution is significantly different (in the statistical sense) compared to another SD file.

Add and Delete Atoms

This script shows an example of deleting and modifying atoms to transform one structure to a related one. It operates on a set of substituted thiophenes, deletes the sulfur atom (note that R1 and R2 may contain sulfur, so the SMARTS pattern is designed to constrain to the ring sulfur), etc. The result is a substituted ethylene, as indicated in the diagrams.