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.4.1
## 
## 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] C/UTF-8/C/C/C/C
## 
## 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.70.2                  
##  [3] rtracklayer_1.62.0                BiocIO_1.12.0                    
##  [5] Biostrings_2.70.2                 XVector_0.42.0                   
##  [7] GenomicRanges_1.54.1              GenomeInfoDb_1.38.7              
##  [9] IRanges_2.36.0                    S4Vectors_0.40.2                 
## [11] BiocGenerics_0.48.1               TFBSTools_1.40.0                 
## [13] JASPAR2020_0.99.10                motifmatchr_1.24.0               
## [15] Seurat_5.0.3                      SeuratObject_5.0.1               
## [17] sp_2.1-3                          Signac_1.13.0                    
## 
## loaded via a namespace (and not attached):
##   [1] RcppAnnoy_0.0.22            splines_4.3.1              
##   [3] later_1.3.2                 bitops_1.0-7               
##   [5] R.oo_1.26.0                 tibble_3.2.1               
##   [7] polyclip_1.10-6             XML_3.99-0.16.1            
##   [9] DirichletMultinomial_1.44.0 fastDummies_1.7.3          
##  [11] lifecycle_1.0.4             globals_0.16.3             
##  [13] lattice_0.22-6              MASS_7.3-60.0.1            
##  [15] magrittr_2.0.3              plotly_4.10.4              
##  [17] sass_0.4.9                  rmarkdown_2.26             
##  [19] jquerylib_0.1.4             yaml_2.3.8                 
##  [21] httpuv_1.6.15               sctransform_0.4.1          
##  [23] spam_2.10-0                 spatstat.sparse_3.0-3      
##  [25] reticulate_1.35.0           cowplot_1.1.3              
##  [27] pbapply_1.7-2               DBI_1.2.2                  
##  [29] CNEr_1.38.0                 RColorBrewer_1.1-3         
##  [31] abind_1.4-5                 zlibbioc_1.48.0            
##  [33] Rtsne_0.17                  R.utils_2.12.3             
##  [35] purrr_1.0.2                 RCurl_1.98-1.14            
##  [37] pracma_2.4.4                GenomeInfoDbData_1.2.11    
##  [39] ggrepel_0.9.5               irlba_2.3.5.1              
##  [41] listenv_0.9.1               spatstat.utils_3.0-4       
##  [43] seqLogo_1.68.0              goftest_1.2-3              
##  [45] RSpectra_0.16-1             annotate_1.80.0            
##  [47] spatstat.random_3.2-3       fitdistrplus_1.1-11        
##  [49] parallelly_1.37.1           pkgdown_2.0.7              
##  [51] DelayedArray_0.28.0         leiden_0.4.3.1             
##  [53] codetools_0.2-19            RcppRoll_0.3.0             
##  [55] tidyselect_1.2.1            farver_2.1.1               
##  [57] matrixStats_1.2.0           spatstat.explore_3.2-7     
##  [59] GenomicAlignments_1.38.2    jsonlite_1.8.8             
##  [61] progressr_0.14.0            ggridges_0.5.6             
##  [63] survival_3.5-8              systemfonts_1.0.6          
##  [65] tools_4.3.1                 ragg_1.3.0                 
##  [67] TFMPvalue_0.0.9             ica_1.0-3                  
##  [69] Rcpp_1.0.12                 glue_1.7.0                 
##  [71] SparseArray_1.2.4           gridExtra_2.3              
##  [73] xfun_0.43                   MatrixGenerics_1.14.0      
##  [75] dplyr_1.1.4                 withr_3.0.0                
##  [77] fastmap_1.1.1               fansi_1.0.6                
##  [79] caTools_1.18.2              digest_0.6.35              
##  [81] R6_2.5.1                    mime_0.12                  
##  [83] textshaping_0.3.7           colorspace_2.1-0           
##  [85] GO.db_3.18.0                scattermore_1.2            
##  [87] poweRlaw_0.80.0             gtools_3.9.5               
##  [89] tensor_1.5                  spatstat.data_3.0-4        
##  [91] RSQLite_2.3.5               R.methodsS3_1.8.2          
##  [93] utf8_1.2.4                  tidyr_1.3.1                
##  [95] generics_0.1.3              data.table_1.15.4          
##  [97] S4Arrays_1.2.1              httr_1.4.7                 
##  [99] htmlwidgets_1.6.4           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.8             dotCall64_1.1-1            
## [107] scales_1.3.0                Biobase_2.62.0             
## [109] png_0.1-8                   knitr_1.45                 
## [111] tzdb_0.4.0                  rjson_0.2.21               
## [113] reshape2_1.4.4              nlme_3.1-164               
## [115] cachem_1.0.8                zoo_1.8-12                 
## [117] stringr_1.5.1               KernSmooth_2.23-22         
## [119] parallel_4.3.1              miniUI_0.1.1.1             
## [121] AnnotationDbi_1.64.1        restfulr_0.0.15            
## [123] desc_1.4.3                  pillar_1.9.0               
## [125] grid_4.3.1                  vctrs_0.6.5                
## [127] RANN_2.6.1                  promises_1.2.1             
## [129] xtable_1.8-4                cluster_2.1.6              
## [131] evaluate_0.23               readr_2.1.5                
## [133] cli_3.6.2                   compiler_4.3.1             
## [135] Rsamtools_2.18.0            rlang_1.1.3                
## [137] crayon_1.5.2                future.apply_1.11.2        
## [139] labeling_0.4.3              plyr_1.8.9                 
## [141] fs_1.6.3                    stringi_1.8.3              
## [143] viridisLite_0.4.2           deldir_2.0-4               
## [145] BiocParallel_1.36.0         munsell_0.5.0              
## [147] lazyeval_0.2.2              spatstat.geom_3.2-9        
## [149] Matrix_1.6-5                RcppHNSW_0.6.0             
## [151] hms_1.1.3                   patchwork_1.2.0            
## [153] bit64_4.0.5                 future_1.33.2              
## [155] ggplot2_3.5.0               KEGGREST_1.42.0            
## [157] shiny_1.8.1                 SummarizedExperiment_1.32.0
## [159] highr_0.10                  ROCR_1.0-11                
## [161] igraph_2.0.3                memoise_2.0.1              
## [163] bslib_0.6.2                 fastmatch_1.1-4            
## [165] bit_4.0.5