Skip to main content

Protein Chain Restoration Algorithm - Full-atom model reconstruction from C-alpha traces

Project description

PULCHRA - Protein Chain Restoration Algorithm

A modern Python implementation of PULCHRA for reconstructing full-atom protein models from reduced C-alpha representations.

Installation

# Clone and enter the directory
cd pulchra-py

# Install with uv
uv sync

Data Setup

Before using PULCHRA, you need to convert the C header data files to NumPy format:

uv run python scripts/convert_data.py

This reads the nco_data.h, rot_data_coords.h, and rot_data_idx.h files from the project root directory and creates the corresponding .npy files in src/pulchra/data/.

Usage

Command Line

# Basic reconstruction
uv run pulchra input_ca.pdb

# With verbose output
uv run pulchra -v input.pdb

# Specify output file
uv run pulchra input.pdb -O output.pdb

# Skip certain steps
uv run pulchra --no-xvol --no-chirality input.pdb

# Use PDB-SG format (CA + sidechain centers)
uv run pulchra --pdbsg input_sg.pdb

# Optimize H-bonds (optional refinement)
uv run pulchra -q input.pdb

Python API

from pulchra import Pulchra

# Basic usage
p = Pulchra()
molecule = p.reconstruct("input_ca.pdb", "output.pdb")

# With options
p = Pulchra(
    verbose=True,
    ca_optimize=True,
    optimize_hbonds=True
)
molecule = p.reconstruct("input.pdb")

# From raw coordinates
import numpy as np
ca_coords = np.array([[x1, y1, z1], [x2, y2, z2], ...])
sequence = "MKWVTFISLLLF..."
molecule = p.reconstruct_coords(ca_coords, sequence)

Options

Option Description
-v, --verbose Verbose output
-c, --no-ca-optimize Skip C-alpha optimization
-b, --no-backbone Skip backbone reconstruction
-s, --no-sidechains Skip sidechain reconstruction
-o, --no-xvol Skip excluded volume optimization
-z, --no-chirality Skip chirality check
-q, --optimize-hbonds Optimize backbone H-bonds
-n, --center Center chain at origin
-g, --pdbsg Use PDB-SG input format
-p, --detect-cispro Auto-detect cis-prolines
-r, --random-start Start from random CA chain
-e, --amber-order AMBER backbone atom ordering
-u, --max-shift Max CA shift in Angstroms
-O, --output Output file path

Algorithm Overview

PULCHRA reconstructs protein structures through the following steps:

  1. C-alpha Optimization: Adjusts CA positions to satisfy ideal geometry using steepest descent
  2. Backbone Reconstruction: Places N, C, O atoms using statistical templates
  3. Sidechain Reconstruction: Places sidechain atoms using rotamer library
  4. Excluded Volume Optimization: Fixes steric clashes by selecting alternative rotamers
  5. Chirality Check: Detects and fixes D-amino acids
  6. H-bond Optimization (optional): Refines backbone to improve hydrogen bonding

Development

# Install dev dependencies
uv sync --dev

# Run tests
uv run pytest

# Type checking
uv run mypy src/pulchra

# Linting
uv run ruff check src/

License

MIT License - see LICENSE file.

Credits

Original PULCHRA algorithm by Piotr Rotkiewicz. Python implementation based on PULCHRA v3.06.

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

pulchra-1.0.0.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

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

pulchra-1.0.0-py3-none-any.whl (1.8 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pulchra-1.0.0.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for pulchra-1.0.0.tar.gz
Algorithm Hash digest
SHA256 acfeafd8a47505ffc4c0cfd03e410eb8148e6bf1cfe97a6cc996a31474d1c4cb
MD5 5299b0037031c8c1049ede88f9b418d3
BLAKE2b-256 dedbd10147bca0d97889be33f3b043a1f9537a7a0a57684801a0835477d4e957

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pulchra-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for pulchra-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb238101b78c1b7afa3c5880e983eb305daa68223af04a465f29aaf3dcf3be8f
MD5 51befa423c39158ae25ea3176325c87d
BLAKE2b-256 43a9e6d39e358858cbabf0e6f43a9527bb8b42b987778e7693acadb91b07e381

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