Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in the qualification workflow #1274

Closed
Yuri05 opened this issue Sep 5, 2024 · 10 comments
Closed

Crash in the qualification workflow #1274

Yuri05 opened this issue Sep 5, 2024 · 10 comments

Comments

@Yuri05
Copy link
Member

Yuri05 commented Sep 5, 2024

Running this workflow:

i Info	Starting run of Plot Comparison Time Profiles task
05/09/2024 - 16:53:57
! Warning	Problem while converting geom to grob.
	
> Error Trace
	 ↪ createQualificationReport(qualificationRunnerFolder = "C:/QualificationRunner/", 
	  ↪ workflow$runWorkflow()
	   ↪ self[[plotTask]]$runTask(self$configurationPlan)
	    ↪ self$saveResults(taskResults, configurationPlan)
	     ↪ result$saveFigure(fileName = figureFilePath)
	      ↪ updatePlotDimensions(self$plot)
	       ↪ ggplot2::ggplotGrob(plotObject)
	        ↪ ggplot_gtable(ggplot_build(x))
	         ↪ ggplot_gtable.ggplot_built(ggplot_build(x))
	          ↪ by_layer(function(l, d) l$draw_geom(d, layout), plot$layers, 
	           ↪ try_fetch(for (i in seq_along(data)) {
	            ↪ f(l = layers[[i]], d = data[[i]])
	             ↪ l$draw_geom(d, layout)
	              ↪ draw_geom(..., self = self)
	               ↪ self$geom$draw_layer(data, self$computed_geom_params, layout, 
	                ↪ draw_layer(..., self = self)
	                 ↪ lapply(data_panels, function(data) {
	                  ↪ FUN(X[[i]], ...)
	                   ↪ inject(self$draw_panel(data, panel_params, coord, !!!params))
	                    ↪ self$draw_panel(data, panel_params, coord, na.rm = TRUE, outline.type = "both", 
	                     ↪ draw_panel(..., self = self)
	                      ↪ lapply(groups, function(group) {
	                       ↪ FUN(X[[i]], ...)
	                        ↪ self$draw_group(group, panel_params, coord, ...)
	                         ↪ draw_group(..., self = self)
	                          ↪ polygonGrob(munched_poly$x, munched_poly$y, id = munched_poly$id, 
	                           ↪ grob(x = x, y = y, id = id, id.lengths = id.lengths, name = name, 
	                            ↪ gpar(fill = fill_alpha(aes$fill, aes$alpha), col = if (is_full_outline) aes$colour else NA, 
	                             ↪ validGP(list(...))
	                              ↪ check.length("fill")
	                               ↪ handlers[[1L]](cnd)
	                                ↪ cli::cli_abort(c("Problem while {step}.", i = "Error occurred in the {ordinal(i)} layer."), 
	                                 ↪ rlang::abort(message, ..., call = call, use_cli_format = TRUE, 
	                                  ↪ signal_abort(cnd, .file)
	                                   ↪ signalCondition(cnd)
	                                    ↪ (function (errorCondition) 
Error: Problem while converting geom to grob.
In addition: Warning message:
In readLines(fileName, encoding = "UTF-8") :
 
 Error: Problem while converting geom to grob. 
@Yuri05
Copy link
Member Author

Yuri05 commented Sep 5, 2024

@pchelle we should fix it before release

@pchelle
Copy link
Collaborator

pchelle commented Sep 5, 2024

Error message looks like a {ggplot2} issue.
Could you provide the sessionInfo ?

@Yuri05
Copy link
Member Author

Yuri05 commented Sep 5, 2024

> sessionInfo()
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.utf8  LC_CTYPE=German_Germany.utf8    LC_MONETARY=German_Germany.utf8
[4] LC_NUMERIC=C                    LC_TIME=German_Germany.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ospsuite.reportingengine_2.2.363 tlf_1.5.170                      ospsuite_12.1.0.9003            
[4] rSharp_1.0.0                    

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.11           pillar_1.9.0          compiler_4.2.2        tools_4.2.2           sysfonts_0.8.8       
 [6] jsonlite_1.8.8        lifecycle_1.0.4       tibble_3.2.1          gtable_0.3.1          pkgconfig_2.0.3      
[11] rlang_1.1.3           cli_3.6.2             rstudioapi_0.15.0     commonmark_1.9.0      parallel_4.2.2       
[16] xfun_0.41             knitr_1.42            withr_3.0.0           dplyr_1.1.4           showtextdb_3.0       
[21] stringr_1.5.1         xml2_1.3.3            systemfonts_1.0.4     ospsuite.utils_1.5.35 generics_0.1.3       
[26] vctrs_0.6.5           gridtext_0.1.5        ggtext_0.1.2          grid_4.2.2            tidyselect_1.2.0     
[31] glue_1.7.0            data.table_1.14.8     R6_2.5.1              textshaping_0.3.6     fansi_1.0.4          
[36] farver_2.1.1          tidyr_1.3.0           ggplot2_3.5.1         purrr_1.0.2           magrittr_2.0.3       
[41] scales_1.3.0          showtext_0.9-6        colorspace_2.1-0      ragg_1.2.5            labeling_0.4.2       
[46] utf8_1.2.3            stringi_1.7.12        munsell_0.5.0         markdown_1.12         crayon_1.5.2         

@pchelle
Copy link
Collaborator

pchelle commented Sep 6, 2024

@Yuri05
I got a different crash before being able to plot anything because the simulations did not run through :(

Error messages
[CVODES WARNING]  CVode
  Internal t = 36243 and h = 1e-12 are such that t + h = t on the next step. The solver will continue anyway.

06/09/2024 - 03:51:41
! Warning	simpleWarning in .getConcurrentSimulationRunnerResults(results = results, resultsIdSimulationIdMap = resultsIdSimulationIdMap, : Simulation run failed: some variables became negative when trying to reach t=38322. There are different possible reasons for this:

  - Solver tolerances are too high. Please reduce the absolute and relative tolerances by one order of magnitude (e.g. from 1E-9 to 1E-10) and restart the simulation.
  - Some variables which are allowed to be negative were defined as non-negative.
  - Model is not properly established (e.g. the kinetic should be k*[A] but was defined as k*[B] etc.)

The following variables became negative :
Schoedel (2012) - DDI - quinidine-dextromethorphan-paroxetine, 30/30/20 mg, po, n=14 (EM)|Organism|Gonads|BloodCells|Dextromethorphan-CYP2D6-Lutz 2012 (dextrorphan) Metabolite

06/09/2024 - 03:51:41
! Warning	Simulation of model file 'Crash_DDGI/re_input/Quinidine-Dextromethorphan-DDI/Capon (1996) - dextromethorphan hydrobromide, 30 mg, po, n=6 (EM)//Capon (1996) - dextromethorphan hydrobromide, 30 mg, po, n=6 (EM).pkml' from simulation set 'Quinidine-Dextromethorphan-DDI-Capon (1996) - dextromethorphan hydrobromide, 30 mg, po, n=6 (EM)' was not completed successfully.; ...

I added ... but the error message included many simulations if not all

By any chance, could you share the simulation results of the first comparison plot ? Or is there a setting I can update to prevent such issue ?

@Yuri05
Copy link
Member Author

Yuri05 commented Sep 6, 2024

This is very strange. Which version of ospsuite package are you using? Mine is 12.1.0.9003
Here are simulation results and PK-Analysis calculation results of the workflow. You can extract them into the re_output folder of the workflow, deactivate the corresponding tasks and try to rerun again.
re_output.zip

@pchelle
Copy link
Collaborator

pchelle commented Sep 6, 2024

This is very strange. Which version of ospsuite package are you using? Mine is 12.1.0.9003

Same: ospsuite_12.1.0.9003
All my versions seem aligned except for rSharp, would rSharp_1.0.0.9000 be the reason then ?

@Yuri05
Copy link
Member Author

Yuri05 commented Sep 6, 2024

All my versions seem aligned except for rSharp, would rSharp_1.0.0.9000 be the reason then ?

no. it just propagates inputs/outputs to the "working" components embedded within the ospsuite package.

@pchelle
Copy link
Collaborator

pchelle commented Sep 6, 2024

I was able to find the cause of the crash:
Shadel 1995 simulated data in second comparison time profile plot has only 0 values which makes the log scale plot somehow.
The culprit seems to be the behaviour of {ggplot2} from the oob argument in setYAxis.

Not sure if the {tlf} issue has always been there or not since I feel that the simulated concentrations should not be 0 here.

@Yuri05
Copy link
Member Author

Yuri05 commented Sep 6, 2024

Not sure if the {tlf} issue has always been there or not since I feel that the simulated concentrations should not be 0 here.

Probably the issue was always there.
Theoretically, sim concentration should not be const zero, but if it's the case: log plot should be just empty and not crash.

@pchelle
Copy link
Collaborator

pchelle commented Sep 6, 2024

Indeed the issue was always there and comes from {ggplot2} handling of legends
https://github.com/Open-Systems-Pharmacology/TLF-Library/blob/2257c8f677e700382e99937769fffd59a6beb17e/R/utilities-axis.R#L303-L312

Censoring Infinite values from the log is appropriate but crashes when used on ribbons.
However, {tlf} has been adding layers of point, line and ribbon to enable a convenient way of displaying a unique legend in time profiles.

pchelle added a commit to pchelle/OSPSuite.ReportingEngine that referenced this issue Sep 6, 2024
…ues in log scale

Provides a warning for such a case
@Yuri05 Yuri05 closed this as completed in 7444997 Sep 6, 2024
@github-project-automation github-project-automation bot moved this from To do to Fixed in Version 2.1 / 2.2 Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Fixed
Development

No branches or pull requests

2 participants