workflow.html 162 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
<!-- 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">
28
29
    

30
31
32
33
34
35
36
37
38
39
40
    <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
41
        <a class="navbar-link" href="../index.html">GRaNIE</a>
42
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">0.14.3</span>
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
87
88
      </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 -->

      

89
      </header><div class="row">
90
91
92
  <div class="col-md-9 contents">
    <div class="page-header toc-ignore">
      <h1 data-toc-skip>Workflow example</h1>
93
                        <h4 data-toc-skip class="author">Christian Arnold, Judith Zaugg, Rim Moussa</h4>
94
            
95
            <h4 data-toc-skip class="date">15 December 2021</h4>
96
97
98
99
100
101
102
103
104
      
      
      <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
105
      <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>
106
107
    </div>
    
108
109
110
<div class="section level1">
<h1 id="example-workflow">Example Workflow<a class="anchor" aria-label="anchor" href="#example-workflow"></a>
</h1>
111
<p><a name="section1"></a></p>
Christian Arnold's avatar
Christian Arnold committed
112
113
<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>
114
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
115
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://tidyverse.tidyverse.org" class="external-link">tidyverse</a></span><span class="op">)</span></code></pre></div>
116
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
117
118
119
120
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
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">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" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://grp-zaugg.embl-community.io/GRaNIE" class="external-link">GRaNIE</a></span><span class="op">)</span></code></pre></div>
<pre><code><span class="co">## Loading required package: topGO</span></code></pre>
<pre><code><span class="co">## Loading required package: BiocGenerics</span></code></pre>
<pre><code><span class="co">## Loading required package: parallel</span></code></pre>
<pre><code><span class="co">## </span>
<span class="co">## Attaching package: 'BiocGenerics'</span></code></pre>
<pre><code><span class="co">## The following objects are masked from 'package:parallel':</span>
<span class="co">## </span>
<span class="co">##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,</span>
<span class="co">##     clusterExport, clusterMap, parApply, parCapply, parLapply,</span>
<span class="co">##     parLapplyLB, parRapply, parSapply, parSapplyLB</span></code></pre>
<pre><code><span class="co">## The following objects are masked from 'package:dplyr':</span>
<span class="co">## </span>
<span class="co">##     combine, intersect, setdiff, union</span></code></pre>
<pre><code><span class="co">## The following objects are masked from 'package:stats':</span>
<span class="co">## </span>
<span class="co">##     IQR, mad, sd, var, xtabs</span></code></pre>
<pre><code><span class="co">## The following objects are masked from 'package:base':</span>
<span class="co">## </span>
<span class="co">##     anyDuplicated, append, as.data.frame, basename, cbind, colnames,</span>
<span class="co">##     dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,</span>
<span class="co">##     grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,</span>
<span class="co">##     order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,</span>
<span class="co">##     rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,</span>
<span class="co">##     union, unique, unsplit, which, which.max, which.min</span></code></pre>
<pre><code><span class="co">## Loading required package: graph</span></code></pre>
<pre><code><span class="co">## </span>
<span class="co">## Attaching package: 'graph'</span></code></pre>
<pre><code><span class="co">## The following object is masked from 'package:stringr':</span>
<span class="co">## </span>
<span class="co">##     boundary</span></code></pre>
<pre><code><span class="co">## Loading required package: Biobase</span></code></pre>
<pre><code><span class="co">## Welcome to Bioconductor</span>
<span class="co">## </span>
<span class="co">##     Vignettes contain introductory material; view with</span>
<span class="co">##     'browseVignettes()'. To cite Bioconductor, see</span>
<span class="co">##     'citation("Biobase")', and for packages 'citation("pkgname")'.</span></code></pre>
<pre><code><span class="co">## Loading required package: GO.db</span></code></pre>
<pre><code><span class="co">## Loading required package: AnnotationDbi</span></code></pre>
<pre><code><span class="co">## Loading required package: stats4</span></code></pre>
<pre><code><span class="co">## Loading required package: IRanges</span></code></pre>
<pre><code><span class="co">## Loading required package: S4Vectors</span></code></pre>
<pre><code><span class="co">## </span>
<span class="co">## Attaching package: 'S4Vectors'</span></code></pre>
<pre><code><span class="co">## The following objects are masked from 'package:dplyr':</span>
<span class="co">## </span>
<span class="co">##     first, rename</span></code></pre>
<pre><code><span class="co">## The following object is masked from 'package:tidyr':</span>
<span class="co">## </span>
<span class="co">##     expand</span></code></pre>
<pre><code><span class="co">## The following object is masked from 'package:base':</span>
<span class="co">## </span>
<span class="co">##     expand.grid</span></code></pre>
<pre><code><span class="co">## </span>
<span class="co">## Attaching package: 'IRanges'</span></code></pre>
<pre><code><span class="co">## The following objects are masked from 'package:dplyr':</span>
<span class="co">## </span>
<span class="co">##     collapse, desc, slice</span></code></pre>
<pre><code><span class="co">## The following object is masked from 'package:purrr':</span>
<span class="co">## </span>
<span class="co">##     reduce</span></code></pre>
<pre><code><span class="co">## </span>
<span class="co">## Attaching package: 'AnnotationDbi'</span></code></pre>
<pre><code><span class="co">## The following object is masked from 'package:dplyr':</span>
<span class="co">## </span>
<span class="co">##     select</span></code></pre>
<pre><code><span class="co">## </span></code></pre>
<pre><code><span class="co">## Loading required package: SparseM</span></code></pre>
<pre><code><span class="co">## </span>
<span class="co">## Attaching package: 'SparseM'</span></code></pre>
<pre><code><span class="co">## The following object is masked from 'package:base':</span>
<span class="co">## </span>
<span class="co">##     backsolve</span></code></pre>
<pre><code><span class="co">## </span>
<span class="co">## groupGOTerms:    GOBPTerm, GOMFTerm, GOCCTerm environments built.</span></code></pre>
<pre><code><span class="co">## </span>
<span class="co">## Attaching package: 'topGO'</span></code></pre>
<pre><code><span class="co">## The following object is masked from 'package:IRanges':</span>
<span class="co">## </span>
<span class="co">##     members</span></code></pre>
<pre><code><span class="co">## Loading required package: magrittr</span></code></pre>
<pre><code><span class="co">## </span>
<span class="co">## Attaching package: 'magrittr'</span></code></pre>
<pre><code><span class="co">## The following object is masked from 'package:purrr':</span>
<span class="co">## </span>
<span class="co">##     set_names</span></code></pre>
<pre><code><span class="co">## The following object is masked from 'package:tidyr':</span>
<span class="co">## </span>
<span class="co">##     extract</span></code></pre>
<pre><code><span class="co">## Warning: replacing previous import 'grid::depth' by 'topGO::depth' when loading</span>
<span class="co">## 'GRaNIE'</span></code></pre>
<pre><code><span class="co">## Warning: replacing previous import 'IRanges::members' by 'topGO::members' when</span>
<span class="co">## loading 'GRaNIE'</span></code></pre>
<pre><code><span class="co">## Warning: replacing previous import 'IRanges::stack' by 'utils::stack' when</span>
<span class="co">## loading 'GRaNIE'</span></code></pre>
<pre><code><span class="co">## Warning: replacing previous import 'IRanges::relist' by 'utils::relist' when</span>
<span class="co">## loading 'GRaNIE'</span></code></pre>
<pre><code><span class="co">## </span>
216
<span class="co">## Welcome to the GRaNIE package and thank you for using our software. This is GRaNIE version 0.14.3.</span>
217
218
219
220
221
<span class="co">## All project-related information, guidance, help, documentation and ways to contact us can be found here: https://grp-zaugg.embl-community.io/GRaNIE</span>
<span class="co">## You may also check the R help</span></code></pre>
<div class="section level2">
<h2 id="general-notes">General notes<a class="anchor" aria-label="anchor" href="#general-notes"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
222
<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>
223
</div>
224
225
226
<div class="section level2">
<h2 id="reading-the-data-required-for-the-granie-package">Reading the data required for the <em>GRaNIE</em> package<a class="anchor" aria-label="anchor" href="#reading-the-data-required-for-the-granie-package"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
227
<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>
228
229
230
231
232
233
234
235
236
237
238
<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
239
<div class="sourceCode" id="cb46"><pre class="downlit sourceCode r">
240
<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" class="external-link">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" class="external-link">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>, 
Christian Arnold's avatar
Christian Arnold committed
241
    full.names <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span><span class="op">)</span></code></pre></div>
242
243
244
245
<pre><code><span class="co">## [1] "/g/scb/zaugg/carnold/R_library/4.0.0-foss-2020a/GRaNIEData/extdata/countsATAC.75k.tsv.gz"   </span>
<span class="co">## [2] "/g/scb/zaugg/carnold/R_library/4.0.0-foss-2020a/GRaNIEData/extdata/countsRNA.sampled.tsv.gz"</span>
<span class="co">## [3] "/g/scb/zaugg/carnold/R_library/4.0.0-foss-2020a/GRaNIEData/extdata/metadata.sampled.tsv"    </span>
<span class="co">## [4] "/g/scb/zaugg/carnold/R_library/4.0.0-foss-2020a/GRaNIEData/extdata/TFBS_selected"</span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
246
<div class="sourceCode" id="cb48"><pre class="downlit sourceCode r">
247
248
249
250
<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" class="external-link">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" class="external-link">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" class="external-link">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" class="external-link">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>
251

