Openbabel is used to inter-convert many file formats [1]. It is available for Linux, Windows, and MAC operating systems. In this article, we will learn how to generate 3D structures of compounds present in the form of smiles on Ubuntu as well as on Windows.
On Ubuntu
You can download the openbabel software on Ubuntu from the repository as shown below:
$ sudo apt-get install openbabel
.
Save your downloaded smiles into smiles format (.smi), for example, ‘smiles.smi’. This is our input file. To generate 3D structures of these smiles into SDF format, type the following commands:
$ obabel -i smi smiles.smi -o sdf -O out.sdf -m -h --gen3d
Here, -m
is used to split the output into multiple files. It is used in batch conversion, where you have multiple smiles in a single file (as described in this article) and you want individual files as output. -h
adds hydrogens.
--gen3d
is used to generate 3D coordinates for the structure.
Similarly, they can be converted into pdb as well as shown below:
$ obabel -i smi smiles.smi -o pdb -O out.pdb -m -h --gen3d
You can also convert files other than smiles. For example, pdb, mol, SDF, and so on. Just change the input-ID and input filename along with the output-ID and output filename according to your requirements.
For more options, type $ obabel -H
.
On Windows
On Windows, you can download the binary file from here. You can use the GUI of openbabel as follows.
- Open the openbabel after installation.
- Upload your input file and specify the input format from the dropdown.
- Select options appropriate to your needs such as ‘Generate 3d’, ‘Output multiple conformers separately’, and so on.
- Select the output format and output file location.
- Click ‘Convert’.
You can input smiles or any other format using the editor given on the left side of GUI and obtain output without saving into any files.
References
- O’Boyle, N. M., Banck, M., James, C. A., Morley, C., Vandermeersch, T., & Hutchison, G. R. (2011). Open Babel: An open chemical toolbox. Journal of cheminformatics, 3(1), 33.