cole-trapnell-lab / cicero-release

https://cole-trapnell-lab.github.io/cicero-release/
MIT License
55 stars 15 forks source link

I can't run the run_cicero!!! #98

Open skkanlei opened 9 months ago

skkanlei commented 9 months ago

While running code "run_cicero", I keep getting "The previous R session was abnormally terminated due to an unexpected crash"

I just run the test code!!

library(cicero) library(Signac) library(Seurat) library(SeuratWrappers) library(ggplot2) library(patchwork) library(monocle3)

data("cicero_data") data("human.hg19.genome")

sample_genome <- subset(human.hg19.genome, V1 == "chr18") sample_genome$V2[1] <- 100000 input_cds <- make_atac_cds(cicero_data, binarize = TRUE) input_cds <- detect_genes(input_cds) input_cds <- estimate_size_factors(input_cds) input_cds <- preprocess_cds(input_cds, method = "PCA") input_cds <- reduce_dimension(input_cds, max_components = 2, num_dim=6, reduction_method = 'tSNE', norm_method = "none", preprocess_method = 'PCA') cicero_cds <- make_cicero_cds(input_cds, reduced_coordinates = reducedDims(input_cds)$tSNE) cons <- run_cicero(cicero_cds, sample_genome, sample_num = 2)

I think this is because of my package version, but I don't know the correct version about cicero and monocle3! cicero_1.3.9 monocle3_1.3.4
Seurat_4.3.0
And I don't want to update my seurat4 to seurat5.

sessionInfo() R version 4.3.2 (2023-10-31) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core)

Matrix products: default BLAS: /opt/software/R-4.3/lib64/R/lib/libRblas.so LAPACK: /opt/software/R-4.3/lib64/R/lib/libRlapack.so; LAPACK version 3.11.0

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: Asia/Shanghai tzcode source: system (glibc)

attached base packages: [1] grid stats4 stats graphics grDevices utils datasets methods base

other attached packages: [1] BSgenome.Btaurus.UCSC.bosTau8_1.4.2 ggsci_3.0.0
[3] paletteer_1.5.0 RColorBrewer_1.1-3
[5] biovizBase_1.50.0 BSgenome.Btaurus.UCSC.bosTau9_1.4.2 [7] BSgenome_1.70.1 rtracklayer_1.62.0
[9] BiocIO_1.12.0 Biostrings_2.70.1
[11] XVector_0.42.0 AnnotationHub_3.10.0
[13] BiocFileCache_2.10.1 dbplyr_2.4.0
[15] EnsDb.Hsapiens.v86_2.99.0 ensembldb_2.26.0
[17] AnnotationFilter_1.26.0 GenomicFeatures_1.54.1
[19] AnnotationDbi_1.64.1 dplyr_1.1.4
[21] patchwork_1.1.3 ggplot2_3.4.4
[23] SeuratWrappers_0.2.0 SeuratObject_4.1.3
[25] Seurat_4.3.0 Signac_1.11.0
[27] cicero_1.3.9 Gviz_1.46.1
[29] monocle3_1.3.4 SingleCellExperiment_1.24.0
[31] SummarizedExperiment_1.32.0 GenomicRanges_1.54.1
[33] GenomeInfoDb_1.38.4 IRanges_2.36.0
[35] S4Vectors_0.40.2 MatrixGenerics_1.14.0
[37] matrixStats_1.2.0 Biobase_2.62.0
[39] BiocGenerics_0.48.1

