workflow.html 98.8 KB
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39  Workflow example • GRN

Abstract

This workflow vignette shows how to use the GRN package in a real-world example. For this purpose, you will use the GRNData package for a more complex analysis to illustrate most of the features from GRN. Importantly, you will also learn in detail how to work with a GRN object and what its main functions and properties are. The vignette will be continuously updated whenever new functionality becomes available or when we receive user feedback.

Example Workflow

In the following example, you will use data from the GRNData package to construct a GRN from TODO

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


Christian Arnold committed May 07, 2021  113      114                                                                                                                                                                                                                                                                                                                                                                                                                library(tidyverse)

115                                                                                                                                                                                                                                                                                                                                                                                                                         library(GRNData) 
Christian Arnold committed May 07, 2021  116                                                                                                                                                                                                                                                                                                                                                                                                                         library(GRN)
 Christian Arnold committed Jun 01, 2021 117 118 119 120 
##  ## Welcome to the GRN package and thank you for using our software. This is GRN version 0.10.1. ## See the vignettes (type browseVignettes("GRN") or the help pages for how to use it for your analyses. ## All project-related information and ways to contact us can be found here: https://grp-zaugg.embl-community.io/grn
 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 

General notes

Each of the GRN 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. However, always check the validity and usefulness of the parameters before starting an analysis to avoid unreasonable results.

Reading the data required for the GRN package

To set up a GRN analysis, we first need to read in some data into R. The following data can be used for the GRN package:

• open chromatin / peak data (from either ATAC-Seq, DNAse-Seq or ChIP-Seq data, for example), hereafter simply referred to as peaks
• 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)

So, let’s import the peak 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.

 Christian Arnold committed Jun 01, 2021 141 

142      143      144      145      146                                                                                                                                                                                                                                                                                                                                                                                     (files = list.files(pattern = "*", system.file("extdata", package = "GRNData"), full.names = TRUE))
 Christian Arnold committed Jun 01, 2021 147 

148      149      150      151      152      153      154      155      156      157      158      159      160      161      162      163      164      165      166      167      168      169      170      171      172      173      174      175      176                                                                                                                                                             file_peaks = files[grep("countsATAC.75k.tsv.gz", files)] file_RNA = files[grep("countsRNA.sampled.tsv.gz", files)] file_sampleMetadata = files[grep("metadata.sampled.tsv", files)] folder_TFBS_first50 = files[grep("TFBS_selected", files)]  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 countsRNA.df
## # A tibble: 35,033 x 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 35,023 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>
 Christian Arnold committed Jun 01, 2021 177 

178      179      180      181      182      183      184      185      186      187      188      189      190      191      192      193      194      195      196                                                                                                                                                                                                                                                       countsPeaks.df
## # A tibble: 75,000 x 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 chr14…      2      5      5      3      1      4      1      5      0     13 ##  2 chrX:…      3      7     10      5      4      6      3     18      4     22 ##  3 chr15…      5     28     38     11     20     19      7     53      5     22 ##  4 chr10…      0     12      7      2      5      8      0     11      1     11 ##  5 chr12…      5     14     18      5      3     13      5     15      2     25 ##  6 chr1:…     12     21     36      6     20     29     12     44      2    105 ##  7 chr16…      3     17     16      9      8     16      6     28      3     33 ##  8 chr17…      4     11      6      3      0      3      2      9      1     14 ##  9 chr13…     10     34     44     12     31     29      9     22      5     82 ## 10 chr1:…     21    113     46     28     44     57     47    146     12     91 ## # … with 74,990 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>
 Christian Arnold committed Jun 01, 2021 197 

198      199      200      201      202      203      204      205      206      207      208      209      210      211      212      213      214      215                                                                                                                                                                                                                                                                sampleMetadata.df
## # A tibble: 31 x 16 ##    sample_id assigned assigned_frac atac_date  clone condition diff_start donor ##    <chr>        <dbl>         <dbl> <date>     <dbl> <chr>     <date>     <chr> ##  1 babk_D     5507093         0.211 2015-12-04     2 IFNg_SL1… 2015-10-12 babk  ##  2 bima_D    23275756         0.677 2014-12-12     1 IFNg_SL1… 2014-11-07 bima  ##  3 cicb_D    19751751         0.580 2015-04-24     3 IFNg_SL1… 2015-03-30 cicb  ##  4 coyi_D     6733642         0.312 2015-11-05     3 IFNg_SL1… 2015-09-30 coyi  ##  5 diku_D     7010213         0.195 2015-11-13     1 IFNg_SL1… 2015-10-15 diku  ##  6 eipl_D    16923025         0.520 2015-08-04     1 IFNg_SL1… 2015-06-30 eipl  ##  7 eiwy_D     9807860         0.404 2015-12-02     1 IFNg_SL1… 2015-10-23 eiwy  ##  8 eofe_D    25687477         0.646 2014-12-12     1 IFNg_SL1… 2014-11-01 eofe  ##  9 fafq_D     4600004         0.415 2015-10-14     1 IFNg_SL1… 2015-09-16 fafq  ## 10 febc_D    31712153         0.430 2015-08-04     2 IFNg_SL1… 2015-07-06 febc  ## # … with 21 more rows, and 8 more variables: EB_formation <date>, ## #   macrophage_diff_days <dbl>, medium_changes <dbl>, mt_frac <dbl>, ## #   percent_duplication <dbl>, received_as <chr>, sex <chr>, ## #   short_long_ratio <dbl>
 Christian Arnold committed Jun 01, 2021 216 

217      218      219      220      221      222      223      224      225      226      227      228                                                                                                                                                                                                                                                                                                                      # Save the name of the respective ID columns idColumn_peaks = "peakID" idColumn_RNA = "ENSEMBL"

While we recommend raw counts for both peaks 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 GRN network, so make sure the choice of normalization is reasonable. For more details, see the next sections.

As you can see, both peaks and RNA-Seq counts must have exactly one ID column, with all other columns being numeric. For peaks, 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 peak ID column, the required format is “chr:start-end”, with chr denoting the chromosome, followed by “:”, and then start, “-”, and end for the peak start and end, respectively. As the coordinates for the peaks are needed in the pipeline, the format must be exactly as stated here.

You may notice that the peaks 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 GRN pipeline can work with it. Note that only the shared sampels between both data modalities are kept, however, so make sure that the sample names match between them and share as many samples as possible.

Initialize a GRN object

We got all the data in the right format, we can start with our GRN 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 GRN object from others.

 Christian Arnold committed Jun 01, 2021 229 

230      231      232      233      234      235      236      237      238      239      240      241      242                                                                                                                                                                                                                                                                                                             ######################### INITIALIZE GRN OBJECT #  # Genome assembly shortcut. Either hg19, hg38 or mm10. Both peaks and RNA data # must have the same genome assembly genomeAssembly = "hg38"  # Optional and arbitrary list with information and metadata that is stored within # the GRN 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 = "output"  
Christian Arnold committed May 07, 2021  243                                                                                                                                                                                                                                                                                                                                                                                                                         GRN = GRN::initializeGRN(objectMetadata = objectMetadata.l, outputFolder = dir_output,  
244                                                                                                                                                                                                                                                                                                                                                                                                                             genomeAssembly = genomeAssembly)
 Christian Arnold committed Jun 01, 2021 245 246 
## INFO [2021-06-01 13:57:14] Empty GRN object created successfully. Type the object name (e.g., GRN) to retrieve summary information about it at any time.

247                                                                                                                                                                                                                                                                                                                                                                                                                         GRN
 Christian Arnold committed Jun 01, 2021 248 
## Object of class: GRN  ( version 0.10.1 ) 
249      250      251      252      253      254      255      256      257      258      259      260      261      262      263      264      265      266      267      268      269                                                                                                                                                                                                                                     ## Data summary: ##  Number of peaks: No peak data found. ##  Number of genes: No RNA-seq data found. ## Parameters: ## Provided metadata: ##   name :  Macrophages_infected_primed  ##   file_peaks :  /media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRNData/extdata/countsATAC.75k.tsv.gz  ##   file_rna :  /media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRNData/extdata/countsRNA.sampled.tsv.gz  ##   file_sampleMetadata :  /media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRNData/extdata/metadata.sampled.tsv  ##   genomeAssembly :  hg38  ## Connections: ##  Number of genes (filtered, all):  NA ,  NA

Initializing a GRN object 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 metadata argument is recommended but optional and may contain an arbitrarily complex named list that is stored as additional metadata for the GRN object. Here, we decided to specify a name for the GRN 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 GRN object by typing its name and a summary of the content is printed to the console.

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 peaks and RNA-seq data to the GRN 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 peak 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”.

 Christian Arnold committed Jun 01, 2021 270 

Christian Arnold committed May 07, 2021  271      272      273                                                                                                                                                                                                                                                                                                                                                                                                       GRN = GRN::addData(GRN, countsPeaks.df, normalization_peaks = "DESeq_sizeFactor",      idColumn_peaks = idColumn_peaks, countsRNA.df, normalization_rna = "quantile",      idColumn_RNA = idColumn_RNA, sampleMetadata = sampleMetadata.df, forceRerun = TRUE)
 Christian Arnold committed Jun 01, 2021 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 
