Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including parse-pdb with all npm packages installed. Try it out:

var parsePdb = require("parse-pdb")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

parse-pdb v1.0.0

A parser for the Protein Data Bank (PDB) molecule format


A simple utility for parsing PDB files into an easily useable JSON format that handles atoms ,residues, and chains.

Getting Started

npm install --save parse-pdb

const parsePdb = require('parse-pdb');
const { readFileSync } = require('fs');

const pdbString = readFileSync('./3aid.pdb', 'utf8');

const parsed = parsePdb(pdbString);

[ { serial: 1,
    name: 'N',
    altLoc: '',
    resName: 'PRO',
    chainID: 'A',
    resSeq: 1,
    iCode: '',
    x: -2.555,
    y: 9.253,
    z: 34.411,
    occupancy: 1,
    tempFactor: 30.6,
    element: 'N',
    charge: '' },
  ...1845 others

JSON Format

The output json is an object containing arrays of each structure keyed on record name, according to the pdb spec.

    serial: integer
    name: string
    altLoc: string
    resName: string
    chainID: string
    resSeq: integer
    iCode: string
    x: float
    y: float
    z: float
    occupancy: float
    tempFactor: float
    element: string
    charge: string
    serNum: integer
    chainID: string
    numRes: integer
    resNames: array of strings
    id: integer (count)
    serNum: integer
    chainID: string
    resName: string
    atoms: array of atoms
  chains: Map
    key: chainID
      id: integer (count)
      chainID: string
      residues: array of residues


MIT. See LICENSE file.


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free