Skip to main content

This library allows the calculation of a solvent-accessible-surface area of a trajectory

Project description

MDSASA-Bolt ⚡️

GitHub Actions Workflow Status PyPI - Version PyPI - License Python 3.11+ PyPI - Downloads

MDSASA-Bolt is a high-performance Python library for computing solvent accessible surface area (SASA) of molecular dynamics trajectories. It's a drop-in replacement for mdakit-sasa that leverages RustSASA under the hood to deliver dramatically improved performance while maintaining full compatibility with MDAnalysis workflows.

Features ✨

  • ⚡️ Ludicrous Speed: ~4.8x faster than mdakit-sasa.
  • 🔄 Drop-in Replacement: Compatible with existing mdakit-sasa workflows.
  • 🧬 MDAnalysis Integration: Seamlessly works with MDAnalysis Universe and AtomGroup objects.
  • 🦀 Powered by RustSASA: Leverages Rust's performance and safety.
  • 🧪 Validated: Tested against Freesasa/mdakit_sasa.
  • 📊 Trajectory Analysis: Built for analyzing entire MD trajectories efficiently
  • 🐍 Pure Python API: Familiar interface for Python developers

Quick Start

Installation

pip install mdsasa-bolt

Basic Usage

import MDAnalysis as mda
from mdsasa_bolt import SASAAnalysis

# Load your trajectory
u = mda.Universe("topology.pdb", "trajectory.dcd")

# Create SASA analysis
sasa_analysis = SASAAnalysis(u, select="protein")

# Run the analysis
sasa_analysis.run()

# Access results
print(f"Mean total SASA: {sasa_analysis.results.mean_total_area:.2f} Ų")
print(f"SASA per frame: {sasa_analysis.results.total_area}")
print(f"SASA per residue: {sasa_analysis.results.residue_area}")

Advanced Usage

import MDAnalysis as mda
from mdsasa_bolt import SASAAnalysis

# Load trajectory
u = mda.Universe("system.gro", "trajectory.xtc")

# Analyze specific selection with custom frame range
sasa_analysis = SASAAnalysis(
    u,
    select="resname LYS or resname ARG",  # Only basic residues
    start=100,                           # Start from frame 100
    stop=1000,                          # End at frame 1000
    step=10                             # Analyze every 10th frame
)

# Run analysis
sasa_analysis.run()

# Results are available as numpy arrays
total_sasa_per_frame = sasa_analysis.results.total_area
residue_sasa_matrix = sasa_analysis.results.residue_area  # Shape: (n_frames, n_residues)
mean_total_sasa = sasa_analysis.results.mean_total_area

Performance Benchmarks 🚀

Benchmarks were performed using Hyperfine with DCD and PSF test trajectory files from MDAnalysisTests:

Method Time Speedup
mdsasa-bolt 1.156 s ± 0.014 s 4.8x faster
mdakit-sasa 5.501 s ± 0.060 s baseline

Test system: MDAnalysisTests trajectory data

Validation 📊

MDSASA-Bolt has been thoroughly validated against reference implementations to ensure accuracy:

Comparing SASA results

MDSASA-Bolt acheives a pearson correlation of 0.947 and an RMSE of 167.95 when compared against mdakit_sasa.

API Reference

SASAAnalysis

The main analysis class that integrates with MDAnalysis.

Parameters

  • universe_or_atomgroup (Universe or AtomGroup): MDAnalysis Universe or AtomGroup to analyze
  • select (str, optional): Selection string for atoms (default: "all")
  • start (int, optional): First frame to analyze
  • stop (int, optional): Last frame to analyze
  • step (int, optional): Step size between frames

Results

After calling run(), results are available in the results attribute:

  • total_area (numpy.ndarray): Total SASA for each frame
  • residue_area (numpy.ndarray): SASA per residue for each frame (shape: n_frames × n_residues)
  • mean_total_area (float): Mean total SASA across all frames

Development

Setting up development environment

git clone https://github.com/maxall41/mdsasa-bolt.git
cd mdsasa-bolt
uv pip install -e .[dev]

Running tests

pytest tests/

Code formatting

This project uses Ruff for linting and formatting:

ruff check .
ruff format .

Contributing

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

⚠️ A Note on Compatibility with mdakit_sasa

Inferring the element of an atom can be quite complicated. mdsasa-bolt does it's best to match the freesasa element inference algorithm, but it may not always be accurate. We recommend test the output values of mdsasa-bolt against mdakit-sasa for your usecase before using it in production. We also recommend that you use input files with explicit element information whenever possible.

License

This project is licensed under the GNU General Public License v2.0 - see the LICENSE file for details.

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdsasa_bolt-1.0.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdsasa_bolt-1.0.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file mdsasa_bolt-1.0.0.tar.gz.

File metadata

  • Download URL: mdsasa_bolt-1.0.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for mdsasa_bolt-1.0.0.tar.gz
Algorithm Hash digest
SHA256 80182c4323ab4ec5f0865ddd90a59c30a2fd81aa2f2e74bf67ed88bf81228405
MD5 f1d7e506b4df74c31a04fbf16ca7b9a4
BLAKE2b-256 c55f83b1f21abd44ce1fe1b6443f72e8c456a62abbba1cabeb1c013b9b046191

See more details on using hashes here.

File details

Details for the file mdsasa_bolt-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mdsasa_bolt-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for mdsasa_bolt-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50c6640a9230a28ebef663feb0967b0447e0338050a2539132c426f1ddd6ecee
MD5 2fd698d1dc3304b859d5e61cba92bb04
BLAKE2b-256 15bd3bee36f9842bf76aa36f4a5afb4ecf700703f997488180099c78aaa4924b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page