Diff of /docs/multiomic.html [000000] .. [413088]

Switch to unified view

a b/docs/multiomic.html
1
<!DOCTYPE html>
2
3
<html>
4
5
<head>
6
7
<meta charset="utf-8" />
8
<meta name="generator" content="pandoc" />
9
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
10
11
12
13
14
<title>Multi-omics</title>
15
16
<script src="site_libs/header-attrs-2.29/header-attrs.js"></script>
17
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
18
<meta name="viewport" content="width=device-width, initial-scale=1" />
19
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
20
<script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script>
21
<script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script>
22
<script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script>
23
<style>h1 {font-size: 34px;}
24
       h1.title {font-size: 38px;}
25
       h2 {font-size: 30px;}
26
       h3 {font-size: 24px;}
27
       h4 {font-size: 18px;}
28
       h5 {font-size: 16px;}
29
       h6 {font-size: 12px;}
30
       code {color: inherit; background-color: rgba(0, 0, 0, 0.04);}
31
       pre:not([class]) { background-color: white }</style>
32
<script src="site_libs/jqueryui-1.13.2/jquery-ui.min.js"></script>
33
<link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
34
<script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script>
35
<script src="site_libs/navigation-1.1/tabsets.js"></script>
36
<link href="site_libs/highlightjs-9.12.0/textmate.css" rel="stylesheet" />
37
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
38
<link href="site_libs/font-awesome-6.5.2/css/all.min.css" rel="stylesheet" />
39
<link href="site_libs/font-awesome-6.5.2/css/v4-shims.min.css" rel="stylesheet" />
40
41
<style type="text/css">
42
  code{white-space: pre-wrap;}
43
  span.smallcaps{font-variant: small-caps;}
44
  span.underline{text-decoration: underline;}
45
  div.column{display: inline-block; vertical-align: top; width: 50%;}
46
  div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
47
  ul.task-list{list-style: none;}
48
    </style>
49
50
<style type="text/css">code{white-space: pre;}</style>
51
<script type="text/javascript">
52
if (window.hljs) {
53
  hljs.configure({languages: []});
54
  hljs.initHighlightingOnLoad();
55
  if (document.readyState && document.readyState === "complete") {
56
    window.setTimeout(function() { hljs.initHighlighting(); }, 0);
57
  }
58
}
59
</script>
60
61
62
63
64
65
66
67
68
69
<style type = "text/css">
70
.main-container {
71
  max-width: 940px;
72
  margin-left: auto;
73
  margin-right: auto;
74
}
75
img {
76
  max-width:100%;
77
}
78
.tabbed-pane {
79
  padding-top: 12px;
80
}
81
.html-widget {
82
  margin-bottom: 20px;
83
}
84
button.code-folding-btn:focus {
85
  outline: none;
86
}
87
summary {
88
  display: list-item;
89
}
90
details > summary > p:only-child {
91
  display: inline;
92
}
93
pre code {
94
  padding: 0;
95
}
96
</style>
97
98
99
<style type="text/css">
100
.dropdown-submenu {
101
  position: relative;
102
}
103
.dropdown-submenu>.dropdown-menu {
104
  top: 0;
105
  left: 100%;
106
  margin-top: -6px;
107
  margin-left: -1px;
108
  border-radius: 0 6px 6px 6px;
109
}
110
.dropdown-submenu:hover>.dropdown-menu {
111
  display: block;
112
}
113
.dropdown-submenu>a:after {
114
  display: block;
115
  content: " ";
116
  float: right;
117
  width: 0;
118
  height: 0;
119
  border-color: transparent;
120
  border-style: solid;
121
  border-width: 5px 0 5px 5px;
122
  border-left-color: #cccccc;
123
  margin-top: 5px;
124
  margin-right: -10px;
125
}
126
.dropdown-submenu:hover>a:after {
127
  border-left-color: #adb5bd;
128
}
129
.dropdown-submenu.pull-left {
130
  float: none;
131
}
132
.dropdown-submenu.pull-left>.dropdown-menu {
133
  left: -100%;
134
  margin-left: 10px;
135
  border-radius: 6px 0 6px 6px;
136
}
137
</style>
138
139
<script type="text/javascript">
140
// manage active state of menu based on current page
141
$(document).ready(function () {
142
  // active menu anchor
143
  href = window.location.pathname
144
  href = href.substr(href.lastIndexOf('/') + 1)
145
  if (href === "")
146
    href = "index.html";
147
  var menuAnchor = $('a[href="' + href + '"]');
148
149
  // mark the anchor link active (and if it's in a dropdown, also mark that active)
150
  var dropdown = menuAnchor.closest('li.dropdown');
151
  if (window.bootstrap) { // Bootstrap 4+
152
    menuAnchor.addClass('active');
153
    dropdown.find('> .dropdown-toggle').addClass('active');
154
  } else { // Bootstrap 3
155
    menuAnchor.parent().addClass('active');
156
    dropdown.addClass('active');
157
  }
158
159
  // Navbar adjustments
160
  var navHeight = $(".navbar").first().height() + 15;
161
  var style = document.createElement('style');
162
  var pt = "padding-top: " + navHeight + "px; ";
163
  var mt = "margin-top: -" + navHeight + "px; ";
164
  var css = "";
165
  // offset scroll position for anchor links (for fixed navbar)
166
  for (var i = 1; i <= 6; i++) {
167
    css += ".section h" + i + "{ " + pt + mt + "}\n";
168
  }
169
  style.innerHTML = "body {" + pt + "padding-bottom: 40px; }\n" + css;
170
  document.head.appendChild(style);
171
});
172
</script>
173
174
<!-- tabsets -->
175
176
<style type="text/css">
177
.tabset-dropdown > .nav-tabs {
178
  display: inline-table;
179
  max-height: 500px;
180
  min-height: 44px;
181
  overflow-y: auto;
182
  border: 1px solid #ddd;
183
  border-radius: 4px;
184
}
185
186
.tabset-dropdown > .nav-tabs > li.active:before, .tabset-dropdown > .nav-tabs.nav-tabs-open:before {
187
  content: "\e259";
188
  font-family: 'Glyphicons Halflings';
189
  display: inline-block;
190
  padding: 10px;
191
  border-right: 1px solid #ddd;
192
}
193
194
.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
195
  content: "\e258";