## INFO [2021-06-01 13:57:15] Normalize counts. Method: DESeq_sizeFactor, ID column: peakID ## INFO [2021-06-01 13:57:20]  Finished successfully. Execution time: 5.4 secs ## INFO [2021-06-01 13:57:20] Normalize counts. Method: quantile, ID column: ENSEMBL ## INFO [2021-06-01 13:57:20]  Finished successfully. Execution time: 0.4 secs ## INFO [2021-06-01 13:57:20] Subset RNA and peaks and keep only shared samples ## INFO [2021-06-01 13:57:20]  Number of samples for RNA before filtering: 29 ## INFO [2021-06-01 13:57:20]  Number of samples for peaks before filtering: 31 ## INFO [2021-06-01 13:57:20]  29 samples (babk_D,bima_D,cicb_D,coyi_D,diku_D,eipl_D,eiwy_D,eofe_D,fafq_D,febc_D,fikt_D,guss_D,hayt_D,hehd_D,heja_D,hiaf_D,iill_D,kuxp_D,nukw_D,oapg_D,oevr_D,pamv_D,pelm_D,podx_D,qolg_D,sojd_D,vass_D,xugn_D,zaui_D) are shared between the peaks and RNA-Seq data ## WARN [2021-06-01 13:57:20] The following samples from the peaks will be ignored for the classification due to missing overlap with RNA-Seq: uaqe_D,qaqx_D ## INFO [2021-06-01 13:57:20]  Number of samples for RNA after filtering: 29 ## INFO [2021-06-01 13:57:20]  Number of samples for peaks data after filtering: 29 ## INFO [2021-06-01 13:57:20]  Finished successfully. Execution time: 0.1 secs ## INFO [2021-06-01 13:57:20] Produce 1 permutations of RNA-counts ## INFO [2021-06-01 13:57:20] Shuffling columns 1 times ## INFO [2021-06-01 13:57:20]  Finished successfully. Execution time: 0 secs ## INFO [2021-06-01 13:57:25] Check for overlapping peaks...
 290 291 292 293 294 

We can see from the output the details for the used normalization method, and the number of samples that are kept in the GRN 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.

Quality control 1: PCA plots

 Christian Arnold committed May 25, 2021 295 

It is time for our first QC plots! 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).

 296 

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

 Christian Arnold committed Jun 01, 2021 297 

Christian Arnold committed May 07, 2021  298                                                                                                                                                                                                                                                                                                                                                                                                                         GRN = GRN::plotPCA_all(GRN, type = c("rna", "peaks"), forceRerun = TRUE)
 Christian Arnold committed Jun 01, 2021 299 
## INFO [2021-06-01 13:57:27]  
Christian Arnold committed May 07, 2021  300                                                                                                                                                                                                                                                                                                                                                                                                                         ## Plotting PCA and metadata correlation of raw RNA data for all shared samples to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/PCA_sharedSamples_RNA.raw.pdf... This may take a few minutes 
Christian Arnold committed Jun 01, 2021  301      302      303      304      305      306                                                                                                                                                                                                                                                                                                                                                                            ## INFO [2021-06-01 13:57:29] Prepare PCA. Count transformation: vst ## INFO [2021-06-01 13:57:29]  Writing to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/PCA_sharedSamples_RNA.raw.pdf
## INFO [2021-06-01 13:57:32] Performing and summarizing PCs across metadata for top 500 features
## INFO [2021-06-01 13:57:37] Performing and summarizing PCs across metadata for top 1000 features
## INFO [2021-06-01 13:57:41] Performing and summarizing PCs across metadata for top 5000 features
## INFO [2021-06-01 13:57:46]  
Christian Arnold committed May 07, 2021  307                                                                                                                                                                                                                                                                                                                                                                                                                         ## Plotting PCA and metadata correlation of normalized RNA data for all shared samples to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/PCA_sharedSamples_RNA.normalized.pdf... This may take a few minutes 
Christian Arnold committed Jun 01, 2021  308      309      310      311      312      313      314      315      316      317      318      319      320      321      322      323      324                                                                                                                                                                                                                                                                         ## INFO [2021-06-01 13:57:46] Prepare PCA. Count transformation: none ## INFO [2021-06-01 13:57:46]  Writing to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/PCA_sharedSamples_RNA.normalized.pdf
## INFO [2021-06-01 13:57:47] Performing and summarizing PCs across metadata for top 500 features
## INFO [2021-06-01 13:57:51] Performing and summarizing PCs across metadata for top 1000 features
## INFO [2021-06-01 13:57:55] Performing and summarizing PCs across metadata for top 5000 features
## INFO [2021-06-01 13:58:00] Plotting PCA and metadata correlation of raw peaks data for all shared samples to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/PCA_sharedSamples_peaks.raw.pdf... This may take a few minutes ## INFO [2021-06-01 13:58:01] Prepare PCA. Count transformation: vst ## INFO [2021-06-01 13:58:01]  Writing to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/PCA_sharedSamples_peaks.raw.pdf
## INFO [2021-06-01 13:58:05] Performing and summarizing PCs across metadata for top 500 features
## INFO [2021-06-01 13:58:09] Performing and summarizing PCs across metadata for top 1000 features
## INFO [2021-06-01 13:58:14] Performing and summarizing PCs across metadata for top 5000 features
## INFO [2021-06-01 13:58:18] Plotting PCA and metadata correlation of normalized peaks data for all shared samples to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/PCA_sharedSamples_peaks.normalized.pdf... This may take a few minutes ## INFO [2021-06-01 13:58:18] Prepare PCA. Count transformation: none ## INFO [2021-06-01 13:58:18]  Writing to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/PCA_sharedSamples_peaks.normalized.pdf
## INFO [2021-06-01 13:58:21] Performing and summarizing PCs across metadata for top 500 features
## INFO [2021-06-01 13:58:25] Performing and summarizing PCs across metadata for top 1000 features
## INFO [2021-06-01 13:58:29] Performing and summarizing PCs across metadata for top 5000 features
 Christian Arnold committed May 25, 2021 325 

We can see from the output that four PDF files have been produced, each of which plots the PCA results for the most variable 500, 1000, and 5000 features, respectively. For reasons of brevity and organization, we describe their interpretation and meaning in detail in the Introductory vignette and not here, however (click here for guidance and example plots).

 326 327 328 329 330 331 

Add TFs and TFBS and overlap with peaks

Now it is time to add data for TFs and predicted TF binding sites (TFBS)! Our GRN package requires pre-computed TFBS that need to be in a specific format (see the Introductory Vignette for details). 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, see the comment below and the Introductory Vignette for details.

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

 Christian Arnold committed Jun 01, 2021 332 

333      334      335      336      337      338      339      340      341                                                                                                                                                                                                                                                                                                                                                 # Should the pipeline be run for only a subset of TFs or all? The special keyword # 'all' will use all TF that are found in the TFBS folder; however, if only a # subset should be considered, specify the subset here with c() and the TF names, # as shown below  # The TFBS predictions are expected as *.bed files as well as a translation table # with the name translationTable.csv We provide all files here: # https://www.embl.de/download/zaugg/GRN/hg19_hg38_mm10_PWMScan.zip (7.5 GB)  
Christian Arnold committed May 07, 2021  342                                                                                                                                                                                                                                                                                                                                                                                                                         GRN = GRN::addTFBS(GRN, motifFolder = folder_TFBS_first50, TFs = "all", filesTFBSPattern = "_TFBS",  
343                                                                                                                                                                                                                                                                                                                                                                                                                             fileEnding = ".bed.gz", forceRerun = TRUE)
 Christian Arnold committed Jun 01, 2021 344 345 346 347 348 349 350 
## INFO [2021-06-01 13:58:32] Checking database folder for matching files: /media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRNData/extdata/TFBS_selected ## INFO [2021-06-01 13:58:32] Found 75 matching TFs: AIRE.0.C, ANDR.0.A, ANDR.1.A, ANDR.2.A, AP2A.0.A, AP2B.0.B, ARI3A.0.D, ARNT2.0.D, ASCL1.0.A, ASCL2.0.D, ATF2.1.B, ATOH1.0.B, BACH1.0.A, BATF3.0.B, BC11A.0.A, BCL6.0.A, BHA15.0.B, BHE41.0.D, BPTF.0.D, BRAC.0.A, BRCA1.0.D, CDX1.0.C, CDX2.0.A, CEBPA.0.A, CENPB.0.D, CLOCK.0.C, COE1.0.A, COT1.0.C, COT1.1.C, COT2.0.A, COT2.1.A, CTCF.0.A, CTCFL.0.A, CUX2.0.D, DLX1.0.D, DLX2.0.D, DLX4.0.D, DLX6.0.D, DMBX1.0.D, DMRT1.0.D, E2F1.0.A, E2F3.0.A, E2F4.0.A, E2F6.0.A, E2F7.0.B, EGR1.0.A, EGR2.0.A, EGR2.1.A, EHF.0.B, ELF1.0.A, ELF3.0.A, ELK3.0.D, ERR1.0.A, ESR1.0.A, ESR1.1.A, ESR2.0.A, ESR2.1.A, ETS1.0.A, ETS2.0.B, ETV2.0.B, ETV4.0.B, ETV5.0.C, EVI1.0.B, FEZF1.0.C, FLI1.1.A, FOXA3.0.B, FOXB1.0.D, FOXC2.0.D, FOXD2.0.D, FOXD3.0.D, FOXF1.0.D, FOXO4.0.C, FOXP1.0.A, FOXP3.0.D, FUBP1.0.D ## INFO [2021-06-01 13:58:32] Use all TF from the database folder /media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRNData/extdata/TFBS_selected ## INFO [2021-06-01 13:58:32] Reading file /media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRNData/extdata/TFBS_selected/translationTable.csv ## INFO [2021-06-01 13:58:32]  Finished successfully. Execution time: 0 secs ## INFO [2021-06-01 13:58:32] Running the pipeline for 75 TF in total.

