Skip to main content

Betlas

Betlas is a Python toolkit for describing beta-rich protein structures through geometry and strand connectivity. It converts C-alpha coordinates and secondary-structure annotations into 136 named measurements of sheet organisation, strand pairing, contact topology, closure and overall shape. Feature tables and residue-linked slices make these properties available for inspection, structural comparison and model training.

Three trained applications use these measurements to recognise solenoids and geometric beta barrels, and to count the beta strands forming a barrel wall.

The name comes from Beta + Atlas. It reflects the idea that beta-structure patterns can become a map: a set of landmarks that can be inspected, joined, and reproduced.

Quickstart · Descriptors · Applications · Python API

Installation

Python 3.10 or newer is required. Install or update the released package from PyPI:

python -m pip install --upgrade betlas

From a source checkout:

python -m pip install .

Structure-based predictions also require a local mkdssp executable for secondary-structure annotation. Use the Conda environment, or install DSSP separately and pass --dssp-binary /path/to/mkdssp. DSSP 4.6.1 is recommended for inference. Prediction outputs record the annotation version; the model documentation describes the training annotations.

The geometry extra provides Gemmi, NetworkX and Matplotlib for geometry relationship analysis. The ml extra adds XGBoost. Install .[dev,geometry] for the complete test suite.

Quickstart

The bundled example runs offline. It contains four analytically constructed beta strands with four C-alpha points each, arranged in one annotated sheet. Copy it, inspect the chain, extract descriptors and trace the geometry through axial slices:

betlas examples copy mini --out-dir outputs/example
betlas chains outputs/example/mini.cif

betlas extract-features \
  --structure outputs/example/mini.cif --chain A \
  --out outputs/features.csv

betlas slice outputs/example/mini.cif --chain A \
  --out outputs/slices.csv \
  --points-out outputs/slice_points.csv \
  --summary-out outputs/slice_summary.json

features.csv contains one record with the 136 descriptor columns plus identifiers and extraction status. slices.csv describes informative axial bins; slice_points.csv links their coordinates to residues, strands and sheets. The JSON summary records the slicing setup and aggregate geometry.

import pandas as pd
from betlas.features.current import FEATURE_COLUMNS

features = pd.read_csv("outputs/features.csv")
print(features[["record_id", "chain_id", "betlas_parse_ok"]])
print(features.loc[:, list(FEATURE_COLUMNS)].shape)  # (1, 136)

points = pd.read_csv("outputs/slice_points.csv")
print(points[["auth_seq_id", "residue_uid", "strand_id", "sheet_id"]].head())

The example documentation explains the construction and outputs. This C-alpha fixture illustrates descriptor extraction and slicing. Use a full-atom protein structure for the DSSP-based applications below.

What Betlas measures

The 136 descriptors form a fixed, ordered feature set organised into 12 families:

Family Structural properties
composition Residue and secondary-structure counts, lengths and fractions
global_shape Spatial extent and anisotropy along principal axes
sheet_global Sheet sizes, planarity, angular spans and strand-axis dispersion
beta_run_topology Lengths, sheet membership and angular arrangement of sequence-contiguous beta runs
sheet_pair_packing Separation, plane alignment and contacts between the two largest sheets
sheet_sequence_topology Sheet interleaving, strand order and nonlocal pairing
contact_graph Contact density, connected components, cycles and sequence locality
axis_closure Angular coverage, gaps, radial variation and continuity along an axis
axis_periodicity Repeated angular organisation through circular moments of orders 3 to 8
strand_order Strand directions and sequence order relative to axes and neighbours
alpha_shell Helix context, radial organisation and alpha/beta alternation
angular_lobes Broad angular organisation through circular moments of orders 1 and 2

Inspect family descriptions and individual field definitions:

betlas grammar list
betlas grammar describe sheet_pair_packing
from betlas import describe_feature, list_feature_specs

print(len(list_feature_specs()))  # 136
print(describe_feature("betlas_axis_best_score").formula)

The field registry supplies definitions, units and missing-value conventions. Extraction retains every descriptor column, including measurements that are unavailable for a particular geometry. For example, a relationship between two sheets requires two suitable sheets. Application checkpoints apply their fitted preprocessing to these missing values. Coordinates are interpreted in angstroms.

Slicing connects aggregate measurements to local structure. Each axial bin summarises the surrounding beta geometry, while its point table retains author residue numbers and strand/sheet membership for inspection in a molecular viewer. The lower-level readout commands expose additional geometric measurements and heuristics.

Inputs and outputs

Workflow Input Output
extract-features An annotated mmCIF chain or a labelled structure collection The 136 descriptors, identifiers and extraction status
slice An annotated mmCIF chain Axial bins, optional residue-linked points and a summary
predict A PDB/mmCIF chain or a task-specific feature table Predictions, probabilities and model/applicability information
CATH benchmarks Domain annotations, features and evaluation groups Coverage, metrics and held-out predictions

For raw single-structure extraction and slicing, supply .cif, .mmcif or gzip-compressed equivalents with usable beta-sheet annotations. Missing sheet records produce an annotation error. The application and frozen CATH workflows assign secondary structure with DSSP, including annotation of structures that contain no beta segments.