196
  font-family: 'Glyphicons Halflings';
197
  border: none;
198
}
199
200
.tabset-dropdown > .nav-tabs > li.active {
201
  display: block;
202
}
203
204
.tabset-dropdown > .nav-tabs > li > a,
205
.tabset-dropdown > .nav-tabs > li > a:focus,
206
.tabset-dropdown > .nav-tabs > li > a:hover {
207
  border: none;
208
  display: inline-block;
209
  border-radius: 4px;
210
  background-color: transparent;
211
}
212
213
.tabset-dropdown > .nav-tabs.nav-tabs-open > li {
214
  display: block;
215
  float: none;
216
}
217
218
.tabset-dropdown > .nav-tabs > li {
219
  display: none;
220
}
221
</style>
222
223
<!-- code folding -->
224
225
226
227
<style type="text/css">
228
229
#TOC {
230
  margin: 25px 0px 20px 0px;
231
}
232
@media (max-width: 768px) {
233
#TOC {
234
  position: relative;
235
  width: 100%;
236
}
237
}
238
239
@media print {
240
.toc-content {
241
  /* see https://github.com/w3c/csswg-drafts/issues/4434 */
242
  float: right;
243
}
244
}
245
246
.toc-content {
247
  padding-left: 30px;
248
  padding-right: 40px;
249
}
250
251
div.main-container {
252
  max-width: 1200px;
253
}
254
255
div.tocify {
256
  width: 20%;
257
  max-width: 260px;
258
  max-height: 85%;
259
}
260
261
@media (min-width: 768px) and (max-width: 991px) {
262
  div.tocify {
263
    width: 25%;
264
  }
265
}
266
267
@media (max-width: 767px) {
268
  div.tocify {
269
    width: 100%;
270
    max-width: none;
271
  }
272
}
273
274
.tocify ul, .tocify li {
275
  line-height: 20px;
276
}
277
278
.tocify-subheader .tocify-item {
279
  font-size: 0.90em;
280
}
281
282
.tocify .list-group-item {
283
  border-radius: 0px;
284
}
285
286
.tocify-subheader {
287
  display: inline;
288
}
289
.tocify-subheader .tocify-item {
290
  font-size: 0.95em;
291
}
292
293
</style>
294
295
296
297
</head>
298
299
<body>
300
301
302
<div class="container-fluid main-container">
303
304
305
<!-- setup 3col/9col grid for toc_float and main content  -->
306
<div class="row">
307
<div class="col-xs-12 col-sm-4 col-md-3">
308
<div id="TOC" class="tocify">
309
</div>
310
</div>
311
312
<div class="toc-content col-xs-12 col-sm-8 col-md-9">
313
314
315
316
317
<div class="navbar navbar-default  navbar-fixed-top" role="navigation">
318
  <div class="container">
319
    <div class="navbar-header">
320
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-bs-toggle="collapse" data-target="#navbar" data-bs-target="#navbar">
321
        <span class="icon-bar"></span>
322
        <span class="icon-bar"></span>
323
        <span class="icon-bar"></span>
324
      </button>
325
      <a class="navbar-brand" href="index.html">VoltRon</a>
326
    </div>
327
    <div id="navbar" class="navbar-collapse collapse">
328
      <ul class="nav navbar-nav">
329
        <li>
330
  <a href="tutorials.html">Explore</a>
331
</li>
332
<li class="dropdown">
333
  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
334
    Vignette
335
     
336
    <span class="caret"></span>
337
  </a>
338
  <ul class="dropdown-menu" role="menu">
339
    <li class="dropdown-submenu">
340
      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">Spatial Data Integration</a>
341
      <ul class="dropdown-menu" role="menu">
342
        <li>
343
          <a href="registration.html">Spatial Data Alignment</a>
344
        </li>
345
        <li>
346
          <a href="multiomic.html">Multi-omic Integration</a>
347
        </li>
348
        <li>
349
          <a href="nicheclustering.html">Niche Clustering</a>
350
        </li>
351
      </ul>
352
    </li>
353
    <li class="dropdown-submenu">
354
      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">Downstream Analysis</a>
355
      <ul class="dropdown-menu" role="menu">
356
        <li>
357
          <a href="roianalysis.html">ROI Analysis</a>
358
        </li>
359
        <li>
