"obabel ... -o svg -xX" - Hide Implicit H in SVG

This section provides a tutorial example how to hide implicit hydrogen symbol 'H' on a non-carbon terminal atoms in a molecule SVG picture using the Open Babel 'obabel ... -o svg -xX' command.

By default, non-carbon terminal atoms have implicit hydrogen connections, Open Babel will display them as chemical formula showing implicit hydrogen counts in SVG format.

If you want to hide those implicit hydrogen counts, you can use the "-o svg -xX" option with the "obabel" command.

Here is how the "-xX" option is described in Open Babel help document: "X - All atoms are explicitly declared. Useful if we don't want any extra hydrogens drawn to fill the valence."

For example, the following command generates a SVG picture with no implicit hydrogen symbols for the tyrosine molecule:

herong$ obabel "-:c1cc(ccc1CC(C(=O)O)N)O" -O tyrosine-no-hydrogen.svg -xX

1 molecule converted

As a comparison, running the following command generates a SVG picture with implicit hydrogen symbols of the same molecule:

herong$ obabel "-:c1cc(ccc1CC(C(=O)O)N)O" -O tyrosine.svg

1 molecule converted

Open both output files, tyrosine.svg and tyrosine-no-hydrogen.svg, in a Web browser, you see the differences:

Tyrosine Molecule without and with Hydrogen Symbols
Tyrosine Molecule without and with Hydrogen Symbols

Note that "-xX" option was added since Open Babel 2.4 for SVG format.

Table of Contents

 About This Book

 SMILES (Simplified Molecular-Input Line-Entry System)

 Open Babel: The Open Source Chemistry Toolbox

 Using Open Babel Command: "obabel"

Generating SVG Pictures with Open Babel

 "obabel -o svg" - Molecule Picture in SVG

 "obabel -:... -o svg" - Generate SVG from SMILES

 "obabel ... -o svg -xi" - Show Atom Indices in SVG

 "obabel ... -o svg -xS" - Ball/Stick Depiction in SVG

"obabel ... -o svg -xX" - Hide Implicit H in SVG

 "obabel ... -o svg -xC" - Hide Terminal C in SVG

 "obabel ... -o svg -xP300" - Control Image Size

 "obabel ... -o svg" - Two "svg" XML Tag Levels

 "obabel ... -o svg -xd" - Hide Molecule Name

 "babel ... -o svg -xd -xP300" - Open Babel 2.4 Bug

 Scale SVG Images using "viewBox" Attribute

 Substructure Search with Open Babel

 Similarity Search with Open Babel

 Fingerprint Index for Fastsearch with Open Babel

 Stereochemistry with Open Babel

 Command Line Tools Provided by Open Babel

 RDKit: Open-Source Cheminformatics Software

 rdkit.Chem.rdchem - The Core Module

 rdkit.Chem.rdmolfiles - Molecular File Module

 rdkit.Chem.rdDepictor - Compute 2D Coordinates

 rdkit.Chem.Draw - Handle Molecule Images

 Molecule Substructure Search with RDKit

 rdkit.Chem.rdmolops - Molecule Operations

 Daylight Fingerprint Generator in RDKit

 Morgan Fingerprint Generator in RDKit

 RDKit Performance on Substructure Search

 Introduction to Molecular Fingerprints

 OCSR (Optical Chemical Structure Recognition)

 AlphaFold - Protein Structure Prediction

 Resources and Tools

 Cheminformatics Related Terminologies

 References

 Full Version in PDF/EPUB