252
253
254
<span class="va">countsRNA.df</span> <span class="op">=</span> <span class="fu"><a href="https://readr.tidyverse.org/reference/read_delim.html" class="external-link">read_tsv</a></span><span class="op">(</span><span class="va">file_RNA</span>, col_types <span class="op">=</span> <span class="fu"><a href="https://readr.tidyverse.org/reference/cols.html" class="external-link">cols</a></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"><a href="https://readr.tidyverse.org/reference/read_delim.html" class="external-link">read_tsv</a></span><span class="op">(</span><span class="va">file_peaks</span>, col_types <span class="op">=</span> <span class="fu"><a href="https://readr.tidyverse.org/reference/cols.html" class="external-link">cols</a></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"><a href="https://readr.tidyverse.org/reference/read_delim.html" class="external-link">read_tsv</a></span><span class="op">(</span><span class="va">file_sampleMetadata</span>, col_types <span class="op">=</span> <span class="fu"><a href="https://readr.tidyverse.org/reference/cols.html" class="external-link">cols</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span>
255
256
257

<span class="co"># Let's check how the data looks like</span>
<span class="va">countsRNA.df</span></code></pre></div>
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<pre><code><span class="co">## <span style="color: #949494;"># A tibble: 35,033 x 30</span></span>
<span class="co">##    ENSEMBL babk_D bima_D cicb_D coyi_D diku_D eipl_D eiwy_D eofe_D fafq_D febc_D</span>
<span class="co">##    <span style="color: #949494;font-style: italic;">&lt;chr&gt;</span><span>    </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 1</span><span> ENSG00…  </span><span style="text-decoration: underline;">48</span><span>933  </span><span style="text-decoration: underline;">48</span><span>737  </span><span style="text-decoration: underline;">60</span><span>581  </span><span style="text-decoration: underline;">93</span><span>101  </span><span style="text-decoration: underline;">84</span><span>980  </span><span style="text-decoration: underline;">91</span><span>536  </span><span style="text-decoration: underline;">85</span><span>728  </span><span style="text-decoration: underline;">35</span><span>483  </span><span style="text-decoration: underline;">69</span><span>674  </span><span style="text-decoration: underline;">58</span><span>890</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 2</span><span> ENSG00…  </span><span style="text-decoration: underline;">49</span><span>916  </span><span style="text-decoration: underline;">44</span><span>086  </span><span style="text-decoration: underline;">50</span><span>706  </span><span style="text-decoration: underline;">55</span><span>893  </span><span style="text-decoration: underline;">57</span><span>239  </span><span style="text-decoration: underline;">76</span><span>418  </span><span style="text-decoration: underline;">75</span><span>934  </span><span style="text-decoration: underline;">27</span><span>926  </span><span style="text-decoration: underline;">57</span><span>526  </span><span style="text-decoration: underline;">50</span><span>491</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 3</span><span> ENSG00… </span><span style="text-decoration: underline;">281</span><span>733 </span><span style="text-decoration: underline;">211</span><span>703 </span><span style="text-decoration: underline;">269</span><span>460 </span><span style="text-decoration: underline;">239</span><span>116 </span><span style="text-decoration: underline;">284</span><span>509 </span><span style="text-decoration: underline;">389</span><span>989 </span><span style="text-decoration: underline;">351</span><span>867 </span><span style="text-decoration: underline;">164</span><span>615 </span><span style="text-decoration: underline;">257</span><span>471 </span><span style="text-decoration: underline;">304</span><span>203</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 4</span><span> ENSG00…  </span><span style="text-decoration: underline;">98</span><span>943  </span><span style="text-decoration: underline;">77</span><span>503  </span><span style="text-decoration: underline;">92</span><span>402  </span><span style="text-decoration: underline;">80</span><span>927  </span><span style="text-decoration: underline;">96</span><span>690 </span><span style="text-decoration: underline;">138</span><span>149 </span><span style="text-decoration: underline;">115</span><span>875  </span><span style="text-decoration: underline;">64</span><span>368  </span><span style="text-decoration: underline;">91</span><span>627 </span><span style="text-decoration: underline;">100</span><span>039</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 5</span><span> ENSG00…  </span><span style="text-decoration: underline;">14</span><span>749  </span><span style="text-decoration: underline;">15</span><span>571  </span><span style="text-decoration: underline;">16</span><span>540  </span><span style="text-decoration: underline;">16</span><span>383  </span><span style="text-decoration: underline;">16</span><span>886  </span><span style="text-decoration: underline;">21</span><span>892  </span><span style="text-decoration: underline;">18</span><span>045  </span><span style="text-decoration: underline;">10</span><span>026  </span><span style="text-decoration: underline;">14</span><span>663  </span><span style="text-decoration: underline;">15</span><span>830</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 6</span><span> ENSG00…  </span><span style="text-decoration: underline;">64</span><span>459  </span><span style="text-decoration: underline;">63</span><span>734  </span><span style="text-decoration: underline;">71</span><span>317  </span><span style="text-decoration: underline;">69</span><span>612  </span><span style="text-decoration: underline;">72</span><span>097 </span><span style="text-decoration: underline;">100</span><span>487  </span><span style="text-decoration: underline;">78</span><span>536  </span><span style="text-decoration: underline;">38</span><span>572  </span><span style="text-decoration: underline;">65</span><span>446  </span><span style="text-decoration: underline;">76</span><span>910</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 7</span><span> ENSG00…  </span><span style="text-decoration: underline;">57</span><span>449  </span><span style="text-decoration: underline;">55</span><span>736  </span><span style="text-decoration: underline;">70</span><span>798  </span><span style="text-decoration: underline;">66</span><span>334  </span><span style="text-decoration: underline;">66</span><span>424  </span><span style="text-decoration: underline;">91</span><span>801  </span><span style="text-decoration: underline;">94</span><span>729  </span><span style="text-decoration: underline;">40</span><span>413  </span><span style="text-decoration: underline;">56</span><span>916  </span><span style="text-decoration: underline;">66</span><span>382</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 8</span><span> ENSG00…  </span><span style="text-decoration: underline;">15</span><span>451  </span><span style="text-decoration: underline;">15</span><span>570  </span><span style="text-decoration: underline;">15</span><span>534  </span><span style="text-decoration: underline;">15</span><span>945  </span><span style="text-decoration: underline;">10</span><span>583  </span><span style="text-decoration: underline;">22</span><span>601  </span><span style="text-decoration: underline;">16</span><span>086   </span><span style="text-decoration: underline;">9</span><span>275  </span><span style="text-decoration: underline;">16</span><span>092  </span><span style="text-decoration: underline;">15</span><span>291</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 9</span><span> ENSG00…  </span><span style="text-decoration: underline;">18</span><span>717  </span><span style="text-decoration: underline;">18</span><span>757  </span><span style="text-decoration: underline;">20</span><span>051  </span><span style="text-decoration: underline;">18</span><span>066  </span><span style="text-decoration: underline;">19</span><span>648  </span><span style="text-decoration: underline;">28</span><span>572  </span><span style="text-decoration: underline;">25</span><span>240  </span><span style="text-decoration: underline;">11</span><span>258  </span><span style="text-decoration: underline;">17</span><span>739  </span><span style="text-decoration: underline;">20</span><span>347</span></span>
<span class="co">## <span style="color: #BCBCBC;">10</span><span> ENSG00… </span><span style="text-decoration: underline;">168</span><span>054 </span><span style="text-decoration: underline;">147</span><span>822 </span><span style="text-decoration: underline;">178</span><span>164 </span><span style="text-decoration: underline;">154</span><span>220 </span><span style="text-decoration: underline;">168</span><span>837 </span><span style="text-decoration: underline;">244</span><span>731 </span><span style="text-decoration: underline;">215</span><span>862  </span><span style="text-decoration: underline;">89</span><span>368 </span><span style="text-decoration: underline;">158</span><span>845 </span><span style="text-decoration: underline;">180</span><span>734</span></span>
<span class="co">## <span style="color: #949494;"># … with 35,023 more rows, and 19 more variables: fikt_D &lt;dbl&gt;, guss_D &lt;dbl&gt;,</span></span>
<span class="co">## <span style="color: #949494;">#   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;,</span></span>
<span class="co">## <span style="color: #949494;">#   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;,</span></span>
<span class="co">## <span style="color: #949494;">#   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;,</span></span>
<span class="co">## <span style="color: #949494;">#   xugn_D &lt;dbl&gt;, zaui_D &lt;dbl&gt;</span></span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
276
<div class="sourceCode" id="cb50"><pre class="downlit sourceCode r">
277
<code class="sourceCode R"><span class="va">countsPeaks.df</span></code></pre></div>
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<pre><code><span class="co">## <span style="color: #949494;"># A tibble: 75,000 x 32</span></span>
<span class="co">##    peakID  babk_D bima_D cicb_D coyi_D diku_D eipl_D eiwy_D eofe_D fafq_D febc_D</span>
<span class="co">##    <span style="color: #949494;font-style: italic;">&lt;chr&gt;</span><span>    </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>  </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 1</span><span> chr14:…      2      5      5      3      1      4      1      5      0     13</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 2</span><span> chrX:1…      3      7     10      5      4      6      3     18      4     22</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 3</span><span> chr15:…      5     28     38     11     20     19      7     53      5     22</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 4</span><span> chr10:…      0     12      7      2      5      8      0     11      1     11</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 5</span><span> chr12:…      5     14     18      5      3     13      5     15      2     25</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 6</span><span> chr1:1…     12     21     36      6     20     29     12     44      2    105</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 7</span><span> chr16:…      3     17     16      9      8     16      6     28      3     33</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 8</span><span> chr17:…      4     11      6      3      0      3      2      9      1     14</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 9</span><span> chr13:…     10     34     44     12     31     29      9     22      5     82</span></span>
<span class="co">## <span style="color: #BCBCBC;">10</span><span> chr1:2…     21    113     46     28     44     57     47    146     12     91</span></span>
<span class="co">## <span style="color: #949494;"># … with 74,990 more rows, and 21 more variables: fikt_D &lt;dbl&gt;, guss_D &lt;dbl&gt;,</span></span>
<span class="co">## <span style="color: #949494;">#   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;,</span></span>
<span class="co">## <span style="color: #949494;">#   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;,</span></span>
<span class="co">## <span style="color: #949494;">#   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;,</span></span>
<span class="co">## <span style="color: #949494;">#   xugn_D &lt;dbl&gt;, zaui_D &lt;dbl&gt;, uaqe_D &lt;dbl&gt;, qaqx_D &lt;dbl&gt;</span></span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
296
<div class="sourceCode" id="cb52"><pre class="downlit sourceCode r">
297
<code class="sourceCode R"><span class="va">sampleMetadata.df</span></code></pre></div>
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<pre><code><span class="co">## <span style="color: #949494;"># A tibble: 31 x 16</span></span>
<span class="co">##    sample_id assigned assigned_frac atac_date  clone condition  diff_start donor</span>
<span class="co">##    <span style="color: #949494;font-style: italic;">&lt;chr&gt;</span><span>        </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>         </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span> </span><span style="color: #949494;font-style: italic;">&lt;date&gt;</span><span>     </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span> </span><span style="color: #949494;font-style: italic;">&lt;chr&gt;</span><span>      </span><span style="color: #949494;font-style: italic;">&lt;date&gt;</span><span>     </span><span style="color: #949494;font-style: italic;">&lt;chr&gt;</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 1</span><span> babk_D     5</span><span style="text-decoration: underline;">507</span><span>093         0.211 2015-12-04     2 IFNg_SL13… 2015-10-12 babk </span></span>
<span class="co">## <span style="color: #BCBCBC;"> 2</span><span> bima_D    23</span><span style="text-decoration: underline;">275</span><span>756         0.677 2014-12-12     1 IFNg_SL13… 2014-11-07 bima </span></span>
<span class="co">## <span style="color: #BCBCBC;"> 3</span><span> cicb_D    19</span><span style="text-decoration: underline;">751</span><span>751         0.580 2015-04-24     3 IFNg_SL13… 2015-03-30 cicb </span></span>
<span class="co">## <span style="color: #BCBCBC;"> 4</span><span> coyi_D     6</span><span style="text-decoration: underline;">733</span><span>642         0.312 2015-11-05     3 IFNg_SL13… 2015-09-30 coyi </span></span>
<span class="co">## <span style="color: #BCBCBC;"> 5</span><span> diku_D     7</span><span style="text-decoration: underline;">010</span><span>213         0.195 2015-11-13     1 IFNg_SL13… 2015-10-15 diku </span></span>
<span class="co">## <span style="color: #BCBCBC;"> 6</span><span> eipl_D    16</span><span style="text-decoration: underline;">923</span><span>025         0.520 2015-08-04     1 IFNg_SL13… 2015-06-30 eipl </span></span>
<span class="co">## <span style="color: #BCBCBC;"> 7</span><span> eiwy_D     9</span><span style="text-decoration: underline;">807</span><span>860         0.404 2015-12-02     1 IFNg_SL13… 2015-10-23 eiwy </span></span>
<span class="co">## <span style="color: #BCBCBC;"> 8</span><span> eofe_D    25</span><span style="text-decoration: underline;">687</span><span>477         0.646 2014-12-12     1 IFNg_SL13… 2014-11-01 eofe </span></span>
<span class="co">## <span style="color: #BCBCBC;"> 9</span><span> fafq_D     4</span><span style="text-decoration: underline;">600</span><span>004         0.415 2015-10-14     1 IFNg_SL13… 2015-09-16 fafq </span></span>
<span class="co">## <span style="color: #BCBCBC;">10</span><span> febc_D    31</span><span style="text-decoration: underline;">712</span><span>153         0.430 2015-08-04     2 IFNg_SL13… 2015-07-06 febc </span></span>
<span class="co">## <span style="color: #949494;"># … with 21 more rows, and 8 more variables: EB_formation &lt;date&gt;,</span></span>
<span class="co">## <span style="color: #949494;">#   macrophage_diff_days &lt;dbl&gt;, medium_changes &lt;dbl&gt;, mt_frac &lt;dbl&gt;,</span></span>
<span class="co">## <span style="color: #949494;">#   percent_duplication &lt;dbl&gt;, received_as &lt;chr&gt;, sex &lt;chr&gt;,</span></span>
<span class="co">## <span style="color: #949494;">#   short_long_ratio &lt;dbl&gt;</span></span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
315
<div class="sourceCode" id="cb54"><pre class="downlit sourceCode r">
316
317
<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
318
319
320
321
322
323
<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>
324
325
<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
326
<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>
327
</div>
328
329
330
<div class="section level2">
<h2 id="initialize-a-granie-object">Initialize a <em>GRaNIE</em> object<a class="anchor" aria-label="anchor" href="#initialize-a-granie-object"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
331
332
<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">
333
334
335
336
337
338
339
<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
340
<span class="co"># the GRaNIE object</span>
341
<span class="va">objectMetadata.l</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>name <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/paste.html" class="external-link">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>, 
342
343
344
345
    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
346
<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>, 
347
    genomeAssembly <span class="op">=</span> <span class="va">genomeAssembly</span><span class="op">)</span></code></pre></div>
