rust-sasa

Crates.iorust-sasa
lib.rsrust-sasa
version0.3.2
created_at2024-02-11 22:54:02.11942+00
updated_at2025-07-13 06:18:26.233222+00
descriptionRustSASA is a Rust library for computing the absolute solvent accessible surface area (ASA/SASA) of each atom in a given protein structure using the Shrake-Rupley algorithm.
homepage
repositoryhttps://github.com/maxall41/RustSASA
max_upload_size
id1136159
size6,352,136
Max Campbell (maxall41)

documentation

https://docs.rs/rust-sasa/latest/rust_sasa/

README

RustSASA

GitHub Actions Workflow Status Crates.io Downloads (recent) Crates.io License rustc 1.85+

RustSASA is a Rust library for computing the absolute solvent accessible surface area (ASA/SASA) of each atom in a given protein structure using the Shrake-Rupley algorithm[1]. It can be used in place of Freesasa, Biopython, or any other SASA calculation library. You can us it directly in Rust or use our Python bindings! We also have a CLI if you prefer that.

Features:

  • 🦀 Written in Pure Rust
  • ⚡️ Ludicrously fast. 46X Faster than Biopython and 7X faster than Freesasa.
  • 🧪 Full test coverage
  • 🐍 Python support
  • 🤖 Command line interface

Usage

Using in Rust 🦀

use pdbtbx::StrictnessLevel;
use rust_sasa::options::{SASAOptions, ResidueLevel};

let (mut pdb, _errors) = pdbtbx::open("./example.cif").unwrap();
let result = SASAOptions::<ResidueLevel>::new().process(&pdb);

Full documentation can be found here

Using in Python 🐍

You can now utilize RustSasa within Python to speed up your scripts! Take a look at rust-sasa-python!

Installation:

pip install rust-sasa-python

Example:

from rust_sasa_python import calculate_sasa_at_residue_level
# Also supports mmCIF files!
residue_sasa_values = calculate_sasa_at_residue_level("path_to_pdb_file.pdb")

See full docs here

Using CLI 🤖

Processing single file

rust-sasa path_to_pdb_file.pdb output.json # Also supports .xml, .pdb, and .cif!

Processing an entire directory

rust-sasa input_directory/ output_directory/ --format json # Also supports .xml, .pdb, and .cif!

Installation

Rust

cargo add rust-sasa

Python

pip install rust-sasa-python

CLI

Method 1: Use Cargo bin install

1. Install Cargo Bin Install

curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash

2. Install rust-sasa

cargo binstall rust-sasa

Method 2: Download binary from Github Releases

  1. Download latest binary from github releases
  2. Add the binary to your path
  3. Done!

Benchmarking

Results:

  • RustSasa: 8.071 s ± 0.361 s

  • Freesasa: 54.914 s ± 0.455 s

  • Biopython: 368.025 s ± 51.156 s

Methodology:

We computed residue level SASA values for the entire AlphaFold E. coli proteome structure database using RustSASA, Freesasa, and Biopython. Benchmarks were run with Hyperfine with options: --warmup 3 --runs 3. All three methods ran across 8 cores on an Apple M3 Macbook with 24GB of unified memory. The RustSASA CLI was used to take advantage of profile guided optimization. GNU Parallel was used to run Freesasa and Biopython in parallel.

Validation against Freesasa

Comparing Freesasa and RustSasa on E. coli proteome

Comparing Freesasa and RustSasa on Freesasa comparison dataset

Other

License

MIT

Latest update (0.3.1)

  • ⚡️ Slightly faster due to memory allocation optimization
  • PGO Builds

Also see changelog.

Contributing

Contributions are welcome! Please feel free to submit pull requests and open issues. As this is an actively developed library, I encourage sharing your thoughts, ideas, suggestions, and feedback.

Citations:

1: Shrake A, Rupley JA. Environment and exposure to solvent of protein atoms. Lysozyme and insulin. J Mol Biol. 1973 Sep 15;79(2):351-71. doi: 10.1016/0022-2836(73)90011-9. PMID: 4760134.

Commit count: 52

cargo fmt