Skip to main content

Python native implementation of selected PhosR style workflows for phosphoproteomics.

Project description

PhosPy

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

It helps you do five things:

  • preprocess total and phospho tables
  • analyse kinase activity from an existing predMat
  • generate a predMat from phosphosite inputs
  • run the native Python kinase workflow
  • build downstream signalome outputs

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

Install

PhosPy supports Python 3.10 and newer.

pip install phospy

For parquet output:

pip install "phospy[parquet]"

Repository examples use paths like examples/data/.... If you installed from PyPI, point those examples at your own files instead.

Start Here

Pick the lane that matches your job.

Common Lane: SimpleKinaseWorkflow

Use this when you already have a phospho table, know the species, and want one supported end-to-end entry point.

from phospy.api import SimpleKinaseWorkflow

result = SimpleKinaseWorkflow().run(
    phospho="study_phospho.tsv",
    total="study_total.tsv",
    species="rat",
    reference="auto",
)

pred_mat = result.pred_mat_result.to_frame()
weighted_activity = result.kinase_activity_result.weighted_activity

This lane handles:

  • preprocessing
  • the analysis-ready phosphosite boundary
  • bundled reference resolution
  • predMat generation
  • kinase activity analysis

Today, the bundled reference lane is intentionally small:

  • supported species: rat
  • supported references: auto, l6, l6_native
  • auto currently resolves to l6_native

Runnable example: examples/simple_workflow_demo.py

Advanced Lane: Native Workflow Pieces

Use this when you need direct control over workflow-shaped inputs such as:

  • site_sequences
  • substrate_map
  • motif_sequences
  • ReferenceBundle
  • intermediate scoring and prediction outputs
  • signalome construction

Main entry points:

  • PhosphoDataset
  • AnalysisReadyPhosphoDataset
  • ReferenceBundle
  • PredMatWorkflow
  • KinaseWorkflow
  • SignalomeWorkflow

Runnable examples:

Other Useful Entry Points

PhosphoDataset

Use this when you want validated total and phospho inputs plus the standard preprocessing flow.

from phospy.datasets import PhosphoDataset
from phospy.io.writers import CoreOutputWriter

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

CoreOutputWriter().write(core, outdir="examples/output", format="csv")

site_matrix = core.site_matrix.matrix
corrected = core.phospho_corrected

KinaseActivityAnalyzer

Use this when you already have a phosphosite matrix and a predMat.

from phospy.activities import KinaseActivityAnalyzer
from phospy.datasets import PhosphoDataset

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

analyzer = KinaseActivityAnalyzer()
result = analyzer.run(
    pred_mat=analyzer.load_pred_mat("examples/data/predMat.csv"),
    phospho_matrix=core.site_matrix.matrix,
    threshold=0.6,
    min_substrates=1,
    top_n_substrates=1,
)

The bundled example data is tiny, so it uses min_substrates=1 and top_n_substrates=1.

PhosRPipeline

Use this when you want file loading, preprocessing, optional kinase analysis, and output publishing in one call.

from phospy.pipeline import PhosRPipeline

pipeline = PhosRPipeline.from_files(
    total_path="examples/data/total.tsv",
    phospho_path="examples/data/phospho.tsv",
    pred_mat_path="examples/data/predMat.csv",
    phospho_encoding="utf-16le",
    max_unmatched_fraction=0.1,
    kinase_activity_threshold=0.6,
    kinase_activity_min_substrates=1,
    kinase_activity_top_n_substrates=1,
)
outputs = pipeline.run(outdir="examples/output")

When outdir is set, the pipeline writes core outputs, optional kinase-analysis outputs, and run_manifest.json.

File Inputs

PhosPy works with:

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

For required columns and common validation rules, see docs/validation.md.

CLI

PhosPy also ships with a small CLI for file-based preprocessing and optional predMat analysis.

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

Read Next

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.3.0.tar.gz (207.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.3.0-py3-none-any.whl (172.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: phospy-1.3.0.tar.gz
  • Upload date:
  • Size: 207.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.3.0.tar.gz
Algorithm Hash digest
SHA256 21e37875d3074c14d072370cf99b554006184eda78f37d7feb48c163b5947f4a
MD5 a291f5d99fc3017a07f696ac82745040
BLAKE2b-256 04f1dd6823c553c1f8a7731ed3670b2333e7982727f5d52d4f991132a213ab77

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: phospy-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 172.8 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4583fc90774b1fb63027ce65ad61e81696c5f97b17ef8fad9925b0687954fbfd
MD5 4c90e1b20f5a3f30afaf7763faed1132
BLAKE2b-256 2cd8516463171011c6f6de86f43c51ba95d62f4298d9ab6bb0ed56c2a06a3350

See more details on using hashes here.

Provenance

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