Collections:
"babel" Command - Output Data Destination and Format
How to specify Output Data Destination 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 output_section to specify Output Data Destination and Format for a "babel" command. The output_section must be the second section of the "babel" command line.
The output_section contains to two optional parts to specify output data format and output data destination as shown in the following syntax:
babel input_section [-o output_format] [output_name] option_section
There are 2 ways to specify output data format:
Explicit Format Name - A pre-defined format name is specified after the "-o" option flag with or without a space " ".
Here are some examples of specifying input data formats explicitly:
-o sdf -osdf -o smiles -osmiles -o svg -osvg ...
Implicit Format Name - No "-o" option flag is specified. In this case, the output_name part is required. Open Babel will determine the output data format implicitly from file name extension of output_name.
For example, the following "babel" command uses "molecule.svg" as the output_name to determine the output data format as "svg". This command writes data to molecule.svg in "svg" format.
fyicenter$ babel molecule.sdf molecule.svg 1 molecule converted 29 audit log messages
There are 3 ways to specify output data destination:
File name of a single output file - In this case, the output data goes to the specified file.
For example, the following "babel" command uses "molecule.svg" as the output_section, which specifies a single file named "molecule.svg". 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
File name prefix and extension for multiple output files with the "-m" option. In this case, the output data goes to multiple files, one per molecule.
For example, the following "babel" command uses "multi_.svg" as the output_section. This command converts molecules from multi.sdf to multi_1.svg, multi_2.svg, ..., because of the "-m" option.
fyicenter$ babel multi.sdf multi_.svg -m 3 molecules converted 3 files output. The first is multi_1.svg 87 audit log messages fyicenter$ ls -l multi_*.* -rw-r--r-- 1 fyicenter staff 7665 Apr 1 20:42 multi_1.svg -rw-r--r-- 1 fyicenter staff 5439 Apr 1 20:42 multi_2.svg -rw-r--r-- 1 fyicenter staff 5189 Apr 1 20:42 multi_3.svg
"stdout" stream - No output file is specified. In this case, the output data goes to the "stdin" stream, which could be the console screen, or data redirected to a command pipe. With no input file name, "babel" requires the "-o ..." option in the output_section to specify the output data type.
For example, the following "babel" command uses "-o smiles" as the output_section, which tells Open Babel to read "stdin" as SMILES data. This command reads chemical data from molecule.sdf and write to the screen in SMILES format
fyicenter$ babel molecule.sdf -o smiles O(C(=O)CCN1CC1)CC 20009 1 molecule converted 34 audit log messages
⇒ "babel" Command - Use "-o ..." as Output Delimiter
⇐ "babel" Command - Input Data Source and Format
2021-07-19, 542👍, 0💬
Popular Posts:
How to generate a molecule SVG picture from a SMILES string? The easiest way to generate a molecule ...
Molecule Summary: ID: FYI-1002017 Names: BENZENE; InChIKey: UHOVQNZJYSORNB-UHFFFAOYS A-NSMILES: c1cc...
Molecule Summary: ID: FYI-1000175 SMILES: C#Cc1ccc(C(=O)CCCC(C)(C) N)cc1Received at FYIcenter.com on...
Molecule Summary: ID: FYI-1000287 SMILES: CCC(C) Received at FYIcenter.com on: 2021-03-07
What Is the PK R Package? The PK R Package is designed to perform all Non-Compartmental Analysis (NC...