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, 654🔥, 0💬
Popular Posts:
Molecule Summary: ID: FYI-1000174 SMILES: N#CCCC(Br)(Cc1ccccc1)Cc2 ccccc2Received at FYIcenter.com o...
How to use "babel --append ..." command to calculate Molecule Properties? The "--append ..." option ...
Molecule Summary: ID: FYI-1000957 SMILES: CC(C)Cc1ccc(C[NH2+]C(C)C C(N)=O)cc1Received at FYIcenter.c...
What are the options for installing Open Babel on CentOS computers? There are a number of options fo...
Molecule Summary: ID: FYI-1001103 SMILES: CC1(CCC(=C(C1)C2=CC=C(C= C2)Cl)CN3CCN(CC3)C4=CC(= C(C=C4)C(=...