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(JASPAR2018)
library(TFBSTools)
library(BSgenome.Hsapiens.UCSC.hg19)

# extract position frequency matrices for the motifs
pwm <- getMatrixSet(
  x = JASPAR2018,
  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.0.1 (2020-06-06)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.5 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
## 
## 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.58.0                  
##  [3] rtracklayer_1.50.0                Biostrings_2.58.0                
##  [5] XVector_0.30.0                    GenomicRanges_1.42.0             
##  [7] GenomeInfoDb_1.26.5               IRanges_2.24.1                   
##  [9] S4Vectors_0.28.1                  BiocGenerics_0.36.0              
## [11] TFBSTools_1.28.0                  JASPAR2018_1.1.1                 
## [13] motifmatchr_1.12.0                SeuratObject_4.0.0               
## [15] Seurat_4.0.1.9005                 Signac_1.2.0                     
## 
## loaded via a namespace (and not attached):
##   [1] utf8_1.2.1                  R.utils_2.10.1             
##   [3] reticulate_1.19             tidyselect_1.1.0           
##   [5] AnnotationDbi_1.52.0        poweRlaw_0.70.6            
##   [7] RSQLite_2.2.7               htmlwidgets_1.5.3          
##   [9] grid_4.0.1                  docopt_0.7.1               
##  [11] BiocParallel_1.24.1         Rtsne_0.15                 
##  [13] munsell_0.5.0               codetools_0.2-18           
##  [15] ragg_1.1.2                  ica_1.0-2                  
##  [17] future_1.21.0               miniUI_0.1.1.1             
##  [19] colorspace_2.0-0            Biobase_2.50.0             
##  [21] highr_0.9                   knitr_1.33                 
##  [23] ROCR_1.0-11                 tensor_1.5                 
##  [25] listenv_0.8.0               MatrixGenerics_1.2.1       
##  [27] labeling_0.4.2              slam_0.1-48                
##  [29] GenomeInfoDbData_1.2.4      polyclip_1.10-0            
##  [31] bit64_4.0.5                 farver_2.1.0               
##  [33] rprojroot_2.0.2             parallelly_1.24.0          
##  [35] vctrs_0.3.7                 generics_0.1.0             
##  [37] xfun_0.22                   lsa_0.73.2                 
##  [39] ggseqlogo_0.1               R6_2.5.0                   
##  [41] bitops_1.0-7                spatstat.utils_2.1-0       
##  [43] cachem_1.0.4                DelayedArray_0.16.3        
##  [45] assertthat_0.2.1            promises_1.2.0.1           
##  [47] scales_1.1.1                gtable_0.3.0               
##  [49] globals_0.14.0              goftest_1.2-2              
##  [51] seqLogo_1.56.0              rlang_0.4.10               
##  [53] systemfonts_1.0.1           RcppRoll_0.3.0             
##  [55] splines_4.0.1               lazyeval_0.2.2             
##  [57] spatstat.geom_2.1-0         yaml_2.2.1                 
##  [59] reshape2_1.4.4              abind_1.4-5                
##  [61] httpuv_1.6.0                tools_4.0.1                
##  [63] ggplot2_3.3.3               ellipsis_0.3.1             
##  [65] spatstat.core_2.1-2         jquerylib_0.1.4            
##  [67] RColorBrewer_1.1-2          ggridges_0.5.3             
##  [69] Rcpp_1.0.6                  plyr_1.8.6                 
##  [71] zlibbioc_1.36.0             purrr_0.3.4                
##  [73] RCurl_1.98-1.3              rpart_4.1-15               
##  [75] deldir_0.2-10               pbapply_1.4-3              
##  [77] cowplot_1.1.1               zoo_1.8-9                  
##  [79] SummarizedExperiment_1.20.0 ggrepel_0.9.1              
##  [81] cluster_2.1.2               fs_1.5.0                   
##  [83] magrittr_2.0.1              data.table_1.14.0          
##  [85] scattermore_0.7             lmtest_0.9-38              
##  [87] RANN_2.6.1                  SnowballC_0.7.0            
##  [89] fitdistrplus_1.1-3          matrixStats_0.58.0         
##  [91] hms_1.0.0                   patchwork_1.1.1            
##  [93] mime_0.10                   evaluate_0.14              
##  [95] xtable_1.8-4                XML_3.99-0.6               
##  [97] sparsesvd_0.2               gridExtra_2.3              
##  [99] compiler_4.0.1              tibble_3.1.1               
## [101] KernSmooth_2.23-18          crayon_1.4.1               
## [103] R.oo_1.24.0                 htmltools_0.5.1.1          
## [105] mgcv_1.8-33                 later_1.2.0                
## [107] tidyr_1.1.3                 DBI_1.1.1                  
## [109] tweenr_1.0.2                MASS_7.3-53.1              
## [111] Matrix_1.3-2                readr_1.4.0                
## [113] R.methodsS3_1.8.1           igraph_1.2.6               
## [115] pkgconfig_2.0.3             pkgdown_1.6.1              
## [117] GenomicAlignments_1.26.0    TFMPvalue_0.0.8            
## [119] plotly_4.9.3                spatstat.sparse_2.0-0      
## [121] annotate_1.68.0             bslib_0.2.4                
## [123] DirichletMultinomial_1.32.0 stringr_1.4.0              
## [125] digest_0.6.27               pracma_2.3.3               
## [127] sctransform_0.3.2           RcppAnnoy_0.0.18           
## [129] CNEr_1.26.0                 spatstat.data_2.1-0        
## [131] rmarkdown_2.7               leiden_0.3.7               
## [133] fastmatch_1.1-0             uwot_0.1.10                
## [135] shiny_1.6.0                 Rsamtools_2.6.0            
## [137] gtools_3.8.2                lifecycle_1.0.0            
## [139] nlme_3.1-152                jsonlite_1.7.2             
## [141] desc_1.3.0                  viridisLite_0.4.0          
## [143] fansi_0.4.2                 pillar_1.6.0               
## [145] lattice_0.20-41             KEGGREST_1.30.1            
## [147] GO.db_3.12.1                fastmap_1.1.0              
## [149] httr_1.4.2                  survival_3.2-11            
## [151] glue_1.4.2                  qlcMatrix_0.9.7            
## [153] png_0.1-7                   bit_4.0.4                  
## [155] ggforce_0.3.3               stringi_1.5.3              
## [157] sass_0.3.1                  blob_1.2.1                 
## [159] textshaping_0.3.3           caTools_1.18.2             
## [161] memoise_2.0.0               dplyr_1.0.5                
## [163] irlba_2.3.3                 future.apply_1.7.0