Skip to main content

Reliability layer for perturbation science - spatial coherence analysis across CRISPR, protein, and chemical domains

Project description

PhaseLab

A reliability layer for perturbation science.

PyPI version License: MIT Python 3.9+ Tests Documentation

PhaseLab assesses whether experimental results from perturbation experiments will be reproducible—before you run the experiment.

The Core Insight

Spatial coherence of response landscapes predicts perturbation reliability.

Validated across 115,251 sgRNAs (6 genes):

  • Correlation with outcome variance: r = -0.24 to -0.50
  • Variance reduction in stable regions: 32-49%

Quick Start

pip install phaselab

Assess CRISPR Tiling Reliability

from phaselab.spatial import analyze_tiling_coherence
from phaselab.landscapes import ResponseLandscape

# Your tiling screen data
landscape = ResponseLandscape(
    coords=[100, 150, 200, 250, 300],  # Guide positions
    responses=[0.8, 0.75, 0.1, 0.82, 0.78],  # Log2 fold-changes
)

# Analyze spatial coherence
result = analyze_tiling_coherence(landscape)

# Find stable regions
for region in result.stable_regions:
    print(f"Stable: {region['start']}-{region['end']}")
    print(f"  Coherence: {region['coherence']:.3f}")
    print(f"  Recommendation: Select guides from this region")

Analyze Protein Mutational Scanning

from phaselab.protein.mutscan import MutScanLandscape, analyze_mutscan_coherence

# Your DMS data
landscape = MutScanLandscape(
    positions=residue_positions,
    effects=fitness_effects,
    protein_id="TEM1",
    protein_name="TEM-1 β-Lactamase",
)

# Find functional domains
result = analyze_mutscan_coherence(landscape)

print(f"Essential domains: {len(result.essential_regions)}")
print(f"Variable regions: {len(result.variable_regions)}")

Assess Binding Landscape Reliability

from phaselab.chem import analyze_binding_coherence, BindingLandscape

# Your binding data
landscape = BindingLandscape(
    positions=mutation_positions,
    affinities=delta_delta_g_values,
    target="ABL1",
    ligand="Imatinib",
)

# Find reliable binding determinants
result = analyze_binding_coherence(landscape)

for hotspot in result.hot_spots:
    print(f"Position {hotspot['position']}: ΔΔG={hotspot['effect']:.2f}")

What PhaseLab Is

PhaseLab Is PhaseLab Is NOT
A reliability assessment framework A CRISPR design tool
Domain-general (CRISPR, protein, chemistry) A predictor of biological outcomes
Pre-experimental guidance A replacement for validation
Honest about uncertainty A guarantee of success

PhaseLab answers: "Can I trust the results I'll get?"

CRISPOR answers: "Which guide should I use?"

Use both. They're complementary.

Two-Stage Framework

Stage I: Feasibility (Before Tiling)

  • Uses structural priors and response modeling
  • Identifies candidate stable regions
  • GO/NO-GO decision for experimental investment

Stage II: Resolution (With Tiling)

  • Minimum 16-20 perturbations per target
  • Empirically resolves stability structure
  • Quantifies variance reduction

Modules

Module Domain Purpose
phaselab.spatial CRISPR Tiling screen coherence
phaselab.protein.mutscan Protein DMS functional domains
phaselab.protein.folding Protein Structure prediction QC
phaselab.chem.binding Chemistry Binding hot spots
phaselab.omics Genomics ATAC/ChIP/RNA-seq reliability
phaselab.microbio Microbiology TnSeq/CRISPRi essentiality
phaselab.trials.sms Therapeutic SMS gene therapy pipeline

Claim Levels

PhaseLab reports uncertainty honestly:

Level Meaning Requirements
UNKNOWN Cannot assess Insufficient data
EXPLORATORY Preliminary Structural priors only
CONTEXT_DEPENDENT Valid in context Single tiling dataset
STRONG_COMPUTATIONAL High confidence Cross-validated

Quantum Mode

For most use cases, quantum mode should be OFF (default):

from phaselab.quantum import set_quantum_mode, QuantumMode

set_quantum_mode(QuantumMode.OFF)  # Classical only (fastest, default)
set_quantum_mode(QuantumMode.AUDIT)  # Validation subset
set_quantum_mode(QuantumMode.REQUIRED)  # Research only

Rule: If a classical experiment can falsify a claim, quantum is optional.

Installation

# Basic installation
pip install phaselab

# With quantum support
pip install phaselab[quantum]

# Full installation
pip install phaselab[all]

Documentation

Research Documentation

Validation

Dataset Scale Correlation Variance Reduction
CRISPRa tiling (6 genes) 115,251 sgRNAs r = -0.34 42% mean
E213-E216 experiments Multiple screens r = -0.24 to -0.50 32-49%

Example: SMS Therapeutic Pipeline

from phaselab.trials.sms import SMSPipeline, SMSTrialConfig

# Configure pipeline
config = SMSTrialConfig(
    therapeutic_window=(0.70, 1.10),
    verbose=True,
)

# Run full assessment
pipeline = SMSPipeline(config=config)
result = pipeline.run_full_pipeline()

print(f"GO/NO-GO: {result.overall_go_nogo}")
print(f"Claim level: {result.overall_claim_level}")

# Get falsification tests for wet lab
for test in result.falsification_tests:
    print(f"Test {test['id']}: {test['name']}")

The Science

E200-E211: Guide-sequence coherence does NOT work (r ≈ 0)

E213-E216: Spatial coherence of response landscapes DOES work

The key insight:

"The guide is the probe, not the structure. Coherence measures the system's response consistency, not properties of the perturbation itself."

Citation

@software{phaselab2025,
  author = {Vaca, Dylan},
  title = {PhaseLab: A reliability layer for perturbation science},
  year = {2025},
  version = {1.0.0},
  url = {https://github.com/followthesapper/phaselab}
}

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE for details.


PhaseLab v1.0.0 - Spatial Coherence Paradigm 315 tests passing | Production ready

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

phaselab-1.0.0.tar.gz (372.4 kB view details)

Uploaded Source

Built Distribution

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

phaselab-1.0.0-py3-none-any.whl (423.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: phaselab-1.0.0.tar.gz
  • Upload date:
  • Size: 372.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for phaselab-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3b25d83bd55964af6d0423cd903f1957d7a88c74497740bbdc52ee5c7ac44402
MD5 4693714945629467f38b28197e7966b5
BLAKE2b-256 223b00bd07007fc45c74f3730c12363696043636b7df9a6c605a869b29586b80

See more details on using hashes here.

File details

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

File metadata

  • Download URL: phaselab-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 423.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for phaselab-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac111aaed8f224a4660b19f43b9eda73504fc951e6760a8a11a4733adc001992
MD5 a324bfa26b24ee0262b35db140afc50f
BLAKE2b-256 9466e587f9e5c019c7d561a1ba9e7a07ca8f9d1af01a35cc825f3a313d882778

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