Closed AyushPraveen closed 5 months ago
sessionInfo() R version 4.4.0 (2024-04-24) Platform: aarch64-apple-darwin20 Running under: macOS Sonoma 14.3.1
Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
locale: [1] C/UTF-8/C/C/C/C
time zone: Asia/Kolkata tzcode source: internal
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] matter_2.6.1 Matrix_1.7-0 Cardinal_3.6.1
[4] S4Vectors_0.42.0 BiocParallel_1.38.0 BiocGenerics_0.50.0
[7] ProtGenerics_1.36.0
loaded via a namespace (and not attached):
[1] nlme_3.1-164 cli_3.6.2 rlang_1.1.3 DBI_1.2.2
[5] tiff_0.1-12 png_0.1-8 RCurl_1.98-1.14 htmltools_0.5.8.1
[9] ontologyIndex_2.12 Biobase_2.64.0 locfit_1.5-9.9 grid_4.4.0
[13] abind_1.4-5 bitops_1.0-7 fastmap_1.2.0 compiler_4.4.0
[17] codetools_0.2-20 CardinalIO_1.2.0 irlba_2.3.5.1 htmlwidgets_1.6.4
[21] fftwtools_0.9-11 EBImage_4.46.0 lattice_0.22-6 digest_0.6.35
[25] parallel_4.4.0 tools_4.4.0 jpeg_0.1-10 biglm_0.9-2.1
Thanks. I will take a look when I’m able.
@AyushPraveen
I will push a fix shortly, but if you need a fix right away and your data fits in memory, you can do:
spectra(mse_proc) <- as.matrix(spectra(mse_proc))
(Note for the "tiny" example this will still fail for k > 2
due to the tiny image sizes with a small number of distinct intensities, but this is intended behavior.)
Fixed by https://github.com/kuwisdelu/Cardinal/commit/1c6249e6bb56888f659e358fffe8b192fe4950f7
May take a couple days to show up on Bioconductor servers.
Hi @kuwisdelu,
Thanks for looking into the issue and resolving it. I will try out my runs with the new version available.
Thanks once again 😃
Hi @kuwisdelu,
I am facing issues while running spatialDGMM with Cardinal and needed your help in resolving it.
I have been using Cardinal v3.4.3 for sometime and unable to debug the issue there. To start afresh I tried to setup a new environment with R v4.4, Cardinal v3.6.1 and matter v2.6.1 (Have shared the session info in the comment for reference). In trying to debug the issue, I tried two cases
mse <- simulateImage(preset=2, dim=c(32,32), sdnoise=0.5, peakheight=c(2,4), representation="centroid")
mse$design <- makeFactor(circle=mse$circle, square=mse$square, bg=!(mse$circle | mse$square))
path_continuous <- CardinalIO::exampleImzMLFile("continuous")
mse_tiny <- readMSIData(path_continuous)
In the first case, I don't run any pre-processing functions over the dataset as followed in the vignette and I get the spatialDGMM results after the run.
However, for the second case, I have tried running spatialDGMM with pre-processing and without pre-processing the data. Below is the snippet for the pre-processing code that I run for reference followed by spatialDGMM.
mse_queue <- mse_tiny |>
normalize(method="tic") |>
peakPick(method = 'mad', SNR=4)mse_proc <- peakAlign(mse_queue)
mse_proc <- subsetFeatures(mse_proc, freq > 0.1)
mse_proc
sdgmm_obj <- spatialDGMM(mse_proc, r=1, k=5, weights='adaptive', annealing = TRUE)
I am getting the following as the error trace,
calculating gaussian weights
calculating adaptive weights
processing chunk 1/5 (6 items)
processing chunk 2/5 (8 items)
processing chunk 3/5 (9 items)
processing chunk 4/5 (8 items)
processing chunk 5/5 (6 items)
fitting spatial Gaussian mixture models for k = 5
Error in sgmixn(NULL, NULL, x, r = r, k = k[j], group = groups, weights = wts, : 'vals' must be a list or matrix
This doesn't change even on updating parameters r (tried 1 and 2) and k (tried 2, 3 and 5) to different values. Have tried to play around with other parameters too from the documentation and had unsuccessful attempts with all of them.
It will be great if you can help me in resolving the issue.