Skip to main content

PhosKinTime is a Python toolkit for ODE‑based modeling of phosphorylation kinetics and transcriptional time‑series, featuring parameter estimation, sensitivity analysis, steady‑state computation, and interactive visualization.

Project description

PhosKinTime

Python NumPy Pandas Matplotlib SciPy Plotly Openpyxl scikit-learn tqdm Numba XlsxWriter statsmodels pymoo adjustText SALib Graphviz mygene python-dotenv cobyqa

PhosKinTime is an ODE-based modeling package for analyzing phosphorylation dynamics over time. It integrates parameter estimation, sensitivity analysis, steady-state computation, and visualization tools to help researchers explore kinase-substrate interactions in a temporal context.

Acknowledgments

This project originated as part of my master's thesis work at Theoretical Biophysics group ( now, Klipp-Linding Lab), Humboldt Universität zu Berlin.

I am especially grateful to Ivo Maintz for his generous technical support, enabling seamless experimentation with packages and server setups.

Overview

PhosKinTime uses ordinary differential equations (ODEs) to model phosphorylation kinetics and supports multiple mechanistic hypotheses, including:

  • Distributive Model: Phosphorylation events occur independently.
  • Successive Model: Phosphorylation events occur sequentially.
  • Random Model: Phosphorylation events occur in a random manner.

The package is designed with modularity in mind. It consists of several key components:

  • Configuration: Centralized settings (paths, parameter bounds, logging, etc.) are defined in the config module.
  • Models: Different ODE models (distributive, successive, random) are implemented to simulate phosphorylation.
  • Parameter Estimation: Multiple routines (sequential and normal estimation) estimate kinetic parameters from experimental data.
  • Sensitivity Analysis: Morris sensitivity analysis is used to evaluate the influence of each parameter on the model output.
  • Steady-State Calculation: Functions compute steady-state initial conditions for ODE simulation.
  • Utilities: Helper functions support file handling, data formatting, report generation, and more.
  • Visualization: A comprehensive plotting module generates static and interactive plots to visualize model fits, parameter profiles, PCA, t-SNE, and sensitivity indices.

Installation

This guide provides clean setup instructions for running the phoskintime package on a new machine. Choose the scenario that best fits your environment and preferences.


Scenario 1: pip + virtualenv (Debian/Ubuntu/Fedora)

For Debian/Ubuntu

sudo apt update && sudo apt install -y python3 python3-pip python3-venv git

For Fedora

sudo dnf install -y python3 python3-pip python3-virtualenv git

Setup

git clone git@github.com:bibymaths/phoskintime.git
cd phoskintime

# Create and activate a virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install --upgrade pip
pip install -r requirements.txt

Scenario 2: Poetry + pyproject.toml

Install Poetry (all platforms)

curl -sSL https://install.python-poetry.org | python3 -
# Or: pip install poetry

Setup

git clone git@github.com:bibymaths/phoskintime.git
cd phoskintime

# Install dependencies
poetry install

# Optional: activate shell within poetry env
poetry shell

Scenario 3: Using uv (fast, isolated pip alternative)

Install uv

curl -LsSf https://astral.sh/uv/install.sh | sh

Setup

git clone git@github.com:bibymaths/phoskintime.git
cd phoskintime

# Create virtual environment and install deps fast
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt

Scenario 4: Conda or Mamba (Anaconda/Miniconda users)

Setup

git clone git@github.com:bibymaths/phoskintime.git
cd phoskintime

# Create and activate conda environment
conda create -n phoskintime python=3.10 -y
conda activate phoskintime

# Install dependencies
pip install -r requirements.txt

Or if using pyproject.toml, add:

pip install poetry
poetry install

For making illustration diagrams, you need to install Graphviz. You can do this via conda or apt-get:

conda install graphviz

or

apt-get install graphviz

or download it from the Graphviz website. For macusers, you can use Homebrew:

brew install graphviz

The package is executed via the main script located in the bin directory. This script sets up the configuration, processes experimental data, performs parameter estimation, generates model simulations, and creates a comprehensive report.

Command-Line Entry Point for the Phoskintime Pipeline

The phoskintime pipeline provides a command-line interface to execute various stages of the workflow,
including preprocessing, optimization, and modeling. Below are the usage instructions and examples for running
the pipeline.

Before running any commands, ensure you are in the working directory one level above the project root (where the project
directory is visible).

Run All Stages

Run the entire pipeline with the default (local) solver:

python phoskintime all

Run Preprocessing Only

Execute only the preprocessing stage:

python phoskintime prep

Run Transcription-Factor-mRNA Optimization (TFOPT)

Run TFOPT with the local solver:

python phoskintime tfopt --mode local

Run TFOPT with the evolutionary solver:

python phoskintime tfopt --mode evol

Run Kinase-Phosphorylation Optimization (KINOPT)

Run KINOPT with the local solver:

python phoskintime kinopt --mode local

Run KINOPT with the evolutionary solver:

python phoskintime kinopt --mode evol

Run the Model

