Visualization of data and simulations

In this notebook, we illustrate the visualization functions of petab.

from petab.visualize import plot_with_vis_spec, plot_without_vis_spec
folder = "example_Isensee/"

data_file_path = folder + "Isensee_measurementData.tsv"
condition_file_path = folder + "Isensee_experimentalCondition.tsv"
visualization_file_path = folder + "Isensee_visualizationSpecification.tsv"
simulation_file_path = folder + "Isensee_simulationData.tsv"
ax = plot_with_vis_spec(visualization_file_path, condition_file_path,
                        data_file_path, simulation_file_path)
../_images/0729bd2340cf4df5e769d41cbd8f73274872312ce4fe02ef7d952201982121e9.png

Now, we want to call the plotting routines without using the simulated data, only the visualization specification file.

ax_without_sim = plot_with_vis_spec(visualization_file_path, condition_file_path, data_file_path)
../_images/76fa6443e26f5a0f3f4c6268fe9de2ff14b7b4074b1915230e5cbb669d34c64b.png

One can also plot only simulated data:

ax = plot_with_vis_spec(visualization_file_path, condition_file_path,
                        simulations_df = simulation_file_path)
../_images/740517aef59fdbf745b80d369128d6961cc02308c78e3b6829a630ab02d9b05c.png

If both measurements and simulated data are available, they can be visualized using scatter plot:

visualization_file_scatterplots = folder + "Isensee_visualizationSpecification_scatterplot.tsv"
ax = plot_with_vis_spec(visualization_file_scatterplots, condition_file_path,
                   data_file_path, simulation_file_path)
../_images/2a388bce7ac7f39c5db8b9f5f5270ca96d27127bf15d92091852353ce4e9ff79.png

We can also call the plotting routine without the visualization specification file, but by passing a list of lists as dataset_id_list. Each sublist corresponds to a plot, and contains the datasetIds which should be plotted. In this simply structured plotting routine, the independent variable will always be time.

datasets = [['JI09_150302_Drg345_343_CycNuc__4_ABnOH_and_ctrl',
             'JI09_150302_Drg345_343_CycNuc__4_ABnOH_and_Fsk'],
            ['JI09_160201_Drg453-452_CycNuc__ctrl',
             'JI09_160201_Drg453-452_CycNuc__Fsk',
             'JI09_160201_Drg453-452_CycNuc__Sp8_Br_cAMPS_AM']]
ax_without_sim = plot_without_vis_spec(condition_file_path, datasets, 'dataset',
                                       data_file_path)
../_images/f92a8df199f3e537dc19e3e84c06b5fe0e06cc78f166b7edb7a68ba82ab96b6f.png

Let’s look more closely at the plotting routines, if no visualization specification file is provided. If such a file is missing, PEtab needs to know how to group the data points. For this, three options can be used:

  • dataset_id_list

  • sim_cond_id_lis

  • observable_id_list

Each of them is a list of lists. Again, each sublist is a plot and its content are either simulation condition IDs or observable IDs or the dataset IDs.

We want to illustrate this functionality by using a simpler example, a model published in 2010 by Fujita et al.

data_file_Fujita = "example_Fujita/Fujita_measurementData.tsv"
condition_file_Fujita = "example_Fujita/Fujita_experimentalCondition.tsv"

# Plot 4 axes objects, plotting 
# - in the first window  all observables of the simulation condition 'model1_data1'
# - in the second window all observables of the simulation conditions 'model1_data2', 'model1_data3'
# - in the third window  all observables of the simulation conditions 'model1_data4', 'model1_data5'
# - in the fourth window all observables of the simulation condition 'model1_data6'

sim_cond_id_list = [['model1_data1'], ['model1_data2', 'model1_data3'],
                    ['model1_data4', 'model1_data5'], ['model1_data6']]

ax = plot_without_vis_spec(condition_file_Fujita, sim_cond_id_list,
                           'simulation', data_file_Fujita,
                           plotted_noise='provided')
../_images/d00b7f7bf68245a9076211720b8b02e8c01e18575f3e546638643c6a43d51ffd.png
# Plot 3 axes objects, plotting
# - in the first window  the observable 'pS6_tot' for all simulation conditions
# - in the second window the observable 'pEGFR_tot' for all simulation conditions
# - in the third window  the observable 'pAkt_tot' for all simulation conditions

observable_id_list = [['pS6_tot'], ['pEGFR_tot'], ['pAkt_tot']]


ax = plot_without_vis_spec(condition_file_Fujita, observable_id_list,
                           'observable', data_file_Fujita,
                           plotted_noise='provided')
../_images/098f4c0741c5c12a942f276c2b222b04b39bb4a92721bb0653c7802f36cb0378.png
# Plot 2 axes objects, plotting
# - in the first window  the observable 'pS6_tot' for all simulation conditions
# - in the second window the observable 'pEGFR_tot' for all simulation conditions
# - in the third window  the observable 'pAkt_tot' for all simulation conditions
# while using the noise values which are saved in the PEtab files

observable_id_list = [['pS6_tot'], ['pEGFR_tot']]


ax = plot_without_vis_spec(condition_file_Fujita, observable_id_list,
                           'observable', data_file_Fujita,
                           plotted_noise='provided')
../_images/ed2f342926848b05cf0f89e1e84b8cb56542c2d097f1047b86cfce3d0d96ecf4.png

Plot only simulations

simu_file_Fujita = "example_Fujita/Fujita_simulatedData.tsv"

sim_cond_id_list = [['model1_data1'], ['model1_data2', 'model1_data3'],
                    ['model1_data4', 'model1_data5'], ['model1_data6']]

ax = plot_without_vis_spec(condition_file_Fujita, sim_cond_id_list,
                           'simulation', simulations_df=simu_file_Fujita,
                           plotted_noise='provided')
../_images/56b9b202c0a0f43f0077738af2131363f78ccc6374a86e253e5e048666687d76.png
observable_id_list = [['pS6_tot'], ['pEGFR_tot'], ['pAkt_tot']]

ax = plot_without_vis_spec(condition_file_Fujita, observable_id_list,
                           'observable', simulations_df=simu_file_Fujita,
                           plotted_noise='provided')
../_images/8cfeac1633793366a01098c250c249a7ed6b48199ff8bded23476c94bb12314d.png