satijalab / seurat-wrappers

Community-provided extensions to Seurat
GNU General Public License v3.0
305 stars 131 forks source link

Monocle3 differential expression failed when active.assay is not "RNA" #77

Open Lix1993 opened 3 years ago

Lix1993 commented 3 years ago

Here is my code

cds_raw <- as.cell_data_set(seurat_object)
cds <- cluster_cells(cds_raw)

pr_graph_test_res <- graph_test(cds, neighbor_graph="knn", cores=8)

Error info:

Error in names(sf) <- colnames(SingleCellExperiment::counts(cds)) : 
  attempt to set an attribute on NULL
Lix1993 commented 3 years ago

When I change the active.assay to "RNA", it works.

> seurat_object@active.assay = 'RNA'
> cds_raw <- as.cell_data_set(seurat_object)
> cds <- cluster_cells(cds_raw)
> pr_graph_test_res <- graph_test(cds, neighbor_graph="knn", cores=8)
  ============================================| 100%, Elapsed 01:23
> str(pr_graph_test_res)
'data.frame':   33538 obs. of  5 variables:
 $ status               : chr  "FAIL" "FAIL" "FAIL" "OK" ...
 $ p_value              : num  NA NA NA 0.000387 NA ...
 $ morans_test_statistic: num  NA NA NA 3.36 NA ...
 $ morans_I             : num  NA NA NA 0.0177 NA ...
 $ q_value              : num  1 1 1 0.00162 1 ...
Lix1993 commented 3 years ago

after run estimate_size_factors, data with active.assay = 'integrated' works too, but no deg in the result.

> seurat_object@active.assay = 'integrated'
> cds_raw <- as.cell_data_set(seurat_object)
Warning: Monocle 3 trajectories require cluster partitions, which Seurat does not calculate. Please run 'cluster_cells' on your cell_data_set object
> cds <- cluster_cells(cds_raw)
> pr_graph_test_res <- graph_test(cds, neighbor_graph="knn", cores=24)
Error in names(sf) <- colnames(SingleCellExperiment::counts(cds)) : 
  attempt to set an attribute on NULL
>  cds <- estimate_size_factors(cds)
Warning message:
In log(cell_total) : NaNs produced
> pr_graph_test_res <- graph_test(cds, neighbor_graph="knn", cores=24)
  |==============================================================================================================| 100%, Elapsed 00:16
> str(pr_graph_test_res)
'data.frame':   3000 obs. of  5 variables:
 $ status               : chr  "FAIL" "FAIL" "FAIL" "FAIL" ...
 $ p_value              : logi  NA NA NA NA NA NA ...
 $ morans_test_statistic: logi  NA NA NA NA NA NA ...
 $ morans_I             : logi  NA NA NA NA NA NA ...
 $ q_value              : num  1 1 1 1 1 1 1 1 1 1 ...
> unique(pr_graph_test_res$status)
[1] "FAIL"
Lix1993 commented 3 years ago

The seurat object I used is from SCTransform pipeline described in https://satijalab.org/seurat/v3.1/integration.html. There are 3 assays: RNA, SCT, integrated, default integrated.

FaragMamdouh commented 9 months ago

I have the same error, may you tell me if you solved it?