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.1.0 (2021-05-18)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.2 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats4    parallel  stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] BSgenome.Hsapiens.UCSC.hg19_1.4.3 BSgenome_1.60.0                  
##  [3] rtracklayer_1.52.1                Biostrings_2.60.2                
##  [5] XVector_0.32.0                    GenomicRanges_1.44.0             
##  [7] GenomeInfoDb_1.28.4               IRanges_2.26.0                   
##  [9] S4Vectors_0.30.0                  BiocGenerics_0.38.0              
## [11] TFBSTools_1.30.0                  JASPAR2020_0.99.10               
## [13] motifmatchr_1.14.0                SeuratObject_4.0.2               
## [15] Seurat_4.0.4                      Signac_1.4.0                     
## 
## loaded via a namespace (and not attached):
##   [1] utf8_1.2.2                  R.utils_2.10.1             
##   [3] reticulate_1.22             tidyselect_1.1.1           
##   [5] AnnotationDbi_1.54.1        poweRlaw_0.70.6            
##   [7] RSQLite_2.2.8               htmlwidgets_1.5.4          
##   [9] grid_4.1.0                  docopt_0.7.1               
##  [11] BiocParallel_1.26.2         Rtsne_0.15                 
##  [13] munsell_0.5.0               codetools_0.2-18           
##  [15] ragg_1.1.3                  ica_1.0-2                  
##  [17] future_1.22.1               miniUI_0.1.1.1             
##  [19] colorspace_2.0-2            Biobase_2.52.0             
##  [21] highr_0.9                   knitr_1.34                 
##  [23] ROCR_1.0-11                 tensor_1.5                 
##  [25] listenv_0.8.0               MatrixGenerics_1.4.3       
##  [27] labeling_0.4.2              slam_0.1-48                
##  [29] GenomeInfoDbData_1.2.6      polyclip_1.10-0            
##  [31] bit64_4.0.5                 farver_2.1.0               
##  [33] rprojroot_2.0.2             parallelly_1.28.1          
##  [35] vctrs_0.3.8                 generics_0.1.0             
##  [37] xfun_0.26                   lsa_0.73.2                 
##  [39] ggseqlogo_0.1               R6_2.5.1                   
##  [41] bitops_1.0-7                spatstat.utils_2.2-0       
##  [43] cachem_1.0.6                DelayedArray_0.18.0        
##  [45] assertthat_0.2.1            BiocIO_1.2.0               
##  [47] promises_1.2.0.1            scales_1.1.1               
##  [49] gtable_0.3.0                globals_0.14.0             
##  [51] goftest_1.2-2               seqLogo_1.58.0             
##  [53] rlang_0.4.11                systemfonts_1.0.2          
##  [55] RcppRoll_0.3.0              splines_4.1.0              
##  [57] lazyeval_0.2.2              spatstat.geom_2.2-2        
##  [59] yaml_2.2.1                  reshape2_1.4.4             
##  [61] abind_1.4-5                 httpuv_1.6.3               
##  [63] tools_4.1.0                 ggplot2_3.3.5              
##  [65] ellipsis_0.3.2              spatstat.core_2.3-0        
##  [67] jquerylib_0.1.4             RColorBrewer_1.1-2         
##  [69] ggridges_0.5.3              Rcpp_1.0.7                 
##  [71] plyr_1.8.6                  zlibbioc_1.38.0            
##  [73] purrr_0.3.4                 RCurl_1.98-1.5             
##  [75] rpart_4.1-15                deldir_0.2-10              
##  [77] pbapply_1.5-0               cowplot_1.1.1              
##  [79] zoo_1.8-9                   SummarizedExperiment_1.22.0
##  [81] ggrepel_0.9.1               cluster_2.1.2              
##  [83] fs_1.5.0                    magrittr_2.0.1             
##  [85] data.table_1.14.0           scattermore_0.7            
##  [87] lmtest_0.9-38               RANN_2.6.1                 
##  [89] SnowballC_0.7.0             fitdistrplus_1.1-5         
##  [91] matrixStats_0.61.0          hms_1.1.0                  
##  [93] patchwork_1.1.1             mime_0.11                  
##  [95] evaluate_0.14               xtable_1.8-4               
##  [97] XML_3.99-0.8                sparsesvd_0.2              
##  [99] gridExtra_2.3               compiler_4.1.0             
## [101] tibble_3.1.4                KernSmooth_2.23-20         
## [103] crayon_1.4.1                R.oo_1.24.0                
## [105] htmltools_0.5.2             tzdb_0.1.2                 
## [107] mgcv_1.8-36                 later_1.3.0                
## [109] tidyr_1.1.3                 DBI_1.1.1                  
## [111] tweenr_1.0.2                MASS_7.3-54                
## [113] readr_2.0.1                 Matrix_1.3-4               
## [115] R.methodsS3_1.8.1           igraph_1.2.6               
## [117] pkgconfig_2.0.3             pkgdown_1.6.1.9001         
## [119] GenomicAlignments_1.28.0    TFMPvalue_0.0.8            
## [121] plotly_4.9.4.1              spatstat.sparse_2.0-0      
## [123] annotate_1.70.0             bslib_0.3.0                
## [125] DirichletMultinomial_1.34.0 stringr_1.4.0              
## [127] digest_0.6.27               pracma_2.3.3               
## [129] sctransform_0.3.2           RcppAnnoy_0.0.19           
## [131] CNEr_1.28.0                 spatstat.data_2.1-0        
## [133] rmarkdown_2.11              leiden_0.3.9               
## [135] fastmatch_1.1-3             uwot_0.1.10                
## [137] restfulr_0.0.13             shiny_1.6.0                
## [139] Rsamtools_2.8.0             gtools_3.9.2               
## [141] rjson_0.2.20                lifecycle_1.0.0            
## [143] nlme_3.1-152                jsonlite_1.7.2             
## [145] desc_1.3.0                  viridisLite_0.4.0          
## [147] fansi_0.5.0                 pillar_1.6.2               
## [149] lattice_0.20-44             GO.db_3.13.0               
## [151] KEGGREST_1.32.0             fastmap_1.1.0              
## [153] httr_1.4.2                  survival_3.2-11            
## [155] glue_1.4.2                  qlcMatrix_0.9.7            
## [157] png_0.1-7                   bit_4.0.4                  
## [159] ggforce_0.3.3               stringi_1.7.4              
## [161] sass_0.4.0                  blob_1.2.2                 
## [163] textshaping_0.3.5           caTools_1.18.2             
## [165] memoise_2.0.0               dplyr_1.0.7                
## [167] irlba_2.3.3                 future.apply_1.8.1