workflow.html 122 KB
Newer Older
1
2
3
4
5
6
7
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Christian Arnold's avatar
Christian Arnold committed
8
<title>Workflow example • GRaNIE</title>
9
10
11
12
13
14
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.4.0/flatly/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css">
<script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><meta property="og:title" content="Workflow example">
Christian Arnold's avatar
Christian Arnold committed
15
<meta property="og:description" content="GRaNIE">
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--><!-- Global site tag (gtag.js) - Google Analytics --><script async src="https://www.googletagmanager.com/gtag/js?id=G-530L9SXFM1"></script><script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-530L9SXFM1');
</script>
</head>
<body data-spy="scroll" data-target="#toc">
    <div class="container template-article">
      <header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="navbar-brand">
Christian Arnold's avatar
Christian Arnold committed
39
40
        <a class="navbar-link" href="../index.html">GRaNIE</a>
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.14.0</span>
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
      </span>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
<li>
  <a href="../index.html"></a>
</li>
<li>
  <a href="../articles/quickStart.html">Getting Started</a>
</li>
<li class="dropdown">
  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
    Vignettes
     
    <span class="caret"></span>
  </a>
  <ul class="dropdown-menu" role="menu">
<li>
      <a href="../articles/quickStart.html">Getting Started</a>
    </li>
    <li>
      <a href="../articles/Introduction.html">Introduction</a>
    </li>
    <li>
      <a href="../articles/workflow.html">Workflow example</a>
    </li>
  </ul>
</li>
<li>
  <a href="../reference/index.html">Reference</a>
</li>
<li>
  <a href="../news/index.html">Changelog &amp; News</a>
</li>
      </ul>
<ul class="nav navbar-nav navbar-right"></ul>
</div>
<!--/.nav-collapse -->
  </div>
<!--/.container -->
</div>
<!--/.navbar -->

      

Christian Arnold's avatar
Christian Arnold committed
87
      </header><script src="workflow_files/header-attrs-2.11/header-attrs.js"></script><div class="row">
88
89
90
91
92
  <div class="col-md-9 contents">
    <div class="page-header toc-ignore">
      <h1 data-toc-skip>Workflow example</h1>
                        <h4 class="author">Christian Arnold, Judith Zaugg</h4>
            
Christian Arnold's avatar
Christian Arnold committed
93
            <h4 class="date">14 December 2021</h4>
94
95
96
97
98
99
100
101
102
      
      
      <div class="hidden name"><code>workflow.Rmd</code></div>

    </div>

    
        <div class="abstract">
      <p class="abstract">Abstract</p>
Christian Arnold's avatar
Christian Arnold committed
103
      <p>This workflow vignette shows how to use the <em>GRaNIE</em> package in a real-world example. For this purpose, you will use the <em>GRaNIEData</em> package for a more complex analysis to illustrate most of its features. Importantly, you will also learn in detail how to work with a <em>GRaNIE</em> 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.</p>
104
105
106
107
108
109
    </div>
    
<div id="example-workflow" class="section level1">
<h1 class="hasAnchor">
<a href="#example-workflow" class="anchor"></a>Example Workflow</h1>
<p><a name="section1"></a></p>
Christian Arnold's avatar
Christian Arnold committed
110
111
<p>In the following example, you will use data from the <em>GRaNIEData</em> package to construct a eGRN from ATAC-seq, RNA-seq data as well transcription factor data.</p>
<p>First, let’s load the required libraries <em>GRaNIE</em> and <em>GRaNIEData</em>. The <em>tidyverse</em> package is already loaded and attached when loading the <em>GRaNIE</em> package, but we nevertheless load it here explicitly to highlight that we’ll use various <em>tidyverse</em> functions for data import.</p>
112
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
Christian Arnold's avatar
Christian Arnold committed
113
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://tidyverse.tidyverse.org">tidyverse</a></span><span class="op">)</span></code></pre></div>
114
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
Christian Arnold's avatar
Christian Arnold committed
115
116
117
118
119
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va">GRaNIEData</span><span class="op">)</span>
<span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://grp-zaugg.embl-community.io/GRaNIE">GRaNIE</a></span><span class="op">)</span></code></pre></div>
<pre><code>## Loading required package: topGO</code></pre>
<pre><code>## Loading required package: BiocGenerics</code></pre>
<pre><code>## Loading required package: parallel</code></pre>
Christian Arnold's avatar
Christian Arnold committed
120
<pre><code>## 
Christian Arnold's avatar
Christian Arnold committed
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
## Attaching package: 'BiocGenerics'</code></pre>
<pre><code>## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB</code></pre>
<pre><code>## The following objects are masked from 'package:dplyr':
## 
##     combine, intersect, setdiff, union</code></pre>
<pre><code>## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs</code></pre>
<pre><code>## The following objects are masked from 'package:base':
## 
##     anyDuplicated, append, as.data.frame, basename, cbind, colnames,
##     dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
##     grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
##     order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
##     rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
##     union, unique, unsplit, which, which.max, which.min</code></pre>
<pre><code>## Loading required package: graph</code></pre>
<pre><code>## 
## Attaching package: 'graph'</code></pre>
<pre><code>## The following object is masked from 'package:stringr':
## 
##     boundary</code></pre>
<pre><code>## Loading required package: Biobase</code></pre>
<pre><code>## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.</code></pre>
<pre><code>## Loading required package: GO.db</code></pre>
<pre><code>## Loading required package: AnnotationDbi</code></pre>
<pre><code>## Loading required package: stats4</code></pre>
<pre><code>## Loading required package: IRanges</code></pre>
<pre><code>## Loading required package: S4Vectors</code></pre>
<pre><code>## 
## Attaching package: 'S4Vectors'</code></pre>
<pre><code>## The following objects are masked from 'package:dplyr':
## 
##     first, rename</code></pre>
<pre><code>## The following object is masked from 'package:tidyr':
## 
##     expand</code></pre>
<pre><code>## The following object is masked from 'package:base':
## 
##     expand.grid</code></pre>
<pre><code>## 
## Attaching package: 'IRanges'</code></pre>
<pre><code>## The following objects are masked from 'package:dplyr':
## 
##     collapse, desc, slice</code></pre>
<pre><code>## The following object is masked from 'package:purrr':
## 
##     reduce</code></pre>
<pre><code>## 
## Attaching package: 'AnnotationDbi'</code></pre>
<pre><code>## The following object is masked from 'package:dplyr':
## 
##     select</code></pre>
<pre><code>## </code></pre>
<pre><code>## Loading required package: SparseM</code></pre>
<pre><code>## 
## Attaching package: 'SparseM'</code></pre>
<pre><code>## The following object is masked from 'package:base':
## 
##     backsolve</code></pre>
<pre><code>## 
## groupGOTerms:    GOBPTerm, GOMFTerm, GOCCTerm environments built.</code></pre>
<pre><code>## 
## Attaching package: 'topGO'</code></pre>
<pre><code>## The following object is masked from 'package:IRanges':
## 
##     members</code></pre>
<pre><code>## Loading required package: magrittr</code></pre>
<pre><code>## 
## Attaching package: 'magrittr'</code></pre>
<pre><code>## The following object is masked from 'package:purrr':
## 
##     set_names</code></pre>
<pre><code>## The following object is masked from 'package:tidyr':
## 
##     extract</code></pre>
<pre><code>## Warning: replacing previous import 'grid::depth' by 'topGO::depth' when loading
## 'GRaNIE'</code></pre>
<pre><code>## Warning: replacing previous import 'IRanges::members' by 'topGO::members' when
## loading 'GRaNIE'</code></pre>
<pre><code>## Warning: replacing previous import 'IRanges::stack' by 'utils::stack' when
## loading 'GRaNIE'</code></pre>
<pre><code>## Warning: replacing previous import 'IRanges::relist' by 'utils::relist' when
## loading 'GRaNIE'</code></pre>
<pre><code>## 
## Welcome to the GRaNIE package and thank you for using our software. This is GRaNIE version 0.14.0.
## See the vignettes (type browseVignettes("GRaNIE") 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/GRaNIE</code></pre>
217
218
219
<div id="general-notes" class="section level2">
<h2 class="hasAnchor">
<a href="#general-notes" class="anchor"></a>General notes</h2>
Christian Arnold's avatar
Christian Arnold committed
220
<p>Each of the <em>GRaNIE</em> 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, <strong>always check the validity and usefulness of the parameters before starting an analysis</strong> to avoid unreasonable results.</p>
221
</div>
Christian Arnold's avatar
Christian Arnold committed
222
<div id="reading-the-data-required-for-the-granie-package" class="section level2">
223
<h2 class="hasAnchor">
Christian Arnold's avatar
Christian Arnold committed
224
225
<a href="#reading-the-data-required-for-the-granie-package" class="anchor"></a>Reading the data required for the <em>GRaNIE</em> package</h2>
<p>To set up a <em>GRaNIE</em> analysis, we first need to read in some data into <em>R</em>. The following data can be used for the <em>GRaNIE</em> package:</p>
226
227
228
229
230
231
232
233
234
235
236
<ul>
<li>open chromatin / peak data (from either ATAC-Seq, DNAse-Seq or ChIP-Seq data, for example), hereafter simply referred to as <em>peaks</em>
</li>
<li>RNA-Seq data (gene expression counts for genes across samples)</li>
</ul>
<p>The following data can be used optionally but are not required:</p>
<ul>
<li>sample metadata (e.g., sex, gender, age, sequencing batch, etc)</li>
<li>TAD domains (bed file)</li>
</ul>
<p>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.</p>
Christian Arnold's avatar
Christian Arnold committed
237
238
239
240
241
242
243
244
<div class="sourceCode" id="cb46"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="op">(</span><span class="va">files</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.files.html">list.files</a></span><span class="op">(</span>pattern <span class="op">=</span> <span class="st">"*"</span>, <span class="fu"><a href="https://rdrr.io/r/base/system.file.html">system.file</a></span><span class="op">(</span><span class="st">"extdata"</span>, package <span class="op">=</span> <span class="st">"GRaNIEData"</span><span class="op">)</span>, 
    full.names <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span><span class="op">)</span></code></pre></div>
<pre><code>## [1] "/media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRaNIEData/extdata/countsATAC.75k.tsv.gz"   
## [2] "/media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRaNIEData/extdata/countsRNA.sampled.tsv.gz"
## [3] "/media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRaNIEData/extdata/metadata.sampled.tsv"    
## [4] "/media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRaNIEData/extdata/TFBS_selected"</code></pre>
<div class="sourceCode" id="cb48"><pre class="downlit sourceCode r">
245
246
247
248
249
250
251
252
253
254
255
<code class="sourceCode R"><span class="va">file_peaks</span> <span class="op">=</span> <span class="va">files</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/grep.html">grep</a></span><span class="op">(</span><span class="st">"countsATAC.75k.tsv.gz"</span>, <span class="va">files</span><span class="op">)</span><span class="op">]</span>
<span class="va">file_RNA</span> <span class="op">=</span> <span class="va">files</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/grep.html">grep</a></span><span class="op">(</span><span class="st">"countsRNA.sampled.tsv.gz"</span>, <span class="va">files</span><span class="op">)</span><span class="op">]</span>
<span class="va">file_sampleMetadata</span> <span class="op">=</span> <span class="va">files</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/grep.html">grep</a></span><span class="op">(</span><span class="st">"metadata.sampled.tsv"</span>, <span class="va">files</span><span class="op">)</span><span class="op">]</span>
<span class="va">folder_TFBS_first50</span> <span class="op">=</span> <span class="va">files</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/grep.html">grep</a></span><span class="op">(</span><span class="st">"TFBS_selected"</span>, <span class="va">files</span><span class="op">)</span><span class="op">]</span>

