Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Learn_graph error Error: colnames(cds)!=names(cds@clusters[[reduction_method]]$partitions) #176

Open
coraolpe opened this issue Jan 11, 2024 · 0 comments

Comments

@coraolpe
Copy link

Hi, I am trying to do a pseudo time analysis using monocle3 after having imported my data with the Seurat-wrappers.
I am essentially following this: https://rpubs.com/mahima_bose/Seurat_and_Monocle3_p
Here is my code:
`monocle_data_raw <- as.cell_data_set(three_plates_nocellcycle)

#checking the metadata
head(colData(monocle_data_raw))
#Looks good

#Now get feature/gene metadata
fData(monocle_data_raw)
#Gives me: DataFrame with 19261 rows and 0 columns

#Now check rownames
rownames(fData(monocle_data_raw))[1:10]

#Gives me: [1] "0610005C13Rik" "0610009B22Rik" "0610009E02Rik" "0610009L18Rik" "0610010F05Rik"
#[6] "0610010K14Rik" "0610012G03Rik" "0610030E20Rik" "0610040B10Rik" "1110002J07Rik"

#Now do a dataframe with the gene names

fData(monocle_data_raw)$gene_short_name <- rownames(fData(monocle_data_raw))

head(fData(monocle_data_raw))

#Gives me: DataFrame with 6 rows and 1 column
#gene_short_name
#
#0610005C13Rik 0610005C13Rik
#0610009B22Rik 0610009B22Rik
#0610009E02Rik 0610009E02Rik
#0610009L18Rik 0610009L18Rik
#0610010F05Rik 0610010F05Rik
#0610010K14Rik 0610010K14Rik

#Get counts
head(counts(monocle_data_raw))

#Gives a load of genes and counts

#Now: IMPORTANT! Retrieve clustering information from Seurat object!!!!

#1. Assign partitions
recreate.partitions <- c(rep(1, length(monocle_data_raw@colData@rownames)))
names(recreate.partitions) <- as.factor(recreate.partitions)
recreate.partitions

monocle_data_raw@clusters@listData[["UMAP"]][["partitions"]] <- recreate.partitions

#Assign cluster info
list.cluster <- three_plates_nocellcycle@active.ident
monocle_data_raw@clusters@listData[["UMAP"]][["clusters"]] <- list.cluster

#Assign UMAP coordinates
monocle_data_raw@int_colData@listData[["reducedDims"]]@ListData[["UMAP"]] <- three_plates_nocellcycle@reductions$umap@cell.embeddings

#Now Learn Trajectory

monocle_data_raw <- learn_graph(monocle_data_raw, use_partition = F)
`

This is where I get this error:
Error: colnames(cds)!=names(cds@clusters[[reduction_method]]$partitions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant