Skip to main content

Beta-barrel-like chain detector for PDB/mmCIF structures.

Project description

Cooper-Beta

Cooper-Beta detects beta-barrel-like protein chains in PDB, CIF, and mmCIF structures. It parses structures with Biopython, runs DSSP, slices beta-sheet C-alpha coordinates, fits ellipses to cross sections, applies geometric consistency rules, and returns chain-level results.

Quick Start

Cooper-Beta requires Python 3.10 or newer and a DSSP executable (mkdssp or dssp) on PATH.

pip install cooper-beta
cooper-beta --check-env
cooper-beta path/to/structures --out cooper_beta_results.csv

If DSSP is installed outside PATH, pass its location as a configuration override:

cooper-beta path/to/structures runtime.dssp_bin_path=/absolute/path/to/mkdssp

Installation

Install the detector:

pip install cooper-beta

Install optional tools:

pip install "cooper-beta[eval]"   # pandas for evaluation helpers
pip install "cooper-beta[full]"   # all optional extras

For development from a source checkout:

pip install -e ".[full,dev]"

The repository also includes environment.yml and scripts/setup_env.sh for a Conda or Mamba environment that installs DSSP from conda-forge:

bash scripts/setup_env.sh --dev

Command Line

Run Cooper-Beta on a single file or a directory:

cooper-beta path/to/structure.cif --out results.csv
cooper-beta path/to/structures --workers 8 --prepare-workers 8 --out results.csv

Useful options:

  • --check-env: print the Python executable and resolved DSSP executable.
  • --workers: number of analysis worker processes.
  • --prepare-workers: number of structure-preparation worker processes.
  • --out: output CSV path.
  • --version: print the installed Cooper-Beta version.

Advanced configuration uses Hydra-style KEY=VALUE overrides:

cooper-beta path/to/structures \
  runtime.dssp_bin_path=/absolute/path/to/mkdssp \
  analyzer.rules.angle.max_gap_deg=160 \
  output.summary_limit=-1

Python API

The recommended Python entry point is detect, which returns a structured PipelineRunResult. CSV output is written only when output is provided or write_csv=True.

from cooper_beta import detect

run = detect(
    "path/to/structures",
    workers=4,
    output="results.csv",
    overrides={"runtime.dssp_bin_path": "/usr/bin/mkdssp"},
)

print(run.result_counts)
for row in run.rows:
    print(row.filename, row.chain, row.result, row.reason)

Public interfaces:

  • cooper_beta.detect(...): run detection and return structured results.
  • cooper_beta.main(...): backward-compatible entry point returning row dicts.
  • cooper_beta.build_config(...): build an AppConfig from overrides.
  • cooper_beta.PipelineRunResult: complete run result with rows, input_files, output_path, and result_counts.
  • cooper_beta.DetectionResult: one chain-level result row.
  • cooper_beta.ProteinLoader: parse structures and collect per-chain C-alpha and DSSP annotations.
  • cooper_beta.PCAAligner, ProteinSlicer, and BarrelAnalyzer: lower-level analysis components for custom workflows.

User-facing failures raise Cooper-Beta exceptions such as InputValidationError, DsspNotFoundError, DsspError, StructureParseError, and ChainNotFoundError.

Output

The result CSV includes one row per chain. Core columns include:

  • filename and chain
  • result: BARREL, NON_BARREL, FILTERED_OUT, or ERROR
  • result_stage and reason
  • decision_score, decision_basis, and decision_threshold
  • score_raw and score_adjust
  • valid_layers, scored_layers, total_layers, junk_layers, and invalid_layers
  • chain_residues, sheet_residues, and informative_slices

Large directory runs use bounded prepare and analysis batches, and the CLI writes the CSV incrementally. The console summary is capped by default; set output.summary_limit=-1 to print every row.

Evaluation Helpers

Evaluation utilities are available after installing cooper-beta[eval]:

cooper-beta-eval \
  --positives path/to/positive-structures \
  --negatives path/to/negative-structures \
  --save-dir evaluation-results
python -m cooper_beta.evaluation \
  --positives path/to/positive-structures \
  --negatives path/to/negative-structures \
  --ablation

The GitHub repository also contains helper scripts for local datasets and Cooper-Beta CSV outputs. Local structure datasets, manual review notes, and research-only helper scripts are intentionally excluded from the package artifacts.

Changelog

0.1.0

  • Initial public release.
  • CLI and Python API for PDB/CIF/mmCIF beta-barrel-like chain detection.
  • DSSP-backed secondary-structure parsing.
  • Ellipse fitting, PCA axis search, geometric rules, and CSV output.
  • Evaluation helpers and ablation utilities.

License

Cooper-Beta is released under the MIT License. See LICENSE.

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

cooper_beta-0.1.0.tar.gz (61.3 kB view details)

Uploaded Source

Built Distribution

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

cooper_beta-0.1.0-py3-none-any.whl (57.4 kB view details)

Uploaded Python 3

File details

Details for the file cooper_beta-0.1.0.tar.gz.

File metadata

  • Download URL: cooper_beta-0.1.0.tar.gz
  • Upload date:
  • Size: 61.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cooper_beta-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7299d75f162c491fb95aac2d1e9ea2b3d169ae59438f89a5f4fba80279a9077a
MD5 14b9a6a1841ab6199950fb4321231f29
BLAKE2b-256 cc733feecad1c01da989350b4746471a9a090002c62d343c0bf2260ceedfb0b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for cooper_beta-0.1.0.tar.gz:

Publisher: publish.yml on GeraltZeroZhong/Cooper-Beta

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

File details

Details for the file cooper_beta-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cooper_beta-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 57.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cooper_beta-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa0bfebc79a2910c413be9f8fe1c06864582ef90b234a5383ee8a55aa6c51b64
MD5 b7a0d4d2e8e6a517a16c25c1751c66d8
BLAKE2b-256 85fbc07d7b50b5d1f8133a485654a5790dead96f5de54e2ea82dd2c882a5e018

See more details on using hashes here.

Provenance

The following attestation bundles were made for cooper_beta-0.1.0-py3-none-any.whl:

Publisher: publish.yml on GeraltZeroZhong/Cooper-Beta

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