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
predMatfrom 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
predMatgeneration- kinase activity analysis
Today, the bundled reference lane is intentionally small:
- supported species:
rat - supported references:
auto,l6,l6_native autocurrently resolves tol6_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_sequencessubstrate_mapmotif_sequencesReferenceBundle- intermediate scoring and prediction outputs
- signalome construction
Main entry points:
PhosphoDatasetAnalysisReadyPhosphoDatasetReferenceBundlePredMatWorkflowKinaseWorkflowSignalomeWorkflow
Runnable examples:
examples/native_workflow_demo.pyexamples/predmat_workflow_demo.pyexamples/signalome_workflow_demo.py
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
predMatas 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
docs/api.mdfor the supported Python APIdocs/validation.mdfor input rules and common failuresdocs/parity.mdfor parity scope andsvm_modedocs/fixtures.mdfor fixture and trace rebuild commandsdocs/architecture/package-layout.mdfor the contributor-facing package layout
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21e37875d3074c14d072370cf99b554006184eda78f37d7feb48c163b5947f4a
|
|
| MD5 |
a291f5d99fc3017a07f696ac82745040
|
|
| BLAKE2b-256 |
04f1dd6823c553c1f8a7731ed3670b2333e7982727f5d52d4f991132a213ab77
|
Provenance
The following attestation bundles were made for phospy-1.3.0.tar.gz:
Publisher:
publish.yml on falconsmilie/phospy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
phospy-1.3.0.tar.gz -
Subject digest:
21e37875d3074c14d072370cf99b554006184eda78f37d7feb48c163b5947f4a - Sigstore transparency entry: 1284670181
- Sigstore integration time:
-
Permalink:
falconsmilie/phospy@5158aae1da62aa185078cc08fac2df3b1bdedff5 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/falconsmilie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5158aae1da62aa185078cc08fac2df3b1bdedff5 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4583fc90774b1fb63027ce65ad61e81696c5f97b17ef8fad9925b0687954fbfd
|
|
| MD5 |
4c90e1b20f5a3f30afaf7763faed1132
|
|
| BLAKE2b-256 |
2cd8516463171011c6f6de86f43c51ba95d62f4298d9ab6bb0ed56c2a06a3350
|
Provenance
The following attestation bundles were made for phospy-1.3.0-py3-none-any.whl:
Publisher:
publish.yml on falconsmilie/phospy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
phospy-1.3.0-py3-none-any.whl -
Subject digest:
4583fc90774b1fb63027ce65ad61e81696c5f97b17ef8fad9925b0687954fbfd - Sigstore transparency entry: 1284670329
- Sigstore integration time:
-
Permalink:
falconsmilie/phospy@5158aae1da62aa185078cc08fac2df3b1bdedff5 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/falconsmilie
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@5158aae1da62aa185078cc08fac2df3b1bdedff5 -
Trigger Event:
push
-
Statement type: