Set PCA variances

pcaVariances(x, ...) <- value

Arguments

x

SCtkE object

...

other parameters

value

PCA variances DataFrame()

Value

A SCtkExperiment object with the pcaVariances slot set.

Examples

data("mouseBrainSubsetSCE") pcaVariances(mouseBrainSubsetSCE)
#> DataFrame with 30 rows and 1 column #> percentVar #> <numeric> #> PC1 0.376778280679595 #> PC2 0.0875963271424538 #> PC3 0.0569427048789942 #> PC4 0.0351617720708411 #> PC5 0.0325555270275067 #> ... ... #> PC26 0.0115455313977834 #> PC27 0.010417876363479 #> PC28 0.00964415338175974 #> PC29 0.00895702448717734 #> PC30 7.43064138911304e-32
#getPCA() sets the pcaVariances newSCE <- getPCA(mouseBrainSubsetSCE, useAssay = "counts") #alternatively, set the pcaVariances directly pca <- prcomp(assay(mouseBrainSubsetSCE, "logcounts")) percentVar <- pca$sdev ^ 2 / sum(pca$sdev ^ 2) pcaVariances(mouseBrainSubsetSCE) <- DataFrame(percentVar)