"babel -s ..." Command - Substructure Search

Q

How to use "babel -s ..." command to do substructure search?

✍: FYIcenter.com

A

You can do substructure search using the "-s ..." option of the "babel" command with the following syntax:

babel input_section output_section -s smarts_string 

The smarts_string specifies a SMARTS string that represents a molecule pattern. "babel" command will apply this pattern to each molecule in the input data source. If the the pattern matches a substructure of the molecule, it will be written to the output. Otherwise, it will be skipped.

Substructure search is also called substructure filtering or substructure matching.

Here are some examples of substructure matching with a single atom as the molecule pattern:

fyicenter$ # methane molecule contains an aliphatic carbon
fyicenter$ obabel -:C -o smiles -s C 
C  
1 molecule converted

fyicenter$ # methane molecule contains no aromatic carbon
fyicenter$ obabel -:C -o smiles -s c
0 molecules converted

fyicenter$ # benzene molecule contains an aromatic carbon
fyicenter$ obabel -:c1ccccc1 -o smiles -s c
c1ccccc1  
1 molecule converted

fyicenter$ # benzene molecule contains no aliphatic carbon
fyicenter$ obabel -:c1ccccc1 -o smiles -s C
0 molecules converted

Here is another group of examples of substructure matching with a single bond as the molecule pattern:

fyicenter$ # tyrosine molecule contains a two-aromatic-carbon bond
fyicenter$ obabel "-:c1cc(ccc1CC(C(=O)O)N)O" -o smiles -s cc
c1cc(ccc1CC(C(=O)O)N)O  
1 molecule converted

fyicenter$ # tyrosine molecule contains an aromatic-carbon-aliphatic-carbon bond
fyicenter$ obabel "-:c1cc(ccc1CC(C(=O)O)N)O" -o smiles -s cC
c1cc(ccc1CC(C(=O)O)N)O  
1 molecule converted

fyicenter$ # tyrosine molecule contains no aromatic-carbon-nitrogen bond
fyicenter$ obabel "-:c1cc(ccc1CC(C(=O)O)N)O" -o smiles -s cN
0 molecules converted

fyicenter$ # tyrosine molecule contains an aliphatic-carbon-nitrogen bond
fyicenter$ obabel "-:c1cc(ccc1CC(C(=O)O)N)O" -o smiles -s CN
c1cc(ccc1CC(C(=O)O)N)O  
1 molecule converted

You can validate the above matching result by looking at the tyrosine molecule structure below:

Open Babel SVG Picture - Tyrosine Molecule
Open Babel SVG Picture - Tyrosine Molecule

 

Substructure Search with Wildcard Atom "*"

Substructure Search with Open Babel

Substructure Search with Open Babel

⇑⇑ Open Babel Tutorials

2020-06-08, 931🔥, 0💬