Cheminformatics file formats from 1971 to today
How molecules are stored on disk, from the PDB format and MDL molfiles to CIF, CML, CDXML and CXSMILES, with ethanol as the running example.
A line notation gives a molecule's connectivity. A file also stores coordinates, drawn stereo bonds, data about the compound and, for crystals, the unit cell. This post covers the formats chemists meet most often, in the order they appeared, with ethanol as the example.
Why a file and not a string#
Caffeine's SMILES has 28 characters; the same molecule as a molfile written by RDKit takes 1,247 bytes. The difference is coordinates for every atom and fixed fields for bonds, charges, isotopes and stereo flags. Notations are for searching and comparing, files for drawing, calculating and exchanging. Notations are covered in Chemistry line notations, reaction files in Reactions and retrosynthesis. The ethanol examples below were written by RDKit.
A short history#
PDB format, 1971#
The Protein Data Bank, set up in 1971, archives macromolecular structures.1 Its format uses 80-column records that begin with keywords such as ATOM, HETATM and CONECT, with fixed columns for residue, chain and 3D coordinates.
MDL molfile, 1981#
MDL defined the molfile as one of its connection table formats.2 A V2000 file has a three-line header, a counts line, atom and bond blocks, optional properties and M END.
ethanol
RDKit 2D
3 2 0 0 0 0 0 0 0 0999 V2000
-1.2990 -0.2500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 0.5000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.2990 -0.2500 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
2 3 1 0
M ENDEach atom line holds coordinates and the element; each bond line holds two atom numbers, the bond order and a stereo flag for wedges and hashes. The counts are three-digit fields, so a V2000 file holds at most 999 atoms.
SD file, 1982#
An SD file is a list of molfiles, each followed by named data items and $$$$:
M END
> <CAS_NUMBER> (1)
64-17-5
> <PUBCHEM_CID> (1)
702
$$$$A data item can hold anything from an assay result to a catalogue number. PubChem, ChEMBL and ZINC distribute their data as SD files, and NMReDATA uses them to attach NMR assignments to a structure (see Spectroscopy file formats).
Mol2, 1991#
The Tripos Mol2 format has sections headed @<TRIPOS>ATOM, @<TRIPOS>BOND and so on, and gives every atom a SYBYL type and a partial charge, which docking and molecular dynamics programs need.
CIF, 1991#
The Crystallographic Information File is the archive format of the International Union of Crystallography.3 Each value sits under a data name, such as _cell_length_a, defined in a dictionary. A CIF holds the unit cell, symmetry, fractional coordinates and refinement data, and grows by adding names that older programs can skip.
XYZ, 1995#
An XYZ file is an atom count, a comment line and one line per atom with the element and Cartesian coordinates in ångström. There are no bonds; programs infer them from distances.
9
ethanol
C -0.888311 0.167003 -0.027316
C 0.465753 -0.511559 -0.036795
O 1.431075 0.322916 0.586670
H -0.848741 1.117480 -0.569524
H -1.647121 -0.470443 -0.489637
H -1.196397 0.397845 0.997723
H 0.791997 -0.722428 -1.059726
H 0.424604 -1.455862 0.513791
H 1.467142 1.155048 0.084814CML, 1999#
Chemical Markup Language, by Peter Murray-Rust and Henry Rzepa, is an XML vocabulary for molecules, reactions, spectra and crystals.4 It can be validated against a schema, and the Chemistry Development Kit and Open Babel read and write it.
CDX and CDXML, 2002#
ChemDraw's binary and XML formats store the drawing as well as the chemistry: text, arrows and the position of every object on the page.
Molfile V3000, 2002#
V3000 replaces the fixed columns with tagged M V30 lines, removes the 999-atom limit, and adds Sgroups and enhanced stereochemistry, which can mark a stereocentre as racemic or as known only in relative configuration.
ethanol
RDKit 2D
0 0 0 0 0 0 0 0 0 0999 V3000
M V30 BEGIN CTAB
M V30 COUNTS 3 2 0 0 0
M V30 BEGIN ATOM
M V30 1 C -1.299038 -0.250000 0.000000 0
M V30 2 C 0.000000 0.500000 0.000000 0
M V30 3 O 1.299038 -0.250000 0.000000 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 2
M V30 2 1 2 3
M V30 END BOND
M V30 END CTAB
M ENDCXSMILES, around 2007#
ChemAxon's extended SMILES appends a block between vertical bars with coordinates, atom labels or Sgroups. A program that does not know the extension reads the SMILES and treats the rest as a name.
CCO |(-1.29904,-0.25,;0,0.5,;1.29904,-0.25,)|mmCIF, 2014#
Macromolecular CIF applies the CIF dictionary to biomolecules.5 The PDB format cannot hold more than 99,999 atoms or 62 chains, and in 2014 PDBx/mmCIF became the standard format of the PDB archive; the old format is frozen.6
Side by side#
| Format | Year | Carries |
|---|---|---|
| PDB | 1971 | Residues, chains, 3D coordinates |
| Molfile V2000 | 1981 | Atoms, bonds, coordinates, stereo flags |
| SD file | 1982 | Molfiles with named data |
| Mol2 | 1991 | Atom types and partial charges |
| CIF | 1991 | Unit cell, symmetry, refinement data |
| XYZ | 1995 | Coordinates only |
| CML | 1999 | Any chemistry, in XML |
| CDXML | 2002 | Structure and full drawing |
| Molfile V3000 | 2002 | No size limit, Sgroups, enhanced stereo |
| CXSMILES | 2007 | SMILES with coordinates and labels |
| mmCIF | 2014 | PDB content in the CIF model |
On this site#
Covalent opens MOL, SD and SMILES files and exports MOL, SMILES, SVG and PNG. The SMILES to structure converter and every page in the molecule catalogue offer a MOL download.
References#
- Bernstein FC et al. The Protein Data Bank: a computer-based archival file for macromolecular structures. J. Mol. Biol. 112, 535–542 (1977). doi:10.1016/S0022-2836(77)80200-3
- Dalby A et al. Description of several chemical structure file formats used by computer programs developed at Molecular Design Limited. J. Chem. Inf. Comput. Sci. 32, 244–255 (1992). doi:10.1021/ci00007a012
- Hall SR, Allen FH, Brown ID. The crystallographic information file (CIF): a new standard archive file for crystallography. Acta Cryst. A47, 655–685 (1991). doi:10.1107/S010876739101067X
- Murray-Rust P, Rzepa HS. Chemical markup, XML, and the Worldwide Web. 1. Basic principles. J. Chem. Inf. Comput. Sci. 39, 928–942 (1999). doi:10.1021/ci990052b
- Westbrook JD et al. PDBx/mmCIF ecosystem: foundational semantic tools for structural biology. J. Mol. Biol. 434, 167599 (2022). doi:10.1016/j.jmb.2022.167599
- wwPDB. File formats and the PDB. wwpdb.org