monocle-release
monocle-release copied to clipboard
Error:Error in vcount(x) : REAL() can only be applied to a 'numeric', not a 'NULL'
Hi I'm using moncle2 for analysis recently, but I found a very strange error, one of which is that when I access the view(cds), there is a problem, the other is cds.1 <- cds[fData(cds) $num_cells_expressed >= 10, ] After screening the cds file, we search for highly variable genes by performing disp_table <- dispersionTable(cds.1), the number of highly expressed genes in the disp_table file is greater than the number of genes in the cds.1 file, I am not sure Where is the problem, so come to help, thank you very much.
library(monocle)
library(SeuratData)
library(Seurat)
sce <- pbmc3k.final
table(Idents(sce))
sce$celltype = Idents(sce)
sce= sce[,sce$celltype %in% c('CD14+ Mono','FCGR3A+ Mono')]
table(Idents(sce))
sample_ann <- [email protected]
head(sample_ann)
sample_ann[,1] = rownames(sample_ann)
gene_ann <- data.frame(
gene_short_name = rownames(sce@assays$RNA) ,
row.names = rownames(sce@assays$RNA)
)
head(gene_ann)
pd <- new("AnnotatedDataFrame",data=sample_ann)
fd <- new("AnnotatedDataFrame",data=gene_ann)
data <- as(as.matrix(sce@assays$RNA@counts), 'sparseMatrix')
class(data)
data[1:4,1:4]
cds <- newCellDataSet(data,
phenoData = pd,
featureData =fd,
expressionFamily = negbinomial.size())
view(cds)
Error in vcount(x) : REAL() can only be applied to a 'numeric', not a 'NULL'_
cds <- estimateSizeFactors(cds) cds <- estimateDispersions(cds) sce cds fData(cds)[1:1,1:1] pData(cds)[1:4,1:4] cds <- detectGenes(cds, min_expr = 1) fData(cds)[1:2,1:2] cds <- cds[fData(cds)$num_cells_expressed >= 10, ] cds length(row.names(fData(cds))) [1] 1803 disp_table <- dispersionTable(cds) length(row.names(disp_table)) [1] 11450 unsup_clustering_genes <- subset(disp_table, mean_expression >= 0.1) length(unsup_clustering_genes$gene_id) [1] 2342
my problem:
- view(cds)
Error in vcount(x) : REAL() can only be applied to a 'numeric', not a 'NULL'_
- Why the number of genes doesn't make sense
length(row.names(fData(cds)))
[1] 1803
disp_table <- dispersionTable(cds)
length(row.names(disp_table))
[1] 11450
unsup_clustering_genes <- subset(disp_table, mean_expression >= 0.1)
length(unsup_clustering_genes$gene_id)
[1] 2342
monocle2 can not directly open cds ,but if you use m3 you can open it
I'm having the same issue. I used to be able to View(cds) or str(cds) but now I cannot! My error message is
> View(cds)
Error in vcount(x) :
REAL() can only be applied to a 'numeric', not a 'NULL'
> str(cds)
Formal class 'CellDataSet' [package "monocle"] with 19 slots
..@ reducedDimS : num[0 , 0 ]
..@ reducedDimW : num[0 , 0 ]
..@ reducedDimA : num[0 , 0 ]
..@ reducedDimK : num[0 , 0 ]
..@ minSpanningTree :Error in vcount(x) :
REAL() can only be applied to a 'numeric', not a 'NULL'
Edit: I looked at the minSpanningTree and see the following message
This graph was created by an old(er) igraph version.
Call upgrade_graph() on it to use with the current igraph version
For now we convert it on the fly...
Error in is_directed(object) :
REAL() can only be applied to a 'numeric', not a 'NULL'
Did this get resolved?
I met the same error, did it get resolved? I can view it in R 4.2.0, but i did not view it in R 4.1.3. if i use R 4.2.0, i met the another error in this step: cds <- orderCells(cds)
I solve this problem,the whole process can be successfully completed by running with R 4.1.3.
Hello, lisahnglai How did you solve the above problem, just the R version problem? Can you provide more details? I would appreciate it very much
Reloading the monocle package works for me