Christian Arnold committed May 07, 2021  351                                                                                                                                                                                                                                                                                                                                                                                                                         GRN = GRN::overlapPeaksAndTFBS(GRN, nCores = 2, forceRerun = TRUE)
 Christian Arnold committed Jun 01, 2021 352 353 
## INFO [2021-06-01 13:58:32] Overlap peaks and TFBS using 2 cores. This may take a few minutes... ## INFO [2021-06-01 13:59:35]  Finished execution using 2 cores. TOTAL RUNNING TIME: 1 mins
 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 

We see from the output that 75 TFs have been found in the specified input folder, and the number of TFBS that overlap our peaks for each of them. We now successfully added our TFs and TFBS to the GRN object.

Filter data (optional)

Optionally, we can filter both peaks and RNA-Seq data according to various criteria.

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).

 Christian Arnold committed Jun 01, 2021 369 

370      371                                                                                                                                                                                                                                                                                                                                                                                                                # Chromosomes to keep for peaks. This should be a vector of chromosome names chrToKeep_peaks = c(paste0("chr", 1:22), "chrX", "chrY") 
Christian Arnold committed May 07, 2021  372      373                                                                                                                                                                                                                                                                                                                                                                                                                GRN = GRN::filterData(GRN, minNormalizedMean_peaks = 5, minNormalizedMeanRNA = 1,      chrToKeep_peaks = chrToKeep_peaks, maxSize_peaks = 10000, forceRerun = TRUE)
 Christian Arnold committed Jun 01, 2021 374 375 376 377 378 379 380 381 382 383 384 385 386 
## INFO [2021-06-01 13:59:35] Filter peaks with a mean across samples of smaller than 5 ## INFO [2021-06-01 13:59:35] Removed 10992 peaks out of 75000 because they had a row mean smaller than 5. ## INFO [2021-06-01 13:59:35]  Finished successfully. Execution time: 0.1 secs ## INFO [2021-06-01 13:59:35] 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,chrY ## INFO [2021-06-01 13:59:35] Filter and sort peaks by size and remain only those smaller than : 10000 ## INFO [2021-06-01 13:59:35]  Number of peaks before filtering: 75000 ## INFO [2021-06-01 13:59:35]  Number of peaks after filtering : 75000 ## INFO [2021-06-01 13:59:36]  Finished successfully. Execution time: 0.3 secs ## INFO [2021-06-01 13:59:36] Collectively, filter 10992 out of 75000 peaks. ## INFO [2021-06-01 13:59:36] Number of remaining peaks: 64008 ## INFO [2021-06-01 13:59:36] Filtering normalized RNA-seq counts ## INFO [2021-06-01 13:59:36]  Number of rows in total: 35033 ## INFO [2021-06-01 13:59:36]  Flagged 16211 rows because the row mean was smaller than 1
 Christian Arnold committed May 25, 2021 387 

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).

 388 389 390 391 392 393 394 395 396 397 398 399 400 401 

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

1. TF - peak
2. peak - gene

Let’s start with TF-peak links! By default, we use Pearson to calculate the correlations between TF expression and peak 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-peak links based on TF expression, we can also correlate a measure that we call TF activity with peak accessibility instead. If the function argument add_TFActivity is set to TRUE, TF-peaks links will be calculated also for TF activity and not only TF expression. Then, the following arguments become also relevant and are ignored otherwise: normalization_TFActivity and remove_negCor_TFActivity. See the Introduction vignette for methodological details.

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.

This function may run a while, and each time-consuming step has a built-in progress bar so the remaining time can be estimated. Note that the TF-peak 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).

 Christian Arnold committed Jun 01, 2021 402 

Christian Arnold committed May 07, 2021  403                                                                                                                                                                                                                                                                                                                                                                                                                         GRN = GRN::addConnections_TF_peak(GRN, plotDiagnosticPlots = TRUE, corMethod = "pearson",  
404                                                                                                                                                                                                                                                                                                                                                                                                                             forceRerun = TRUE)
 Christian Arnold committed Jun 01, 2021 405 
## INFO [2021-06-01 13:59:36]  
406      407                                                                                                                                                                                                                                                                                                                                                                                                                ## Real data ##  
Christian Arnold committed Jun 01, 2021  408      409      410      411      412      413      414      415      416      417      418      419                                                                                                                                                                                                                                                                                                                      ## INFO [2021-06-01 13:59:36] Calculate TF-peak links for connection type expression ## INFO [2021-06-01 13:59:36]  Correlate expression values and peak counts ## INFO [2021-06-01 13:59:36]   Retain 59 rows from TF/gene data out of 18822 (filter non-TF genes and TF genes with 0 counts throughout and keep only unique ENSEMBL IDs). ## INFO [2021-06-01 13:59:36]   Correlate TF/gene data for 59 unique TF genes and peak counts for 64008 peaks. ## INFO [2021-06-01 13:59:36]   Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table. ## INFO [2021-06-01 13:59:37]   Finished successfully. Execution time: 0.4 secs ## INFO [2021-06-01 13:59:37]  Run FDR calculations for 65 TFs for which TFBS predictions and RNA-Seq data for the corresponding gene are available. ## INFO [2021-06-01 13:59:37]   Skip the following 10 TF due to missing data for RNA-Seq: ATOH1.0.B,CDX1.0.C,CTCFL.0.A,DLX6.0.D,DMRT1.0.D,EHF.0.B,ESR2.0.A,ESR2.1.A,FOXA3.0.B,FOXB1.0.D ## INFO [2021-06-01 13:59:37]   Compute FDR for each TF. This may take a while... ## INFO [2021-06-01 13:59:45]   Finished successfully. Execution time: 9.1 secs ## INFO [2021-06-01 13:59:45]  Finished successfully. Execution time: 9.3 secs ## INFO [2021-06-01 13:59:45]  
420      421                                                                                                                                                                                                                                                                                                                                                                                                                ## Permuted data ##  
Christian Arnold committed Jun 01, 2021  422      423      424      425      426      427      428      429      430      431      432      433      434      435      436      437      438      439      440      441      442      443      444                                                                                                                                                                                                                   ## INFO [2021-06-01 13:59:46] Shuffling rows per column ## INFO [2021-06-01 13:59:46]  Finished successfully. Execution time: 0.5 secs ## INFO [2021-06-01 13:59:46] Calculate TF-peak links for connection type expression ## INFO [2021-06-01 13:59:46]  Correlate expression values and peak counts ## INFO [2021-06-01 13:59:46]   Retain 59 rows from TF/gene data out of 18822 (filter non-TF genes and TF genes with 0 counts throughout and keep only unique ENSEMBL IDs). ## INFO [2021-06-01 13:59:46]   Correlate TF/gene data for 59 unique TF genes and peak counts for 64008 peaks. ## INFO [2021-06-01 13:59:46]   Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table. ## INFO [2021-06-01 13:59:47]   Finished successfully. Execution time: 1.2 secs ## INFO [2021-06-01 13:59:47]  Run FDR calculations for 65 TFs for which TFBS predictions and RNA-Seq data for the corresponding gene are available. ## INFO [2021-06-01 13:59:47]   Skip the following 10 TF due to missing data for RNA-Seq: ATOH1.0.B,CDX1.0.C,CTCFL.0.A,DLX6.0.D,DMRT1.0.D,EHF.0.B,ESR2.0.A,ESR2.1.A,FOXA3.0.B,FOXB1.0.D ## INFO [2021-06-01 13:59:47]   Compute FDR for each TF. This may take a while... ## INFO [2021-06-01 13:59:55]   Finished successfully. Execution time: 9.2 secs ## INFO [2021-06-01 13:59:55]  Finished successfully. Execution time: 9.9 secs ## INFO [2021-06-01 13:59:55] Plotting FDR curves for each TF to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/TF_peak.fdrCurves_original.pdf ## INFO [2021-06-01 13:59:55]  Including a total of 65 TF. Preparing plots... ## INFO [2021-06-01 13:59:58]  Finished generating plots, start plotting to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/TF_peak.fdrCurves_original.pdf. This may take a few minutes.
## INFO [2021-06-01 14:00:27] Finished writing plots to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/TF_peak.fdrCurves_original.pdf ## INFO [2021-06-01 14:00:27]  Finished successfully. Execution time: 31.4 secs ## INFO [2021-06-01 14:00:27] Plotting FDR curves for each TF to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/TF_peak.fdrCurves_permuted.pdf ## INFO [2021-06-01 14:00:27]  Including a total of 65 TF. Preparing plots... ## INFO [2021-06-01 14:00:29]  Finished generating plots, start plotting to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/TF_peak.fdrCurves_permuted.pdf. This may take a few minutes.
## INFO [2021-06-01 14:00:58] Finished writing plots to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/TF_peak.fdrCurves_permuted.pdf ## INFO [2021-06-01 14:00:58]  Finished successfully. Execution time: 31 secs
 445 446 447 448 449 450 

