Skip to contents

Introduction

chromTFR is the chromatin accessibility counterpart of methylTFR. It uses the same annotation, but methylation levels are replaced by Tn5 insertion densities: for every binding site of a motif the insertions are counted per base, the sites are stacked on their centre and the average gives the footprint. A protein bound to the motif shields the DNA from Tn5, so the profile dips in the centre and rises on the flanks.

The deviation score is that shape as one number, the insertion density of the central window over the density of the outer flanks, corrected by the same ratio computed on an expected profile.

The expected profile

Two models are available.

The GC model follows methylTFR: the genome wide insertion density is summarised per GC bin with addGCBintoAccessome() and combined with the GC bin composition of the binding sites by computeAccExpectations().

The k-mer model captures the sequence preference of Tn5 directly. computeKmerBias() counts the k-mer centred on every observed cut and compares it with the frequency of that k-mer in the accessible genome, and kmerBiasProfile() averages those weights along the binding sites. The motif is a fixed string of letters at the centre of every window, so this term matters: for an AT-rich motif Tn5 cuts less in the centre for chemical reasons alone, which looks like protection.

A minimal workflow

library(chromTFR)

dsa <- loadAccDataset("dsATAC_filtered")
peaks <- getAccRegions(dsa, regionType = ".peaks.cons", extend = 500)
ins <- getTn5Insertions(dsa, getAccSamples(dsa)[1], regions = peaks)

tfbs <- prepareTFBS(tf_bindsites[["CTCF"]])
profile <- accProfile(ins, tfbs)
accDeviationScore(profile)

runChromTFR() runs the GC based workflow over every sample and motif and returns a SummarizedExperiment with the deviations, their row-wise z-scores and the expected deviations.

Figures

accFootprintData() builds the observed and expected curves of one motif for a named list of samples or group aggregates, and plotAccFootprintGrid() draws them as two rows, the profiles on top and the corrected curves below, each labelled with its deviation score.

For a per sample overview, accObservedMatrix() and accExpectedMatrix() give the two halves of the deviation matrix and plotAccDeviationHeatmap() draws the row-wise z-scores. Fit the Tn5 model per sample there: with one shared model the expected term is constant per motif and cancels out of a row-wise z-score.

Relation to chromVAR

The deviation score here is a footprint depth: the insertion density of the central window over the density of the outer flanks. chromVAR measures a different quantity, the accessibility of the peaks that carry a motif, which corresponds to the flanking accessibility rather than to the depth of the footprint. The two are separate axes of the same picture (Baek et al. 2017; Corces et al. 2018, Fig. 4), so a motif can move in one and not in the other. A heatmap of these scores is not expected to reproduce a chromVAR heatmap, and the sign is opposite: a deeper footprint, meaning more protection, gives a lower score.

Analysis scripts

Template scripts for the whole workflow are installed with the package. Copy one, set the paths and the grouping column at the top, and run it.

list.files(system.file("scripts", package = "chromTFR"))

Session info

sessionInfo()
#> R version 4.3.3 (2024-02-29)
#> Platform: x86_64-conda-linux-gnu (64-bit)
#> Running under: Debian GNU/Linux 12 (bookworm)
#> 
#> Matrix products: default
#> BLAS/LAPACK: /icbb/projects/share/software/packages/miniconda3/envs/chromTFR/lib/libopenblasp-r0.3.34.so;  LAPACK version 3.12.0
#> 
#> locale:
#> [1] C
#> 
#> time zone: Europe/Berlin
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] BiocStyle_2.30.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.37       desc_1.4.3          R6_2.6.1           
#>  [4] bookdown_0.48       fastmap_1.2.0       xfun_0.61          
#>  [7] cachem_1.1.0        knitr_1.50          htmltools_0.5.8.1  
#> [10] rmarkdown_2.29      lifecycle_1.0.4     cli_3.6.5          
#> [13] sass_0.4.10         pkgdown_2.1.3       textshaping_1.0.3  
#> [16] jquerylib_0.1.4     systemfonts_1.2.3   compiler_4.3.3     
#> [19] tools_4.3.3         ragg_1.5.0          evaluate_1.0.5     
#> [22] bslib_0.9.0         yaml_2.3.10         BiocManager_1.30.26
#> [25] jsonlite_2.0.0      rlang_1.1.6         fs_1.6.6           
#> [28] htmlwidgets_1.6.4