Execute the modeling stage:

python phoskintime model

Main Script

The command-line arguments (such as parameter bounds, fixed parameters, bootstrapping iterations, and input file paths) are parsed by the configuration module. The main script then:

  • Loads the experimental data.
  • Logs the configuration and initializes output directories.
  • Processes each gene in parallel using a ProcessPoolExecutor.
  • Performs parameter estimation (toggling between sequential and normal modes as configured).
  • Generates ODE simulations and various plots.
  • Saves all results (including a global HTML report) in the designated output directory.

Example

Here’s a brief overview of the execution flow:

  1. Configuration:

    • config/config.py and config/constants.py set up model options (e.g., ODE_MODEL, ESTIMATION_MODE), time points, file paths, and logging settings.
    • Command-line arguments are parsed to override default settings.
  2. Parameter Estimation:

    • The toggle functionality in paramest/toggle.py selects the appropriate routine.
    • Results are saved and passed for visualization.
  3. Model Simulation and Visualization:

    • The selected ODE model (from models/) is used to simulate system dynamics.
    • The plotting module generates plots (e.g., parallel coordinates, PCA, t-SNE, model fits, and sensitivity plots) to visually inspect the results.
  4. Reporting:

    • The utils/display.py and utils/tables.py modules save results and generate an HTML report summarizing the analysis.

Modules

  • Config Module:

    • config/constants.py: Global constants (model settings, time points, directories, scoring weights, etc.).
    • config/config.py: Command-line argument parsing and configuration extraction.
    • config/logconf.py: Logging configuration with colored console output and rotating file logs.
    • config/helpers/__init__.py: Helper functions for generating parameter names, state labels, bounds, and clickable file links.
  • Models Module:
    Implements various ODE models:

    • randmod.py: Random model with vectorized state calculations.
    • distmod.py: Distributive model.
    • succmod.py: Successive model.
    • weights.py: Weighting schemes for parameter estimation.
  • Parameter Estimation Module:

    • normest.py: Normal (all timepoints at once) estimation.
    • toggle.py: Utility to switch between estimation modes.
    • core.py: Integrates estimation, ODE solving, error metrics, and visualization.
  • Steady-State Module:

    • initdist.py, initrand.py, initsucc.py: Compute steady-state initial conditions for each model type.
  • Sensitivity Module:

    • analysis.py: Implements Morris sensitivity analysis, including problem definition, sampling, analysis, and plotting of sensitivity indices.
  • Utils Module:

    • display.py: Helper functions for file/directory management, data loading, result saving, and report generation.
    • tables.py: Functions to generate, save, and compile data tables (LaTeX and CSV).
  • Bin Module:

    • main.py: The main entry point that orchestrates the entire workflow—from configuration and data loading to parameter estimation, simulation, visualization, and report generation.

Customization

You can customize the package by:

  • Adjusting model parameters and bounds in the config files.
  • Choosing the ODE model type by modifying ODE_MODEL in constants.py.
  • Configuring output directories and file paths.
  • Modifying the logging behavior in logconf.py.
  • Tweaking the scoring function weights in constants.py.

Conclusion

PhosKinTime is a flexible and powerful package for modeling phosphorylation kinetics. Its modular design allows researchers to simulate different mechanistic models, estimate kinetic parameters, analyze parameter sensitivity, and generate comprehensive visual and tabular reports. Whether you are exploring basic kinetic hypotheses or conducting in-depth sensitivity analysis, PhosKinTime offers the necessary tools for robust model-based analysis.

For more information, please refer to the individual module documentation and source code.

License

This package is distributed under the BSD 3-Clause License.
See the LICENSE file for full details.


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

phoskintime-0.4.0.tar.gz (11.0 MB view details)

Uploaded Source

Built Distribution

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

phoskintime-0.4.0-py3-none-any.whl (206.6 kB view details)

Uploaded Python 3

File details

Details for the file phoskintime-0.4.0.tar.gz.

File metadata

  • Download URL: phoskintime-0.4.0.tar.gz
  • Upload date:
  • Size: 11.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Linux/6.11.0-1012-azure

File hashes

Hashes for phoskintime-0.4.0.tar.gz
Algorithm Hash digest
SHA256 9b22b217b109b4d23e0f50620999b197874be2bb59cf3d9915e751c7ea18369e
MD5 e3849e19cd98227b01937e0f0c06b2a1
BLAKE2b-256 db28ff93ba5bd197309e2a625977aee3a8374307aea2198f0701dc849dfbc636

See more details on using hashes here.

File details

Details for the file phoskintime-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: phoskintime-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 206.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Linux/6.11.0-1012-azure

File hashes

Hashes for phoskintime-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a073e3d76fbb33390d3cf729e03d88c48f274f3a4f15dd08b80a984701d3f11
MD5 3e0e078376675daaf746a006a3525a21
BLAKE2b-256 caa694a10ad64c3b6661a66184d6f7ec3b6ba7eb67ab4f40235e13b4087160c1

See more details on using hashes here.

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