From the output, we see that a total of 65 TFs have RNA-seq data available and consequently will be included and correlated with the peak accessibility. The created PDF files are mentioned in the output and these we’ll take a look at now!

Quality control 2: Diagnostic plots for TF-peak connections

After adding the TF-peak links to our GRN object, let’s look at some diagnostic plots. The plots folder within the specified output folder when initializing the GRN object should now contain two new files that are named TF_peak.fdrCurves_original.pdf and TF_peak.fdrCurves_permuted.pdf. For reasons of brevity and organization, we describe their interpretation and meaning in detail in the Introductory vignette and not here, however.

 Christian Arnold committed May 07, 2021 451 452 453 454 455 456 457 458   459 460 461 462 463 464 

Run the AR classification and QC (optional)

Transcription factors (TFs) regulate many cellular processes and can therefore serve as readouts of the signaling and regulatory state. Yet for many TFs, the mode of action—repressing or activating transcription of target genes—is unclear. In analogy to our diffTF approach that we recently published to calculate differential TF activity,the classification of TFs into putative transcriptional activators or repressors can also be done from within the GRN framework in an identical fashion.

Note that this step is fully optional and can be skipped. The output of the AR_classification_wrapper function is not used for subsequent steps.. To keep the memory footprint of the GRN object low, we recommend to set deleteIntermediateData = TRUE.

 Christian Arnold committed Jun 01, 2021 465 

Christian Arnold committed May 07, 2021  466      467      468                                                                                                                                                                                                                                                                                                                                                                                                       GRN = GRN::AR_classification_wrapper(GRN, significanceThreshold_Wilcoxon = 0.05,      plot_minNoTFBS_heatmap = 100, plotDiagnosticPlots = TRUE, deleteIntermediateData = TRUE,      forceRerun = TRUE)
 Christian Arnold committed Jun 01, 2021 469 
## INFO [2021-06-01 14:00:58]  Connection type expression 
470                                                                                                                                                                                                                                                                                                                                                                                                                         ##  
Christian Arnold committed Jun 01, 2021  471                                                                                                                                                                                                                                                                                                                                                                                                                         ## INFO [2021-06-01 14:00:58]  Real data 
472                                                                                                                                                                                                                                                                                                                                                                                                                         ##  
Christian Arnold committed Jun 01, 2021  473      474      475      476      477      478      479      480      481      482      483      484      485      486      487      488      489      490      491      492      493      494      495      496      497      498      499      500      501      502      503      504      505      506      507      508      509      510      511      512                                                          ## INFO [2021-06-01 14:00:58]  Correlate expression values and peak counts ## INFO [2021-06-01 14:00:58]  Retain 59 rows from TF/gene data out of 18822 (filter non-TF genes and TF genes with 0 counts throughout and keep only unique ENSEMBL IDs). ## INFO [2021-06-01 14:00:58]  Correlate TF/gene data for 59 unique TF genes and peak counts for 64008 peaks. ## INFO [2021-06-01 14:00:58]  Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table. ## INFO [2021-06-01 14:00:58]  Finished successfully. Execution time: 0.4 secs ## INFO [2021-06-01 14:00:58] Compute foreground and background as well as their median values per TF ## INFO [2021-06-01 14:01:01]  Finished successfully. Execution time: 2.5 secs ## INFO [2021-06-01 14:01:01] Calculate classification thresholds for repressors / activators ## INFO [2021-06-01 14:01:01]  Stringency 0.1: -0.0305 / 0.0157 ## INFO [2021-06-01 14:01:01]  Stringency 0.05: -0.0439 / 0.0195 ## INFO [2021-06-01 14:01:01]  Stringency 0.01: -0.0537 / 0.024 ## INFO [2021-06-01 14:01:02]  Stringency 0.001: -0.0564 / 0.0281 ## INFO [2021-06-01 14:01:02]  Finished successfully. Execution time: 0.9 secs ## INFO [2021-06-01 14:01:02] Finalize classification ## INFO [2021-06-01 14:01:02]  Perform Wilcoxon test for each TF. This may take a few minutes. ## INFO [2021-06-01 14:01:13]   Stringency 0.1 ## INFO [2021-06-01 14:01:13]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: AIRE.0.C,ASCL2.0.D,CUX2.0.D ## INFO [2021-06-01 14:01:13]   Stringency 0.05 ## INFO [2021-06-01 14:01:13]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: AIRE.0.C ## INFO [2021-06-01 14:01:13]   Stringency 0.01 ## INFO [2021-06-01 14:01:13]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: AIRE.0.C ## INFO [2021-06-01 14:01:13]   Stringency 0.001 ## INFO [2021-06-01 14:01:13]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: AIRE.0.C ## INFO [2021-06-01 14:01:13]  Summary of classification: ## INFO [2021-06-01 14:01:13]   Column classification_q0.1_final ## INFO [2021-06-01 14:01:13]    activator: 25,    undetermined: 17,    repressor: 23,    not-expressed: 10 ## INFO [2021-06-01 14:01:13]   Column classification_q0.05_final ## INFO [2021-06-01 14:01:13]    activator: 24,    undetermined: 21,    repressor: 20,    not-expressed: 10 ## INFO [2021-06-01 14:01:13]   Column classification_q0.01_final ## INFO [2021-06-01 14:01:13]    activator: 21,    undetermined: 28,    repressor: 16,    not-expressed: 10 ## INFO [2021-06-01 14:01:13]   Column classification_q0.001_final ## INFO [2021-06-01 14:01:13]    activator: 19,    undetermined: 30,    repressor: 16,    not-expressed: 10 ## INFO [2021-06-01 14:01:13]  Finished successfully. Execution time: 11.6 secs ## INFO [2021-06-01 14:01:13] Plotting density plots with foreground and background for each TF to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/TF_classification_densityPlotsForegroundBackground_expression_original.pdf
## INFO [2021-06-01 14:01:15]  Finished successfully. Execution time: 1.7 secs ## INFO [2021-06-01 14:01:15] Plotting AR summary plot to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/TF_classification_stringencyThresholds_expression_original.pdf
## INFO [2021-06-01 14:01:15]  Finished successfully. Execution time: 0 secs ## INFO [2021-06-01 14:01:15] Plotting AR heatmap to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/TF_classification_summaryHeatmap_expression_original.pdf
## INFO [2021-06-01 14:01:16]  Finished successfully. Execution time: 0.8 secs ## INFO [2021-06-01 14:01:16]  Permuted data 
513                                                                                                                                                                                                                                                                                                                                                                                                                         ##  
Christian Arnold committed Jun 01, 2021  514      515      516      517      518      519      520      521      522      523      524      525      526      527      528      529      530      531      532      533      534      535      536      537      538      539      540      541      542      543      544      545      546      547      548      549      550      551      552      553      554      555      556                               ## INFO [2021-06-01 14:01:16]  Correlate expression values and peak counts ## INFO [2021-06-01 14:01:16]  Retain 59 rows from TF/gene data out of 18822 (filter non-TF genes and TF genes with 0 counts throughout and keep only unique ENSEMBL IDs). ## INFO [2021-06-01 14:01:16]  Correlate TF/gene data for 59 unique TF genes and peak counts for 64008 peaks. ## INFO [2021-06-01 14:01:16]  Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table. ## INFO [2021-06-01 14:01:16]  Finished successfully. Execution time: 0.4 secs ## INFO [2021-06-01 14:01:16] Shuffling rows per column ## INFO [2021-06-01 14:01:17]  Finished successfully. Execution time: 0.4 secs ## INFO [2021-06-01 14:01:17] Compute foreground and background as well as their median values per TF ## INFO [2021-06-01 14:01:18]  Finished successfully. Execution time: 1.4 secs ## INFO [2021-06-01 14:01:18] Calculate classification thresholds for repressors / activators ## INFO [2021-06-01 14:01:19]  Stringency 0.1: -0.0248 / 0.008 ## INFO [2021-06-01 14:01:19]  Stringency 0.05: -0.0361 / 0.0093 ## INFO [2021-06-01 14:01:20]  Stringency 0.01: -0.0453 / 0.0142 ## INFO [2021-06-01 14:01:20]  Stringency 0.001: -0.0495 / 0.0156 ## INFO [2021-06-01 14:01:20]  Finished successfully. Execution time: 1.4 secs ## INFO [2021-06-01 14:01:20] Finalize classification ## INFO [2021-06-01 14:01:20]  Perform Wilcoxon test for each TF. This may take a few minutes. ## INFO [2021-06-01 14:01:31]   Stringency 0.1 ## INFO [2021-06-01 14:01:31]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: AP2B.0.B,ARNT2.0.D,ATF2.1.B,BRCA1.0.D,CLOCK.0.C,COT2.1.A,E2F1.0.A,ELF1.0.A,ETV5.0.C,FLI1.1.A,FUBP1.0.D ## INFO [2021-06-01 14:01:31]   Stringency 0.05 ## INFO [2021-06-01 14:01:31]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: AP2B.0.B,ATF2.1.B,BRCA1.0.D,E2F1.0.A,ELF1.0.A,ETV5.0.C,FLI1.1.A ## INFO [2021-06-01 14:01:31]   Stringency 0.01 ## INFO [2021-06-01 14:01:31]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: BRCA1.0.D,E2F1.0.A,ELF1.0.A ## INFO [2021-06-01 14:01:31]   Stringency 0.001 ## INFO [2021-06-01 14:01:31]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: BRCA1.0.D,E2F1.0.A ## INFO [2021-06-01 14:01:31]  Summary of classification: ## INFO [2021-06-01 14:01:31]   Column classification_q0.1_final ## INFO [2021-06-01 14:01:31]    activator: 2,    undetermined: 62,    repressor: 1,    not-expressed: 10 ## INFO [2021-06-01 14:01:31]   Column classification_q0.05_final ## INFO [2021-06-01 14:01:31]    activator: 1,    undetermined: 63,    repressor: 1,    not-expressed: 10 ## INFO [2021-06-01 14:01:31]   Column classification_q0.01_final ## INFO [2021-06-01 14:01:31]    activator: 1,    undetermined: 64,    repressor: 0,    not-expressed: 10 ## INFO [2021-06-01 14:01:31]   Column classification_q0.001_final ## INFO [2021-06-01 14:01:31]    activator: 1,    undetermined: 64,    repressor: 0,    not-expressed: 10 ## INFO [2021-06-01 14:01:31]  Finished successfully. Execution time: 11.2 secs ## INFO [2021-06-01 14:01:31] Plotting density plots with foreground and background for each TF to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/TF_classification_densityPlotsForegroundBackground_expression_permuted.pdf
## INFO [2021-06-01 14:01:32]  Finished successfully. Execution time: 1.1 secs ## INFO [2021-06-01 14:01:32] Plotting AR summary plot to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/TF_classification_stringencyThresholds_expression_permuted.pdf
## INFO [2021-06-01 14:01:32]  Finished successfully. Execution time: 0 secs ## INFO [2021-06-01 14:01:32] Shuffling rows per column ## INFO [2021-06-01 14:01:33]  Finished successfully. Execution time: 0.5 secs ## INFO [2021-06-01 14:01:33] Plotting AR heatmap to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/TF_classification_summaryHeatmap_expression_permuted.pdf
## INFO [2021-06-01 14:01:34]  Finished successfully. Execution time: 1.4 secs
 557 558 559 560 561 562 563 564 565 566 567 568 