360
          <a href="spotanalysis.html">Cell/Spot Analysis</a>
361
        </li>
362
        <li>
363
          <a href="moleculeanalysis.html">Molecule Analysis</a>
364
        </li>
365
        <li>
366
          <a href="pixelanalysis.html">Pixels (Image Only) Analysis</a>
367
        </li>
368
      </ul>
369
    </li>
370
    <li class="dropdown-submenu">
371
      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">Utilities</a>
372
      <ul class="dropdown-menu" role="menu">
373
        <li>
374
          <a href="interactive.html">Interactive Utilities</a>
375
        </li>
376
        <li>
377
          <a href="importingdata.html">Importing Spatial Data</a>
378
        </li>
379
        <li>
380
          <a href="voltronobjects.html">Working with VoltRon Objects</a>
381
        </li>
382
        <li>
383
          <a href="conversion.html">Converting VoltRon Objects</a>
384
        </li>
385
        <li>
386
          <a href="ondisk.html">OnDisk-based Analysis Utilities</a>
387
        </li>
388
      </ul>
389
    </li>
390
  </ul>
391
</li>
392
      </ul>
393
      <ul class="nav navbar-nav navbar-right">
394
        <li class="dropdown">
395
  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
396
    <span class="fa fa-envelope-o"></span>
397
     
398
    Contact
399
     
400
    <span class="caret"></span>
401
  </a>
402
  <ul class="dropdown-menu" role="menu">
403
    <li>
404
      <a href="https://bioinformatics.mdc-berlin.de">Altuna Lab/BIMSB Bioinfo</a>
405
    </li>
406
    <li>
407
      <a href="https://www.mdc-berlin.de/landthaler">Landthaler Lab/BIMSB</a>
408
    </li>
409
  </ul>
410
</li>
411
<li class="dropdown">
412
  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
413
    <span class="fa fa-github"></span>
414
     
415
    GitHub
416
     
417
    <span class="caret"></span>
418
  </a>
419
  <ul class="dropdown-menu" role="menu">
420
    <li>
421
      <a href="https://github.com/BIMSBbioinfo/VoltRon">VoltRon</a>
422
    </li>
423
    <li>
424
      <a href="https://github.com/BIMSBbioinfo">BIMSB Bioinfo</a>
425
    </li>
426
  </ul>
427
</li>
428
      </ul>
429
    </div><!--/.nav-collapse -->
430
  </div><!--/.container -->
431
</div><!--/.navbar -->
432
433
<div id="header">
434
435
436
437
<h1 class="title toc-ignore">Multi-omics</h1>
438
439
</div>
440
441
442
<style>
443
.title{
444
  display: none;
445
}
446
body {
447
  text-align: justify
448
}
449
.center {
450
  display: block;
451
  margin-left: auto;
452
  margin-right: auto;
453
}
454
table, th, td {
455
  border-collapse: collapse;
456
  align-self: center;
457
  padding-right: 10px;
458
  padding-left: 10px;
459
}
460
</style>
461
<style type="text/css">
462
.watch-out {
463
  color: black;
464
}
465
</style>
466
<p><br></p>
467
<div id="label-transfer-via-registration" class="section level1">
468
<h1>Label Transfer via Registration</h1>
469
<p>VoltRon is capable of analyzing molecule-level subcellular datasets
470
independent of single cells, and specifically those that may also found
471
outside of these cells. To demonstrate how VoltRon investigates
472
extra-cellular molecules, we will make use of another Xenium in situ
473
dataset where custom Xenium probes designed to hybridize distinct open
474
reading frames of SARS-COV-2 virus molecules. These subcellular entities
475
which then can be detected both within and outside of cells which allows
476
to understand proliferation mechanics of the virus across the
477
tissue.</p>
478
<p>In this use case, we analyse readouts of <strong>eight tissue micro
479
array (TMA) tissue sections</strong> that were fitted into the scan area
480
of a slide loaded on a Xenium in situ instrument. These sections were
481
cut from <strong>control and COVID-19 lung tissues</strong> of donors
482
categorized based on disease durations (acute and prolonged). You can
483
download the standard Xenium output folder <a
484
href="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Multiomics/Xenium_SARSCOV2.zip">here</a>.</p>
485
<p>For more information on the TMA blocks, see <a
486
href="https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE190732">GSE190732</a>
487
for more information.</p>
488
<p><br></p>
489
<div id="single-cells-and-molecules" class="section level2">
490
<h2>Single Cells and Molecules</h2>
491
<p>Across these eight TMA section, we investigate a section of acute
492
case which is originated from a lung with extreme number of detected
493
open reading frames of virus molecules. For convenience, we load a
494
VoltRon object where cells are already annotated. You can also find the
495
RDS file <a
496
href="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Multiomics/acutecase1_annotated.rds">here</a>.</p>
497
<pre class="r watch-out"><code>vr2_merged_acute1 &lt;- readRDS(file = &quot;acutecase1_annotated.rds&quot;)</code></pre>
498
<p><br></p>
499
<p>Lets visualize both the UMAP and Spatial plot of the annotated
500
cells.</p>
501
<pre class="r watch-out"><code>vrEmbeddingPlot(vr2_merged_acute1, assay = &quot;Xenium&quot;, embedding = &quot;umap&quot;, 
502
                group.by = &quot;CellType&quot;, label = TRUE)
