Skip to main content

Python native implementation of selected PhosR style workflows for phosphoproteomics.

Project description

PhosPy

PhosPy is a Python package for a small, supported set of phosphoproteomics workflows inspired by PhosR.

It is built for three main jobs:

  • Preprocessing raw total and phospho tables with PhosphoDataset
  • Kinase scoring and prediction with SimpleKinaseWorkflow
  • Signalome analysis with SignalomeWorkflow

PhosPy is intentionally narrow. It is not a full PhosR replacement.

Install

PhosPy supports Python 3.10 and newer.

pip install phospy

Optional parquet support:

pip install "phospy[parquet]"

Start Here

Use PhosphoDataset when you want preprocessing only

from phospy.datasets import PhosphoDataset
from phospy.preprocessing import CorePreprocessingConfig

dataset = PhosphoDataset.from_files(
    "examples/data/total.tsv",
    "examples/data/phospho.tsv",
    phospho_encoding="utf-16le",
)

analysis_ready = dataset.preprocessing.run_analysis_ready(
    config=CorePreprocessingConfig(max_unmatched_fraction=0.1)
)

You get a validated, analysis-ready dataset that you can pass into downstream workflows.

Use SimpleKinaseWorkflow for the common end-to-end path

from phospy.api import PredictionRunConfig, SimpleKinaseWorkflow

with SimpleKinaseWorkflow().run(
    phospho="examples/data/simple_workflow/phospho.tsv",
    total="examples/data/simple_workflow/total.tsv",
    species="rat",
    prediction_config=PredictionRunConfig(
        min_substrates=1,
        min_motif_size=1,
        ensemble_size=2,
        top=3,
        inclusion=2,
        n_iterations=2,
        random_state=7,
    ),
) as result:
    pred_mat = result.pred_mat_result.to_frame(copy=False)
    weighted_activity = result.kinase_activity_result.weighted_activity

This path handles preprocessing, analysis-ready adaptation, bundled reference selection, prediction, and kinase activity analysis.

Use SignalomeWorkflow when you already have workflow outputs

The next example assumes you already have a result from SimpleKinaseWorkflow.run(...).

from phospy.api import SignalomeRunConfig, SignalomeWorkflow

signalome = SignalomeWorkflow().run_from_analysis_ready(
    dataset=result.analysis_ready_dataset,
    scoring_result=result.scoring_result,
    prediction_result=result.prediction_result,
    kinases_of_interest=list(result.pred_mat_result.kinase_names[:2]),
    config=SignalomeRunConfig(signalome_cutoff=0.5),
)

Minimum Input Expectations

PhosPy works with:

  • total input as TSV
  • phospho input as TSV
  • predMat as CSV, with the first column used as the phosphosite index

Default required columns:

Input Required columns
Total table genes, group1 to group6
Phospho table uid, gene_names, gene_p_site, localization_prob, centralized_sequence, p_group1 to p_group6

For full validation rules and common failure cases, see docs/validation.md.

CLI

PhosPy ships with a small CLI for file-based preprocessing and optional kinase activity analysis from an existing predMat.

phospy \
  --total examples/data/total.tsv \
  --phospho examples/data/phospho.tsv \
  --pred-mat examples/data/predMat.csv \
  --phospho-encoding utf-16le \
  --max-unmatched-fraction 0.1 \
  --outdir examples/output

Use phospy --help to see every option.

Runnable Examples

Read Next

Beginner guides

Advanced and contributor docs

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.4.0.tar.gz (225.1 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.4.0-py3-none-any.whl (193.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for phospy-1.4.0.tar.gz
Algorithm Hash digest
SHA256 2b2e446a82813b6c2cb8691d71b0769d6e7577b8438a9a0f6f87446bf536a960
MD5 0aa88778d12fae61d84349f8ad128ffb
BLAKE2b-256 c3a4ad64e5e699a2a62384957bfe70cce228433075dc723f5ef08063a7d08d20

See more details on using hashes here.

Provenance

The following attestation bundles were made for phospy-1.4.0.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.4.0-py3-none-any.whl.

File metadata

  • Download URL: phospy-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 193.3 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8fab55f05e4c5a8a3ec16401f3721115fc6000e363a000956213e7883ed9f3fb
MD5 e532befcfc1ef88954aeedd98cbf77ed
BLAKE2b-256 12a3b73e7c2d13278690ac0cdd6396d57a0c64c11d7a87bad0ef4541baf4a25c

See more details on using hashes here.

Provenance

The following attestation bundles were made for phospy-1.4.0-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