348
<pre><code><span class="co">## INFO [2021-12-15 12:59:50] Empty GRN object created successfully. Type the object name (e.g., GRN) to retrieve summary information about it at any time.</span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
349
<div class="sourceCode" id="cb57"><pre class="downlit sourceCode r">
350
<code class="sourceCode R"><span class="va">GRN</span></code></pre></div>
351
<pre><code><span class="co">## Object of class: GRaNIE  ( version 0.14.3 )</span>
352
353
354
355
356
357
358
359
360
361
362
363
<span class="co">## Data summary:</span>
<span class="co">##  Number of peaks: No peak data found.</span>
<span class="co">##  Number of genes: No RNA-seq data found.</span>
<span class="co">## Parameters:</span>
<span class="co">## Provided metadata:</span>
<span class="co">##   name :  Macrophages_infected_primed </span>
<span class="co">##   file_peaks :  /g/scb/zaugg/carnold/R_library/4.0.0-foss-2020a/GRaNIEData/extdata/countsATAC.75k.tsv.gz </span>
<span class="co">##   file_rna :  /g/scb/zaugg/carnold/R_library/4.0.0-foss-2020a/GRaNIEData/extdata/countsRNA.sampled.tsv.gz </span>
<span class="co">##   file_sampleMetadata :  /g/scb/zaugg/carnold/R_library/4.0.0-foss-2020a/GRaNIEData/extdata/metadata.sampled.tsv </span>
<span class="co">##   genomeAssembly :  hg38 </span>
<span class="co">## Connections:</span>
<span class="co">##  Number of genes (filtered, all):  NA ,  NA</span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
364
<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>
365
<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
366
<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>
367
</div>
368
369
370
<div class="section level2">
<h2 id="add-data">Add data<a class="anchor" aria-label="anchor" href="#add-data"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
371
<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>
372
<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
373
374
<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>, 
375
376
    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>
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
405
<pre><code><span class="co">## INFO [2021-12-15 12:59:52] Normalize counts. Method: DESeq_sizeFactor, ID column: peakID</span>
<span class="co">## INFO [2021-12-15 13:00:01]  Finished successfully. Execution time: 10.4 secs</span>
<span class="co">## INFO [2021-12-15 13:00:01] Normalize counts. Method: quantile, ID column: ENSEMBL</span>
<span class="co">## INFO [2021-12-15 13:00:03]  Finished successfully. Execution time: 1.1 secs</span>
<span class="co">## INFO [2021-12-15 13:00:03] Subset RNA and peaks and keep only shared samples</span>
<span class="co">## INFO [2021-12-15 13:00:03]  Number of samples for RNA before filtering: 29</span>
<span class="co">## INFO [2021-12-15 13:00:03]  Number of samples for peaks before filtering: 31</span>
<span class="co">## INFO [2021-12-15 13:00:03]  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</span>
<span class="co">## WARN [2021-12-15 13:00:03] The following samples from the peaks will be ignored for the classification due to missing overlap with RNA-Seq: uaqe_D,qaqx_D</span>
<span class="co">## INFO [2021-12-15 13:00:03]  Number of samples for RNA after filtering: 29</span>
<span class="co">## INFO [2021-12-15 13:00:03]  Number of samples for peaks data after filtering: 29</span>
<span class="co">## INFO [2021-12-15 13:00:03]  Finished successfully. Execution time: 0.1 secs</span>
<span class="co">## INFO [2021-12-15 13:00:03] Produce 1 permutations of RNA-counts</span>
<span class="co">## INFO [2021-12-15 13:00:03] Shuffling columns 1 times</span>
<span class="co">## INFO [2021-12-15 13:00:03]  Finished successfully. Execution time: 0 secs</span>
<span class="co">## INFO [2021-12-15 13:00:03] Parsing provided metadata...</span>
<span class="co">## INFO [2021-12-15 13:00:10] Check for overlapping peaks...</span>
<span class="co">## INFO [2021-12-15 13:00:16]  Calculate statistics for each peak (mean and CV)</span>
<span class="co">## INFO [2021-12-15 13:00:17]  Retrieve peak annotation using ChipSeeker. This may take a while</span>
<span class="co">## &gt;&gt; preparing features information...      2021-12-15 01:00:19 PM </span>
<span class="co">## &gt;&gt; identifying nearest features...        2021-12-15 01:00:22 PM </span>
<span class="co">## &gt;&gt; calculating distance from peak to TSS...   2021-12-15 01:00:24 PM </span>
<span class="co">## &gt;&gt; assigning genomic annotation...        2021-12-15 01:00:24 PM </span>
<span class="co">## &gt;&gt; adding gene annotation...          2021-12-15 01:01:01 PM </span>
<span class="co">## &gt;&gt; assigning chromosome lengths           2021-12-15 01:01:01 PM </span>
<span class="co">## &gt;&gt; done...                    2021-12-15 01:01:01 PM </span>
<span class="co">## INFO [2021-12-15 13:01:02] Calculate GC-content for peaks... </span>
<span class="co">## INFO [2021-12-15 13:01:06]  Finished successfully. Execution time: 3.8 secs</span>
<span class="co">## INFO [2021-12-15 13:01:06]  Calculate statistics for each gene (mean and CV)</span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
406
<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>
407
</div>
408
409
410
<div class="section level2">
<h2 id="quality-control-1-pca-plots">Quality control 1: PCA plots<a class="anchor" aria-label="anchor" href="#quality-control-1-pca-plots"></a>
</h2>
411
<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>
412
<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
413
<div class="sourceCode" id="cb61"><pre class="downlit sourceCode r">
414
<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" class="external-link">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>
415
<pre><code><span class="co">## INFO [2021-12-15 13:01:07] </span>
416
<span class="co">## 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</span>
417
418
419
420
<span class="co">## INFO [2021-12-15 13:01:09] Prepare PCA. Count transformation: vst</span>
<span class="co">## INFO [2021-12-15 13:01:09]  Writing to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/PCA_sharedSamples_RNA.raw.pdf</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:01:13] Performing and summarizing PCs across metadata for top 500 features</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:01:16] </span>
421
<span class="co">## 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</span>
422
423
424
425
426
427
428
429
430
431
432
<span class="co">## INFO [2021-12-15 13:01:16] Prepare PCA. Count transformation: none</span>
<span class="co">## INFO [2021-12-15 13:01:16]  Writing to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/PCA_sharedSamples_RNA.normalized.pdf</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:01:18] Performing and summarizing PCs across metadata for top 500 features</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:01:21] 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</span>
<span class="co">## INFO [2021-12-15 13:01:25] Prepare PCA. Count transformation: vst</span>
<span class="co">## INFO [2021-12-15 13:01:25]  Writing to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/PCA_sharedSamples_peaks.raw.pdf</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:01:27] Performing and summarizing PCs across metadata for top 500 features</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:01:31] 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</span>
<span class="co">## INFO [2021-12-15 13:01:31] Prepare PCA. Count transformation: none</span>
<span class="co">## INFO [2021-12-15 13:01:31]  Writing to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/PCA_sharedSamples_peaks.normalized.pdf</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:01:34] Performing and summarizing PCs across metadata for top 500 features</span></code></pre>
433
<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>
434
</div>
435
436
437
438
<div class="section level2">
<h2 id="add-tfs-and-tfbs-and-overlap-with-peaks">Add TFs and TFBS and overlap with peaks<a class="anchor" aria-label="anchor" href="#add-tfs-and-tfbs-and-overlap-with-peaks"></a>
</h2>
<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>
439
<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
440
<div class="sourceCode" id="cb70"><pre class="downlit sourceCode r">
441
442
443
444
445
446
447
448
449
<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
450
<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>, 
451
    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>
