Error in GetAssayData():
! GetAssayData doesn't work for multiple layers in v5 assay.
Run rlang::last_trace() to see where the error occurred.
rlang::last_trace()
<error/ You can run 'object <- JoinLayers(object = object, layers = layer)'.>
Error in GetAssayData():
! GetAssayData doesn't work for multiple layers in v5 assay.
p1d0 <- Read10X("P1-d0") # Replace 'path_to_dataset1' with the path to your first dataset
p2d0 <- Read10X("P2_d0") # Replace 'path_to_dataset1' with the path to your first dataset
Hello,
I am facing problems when assigning cell types using celldex::ImmGenData()
Console
Error in
GetAssayData()
: ! GetAssayData doesn't work for multiple layers in v5 assay. Runrlang::last_trace()
to see where the error occurred.Backtrace: ▆
This were the commands
library(dplyr) library(Seurat) library(patchwork) library(SingleR) library(celldex)
directory <- getwd() dir(directory)
p1d0 <- Read10X("P1-d0") # Replace 'path_to_dataset1' with the path to your first dataset p2d0 <- Read10X("P2_d0") # Replace 'path_to_dataset1' with the path to your first dataset
celldex p1d0 <- CreateSeuratObject(p1d0, project = "p1d0") p2d0 <- CreateSeuratObject(p2d0, project = "p2d0")
add metadata
p1d0$type = "p1d0" p2d0$type = "p2d0"
The [[ operator can add columns to object metadata. This is a great place to stash QC stats
p1d0[["percent.mt"]] <- PercentageFeatureSet(p1d0, pattern = "^MT-") p2d0[["percent.mt"]] <- PercentageFeatureSet(p2d0, pattern = "^MT-")
Visualize QC metrics as a violin plot
VlnPlot(p1d0, features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), ncol = 3)
VlnPlot(p2d0, features = c("nFeature_RNA", "nCount_RNA", "percent.mt"), ncol = 3)
p1d0 <- subset(p1d0, subset = nFeature_RNA > 200 & nFeature_RNA < 2500 & percent.mt < 5) p2d0 <- subset(p2d0, subset = nFeature_RNA > 200 & nFeature_RNA < 2500 & percent.mt < 5)
Merge datasets into one single seurat object
alldata <- merge(p1d0, c(p2d0), add.cell.ids = c("p1d0", "p2d0")) alldata <- NormalizeData(alldata) alldata <- FindVariableFeatures(alldata) alldata <- ScaleData(alldata) alldata <- RunPCA(alldata, npcs = 30, verbose = FALSE) alldata <- RunUMAP(alldata , reduction = "pca", dims = 1:30) alldata <- FindNeighbors(alldata, reduction = "pca", dims = 1:30) alldata <- FindClusters(alldata, resolution = 0.5)
View(alldata@meta.data)
DimPlot(alldata, reduction = "umap", label=TRUE)
ref <- celldex::ImmGenData()
pred <- SingleR(test = as.SingleCellExperiment(alldata), ref = ref, labels = ref$label.main)
Please post issues in https://github.com/LTLA/SingleR