Build
Turn phosphosite intensities and aligned metadata into an AnalysisReadyPhosphoDataset with protein-scoped site_key rows, required sequence context, validation, and recorded preprocessing.
Inspired by selected PhosR workflows
Beta · Python 3.11–3.12PhosPy is a focused Python package for phosphoproteomics. Build validated analysis-ready datasets, test explicit condition contrasts, run offline enrichment with your own sets and background, rank kinase support, and continue into optional signalome summaries. Typed requests, results, provenance, and caveats keep each scientific choice visible.
pip install phospy
Turn phosphosite intensities and aligned metadata into an AnalysisReadyPhosphoDataset with protein-scoped site_key rows, required sequence context, validation, and recorded preprocessing.
Test named condition contrasts with DifferentialAnalysisWorkflow, or run offline ORA with EnrichmentWorkflow and an explicit background universe.
Use KinaseWorkflow to rank relative kinase support, then use SignalomeWorkflow for descriptive site modules and score-profile associations when its prerequisites are met.
Why PhosPy
PhosPy keeps phosphoproteomics analysis approachable without hiding what each step expects. Each supported workflow has one guide with its request, runnable example, response format, interpretation notes, and common problems. Typed results carry diagnostics, provenance, attrition records, and caveats so you can see what happened before you interpret the biology.
Research use
Build repeatable Python workflows around validated dataset construction, explicit preprocessing, importer quality reports, provenance, and safe output publishing.
Move from phosphosite intensities to fitted contrasts, offline ORA, relative kinase support, optional activity-like summaries, and descriptive signalome outputs—with assumptions and limits kept beside the results.
Share a governed public API, complete workflow guides, and reproducible outputs. Everyday code stays on the stable route; specialist work uses the documented advanced route rather than private modules.
Interface
The curated phospy surface provides convenience aliases for the dataset builder and selected workflow entry points: AnalysisReadyDatasetBuilder, DifferentialAnalysisWorkflow, KinaseWorkflow, and SignalomeWorkflow.
phospy.apiphospy.api is the stable beta-user route for requests, common configuration objects, references, results, enums, enrichment objects, and user-facing exceptions.
phospy.advancedUse phospy.advanced when a workflow guide asks for specialist configuration, diagnostics, reference helpers, or publishers. Internal modules and private validators are unsupported import targets; PhosPy's supported interface is the Python API, not HTTP.
First run
The quickstart builds a small rat dataset from linear phosphosite intensities, applies a log2 transform, declares an explicit four-sample design, and tests one treated-versus-control contrast. It is the fastest way to check your Python 3.11 or 3.12 installation, the supported public API, dataset validation, and the differential result contract before moving to your own data. Kinase, enrichment, and signalome each have a separate complete workflow guide.
import pandas as pd
from phospy import AnalysisReadyDatasetBuilder, DifferentialAnalysisWorkflow
from phospy.advanced import DatasetIntensityTransformConfig
from phospy.api import (
Contrast,
DatasetBuildRequest,
DatasetLocalisationConfig,
DatasetPreprocessingConfig,
DifferentialAnalysisRequest,
ExperimentalDesign,
Organism,
SampleDesignRecord,
)
phospho = pd.DataFrame(
{
"control_1": [1000.0, 900.0],
"control_2": [1050.0, 880.0],
"treated_1": [1800.0, 930.0],
"treated_2": [1750.0, 920.0],
},
index=["MAPK14;Y182;", "GSK3A;S21;"],
)
site_metadata = pd.DataFrame(
{
"gene_symbol": ["MAPK14", "GSK3A"],
"site": ["Y182", "S21"],
"site_sequence": [
"LDFGLARHTDDEMTGYVATRWYRAPEIMLNW",
"PSGGGPGGSGRARTSSFAEPGGGGGGGGGGP",
],
"protein_identifier": ["MAPK14", "GSK3A"],
"localisation_confidence": [0.95, 0.94],
},
index=phospho.index,
)
dataset = AnalysisReadyDatasetBuilder().run(
DatasetBuildRequest(
phospho=phospho,
site_metadata=site_metadata,
organism=Organism.RAT,
preprocessing_config=DatasetPreprocessingConfig(
intensity_transform=DatasetIntensityTransformConfig(policy="log2"),
localisation=DatasetLocalisationConfig(
confidence_column="localisation_confidence",
min_confidence=0.75,
),
),
)
)
design = ExperimentalDesign(
samples=(
SampleDesignRecord("control_1", "control", "control_r1"),
SampleDesignRecord("control_2", "control", "control_r2"),
SampleDesignRecord("treated_1", "treated", "treated_r1"),
SampleDesignRecord("treated_2", "treated", "treated_r2"),
)
)
result = DifferentialAnalysisWorkflow().run(
DifferentialAnalysisRequest(
dataset=dataset,
design=design,
contrasts=(
Contrast(
name="treated_vs_control",
numerator_condition="treated",
denominator_condition="control",
),
),
)
)
print(
result.table_for("treated_vs_control").loc[
:, ["display_id", "logFC", "P.Value", "adj.P.Val"]
]
)
A numeric site-by-sample matrix plus aligned site metadata. The finished dataset requires protein-scoped row identity, site_sequence, and localisation evidence; the differential design and contrasts are declared separately.
Pass pandas DataFrames or .csv, .tsv, .txt, and .parquet paths. Install phospy[parquet] for Parquet support, or begin with MaxQuant and FragPipe/PTMProphet importer outputs.
DifferentialAnalysisResult provides one independent table per contrast plus diagnostics, provenance, feature eligibility, attrition, and caveats. Advanced publishers cover dataset, kinase, and signalome tables; reloadable bundles are available for kinase and signalome.
Scientific posture
PhosPy says what its outputs mean—and what they do not. Differential statistics apply only within the designs and contrasts the workflow supports; enrichment is offline ORA over caller-supplied collections and backgrounds; kinase scores are relative support, not causal probabilities; and signalome modules are descriptive, run-local summaries. The package does not claim full PhosR or limma parity, PTM-SEA support, or causal pathway evidence.
FAQ
No. PhosPy is inspired by selected PhosR workflows, but its supported methods and Python API are deliberately narrower and documented. It does not claim full PhosR or limma parity.
Differential analysis tests explicit contrasts on an established log2 dataset and, in production mode, requires at least two biological replicates per contrasted condition. Enrichment is a separate offline ORA workflow with caller-supplied identifiers, local sets, and an explicit background; PhosPy does not fetch online enrichment resources.
In PhosPy 1.7.0, ReferencePreset.AUTO resolves only the approved rat l6_native snapshot. Human, mouse, and custom reference-backed workflows require a caller-supplied ReferenceBundle with suitable source and compatibility metadata.
Signalome starts from a completed KinaseWorkflowResult and requires non-empty site_metadata.protein_group_id values for interpreted sites. It does not infer this grouping identity from gene_symbol or display_id; production mode also requires suitable localisation evidence.
Open the matching workflow guide and its guidance for common issues. The guides help you check installation, table alignment, intensity scale, localisation, design and contrast records, identifier namespaces, reference compatibility, and workflow-specific prerequisites.
Get started
Install PhosPy on Python 3.11 or 3.12, prepare an analysis-ready dataset, and run the differential quickstart. From there, choose the single workflow page that matches your question; each page keeps its request, runnable example, response contract, interpretation guidance, and practical help for common issues together.