Skip to contents

Find the top features for a given assay based on analytic Pearson residual variance. This function computes the Pearson residual variance for each feature without constructing the entire dense matrix of Pearson residuals to reduce the memory required.

Usage

PearsonResidualVar(object, ...)

# Default S3 method
PearsonResidualVar(
  object,
  assay = NULL,
  nfeatures = 20000,
  min.counts = 100,
  ncell.batch = 100,
  theta = 10,
  weight.mean = 0,
  verbose = TRUE,
  ...
)

# S3 method for class 'Assay5'
PearsonResidualVar(
  object,
  assay = NULL,
  nfeatures = 20000,
  theta = 10,
  min.counts = 100,
  weight.mean = 0,
  ncell.batch = 100,
  key = "pearson",
  verbose = TRUE,
  ...
)

# S3 method for class 'StdAssay'
PearsonResidualVar(
  object,
  assay = NULL,
  min.counts = 100,
  weight.mean = 0,
  theta = 10,
  ncell.batch = 100,
  key = "pearson",
  verbose = TRUE,
  ...
)

# S3 method for class 'Seurat'
PearsonResidualVar(
  object,
  assay = NULL,
  min.counts = 100,
  weight.mean = 0.5,
  theta = 10,
  ncell.batch = 100,
  key = "pearson",
  verbose = TRUE,
  ...
)

Arguments

object

A Seurat object

...

Arguments passed to other methods

assay

Name of assay to use

nfeatures

Number of top features to set as the variable features

min.counts

Minimum number of counts for feature to be eligible for variable features

ncell.batch

Number of cells to process in each batch. Higher number increases speed but uses more memory.

theta

Theta value for analytic Pearson residual calculation

weight.mean

Weighting to apply to the feature mean relative to the Pearson residual variance for ranking features. weight.mean=0 will rank features based on the Pearson residual variance only.

verbose

Display messages

key

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

Value

Returns a SeuratObject::Seurat() object

References

Lause, J., Berens, P. & Kobak, D. Analytic Pearson residuals for normalization of single-cell RNA-seq UMI data. Genome Biol 22, 258 (2021). https://doi.org/10.1186/s13059-021-02451-7

Examples

