monocle-release icon indicating copy to clipboard operation
monocle-release copied to clipboard

orderCells

Open chrismahony opened this issue 2 years ago • 4 comments

I am running monocle 2 to analyse some scATACseq data.

When I run:

data_atac <- GetAssayData(atac_cicero[["ATAC"]], slot="data") pd_atac <- new('AnnotatedDataFrame', data = [email protected]) fData_atac <- data.frame(gene_short_name = row.names(data_atac), row.names = row.names(data_atac)) fd_atac <- new('AnnotatedDataFrame', data = fData_atac) data_atac <- data_atac[, rownames(pd_atac)]

atac_cicero_monocle2_cds_peaks <- newCellDataSet(data_atac, phenoData = pd_atac, featureData = fd_atac, lowerDetectionLimit = 0.5, expressionFamily = negbinomial.size())

atac_cicero_monocle2_cds_peaks <- estimateSizeFactors(atac_cicero_monocle2_cds_peaks)

all.markers_ATAC_top50<- all.markers %>% group_by(cluster) %>% top_n(n = 50, wt = avg_log2FC)

atac_cicero_monocle2_cds_peaks <- setOrderingFilter(atac_cicero_monocle2_cds_peaks, all.markers_ATAC_top50$gene) atac_cicero_monocle2_cds_peaks <- reduceDimension(atac_cicero_monocle2_cds_peaks, max_components = 2, method = 'DDRTree', ncenter = 100) atac_cicero_monocle2_cds_peaks <- orderCells(atac_cicero_monocle2_cds_peaks)

I get the following error message from ordercells():

Warning: Argument neimode' is deprecated; use mode' insteadError in if (class(projection) != "matrix") projection <- as.matrix(projection) : the condition has length > 1

If you could help I would really appreciate it.

Thanks Chris

chrismahony avatar Aug 09 '22 10:08 chrismahony

I have solved this. I recently updated to R4.2 from 4.1. This error only occurs on 4.2. When I switch back to 4.1 I can run this script no problem.

Thanks Chris

chrismahony avatar Aug 16 '22 19:08 chrismahony

I come across the same problem. I wonder if there is a solution for R 4.2.

PrinceWang2018 avatar Aug 20 '22 01:08 PrinceWang2018

Hello, I have fixed this problem under R4.2. Here is the solution:

trace('project2MST', edit = T, where = asNamespace("monocle")) and find the code: if (class(projection) != "matrix") projection <- as.matrix(projection) : delete the if condition line. Then ordercell function will be work

yuanlizhanshi avatar Aug 22 '22 01:08 yuanlizhanshi

Thanks for your response! I have tried the solution you mentioned and it works! @yuanlizhanshi

PrinceWang2018 avatar Aug 22 '22 03:08 PrinceWang2018