<span class="va">countsRNA.df</span> <span class="op">=</span> <span class="fu">read_tsv</span><span class="op">(</span><span class="va">file_RNA</span>, col_types <span class="op">=</span> <span class="fu">cols</span><span class="op">(</span><span class="op">)</span><span class="op">)</span>
<span class="va">countsPeaks.df</span> <span class="op">=</span> <span class="fu">read_tsv</span><span class="op">(</span><span class="va">file_peaks</span>, col_types <span class="op">=</span> <span class="fu">cols</span><span class="op">(</span><span class="op">)</span><span class="op">)</span>
<span class="va">sampleMetadata.df</span> <span class="op">=</span> <span class="fu">read_tsv</span><span class="op">(</span><span class="va">file_sampleMetadata</span>, col_types <span class="op">=</span> <span class="fu">cols</span><span class="op">(</span><span class="op">)</span><span class="op">)</span>

<span class="co"># Let's check how the data looks like</span>
<span class="va">countsRNA.df</span></code></pre></div>
Christian Arnold's avatar
Christian Arnold committed
256
<pre><code>## # A tibble: 35,033 × 30
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
##    ENSEMBL babk_D bima_D cicb_D coyi_D diku_D eipl_D eiwy_D eofe_D fafq_D febc_D
##    &lt;chr&gt;    &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;
##  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 &lt;dbl&gt;, guss_D &lt;dbl&gt;,
## #   hayt_D &lt;dbl&gt;, hehd_D &lt;dbl&gt;, heja_D &lt;dbl&gt;, hiaf_D &lt;dbl&gt;, iill_D &lt;dbl&gt;,
## #   kuxp_D &lt;dbl&gt;, nukw_D &lt;dbl&gt;, oapg_D &lt;dbl&gt;, oevr_D &lt;dbl&gt;, pamv_D &lt;dbl&gt;,
## #   pelm_D &lt;dbl&gt;, podx_D &lt;dbl&gt;, qolg_D &lt;dbl&gt;, sojd_D &lt;dbl&gt;, vass_D &lt;dbl&gt;,
## #   xugn_D &lt;dbl&gt;, zaui_D &lt;dbl&gt;</code></pre>
Christian Arnold's avatar
Christian Arnold committed
274
<div class="sourceCode" id="cb50"><pre class="downlit sourceCode r">
275
<code class="sourceCode R"><span class="va">countsPeaks.df</span></code></pre></div>
Christian Arnold's avatar
Christian Arnold committed
276
277
278
279
280
281
282
283
284
285
286
287
288
<pre><code>## # A tibble: 75,000 × 32
##    peakID  babk_D bima_D cicb_D coyi_D diku_D eipl_D eiwy_D eofe_D fafq_D febc_D
##    &lt;chr&gt;    &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;
##  1 chr14:…      2      5      5      3      1      4      1      5      0     13
##  2 chrX:1…      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:1…     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:2…     21    113     46     28     44     57     47    146     12     91
289
290
291
292
293
## # … with 74,990 more rows, and 21 more variables: fikt_D &lt;dbl&gt;, guss_D &lt;dbl&gt;,
## #   hayt_D &lt;dbl&gt;, hehd_D &lt;dbl&gt;, heja_D &lt;dbl&gt;, hiaf_D &lt;dbl&gt;, iill_D &lt;dbl&gt;,
## #   kuxp_D &lt;dbl&gt;, nukw_D &lt;dbl&gt;, oapg_D &lt;dbl&gt;, oevr_D &lt;dbl&gt;, pamv_D &lt;dbl&gt;,
## #   pelm_D &lt;dbl&gt;, podx_D &lt;dbl&gt;, qolg_D &lt;dbl&gt;, sojd_D &lt;dbl&gt;, vass_D &lt;dbl&gt;,
## #   xugn_D &lt;dbl&gt;, zaui_D &lt;dbl&gt;, uaqe_D &lt;dbl&gt;, qaqx_D &lt;dbl&gt;</code></pre>
Christian Arnold's avatar
Christian Arnold committed
294
<div class="sourceCode" id="cb52"><pre class="downlit sourceCode r">
295
<code class="sourceCode R"><span class="va">sampleMetadata.df</span></code></pre></div>
Christian Arnold's avatar
Christian Arnold committed
296
297
298
299
300
301
302
303
304
305
306
307
308
<pre><code>## # A tibble: 31 × 16
##    sample_id assigned assigned_frac atac_date  clone condition  diff_start donor
##    &lt;chr&gt;        &lt;dbl&gt;         &lt;dbl&gt; &lt;date&gt;     &lt;dbl&gt; &lt;chr&gt;      &lt;date&gt;     &lt;chr&gt;
##  1 babk_D     5507093         0.211 2015-12-04     2 IFNg_SL13… 2015-10-12 babk 
##  2 bima_D    23275756         0.677 2014-12-12     1 IFNg_SL13… 2014-11-07 bima 
##  3 cicb_D    19751751         0.580 2015-04-24     3 IFNg_SL13… 2015-03-30 cicb 
##  4 coyi_D     6733642         0.312 2015-11-05     3 IFNg_SL13… 2015-09-30 coyi 
##  5 diku_D     7010213         0.195 2015-11-13     1 IFNg_SL13… 2015-10-15 diku 
##  6 eipl_D    16923025         0.520 2015-08-04     1 IFNg_SL13… 2015-06-30 eipl 
##  7 eiwy_D     9807860         0.404 2015-12-02     1 IFNg_SL13… 2015-10-23 eiwy 
##  8 eofe_D    25687477         0.646 2014-12-12     1 IFNg_SL13… 2014-11-01 eofe 
##  9 fafq_D     4600004         0.415 2015-10-14     1 IFNg_SL13… 2015-09-16 fafq 
## 10 febc_D    31712153         0.430 2015-08-04     2 IFNg_SL13… 2015-07-06 febc 
309
310
311
312
## # … with 21 more rows, and 8 more variables: EB_formation &lt;date&gt;,
## #   macrophage_diff_days &lt;dbl&gt;, medium_changes &lt;dbl&gt;, mt_frac &lt;dbl&gt;,
## #   percent_duplication &lt;dbl&gt;, received_as &lt;chr&gt;, sex &lt;chr&gt;,
## #   short_long_ratio &lt;dbl&gt;</code></pre>
Christian Arnold's avatar
Christian Arnold committed
313
<div class="sourceCode" id="cb54"><pre class="downlit sourceCode r">
314
315
<code class="sourceCode R"><span class="co"># Save the name of the respective ID columns</span>
<span class="va">idColumn_peaks</span> <span class="op">=</span> <span class="st">"peakID"</span>
Christian Arnold's avatar
Christian Arnold committed
316
317
318
319
320
321
<span class="va">idColumn_RNA</span> <span class="op">=</span> <span class="st">"ENSEMBL"</span>

<span class="co"># For the sake of simplicity, we only take a subset of all samples here to</span>
<span class="co"># speed-up the vignette code countsRNA.df = countsRNA.df[1:10000,1:10]</span>
<span class="co"># countsPeaks.df = countsPeaks.df[1:20000,1:10]</span></code></pre></div>
<p>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 <em>eGRN</em> network, so make sure the choice of normalization is reasonable. For more details, see the next sections.</p>
322
323
<p>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 <em>peakID</em>, 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 <em>ensemblID</em>, for example.</p>
<p>For the peak ID column, the required format is “chr:start-end”, with <em>chr</em> denoting the chromosome, followed by “:”, and then <em>start</em>, “-”, and <em>end</em> 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.</p>
Christian Arnold's avatar
Christian Arnold committed
324
<p>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 <em>some</em> samples are found in both of them, the <em>GRaNIE</em> 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.</p>
325
</div>
Christian Arnold's avatar
Christian Arnold committed
326
<div id="initialize-a-granie-object" class="section level2">
327
<h2 class="hasAnchor">
Christian Arnold's avatar
Christian Arnold committed
328
329
330
<a href="#initialize-a-granie-object" class="anchor"></a>Initialize a <em>GRaNIE</em> object</h2>
<p>We got all the data in the right format, we can start with our <em>GRaNIE</em> 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 <em>GRaNIE</em> object from others.</p>
<div class="sourceCode" id="cb55"><pre class="downlit sourceCode r">
331
332
333
334
335
336
337
<code class="sourceCode R"><span class="co">######################### INITIALIZE GRN OBJECT #</span>

<span class="co"># Genome assembly shortcut. Either hg19, hg38 or mm10. Both peaks and RNA data</span>
<span class="co"># must have the same genome assembly</span>
<span class="va">genomeAssembly</span> <span class="op">=</span> <span class="st">"hg38"</span>

<span class="co"># Optional and arbitrary list with information and metadata that is stored within</span>
Christian Arnold's avatar
Christian Arnold committed
338
<span class="co"># the GRaNIE object</span>
339
340
341
342
343
<span class="va">objectMetadata.l</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span>name <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/paste.html">paste0</a></span><span class="op">(</span><span class="st">"Macrophages_infected_primed"</span><span class="op">)</span>, file_peaks <span class="op">=</span> <span class="va">file_peaks</span>, 
    file_rna <span class="op">=</span> <span class="va">file_RNA</span>, file_sampleMetadata <span class="op">=</span> <span class="va">file_sampleMetadata</span>, genomeAssembly <span class="op">=</span> <span class="va">genomeAssembly</span><span class="op">)</span>

<span class="va">dir_output</span> <span class="op">=</span> <span class="st">"output"</span>

Christian Arnold's avatar
Christian Arnold committed
344
<span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/initializeGRN.html">initializeGRN</a></span><span class="op">(</span>objectMetadata <span class="op">=</span> <span class="va">objectMetadata.l</span>, outputFolder <span class="op">=</span> <span class="va">dir_output</span>, 
345
    genomeAssembly <span class="op">=</span> <span class="va">genomeAssembly</span><span class="op">)</span></code></pre></div>
Christian Arnold's avatar
Christian Arnold committed
346
347
<pre><code>## INFO [2021-12-14 13:42:02] Empty GRN object created successfully. Type the object name (e.g., GRN) to retrieve summary information about it at any time.</code></pre>
<div class="sourceCode" id="cb57"><pre class="downlit sourceCode r">
348
<code class="sourceCode R"><span class="va">GRN</span></code></pre></div>
Christian Arnold's avatar
Christian Arnold committed
349
<pre><code>## Object of class: GRaNIE  ( version 0.14.0 )
350
351
352
353
354
355
## Data summary:
##  Number of peaks: No peak data found.
##  Number of genes: No RNA-seq data found.
## Parameters:
## Provided metadata:
##   name :  Macrophages_infected_primed 
Christian Arnold's avatar
Christian Arnold committed
356
357
358
##   file_peaks :  /media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRaNIEData/extdata/countsATAC.75k.tsv.gz 
##   file_rna :  /media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRaNIEData/extdata/countsRNA.sampled.tsv.gz 
##   file_sampleMetadata :  /media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRaNIEData/extdata/metadata.sampled.tsv 
359
360
361
##   genomeAssembly :  hg38 
## Connections:
##  Number of genes (filtered, all):  NA ,  NA</code></pre>
Christian Arnold's avatar
Christian Arnold committed
362
<p>Initializing a <em>GRaNIE</em> 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 <em>hg19</em>, <em>hg38</em>, and <em>mm10</em>. Please contact us if you need additional genomes. The <em>metadata</em> argument is recommended but optional and may contain an arbitrarily complex named list that is stored as additional metadata for the <em>GRaNIE</em> object. Here, we decided to specify a name for the <em>GRaNIE</em> object as well as the original paths for all 3 input files and the genome assembly.</p>
363
<p>For more parameter details, see the R help (<code><a href="../reference/initializeGRN.html">?initializeGRN</a></code>).</p>
Christian Arnold's avatar
Christian Arnold committed
364
<p>At any time point, we can simply “print” a <em>GRaNIE</em> object by typing its name and a summary of the content is printed to the console.</p>
365
366
367
368
</div>
<div id="add-data" class="section level2">
<h2 class="hasAnchor">
<a href="#add-data" class="anchor"></a>Add data</h2>
Christian Arnold's avatar
Christian Arnold committed
369
<p>We are now ready to fill our empty object with data! After preparing the data beforehand, we can now use the data import function <em>addData</em> to import both peaks and RNA-seq data to the <em>GRaNIE</em> 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.</p>
370
<p>An important consideration is data normalization for RNA and ATAC. We currently support three choices of normalization: <em>quantile</em>, <em>DESeq_sizeFactor</em> and <em>none</em> and refer to the R help for more details (<code><a href="../reference/addData.html">?addData</a></code>). The default for RNA-Seq is a quantile normalization, while for the open chromatin peak data, it is <em>DESeq_sizeFactor</em> (i.e., a “regular” DESeq size factor normalization). Importantly, <em>DESeq_sizeFactor</em> requires raw data, while <em>quantile</em> 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”.</p>
Christian Arnold's avatar
Christian Arnold committed
371
372
<div class="sourceCode" id="cb59"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/addData.html">addData</a></span><span class="op">(</span><span class="va">GRN</span>, <span class="va">countsPeaks.df</span>, normalization_peaks <span class="op">=</span> <span class="st">"DESeq_sizeFactor"</span>, 
373
374
    idColumn_peaks <span class="op">=</span> <span class="va">idColumn_peaks</span>, <span class="va">countsRNA.df</span>, normalization_rna <span class="op">=</span> <span class="st">"quantile"</span>, 
    idColumn_RNA <span class="op">=</span> <span class="va">idColumn_RNA</span>, sampleMetadata <span class="op">=</span> <span class="va">sampleMetadata.df</span>, forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
