Openbabel  offers a wide range of operations. One of which is file format conversion which is most widely used. In this article, we will describe commands that convert file formats.
Assuming, you have already installed Openbabel on your system, you should be able to run it as obabel/babel in the terminal. Also, you can use the GUI of Openbabel that you will have to compile during its installation.
So, here is the command syntax for file conversion:
$ obabel -i<input_format> <input_filename> -o<output_format> -O <output_filename> -other_arguments
It is optional to provide input and output formats but it is always better to do so.
Let’s convert opensmiles SMILES to canonical SMILES.
$ obabel -ismi input.smi -osmi -O output.smi -ocan
Similarly, you can convert SMILES to InChi as shown below:
$ obabel -ismi input.smi -oinchi -O output.inchi
If you want, you can give some additional arguments such as ignoring isomers, removing duplicates, etc. Sometimes, the openbabel stops processing once it finds any invalid compound/molecule, so for that, you can -e to the command.
$ obabel -ismi input.smi -oinchi -O output.inchi -e --unique
Here, –unique will not convert the duplicate molecules.
If you want to ignore the stereochemistry of the molecules then you can use the following arguments:
$ obabel -ismi input.smi -oinchi -O output.inchi -e /nostereo /nochg /noiso /noEZ /sp3
You can also keep unique molecules based on the arguments given in the above command by writing –unique before the arguments as shown below.
$ obabel -ismi input.smi -oinchi -O output.inchi -e --unique /nostereo /nochg /noiso /noEZ /sp3
For further information on supported file formats, read here.
- O’Boyle, NM, Banck, M., James, CA, Morley, C., Vandermeersch, T., & Hutchison, GR (2011). Open Babel: An open chemical toolbox. Journal of cheminformatics, 3 (1), 1-14.
smitostr.py: Python script to convert SMILES to structures.
tanimoto_similarities.py: A Python script to calculate Tanimoto similarities of multiple compounds using RDKit.
RDKit  is a very nice cheminformatics software. It allows us to perform a wide range of operations on chemical compounds/ ligands. We have provided a Python script to perform fingerprinting using Tanimoto similarity on multiple compounds using RDKit. (more…)