loaded via a namespace (and not attached): [1] fs_1.6.3 ProtGenerics_1.34.0 spatstat.sparse_3.0-3
[4] bitops_1.0-7 devtools_2.4.5 httr_1.4.7
[7] docopt_0.7.1 profvis_0.3.8 tools_4.3.2
[10] sctransform_0.4.1 backports_1.4.1 utf8_1.2.4
[13] R6_2.5.1 lazyeval_0.2.2 uwot_0.1.16
[16] urlchecker_1.0.1 withr_2.5.2 sp_2.1-2
[19] prettyunits_1.2.0 gridExtra_2.3 progressr_0.14.0
[22] textshaping_0.3.7 cli_3.6.2 spatstat.explore_3.2-5
[25] labeling_0.4.3 slam_0.1-50 spatstat.data_3.0-3
[28] ggridges_0.5.5 pbapply_1.7-2 systemfonts_1.0.5
[31] Rsamtools_2.18.0 foreign_0.8-85 dichromat_2.0-0.1
[34] sessioninfo_1.2.2 parallelly_1.36.0 maps_3.4.2
[37] VGAM_1.1-9 rstudioapi_0.15.0 RSQLite_2.3.4
[40] generics_0.1.3 ica_1.0-3 spatstat.random_3.2-2
[43] Matrix_1.6-1 interp_1.1-6 fansi_1.0.6
[46] abind_1.4-5 terra_1.7-65 lifecycle_1.0.4
[49] yaml_2.3.8 SparseArray_1.2.3 Rtsne_0.17
[52] blob_1.2.4 promises_1.2.1 crayon_1.5.2
[55] miniUI_0.1.1.1 lattice_0.21-9 cowplot_1.1.2
[58] KEGGREST_1.42.0 pillar_1.9.0 knitr_1.45
[61] rjson_0.2.21 boot_1.3-28.1 future.apply_1.11.1
[64] codetools_0.2-19 fastmatch_1.1-4 leiden_0.4.3.1
[67] glue_1.6.2 remotes_2.4.2.1 data.table_1.14.10
[70] spam_2.10-0 vctrs_0.6.5 png_0.1-8
[73] gtable_0.3.4 rematch2_2.1.2 cachem_1.0.8
[76] xfun_0.41 S4Arrays_1.2.0 mime_0.12
[79] qlcMatrix_0.9.7 survival_3.5-7 RcppRoll_0.3.0
[82] fields_15.2 interactiveDisplayBase_1.40.0 ellipsis_0.3.2
[85] fitdistrplus_1.1-11 ROCR_1.0-11 nlme_3.1-163
[88] usethis_2.2.2 bit64_4.0.5 progress_1.2.3
[91] filelock_1.0.3 RcppAnnoy_0.0.21 irlba_2.3.5.1
[94] KernSmooth_2.23-22 rpart_4.1.21 colorspace_2.1-0
[97] DBI_1.2.0 Hmisc_5.1-1 nnet_7.3-19
[100] tidyselect_1.2.0 bit_4.0.5 compiler_4.3.2
[103] curl_5.2.0 htmlTable_2.4.2 xml2_1.3.6
[106] DelayedArray_0.28.0 plotly_4.10.3 checkmate_2.3.1
[109] scales_1.3.0 lmtest_0.9-40 rappdirs_0.3.3
[112] stringr_1.5.1 digest_0.6.33 goftest_1.2-3
[115] spatstat.utils_3.0-4 minqa_1.2.6 sparsesvd_0.2-2
[118] rmarkdown_2.25 htmltools_0.5.7 pkgconfig_2.0.3
[121] jpeg_0.1-10 base64enc_0.1-3 lme4_1.1-35.1
[124] fastmap_1.1.1 rlang_1.1.2 htmlwidgets_1.6.4
[127] shiny_1.8.0 farver_2.1.1 zoo_1.8-12
[130] jsonlite_1.8.8 BiocParallel_1.36.0 VariantAnnotation_1.48.1
[133] RCurl_1.98-1.13 magrittr_2.0.3 Formula_1.2-5
[136] GenomeInfoDbData_1.2.11 dotCall64_1.1-1 sceasy_0.0.7
[139] munsell_0.5.0 Rcpp_1.0.11 reticulate_1.34.0
[142] stringi_1.8.3 jjAnno_0.0.3 zlibbioc_1.48.0
[145] MASS_7.3-60 pkgbuild_1.4.3 plyr_1.8.9
[148] parallel_4.3.2 listenv_0.9.0 ggrepel_0.9.4
[151] deldir_2.0-2 splines_4.3.2 tensor_1.5
[154] hms_1.1.3 igraph_1.6.0 spatstat.geom_3.2-7
[157] pkgload_1.3.3 reshape2_1.4.4 biomaRt_2.58.0
[160] BiocVersion_3.18.1 XML_3.99-0.16 evaluate_0.23
[163] latticeExtra_0.6-30 BiocManager_1.30.22 nloptr_2.0.3
[166] httpuv_1.6.13 RANN_2.6.1 tidyr_1.3.0
[169] purrr_1.0.2 polyclip_1.10-6 future_1.33.1
[172] scattermore_1.2 rsvd_1.0.5 xtable_1.8-4
[175] restfulr_0.0.15 later_1.3.2 ragg_1.2.7
[178] viridisLite_0.4.2 tibble_3.2.1 memoise_2.0.1
[181] GenomicAlignments_1.38.0 cluster_2.1.4 globals_0.16.2

