Skip to main content

Molecular Realm for Spatial Indexed Structures - Fast spatial operations for molecular data

Project description

Molr

GitHub Release GitHub Actions Test Workflow Status PyPI - Version Python Wheels Python Versions GitHub last commit PyPI - Status Conda Version License GitHub Downloads (all assets, all releases) PyPI Downloads codecov Socket CodeFactor

MolR - Molecular Realm for Spatial Indexed Structures

A high-performance Python package that creates a spatial realm for molecular structures, providing lightning-fast neighbor searches, geometric queries, and spatial operations through integrated KDTree indexing.

Features

High-Performance Structure Representation

  • NumPy-based Structure class with Structure of Arrays (SoA)
  • Efficient spatial indexing with scipy KDTree integration for O(log n) neighbor queries
  • Memory-efficient trajectory handling with StructureEnsemble
  • Lazy initialization of optional annotations to minimize memory usage

Comprehensive Bond Detection

  • Hierarchical bond detection with multiple providers:
    • File-based bonds from PDB CONECT records and mmCIF data
    • Template-based detection using standard residue topologies
    • Chemical Component Dictionary (CCD) lookup for ligands
    • Distance-based detection with Van der Waals radii
  • Intelligent fallback system ensures complete bond coverage
  • Partial processing support for incremental bond detection

Powerful Selection Language

  • MDAnalysis/VMD-inspired syntax for complex atom queries
  • Spatial selections with within, around, and center-of-geometry queries
  • Boolean operations (and, or, not) for combining selections
  • Residue-based selections with byres modifier

Multi-Format I/O Support

  • PDB format with multi-model support and CONECT record parsing
  • mmCIF format with chemical bond information extraction
  • Auto-detection of single structures vs. trajectories
  • String-based parsing for in-memory structure creation

Installation

pip install molr

For development installation:

git clone https://github.com/abhishektiwari/molr.git
cd molr
pip install -e .[dev]

Requirements

  • Python ≥3.8
  • NumPy ≥1.20.0
  • SciPy ≥1.7.0 (for spatial indexing)
  • pyparsing ≥3.0.0 (for selection language)

Usage

Please review Molr documentation for more details on how to use Molr for various use cases.

Quick Example

import molr

# Load a structure
structure = molr.Structure.from_pdb("protein.pdb")

# Detect bonds
bonds = structure.detect_bonds()

# Use selection language
active_site = structure.select("within 5.0 of (resname HIS)")

# Fast spatial queries
neighbors = structure.get_neighbors_within(atom_idx=100, radius=5.0)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

See our contributing guide and development guide. At a high-level,

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

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

molr-0.0.2.dev3.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

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

molr-0.0.2.dev3-py3-none-any.whl (3.2 MB view details)

Uploaded Python 3

File details

Details for the file molr-0.0.2.dev3.tar.gz.

File metadata

  • Download URL: molr-0.0.2.dev3.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for molr-0.0.2.dev3.tar.gz
Algorithm Hash digest
SHA256 6c1bc12cf673ed5bc89b868eb2cccbc65106fa9c8685b700884a66535c94471a
MD5 e6139059ffd3bc2258b464fb165782b8
BLAKE2b-256 7b452060349e8edd9ae5c417eac285c9294815b79e6047e5314649fc9bec5ccf

See more details on using hashes here.

Provenance

The following attestation bundles were made for molr-0.0.2.dev3.tar.gz:

Publisher: release.yml on abhishektiwari/molr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file molr-0.0.2.dev3-py3-none-any.whl.

File metadata

  • Download URL: molr-0.0.2.dev3-py3-none-any.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for molr-0.0.2.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 ae8c327b07b9809732eb0db72f0eef8e20cb0076c85362a7ce68bbdbdccb59c6
MD5 c5cc80ea2e6c04144b6077e53fc334e5
BLAKE2b-256 a2849563832568052aa46952128c3f1227c6f63e089d0de58408541d5d228155

See more details on using hashes here.

Provenance

The following attestation bundles were made for molr-0.0.2.dev3-py3-none-any.whl:

Publisher: release.yml on abhishektiwari/molr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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