Cheminformatics Tutorials - Herong's Tutorial Examples - v2.01, by Herong Yang
What Is "obabel" Command
This section provides a quick introduction on the 'obabel' command, which reads molecule information in any given format, processes it and generates output in any given format.
What Is "obabel" Command? - "obabel" is the command to invoke Open Babel to read molecule information in any given format, process it and generate output in any given format.
Note that new releases use "obabel" command instead of "babel". And its command line syntax has some small changes too. So you may need to revise your automated scripts accordingly, if you are migrating from Open Babel old releases.
To access the "obabel" command, you have to know the absolute path of the "obabel" program file, which is different depending on your Open Babel installations. Here are some examples:
# - Anaconda installation on Linux: herong$ /usr/local/anaconda3/envs/openbabel/bin/obabel -V Open Babel 3.1.0 -- Aug 18 2019 -- 08:52:33 # - Binary package installation on Windows: herong> "C:\Program Files\OpenBabel-3.1.1\obabel" -V Open Babel 3.1.1 -- May 16 2020 -- 11:57:55 # - Source code installation on Linux: herong$ /usr/local/bin/obabel -V Open Babel 3.1.0 -- Jul 19 2019 -- 10:30:02 # - Binary package installation on macOS: herong$ /usr/local/bin/obabel -V Open Babel 2.3.1 -- Oct 13 2011 -- 15:14:48
To avoid typing the full path of the "obabel" command, you can put the path name into the PATH environment variable. Here is how to do it on a Linux system.
herong$ export PATH=/usr/local/anaconda3/envs/openbabel/bin/:$PATH herong$ obabel -V Open Babel 3.1.0 -- Aug 18 2019 -- 08:52:33
Now you can start learning "obabel" command by running the help command as shown below:
herong$ obabel -H Open Babel converts chemical structures from one file format to another Usage: obabel [-i<input-type>] <infilename> [-o<output-type>] \ -O<outfilename> [Options] The extension of a file decides the format, unless it is overridden by -i or -o options, e.g. -icml, or -o smi See below for available format-types, which are the same as the file extensions and are case independent. If no input or output file is given stdin or stdout are used instead. More than one input file can be specified and their names can contain wildcard chars (* and ?). The format of each file can be different unless the -i option has been used, when they are all the same. By default, the molecules are aggregated in the output file, but see -m option, Splitting, below. Options, other than -i -o -O -m, must come after the input files. Conversion options -f <#> Start import at molecule # specified -l <#> End import at molecule # specified -e Continue with next object after error, if possible -z Compress the output with gzip -zin Decompress the input with gzip -k Attempt to translate keywords -H Outputs this help text -Hfff (fff is file format ID e.g. -Hcml) gives format info -Hall Outputs details of all formats -V Outputs version number -L <category> Lists plugin classes of this category, e.g. <formats> Use just -L for a list of plugin categories. Use -L <ID> e.g. -L sdf for details of a format or other plugin. -m Produces multiple output files, to allow: Splitting: e.g. obabel infile.mol -O new.smi -m puts each molecule into new1.smi new2.smi etc Batch conversion: e.g. obabel *.mol -osmi -m converts each input file to a .smi file Interface to OBAPI internals API options, e.g. ---errorlevel 2 errorlevel # min warning level displayed To see a list of recognized file formats use babel -L formats [read] [write] To see details and specific options for a particular format, e.g CML, use babel -L cml
Table of Contents
SMILES (Simplified Molecular-Input Line-Entry System)
Open Babel: The Open Source Chemistry Toolbox
►Using Open Babel Command: "obabel"
"obabel -i ..." - Input Data Format and Source
"obabel -o ... -O" - Output Data Format and Destination
"obabel -... --..." - Generic Conversion Options
"obabel" Command Option Argument Syntax
"obabel ... --gen2D" - Calculated 2D Coordinates
"obabel ... -f # -l #" - Split Large Molecule File
"obabel -h/-d" - Add/Remove Hydrogens in Molecule Data
"obabel --append ..." - Calculate Molecule Properties
"obabel -L formats" - List of File Formats Supported
"obabel -a..." - Extra Options for Input Reading
"obabel -x..." - Extra Options for Output Writing
"obabel" vs. "babel" Open Babel Commands
Generating SVG Pictures with Open Babel
Substructure Search with Open Babel
Similarity Search with Open Babel
Fingerprint Index for Fastsearch with Open Babel
Stereochemistry with Open Babel
Command Line Tools Provided by Open Babel
RDKit: Open-Source Cheminformatics Software
rdkit.Chem.rdchem - The Core Module
rdkit.Chem.rdmolfiles - Molecular File Module
rdkit.Chem.rdDepictor - Compute 2D Coordinates
rdkit.Chem.Draw - Handle Molecule Images
Molecule Substructure Search with RDKit
rdkit.Chem.rdmolops - Molecule Operations
Daylight Fingerprint Generator in RDKit
Morgan Fingerprint Generator in RDKit
RDKit Performance on Substructure Search
Introduction to Molecular Fingerprints
OCSR (Optical Chemical Structure Recognition)
AlphaFold - Protein Structure Prediction