#protein #read #file-read #atoms #structure #file-format #manipulate

bin+lib lib3dmol

Lib3dmol is a library written in rust to read, manipulate, select atoms in protein structure files

4 releases

0.4.0 Oct 14, 2021
0.3.2 Mar 5, 2020
0.3.1 Feb 24, 2020
0.3.0 Feb 24, 2020

#119 in Biology

Apache-2.0

115KB
2K SLoC

Lib3dmol

Crates.io Crates.io

Lib3dmol is a library written in rust to read and select atoms in protein structure files in the PDB format

Usage

Add this to your Cargo.toml:

[dependencies]
lib3dmol = "0.3.2"

Here's a simple example that read a pdb file in tests/tests_file

use lib3dmol::parser;

fn main() {
    let my_structure = parser::read_pdb("tests/tests_file/f2.pdb", "Protein f2");

    println!(
        "Structure name: {}
Number of chain: {}
Number of residue: {}
Number of atom: {}",
        my_structure.name,
        my_structure.get_chain_number(),
        my_structure.get_residue_number(),
        my_structure.get_atom_number()
    );

    // Now we will extract the backbone

    let backbone = my_structure.select_atoms("backbone").unwrap();

    println!(
        "Number of chain: {}
Number of residue: {}
Number of atom: {}",
        backbone.get_chain_number(),
        backbone.get_residue_number(),
        backbone.get_atom_number()
    );
}

Todo

  • : PDB Writer
  • : Structure to keep informations on nucleic acid/lipid/water
  • : More options to select atoms (Alpha carbon, atoms near to an other, ...)
  • : Support of PDBx/mmCIF format

Dependencies