Entering edit mode
2.1 years ago
shweta.johari13
▴
30
Hello,
I am receiving the follow error:
cds <- as.cell_data_set(b.seu)
Warning: Monocle 3 trajectories require cluster partitions, which Seurat does not calculate. Please run 'cluster_cells' on your cell_data_set object.
library(Seurat)
library(patchwork)
library(SeuratWrappers)
library(ggplot2)
library(tidyverse)
control = Read10X("C:/Users/TVIT1/Desktop/imtegrationsdj_Tuall/Tu1_099")
inhibitor = Read10X("C:/Users/TVIT1/Desktop/imtegrationsdj_Tuall/Tu2_099")
dnavaccine = Read10X("C:/Users/TVIT1/Desktop/imtegrationsdj_Tuall/Tu3_099")
combitr = Read10X("C:/Users/TVIT1/Desktop/imtegrationsdj_Tuall/Tu4_099")
Created the Seurat Object:
control_seurat = CreateSeuratObject(counts = control$Gene Expression,
project = "control")
inhibitor_seurat = CreateSeuratObject(counts = inhibitor$Gene
Expression, project = "inhibitor")
dnavaccine_seurat = CreateSeuratObject(counts = dnavaccine$Gene
Expression, project = "dnavaccine")
combitr_seurat = CreateSeuratObject(counts = combitr$Gene Expression,
project = "combitr")
Merged the datasets
merge_seurat = merge(x = control_seurat, y = c(inhibitor_seurat,
dnavaccine_seurat, combitr_seurat), add.cell.id = c("control",
"inhibitor","dnavaccine", "combitr"))
head(merge_seurat@meta.data,5)
Filtering the mitochondrial genes
merge_seurat$mitoRatio <- PercentageFeatureSet(object = merge_seurat,
pattern = "^mt-")
metadata <- merge_seurat@meta.data
metadata$cells <- rownames(metadata)
library(dplyr)
metadata <- metadata %>%
dplyr::rename(group = orig.ident,
nUMI = nCount_RNA,
nGene = nFeature_RNA)
library(stringr)
metadata$sample <- NA
metadata$sample[which(str_detect(metadata$cells, "^control_"))] <- "control"
metadata$sample[which(str_detect(metadata$cells, "^inhibitor_"))] <- "inhibitor"
metadata$sample[which(str_detect(metadata$cells, "^dnavaccine_"))] <-
"dnavaccine"
metadata$sample[which(str_detect(metadata$cells, "^combitr_"))] <- "combitr"
merge_seurat@meta.data <- metadata
head(merge_seurat@meta.data,5)
tail(merge_seurat@meta.data,5)
data.list <- SplitObject(merge_seurat, split.by = "sample")
data.list <- lapply(X = data.list, FUN = function(x) {
x <- NormalizeData(x)
x <- FindVariableFeatures(x, selection.method = "vst")
})
Integration of datasets
features <- SelectIntegrationFeatures(object.list = data.list)
immune.anchors <- FindIntegrationAnchors(object.list = data.list,
anchor.features = features)
immune.combined <- IntegrateData(anchorset = immune.anchors)
DefaultAssay(immune.combined) <- "integrated"
immune.combined <- ScaleData(immune.combined, verbose = FALSE)
immune.combined <- RunPCA(immune.combined, npcs = 30, verbose = FALSE)
immune.combined <- RunUMAP(immune.combined, reduction = "pca", dims = 1:10)
immune.combined <- FindNeighbors(immune.combined, reduction = "pca",
dims = 1:30)
immune.combined <- FindClusters(immune.combined, resolution = 0.5)
p1 <- DimPlot(immune.combined, reduction = "umap", group.by = "sample")
p2 <- DimPlot(immune.combined, reduction = "umap", label = TRUE, repel = TRUE)
DimPlot(immune.combined, reduction = "umap", split.by = "sample")
DefaultAssay(immune.combined) <- "RNA"
library(metap)
all.markers084 <- FindAllMarkers(immune.combined, only.pos = TRUE,
min.pct = 0.25, logfc.threshold = 0.25)
b.seu <- WhichCells(immune.combined, idents= c("B", "CD21+ B", "Immature B", "Tuft", "Inflammatory mono", "Goblet cell"))
b.seu = subset(immune.combined, cells = b.seu)
pre-processing using seurat
b.seu <- NormalizeData(b.seu)
b.seu <- FindVariableFeatures(b.seu)
b.seu <- ScaleData(b.seu)
b.seu <- RunPCA(b.seu)
b.seu <- FindNeighbors(b.seu, dims = 1:30)
b.seu <- FindClusters(b.seu, resolution = 0.9)
b.seu <- RunUMAP(b.seu, dims = 1:30, n.neighbors = 50)
a1 <- DimPlot(b.seu, reduction = 'umap', group.by = 'seurat_clusters', label = T)
MONOCLE3 WORKFLOW ---------------------
monocle3 requires cell_data_set object
convert seurat object to cell_data_set object for monocle3
...1 Convert to cell_data_set object ------------------------
cds <- as.cell_data_set(b.seu)
Warning: Monocle 3 trajectories require cluster partitions, which Seurat does not calculate. Please run 'cluster_cells' on your cell_data_set object.
First of all, it's a warning and not an error. I guess your cell data object has been created.
As suggested in the warning either run
cluster_cells
function OR you can assign a dummy partition manually.Regards,
Nitin N.
Hello, Thank you very much for your reply. I did run the recreate partition code and added the following code. Im still receiving an error:
Anything that can be done?
Thank you.
Kind Regards, Shweta Johari
This thread might help to create a monocle3 object using Seurat object.
Using Monocle 3 with Seurat 3 integrated object