Christian Arnold's avatar
Christian Arnold committed
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<pre><code>## INFO [2021-12-14 13:42:02] Normalize counts. Method: DESeq_sizeFactor, ID column: peakID
## INFO [2021-12-14 13:42:08]  Finished successfully. Execution time: 5.4 secs
## INFO [2021-12-14 13:42:08] Normalize counts. Method: quantile, ID column: ENSEMBL
## INFO [2021-12-14 13:42:09]  Finished successfully. Execution time: 0.4 secs
## INFO [2021-12-14 13:42:09] Subset RNA and peaks and keep only shared samples
## INFO [2021-12-14 13:42:09]  Number of samples for RNA before filtering: 29
## INFO [2021-12-14 13:42:09]  Number of samples for peaks before filtering: 31
## INFO [2021-12-14 13:42:09]  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-12-14 13:42:09] 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-12-14 13:42:09]  Number of samples for RNA after filtering: 29
## INFO [2021-12-14 13:42:09]  Number of samples for peaks data after filtering: 29
## INFO [2021-12-14 13:42:09]  Finished successfully. Execution time: 0.2 secs
## INFO [2021-12-14 13:42:09] Produce 1 permutations of RNA-counts
## INFO [2021-12-14 13:42:09] Shuffling columns 1 times
## INFO [2021-12-14 13:42:09]  Finished successfully. Execution time: 0 secs
## INFO [2021-12-14 13:42:09] Parsing provided metadata...
## INFO [2021-12-14 13:42:15] Check for overlapping peaks...
## INFO [2021-12-14 13:42:17]  Calculate statistics for each peak (mean and CV)
## INFO [2021-12-14 13:42:17]  Retrieve peak annotation using ChipSeeker. This may take a while
## &gt;&gt; preparing features information...      2021-12-14 13:42:19 
## &gt;&gt; identifying nearest features...        2021-12-14 13:42:21 
## &gt;&gt; calculating distance from peak to TSS...   2021-12-14 13:42:22 
## &gt;&gt; assigning genomic annotation...        2021-12-14 13:42:22 
## &gt;&gt; adding gene annotation...          2021-12-14 13:42:53 
## &gt;&gt; assigning chromosome lengths           2021-12-14 13:42:53 
## &gt;&gt; done...                    2021-12-14 13:42:53 
## INFO [2021-12-14 13:42:54] Calculate GC-content for peaks... 
## INFO [2021-12-14 13:42:56]  Finished successfully. Execution time: 2.7 secs
## INFO [2021-12-14 13:42:56]  Calculate statistics for each gene (mean and CV)</code></pre>
<p>We can see from the output the details for the used normalization method, and the number of samples that are kept in the <em>GRaNIE</em> 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.</p>
405
406
407
408
</div>
<div id="quality-control-1-pca-plots" class="section level2">
<h2 class="hasAnchor">
<a href="#quality-control-1-pca-plots" class="anchor"></a>Quality control 1: PCA plots</h2>
409
<p>It is time for our first QC plots! Now that we added peak and RNA data to the object, let’s check with a <em>Principal Component Analysis</em> (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 <em>addData</em> 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 (<code><a href="../reference/plotPCA_all.html">?plotPCA_all</a></code>).</p>
410
<p>Note that while this step is recommended to do, it is fully optional from a workflow point of view.</p>
Christian Arnold's avatar
Christian Arnold committed
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<div class="sourceCode" id="cb61"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/plotPCA_all.html">plotPCA_all</a></span><span class="op">(</span><span class="va">GRN</span>, type <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"rna"</span>, <span class="st">"peaks"</span><span class="op">)</span>, topn <span class="op">=</span> <span class="fl">500</span>, forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
<pre><code>## INFO [2021-12-14 13:42:57] 
## Plotting PCA and metadata correlation of raw RNA data for all shared samples to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/PCA_sharedSamples_RNA.raw.pdf... This may take a few minutes
## INFO [2021-12-14 13:42:59] Prepare PCA. Count transformation: vst
## INFO [2021-12-14 13:42:59]  Writing to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/PCA_sharedSamples_RNA.raw.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:43:02] Performing and summarizing PCs across metadata for top 500 features</code></pre>
<pre><code>## INFO [2021-12-14 13:43:07] 
## Plotting PCA and metadata correlation of normalized RNA data for all shared samples to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/PCA_sharedSamples_RNA.normalized.pdf... This may take a few minutes
## INFO [2021-12-14 13:43:07] Prepare PCA. Count transformation: none
## INFO [2021-12-14 13:43:07]  Writing to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/PCA_sharedSamples_RNA.normalized.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:43:09] Performing and summarizing PCs across metadata for top 500 features</code></pre>
<pre><code>## INFO [2021-12-14 13:43:14] Plotting PCA and metadata correlation of raw peaks data for all shared samples to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/PCA_sharedSamples_peaks.raw.pdf... This may take a few minutes
## INFO [2021-12-14 13:43:16] Prepare PCA. Count transformation: vst
## INFO [2021-12-14 13:43:16]  Writing to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/PCA_sharedSamples_peaks.raw.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:43:19] Performing and summarizing PCs across metadata for top 500 features</code></pre>
<pre><code>## INFO [2021-12-14 13:43:24] Plotting PCA and metadata correlation of normalized peaks data for all shared samples to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/PCA_sharedSamples_peaks.normalized.pdf... This may take a few minutes
## INFO [2021-12-14 13:43:24] Prepare PCA. Count transformation: none
## INFO [2021-12-14 13:43:24]  Writing to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/PCA_sharedSamples_peaks.normalized.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:43:26] Performing and summarizing PCs across metadata for top 500 features</code></pre>
431
<p>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).</p>
432
433
434
435
</div>
<div id="add-tfs-and-tfbs-and-overlap-with-peaks" class="section level2">
<h2 class="hasAnchor">
<a href="#add-tfs-and-tfbs-and-overlap-with-peaks" class="anchor"></a>Add TFs and TFBS and overlap with peaks</h2>
Christian Arnold's avatar
Christian Arnold committed
436
<p>Now it is time to add data for TFs and predicted TF binding sites (TFBS)! Our <em>GRaNIE</em> 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 <em>bed</em> or <em>bed.gz</em>; here, we specify the latter). All these files must be located in a particular folder that the <em>addTFBS</em> 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.</p>
437
<p>For more parameter details, see the R help (<code><a href="../reference/addTFBS.html">?addTFBS</a></code> and <code><a href="../reference/overlapPeaksAndTFBS.html">?overlapPeaksAndTFBS</a></code>).</p>
Christian Arnold's avatar
Christian Arnold committed
438
<div class="sourceCode" id="cb70"><pre class="downlit sourceCode r">
439
440
441
442
443
444
445
446
447
<code class="sourceCode R"><span class="co"># Should the pipeline be run for only a subset of TFs or all? The special keyword</span>
<span class="co"># 'all' will use all TF that are found in the TFBS folder; however, if only a</span>
<span class="co"># subset should be considered, specify the subset here with c() and the TF names,</span>
<span class="co"># as shown below</span>

<span class="co"># The TFBS predictions are expected as *.bed files as well as a translation table</span>
<span class="co"># with the name translationTable.csv We provide all files here:</span>
<span class="co"># https://www.embl.de/download/zaugg/GRN/hg19_hg38_mm10_PWMScan.zip (7.5 GB)</span>

Christian Arnold's avatar
Christian Arnold committed
448
<span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/addTFBS.html">addTFBS</a></span><span class="op">(</span><span class="va">GRN</span>, motifFolder <span class="op">=</span> <span class="va">folder_TFBS_first50</span>, TFs <span class="op">=</span> <span class="st">"all"</span>, filesTFBSPattern <span class="op">=</span> <span class="st">"_TFBS"</span>, 
449
    fileEnding <span class="op">=</span> <span class="st">".bed.gz"</span>, forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