Puriney commented 9 months ago

No. you are wrong. I confirmed I've got the same package versions as yours and run_cicero works.

My R is 4.1.2.

[1] cicero_1.3.9                Gviz_1.38.4                 monocle3_1.3.4             
 [4] SingleCellExperiment_1.16.0 SummarizedExperiment_1.24.0 GenomicRanges_1.46.1       
 [7] GenomeInfoDb_1.30.1         IRanges_2.28.0              S4Vectors_0.32.3           
[10] MatrixGenerics_1.6.0        matrixStats_0.63.0          Biobase_2.54.0             
[13] BiocGenerics_0.40.0         Signac_1.10.0               SeuratObject_4.1.3         
[16] Seurat_4.3.0 

I suggest you go through the original tutorial https://cole-trapnell-lab.github.io/cicero-release/docs_m3/#constructing-cis-regulatory-networks make sure it runs. I suspected the way you set the 'toy' data, sample_genome$V2[1] <- 100000, gives the problem. The range you specified may be too short. It could also be that the demo data does not have enough peaks in chr18 you specified.

skkanlei commented 9 months ago

No. you are wrong. I confirmed I've got the same package versions as yours and run_cicero works.

My R is 4.1.2.

[1] cicero_1.3.9                Gviz_1.38.4                 monocle3_1.3.4             
 [4] SingleCellExperiment_1.16.0 SummarizedExperiment_1.24.0 GenomicRanges_1.46.1       
 [7] GenomeInfoDb_1.30.1         IRanges_2.28.0              S4Vectors_0.32.3           
[10] MatrixGenerics_1.6.0        matrixStats_0.63.0          Biobase_2.54.0             
[13] BiocGenerics_0.40.0         Signac_1.10.0               SeuratObject_4.1.3         
[16] Seurat_4.3.0 

I suggest you go through the original tutorial https://cole-trapnell-lab.github.io/cicero-release/docs_m3/#constructing-cis-regulatory-networks make sure it runs. I suspected the way you set the 'toy' data, sample_genome$V2[1] <- 100000, gives the problem. The range you specified may be too short. It could also be that the demo data does not have enough peaks in chr18 you specified.

Thank you so much for your reply! I have changed my code according your suggestion, but still get the same error! My code is

Code to download (54M) and unzip the file - can take a couple minutes

depending on internet connection:

temp <- textConnection(readLines(gzcon(url("http://staff.washington.edu/hpliner/data/kidney_data.txt.gz"))))

read in the data

cicero_data <- read.table(temp) input_cds <- make_atac_cds(cicero_data, binarize = TRUE)

input_cds <- detect_genes(input_cds) input_cds <- estimate_size_factors(input_cds) input_cds <- preprocess_cds(input_cds, method = "LSI") save(input_cds, file = "input_cds.rdata") input_cds <- reduce_dimension(input_cds, reduction_method = 'UMAP', preprocess_method = "LSI")

plot_cells(input_cds) umap_coords <- reducedDims(input_cds)$UMAP cicero_cds <- make_cicero_cds(input_cds, reduced_coordinates = umap_coords)

data("mouse.mm9.genome")

use only a small part of the genome for speed

sample_genome <- subset(mouse.mm9.genome, V1 == "chr2") sample_genome$V2[1] <- 1000000000

Usually use the whole mouse.mm9.genome

Usually run with sample_num = 100