503
vrSpatialPlot(vr2_merged_acute1, assay = &quot;Xenium&quot;, group.by = &quot;CellType&quot;,
504
              plot.segments = TRUE)</code></pre>
505
<table>
506
<tbody>
507
<tr style="vertical-align: center">
508
<td style="width:45%; vertical-align: center">
509
<img src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/molecule_vrembeddingplot.png" class="center">
510
</td>
511
<td style="width:55%; vertical-align: center">
512
<img src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/molecule_visualize_celltype.png" class="center">
513
</td>
514
</tr>
515
</tbody>
516
</table>
517
<p><br></p>
518
<p>We incorporate two open reading frames (ORFs), named
519
<strong>S2_N</strong> and <strong>S2_orf1ab</strong>, which represent
520
unreplicated and replicated virus molecules, respectively. We can
521
visualize again tile the count of these virus expressions by
522
specifically selecting these two ORFs.</p>
523
<pre class="r watch-out"><code>vrSpatialPlot(vr2_merged_acute1, assay = &quot;Xenium_mol&quot;, group.by = &quot;gene&quot;, 
524
              group.ids = c(&quot;S2_N&quot;, &quot;S2_orf1ab&quot;), n.tile = 500)</code></pre>
525
<p><img width="70%" height="70%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/molecule_visualize_virus.png" class="center"></p>
526
<p><br></p>
527
<p>We can even zoom into specific locations at the tissue to investigate
528
virus particles more closely by droping the <strong>n.tile</strong>
529
argument and calling interactive visualization.</p>
530
<pre class="r watch-out"><code>vrSpatialPlot(vr2_merged_acute1, assay = &quot;Xenium_mol&quot;, group.by = &quot;gene&quot;, 
531
              group.ids = c(&quot;S2_N&quot;, &quot;S2_orf1ab&quot;), interactive = TRUE, pt.size = 0.1)</code></pre>
532
<p><img width="70%" height="70%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/molecules_visualize_virus_zoom.png" class="center"></p>
533
<p><br></p>
534
<p>In the following sections, we will integrate pathological images and
535
annotations with Xenium datasets to further understand the spatial
536
localization of virus ORF types over the tissue.</p>
537
<p><br></p>
538
</div>
539
<div id="hot-spot-analysis" class="section level2">
540
<h2>Hot Spot Analysis</h2>
541
<p>VoltRon platform allows users to find hot spots of several types of
542
spatial entities, for spots, cells, and even molecules. We first learn
543
spatial neighborhoods from molecules of interests, in this case, the
544
extracellular virus particles and their ORFs.</p>
545
<pre class="r watch-out"><code>vr2_merged_acute1</code></pre>
546
<pre><code>VoltRon Object 
547
acute case 1: 
548
  Layers: Section1 
549
Assays: Xenium(Main) Xenium_mol </code></pre>
550
<p>We switch to the molecule assay of the VoltRon object, and select
551
virus ORFs. We also look for other virus ORFs that are 50 pixel distance
552
from each virus molecule to pin point neighborhoods that are rich in
553
virus.</p>
554
<pre class="r watch-out"><code>vr2_merged_acute1 &lt;- getSpatialNeighbors(vr2_merged_acute1, assay = &quot;Xenium_mol&quot;, 
555
                                         group.by = &quot;gene&quot;, group.ids = c(&quot;S2_N&quot;, &quot;S2_orf1ab&quot;), 
556
                                         method = &quot;radius&quot;, radius = 50)</code></pre>
557
<p>We can now observe the new spatial neighborhood graph saved in the
558
VoltRon object with name <strong>radius</strong>.</p>
559
<pre class="r watch-out"><code>vrGraphNames(vr2_merged_acute1)</code></pre>
560
<pre><code>[1] &quot;radius&quot;</code></pre>
561
<p>We now select the feature type and graph name to run an hot spot
562
analysis which will label each molecule if their neighborhood are dense
563
in other virus molecules.</p>
564
<pre class="r watch-out"><code>vr2_merged_acute1 &lt;- getHotSpotAnalysis(vr2_merged_acute1, assay = &quot;Xenium_mol&quot;, 
565
                                        features = &quot;gene&quot;, graph.type = &quot;radius&quot;)
566
vrSpatialPlot(vr2_merged_acute1, assay = &quot;Xenium_mol&quot;, 
567
              group.by = &quot;gene_hotspot_flag&quot;, group.ids = c(&quot;cold&quot;, &quot;hot&quot;), 
568
              alpha = 1, background.color = &quot;white&quot;)</code></pre>
