Skip to main content

confdelta

Statistically rigorous comparison of two protein conformational ensembles — networks, dynamics and kinetics — with proper multiple-testing correction.

Python License Version DOI

Comparing two ensembles — wild-type against a mutant, apo against holo, one design against another — is something almost every MD study does and almost everyone hand-rolls in a notebook: subtract two averages, eyeball the difference, and rarely correct for having just run hundreds of per-residue comparisons at once. confdelta makes that comparison a first-class, tested operation: per residue it reports an effect size with a confidence interval and a p-value corrected across all residues, and it is honest about when a design is too small to conclude anything.

Single-trajectory analysis (residue interaction networks, DCCM, PCA, free-energy landscapes, Markov state models) is here too, but as the layer the comparison is built on — the comparison is the point.

Install

pip install confdelta

Python 3.10–3.13, no conda required. Markov state models need one extra: pip install "confdelta[msm]".

Compare two ensembles

confdelta compare \
  -a wild_type.pdb wild_type.xtc  --a-name wild_type \
  -b mutant.pdb    mutant.xtc     --b-name mutant \
  -o results/

The run writes results/07_comprehensive_report/per_residue_statistics.csv — one row per residue, effect size and confidence interval first, corrected q-value after — and prints the largest effects. The output has this shape (the layout is real; the residues and numbers below are placeholders, not results from any particular system):

residue        g   ci_low  ci_high        q  sig
A_82       +2.41    +1.36    +3.46   0.0108    *
A_84       +1.62    +0.93    +2.31   0.0108    *
A_50       -1.54    -2.06    -1.02   0.0144    *
A_25       -0.97    -2.16    +0.23   0.2684

g is Hedges' g (effect size); sig marks residues significant after Benjamini–Hochberg correction across every residue tested. The DCCM difference heatmap and the descriptive network/allosteric tables are written alongside.

If you supply replicate ensembles per condition, the replicate is the unit of inference. If you supply a single run per condition, a block bootstrap over frames supplies the uncertainty and the output says plainly that one run cannot separate the condition effect from run-to-run variation. And if the design cannot reach significance at all — three replicates per condition have a p-value floor of 0.10 — confdelta tells you that and points you to the effect sizes, instead of reporting a misleading "nothing significant".

The compare command takes one run per condition, so it uses block-bootstrap (single-run) inference. For replicate-level inference, build EnsembleGroups from several runs and use the Python API shown below.

Common tasks

# Analyse a single ensemble on its own
confdelta single -t system.pdb -x trajectory.xtc -n my_run -o results/

# Generate a config file with every option, then run with it
confdelta example-config -o study.json
confdelta compare -a wt.pdb wt.xtc -b mut.pdb mut.xtc --config study.json

Every option not shown on the command line lives in the config file; the full reference is in docs/CONFIGURATION.md, generated from the code and checked against it by the test suite.

Python API

The comparison is designed to be imported. An ensemble is built from any source — a trajectory, a multi-model PDB, a set of predicted structures, or an in-memory coordinate array — and the comparison code does not care which:

from confdelta import Ensemble, EnsembleGroup, compare_ensemble_groups

wt  = EnsembleGroup([Ensemble.from_trajectory("wt.pdb",   f"wt_{i}.xtc")   for i in range(3)], label="wild_type")
mut = EnsembleGroup([Ensemble.from_trajectory("v82a.pdb", f"v82a_{i}.xtc") for i in range(3)], label="V82A")

report = compare_ensemble_groups(wt, mut, correction="fdr_bh", alpha=0.05)

for f in report.significant_features():
    print(f"{f.feature}: g={f.effect_size:+.2f} "
          f"[{f.effect_ci.low:+.2f}, {f.effect_ci.high:+.2f}]  q={f.qvalue:.3g}")

report is typed (ComparisonReport / FeatureComparison): report.underpowered, report.mode ("replicate" or "bootstrap"), report.ranked_by_effect(), and the per-residue effect sizes, confidence intervals and q-values are all attributes, not files. Other sources: Ensemble.from_structures([...]), .from_pdb_models(path), .from_coordinates(array, topology).

What it does

  • Compare two ensembles, with statistics — per-residue effect sizes, confidence intervals and FDR/Bonferroni-corrected q-values; replicate-level or block-bootstrap inference; honest reporting of underpowered designs. This is the core.
  • Descriptive difference views — DCCM difference matrices, centrality and modularity deltas, energy-surface differences, allosteric pathway and hotspot changes. Reported without inference, alongside the statistics.
  • Single-ensemble analysis — residue interaction networks and community detection, dynamic cross-correlation, PCA and free-energy landscapes, and (with the msm extra) Markov state models. The substrate the comparison is built on.

Status

confdelta is 0.2.0 and pre-1.0: the statistical comparison returns typed objects, but the descriptive comparators still return the loosely structured objects inherited from its predecessor. Features so far: per-residue contact number, RMSF and RMSD to a reference; user-defined geometric collective variables (distances, angles and dihedrals, including between residue groups); and a custom-observable escape hatch for any per-frame quantity. Expect the API to firm up before 1.0. It continues MD-Compare; see CHANGELOG.md for the lineage and AUDIT.md for an account of what was rebuilt and why.

Documentation

Licence

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

confdelta-0.2.0.tar.gz (922.4 kB view details)

Uploaded Source

Built Distribution

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

confdelta-0.2.0-py3-none-any.whl (129.3 kB view details)

Uploaded Python 3

File details

Details for the file confdelta-0.2.0.tar.gz.

File metadata

  • Download URL: confdelta-0.2.0.tar.gz
  • Upload date:
  • Size: 922.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for confdelta-0.2.0.tar.gz
Algorithm Hash digest
SHA256 90df12eb2c148119c66ce7dc6ce010666c90bbec2dffc55b33d6702d6755b9c2
MD5 f2e8df830284ec920489e068c1101d13
BLAKE2b-256 f419d35631fad79c8e81bb2d8969d2b557c026ce7d1a193b11efcfcf2f2f8577

See more details on using hashes here.

Provenance

The following attestation bundles were made for confdelta-0.2.0.tar.gz:

Publisher: publish.yml on DoctorDean/confdelta

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

File details

Details for the file confdelta-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: confdelta-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 129.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for confdelta-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ce6ad8f20565088ad98c19f4da4ca4f7cfdbd75841d100610bd9a73b350553c
MD5 5bdbb2df42aebbc761c480ca077d6383
BLAKE2b-256 33745ef380332c3396ea14b42344f03954be4e267063dc88b183bd2e71dd186d

See more details on using hashes here.

Provenance

The following attestation bundles were made for confdelta-0.2.0-py3-none-any.whl:

Publisher: publish.yml on DoctorDean/confdelta

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