Skip to main content

PhosPy

repo-banner-thin.png

PyPI version Python versions Tests License

PhosPy helps you turn phosphosite intensity tables into analysis-ready datasets and run focused phosphoproteomics workflows from Python.

Use PhosPy to prepare and validate phosphosite data, test differential phosphorylation, run offline enrichment, explore kinase-substrate support, and build signalome summaries. The supported user interface is the Python API.

Project Status and API Stability

PhosPy is currently beta software for Python 3.11 and 3.12. APIs may evolve during beta: phospy.api is the stable user-facing route, phospy.api.advanced is the supported route for advanced configuration and publishing helpers, the package root provides version metadata only, and internal modules are unsupported import targets. See the API stability guide and the maintainer release process.

Install PhosPy

pip install phospy

Add Parquet support when you need it:

pip install "phospy[parquet]"

Try a Kinase Analysis

The public workflow follows a simple pattern: prepare a dataset, create a request, and run the workflow. The complete example below uses a small rat dataset and bundled rat references.

View the Complete Kinase Example
import pandas as pd

from phospy.api import AnalysisReadyDatasetBuilder, KinaseWorkflow
from phospy.api.advanced import (
    KinaseReliabilityProfile,
    KinaseScoringConfig,
    ReferenceContextCompatibilityPolicy,
)
from phospy.api import (
    DatasetBuildRequest,
    DatasetLocalisationConfig,
    DatasetPreprocessingConfig,
    IntensityScaleKind,
    KinaseWorkflowRequest,
    Organism,
    ReferencePreset,
)

phospho = pd.DataFrame(
    {
        "control_1": [8200.0, 9100.0, 6000.0],
        "control_2": [8000.0, 9000.0, 5900.0],
        "treated_1": [16200.0, 9150.0, 13000.0],
    },
    index=["MAPK14;Y182;", "GSK3A;S21;", "TSC2;S939;"],
)

site_metadata = pd.DataFrame(
    {
        "gene_symbol": ["MAPK14", "GSK3A", "TSC2"],
        "site": ["Y182", "S21", "S939"],
        "site_sequence": [
            "LDFGLARHTDDEMTGYVATRWYRAPEIMLNW",
            "PSGGGPGGSGRARTSSFAEPGGGGGGGGGGP",
            "FDDTPEKDSFRARSTSLNERPKSLRIARAPK",
        ],
        "protein_identifier": ["MAPK14", "GSK3A", "TSC2"],
        "protein_namespace": ["protein_id"] * phospho.shape[0],
        "protein_group_id": ["MAPK14", "GSK3A", "TSC2"],
        "localisation_confidence": [0.95, 0.94, 0.96],
    },
    index=phospho.index,
)

dataset = AnalysisReadyDatasetBuilder().run(
    DatasetBuildRequest(
        phospho=phospho,
        site_metadata=site_metadata,
        organism=Organism.RAT,
        input_intensity_scale=IntensityScaleKind.LINEAR,
        preprocessing_config=DatasetPreprocessingConfig(
            localisation=DatasetLocalisationConfig(
                mode="require_threshold",
                confidence_column="localisation_confidence",
                min_confidence=0.75,
            )
        ),
    )
)

result = KinaseWorkflow().run(
    KinaseWorkflowRequest(
        dataset=dataset,
        references=ReferencePreset.AUTO,
        scoring_config=KinaseScoringConfig(
            reliability_profile=KinaseReliabilityProfile.CUSTOM,
            reference_context_compatibility_policy=(
                ReferenceContextCompatibilityPolicy.ALLOW_UNKNOWN_WITH_CAVEAT
            ),
        ),
        activity_config=None,
    )
)

print(result.prediction_result.pred_mat.head())

The values are illustrative. Use study-specific references, biological replicates, and thresholds for real analyses.

All ordinary scientific contracts and workflows come from phospy.api:

from phospy.api import (
    AnalysisReadyDatasetBuilder,
    DifferentialAnalysisWorkflow,
    KinaseWorkflow,
    SignalomeWorkflow,
)

Enrichment is available from phospy.api:

from phospy.api import EnrichmentConfig, EnrichmentWorkflow, EnrichmentWorkflowRequest

Read the Guides

The full documentation is available at PhosPy Docs. See the contributing guide, license, and CITATION.cff for project and citation details.

Scientific Scope

PhosPy is careful about what each result can support. Read the interpretation guide before drawing biological conclusions from an analysis.

Review the Current Scientific Boundaries

PhosPy is inspired by PhosR, but differential analysis is limited to tested design and contrast envelopes; it is not full limma or PhosR parity.

Bundled runtime references are rat-only. ReferencePreset.AUTO is therefore for rat datasets; human, mouse, and custom analyses must pass an explicit ReferenceBundle. Kinase scores show relative support within a run. They are not calibrated probabilities, and activity outputs are not direct proof of kinase activation or causal pathway activity.

Enrichment provides offline over-representation analysis (ORA) with caller-supplied identifier sets and an explicit background. ORA does not imply GSEA or PTM-SEA support.

linear_residualize_batch, a limited fixed-effect residualisation, rejects confounded batch/condition designs. It is not ComBat, not RUV, not limma removeBatchEffect parity, and not mixed-effects modelling. Native SPS/RUV-style correction through SpsRuvBatchCorrectionConfig is a separate, explicit preprocessing method with distinct sps_ruv_style and replicate-aware ruv_iii_style estimators. Replicate metadata is provenance/diagnostics-only for sps_ruv_style and is not used for numerical unwanted-factor estimation by that method; for ruv_iii_style it is required and participates directly in estimation. Multi-reference SPS discovery is a separate operation with an explicit condition-relative log2 reference-input contract; the target experiment follows normal PhosPy input contracts. See the SPS discovery and RUV correction guide. These native methods have narrow fixture-scoped external evidence. This is not PhosR-equivalent SPS/RUV-III parity and not PhosR-equivalent batch correction. ruv_readiness values are report-only readiness signals and do not apply correction; use native correction only after those prerequisites are implemented in the request.

Metadata

Release files for phospy 1.8.1

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

Source distribution (sdist)

Source distribution for phospy 1.8.1
File Size Uploaded Provenance Actions
phospy-1.8.1.tar.gz 1.4 MB With provenance Details for phospy-1.8.1.tar.gz

Built distribution (wheel)

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

Total release size: 3.1 MB

Release files / phospy-1.8.1.tar.gz

Download URL phospy-1.8.1.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
0c52571d4010c1e68e17571dc3593725d4caca80314c7de1e9fb7864886c7e2a
BLAKE2b-256 checksum
How to use checksums
a5ba19c2f707458e1f25d2beb422cd74a21d271680de981640d3da34747eff1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / phospy-1.8.1-py3-none-any.whl

Download URL phospy-1.8.1-py3-none-any.whl
Size 1.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
44f3a8c448a4296a43fb9a7a5d12a43e1c19ce7b0915bb64f6d7f7b1495536f8
BLAKE2b-256 checksum
How to use checksums
14ba14662e48c17593b52b288f482e2f58ecd5f977a5730891655ae85479082c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for phospy 1.8.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for phospy-1.8.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

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.

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