569
<p><img width="70%" height="70%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/molecule_visualize_virus_hotspot.png" class="center"></p>
570
</div>
571
<div id="automated-he-registration" class="section level2">
572
<h2>Automated H&amp;E Registration</h2>
573
<p>VoltRon can analyze and also integrate information from distinct
574
spatial data types such as images, annotations (as regions of interests,
575
i.e. ROIs) and molecules independently. Using such advanced utilities,
576
we can make use of histological information and generate new metadata
577
level information for molecule datasets.</p>
578
<p>We will first import both histological images and manual annotations
579
using the <strong>importImageData</strong> function which accepts both
580
images to generate tile/pixel level datasets but also allows one to
581
import either a list of segments or <a
582
href="https://geojson.org/">GeoJSON</a> objects for create ROI-level
583
datasets as separate assays in a single VoltRon layer. The .geojson file
584
was generated using <a href="https://qupath.github.io/">QuPath</a> on
585
the same section H&amp;E image of one Xenium section with the acute
586
COVID-19 case. We also have to flip the coordinates of ROI annotations
587
also for they were directly imported from QuPath which incorporates a
588
reverse coordinate system on the y-axis.</p>
589
<p>Once imported, the resulting VoltRon object will have two assays in a
590
single layer, one for tile dataset of the H&amp;E image and the other
591
for ROI based annotations of again the same image. You can download the
592
H&amp;E image from <a
593
href="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Multiomics/acutecase1_HE.jpg">here</a>,
594
and download the json file from <a
595
href="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Multiomics/acutecase1_membrane.geojson">here</a>.</p>
596
<pre class="r watch-out"><code># get image
597
imgdata &lt;- importImageData(&quot;acutecase1_HE.jpg&quot;, 
598
                           segments = &quot;acutecase1_membrane.geojson&quot;, 
599
                           sample_name = &quot;acute case 1 (HE)&quot;)
600
imgdata &lt;- flipCoordinates(imgdata, assay = &quot;ROIAnnotation&quot;)
601
imgdata</code></pre>
602
<pre><code>VoltRon Object 
603
acute case 1 (HE): 
604
  Layers: Section1 
605
Assays: ImageData(Main) ROIAnnotation 
606
Features: main(Main) </code></pre>
607
<p>By visualizing these annotations interactively, we can see that the
608
ROIs point to the hyaline membranes. Here, we likely find extra-cellular
609
SARS-COV-2 molecules mostly outside of any single cell.</p>
610
<pre class="r watch-out"><code>vrSpatialPlot(imgdata, assay = &quot;ROIAnnotation&quot;, group.by = &quot;Sample&quot;, 
611
              alpha = 0.7, interactive = TRUE)</code></pre>
612
<p><img width="60%" height="60%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/molecule_Covid_HE_zoom.png" class="center"></p>
613
<p><br></p>
614
<p>At a first glance, although the Xenium (DAPI) and H&amp;E images are
615
associated with the same TMA core, they were captured in a different
616
perspective; that is, one image is almost the 90 degree rotated version
617
of the other. We will account for this rotation when we (automatically)
618
align the Xenium data with the H&amp;E image.</p>
619
<pre class="r watch-out"><code>vr2_merged_acute1 &lt;- modulateImage(vr2_merged_acute1, brightness = 300, channel = &quot;DAPI&quot;)
620
vrImages(vr2_merged_acute1, assay = &quot;Assay7&quot;, scale.perc = 20)
621
vrImages(imgdata, assay = &quot;Assay1&quot;, scale.perc = 20)</code></pre>
622
<p><img width="90%" height="90%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/multiomic_twoimages.png" class="center"></p>
623
<p><br></p>
624
<p>We now register the H&amp;E image and annotations to the DAPI image
625
of Xenium section using the <strong>registerSpatialData</strong>
626
function. We select FLANN (with “Homography” method) automated
627
registration mode, negate the DAPI image of the Xenium slide, turn 90
628
degrees to the left and set the scale parameter of both images to
629
<strong>width = 1859</strong>. See <a href="registration.html">Spatial
630
Data Alignment</a> tutorial for more information.</p>
631
<pre class="r watch-out"><code>xen_reg &lt;- registerSpatialData(object_list = list(vr2_merged_acute1, imgdata))</code></pre>
632
<p><img width="90%" height="90%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/molecule_HE_registration.png" class="center"></p>
633
<p><br></p>
634
<p>Once registered, we can isolate the registered H&amp;E data and use
635
it further analysis. We can transfer images and their channels across
636
assays of one or multiple VoltRon objects. Here, we save the registered
637
image of the H&amp;E data as an additional channel of Xenium section of
638
the acuse case 1 sample with molecule data.</p>
639
<pre class="r watch-out"><code>imgdata_reg &lt;- xen_reg$registered_spat[[2]]
640
vrImages(vr2_merged_acute1[[&quot;Assay7&quot;]], name = &quot;main&quot;, channel = &quot;H&amp;E&quot;) &lt;- 
641
  vrImages(imgdata_reg, assay = &quot;Assay1&quot;, name = &quot;main_reg&quot;)
642
vrImages(vr2_merged_acute1[[&quot;Assay8&quot;]], name = &quot;main&quot;, channel = &quot;H&amp;E&quot;) &lt;- 
643
  vrImages(imgdata_reg, assay = &quot;Assay1&quot;, name = &quot;main_reg&quot;)</code></pre>
