hi! I use monocle to make a pseudotime anlysis with my single cell sequencing data. After dimension reduction and cluster, when I try to order cells using the function "orderCells",the error occurred. The error is: "Error in graph.adjacency.dense(adjmatrix, mode = mode, weighted = weighted, : long vectors not supported yet: ../../src/include/Rinlinedfuns.h:519"
The code i use is showed below: library(dplyr) library(Seurat) library(monocle) library(Biobase) library(knitr) library(reshape2) library(ggplot2) library(HSMMSingleCell) library(org.Hs.eg.db) t <- readRDS(file = "/home/zhangs/t20190829.rds")
import our data as a celldataset
the matrix including data of genes and cells
matrix <- as.matrix(t@data)
the data of cells
pd <- new('AnnotatedDataFrame', data = t@meta.data)
the data of genes
fdata <- data.frame(geneshortname = row.names(matrix), row.names = row.names(matrix)) fd <- new('AnnotatedDataFrame', data = fdata)
whole dataset
monocle <- newCellDataSet(matrix, phenoData = pd, featureData = fd, expressionFamily=negbinomial.size())
this row is to decide the distribution of data
look at the cell data and change the name of upstream cluster information
head(pData(monocle)) names(pData(monocle))[names(pData(monocle)) == "res.1"] = "seucluster"
this step will help us with differentied gene expression
monocle <- estimateSizeFactors(monocle) monocle <- estimateDispersions(monocle) monocle <- detectGenes(monocle, minexpr = 0.1) expressedgenes <- row.names(subset(fData(monocle), numcellsexpressed >= 10))
disptable <- dispersionTable(monocle) orderinggenes <- subset(disptable, meanexpression >= 0.5 & dispersionempirical >= 1 * dispersionfit)$geneid monocle <- setOrderingFilter(monocle, orderinggenes) plotorderinggenes(monocle) plotpcvarianceexplained(monocle, returnall = F) monocle <- reduceDimension(monocle, maxcomponents = 2, numdim = 10, reductionmethod = 'tSNE', verbose = T) monocle <- clusterCells(monocle) plotcellclusters(monocle, 1, 2, colorby= "Cluster", showcellnames = T, cellsize = 0.5) difftestres <- differentialGeneTest(monocle[expressedgenes,], fullModelFormulaStr="~Cluster") monocleorderinggenes <- row.names(difftestres)[order(difftestres$qval)][1:1000]
monocle <- setOrderingFilter(monocle, orderinggenes = monocleordering_genes)
monocle <- reduceDimension(monocle, method = 'DDRTree')
monocle <- orderCells(monocle)
plotcelltrajectory(monocle, color_by = "Hours")
monocle <- setOrderingFilter(monocle, unsupclusteringgenes$geneid) orderinggenes <- row.names (subset(difftestres, qval < 0.01)) monocle <- setOrderingFilter(monocle, orderinggenes) plotordering_genes(monocle)
monocle <- reduceDimension(monocle, maxcomponents=2) monocle <- orderCells(monocle) colnames(pData(monocle)) plotcelltrajectory(monocle, colorby="Cluster")
I have never met this error before,can anyone used to this packages tell me what it means and how can i fix it?
It looks from the developer's website that the Bioconductor version of Monocle (aka Monocle 2) is deprecated, and you should move to the newer version Monocle 3:
http://cole-trapnell-lab.github.io/monocle-release/