See title ... came across this working on some PCA-related things:
library(scater)
sce <- mockSCE()
sce <- logNormCounts(sce)
sce <- runPCA(sce)
pca <- reducedDim(sce, "PCA")
rot <- attr(pca, "rotation")
class(rot) # matrix
sub <- sce[, -1]
pcb <- reducedDim(sub, "PCA")
rot <- attr(pcb, "rotation")
class(rot) # NULL
Now, I'm aware this is not a SCE-specific thing, i.e., plain matrix subsetting does the trick:
names(attributes(pca))
# "dim" "dimnames" "varExplained" "percentVar" "rotation"
names(attributes(pca[1, ]))
# "dim" "dimnames"
However, I still wonder whether our "core" class for handling such data could somehow retain this information better? E.g., with rotations gone, it's impossible for me to tell what features underly the PCs in the object, etc.
Any thoughts, suggestions, further discussion appreciated!
See title ... came across this working on some PCA-related things:
Now, I'm aware this is not a SCE-specific thing, i.e., plain matrix subsetting does the trick:
However, I still wonder whether our "core" class for handling such data could somehow retain this information better? E.g., with rotations gone, it's impossible for me to tell what features underly the PCs in the object, etc.
Any thoughts, suggestions, further discussion appreciated!