edward130603 / BayesSpace

Bayesian model for clustering and enhancing the resolution of spatial gene expression experiments.
http://edward130603.github.io/BayesSpace
Other
106 stars 21 forks source link

About the input file of BayesSpace #112

Closed makabakayu closed 1 year ago

makabakayu commented 1 year ago

Hi, I wondered if I could apply this method to non-gene expression matrix, where my input is a low-dimensional matrix with columns representing spots while rows representing the proportions of each cell type, and there are only 30 rows so I don't need to perform pre-processing and PCA. I initially used the option to skip pca, but in the next step qTune() I reported an error:

Error in value[[3L]](cond) : 
  invalid subscript 'type' in 'reducedDim(<SingleCellExperiment>, type="character", ...)':
  'PCA' not in 'reducedDimNames(<SingleCellExperiment>)'

it seems that it has to use the results of pca, so I perform the pca, but again I got an error when running the sce <- qTune(sce, qs=seq(2, 10), platform="Visium"):

Neighbors were identified for 41055 out of 41067 spots.
Error in `[<-`(`*tmp*`, g, modelName, value = bic(modelName = modelName,  : 
  subscript out of bounds

And I just can't figure it out Is there any way for the method to take my matrix directly as input without any processing?

Thanks!

edward130603 commented 1 year ago

You can first set your expression matrix using something like this:

reducedDim(sce, "mySlotNameHere") = myMatrixHere

I think this matrix should be in the format with spots in rows and cell type proportion in column.

Then you can run qTune or spatialCluster using the argument use.dimred = "mySlotNameHere" (see documentation here: https://rdrr.io/bioc/BayesSpace/man/spatialCluster.html)

makabakayu commented 1 year ago

It works! Thank you for your prompt answer!