Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: use schex with data frame? #15

Open
davemcg opened this issue Dec 17, 2019 · 7 comments
Open

feature request: use schex with data frame? #15

davemcg opened this issue Dec 17, 2019 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@davemcg
Copy link

davemcg commented Dec 17, 2019

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.

@SaskiaFreytag
Copy link
Owner

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.

@SaskiaFreytag SaskiaFreytag self-assigned this Dec 17, 2019
@SaskiaFreytag SaskiaFreytag added the enhancement New feature or request label Dec 17, 2019
@davemcg
Copy link
Author

davemcg commented Dec 18, 2019

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.

@davemcg
Copy link
Author

davemcg commented Dec 18, 2019

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')

@lazappi
Copy link

lazappi commented Dec 19, 2019

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 🤷‍♂️.

@SaskiaFreytag
Copy link
Owner

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.

@lazappi
Copy link

lazappi commented Dec 20, 2019

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 😺.

@tomashhurst
Copy link

tomashhurst commented Jul 1, 2020

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.

image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants