Convert SDF to SVG using Open Babel

Provides a tutorial example on how to convert a molecule structure in a SDF file to a SVG (Scalable Vector Graphics) file using 'Open Babel'.

If you want to see the molecule structure specified in a SDF file, you can convert it to a SVG (Scalable Vector Graphics) file using the "Open Babel" tool.

1. Download and install "Open Babel" 2.3.1 from sourceforge.net/projects/openbabel.

2. Run the following "babel" command to convert SDF to SVG:

herong$ babel Molecule-HY-001.sdf Molecule-HY-001.svg
  1 molecule converted
  29 audit log messages

3. Open the SVG file, Molecule-HY-001.svg, in a text editor to review:

<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:cml="http://www.xml-cml.org/schema"
  width="149.961" height="333.147" x="0" y="0"
  font-family="sans-serif" font-size="16"
  stroke="rgb(0,0,0)" stroke-width="1"  stroke-linecap="round">
<rect x="0%" y="0%" width="100%" height="100%" stroke-width="0"
 fill="rgb(255,255,255)"  />
<line x1="75.4" y1="213.5" x2="75.4" y2="186.5"/>
<line x1="107.2" y1="74.5" x2="87.9" y2="110.4"/>
<line x1="92.8" y1="51.1" x2="107.2" y2="74.5"/>
<line x1="85.0" y1="164.7" x2="95.3" y2="155.1"/>
<line x1="99.3" y1="134.5" x2="87.9" y2="110.4"/>
<line x1="91.9" y1="135.7" x2="83.9" y2="118.9"/>
<line x1="87.9" y1="110.4" x2="49.2" y2="114.6"/>
<line x1="49.2" y1="114.6" x2="43.7" y2="140.8"/>
<line x1="55.0" y1="121.9" x2="51.1" y2="140.3"/>
<line x1="52.2" y1="160.2" x2="64.2" y2="167.0"/>
<line x1="75.4" y1="213.5" x2="110.0" y2="233.3"/>
<line x1="110.0" y1="233.3" x2="110.0" y2="273.4"/>
<line x1="102.8" y1="239.3" x2="102.8" y2="267.4"/>
<line x1="110.0" y1="273.4" x2="75.4" y2="293.1"/>
<line x1="75.4" y1="293.1" x2="40.0" y2="272.9"/>
<line x1="73.8" y1="283.9" x2="48.8" y2="269.6"/>
<line x1="40.0" y1="272.9" x2="40.5" y2="233.3"/>
<line x1="40.5" y1="233.3" x2="75.4" y2="213.5"/>
<line x1="49.2" y1="236.6" x2="73.8" y2="222.7"/>
<text x="69.440616" y="181.477643" stroke="rgb(12,12,255)">N</text>
<text x="98.897751" y="154.321847" stroke="rgb(12,12,255)">N</text>
<text x="34.920535" y="161.686130" stroke="rgb(12,12,255)">N</text>
<text x="68.026773" y="48.000000" stroke="rgb(30,239,30)">Cl</text>
<text font-size="18.000000" fill ="black" font-family="sans-serif"
  x="10.000000" y="20.000000" >HY-001</text>
<title>HY-001 - OBDepict</title>
</svg>

4. Open the SVG file, Molecule-HY-001.svg, in a Web browser. You see the molecule structure:

Open Babel - Convert SDF to SVG
Open Babel - Convert SDF to SVG

Table of Contents

 About This Book

 Introduction of Molecules

 Molecule Names and Identifications

 Molecule Mass and Weight

 Protein and Amino Acid

 Nucleobase, Nucleoside, Nucleotide, DNA and RNA

 Gene and Chromosome

 Protein Kinase (PK)

 DNA Sequencing

 Gene Mutation

SDF (Structure Data File)

 What Is SDF (Structure Data File)

 SDF Format Specification

 What Are CTfile and CTAB

Convert SDF to SVG using Open Babel

 "sdf2svg" - PHP Script to Convert SDF to SVG

 PyMol Installation

 PyMol GUI and CLI

 PyMol Selections

 PyMol Editing Functions

 PyMol Measurement Functions

 PyMol Movie Functions

 PyMol Python Integration

 PyMol Object Functions

 ChEMBL Database - European Molecular Biology Laboratory

 PubChem Database - National Library of Medicine

 PDB (Protein Data Bank)

 INSDC (International Nucleotide Sequence Database Collaboration)

 HGNC (HUGO Gene Nomenclature Committee)

 Relocated Tutorials

 Resources and Tools

 Molecule Related Terminologies

 References

 Full Version in PDF/EPUB