vignettes/cicero.Rmd
cicero.Rmd
In this vignette we will demonstrate how to find cis-co-accessible networks with Cicero using single-cell ATAC-seq data. Please see the Cicero website for information about Cicero.
To facilitate conversion between the Seurat (used by Signac) and CellDataSet (used by Cicero) formats, we will use a conversion function in the SeuratWrappers package available on GitHub.
We will use a single-cell ATAC-seq dataset containing human CD34+ hematopoietic stem and progenitor cells published by Satpathy and Granja et al. (2019, Nature Biotechnology). The processed datasets are available on NCBI GEO here: https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE129785
This is the same dataset we used in the trajectory vignette, and we’ll start by loading the dataset that was created in that vignette. See the trajectory vignette for the code used to create the object from raw data.
First we will load their dataset and perform some standard preprocessing using Signac.
# load the object created in the Monocle 3 vignette
bone <- readRDS("../vignette_data/cd34.rds")
We can find cis-co-accessible networks (CCANs) using Cicero.
The Cicero developers have developed a separate branch of the package
that works with a Monocle 3 CellDataSet
object. We will
first make sure this branch is installed, then convert our
Seurat
object for the whole bone marrow dataset to
CellDataSet
format.
# Install Cicero
if (!requireNamespace("remotes", quietly = TRUE))
install.packages("remotes")
remotes::install_github("cole-trapnell-lab/cicero-release", ref = "monocle3")
library(cicero)
# convert to CellDataSet format and make the cicero object
bone.cds <- as.cell_data_set(x = bone)
bone.cicero <- make_cicero_cds(bone.cds, reduced_coordinates = reducedDims(bone.cds)$UMAP)
We’ll demonstrate running Cicero here using just one chromosome to save some time, but the same workflow can be applied to find CCANs for the whole genome.
Here we demonstrate the most basic workflow for running Cicero. This workflow can be broken down into several steps, each with parameters that can be changed from their defaults to fine-tune the Cicero algorithm depending on your data. We highly recommend that you explore the Cicero website, paper, and documentation for more information.
# get the chromosome sizes from the Seurat object
genome <- seqlengths(bone)
# use chromosome 1 to save some time
# omit this step to run on the whole genome
genome <- genome[1]
# convert chromosome sizes to a dataframe
genome.df <- data.frame("chr" = names(genome), "length" = genome)
# run cicero
conns <- run_cicero(bone.cicero, genomic_coords = genome.df, sample_num = 100)
## [1] "Starting Cicero"
## [1] "Calculating distance_parameter value"
## [1] "Running models"
## [1] "Assembling connections"
## [1] "Successful cicero models: 755"
## [1] "Other models: "
##
## Too many elements in range Zero or one element in range
## 157 86
## [1] "Models with errors: 0"
## [1] "Done"
head(conns)
## Peak1 Peak2 coaccess
## 1 chr1-100003337-100003837 chr1-99791719-99792219 0
## 2 chr1-100003337-100003837 chr1-99828699-99829199 0
## 3 chr1-100003337-100003837 chr1-99835542-99836042 0
## 4 chr1-100003337-100003837 chr1-99836217-99836717 0
## 5 chr1-100003337-100003837 chr1-99839576-99840076 0
## 6 chr1-100003337-100003837 chr1-99840640-99841140 0
Now that we’ve found pairwise co-accessibility scores for each peak,
we can now group these pairwise connections into larger co-accessible
networks using the generate_ccans()
function from
Cicero.
ccans <- generate_ccans(conns)
## [1] "Coaccessibility cutoff used: 0.19"
head(ccans)
## Peak CCAN
## chr1-10009702-10010202 chr1-10009702-10010202 1
## chr1-100151188-100151688 chr1-100151188-100151688 2
## chr1-100164787-100165287 chr1-100164787-100165287 2
## chr1-100165566-100166066 chr1-100165566-100166066 2
## chr1-100202505-100203005 chr1-100202505-100203005 3
## chr1-100215491-100215991 chr1-100215491-100215991 3
We can add the co-accessible links found by Cicero to the
ChromatinAssay
object in Seurat. Using the
ConnectionsToLinks()
function in Signac we can convert the
outputs of Cicero to the format needed to store in the
links
slot in the ChromatinAssay
, and add this
to the object using the Links<-
assignment function.
links <- ConnectionsToLinks(conns = conns, ccans = ccans)
Links(bone) <- links
We can now visualize these links along with DNA accessibility
information by running CoveragePlot()
for a region:
CoveragePlot(bone, region = "chr1-40189344-40252549")
Thanks to the developers of Cicero, especially Cole Trapnell, Hannah Pliner, and members of the Trapnell lab. If you use Cicero please cite the Cicero paper.
## R version 4.3.1 (2023-06-16)
## Platform: aarch64-apple-darwin20 (64-bit)
## Running under: macOS Sonoma 14.0
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## time zone: Asia/Singapore
## tzcode source: internal
##
## attached base packages:
## [1] grid stats4 stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] cicero_1.3.9 Gviz_1.44.2
## [3] monocle3_1.3.4 SingleCellExperiment_1.22.0
## [5] SummarizedExperiment_1.30.2 GenomicRanges_1.52.0
## [7] GenomeInfoDb_1.36.3 IRanges_2.34.1
## [9] S4Vectors_0.38.2 MatrixGenerics_1.12.3
## [11] matrixStats_1.0.0 Biobase_2.60.0
## [13] BiocGenerics_0.46.0 patchwork_1.1.3
## [15] ggplot2_3.4.4 SeuratWrappers_0.3.1
## [17] SeuratObject_4.1.4 Seurat_4.4.0
## [19] Signac_1.11.0
##
## loaded via a namespace (and not attached):
## [1] ProtGenerics_1.32.0 fs_1.6.3 spatstat.sparse_3.0-2
## [4] bitops_1.0-7 httr_1.4.7 RColorBrewer_1.1-3
## [7] backports_1.4.1 tools_4.3.1 sctransform_0.4.0
## [10] utf8_1.2.3 R6_2.5.1 lazyeval_0.2.2
## [13] uwot_0.1.16 withr_2.5.1 sp_2.1-0
## [16] prettyunits_1.2.0 gridExtra_2.3 progressr_0.14.0
## [19] cli_3.6.1 textshaping_0.3.7 spatstat.explore_3.2-3
## [22] labeling_0.4.3 sass_0.4.7 spatstat.data_3.0-1
## [25] ggridges_0.5.4 pbapply_1.7-2 pkgdown_2.0.7
## [28] Rsamtools_2.16.0 systemfonts_1.0.5 foreign_0.8-84
## [31] R.utils_2.12.2 dichromat_2.0-0.1 parallelly_1.36.0
## [34] BSgenome_1.68.0 VGAM_1.1-9 rstudioapi_0.15.0
## [37] RSQLite_2.3.1 FNN_1.1.3.2 generics_0.1.3
## [40] BiocIO_1.10.0 ica_1.0-3 spatstat.random_3.1-6
## [43] dplyr_1.1.3 interp_1.1-4 Matrix_1.6-1.1
## [46] fansi_1.0.5 abind_1.4-5 R.methodsS3_1.8.2
## [49] terra_1.7-46 lifecycle_1.0.3 yaml_2.3.7
## [52] BiocFileCache_2.8.0 Rtsne_0.16 blob_1.2.4
## [55] promises_1.2.1 crayon_1.5.2 miniUI_0.1.1.1
## [58] lattice_0.21-8 cowplot_1.1.1 GenomicFeatures_1.52.2
## [61] KEGGREST_1.40.1 pillar_1.9.0 knitr_1.44
## [64] rjson_0.2.21 boot_1.3-28.1 future.apply_1.11.0
## [67] codetools_0.2-19 fastmatch_1.1-4 leiden_0.4.3
## [70] glue_1.6.2 leidenbase_0.1.25 data.table_1.14.8
## [73] remotes_2.4.2.1 vctrs_0.6.3 png_0.1-8
## [76] gtable_0.3.4 assertthat_0.2.1 cachem_1.0.8
## [79] xfun_0.40 S4Arrays_1.0.6 mime_0.12
## [82] survival_3.5-5 RcppRoll_0.3.0 ellipsis_0.3.2
## [85] fitdistrplus_1.1-11 ROCR_1.0-11 nlme_3.1-162
## [88] bit64_4.0.5 progress_1.2.2 filelock_1.0.2
## [91] RcppAnnoy_0.0.21 rprojroot_2.0.3 bslib_0.5.1
## [94] irlba_2.3.5.1 rpart_4.1.19 KernSmooth_2.23-21
## [97] colorspace_2.1-0 DBI_1.1.3 Hmisc_5.1-1
## [100] nnet_7.3-19 tidyselect_1.2.0 processx_3.8.2
## [103] bit_4.0.5 compiler_4.3.1 curl_5.1.0
## [106] htmlTable_2.4.1 xml2_1.3.5 desc_1.4.2
## [109] DelayedArray_0.26.7 plotly_4.10.2 rtracklayer_1.60.1
## [112] checkmate_2.2.0 scales_1.2.1 lmtest_0.9-40
## [115] callr_3.7.3 rappdirs_0.3.3 stringr_1.5.0
## [118] digest_0.6.33 goftest_1.2-3 spatstat.utils_3.0-3
## [121] minqa_1.2.6 rmarkdown_2.25 XVector_0.40.0
## [124] jpeg_0.1-10 base64enc_0.1-3 htmltools_0.5.6.1
## [127] pkgconfig_2.0.3 lme4_1.1-34 ensembldb_2.24.1
## [130] dbplyr_2.3.4 fastmap_1.1.1 rlang_1.1.1
## [133] htmlwidgets_1.6.2 shiny_1.7.5 farver_2.1.1
## [136] jquerylib_0.1.4 zoo_1.8-12 jsonlite_1.8.7
## [139] BiocParallel_1.34.2 R.oo_1.25.0 VariantAnnotation_1.46.0
## [142] RCurl_1.98-1.12 magrittr_2.0.3 Formula_1.2-5
## [145] GenomeInfoDbData_1.2.10 munsell_0.5.0 Rcpp_1.0.11
## [148] reticulate_1.32.0 stringi_1.7.12 zlibbioc_1.46.0
## [151] MASS_7.3-60 plyr_1.8.9 pkgbuild_1.4.2
## [154] parallel_4.3.1 listenv_0.9.0 ggrepel_0.9.3
## [157] deldir_1.0-9 Biostrings_2.68.1 splines_4.3.1
## [160] tensor_1.5 hms_1.1.3 ps_1.7.5
## [163] igraph_1.5.1 spatstat.geom_3.2-5 reshape2_1.4.4
## [166] biomaRt_2.56.1 XML_3.99-0.14 evaluate_0.22
## [169] latticeExtra_0.6-30 biovizBase_1.48.0 BiocManager_1.30.22
## [172] tweenr_2.0.2 nloptr_2.0.3 httpuv_1.6.11
## [175] RANN_2.6.1 tidyr_1.3.0 purrr_1.0.2
## [178] polyclip_1.10-6 future_1.33.0 scattermore_1.2
## [181] ggforce_0.4.1 rsvd_1.0.5 xtable_1.8-4
## [184] AnnotationFilter_1.24.0 restfulr_0.0.15 later_1.3.1
## [187] viridisLite_0.4.2 ragg_1.2.6 tibble_3.2.1
## [190] memoise_2.0.1 AnnotationDbi_1.62.2 GenomicAlignments_1.36.0
## [193] cluster_2.1.4 globals_0.16.2