|
a |
|
b/docs/nicheclustering.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>Niche Clustering</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">Niche Clustering</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="spot-based-niche-clustering" class="section level1"> |
|
|
462 |
<h1>Spot-based Niche Clustering</h1> |
|
|
463 |
<p>Spot-based spatial transcriptomic assays capture spatially-resolved |
|
|
464 |
gene expression profiles that are somewhat closer to single cell |
|
|
465 |
resolution. However, each spot still includes a few number of cells that |
|
|
466 |
are likely originated from few number of cell types, hence |
|
|
467 |
transcriptomic profile of each spot would likely include markers from |
|
|
468 |
multiple cell types. Here, <strong>RNA deconvolution</strong> can be |
|
|
469 |
incorporated to estimate the percentage/abundance of cell types for each |
|
|
470 |
spot. We use a scRNAseq dataset as a reference to computationally |
|
|
471 |
estimate the relative abundance of cell types across across the |
|
|
472 |
spots.</p> |
|
|
473 |
<p>VoltRon includes wrapper commands for using popular spot-level RNA |
|
|
474 |
deconvolution methods such as <a |
|
|
475 |
href="https://www.nature.com/articles/s41587-021-00830-w">RCTD</a> and |
|
|
476 |
return estimated abundances as additional feature sets within each |
|
|
477 |
layer. These estimated percentages of cell types for each spot could be |
|
|
478 |
incorporated to detect <strong>niches</strong> (i.e. small local |
|
|
479 |
microenvironments of cells) within the tissue. We can process cell type |
|
|
480 |
abundance assays and used them for clustering to detect these |
|
|
481 |
niches.</p> |
|
|
482 |
<p><br></p> |
|
|
483 |
<div id="import-visium-data" class="section level2"> |
|
|
484 |
<h2>Import Visium Data</h2> |
|
|
485 |
<p>For this tutorial we will analyze spot-based transcriptomic assays |
|
|
486 |
from Mouse Brain generated by the <a |
|
|
487 |
href="https://www.10xgenomics.com/products/spatial-gene-expression">Visium</a> |
|
|
488 |
instrument.</p> |
|
|
489 |
<p>You can find and download readouts of all four Visium sections <a |
|
|
490 |
href="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Cellanalysis/Visium/MouseBrainSerialSections.zip">here</a>. |
|
|
491 |
The <strong>Mouse Brain Serial Section 1/2</strong> datasets can be also |
|
|
492 |
downloaded from <a |
|
|
493 |
href="https://www.10xgenomics.com/resources/datasets?menu%5Bproducts.name%5D=Spatial%20Gene%20Expression&query=&page=1&configure%5BhitsPerPage%5D=50&configure%5BmaxValuesPerFacet%5D=1000">here</a> |
|
|
494 |
(specifically, please filter for <strong>Species=Mouse</strong>, |
|
|
495 |
<strong>AnatomicalEntity=brain</strong>, <strong>Chemistry=v1</strong> |
|
|
496 |
and <strong>PipelineVersion=v1.1.0</strong>).</p> |
|
|
497 |
<p>We will now import each of four samples separately and merge them |
|
|
498 |
into one VoltRon object. There are four brain tissue sections in total |
|
|
499 |
given two serial anterior and serial posterior sections, hence we have |
|
|
500 |
<strong>two tissue blocks each having two layers</strong>.</p> |
|
|
501 |
<pre class="r watch-out"><code>library(VoltRon) |
|
|
502 |
Ant_Sec1 <- importVisium("Sagittal_Anterior/Section1/", sample_name = "Anterior1") |
|
|
503 |
Ant_Sec2 <- importVisium("Sagittal_Anterior/Section2/", sample_name = "Anterior2") |
|
|
504 |
Pos_Sec1 <- importVisium("Sagittal_Posterior/Section1/", sample_name = "Posterior1") |
|
|
505 |
Pos_Sec2 <- importVisium("Sagittal_Posterior/Section2/", sample_name = "Posterior2") |
|
|
506 |
|
|
|
507 |
# merge datasets |
|
|
508 |
MBrain_Sec_list <- list(Ant_Sec1, Ant_Sec2, Pos_Sec1, Pos_Sec2) |
|
|
509 |
MBrain_Sec <- merge(MBrain_Sec_list[[1]], MBrain_Sec_list[-1], |
|
|
510 |
samples = c("Anterior", "Anterior", "Posterior", "Posterior")) |
|
|
511 |
MBrain_Sec</code></pre> |
|
|
512 |
<pre><code>VoltRon Object |
|
|
513 |
Anterior: |
|
|
514 |
Layers: Section1 Section2 |
|
|
515 |
Posterior: |
|
|
516 |
Layers: Section1 Section2 |
|
|
517 |
Assays: Visium(Main) |
|
|
518 |
Features: RNA(Main) </code></pre> |
|
|
519 |
<p>VoltRon maps metadata features on the spatial images, multiple |
|
|
520 |
features can be provided for all assays/layers associated with the main |
|
|
521 |
assay (Visium).</p> |
|
|
522 |
<pre class="r watch-out"><code>vrSpatialFeaturePlot(MBrain_Sec, features = "Count", crop = TRUE, alpha = 1, ncol = 2)</code></pre> |
|
|
523 |
<p><img width="80%" height="80%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/decon_first_plot.png" class="center"></p> |
|
|
524 |
<p><br></p> |
|
|
525 |
</div> |
|
|
526 |
<div id="import-scrna-data" class="section level2"> |
|
|
527 |
<h2>Import scRNA data</h2> |
|
|
528 |
<p>We will now import the scRNA data for reference which can be |
|
|
529 |
downloaded from <a |
|
|
530 |
href="https://www.dropbox.com/s/cuowvm4vrf65pvq/allen_cortex.rds?dl=1">here</a>. |
|
|
531 |
Specifically, we will use a scRNA data of Mouse cortical adult brain |
|
|
532 |
with 14,000 cells, generated with the SMART-Seq2 protocol, from the |
|
|
533 |
Allen Institute. This scRNA data is also used by the Spatial Data |
|
|
534 |
Analysis tutorial in <a |
|
|
535 |
href="https://satijalab.org/seurat/articles/spatial_vignette.html#integration-with-single-cell-data">Seurat</a> |
|
|
536 |
website.</p> |
|
|
537 |
<pre class="r watch-out"><code># install packages if necessary |
|
|
538 |
if(!requireNamespace("Seurat")) |
|
|
539 |
install.packages("Seurat") |
|
|
540 |
if(!requireNamespace("dplyr")) |
|
|
541 |
install.packages("dplyr") |
|
|
542 |
|
|
|
543 |
# import scRNA data |
|
|
544 |
library(Seurat) |
|
|
545 |
allen_reference <- readRDS("allen_cortex.rds") |
|
|
546 |
|
|
|
547 |
# process and reduce dimensionality |
|
|
548 |
library(dplyr) |
|
|
549 |
allen_reference <- SCTransform(allen_reference, ncells = 3000, verbose = FALSE) %>% |
|
|
550 |
RunPCA(verbose = FALSE) %>% |
|
|
551 |
RunUMAP(dims = 1:30)</code></pre> |
|
|
552 |
<p>Before deconvoluting Visium spots, we correct cell types labels and |
|
|
553 |
drop some cell types with extremely few number of cells (e.g. “CR”).</p> |
|
|
554 |
<pre class="r watch-out"><code># update labels and subset |
|
|
555 |
allen_reference$subclass <- gsub("L2/3 IT", "L23 IT", allen_reference$subclass) |
|
|
556 |
allen_reference <- allen_reference[,colnames(allen_reference)[!allen_reference@meta.data$subclass %in% "CR"]] |
|
|
557 |
|
|
|
558 |
# visualize |
|
|
559 |
Idents(allen_reference) <- "subclass" |
|
|
560 |
gsubclass <- DimPlot(allen_reference, reduction = "umap", label = T) + NoLegend() |
|
|
561 |
Idents(allen_reference) <- "class" |
|
|
562 |
gclass <- DimPlot(allen_reference, reduction = "umap", label = T) + NoLegend() |
|
|
563 |
gsubclass | gclass</code></pre> |
|
|
564 |
<p><img width="95%" height="95%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/decon_singlecell.png" class="center"></p> |
|
|
565 |
<p><br></p> |
|
|
566 |
</div> |
|
|
567 |
<div id="spot-deconvolution-with-rctd" class="section level2"> |
|
|
568 |
<h2>Spot Deconvolution with RCTD</h2> |
|
|
569 |
<p>In order to integrate the scRNA data and the spatial data sets within |
|
|
570 |
the VoltRon object and estimate relative cell type abundances for each |
|
|
571 |
Visium spot, we will use <strong>RCTD</strong> algorithm which is |
|
|
572 |
accessible with the <a |
|
|
573 |
href="https://github.com/dmcable/spacexr">spacexr</a> package.</p> |
|
|
574 |
<pre class="r watch-out"><code>if(!requireNamespace("spacexr")) |
|
|
575 |
devtools::install_github("dmcable/spacexr", build_vignettes = FALSE)</code></pre> |
|
|
576 |
<p>After running <strong>getDeconvolution</strong>, an additional |
|
|
577 |
feature set within the same Visium assay with name |
|
|
578 |
<strong>Decon</strong> will be created.</p> |
|
|
579 |
<pre class="r watch-out"><code>library(spacexr) |
|
|
580 |
MBrain_Sec <- getDeconvolution(MBrain_Sec, sc.object = allen_reference, sc.cluster = "subclass", max_cores = 6) |
|
|
581 |
MBrain_Sec</code></pre> |
|
|
582 |
<pre><code>VoltRon Object |
|
|
583 |
Anterior: |
|
|
584 |
Layers: Section1 Section2 |
|
|
585 |
Posterior: |
|
|
586 |
Layers: Section1 Section2 |
|
|
587 |
Assays: Visium(Main) |
|
|
588 |
Features: RNA(Main) Decon </code></pre> |
|
|
589 |
<p>We can now switch to the <strong>Decon</strong> feature type where |
|
|
590 |
features are cell types from the scRNA reference and the data values are |
|
|
591 |
cell types percentages in each spot.</p> |
|
|
592 |
<pre class="r watch-out"><code>vrMainFeatureType(MBrain_Sec) <- "Decon" |
|
|
593 |
vrFeatures(MBrain_Sec)</code></pre> |
|
|
594 |
<pre><code> [1] "Astro" "Endo" "L23 IT" "L4" "L5 IT" "L5 PT" |
|
|
595 |
[7] "L6 CT" "L6 IT" "L6b" "Lamp5" "Macrophage" "Meis2" |
|
|
596 |
[13] "NP" "Oligo" "Peri" "Pvalb" "Serpinf1" "SMC" |
|
|
597 |
[19] "Sncg" "Sst" "Vip" "VLMC" </code></pre> |
|
|
598 |
<p>These features (i.e. cell type abundances) can be visualized like any |
|
|
599 |
other feature type.</p> |
|
|
600 |
<pre class="r watch-out"><code>vrSpatialFeaturePlot(MBrain_Sec, features = c("L4", "L5 PT", "Oligo", "Vip"), |
|
|
601 |
crop = TRUE, ncol = 2, alpha = 1, keep.scale = "all")</code></pre> |
|
|
602 |
<p><img width="90%" height="90%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/decon_spatialfeature_plot.png" class="center"></p> |
|
|
603 |
<p><br></p> |
|
|
604 |
</div> |
|
|
605 |
<div id="clustering" class="section level2"> |
|
|
606 |
<h2>Clustering</h2> |
|
|
607 |
<p>Relative cell type abundances that are learned by RCTD and stored |
|
|
608 |
within VoltRon can now be used to cluster spots. These groups or |
|
|
609 |
clusters of spots can often be referred to as <strong>niches</strong>. |
|
|
610 |
Here, as a definition, a niche is a region or a collection of regions |
|
|
611 |
within tissue that have a distinct cell type composition as opposed to |
|
|
612 |
the remaining parts of the tissue.</p> |
|
|
613 |
<p>The cell type abundances (which adds up to one for each spot) can be |
|
|
614 |
normalized and processed like transcriptomic and proteomic profiles |
|
|
615 |
prior to clustering (i.e. niche clustering). We treat cell type |
|
|
616 |
abundances as <a |
|
|
617 |
href="https://en.wikipedia.org/wiki/Compositional_data">compositional |
|
|
618 |
data</a>, hence we incorporate <strong>centred log ratio (CLR)</strong> |
|
|
619 |
transformation for normalizing them.</p> |
|
|
620 |
<pre class="r watch-out"><code>vrMainFeatureType(MBrain_Sec) <- "Decon" |
|
|
621 |
MBrain_Sec <- normalizeData(MBrain_Sec, method = "CLR")</code></pre> |
|
|
622 |
<p>The CLR normalized assay have only 25 features, each representing a |
|
|
623 |
cell type from the single cell reference data. Hence, we can |
|
|
624 |
<strong>directly calculate UMAP reductions from this feature |
|
|
625 |
abundances</strong> since we dont have much number of features which |
|
|
626 |
necessitates dimensionality reduction such as PCA.</p> |
|
|
627 |
<p>However, we may still need to reduce the dimensionality of this space |
|
|
628 |
with 25 features using UMAP for visualizing purposes. VoltRon is also |
|
|
629 |
capable of calculating the UMAP reduction from normalized data slots. |
|
|
630 |
Hence, we build a UMAP reduction from CLR data directly. However, UMAP |
|
|
631 |
will always be calculated from a PCA reduction by default (if a PCA |
|
|
632 |
embedding is found in the object).</p> |
|
|
633 |
<pre class="r watch-out"><code>MBrain_Sec <- getUMAP(MBrain_Sec, data.type = "norm") |
|
|
634 |
vrEmbeddingPlot(MBrain_Sec, embedding = "umap", group.by = "Sample")</code></pre> |
|
|
635 |
<p><img width="60%" height="60%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/decon_embedding_sample.png" class="center"></p> |
|
|
636 |
<p><br></p> |
|
|
637 |
<p>Using normalized cell type abundances, we can now generate k-nearest |
|
|
638 |
neighbor graphs and cluster the graph using leiden method.</p> |
|
|
639 |
<pre class="r watch-out"><code>MBrain_Sec <- getProfileNeighbors(MBrain_Sec, data.type = "norm", method = "SNN") |
|
|
640 |
vrGraphNames(MBrain_Sec)</code></pre> |
|
|
641 |
<pre><code>[1] "SNN"</code></pre> |
|
|
642 |
<pre class="r watch-out"><code>MBrain_Sec <- getClusters(MBrain_Sec, resolution = 0.6, graph = "SNN")</code></pre> |
|
|
643 |
<p><br></p> |
|
|
644 |
</div> |
|
|
645 |
<div id="visualization" class="section level2"> |
|
|
646 |
<h2>Visualization</h2> |
|
|
647 |
<p>VoltRon incorporates distinct plotting functions for, |
|
|
648 |
e.g. embeddings, coordinates, heatmap and even barplots. We can now map |
|
|
649 |
the clusters we have generated on UMAP embeddings.</p> |
|
|
650 |
<pre class="r watch-out"><code># visualize |
|
|
651 |
g1 <- vrEmbeddingPlot(MBrain_Sec, embedding = "umap", group.by = "Sample") |
|
|
652 |
g2 <- vrEmbeddingPlot(MBrain_Sec, embedding = "umap", group.by = "niche_clusters", label = TRUE) |
|
|
653 |
g1 | g2</code></pre> |
|
|
654 |
<p><img width="100%" height="100%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/decon_embedding_clusters.png" class="center"></p> |
|
|
655 |
<p><br></p> |
|
|
656 |
<p>Mapping clusters on the spatial images and spots would show the niche |
|
|
657 |
structure across all four tissue sections.</p> |
|
|
658 |
<pre class="r watch-out"><code>vrSpatialPlot(MBrain_Sec, group.by = "niche_clusters", crop = TRUE, alpha = 1)</code></pre> |
|
|
659 |
<p><img width="80%" height="80%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/decon_spatial_clusters.png" class="center"></p> |
|
|
660 |
<p><br></p> |
|
|
661 |
<p>We use <strong>vrHeatmapPlot</strong> to investigate relative cell |
|
|
662 |
type abundances across these niche clusters. You will need to have |
|
|
663 |
<strong>ComplexHeatmap</strong> package in your namespace.</p> |
|
|
664 |
<pre class="r watch-out"><code># install packages if necessary |
|
|
665 |
if(!requireNamespace("ComplexHeatmap")) |
|
|
666 |
BiocManager::install("ComplexHeatmap") |
|
|
667 |
|
|
|
668 |
# heatmap of niches |
|
|
669 |
library(ComplexHeatmap) |
|
|
670 |
vrHeatmapPlot(MBrain_Sec, features = vrFeatures(MBrain_Sec), group.by = "niche_clusters", |
|
|
671 |
show_row_names = T, show_heatmap_legend = T)</code></pre> |
|
|
672 |
<p><img width="90%" height="90%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/decon_heatmap_clusters.png" class="center"> |
|
|
673 |
<br></p> |
|
|
674 |
</div> |
|
|
675 |
</div> |
|
|
676 |
<div id="cell-based-niche-clustering" class="section level1"> |
|
|
677 |
<h1>Cell-based Niche Clustering</h1> |
|
|
678 |
<p>Similar to spot-based spatial omics assays, we can build and cluster |
|
|
679 |
niche associated to each cell for spatial transcriptomics datasets in |
|
|
680 |
single cell resolution. For this, we require building niche assays for |
|
|
681 |
the collections of cells where a niche of cell is defined as a region of |
|
|
682 |
sets of regions with distinct cell type population that each of these |
|
|
683 |
cells belong to.</p> |
|
|
684 |
<p>Here, we dont require any scRNA reference dataset but we may first |
|
|
685 |
need to cluster and annotate cells in the RNA/transcriptome level |
|
|
686 |
profiles, and determine cell types. Then, we first detect the mixture of |
|
|
687 |
cell types within a spatial neighborhood around all cells and use that |
|
|
688 |
as a profile to perform clustering where these clusters will be |
|
|
689 |
associated with niches.</p> |
|
|
690 |
<div id="import-xenium-data" class="section level2"> |
|
|
691 |
<h2>Import Xenium Data</h2> |
|
|
692 |
<p>For this, the data has to be already clustered (and annotated if |
|
|
693 |
possible). We will use the cluster labels generated at the end of the |
|
|
694 |
Xenium analysis workflow from <a href="spotanalysis.html">Cell/Spot |
|
|
695 |
Analysis</a>. You can download the VoltRon object with clustered and |
|
|
696 |
annotated Xenium cells along with the Visium assay from <a |
|
|
697 |
href="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/SpatialDataAlignment/Xenium_vs_Visium/VRBlock_data_clustered.rds">here</a>.</p> |
|
|
698 |
<pre class="r watch-out"><code>Xen_data <- readRDS("VRBlock_data_clustered.rds")</code></pre> |
|
|
699 |
<p>We will use all these 18 cell types used for annotating Xenium cells |
|
|
700 |
for detecting niches with distinct cellular type mixtures.</p> |
|
|
701 |
<pre class="r watch-out"><code>vrMainSpatial(Xen_data, assay = "Assay1") <- "main" |
|
|
702 |
vrMainSpatial(Xen_data, assay = "Assay3") <- "main" |
|
|
703 |
vrSpatialPlot(Xen_data, group.by = "CellType", pt.size = 0.13, background.color = "black", |
|
|
704 |
legend.loc = "top", n.tile = 500)</code></pre> |
|
|
705 |
<p><img width="100%" height="100%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/decon_xenium_clusters.png" class="center"></p> |
|
|
706 |
<p><br></p> |
|
|
707 |
</div> |
|
|
708 |
<div id="creating-niche-assay" class="section level2"> |
|
|
709 |
<h2>Creating Niche Assay</h2> |
|
|
710 |
<p>For calculating niche profiles for each cell, we have to first build |
|
|
711 |
spatial neighborhoods around cells and capture the local cell type |
|
|
712 |
mixtures. Using <strong>getSpatialNeighbors</strong>, we build a spatial |
|
|
713 |
neighborhood graph to connect all cells to other cells within at most 15 |
|
|
714 |
distance apart.</p> |
|
|
715 |
<pre class="r watch-out"><code>Xen_data <- getSpatialNeighbors(Xen_data, radius = 15, method = "radius") |
|
|
716 |
vrGraphNames(Xen_data)</code></pre> |
|
|
717 |
<pre><code>[1] "radius"</code></pre> |
|
|
718 |
<p>Now, we can build a niche assay for cells using the |
|
|
719 |
<strong>getNicheAssay</strong> function which will create an additional |
|
|
720 |
feature set for cells called <strong>Niche</strong>. Here, each cell |
|
|
721 |
type is a feature and the profile of a cell represents the relative |
|
|
722 |
abundance of cell types around each cell.</p> |
|
|
723 |
<pre class="r watch-out"><code>Xen_data <- getNicheAssay(Xen_data, label = "CellType", graph.type = "radius") |
|
|
724 |
Xen_data</code></pre> |
|
|
725 |
<pre><code>VoltRon Object |
|
|
726 |
10XBlock: |
|
|
727 |
Layers: Section1 Section2 Section3 |
|
|
728 |
Assays: Xenium(Main) Visium |
|
|
729 |
Features: RNA(Main) Niche</code></pre> |
|
|
730 |
<p><br></p> |
|
|
731 |
</div> |
|
|
732 |
<div id="clustering-1" class="section level2"> |
|
|
733 |
<h2>Clustering</h2> |
|
|
734 |
<p>The Niche assay can be normalized similar to the spot-level niche |
|
|
735 |
analysis using <strong>centred log ratio (CLR)</strong> |
|
|
736 |
transformation.</p> |
|
|
737 |
<pre class="r watch-out"><code>vrMainFeatureType(Xen_data) <- "Niche" |
|
|
738 |
Xen_data <- normalizeData(Xen_data, method = "CLR")</code></pre> |
|
|
739 |
<p>Default clustering functions could be used to analyze the normalized |
|
|
740 |
niche profiles of cells to detect niches associated with each cell. |
|
|
741 |
However, we use K-means algorithm to perform the niche clustering. For |
|
|
742 |
this exercise, we pick an estimate of 7 clusters which will be the |
|
|
743 |
number of niche clusters we get.</p> |
|
|
744 |
<pre class="r watch-out"><code>Xen_data <- getClusters(Xen_data, nclus = 7, method = "kmeans", label = "niche_clusters")</code></pre> |
|
|
745 |
<p>After the niche clustering, the metadata is updated and observed |
|
|
746 |
later like below.</p> |
|
|
747 |
<pre class="r watch-out"><code>head(Metadata(Xen_data))</code></pre> |
|
|
748 |
<div> |
|
|
749 |
<pre><code style="font-size: 10px;"> id Count assay_id Assay Layer Sample CellType niche_clusters |
|
|
750 |
1_Assay1 1_Assay1 28 Assay1 Xenium Section1 10XBlock DCIS_1 2 |
|
|
751 |
2_Assay1 2_Assay1 94 Assay1 Xenium Section1 10XBlock DCIS_2 2 |
|
|
752 |
3_Assay1 3_Assay1 9 Assay1 Xenium Section1 10XBlock DCIS_1 2 |
|
|
753 |
4_Assay1 4_Assay1 11 Assay1 Xenium Section1 10XBlock DCIS_1 2 |
|
|
754 |
5_Assay1 5_Assay1 48 Assay1 Xenium Section1 10XBlock DCIS_2 2 |
|
|
755 |
6_Assay1 6_Assay1 7 Assay1 Xenium Section1 10XBlock DCIS_1 2</code></pre> |
|
|
756 |
</div> |
|
|
757 |
<p><br></p> |
|
|
758 |
</div> |
|
|
759 |
<div id="visualization-1" class="section level2"> |
|
|
760 |
<h2>Visualization</h2> |
|
|
761 |
<p>After niche clustering, each cell in the Xenium assay will be |
|
|
762 |
assigned a niche which is initially a number which indicates the ID of |
|
|
763 |
each particular niche. It is up to the user to annotate, filter and |
|
|
764 |
visualize these niches moving forward.</p> |
|
|
765 |
<pre class="r watch-out"><code>vrSpatialPlot(Xen_data, group.by = "niche_clusters", alpha = 1, legend.loc = "top")</code></pre> |
|
|
766 |
<p>We use <strong>vrHeatmapPlot</strong> to investigate the abundance of |
|
|
767 |
each cell type across the niche clusters. You will need to have |
|
|
768 |
<strong>ComplexHeatmap</strong> package in your namespace. We see that |
|
|
769 |
niche cluster 1 include all invasive tumor subtypes (IT 1-3). We see |
|
|
770 |
this for two subtypes of in situ ductal carcinoma (DCIS 1,2) subtypes as |
|
|
771 |
well other than a third DCIS subcluster being within proximity to |
|
|
772 |
myoepithelial cells. Niche cluster 6 also shows regions within the |
|
|
773 |
breast cancer tissue where T cells and B cells are found together |
|
|
774 |
abundantly.</p> |
|
|
775 |
<p><img width="100%" height="100%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/decon_xenium_nicheclusters.png" class="center"> |
|
|
776 |
<br></p> |
|
|
777 |
<pre class="r watch-out"><code># install packages if necessary |
|
|
778 |
if(!requireNamespace("ComplexHeatmap")) |
|
|
779 |
BiocManager::install("ComplexHeatmap") |
|
|
780 |
|
|
|
781 |
# heatmap of niches |
|
|
782 |
library(ComplexHeatmap) |
|
|
783 |
vrHeatmapPlot(Xen_data, features = vrFeatures(Xen_data), group.by = "niche_clusters")</code></pre> |
|
|
784 |
<p><img width="100%" height="100%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/decon_xenium_heatmapclusters.png" class="center"> |
|
|
785 |
<br></p> |
|
|
786 |
</div> |
|
|
787 |
</div> |
|
|
788 |
|
|
|
789 |
|
|
|
790 |
|
|
|
791 |
</div> |
|
|
792 |
</div> |
|
|
793 |
|
|
|
794 |
</div> |
|
|
795 |
|
|
|
796 |
<script> |
|
|
797 |
|
|
|
798 |
// add bootstrap table styles to pandoc tables |
|
|
799 |
function bootstrapStylePandocTables() { |
|
|
800 |
$('tr.odd').parent('tbody').parent('table').addClass('table table-condensed'); |
|
|
801 |
} |
|
|
802 |
$(document).ready(function () { |
|
|
803 |
bootstrapStylePandocTables(); |
|
|
804 |
}); |
|
|
805 |
|
|
|
806 |
|
|
|
807 |
</script> |
|
|
808 |
|
|
|
809 |
<!-- tabsets --> |
|
|
810 |
|
|
|
811 |
<script> |
|
|
812 |
$(document).ready(function () { |
|
|
813 |
window.buildTabsets("TOC"); |
|
|
814 |
}); |
|
|
815 |
|
|
|
816 |
$(document).ready(function () { |
|
|
817 |
$('.tabset-dropdown > .nav-tabs > li').click(function () { |
|
|
818 |
$(this).parent().toggleClass('nav-tabs-open'); |
|
|
819 |
}); |
|
|
820 |
}); |
|
|
821 |
</script> |
|
|
822 |
|
|
|
823 |
<!-- code folding --> |
|
|
824 |
|
|
|
825 |
<script> |
|
|
826 |
$(document).ready(function () { |
|
|
827 |
|
|
|
828 |
// temporarily add toc-ignore selector to headers for the consistency with Pandoc |
|
|
829 |
$('.unlisted.unnumbered').addClass('toc-ignore') |
|
|
830 |
|
|
|
831 |
// move toc-ignore selectors from section div to header |
|
|
832 |
$('div.section.toc-ignore') |
|
|
833 |
.removeClass('toc-ignore') |
|
|
834 |
.children('h1,h2,h3,h4,h5').addClass('toc-ignore'); |
|
|
835 |
|
|
|
836 |
// establish options |
|
|
837 |
var options = { |
|
|
838 |
selectors: "h1,h2,h3", |
|
|
839 |
theme: "bootstrap3", |
|
|
840 |
context: '.toc-content', |
|
|
841 |
hashGenerator: function (text) { |
|
|
842 |
return text.replace(/[.\\/?&!#<>]/g, '').replace(/\s/g, '_'); |
|
|
843 |
}, |
|
|
844 |
ignoreSelector: ".toc-ignore", |
|
|
845 |
scrollTo: 0 |
|
|
846 |
}; |
|
|
847 |
options.showAndHide = false; |
|
|
848 |
options.smoothScroll = false; |
|
|
849 |
|
|
|
850 |
// tocify |
|
|
851 |
var toc = $("#TOC").tocify(options).data("toc-tocify"); |
|
|
852 |
}); |
|
|
853 |
</script> |
|
|
854 |
|
|
|
855 |
<!-- dynamically load mathjax for compatibility with self-contained --> |
|
|
856 |
<script> |
|
|
857 |
(function () { |
|
|
858 |
var script = document.createElement("script"); |
|
|
859 |
script.type = "text/javascript"; |
|
|
860 |
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; |
|
|
861 |
document.getElementsByTagName("head")[0].appendChild(script); |
|
|
862 |
})(); |
|
|
863 |
</script> |
|
|
864 |
|
|
|
865 |
</body> |
|
|
866 |
</html> |