From the output, we see that the classification has been run for both real and permuted data, as before. For permuted data, almost all TFs are classified as undetermined, while for the non-permuted one, the majority of TFs is either an activator or repressor. This is irrespective of the classification stringency. Overall, this is not surprising and in fact re-assuring and indicates we capture real signal.

The contents of these plots is identical to and uses in fact practically the same code as our diffTF software. We refer to the following links for more details:

1. diffTF_paper
2. In general, readtehdocs, and in particular readtehdocs. In File {comparisonType}.diagnosticPlotsClassification1.pdf:, pages 1-4, the content of the files "TF_classification_stringencyThresholds* are explained in detail, while in File {comparisonType}.diagnosticPlotsClassification2.pdf:, Page 20 - end the contents of the files TF_classification_summaryHeatmap and TF_classification_densityPlotsForegroundBackground are elaborated upon.

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

Save GRN object to disk (optional)

After steps that take up a bit of time, it may make sense to store the GRN object to disk in order to be able to restore it at any time point. This can simply be done, for example, by saving it as an rds file using the built-in function saveRDS from R to save our GRN object in a compressed rds format.

 Christian Arnold committed Jun 01, 2021 569 

570      571      572      573      574      575      576      577                                                                                                                                                                                                                                                                                                                                                          GRN_file_outputRDS = paste0(dir_output, "/GRN.rds") saveRDS(GRN, GRN_file_outputRDS)  # Read it back into R with GRN = readRDS(GRN_file_outputRDS)

 Christian Arnold committed May 07, 2021 578 579 580 581 582 583 584 585 

Let’s add now the second type of connections, peak-genes!

 586 

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

 Christian Arnold committed Jun 01, 2021 587 

Christian Arnold committed May 07, 2021  588                                                                                                                                                                                                                                                                                                                                                                                                                         GRN = GRN::addConnections_peak_gene(GRN, overlapTypeGene = "TSS", corMethod = "pearson",  
Christian Arnold committed Jun 01, 2021  589      590      591                                                                                                                                                                                                                                                                                                                                                                                                           promoterRange = 10000, TADs = NULL, nCores = 2, plotDiagnosticPlots = TRUE, forceRerun = TRUE)
## INFO [2021-06-01 14:01:46]  Calculate statistics for each peak and gene (mean and CV) ## INFO [2021-06-01 14:01:47]  
592      593                                                                                                                                                                                                                                                                                                                                                                                                                ## Real data ##  
Christian Arnold committed Jun 01, 2021  594      595      596      597      598      599      600                                                                                                                                                                                                                                                                                                                                                                   ## INFO [2021-06-01 14:01:47] Calculate peak-gene correlations for neighborhood size 10000 ## INFO [2021-06-01 14:01:47] Calculate peak gene overlaps... ## INFO [2021-06-01 14:01:47] Extend peaks based on user-defined extension size of 10000 up- and downstream. ## INFO [2021-06-01 14:01:47] Reading pre-compiled genome annotation data  ## INFO [2021-06-01 14:01:47]  Finished successfully. Execution time: 0.5 secs ## INFO [2021-06-01 14:01:47]  Iterate through 41912 peak-gene combinations and (if possible) calculate correlations using 2 cores. This may take a few minutes. ## INFO [2021-06-01 14:01:56]  Finished execution using 2 cores. TOTAL RUNNING TIME: 8.5 secs 
601                                                                                                                                                                                                                                                                                                                                                                                                                         ##  
Christian Arnold committed Jun 01, 2021  602      603      604      605      606                                                                                                                                                                                                                                                                                                                                                                                     ## INFO [2021-06-01 14:01:56]  Finished with calculating correlations, creating final data frame and filter NA rows due to missing RNA-seq data ## INFO [2021-06-01 14:01:56]  Initial number of rows: 41912 ## INFO [2021-06-01 14:01:56]  Finished. Final number of rows: 18804 ## INFO [2021-06-01 14:01:56]  Finished successfully. Execution time: 9.3 secs ## INFO [2021-06-01 14:01:56]  
607      608                                                                                                                                                                                                                                                                                                                                                                                                                ## Permuted data ##  
Christian Arnold committed Jun 01, 2021  609      610      611      612      613      614      615      616                                                                                                                                                                                                                                                                                                                                                          ## INFO [2021-06-01 14:01:56] Calculate random peak-gene correlations for neighborhood size 10000 ## INFO [2021-06-01 14:01:56] Calculate peak gene overlaps... ## INFO [2021-06-01 14:01:56] Extend peaks based on user-defined extension size of 10000 up- and downstream. ## INFO [2021-06-01 14:01:56] Reading pre-compiled genome annotation data  ## INFO [2021-06-01 14:01:56]  Finished successfully. Execution time: 0.4 secs ## INFO [2021-06-01 14:01:57]  Randomize gene-peak links by shuffling the peak IDs. ## INFO [2021-06-01 14:01:57]  Iterate through 41912 peak-gene combinations and (if possible) calculate correlations using 2 cores. This may take a few minutes. ## INFO [2021-06-01 14:02:05]  Finished execution using 2 cores. TOTAL RUNNING TIME: 8.7 secs 
617                                                                                                                                                                                                                                                                                                                                                                                                                         ##  
Christian Arnold committed Jun 01, 2021  618      619      620      621      622      623      624      625      626      627                                                                                                                                                                                                                                                                                                                                        ## INFO [2021-06-01 14:02:05]  Finished with calculating correlations, creating final data frame and filter NA rows due to missing RNA-seq data ## INFO [2021-06-01 14:02:05]  Initial number of rows: 41912 ## INFO [2021-06-01 14:02:06]  Finished. Final number of rows: 18808 ## INFO [2021-06-01 14:02:06]  Finished successfully. Execution time: 9.4 secs ## INFO [2021-06-01 14:02:06] Plotting diagnostic plots for peak-gene correlations to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/peakGene_diagnosticPlots_all.pdf
## INFO [2021-06-01 14:02:09]  Finished successfully. Execution time: 3.2 secs ## INFO [2021-06-01 14:02:09] Plotting diagnostic plots for peak-gene correlations to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/peakGene_diagnosticPlots_protein_coding.pdf
## INFO [2021-06-01 14:02:12]  Finished successfully. Execution time: 3.1 secs ## INFO [2021-06-01 14:02:12] Plotting diagnostic plots for peak-gene correlations to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/peakGene_diagnosticPlots_protein_coding+lincRNA.pdf
## INFO [2021-06-01 14:02:15]  Finished successfully. Execution time: 3.3 secs
 628 629 630 631 632 633 634 635 636 637 638 

