schex
schex copied to clipboard
feature request: use schex with data frame?
Would it be possible to allow schex to take data frames / tibbles as input? I work with a lot of huge objects that I largely handle by extracting the tSNE/UMAP coords from Seurat / SCE.
Hmm this is gonna take some refactoring of code, but I will give it a shot. Probably only going to be ready sometime later in January.
Hmm, I was afraid that might be the case. I was poking around the source code and it didn't look straightforward. In the meantime I'll see what the lightest way is to convert a tibble of coordinates to a SCE or seurat obj.
I'm wondering if you should just make a wrapper to turn a data frame into a SCE.
The tibble I've been working with is cell (rows) x data (UMAP, genes, various metadata).
Three lines gives me a SCE object which schex can use.
sce <- SingleCellExperiment(assay = list(counts = umap %>% select(RHO:NTNG1) %>% as.matrix() %>% t()))
reducedDims(sce) <- list(UMAP = umap %>% select(UMAP_1, UMAP_2) %>% as.matrix())
sce$CellType <- umap$CellType_predict
plot_hexbin_meta(sce, col = 'CellType', action = 'majority')
plot_hexbin_gene(sce, gene = 'RHO',type = 'counts', action = 'mean')
If this is possible an additional benefit might be being able to move SingleCellExperiment and Seurat from Depends to Suggests so people only need to install the packages they are using for analysis. We did this in clustree by making data.frame the default format and extracting the information from other objects as needed. Not sure how easy/possible that would be for schex though 🤷♂️.
Well the main benefit schex provides is interacting with SingleCellExperiment and Seurat, so I am not sure this is an option. I think for @davemcg;s problem ggplot.multistats is a better solution.
Fair enough. I guess my point was if it is possible for everyone to avoid having to install both SingleCellExperiment and Seurat that would be good. When you are only using one of them in a project having to install the other (and it's many dependencies) just to use schex is a pretty big downside. This is probably a separate discussion though so I'll stop commenting here 😺.
Hi @davemcg ,
Would it be possible to allow schex to take data frames / tibbles as input? I work with a lot of huge objects that I largely handle by extracting the tSNE/UMAP coords from Seurat / SCE.
Our package 'Spectre' (https://sydneycytometry.org.au/spectre) might be the kind of thing you are looking for? Our operations (including clustering, umap etc) all run directly on data.tables/data.frames, and so does our plotting -- including hexbins (see image), which was implemented by @ghar1821 in the last couple of weeks. We added it after being inspired by @SaskiaFreytag give a talk on Schex last year.
Here's what our plotting options look like: https://wiki.centenary.org.au/x/hYUcCg. We've only got our hexbin plotting options in the development branch, so it's not in a stable release yet, but it should be by the end of the week.

We've also have functions to turn Seurat objects into data tables by extracting the relevant assay data etc (though we don't yet have this for SCE, but we are getting there). This is also in development, but should be out shortly.