1 Motivation and Summary

Genetic variants associated with diseases often affect non-coding regions, thus likely having a regulatory role. To understand the effects of genetic variants in these regulatory regions, identifying genes that are modulated by specific regulatory elements (REs) is crucial. The effect of gene regulatory elements, such as enhancers, is often cell-type specific, likely because the combinations of transcription factors (TFs) that are regulating a given enhancer have cell-type specific activity. This TF activity can be quantified with existing tools such as diffTF and captures differences in binding of a TF in open chromatin regions. Collectively, this forms a enhancer-mediated gene regulatory network (eGRN) with cell-type and data-specific TF-RE and RE-gene links. Here, we reconstruct such a eGRN using bulk RNA-seq and open chromatin (e.g., using ATAC-seq or ChIP-seq for open chromatin marks) and optionally TF activity data. Our network contains different types of links, connecting TFs to regulatory elements, the latter of which is connected to genes in the vicinity or within the same chromatin domain (TAD). We use a statistical framework to assign empirical FDRs and weights to all links using a permutation-based approach.

For a more detailed description of the package, its mode of action, guidelines, recommendations, limitations, scope, etc,please see the Package Details Vignette on the GRaNIE website.

2 Example data

Before we start with the package, let’s retrieve some example data! For the purpose of this vignette, the data we will use is taken from here 1, has been minimally processed to meet the requirements of the GRaNIE package and consists of the following files:

In general, the dataset is from human macrophages (both naive and IFNg primed) of healthy individuals and various stimulations / infections (naive vs primed and infected with SL1344 vs not), with 4 groups in total: control/infected(SL1344) and naive/primed(IFNg)

Furthermore, the example dataset is accompanied by the following files:

3 Example Workflow

In the following example, you will use the example data to construct a eGRN from ATAC-seq, RNA-seq data as well transcription factor (TF) data.

