Skip to content

Your first model

You will create the synthetic example, check it, fit it and look at the pictures. All from the phoskintime folder.

1. Create the example project

pixi run phoskintime example my-project
wrote .../phoskintime/my-project (config: .../phoskintime/my-project/config.toml)

The folder holds:

my-project/
├── config.toml               all settings of a run
├── priors_lognormal.toml     gentle assumptions about plausible parameter values
├── README.md                 the commands for this project
└── data/
    ├── kinase_net.csv        which kinase acts on which site
    ├── tf_net.csv            which TF regulates which gene
    ├── ms.csv                protein and phosphosite time series
    ├── rna.csv               mRNA time series
    ├── kinopt_results.xlsx   kinase weights
    └── tfopt_results.xlsx    TF weights

The network is tiny: two kinases K1 and K2, proteins A, B, K1, and transcription factors T1, T2, T3 (and A). The curves are invented.

2. Check the inputs

pixi run phoskintime validate --conf my-project/config.toml

This takes some seconds. It prints a long log. Only the end and the lines marked WARNING matter:

... WARNING - [TF] orphan TF T2 has no mrna data to drive it: fallback its own state (data_drive_fallback)
... WARNING - [TF] orphan TF T3 has no mrna data to drive it: fallback its own state (data_drive_fallback)
... WARNING - [TF] observations of data-driven TFs ['T1'] are inputs: 9 rows removed from the loss
ok

ok means a run can start. The warnings are expected here: see Validate and fit.

3. Fit

pixi run phoskintime run --conf my-project/config.toml

It took about 45 seconds on 4 cores. Near the middle of the log you see the fit:

[Model] 6 proteins, 2 kinases, 16 state variables.
[Fit] sbmlsim: 4/4 repeats succeeded in 4.8 s; best start 3, objective 0.08406339417.
...
[Identifiability] labels: {'not assessed': 28, 'not identifiable: no data influence': 7, ...}
  • The model has 16 numbers that change in time.
  • The fit was tried 4 times from different starting guesses. The best one was kept.
  • The objective is the mismatch between model and data. Smaller is better.

4. Look at the result

ls my-project/results

Open the pictures in my-project/results/timeseries_plots/, one per protein, and goodness_of_fit.png.

Here is protein A again, drawn with a logarithmic time axis (the small script is in Read the results):

Data and model of protein A in the synthetic example

Be honest with yourself about this picture. The model follows the protein and site S_2 roughly. It misses the fast peak of S_1 and half of the mRNA peak. The invented curves were not made by this model, and the example uses only 4 fit starts. A poor fit is information: it says that the wiring, the mechanism or the data do not agree.

5. Ask a question

What would happen without kinase K2?

pixi run phoskintime simulate run --model my-project/results --preset knockout --target K2 --out ko_K2.pke.zip
1 scenarios: .../ko_K2.pke.zip

You have built, fitted and questioned a model. The next pages explain each step properly.

Starting over

example refuses a folder that is not empty. Choose a new name. Use a new output folder for each run too.

Next: Prepare your own inputs.