cealign 0.1.0

Implementation of the Combinatorial Extension (cealign) algorithm to align protein structures
Documentation

cealign

ci Codacy Badge crates.io docs.rs DOI

A Rust implementation of the Combinatorial Extension (CE) algorithm for protein structure alignment, available as both a command-line tool and a library.

Usage

CLI

Usage: cealign [OPTIONS] -m <MOBILE> -t <TARGET>

Options:
  -m <MOBILE>   Path to the mobile structure
  -t <TARGET>   Path to the target structure
  -o, --output  Save aligned structures as PDB files (`<name>_aln.pdb`)
  -v, --verbose Increase output verbosity
  -p, --plot    Save the alignment path plot as plot.png [requires --features plot]
  -h, --help    Print help
  -V, --version Print version

Align two structures and print the RMSD:

cealign -m mobile.pdb -t target.pdb

Save the aligned structures to disk:

cealign -m mobile.pdb -t target.pdb -o

Save the alignment path plot (requires --features plot):

cealign -m mobile.pdb -t target.pdb -p

Library

use cealign::ce;

let (mobile, _) = pdbtbx::open("mobile.pdb").unwrap();
let (target, _) = pdbtbx::open("target.pdb").unwrap();

let (aligned_mobile, reference, rmsd, n_aligned) = ce::align(mobile, target, false);
println!("{:.3}", rmsd);

Installation

CLI

cargo install cealign

To include the optional alignment path plot feature:

cargo install cealign --features plot

The plot feature requires libfontconfig on Linux (sudo apt-get install libfontconfig-dev).

Library

Add to your Cargo.toml:

[dependencies]
cealign = "0.1"

Example

Align crambin X-ray structure (1CRN) against the first NMR model of (1CCM).

1CCM is a multi-model NMR ensemble, so we extract model 1 first:

# Download structures
curl -s https://files.rcsb.org/download/1CRN.pdb -o 1crn.pdb
curl -s https://files.rcsb.org/download/1CCM.pdb -o 1ccm_full.pdb

# Extract model 1 from the NMR ensemble
awk '/^MODEL/ && $2==1{p=1} p; /^ENDMDL/ && p{p=0}' 1ccm_full.pdb > 1ccm_1.pdb

# Align
cealign -m 1crn.pdb -t 1ccm_1.pdb

Expected output (RMSD in Å over the aligned Cα atoms):

1.331

Full run with verbose logging, alignment output, and plot (requires --features plot):

cealign -m 1crn.pdb -t 1ccm_1.pdb -v -o -p
[DEBUG cealign] Verbose mode enabled
[INFO  cealign::ce] Initial RMSD (full): 22.172
[DEBUG cealign::ce] find_path: 20 candidate paths in buffer
[DEBUG cealign::ce] Candidate path: 5 AFPs (40 residues), aligned RMSD = 1.331
...
[INFO  cealign::ce] Final RMSD (aligned CA, 40 residues): 1.331
[INFO  cealign::ce] Final RMSD (full): 1.921
1.331
Saved: plot.png
Saved: 1crn_aln.pdb and 1ccm_1_aln.pdb

The alignment path plot (plot.png) shows each AFP as a diagonal segment on a residue-index grid, mirroring Figure 2 from Shindyalov & Bourne (1998):

Alignment path plot

Limitations

  • Single-model PDB files only — multi-model NMR ensembles must be split before use
  • Alignment is performed on Cα atoms; all heavy atoms are transformed using the resulting rotation and translation

See Also

License

0BSD