We see from the output that almost 42,000 peak-gene links have been identified that match our parameters (here: a maximum peak-gene distance of 10 kb). From these 42.000, however, only around 18,804 actually had corresponding RNA-seq data available, while RNA-seq data was missing or has been filtered for the other. This is a rather typical case, as not all known and annotated genes are included in the RNA-seq data in the first place. Similar to before, the correlations have also been performed for the permuted data.

Quality control 3: Diagnostic plots for peak-gene connections

Let’s now check some diagnostic plots for the peak-gene connections. In analogy to the other diagnostic plots that we encountered already before, we describe their interpretation and meaning in detail in the Introductory vignette.

Combine TF-peak and peak-gene connections and filter

Now that we added both TF-peaks and peak-gene links to our GRN object, we are ready to filter and combine them. So far, they are stored separately in the GRN object for various reasons (see the Introductory Vignette for details), but ultimately, we aim for combining them to derive TF-peak-gene connections. To do so, we can simply run the filterGRNAndConnectGenes function and filter the individual TF-peak and peak-gene links to our liking. The function has many more arguments, and we only specify a few in the example below. As before, we get a GRN object back that now contains the merged and filtered TF-peak-gene connections that we can later extract. Some of the filters apply to the TF-peak links, some of them to the peak-gene links, the parameter name is intended to indicate that.

 Christian Arnold committed Jun 01, 2021 639 

Christian Arnold committed May 07, 2021  640                                                                                                                                                                                                                                                                                                                                                                                                                         GRN = GRN::filterGRNAndConnectGenes(GRN, TF_peak.fdr.threshold = 0.2, peak_gene.fdr.threshold = 0.2,  
641      642                                                                                                                                                                                                                                                                                                                                                                                                                    peak_gene.fdr.method = "BH", gene.types = c("protein_coding", "lincRNA"), allowMissingTFs = FALSE,      allowMissingGenes = TRUE)
 Christian Arnold committed Jun 01, 2021 643 644 
## INFO [2021-06-01 14:02:15] Filter GRN network ## INFO [2021-06-01 14:02:15]  
645      646                                                                                                                                                                                                                                                                                                                                                                                                                ##  ## Real data 
Christian Arnold committed Jun 01, 2021  647      648      649      650      651      652      653      654      655      656      657      658      659      660      661      662      663      664      665      666      667                                                                                                                                                                                                                                     ## INFO [2021-06-01 14:02:15] Inital number of rows left before all filtering steps: 23153 ## INFO [2021-06-01 14:02:15]  Filter network and retain only rows with TF-peak connections with an FDR < 0.2 ## INFO [2021-06-01 14:02:15]   Number of TF-peak rows before filtering TFs: 23153 ## INFO [2021-06-01 14:02:15]   Number of TF-peak rows after filtering TFs: 4923 ## INFO [2021-06-01 14:02:15] 2. Filter peak-gene connections ## INFO [2021-06-01 14:02:15]  Filter genes by gene type, keep only the following gene types: protein_coding, lincRNA ## INFO [2021-06-01 14:02:15]   Number of peak-gene rows before filtering by gene type: 18828 ## INFO [2021-06-01 14:02:15]   Number of peak-gene rows after filtering by gene type: 18734 ## INFO [2021-06-01 14:02:16] 3. Merging TF-peak with peak-gene connections and filter the combined table... ## INFO [2021-06-01 14:02:16] Inital number of rows left before all filtering steps: 5972 ## INFO [2021-06-01 14:02:16]  Filter network and retain only rows with peak_gene.r in the following interval: (0 - 1] ## INFO [2021-06-01 14:02:16]   Number of rows before filtering TFs: 5972 ## INFO [2021-06-01 14:02:16]   Number of rows after filtering TFs: 4330 ## INFO [2021-06-01 14:02:16]  Calculate FDR based on remaining rows, filter network and retain only rows with peak-gene connections with an FDR < 0.2 ## INFO [2021-06-01 14:02:16]   Number of rows before filtering genes (including NA): 4330 ## INFO [2021-06-01 14:02:16]   Number of rows before filtering genes (excluding NA): 2368 ## INFO [2021-06-01 14:02:16]   Number of rows after filtering genes (including NA): 2593 ## INFO [2021-06-01 14:02:16]   Number of rows after filtering genes (excluding NA): 631 ## INFO [2021-06-01 14:02:16] Final number of rows left after all filtering steps: 2593 ## INFO [2021-06-01 14:02:16]  Finished successfully. Execution time: 0.5 secs ## INFO [2021-06-01 14:02:16]  
668      669                                                                                                                                                                                                                                                                                                                                                                                                                ##  ## Permuted data 
Christian Arnold committed Jun 01, 2021  670      671      672      673      674      675      676      677      678      679      680      681      682      683      684      685      686      687      688      689                                                                                                                                                                                                                                              ## INFO [2021-06-01 14:02:16] Inital number of rows left before all filtering steps: 68 ## INFO [2021-06-01 14:02:16]  Filter network and retain only rows with TF-peak connections with an FDR < 0.2 ## INFO [2021-06-01 14:02:16]   Number of TF-peak rows before filtering TFs: 68 ## INFO [2021-06-01 14:02:16]   Number of TF-peak rows after filtering TFs: 13 ## INFO [2021-06-01 14:02:16] 2. Filter peak-gene connections ## INFO [2021-06-01 14:02:16]  Filter genes by gene type, keep only the following gene types: protein_coding, lincRNA ## INFO [2021-06-01 14:02:16]   Number of peak-gene rows before filtering by gene type: 18832 ## INFO [2021-06-01 14:02:16]   Number of peak-gene rows after filtering by gene type: 18738 ## INFO [2021-06-01 14:02:16] 3. Merging TF-peak with peak-gene connections and filter the combined table... ## INFO [2021-06-01 14:02:16] Inital number of rows left before all filtering steps: 14 ## INFO [2021-06-01 14:02:16]  Filter network and retain only rows with peak_gene.r in the following interval: (0 - 1] ## INFO [2021-06-01 14:02:16]   Number of rows before filtering TFs: 14 ## INFO [2021-06-01 14:02:16]   Number of rows after filtering TFs: 11 ## INFO [2021-06-01 14:02:16]  Calculate FDR based on remaining rows, filter network and retain only rows with peak-gene connections with an FDR < 0.2 ## INFO [2021-06-01 14:02:16]   Number of rows before filtering genes (including NA): 11 ## INFO [2021-06-01 14:02:16]   Number of rows before filtering genes (excluding NA): 2 ## INFO [2021-06-01 14:02:16]   Number of rows after filtering genes (including NA): 10 ## INFO [2021-06-01 14:02:16]   Number of rows after filtering genes (excluding NA): 1 ## INFO [2021-06-01 14:02:16] Final number of rows left after all filtering steps: 10 ## INFO [2021-06-01 14:02:16]  Finished successfully. Execution time: 0.9 secs
 690 691 692 693 694 695 696 

The output shows the number of links before and after applying a particular filter that has been set for both real and permuted data. Expectedly and reassuringly, almost no connections remain for the permuted data, while the real data keeps around 2500 connections.

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

Optionally, we can also include extra columns about the correlation of TF and genes directly. So far, only TF-peaks and peak-genes have been correlated, but not directly TFs and genes. Based on a filtered set of TF-peak-gene connections, the function add_TF_gene_correlation calculates the TF-gene correlation for each connection from the filtered set for which the TF is not missing.

 Christian Arnold committed Jun 01, 2021 697 

Christian Arnold committed May 07, 2021  698                                                                                                                                                                                                                                                                                                                                                                                                                         GRN = GRN::add_TF_gene_correlation(GRN, corMethod = "pearson", nCores = 1, forceRerun = TRUE)
 Christian Arnold committed Jun 01, 2021 699 700 701 702 703 704 705 706 707 
## INFO [2021-06-01 14:02:16] Calculate correlations for TF and genes from the filtered set of connections ## INFO [2021-06-01 14:02:16]  Real data ## INFO [2021-06-01 14:02:16]   Iterate through 587 TF-gene combinations and (if possible) calculate correlations using 1 cores. This may take a few minutes. ## INFO [2021-06-01 14:02:17]  Finished execution using 1 cores. TOTAL RUNNING TIME: 0.9 secs ##  ## INFO [2021-06-01 14:02:17]   Done. Construct the final table, this may result in an increased number of TF-gene pairs due to different TF names linked to the same Ensembl ID. ## INFO [2021-06-01 14:02:17]  Permuted data ## INFO [2021-06-01 14:02:17]   Iterate through 1 TF-gene combinations and (if possible) calculate correlations using 1 cores. This may take a few minutes. ## INFO [2021-06-01 14:02:18]  Finished execution using 1 cores. TOTAL RUNNING TIME: 0.7 secs 
708                                                                                                                                                                                                                                                                                                                                                                                                                         ##  
Christian Arnold committed Jun 01, 2021  709                                                                                                                                                                                                                                                                                                                                                                                                                         ## INFO [2021-06-01 14:02:18]   Done. Construct the final table, this may result in an increased number of TF-gene pairs due to different TF names linked to the same Ensembl ID.
 710 711 712 713 714 715 716 