644
<p>We can now observe the new channels available for the both molecule
645
and cell-level assays of Xenium data.</p>
646
<pre class="r watch-out"><code>vrImageChannelNames(vr2_merged_acute1)</code></pre>
647
<pre><code>               Assay    Layer       Sample  Spatial Channels
648
Assay7        Xenium Section1 acute case 1     main DAPI,H&amp;E
649
Assay8    Xenium_mol Section1 acute case 1     main DAPI,H&amp;E</code></pre>
650
<p><br></p>
651
<p>You can also add the VoltRon object of H&amp;E data as an additional
652
assay of the Xenium section such that one layer includes cell,
653
molecules, ROI Annotations and images in the same time. Specifically, we
654
add the ROI annotation to the Xenium VoltRon object using the
655
<strong>addAssay</strong> function where we choose the destination
656
sample/block and the layer of the assay.</p>
657
<pre class="r watch-out"><code>vr2_merged_acute1 &lt;- addAssay(vr2_merged_acute1,
658
                              assay = imgdata_reg[[&quot;Assay2&quot;]],
659
                              metadata = Metadata(imgdata_reg, assay = &quot;ROIAnnotation&quot;),
660
                              assay_name = &quot;ROIAnnotation&quot;,
661
                              sample = &quot;acute case 1&quot;, layer = &quot;Section1&quot;)
662
vr2_merged_acute1</code></pre>
663
<pre><code>VoltRon Object 
664
acute case 1: 
665
  Layers: Section1 
666
Assays: ROIAnnotation(Main) Xenium_mol Xenium </code></pre>
667
<p><br></p>
668
</div>
669
<div id="interactive-visualization" class="section level2">
670
<h2>Interactive Visualization</h2>
671
<p>Once the H&amp;E image is registered and transfered to the Xenium
672
data, we can convert the VoltRon object into an Anndata object (h5ad
673
file) and use <a href="https://tissuumaps.github.io/">TissUUmaps</a>
674
tool for interactive visualization.</p>
675
<pre class="r watch-out"><code># convert VoltRon object to h5ad
676
as.AnnData(vr2_merged_acute1, assay = &quot;Xenium&quot;, file = &quot;vr2_merged_acute1.h5ad&quot;, 
677
           flip_coordinates = TRUE, name = &quot;main&quot;, channel = &quot;H&amp;E&quot;)</code></pre>
678
<p>To run TissUUmaps please follow installation instructions <a
679
href="https://tissuumaps.github.io/installation/">here</a>, then you can
680
simply drag and drop both the h5ad file and png file to the
681
application.</p>
682
<p><img width="90%" height="90%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/multiomic_interactivevisualization.png" class="center"></p>
683
<p><br></p>
684
</div>
685
<div id="label-transfer" class="section level2">
686
<h2>Label transfer</h2>
687
<p>Now we can transfer ROI annotations as additional metadata features
688
of the molecule assay. We will refer the new metadata column as “Region”
689
which will indicate if the molecule is within any annotated ROI in the
690
same layer.</p>
691
<pre class="r watch-out"><code>vrMainAssay(vr2_merged_acute1) &lt;- &quot;ROIAnnotation&quot;
692
vr2_merged_acute1$Region &lt;- vrSpatialPoints(vr2_merged_acute1)
693
694
# set the spatial coordinate system of ROI Annotations assay
695
vrMainSpatial(vr2_merged_acute1[[&quot;Assay9&quot;]]) &lt;- &quot;main_reg&quot;
696
697
# transfer ROI annotations to molecules
698
vr2_merged_acute1 &lt;- transferData(object = vr2_merged_acute1, from = &quot;Assay9&quot;, to = &quot;Assay8&quot;, 
699
                                  features = &quot;Region&quot;)
700
701
# Metadata of molecules
702
Metadata(vr2_merged_acute1, assay = &quot;Xenium_mol&quot;)</code></pre>
703
<div>
704
<pre><code style="font-size: 11px;">                            id assay_id overlaps_nucleus   gene       qv      Assay    Layer       Sample    Region
705
                        &lt;char&gt;   &lt;char&gt;            &lt;int&gt; &lt;char&gt;    &lt;num&gt;     &lt;char&gt;   &lt;char&gt;       &lt;char&gt;    &lt;char&gt;
706
     1: 281651070371256_cb791e   Assay8                0   ENAH 40.00000 Xenium_mol Section1 acute case 1 undefined
707
     2: 281651070371258_cb791e   Assay8                1  CD274 40.00000 Xenium_mol Section1 acute case 1 undefined
708
     3: 281651070372515_cb791e   Assay8                0  CD163 40.00000 Xenium_mol Section1 acute case 1 undefined
709
     4: 281651070374059_cb791e   Assay8                1   CTSL 33.97290 Xenium_mol Section1 acute case 1 undefined
710
     5: 281651070374411_cb791e   Assay8                0    C1S 40.00000 Xenium_mol Section1 acute case 1 undefined
711
    ---                                                                                                            
712
785787: 281874408669584_cb791e   Assay8                0  SFRP2 40.00000 Xenium_mol Section1 acute case 1 undefined
713
785788: 281874408671410_cb791e   Assay8                0   S2_N 40.00000 Xenium_mol Section1 acute case 1 undefined
714
785789: 281874408672438_cb791e   Assay8                0 S100A8 40.00000 Xenium_mol Section1 acute case 1 undefined
715
785790: 281874408673446_cb791e   Assay8                0  TIMP1 29.86642 Xenium_mol Section1 acute case 1 undefined
716
785791: 281874408673882_cb791e   Assay8                0   S2_N 40.00000 Xenium_mol Section1 acute case 1 undefined</code></pre>
717
</div>
718
<p><br></p>
719
<p>This annotations can be accessed from the default molecule level
720
metadata of the VoltRon object.</p>
721
<pre class="r watch-out"><code>vrMainAssay(vr2_merged_acute1) &lt;- &quot;Xenium_mol&quot;
722
head(table(vr2_merged_acute1$Region))</code></pre>
723
<pre><code>  ROI1_Assay9  ROI10_Assay9 ROI100_Assay9 ROI101_Assay9 ROI102_Assay9 ROI103_Assay9 
724
          583           624           784           357           215           200 </code></pre>
