Skip to main content

Python native implementation of selected PhosR style workflows for phosphoproteomics.

Project description

PhosPy

PhosPy is a Python package for selected phosphoproteomics workflows inspired by PhosR. It is aimed at scientists who want a clear Python lane from phosphosite intensity tables to kinase scoring, kinase prediction, and optional signalome analysis.

PhosPy does not provide HTTP endpoints or a web service. The supported user interfaces are:

  • the Python API
  • the phospy command-line interface

Install

PhosPy requires Python 3.10 or newer.

pip install phospy

For .parquet input or output support:

pip install "phospy[parquet]"

For local development from a clone:

pip install -e ".[dev]"
pyright
pytest -m "not parity"

For reproducible scientific/regression runs aligned to CI:

pip install -c constraints/ci.txt -e ".[dev,test]"
pytest tests/parity -m parity -s

Beginner Lane

The smallest supported lane is:

  1. build a dataset with organism=Organism.RAT
  2. run kinase with references=ReferencePreset.AUTO
  3. run signalome only when site_metadata.protein_id is present

Bundled runtime references in 1.5.0 are rat-only. For human or mouse work, create and pass an explicit ReferenceBundle in Python instead of using ReferencePreset.AUTO.

Minimum Input Shape

phospho is a numeric site-by-sample table. Its index should use standard PhosPy site IDs such as TSC2;S939;.

site_metadata must align to phospho.index and include:

  • gene_symbol
  • site
  • site_sequence when you want motif-based scoring
  • protein_id when you want signalome analysis

Minimal Python Example

import pandas as pd

from phospy import AnalysisReadyDatasetBuilder, KinaseWorkflow, SignalomeWorkflow
from phospy.api import (
    DatasetBuildRequest,
    KinaseWorkflowRequest,
    Organism,
    ReferencePreset,
    SignalomeWorkflowRequest,
)

phospho = pd.DataFrame(
    {
        "sample_a": [1.00, 0.70],
        "sample_b": [1.10, 0.80],
        "sample_c": [0.95, 0.75],
    },
    index=["TSC2;S939;", "GSK3B;S9;"],
)
site_metadata = pd.DataFrame(
    {
        "gene_symbol": ["TSC2", "GSK3B"],
        "site": ["S939", "S9"],
        "site_sequence": [
            "FDDTPEKDSFRARSTSLNERPKSLRIARAPK",
            "_______MSGRPRTTSFAESCKPVQQPSAFG",
        ],
        "protein_id": ["TSC2", "GSK3B"],
    },
    index=phospho.index.copy(),
)

dataset = AnalysisReadyDatasetBuilder().run(
    DatasetBuildRequest(
        phospho=phospho,
        site_metadata=site_metadata,
        organism=Organism.RAT,
    )
)

kinase_result = KinaseWorkflow().run(
    KinaseWorkflowRequest(
        dataset=dataset,
        references=ReferencePreset.AUTO,
        activity_config=None,  # keep this tiny two-site example in the safe lane
    )
)

signalome_result = SignalomeWorkflow().run(
    SignalomeWorkflowRequest(kinase_result=kinase_result)
)

print(dataset.phospho.shape)
print(kinase_result.prediction_result.pred_mat.round(4))
print(signalome_result.signalome_modules.table)

With the tables above you should get a strict AnalysisReadyPhosphoDataset, a non-empty kinase prediction matrix, and signalome tables because every site has an explicit protein_id.

Minimal CLI Example

phospy kinase \
  --phospho ./input/phospho.csv \
  --site-metadata ./input/site_metadata.csv \
  --organism rat \
  --reference auto \
  --skip-activity \
  --outdir ./out

The CLI writes a dataset directory, a kinase directory, and a short list of file paths written.

Import Contract

Use top-level phospy for the four main entrypoints only:

from phospy import AnalysisReadyDatasetBuilder, AnalysisReadyPhosphoDataset
from phospy import KinaseWorkflow, SignalomeWorkflow

Use phospy.api for requests, configs, results, enums, references, and public exceptions.

Documentation

  1. Quickstart
  2. API Guide
  3. CLI Guide
  4. Validation Guide

Citation

If you use PhosPy in scientific work, cite this software release using CITATION.cff and also cite the upstream PhosR project and publications described in NOTICE.md.

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

phospy-1.5.1.tar.gz (405.7 kB view details)

Uploaded Source

Built Distribution

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

phospy-1.5.1-py3-none-any.whl (491.7 kB view details)

Uploaded Python 3

File details

Details for the file phospy-1.5.1.tar.gz.

File metadata

  • Download URL: phospy-1.5.1.tar.gz
  • Upload date:
  • Size: 405.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for phospy-1.5.1.tar.gz
Algorithm Hash digest
SHA256 d2027ec8957798591a650c17d7eba1c8467a39010143f619e4d3bdace0c3dc14
MD5 83ef7ab5758dde0e8b138d3c19144b15
BLAKE2b-256 a2f44179eeae278b9c60f7a86c3b1efce13311fb318aabad7cc4c48a3f4e57d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for phospy-1.5.1.tar.gz:

Publisher: publish.yml on falconsmilie/phospy

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

File details

Details for the file phospy-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: phospy-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 491.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for phospy-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0cd1f6b295e877c2cd7744cac03a27de7b4df15a71a7b7307323d7f0a1ef1091
MD5 4b537d954147c035fc1fcc0999b2b407
BLAKE2b-256 38446be4a6d66f2a37549054af04780290ad43fbce0ac5a3cb72dd174b4cf718

See more details on using hashes here.

Provenance

The following attestation bundles were made for phospy-1.5.1-py3-none-any.whl:

Publisher: publish.yml on falconsmilie/phospy

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