[413088]: / docs / voltronobjects.html

Download this file

1055 lines (962 with data), 42.7 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
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<title>Importing Spatial Data</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">Importing Spatial Data</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="working-with-voltron-objects" class="section level1">
<h1>Working with VoltRon objects</h1>
<p>In this tutorial, we will cover some of the fundemantel built-in
functions of VoltRon to manage data, images and spatial information of
assays. Here is the list of example datasets included in the
Package.</p>
<pre class="r watch-out"><code>data(&quot;visium_data&quot;)
data(&quot;melc_data&quot;)
data(&quot;xenium_data&quot;)
data(&quot;merged_object&quot;)</code></pre>
<p><br></p>
<div id="samplemetadata" class="section level2">
<h2>Sample Metadata</h2>
<p>The sample metadata is a summarized data frame which provides
informations on assays, layers and sample (tissue blocks) included in
the VoltRon object. You can use the <strong>SampleMetadata</strong>
function to call this table. The row names are the unique assay IDs,
following assay types (e.g. Visium), layer name and Sample (typicall
tissue block with multiple layers and assays).</p>
<pre class="r watch-out"><code>SampleMetadata(visium_data)</code></pre>
<pre><code>## Assay Layer Sample
## Assay1 Visium Section1 Anterior1</code></pre>
<p><br></p>
</div>
<div id="metadata" class="section level2">
<h2>Metadata</h2>
<p>The <strong>Metadata</strong> function calls the metadata table of
the main assay type (see <a href="#assays">vrMainAssay</a>).</p>
<pre class="r watch-out"><code>Metadata(visium_data)</code></pre>
<pre><code>## id Count assay_id Assay Layer Sample
## AAAGGCTCTCGCGCCG-1_Assay1 AAAGGCTCTCGCGCCG-1_Assay1 39690 Assay1 Visium Section1 Anterior1
## AAATGGCCCGTGCCCT-1_Assay1 AAATGGCCCGTGCCCT-1_Assay1 33516 Assay1 Visium Section1 Anterior1
## AAATTACACGACTCTG-1_Assay1 AAATTACACGACTCTG-1_Assay1 12250 Assay1 Visium Section1 Anterior1
## AAGACATACGTGGTTT-1_Assay1 AAGACATACGTGGTTT-1_Assay1 31821 Assay1 Visium Section1 Anterior1
## ACCTACTATAAATCTA-1_Assay1 ACCTACTATAAATCTA-1_Assay1 41387 Assay1 Visium Section1 Anterior1
## ACGCGGGCCAAGGACA-1_Assay1 ACGCGGGCCAAGGACA-1_Assay1 48003 Assay1 Visium Section1 Anterior1</code></pre>
<p>You can also specify the assay ID or the assay type to call metadata
of a subset of spatial points.</p>
<pre class="r watch-out"><code>Metadata(visium_data, assay = &quot;Visium&quot;)
Metadata(visium_data, assay = &quot;Assay1&quot;)</code></pre>
<p>The <strong>type</strong> argument returns all spatial points of a
given spatial point type (ROI, spot, cell, molecule or tile).</p>
<pre class="r watch-out"><code>Metadata(visium_data, type = &quot;spot&quot;)</code></pre>
<p>If the type argument is specified as <strong>all</strong>. Then this
would return the VoltRon Metadata Object (vrMetadata)</p>
<pre class="r watch-out"><code>Metadata(visium_data, type = &quot;all&quot;)</code></pre>
<pre><code>## VoltRon Metadata Object
## This object includes:
## 100 spots</code></pre>
<p><br></p>
</div>
<div id="spatialpoints" class="section level2">
<h2>Spatial Points</h2>
<p>In a VoltRon object, spatial points are spatially defined entities
with coordinates, segments which are of any of five assay types (ROI,
spot, cell, molecule and tile).</p>
<p>The <strong>vrSpatialPoints</strong> function return the IDs of these
entities for further downstream operations, such as subsetting etc.</p>
<pre class="r watch-out"><code>vrSpatialPoints(visium_data)</code></pre>
<pre><code>## [1] &quot;AAAGGCTCTCGCGCCG-1_Assay1&quot; &quot;AAATGGCCCGTGCCCT-1_Assay1&quot; &quot;AAATTACACGACTCTG-1_Assay1&quot;</code></pre>
<p>You can also specify the assay ID or the assay type to call metadata
of a subset of spatial points.</p>
<pre class="r watch-out"><code>vrSpatialPoints(visium_data, assay = &quot;Visium&quot;)
vrSpatialPoints(visium_data, assay = &quot;Assay1&quot;)</code></pre>
<pre><code>## [1] &quot;AAAGGCTCTCGCGCCG-1_Assay1&quot; &quot;AAATGGCCCGTGCCCT-1_Assay1&quot; &quot;AAATTACACGACTCTG-1_Assay1&quot;</code></pre>
<p><br></p>
</div>
<div id="assays" class="section level2">
<h2>Assays</h2>
<p>The default (or main) assay of the VoltRon object is typically shown
when printed (next to the assay name says “main” in paranthesis)</p>
<pre class="r watch-out"><code>melc_data</code></pre>
<pre><code>## VoltRon Object
## control_case_3:
## Layers: Section1
## Assays: MELC(Main)
## Features: main(Main)</code></pre>
<p>You can also call/get the name of the default (or main) using the
<strong>vrMainAssay</strong> function</p>
<pre class="r watch-out"><code>vrMainAssay(melc_data)</code></pre>
<pre><code>## [1] &quot;MELC&quot;</code></pre>
<p>You can also set the main assay yourself, but only the assay types
given in the <strong>Assay</strong> column of
<strong>SampleMetadata(object)</strong>.</p>
<pre class="r watch-out"><code>SampleMetadata(melc_data)</code></pre>
<pre><code>## Assay Layer Sample
## Assay1 MELC Section1 control_case_3</code></pre>
<pre class="r watch-out"><code>vrMainAssay(melc_data) &lt;- &quot;MELC&quot;</code></pre>
<p>You can also get the assay IDs associated with the main assay using
<strong>vrAssayNames</strong> function.</p>
<pre class="r watch-out"><code>vrAssayNames(melc_data)</code></pre>
<pre><code>## [1] &quot;Assay1&quot;</code></pre>
<p>The assay type can be provided with the <strong>assay</strong>
arguement to get type specific assay IDs</p>
<pre class="r watch-out"><code>vrAssayNames(melc_data, assay = &quot;MELC&quot;)</code></pre>
<pre><code>## [1] &quot;Assay1&quot;</code></pre>
<p><br></p>
</div>
<div id="coordinates-and-segments" class="section level2">
<h2>Coordinates and Segments</h2>
<p>The <strong>vrCoordinates</strong> function is used to call the
centroids of spots, cells and all other spatial points types with
VoltRon objects.</p>
<pre class="r watch-out"><code>vrCoordinates(visium_data)</code></pre>
<pre><code>## x y z
## CCTTGACCACTTTATT-1_Assay1 463.78658 183.1497 0
## ATTTGTCTTGGGAGCT-1_Assay1 374.97419 275.8864 0
## TCACGCATTGTAGATC-1_Assay1 250.58520 319.1566 0
## CCGAGCTGTGCTTGTC-1_Assay1 474.47505 411.9449 0
## GCATGGGTACTGACGC-1_Assay1 87.10844 269.6902 0
## AGTCGGCCCAAACGAC-1_Assay1 215.00861 368.6231 0</code></pre>
<p>You can also specify the assay ID or the assay type to call
coordinates of a subset of spatial points.</p>
<pre class="r watch-out"><code>vrCoordinates(visium_data, assay = &quot;Visium&quot;)
vrCoordinates(visium_data, assay = &quot;Assay1&quot;)</code></pre>
<p><br></p>
<p>Each assay a VoltRon object may incorporate indefinite number of
coordinate systems. One can look for these coordinate systems using the
<strong>vrMainSpatial</strong> function, and select one of systems to
call coordinates (see <a href="#image">vrMainSpatial</a>)</p>
<pre class="r watch-out"><code>vrCoordinates(visium_data, spatial_name = &quot;main&quot;)</code></pre>
<p>The <strong>reg</strong> option in the <strong>vrCoordinates</strong>
function looks for a registered version of the main coordinate system
and returns its coordinates (if there is any).</p>
<pre class="r watch-out"><code>vrCoordinates(visium_data, spatial_name = &quot;main&quot;, reg = TRUE)</code></pre>
<pre><code>## Warning in .local(object, ...): There are no registered spatial systems with name main!</code></pre>
<pre><code>## x y z
## CCTTGACCACTTTATT-1_Assay1 463.78658 183.1497 0
## ATTTGTCTTGGGAGCT-1_Assay1 374.97419 275.8864 0
## TCACGCATTGTAGATC-1_Assay1 250.58520 319.1566 0
## CCGAGCTGTGCTTGTC-1_Assay1 474.47505 411.9449 0
## GCATGGGTACTGACGC-1_Assay1 87.10844 269.6902 0
## AGTCGGCCCAAACGAC-1_Assay1 215.00861 368.6231 0</code></pre>
<p><br></p>
<p>The arguements of the <strong>vrSegments</strong> functions are
idential to vrCoordinates and return a list of polygon corners
associated with the coordinate system of the coordinates.</p>
<pre class="r watch-out"><code>vrSegments(xenium_data)
vrSegments(xenium_data, assay = &quot;Xenium&quot;)
vrSegments(xenium_data, assay = &quot;Assay1&quot;)
vrSegments(xenium_data, spatial_name = &quot;main&quot;)
vrSegments(xenium_data, spatial_name = &quot;main&quot;, reg = TRUE)</code></pre>
<pre><code>## $`171_Assay1`
## id x y
## 1 171 105.25 145.50
## 2 171 101.75 144.25
## 3 171 101.50 143.25
## 4 171 109.75 135.25
## 5 171 112.00 127.00
## 6 171 115.50 123.50
## 7 171 120.00 123.50
## 8 171 124.25 132.50
## 9 171 121.00 136.00
## 10 171 120.25 140.00
## 11 171 111.25 143.50
## 12 171 105.50 145.25
## 13 171 105.25 145.50
##
## $`180_Assay1`
## id x y
## 14 180 148.25 153.25
## 15 180 145.75 151.50
## 16 180 143.25 147.50
## 17 180 143.25 146.25
## 18 180 143.00 144.50
## 19 180 142.50 140.50
## 20 180 144.25 140.50
## 21 180 146.25 140.75
## 22 180 148.50 141.00
## 23 180 151.00 144.75
## 24 180 150.50 150.00
## 25 180 148.75 153.25
## 26 180 148.25 153.25</code></pre>
<p><br></p>
</div>
<div id="image" class="section level2">
<h2>Images and Coordinate Systems</h2>
<p>Below we review some of the essential built-in functions to
manipulate and manage images of a VoltRon object as well as the
coordinate systems that are associated with these images.</p>
<p><br></p>
<div id="spatial-coordinate-systems" class="section level3">
<h3>Spatial Coordinate Systems</h3>
<p>In a VoltRon object, each image has a unique ID which is also
associated with a coordinate (or spatial) system. The names of these
spatial systems can be called using the <strong>vrSpatialNames</strong>
function.</p>
<pre class="r watch-out"><code>vrSpatialNames(visium_data)</code></pre>
<pre><code>## [1] &quot;main&quot;</code></pre>
<p>You can also specify the assay ID or the assay type to call image
names of a subset assays or any assay type (see <a
href="#samplemetadata">Sample Metadata</a>)</p>
<pre class="r watch-out"><code>vrSpatialNames(visium_data, assay = &quot;Visium&quot;)
vrSpatialNames(visium_data, assay = &quot;Assay1&quot;)</code></pre>
<pre><code>## [1] &quot;main&quot;</code></pre>
<p><br></p>
<p>If you wanna see the list of all spatial systems associated with all
assays of the main assay type, you can call the
<strong>vrMainSpatial</strong> function.</p>
<pre class="r watch-out"><code>vrMainSpatial(visium_data)</code></pre>
<pre><code>## Assay Spatial
## 1 Assay1 main</code></pre>
<p>You can also specify the assay ID or the assay type to call spatial
system names of a subset assays or any assay type (see <a
href="#samplemetadata">Sample Metadata</a>)</p>
<pre class="r watch-out"><code>vrMainSpatial(visium_data, assay = &quot;Visium&quot;)
vrMainSpatial(visium_data, assay = &quot;Assay1&quot;)</code></pre>
<pre><code>## Assay Spatial
## 1 Assay1 main</code></pre>
<p><br></p>
</div>
<div id="channel-names" class="section level3">
<h3>Channel Names</h3>
<p>Each spatial system object (vrSpatial) in VoltRon object can also
include a indefinite number of channels which you can get (or request) a
list of for further use.</p>
<pre class="r watch-out"><code>vrImageChannelNames(melc_data)
vrImageChannelNames(melc_data, assay = &quot;MELC&quot;)
vrImageChannelNames(melc_data, assay = &quot;Assay1&quot;)</code></pre>
<pre><code>## Assay Layer Sample Spatial Channels
## Assay1 MELC Section1 control_case_3 MELC DAPI,CD45</code></pre>
<p><br></p>
</div>
<div id="get-and-set-images" class="section level3">
<h3>Get and Set Images</h3>
<p>In VoltRon, images can be called specifically, or return as a list.
The return image is of a magick image object (see <a
href="https://cran.r-project.org/web/packages/magick/vignettes/intro.html">magick</a>
package)</p>
<pre class="r watch-out"><code>vrImages(visium_data)
vrImages(visium_data, assay = &quot;Visium&quot;)
vrImages(visium_data, assay = &quot;Assay1&quot;)</code></pre>
<p><img src="voltronobjects_files/figure-html/unnamed-chunk-36-1.png" width="60%" style="display: block; margin: auto;" /></p>
<!-- <img width="50%" height="50%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/voltronobjects_HE.png" class="center"> -->
<p><br></p>
<p>Once you know the name of a specific channel, you can the image of a
specific channel by providing the name and the associated channel.</p>
<pre class="r watch-out"><code>vrImages(melc_data, name = &quot;MELC&quot;, channel = &quot;DAPI&quot;)</code></pre>
<p><img src="voltronobjects_files/figure-html/unnamed-chunk-38-1.png" width="60%" style="display: block; margin: auto;" /></p>
<!-- <img width="50%" height="50%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/importdata_DAPI.png" class="center"> -->
<p><br></p>
<p>You can set up the main channel as well as the main spatial system
name for later use.</p>
<pre class="r watch-out"><code>vrMainSpatial(melc_data, assay = &quot;Assay1&quot;) &lt;- c(&quot;MELC&quot;, &quot;CD45&quot;)
vrImages(melc_data)</code></pre>
<p><img src="voltronobjects_files/figure-html/unnamed-chunk-40-1.png" width="60%" style="display: block; margin: auto;" /></p>
<!-- <img width="50%" height="50%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/importdata_CD45.png" class="center"> -->
<p><br></p>
<p>You can also resize the images as they are being returned. This is
usually used for visualization purposes and helps speeding up
visualization for large images. This is accomplished with
<strong>scale.perc</strong> arguement.</p>
<pre class="r watch-out"><code>vrImages(melc_data, scale.perc = 25)</code></pre>
<p><br></p>
</div>
<div id="combining-image-channels" class="section level3">
<h3>Combining Image Channels</h3>
<p>VoltRon even allows manipulation of channel images if you also
provide an associate list of colors.</p>
<pre class="r watch-out"><code>melc_data &lt;- combineChannels(melc_data,
channels = c(&quot;DAPI&quot;, &quot;CD45&quot;), colors = c(&quot;grey&quot;, &quot;green&quot;),
channel_key = &quot;combined&quot;)</code></pre>
<p>These new images can be stored as new channels within the same image
object, and called later again</p>
<pre class="r watch-out"><code>vrImageChannelNames(melc_data)</code></pre>
<pre><code>## Assay Layer Sample Spatial Channels
## Assay1 MELC Section1 control_case_3 MELC DAPI,CD45,combined</code></pre>
<pre class="r watch-out"><code>vrImages(melc_data, channel = &quot;combined&quot;)</code></pre>
<p><img src="voltronobjects_files/figure-html/unnamed-chunk-45-1.png" width="60%" style="display: block; margin: auto;" /></p>
<p><br></p>
</div>
</div>
<div id="feature-matrix-data" class="section level2">
<h2>Feature Matrix (Data)</h2>
<pre class="r watch-out"><code>vrData(visium_data)[3:8,3:5]</code></pre>
<pre><code>## AAATTACACGACTCTG-1_Assay1 AAGACATACGTGGTTT-1_Assay1 ACCTACTATAAATCTA-1_Assay1
## Gm19938 0 0 0
## Gm37381 0 0 0
## Rp1 0 0 0
## Sox17 0 1 1
## Gm37587 0 0 0
## Gm37323 0 0 0</code></pre>
<pre class="r watch-out"><code>vrData(visium_data, norm = TRUE)[3:8,3:5]</code></pre>
<pre><code>## AAATTACACGACTCTG-1_Assay1 AAGACATACGTGGTTT-1_Assay1 ACCTACTATAAATCTA-1_Assay1
## Gm19938 0 0.0000000 0.0000000
## Gm37381 0 0.0000000 0.0000000
## Rp1 0 0.0000000 0.0000000
## Sox17 0 0.2732722 0.2164184
## Gm37587 0 0.0000000 0.0000000
## Gm37323 0 0.0000000 0.0000000</code></pre>
<p><br></p>
</div>
<div id="embedding" class="section level2">
<h2>Embeddings</h2>
<p>You can parse and even set individual embedding elements in a VoltRon
object.</p>
<pre class="r watch-out"><code>vrEmbeddingNames(xenium_data)</code></pre>
<pre><code>## [1] &quot;pca&quot; &quot;umap&quot;</code></pre>
<p>You can use these names of get the associated embedding dataset from
the object.</p>
<pre class="r watch-out"><code>vrEmbeddings(xenium_data, type = &quot;umap&quot;)</code></pre>
<pre><code>## x y
## 171_Assay1 -7.110343 0.451607
## 180_Assay1 5.333756 3.896294
## 182_Assay1 3.805085 4.581084
## 185_Assay1 5.330851 3.870111
## 197_Assay1 -4.397479 2.763229
## 206_Assay1 -1.753468 3.973698</code></pre>
<p>You can also set and create new embedding elements in the voltron
object. In this case, you have to make sure that the row names should
match with the targeted spatial points.</p>
<pre class="r watch-out"><code>new_umap_data &lt;- vrEmbeddings(xenium_data, type = &quot;umap&quot;)
vrEmbeddings(xenium_data, type = &quot;new_umap&quot;) &lt;- new_umap_data*2</code></pre>
<p>Now we can observe changes to the new embedding data.</p>
<pre class="r watch-out"><code>vrEmbeddings(xenium_data, type = &quot;new_umap&quot;)</code></pre>
<pre><code>## x y
## 171_Assay1 -14.220687 0.903214
## 180_Assay1 10.667511 7.792587
## 182_Assay1 7.610170 9.162168
## 185_Assay1 10.661703 7.740223
## 197_Assay1 -8.794958 5.526458
## 206_Assay1 -3.506937 7.947396</code></pre>
<p>You can choose individual assay names or assay classes.</p>
<pre class="r watch-out"><code>vrEmbeddings(xenium_data, type = &quot;umap&quot;, assay = &quot;Xenium&quot;)
vrEmbeddings(xenium_data, type = &quot;pca&quot;, assay = &quot;Assay1&quot;)</code></pre>
<p><br></p>
</div>
<div id="subsetting-voltron-objects" class="section level2">
<h2>Subsetting VoltRon objects</h2>
<p><br></p>
<div id="sampleassay" class="section level3">
<h3>sample/assay</h3>
<p>VoltRon object can be subsetted in a variety of ways using assay
names, sample names, spatial point names, features (e.g. gene), image
coordinates (crop boxes or bounding boxes) as well as interactively.</p>
<pre class="r watch-out"><code>visium_data_subset &lt;- subset(visium_data, assays = &quot;Assay1&quot;)</code></pre>
<pre class="r watch-out"><code>visium_data_subset &lt;- subset(visium_data, samples = &quot;Anterior1&quot;)
visium_data_subset</code></pre>
<pre><code>## VoltRon Object
## Anterior1:
## Layers: Section1
## Assays: Visium(Main)
## Features: RNA(Main)</code></pre>
<p><br></p>
</div>
<div id="spatial-points" class="section level3">
<h3>spatial points</h3>
<p>You can use a list of spatial points (typically using
<strong>vrSpatialPoints</strong> function, see <a
href="#spatialpoints">vrSpatialPoints</a>)</p>
<pre class="r watch-out"><code>selected_points &lt;- vrSpatialPoints(visium_data)
selected_points[1:20]</code></pre>
<pre><code>## [1] &quot;AAAGGCTCTCGCGCCG-1_Assay1&quot; &quot;AAATGGCCCGTGCCCT-1_Assay1&quot; &quot;AAATTACACGACTCTG-1_Assay1&quot;</code></pre>
<pre class="r watch-out"><code>visium_data_subset &lt;- subset(visium_data, spatialpoints = selected_points[1:20])
visium_data_subset</code></pre>
<pre><code>## VoltRon Object
## Anterior1:
## Layers: Section1
## Assays: Visium(Main)
## Features: RNA(Main)</code></pre>
<p><br></p>
</div>
<div id="features" class="section level3">
<h3>features</h3>
<p>You can select a few number of features and subset the features given
this list. However, it would only subset the main assay (see <a
href="#assays">vrMainAssay</a>)</p>
<pre class="r watch-out"><code>selected_features &lt;- vrFeatures(visium_data)
selected_features[1:20]</code></pre>
<pre><code>## [1] &quot;Xkr4&quot; &quot;Gm1992&quot; &quot;Gm19938&quot; &quot;Gm37381&quot; &quot;Rp1&quot; &quot;Sox17&quot; &quot;Gm37587&quot; &quot;Gm37323&quot; &quot;Mrpl15&quot; &quot;Lypla1&quot;
## [11] &quot;Tcea1&quot; &quot;Rgs20&quot; &quot;Gm16041&quot; &quot;Atp6v1h&quot; &quot;Oprk1&quot; &quot;Npbwr1&quot; &quot;Rb1cc1&quot; &quot;4732440D04Rik&quot; &quot;Alkal1&quot; &quot;St18&quot;</code></pre>
<pre class="r watch-out"><code>visium_data_subset &lt;- subset(visium_data, features = selected_features[1:20])
vrFeatures(visium_data_subset)</code></pre>
<pre><code>## [1] &quot;Xkr4&quot; &quot;Gm1992&quot; &quot;Gm19938&quot; &quot;Gm37381&quot; &quot;Rp1&quot; &quot;Sox17&quot; &quot;Gm37587&quot; &quot;Gm37323&quot; &quot;Mrpl15&quot; &quot;Lypla1&quot;
## [11] &quot;Tcea1&quot; &quot;Rgs20&quot; &quot;Gm16041&quot; &quot;Atp6v1h&quot; &quot;Oprk1&quot; &quot;Npbwr1&quot; &quot;Rb1cc1&quot; &quot;4732440D04Rik&quot; &quot;Alkal1&quot; &quot;St18&quot;</code></pre>
<p><br></p>
</div>
<div id="interactive-subsetting" class="section level3">
<h3>Interactive subsetting</h3>
<p>VoltRon allows interactively subsetting spatial data. Using the
arguement <strong>interactive = TRUE</strong>, a mini Shiny app is
triggered where users can select a bounding box to crop the spatial
data.</p>
<pre class="r watch-out"><code>visium_data_subset_info &lt;- subset(visium_data, interactive = TRUE)
visium_data_subset &lt;- visium_data_subset_info$subsets[[1]]</code></pre>
<pre><code>VoltRon Object
Anterior1_subset:
Layers: Section1
Assays: Visium(Main) </code></pre>
<pre class="r watch-out"><code>vrImages(visium_data_subset)</code></pre>
<p><br></p>
</div>
</div>
<div id="visualization" class="section level2">
<h2>Visualization</h2>
<p>VoltRon provides visualization utilities for both spatial and
embedding level visualizations.</p>
<p><br></p>
<div id="spatial-plots" class="section level3">
<h3>Spatial Plots</h3>
<p><strong>vrSpatialPlot</strong> is the main function for visualize
labels and identities of cells. This information is parsed from the
Metadata of the main assay (see <a href="#assays">vrMainAssay</a>). The
users can also specify the assay.</p>
<pre class="r watch-out"><code>vrSpatialPlot(xenium_data, group.by = &quot;clusters&quot;)</code></pre>
<p><img width="50%" height="50%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/voltronobjects_sp.png" class="center"></p>
<p><br></p>
<p>You can also visualize the segments of spatial points and even get
the segments transparent</p>
<pre class="r watch-out"><code>vrSpatialPlot(xenium_data, group.by = &quot;clusters&quot;, plot.segments = TRUE, alpha = 0.6)</code></pre>
<p><img width="50%" height="50%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/voltronobjects_spsegment.png" class="center"></p>
<p><br></p>
<p>The background color can be set to any color.</p>
<pre class="r watch-out"><code>vrSpatialPlot(xenium_data, group.by = &quot;clusters&quot;, plot.segments = TRUE,
background.color = &quot;white&quot;)</code></pre>
<p><img width="50%" height="50%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/voltronobjects_spback.png" class="center"></p>
<p><br></p>
<p>In cases where there are multiple coordinate systems, you can get the
background set to the name of the image (or coordinate system). You can
get the name of these images from <a
href="#image">vrSpatialNames</a>.</p>
<p>If also want to select a channel from the same coordinate system, you
can set background arguement as a vector of 2 where first is the name of
the image (coordinate system) and the other would be channel name. You
can get the name of these channels from <a
href="#image">vrImageChannelNames</a>.</p>
<pre class="r watch-out"><code>vrSpatialPlot(xenium_data, group.by = &quot;clusters&quot;, plot.segments = TRUE,
spatial = &quot;main&quot;)
vrSpatialPlot(xenium_data, group.by = &quot;clusters&quot;, plot.segments = TRUE,
spatial = &quot;main&quot;, channel = &quot;DAPI&quot;)</code></pre>
<p><br></p>
<p>If the visualized assay is of a type “spot”, you can crop the image
to encapsulate the smallest subset that include all spots.</p>
<pre class="r watch-out"><code>vrSpatialPlot(visium_data, group.by = &quot;Sample&quot;, crop = TRUE)</code></pre>
<p><img width="50%" height="50%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/voltronobjects_spcrop.png" class="center"></p>
<p><br></p>
<p>The <strong>vrSpatialFeaturePlot</strong> functions the same way as
vrSpatialPlot but requires extra arguements such as
<strong>features</strong> for selecting features, <strong>norm</strong>
for normalized expression (default), and <strong>log</strong> for log
transformed counts.</p>
<pre class="r watch-out"><code>vrSpatialFeaturePlot(visium_data, features = &quot;Count&quot;)
vrSpatialFeaturePlot(visium_data, features = &quot;Stat1&quot;, norm = TRUE)</code></pre>
<p><img width="100%" height="100%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/voltronobjects_spfeature.png" class="center"></p>
<p><br></p>
<p>For all variations of <strong>vrSpatialPlot</strong> and
<strong>vrSpatialFeaturePlot</strong> functions above, you can specifiy
the assay names or assay class.</p>
<pre class="r watch-out"><code>vrSpatialPlot(visium_data, assay = &quot;Visium&quot;, plot.segments = TRUE)
vrSpatialPlot(visium_data, assay = &quot;Assay1&quot;, plot.segments = TRUE)
vrSpatialFeaturePlot(visium_data, assay = &quot;Visium&quot;, features = &quot;Count&quot;)
vrSpatialFeaturePlot(visium_data, assay = &quot;Assay1&quot;, features = &quot;Count&quot;)</code></pre>
<p><br></p>
</div>
<div id="spatial-plots-multi-layer" class="section level3">
<h3>Spatial Plots (Multi-Layer)</h3>
<p><strong>vrSpatialPlot</strong> function can be paired with the
<strong>addSpatialLayer</strong> function to add additional assays of
the same spatial coordinate system as the original assay. We use the
piping operator “|&gt;” to connect to functions which overlays the
results of the first image with the second.
<strong>addSpatialLayer</strong> will check if two assays are within the
same tissue block and coordinate system, and will overlay these assays
if thats the case.</p>
<p>This utility can be used to visualize molecules along with cell
segments. Here we can also color each individual molecule (gene)
type.</p>
<pre class="r watch-out"><code>library(ggnewscale)</code></pre>
<pre class="r watch-out"><code>vrSpatialPlot(merged_object, plot.segments = TRUE, group.by = &quot;clusters&quot;) |&gt;
addSpatialLayer(merged_object, assay = &quot;Assay2&quot;, group.by = &quot;gene&quot;, alpha = 1,
colors = list(KRT15 = &quot;blue&quot;, KRT14 = &quot;green&quot;))</code></pre>
<pre><code>## Warning: Duplicated `override.aes` is ignored.</code></pre>
<p><img src="voltronobjects_files/figure-html/unnamed-chunk-73-1.png" width="60%" style="display: block; margin: auto;" /></p>
<p><br></p>
<p>You can also visualize the segments that represents annotations of
the tissue sections along with the cells.</p>
<pre class="r watch-out"><code>vrSpatialPlot(merged_object, plot.segments = FALSE, group.by = &quot;clusters&quot;) |&gt;
addSpatialLayer(merged_object, assay = &quot;Assay3&quot;, group.by = &quot;Region&quot;, alpha = 0.3,
color = list(Region1 = &quot;blue&quot;, Region2 = &quot;yellow&quot;))</code></pre>
<pre><code>## Warning: Duplicated `override.aes` is ignored.</code></pre>
<p><img src="voltronobjects_files/figure-html/unnamed-chunk-74-1.png" width="60%" style="display: block; margin: auto;" /></p>
<p><br></p>
</div>
<div id="embedding-plots" class="section level3">
<h3>Embedding Plots</h3>
<p>Dimensional reduction and embedding features are also possible for
the VoltRon objects.</p>
<pre class="r watch-out"><code>vrEmbeddingPlot(xenium_data, embedding = &quot;umap&quot;, group.by = &quot;clusters&quot;, label = T)</code></pre>
<p><img width="50%" height="50%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/voltronobjects_embed.png" class="center"></p>
<p><br></p>
<p>The <strong>vrEmbeddingFeaturePlot</strong> functions the same way as
vrEmbeddingPlot but requires extra arguements such as
<strong>features</strong> for selecting features, <strong>norm</strong>
for normalized expression (default), and <strong>log</strong> for log
transformed counts.</p>
<pre class="r watch-out"><code>vrEmbeddingFeaturePlot(xenium_data, embedding = &quot;umap&quot;, features = &quot;Count&quot;)
vrEmbeddingFeaturePlot(xenium_data, embedding = &quot;umap&quot;, features = &quot;KRT5&quot;, norm = FALSE)</code></pre>
<p><img width="100%" height="100%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/voltronobjects_embedfeature.png" class="center"></p>
<p><br></p>
<p>For all variations of <strong>vrEmbeddingPlot</strong> and
<strong>vrEmbeddingFeaturePlot</strong> functions above, you can
specifiy the assay names or assay class.</p>
<pre class="r watch-out"><code>vrEmbeddingPlot(xenium_data, assay = &quot;Xenium&quot;, embedding = &quot;umap&quot;)
vrEmbeddingPlot(xenium_data, assay = &quot;Assay1&quot;, embedding = &quot;umap&quot;)
vrEmbeddingFeaturePlot(xenium_data, assay = &quot;Xenium&quot;, embedding = &quot;umap&quot;, features = &quot;Count&quot;)
vrEmbeddingFeaturePlot(xenium_data, assay = &quot;Assay1&quot;, embedding = &quot;umap&quot;, features = &quot;Count&quot;)</code></pre>
</div>
</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>