kuwisdelu / Cardinal

Mass spectrometry imaging toolbox
http://www.cardinalmsi.org
36 stars 14 forks source link

`Cardinal::image` can not generate correct figure in 3.6.2 version #40

Closed shaman-yellow closed 3 months ago

shaman-yellow commented 3 months ago

I run the code exactly the same, however, when I use the latest version of Cardinal from github, an error occurs (the generated image is problematic), while the Bioconductor version does not.

objects <- lapply(files, Cardinal::readMSIData)
mse <- do.call(c, objects)

mse <- Cardinal::normalize(mse) |>
  Cardinal::smooth() |>
  Cardinal::reduceBaseline() |>
  Cardinal::peakPick() |>
  Cardinal::peakAlign()

Cardinal::image(mse)

Bioconductor version (3.6.1): test.pdf

Github latest version (3.6.2) (issue): test2.pdf

kuwisdelu commented 3 months ago

Please always include full output from sessionInfo().

shaman-yellow commented 3 months ago
R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: Pop!_OS 22.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Asia/Shanghai
tzcode source: system (glibc)

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

other attached packages:
[1] nvimcom_0.9-146       utils.tool_0.0.0.9000

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.0    viridisLite_0.4.2   EBImage_4.46.0      dplyr_1.1.2         farver_2.1.1        viridis_0.6.4      
 [7] bitops_1.0-7        ggraph_2.1.0        fastmap_1.2.0       RCurl_1.98-1.14     tweenr_2.0.2        XML_3.99-0.14      
[13] digest_0.6.35       lifecycle_1.0.4     ProtGenerics_1.36.0 rsvg_2.4.0          magrittr_2.0.3      compiler_4.4.0     
[19] rlang_1.1.4         tools_4.4.0         igraph_1.5.1        utf8_1.2.3          data.table_1.14.8   askpass_1.1        
[25] graphlayouts_1.0.0  htmlwidgets_1.6.4   ontologyIndex_2.12  xml2_1.3.5          pkgload_1.3.2.1     Cardinal_3.6.1     
[31] abind_1.4-5         BiocParallel_1.38.0 withr_2.5.0         purrr_1.0.2         BiocGenerics_0.50.0 desc_1.4.2         
[37] polyclip_1.10-4     stats4_4.4.0        fansi_1.0.4         colorspace_2.1-0    ggplot2_3.5.1       scales_1.3.0       
[43] MASS_7.3-60.0.1     cli_3.6.2           crayon_1.5.2        ragg_1.2.5          generics_0.1.3      matter_2.7.1       
[49] DBI_1.2.3           pbapply_1.7-2       ggforce_0.4.1       stringr_1.5.0       parallel_4.4.0      BiocManager_1.30.23
[55] tiff_0.1-12         vctrs_0.6.3         Matrix_1.7-0        CardinalIO_1.2.1    fftwtools_0.9-11    S4Vectors_0.42.0   
[61] ggrepel_0.9.3       irlba_2.3.5.1       systemfonts_1.0.4   jpeg_0.1-10         locfit_1.5-9.9      tidyr_1.3.0        
[67] glue_1.7.0          codetools_0.2-20    stringi_1.7.12      gtable_0.3.3        munsell_0.5.0       tibble_3.2.1       
[73] pillar_1.9.0        htmltools_0.5.8.1   openssl_2.1.0       R6_2.5.1            textshaping_0.3.6   tidygraph_1.2.3    
[79] rprojroot_2.0.3     lattice_0.22-6      Biobase_2.64.0      png_0.1-8           ggsci_3.0.0         Rcpp_1.0.12        
[85] zip_2.3.0           uuid_1.1-0          gridExtra_2.3       nlme_3.1-164        officer_0.6.2       pkgconfig_2.0.3    
kuwisdelu commented 3 months ago

@shaman-yellow That is output from 3.6.1, can you provide the sessionInfo() output from when running 3.6.2?

shaman-yellow commented 3 months ago

I re-installed the latest version of package and run the codes.

R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: Pop!_OS 22.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Asia/Shanghai
tzcode source: system (glibc)

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

