PDBTools.jl

A lightweight and flexible Julia package for handling structure files with ease.

Installation

Install the Julia programming language, and do:

julia> import Pkg; Pkg.add("PDBTools")

Quick Start

using PDBTools
atoms = read_pdb(PDBTools.test_dir*"/small.pdb")
   Vector{Atom{Nothing}} with 35 atoms with fields:
   index name resname chain   resnum  residue        x        y        z occup  beta model segname index_pdb
       1    N     ALA     A        1        1   -9.229  -14.861   -5.481  0.00  0.00     1    PROT         1
       2 1HT1     ALA     A        1        1  -10.048  -15.427   -5.569  0.00  0.00     1    PROT         2
⋮
      34    C     ASP     A        3        3   -2.626  -10.480   -7.749  1.00  0.00     1    PROT        34
      35    O     ASP     A        3        3   -1.940  -10.014   -8.658  1.00  0.00     1    PROT        35

What Makes it Special?

  • Simple but Powerful: Read and write PDB and mmCIF structure files with minimal overhead.
  • Flexible Atom Selection: Use intuitive syntax or custom Julia functions.
  • Perfect for MD: Designed with molecular dynamics workflows in mind.
  • Lightweight: Focus on atomic data without the overhead of metadata parsing and compact data structures. Can handle very large structures.
  • Performance: Expect analysis functions to be fast. For instance, SASA and hydrogen bonds analyses are among the fastest available.

Key Features

Clean Data Structure

Every atom is represented by a simple, accessible structure:

atoms[1]
   index name resname chain   resnum  residue        x        y        z occup  beta model segname index_pdb
       1    N     ALA     A        1        1   -9.229  -14.861   -5.481  0.00  0.00     1    PROT         1
(name(atoms[1]), resname(atoms[1]), chain(atoms[1]))
(InlineStrings.String7("N"), InlineStrings.String7("ALA"), InlineStrings.String3("A"))

The use of InlineStrings makes the data structure compact, allowing handling millions of atoms is standard computers.

Intuitive Selection Syntax

Select atoms using simple, readable syntax, similar to that of VMD:

selection = select(atoms, "resname ALA and name N CA")
   Vector{Atom{Nothing}} with 2 atoms with fields:
   index name resname chain   resnum  residue        x        y        z occup  beta model segname index_pdb
       1    N     ALA     A        1        1   -9.229  -14.861   -5.481  0.00  0.00     1    PROT         1
       5   CA     ALA     A        1        1   -8.483  -14.912   -6.726  1.00  0.00     1    PROT         5

Power of Julia Functions

Leverage Julia's expressiveness for complex selections:

selection = select(atoms, atom ->
    (atom.resname == "ARG" && atom.x < 10) || atom.name == "N"
)
   Vector{Atom{Nothing}} with 3 atoms with fields:
   index name resname chain   resnum  residue        x        y        z occup  beta model segname index_pdb
       1    N     ALA     A        1        1   -9.229  -14.861   -5.481  0.00  0.00     1    PROT         1
      13    N     CYS     A        2        2   -6.351  -14.461   -5.695  1.00  0.00     1    PROT        13
      24    N     ASP     A        3        3   -4.383  -11.903   -6.849  1.00  0.00     1    PROT        24

Use of Julia functions for selection can also improve performance if dynamic selections are used in critical code.

See also

PDBTools.jl is integrated with MolSimToolkit.jl and ComplexMixtures.jl, providing novel and practical tools for molecular dynamics simulations analysis.

Note

PDBTools prioritizes flexibility over strict format adherence. It's designed for:

  • Molecular dynamics workflows
  • Quick structure analysis
  • Basic PDB/mmCIF file manipulation

For comprehensive PDB/mmCIF format support, check out BioStructures.jl from BioJulia.