452
453
454
455
456
457
<pre><code><span class="co">## INFO [2021-12-15 13:01:38] Checking database folder for matching files: /g/scb/zaugg/carnold/R_library/4.0.0-foss-2020a/GRaNIEData/extdata/TFBS_selected</span>
<span class="co">## INFO [2021-12-15 13:01:38] 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</span>
<span class="co">## INFO [2021-12-15 13:01:38] Use all TF from the database folder /g/scb/zaugg/carnold/R_library/4.0.0-foss-2020a/GRaNIEData/extdata/TFBS_selected</span>
<span class="co">## INFO [2021-12-15 13:01:38] Reading file /g/scb/zaugg/carnold/R_library/4.0.0-foss-2020a/GRaNIEData/extdata/TFBS_selected/translationTable.csv</span>
<span class="co">## INFO [2021-12-15 13:01:38]  Finished successfully. Execution time: 0.1 secs</span>
<span class="co">## INFO [2021-12-15 13:01:38] Running the pipeline for 75 TF in total.</span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
458
459
<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>
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
536
<pre><code><span class="co">## INFO [2021-12-15 13:01:38] Overlap peaks and TFBS using 1 cores. This may take a few minutes...</span>
<span class="co">## INFO [2021-12-15 13:01:41]  Calculating intersection for TF AIRE.0.C finished. Number of overlapping TFBS after filtering: 299</span>
<span class="co">## INFO [2021-12-15 13:01:43]  Calculating intersection for TF ANDR.0.A finished. Number of overlapping TFBS after filtering: 1205</span>
<span class="co">## INFO [2021-12-15 13:01:44]  Calculating intersection for TF ANDR.1.A finished. Number of overlapping TFBS after filtering: 1012</span>
<span class="co">## INFO [2021-12-15 13:01:46]  Calculating intersection for TF ANDR.2.A finished. Number of overlapping TFBS after filtering: 1392</span>
<span class="co">## INFO [2021-12-15 13:01:49]  Calculating intersection for TF ARI3A.0.D finished. Number of overlapping TFBS after filtering: 406</span>
<span class="co">## INFO [2021-12-15 13:01:50]  Calculating intersection for TF ARNT2.0.D finished. Number of overlapping TFBS after filtering: 1921</span>
<span class="co">## INFO [2021-12-15 13:01:53]  Calculating intersection for TF ASCL1.0.A finished. Number of overlapping TFBS after filtering: 3482</span>
<span class="co">## INFO [2021-12-15 13:01:54]  Calculating intersection for TF ASCL2.0.D finished. Number of overlapping TFBS after filtering: 2709</span>
<span class="co">## INFO [2021-12-15 13:01:55]  Calculating intersection for TF ATF2.1.B finished. Number of overlapping TFBS after filtering: 919</span>
<span class="co">## INFO [2021-12-15 13:01:58]  Calculating intersection for TF ATOH1.0.B finished. Number of overlapping TFBS after filtering: 2053</span>
<span class="co">## INFO [2021-12-15 13:01:59]  Calculating intersection for TF BACH1.0.A finished. Number of overlapping TFBS after filtering: 2791</span>
<span class="co">## INFO [2021-12-15 13:02:00]  Calculating intersection for TF BATF3.0.B finished. Number of overlapping TFBS after filtering: 1096</span>
<span class="co">## INFO [2021-12-15 13:02:04]  Calculating intersection for TF BC11A.0.A finished. Number of overlapping TFBS after filtering: 10571</span>
<span class="co">## INFO [2021-12-15 13:02:05]  Calculating intersection for TF BCL6.0.A finished. Number of overlapping TFBS after filtering: 1211</span>
<span class="co">## INFO [2021-12-15 13:02:07]  Calculating intersection for TF BHA15.0.B finished. Number of overlapping TFBS after filtering: 3430</span>
<span class="co">## INFO [2021-12-15 13:02:08]  Calculating intersection for TF BHE41.0.D finished. Number of overlapping TFBS after filtering: 1651</span>
<span class="co">## INFO [2021-12-15 13:02:10]  Calculating intersection for TF BPTF.0.D finished. Number of overlapping TFBS after filtering: 1407</span>
<span class="co">## INFO [2021-12-15 13:02:11]  Calculating intersection for TF BRCA1.0.D finished. Number of overlapping TFBS after filtering: 739</span>
<span class="co">## INFO [2021-12-15 13:02:14]  Calculating intersection for TF CDX1.0.C finished. Number of overlapping TFBS after filtering: 790</span>
<span class="co">## INFO [2021-12-15 13:02:15]  Calculating intersection for TF CDX2.0.A finished. Number of overlapping TFBS after filtering: 451</span>
<span class="co">## INFO [2021-12-15 13:02:16]  Calculating intersection for TF CEBPA.0.A finished. Number of overlapping TFBS after filtering: 1329</span>
<span class="co">## INFO [2021-12-15 13:02:17]  Calculating intersection for TF CENPB.0.D finished. Number of overlapping TFBS after filtering: 1070</span>
<span class="co">## INFO [2021-12-15 13:02:18]  Calculating intersection for TF CLOCK.0.C finished. Number of overlapping TFBS after filtering: 1335</span>
<span class="co">## INFO [2021-12-15 13:02:20]  Calculating intersection for TF CTCF.0.A finished. Number of overlapping TFBS after filtering: 8577</span>
<span class="co">## INFO [2021-12-15 13:02:22]  Calculating intersection for TF CTCFL.0.A finished. Number of overlapping TFBS after filtering: 8603</span>
<span class="co">## INFO [2021-12-15 13:02:23]  Calculating intersection for TF CUX2.0.D finished. Number of overlapping TFBS after filtering: 184</span>
<span class="co">## INFO [2021-12-15 13:02:24]  Calculating intersection for TF DLX1.0.D finished. Number of overlapping TFBS after filtering: 194</span>
<span class="co">## INFO [2021-12-15 13:02:25]  Calculating intersection for TF DLX2.0.D finished. Number of overlapping TFBS after filtering: 239</span>
<span class="co">## INFO [2021-12-15 13:02:26]  Calculating intersection for TF DLX4.0.D finished. Number of overlapping TFBS after filtering: 128</span>
<span class="co">## INFO [2021-12-15 13:02:27]  Calculating intersection for TF DLX6.0.D finished. Number of overlapping TFBS after filtering: 121</span>
<span class="co">## INFO [2021-12-15 13:02:28]  Calculating intersection for TF DMBX1.0.D finished. Number of overlapping TFBS after filtering: 135</span>
<span class="co">## INFO [2021-12-15 13:02:29]  Calculating intersection for TF DMRT1.0.D finished. Number of overlapping TFBS after filtering: 462</span>
<span class="co">## INFO [2021-12-15 13:02:30]  Calculating intersection for TF E2F1.0.A finished. Number of overlapping TFBS after filtering: 3120</span>
<span class="co">## INFO [2021-12-15 13:02:31]  Calculating intersection for TF E2F3.0.A finished. Number of overlapping TFBS after filtering: 1711</span>
<span class="co">## INFO [2021-12-15 13:02:32]  Calculating intersection for TF E2F4.0.A finished. Number of overlapping TFBS after filtering: 4226</span>
<span class="co">## INFO [2021-12-15 13:02:35]  Calculating intersection for TF E2F6.0.A finished. Number of overlapping TFBS after filtering: 5603</span>
<span class="co">## INFO [2021-12-15 13:02:36]  Calculating intersection for TF E2F7.0.B finished. Number of overlapping TFBS after filtering: 4766</span>
<span class="co">## INFO [2021-12-15 13:02:38]  Calculating intersection for TF COE1.0.A finished. Number of overlapping TFBS after filtering: 2365</span>
<span class="co">## INFO [2021-12-15 13:02:41]  Calculating intersection for TF EGR1.0.A finished. Number of overlapping TFBS after filtering: 8759</span>
<span class="co">## INFO [2021-12-15 13:02:48]  Calculating intersection for TF EGR2.0.A finished. Number of overlapping TFBS after filtering: 12564</span>
<span class="co">## INFO [2021-12-15 13:02:51]  Calculating intersection for TF EGR2.1.A finished. Number of overlapping TFBS after filtering: 8819</span>
<span class="co">## INFO [2021-12-15 13:02:53]  Calculating intersection for TF EHF.0.B finished. Number of overlapping TFBS after filtering: 4953</span>
<span class="co">## INFO [2021-12-15 13:02:54]  Calculating intersection for TF ELF1.0.A finished. Number of overlapping TFBS after filtering: 3502</span>
<span class="co">## INFO [2021-12-15 13:02:55]  Calculating intersection for TF ELF3.0.A finished. Number of overlapping TFBS after filtering: 5458</span>
<span class="co">## INFO [2021-12-15 13:02:56]  Calculating intersection for TF ELK3.0.D finished. Number of overlapping TFBS after filtering: 2178</span>
<span class="co">## INFO [2021-12-15 13:02:58]  Calculating intersection for TF ESR1.0.A finished. Number of overlapping TFBS after filtering: 1454</span>
<span class="co">## INFO [2021-12-15 13:02:59]  Calculating intersection for TF ESR1.1.A finished. Number of overlapping TFBS after filtering: 1610</span>
<span class="co">## INFO [2021-12-15 13:03:00]  Calculating intersection for TF ESR2.0.A finished. Number of overlapping TFBS after filtering: 1887</span>
<span class="co">## INFO [2021-12-15 13:03:03]  Calculating intersection for TF ESR2.1.A finished. Number of overlapping TFBS after filtering: 3900</span>
<span class="co">## INFO [2021-12-15 13:03:04]  Calculating intersection for TF ERR1.0.A finished. Number of overlapping TFBS after filtering: 1269</span>
<span class="co">## INFO [2021-12-15 13:03:06]  Calculating intersection for TF ETS1.0.A finished. Number of overlapping TFBS after filtering: 6264</span>
<span class="co">## INFO [2021-12-15 13:03:09]  Calculating intersection for TF ETS2.0.B finished. Number of overlapping TFBS after filtering: 7360</span>
<span class="co">## INFO [2021-12-15 13:03:11]  Calculating intersection for TF ETV2.0.B finished. Number of overlapping TFBS after filtering: 6427</span>
<span class="co">## INFO [2021-12-15 13:03:13]  Calculating intersection for TF ETV4.0.B finished. Number of overlapping TFBS after filtering: 5078</span>
<span class="co">## INFO [2021-12-15 13:03:16]  Calculating intersection for TF ETV5.0.C finished. Number of overlapping TFBS after filtering: 10355</span>
<span class="co">## INFO [2021-12-15 13:03:17]  Calculating intersection for TF FEZF1.0.C finished. Number of overlapping TFBS after filtering: 1038</span>
<span class="co">## INFO [2021-12-15 13:03:19]  Calculating intersection for TF FLI1.1.A finished. Number of overlapping TFBS after filtering: 8999</span>
<span class="co">## INFO [2021-12-15 13:03:20]  Calculating intersection for TF FOXA3.0.B finished. Number of overlapping TFBS after filtering: 489</span>
<span class="co">## INFO [2021-12-15 13:03:21]  Calculating intersection for TF FOXB1.0.D finished. Number of overlapping TFBS after filtering: 260</span>
<span class="co">## INFO [2021-12-15 13:03:22]  Calculating intersection for TF FOXC2.0.D finished. Number of overlapping TFBS after filtering: 682</span>
<span class="co">## INFO [2021-12-15 13:03:24]  Calculating intersection for TF FOXD2.0.D finished. Number of overlapping TFBS after filtering: 249</span>
<span class="co">## INFO [2021-12-15 13:03:25]  Calculating intersection for TF FOXD3.0.D finished. Number of overlapping TFBS after filtering: 969</span>
<span class="co">## INFO [2021-12-15 13:03:26]  Calculating intersection for TF FOXF1.0.D finished. Number of overlapping TFBS after filtering: 450</span>
<span class="co">## INFO [2021-12-15 13:03:27]  Calculating intersection for TF FOXO4.0.C finished. Number of overlapping TFBS after filtering: 399</span>
<span class="co">## INFO [2021-12-15 13:03:29]  Calculating intersection for TF FOXP1.0.A finished. Number of overlapping TFBS after filtering: 441</span>
<span class="co">## INFO [2021-12-15 13:03:30]  Calculating intersection for TF FOXP3.0.D finished. Number of overlapping TFBS after filtering: 363</span>
<span class="co">## INFO [2021-12-15 13:03:32]  Calculating intersection for TF FUBP1.0.D finished. Number of overlapping TFBS after filtering: 1055</span>
<span class="co">## INFO [2021-12-15 13:03:33]  Calculating intersection for TF EVI1.0.B finished. Number of overlapping TFBS after filtering: 250</span>
<span class="co">## INFO [2021-12-15 13:03:35]  Calculating intersection for TF COT1.0.C finished. Number of overlapping TFBS after filtering: 4814</span>
<span class="co">## INFO [2021-12-15 13:03:37]  Calculating intersection for TF COT1.1.C finished. Number of overlapping TFBS after filtering: 2976</span>
<span class="co">## INFO [2021-12-15 13:03:38]  Calculating intersection for TF COT2.0.A finished. Number of overlapping TFBS after filtering: 1413</span>
<span class="co">## INFO [2021-12-15 13:03:40]  Calculating intersection for TF COT2.1.A finished. Number of overlapping TFBS after filtering: 2548</span>
<span class="co">## INFO [2021-12-15 13:03:41]  Calculating intersection for TF BRAC.0.A finished. Number of overlapping TFBS after filtering: 745</span>
<span class="co">## INFO [2021-12-15 13:03:43]  Calculating intersection for TF AP2A.0.A finished. Number of overlapping TFBS after filtering: 3005</span>
<span class="co">## INFO [2021-12-15 13:03:44]  Calculating intersection for TF AP2B.0.B finished. Number of overlapping TFBS after filtering: 4205</span>
<span class="co">## INFO [2021-12-15 13:03:44]  Finished execution using 1 cores. TOTAL RUNNING TIME: 2.1 mins</span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
537
<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>
538
</div>
539
540
541
<div class="section level2">
<h2 id="filter-data-optional">Filter data (optional)<a class="anchor" aria-label="anchor" href="#filter-data-optional"></a>
</h2>
542
543
544
545
546
547
548
549
550
551
<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
552
<div class="sourceCode" id="cb74"><pre class="downlit sourceCode r">
553
<code class="sourceCode R"><span class="co"># Chromosomes to keep for peaks. This should be a vector of chromosome names</span>
554
<span class="va">chrToKeep_peaks</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/paste.html" class="external-link">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
555
<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>, 
556
    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>
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
<pre><code><span class="co">## INFO [2021-12-15 13:03:44] FILTER PEAKS</span>
<span class="co">## INFO [2021-12-15 13:03:44]  Number of peaks before filtering : 75000</span>
<span class="co">## INFO [2021-12-15 13:03:44]   Filter peaks by CV: Min = 0</span>
<span class="co">## INFO [2021-12-15 13:03:44]   Filter peaks by mean: Min = 5</span>
<span class="co">## INFO [2021-12-15 13:03:44]  Number of peaks after filtering : 64008</span>
<span class="co">## INFO [2021-12-15 13:03:45]  Finished successfully. Execution time: 0.1 secs</span>
<span class="co">## INFO [2021-12-15 13:03:45] 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</span>
<span class="co">## INFO [2021-12-15 13:03:45] Filter and sort peaks by size and remain only those smaller than : 10000</span>
<span class="co">## INFO [2021-12-15 13:03:45]  Number of peaks before filtering: 75000</span>
<span class="co">## INFO [2021-12-15 13:03:45]  Number of peaks after filtering : 75000</span>
<span class="co">## INFO [2021-12-15 13:03:45]  Finished successfully. Execution time: 0.4 secs</span>
<span class="co">## INFO [2021-12-15 13:03:45] Collectively, filter 10992 out of 75000 peaks.</span>
<span class="co">## INFO [2021-12-15 13:03:45] Number of remaining peaks: 64008</span>
<span class="co">## INFO [2021-12-15 13:03:45] FILTER RNA-seq</span>
<span class="co">## INFO [2021-12-15 13:03:45]  Number of genes before filtering : 61534</span>
<span class="co">## INFO [2021-12-15 13:03:45]   Filter genes by CV: Min = 0</span>
<span class="co">## INFO [2021-12-15 13:03:45]   Filter genes by mean: Min = 1</span>
<span class="co">## INFO [2021-12-15 13:03:45]  Number of genes after filtering : 18924</span>
<span class="co">## INFO [2021-12-15 13:03:45]  Finished successfully. Execution time: 0.1 secs</span>
<span class="co">## INFO [2021-12-15 13:03:45]  Number of rows in total: 35033</span>
<span class="co">## INFO [2021-12-15 13:03:45]  Flagged 16211 rows because the row mean was smaller than 1</span></code></pre>
578
<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>
579
</div>
580
581
582
<div class="section level2">
<h2 id="add-tf-peak-connections">Add TF-peak connections<a class="anchor" aria-label="anchor" href="#add-tf-peak-connections"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
583
<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>
584
585
586
587
588
<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
589
<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>
590
<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
591
592
<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">
593
<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" class="external-link">c</a></span><span class="op">(</span><span class="st">"expression"</span><span class="op">)</span>, 
Christian Arnold's avatar
Christian Arnold committed
594
    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>
