Skip to main content

PhosPy

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.advanced is the supported route for advanced configuration and publishing helpers, 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 import AnalysisReadyDatasetBuilder, KinaseWorkflow
from phospy.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.

The main dataset and workflow entry points are available from phospy:

from phospy import AnalysisReadyDatasetBuilder
from phospy import 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. It is not PhosR-equivalent SPS/RUV-III parity and not PhosR-equivalent batch correction. Replicate metadata is checked and recorded but is not used for numerical unwanted-factor estimation. 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.7.3

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.7.3
File Size Uploaded Provenance Actions
phospy-1.7.3.tar.gz 1.4 MB With provenance Details for phospy-1.7.3.tar.gz

Built distribution (wheel)

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

Total release size: 3.1 MB

Release files / phospy-1.7.3.tar.gz

Download URL phospy-1.7.3.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
9ca2fd40965056c08a3abee345aa15192dc718515b3623a8c646aa2c0f02593b
BLAKE2b-256 checksum
How to use checksums
6c959da2124508caf7a6e7cfb647620c5011f3666509f847f0acffc6835c2020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 10, 2026.

Transparency log

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

Download URL phospy-1.7.3-py3-none-any.whl
Size 1.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
83411389bad9bd37c7a0511940074a57b9d44a3c05eff112d5261bb3ad086126
BLAKE2b-256 checksum
How to use checksums
b32b8b41bc376e0dafef5650c1a8ba3eeea38f849563e0146a2741f708351a50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 10, 2026.

Transparency log

Security for phospy 1.7.3

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.7.3.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 Sep 10, 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