Skip to main content

rs-dssp

A high-performance Rust implementation of the DSSP (Dictionary of Secondary Structure of Proteins) algorithm.

Features

  • Full C8 Classification: Supports all 8 secondary structure types (H, G, I, E, B, T, S, P)
  • High Accuracy: >97% agreement with reference DSSP on TS50 benchmark
  • Multiple Input Formats: PDB and mmCIF file support
  • Multiple Output Formats: Legacy DSSP, JSON, simple sequence, mmCIF annotations
  • Parallel Processing: Multi-threaded batch processing with Rayon
  • Python Bindings: Full Python API via PyO3
  • SASA Calculation: Solvent accessible surface area using Shrake-Rupley algorithm

Installation

Rust CLI

Build from source:

git clone https://github.com/your-org/rs-dssp
cd rs-dssp
cargo build --release

# The binary will be at target/release/rs-dssp
./target/release/rs-dssp --help

Python Package (Local Installation with uv)

The Python bindings are built using PyO3 and maturin. Use uv for easy local installation:

# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh

# Navigate to the Python bindings crate
cd crates/dssp-py

# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Build and install in development mode
uv pip install maturin
maturin develop --release

# Or build a wheel for distribution
maturin build --release
uv pip install ../target/wheels/rs_dssp-*.whl

Using uvx (One-shot execution)

For quick one-shot usage without permanent installation:

# Run maturin directly via uvx
cd crates/dssp-py
uvx maturin develop --release

Alternative: pip installation (from local build)

cd crates/dssp-py
pip install maturin
maturin develop --release

Note: PyPI publication is not yet available. Please use local installation methods above.

Usage

Command Line

# Basic usage
rs-dssp protein.pdb -o result.dssp

# JSON output
rs-dssp protein.pdb --format json -o result.json

# Simple sequence output
rs-dssp protein.pdb --format simple

# Batch processing with 8 threads
rs-dssp *.pdb -j 8 -o results/

# C3 simplified classification
rs-dssp protein.pdb --c3

# mmCIF input
rs-dssp protein.cif -o result.dssp

Python API

import rs_dssp

# From PDB file
result = rs_dssp.assign("protein.pdb")
print(result.sequence)      # 'HHHHHH    EEEE    '
print(result.sequence_c3)   # 'HHHHHH----EEEE----'
print(result.aa_sequence)   # 'MKTAYIAKQR...'

# Access individual residues
for res in result.residues:
    print(f"{res.chain_id}:{res.seq_id} {res.amino_acid} -> {res.structure}")

# From NumPy coordinates
import numpy as np
coords = np.array([...])  # shape: (L, 4, 3) - N, CA, C, O
result = rs_dssp.assign_from_coords(coords)

# Batch processing
results = rs_dssp.assign_batch(["a.pdb", "b.pdb"], n_threads=4)

Rust Library

use dssp_core::{calculate_dssp, DsspConfig, Structure};
use dssp_io::pdb::parse_pdb;
use std::fs::File;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Parse PDB file
    let file = File::open("protein.pdb")?;
    let mut structure = parse_pdb(file)?;

    // Calculate DSSP
    let config = DsspConfig::default();
    let stats = calculate_dssp(&mut structure, &config);

    // Get results
    println!("SS sequence: {}", structure.ss_sequence());
    println!("Residue count: {}", stats.residue_count);

    Ok(())
}

Secondary Structure Classification

C8 (Full)

Code Structure Description
H α-helix 4-residue H-bond pattern
G 3₁₀-helix 3-residue H-bond pattern
I π-helix 5-residue H-bond pattern
E β-strand Extended in β-sheet
B β-bridge Isolated β-bridge
T Turn H-bonded turn
S Bend High curvature (κ > 70°)
P PPII Poly-Proline II helix
(space) Loop No regular structure

C3 (Simplified)

Code C8 Mapping
H H, G, I
E E, B
- T, S, P, (space)

Algorithm

The implementation follows the original Kabsch & Sander (1983) algorithm:

  1. Hydrogen Bond Detection: Calculates H-bond energy using the electrostatic formula:

    E = -27.888 × (1/r_ON + 1/r_CH - 1/r_OH - 1/r_CN) kcal/mol
    

    Bonds with E < -0.5 kcal/mol are considered hydrogen bonds.

  2. Helix Detection: Identifies 3₁₀, α, and π helices based on consecutive H-bond patterns.

  3. Beta Sheet Detection: Detects parallel and antiparallel bridges, assembles ladders and sheets.

  4. Turn/Bend Detection: Marks turns near helix starts and bends at high curvature regions.

  5. PPII Detection: Identifies Poly-Proline II helices based on φ/ψ angles.

Benchmarks

Performance comparison on TS50 dataset (50 proteins, 6860 residues):

Implementation Throughput (res/ms) Speedup vs mkdssp
rs-dssp (batch) 190.6 2593x
dssp-py (Python bindings) 82.5 1122x
rs-dssp (per-file) 23.8 324x
PyDSSP (NumPy) 20.2 275x
mkdssp (C++ reference) 0.1 1x
  • rs-dssp batch mode processes all files in a single invocation with parallel execution
  • dssp-py calls Rust directly via PyO3 FFI (no process spawn overhead)
  • mkdssp is slow due to ~500MB dictionary loading per invocation

Accuracy: >97% C3 agreement with reference DSSP.

References

  • Kabsch, W. & Sander, C. (1983). Dictionary of protein secondary structure: Pattern recognition of hydrogen-bonded and geometrical features. Biopolymers, 22(12), 2577-2637.

License

MIT OR Apache-2.0

Metadata

Release files for rs-dssp 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rs-dssp 0.2.1
File Size Uploaded Provenance Actions
rs_dssp-0.2.1.tar.gz 58.7 kB Without provenance Details for rs_dssp-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rs-dssp 0.2.1
File Interpreter ABI Platform Actions
rs_dssp-0.2.1-cp311-cp311-manylinux_2_34_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.34+ x86-64 Details for rs_dssp-0.2.1-cp311-cp311-manylinux_2_34_x86_64.whl

Total release size: 456.1 kB

Release files / rs_dssp-0.2.1.tar.gz

Download URL rs_dssp-0.2.1.tar.gz
Size 58.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b7f55563d259f84f86967284ead123b1a0491b3010507322a7780c426739e2e8
BLAKE2b-256 checksum
How to use checksums
cde5780894b2fe6c05d78d8b4af4c3a7b044869c07362d524bb03722cac7123c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / rs_dssp-0.2.1-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL rs_dssp-0.2.1-cp311-cp311-manylinux_2_34_x86_64.whl
Size 397.4 kB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
d747acfcfeee43b36cd1514326798ba16f3ef87abba284119c9c7e86d5d04398
BLAKE2b-256 checksum
How to use checksums
1a7cb68daeb72dcd646645a4175fd4990914b809a53fa7e534dcfdd499caef66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for rs-dssp 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page