725
<p><br></p>
726
<p>Now we will grab these annotations from molecule metadata and
727
calculate the ratio of N to orf1ab frequency of SARS-COV-2 particles
728
across all annotated molecules.</p>
729
<pre class="r watch-out"><code>library(dplyr)
730
s2_summary_hyaline &lt;- 
731
  Metadata(vr2_merged_acute1, assay = &quot;Xenium_mol&quot;) %&gt;%
732
  filter(gene %in% c(&quot;S2_N&quot;, &quot;S2_orf1ab&quot;), 
733
         Region != &quot;undefined&quot;) %&gt;% 
734
  summarise(S2_N = sum(gene == &quot;S2_N&quot;), 
735
            S2_orf1ab = sum(gene == &quot;S2_orf1ab&quot;), 
736
            ratio = sum(gene == &quot;S2_N&quot;)/sum(gene == &quot;S2_orf1ab&quot;)) %&gt;% 
737
  as.matrix()
738
s2_summary_hyaline</code></pre>
739
<pre><code>      S2_N S2_orf1ab    ratio
740
[1,] 50977     33532 1.520249</code></pre>
741
<p><br></p>
742
</div>
743
<div id="manual-annotation" class="section level2">
744
<h2>Manual annotation</h2>
745
<p>To compare the proportion of <strong>S2_N</strong> and
746
<strong>S2_orf1ab</strong> molecules in hyaline membranes with tissue
747
sites of possible infection. We focus on another tissue niche where a
748
large accumulation of cells with high <strong>S2_N</strong> and
749
<strong>S2_orf1ab</strong> counts.</p>
750
<p>By visualizing and zooming on a spatial plot with annotated cells, we
751
can detect a site of cells with high infection which are also
752
accompanied by a group of T cells.</p>
753
<pre class="r watch-out"><code>vrSpatialPlot(vr2_merged_acute1, assay = &quot;Xenium&quot;, group.by = &quot;CellType&quot;, 
754
              group.ids = c(&quot;H.I. Cells&quot;, &quot;T cells&quot;), plot.segments = TRUE, 
755
              alpha = 0.6, spatial = &quot;main&quot;, channel = &quot;H&amp;E&quot;, interactive = TRUE)</code></pre>
756
<p><img width="80%" height="80%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/molecule_spatialplot_infected.png" class="center"></p>
757
<p><br></p>
758
<p>Now we use the <strong>annotateSpatialData</strong> function to
759
create an additional annotation of Xenium molecules directly. By
760
selecting this region of infection we can directly annotate the
761
‘Xenium_mol’ assay and the metadata of molecules. We use the H&amp;E
762
image as the background again, and generate a new molecule-level
763
metadata column called “Infected”.</p>
764
<pre class="r watch-out"><code>vr2_merged_acute1 &lt;- annotateSpatialData(vr2_merged_acute1, assay = &quot;Xenium_mol&quot;, 
765
                                         label = &quot;Region&quot;, use.image = TRUE, 
766
                                         channel = &quot;H&amp;E&quot;, annotation_assay = &quot;ROIAnnotation1&quot;)</code></pre>
767
<p><img width="80%" height="80%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/molecule_annotation_infected.png" class="center"></p>
768
<p><br></p>
769
</div>
770
<div id="visualize-annotations" class="section level2">
771
<h2>Visualize annotations</h2>
772
<p>Before visualizing the annotations and molecule localizations in the
773
same time, lets make some changes to the metadata. We basically wanna
774
change the annotation of all ROIs originated from the GeoJson file to
775
have the label <strong>Hyaline Membrane</strong>.</p>
776
<pre class="r watch-out"><code># update molecule metadata
777
vrMainAssay(vr2_merged_acute1_infected) &lt;- &quot;Xenium_mol&quot;
778
vr2_merged_acute1_infected$Region &lt;- gsub(&quot;ROI[0-9]+&quot;, &quot;Hyaline Membrane&quot;, 
779
                                          vr2_merged_acute1_infected$Region)
780
781
# update ROI metadata
782
vrMainAssay(vr2_merged_acute1_infected) &lt;- &quot;ROIAnnotation&quot;
783
vr2_merged_acute1_infected$Region &lt;- gsub(&quot;ROI[0-9]+&quot;, &quot;Hyaline Membrane&quot;, 
784
                                          vr2_merged_acute1_infected$Region)</code></pre>
785
<p>Now we can visualize two assays together. We use the
786
<strong>addSpatialLayer</strong> function to overlay molecule locations
787
with both the Hyaline Membrane and the infected region annotations.</p>
788
<pre class="r watch-out"><code>vrSpatialPlot(vr2_merged_acute1_infected, assay = &quot;Xenium_mol&quot;, group.by = &quot;gene&quot;, 
789
              group.ids = c(&quot;S2_N&quot;, &quot;S2_orf1ab&quot;), n.tile = 500) |&gt;