other attached packages:
[1] nvimcom_0.9-146       utils.tool_0.0.0.9000

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.0    viridisLite_0.4.2   EBImage_4.46.0      dplyr_1.1.2         farver_2.1.1        viridis_0.6.4      
 [7] bitops_1.0-7        ggraph_2.1.0        fastmap_1.2.0       RCurl_1.98-1.14     tweenr_2.0.2        XML_3.99-0.14      
[13] digest_0.6.35       lifecycle_1.0.4     ProtGenerics_1.36.0 rsvg_2.4.0          magrittr_2.0.3      compiler_4.4.0     
[19] rlang_1.1.4         tools_4.4.0         igraph_1.5.1        utf8_1.2.3          data.table_1.14.8   askpass_1.1        
[25] graphlayouts_1.0.0  htmlwidgets_1.6.4   ontologyIndex_2.12  xml2_1.3.5          pkgload_1.3.2.1     Cardinal_3.7.0     
[31] abind_1.4-5         BiocParallel_1.38.0 withr_2.5.0         purrr_1.0.2         BiocGenerics_0.50.0 desc_1.4.2         
[37] polyclip_1.10-4     stats4_4.4.0        fansi_1.0.4         colorspace_2.1-0    ggplot2_3.5.1       scales_1.3.0       
[43] MASS_7.3-60.0.1     cli_3.6.2           crayon_1.5.2        ragg_1.2.5          generics_0.1.3      matter_2.7.1       
[49] DBI_1.2.3           pbapply_1.7-2       ggforce_0.4.1       stringr_1.5.0       parallel_4.4.0      tiff_0.1-12        
[55] vctrs_0.6.3         Matrix_1.7-0        CardinalIO_1.2.1    fftwtools_0.9-11    S4Vectors_0.42.0    ggrepel_0.9.3      
[61] irlba_2.3.5.1       systemfonts_1.0.4   jpeg_0.1-10         locfit_1.5-9.9      tidyr_1.3.0         glue_1.7.0         
[67] codetools_0.2-20    stringi_1.7.12      gtable_0.3.3        munsell_0.5.0       tibble_3.2.1        pillar_1.9.0       
[73] htmltools_0.5.8.1   openssl_2.1.0       R6_2.5.1            textshaping_0.3.6   tidygraph_1.2.3     rprojroot_2.0.3    
[79] lattice_0.22-6      Biobase_2.64.0      png_0.1-8           ggsci_3.0.0         Rcpp_1.0.12         zip_2.3.0          
[85] uuid_1.1-0          gridExtra_2.3       nlme_3.1-164        officer_0.6.2       pkgconfig_2.0.3    
shaman-yellow commented 3 months ago

It's version 3.7 now, but the problem still exists.

kuwisdelu commented 3 months ago

@shaman-yellow You are on 3.7.0 which is the current unstable development version.

3.6.2 is available on the RELEASE_3_19 branch, or you can wait for it to build on the Bioconductor servers. I can't replicate the issue on 3.6.2.

shaman-yellow commented 3 months ago

This issue does occur after version 3.6.2. I can only use 3.6.1 now. But 3.6.1 has the issue when using Cardinal::spatialDGMM: https://github.com/kuwisdelu/Cardinal/issues/39

kuwisdelu commented 3 months ago

@shaman-yellow I can replicate the issue in 3.7.0 which is unstable and the plotting methods are currently under active development and expected to be buggy.

Did you install 3.6.2 from the RELEASE_3_19 branch? 3.6.2 is stable and I can't replicate the issue there.

shaman-yellow commented 3 months ago

Thanks, I installed the version you mentioned and now the issue is solved.

kuwisdelu commented 3 months ago

Likewise for matter, which I notice you are on 2.7.1 which is also an unstable development version.

As described in the README, the devel branches on GitHub should not be used unless you are developer and are prepared to tolerate (and potentially help fix) bugs and instability. They should not be relied on for reproducible data analysis.

Either use Bioconductor or the RELEASE branches. Thanks.

shaman-yellow commented 3 months ago

I use the devel version because I found the issue https://github.com/kuwisdelu/Cardinal/issues/39, which just happened two days ago.

kuwisdelu commented 3 months ago

Urgent bugfixes will be on the release branch and later merged into devel.

The devel version includes ongoing development that is not ready for stable use.

shaman-yellow commented 3 months ago

OK, thank you for your patience.