Data loading

For this vignette we’ll use the dataset introduced and pre-processed in the trajectory building vignette.

bone <- readRDS("../vignette_data/cd34.rds")
DimPlot(bone, label = TRUE)

To perform a footprinting analysis we first need to add motif information to the object, including the exact positions of each motif. This can be done using functions from the and packages.

library(motifmatchr)
library(JASPAR2020)
library(TFBSTools)
library(BSgenome.Hsapiens.UCSC.hg19)

# extract position frequency matrices for the motifs
pwm <- getMatrixSet(
  x = JASPAR2020,
  opts = list(species = 9606, all_versions = FALSE)
)

# add motif information
bone <- AddMotifs(bone, genome = BSgenome.Hsapiens.UCSC.hg19, pfm = pwm)

Motif footprinting

Now we can footprint any motif that we have positional information for. By default, this includes every instance of the motif in the genome. We can instead use the in.peaks = TRUE parameter to include only those motifs that fall inside a peak in the assay. The Footprint() function gathers all the required data and stores it in the assay. We can then plot the footprinted motifs using the PlotFootprint() function.

# gather the footprinting information for sets of motifs
bone <- Footprint(
  object = bone,
  motif.name = c("GATA2", "CEBPA", "EBF1"),
  genome = BSgenome.Hsapiens.UCSC.hg19
)

# plot the footprint data for each group of cells
p2 <- PlotFootprint(bone, features = c("GATA2", "CEBPA", "EBF1"))
p2 + patchwork::plot_layout(ncol = 1)