Christian Arnold's avatar
Christian Arnold committed
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
<pre><code>## INFO [2021-12-14 13:43:31] Checking database folder for matching files: /media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRaNIEData/extdata/TFBS_selected
## INFO [2021-12-14 13:43:31] 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-12-14 13:43:31] Use all TF from the database folder /media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRaNIEData/extdata/TFBS_selected
## INFO [2021-12-14 13:43:31] Reading file /media/carnold/DATADRIVE1/R/x86_64-pc-linux-gnu-library/3.6/GRaNIEData/extdata/TFBS_selected/translationTable.csv
## INFO [2021-12-14 13:43:31]  Finished successfully. Execution time: 0 secs
## INFO [2021-12-14 13:43:31] Running the pipeline for 75 TF in total.</code></pre>
<div class="sourceCode" id="cb72"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/overlapPeaksAndTFBS.html">overlapPeaksAndTFBS</a></span><span class="op">(</span><span class="va">GRN</span>, nCores <span class="op">=</span> <span class="fl">1</span>, forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
<pre><code>## INFO [2021-12-14 13:43:31] Overlap peaks and TFBS using 1 cores. This may take a few minutes...
## INFO [2021-12-14 13:43:33]  Calculating intersection for TF AIRE.0.C finished. Number of overlapping TFBS after filtering: 299
## INFO [2021-12-14 13:43:35]  Calculating intersection for TF ANDR.0.A finished. Number of overlapping TFBS after filtering: 1205
## INFO [2021-12-14 13:43:35]  Calculating intersection for TF ANDR.1.A finished. Number of overlapping TFBS after filtering: 1012
## INFO [2021-12-14 13:43:37]  Calculating intersection for TF ANDR.2.A finished. Number of overlapping TFBS after filtering: 1392
## INFO [2021-12-14 13:43:38]  Calculating intersection for TF ARI3A.0.D finished. Number of overlapping TFBS after filtering: 406
## INFO [2021-12-14 13:43:39]  Calculating intersection for TF ARNT2.0.D finished. Number of overlapping TFBS after filtering: 1921
## INFO [2021-12-14 13:43:41]  Calculating intersection for TF ASCL1.0.A finished. Number of overlapping TFBS after filtering: 3482
## INFO [2021-12-14 13:43:42]  Calculating intersection for TF ASCL2.0.D finished. Number of overlapping TFBS after filtering: 2709
## INFO [2021-12-14 13:43:43]  Calculating intersection for TF ATF2.1.B finished. Number of overlapping TFBS after filtering: 919
## INFO [2021-12-14 13:43:44]  Calculating intersection for TF ATOH1.0.B finished. Number of overlapping TFBS after filtering: 2053
## INFO [2021-12-14 13:43:46]  Calculating intersection for TF BACH1.0.A finished. Number of overlapping TFBS after filtering: 2791
## INFO [2021-12-14 13:43:47]  Calculating intersection for TF BATF3.0.B finished. Number of overlapping TFBS after filtering: 1096
## INFO [2021-12-14 13:43:50]  Calculating intersection for TF BC11A.0.A finished. Number of overlapping TFBS after filtering: 10571
## INFO [2021-12-14 13:43:51]  Calculating intersection for TF BCL6.0.A finished. Number of overlapping TFBS after filtering: 1211
## INFO [2021-12-14 13:43:53]  Calculating intersection for TF BHA15.0.B finished. Number of overlapping TFBS after filtering: 3430
## INFO [2021-12-14 13:43:53]  Calculating intersection for TF BHE41.0.D finished. Number of overlapping TFBS after filtering: 1651
## INFO [2021-12-14 13:43:55]  Calculating intersection for TF BPTF.0.D finished. Number of overlapping TFBS after filtering: 1407
## INFO [2021-12-14 13:43:56]  Calculating intersection for TF BRCA1.0.D finished. Number of overlapping TFBS after filtering: 739
## INFO [2021-12-14 13:43:58]  Calculating intersection for TF CDX1.0.C finished. Number of overlapping TFBS after filtering: 790
## INFO [2021-12-14 13:43:59]  Calculating intersection for TF CDX2.0.A finished. Number of overlapping TFBS after filtering: 451
## INFO [2021-12-14 13:44:00]  Calculating intersection for TF CEBPA.0.A finished. Number of overlapping TFBS after filtering: 1329
## INFO [2021-12-14 13:44:01]  Calculating intersection for TF CENPB.0.D finished. Number of overlapping TFBS after filtering: 1070
## INFO [2021-12-14 13:44:02]  Calculating intersection for TF CLOCK.0.C finished. Number of overlapping TFBS after filtering: 1335
## INFO [2021-12-14 13:44:03]  Calculating intersection for TF CTCF.0.A finished. Number of overlapping TFBS after filtering: 8577
## INFO [2021-12-14 13:44:05]  Calculating intersection for TF CTCFL.0.A finished. Number of overlapping TFBS after filtering: 8603
## INFO [2021-12-14 13:44:06]  Calculating intersection for TF CUX2.0.D finished. Number of overlapping TFBS after filtering: 184
## INFO [2021-12-14 13:44:07]  Calculating intersection for TF DLX1.0.D finished. Number of overlapping TFBS after filtering: 194
## INFO [2021-12-14 13:44:08]  Calculating intersection for TF DLX2.0.D finished. Number of overlapping TFBS after filtering: 239
## INFO [2021-12-14 13:44:09]  Calculating intersection for TF DLX4.0.D finished. Number of overlapping TFBS after filtering: 128
## INFO [2021-12-14 13:44:10]  Calculating intersection for TF DLX6.0.D finished. Number of overlapping TFBS after filtering: 121
## INFO [2021-12-14 13:44:11]  Calculating intersection for TF DMBX1.0.D finished. Number of overlapping TFBS after filtering: 135
## INFO [2021-12-14 13:44:12]  Calculating intersection for TF DMRT1.0.D finished. Number of overlapping TFBS after filtering: 462
## INFO [2021-12-14 13:44:14]  Calculating intersection for TF E2F1.0.A finished. Number of overlapping TFBS after filtering: 3120
## INFO [2021-12-14 13:44:14]  Calculating intersection for TF E2F3.0.A finished. Number of overlapping TFBS after filtering: 1711
## INFO [2021-12-14 13:44:15]  Calculating intersection for TF E2F4.0.A finished. Number of overlapping TFBS after filtering: 4226
## INFO [2021-12-14 13:44:16]  Calculating intersection for TF E2F6.0.A finished. Number of overlapping TFBS after filtering: 5603
## INFO [2021-12-14 13:44:17]  Calculating intersection for TF E2F7.0.B finished. Number of overlapping TFBS after filtering: 4766
## INFO [2021-12-14 13:44:18]  Calculating intersection for TF COE1.0.A finished. Number of overlapping TFBS after filtering: 2365
## INFO [2021-12-14 13:44:20]  Calculating intersection for TF EGR1.0.A finished. Number of overlapping TFBS after filtering: 8759
## INFO [2021-12-14 13:44:26]  Calculating intersection for TF EGR2.0.A finished. Number of overlapping TFBS after filtering: 12564
## INFO [2021-12-14 13:44:32]  Calculating intersection for TF EGR2.1.A finished. Number of overlapping TFBS after filtering: 8819
## INFO [2021-12-14 13:44:33]  Calculating intersection for TF EHF.0.B finished. Number of overlapping TFBS after filtering: 4953
## INFO [2021-12-14 13:44:33]  Calculating intersection for TF ELF1.0.A finished. Number of overlapping TFBS after filtering: 3502
## INFO [2021-12-14 13:44:34]  Calculating intersection for TF ELF3.0.A finished. Number of overlapping TFBS after filtering: 5458
## INFO [2021-12-14 13:44:35]  Calculating intersection for TF ELK3.0.D finished. Number of overlapping TFBS after filtering: 2178
## INFO [2021-12-14 13:44:36]  Calculating intersection for TF ESR1.0.A finished. Number of overlapping TFBS after filtering: 1454
## INFO [2021-12-14 13:44:37]  Calculating intersection for TF ESR1.1.A finished. Number of overlapping TFBS after filtering: 1610
## INFO [2021-12-14 13:44:38]  Calculating intersection for TF ESR2.0.A finished. Number of overlapping TFBS after filtering: 1887
## INFO [2021-12-14 13:44:39]  Calculating intersection for TF ESR2.1.A finished. Number of overlapping TFBS after filtering: 3900
## INFO [2021-12-14 13:44:40]  Calculating intersection for TF ERR1.0.A finished. Number of overlapping TFBS after filtering: 1269
## INFO [2021-12-14 13:44:42]  Calculating intersection for TF ETS1.0.A finished. Number of overlapping TFBS after filtering: 6264
## INFO [2021-12-14 13:44:46]  Calculating intersection for TF ETS2.0.B finished. Number of overlapping TFBS after filtering: 7360
## INFO [2021-12-14 13:44:51]  Calculating intersection for TF ETV2.0.B finished. Number of overlapping TFBS after filtering: 6427
## INFO [2021-12-14 13:44:52]  Calculating intersection for TF ETV4.0.B finished. Number of overlapping TFBS after filtering: 5078
## INFO [2021-12-14 13:44:55]  Calculating intersection for TF ETV5.0.C finished. Number of overlapping TFBS after filtering: 10355
## INFO [2021-12-14 13:44:56]  Calculating intersection for TF FEZF1.0.C finished. Number of overlapping TFBS after filtering: 1038
## INFO [2021-12-14 13:44:58]  Calculating intersection for TF FLI1.1.A finished. Number of overlapping TFBS after filtering: 8999
## INFO [2021-12-14 13:44:58]  Calculating intersection for TF FOXA3.0.B finished. Number of overlapping TFBS after filtering: 489
## INFO [2021-12-14 13:44:59]  Calculating intersection for TF FOXB1.0.D finished. Number of overlapping TFBS after filtering: 260
## INFO [2021-12-14 13:45:00]  Calculating intersection for TF FOXC2.0.D finished. Number of overlapping TFBS after filtering: 682
## INFO [2021-12-14 13:45:01]  Calculating intersection for TF FOXD2.0.D finished. Number of overlapping TFBS after filtering: 249
## INFO [2021-12-14 13:45:02]  Calculating intersection for TF FOXD3.0.D finished. Number of overlapping TFBS after filtering: 969
## INFO [2021-12-14 13:45:02]  Calculating intersection for TF FOXF1.0.D finished. Number of overlapping TFBS after filtering: 450
## INFO [2021-12-14 13:45:04]  Calculating intersection for TF FOXO4.0.C finished. Number of overlapping TFBS after filtering: 399
## INFO [2021-12-14 13:45:05]  Calculating intersection for TF FOXP1.0.A finished. Number of overlapping TFBS after filtering: 441
## INFO [2021-12-14 13:45:06]  Calculating intersection for TF FOXP3.0.D finished. Number of overlapping TFBS after filtering: 363
## INFO [2021-12-14 13:45:07]  Calculating intersection for TF FUBP1.0.D finished. Number of overlapping TFBS after filtering: 1055
## INFO [2021-12-14 13:45:08]  Calculating intersection for TF EVI1.0.B finished. Number of overlapping TFBS after filtering: 250
## INFO [2021-12-14 13:45:10]  Calculating intersection for TF COT1.0.C finished. Number of overlapping TFBS after filtering: 4814
## INFO [2021-12-14 13:45:11]  Calculating intersection for TF COT1.1.C finished. Number of overlapping TFBS after filtering: 2976
## INFO [2021-12-14 13:45:12]  Calculating intersection for TF COT2.0.A finished. Number of overlapping TFBS after filtering: 1413
## INFO [2021-12-14 13:45:14]  Calculating intersection for TF COT2.1.A finished. Number of overlapping TFBS after filtering: 2548
## INFO [2021-12-14 13:45:14]  Calculating intersection for TF BRAC.0.A finished. Number of overlapping TFBS after filtering: 745
## INFO [2021-12-14 13:45:16]  Calculating intersection for TF AP2A.0.A finished. Number of overlapping TFBS after filtering: 3005
## INFO [2021-12-14 13:45:17]  Calculating intersection for TF AP2B.0.B finished. Number of overlapping TFBS after filtering: 4205
## INFO [2021-12-14 13:45:17]  Finished execution using 1 cores. TOTAL RUNNING TIME: 1.8 mins</code></pre>
<p>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 <em>GRaNIE</em> object.</p>
536
537
538
539
540
541
542
543
544
545
546
547
548
549
</div>
<div id="filter-data-optional" class="section level2">
<h2 class="hasAnchor">
<a href="#filter-data-optional" class="anchor"></a>Filter data (optional)</h2>
<p>Optionally, we can filter both peaks and RNA-Seq data according to various criteria.</p>
<p>For the open chromatin peaks, we currently support three filters:</p>
<ol style="list-style-type: decimal">
<li>Filter by their normalized mean read counts (<em>minNormalizedMean_peaks</em>, default 5)</li>
<li>Filter by their size / width (in bp) and discarding peaks that exceed a particular threshold (<em>maxSize_peaks</em>, default: 10000 bp)</li>
<li>Filter by chromosome (only keep chromosomes that are provided as input to the function, <em>chrToKeep_peaks</em>)</li>
</ol>
<p>For RNA-seq, we currently support the analogous filter as for open chromatin for normalized mean counts as explained above (<em>minNormalizedMeanRNA</em>).</p>
<p>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.</p>
<p>For more parameter details, see the R help (<code><a href="../reference/filterData.html">?filterData</a></code>).</p>
Christian Arnold's avatar
Christian Arnold committed
550
<div class="sourceCode" id="cb74"><pre class="downlit sourceCode r">
551
552
<code class="sourceCode R"><span class="co"># Chromosomes to keep for peaks. This should be a vector of chromosome names</span>
<span class="va">chrToKeep_peaks</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/paste.html">paste0</a></span><span class="op">(</span><span class="st">"chr"</span>, <span class="fl">1</span><span class="op">:</span><span class="fl">22</span><span class="op">)</span>, <span class="st">"chrX"</span>, <span class="st">"chrY"</span><span class="op">)</span>
Christian Arnold's avatar
Christian Arnold committed
553
<span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/filterData.html">filterData</a></span><span class="op">(</span><span class="va">GRN</span>, minNormalizedMean_peaks <span class="op">=</span> <span class="fl">5</span>, minNormalizedMeanRNA <span class="op">=</span> <span class="fl">1</span>, 
554
    chrToKeep_peaks <span class="op">=</span> <span class="va">chrToKeep_peaks</span>, maxSize_peaks <span class="op">=</span> <span class="fl">10000</span>, forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
