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

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

By default, Open Babel displays carbon (C) symbols in SVG format, if they are terminal atoms in the molecule structure.

If you want to hide those C symbols for terminal carbon atoms, you can use the "-o svg -xC" option with the "obabel" command.

Here is how the "-xC" option is described in Open Babel help document: "C - do not draw terminal C (and attached H) explicitly The default is to draw all hetero atoms and terminal C explicitly, together with their attached hydrogens."

For example, the following command generates a SVG picture without C symbols for terminal carbon atoms for the Aspirin molecule:

herong$ obabel "-:O=C(Oc1ccccc1C(=O)O)C" -O aspirin-no-carbon.svg -xC

1 molecule converted

As a comparison, running the following command generates a SVG picture with C symbols for terminal carbon atoms for the same molecule:

herong$ obabel "-:O=C(Oc1ccccc1C(=O)O)C" -O aspirin.svg

1 molecule converted

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

Aspirin Molecule without and with Carbon Symbols
Aspirin Molecule without and with Carbon Symbols

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