|
a |
|
b/docs/conversion.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>Conversion</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">Conversion</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 |
</style> |
|
|
455 |
<style type="text/css"> |
|
|
456 |
.watch-out { |
|
|
457 |
color: black; |
|
|
458 |
} |
|
|
459 |
</style> |
|
|
460 |
<p><br></p> |
|
|
461 |
<div id="conversion-to-other-platforms" class="section level1"> |
|
|
462 |
<h1>Conversion to Other Platforms</h1> |
|
|
463 |
<p>VoltRon is capable of end-to-end spatial data analysis for all levels |
|
|
464 |
of spatial resolutions, including those of single cell resolution. |
|
|
465 |
However, VoltRon provides a ecosystem friendly infrastructure where |
|
|
466 |
VoltRon objects could be transformed into data structures used by |
|
|
467 |
popular computational platforms such as <a |
|
|
468 |
href="https://satijalab.org/seurat/">Seurat</a>, <a |
|
|
469 |
href="https://squidpy.readthedocs.io/en/stable/">Squidpy</a> and even <a |
|
|
470 |
href="http://vitessce.io/docs/data-file-types/#anndata-zarr">Zarr</a> |
|
|
471 |
for interactive spatial data visualizatiob with <a |
|
|
472 |
href="http://vitessce.io/">Vitessce</a>.</p> |
|
|
473 |
<p>For both <strong>Seurat (R)</strong> and <strong>Squidpy |
|
|
474 |
(Python)</strong>, we analyse readouts of the experiments conducted on |
|
|
475 |
example tissue sections analysed by the <a |
|
|
476 |
href="https://www.10xgenomics.com/platforms/xenium">Xenium In Situ</a> |
|
|
477 |
platform. For more information on processing and analyzing Xenium |
|
|
478 |
datasets, check the <a href="spotanalysis.html">Cell/Spot Analysis</a> |
|
|
479 |
tutorial.</p> |
|
|
480 |
<p><br></p> |
|
|
481 |
<div id="seurat" class="section level2"> |
|
|
482 |
<h2>Seurat</h2> |
|
|
483 |
<p>We will first see how we can transform VoltRon objects into Seurat |
|
|
484 |
object and use built-in functions such as |
|
|
485 |
<strong>FindAllMarkers</strong> to visualize marker genes of clusters |
|
|
486 |
found by VoltRon. You can find the clustered Xenium data using VoltRon |
|
|
487 |
<a |
|
|
488 |
href="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Cellanalysis/Xenium/Xenium_data_clustered.rds">here</a>.</p> |
|
|
489 |
<pre class="r watch-out"><code>Xen_data <- readRDS("Xenium_data_clustered.rds") |
|
|
490 |
SampleMetadata(Xen_data)</code></pre> |
|
|
491 |
<pre><code> Assay Layer Sample |
|
|
492 |
Assay1 Xenium Section1 XeniumR1 |
|
|
493 |
Assay3 Xenium Section1 XeniumR2</code></pre> |
|
|
494 |
<p><br></p> |
|
|
495 |
<p>We use the <strong>as.Seurat</strong> function to convert spatial |
|
|
496 |
assays of VoltRon into Seurat objects. Here, a Seurat object defines |
|
|
497 |
spatial components of cellular and subcellular assays as |
|
|
498 |
<strong>FOV</strong> objects, and we use the <strong>type = |
|
|
499 |
“image”</strong> argument to convert spatial coordinates of cells and |
|
|
500 |
molecules into individual FOV objects for each Xenium assay/layer in the |
|
|
501 |
VoltRon object.</p> |
|
|
502 |
<p>Please check the <a |
|
|
503 |
href="https://satijalab.org/seurat/articles/seurat5_spatial_vignette_2">Analysis |
|
|
504 |
of Image-based Spatial Data in Seurat</a> tutorial for more information |
|
|
505 |
on analyzing FOV-based spatial data sets with Seurat.</p> |
|
|
506 |
<p>note: Use VoltRon::as.Seurat to avoid conflict with Seurat package’s |
|
|
507 |
as.Seurat function</p> |
|
|
508 |
<pre class="r watch-out"><code>library(Seurat) |
|
|
509 |
Xen_data_seu <- VoltRon::as.Seurat(Xen_data, cell.assay = "Xenium", type = "image") |
|
|
510 |
Xen_data_seu <- NormalizeData(Xen_data_seu) |
|
|
511 |
Xen_data_seu</code></pre> |
|
|
512 |
<pre><code>An object of class Seurat |
|
|
513 |
313 features across 283298 samples within 1 assay |
|
|
514 |
Active assay: Xenium (313 features, 0 variable features) |
|
|
515 |
1 layers present: counts |
|
|
516 |
2 dimensional reductions calculated: pca, umap |
|
|
517 |
2 spatial fields of view present: fov_Assay1 fov_Assay3</code></pre> |
|
|
518 |
<p><br></p> |
|
|
519 |
<div id="marker-analysis" class="section level3"> |
|
|
520 |
<h3>Marker Analysis</h3> |
|
|
521 |
<p>Now that we converted VoltRon into a Seurat object, we can pick the |
|
|
522 |
<strong>Clusters</strong> metadata column indicating the clustering of |
|
|
523 |
cells and test for marker genes of each individual cluster.</p> |
|
|
524 |
<pre class="r watch-out"><code>Idents(Xen_data_seu) <- "Clusters" |
|
|
525 |
markers <- FindAllMarkers(Xen_data_seu) |
|
|
526 |
head(markers[order(markers$avg_log2FC, decreasing = TRUE),])</code></pre> |
|
|
527 |
<div> |
|
|
528 |
<pre><code style="font-size: 13px;"> p_val avg_log2FC pct.1 pct.2 p_val_adj cluster gene |
|
|
529 |
CPA3 0 7.343881 0.977 0.029 0 16 CPA3 |
|
|
530 |
CTSG 0 7.114698 0.878 0.011 0 16 CTSG |
|
|
531 |
LILRA4.1 0 6.992717 0.939 0.015 0 19 LILRA4 |
|
|
532 |
ADIPOQ 0 6.860190 0.974 0.025 0 5 ADIPOQ |
|
|
533 |
MS4A1 0 6.763083 0.919 0.027 0 17 MS4A1 |
|
|
534 |
BANK1 0 6.082192 0.889 0.037 0 17 BANK1</code></pre> |
|
|
535 |
</div> |
|
|
536 |
<p><br></p> |
|
|
537 |
</div> |
|
|
538 |
<div id="visualization" class="section level3"> |
|
|
539 |
<h3>Visualization</h3> |
|
|
540 |
<p>We can now pick top positive markers from each of these clusters |
|
|
541 |
prior to visualization.</p> |
|
|
542 |
<pre class="r watch-out"><code>library(dplyr) |
|
|
543 |
topmarkers <- markers %>% |
|
|
544 |
group_by(cluster) %>% |
|
|
545 |
top_n(n = 5, wt = avg_log2FC)</code></pre> |
|
|
546 |
<p>Here, VoltRon incorporates the unique markers learned by the |
|
|
547 |
<strong>FindAllMarkers</strong> function from Seurat and uses them to |
|
|
548 |
visualize the expression of these markers on heatmaps, and now we can |
|
|
549 |
also use these markers for annotating the clusters.</p> |
|
|
550 |
<pre class="r watch-out"><code>library(ComplexHeatmap) |
|
|
551 |
marker_features <- unique(topmarkers$gene) |
|
|
552 |
vrHeatmapPlot(Xen_data, features = marker_features, group.by = "Clusters", |
|
|
553 |
show_row_names = TRUE, font.size = 10)</code></pre> |
|
|
554 |
<p><img width="100%" height="100%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/conversions_seurat_heatmap.png" class="center"></p> |
|
|
555 |
<p><br></p> |
|
|
556 |
</div> |
|
|
557 |
<div id="convert-with-molecule-data" class="section level3"> |
|
|
558 |
<h3>Convert with Molecule Data</h3> |
|
|
559 |
<p>If defined, the <strong>as.Seurat</strong> function may also convert |
|
|
560 |
the molecule assay of the VoltRon object into a Seurat FOV object and |
|
|
561 |
allow visualizing molecules. You can find the Xenium VoltRon object with |
|
|
562 |
the molecule assay <a |
|
|
563 |
href="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Cellanalysis/Xenium/Xen_R1.rds">here</a>.</p> |
|
|
564 |
<pre class="r watch-out"><code>Xen_R1 <- readRDS("Xen_R1.rds") |
|
|
565 |
SampleMetadata(Xen_R1)</code></pre> |
|
|
566 |
<pre><code> Assay Layer Sample |
|
|
567 |
Assay1 Xenium Section1 XeniumR1 |
|
|
568 |
Assay2 Xenium_mol Section1 XeniumR1</code></pre> |
|
|
569 |
<p><br></p> |
|
|
570 |
<p>We define both the cell level assay and the molecule level assay.</p> |
|
|
571 |
<pre class="r watch-out"><code>Xen_R1_seu <- as.Seurat(Xen_R1, cell.assay = "Xenium", molecule.assay = "Xenium_mol", type = "image")</code></pre> |
|
|
572 |
<p><br></p> |
|
|
573 |
<p>Now we can visualize molecules alongside with cells.</p> |
|
|
574 |
<pre class="r watch-out"><code>ImageDimPlot(Xen_R1_seu, fov = "fovAssay1", molecules = "PGR", group.by = "orig.ident", cols = "lightgrey", mols.size = 1)</code></pre> |
|
|
575 |
<p><img width="60%" height="60%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/conversions_seurat_imagedimplot.png" class="center"></p> |
|
|
576 |
<p><br></p> |
|
|
577 |
</div> |
|
|
578 |
</div> |
|
|
579 |
<div id="spatialexperiment" class="section level2"> |
|
|
580 |
<h2>SpatialExperiment</h2> |
|
|
581 |
<p>VoltRon can also convert objects in <a |
|
|
582 |
href="https://www.bioconductor.org/packages/release/bioc/html/SpatialExperiment.html">SpatialExperiment</a> |
|
|
583 |
objects. We are going to use the Xenium data clustered using VoltRon <a |
|
|
584 |
href="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Cellanalysis/Xenium/Xenium_data_clustered.rds">here</a>.</p> |
|
|
585 |
<pre class="r watch-out"><code>Xen_data <- readRDS("Xenium_data_clustered.rds") |
|
|
586 |
SampleMetadata(Xen_data)</code></pre> |
|
|
587 |
<p>We use the <strong>as.SpatialExperiment</strong> function to convert |
|
|
588 |
spatial assays of VoltRon into SpatialExperiment objects. Please check |
|
|
589 |
the <a |
|
|
590 |
href="https://www.bioconductor.org/packages/release/bioc/vignettes/SpatialExperiment/inst/doc/SpatialExperiment.html">Introduction |
|
|
591 |
to the SpatialExperiment class</a> tutorial for more information.</p> |
|
|
592 |
<pre class="r watch-out"><code>library(SpatialExperiment) |
|
|
593 |
spe <- as.SpatialExperiment(Xen_data, assay = "Xenium")</code></pre> |
|
|
594 |
<p>Here we can parse the image and visualize.</p> |
|
|
595 |
<pre class="r watch-out"><code>img <- imgRaster(spe, |
|
|
596 |
sample_id = "Assay1", |
|
|
597 |
image_id = "main") |
|
|
598 |
plot(img)</code></pre> |
|
|
599 |
<p><br></p> |
|
|
600 |
</div> |
|
|
601 |
<div id="squidpy-anndata-h5ad" class="section level2"> |
|
|
602 |
<h2>Squidpy (Anndata, h5ad)</h2> |
|
|
603 |
<p>A true ecosystem friendly computational platform should support data |
|
|
604 |
types across multiple computing environments. By allowing users to |
|
|
605 |
convert VoltRon objects into annotated data matrix formats such as <a |
|
|
606 |
href="https://github.com/scverse/anndata">anndata</a>, we can use |
|
|
607 |
built-in spatial data analysis methods available on <a |
|
|
608 |
href="https://squidpy.readthedocs.io/en/stable/">squidpy</a>.</p> |
|
|
609 |
<p>You can find the clustered and the annotated Xenium data using |
|
|
610 |
VoltRon <a |
|
|
611 |
href="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Cellanalysis/Xenium/Xenium_data_clustered_annotated.rds">here</a>.</p> |
|
|
612 |
<p>Anndata objects wrapped on h5ad files are commonly used by the <a |
|
|
613 |
href="https://www.nature.com/articles/s41587-023-01733-8">scverse</a> |
|
|
614 |
ecosystem for single cell analysis which bring together numeruous tools |
|
|
615 |
maintained and distributed by a large community effort. Both squidpy and |
|
|
616 |
<a href="https://scanpy.readthedocs.io/en/stable/">scanpy</a> are |
|
|
617 |
currently available on scverse.</p> |
|
|
618 |
<pre class="r watch-out"><code>Xen_data <- readRDS("Xenium_data_clustered_annotated.rds") |
|
|
619 |
as.AnnData(Xen_data, assay = "Xenium", file = "Xen_adata_annotated.h5ad")</code></pre> |
|
|
620 |
<p><br></p> |
|
|
621 |
<div id="configure-squidpy-scverse" class="section level3"> |
|
|
622 |
<h3>Configure Squidpy (scverse)</h3> |
|
|
623 |
<p>Here, we use the <a |
|
|
624 |
href="https://rstudio.github.io/reticulate/">reticulate</a> package to |
|
|
625 |
call <strong>scverse</strong> module in Python through a prebuilt |
|
|
626 |
anaconda environment. However, any python installation with the scverse |
|
|
627 |
module can be incorporated by reticulate.</p> |
|
|
628 |
<pre class="r watch-out"><code>library(reticulate) |
|
|
629 |
use_condaenv("scverse", required = T)</code></pre> |
|
|
630 |
<p>We import some other necessary modules such as pandas, scanpy and |
|
|
631 |
squidpy.</p> |
|
|
632 |
<pre class="python watch-out"><code>from pathlib import Path |
|
|
633 |
import numpy as np |
|
|
634 |
import pandas as pd |
|
|
635 |
import matplotlib.pyplot as plt |
|
|
636 |
import seaborn as sns |
|
|
637 |
import scanpy as sc |
|
|
638 |
import squidpy as sq |
|
|
639 |
sc.logging.print_header()</code></pre> |
|
|
640 |
<p><br></p> |
|
|
641 |
</div> |
|
|
642 |
<div id="filter-and-normalize" class="section level3"> |
|
|
643 |
<h3>Filter and Normalize</h3> |
|
|
644 |
<p>We read the annotated Xenium object that was saved as an h5ad file |
|
|
645 |
using the <strong>as.Anndata</strong> function in VoltRon, and process |
|
|
646 |
before analysis. For more information using scanpy and squidpy on Xenium |
|
|
647 |
datasets, check the <a |
|
|
648 |
href="https://squidpy.readthedocs.io/en/stable/notebooks/tutorials/tutorial_xenium.html">Analyzing |
|
|
649 |
Xenium data</a> tutorial at squidpy webpage.</p> |
|
|
650 |
<pre class="python watch-out"><code>adata = sc.read_h5ad("Xen_adata_annotated.h5ad") |
|
|
651 |
adata.layers["counts"] = adata.X.copy() |
|
|
652 |
sc.pp.normalize_total(adata, inplace=True) |
|
|
653 |
sc.pp.log1p(adata)</code></pre> |
|
|
654 |
<p><br></p> |
|
|
655 |
</div> |
|
|
656 |
<div id="visualize" class="section level3"> |
|
|
657 |
<h3>Visualize</h3> |
|
|
658 |
<p>We use the <strong>squidpy.pl.spatial_scatter</strong> functions |
|
|
659 |
available in squidpy to visualize the spatial localization of cell types |
|
|
660 |
of both Xenium replicates.</p> |
|
|
661 |
<pre class="python watch-out"><code>fig, ax = plt.subplots(1, 2, figsize=(10, 7)) |
|
|
662 |
sq.pl.spatial_scatter(adata, library_key = "library_id", library_id = "Assay1", |
|
|
663 |
color=["CellType"], shape=None, size=1, img = False, ax=ax[0]) |
|
|
664 |
sq.pl.spatial_scatter(adata, library_key = "library_id", library_id = "Assay3", |
|
|
665 |
color=["CellType"], shape=None, size=1, img = False, ax=ax[1]) |
|
|
666 |
plt.show(ax)</code></pre> |
|
|
667 |
<p><img width="100%" height="100%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/conversions_anndata_spatial_scatter.png" class="center"></p> |
|
|
668 |
<p><br></p> |
|
|
669 |
</div> |
|
|
670 |
<div id="neighborhood-enrichment" class="section level3"> |
|
|
671 |
<h3>Neighborhood Enrichment</h3> |
|
|
672 |
<p>We can now use high level spatially-aware functions available in |
|
|
673 |
squidpy. We first establish spatial neighbors using the delaunay graphs. |
|
|
674 |
The spatial graph and distances will be stored under |
|
|
675 |
<strong>.obsp</strong> attribute/matrix.</p> |
|
|
676 |
<pre class="python watch-out"><code>sq.gr.spatial_neighbors(adata, coord_type="generic", delaunay=True) |
|
|
677 |
adata</code></pre> |
|
|
678 |
<pre><code>AnnData object with n_obs × n_vars = 283298 × 313 |
|
|
679 |
obs: 'Count', 'Assay', 'Layer', 'Sample', 'Clusters', 'CellType', 'library_id' |
|
|
680 |
uns: 'log1p', 'spatial_neighbors' |
|
|
681 |
obsm: 'spatial' |
|
|
682 |
layers: 'counts' |
|
|
683 |
obsp: 'spatial_connectivities', 'spatial_distances'</code></pre> |
|
|
684 |
<p>We can now conduct the permutation test for neighborhood enrichment |
|
|
685 |
across cell type pairs.</p> |
|
|
686 |
<pre class="python watch-out"><code>sq.gr.nhood_enrichment(adata, cluster_key="CellType")</code></pre> |
|
|
687 |
<pre class="python watch-out"><code>fig, ax = plt.subplots(1, 2, figsize=(13, 7)) |
|
|
688 |
sq.pl.nhood_enrichment(adata, cluster_key="CellType", figsize=(8, 8), |
|
|
689 |
title="Neighborhood enrichment adata", ax=ax[0]) |
|
|
690 |
sq.pl.spatial_scatter(adata, color="CellType", library_key = "library_id", |
|
|
691 |
library_id = "Assay1", shape=None, size=2, ax=ax[1]) |
|
|
692 |
plt.show(ax)</code></pre> |
|
|
693 |
<p><img width="100%" height="100%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/conversions_anndata_neighborhood.png" class="center"></p> |
|
|
694 |
<p><br></p> |
|
|
695 |
</div> |
|
|
696 |
</div> |
|
|
697 |
<div id="vitessce-anndata-zarr" class="section level2"> |
|
|
698 |
<h2>Vitessce (Anndata, zarr)</h2> |
|
|
699 |
<p>In this section, we will transform VoltRon objects of Xenium data |
|
|
700 |
into zarr arrays, and use them for interactive visualization in <a |
|
|
701 |
href="http://vitessce.io/">Vitessce</a>. We should first download the |
|
|
702 |
vitessceR package which incorporates wrapper function to visualize zarr |
|
|
703 |
arrays interactively in R.</p> |
|
|
704 |
<pre class="r watch-out"><code>install.packages("devtools") |
|
|
705 |
devtools::install_github("vitessce/vitessceR")</code></pre> |
|
|
706 |
<p><br></p> |
|
|
707 |
<p>You can find the clustered and annotated Xenium data using VoltRon <a |
|
|
708 |
href="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Cellanalysis/Xenium/Xenium_data_clustered_annotated.rds">here</a>.</p> |
|
|
709 |
<pre class="r watch-out"><code>Xen_data <- readRDS("Xenium_data_clustered_annotated.rds") |
|
|
710 |
SampleMetadata(Xen_data)</code></pre> |
|
|
711 |
<pre><code> Assay Layer Sample |
|
|
712 |
Assay1 Xenium Section1 XeniumR1 |
|
|
713 |
Assay2 Xenium Section1 XeniumR2</code></pre> |
|
|
714 |
<p><br></p> |
|
|
715 |
<div id="interactive-visualization" class="section level3"> |
|
|
716 |
<h3>Interactive Visualization</h3> |
|
|
717 |
<p>Now we can convert the VoltRon object into a zarr array using the |
|
|
718 |
<strong>as.Zarr</strong> function which will create the array in a |
|
|
719 |
specified location.</p> |
|
|
720 |
<pre class="r watch-out"><code>as.AnnData(Xen_data, assays = "Assay1", |
|
|
721 |
file = "xendata_clustered_annotated.zarr", flip_coordinates = TRUE)</code></pre> |
|
|
722 |
<p>We can use the zarr file directly in the |
|
|
723 |
<strong>vrSpatialPlot</strong> function to visualize the zarr array |
|
|
724 |
interactively in Rstudio viewer. The <strong>reduction</strong> |
|
|
725 |
arguement allows the umap of the Xenium data to be visualized alongside |
|
|
726 |
with the spatial coordinates of the Xenium cells.</p> |
|
|
727 |
<pre class="r watch-out"><code>vrSpatialPlot("xendata_clustered_annotated.zarr", group.by = "CellType", reduction = "umap")</code></pre> |
|
|
728 |
<p><img width="100%" height="100%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/conversions_interactive.png" class="center"> |
|
|
729 |
<br> |
|
|
730 |
<img width="100%" height="100%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/conversions_interactive_zoom.png" class="center"></p> |
|
|
731 |
</div> |
|
|
732 |
</div> |
|
|
733 |
</div> |
|
|
734 |
|
|
|
735 |
|
|
|
736 |
|
|
|
737 |
</div> |
|
|
738 |
</div> |
|
|
739 |
|
|
|
740 |
</div> |
|
|
741 |
|
|
|
742 |
<script> |
|
|
743 |
|
|
|
744 |
// add bootstrap table styles to pandoc tables |
|
|
745 |
function bootstrapStylePandocTables() { |
|
|
746 |
$('tr.odd').parent('tbody').parent('table').addClass('table table-condensed'); |
|
|
747 |
} |
|
|
748 |
$(document).ready(function () { |
|
|
749 |
bootstrapStylePandocTables(); |
|
|
750 |
}); |
|
|
751 |
|
|
|
752 |
|
|
|
753 |
</script> |
|
|
754 |
|
|
|
755 |
<!-- tabsets --> |
|
|
756 |
|
|
|
757 |
<script> |
|
|
758 |
$(document).ready(function () { |
|
|
759 |
window.buildTabsets("TOC"); |
|
|
760 |
}); |
|
|
761 |
|
|
|
762 |
$(document).ready(function () { |
|
|
763 |
$('.tabset-dropdown > .nav-tabs > li').click(function () { |
|
|
764 |
$(this).parent().toggleClass('nav-tabs-open'); |
|
|
765 |
}); |
|
|
766 |
}); |
|
|
767 |
</script> |
|
|
768 |
|
|
|
769 |
<!-- code folding --> |
|
|
770 |
|
|
|
771 |
<script> |
|
|
772 |
$(document).ready(function () { |
|
|
773 |
|
|
|
774 |
// temporarily add toc-ignore selector to headers for the consistency with Pandoc |
|
|
775 |
$('.unlisted.unnumbered').addClass('toc-ignore') |
|
|
776 |
|
|
|
777 |
// move toc-ignore selectors from section div to header |
|
|
778 |
$('div.section.toc-ignore') |
|
|
779 |
.removeClass('toc-ignore') |
|
|
780 |
.children('h1,h2,h3,h4,h5').addClass('toc-ignore'); |
|
|
781 |
|
|
|
782 |
// establish options |
|
|
783 |
var options = { |
|
|
784 |
selectors: "h1,h2,h3", |
|
|
785 |
theme: "bootstrap3", |
|
|
786 |
context: '.toc-content', |
|
|
787 |
hashGenerator: function (text) { |
|
|
788 |
return text.replace(/[.\\/?&!#<>]/g, '').replace(/\s/g, '_'); |
|
|
789 |
}, |
|
|
790 |
ignoreSelector: ".toc-ignore", |
|
|
791 |
scrollTo: 0 |
|
|
792 |
}; |
|
|
793 |
options.showAndHide = false; |
|
|
794 |
options.smoothScroll = false; |
|
|
795 |
|
|
|
796 |
// tocify |
|
|
797 |
var toc = $("#TOC").tocify(options).data("toc-tocify"); |
|
|
798 |
}); |
|
|
799 |
</script> |
|
|
800 |
|
|
|
801 |
<!-- dynamically load mathjax for compatibility with self-contained --> |
|
|
802 |
<script> |
|
|
803 |
(function () { |
|
|
804 |
var script = document.createElement("script"); |
|
|
805 |
script.type = "text/javascript"; |
|
|
806 |
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; |
|
|
807 |
document.getElementsByTagName("head")[0].appendChild(script); |
|
|
808 |
})(); |
|
|
809 |
</script> |
|
|
810 |
|
|
|
811 |
</body> |
|
|
812 |
</html> |