# Get assay data from the default assay in a Seurat object
GetAssayData(object = pbmc_small, layer = "data")[1:5,1:5]
# Set an Assay layer through the Seurat object
count.data <- GetAssayData(object = pbmc_small[["RNA"]], layer = "counts")
count.data <- as.matrix(x = count.data + 1)
new.seurat.object <- SetAssayData(
object = pbmc_small,
layer = "counts",
new.data = count.data,
assay = "RNA"
)
# Get the data directly from an Assay object
GetAssayData(pbmc_small[["RNA"]], layer = "data")[1:5,1:5]
# Set an Assay layer directly
count.data <- GetAssayData(pbmc_small[["RNA"]], layer = "counts")
count.data <- as.matrix(x = count.data + 1)
new.assay <- SetAssayData(pbmc_small[["RNA"]], layer = "counts", new.data = count.data)
Run the code above in your browser using DataLab