Christian Arnold's avatar
Christian Arnold committed
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
<pre><code>## INFO [2021-12-14 13:45:18] FILTER PEAKS
## INFO [2021-12-14 13:45:18]  Number of peaks before filtering : 75000
## INFO [2021-12-14 13:45:18]   Filter peaks by CV: Min = 0
## INFO [2021-12-14 13:45:19]   Filter peaks by mean: Min = 5
## INFO [2021-12-14 13:45:19]  Number of peaks after filtering : 64008
## INFO [2021-12-14 13:45:19]  Finished successfully. Execution time: 0.1 secs
## INFO [2021-12-14 13:45:19] 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-12-14 13:45:19] Filter and sort peaks by size and remain only those smaller than : 10000
## INFO [2021-12-14 13:45:19]  Number of peaks before filtering: 75000
## INFO [2021-12-14 13:45:19]  Number of peaks after filtering : 75000
## INFO [2021-12-14 13:45:19]  Finished successfully. Execution time: 0.4 secs
## INFO [2021-12-14 13:45:19] Collectively, filter 10992 out of 75000 peaks.
## INFO [2021-12-14 13:45:19] Number of remaining peaks: 64008
## INFO [2021-12-14 13:45:20] FILTER RNA-seq
## INFO [2021-12-14 13:45:20]  Number of genes before filtering : 61534
## INFO [2021-12-14 13:45:20]   Filter genes by CV: Min = 0
## INFO [2021-12-14 13:45:20]   Filter genes by mean: Min = 1
## INFO [2021-12-14 13:45:20]  Number of genes after filtering : 18924
## INFO [2021-12-14 13:45:20]  Finished successfully. Execution time: 0.1 secs
## INFO [2021-12-14 13:45:20]  Number of rows in total: 35033
## INFO [2021-12-14 13:45:20]  Flagged 16211 rows because the row mean was smaller than 1</code></pre>
576
<p>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).</p>
577
578
579
580
</div>
<div id="add-tf-peak-connections" class="section level2">
<h2 class="hasAnchor">
<a href="#add-tf-peak-connections" class="anchor"></a>Add TF-peak connections</h2>
Christian Arnold's avatar
Christian Arnold committed
581
<p>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 <em>GRaNIE</em> approach:</p>
582
583
584
585
586
<ol style="list-style-type: decimal">
<li>TF - peak</li>
<li>peak - gene</li>
</ol>
<p>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.</p>
Christian Arnold's avatar
Christian Arnold committed
587
<p>In addition to creating TF-peak links based on TF expression, we can also correlate peak accessibility with other measures. We call this the <em>connection type</em>, and <em>expression</em> is the default one in our framework. However, we implemented a flexible way of allowing also additional or other connection types. Briefly, this works as follows: Additional data has to be imported beforehand with a particular name (the name of the <em>connection type</em>). For example, measures that are related to so-called <em>TF activity</em> can be used in addition or as a replacement of TF <em>expression</em>. For each connection type that we want to include, we simply add it to the parameter <em>connectionTypes</em> along with the binary vector <em>removeNegativeCorrelation</em> that specifies whether or not negatively correlated pairs should be removed or not. For expression, the default is to not remove them, while removal may be more reasonable for measures related to TF activity.</p>
588
<p>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.</p>
Christian Arnold's avatar
Christian Arnold committed
589
590
591
592
593
<p>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 <em>original</em>) and permuted data (<em>permuted</em>). For more parameter options and parameter details, see the R help (<code><a href="../reference/addConnections_TF_peak.html">?addConnections_TF_peak</a></code>).</p>
<div class="sourceCode" id="cb76"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/addConnections_TF_peak.html">addConnections_TF_peak</a></span><span class="op">(</span><span class="va">GRN</span>, plotDiagnosticPlots <span class="op">=</span> <span class="cn">TRUE</span>, connectionTypes <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"expression"</span><span class="op">)</span>, 
    corMethod <span class="op">=</span> <span class="st">"pearson"</span>, forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
<pre><code>## INFO [2021-12-14 13:45:20] 
594
595
## Real data
## 
Christian Arnold's avatar
Christian Arnold committed
596
597
598
599
600
601
602
603
604
605
606
607
## INFO [2021-12-14 13:45:20] Calculate TF-peak links for connection type expression
## INFO [2021-12-14 13:45:20]  Correlate expression and peak counts
## INFO [2021-12-14 13:45:20]   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-12-14 13:45:20]   Correlate TF/gene data for 59 unique Ensembl IDs (TFs) and peak counts for 64008 peaks.
## INFO [2021-12-14 13:45:20]   Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table.
## INFO [2021-12-14 13:45:21]   Finished successfully. Execution time: 0.9 secs
## INFO [2021-12-14 13:45:21]  Run FDR calculations for 65 TFs for which TFBS predictions and expression data for the corresponding gene are available.
## INFO [2021-12-14 13:45:21]   Skip the following 10 TF due to missing data: 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-12-14 13:45:21]   Compute FDR for each TF. This may take a while...
## INFO [2021-12-14 13:45:34]   Finished successfully. Execution time: 13.8 secs
## INFO [2021-12-14 13:45:34]  Finished successfully. Execution time: 14 secs
## INFO [2021-12-14 13:45:34] 
608
609
## Permuted data
## 
Christian Arnold's avatar
Christian Arnold committed
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
## INFO [2021-12-14 13:45:34] Shuffling rows per column
## INFO [2021-12-14 13:45:35]  Finished successfully. Execution time: 0.7 secs
## INFO [2021-12-14 13:45:35] Calculate TF-peak links for connection type expression
## INFO [2021-12-14 13:45:35]  Correlate expression and peak counts
## INFO [2021-12-14 13:45:35]   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-12-14 13:45:35]   Correlate TF/gene data for 59 unique Ensembl IDs (TFs) and peak counts for 64008 peaks.
## INFO [2021-12-14 13:45:35]   Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table.
## INFO [2021-12-14 13:45:37]   Finished successfully. Execution time: 1.6 secs
## INFO [2021-12-14 13:45:37]  Run FDR calculations for 65 TFs for which TFBS predictions and expression data for the corresponding gene are available.
## INFO [2021-12-14 13:45:37]   Skip the following 10 TF due to missing data: 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-12-14 13:45:37]   Compute FDR for each TF. This may take a while...
## INFO [2021-12-14 13:45:45]   Finished successfully. Execution time: 10 secs
## INFO [2021-12-14 13:45:45]  Finished successfully. Execution time: 10.9 secs
## INFO [2021-12-14 13:45:45] Plotting FDR curves for each TF to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_peak.fdrCurves_original.pdf
## INFO [2021-12-14 13:45:45]  Including a total of 65 TF. Preparing plots...
## INFO [2021-12-14 13:45:48]  Finished generating plots, start plotting to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_peak.fdrCurves_original.pdf. This may take a few minutes.</code></pre>
<pre><code>## INFO [2021-12-14 13:46:26] Finished writing plots to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_peak.fdrCurves_original.pdf
## INFO [2021-12-14 13:46:26]  Finished successfully. Execution time: 40.9 secs
## INFO [2021-12-14 13:46:26] Plotting FDR curves for each TF to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_peak.fdrCurves_permuted.pdf
## INFO [2021-12-14 13:46:26]  Including a total of 65 TF. Preparing plots...
## INFO [2021-12-14 13:46:30]  Finished generating plots, start plotting to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_peak.fdrCurves_permuted.pdf. This may take a few minutes.</code></pre>
<pre><code>## INFO [2021-12-14 13:47:12] Finished writing plots to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_peak.fdrCurves_permuted.pdf
## INFO [2021-12-14 13:47:12]  Finished successfully. Execution time: 46.2 secs</code></pre>
633
634
635
636
637
<p>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!</p>
</div>
<div id="quality-control-2-diagnostic-plots-for-tf-peak-connections" class="section level2">
<h2 class="hasAnchor">
<a href="#quality-control-2-diagnostic-plots-for-tf-peak-connections" class="anchor"></a>Quality control 2: Diagnostic plots for TF-peak connections</h2>
Christian Arnold's avatar
Christian Arnold committed
638
<p>After adding the TF-peak links to our <em>GRaNIE</em> object, let’s look at some diagnostic plots. The <em>plots</em> folder within the specified output folder when initializing the <em>GRaNIE</em> object should now contain two new files that are named <em>TF_peak.fdrCurves_original.pdf</em> and <em>TF_peak.fdrCurves_permuted.pdf</em>. For reasons of brevity and organization, we describe their interpretation and meaning in detail in the Introductory vignette and not here, however.</p>
639
640
641
642
643
644
645
646
<!-- Here is what the plot for the original data for the TF *SP1.0.A* looks like: -->
<!-- <div align="center"> -->
<!-- <figure> -->
<!-- <img src="figs/TF-peak_diagnosticPlots1.png" height="600px"/> -->
<!-- <figcaption><i>Figure 3 - Diagnostic plots for TF-peak links for a particular TF, *SP1.0.A*.</i></figcaption> -->
<!-- </figure> -->
<!-- </div> -->
<!-- We can see that the TF-peak FDR is below 0.2 for positive correlation bins in the positive direction only (upper plot), while for the negative direction (lower plot), it is always above 0.4, regardless of the correlation bin. Here, correlation bin refers to the correlation of a particular SP1.0.A - peak pair that has been discretized accordingly (i.e., a correlation of 0.07 would go into (0.05-0.10] correlation bin)). Usually, depending on the mode of action of a TF, either one of the two directions may show a low FDR, but rarely both. Thus, positively correlated SP1.0.A - peak pairs seem to be significant and will be retained for the final *GRN* network. As an exercise, check how this plot looks like for the permuted data! Would you expect lower or higher FDRs? -->
647
648
649
650
</div>
<div id="run-the-ar-classification-and-qc-optional" class="section level2">
<h2 class="hasAnchor">
<a href="#run-the-ar-classification-and-qc-optional" class="anchor"></a>Run the AR classification and QC (optional)</h2>
Christian Arnold's avatar
Christian Arnold committed
651
652
653
654
<p>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 <em>diffTF</em> 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 <em>GRaNIE</em> framework in an identical fashion.</p>
<p><strong>Note that this step is fully optional and can be skipped. The output of the <em>AR_classification_wrapper</em> function is not used for subsequent steps.</strong>. To keep the memory footprint of the <em>GRaNIE</em> object low, we recommend to set <code>deleteIntermediateData = TRUE</code>.</p>
<div class="sourceCode" id="cb80"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/AR_classification_wrapper.html">AR_classification_wrapper</a></span><span class="op">(</span><span class="va">GRN</span>, significanceThreshold_Wilcoxon <span class="op">=</span> <span class="fl">0.05</span>, 
655
656
    plot_minNoTFBS_heatmap <span class="op">=</span> <span class="fl">100</span>, plotDiagnosticPlots <span class="op">=</span> <span class="cn">TRUE</span>, deleteIntermediateData <span class="op">=</span> <span class="cn">TRUE</span>, 
    forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