595
<pre><code><span class="co">## INFO [2021-12-15 13:03:46] </span>
596
597
<span class="co">## Real data</span>
<span class="co">## </span>
598
599
600
601
602
603
604
605
606
607
608
609
<span class="co">## INFO [2021-12-15 13:03:46] Calculate TF-peak links for connection type expression</span>
<span class="co">## INFO [2021-12-15 13:03:46]  Correlate expression and peak counts</span>
<span class="co">## INFO [2021-12-15 13:03:46]   Retain 59 rows from TF/gene data out of 18822 (filter non-TF genes and TF genes with 0 counts throughout and keep only unique ENSEMBL IDs).</span>
<span class="co">## INFO [2021-12-15 13:03:46]   Correlate TF/gene data for 59 unique Ensembl IDs (TFs) and peak counts for 64008 peaks.</span>
<span class="co">## INFO [2021-12-15 13:03:46]   Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table.</span>
<span class="co">## INFO [2021-12-15 13:03:47]   Finished successfully. Execution time: 0.7 secs</span>
<span class="co">## INFO [2021-12-15 13:03:47]  Run FDR calculations for 65 TFs for which TFBS predictions and expression data for the corresponding gene are available.</span>
<span class="co">## INFO [2021-12-15 13:03:47]   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</span>
<span class="co">## INFO [2021-12-15 13:03:47]   Compute FDR for each TF. This may take a while...</span>
<span class="co">## INFO [2021-12-15 13:04:00]   Finished successfully. Execution time: 14.5 secs</span>
<span class="co">## INFO [2021-12-15 13:04:00]  Finished successfully. Execution time: 14.8 secs</span>
<span class="co">## INFO [2021-12-15 13:04:00] </span>
610
611
<span class="co">## Permuted data</span>
<span class="co">## </span>
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
<span class="co">## INFO [2021-12-15 13:04:01] Shuffling rows per column</span>
<span class="co">## INFO [2021-12-15 13:04:01]  Finished successfully. Execution time: 0.5 secs</span>
<span class="co">## INFO [2021-12-15 13:04:01] Calculate TF-peak links for connection type expression</span>
<span class="co">## INFO [2021-12-15 13:04:01]  Correlate expression and peak counts</span>
<span class="co">## INFO [2021-12-15 13:04:02]   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).</span>
<span class="co">## INFO [2021-12-15 13:04:02]   Correlate TF/gene data for 59 unique Ensembl IDs (TFs) and peak counts for 64008 peaks.</span>
<span class="co">## INFO [2021-12-15 13:04:02]   Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table.</span>
<span class="co">## INFO [2021-12-15 13:04:03]   Finished successfully. Execution time: 1.5 secs</span>
<span class="co">## INFO [2021-12-15 13:04:03]  Run FDR calculations for 65 TFs for which TFBS predictions and expression data for the corresponding gene are available.</span>
<span class="co">## INFO [2021-12-15 13:04:03]   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</span>
<span class="co">## INFO [2021-12-15 13:04:03]   Compute FDR for each TF. This may take a while...</span>
<span class="co">## INFO [2021-12-15 13:04:15]   Finished successfully. Execution time: 14.1 secs</span>
<span class="co">## INFO [2021-12-15 13:04:15]  Finished successfully. Execution time: 14.7 secs</span>
<span class="co">## INFO [2021-12-15 13:04:15] 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</span>
<span class="co">## INFO [2021-12-15 13:04:15]  Including a total of 65 TF. Preparing plots...</span>
<span class="co">## INFO [2021-12-15 13:04:18]  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.</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:04:40] Finished writing plots to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_peak.fdrCurves_original.pdf</span>
<span class="co">## INFO [2021-12-15 13:04:40]  Finished successfully. Execution time: 24.9 secs</span>
<span class="co">## INFO [2021-12-15 13:04:40] 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</span>
<span class="co">## INFO [2021-12-15 13:04:40]  Including a total of 65 TF. Preparing plots...</span>
<span class="co">## INFO [2021-12-15 13:04:43]  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.</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:05:06] Finished writing plots to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_peak.fdrCurves_permuted.pdf</span>
<span class="co">## INFO [2021-12-15 13:05:06]  Finished successfully. Execution time: 25.5 secs</span></code></pre>
635
636
<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>
637
638
639
<div class="section level2">
<h2 id="quality-control-2-diagnostic-plots-for-tf-peak-connections">Quality control 2: Diagnostic plots for TF-peak connections<a class="anchor" aria-label="anchor" href="#quality-control-2-diagnostic-plots-for-tf-peak-connections"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
640
<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>
641
642
643
644
645
646
647
648
<!-- 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? -->
649
</div>
650
651
652
<div class="section level2">
<h2 id="run-the-ar-classification-and-qc-optional">Run the AR classification and QC (optional)<a class="anchor" aria-label="anchor" href="#run-the-ar-classification-and-qc-optional"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
653
654
655
656
<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>, 
657
658
    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>