As can be seen from the output, the Pearson correlation for 587 TF-gene pairs has been calculated. From the around 2500 connections we obtained above, since we set the parameter allowMissingGenes = TRUE, for the majority of the TF-peak-gene connections the gene is actually missing. That is, while a TF-peak connection below the specified significance threshold exists, no corresponding gene could be found that connects to the same peak, therefore setting the gene to NA rather than excluding the row altogether.

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

Retrieve filtered connections

We are now ready to retrieve the connections and the additional data we added to them. This can be done with a helper function that retrieves a data frame from a GRN object from a particular slot. Here, we specify all.filtered, as we want to retrieve all filtered connections. For more parameter details, see the R help (getGRNConnections). Note that the first time, we assign a different variable to the return of the function (i.e., GRN_connections.all and NOT GRN as before). Importantly, we have to select a new variable as we would otherwise overwrite our GRN object altogether! All get functions from the GRN package return an element from within the object and NOT the object itself, so please keep that in mind and always check what the functions returns before running it. You can simply do so in the R help (?getGRNConnections).

 Christian Arnold committed Jun 01, 2021 717 718 
GRN_connections.all = GRN::getGRNConnections(GRN, type = "all.filtered", include_TF_gene_correlations = TRUE) 
719      720      721      722      723      724      725      726      727      728      729      730      731      732      733      734      735      736      737      738      739      740      741      742      743      744      745      746      747      748      749      750      751                                                                                                                          GRN_connections.all
## # A tibble: 2,593 x 28 ##    TF.name TF.ENSEMBL TF_peak.r_bin TF_peak.r TF_peak.fdr TF_peak.fdr_orig ##    <chr>   <fct>      <fct>             <dbl>       <dbl>            <dbl> ##  1 ARI3A.… ENSG00000… [0.65,0.7)        0.662      0.142            0.142  ##  2 ASCL2.… ENSG00000… (-0.75,-0.7]     -0.701      0.108            0.108  ##  3 BATF3.… ENSG00000… [0.65,0.7)        0.684      0.185            0.185  ##  4 BATF3.… ENSG00000… [0.65,0.7)        0.684      0.185            0.185  ##  5 BATF3.… ENSG00000… [0.65,0.7)        0.689      0.185            0.185  ##  6 BATF3.… ENSG00000… [0.75,0.8)        0.792      0.0465           0.0465 ##  7 BC11A.… ENSG00000… (-0.75,-0.7]     -0.746      0                0      ##  8 BRCA1.… ENSG00000… [0.65,0.7)        0.653      0.132            0.132  ##  9 CDX2.0… ENSG00000… [0.7,0.75)        0.706      0.0241           0.0241 ## 10 CEBPA.… ENSG00000… (-0.6,-0.55]     -0.594      0.127            0.127  ## # … with 2,583 more rows, and 22 more variables: TF_peak.fdr_direction <fct>, ## #   TF_peak.connectionType <fct>, peak.ID <fct>, peak.mean <dbl>, ## #   peak.median <dbl>, peak.CV <dbl>, peak_gene.distance <int>, ## #   peak_gene.r <dbl>, peak_gene.p_raw <dbl>, peak_gene.p_adj <dbl>, ## #   gene.ENSEMBL <fct>, gene.mean <dbl>, gene.median <dbl>, gene.CV <dbl>, ## #   gene.chr <fct>, gene.start <int>, gene.end <int>, gene.strand <fct>, ## #   gene.type <fct>, gene.name <fct>, TF_gene.r <dbl>, TF_gene.p_raw <dbl>

The table contains a total of 28 columns, and the prefix of each column name indicates the part of the GRN network that the column refers to (e.g., TFs, TF-peaks, peaks, peak-genes or genes, or TF-gene if add_TF_gene_correlation has been run before). Data are stored in a format that minimizes the memory footprint (e.g., each character column is stored as a factor). This table can now be used for any downstream analysis, as it is just a normal data frame.

Visualize the filtered GRN connections

The GRN package will soon also offer some rudimentary functions to visualize a filtered GRN network. Stay tuned! Meanwhile, you can use the igraph package to construct a graph out of the filtered TF-peak-gene connection table (see above).

Generate a connection summary

It is often useful to get a grasp of the general connectivity of a network and the number of connections that survive the filtering. This makes it possible to make an informed decision about which FDR to choose for TF-peak and peak-gene links, depending on how many links are retained and how many connections are needed for downstream analysis. To facilitate this and automate it, we offer a convenience function that in essence iterates over different combinations of filtering parameters and calls filterGRNAndConnectGenes once for each of them, and then records various connectivity statistics. Note that running this function may take a while. Afterwards, we can graphically summarize this result in either a heatmap or a boxplot. For more parameter details, see the R help (?generateStatsSummary and plot_stats_connectionSummary).

 Christian Arnold committed Jun 01, 2021 752 

Christian Arnold committed May 07, 2021  753                                                                                                                                                                                                                                                                                                                                                                                                                         GRN = GRN::generateStatsSummary(GRN, TF_peak.fdr = c(0.01, 0.05, 0.1, 0.2), TF_peak.connectionTypes = "all",  
754      755      756                                                                                                                                                                                                                                                                                                                                                                                                           peak_gene.p_raw = NULL, peak_gene.fdr = c(0.01, 0.05, 0.1, 0.2), peak_gene.r_range = c(0,          1), allowMissingGenes = c(FALSE, TRUE), allowMissingTFs = c(FALSE), gene.types = c("protein_coding",          "lincRNA"))
 Christian Arnold committed Jun 01, 2021 757 758 
## INFO [2021-06-01 14:02:18] Generating summary. This may take a while... ## INFO [2021-06-01 14:02:18]  
759      760                                                                                                                                                                                                                                                                                                                                                                                                                ## Real data... ##  
Christian Arnold committed Jun 01, 2021  761      762      763      764      765                                                                                                                                                                                                                                                                                                                                                                                     ## INFO [2021-06-01 14:02:18] Calculate network stats for TF-peak FDR of 0.01 ## INFO [2021-06-01 14:02:22] Calculate network stats for TF-peak FDR of 0.05 ## INFO [2021-06-01 14:02:26] Calculate network stats for TF-peak FDR of 0.1 ## INFO [2021-06-01 14:02:29] Calculate network stats for TF-peak FDR of 0.2 ## INFO [2021-06-01 14:02:33]  
766      767                                                                                                                                                                                                                                                                                                                                                                                                                ## Permuted data... ##  
Christian Arnold committed Jun 01, 2021  768      769      770      771      772                                                                                                                                                                                                                                                                                                                                                                                     ## INFO [2021-06-01 14:02:33] Calculate network stats for TF-peak FDR of 0.01 ## INFO [2021-06-01 14:02:36] Calculate network stats for TF-peak FDR of 0.05 ## INFO [2021-06-01 14:02:40] Calculate network stats for TF-peak FDR of 0.1 ## INFO [2021-06-01 14:02:43] Calculate network stats for TF-peak FDR of 0.2

Christian Arnold committed May 07, 2021  773                                                                                                                                                                                                                                                                                                                                                                                                                         GRN = GRN::plot_stats_connectionSummary(GRN, type = "heatmap", forceRerun = TRUE)
 Christian Arnold committed Jun 01, 2021 774 775 776 777 
## INFO [2021-06-01 14:02:47] Plotting connection summary to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/GRN.connectionSummary_heatmap.pdf
## INFO [2021-06-01 14:02:47] Finished writing plots to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/GRN.connectionSummary_heatmap.pdf ## INFO [2021-06-01 14:02:47]  Finished successfully. Execution time: 0.5 secs

Christian Arnold committed May 07, 2021  778                                                                                                                                                                                                                                                                                                                                                                                                                         GRN = GRN::plot_stats_connectionSummary(GRN, type = "boxplot", forceRerun = TRUE)
 Christian Arnold committed Jun 01, 2021 779 780 
## INFO [2021-06-01 14:02:47] Plotting diagnostic plots for network connections to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRN/vignettes/output/plots/GRN.connectionSummary_boxplot.pdf
## INFO [2021-06-01 14:02:58]  Finished successfully. Execution time: 10.7 secs
 781 782 783 784 785 786 

The output is not very informative here and just tells us about the current progress and parameter it iterates over. We can now check the two new PDF files that have been created! Please see the Introductory Vignette for examples and interpretation.

Wrapping up

We are basically finished with the main workflow, all that is left to do is to save our GRN object to disk so we can load it at a later time point without having to repeat the analysis. We recommend to run a convenience function beforehand that aims to reduce the size of the GRN object by deleting some intermediate data that may still be stored within the object. Afterwards, as we did already in the middle of the workflow, we save the object finally in rds format.

 Christian Arnold committed Jun 01, 2021 787 