Christian Arnold's avatar
Christian Arnold committed
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
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
<pre><code>## INFO [2021-12-14 13:47:12]  Connection type expression
## 
## INFO [2021-12-14 13:47:12]  Real data
## 
## INFO [2021-12-14 13:47:12]  Correlate expression and peak counts
## INFO [2021-12-14 13:47:12]  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-12-14 13:47:12]  Correlate TF/gene data for 59 unique Ensembl IDs (TFs) and peak counts for 64008 peaks.
## INFO [2021-12-14 13:47:12]  Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table.
## INFO [2021-12-14 13:47:13]  Finished successfully. Execution time: 0.8 secs
## INFO [2021-12-14 13:47:14] Compute foreground and background as well as their median values per TF
## INFO [2021-12-14 13:47:17]  Finished successfully. Execution time: 3.6 secs
## INFO [2021-12-14 13:47:17] Calculate classification thresholds for repressors / activators
## INFO [2021-12-14 13:47:18]  Stringency 0.1: -0.0305 / 0.0157
## INFO [2021-12-14 13:47:18]  Stringency 0.05: -0.0439 / 0.0195
## INFO [2021-12-14 13:47:19]  Stringency 0.01: -0.0537 / 0.024
## INFO [2021-12-14 13:47:20]  Stringency 0.001: -0.0564 / 0.0281
## INFO [2021-12-14 13:47:20]  Finished successfully. Execution time: 3 secs
## INFO [2021-12-14 13:47:20] Finalize classification
## INFO [2021-12-14 13:47:20]  Perform Wilcoxon test for each TF. This may take a few minutes.
## INFO [2021-12-14 13:47:36]   Stringency 0.1
## INFO [2021-12-14 13:47:36]    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-12-14 13:47:36]   Stringency 0.05
## INFO [2021-12-14 13:47:37]    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-12-14 13:47:37]   Stringency 0.01
## INFO [2021-12-14 13:47:37]    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-12-14 13:47:37]   Stringency 0.001
## INFO [2021-12-14 13:47:37]    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-12-14 13:47:37]  Summary of classification:
## INFO [2021-12-14 13:47:37]   Column classification_q0.1_final
## INFO [2021-12-14 13:47:37]    activator: 25,    undetermined: 17,    repressor: 23,    not-expressed: 10
## INFO [2021-12-14 13:47:37]   Column classification_q0.05_final
## INFO [2021-12-14 13:47:37]    activator: 24,    undetermined: 21,    repressor: 20,    not-expressed: 10
## INFO [2021-12-14 13:47:37]   Column classification_q0.01_final
## INFO [2021-12-14 13:47:37]    activator: 21,    undetermined: 28,    repressor: 16,    not-expressed: 10
## INFO [2021-12-14 13:47:37]   Column classification_q0.001_final
## INFO [2021-12-14 13:47:37]    activator: 19,    undetermined: 30,    repressor: 16,    not-expressed: 10
## INFO [2021-12-14 13:47:37]  Finished successfully. Execution time: 16.5 secs
## INFO [2021-12-14 13:47:37] Plotting density plots with foreground and background for each TF to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_classification_densityPlotsForegroundBackground_expression_original.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:47:38]  Finished successfully. Execution time: 1.1 secs
## INFO [2021-12-14 13:47:38] Plotting AR summary plot to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_classification_stringencyThresholds_expression_original.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:47:38]  Finished successfully. Execution time: 0 secs
## INFO [2021-12-14 13:47:38] Plotting AR heatmap to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_classification_summaryHeatmap_expression_original.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:47:39]  Finished successfully. Execution time: 1.2 secs
## INFO [2021-12-14 13:47:40]  Permuted data
## 
## INFO [2021-12-14 13:47:40]  Correlate expression and peak counts
## INFO [2021-12-14 13:47:40]  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-12-14 13:47:40]  Correlate TF/gene data for 59 unique Ensembl IDs (TFs) and peak counts for 64008 peaks.
## INFO [2021-12-14 13:47:40]  Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table.
## INFO [2021-12-14 13:47:40]  Finished successfully. Execution time: 0.5 secs
## INFO [2021-12-14 13:47:40] Shuffling rows per column
## INFO [2021-12-14 13:47:41]  Finished successfully. Execution time: 0.6 secs
## INFO [2021-12-14 13:47:41] Compute foreground and background as well as their median values per TF
## INFO [2021-12-14 13:47:43]  Finished successfully. Execution time: 1.9 secs
## INFO [2021-12-14 13:47:43] Calculate classification thresholds for repressors / activators
## INFO [2021-12-14 13:47:43]  Stringency 0.1: -0.021 / 0.0165
## INFO [2021-12-14 13:47:43]  Stringency 0.05: -0.0248 / 0.0237
## INFO [2021-12-14 13:47:44]  Stringency 0.01: -0.0274 / 0.0298
## INFO [2021-12-14 13:47:44]  Stringency 0.001: -0.0276 / 0.0328
## INFO [2021-12-14 13:47:44]  Finished successfully. Execution time: 1.1 secs
## INFO [2021-12-14 13:47:44] Finalize classification
## INFO [2021-12-14 13:47:44]  Perform Wilcoxon test for each TF. This may take a few minutes.
## INFO [2021-12-14 13:47:57]   Stringency 0.1
## INFO [2021-12-14 13:47:57]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: AIRE.0.C,ANDR.1.A,ARNT2.0.D,ASCL2.0.D,ATF2.1.B,BCL6.0.A,BHE41.0.D,BRAC.0.A,COT2.0.A,COT2.1.A,CUX2.0.D,DMBX1.0.D,EGR2.0.A,EGR2.1.A,ETV2.0.B,ETV4.0.B,EVI1.0.B,FLI1.1.A,FOXC2.0.D,FOXO4.0.C
## INFO [2021-12-14 13:47:57]   Stringency 0.05
## INFO [2021-12-14 13:47:57]    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,BHE41.0.D,BRAC.0.A,CUX2.0.D,DMBX1.0.D,EGR2.1.A,FOXO4.0.C
## INFO [2021-12-14 13:47:57]   Stringency 0.01
## INFO [2021-12-14 13:47:57]    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,BHE41.0.D,BRAC.0.A,CUX2.0.D,DMBX1.0.D,FOXO4.0.C
## INFO [2021-12-14 13:47:57]   Stringency 0.001
## INFO [2021-12-14 13:47:57]    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,BHE41.0.D,BRAC.0.A,CUX2.0.D,DMBX1.0.D,FOXO4.0.C
## INFO [2021-12-14 13:47:57]  Summary of classification:
## INFO [2021-12-14 13:47:57]   Column classification_q0.1_final
## INFO [2021-12-14 13:47:57]    activator: 1,    undetermined: 64,    repressor: 0,    not-expressed: 10
## INFO [2021-12-14 13:47:57]   Column classification_q0.05_final
## INFO [2021-12-14 13:47:57]    activator: 1,    undetermined: 64,    repressor: 0,    not-expressed: 10
## INFO [2021-12-14 13:47:57]   Column classification_q0.01_final
## INFO [2021-12-14 13:47:58]    activator: 1,    undetermined: 64,    repressor: 0,    not-expressed: 10
## INFO [2021-12-14 13:47:58]   Column classification_q0.001_final
## INFO [2021-12-14 13:47:58]    activator: 1,    undetermined: 64,    repressor: 0,    not-expressed: 10
## INFO [2021-12-14 13:47:58]  Finished successfully. Execution time: 13.8 secs
## INFO [2021-12-14 13:47:58] Plotting density plots with foreground and background for each TF to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_classification_densityPlotsForegroundBackground_expression_permuted.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:47:59]  Finished successfully. Execution time: 1.6 secs
## INFO [2021-12-14 13:47:59] Plotting AR summary plot to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_classification_stringencyThresholds_expression_permuted.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:47:59]  Finished successfully. Execution time: 0 secs
## INFO [2021-12-14 13:47:59] Shuffling rows per column
## INFO [2021-12-14 13:48:00]  Finished successfully. Execution time: 0.8 secs
## INFO [2021-12-14 13:48:00] Plotting AR heatmap to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_classification_summaryHeatmap_expression_permuted.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:48:02]  Finished successfully. Execution time: 2 secs</code></pre>
745
746
747
748
<p>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 <em>undetermined</em>, 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.</p>
<p>The contents of these plots is identical to and uses in fact practically the same code as our <em>diffTF</em> software. We refer to the following links for more details:</p>
<ol style="list-style-type: decimal">
<li><a href="https://doi.org/10.1016/j.celrep.2019.10.106" title="The original publication explaining the method and motivation in detail">diffTF_paper</a></li>
Christian Arnold's avatar
Christian Arnold committed
749
<li>In general, <a href="https://difftf.readthedocs.io" title="the *ReadTheDocs* help for *diffTF*">readtehdocs</a>, and in particular <a href="https://difftf.readthedocs.io/en/latest/chapter2.html#files-comparisontype-diagnosticplotsclassification1-pdf-and-comparisontype-diagnosticplotsclassification2-pdf" title="the following part*">readtehdocs</a>. In <em>File {comparisonType}.diagnosticPlotsClassification1.pdf:, pages 1-4</em>, the content of the files “TF_classification_stringencyThresholds* are explained in detail, while in <em>File {comparisonType}.diagnosticPlotsClassification2.pdf:, Page 20 - end</em> the contents of the files <em>TF_classification_summaryHeatmap</em> and <em>TF_classification_densityPlotsForegroundBackground</em> are elaborated upon.</li>
750
751
752
</ol>
<p>For more parameter details, see the R help (<code><a href="../reference/AR_classification_wrapper.html">?AR_classification_wrapper</a></code>).</p>
</div>
Christian Arnold's avatar
Christian Arnold committed
753
<div id="save-granie-object-to-disk-optional" class="section level2">
754
<h2 class="hasAnchor">
Christian Arnold's avatar
Christian Arnold committed
755
756
757
<a href="#save-granie-object-to-disk-optional" class="anchor"></a>Save <em>GRaNIE</em> object to disk (optional)</h2>
<p>After steps that take up a bit of time, it may make sense to store the <em>GRaNIE</em> 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 <em>rds</em> file using the built-in function <em>saveRDS</em> from R to save our <em>GRaNIE</em> object in a compressed rds format.</p>
<div class="sourceCode" id="cb88"><pre class="downlit sourceCode r">
758
759
760
761
762
763
764
765
<code class="sourceCode R"><span class="va">GRN_file_outputRDS</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/paste.html">paste0</a></span><span class="op">(</span><span class="va">dir_output</span>, <span class="st">"/GRN.rds"</span><span class="op">)</span>
<span class="fu"><a href="https://rdrr.io/r/base/readRDS.html">saveRDS</a></span><span class="op">(</span><span class="va">GRN</span>, <span class="va">GRN_file_outputRDS</span><span class="op">)</span>

<span class="co"># Read it back into R with GRN = readRDS(GRN_file_outputRDS)</span></code></pre></div>
</div>
<div id="add-peak-gene-connections" class="section level2">
<h2 class="hasAnchor">
<a href="#add-peak-gene-connections" class="anchor"></a>Add peak-gene connections</h2>
Christian Arnold's avatar
Christian Arnold committed
766
<p>Let’s add now the second type of connections, peak-genes! Note that to make the function run faster, we restrict the maximum peak-gene distance to 10,000 bp here, while the default is 250,000 bp.</p>
767
768
769
770
771
772
773
<!-- TODO -->
<!-- Type of overlap for gene: Either "TSS" or "full". If "full", any extended peak-gene overlap is taken, regardless of where in the gene it occurs -->
<!-- If set to "TSS", only overlap of extended peaks with the TSS of the gene (assumed to be at the 5' position) is considered -->
<!-- Until 09.09.20, "full" was being used by default, this parameter did not exist before -->
<!-- Only relevant when no TAD domains are provided; if TADs are provided, this parameter can be ignored. -->
<!-- Specifies the neighborhood size in bp (for both upstream and downstream of the peak) for peaks to find genes in vicinity and associate/correlate genes with peaks -->
<!-- Default value 250000, here set to a smaller value to decrease running time -->
774
<p>For more parameter details, see the R help (<code><a href="../reference/addConnections_peak_gene.html">?addConnections_peak_gene</a></code>).</p>
Christian Arnold's avatar
Christian Arnold committed
775
776
777
778
779
<div class="sourceCode" id="cb89"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/addConnections_peak_gene.html">addConnections_peak_gene</a></span><span class="op">(</span><span class="va">GRN</span>, overlapTypeGene <span class="op">=</span> <span class="st">"TSS"</span>, corMethod <span class="op">=</span> <span class="st">"pearson"</span>, 
    promoterRange <span class="op">=</span> <span class="fl">10000</span>, TADs <span class="op">=</span> <span class="cn">NULL</span>, nCores <span class="op">=</span> <span class="fl">1</span>, plotDiagnosticPlots <span class="op">=</span> <span class="cn">TRUE</span>, plotGeneTypes <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"all"</span><span class="op">)</span><span class="op">)</span>, 
    forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
