zhengli09 / BASS

Bayesian Analytics for Spatial Segmentation
GNU General Public License v3.0
14 stars 6 forks source link

Code to run preprocessed data #3

Open tkcaccia opened 1 month ago

tkcaccia commented 1 month ago

Dear all,

I am trying to run BASS avoiding their preprocessing but I got the error: "Error: Expecting a single value: [extent=20]."

C <- 20
R <- 7
set.seed(0)
BASS <- createBASSObject(ldata_list, xy_list, C = C, R = R,
                         beta_method = "SW", init_method = "mclust", 
                         nsample = 10000)

BASS@R=1:BASS@R
BASS@C=1:BASS@C
BASS@X_run=t(pca)
BASS <- BASS.run(BASS)
zhengli09 commented 1 month ago

Hi there,

It looks like you are trying to pass a vector of different R and C parameter values into BASS. Unfortunately, BASS currently only accepts a single scalar value for both R and C. If you would like to test the performance under different R and C values, you would need to create different BASS objects under these different values.

Best, Zheng

tkcaccia commented 1 month ago

Thank you for your fast reply. I was trying to understand better how to solve the problem but I went in the wrong path. I need to pass the data to analyze to BASS@X_run. The function BASS seems to have some limitations for the number of features of the data to analyze. With 30 features, the function works. With 40 (like in the code below), I got error:

> BASS <- createBASSObject(lapply(data_list,t), xy_list, C = C, R = R,
+                          beta_method = "SW", init_method = "mclust", 
+                          nsample = 10000)
***************************************
  INPUT INFO:
    - Number of tissue sections: 12 
    - Number of cells/spots: 4170 4285 4708 4571 3587 3274 4013 3772 3568 3576 3468 3326 
    - Number of genes: 100 
    - Potts interaction parameter estimation method: SW 
      - Estimate Potts interaction parameter with SW algorithm
  To list all hyper-parameters, Type listAllHyper(BASS_object)
***************************************
> 
> 
> BASS@X_run=t(pca[,1:40])
> BASS <- BASS.run(BASS)
Error: Not compatible with requested type: [type=NULL; target=double].
zhengli09 commented 1 month ago

I am not entirely sure about the issue there but it looks like to be caused by a data type mismatch . Do your "pca" data have any missing values or weird looking values such as Inf, NULL, etc.?

Best, Zheng

tkcaccia commented 1 month ago

You can download my variables pca, xy_list, and data_list here and upload into R with the function load("files_x_BASS.RData")

I did not find any weird variables.

zhengli09 commented 1 month ago

It looks like the issue is on the Mclust function which is used to initialize the cluster labels. Somehow it produces NULL results when the number of features is too large. I will work on this in the following days.

Best, Zheng