PearsonResidualVar(object = atac_small[["peaks"]]["counts"])
#> Retaining 90 features with mean greater than zero
#>                      count mean ResidualVariance rank
#> chr1:9772-10660          2 0.02         1.018171 80.5
#> chr1:180712-181178       2 0.02         1.018171 80.5
#> chr1:181200-181607       2 0.02         1.018171 80.5
#> chr1:191183-192084       0 0.00         0.000000 95.5
#> chr1:267576-268461       2 0.02         1.018171 80.5
#> chr1:270850-271755       0 0.00         0.000000 95.5
#> chr1:273946-274792       0 0.00         0.000000 95.5
#> chr1:585753-586648       6 0.06         1.928429 37.5
#> chr1:605079-605959       2 0.02         1.018171 80.5
#> chr1:629538-630397       2 0.02         1.018171 80.5
#> chr1:633579-634474      14 0.14         1.834320 44.5
#> chr1:778263-779184     224 2.24         2.284080 17.0
#> chr1:816878-817773      28 0.28         2.784880  4.0
#> chr1:825323-825997       2 0.02         1.018171 80.5
#> chr1:827056-827941      82 0.82         1.902078 41.0
#> chr1:844135-844989       6 0.06         1.928429 37.5
#> chr1:854732-855551       0 0.00         0.000000 95.5
#> chr1:856152-857041       2 0.02         1.018171 80.5
#> chr1:857907-858672      14 0.14         1.834320 44.5
#> chr1:860139-860923       3 0.03         1.341823 68.5
#> chr1:865460-866306       2 0.02         1.018171 80.5
#> chr1:869458-870366      62 0.62         2.058806 25.0
#> chr1:876322-877105       3 0.03         1.341823 68.5
#> chr1:877256-878073       0 0.00         0.000000 95.5
#> chr1:890356-891196       2 0.02         1.018171 80.5
#> chr1:897006-897867       0 0.00         0.000000 95.5
#> chr1:898350-899223       3 0.03         1.341823 68.5
#> chr1:904344-905188      61 0.61         1.727260 55.0
#> chr1:906494-907390      18 0.18         2.660991  8.0
#> chr1:912460-913353       6 0.06         1.928429 37.5
#> chr1:920759-921626       7 0.07         1.774720 50.0
#> chr1:923353-924170      14 0.14         2.207405 19.0
#> chr1:925410-926122       3 0.03         1.341823 68.5
#> chr1:935093-935954       1 0.01         0.989011 88.5
#> chr1:940016-940932      13 0.13         1.618194 59.0
#> chr1:943054-943636       5 0.05         1.741294 53.5
#> chr1:955190-956101       4 0.04         1.952191 33.5
#> chr1:958863-959759     109 1.09         1.755363 52.0
#> chr1:960325-961048      26 0.26         2.370670 14.0
#> chr1:966548-967354      35 0.35         2.726018  6.0
#> chr1:975761-976723      26 0.26         1.995801 29.0
#> chr1:983865-984750      28 0.28         1.673152 57.0
#> chr1:993329-994164       1 0.01         0.989011 88.5
#> chr1:995556-996375       8 0.08         1.989823 30.5
#> chr1:998676-999441      15 0.15         1.756979 51.0
#> chr1:999740-1000366     20 0.20         1.568627 64.0
#> chr1:1000488-1001217    31 0.31         1.670473 58.0
#> chr1:1001698-1002476    34 0.34         1.605416 61.0
#> chr1:1004753-1005628    12 0.12         1.857708 43.0
#> chr1:1008923-1009812     2 0.02         1.018171 80.5
#> chr1:1012999-1013896   145 1.45         1.691010 56.0
#> chr1:1019089-1019953    87 0.87         3.629736  1.0
#> chr1:1027807-1028323     1 0.01         0.989011 88.5
#> chr1:1032718-1033630    80 0.80         2.314815 15.0
#> chr1:1038451-1039304    15 0.15         2.545156 12.0
#> chr1:1040389-1041273    62 0.62         2.514428 13.0
#> chr1:1059203-1060060    48 0.48         2.285305 16.0
#> chr1:1063699-1064592    52 0.52         2.576777 10.0
#> chr1:1068591-1069593   136 1.36         2.013256 28.0
#> chr1:1079455-1080338    25 0.25         1.980488 32.0
#> chr1:1092669-1093579     3 0.03         1.341823 68.5
#> chr1:1098941-1099797    49 0.49         2.976401  3.0
#> chr1:1103886-1104761     0 0.00         0.000000 95.5
#> chr1:1106514-1107086     4 0.04         1.029915 74.0
#> chr1:1107314-1108235     0 0.00         0.000000 95.5
#> chr1:1115790-1116694   264 2.64         2.160769 21.0
#> chr1:1121854-1122751    65 0.65         2.033225 27.0
#> chr1:1136258-1136912     5 0.05         1.804474 48.5
#> chr1:1137049-1137873    19 0.19         2.551005 11.0
#> chr1:1140665-1141034     0 0.00         0.000000 95.5
#> chr1:1143866-1144747    24 0.24         2.670571  7.0
#> chr1:1157456-1158077    36 0.36         1.583012 63.0
#> chr1:1165728-1166624     2 0.02         1.018171 80.5
#> chr1:1171563-1172488     5 0.05         1.741294 53.5
#> chr1:1173370-1174285    27 0.27         2.081215 24.0
#> chr1:1174988-1175803     1 0.01         0.989011 88.5
#> chr1:1188896-1189774     4 0.04         1.952191 33.5
#> chr1:1201061-1201938    57 0.57         3.029262  2.0
#> chr1:1206183-1207065     7 0.07         2.124180 23.0
#> chr1:1207866-1208674    25 0.25         2.136585 22.0
#> chr1:1208906-1209549    10 0.10         2.166811 20.0
#> chr1:1212684-1213459    41 0.41         2.581711  9.0
#> chr1:1216631-1217510    19 0.19         2.769135  5.0
#> chr1:1219105-1219995     7 0.07         1.589210 62.0
#> chr1:1221668-1222458     6 0.06         1.928429 37.5
#> chr1:1222590-1223380     6 0.06         1.038946 73.0
#> chr1:1231645-1232553   214 2.14         2.055613 26.0
#> chr1:1246286-1247224     3 0.03         1.341823 68.5
#> chr1:1250624-1251529    34 0.34         1.832973 46.0
#> chr1:1259851-1260705     0 0.00         0.000000 95.5
#> chr1:1261037-1261825     3 0.03         1.341823 68.5
#> chr1:1264764-1265656     6 0.06         1.928429 37.5
#> chr1:1273489-1274375   118 1.18         1.612747 60.0
#> chr1:1287495-1288325     5 0.05         1.804474 48.5
#> chr1:1289933-1290836     8 0.08         1.989823 30.5
#> chr1:1291564-1292473    10 0.10         1.881188 42.0
#> chr1:1299784-1300670     3 0.03         1.341823 68.5
#> chr1:1301689-1302543     6 0.06         1.928429 37.5
#> chr1:1305198-1306109    59 0.59         1.827596 47.0
#> chr1:1307720-1308738   261 2.61         2.223468 18.0
PearsonResidualVar(object = atac_small[["peaks"]])
#> Finding variable features for layer counts
#> Retaining 90 features with mean greater than zero
#> GRangesAssay data with 100 features for 100 cells
#> Variable features: 100 
#> Annotation present: TRUE 
#> Fragment files: 0 
#> Motifs present: TRUE 
#> Links present: 0 
#> Region aggregation matrices: 0
PearsonResidualVar(object = atac_small[["peaks"]])
#> Finding variable features for layer counts
#> Retaining 90 features with mean greater than zero
#> GRangesAssay data with 100 features for 100 cells
#> Variable features: 100 
#> Annotation present: TRUE 
#> Fragment files: 0 
#> Motifs present: TRUE 
#> Links present: 0 
#> Region aggregation matrices: 0
PearsonResidualVar(atac_small)
#> Finding variable features for layer counts
#> Retaining 90 features with mean greater than zero
#> An object of class Seurat 
#> 150 features across 100 samples within 2 assays 
#> Active assay: peaks (100 features, 100 variable features)
#>  2 layers present: counts, data
#>  1 other assay present: RNA
#>  2 dimensional reductions calculated: lsi, umap