659
<pre><code><span class="co">## INFO [2021-12-15 13:05:06]  Connection type expression</span>
660
<span class="co">## </span>
661
<span class="co">## INFO [2021-12-15 13:05:06]  Real data</span>
662
<span class="co">## </span>
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
<span class="co">## INFO [2021-12-15 13:05:06]  Correlate expression and peak counts</span>
<span class="co">## INFO [2021-12-15 13:05:06]  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).</span>
<span class="co">## INFO [2021-12-15 13:05:06]  Correlate TF/gene data for 59 unique Ensembl IDs (TFs) and peak counts for 64008 peaks.</span>
<span class="co">## INFO [2021-12-15 13:05:06]  Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table.</span>
<span class="co">## INFO [2021-12-15 13:05:06]  Finished successfully. Execution time: 0.6 secs</span>
<span class="co">## INFO [2021-12-15 13:05:06] Compute foreground and background as well as their median values per TF</span>
<span class="co">## INFO [2021-12-15 13:05:08]  Finished successfully. Execution time: 1.2 secs</span>
<span class="co">## INFO [2021-12-15 13:05:08] Calculate classification thresholds for repressors / activators</span>
<span class="co">## INFO [2021-12-15 13:05:08]  Stringency 0.1: -0.0305 / 0.0157</span>
<span class="co">## INFO [2021-12-15 13:05:08]  Stringency 0.05: -0.0439 / 0.0195</span>
<span class="co">## INFO [2021-12-15 13:05:09]  Stringency 0.01: -0.0537 / 0.024</span>
<span class="co">## INFO [2021-12-15 13:05:09]  Stringency 0.001: -0.0564 / 0.0281</span>
<span class="co">## INFO [2021-12-15 13:05:09]  Finished successfully. Execution time: 1.4 secs</span>
<span class="co">## INFO [2021-12-15 13:05:09] Finalize classification</span>
<span class="co">## INFO [2021-12-15 13:05:09]  Perform Wilcoxon test for each TF. This may take a few minutes.</span>
<span class="co">## INFO [2021-12-15 13:05:23]   Stringency 0.1</span>
<span class="co">## INFO [2021-12-15 13:05:23]    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</span>
<span class="co">## INFO [2021-12-15 13:05:23]   Stringency 0.05</span>
<span class="co">## INFO [2021-12-15 13:05:23]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: AIRE.0.C</span>
<span class="co">## INFO [2021-12-15 13:05:23]   Stringency 0.01</span>
<span class="co">## INFO [2021-12-15 13:05:23]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: AIRE.0.C</span>
<span class="co">## INFO [2021-12-15 13:05:23]   Stringency 0.001</span>
<span class="co">## INFO [2021-12-15 13:05:23]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: AIRE.0.C</span>
<span class="co">## INFO [2021-12-15 13:05:23]  Summary of classification:</span>
<span class="co">## INFO [2021-12-15 13:05:23]   Column classification_q0.1_final</span>
<span class="co">## INFO [2021-12-15 13:05:23]    activator: 25,    undetermined: 17,    repressor: 23,    not-expressed: 10</span>
<span class="co">## INFO [2021-12-15 13:05:24]   Column classification_q0.05_final</span>
<span class="co">## INFO [2021-12-15 13:05:24]    activator: 24,    undetermined: 21,    repressor: 20,    not-expressed: 10</span>
<span class="co">## INFO [2021-12-15 13:05:24]   Column classification_q0.01_final</span>
<span class="co">## INFO [2021-12-15 13:05:24]    activator: 21,    undetermined: 28,    repressor: 16,    not-expressed: 10</span>
<span class="co">## INFO [2021-12-15 13:05:24]   Column classification_q0.001_final</span>
<span class="co">## INFO [2021-12-15 13:05:24]    activator: 19,    undetermined: 30,    repressor: 16,    not-expressed: 10</span>
<span class="co">## INFO [2021-12-15 13:05:24]  Finished successfully. Execution time: 14.5 secs</span>
<span class="co">## INFO [2021-12-15 13:05:24] 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</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:05:26]  Finished successfully. Execution time: 2.2 secs</span>
<span class="co">## INFO [2021-12-15 13:05:26] Plotting AR summary plot to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_classification_stringencyThresholds_expression_original.pdf</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:05:26]  Finished successfully. Execution time: 0.1 secs</span>
<span class="co">## INFO [2021-12-15 13:05:26] Plotting AR heatmap to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_classification_summaryHeatmap_expression_original.pdf</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:05:28]  Finished successfully. Execution time: 1.6 secs</span>
<span class="co">## INFO [2021-12-15 13:05:28]  Permuted data</span>
703
<span class="co">## </span>
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
745
746
<span class="co">## INFO [2021-12-15 13:05:28]  Correlate expression and peak counts</span>
<span class="co">## INFO [2021-12-15 13:05:28]  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).</span>
<span class="co">## INFO [2021-12-15 13:05:28]  Correlate TF/gene data for 59 unique Ensembl IDs (TFs) and peak counts for 64008 peaks.</span>
<span class="co">## INFO [2021-12-15 13:05:28]  Note: For subsequent steps, the same gene may be associated with multiple TF, depending on the translation table.</span>
<span class="co">## INFO [2021-12-15 13:05:29]  Finished successfully. Execution time: 0.7 secs</span>
<span class="co">## INFO [2021-12-15 13:05:29] Shuffling rows per column</span>
<span class="co">## INFO [2021-12-15 13:05:31]  Finished successfully. Execution time: 2.1 secs</span>
<span class="co">## INFO [2021-12-15 13:05:31] Compute foreground and background as well as their median values per TF</span>
<span class="co">## INFO [2021-12-15 13:05:32]  Finished successfully. Execution time: 1.1 secs</span>
<span class="co">## INFO [2021-12-15 13:05:32] Calculate classification thresholds for repressors / activators</span>
<span class="co">## INFO [2021-12-15 13:05:32]  Stringency 0.1: -0.0187 / 0.0124</span>
<span class="co">## INFO [2021-12-15 13:05:33]  Stringency 0.05: -0.0231 / 0.0189</span>
<span class="co">## INFO [2021-12-15 13:05:33]  Stringency 0.01: -0.0306 / 0.0243</span>
<span class="co">## INFO [2021-12-15 13:05:34]  Stringency 0.001: -0.0404 / 0.0247</span>
<span class="co">## INFO [2021-12-15 13:05:34]  Finished successfully. Execution time: 1.6 secs</span>
<span class="co">## INFO [2021-12-15 13:05:34] Finalize classification</span>
<span class="co">## INFO [2021-12-15 13:05:34]  Perform Wilcoxon test for each TF. This may take a few minutes.</span>
<span class="co">## INFO [2021-12-15 13:05:48]   Stringency 0.1</span>
<span class="co">## INFO [2021-12-15 13:05:48]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: AIRE.0.C,ARI3A.0.D,ATF2.1.B,BATF3.0.B,BPTF.0.D,CEBPA.0.A,CLOCK.0.C,CTCF.0.A,CUX2.0.D,DLX4.0.D,E2F7.0.B,EGR1.0.A,ESR1.0.A,ESR1.1.A,ETV4.0.B,FEZF1.0.C,FOXC2.0.D,FOXD2.0.D,FUBP1.0.D</span>
<span class="co">## INFO [2021-12-15 13:05:48]   Stringency 0.05</span>
<span class="co">## INFO [2021-12-15 13:05:48]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: BATF3.0.B,CLOCK.0.C,CTCF.0.A,CUX2.0.D,DLX4.0.D,E2F7.0.B,ESR1.1.A,ETV4.0.B,FOXD2.0.D,FUBP1.0.D</span>
<span class="co">## INFO [2021-12-15 13:05:48]   Stringency 0.01</span>
<span class="co">## INFO [2021-12-15 13:05:48]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: CTCF.0.A,CUX2.0.D,E2F7.0.B,FOXD2.0.D</span>
<span class="co">## INFO [2021-12-15 13:05:48]   Stringency 0.001</span>
<span class="co">## INFO [2021-12-15 13:05:48]    Change the following TFs to 'undetermined' as they were classified as activator/repressor before but the Wilcoxon test was not significant: CTCF.0.A,FOXD2.0.D</span>
<span class="co">## INFO [2021-12-15 13:05:48]  Summary of classification:</span>
<span class="co">## INFO [2021-12-15 13:05:48]   Column classification_q0.1_final</span>
<span class="co">## INFO [2021-12-15 13:05:48]    activator: 2,    undetermined: 62,    repressor: 1,    not-expressed: 10</span>
<span class="co">## INFO [2021-12-15 13:05:48]   Column classification_q0.05_final</span>
<span class="co">## INFO [2021-12-15 13:05:48]    activator: 1,    undetermined: 63,    repressor: 1,    not-expressed: 10</span>
<span class="co">## INFO [2021-12-15 13:05:48]   Column classification_q0.01_final</span>
<span class="co">## INFO [2021-12-15 13:05:48]    activator: 1,    undetermined: 64,    repressor: 0,    not-expressed: 10</span>
<span class="co">## INFO [2021-12-15 13:05:48]   Column classification_q0.001_final</span>
<span class="co">## INFO [2021-12-15 13:05:48]    activator: 1,    undetermined: 64,    repressor: 0,    not-expressed: 10</span>
<span class="co">## INFO [2021-12-15 13:05:48]  Finished successfully. Execution time: 14.6 secs</span>
<span class="co">## INFO [2021-12-15 13:05:48] 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</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:05:50]  Finished successfully. Execution time: 1.8 secs</span>
<span class="co">## INFO [2021-12-15 13:05:50] Plotting AR summary plot to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_classification_stringencyThresholds_expression_permuted.pdf</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:05:50]  Finished successfully. Execution time: 0.1 secs</span>
<span class="co">## INFO [2021-12-15 13:05:50] Shuffling rows per column</span>
<span class="co">## INFO [2021-12-15 13:05:51]  Finished successfully. Execution time: 0.5 secs</span>
<span class="co">## INFO [2021-12-15 13:05:51] Plotting AR heatmap to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/TF_classification_summaryHeatmap_expression_permuted.pdf</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:05:52]  Finished successfully. Execution time: 1 secs</span></code></pre>
747
748
749
<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">
750
751
<li><a href="https://doi.org/10.1016/j.celrep.2019.10.106" title="The original publication explaining the method and motivation in detail" class="external-link">diffTF_paper</a></li>
<li>In general, <a href="https://difftf.readthedocs.io" title="the *ReadTheDocs* help for *diffTF*" class="external-link">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*" class="external-link">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>
752
753
754
</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>
755
756
757
<div class="section level2">
<h2 id="save-granie-object-to-disk-optional">Save <em>GRaNIE</em> object to disk (optional)<a class="anchor" aria-label="anchor" href="#save-granie-object-to-disk-optional"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
758
759
<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">
760
761
<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" class="external-link">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" class="external-link">saveRDS</a></span><span class="op">(</span><span class="va">GRN</span>, <span class="va">GRN_file_outputRDS</span><span class="op">)</span>
762
763
764