conns <- run_cicero(cicero_cds, sample_genome, sample_num = 100) head(conns)

R is 4.3.2

other attached packages: [1] SeuratWrappers_0.2.0 cicero_1.3.9
[3] Gviz_1.46.1 monocle3_1.3.5
[5] SingleCellExperiment_1.24.0 TFBSTools_1.40.0
[7] JASPAR2020_0.99.10 ggsci_3.0.0
[9] paletteer_1.5.0 RColorBrewer_1.1-3
[11] biovizBase_1.50.0 AnnotationHub_3.10.0
[13] BiocFileCache_2.10.1 dbplyr_2.4.0
[15] EnsDb.Hsapiens.v86_2.99.0 ensembldb_2.26.0
[17] AnnotationFilter_1.26.0 GenomicFeatures_1.54.1
[19] AnnotationDbi_1.64.1 Signac_1.11.0
[21] dplyr_1.1.4 patchwork_1.1.3
[23] SeuratObject_4.1.3 Seurat_4.3.0
[25] ggplot2_3.4.4 Matrix_1.6-1
[27] SummarizedExperiment_1.32.0 Biobase_2.62.0
[29] MatrixGenerics_1.14.0 matrixStats_1.2.0
[31] motifmatchr_1.24.0 chromVAR_1.24.0
[33] BiocParallel_1.36.0 BSgenome.Btaurus.UCSC.bosTau9_1.4.2 [35] BSgenome_1.70.1 rtracklayer_1.62.0
[37] BiocIO_1.12.0 Biostrings_2.70.1
[39] XVector_0.42.0 GenomicRanges_1.54.1
[41] GenomeInfoDb_1.38.4 IRanges_2.36.0
[43] S4Vectors_0.40.2 BiocGenerics_0.48.1

skkanlei commented 9 months ago

No. you are wrong. I confirmed I've got the same package versions as yours and run_cicero works.

My R is 4.1.2.

[1] cicero_1.3.9                Gviz_1.38.4                 monocle3_1.3.4             
 [4] SingleCellExperiment_1.16.0 SummarizedExperiment_1.24.0 GenomicRanges_1.46.1       
 [7] GenomeInfoDb_1.30.1         IRanges_2.28.0              S4Vectors_0.32.3           
[10] MatrixGenerics_1.6.0        matrixStats_0.63.0          Biobase_2.54.0             
[13] BiocGenerics_0.40.0         Signac_1.10.0               SeuratObject_4.1.3         
[16] Seurat_4.3.0 

I suggest you go through the original tutorial https://cole-trapnell-lab.github.io/cicero-release/docs_m3/#constructing-cis-regulatory-networks make sure it runs. I suspected the way you set the 'toy' data, sample_genome$V2[1] <- 100000, gives the problem. The range you specified may be too short. It could also be that the demo data does not have enough peaks in chr18 you specified.

So sorry to trouble again! I run the https://github.com/cole-trapnell-lab/cicero-release/blob/monocle3/R/runCicero.R and find that as soon as I ran the following code, I keep getting "The previous R session was abnormally terminated due to an unexpected crash".

while(sample_num > distance_parameters_calced & it < max_sample_windows) { it <- it + 1 win <- sample(seq_len(length(grs)), 1) GL <- "Error" win_range <- get_genomic_range(grs, cds, win)

if (nrow(exprs(win_range))<=1) {
  next()
}
if (nrow(exprs(win_range)) > max_elements) {
  next()
}

dist_matrix <- calc_dist_matrix(win_range)

distance_parameter <- find_distance_parameter(dist_matrix,
                    win_range,
                    maxit = maxit,
                    null_rho = 0,
                    s,
                    distance_constraint = distance_constraint,
                    distance_parameter_convergence =
                      distance_parameter_convergence)

if (!is(distance_parameter, "numeric")) next()
distance_parameters = c(distance_parameters, distance_parameter)
distance_parameters_calced <- distance_parameters_calced + 1

}

If you'd like, can you share the code you run?Thank you very much!

hpliner commented 2 months ago

Apologies for the long delay. Is this still an issue?