Closed ruchikabhat closed 1 year ago
Hi,
I am using pseudotime analysis for the first time for mouse scRNA data and have encountered the following error:
Here is my code:
library(Seurat) library(SeuratDisk) library(SeuratData) library(ggplot2) library(monocle) library(slingshot) library(BUSpaRse) library(RColorBrewer) set.seed(1) n <- 30 qual_col_pals = brewer.pal.info[brewer.pal.info$category == 'qual',] col_vector = unlist(mapply(brewer.pal, qual_col_pals$maxcolors, rownames(qual_col_pals))) a<-DiscretePalette(n, palette = NULL) ######load the seurat object first ###### setwd ("D:/HPC_DATA_MOUSE_NEW COVID_April2022/Rrun") mouse<-readRDS("mouseAnnotated_16thMarch2023.rds") ##NEWEST ## Idents(mouse)<-'seurat_clusters' FRC<-subset(mouse,idents= c('6'), invert=TRUE) Idents(FRC)<-'Condition' Ad<-subset(FRC,idents= c('Adult'), invert=FALSE) Od<-subset(FRC,idents= c('Old'), invert=FALSE) Idents(Ad)<-'Ref_celltypes' Lec_aad<-subset(Ad,idents= c('LECs'), invert=FALSE) Idents(Lec_aad)<-'Clusters' Lec_ad<-subset(Lec_aad,idents= c('Cd45+Bcells','Cd45+Tcells','NerveCells'), invert=TRUE) View(Lec_ad@meta.data) Idents(Lec_ad)<-'Clusters' data <- as(as.matrix(Lec_ad@assays$RNA@data), 'sparseMatrix') pd <- new('AnnotatedDataFrame', data = Lec_ad@meta.data) fData <- data.frame(gene_short_name = row.names(data), row.names = row.names(data))# save list of gene names fd <- new('AnnotatedDataFrame', data = fData) ############ NEWCELLDATASET ########### FibroMono <- newCellDataSet(data, phenoData = pd, featureData = fd,expressionFamily = negbinomial.size()) ####ESTIMATE DISPERSIONS AND SIZE FACTORS############ FibroMono <- estimateSizeFactors(FibroMono) FibroMono <- estimateDispersions(FibroMono) #######FILTER LOW QUALITY GENES/CELLS########## FibroMono <- detectGenes(FibroMono, min_expr = 0.1) print(head(fData(FibroMono))) expressed_genes <- row.names(subset(fData(FibroMono), num_cells_expressed >= 10)) expressed_genes ######DEG TEST########## diff_test_res <- differentialGeneTest(FibroMono[expressed_genes,], fullModelFormulaStr = "~Clusters") ordering_genes <- row.names (subset(diff_test_res, qval < 0.01)) ordering_genes ################## Run ordering algorithm ############# FibroMono <- setOrderingFilter(FibroMono, ordering_genes) print(dim(exprs(FibroMono))) ## reduce dimension - do not normalize or include pseudo count. Use monocle scaling FibroMono <- reduceDimension(FibroMono,norm_method="none", reduction_method="DDRTree", max_components=2, scaling=TRUE, verbose=TRUE, pseudo_expr=0, auto_param_selection=F) # First decide what you want to color your cells by print(head(pData(FibroMono))) ## order cells change colors and theta to match your plot FibroMono <- orderCells(FibroMono) ## Plot Pseudotime trajectories ## plot_ordering_genes(FibroMono) plot_cell_trajectory(FibroMono, color_by = "Clusters", theta = -15, show_branch_points = TRUE,show_backbone = TRUE, backbone_color = "black", show_tree = TRUE,use_color_gradient = FALSE, cell_size = 1.5, values=a) + scale_color_manual(values = a, name = "Only FRCs Pseudotime")+ theme(legend.position = "top")
FibroMono <- orderCells(FibroMono)
Warning messages: 1: In graph.dfs(dp_mst, root = root_cell, neimode = "all", unreachable = FALSE, : Argument neimode' is deprecated; use mode' instead 2: In graph.dfs(dp_mst, root = root_cell, neimode = "all", unreachable = FALSE, : Argument neimode' is deprecated; use mode' instead
plot_cell_trajectory(FibroMono, color_by = "Clusters", theta = -15, show_branch_points = TRUE,show_backbone = TRUE, backbone_color = "black", show_tree = TRUE,use_color_gradient = FALSE, cell_size = 1.5, values=a) + scale_color_manual(values = a, name = "Only FRCs Pseudotime")+ theme(legend.position = "top")
Error in .standalone_types_check_dot_call(ffi_standalone_check_number_1.0.7, : object 'ffi_standalone_check_number_1.0.7' not found
Please help in solving the problem. How to know/plot the pseudotime of these celltypes? Any help would be highly appreciated.
Thank you in advance.
same issues
I update the packages which name is "rlang" to '1.1.0' ,then the problem was solved.
@Humboler .. Thanks a lot for your kind help! It worked.
Hi,
I am using pseudotime analysis for the first time for mouse scRNA data and have encountered the following error:
Here is my code:
FibroMono <- orderCells(FibroMono)
Please help in solving the problem. How to know/plot the pseudotime of these celltypes? Any help would be highly appreciated.
Thank you in advance.