<span class="co"># Read it back into R with GRN = readRDS(GRN_file_outputRDS)</span></code></pre></div>
</div>
765
766
767
<div class="section level2">
<h2 id="add-peak-gene-connections">Add peak-gene connections<a class="anchor" aria-label="anchor" href="#add-peak-gene-connections"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
768
<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>
769
770
771
772
773
774
775
<!-- 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 -->
776
<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
777
778
<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>, 
779
    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" class="external-link">list</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"all"</span><span class="op">)</span><span class="op">)</span>, 
Christian Arnold's avatar
Christian Arnold committed
780
    forceRerun <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></code></pre></div>
781
<pre><code><span class="co">## INFO [2021-12-15 13:05:52] </span>
782
783
<span class="co">## Real data</span>
<span class="co">## </span>
784
785
786
787
788
789
790
<span class="co">## INFO [2021-12-15 13:05:52] Calculate peak-gene correlations for neighborhood size 10000</span>
<span class="co">## INFO [2021-12-15 13:05:52] Calculate peak gene overlaps...</span>
<span class="co">## INFO [2021-12-15 13:05:52] Extend peaks based on user-defined extension size of 10000 up- and downstream.</span>
<span class="co">## INFO [2021-12-15 13:05:52] Reading pre-compiled genome annotation data </span>
<span class="co">## INFO [2021-12-15 13:05:52]  Finished successfully. Execution time: 0.4 secs</span>
<span class="co">## INFO [2021-12-15 13:05:52]  Iterate through 41912 peak-gene combinations and (if possible) calculate correlations using 1 cores. This may take a few minutes.</span>
<span class="co">## INFO [2021-12-15 13:06:04]  Finished execution using 1 cores. TOTAL RUNNING TIME: 11.4 secs</span>
791
<span class="co">## </span>
792
793
794
795
796
<span class="co">## INFO [2021-12-15 13:06:04]  Finished with calculating correlations, creating final data frame and filter NA rows due to missing RNA-seq data</span>
<span class="co">## INFO [2021-12-15 13:06:04]  Initial number of rows: 41912</span>
<span class="co">## INFO [2021-12-15 13:06:04]  Finished. Final number of rows: 18804</span>
<span class="co">## INFO [2021-12-15 13:06:04]  Finished successfully. Execution time: 12.3 secs</span>
<span class="co">## INFO [2021-12-15 13:06:04] </span>
797
798
<span class="co">## Permuted data</span>
<span class="co">## </span>
799
800
801
802
803
804
805
806
<span class="co">## INFO [2021-12-15 13:06:04] Calculate random peak-gene correlations for neighborhood size 10000</span>
<span class="co">## INFO [2021-12-15 13:06:04] Calculate peak gene overlaps...</span>
<span class="co">## INFO [2021-12-15 13:06:04] Extend peaks based on user-defined extension size of 10000 up- and downstream.</span>
<span class="co">## INFO [2021-12-15 13:06:04] Reading pre-compiled genome annotation data </span>
<span class="co">## INFO [2021-12-15 13:06:05]  Finished successfully. Execution time: 0.4 secs</span>
<span class="co">## INFO [2021-12-15 13:06:05]  Randomize gene-peak links by shuffling the peak IDs.</span>
<span class="co">## INFO [2021-12-15 13:06:05]  Iterate through 41912 peak-gene combinations and (if possible) calculate correlations using 1 cores. This may take a few minutes.</span>
<span class="co">## INFO [2021-12-15 13:06:16]  Finished execution using 1 cores. TOTAL RUNNING TIME: 11.4 secs</span>
807
<span class="co">## </span>
808
809
810
811
812
813
814
<span class="co">## INFO [2021-12-15 13:06:16]  Finished with calculating correlations, creating final data frame and filter NA rows due to missing RNA-seq data</span>
<span class="co">## INFO [2021-12-15 13:06:16]  Initial number of rows: 41912</span>
<span class="co">## INFO [2021-12-15 13:06:17]  Finished. Final number of rows: 18804</span>
<span class="co">## INFO [2021-12-15 13:06:17]  Finished successfully. Execution time: 12.3 secs</span>
<span class="co">## INFO [2021-12-15 13:06:17] 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_</span>
<span class="co">## INFO [2021-12-15 13:06:17]  Gene type all</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:06:34]  Finished successfully. Execution time: 17.7 secs</span></code></pre>
815
816
<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>
817
818
819
<div class="section level2">
<h2 id="quality-control-3-diagnostic-plots-for-peak-gene-connections">Quality control 3: Diagnostic plots for peak-gene connections<a class="anchor" aria-label="anchor" href="#quality-control-3-diagnostic-plots-for-peak-gene-connections"></a>
</h2>
820
821
<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>
822
823
824
<div class="section level2">
<h2 id="combine-tf-peak-and-peak-gene-connections-and-filter">Combine TF-peak and peak-gene connections and filter<a class="anchor" aria-label="anchor" href="#combine-tf-peak-and-peak-gene-connections-and-filter"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
825
826
<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">
827
<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.2</span>, peak_gene.fdr.threshold <span class="op">=</span> <span class="fl">0.2</span>, 
828
    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" class="external-link">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
829
    allowMissingGenes <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></code></pre></div>
830
831
<pre><code><span class="co">## INFO [2021-12-15 13:06:34] Filter GRN network</span>
<span class="co">## INFO [2021-12-15 13:06:34] </span>
832
833
<span class="co">## </span>
<span class="co">## Real data</span>
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
<span class="co">## INFO [2021-12-15 13:06:34] Inital number of rows left before all filtering steps: 23153</span>
<span class="co">## INFO [2021-12-15 13:06:34]  Filter network and retain only rows with TF-peak connections with an FDR &lt; 0.2</span>
<span class="co">## INFO [2021-12-15 13:06:34]   Number of TF-peak rows before filtering TFs: 23153</span>
<span class="co">## INFO [2021-12-15 13:06:34]   Number of TF-peak rows after filtering TFs: 4923</span>
<span class="co">## INFO [2021-12-15 13:06:35] 2. Filter peak-gene connections</span>
<span class="co">## INFO [2021-12-15 13:06:35]  Filter genes by gene type, keep only the following gene types: protein_coding, lincRNA</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of peak-gene rows before filtering by gene type: 18828</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of peak-gene rows after filtering by gene type: 18734</span>
<span class="co">## INFO [2021-12-15 13:06:35] 3. Merging TF-peak with peak-gene connections and filter the combined table...</span>
<span class="co">## INFO [2021-12-15 13:06:35] Inital number of rows left before all filtering steps: 5972</span>
<span class="co">## INFO [2021-12-15 13:06:35]  Filter rows with missing ENSEMBL IDs</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows before filtering: 5972</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows after filtering: 4010</span>
<span class="co">## INFO [2021-12-15 13:06:35]  Filter network and retain only rows with peak_gene.r in the following interval: (0 - 1]</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows before filtering TFs: 4010</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows after filtering TFs: 2368</span>
<span class="co">## INFO [2021-12-15 13:06:35]  Calculate FDR based on remaining rows, filter network and retain only rows with peak-gene connections with an FDR &lt; 0.2</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows before filtering genes (including NA): 2368</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows before filtering genes (excluding NA): 2368</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows after filtering genes (including NA): 631</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows after filtering genes (excluding NA): 631</span>
<span class="co">## INFO [2021-12-15 13:06:35] Final number of rows left after all filtering steps: 631</span>
<span class="co">## INFO [2021-12-15 13:06:35]  Finished successfully. Execution time: 0.6 secs</span>
<span class="co">## INFO [2021-12-15 13:06:35] </span>
858
859
<span class="co">## </span>
<span class="co">## Permuted data</span>
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
<span class="co">## INFO [2021-12-15 13:06:35] Inital number of rows left before all filtering steps: 83</span>
<span class="co">## INFO [2021-12-15 13:06:35]  Filter network and retain only rows with TF-peak connections with an FDR &lt; 0.2</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of TF-peak rows before filtering TFs: 83</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of TF-peak rows after filtering TFs: 33</span>
<span class="co">## INFO [2021-12-15 13:06:35] 2. Filter peak-gene connections</span>
<span class="co">## INFO [2021-12-15 13:06:35]  Filter genes by gene type, keep only the following gene types: protein_coding, lincRNA</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of peak-gene rows before filtering by gene type: 18828</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of peak-gene rows after filtering by gene type: 18734</span>
<span class="co">## INFO [2021-12-15 13:06:35] 3. Merging TF-peak with peak-gene connections and filter the combined table...</span>
<span class="co">## INFO [2021-12-15 13:06:35] Inital number of rows left before all filtering steps: 33</span>
<span class="co">## INFO [2021-12-15 13:06:35]  Filter rows with missing ENSEMBL IDs</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows before filtering: 33</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows after filtering: 6</span>
<span class="co">## INFO [2021-12-15 13:06:35]  Filter network and retain only rows with peak_gene.r in the following interval: (0 - 1]</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows before filtering TFs: 6</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows after filtering TFs: 4</span>
<span class="co">## INFO [2021-12-15 13:06:35]  Calculate FDR based on remaining rows, filter network and retain only rows with peak-gene connections with an FDR &lt; 0.2</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows before filtering genes (including NA): 4</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows before filtering genes (excluding NA): 4</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows after filtering genes (including NA): 0</span>
<span class="co">## INFO [2021-12-15 13:06:35]   Number of rows after filtering genes (excluding NA): 0</span>
<span class="co">## INFO [2021-12-15 13:06:36] Final number of rows left after all filtering steps: 0</span>
<span class="co">## INFO [2021-12-15 13:06:36]  Finished successfully. Execution time: 1.2 secs</span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
883
<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>
884
885
<p>For more parameter details, see the R help (<code><a href="../reference/filterGRNAndConnectGenes.html">?filterGRNAndConnectGenes</a></code>).</p>
</div>
886
887
888
<div class="section level2">
<h2 id="add-tf-gene-correlations-optional">Add TF-gene correlations (optional)<a class="anchor" aria-label="anchor" href="#add-tf-gene-correlations-optional"></a>
</h2>
889
<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
890
891
<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>
892
893
894
895
<pre><code><span class="co">## INFO [2021-12-15 13:06:36] Calculate correlations for TF and genes from the filtered set of connections</span>
<span class="co">## INFO [2021-12-15 13:06:36]  Real data</span>
<span class="co">## INFO [2021-12-15 13:06:36]   Iterate through 587 TF-gene combinations and (if possible) calculate correlations using 1 cores. This may take a few minutes.</span>
<span class="co">## INFO [2021-12-15 13:06:39]  Finished execution using 1 cores. TOTAL RUNNING TIME: 3.2 secs</span>
896
<span class="co">## </span>
897
898
899
<span class="co">## INFO [2021-12-15 13:06:39]   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.</span>
<span class="co">## INFO [2021-12-15 13:06:39]  Permuted data</span>
<span class="co">## WARN [2021-12-15 13:06:39]  Nothing to do, skip.</span></code></pre>
900
901
902
<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>
903
904
905
<div class="section level2">
<h2 id="retrieve-filtered-connections">Retrieve filtered connections<a class="anchor" aria-label="anchor" href="#retrieve-filtered-connections"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
906
907
908
<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>
909
910

