View source: R/addDimReduction.R
addDimReduction | R Documentation |
Add any dimensionality reduction space to a SingleCellExperiment object containing bulk or single-cell data
addDimReduction(object, embeddings, name, key = .gen_key(name))
object |
the bulk or single-cell |
embeddings |
a numeric matrix or matrix-like object, with number of rows equal to ncol(object), containing the coordinates of all cells / samples within the dimensionality reduction space. |
name |
String name for the reduction slot. Example: "pca".
This will become the name of the slot, and what should be provided to the |
key |
String, like "PC", which sets the default axes-label prefix when this reduction is used for making a |
Outputs a SingleCellExperiment
object with an added or replaced dimensionality reduction slot.
Daniel Bunis
addPrcomp
for a prcomp specific PCA import wrapper
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
# NOTE: This is typically not done with all genes in the 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.
embeds <- prcomp(t(logcounts(myRNA)), center = TRUE, scale = TRUE)$x
myRNA <- addDimReduction(
object = myRNA,
embeddings = embeds,
name = "pca",
key = "PC")
# Visualize conditions metadata on a PCA plot
dittoDimPlot(myRNA, "conditions", reduction.use = "pca", size = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.