FitMeanVar: Find variable features fitting LOESS

View source: R/generics.R

FitMeanVarR Documentation

Find variable features fitting LOESS

Description

Find highly variable features by fitting a locally polynomial regression model to the log(mean) and log(variance) of downsampled features.

Usage

FitMeanVar(object, ...)

## S3 method for class 'Seurat'
FitMeanVar(
  object,
  assay = NULL,
  layer = NULL,
  nfeatures = 20000,
  loess.span = 0.1,
  min.cutoff = 10,
  weight.mean = 0,
  bins = 1000,
  sample_per_bin = 50,
  key = "dsLoess",
  verbose = FALSE,
  ...
)

## S3 method for class 'StdAssay'
FitMeanVar(
  object,
  layer = NULL,
  loess.span = 0.1,
  nfeatures = 20000,
  min.cutoff = 10,
  weight.mean = 0,
  bins = 1000,
  sample_per_bin = 50,
  key = "dsLoess",
  verbose = FALSE,
  ...
)

## S3 method for class 'Assay'
FitMeanVar(
  object,
  layer = NULL,
  loess.span = 0.1,
  nfeatures = 20000,
  min.cutoff = 10,
  weight.mean = 0,
  bins = 1000,
  sample_per_bin = 50,
  key = "dsLoess",
  verbose = FALSE,
  ...
)

## Default S3 method:
FitMeanVar(
  object,
  nfeatures = 20000,
  loess.span = 0.1,
  min.cutoff = 10,
  weight.mean = 0,
  bins = 1000,
  sample_per_bin = 50,
  random.seed = 1234,
  verbose = FALSE,
  ...
)

## S3 method for class 'data.frame'
FitMeanVar(
  object,
  loess.span = 0.1,
  weight.mean = 0,
  bins = 1000,
  sample_per_bin = 50,
  random.seed = 1234,
  verbose = FALSE,
  ...
)

Arguments

object

A Seurat object

...

Arguments passed to other methods

assay

Name of assay to use. If NULL, use the default assay.

layer

Name of layer to use. If NULL, use the default layer(s).

nfeatures

Number of features to selected as top variable features.

loess.span

span parameter passed to the stats::loess() function

min.cutoff

Minimum number of counts for a feature to be eligible for variable feature selection.

weight.mean

How much to weight the ranking of features according to their mean. Setting weight.mean=0 will rank features according to their residual variance only.

bins

Number of bins to use when downsampling features across the range of mean count values.

sample_per_bin

Number of features to select per mean count bin in feature downsampling step.

key

Key to use when storing the highly variable feature information in the assay.

verbose

Display messages.

random.seed

Random seed to set for sampling.

Details

This function is similar to the Seurat::FindVariableFeatures() function (with selection.method="vst"), but downsamples the features evenly across the range of mean values. This speeds up fitting of the loess curve when the number of features is large.

The function also provides the ability to combine ranking of features according to their mean count and their residual variance, using a weighted rank sum with weights set by the weight.mean parameter. This can help to avoid selecting features with high residual variance but very low mean.

Value

Returns a SeuratObject::Seurat() object

Examples

FitMeanVar(atac_small)
FitMeanVar(object = atac_small[["peaks"]])

Signac documentation built on April 1, 2026, 5:06 p.m.