<span class="va">GRN_connections.all</span></code></pre></div>
911
<pre><code><span class="co">## <span style="color: #949494;"># A tibble: 631 x 32</span></span>
912
913
<span class="co">##    TF.name   TF.ENSEMBL     TF_peak.r_bin TF_peak.r TF_peak.fdr TF_peak.fdr_orig</span>
<span class="co">##    <span style="color: #949494;font-style: italic;">&lt;chr&gt;</span><span>     </span><span style="color: #949494;font-style: italic;">&lt;fct&gt;</span><span>          </span><span style="color: #949494;font-style: italic;">&lt;fct&gt;</span><span>             </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>       </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span><span>            </span><span style="color: #949494;font-style: italic;">&lt;dbl&gt;</span></span>
914
915
916
917
918
919
920
921
922
923
924
<span class="co">## <span style="color: #BCBCBC;"> 1</span><span> BATF3.0.B ENSG000001236… [0.65,0.7)        0.684       0.185            0.185</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 2</span><span> E2F6.0.A  ENSG000001690… [0.55,0.6)        0.550       0.156            0.156</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 3</span><span> E2F6.0.A  ENSG000001690… [0.5,0.55)        0.514       0.175            0.175</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 4</span><span> E2F6.0.A  ENSG000001690… [0.5,0.55)        0.539       0.175            0.175</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 5</span><span> E2F6.0.A  ENSG000001690… [0.5,0.55)        0.539       0.175            0.175</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 6</span><span> E2F6.0.A  ENSG000001690… [0.45,0.5)        0.494       0.191            0.191</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 7</span><span> E2F6.0.A  ENSG000001690… [0.55,0.6)        0.585       0.156            0.156</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 8</span><span> E2F6.0.A  ENSG000001690… [0.5,0.55)        0.501       0.175            0.175</span></span>
<span class="co">## <span style="color: #BCBCBC;"> 9</span><span> E2F6.0.A  ENSG000001690… [0.65,0.7)        0.663       0.166            0.166</span></span>
<span class="co">## <span style="color: #BCBCBC;">10</span><span> E2F6.0.A  ENSG000001690… [0.5,0.55)        0.528       0.175            0.175</span></span>
<span class="co">## <span style="color: #949494;"># … with 621 more rows, and 26 more variables: TF_peak.fdr_direction &lt;fct&gt;,</span></span>
925
926
927
928
929
930
931
932
<span class="co">## <span style="color: #949494;">#   TF_peak.connectionType &lt;fct&gt;, peak.ID &lt;fct&gt;, peak.mean &lt;dbl&gt;,</span></span>
<span class="co">## <span style="color: #949494;">#   peak.median &lt;dbl&gt;, peak.CV &lt;dbl&gt;, peak.annotation &lt;fct&gt;,</span></span>
<span class="co">## <span style="color: #949494;">#   peak.GC.perc &lt;dbl&gt;, peak.width &lt;int&gt;, peak.GC.class &lt;ord&gt;,</span></span>
<span class="co">## <span style="color: #949494;">#   peak_gene.distance &lt;int&gt;, peak_gene.r &lt;dbl&gt;, peak_gene.p_raw &lt;dbl&gt;,</span></span>
<span class="co">## <span style="color: #949494;">#   peak_gene.p_adj &lt;dbl&gt;, gene.ENSEMBL &lt;fct&gt;, gene.mean &lt;dbl&gt;,</span></span>
<span class="co">## <span style="color: #949494;">#   gene.median &lt;dbl&gt;, gene.CV &lt;dbl&gt;, gene.chr &lt;fct&gt;, gene.start &lt;int&gt;,</span></span>
<span class="co">## <span style="color: #949494;">#   gene.end &lt;int&gt;, gene.strand &lt;fct&gt;, gene.type &lt;fct&gt;, gene.name &lt;fct&gt;,</span></span>
<span class="co">## <span style="color: #949494;">#   TF_gene.r &lt;dbl&gt;, TF_gene.p_raw &lt;dbl&gt;</span></span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
933
<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>
934
</div>
935
936
937
<div class="section level2">
<h2 id="visualize-the-filtered-egrn-connections">Visualize the filtered <em>eGRN</em> connections<a class="anchor" aria-label="anchor" href="#visualize-the-filtered-egrn-connections"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
938
<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>
939
</div>
940
941
942
<div class="section level2">
<h2 id="generate-a-connection-summary">Generate a connection summary<a class="anchor" aria-label="anchor" href="#generate-a-connection-summary"></a>
</h2>
943
<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
944
<div class="sourceCode" id="cb98"><pre class="downlit sourceCode r">
945
946
947
<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" class="external-link">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>, 
    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" class="external-link">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" class="external-link">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" class="external-link">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" class="external-link">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" class="external-link">c</a></span><span class="op">(</span><span class="st">"protein_coding"</span>, 
948
        <span class="st">"lincRNA"</span><span class="op">)</span><span class="op">)</span></code></pre></div>
949
950
<pre><code><span class="co">## INFO [2021-12-15 13:06:39] Generating summary. This may take a while...</span>
<span class="co">## INFO [2021-12-15 13:06:39] </span>
951
952
<span class="co">## Real data...</span>
<span class="co">## </span>
953
954
955
956
957
<span class="co">## INFO [2021-12-15 13:06:39] Calculate network stats for TF-peak FDR of 0.01</span>
<span class="co">## INFO [2021-12-15 13:06:48] Calculate network stats for TF-peak FDR of 0.05</span>
<span class="co">## INFO [2021-12-15 13:06:55] Calculate network stats for TF-peak FDR of 0.1</span>
<span class="co">## INFO [2021-12-15 13:07:03] Calculate network stats for TF-peak FDR of 0.2</span>
<span class="co">## INFO [2021-12-15 13:07:10] </span>
958
959
<span class="co">## Permuted data...</span>
<span class="co">## </span>
960
961
962
963
<span class="co">## INFO [2021-12-15 13:07:10] Calculate network stats for TF-peak FDR of 0.01</span>
<span class="co">## INFO [2021-12-15 13:07:18] Calculate network stats for TF-peak FDR of 0.05</span>
<span class="co">## INFO [2021-12-15 13:07:25] Calculate network stats for TF-peak FDR of 0.1</span>
<span class="co">## INFO [2021-12-15 13:07:33] Calculate network stats for TF-peak FDR of 0.2</span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
964
965
<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>
966
967
968
<pre><code><span class="co">## INFO [2021-12-15 13:07:40] Plotting connection summary to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/GRN.connectionSummary_heatmap.pdf</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:07:41] Finished writing plots to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/GRN.connectionSummary_heatmap.pdf</span>
<span class="co">## INFO [2021-12-15 13:07:41]  Finished successfully. Execution time: 0.5 secs</span></code></pre>
Christian Arnold's avatar
Christian Arnold committed
969
970
<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>
971
972
<pre><code><span class="co">## INFO [2021-12-15 13:07:41] Plotting diagnostic plots for network connections to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/GRN.connectionSummary_boxplot.pdf</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:07:51]  Finished successfully. Execution time: 10.1 secs</span></code></pre>
973
974
<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>
975
976
977
<div class="section level2">
<h2 id="enrichment-analyses">Enrichment analyses<a class="anchor" aria-label="anchor" href="#enrichment-analyses"></a>
</h2>
Christian Arnold's avatar
Christian Arnold committed
978
979
980
981
982
983
984
985
986
<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>
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<pre><code><span class="co">## INFO [2021-12-15 13:07:51] Plotting general network statistics to file /g/scb2/zaugg/carnold/Projects/GRN_pipeline/src/GRaNIE/vignettes/output/plots/GRN.overall_stats.pdf</span></code></pre>
<pre><code><span class="co">## INFO [2021-12-15 13:07:54]  Finished successfully. Execution time: 3.1 secs</span>
<span class="co">## INFO [2021-12-15 13:07:54] Calculating general enrichment statistics... This may take a while.</span>
<span class="co">## INFO [2021-12-15 13:08:58]  Enrichment calculation finished for ontology BP. Checked 7227 terms</span>
<span class="co">## INFO [2021-12-15 13:08:58]   Number of terms for which p-value &lt;= 0.01: 28</span>
<span class="co">## INFO [2021-12-15 13:08:58]   Number of terms for which p-value &lt;= 0.05: 110</span>
<span class="co">## INFO [2021-12-15 13:08:58]   Number of terms for which p-value &lt;= 0.1: 194</span>
<span class="co">## INFO [2021-12-15 13:08:58]   Number of terms for which p-value &lt;= 0.2: 466</span>
<span class="co">## INFO [2021-12-15 13:09:05]  Enrichment calculation finished for ontology MF. Checked 1301 terms</span>
<span class="co">## INFO [2021-12-15 13:09:06]   Number of terms for which p-value &lt;= 0.01: 4</span>
<span class="co">## INFO [2021-12-15 13:09:06]   Number of terms for which p-value &lt;= 0.05: 27</span>
<span class="co">## INFO [2021-12-15 13:09:06]   Number of terms for which p-value &lt;= 0.1: 35</span>
<span class="co">## INFO [2021-12-15 13:09:06]   Number of terms for which p-value &lt;= 0.2: 97</span>
<span class="co">## INFO [2021-12-15 13:09:06] Results stored in GRN@stats[["Enrichment"]][["general"]]</span>
For faster browsing, not all history is shown. View entire blame