Extension of Seurat::FindVariableFeatures that finds variable features within each subset of the data.

FindVariableFeatures_split(
  seurat,
  split.by,
  nfeatures = 4000,
  count_overall = FALSE,
  return_nested = FALSE,
  nfeatures_max = 2000,
  batches = 10
)

Arguments

seurat

Seurat object.

split.by

Metadata variable to split data into subsets.

nfeatures

The number of variable genes to select.

count_overall

Whether nfeatures should be interpreted as the number of variable genes overall (TRUE) or per subset (FALSE).

return_nested

Return a named list of variable genes per subset (TRUE) or a flattened list (FALSE).

nfeatures_max

The max number of features to return.

batches

Number of batches. Features are prioritised according to how many variable gene subsets they appear in.

Value

A character vector of variable feature names, or if return_nested=TRUE, a named list of variable features per subset.

Examples

data("pseudo_seurat")
var_features <- FindVariableFeatures_split(
    seurat = pseudo_seurat,
    split.by = "batch",
    nfeatures = 100,
    nfeatures_max = 50
)
#> Finding variable genes per subset.
#> Finding variable features for: DRONC_human
#> Finding variable features for: DRONC_mouse
#> Finding variable features for: BlueLake2018_FrontalCortexOnly
#> Finding variable features for: BlueLake2018_VisualCortexOnly
#> Finding variable features for: Zeisel2016
#> Finding variable features for: Zeisel2018
#> Finding variable features for: AIBS
#> Finding variable features for: Aerts2020
#> Finding variable features for: LaManno2020
#> Finding variable features for: descartes_SampledData
#> Finding variable features for: Raj2020