Open rue1996 opened 1 year ago
Sorry we don't have a function to do this. You can probably write some dplyr code by making a dataframe and then using group_by
on the spot index and then mutate (divide by sum) to get this for each gene. Here is a minimal example:
library(BayesSpace)
library(tibble)
library(dplyr)
sce = BayesSpace::exampleSCE()
sce.e = spatialEnhance(sce, q = 3, nrep = 1000, burn.in = 100)
sce.e = enhanceFeatures(sce.e, sce.ref = sce)
data1 = as_tibble(cbind(colData(sce.e), t(logcounts(sce.e))))
gene.names = rownames(sce)
data1 %>%
group_by(spot.idx) %>%
mutate(across(any_of(gene.names),~./(sum(.)))) ->
props
Hi
I have a question, is there a way to transform the enhanced gene expression of each spot to a percentage?