Christian Arnold committed May 07, 2021  788                                                                                                                                                                                                                                                                                                                                                                                                                         GRN = GRN::deleteIntermediateData(GRN) 
789      790      791      792      793      794      795      796      797      798      799      800      801                                                                                                                                                                                                                                                                                                             saveRDS(GRN, GRN_file_outputRDS)

Finally, we again save the object in an rds file, in analogy to the intermediate save above.

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

How to continue?

From here on, possibilities are endless, and you can further investigate patterns and trends in the data! We hope that the GRN package is useful for your research and encourage you to contact us if you have any question or feature request!

Session Info

 Christian Arnold committed Jun 01, 2021 802 

803      804      805      806      807      808      809      810      811      812      813      814      815      816      817      818      819      820                                                                                                                                                                                                                                                                sessionInfo()
## R version 3.6.3 (2020-02-29) ## Platform: x86_64-pc-linux-gnu (64-bit) ## Running under: Ubuntu 20.04.1 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_GB.UTF-8        LC_COLLATE=en_US.UTF-8     ##  [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_US.UTF-8    ##  [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                  ##  [9] LC_ADDRESS=C               LC_TELEPHONE=C             ## [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C        ##  ## attached base packages: 
Christian Arnold committed Jun 01, 2021  821                                                                                                                                                                                                                                                                                                                                                                                                                         ## [1] parallel  stats4    stats     graphics  grDevices utils     datasets  
822      823      824                                                                                                                                                                                                                                                                                                                                                                                                       ## [8] methods   base      ##  ## other attached packages: 
Christian Arnold committed Jun 01, 2021  825      826      827      828      829      830      831      832      833      834      835      836      837      838      839      840                                                                                                                                                                                                                                                                                  ##  [1] progress_1.2.2                           ##  [2] TxDb.Hsapiens.UCSC.hg38.knownGene_3.10.0 ##  [3] GenomicFeatures_1.38.2                   ##  [4] GenomicRanges_1.38.0                     ##  [5] GenomeInfoDb_1.22.1                      ##  [6] org.Hs.eg.db_3.10.0                      ##  [7] AnnotationDbi_1.48.0                     ##  [8] IRanges_2.20.2                           ##  [9] S4Vectors_0.24.4                         ## [10] Biobase_2.46.0                           ## [11] BiocGenerics_0.32.0                      ## [12] limma_3.42.2                             ## [13] checkmate_2.0.0                          ## [14] futile.logger_1.4.3                      ## [15] GRN_0.10.1                               ## [16] GRNData_0.99.0                           
Christian Arnold committed May 07, 2021  841      842      843      844      845      846      847      848      849                                                                                                                                                                                                                                                                                                                                                 ## [17] forcats_0.5.1                            ## [18] stringr_1.4.0                            ## [19] dplyr_1.0.4                              ## [20] purrr_0.3.4                              ## [21] readr_1.4.0                              ## [22] tidyr_1.1.2                              ## [23] tibble_3.0.6                             ## [24] ggplot2_3.3.3                            ## [25] tidyverse_1.3.0                          
Christian Arnold committed Jun 01, 2021  850      851                                                                                                                                                                                                                                                                                                                                                                                                                ## [26] knitr_1.31                               ## [27] BiocStyle_2.19.1                         
852      853      854      855      856      857      858      859      860                                                                                                                                                                                                                                                                                                                                                 ##  ## loaded via a namespace (and not attached): ##   [1] readxl_1.3.1                backports_1.2.1             ##   [3] Hmisc_4.4-2                 BiocFileCache_1.10.2        ##   [5] systemfonts_1.0.1           plyr_1.8.6                  ##   [7] splines_3.6.3               BiocParallel_1.20.1         ##   [9] digest_0.6.27               htmltools_0.5.1.1           ##  [11] fansi_0.4.2                 magrittr_2.0.1              ##  [13] memoise_2.0.0               cluster_2.1.0               
Christian Arnold committed Jun 01, 2021  861                                                                                                                                                                                                                                                                                                                                                                                                                         ##  [15] Biostrings_2.54.0           annotate_1.64.0             
862      863      864                                                                                                                                                                                                                                                                                                                                                                                                       ##  [17] modelr_0.1.8                matrixStats_0.58.0          ##  [19] askpass_1.1                 pkgdown_1.6.1               ##  [21] prettyunits_1.1.1           jpeg_0.1-8.1                
Christian Arnold committed Jun 01, 2021  865      866                                                                                                                                                                                                                                                                                                                                                                                                                ##  [23] colorspace_2.0-0            rappdirs_0.3.3              ##  [25] blob_1.2.1                  rvest_0.3.6                 
867      868      869      870      871      872      873                                                                                                                                                                                                                                                                                                                                                                   ##  [27] textshaping_0.3.2           haven_2.3.1                 ##  [29] xfun_0.20                   crayon_1.4.1                ##  [31] RCurl_1.98-1.2              jsonlite_1.7.2              ##  [33] genefilter_1.68.0           survival_3.1-12             ##  [35] glue_1.4.2                  gtable_0.3.0                ##  [37] zlibbioc_1.32.0             XVector_0.26.0              ##  [39] DelayedArray_0.12.3         scales_1.1.1                
Christian Arnold committed May 07, 2021  874                                                                                                                                                                                                                                                                                                                                                                                                                         ##  [41] pheatmap_1.0.12             futile.options_1.0.1        
875      876      877      878      879      880                                                                                                                                                                                                                                                                                                                                                                            ##  [43] DBI_1.1.1                   Rcpp_1.0.6                  ##  [45] viridisLite_0.3.0           xtable_1.8-4                ##  [47] htmlTable_2.1.0             foreign_0.8-71              ##  [49] bit_4.0.4                   Formula_1.2-4               ##  [51] htmlwidgets_1.5.3           httr_1.4.2                  ##  [53] RColorBrewer_1.1-2          ellipsis_0.3.1              
Christian Arnold committed May 07, 2021  881      882                                                                                                                                                                                                                                                                                                                                                                                                                ##  [55] farver_2.0.3                pkgconfig_2.0.3             ##  [57] XML_3.99-0.3                nnet_7.3-14                 
883                                                                                                                                                                                                                                                                                                                                                                                                                         ##  [59] dbplyr_2.1.0                locfit_1.5-9.4              
Christian Arnold committed May 07, 2021  884      885      886                                                                                                                                                                                                                                                                                                                                                                                                       ##  [61] utf8_1.1.4                  labeling_0.4.2              ##  [63] reshape2_1.4.4              tidyselect_1.1.0            ##  [65] rlang_0.4.10                munsell_0.5.0               
887                                                                                                                                                                                                                                                                                                                                                                                                                         ##  [67] cellranger_1.1.0            tools_3.6.3                 
Christian Arnold committed May 07, 2021  888                                                                                                                                                                                                                                                                                                                                                                                                                         ##  [69] cachem_1.0.3                cli_2.5.0                   
889      890      891      892      893      894      895      896      897      898      899      900      901      902                                                                                                                                                                                                                                                                                                    ##  [71] generics_0.1.0              RSQLite_2.2.3               ##  [73] broom_0.7.4                 evaluate_0.14               ##  [75] fastmap_1.1.0               yaml_2.2.1                  ##  [77] ragg_1.1.1                  bit64_4.0.5                 ##  [79] fs_1.5.0                    formatR_1.7                 ##  [81] xml2_1.3.2                  biomaRt_2.42.1              ##  [83] compiler_3.6.3              rstudioapi_0.13             ##  [85] curl_4.3                    png_0.1-7                   ##  [87] reprex_1.0.0                geneplotter_1.64.0          ##  [89] stringi_1.5.3               desc_1.2.0                  ##  [91] lattice_0.20-41             Matrix_1.2-18               ##  [93] vctrs_0.3.6                 pillar_1.4.7                ##  [95] lifecycle_0.2.0             BiocManager_1.30.10         ##  [97] data.table_1.13.6           bitops_1.0-6                
Christian Arnold committed Jun 01, 2021  903                                                                                                                                                                                                                                                                                                                                                                                                                         ##  [99] rtracklayer_1.46.0          patchwork_1.0.1             
Christian Arnold committed May 25, 2021  904      905                                                                                                                                                                                                                                                                                                                                                                                                                ## [101] R6_2.5.0                    latticeExtra_0.6-29         ## [103] bookdown_0.21               gridExtra_2.3               
Christian Arnold committed Jun 01, 2021  906      907      908      909      910      911      912      913                                                                                                                                                                                                                                                                                                                                                          ## [105] lambda.r_1.2.4              assertthat_0.2.1            ## [107] SummarizedExperiment_1.16.1 openssl_1.4.3               ## [109] DESeq2_1.26.0               rprojroot_2.0.2             ## [111] withr_2.4.1                 GenomicAlignments_1.22.1    ## [113] Rsamtools_2.2.3             GenomeInfoDbData_1.2.2      ## [115] hms_1.0.0                   grid_3.6.3                  ## [117] rpart_4.1-15                rmarkdown_2.7               ## [119] lubridate_1.7.9.2           base64enc_0.1-3
 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942