Open-Systems-Pharmacology / OSPSuite.ReportingEngine

R implementation of the reporting engine
https://www.open-systems-pharmacology.org/OSPSuite.ReportingEngine/
Other
5 stars 5 forks source link

Missing Y2 in plots of Qualification Report (Workflow.R) #934

Closed GhazalMontaseri closed 1 year ago

GhazalMontaseri commented 2 years ago

I tried to generate the qualification report for Fluconazole model based on files provided here: https://github.com/Open-Systems-Pharmacology/Fluconazole-Model

However, instead of Workflow.m I have used workflow.R as described here: https://www.open-systems-pharmacology.org/OSPSuite.ReportingEngine/articles/qualification-workflow.html#template

I have PK-Sim portable version 11 and latest version of 'QualificationRunner'. The issue is in concentration-time profiles with double Y axes like Y and Y2 (like the third plot in section 3.3.1), I got a plot with only Y and not both Y and Y2. Can you please help me with this issue?

Yuri05 commented 2 years ago

I guess you are talkimg about this plot: https://raw.githubusercontent.com/Open-Systems-Pharmacology/OSP-PBPK-Model-Library/master/Fluconazole/images/003_3_Results_and_Discussion/003_3_3_Concentration-Time_Profiles/001_3_3_1_Model_Building/003_plotTimeProfile.png (here created in Matlab.) How does the plot look like in your case?

GhazalMontaseri commented 2 years ago

This is my plot, both observations and model prediction on Y2 axis are missing.

no_Y2

it seems that my issue is not specific only for the fluconazole report but for a simple template https://github.com/Open-Systems-Pharmacology/Evaluation-plan-template

when I add a second plot on Y2, I cannot get it in the generated pictures from the reporting engine.

pchelle commented 2 years ago

This is a limitation of the current versions of {ospsuite.reportingengine} and {tlf} packages that cannot handle Y2 axis yet. For this reason, every data on Y2 axis are skipped in the figure. As a workaround, I suggest to plot the data in Y2 axis as a separate figure.

GhazalMontaseri commented 2 years ago

Thanks Pierre for your answer. May I ask if this is a limitation only for R users (worflow.R)? because in the original qualification report which was generated using Matlab (workflow.m) Y2 exists.

https://github.com/Open-Systems-Pharmacology/OSP-PBPK-Model-Library/tree/master/Fluconazole

One option as you said is separating the plots, but Do you think using Matlab instead of R is also an option to solve this issue?

pchelle commented 2 years ago

Yes, it is currently a limitation for R users only. Matlab can handle Y2 axis, so using Matlab instead of R may be an option as well. However, I don't know if there could be compatibility issues with between Matlab and latest OSPSuite versions. @Yuri05 may have more insight about this aspect

GhazalMontaseri commented 2 years ago

thanks a lot Pierre, may I ask: 1) if you have a plan to solve it for R users? 2) where I may find instructions for generating a qualification report based on MATLAB? Thanks in advance for your supports

pchelle commented 2 years ago

@Yuri05 , please correct me if I am wrong

1. if you have a plan to solve it for R users?

Yes, we intend to add the Y2 axis feature for time profile plots. However, I don't know in terms of timeline exactly when we will fix that.

2. where I may find instructions for generating a qualification report based on MATLAB?

You will find the instructions for using the Matlab qualification framework here

GhazalMontaseri commented 2 years ago

Hello Pierre, thanks for your supports. For the moment, I switch to MATLAB. My questions is how can I install 'Reporting engine 3.0.1.53' as MATLAB source code library (alternative no. 1 according to the link you have sent me)? There is no .exe file for installation. When I run the 'Workflow.m' file, it calls many functions and since they are not at the same folder as 'workflow.m' or the library is not installed I get errors saying 'unrecognize function or variable ....'

thanks for your supports.

Yuri05 commented 2 years ago

@GhazalMontaseri Matlab Reporting Engine is just zipped Matlab source code . You need to unzip it and add the Folder with the source Code (with subfolders) to the Matlab search path

GhazalMontaseri commented 2 years ago

thank you so much Juri, I used ''addpath'' command to add all subfolders to the search path.

GhazalMontaseri commented 1 year ago

@Yuri05 Hello Yuri, may I ask if in the new release, adding the Y2 axis feature for time profile plots in the qualification report workflow.R, has been resolved?

Yuri05 commented 1 year ago

Hello @GhazalMontaseri , this will be fixed in the next release, which will be hopefully available till the end of March.

Yuri05 commented 1 year ago

Dear @GhazalMontaseri , new release with the fixed Y2-issue is available now: https://github.com/Open-Systems-Pharmacology/QualificationPlan/releases/tag/v3.1

GhazalMontaseri commented 1 year ago

Thanks @Yuri05 .

GhazalMontaseri commented 1 year ago

Hello @Yuri05, can you please help me how I may modify/increase size of points in the generated Gof plots from the qualification report? As you see below the points are very small. 2_gof_plot_predictedVsObserved

Yuri05 commented 1 year ago

Hi @GhazalMontaseri , try to use the new default theme:

Yuri05 commented 1 year ago

You can also modify the theme properties programmatically, s. https://www.open-systems-pharmacology.org/OSPSuite.ReportingEngine/articles/plot-settings.html

E.g.

...
jsonFile <- system.file("extdata", "re-theme.json",  package = "ospsuite.reportingengine")
reTheme <- tlf::loadThemeFromJson(jsonFile)
reTheme$plotConfigurations$plotObsVsPred$points$size=8
setDefaultTheme(reTheme)

workflow$runWorkflow()
...
Yuri05 commented 1 year ago

Please note, that those changes are global and will apply to all workflows which are executed after the setting of the new theme. Plot settings can also be changed locally only for the workflow being executed. However not all such settings are (easily) accessible. E.g. I don'r know how to change the symbol size for the GOF plots of the given workflow. Maybe @pchelle could advice.

GhazalMontaseri commented 1 year ago

Hello @Yuri05 , I tried this in my workflow.R:

jsonFile <- system.file("extdata", "re-theme.json", package = "ospsuite.reportingengine") reTheme <- tlf::loadThemeFromJson(jsonFile)

reTheme$plotConfigurations$plotObsVsPred$points$size=8 --> for GoF plots reTheme$plotConfigurations$plotTimeProfile$points$size=40 --> for time profiles

setDefaultTheme(reTheme) workflow$runWorkflow()

However, while point size in the GoF plot has been increased this is not the case for the time profile plot (second Y-axis has some points but very small) 2_gof_plot_predictedVsObserved

1_time_profile_plot_Rifampicin_Midazolam_DDI_test_DDI_Treatment___Rifampicin_Midazolam___Yu_2004__CYP3A5_s3_s3__parameters

Yuri05 commented 1 year ago

However, while point size in the GoF plot has been increased this is not the case for the time profile plot (second Y-axis has some points but very small)

It's a bug :(

You can try the latest development version of the reporting engine where this bug was fixed. For this, you need to install some CRAN packages first:

Then install the latest development version of the OSP packages:

GhazalMontaseri commented 1 year ago

Thanks @Yuri05 , any plan to release the validated reporting engine package with this bug being fixed in near future?

Yuri05 commented 1 year ago

Hopefully till the end of summer

GhazalMontaseri commented 3 months ago

Hello @Yuri05, any update on release of reportingEngine package in which the issues with Y2 (dual axes), size of points, and plot of time profiles with no observated data ( #1082) have been solved?