Skip to main content

NMR spectroscopy calculations for protein structures

Project description

synth-nmr

Tests PyPI version Python versions Ruff Mypy License: MIT Documentation DOI

NOE Avenue

NMR spectroscopy calculations for protein structures

A lightweight, standalone Python package for calculating NMR observables from protein structures. Originally extracted from the synth-pdb package to provide a focused toolkit that works with any protein structure source.

Read the full documentation here!

Features

  • NOE Calculations: Synthetic NOE distance restraints
  • Relaxation Rates: R1, R2, and heteronuclear NOE predictions
  • Chemical Shifts: Integrates to SHIFTX2 predictions with SPARTA+ empirical fallback
  • J-Couplings: Scalar coupling prediction using the Karplus equation with Vuister & Bax (1993) parameters.
  • RDC Calculations: Prediction of residual dipolar couplings
  • MD Trajectory / Ensemble NMR: S², ensemble-averaged shifts, NOEs (r⁻⁶), and RDCs from NMR ensembles or MD trajectories
  • NEF I/O: Read and write NMR Exchange Format files
  • Secondary Structure: Automatic classification for enhanced predictions

Interactive Tutorials

Try out synth-nmr immediately in your browser using Google Colab!

  • Open In Colab Basic NMR Prediction
  • Open In Colab Advanced Observables: J-Couplings, NOEs, and RDCs
  • Open In Colab Relaxation & Dynamics Analysis
  • Open In Colab Ensemble NMR Analysis: Proteins in Motion

AI Assistant & Interactive Documentation

NotebookLM Source Guide
We've assembled the repository documentation, roadmap, and core physics code into a single curated text file: synth_nmr_source_guide.txt. You can upload this file directly to Google's NotebookLM to instantly create an interactive, AI-powered study guide. Use it to chat with the codebase, learn the underlying NMR spectroscopy physics, or ask how to use the CLI and API!

Installation

pip install synth-nmr

For improved performance with JIT compilation:

pip install synth-nmr[performance]

For MD trajectory / ensemble NMR analysis:

pip install synth-nmr[trajectory]

Command-Line Interface

synth-nmr provides a command-line interface for common tasks, allowing you to perform calculations directly from your terminal.

Usage

You can run synth-nmr CLI commands directly or enter an interactive mode.

Non-Interactive Mode

Execute commands by passing them as arguments to the synth_nmr.synth_nmr_cli module:

python -m synth_nmr.synth_nmr_cli <command> [arguments]

Examples:

  1. Read a PDB file and calculate RDCs:

    python -m synth_nmr.synth_nmr_cli read pdb protein.pdb calculate rdc 10.0 0.5
    
  2. Read a PDB file and predict chemical shifts:

    python -m synth_nmr.synth_nmr_cli read pdb protein.pdb predict shifts
    
  3. Read a PDB file and calculate J-couplings:

    python -m synth_nmr.synth_nmr_cli read pdb protein.pdb calculate j-coupling
    

Interactive Mode

To enter interactive mode, run the CLI without any arguments:

python -m synth_nmr.synth_nmr_cli

Once in interactive mode, you will see a SynthNMR> prompt. Type help to see available commands:

SynthNMR> help
Commands:
  read pdb <filename>
  calculate rdc [Da] [R]
  predict shifts
  calculate j-coupling
  exit
SynthNMR> read pdb protein.pdb
SynthNMR> calculate rdc 10.0 0.5
SynthNMR> exit

Available Commands

  • read pdb <filename>: Loads a protein structure from the specified PDB file. This command must be executed before any calculation commands.
  • calculate rdc [Da] [R]: Calculates Residual Dipolar Couplings.
    • Da: (Optional) Axial component of the alignment tensor in Hz (default: 10.0).
    • R: (Optional) Rhombicity of the alignment tensor (dimensionless) (default: 0.5).
  • predict shifts: Predicts chemical shifts using SPARTA+ with ring current corrections.
  • calculate j-coupling: Calculates ³J(HN-Hα) couplings using the Karplus equation.
  • help: (Interactive mode only) Displays a list of available commands.
  • exit: (Interactive mode only) Exits the CLI.

Quick Start

import biotite.structure.io as strucio
from synth_nmr import (
    calculate_synthetic_noes,
    calculate_relaxation_rates,
    predict_chemical_shifts,
    calculate_hn_ha_coupling,
    calculate_rdcs
)

# Load a protein structure
structure = strucio.load_structure("protein.pdb")

# Calculate NOEs
noes = calculate_synthetic_noes(structure, cutoff=5.0)

# Predict relaxation rates
relaxation = calculate_relaxation_rates(
    structure,
    field_strength=600.0,  # MHz
    temperature=298.0,      # K
    correlation_time=5.0    # ns
)

# Predict chemical shifts
shifts = predict_chemical_shifts(structure)

# Calculate J-couplings
j_couplings = calculate_hn_ha_coupling(structure)

# Predict RDCs
rdcs = calculate_rdcs(
    structure,
    Da=10.0, # Axial component of alignment tensor (Hz)
    R=0.5    # Rhombic component of alignment tensor
)

Requirements

  • Python ≥ 3.8
  • NumPy ≥ 1.20
  • Biotite ≥ 0.35.0
  • Numba ≥ 0.55.0 (optional, for performance)

Documentation

