Seurat: subset function in v3

Created on 14 Jan 2019  路  2Comments  路  Source: satijalab/seurat

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

Most helpful comment

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

All 2 comments

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

Yes this works well. Thanks for the explanation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akhst7 picture akhst7  路  3Comments

whitleyo picture whitleyo  路  3Comments

camilliano picture camilliano  路  3Comments

GHAStVHenry picture GHAStVHenry  路  3Comments

RuiyangLiu94 picture RuiyangLiu94  路  3Comments