| addPrcomp {dittoSeq} | R Documentation |
Add a prcomp pca calculation to a SingleCellExperiment object containing bulk or single-cell data
addPrcomp(object, prcomp, name = "pca", key = "PC")
object |
the |
prcomp |
a prcomp output which will be added to the |
name |
String name for the reduction slot.
Normally, this will be "pca", but you can hold any number of PCA calculations so long as a unique |
key |
String, like "PC", which sets the default axes-label prefix when this reduction is used for making a |
Outputs an SingleCellExperiment object with an added or replaced pca reduction slot.
Daniel Bunis
addDimReduction for adding other types of dimensionality reductions
importDittoBulk for initial import of bulk RNAseq data into dittoSeq as a SingleCellExperiment.
dittoDimPlot for visualizing how samples group within added dimensionality reduction spaces
example("importDittoBulk", echo = FALSE)
# Calculate PCA with prcomp
# NOTE: This is typically not done with all genes in a dataset.
# The inclusion of this example code is not an endorsement of a particular
# method of PCA. Consult yourself, a bioinformatician, or literature for
# tips on proper techniques.
calc <- prcomp(t(logcounts(myRNA)), center = TRUE, scale = TRUE)
myRNA <- addPrcomp(
object = myRNA,
prcomp = calc)
# Now we can visualize conditions metadata on a PCA plot
dittoDimPlot(myRNA, "conditions", reduction.use = "pca", size = 3)