Collections:
"babel" Command - Input Data Source and Format
How to specify Input Data Source and Format for a "babel" command?
✍: FYIcenter.com
"babel" command arguments and options are organized into 3 sections
as shown in the following syntax to convert chemical data
from input to output with specified options.
babel input_section output_section option_section
You use input_section to specify Input Data Source and Format for a "babel" command. The input_section must be the first section of the "babel" command line.
The input_section contains to two optional parts to specify input data format and input data source as shown in the following syntax:
babel [-i input_format] [input_name] output_section option_section
There are 2 ways to specify input data format:
Explicit Format Name - A pre-defined format name is specified after the "-i" option flag with or without a space " ".
Here are some examples of specifying input data formats explicitly:
-i sdf -isdf -i smiles -ismiles -i smi -ismi ...
Implicit Format Name - No "-i" option flag is specified. In this case, the input_name part is required. Open Babel will determine the input data format implicitly from file name extension of input_name.
For example, the following "babel" command uses "molecule.sdf" as the input_name to determine the input data format as "sdf". This command reads data from molecule.sdf in "sdf" format.
fyicenter$ babel molecule.sdf molecule.svg 1 molecule converted 29 audit log messages
There are 3 ways to specify input data source:
File name of a single input file - In this case, the input data comes from the specified file.
For example, the following "babel" command uses "molecule.sdf" as the input_section, which specifies a single file named "molecule.sdf". This command converts the molecule data from molecule.sdf to molecule.svg.
fyicenter$ babel molecule.sdf molecule.svg 1 molecule converted 29 audit log messages
Multiple file names or a file pattern to match a group of input files - In this case, the input data comes from all specified files concatenated sequentially.
For example, the following "babel" command uses "mol-20001.sdf mol-20002.sdf mol-20003.sdf" as the input_section, which specifies 3 input files. This command converts merges molecules from 3 input files and converts them to molecule.svg.
fyicenter$ babel mol-20001.sdf mol-20002.sdf mol-20003.sdf output.svg 3 molecules converted 85 audit log messages
Note that "babel" command syntax has no delimiter to separate the input_section and the output_section. If a list of file names are provided as shown in the above command, the last file name is considered to be the output_section. Other files are considered as input_section.
Here is another way to specified multiple input files a file name pattern:
fyicenter$ babel mol-*.sdf output.svg 3 molecules converted 85 audit log messages
Note that when a file pattern is specified, the operating system will convert it into a list of file names. So the following two commands are identical from "babel" command point of view.
fyicenter$ babel mol-*.sdf output.svg fyicenter$ babel mol-20001.sdf mol-20002.sdf mol-20003.sdf output.svg
"stdin" stream - No input file is specified. In this case, the input data comes from the "stdin" stream, which could be keys typed in from the keyboard, or data redirected from a command pipe. With no input file name, "babel" requires the "-i ..." option in the input_section to specify the input data type.
For example, the following "babel" command uses "-i smiles" as the input_section, which tells Open Babel to read "stdin" as SMILES data. This command reads chemical data from "stdin" in SMILES format and convert to benzene.svg.
fyicenter$ babel -i smiles benzene.svg c1ccccc1 <Ctrl-D> 1 molecule converted 21 audit log messages
Note the above command expects you to enter SMILES string from the keyboard. You need to press "<Ctrl-D>" to end the input.
⇒ "babel" Command - Output Data Destination and Format
2021-07-19, 537👍, 0💬
Popular Posts:
Where to find tutorials on molecule visualization software PyMol? I want to know how to use PyMol. H...
What is Isomer? An Isomer is molecule that has the same the same chemical formula as another molecul...
Where to find tutorials in understanding PyMol GUI and CLI? Here is a list of tutorials to answer ma...
What Is the PKNCA R Package? The PKNCA R Package is designed to perform all Non-Compartmental Analys...
What is Formal Charge of an atom in a molecule? And what is the total formal charge of a molecule? T...