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

subset function in v3 #1053

Closed
nasqar opened this issue Jan 14, 2019 · 3 comments
Closed

subset function in v3 #1053

nasqar opened this issue Jan 14, 2019 · 3 comments

Comments

@nasqar
Copy link

nasqar commented Jan 14, 2019

Hi,
Background: We developed an RShiny web interface SeuratWizard for seurat v2 (guided clustering workflow) and I am currently trying to migrate it to v3.

For the subset function, is there a way to use a variable containing the subset name. For example:
var1 = "name"
subset(x = object, subset = var1 > low & var1 < high)

Could be a simple oversight on my part. Appreciate the help

@mojaveazure
Copy link
Member

Much like R's subset function, subset.Seurat is designed for interactive use only. While we currently don't offer a programmatic way to subset Seurat objects based on feature expression, this can be accomplished relatively easily using which and FetchData

expr <- FetchData(object = object, vars = var1)
object[, which(x = expr > low & expr < high)]

@nasqar
Copy link
Author

nasqar commented Jan 16, 2019

Yes this works well. Thanks for the explanation.

@jindall
Copy link

jindall commented Jul 5, 2022

@mojaveazure
how to make a subset of seurat object that contains the cells expressing just the genes in the gene_list:
gene_list hs 4000 genes in total
text_case

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

No branches or pull requests

3 participants