Core Functions

calculate_synthetic_noes(structure, cutoff=5.0)

Calculate synthetic NOE distance restraints.

Parameters:

  • structure: biotite AtomArray
  • cutoff: Distance cutoff in Ångströms (default: 5.0)

Returns: Dictionary of NOE restraints

calculate_relaxation_rates(structure, field_strength, temperature, correlation_time)

Predict NMR relaxation rates (R1, R2, heteronuclear NOE).

Parameters:

  • structure: biotite AtomArray
  • field_strength: Spectrometer frequency in MHz
  • temperature: Temperature in Kelvin
  • correlation_time: Molecular correlation time in nanoseconds

Returns: Dictionary of relaxation rates per residue

predict_chemical_shifts(structure)

Predict chemical shifts using SPARTA+ with ring current corrections.

Parameters:

  • structure: biotite AtomArray

Returns: Dictionary of chemical shifts by residue and atom type

calculate_hn_ha_coupling(structure)

Calculate ³J(HN-Hα) couplings using the Karplus equation.

Parameters:

  • structure: biotite AtomArray

Returns: Dictionary of J-coupling values per residue

calculate_rdcs(structure, Da, R)

Predict residual dipolar couplings (RDCs) for backbone N-H vectors.

Parameters:

  • structure: biotite AtomArray
  • Da: Axial component of the alignment tensor in Hz
  • R: Rhombicity of the alignment tensor (dimensionless)

Returns: Dictionary of RDC values per residue

Use Cases

  • Structure Validation: Compare predicted vs experimental NMR data
  • MD Analysis: Calculate NMR observables from molecular dynamics trajectories
  • Protein Design: Predict NMR properties of designed structures
  • Data Integration: Generate synthetic NMR data for machine learning

Compatibility

Works with protein structures from any source:

  • PDB files
  • AlphaFold predictions
  • Molecular dynamics simulations
  • De novo structure generation (e.g., synth-pdb)

Citation

If you use synth-nmr in your research, please cite:

@software{synth_nmr,
  author = {Elkins, George},
  title = {synth-nmr: NMR spectroscopy calculations for protein structures},
  year = {2026},
  doi = {10.5281/zenodo.18855129},
  url = {https://github.com/elkins/synth-nmr}
}

License

MIT License - see LICENSE file for details

Related Projects

  • synth-pdb — Core synthetic protein structure generator
  • synth-saxs — SAXS profile simulator (use with synth-dynamics ensembles)
  • synth-cryo-em — Cryo-EM map simulator
  • synth-dynamics — ANM/Langevin dynamics for NMR ensemble averaging
  • diff-biophys — Differentiable JAX versions of all NMR kernels
  • diff-ensemble — IDP structural ensemble prediction with NMR restraints
  • Biotite — Computational biology toolkit

References

This package relies on the following peer-reviewed research:

  • SPARTA+: For chemical shift predictions.

    Yang, Y., & Bax, A. (2011). Journal of Biomolecular NMR, 51(3), 259–274.

  • Karplus Equation: For J-coupling calculations.

    Karplus, M. (1959). The Journal of Chemical Physics, 30(1), 11–15.

  • NMR Relaxation: The underlying theory for relaxation rate predictions.

    Lipari, G., & Szabo, A. (1982). Journal of the American Chemical Society, 104(17), 4546–4559.

  • Residual Dipolar Couplings: Seminal work on applying RDCs to proteins.

    Bax, A., & Tjandra, N. (1997). Journal of the American Chemical Society, 119(49), 12041-12042.

  • Nuclear Overhauser Effect: Foundational experimental observation.

    Solomon, I. (1955). Physical Review, 99(2), 559.

  • 2D NOESY: Development of two-dimensional NOE spectroscopy for biomolecules.

    Kumar, A., Ernst, R. R., & Wüthrich, K. (1980). Biochemical and Biophysical Research Communications, 95(1), 1-6.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions, please use the GitHub issue tracker.

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

synth_nmr-0.11.1.tar.gz (144.5 kB view details)

Uploaded Source

Built Distribution

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

synth_nmr-0.11.1-py3-none-any.whl (86.4 kB view details)

Uploaded Python 3

File details

Details for the file synth_nmr-0.11.1.tar.gz.

File metadata

  • Download URL: synth_nmr-0.11.1.tar.gz
  • Upload date:
  • Size: 144.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for synth_nmr-0.11.1.tar.gz
Algorithm Hash digest
SHA256 f675382c6e77d480625756e56407d27a4db7122e4175dcf0186e6e4ce8c0f8cb
MD5 4b56082736035d11b32debd68c16b3f7
BLAKE2b-256 2d12ceb059756dcf19b26e33b0726dfb74ec238209b4d7d86e8d661ea09f5947

See more details on using hashes here.

File details

Details for the file synth_nmr-0.11.1-py3-none-any.whl.

File metadata

  • Download URL: synth_nmr-0.11.1-py3-none-any.whl
  • Upload date:
  • Size: 86.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for synth_nmr-0.11.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cc2d53620f72a637e12862ed02d04878e1fa24fcd8039b19dc744efb906ad7a3
MD5 700d426d935c4cba72231eae691927d4
BLAKE2b-256 3afa970ab64257c64df4728e37f86a4b0c403ff4a86165e097c0a71e35856a49

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