babel
Transpile JavaScript code
TLDR
Transpile a specified input file and output to stdout
Transpile a specified input file and output to a specific file
Transpile the input file every time it is changed
Transpile a whole directory of files
Ignore specified comma-separated files in a directory
Transpile and output as minified JavaScript
Choose a set of presets for output formatting
Display help
SYNOPSIS
babel [input_options] input_file [output_options] output_file [conversion_options]
Example: babel -isdf input.sdf -osmi output.smi -c
PARAMETERS
-i
Specifies the input file format (e.g., smi for SMILES, mol for Molfile).
-o
Specifies the output file format (e.g., sdf for SDF, inchi for InChI).
-O
Specifies the output filename. If omitted, output goes to standard output.
-f
Start reading from the N-th molecule in a multi-molecule file.
-l
Stop reading after the N-th molecule.
-s
Select molecules that match the provided SMARTS pattern.
-H
Add hydrogens to the molecule(s).
-d
Delete hydrogens from the molecule(s).
-p
Add hydrogens appropriate for a given pH (protonation).
-gen3d
Generate 3D coordinates for the molecule(s).
-c
Canonicalize SMILES string (typically used with SMILES output).
-v
Verbose output, showing progress and details during conversion.
-h
Display a comprehensive help message with all available options.
-V
Display version information for the Open Babel library and program.
DESCRIPTION
babel is a command-line utility from the Open Babel project, a comprehensive chemical informatics software package. It serves as a versatile tool for converting between a vast array of chemical file formats, manipulating chemical data, and performing various operations such as calculating molecular properties, generating 3D coordinates, or adding/removing hydrogens. Supporting over 100 file formats, babel is indispensable for chemists, cheminformaticians, and materials scientists needing to interoperate between different chemical software environments. While obabel is the more modern and primary command-line interface, babel often acts as a legacy interface or alias, providing similar powerful capabilities.
CAVEATS
The babel command is largely superseded by obabel, which is the primary and more actively developed command-line interface for Open Babel. Users are generally advised to use obabel for new scripts and workflows to ensure access to the latest features and bug fixes. The sheer number of supported file formats and options can make the command line interface complex for new users.
EXTENSIVE FILE FORMAT SUPPORT
babel supports over 100 chemical file formats, including common ones like SMILES, SDF, Mol2, CML, PDB, XYZ, and InChI. A full list of supported formats and their specific options can typically be obtained by running babel --list-formats or obabel --list-formats.
SCRIPTING AND AUTOMATION
Due to its command-line nature and extensive capabilities, babel (or obabel) is widely used in shell scripts and automated workflows for high-throughput chemical data processing, integration with computational chemistry pipelines, and database population.
HISTORY
The Open Babel project, including the babel command, originated in 2000 as a fork of the original Babel program developed by Peter Murray-Rust and others. The initial babel command served as the primary command-line tool for chemical file format conversions. Over time, as the Open Babel library evolved, a more consistent and feature-rich interface named obabel was introduced. While obabel is now the recommended tool, babel is often retained for backward compatibility, sometimes as a symbolic link to obabel or an older wrapper around the library.
SEE ALSO
obabel(1)