Session Info
## 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] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] BSgenome.Hsapiens.UCSC.hg19_1.4.3 BSgenome_1.68.0                  
##  [3] rtracklayer_1.60.1                Biostrings_2.68.1                
##  [5] XVector_0.40.0                    GenomicRanges_1.52.0             
##  [7] GenomeInfoDb_1.36.3               IRanges_2.34.1                   
##  [9] S4Vectors_0.38.2                  BiocGenerics_0.46.0              
## [11] TFBSTools_1.38.0                  JASPAR2020_0.99.10               
## [13] motifmatchr_1.22.0                SeuratObject_4.1.4               
## [15] Seurat_4.4.0                      Signac_1.11.0                    
## 
## loaded via a namespace (and not attached):
##   [1] RcppAnnoy_0.0.21            splines_4.3.1              
##   [3] later_1.3.1                 BiocIO_1.10.0              
##   [5] bitops_1.0-7                R.oo_1.25.0                
##   [7] tibble_3.2.1                polyclip_1.10-6            
##   [9] XML_3.99-0.14               DirichletMultinomial_1.42.0
##  [11] lifecycle_1.0.3             rprojroot_2.0.3            
##  [13] globals_0.16.2              lattice_0.21-8             
##  [15] MASS_7.3-60                 magrittr_2.0.3             
##  [17] plotly_4.10.2               sass_0.4.7                 
##  [19] rmarkdown_2.25              jquerylib_0.1.4            
##  [21] yaml_2.3.7                  httpuv_1.6.11              
##  [23] sctransform_0.4.0           sp_2.1-0                   
##  [25] spatstat.sparse_3.0-2       reticulate_1.32.0          
##  [27] cowplot_1.1.1               pbapply_1.7-2              
##  [29] DBI_1.1.3                   CNEr_1.35.0                
##  [31] RColorBrewer_1.1-3          abind_1.4-5                
##  [33] zlibbioc_1.46.0             Rtsne_0.16                 
##  [35] R.utils_2.12.2              purrr_1.0.2                
##  [37] RCurl_1.98-1.12             pracma_2.4.2               
##  [39] GenomeInfoDbData_1.2.10     ggrepel_0.9.3              
##  [41] irlba_2.3.5.1               listenv_0.9.0              
##  [43] spatstat.utils_3.0-3        seqLogo_1.66.0             
##  [45] goftest_1.2-3               annotate_1.78.0            
##  [47] spatstat.random_3.1-6       fitdistrplus_1.1-11        
##  [49] parallelly_1.36.0           pkgdown_2.0.7              
##  [51] DelayedArray_0.26.7         leiden_0.4.3               
##  [53] codetools_0.2-19            RcppRoll_0.3.0             
##  [55] tidyselect_1.2.0            farver_2.1.1               
##  [57] matrixStats_1.0.0           spatstat.explore_3.2-3     
##  [59] GenomicAlignments_1.36.0    jsonlite_1.8.7             
##  [61] ellipsis_0.3.2              progressr_0.14.0           
##  [63] ggridges_0.5.4              survival_3.5-5             
##  [65] systemfonts_1.0.5           tools_4.3.1                
##  [67] ragg_1.2.6                  TFMPvalue_0.0.9            
##  [69] ica_1.0-3                   Rcpp_1.0.11                
##  [71] glue_1.6.2                  gridExtra_2.3              
##  [73] xfun_0.40                   MatrixGenerics_1.12.3      
##  [75] dplyr_1.1.3                 withr_2.5.1                
##  [77] fastmap_1.1.1               fansi_1.0.5                
##  [79] caTools_1.18.2              digest_0.6.33              
##  [81] R6_2.5.1                    mime_0.12                  
##  [83] textshaping_0.3.7           colorspace_2.1-0           
##  [85] GO.db_3.17.0                scattermore_1.2            
##  [87] poweRlaw_0.70.6             gtools_3.9.4               
##  [89] tensor_1.5                  spatstat.data_3.0-1        
##  [91] RSQLite_2.3.1               R.methodsS3_1.8.2          
##  [93] utf8_1.2.3                  tidyr_1.3.0                
##  [95] generics_0.1.3              data.table_1.14.8          
##  [97] S4Arrays_1.0.6              httr_1.4.7                 
##  [99] htmlwidgets_1.6.2           uwot_0.1.16                
## [101] pkgconfig_2.0.3             gtable_0.3.4               
## [103] blob_1.2.4                  lmtest_0.9-40              
## [105] htmltools_0.5.6.1           scales_1.2.1               
## [107] Biobase_2.60.0              png_0.1-8                  
## [109] knitr_1.44                  rstudioapi_0.15.0          
## [111] tzdb_0.4.0                  rjson_0.2.21               
## [113] reshape2_1.4.4              nlme_3.1-162               
## [115] cachem_1.0.8                zoo_1.8-12                 
## [117] stringr_1.5.0               KernSmooth_2.23-21         
## [119] parallel_4.3.1              miniUI_0.1.1.1             
## [121] AnnotationDbi_1.62.2        restfulr_0.0.15            
## [123] desc_1.4.2                  pillar_1.9.0               
## [125] grid_4.3.1                  vctrs_0.6.3                
## [127] RANN_2.6.1                  promises_1.2.1             
## [129] xtable_1.8-4                cluster_2.1.4              
## [131] evaluate_0.22               readr_2.1.4                
## [133] cli_3.6.1                   compiler_4.3.1             
## [135] Rsamtools_2.16.0            rlang_1.1.1                
## [137] crayon_1.5.2                future.apply_1.11.0        
## [139] labeling_0.4.3              plyr_1.8.9                 
## [141] fs_1.6.3                    stringi_1.7.12             
## [143] viridisLite_0.4.2           deldir_1.0-9               
## [145] BiocParallel_1.34.2         munsell_0.5.0              
## [147] lazyeval_0.2.2              spatstat.geom_3.2-5        
## [149] Matrix_1.6-1.1              hms_1.1.3                  
## [151] patchwork_1.1.3             bit64_4.0.5                
## [153] future_1.33.0               ggplot2_3.4.4              
## [155] KEGGREST_1.40.1             shiny_1.7.5                
## [157] SummarizedExperiment_1.30.2 ROCR_1.0-11                
## [159] igraph_1.5.1                memoise_2.0.1              
## [161] bslib_0.5.1                 fastmatch_1.1-4            
## [163] bit_4.0.5