cole-trapnell-lab / monocle3

Other
318 stars 98 forks source link

error in cluster_cells: Error in graph.adjacency.dense(adjmatrix, mode = mode, weighted = weighted #707

Closed vgettaa closed 3 months ago

vgettaa commented 3 months ago

Hi, I followed the tutorial documentation to construct the trajectories. And It reported error when I ran cluster_cells: Error in graph.adjacency.dense(adjmatrix, mode = mode, weighted = weighted, : At vendor/cigraph/src/constructors/adjacency.c:535 : Adjacency matrix should be symmetric to produce an undirected graph. Invalid value

The code is as follows:

create object

s<-subset(combined,subset= cell_type=="T cell") data<- GetAssayData(s,assay='RNA',layer='counts') cell_metadata<-data.frame(cell_data=colnames(data)) gene_annotation<- data.frame(gene_short_name=rownames(data)) rownames(gene_annotation)<- rownames(data) rownames(cell_metadata)<- colnames(data) cds<- new_cell_data_set(data,cell_metadata = cell_metadata,gene_metadata = gene_annotation)

pre-processing

cds<-preprocess_cds(cds,num_dim=50) cds@colData$orig.ident<-substr(rownames(cds@colData[1]),start=1,stop=2) cds <- align_cds(cds, alignment_group = "orig.ident")

Umap

cds<-reduce_dimension(cds,preprocess_method = "PCA")

cds<-cluster_cells(cds)

When I used other cell type for example: s<-subset(combined,subset= cell_type=="T cell"), the error disappeared. I don't know why this happened.

cieloLab commented 3 months ago

This also happened to me, it worked with all scRNA data, but in my own subseted data: scRna_tra <- new_cell_data_set(expression_data = Counts, cell_metadata = sample_sheet, gene_metadata = gene_annotation) scRna_tra <- preprocess_cds(scRna_tra, num_dim = 50) scRna_tra <- reduce_dimension(scRna_tra, verbose = F) No preprocess_method specified, using preprocess_method = 'PCA' Found more than one class "dist" in cache; using the first, from namespace 'BiocGenerics' Also defined by ‘spam’ Found more than one class "dist" in cache; using the first, from namespace 'BiocGenerics' Also defined by ‘spam’ scRna_tra <- cluster_cells(scRna_tra) Error in graph.adjacency.dense(adjmatrix, mode = mode, weighted = weighted, : At vendor/cigraph/src/constructors/adjacency.c:535 : Adjacency matrix should be symmetric to produce an undirected graph. Invalid value

i retury the subset data with tsne method 'reduce_dimension(scRna_tra, verbose = F, reduction_method = 'tSNE')', the error disapperaed

Dexiao211 commented 3 months ago

This also happened to me, it worked with some subseted data, but not in others.

Dexiao211 commented 3 months ago

@vgettaa @hereFadeStar Did you recently upgrade monocle3 or its dependencies? Something's wrong with my desktop. I reinstalled the package about two weeks ago and then encountered an issue. Everything was OK before the reinstall, so I thought the issue might have been caused by an update. I reverted to version 1.3.1, but it didn't work. Now, I think the issue may be caused by an update of one of its dependency. Thanks.

blaserlab commented 3 months ago

I get the same error with all combinations of monocle3 versions 1.3.5 and 1.3.4 and igraph versions 2.0.1, 2.0.1.1, 2.0.2 and 2.0.3. It looks like the error may be coming from some c library within igraph.

cieloLab commented 3 months ago

@vgettaa @hereFadeStar Did you recently upgrade monocle3 or its dependencies? Something's wrong with my desktop. I reinstalled the package about two weeks ago and then encountered an issue. Everything was OK before the reinstall, so I thought the issue might have been caused by an update. I reverted to version 1.3.1, but it didn't work. Now, I think the issue may be caused by an update of one of its dependency. Thanks.

YES, i updated monocle3 last week to try trajectory in UMAP

blaserlab commented 3 months ago

Looks like igraph v2.0.1 introduced the breaking change. cluster_cells runs as expected with monocle3 v1.3.5 and igraph v1.6.0.

Dexiao211 commented 3 months ago

Looks like igraph v2.0.1 introduced the breaking change. cluster_cells runs as expected with monocle3 v1.3.5 and igraph v1.6.0.

Thanks So much

brgew commented 3 months ago

Hi,

There is a new Monocle3 version, 1.3.6, that should fix this problem when using recent igraph package versions.

cieloLab commented 3 months ago

Hi,

There is a new Monocle3 version, 1.3.6, that should fix this problem when using recent igraph package versions.

Thanks, it already work in my data.

vgettaa commented 3 months ago

Hi,

There is a new Monocle3 version, 1.3.6, that should fix this problem when using recent igraph package versions.

Thanks! I updated monocle3 1.3.7, the error disappeared

Noralii commented 2 months ago

I encountered the same issue and resolved it by reinstalling the latest version of Monocle3 using devtools::install_github('cole-trapnell-lab/monocle3'). After this update, the problem disappeared when using Monocle3 version '1.3.7' and igraph version '2.0.3'.