<pre><code>## INFO [2021-12-14 13:48:02] 
780
781
## Real data
## 
Christian Arnold's avatar
Christian Arnold committed
782
783
784
785
786
787
788
789
790
791
792
793
794
## INFO [2021-12-14 13:48:02] Calculate peak-gene correlations for neighborhood size 10000
## INFO [2021-12-14 13:48:02] Calculate peak gene overlaps...
## INFO [2021-12-14 13:48:02] Extend peaks based on user-defined extension size of 10000 up- and downstream.
## INFO [2021-12-14 13:48:03] Reading pre-compiled genome annotation data 
## INFO [2021-12-14 13:48:03]  Finished successfully. Execution time: 0.6 secs
## INFO [2021-12-14 13:48:03]  Iterate through 41912 peak-gene combinations and (if possible) calculate correlations using 1 cores. This may take a few minutes.
## INFO [2021-12-14 13:48:12]  Finished execution using 1 cores. TOTAL RUNNING TIME: 8.9 secs
## 
## INFO [2021-12-14 13:48:12]  Finished with calculating correlations, creating final data frame and filter NA rows due to missing RNA-seq data
## INFO [2021-12-14 13:48:12]  Initial number of rows: 41912
## INFO [2021-12-14 13:48:12]  Finished. Final number of rows: 18804
## INFO [2021-12-14 13:48:12]  Finished successfully. Execution time: 9.8 secs
## INFO [2021-12-14 13:48:12] 
795
796
## Permuted data
## 
Christian Arnold's avatar
Christian Arnold committed
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
## INFO [2021-12-14 13:48:12] Calculate random peak-gene correlations for neighborhood size 10000
## INFO [2021-12-14 13:48:12] Calculate peak gene overlaps...
## INFO [2021-12-14 13:48:12] Extend peaks based on user-defined extension size of 10000 up- and downstream.
## INFO [2021-12-14 13:48:12] Reading pre-compiled genome annotation data 
## INFO [2021-12-14 13:48:13]  Finished successfully. Execution time: 0.5 secs
## INFO [2021-12-14 13:48:13]  Randomize gene-peak links by shuffling the peak IDs.
## INFO [2021-12-14 13:48:13]  Iterate through 41912 peak-gene combinations and (if possible) calculate correlations using 1 cores. This may take a few minutes.
## INFO [2021-12-14 13:48:21]  Finished execution using 1 cores. TOTAL RUNNING TIME: 8.5 secs
## 
## INFO [2021-12-14 13:48:21]  Finished with calculating correlations, creating final data frame and filter NA rows due to missing RNA-seq data
## INFO [2021-12-14 13:48:21]  Initial number of rows: 41912
## INFO [2021-12-14 13:48:22]  Finished. Final number of rows: 18806
## INFO [2021-12-14 13:48:22]  Finished successfully. Execution time: 9.4 secs
## INFO [2021-12-14 13:48:22] Plotting diagnostic plots for peak-gene correlations to file(s) with basename /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/peakGene_diagnosticPlots_
## INFO [2021-12-14 13:48:22]  Gene type all</code></pre>
<pre><code>## INFO [2021-12-14 13:48:44]  Finished successfully. Execution time: 22.1 secs</code></pre>
813
814
815
816
817
818
819
820
821
822
<p>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.</p>
</div>
<div id="quality-control-3-diagnostic-plots-for-peak-gene-connections" class="section level2">
<h2 class="hasAnchor">
<a href="#quality-control-3-diagnostic-plots-for-peak-gene-connections" class="anchor"></a>Quality control 3: Diagnostic plots for peak-gene connections</h2>
<p>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.</p>
</div>
<div id="combine-tf-peak-and-peak-gene-connections-and-filter" class="section level2">
<h2 class="hasAnchor">
<a href="#combine-tf-peak-and-peak-gene-connections-and-filter" class="anchor"></a>Combine TF-peak and peak-gene connections and filter</h2>
Christian Arnold's avatar
Christian Arnold committed
823
824
825
<p>Now that we added both TF-peaks and peak-gene links to our <em>GRaNIE</em> object, we are ready to filter and combine them. So far, they are stored separately in the 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 <em>filterGRNAndConnectGenes</em> 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 <em>GRaNIE</em> 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.</p>
<div class="sourceCode" id="cb92"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/filterGRNAndConnectGenes.html">filterGRNAndConnectGenes</a></span><span class="op">(</span><span class="va">GRN</span>, TF_peak.fdr.threshold <span class="op">=</span> <span class="fl">0.3</span>, peak_gene.fdr.threshold <span class="op">=</span> <span class="fl">0.3</span>, 
826
    peak_gene.fdr.method <span class="op">=</span> <span class="st">"BH"</span>, gene.types <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"protein_coding"</span>, <span class="st">"lincRNA"</span><span class="op">)</span>, allowMissingTFs <span class="op">=</span> <span class="cn">FALSE</span>, 
Christian Arnold's avatar
Christian Arnold committed
827
828
829
    allowMissingGenes <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></code></pre></div>
<pre><code>## INFO [2021-12-14 13:48:44] Filter GRN network
## INFO [2021-12-14 13:48:44] 
830
831
## 
## Real data
Christian Arnold's avatar
Christian Arnold committed
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
## INFO [2021-12-14 13:48:44] Inital number of rows left before all filtering steps: 23153
## INFO [2021-12-14 13:48:44]  Filter network and retain only rows with TF-peak connections with an FDR &lt; 0.3
## INFO [2021-12-14 13:48:44]   Number of TF-peak rows before filtering TFs: 23153
## INFO [2021-12-14 13:48:44]   Number of TF-peak rows after filtering TFs: 23153
## INFO [2021-12-14 13:48:44] 2. Filter peak-gene connections
## INFO [2021-12-14 13:48:44]  Filter genes by gene type, keep only the following gene types: protein_coding, lincRNA
## INFO [2021-12-14 13:48:44]   Number of peak-gene rows before filtering by gene type: 18828
## INFO [2021-12-14 13:48:44]   Number of peak-gene rows after filtering by gene type: 18734
## INFO [2021-12-14 13:48:44] 3. Merging TF-peak with peak-gene connections and filter the combined table...
## INFO [2021-12-14 13:48:44] Inital number of rows left before all filtering steps: 27474
## INFO [2021-12-14 13:48:44]  Filter rows with missing ENSEMBL IDs
## INFO [2021-12-14 13:48:44]   Number of rows before filtering: 27474
## INFO [2021-12-14 13:48:44]   Number of rows after filtering: 16412
## INFO [2021-12-14 13:48:44]  Filter network and retain only rows with peak_gene.r in the following interval: (0 - 1]
## INFO [2021-12-14 13:48:44]   Number of rows before filtering TFs: 16412
## INFO [2021-12-14 13:48:44]   Number of rows after filtering TFs: 9943
## INFO [2021-12-14 13:48:44]  Calculate FDR based on remaining rows, filter network and retain only rows with peak-gene connections with an FDR &lt; 0.3
## INFO [2021-12-14 13:48:44]   Number of rows before filtering genes (including NA): 9943
## INFO [2021-12-14 13:48:44]   Number of rows before filtering genes (excluding NA): 9943
## INFO [2021-12-14 13:48:44]   Number of rows after filtering genes (including NA): 3467
## INFO [2021-12-14 13:48:44]   Number of rows after filtering genes (excluding NA): 3467
## INFO [2021-12-14 13:48:44] Final number of rows left after all filtering steps: 3467
## INFO [2021-12-14 13:48:44]  Finished successfully. Execution time: 0.5 secs
## INFO [2021-12-14 13:48:44] 
856
857
## 
## Permuted data
Christian Arnold's avatar
Christian Arnold committed
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
## INFO [2021-12-14 13:48:44] Inital number of rows left before all filtering steps: 84
## INFO [2021-12-14 13:48:44]  Filter network and retain only rows with TF-peak connections with an FDR &lt; 0.3
## INFO [2021-12-14 13:48:44]   Number of TF-peak rows before filtering TFs: 84
## INFO [2021-12-14 13:48:44]   Number of TF-peak rows after filtering TFs: 84
## INFO [2021-12-14 13:48:44] 2. Filter peak-gene connections
## INFO [2021-12-14 13:48:44]  Filter genes by gene type, keep only the following gene types: protein_coding, lincRNA
## INFO [2021-12-14 13:48:45]   Number of peak-gene rows before filtering by gene type: 18830
## INFO [2021-12-14 13:48:45]   Number of peak-gene rows after filtering by gene type: 18736
## INFO [2021-12-14 13:48:45] 3. Merging TF-peak with peak-gene connections and filter the combined table...
## INFO [2021-12-14 13:48:45] Inital number of rows left before all filtering steps: 87
## INFO [2021-12-14 13:48:45]  Filter rows with missing ENSEMBL IDs
## INFO [2021-12-14 13:48:45]   Number of rows before filtering: 87
## INFO [2021-12-14 13:48:45]   Number of rows after filtering: 21
## INFO [2021-12-14 13:48:45]  Filter network and retain only rows with peak_gene.r in the following interval: (0 - 1]
## INFO [2021-12-14 13:48:45]   Number of rows before filtering TFs: 21
## INFO [2021-12-14 13:48:45]   Number of rows after filtering TFs: 9
## INFO [2021-12-14 13:48:45]  Calculate FDR based on remaining rows, filter network and retain only rows with peak-gene connections with an FDR &lt; 0.3
## INFO [2021-12-14 13:48:45]   Number of rows before filtering genes (including NA): 9
## INFO [2021-12-14 13:48:45]   Number of rows before filtering genes (excluding NA): 9
## INFO [2021-12-14 13:48:45]   Number of rows after filtering genes (including NA): 4
## INFO [2021-12-14 13:48:45]   Number of rows after filtering genes (excluding NA): 4
## INFO [2021-12-14 13:48:45] Final number of rows left after all filtering steps: 4
## INFO [2021-12-14 13:48:45]  Finished successfully. Execution time: 1.1 secs</code></pre>
<p>The output shows the number of links before and after applying a particular filter that has been set for both real and permuted data. As expected and reassuringly, almost no connections remain for the permuted data, while the real data keeps around 2500 connections.</p>
882
883
884
885
886
887
<p>For more parameter details, see the R help (<code><a href="../reference/filterGRNAndConnectGenes.html">?filterGRNAndConnectGenes</a></code>).</p>
</div>
<div id="add-tf-gene-correlations-optional" class="section level2">
<h2 class="hasAnchor">
<a href="#add-tf-gene-correlations-optional" class="anchor"></a>Add TF-gene correlations (optional)</h2>
<p>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 <em>add_TF_gene_correlation</em> calculates the TF-gene correlation for each connection from the filtered set for which the TF is not missing.</p>
Christian Arnold's avatar
Christian Arnold committed
888
889
890
891
892
893
894
895
896
897
898
899
900
<div class="sourceCode" id="cb94"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/add_TF_gene_correlation.html">add_TF_gene_correlation</a></span><span class="op">(</span><span class="va">GRN</span>, corMethod <span class="op">=</span> <span class="st">"pearson"</span>, nCores <span class="op">=</span> <span class="fl">1</span>, forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
<pre><code>## INFO [2021-12-14 13:48:45] Calculate correlations for TF and genes from the filtered set of connections
## INFO [2021-12-14 13:48:45]  Real data
## INFO [2021-12-14 13:48:45]   Iterate through 3179 TF-gene combinations and (if possible) calculate correlations using 1 cores. This may take a few minutes.
## INFO [2021-12-14 13:48:47]  Finished execution using 1 cores. TOTAL RUNNING TIME: 2 secs
## 
## INFO [2021-12-14 13:48:47]   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-12-14 13:48:47]  Permuted data
## INFO [2021-12-14 13:48:47]   Iterate through 4 TF-gene combinations and (if possible) calculate correlations using 1 cores. This may take a few minutes.
## INFO [2021-12-14 13:48:48]  Finished execution using 1 cores. TOTAL RUNNING TIME: 1 secs
## 
## INFO [2021-12-14 13:48:48]   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.</code></pre>
901
902
903
904
905
906
<p>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 <em>allowMissingGenes = TRUE</em>, 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 <em>NA</em> rather than excluding the row altogether.</p>
<p>For more parameter details, see the R help (<code><a href="../reference/add_TF_gene_correlation.html">?add_TF_gene_correlation</a></code>).</p>
</div>
<div id="retrieve-filtered-connections" class="section level2">
<h2 class="hasAnchor">
<a href="#retrieve-filtered-connections" class="anchor"></a>Retrieve filtered connections</h2>
Christian Arnold's avatar
Christian Arnold committed
907
908
909
<p>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 <em>GRaNIE</em> object from a particular slot. Here, we specify <em>all.filtered</em>, as we want to retrieve all filtered connections. For more parameter details, see the R help (<code>getGRNConnections</code>). Note that the first time, we assign a different variable to the return of the function (i.e., <em>GRN_connections.all</em> and NOT <em>GRaNIE</em> as before). Importantly, we have to select a new variable as we would otherwise overwrite our <em>GRaNIE</em> object altogether! All <em>get</em> functions from the <em>GRaNIE</em> 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 (<code><a href="../reference/getGRNConnections.html">?getGRNConnections</a></code>).</p>
<div class="sourceCode" id="cb96"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN_connections.all</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/getGRNConnections.html">getGRNConnections</a></span><span class="op">(</span><span class="va">GRN</span>, type <span class="op">=</span> <span class="st">"all.filtered"</span>, include_TF_gene_correlations <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span>
910
911

