scaleNotCenter | R Documentation |
This function scales normalized gene expression data after variable genes have been selected. We do not mean-center the data before scaling in order to address the non-negativity constraint of NMF. Computation applied to each normalized dataset matrix can form the following equation:
S_{i,j}=\frac{N_{i,j}}{\sqrt{\sum_{p}^{n}\frac{N_{i,p}^2}{n-1}}}
Where N
denotes the normalized matrix for an individual dataset,
S
is the output scaled matrix for this dataset, and n
is the
number of cells in this dataset. i, j
denotes the specific gene and
cell index, and p
is the cell iterator.
Please see detailed section below for explanation on methylation dataset.
scaleNotCenter(object, ...)
## S3 method for class 'dgCMatrix'
scaleNotCenter(object, ...)
## S3 method for class 'ligerDataset'
scaleNotCenter(
object,
features = NULL,
chunk = 1000,
verbose = getOption("ligerVerbose", TRUE),
...
)
## S3 method for class 'ligerMethDataset'
scaleNotCenter(
object,
features = NULL,
verbose = getOption("ligerVerbose", TRUE),
...
)
## S3 method for class 'liger'
scaleNotCenter(
object,
useDatasets = NULL,
features = varFeatures(object),
verbose = getOption("ligerVerbose", TRUE),
remove.missing = NULL,
...
)
## S3 method for class 'Seurat'
scaleNotCenter(
object,
assay = NULL,
layer = "ligerNormData",
save = "ligerScaleData",
datasetVar = "orig.ident",
features = NULL,
...
)
object |
liger object, ligerDataset object, dgCMatrix-class object, or a Seurat object. |
... |
Arguments passed to other methods. The order goes by: "liger" method calls "ligerDataset" method", which then calls "dgCMatrix" method. "Seurat" method directly calls "dgCMatrix" method. |
features |
Character, numeric or logical index that choose the variable
feature to be scaled. "liger" method by default uses
|
chunk |
Integer. Number of maximum number of cells in each chunk, when
scaling is applied to any HDF5 based dataset. Default |
verbose |
Logical. Whether to show information of the progress. Default
|
useDatasets |
A character vector of the names, a numeric or logical
vector of the index of the datasets to be scaled but not centered. Default
|
remove.missing |
Deprecated. The functionality of this is covered through other parts of the whole workflow and is no long needed. Will be ignored if specified. |
assay |
Name of assay to use. Default |
layer |
For Seurat>=4.9.9, the name of layer to retrieve normalized
data. Default |
save |
For Seurat>=4.9.9, the name of layer to store normalized data.
Default |
datasetVar |
Metadata variable name that stores the dataset source
annotation. Default |
Updated object
dgCMatrix method - Returns scaled dgCMatrix object
ligerDataset method - Updates the scaleData
and
scaledUnsharedData
(if unshared variable feature available) slot
of the object
liger method - Updates the scaleData
and
scaledUnsharedData
(if unshared variable feature available) slot
of chosen datasets
Seurat method - Adds a named layer in chosen assay (V5), or update the
scale.data
slot of the chosen assay (<=V4)
Because gene body mCH proportions are negatively correlated with gene
expression level in neurons, we need to reverse the direction of the
methylation data before performing the integration. We do this by simply
subtracting all values from the maximum methylation value. The resulting
values are positively correlated with gene expression. This will only be
applied to variable genes detected in prior. Please make sure that argument
modal
is set accordingly when running createLiger
. In
this way, this function can automatically detect it and take proper action.
If it is not set, users can still manually have the equivalent processing
done by doing scaleNotCenter(lig, useDataset = c("other", "datasets"))
,
and then reverseMethData(lig, useDataset = c("meth", "datasets"))
.
Since the scaling on genes is applied on a per dataset base, other scaling
methods that apply to a whole concatenated matrix of multiple datasets might
not be considered as equivalent alternatives, even if options like
center
are set to FALSE
. Hence we implemented an efficient
solution that works under such circumstance, provided with the Seurat S3
method.
pbmc <- normalize(pbmc)
pbmc <- selectGenes(pbmc)
pbmc <- scaleNotCenter(pbmc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.