[413088]: / docs / multiomic.html

Download this file

921 lines (823 with data), 36.5 kB

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