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

Issue with estimateDispersions() #515

Open
aeg06 opened this issue Jul 19, 2024 · 0 comments
Open

Issue with estimateDispersions() #515

aeg06 opened this issue Jul 19, 2024 · 0 comments

Comments

@aeg06
Copy link

aeg06 commented Jul 19, 2024

Hi there,

First of all, thank you for creating such a fantastic tool. I am using Monocle 2 to analyze some splenic data. I was able to convert the splenic data from a Seurat object to a CellDataSet object, however, during the estimateDispersions() step, I received the following warning:

Removing 13 outliers
Warning message:
glm.fit: algorithm did not converge

I wanted to check the dispersion data and plotted the dispersion data against mean expression. The resulting plot (shown below) looked completely incorrect.

Screenshot 2024-07-19 at 3 23 15 PM

Could you please help me understand what might be the issue? I have also attached my code below:

# load in packages
library(monocle)
library(Seurat)
library(dplyr) 
library(igraph)

# load in data
load("/path/to/harmonized_spleen.RData")

# set default assay to RNA
DefaultAssay(harmonized_spleen) <- "RNA"

# set idents to Seurat clusters
Idents(harmonized_spleen) <- "seurat_clusters"

# set seurat clusters as monocle clusters
harmonized_spleen$clusters <- harmonized_spleen@active.ident

# add current ident to metadata in order to color Monocle graphs by cluster identity
Idents(harmonized_spleen) <- harmonized_spleen$clusters

# create a CDS Monocle object using count data
phenoData = new("AnnotatedDataFrame", data = harmonized_spleen@meta.data)
fData <- data.frame(gene_short_name = row.names(harmonized_spleen), row.names = row.names(harmonized_spleen))
fd <- new('AnnotatedDataFrame', data = fData)
data_monocle <- newCellDataSet(cellData = as.matrix(harmonized_spleen@assays$RNA@counts),
                               phenoData = phenoData,
                               featureData = fd)

# estimate size factors and dispersions
data_monocle <- estimateSizeFactors(data_monocle)
data_monocle <- estimateDispersions(data_monocle)

# check the dispersion data vs. mean expression plot
dispersion_data <- data_monocle@dispFitInfo$blind$disp_table$disp
mean_expression <- data_monocle@dispFitInfo$blind$disp_table$mu
plot(mean_expression, dispersion_data)

Please let me know if I need to provide any additional information. Thank you in advance for your help!

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