790
  addSpatialLayer(vr2_merged_acute1_infected, assay = &quot;ROIAnnotation&quot;, 
791
                  group.by = &quot;Region&quot;, alpha = 0.3, 
792
                  colors = list(`Hyaline Membrane` = &quot;blue&quot;, `Infected` = &quot;yellow&quot;))</code></pre>
793
<p><img width="70%" height="70%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/molecule_visualize_virus_overlay.png" class="center"></p>
794
</div>
795
<div id="comparison-of-annotations" class="section level2">
796
<h2>Comparison of annotations</h2>
797
<p>By using the newly annotated infection-associated virus molecules, we
798
can do a comparison of infected regions versus the hyaline
799
membranes.</p>
800
<pre class="r watch-out"><code>library(dplyr)
801
s2_summary_infected &lt;- 
802
  Metadata(vr2_merged_acute1, assay = &quot;Xenium_mol&quot;) %&gt;%
803
  filter(gene %in% c(&quot;S2_N&quot;, &quot;S2_orf1ab&quot;), 
804
         Region == &quot;Infected&quot;) %&gt;% 
805
  summarise(S2_N = sum(gene == &quot;S2_N&quot;), 
806
            S2_orf1ab = sum(gene == &quot;S2_orf1ab&quot;), 
807
            ratio = sum(gene == &quot;S2_N&quot;)/sum(gene == &quot;S2_orf1ab&quot;)) %&gt;% 
808
  as.matrix()
809
s2_summary_infected</code></pre>
810
<pre><code>     S2_N S2_orf1ab    ratio
811
[1,] 6376      2372 2.688027</code></pre>
812
<p>Comparison of both the ratio between the infected region and the
813
hyaline membranes show a considerable difference of the population of
814
<strong>S2_N</strong> and <strong>S2_orf1ab</strong> molecules.</p>
815
<pre class="r watch-out"><code>S2_table &lt;- matrix(c(s2_summary_hyaline[,1:2], 
816
                     s2_summary_infected[,1:2]), 
817
                   dimnames = list(Region = c(&quot;Hyaline&quot;, &quot;Infected&quot;), 
818
                                   S2 = c(&quot;N&quot;, &quot;orf1ab&quot;)),
819
                   ncol = 2,  byrow = TRUE)
820
S2_table</code></pre>
821
<pre><code>          S2
822
Region     N     orf1ab
823
  Hyaline  50977 33532 
824
  Infected 6376  2372</code></pre>
825
<p>A quick test of independance on this contingency table show a
826
significant difference of ratios across Hyaline and Infected
827
regions.</p>
828
<pre class="r watch-out"><code>fisher.test(S2_table, alternative = &quot;two.sided&quot;)</code></pre>
829
<pre><code>
830
    Fisher&#39;s Exact Test for Count Data
831
832
data:  S2_table
833
p-value &lt; 2.2e-16
834
alternative hypothesis: true odds ratio is not equal to 1
835
95 percent confidence interval:
836
 0.5382305 0.5941683
837
sample estimates:
838
odds ratio 
839
 0.5655696 </code></pre>
840
</div>
841
</div>
842
843
844
845
</div>
846
</div>
847
848
</div>
849
850
<script>
851
852
// add bootstrap table styles to pandoc tables
853
function bootstrapStylePandocTables() {
854
  $('tr.odd').parent('tbody').parent('table').addClass('table table-condensed');
855
}
856
$(document).ready(function () {
857
  bootstrapStylePandocTables();
858
});
859
860
861
</script>
862
863
<!-- tabsets -->
864
865
<script>
866
$(document).ready(function () {
867
  window.buildTabsets("TOC");
868
});
869
870
$(document).ready(function () {
871
  $('.tabset-dropdown > .nav-tabs > li').click(function () {
872
    $(this).parent().toggleClass('nav-tabs-open');
873
  });
874
});
875
</script>
876
877
<!-- code folding -->
878
879
<script>
880
$(document).ready(function ()  {
881
882
    // temporarily add toc-ignore selector to headers for the consistency with Pandoc
883
    $('.unlisted.unnumbered').addClass('toc-ignore')
884
885
    // move toc-ignore selectors from section div to header
886
    $('div.section.toc-ignore')
887
        .removeClass('toc-ignore')
888
        .children('h1,h2,h3,h4,h5').addClass('toc-ignore');
889
890
    // establish options
891
    var options = {
892
      selectors: "h1,h2,h3,h4",
893
      theme: "bootstrap3",
894
      context: '.toc-content',
895
      hashGenerator: function (text) {
896
        return text.replace(/[.\\/?&!#<>]/g, '').replace(/\s/g, '_');
897
      },
898
      ignoreSelector: ".toc-ignore",
899
      scrollTo: 0
900
    };
901
    options.showAndHide = false;
902
    options.smoothScroll = false;
903
904
    // tocify
905
    var toc = $("#TOC").tocify(options).data("toc-tocify");
906
});
907
</script>
908
909
<!-- dynamically load mathjax for compatibility with self-contained -->
910
<script>
911
  (function () {
912
    var script = document.createElement("script");
913
    script.type = "text/javascript";
914
    script.src  = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
915
    document.getElementsByTagName("head")[0].appendChild(script);
916
  })();
917
</script>
918
919
</body>
920
</html>