1
$\begingroup$

I'm working with some large Seurat objects (MOCA, MCA, Tabula Muris) studying gene coexpression, and I'm running into memory issues.

Is it possible to remove all genes in a Seurat object that are not in a specified gene array? Ideally I'd like to be working with a small R matrix with say, 250k rows (cells) and 10-50 columns (gene expression data) which will enable fast processing and comprehensive analysis using other packages.

$\endgroup$
1
  • $\begingroup$ There might be drawbakcs with this approach, for example if you end up with genes that are highly expressed in one cell type and lowly expressed in the other, these two sets of cells will look like expressing these genes at similar levels after normalization if normalization is performed with this limited number of specific genes. You might want to consider sampling your cells, you can decrease the number of cells instead of genes. $\endgroup$ – haci Nov 19 '19 at 8:43
1
$\begingroup$

Is your memory usage low enough that you can initially read everything in and then filter later? If so you could read the Seurat object in like normal and then use subset against a vector of your gene names.

subsample <- subset(seurat_obj, features = my_genes)
$\endgroup$
2
$\begingroup$

A different approach if you are using Seurat3, is DietSeurat(). It allows you to diet the object by removing the components that you don't need. For example you can keep the normalised/scaled matrix and remove the raw counts. This approach could reduce space and memory usage, while keeping all your genes in place.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.