campbio / celda

Bayesian Hierarchical Modeling for Clustering Single Cell Genomic Data
http://bioconductor.org/packages/celda
MIT License
148 stars 27 forks source link

different genes #370

Closed wbf520qcp closed 2 years ago

wbf520qcp commented 2 years ago

Hi, Thanks for developing this awesome tools. I have run it on my data and got fantastic figures. But I wonder how can I retrieve those gene modules so that I can manipulate heat maps with my own code?

Thank you, Bofei

joshua-d-campbell commented 2 years ago

Hi @wbf520qcp, thanks for trying out our tools! Great question! If you want to get the gene modules, you can use the factorizeMatrix function described here in our tutorial. Briefly, if your celda result is stored in a SingleCellExperiment object called "sce", you can use the following code:

# Factorize the original counts matrix
fm <- factorizeMatrix(sce)

# Get the matrix of module probabilities for each cell
fm$proportions$cell

# Get the matrix of module counts for each cell
fm$counts$cell

Hope that helps. I'm going to convert this to a "Discussion".