Run partial singular value decomposition using RSpectra::svds()
Usage
RunSVD(object, ...)
# Default S3 method
RunSVD(
object,
assay = NULL,
n = 50,
scale.embeddings = !pca,
pca = FALSE,
reduction.key = ifelse(pca, "PCA_", "LSI_"),
scale.max = NULL,
verbose = TRUE,
tol = 1e-05,
...
)
# S3 method for class 'Assay5'
RunSVD(
object,
assay = NULL,
layer = "data",
features = NULL,
pca = FALSE,
n = 50,
reduction.key = ifelse(pca, "PCA_", "LSI_"),
scale.max = NULL,
verbose = TRUE,
...
)
# S3 method for class 'Assay'
RunSVD(
object,
assay = NULL,
layer = "data",
features = NULL,
pca = FALSE,
n = 50,
reduction.key = ifelse(pca, "PCA_", "LSI_"),
scale.max = NULL,
verbose = TRUE,
...
)
# S3 method for class 'StdAssay'
RunSVD(
object,
assay = NULL,
layer = "data",
features = NULL,
pca = FALSE,
n = 50,
reduction.key = ifelse(pca, "PCA_", "LSI_"),
scale.max = NULL,
verbose = TRUE,
...
)
# S3 method for class 'Seurat'
RunSVD(
object,
assay = NULL,
features = NULL,
layer = "data",
n = 50,
pca = FALSE,
reduction.key = ifelse(pca, "PCA_", "LSI_"),
reduction.name = ifelse(pca, "pca", "lsi"),
scale.max = NULL,
verbose = TRUE,
...
)Arguments
- object
A Seurat object
- ...
Arguments passed to other methods
- assay
Which assay to use. If NULL, use the default assay
- n
Number of singular values to compute
- scale.embeddings
Scale cell embeddings within each component to mean 0 and SD 1 (default TRUE).
- pca
Run PCA. Setting this option to TRUE will perform implicit scaling and centering of the input matrix to enable memory-efficient computation of the principal components.
- reduction.key
Key for dimension reduction object
- scale.max
Clipping value for cell embeddings. Default (NULL) is no clipping.
- verbose
Print messages
- tol
Tolerance (tol) parameter for
RSpectra::svds(). Larger values speed up convergence due to greater amount of allowed error.- layer
Name of layer to use.
- features
Which features to use. If NULL, use variable features
- reduction.name
Name for stored dimension reduction object.
Value
Returns a SeuratObject::Seurat() object
Examples
x <- matrix(data = rnorm(100), ncol = 10)
RunSVD(x)
#> Running SVD
#> Scaling cell embeddings
#> Warning: No assay specified, setting assay as RNA by default.
#> Warning: Requested number is larger than the number of available items (10). Setting to 10.
#> LSI_ 1
#> Positive: 8, 3, 6, 7, 2
#> Negative: 5, 1, 10, 9, 4
#> Warning: Requested number is larger than the number of available items (10). Setting to 10.
#> LSI_ 2
#> Positive: 4, 2, 10, 7, 9
#> Negative: 5, 8, 6, 3, 1
#> Warning: Requested number is larger than the number of available items (10). Setting to 10.
#> LSI_ 3
#> Positive: 9, 7, 10, 8, 4
#> Negative: 2, 6, 1, 5, 3
#> Warning: Requested number is larger than the number of available items (10). Setting to 10.
#> LSI_ 4
#> Positive: 6, 7, 10, 5, 3
#> Negative: 1, 8, 2, 9, 4
#> Warning: Requested number is larger than the number of available items (10). Setting to 10.
#> LSI_ 5
#> Positive: 6, 10, 9, 1, 4
#> Negative: 7, 2, 5, 3, 8
RunSVD(atac_small[["peaks"]], features = rownames(atac_small))
#> Warning: The following 10 features requested have zero variance; running reduction without them: chr1:191183-192084, chr1:270850-271755, chr1:273946-274792, chr1:854732-855551, chr1:877256-878073, chr1:897006-897867, chr1:1103886-1104761, chr1:1107314-1108235, chr1:1140665-1141034, chr1:1259851-1260705
#> Running SVD
#> Scaling cell embeddings
#> Warning: No assay specified, setting assay as RNA by default.
#> LSI_ 1
#> Positive: chr1:1307720-1308738, chr1:1115790-1116694, chr1:1231645-1232553, chr1:778263-779184, chr1:1012999-1013896, chr1:1273489-1274375, chr1:1068591-1069593, chr1:958863-959759, chr1:1032718-1033630, chr1:1019089-1019953
#> chr1:827056-827941, chr1:904344-905188, chr1:1121854-1122751, chr1:1305198-1306109, chr1:869458-870366, chr1:1040389-1041273, chr1:1157456-1158077, chr1:1201061-1201938, chr1:1059203-1060060, chr1:1063699-1064592
#> Negative: chr1:1106514-1107086, chr1:825323-825997, chr1:267576-268461, chr1:1008923-1009812, chr1:1222590-1223380, chr1:1174988-1175803, chr1:1027807-1028323, chr1:865460-866306, chr1:993329-994164, chr1:890356-891196
#> chr1:629538-630397, chr1:1165728-1166624, chr1:856152-857041, chr1:181200-181607, chr1:935093-935954, chr1:1246286-1247224, chr1:9772-10660, chr1:605079-605959, chr1:180712-181178, chr1:1287495-1288325
#> LSI_ 2
#> Positive: chr1:827056-827941, chr1:1063699-1064592, chr1:1019089-1019953, chr1:999740-1000366, chr1:1098941-1099797, chr1:1000488-1001217, chr1:1307720-1308738, chr1:1212684-1213459, chr1:1231645-1232553, chr1:1173370-1174285
#> chr1:1188896-1189774, chr1:983865-984750, chr1:1157456-1158077, chr1:1289933-1290836, chr1:906494-907390, chr1:1092669-1093579, chr1:816878-817773, chr1:1001698-1002476, chr1:1305198-1306109, chr1:923353-924170
#> Negative: chr1:1273489-1274375, chr1:1201061-1201938, chr1:869458-870366, chr1:1115790-1116694, chr1:1250624-1251529, chr1:1207866-1208674, chr1:1121854-1122751, chr1:778263-779184, chr1:1004753-1005628, chr1:966548-967354
#> chr1:975761-976723, chr1:1264764-1265656, chr1:1165728-1166624, chr1:998676-999441, chr1:1221668-1222458, chr1:1012999-1013896, chr1:633579-634474, chr1:860139-860923, chr1:629538-630397, chr1:890356-891196
#> LSI_ 3
#> Positive: chr1:1157456-1158077, chr1:1305198-1306109, chr1:778263-779184, chr1:1079455-1080338, chr1:1038451-1039304, chr1:1121854-1122751, chr1:923353-924170, chr1:1032718-1033630, chr1:1231645-1232553, chr1:998676-999441
#> chr1:827056-827941, chr1:1207866-1208674, chr1:955190-956101, chr1:983865-984750, chr1:1208906-1209549, chr1:958863-959759, chr1:1137049-1137873, chr1:1273489-1274375, chr1:1221668-1222458, chr1:1188896-1189774
#> Negative: chr1:1068591-1069593, chr1:904344-905188, chr1:1173370-1174285, chr1:1098941-1099797, chr1:1115790-1116694, chr1:960325-961048, chr1:1212684-1213459, chr1:966548-967354, chr1:1143866-1144747, chr1:1287495-1288325
#> chr1:1250624-1251529, chr1:1206183-1207065, chr1:999740-1000366, chr1:1063699-1064592, chr1:1216631-1217510, chr1:1008923-1009812, chr1:856152-857041, chr1:1264764-1265656, chr1:995556-996375, chr1:1000488-1001217
#> LSI_ 4
#> Positive: chr1:1040389-1041273, chr1:1059203-1060060, chr1:869458-870366, chr1:1201061-1201938, chr1:999740-1000366, chr1:1143866-1144747, chr1:960325-961048, chr1:1231645-1232553, chr1:983865-984750, chr1:633579-634474
#> chr1:1032718-1033630, chr1:1305198-1306109, chr1:1000488-1001217, chr1:940016-940932, chr1:958863-959759, chr1:920759-921626, chr1:998676-999441, chr1:1299784-1300670, chr1:1222590-1223380, chr1:1261037-1261825
#> Negative: chr1:1012999-1013896, chr1:778263-779184, chr1:1121854-1122751, chr1:1173370-1174285, chr1:966548-967354, chr1:1250624-1251529, chr1:1307720-1308738, chr1:1019089-1019953, chr1:1157456-1158077, chr1:923353-924170
#> chr1:1273489-1274375, chr1:1206183-1207065, chr1:1137049-1137873, chr1:1001698-1002476, chr1:816878-817773, chr1:827056-827941, chr1:1068591-1069593, chr1:1287495-1288325, chr1:1216631-1217510, chr1:1264764-1265656
#> LSI_ 5
#> Positive: chr1:958863-959759, chr1:1012999-1013896, chr1:1001698-1002476, chr1:1059203-1060060, chr1:1032718-1033630, chr1:1000488-1001217, chr1:998676-999441, chr1:1019089-1019953, chr1:966548-967354, chr1:983865-984750
#> chr1:816878-817773, chr1:1208906-1209549, chr1:1201061-1201938, chr1:860139-860923, chr1:1098941-1099797, chr1:1221668-1222458, chr1:1174988-1175803, chr1:1106514-1107086, chr1:935093-935954, chr1:1027807-1028323
#> Negative: chr1:1040389-1041273, chr1:1231645-1232553, chr1:1121854-1122751, chr1:1250624-1251529, chr1:1157456-1158077, chr1:1068591-1069593, chr1:940016-940932, chr1:975761-976723, chr1:633579-634474, chr1:1079455-1080338
#> chr1:1004753-1005628, chr1:923353-924170, chr1:1173370-1174285, chr1:925410-926122, chr1:1038451-1039304, chr1:906494-907390, chr1:869458-870366, chr1:1291564-1292473, chr1:1299784-1300670, chr1:827056-827941
RunSVD(atac_small[["peaks"]], features = rownames(atac_small))
#> Warning: The following 10 features requested have zero variance; running reduction without them: chr1:191183-192084, chr1:270850-271755, chr1:273946-274792, chr1:854732-855551, chr1:877256-878073, chr1:897006-897867, chr1:1103886-1104761, chr1:1107314-1108235, chr1:1140665-1141034, chr1:1259851-1260705
#> Running SVD
#> Scaling cell embeddings
#> Warning: No assay specified, setting assay as RNA by default.
#> LSI_ 1
#> Positive: chr1:1307720-1308738, chr1:1115790-1116694, chr1:1231645-1232553, chr1:778263-779184, chr1:1012999-1013896, chr1:1273489-1274375, chr1:1068591-1069593, chr1:958863-959759, chr1:1032718-1033630, chr1:1019089-1019953
#> chr1:827056-827941, chr1:904344-905188, chr1:1121854-1122751, chr1:1305198-1306109, chr1:869458-870366, chr1:1040389-1041273, chr1:1157456-1158077, chr1:1201061-1201938, chr1:1059203-1060060, chr1:1063699-1064592
#> Negative: chr1:1106514-1107086, chr1:825323-825997, chr1:267576-268461, chr1:1008923-1009812, chr1:1222590-1223380, chr1:1174988-1175803, chr1:1027807-1028323, chr1:865460-866306, chr1:993329-994164, chr1:890356-891196
#> chr1:629538-630397, chr1:1165728-1166624, chr1:856152-857041, chr1:181200-181607, chr1:935093-935954, chr1:1246286-1247224, chr1:9772-10660, chr1:605079-605959, chr1:180712-181178, chr1:1287495-1288325
#> LSI_ 2
#> Positive: chr1:827056-827941, chr1:1063699-1064592, chr1:1019089-1019953, chr1:999740-1000366, chr1:1098941-1099797, chr1:1000488-1001217, chr1:1307720-1308738, chr1:1212684-1213459, chr1:1231645-1232553, chr1:1173370-1174285
#> chr1:1188896-1189774, chr1:983865-984750, chr1:1157456-1158077, chr1:1289933-1290836, chr1:906494-907390, chr1:1092669-1093579, chr1:816878-817773, chr1:1001698-1002476, chr1:1305198-1306109, chr1:923353-924170
#> Negative: chr1:1273489-1274375, chr1:1201061-1201938, chr1:869458-870366, chr1:1115790-1116694, chr1:1250624-1251529, chr1:1207866-1208674, chr1:1121854-1122751, chr1:778263-779184, chr1:1004753-1005628, chr1:966548-967354
#> chr1:975761-976723, chr1:1264764-1265656, chr1:1165728-1166624, chr1:998676-999441, chr1:1221668-1222458, chr1:1012999-1013896, chr1:633579-634474, chr1:860139-860923, chr1:629538-630397, chr1:890356-891196
#> LSI_ 3
#> Positive: chr1:1157456-1158077, chr1:1305198-1306109, chr1:778263-779184, chr1:1079455-1080338, chr1:1038451-1039304, chr1:1121854-1122751, chr1:923353-924170, chr1:1032718-1033630, chr1:1231645-1232553, chr1:998676-999441
#> chr1:827056-827941, chr1:1207866-1208674, chr1:955190-956101, chr1:983865-984750, chr1:1208906-1209549, chr1:958863-959759, chr1:1137049-1137873, chr1:1273489-1274375, chr1:1221668-1222458, chr1:1188896-1189774
#> Negative: chr1:1068591-1069593, chr1:904344-905188, chr1:1173370-1174285, chr1:1098941-1099797, chr1:1115790-1116694, chr1:960325-961048, chr1:1212684-1213459, chr1:966548-967354, chr1:1143866-1144747, chr1:1287495-1288325
#> chr1:1250624-1251529, chr1:1206183-1207065, chr1:999740-1000366, chr1:1063699-1064592, chr1:1216631-1217510, chr1:1008923-1009812, chr1:856152-857041, chr1:1264764-1265656, chr1:995556-996375, chr1:1000488-1001217
#> LSI_ 4
#> Positive: chr1:1040389-1041273, chr1:1059203-1060060, chr1:869458-870366, chr1:1201061-1201938, chr1:999740-1000366, chr1:1143866-1144747, chr1:960325-961048, chr1:1231645-1232553, chr1:983865-984750, chr1:633579-634474
#> chr1:1032718-1033630, chr1:1305198-1306109, chr1:1000488-1001217, chr1:940016-940932, chr1:958863-959759, chr1:920759-921626, chr1:998676-999441, chr1:1299784-1300670, chr1:1222590-1223380, chr1:1261037-1261825
#> Negative: chr1:1012999-1013896, chr1:778263-779184, chr1:1121854-1122751, chr1:1173370-1174285, chr1:966548-967354, chr1:1250624-1251529, chr1:1307720-1308738, chr1:1019089-1019953, chr1:1157456-1158077, chr1:923353-924170
#> chr1:1273489-1274375, chr1:1206183-1207065, chr1:1137049-1137873, chr1:1001698-1002476, chr1:816878-817773, chr1:827056-827941, chr1:1068591-1069593, chr1:1287495-1288325, chr1:1216631-1217510, chr1:1264764-1265656
#> LSI_ 5
#> Positive: chr1:958863-959759, chr1:1012999-1013896, chr1:1001698-1002476, chr1:1059203-1060060, chr1:1032718-1033630, chr1:1000488-1001217, chr1:998676-999441, chr1:1019089-1019953, chr1:966548-967354, chr1:983865-984750
#> chr1:816878-817773, chr1:1208906-1209549, chr1:1201061-1201938, chr1:860139-860923, chr1:1098941-1099797, chr1:1221668-1222458, chr1:1174988-1175803, chr1:1106514-1107086, chr1:935093-935954, chr1:1027807-1028323
#> Negative: chr1:1040389-1041273, chr1:1231645-1232553, chr1:1121854-1122751, chr1:1250624-1251529, chr1:1157456-1158077, chr1:1068591-1069593, chr1:940016-940932, chr1:975761-976723, chr1:633579-634474, chr1:1079455-1080338
#> chr1:1004753-1005628, chr1:923353-924170, chr1:1173370-1174285, chr1:925410-926122, chr1:1038451-1039304, chr1:906494-907390, chr1:869458-870366, chr1:1291564-1292473, chr1:1299784-1300670, chr1:827056-827941
RunSVD(atac_small, features = rownames(atac_small))
#> Warning: The following 10 features requested have zero variance; running reduction without them: chr1:191183-192084, chr1:270850-271755, chr1:273946-274792, chr1:854732-855551, chr1:877256-878073, chr1:897006-897867, chr1:1103886-1104761, chr1:1107314-1108235, chr1:1140665-1141034, chr1:1259851-1260705
#> Running SVD
#> Scaling cell embeddings
#> An object of class Seurat
#> 150 features across 100 samples within 2 assays
#> Active assay: peaks (100 features, 0 variable features)
#> 2 layers present: counts, data
#> 1 other assay present: RNA
#> 2 dimensional reductions calculated: lsi, umap