<span class="va">GRN_connections.all</span></code></pre></div>
Christian Arnold's avatar
Christian Arnold committed
912
913
914
915
916
917
918
919
920
921
922
923
924
925
<pre><code>## # A tibble: 4,582 × 32
##    TF.name   TF.ENSEMBL     TF_peak.r_bin TF_peak.r TF_peak.fdr TF_peak.fdr_orig
##    &lt;chr&gt;     &lt;fct&gt;          &lt;fct&gt;             &lt;dbl&gt;       &lt;dbl&gt;            &lt;dbl&gt;
##  1 ARNT2.0.D ENSG000001723… (-0.5,-0.45]     -0.464       0.295            0.295
##  2 ARNT2.0.D ENSG000001723… (-0.45,-0.4]     -0.446       0.299            0.299
##  3 ARNT2.0.D ENSG000001723… (-0.45,-0.4]     -0.446       0.299            0.299
##  4 ARNT2.0.D ENSG000001723… (-0.45,-0.4]     -0.446       0.299            0.299
##  5 ARNT2.0.D ENSG000001723… (-0.3,-0.25]     -0.295       0.298            0.298
##  6 ARNT2.0.D ENSG000001723… (-0.3,-0.25]     -0.282       0.298            0.298
##  7 ARNT2.0.D ENSG000001723… (-0.3,-0.25]     -0.283       0.298            0.298
##  8 ARNT2.0.D ENSG000001723… (-0.4,-0.35]     -0.365       0.289            0.289
##  9 ARNT2.0.D ENSG000001723… (-0.3,-0.25]     -0.275       0.298            0.298
## 10 ARNT2.0.D ENSG000001723… (-0.55,-0.5]     -0.531       0.295            0.295
## # … with 4,572 more rows, and 26 more variables: TF_peak.fdr_direction &lt;fct&gt;,
926
## #   TF_peak.connectionType &lt;fct&gt;, peak.ID &lt;fct&gt;, peak.mean &lt;dbl&gt;,
Christian Arnold's avatar
Christian Arnold committed
927
928
929
930
931
932
## #   peak.median &lt;dbl&gt;, peak.CV &lt;dbl&gt;, peak.annotation &lt;fct&gt;,
## #   peak.GC.perc &lt;dbl&gt;, peak.width &lt;int&gt;, peak.GC.class &lt;ord&gt;,
## #   peak_gene.distance &lt;int&gt;, peak_gene.r &lt;dbl&gt;, peak_gene.p_raw &lt;dbl&gt;,
## #   peak_gene.p_adj &lt;dbl&gt;, gene.ENSEMBL &lt;fct&gt;, gene.mean &lt;dbl&gt;,
## #   gene.median &lt;dbl&gt;, gene.CV &lt;dbl&gt;, gene.chr &lt;fct&gt;, gene.start &lt;int&gt;, …</code></pre>
<p>The table contains a total of 28 columns, and the prefix of each column name indicates the part of the <em>eGRN</em> network that the column refers to (e.g., TFs, TF-peaks, peaks, peak-genes or genes, or TF-gene if <em>add_TF_gene_correlation</em> 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.</p>
933
</div>
Christian Arnold's avatar
Christian Arnold committed
934
<div id="visualize-the-filtered-egrn-connections" class="section level2">
935
<h2 class="hasAnchor">
Christian Arnold's avatar
Christian Arnold committed
936
937
<a href="#visualize-the-filtered-egrn-connections" class="anchor"></a>Visualize the filtered <em>eGRN</em> connections</h2>
<p>The <em>GRaNIE</em> package will soon also offer some rudimentary functions to visualize a filtered <em>eGRN</em> network. Stay tuned! Meanwhile, you can use the <em>igraph</em> package to construct a graph out of the filtered TF-peak-gene connection table (see above).</p>
938
939
940
941
942
</div>
<div id="generate-a-connection-summary" class="section level2">
<h2 class="hasAnchor">
<a href="#generate-a-connection-summary" class="anchor"></a>Generate a connection summary</h2>
<p>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 <em>filterGRNAndConnectGenes</em> 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 (<code><a href="../reference/generateStatsSummary.html">?generateStatsSummary</a></code> and <code>plot_stats_connectionSummary</code>).</p>
Christian Arnold's avatar
Christian Arnold committed
943
944
<div class="sourceCode" id="cb98"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/generateStatsSummary.html">generateStatsSummary</a></span><span class="op">(</span><span class="va">GRN</span>, TF_peak.fdr <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="fl">0.01</span>, <span class="fl">0.05</span>, <span class="fl">0.1</span>, <span class="fl">0.2</span><span class="op">)</span>, TF_peak.connectionTypes <span class="op">=</span> <span class="st">"all"</span>, 
945
946
947
    peak_gene.p_raw <span class="op">=</span> <span class="cn">NULL</span>, peak_gene.fdr <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="fl">0.01</span>, <span class="fl">0.05</span>, <span class="fl">0.1</span>, <span class="fl">0.2</span><span class="op">)</span>, peak_gene.r_range <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="fl">0</span>, 
        <span class="fl">1</span><span class="op">)</span>, allowMissingGenes <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="cn">FALSE</span>, <span class="cn">TRUE</span><span class="op">)</span>, allowMissingTFs <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="cn">FALSE</span><span class="op">)</span>, gene.types <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op">(</span><span class="st">"protein_coding"</span>, 
        <span class="st">"lincRNA"</span><span class="op">)</span><span class="op">)</span></code></pre></div>
Christian Arnold's avatar
Christian Arnold committed
948
949
<pre><code>## INFO [2021-12-14 13:48:49] Generating summary. This may take a while...
## INFO [2021-12-14 13:48:49] 
950
951
## Real data...
## 
Christian Arnold's avatar
Christian Arnold committed
952
953
954
955
956
## INFO [2021-12-14 13:48:49] Calculate network stats for TF-peak FDR of 0.01
## INFO [2021-12-14 13:48:54] Calculate network stats for TF-peak FDR of 0.05
## INFO [2021-12-14 13:49:00] Calculate network stats for TF-peak FDR of 0.1
## INFO [2021-12-14 13:49:06] Calculate network stats for TF-peak FDR of 0.2
## INFO [2021-12-14 13:49:13] 
957
958
## Permuted data...
## 
Christian Arnold's avatar
Christian Arnold committed
959
960
961
962
963
964
965
966
967
968
969
970
971
## INFO [2021-12-14 13:49:13] Calculate network stats for TF-peak FDR of 0.01
## INFO [2021-12-14 13:49:19] Calculate network stats for TF-peak FDR of 0.05
## INFO [2021-12-14 13:49:25] Calculate network stats for TF-peak FDR of 0.1
## INFO [2021-12-14 13:49:31] Calculate network stats for TF-peak FDR of 0.2</code></pre>
<div class="sourceCode" id="cb100"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/plot_stats_connectionSummary.html">plot_stats_connectionSummary</a></span><span class="op">(</span><span class="va">GRN</span>, type <span class="op">=</span> <span class="st">"heatmap"</span>, forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
<pre><code>## INFO [2021-12-14 13:49:37] Plotting connection summary to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/GRN.connectionSummary_heatmap.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:49:37] Finished writing plots to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/GRN.connectionSummary_heatmap.pdf
## INFO [2021-12-14 13:49:37]  Finished successfully. Execution time: 0.5 secs</code></pre>
<div class="sourceCode" id="cb103"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/plot_stats_connectionSummary.html">plot_stats_connectionSummary</a></span><span class="op">(</span><span class="va">GRN</span>, type <span class="op">=</span> <span class="st">"boxplot"</span>, forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
<pre><code>## INFO [2021-12-14 13:49:37] Plotting diagnostic plots for network connections to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/GRN.connectionSummary_boxplot.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:49:50]  Finished successfully. Execution time: 12.8 secs</code></pre>
972
973
<p>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.</p>
</div>
Christian Arnold's avatar
Christian Arnold committed
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<div id="enrichment-analyses" class="section level2">
<h2 class="hasAnchor">
<a href="#enrichment-analyses" class="anchor"></a>Enrichment analyses</h2>
<p>Lastly, our framework also supports various types of enrichment analyses that are fully integrated into the package. We offer these for the full network as well as per community. The latter can be calculated v For both the general and the community statistics and enrichment, the package can:</p>
<ul>
<li>calculate and plot general structure and connectivity statistics for a filtered <em>eGRN</em> (function <em>plotGeneralGraphStats</em>) and per community (functions <em>calculateCommunitiesStats</em> and <em>plotCommunitiesStats</em>) ,</li>
<li>ontology enrichment and visualization for genes for the full network (functions <em>calculateGeneralEnrichment</em> and <em>plotGeneralEnrichment</em>) as well as per community (functions <em>calculateCommunitiesEnrichment</em> and <em>plotCommunitiesEnrichment</em>)</li>
</ul>
<p>All functions can be called individually, adjusted flexibly and the data is stored in the <em>GRaNIE</em> object for ultimate flexibility. In the near future, we plan to expand this set of functionality to additional enrichment analyses such as other databases (specific diseases pathways etc), so stay tuned!</p>
<p>For user convenience, all aforementioned functions can be called at once via a designated wrapper function <em>performAllNetworkAnalyses</em>.</p>
<div class="sourceCode" id="cb106"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">GRN</span> <span class="op">=</span> <span class="fu">GRaNIE</span><span class="fu">::</span><span class="fu"><a href="../reference/performAllNetworkAnalyses.html">performAllNetworkAnalyses</a></span><span class="op">(</span><span class="va">GRN</span>, forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
<pre><code>## INFO [2021-12-14 13:49:50] Plotting general network statistics to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/GRN.overall_stats.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:49:54]  Finished successfully. Execution time: 3.7 secs
## INFO [2021-12-14 13:49:54] Calculating general enrichment statistics... This may take a while.
## INFO [2021-12-14 13:49:54]  Finished successfully. Execution time: 0.1 secs
## INFO [2021-12-14 13:49:54] Plotting general enrichment results to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/GRN.overall_enrichment.pdf
## INFO [2021-12-14 13:49:54]  Finished successfully. Execution time: 0 secs
## INFO [2021-12-14 13:49:54] Calculating communities for clustering type louvain...
## INFO [2021-12-14 13:49:54]  Finished successfully. Execution time: 0.1 secs
## INFO [2021-12-14 13:49:54] Plotting community statistics to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/GRN.community_stats.pdf</code></pre>
<pre><code>## INFO [2021-12-14 13:50:02]  Finished successfully. Execution time: 8.1 secs
## INFO [2021-12-14 13:50:02] Running enrichment analysis for all communities. This may take a while...
## INFO [2021-12-14 13:50:02]  Community 4
## INFO [2021-12-14 13:50:02]  Community 2
## INFO [2021-12-14 13:50:03]  Community 3
## INFO [2021-12-14 13:50:03]  Community 1
For faster browsing, not all history is shown. View entire blame