cole-trapnell-lab / monocle3

Other
318 stars 98 forks source link

Error while running learn_graph(cds, use_partition = FALSE) #704

Open Fatemeh99m opened 4 months ago

Fatemeh99m commented 4 months ago

I am using version 5 seurat and CCAIntegration as the integration method for my data set. after creating cds, I have problems while running learn graph. I faced this error : Error: names(cds@clusters[[reduction_method]]$partitions) == NULL I didnt run "cds <- cluster_cells(cds)" cause I wanted to use cca_clusters. This is my code : `gene_annotation <- as.data.frame(rownames(obj@reductions[["pca"]]@feature.loadings), row.names = rownames(obj@reductions[["pca"]]@feature.loadings)) colnames(gene_annotation) <- "gene_short_name" head(gene_annotation)

cell_metadata <- as.data.frame(obj[["RNA"]]$counts@Dimnames[[2]], row.names = obj[["RNA"]]$counts@Dimnames[[2]]) colnames(cell_metadata) <- "barcode" head(cell_metadata)

New_matrix <- obj[["RNA"]]$data New_matrix <- New_matrix[rownames(obj@reductions[["pca"]]@feature.loadings), ] expression_matrix <- New_matrix

cds<- new_cell_data_set(expression_matrix, cell_metadata = cell_metadata, gene_metadata = gene_annotation)

list_cluster <-Idents(obj) names(list_cluster) <- obj[["RNA"]]$data@Dimnames[[2]] cds@clusters@listData[["UMAP"]][["clusters"]] <- list_cluster

cds@clusters@listData[["UMAP"]][["louvain_res"]] <- "NA" cds@int_colData@listData$reducedDims$UMAP <-obj@reductions[["umap.cca"]]@cell.embeddings

cds <- preprocess_cds(cds, num_dim = 35) cds <- align_cds(cds) cds <- learn_graph(cds, verbose = FALSE, use_partition = FALSE)`