First, let’s load the required libraries. The readr package is already loaded and attached when loading the GRaNIE package, but we nevertheless load it here explicitly to highlight that we’ll use various `readr`` functions for data import.

For reasons of brevity, we omit the output of this code chunk.


3.1 Install suggested, additional packages for full functionality

When installing GRaNIE, all required dependency packages are automatically installed. In addition, GRaNIE needs some additional packages for special functionality, packages that are not strictly necessary for the workflow but which enhance the functionality, may be required depending on certain parameters (such as your genome assembly version), or may be required only when using a particular functionality (such as the robust package for robust regression). The package will automatically check if any of these packages are missing during execution, and inform the user when a package is missing, along with a line to copy for pasting into R for installation.

3.2 General notes

Each of the GRaNIE functions we mention here in this Vignette comes with sensible default parameters that we found to work well for most of the datasets we tested it with so far. For the purpose of this Vignette, however, and the resulting running times, we here try to provide a good compromise between biological necessity and computational efficacy. However, always check the validity and usefulness of the parameters before starting an analysis to avoid unreasonable results.

3.3 Reading the data required for the GRaNIE package

To set up a GRaNIE analysis, we first need to read in some data into R.

For a more detailed description and list of the required and optional input data, please see the Package Details Vignette on the GRaNIE website.

Briefly, the following data can be used for the GRaNIE package:

  • open chromatin / peak data (from either ATAC-Seq, DNAse-Seq or ChIP-Seq data, for example), hereafter simply referred to as enhancers
  • RNA-Seq data (gene expression counts for genes across samples)

The following data can be used optionally but are not required:

  • sample metadata (e.g., sex, gender, age, sequencing batch, etc)
  • TAD domains (bed file, not used here in this vignette)

So, let’s import the enhancer and RNA-seq data as a data frame as well as some sample metadata. This can be done in any way you want as long as you end up with the right format.

# We load the example data directly from the web:
file_peaks = ""
file_RNA = ""
file_sampleMetadata = ""

countsRNA.df = read_tsv(file_RNA, col_types = cols())
countsPeaks.df = read_tsv(file_peaks, col_types = cols())
sampleMetadata.df = read_tsv(file_sampleMetadata, col_types = cols())

# Let's check how the data looks like

# Save the name of the respective ID columns
idColumn_peaks = "peakID"
idColumn_RNA = "ENSEMBL"
## # A tibble: 18,972 × 30
##    ENSEMBL babk_D bima_D cicb_D coyi_D diku_D eipl_D eiwy_D eofe_D fafq_D febc_D
##    <chr>    <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
##  1 ENSG00…  48933  48737  60581  93101  84980  91536  85728  35483  69674  58890
##  2 ENSG00…  49916  44086  50706  55893  57239  76418  75934  27926  57526  50491
##  3 ENSG00… 281733 211703 269460 239116 284509 389989 351867 164615 257471 304203
##  4 ENSG00…  98943  77503  92402  80927  96690 138149 115875  64368  91627 100039
##  5 ENSG00…  14749  15571  16540  16383  16886  21892  18045  10026  14663  15830
##  6 ENSG00…  64459  63734  71317  69612  72097 100487  78536  38572  65446  76910
##  7 ENSG00…  57449  55736  70798  66334  66424  91801  94729  40413  56916  66382
##  8 ENSG00…  15451  15570  15534  15945  10583  22601  16086   9275  16092  15291
##  9 ENSG00…  18717  18757  20051  18066  19648  28572  25240  11258  17739  20347
## 10 ENSG00… 168054 147822 178164 154220 168837 244731 215862  89368 158845 180734
## # … with 18,962 more rows, and 19 more variables: fikt_D <dbl>, guss_D <dbl>,
## #   hayt_D <dbl>, hehd_D <dbl>, heja_D <dbl>, hiaf_D <dbl>, iill_D <dbl>,
## #   kuxp_D <dbl>, nukw_D <dbl>, oapg_D <dbl>, oevr_D <dbl>, pamv_D <dbl>,
## #   pelm_D <dbl>, podx_D <dbl>, qolg_D <dbl>, sojd_D <dbl>, vass_D <dbl>,
## #   xugn_D <dbl>, zaui_D <dbl>
## # A tibble: 60,698 × 32
##    peakID  babk_D bima_D cicb_D coyi_D diku_D eipl_D eiwy_D eofe_D fafq_D febc_D
##    <chr>    <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
##  1 chrX:1…      3      7     10      5      4      6      3     18      4     22
##  2 chr15:…      5     28     38     11     20     19      7     53      5     22
##  3 chr12:…      5     14     18      5      3     13      5     15      2     25
##  4 chr1:1…     12     21     36      6     20     29     12     44      2    105
##  5 chr16:…      3     17     16      9      8     16      6     28      3     33
##  6 chr17:…      4     11      6      3      0      3      2      9      1     14
##  7 chr13:…     10     34     44     12     31     29      9     22      5     82
##  8 chr1:2…     21    113     46     28     44     57     47    146     12     91
##  9 chr14:…      5      9     14      6      6      9      8     16      2     26
## 10 chr8:1…      6      4     10      5      8     12      2      5      1     21
## # … with 60,688 more rows, and 21 more variables: fikt_D <dbl>, guss_D <dbl>,
## #   hayt_D <dbl>, hehd_D <dbl>, heja_D <dbl>, hiaf_D <dbl>, iill_D <dbl>,
## #   kuxp_D <dbl>, nukw_D <dbl>, oapg_D <dbl>, oevr_D <dbl>, pamv_D <dbl>,
## #   pelm_D <dbl>, podx_D <dbl>, qolg_D <dbl>, sojd_D <dbl>, vass_D <dbl>,
## #   xugn_D <dbl>, zaui_D <dbl>, uaqe_D <dbl>, qaqx_D <dbl>
## # A tibble: 31 × 16
##    sample…¹ assig…² assig…³ atac_date  clone condi…⁴ diff_start donor EB_forma…⁵
##    <chr>      <dbl>   <dbl> <date>     <dbl> <chr>   <date>     <chr> <date>    
##  1 babk_D    5.51e6   0.211 2015-12-04     2 IFNg_S… 2015-10-12 babk  2015-10-09
##  2 bima_D    2.33e7   0.677 2014-12-12     1 IFNg_S… 2014-11-07 bima  2014-11-04
##  3 cicb_D    1.98e7   0.580 2015-04-24     3 IFNg_S… 2015-03-30 cicb  2015-03-27
##  4 coyi_D    6.73e6   0.312 2015-11-05     3 IFNg_S… 2015-09-30 coyi  2015-09-27
##  5 diku_D    7.01e6   0.195 2015-11-13     1 IFNg_S… 2015-10-15 diku  2015-10-12
##  6 eipl_D    1.69e7   0.520 2015-08-04     1 IFNg_S… 2015-06-30 eipl  2015-06-27
##  7 eiwy_D    9.81e6   0.404 2015-12-02     1 IFNg_S… 2015-10-23 eiwy  2015-10-20
##  8 eofe_D    2.57e7   0.646 2014-12-12     1 IFNg_S… 2014-11-01 eofe  2014-10-29
##  9 fafq_D    4.60e6   0.415 2015-10-14     1 IFNg_S… 2015-09-16 fafq  2015-09-13
## 10 febc_D    3.17e7   0.430 2015-08-04     2 IFNg_S… 2015-07-06 febc  2015-07-03
## # … with 21 more rows, 7 more variables: macrophage_diff_days <dbl>,
## #   medium_changes <dbl>, mt_frac <dbl>, percent_duplication <dbl>,
## #   received_as <chr>, sex <chr>, short_long_ratio <dbl>, and abbreviated
## #   variable names ¹​sample_id, ²​assigned, ³​assigned_frac, ⁴​condition,
## #   ⁵​EB_formation

While we recommend raw counts for both enhancers and RNA-Seq as input and offer several normalization choices in the pipeline, it is also possible to provide pre-normalized data. Note that the normalization method may have a large influence on the resulting eGRN network, so make sure the choice of normalization is reasonable. For more details, see the next sections.

As you can see, both enhancers and RNA-Seq counts must have exactly one ID column, with all other columns being numeric. For enhancers, this column may be called peakID, for example, but the exact name is not important and can be specified as a parameter later when adding the data to the object. The same applies for the RNA-Seq data, whereas a sensible choice here is ensemblID, for example.

For the enhancer ID column, the required format is chr:start-end, with chr denoting the chromosome, followed by “:”, and then start, -, and end for the enhancer start and end, respectively. As the coordinates for the enhancers are needed in the pipeline, the format must be exactly as stated here.

You may notice that the enhancers and RNA-seq data have different samples being included, and not all are overlapping. This is not a problem and as long as some samples are found in both of them, the GRaNIE pipeline can work with it. Note that only the shared samples between both data modalities are kept, however, so make sure that the sample names match between them and share as many samples as possible.

3.4 Initialize a GRaNIE object

We got all the data in the right format, we can start with our GRaNIE analysis now! We start by specifying some parameters such as the genome assembly version the data have been produced with, as well as some optional object metadata that helps us to distinguish this GRaNIE object from others.

genomeAssembly = "hg38"  #Either hg19, hg38 or mm10. Both enhancers and RNA data must have the same genome assembly

# Optional and arbitrary list with information and metadata that is stored
# within the GRaNIE object
objectMetadata.l = list(name = paste0("Macrophages_infected_primed"), file_peaks = file_peaks,
    file_rna = file_RNA, file_sampleMetadata = file_sampleMetadata, genomeAssembly = genomeAssembly)

dir_output = "."

GRN = initializeGRN(objectMetadata = objectMetadata.l, outputFolder = dir_output,
    genomeAssembly = genomeAssembly)

## INFO [2022-11-01 17:42:02] Empty GRN object created successfully. Type the object name (e.g., GRN) to retrieve summary information about it at any time.
## INFO [2022-11-01 17:42:02]  Default output folder: /tmp/RtmpL36V6g/Rbuild1bb6f9636e23df/GRaNIE/vignettes/
## INFO [2022-11-01 17:42:02]  Genome assembly: hg38
## INFO [2022-11-01 17:42:02] Finished successfully. Execution time: 1.2 secs
## Object of class: GRaNIE  ( version 1.2.0 )
## Data summary:
##  # peaks: No peak data found.
##  # genes: No RNA-seq data found.
## Parameters:
##  Output directory:  /tmp/RtmpL36V6g/Rbuild1bb6f9636e23df/GRaNIE/vignettes/ 
## Provided metadata:
##   name :  Macrophages_infected_primed 
##   file_peaks : 
##   file_rna : 
##   file_sampleMetadata : 
##   genomeAssembly :  hg38 
## Connections:
##  TF-peak links: none found
##  peak-gene links: none found
##  TF-peak-gene links (filtered): none found
## Network-related:
##   eGRN network: not found

Initializing a GRaNIE object occurs in the function initializeGRN() and is trivial: All we need to specify is an output folder (this is where all the pipeline output is automatically being saved unless specified otherwise) and the genome assembly shortcut of the data. We currently support hg19, hg38, and mm10. Please contact us if you need additional genomes. The objectMetadata argument is recommended but optional and may contain an arbitrarily complex named list that is stored as additional metadata for the GRaNIE object. Here, we decided to specify a name for the GRaNIE object as well as the original paths for all 3 input files and the genome assembly.

For more parameter details, see the R help (?initializeGRN).

At any time point, we can simply “print” a GRaNIE object by typing its name and a summary of the content is printed to the console.

3.5 Add data

We are now ready to fill our empty object with data! After preparing the data beforehand, we can now use the data import function addData() to import both enhancers and RNA-seq data to the GRaNIE object. In addition to the count tables, we explicitly specify the name of the ID columns. As mentioned before, the sample metadata is optional but recommended if available.

An important consideration is data normalization for RNA and ATAC. We currently support three choices of normalization: quantile, DESeq_sizeFactor and none and refer to the R help for more details (?addData). The default for RNA-Seq is a quantile normalization, while for the open chromatin enhancer data, it is DESeq_sizeFactor (i.e., a “regular” DESeq size factor normalization). Importantly, DESeq_sizeFactor requires raw data, while quantile does not necessarily. We nevertheless recommend raw data as input, although it is also possible to provide pre-normalized data as input and then topping this up with another normalization method or “none”.

GRN = addData(GRN, counts_peaks = countsPeaks.df, normalization_peaks = "DESeq_sizeFactor",
    idColumn_peaks = idColumn_peaks, counts_rna = countsRNA.df, normalization_rna = "quantile",
    idColumn_RNA = idColumn_RNA, sampleMetadata = sampleMetadata.df, forceRerun = TRUE)

Only overlapping samples between the two data modalities are kept in the GRaNIE object. Here, all 29 samples from the RNA data are kept because they are also found in the peak data, while only 29 out of 31 samples from the peak data are also found in the RNA data, resulting in 29 shared samples overall. The RNA counts are also permuted, which will be the basis for all analysis and plots in subsequent steps that repeat the analysis for permuted data in addition to the real, non-permuted data.

3.6 Quality control 1: PCA plots

It is time for our first QC plots using the function plotPCA_all()! Now that we added peak and RNA data to the object, let’s check with a Principal Component Analysis (PCA) for both peak and RNA-seq data as well as the original input and the normalized data (unless normalization has been set to none, in which case they are identical to the original data) where the variation in the data comes from. If sample metadata has been provided in the addData() function (something we strongly recommend), they are automatically added to the PCA plots by coloring the PCA results according to the provided metadata, so that potential batch effects can be examined and identified. For more details, see the R help (?plotPCA_all).

Note that while this step is recommended to do, it is fully optional from a workflow point of view.

GRN = plotPCA_all(GRN, data = c("rna"), topn = 500, type = "normalized", plotAsPDF = FALSE,
    pages = c(2, 3, 14), forceRerun = TRUE)

Depending on the parameters, multiple output files (and plots) may be produced, with up to two files for each of the specified data modalities (that is, RNA-Seq counts, as specified with rna here, as well as the peak counts, peaks, not done here for reasons of brevity). For each of them, PCA plots can be produced for both raw and normalized data (here: only raw). With raw, we here denote the original counts as given as input with the addData() function, irrespective of whether this was already pre-normalized or not. The topn argument specifies the number of top variable features to do PCA for - here 500.

There are more plots that are generated, make sure to examine these plots closely! For all details, which plots are produced and further comments on how to understand and interpret them, see the Package Website.

3.7 Add TFs and TFBS and overlap with peak

Now it is time to add data for TFs and predicted TF binding sites (TFBS)! Our GRaNIE package requires pre-computed TFBS that need to be in a specific format. In brief, a 6-column bed file must be present for each TF, with a specific file name that starts with the name of the TF, an arbitrary and optional suffix (here: _TFBS) and a particular file ending (supported are bed or bed.gz; here, we specify the latter). All these files must be located in a particular folder that the addTFBS() functions then searches in order to identify those files that match the specified patterns. We provide example TFBS for the 3 genome assemblies we support. After setting this up, we are ready to overlap the TFBS and the peaks by calling the function overlapPeaksAndTFBS().

For more parameter details, see the R help (?addTFBS and ?overlapPeaksAndTFBS).

folder_TFBS_first50 = ""
# Download the zip of all TFBS files. Takes too long here, not executed
# therefore download.file(folder_TFBS_first50, file.path(''),
# quiet = FALSE) unzip(file.path(''), overwrite = TRUE)
# motifFolder = tools::file_path_as_absolute('TFBS_selected')

GRN = addTFBS(GRN, motifFolder = motifFolder, TFs = "all", filesTFBSPattern = "_TFBS",
    fileEnding = ".bed.gz", forceRerun = TRUE)

GRN = overlapPeaksAndTFBS(GRN, nCores = 1, forceRerun = TRUE)

We see from the output (omitted here for brevity) that 6 TFs have been found in the specified input folder, and the number of TFBS that overlap our peaks for each of them. We successfully added our TFs and TFBS to the GRaNIE object"

3.8 Filter data (optional)

Optionally, we can filter both peaks and RNA-Seq data according to various criteria using the function filterData().

For the open chromatin peaks, we currently support three filters:

  1. Filter by their normalized mean read counts (minNormalizedMean_peaks, default 5)
  2. Filter by their size / width (in bp) and discarding peaks that exceed a particular threshold (maxSize_peaks, default: 10000 bp)
  3. Filter by chromosome (only keep chromosomes that are provided as input to the function, chrToKeep_peaks)

For RNA-seq, we currently support the analogous filter as for open chromatin for normalized mean counts as explained above (minNormalizedMeanRNA).

The default values are usually suitable for bulk data and should result in the removal of very few peaks / genes; however, for single-cell data, lowering them may more reasonable. The output will print clearly how many peaks and genes have been filtered, so you can rerun the function with different values if needed.

For more parameter details, see the R help (?filterData).

# Chromosomes to keep for peaks. This should be a vector of chromosome names
chrToKeep_peaks = c(paste0("chr", 1:22), "chrX")
GRN = filterData(GRN, minNormalizedMean_peaks = 5, minNormalizedMeanRNA = 1, chrToKeep_peaks = chrToKeep_peaks,
    maxSize_peaks = 10000, forceRerun = TRUE)
## INFO [2022-11-01 17:42:08] FILTER PEAKS
## INFO [2022-11-01 17:42:08]  Number of peaks before filtering : 60698
## INFO [2022-11-01 17:42:08]   Filter peaks by CV: Min = 0
## INFO [2022-11-01 17:42:08]   Filter peaks by mean: Min = 5
## INFO [2022-11-01 17:42:08]  Number of peaks after filtering : 58934
## INFO [2022-11-01 17:42:08]  Finished successfully. Execution time: 0 secs
## INFO [2022-11-01 17:42:08] Filter and sort peaks and remain only those on the following chromosomes: chr1,chr2,chr3,chr4,chr5,chr6,chr7,chr8,chr9,chr10,chr11,chr12,chr13,chr14,chr15,chr16,chr17,chr18,chr19,chr20,chr21,chr22,chrX
## INFO [2022-11-01 17:42:08] Filter and sort peaks by size and remain only those smaller than : 10000
## INFO [2022-11-01 17:42:08]  Number of peaks before filtering: 60698
## INFO [2022-11-01 17:42:08]  Number of peaks after filtering : 60698
## INFO [2022-11-01 17:42:08]  Finished successfully. Execution time: 0.1 secs
## INFO [2022-11-01 17:42:08] Collectively, filter 1764 out of 60698 peaks.
## INFO [2022-11-01 17:42:08] Number of remaining peaks: 58934
## INFO [2022-11-01 17:42:08] FILTER RNA-seq
## INFO [2022-11-01 17:42:08]  Number of genes before filtering : 61721
## INFO [2022-11-01 17:42:08]   Filter genes by CV: Min = 0
## INFO [2022-11-01 17:42:08]   Filter genes by mean: Min = 1
## INFO [2022-11-01 17:42:09]  Number of genes after filtering : 18905
## INFO [2022-11-01 17:42:09]  Finished successfully. Execution time: 0.6 secs
## INFO [2022-11-01 17:42:09]  Flagged 67 rows because the row mean was smaller than 1
## INFO [2022-11-01 17:42:09] Finished successfully. Execution time: 0.9 secs

We can see from the output that no peaks have been filtered due to their size and almost 11,000 have been filtered due to their small mean read counts, which collectively leaves around 64,000 peaks out of 75,000 originally. For the RNA data, almost half of the data has been filtered (16,211 out of around 35,000 genes).

3.9 Add TF-enhancer connections

We now have all necessary data in the object to start constructing our network. As explained elsewhere, we currently support two types of links for our GRaNIE approach:

  1. TF - peak/enhancer
  2. peak/enhancer - gene

Let’s start with TF-enhancer links! For this, we employ the function addConnections_TF_peak(). By default, we use Pearson to calculate the correlations between TF expression and enhancer accessibility, but Spearman may sometimes be a better alternative, especially if the diagnostic plots show that the background is not looking as expected.

In addition to creating TF-enhancer links based on TF expression, we can also correlate enhancer accessibility with other measures. We call this the connection type, and expression is the default one in our framework. However, we implemented a flexible way of allowing also additional or other connection types. Briefly, this works as follows: Additional data has to be imported beforehand with a particular name (the name of the connection type). For example, measures that are related to so-called TF activity can be used in addition or as a replacement of TF expression. For each connection type that we want to include, we simply add it to the parameter connectionTypes along with the binary vector removeNegativeCorrelation that specifies whether or not negatively correlated pairs should be removed or not. For expression, the default is to not remove them, while removal may be more reasonable for measures related to TF activity.

Lastly, we offer a so called GC-correction that uses a GC-matching background to compare it with the foreground instead of using the full background as comparison. We are still investigating the plausibility and effects of this and therefore mark this feature as experimental as of now.

Note that the TF-enhancer links are constructed for both the original, non-permuted data (in the corresponding output plots that are produced, this is labeled as original) and permuted data (permuted). For more parameter options and parameter details, see the R help (?addConnections_TF_peak).

GRN = addConnections_TF_peak(GRN, plotDiagnosticPlots = FALSE, connectionTypes = c("expression"),
    corMethod = "pearson", forceRerun = TRUE)
## INFO [2022-11-01 17:42:09] 
## Real data
## INFO [2022-11-01 17:42:09] Calculate TF-peak links for connection type expression
## INFO [2022-11-01 17:42:09]  Correlate expression and peak counts
## INFO [2022-11-01 17:42:09]   Retain 6 unique genes from TF/gene data out of 18905 (filter 18899 non-TF genes and 0 TF genes with 0 counts throughout).
## INFO [2022-11-01 17:42:09]   Correlate TF/gene data for 6 unique Ensembl IDs (TFs) and peak counts for 58934 peaks.
## INFO [2022-11-01 17:42:09]   Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table.
## INFO [2022-11-01 17:42:09]   Finished successfully. Execution time: 0.1 secs
## INFO [2022-11-01 17:42:09]  Run FDR calculations for 6 TFs for which TFBS predictions and expression data for the corresponding gene are available.
## INFO [2022-11-01 17:42:09]   Compute FDR for each TF. This may take a while...
## INFO [2022-11-01 17:42:10]   Finished successfully. Execution time: 1.5 secs
## INFO [2022-11-01 17:42:10] Finished successfully. Execution time: 1.5 secs
## INFO [2022-11-01 17:42:10] Finished. Stored 12035 connections with an FDR <= 0.3
## INFO [2022-11-01 17:42:10] 
## Permuted data
## INFO [2022-11-01 17:42:10] Shuffling rows per column
## INFO [2022-11-01 17:42:10]  Finished successfully. Execution time: 0 secs
## INFO [2022-11-01 17:42:10] Calculate TF-peak links for connection type expression
## INFO [2022-11-01 17:42:10]  Correlate expression and peak counts
## INFO [2022-11-01 17:42:10]   Retain 6 unique genes from TF/gene data out of 18905 (filter 18899 non-TF genes and 0 TF genes with 0 counts throughout).
## INFO [2022-11-01 17:42:10]   Correlate TF/gene data for 6 unique Ensembl IDs (TFs) and peak counts for 58934 peaks.
## INFO [2022-11-01 17:42:10]   Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table.
## INFO [2022-11-01 17:42:11]   Finished successfully. Execution time: 0.1 secs
## INFO [2022-11-01 17:42:11]  Run FDR calculations for 6 TFs for which TFBS predictions and expression data for the corresponding gene are available.
## INFO [2022-11-01 17:42:11]   Compute FDR for each TF. This may take a while...
## INFO [2022-11-01 17:42:12]   Finished successfully. Execution time: 1.4 secs
## INFO [2022-11-01 17:42:12] Finished successfully. Execution time: 1.4 secs
## INFO [2022-11-01 17:42:12] Finished. Stored 1 connections with an FDR <= 0.3
## INFO [2022-11-01 17:42:12] Finished successfully. Execution time: 3.1 secs

From the output, we see that all of the 6 TFs also have RNA-seq data available and consequently will be included and correlated with the enhancer accessibility.

3.10 Quality control 2: Diagnostic plots for TF-enhancer connections

After adding the TF-enhancer links to our GRaNIE object, let’s look at some diagnostic plots. Depending on the user parameters, the plots are either directly plotted to the currently active graphics device or to PDF files as specified in the object or via the function parameters. If plotted to a PDF, within the specified or default output folder (when initializing the GRaNIE object) should contain two new files that are named TF_peak.fdrCurves_original.pdf and TF_peak.fdrCurves_permuted.pdf, for example.

This function may run a while, and each time-consuming step has a built-in progress bar for the plot-related parts so the remaining time can be estimated.

For reasons of brevity and organization, we fully describe their interpretation and meaning in detail elsewhere, however. In summary, TF-enhancer diagnostic plots are available for each TF, and each page summarizes the QC for each TF in two plots: