Closed alextamburino closed 5 years ago
You can save only the required data as a df
df = FetchData(Obj, c(rownames(Obj@data), "meta.data.var1", "meta.data.var2"), use.scaled = T)
Thanks @sansense I built the Shiny app to plot from a Seurat object. Is there a way to save only the required data as a Seurat object for use with VlnPlot, DotPlot, etc.? The app works as is, just slow and I'm trying to avoid redeveloping it.
Sorry, shameless plug for my software, but you could export your data from the Seurat object to a cellbrowser, which does not use shiny so is probably a lot faster. See cells.ucsc.edu or https://github.com/maximilianh/cellBrowser (needs more docs) and contact me. It can only color by gene or cell annotation, so it may not do what you want here.
@alextamburino,
The minimum Seurat object will contain at least the @raw.data slot. As soon as you enter the raw.data
in Seurat, the @ data slot is also populated with the same data (otherwise the normalized data goes here). So, create a nea lean Seurat Obj from the normalized data of bigObj
leanObj = CreateSeuratObject(bigObj@data)
## Almost all of the analyses work on scaled.data, so, it makes sense to populate also the scale data slot
leanObj@scale.data = bigObj@scale.data
## And then copy the required meta.data to your lean obj
leanObj@meta.data = bigObj@meta.data ## or only a part of the meta data that you need
Seurat v3 introduces a DietSeurat
function. This function allows you to select which slots (counts
/raw.data
, data
, and/or scale.data
) to keep in an object, and which features to keep (eg. only highly variable features). Currently, the function doesn't support bringing over meta data, but that's relatively easy to transfer over.
Details on installing the Seurat v3 prerelease can be found here
Hi, I have a fully processed Seurat object and I want to create a lean version (i.e. minimal size) for a Shiny app that enables plotting (
@data
and@scale.data
) and has 1-2@meta.data
variables. What's the easiest way to do this? Thanks in advance for your time and thoughts. Alex