Use the author chain identifier and a zero-based --model-id (default 0). Numeric author residue ranges select domains; prepare insertion-code selections upstream. Label-table extraction reads local structures and downloads missing mmCIF files from RCSB. See the benchmark workflow for domain selection, annotations and batch extraction.

Structural applications

Supply a local full-atom PDB or mmCIF structure and its author chain identifier:

betlas predict solenoid --structure protein.cif --chain A --out solenoid.csv
betlas predict barrel --structure protein.cif --chain A --out barrel.csv
betlas predict barrel-strands --structure protein.cif --chain A --out strand_count.csv

Solenoid recognition can select a domain with --residue-ranges 10-180:A. Barrel recognition and strand counting operate on the selected chain. Gzip-compressed structures are supported.

Strand counting combines the 136 descriptors with 16 layer/radial measurements. Its default workflow first checks the barrel-recognition model, then predicts the number of strands forming the barrel wall. The trained classes are 8, 10, 12, 14, 16, 18 and 22 strands. For an independently established barrel, add --assume-barrel to count directly.

Each command writes predictions with model and applicability information. Choose a .json output filename for JSON, or omit --out for CSV on stdout. Supply extracted descriptor tables with --features features.csv. Counting tables require the 16 radial measurements and --assume-barrel. Recognition and counting use separate annotation contexts, documented alongside the models.

Checkpoints

The v1.1 release uses three version-pinned JSON checkpoints, distributed as release attachments separately from the software wheel. The first prediction installs a missing checkpoint into the local cache after checking its expected size and SHA-256 digest. Subsequent predictions reuse that verified copy. Inspect availability or pre-install all three:

betlas checkpoints list
betlas checkpoints install all

Use --cache-dir to choose the cache, --checkpoint model.json for an explicit local checkpoint, and --offline to require local files. A local release folder or mirror can populate the cache:

betlas checkpoints install all --base-url /path/to/release-assets --cache-dir /path/to/cache
betlas predict solenoid --structure protein.cif --chain A --cache-dir /path/to/cache --offline

For strand counting with explicit local files, supply --barrel-checkpoint for the recognition gate, or --assume-barrel for a known barrel. Inference reads numeric parameters directly from JSON. See the model documentation for training populations, annotation procedures and prediction interpretation.

Python API

The Python API supports the same descriptor extraction, slicing and prediction workflows:

from betlas import extract_structure_features, predict_structure

features = extract_structure_features("outputs/example/mini.cif", chain_id="A")
print(features["betlas_beta_strand_count"])

result = predict_structure("barrel", "protein.cif", chain_id="A")

For an annotated StructureGeometry, use betlas.extract_classifier_features(geometry). For measured inputs, use betlas.predict_features(task, feature_mapping). All descriptor extraction paths share the current 136-field contract. Column aliases can be converted explicitly with betlas.schema.normalize_feature_columns.

The CATH benchmark workflow covers release catalogs, exact domain extraction, DSSP annotations, grouped splits and coverage-aware evaluation. Specialist workflows compare task-specific methods and record their applicability.

The geometry tools analyse packing, connectivity and structural correspondence. Companion scripts adapt separately installed methods and ESM-C embeddings. Source distributions include these scripts; the wheel installs the betlas package. Run betlas COMMAND --help for command options.

General assets use BETLAS_ASSET_MANIFEST_DIR, BETLAS_ASSET_DIR and BETLAS_ASSET_BASE_URL to select manifests, cache and source. Application checkpoints have their own built-in manifest and the installation interface described above.

Development

python -m pip install '.[dev,geometry]'
python -m pytest
python -m build

Tests use independently constructed structures, tables and local tool stand-ins. Optional native alignment tests require USalign or TM-align. Application tests exercise numeric inference and checkpoint installation using local fixtures.

The release guide covers package checks and publishing.

See the changelog for the v1.1 interface changes. Betlas uses the MIT License. CATH, RCSB PDB, DSSP and external software retain their respective attribution and distribution terms.

Metadata

Release files for betlas 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for betlas 1.1.0
File Size Uploaded Provenance Actions
betlas-1.1.0.tar.gz 587.5 kB Without provenance Details for betlas-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for betlas 1.1.0
File Interpreter ABI Platform Actions
betlas-1.1.0-py3-none-any.whl Python 3 none any Details for betlas-1.1.0-py3-none-any.whl

Total release size: 1.0 MB

Release files / betlas-1.1.0.tar.gz

Download URL betlas-1.1.0.tar.gz
Size 587.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2162be991f082bcf3bf432ce43831a4f12c022b11dd3894a61cef12f6f8c6c8a
BLAKE2b-256 checksum
How to use checksums
6e3f880f322c685acfbd2c7784ce65c6e12eec01f7f510308071b0608f26a0c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / betlas-1.1.0-py3-none-any.whl

Download URL betlas-1.1.0-py3-none-any.whl
Size 457.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
149b867b8c1132e415cc2802256b5e85eac369dab40d07fa12011c992a6dee97
BLAKE2b-256 checksum
How to use checksums
ad7929ca589c918c239ceaf09d7f68febb5b305693c77dfa29f1b3bfe18768e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for betlas 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page