reduceDims: Reduce dimensions of residual matrix

View source: R/reduce_dimensions.R

reduceDimsR Documentation

Reduce dimensions of residual matrix

Description

Run SVD on Pearson residuals using IRLBA.

Usage

reduceDims(
  obj,
  method = "SVD",
  n.pcs = 50,
  scaleVar = T,
  num.var = 5000,
  regNum = 5000,
  cor.max = 0.75,
  doL2 = F,
  doL1 = F,
  doSTD = T,
  refit_residuals = F,
  residuals_slotName = "residuals",
  svd_slotName = "PCA",
  verbose = FALSE,
  ...
)

Arguments

obj

list, object containing "pearson_residuals" output by the function regModel.

method

character, string denoting dimension reduction method. Can be one of "SVD" or "NMF". Defaults to SVD.

n.pcs

numeric, number of singular values to calculate.

regNum

number of peaks/bins to use for regularization. regNum must be equal or less than num.vars. Defaults to 5000.

cor.max

float, maximum spearman correlation between log10nSites (log10 number of accessible peaks) and singular value to keep. Singular values with correlations greater than cor.max are removed. Ranges from 0 to 1. Default set to 0.75.

doL2

logical, whether or not to L2 normalize barcodes.

doL1

logical, whether or not to L1 normalize barcodes

refit_residuals

logical, whether or not to use quasibinomial logistic regression residuals for num.vars features. Only applicable when num.vars < nrow(obj$counts) and when the normalization was performed with tfidf. Defaults to FALSE.

residuals_slotName

character, character string of the desired residual slotName. Defaults to "residuals".

svd_slotName

character, character string for naming the SVD output in the returned object. Defaults to "PCA".

verbose

logical. Defaults to FALSE.

...

Additional arguments to be passed to RcppML::nmf

scaleVars

logical, whether or not to scale PCs by variance explained (or to scale NMF components by scale factors). Default to TRUE.

num.vars

number of highly variable ACRs/bins to use for dimensionality reduction. Variance is stabilized using loess regression between the feature variance and mean. Defaults to 5000. Set to NULL to use all ACRs/bins. To select features above a specific stabilized variance value, set num.var to a numeric value less than 100. In all cases, Socrates will take a minimum of 100 features to perform dimensionality reduction.

stdLSI

logical, whether or not to standardize barcodes.


plantformatics/Socrates documentation built on April 3, 2025, 1:02 p.m.