Files
biodiversity-metrics/Lecture.html

2125 lines
116 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en"><head>
<script src="Lecture_files/libs/clipboard/clipboard.min.js"></script>
<script src="Lecture_files/libs/quarto-html/tabby.min.js"></script>
<script src="Lecture_files/libs/quarto-html/popper.min.js"></script>
<script src="Lecture_files/libs/quarto-html/tippy.umd.min.js"></script>
<link href="Lecture_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="Lecture_files/libs/quarto-html/quarto-html.min.css" rel="stylesheet" data-mode="light">
<link href="Lecture_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles"><meta charset="utf-8">
<meta name="generator" content="quarto-1.2.256">
<meta name="author" content="Eric Coissac">
<title>Biodiversity metrics and metabarcoding</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="Lecture_files/libs/revealjs/dist/reset.css">
<link rel="stylesheet" href="Lecture_files/libs/revealjs/dist/reveal.css">
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1.6em;
vertical-align: middle;
}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ color: #003b4f; background-color: #f1f3f5; }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span { color: #003b4f; } /* Normal */
code span.al { color: #ad0000; } /* Alert */
code span.an { color: #5e5e5e; } /* Annotation */
code span.at { color: #657422; } /* Attribute */
code span.bn { color: #ad0000; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #003b4f; } /* ControlFlow */
code span.ch { color: #20794d; } /* Char */
code span.cn { color: #8f5902; } /* Constant */
code span.co { color: #5e5e5e; } /* Comment */
code span.cv { color: #5e5e5e; font-style: italic; } /* CommentVar */
code span.do { color: #5e5e5e; font-style: italic; } /* Documentation */
code span.dt { color: #ad0000; } /* DataType */
code span.dv { color: #ad0000; } /* DecVal */
code span.er { color: #ad0000; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #ad0000; } /* Float */
code span.fu { color: #4758ab; } /* Function */
code span.im { color: #00769e; } /* Import */
code span.in { color: #5e5e5e; } /* Information */
code span.kw { color: #003b4f; } /* Keyword */
code span.op { color: #5e5e5e; } /* Operator */
code span.ot { color: #003b4f; } /* Other */
code span.pp { color: #ad0000; } /* Preprocessor */
code span.sc { color: #5e5e5e; } /* SpecialChar */
code span.ss { color: #20794d; } /* SpecialString */
code span.st { color: #20794d; } /* String */
code span.va { color: #111111; } /* Variable */
code span.vs { color: #20794d; } /* VerbatimString */
code span.wa { color: #5e5e5e; font-style: italic; } /* Warning */
div.csl-bib-body { }
div.csl-entry {
clear: both;
}
.hanging div.csl-entry {
margin-left:2em;
text-indent:-2em;
}
div.csl-left-margin {
min-width:2em;
float:left;
}
div.csl-right-inline {
margin-left:2em;
padding-left:1em;
}
div.csl-indent {
margin-left: 2em;
}
</style>
<link rel="stylesheet" href="Lecture_files/libs/revealjs/dist/theme/quarto.css" id="theme">
<link href="Lecture_files/libs/revealjs/plugin/quarto-line-highlight/line-highlight.css" rel="stylesheet">
<link href="Lecture_files/libs/revealjs/plugin/reveal-menu/menu.css" rel="stylesheet">
<link href="Lecture_files/libs/revealjs/plugin/reveal-menu/quarto-menu.css" rel="stylesheet">
<link href="Lecture_files/libs/revealjs/plugin/quarto-support/footer.css" rel="stylesheet">
<style type="text/css">
.callout {
margin-top: 1em;
margin-bottom: 1em;
border-radius: .25rem;
}
.callout.callout-style-simple {
padding: 0em 0.5em;
border-left: solid #acacac .3rem;
border-right: solid 1px silver;
border-top: solid 1px silver;
border-bottom: solid 1px silver;
display: flex;
}
.callout.callout-style-default {
border-left: solid #acacac .3rem;
border-right: solid 1px silver;
border-top: solid 1px silver;
border-bottom: solid 1px silver;
}
.callout .callout-body-container {
flex-grow: 1;
}
.callout.callout-style-simple .callout-body {
font-size: 1rem;
font-weight: 400;
}
.callout.callout-style-default .callout-body {
font-size: 0.9rem;
font-weight: 400;
}
.callout.callout-captioned.callout-style-simple .callout-body {
margin-top: 0.2em;
}
.callout:not(.callout-captioned) .callout-body {
display: flex;
}
.callout:not(.no-icon).callout-captioned.callout-style-simple .callout-content {
padding-left: 1.6em;
}
.callout.callout-captioned .callout-header {
padding-top: 0.2em;
margin-bottom: -0.2em;
}
.callout.callout-captioned .callout-caption p {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.callout.callout-captioned.callout-style-simple .callout-content p {
margin-top: 0;
}
.callout.callout-captioned.callout-style-default .callout-content p {
margin-top: 0.7em;
}
.callout.callout-style-simple div.callout-caption {
border-bottom: none;
font-size: .9rem;
font-weight: 600;
opacity: 75%;
}
.callout.callout-style-default div.callout-caption {
border-bottom: none;
font-weight: 600;
opacity: 85%;
font-size: 0.9rem;
padding-left: 0.5em;
padding-right: 0.5em;
}
.callout.callout-style-default div.callout-content {
padding-left: 0.5em;
padding-right: 0.5em;
}
.callout.callout-style-simple .callout-icon::before {
height: 1rem;
width: 1rem;
display: inline-block;
content: "";
background-repeat: no-repeat;
background-size: 1rem 1rem;
}
.callout.callout-style-default .callout-icon::before {
height: 0.9rem;
width: 0.9rem;
display: inline-block;
content: "";
background-repeat: no-repeat;
background-size: 0.9rem 0.9rem;
}
.callout-caption {
display: flex
}
.callout-icon::before {
margin-top: 1rem;
padding-right: .5rem;
}
.callout.no-icon::before {
display: none !important;
}
.callout.callout-captioned .callout-body > .callout-content > :last-child {
margin-bottom: 0.5rem;
}
.callout.callout-captioned .callout-icon::before {
margin-top: .5rem;
padding-right: .5rem;
}
.callout:not(.callout-captioned) .callout-icon::before {
margin-top: 1rem;
padding-right: .5rem;
}
/* Callout Types */
div.callout-note {
border-left-color: #4582ec !important;
}
div.callout-note .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAAEU0lEQVRYCcVXTWhcVRQ+586kSUMMxkyaElstCto2SIhitS5Ek8xUKV2poatCcVHtUlFQk8mbaaziwpWgglJwVaquitBOfhQXFlqlzSJpFSpIYyXNjBNiTCck7x2/8/LeNDOZxDuEkgOXe++553zfefee+/OYLOXFk3+1LLrRdiO81yNqZ6K9cG0P3MeFaMIQjXssE8Z1JzLO9ls20MBZX7oG8w9GxB0goaPrW5aNMp1yOZIa7Wv6o2ykpLtmAPs/vrG14Z+6d4jpbSKuhdcSyq9wGMPXjonwmESXrriLzFGOdDBLB8Y6MNYBu0dRokSygMA/mrun8MGFN3behm6VVAwg4WR3i6FvYK1T7MHo9BK7ydH+1uurECoouk5MPRyVSBrBHMYwVobG2aOXM07sWrn5qgB60rc6mcwIDJtQrnrEr44kmy+UO9r0u9O5/YbkS9juQckLed3DyW2XV/qWBBB3ptvI8EUY3I9p/67OW+g967TNr3Sotn3IuVlfMLVnsBwH4fsnebJvyGm5GeIUA3jljERmrv49SizPYuq+z7c2H/jlGC+Ghhupn/hcapqmcudB9jwJ/3jvnvu6vu5lVzF1fXyZuZZ7U8nRmVzytvT+H3kilYvH09mLWrQdwFSsFEsxFVs5fK7A0g8gMZjbif4ACpKbjv7gNGaD8bUrlk8x+KRflttr22JEMRUbTUwwDQScyzPgedQHZT0xnx7ujw2jfVfExwYHwOsDTjLdJ2ebmeQIlJ7neo41s/DrsL3kl+W2lWvAga0tR3zueGr6GL78M3ifH0rGXrBC2aAR8uYcIA5gwV8zIE8onoh8u0Fca/ciF7j1uOzEnqcIm59sEXoGc0+z6+H45V1CvAvHcD7THztu669cnp+L0okAeIc6zjbM/24LgGM1gZk7jnRu1aQWoU9sfUOuhrmtaPIO3YY1KLLWZaEO5TKUbMY5zx8W9UJ6elpLwKXbsaZ4EFl7B4bMtDv0iRipKoDQT2sNQI9b1utXFdYisi+wzZ/ri/1m7QfDgEuvgUUEIJPq3DhX/5DWNqIXDOweC2wvIR90Oq3lDpdMIgD2r0dXvGdsEW5H6x6HLRJYU7C69VefO1x8Gde1ZFSJLfWS1jbCnhtOPxmpfv2LXOA2Xk2tvnwKKPFuZ/oRmwBwqRQDcKNeVQkYcOjtWVBuM/JuYw5b6isojIkYxyYAFn5K7ZBF10fea52y8QltAg6jnMqNHFBmGkQ1j+U43HMi2xMar1Nv0zGsf1s8nUsmUtPOOrbFIR8bHFDMB5zL13Gmr/kGlCkUzedTzzmzsaJXhYawnA3UmARpiYj5ooJZiUoxFRtK3X6pgNPv+IZVPcnwbOl6f+aBaO1CNvPW9n9LmCp01nuSaTRF2YxHqZ8DYQT6WsXT+RD6eUztwYLZ8rM+rcPxamv1VQzFUkzFXvkiVrySGQgJNvXHJAxiU3/NwiC03rSf05VBaPtu/Z7/B8Yn/w7eguloAAAAAElFTkSuQmCC');
}
div.callout-note.callout-style-default .callout-caption {
background-color: #dae6fb
}
div.callout-important {
border-left-color: #d9534f !important;
}
div.callout-important .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAAEKklEQVRYCcVXTWhcVRS+575MJym48A+hSRFr00ySRQhURRfd2HYjk2SSTokuBCkU2o0LoSKKraKIBTcuFCoidGFD08nkBzdREbpQ1EDNIv8qSGMFUboImMSZd4/f9zJv8ibJMC8xJQfO3HPPPef7zrvvvnvviIkpC9nsw0UttFunbUhpFzFtarSd6WJkStVMw5xyVqYTvkwfzuf/5FgtkVoB0729j1rjXwThS7Vio+Mo6DNnvLfahoZ+i/o32lULuJ3NNiz7q6+pyAUkJaFF6JwaM2lUJlV0MlnQn5aTRbEu0SEqHUa0A4AdiGuB1kFXRfVyg5d87+Dg4DL6m2TLAub60ilj7A1Ec4odSAc8X95sHh7+ZRPCFo6Fnp7HfU/fBng/hi10CjCnWnJjsxvDNxWw0NfV6Rv5GgP3I3jGWXumdTD/3cbEOP2ZbOZp69yniG3FQ9z1jD7bnBu9Fc2tKGC2q+uAJOQHBDRiZX1x36o7fWBs7J9ownbtO+n0/qWkvW7UPIfc37WgT6ZGR++EOJyeQDSb9UB+DZ1G6DdLDzyS+b/kBCYGsYgJbSQHuThGKRcw5xdeQf8YdNHsc6ePXrlSYMBuSIAFTGAtQo+VuALo4BX83N190NWZWbynBjhOHsmNfFWLeL6v+ynsA58zDvvAC8j5PkbOcXCMg2PZFk3q8MjI7WAG/Dp9AwP7jdGBOOQkAvlFUB+irtm16I1Zw9YBcpGTGXYmk3kQIC/Cds55l+iMI3jqhjAuaoe+am2Jw5GT3Nbz3CkE12NavmzN5+erJW7046n/CH1RO/RVa8lBLozXk9uqykkGAyRXLWlLv5jyp4RFsG5vGVzpDLnIjTWgnRy2Rr+tDKvRc7Y8AyZq10jj8DqXdnIRNtFZb+t/ZRtXcDiVnzpqx8mPcDWxgARUqx0W1QB9MeUZiNrV4qP+Ehc+BpNgATsTX8ozYKL2NtFYAHc84fG7ndxUPr+AR/iQSns7uSUufAymwDOb2+NjK27lEFocm/EE2WpyIy/Hi66MWuMKJn8RvxIcj87IM5Vh9663ziW36kR0HNenXuxmfaD8JC7tfKbrhFr7LiZCrMjrzTeGx+PmkosrkNzW94ObzwocJ7A1HokLolY+AvkTiD/q1H0cN48c5EL8Crkttsa/AXQVDmutfyku0E7jShx49XqV3MFK8IryDhYVbj7Sj2P2eBxwcXoe8T8idsKKPRcnZw1b+slFTubwUwhktrfnAt7J++jwQtLZcm3sr9LQrjRzz6cfMv9aLvgmnAGvpoaGLxM4mAEaLV7iAzQ3oU0IvD5x9ix3yF2RAAuYAOO2f7PEFWCXZ4C9Pb2UsgDeVnFSpbFK7/IWu7TPTvBqzbGdCHOJQSxiEjt6IyZmxQyEJHv6xyQsYk//moVFsN2zP6fRImjfq7/n/wFDguUQFNEwugAAAABJRU5ErkJggg==');
}
div.callout-important.callout-style-default .callout-caption {
background-color: #f7dddc
}
div.callout-warning {
border-left-color: #f0ad4e !important;
}
div.callout-warning .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAAETklEQVRYCeVWW2gcVRg+58yaTUnizqbipZeX4uWhBEniBaoUX1Ioze52t7sRq6APio9V9MEaoWlVsFasRq0gltaAPuxms8lu0gcviE/FFOstVbSIxgcv6SU7EZqmdc7v9+9mJtNks51NTUH84ed889/PP+cmxP+d5FIbMJmNbpREu4WUkiTtCicKny0l1pIKmBzovF2S+hIJHX8iEu3hZJ5lNZGqyRrGSIQpq15AzF28jgpeY6yk6GVdrfFqdrD6Iw+QlB8g0YS2g7dyQmXM/IDhBhT0UCiRf59lfqmmDvzRt6kByV/m4JjtzuaujMUM2c5Z2d6JdKrRb3K2q6mA+oYVz8JnDdKPmmNthzkAk/lN63sYPgevrguc72aZX/L9C6x09GYyxBgCX4NlvyGUHOKELlm5rXeR1kchuChJt4SSwyddZRXgvwMGvYo4QSlk3/zkHD8UHxwVJA6zjZZqP8v8kK8OWLnIZtLyCAJagYC4rTGW/9Pqj92N/c+LUaAj27movwbi19tk/whRCIE7Q9vyI6yvRpftAKVTdUjOW40X3h5OXsKCdmFcx0xlLJoSuQngnrJe7Kcjm4OMq9FlC7CMmScQANuNvjfP3PjGXDBaUQmbp296S5L4DrpbrHN1T87ZVEZVCzg1FF0Ft+dKrlLukI+/c9ENo+TvlTDbYFvuKPtQ9+l052rXrgKoWkDAFnvh0wTOmYn8R5f4k/jN/fZiCM1tQx9jQQ4ANhqG4hiL0qIFTGViG9DKB7GYzgubnpofgYRwO+DFjh0Zin2m4b/97EDkXkc+f6xYAPX0KK2I/7fUQuwzuwo/L3AkcjugPNixC8cHf0FyPjWlItmLxWw4Ou9YsQCr5fijMGoD/zpdRy95HRysyXA74MWOnscpO4j2y3HAVisw85hX5+AFBRSHt4ShfLFkIMXTqyKFc46xdzQM6XbAi702a7sy04J0+feReMFKp5q9esYLCqAZYw/k14E/xcLLsFElaornTuJB0svMuJINy8xkIYuL+xPAlWRceH6+HX7THJ0djLUom46zREu7tTkxwmf/FdOZ/sh6Q8qvEAiHpm4PJ4a/doJe0gH1t+aHRgCzOvBvJedEK5OFE5jpm4AGP2a8Dxe3gGJ/pAutug9Gp6he92CsSsWBaEcxGx0FHytmIpuqGkOpldqNYQK8cSoXvd+xLxXADw0kf6UkJNFtdo5MOgaLjiQOQHcn+A6h5NuL2s0qsC2LOM75PcF3yr5STuBSAcGG+meA14K/CI21HcS4LBT6tv0QAh8Dr5l93AhZzG5ZJ4VxAqdZUEl9z7WJ4aN+svMvwHHL21UKTd1mqvChH7/Za5xzXBBKrUcB0TQ+Ulgkfbi/H/YT5EptrGzsEK7tR1B7ln9BBwckYfMiuSqklSznIuoIIOM42MQO+QnduCoFCI0bpkzjCjddHPN/F+2Yu+sd9bKNpVwHhbS3LluK/0zgfwD0xYI5dXuzlQAAAABJRU5ErkJggg==');
}
div.callout-warning.callout-style-default .callout-caption {
background-color: #fcefdc
}
div.callout-tip {
border-left-color: #02b875 !important;
}
div.callout-tip .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAADr0lEQVRYCe1XTWgTQRj9ZjZV8a9SPIkKgj8I1bMHsUWrqYLVg4Ue6v9BwZOxSYsIerFao7UiUryIqJcqgtpimhbBXoSCVxUFe9CTiogUrUp2Pt+3aUI2u5vdNh4dmMzOzHvvezuz8xNFM0mjnbXaNu1MvFWRXkXEyE6aYOYJpdW4IXuA4r0fo8qqSMDBU0v1HJUgVieAXxzCsdE/YJTdFcVIZQNMyhruOMJKXYFoLfIfIvVIMWdsrd+Rpd86ZmyzzjJmLStqRn0v8lzkb4rVIXvnpScOJuAn2ACC65FkPzEdEy4TPWRLJ2h7z4cArXzzaOdKlbOvKKX25Wl00jSnrwVxAg3o4dRxhO13RBSdNvH0xSARv3adTXbBdTf64IWO2vH0LT+cv4GR1DJt+DUItaQogeBX/chhbTBxEiZ6gftlDNXTrvT7co4ub5A6gp9HIcHvzTa46OS5fBeP87Qm0fQkr4FsYgVQ7Qg+ZayaDg9jhg1GkWj8RG6lkeSacrrHgDaxdoBiZPg+NXV/KifMuB6//JmYH4CntVEHy/keA6x4h4CU5oFy8GzrBS18cLJMXcljAKB6INjWsRcuZBWVaS3GDrqB7rdapVIeA+isQ57Eev9eCqzqOa81CY05VLd6SamW2wA2H3SiTbnbSxmzfp7WtKZkqy4mdyAlGx7ennghYf8voqp9cLSgKdqNfa6RdRsAAkPwRuJZNbpByn+RrJi1RXTwdi8RQF6ymDwGMAtZ6TVE+4uoKh+MYkcLsT0Hk8eAienbiGdjJHZTpmNjlbFJNKDVAp2fJlYju6IreQxQ08UJDNYdoLSl6AadO+fFuCQqVMB1NJwPm69T04Wv5WhfcWyfXQB+wXRs1pt+nCknRa0LVzSA/2B+a9+zQJadb7IyyV24YAxKp2Jqs3emZTuNnKxsah+uabKbMk7CbTgJx/zIgQYErIeTKRQ9yD9wxVof5YolPHqaWo7TD6tJlh7jQnK5z2n3+fGdggIOx2kaa2YI9QWarc5Ce1ipNWMKeSG4DysFF52KBmTNMmn5HqCFkwy34rDg05gDwgH3bBi+sgFhN/e8QvRn8kbamCOhgrZ9GJhFDgfcMHzFb6BAtjKpFhzTjwv1KCVuxHvCbsSiEz4CANnj84cwHdFXAbAOJ4LTSAawGWFn5tDhLMYz6nWeU2wJfIhmIJBefcd/A5FWQWGgrWzyORZ3Q6HuV+Jf0Bj+BTX69fm1zWgK7By1YTXchFDORywnfQ7GpzOo6S+qECrsx2ifVQAAAABJRU5ErkJggg==');
}
div.callout-tip.callout-style-default .callout-caption {
background-color: #ccf1e3
}
div.callout-caution {
border-left-color: #fd7e14 !important;
}
div.callout-caution .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAACV0lEQVRYCdVWzWoUQRCuqp2ICBLJXgITZL1EfQDBW/bkzUMUD7klD+ATSHBEfAIfQO+iXsWDxJsHL96EHAwhgzlkg8nBg25XWb0zIb0zs9muYYWkoKeru+vn664fBqElyZNuyh167NXJ8Ut8McjbmEraKHkd7uAnAFku+VWdb3reSmRV8PKSLfZ0Gjn3a6Xlcq9YGb6tADjn+lUfTXtVmaZ1KwBIvFI11rRXlWlatwIAAv2asaa9mlB9wwygiDX26qaw1yYPzFXg2N1GgG0FMF8Oj+VIx7E/03lHx8UhvYyNZLN7BwSPgekXXLribw7w5/c8EF+DBK5idvDVYtEEwMeYefjjLAdEyQ3M9nfOkgnPTEkYU+sxMq0BxNR6jExrAI31H1rzvLEfRIdgcv1XEdj6QTQAS2wtstEALLG1yEZ3QhH6oDX7ExBSFEkFINXH98NTrme5IOaaA7kIfiu2L8A3qhH9zRbukdCqdsA98TdElyeMe5BI8Rs2xHRIsoTSSVFfCFCWGPn9XHb4cdobRIWABNf0add9jakDjQJpJ1bTXOJXnnRXHRf+dNL1ZV1MBRCXhMbaHqGI1JkKIL7+i8uffuP6wVQAzO7+qVEbF6NbS0LJureYcWXUUhH66nLR5rYmva+2tjRFtojkM2aD76HEGAD3tPtKM309FJg5j/K682ywcWJ3PASCcycH/22u+Bh7Aa0ehM2Fu4z0SAE81HF9RkB21c5bEn4Dzw+/qNOyXr3DCTQDMBOdhi4nAgiFDGCinIa2owCEChUwD8qzd03PG+qdW/4fDzjUMcE1ZpIAAAAASUVORK5CYII=');
}
div.callout-caution.callout-style-default .callout-caption {
background-color: #ffe5d0
}
</style>
<style type="text/css">
.reveal div.sourceCode {
margin: 0;
overflow: auto;
}
.reveal div.hanging-indent {
margin-left: 1em;
text-indent: -1em;
}
.reveal .slide:not(.center) {
height: 100%;
overflow-y: auto;
}
.reveal .slide.scrollable {
overflow-y: auto;
}
.reveal .footnotes {
height: 100%;
overflow-y: auto;
}
.reveal .slide .absolute {
position: absolute;
display: block;
}
.reveal .footnotes ol {
counter-reset: ol;
list-style-type: none;
margin-left: 0;
}
.reveal .footnotes ol li:before {
counter-increment: ol;
content: counter(ol) ". ";
}
.reveal .footnotes ol li > p:first-child {
display: inline-block;
}
.reveal .slide ul,
.reveal .slide ol {
margin-bottom: 0.5em;
}
.reveal .slide ul li,
.reveal .slide ol li {
margin-top: 0.4em;
margin-bottom: 0.2em;
}
.reveal .slide ul[role="tablist"] li {
margin-bottom: 0;
}
.reveal .slide ul li > *:first-child,
.reveal .slide ol li > *:first-child {
margin-block-start: 0;
}
.reveal .slide ul li > *:last-child,
.reveal .slide ol li > *:last-child {
margin-block-end: 0;
}
.reveal .slide .columns:nth-child(3) {
margin-block-start: 0.8em;
}
.reveal blockquote {
box-shadow: none;
}
.reveal .tippy-content>* {
margin-top: 0.2em;
margin-bottom: 0.7em;
}
.reveal .tippy-content>*:last-child {
margin-bottom: 0.2em;
}
.reveal .slide > img.stretch.quarto-figure-center,
.reveal .slide > img.r-stretch.quarto-figure-center {
display: block;
margin-left: auto;
margin-right: auto;
}
.reveal .slide > img.stretch.quarto-figure-left,
.reveal .slide > img.r-stretch.quarto-figure-left {
display: block;
margin-left: 0;
margin-right: auto;
}
.reveal .slide > img.stretch.quarto-figure-right,
.reveal .slide > img.r-stretch.quarto-figure-right {
display: block;
margin-left: auto;
margin-right: 0;
}
</style>
<script src="Lecture_files/libs/kePrint-0.0.1/kePrint.js"></script>
<link href="Lecture_files/libs/lightable-0.0.1/lightable.css" rel="stylesheet">
</head>
<body class="quarto-light">
<div class="reveal">
<div class="slides">
<section id="title-slide" class="quarto-title-block center">
<h1 class="title">Biodiversity metrics and metabarcoding</h1>
<div class="quarto-title-authors">
<div class="quarto-title-author">
<div class="quarto-title-author-name">
Eric Coissac
</div>
</div>
</div>
<p class="date">2/2/24</p>
</section>
<section id="summary" class="title-slide slide level1 center">
<h1>Summary</h1>
<ul>
<li>The MetabarSchool Package</li>
<li>What do the reading numbers per PCR mean?</li>
<li>Rarefaction vs.&nbsp;relative frequencies</li>
<li>alpha diversity metrics</li>
<li>beta diversity metrics</li>
<li>multidimentionnal analysis</li>
<li>comparison between datasets</li>
</ul>
</section>
<section>
<section id="the-metabarschool-package" class="title-slide slide level1 center">
<h1>The MetabarSchool Package</h1>
</section>
<section id="installing-the-package" class="slide level2">
<h2>Installing the package</h2>
<p>You need the <em>devtools</em> package</p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-1_4f014743d080e19a3e9d61bf83ed067d">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1"></a><span class="fu">install.packages</span>(<span class="st">"devtools"</span>,<span class="at">dependencies =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>Then you can install <em>MetabarSchool</em></p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-2_473ea5a1e6aa397da6d30fc064b86dc5">
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1"></a>devtools<span class="sc">::</span><span class="fu">install_git</span>(<span class="st">"https://git.metabarcoding.org/MetabarcodingSchool/biodiversity-metrics.git"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>You will also need the <em>vegan</em> package</p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-3_7dd268352cd584150bbb98f4fc77024c">
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1"></a><span class="fu">install.packages</span>(<span class="st">"vegan"</span>,<span class="at">dependencies =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section></section>
<section>
<section id="the-dataset" class="title-slide slide level1 center">
<h1>The dataset</h1>
</section>
<section id="the-mock-community" class="slide level2 flexbox vcenter smaller">
<h2>The mock community</h2>
<p>A 16 plants mock community</p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-4_af58d551e08091850a0a7fed05bb892c">
<div class="cell-output-display">
<table class="table" style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:right;"> </th>
<th style="text-align:left;"> species </th>
<th style="text-align:right;"> taxid </th>
<th style="text-align:right;"> Relative aboundance </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right;"> 1 </td>
<td style="text-align:left;"> Taxus baccata </td>
<td style="text-align:right;"> 25629 </td>
<td style="text-align:right;"> 1/2 </td>
</tr>
<tr>
<td style="text-align:right;"> 2 </td>
<td style="text-align:left;"> Salvia pratensis </td>
<td style="text-align:right;"> 49216 </td>
<td style="text-align:right;"> 1/4 </td>
</tr>
<tr>
<td style="text-align:right;"> 3 </td>
<td style="text-align:left;"> Populus tremula </td>
<td style="text-align:right;"> 113636 </td>
<td style="text-align:right;"> 1/8 </td>
</tr>
<tr>
<td style="text-align:right;"> 4 </td>
<td style="text-align:left;"> Rumex acetosa </td>
<td style="text-align:right;"> 41241 </td>
<td style="text-align:right;"> 1/16 </td>
</tr>
<tr>
<td style="text-align:right;"> 5 </td>
<td style="text-align:left;"> Carpinus betulus </td>
<td style="text-align:right;"> 12990 </td>
<td style="text-align:right;"> 1/32 </td>
</tr>
<tr>
<td style="text-align:right;"> 6 </td>
<td style="text-align:left;"> Fraxinus excelsior </td>
<td style="text-align:right;"> 38873 </td>
<td style="text-align:right;"> 1/64 </td>
</tr>
<tr>
<td style="text-align:right;"> 7 </td>
<td style="text-align:left;"> Picea abies </td>
<td style="text-align:right;"> 3329 </td>
<td style="text-align:right;"> 1/128 </td>
</tr>
<tr>
<td style="text-align:right;"> 8 </td>
<td style="text-align:left;"> Lonicera xylosteum </td>
<td style="text-align:right;"> 439142 </td>
<td style="text-align:right;"> 1/256 </td>
</tr>
<tr>
<td style="text-align:right;"> 9 </td>
<td style="text-align:left;"> Abies alba </td>
<td style="text-align:right;"> 45372 </td>
<td style="text-align:right;"> 1/512 </td>
</tr>
<tr>
<td style="text-align:right;"> 10 </td>
<td style="text-align:left;"> Acer campestre </td>
<td style="text-align:right;"> 66205 </td>
<td style="text-align:right;"> 1/1024 </td>
</tr>
<tr>
<td style="text-align:right;"> 11 </td>
<td style="text-align:left;"> Briza media </td>
<td style="text-align:right;"> 281077 </td>
<td style="text-align:right;"> 1/2048 </td>
</tr>
<tr>
<td style="text-align:right;"> 12 </td>
<td style="text-align:left;"> Rosa canina </td>
<td style="text-align:right;"> 74635 </td>
<td style="text-align:right;"> 1/4096 </td>
</tr>
<tr>
<td style="text-align:right;"> 13 </td>
<td style="text-align:left;"> Capsella bursa-pastoris </td>
<td style="text-align:right;"> 3719 </td>
<td style="text-align:right;"> 1/8192 </td>
</tr>
<tr>
<td style="text-align:right;"> 14 </td>
<td style="text-align:left;"> Geranium robertianum </td>
<td style="text-align:right;"> 122183 </td>
<td style="text-align:right;"> 1/16384 </td>
</tr>
<tr>
<td style="text-align:right;"> 15 </td>
<td style="text-align:left;"> Rhododendron ferrugineum </td>
<td style="text-align:right;"> 49622 </td>
<td style="text-align:right;"> 1/32768 </td>
</tr>
<tr>
<td style="text-align:right;"> 16 </td>
<td style="text-align:left;"> Lotus corniculatus </td>
<td style="text-align:right;"> 47247 </td>
<td style="text-align:right;"> 1/65536 </td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="the-experiment" class="slide level2 flexbox vcenter">
<h2>The experiment</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-5_1a00c4f93f4ca45adf92477b259937ee">
</div>
<ul>
<li><p>192 PCR of the mock community using SPER02 trnL-P6-Loop primers</p>
<ul>
<li><p>6 dilutions of the mock community: 1/1, 1/2, 1/4, 1/8, 1/16, 1/32</p></li>
<li><p>32 repeats per dilution</p></li>
</ul></li>
</ul>
</section>
<section id="loading-data" class="slide level2">
<h2>Loading data</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-6_aa8fa7cd691d395d7913a3da636cee65">
<div class="sourceCode cell-code" id="cb4"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1"></a><span class="fu">library</span>(MetabarSchool)</span>
<span id="cb4-2"><a href="#cb4-2"></a></span>
<span id="cb4-3"><a href="#cb4-3"></a><span class="fu">data</span>(<span class="st">"positive.count"</span>)</span>
<span id="cb4-4"><a href="#cb4-4"></a><span class="fu">data</span>(<span class="st">"positive.samples"</span>)</span>
<span id="cb4-5"><a href="#cb4-5"></a><span class="fu">data</span>(<span class="st">"positive.motus"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li><code>positive.count</code> read count matrix <span class="math inline">\(192 \; PCRs \; \times \; 24330 \; MOTUs\)</span></li>
</ul>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-7_b233592318105b969bc00979f8b3bfad">
<div class="cell-output-display">
<table class="table" style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:left;-webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg);"> </th>
<th style="text-align:right;-webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg);"> P000001 </th>
<th style="text-align:center;-webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg);"> P000002 </th>
<th style="text-align:right;-webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg);"> P000003 </th>
<th style="text-align:center;-webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg);"> P000004 </th>
<th style="text-align:right;-webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg);"> P000005 </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> sample.TM_POS_d16_1_a_A1 </td>
<td style="text-align:right;"> 1167 </td>
<td style="text-align:center;"> 4477 </td>
<td style="text-align:right;"> 779 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:right;"> 12 </td>
</tr>
<tr>
<td style="text-align:left;"> sample.TM_POS_d16_1_a_B1 </td>
<td style="text-align:right;"> 1072 </td>
<td style="text-align:center;"> 5077 </td>
<td style="text-align:right;"> 985 </td>
<td style="text-align:center;"> 2 </td>
<td style="text-align:right;"> 8 </td>
</tr>
<tr>
<td style="text-align:left;"> sample.TM_POS_d16_1_b_A2 </td>
<td style="text-align:right;"> 919 </td>
<td style="text-align:center;"> 3599 </td>
<td style="text-align:right;"> 601 </td>
<td style="text-align:center;"> 0 </td>
<td style="text-align:right;"> 10 </td>
</tr>
<tr>
<td style="text-align:left;"> sample.TM_POS_d16_1_b_B2 </td>
<td style="text-align:right;"> 704 </td>
<td style="text-align:center;"> 4129 </td>
<td style="text-align:right;"> 835 </td>
<td style="text-align:center;"> 2 </td>
<td style="text-align:right;"> 15 </td>
</tr>
<tr>
<td style="text-align:left;"> sample.TM_POS_d16_2_a_A1 </td>
<td style="text-align:right;"> 1155 </td>
<td style="text-align:center;"> 5341 </td>
<td style="text-align:right;"> 1023 </td>
<td style="text-align:center;"> 2 </td>
<td style="text-align:right;"> 6 </td>
</tr>
</tbody>
</table>
</div>
</div>
<p><br></p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-8_e3941c11a44c459823749b740d511dde">
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1"></a>positive.count[<span class="dv">1</span><span class="sc">:</span><span class="dv">5</span>,<span class="dv">1</span><span class="sc">:</span><span class="dv">5</span>]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="loading-data-1" class="slide level2">
<h2>Loading data</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-9_9452f59d038f0125dc9665451cfc1d90">
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1"></a><span class="fu">library</span>(MetabarSchool)</span>
<span id="cb6-2"><a href="#cb6-2"></a></span>
<span id="cb6-3"><a href="#cb6-3"></a><span class="fu">data</span>(<span class="st">"positive.count"</span>)</span>
<span id="cb6-4"><a href="#cb6-4"></a><span class="fu">data</span>(<span class="st">"positive.samples"</span>)</span>
<span id="cb6-5"><a href="#cb6-5"></a><span class="fu">data</span>(<span class="st">"positive.motus"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li><code>positive.samples</code> a 192 rows <code>data.frame</code> of 2 columns describing each PCR</li>
</ul>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-10_715e8532b3399252b811fff7d4ac36e6">
<div class="cell-output-display">
<table class="table" style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:left;"> </th>
<th style="text-align:right;"> dilution </th>
<th style="text-align:center;"> repeats </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> sample.TM_POS_d16_1_a_A1 </td>
<td style="text-align:right;"> 2 </td>
<td style="text-align:center;"> 1.a.A1 </td>
</tr>
<tr>
<td style="text-align:left;"> sample.TM_POS_d16_1_a_B1 </td>
<td style="text-align:right;"> 2 </td>
<td style="text-align:center;"> 1.a.B1 </td>
</tr>
<tr>
<td style="text-align:left;"> sample.TM_POS_d16_1_b_A2 </td>
<td style="text-align:right;"> 2 </td>
<td style="text-align:center;"> 1.b.A2 </td>
</tr>
</tbody>
</table>
</div>
</div>
<p><br></p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-11_6ed5f6c941da70603f94f3f75037307f">
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1"></a><span class="fu">head</span>(positive.samples,<span class="at">n=</span><span class="dv">3</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="loading-data-2" class="slide level2">
<h2>Loading data</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-12_fe13efba6fb9eada97bb84aa82e54459">
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1"></a><span class="fu">library</span>(MetabarSchool)</span>
<span id="cb8-2"><a href="#cb8-2"></a></span>
<span id="cb8-3"><a href="#cb8-3"></a><span class="fu">data</span>(<span class="st">"positive.count"</span>)</span>
<span id="cb8-4"><a href="#cb8-4"></a><span class="fu">data</span>(<span class="st">"positive.samples"</span>)</span>
<span id="cb8-5"><a href="#cb8-5"></a><span class="fu">data</span>(<span class="st">"positive.motus"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li><code>positive.motus</code> : a 24330 rows <code>data.frame</code> of 4 columns describing each MOTU</li>
</ul>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-13_589dc449794f7d6ebcf7ebbfbc09e449">
<div class="cell-output-display">
<table class="table" style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:left;"> </th>
<th style="text-align:right;"> dilution </th>
<th style="text-align:left;"> species </th>
<th style="text-align:right;"> taxid </th>
<th style="text-align:center;"> true </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> P000001 </td>
<td style="text-align:right;"> 0.250 </td>
<td style="text-align:left;"> Salvia pratensis </td>
<td style="text-align:right;"> 49216 </td>
<td style="text-align:center;"> TRUE </td>
</tr>
<tr>
<td style="text-align:left;"> P000002 </td>
<td style="text-align:right;"> 0.125 </td>
<td style="text-align:left;"> Populus tremula </td>
<td style="text-align:right;"> 113636 </td>
<td style="text-align:center;"> TRUE </td>
</tr>
<tr>
<td style="text-align:left;"> P000003 </td>
<td style="text-align:right;"> 0.500 </td>
<td style="text-align:left;"> Taxus baccata </td>
<td style="text-align:right;"> 25629 </td>
<td style="text-align:center;"> TRUE </td>
</tr>
</tbody>
</table>
</div>
</div>
<p><br></p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-14_8911c14532e43e8ae0f12465bda3dcbe">
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1"></a><span class="fu">head</span>(positive.motus,<span class="at">n=</span><span class="dv">3</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="removing-singleton-sequences" class="slide level2 flexbox vcenter">
<h2>Removing singleton sequences</h2>
<p>Singleton sequences are observed only once over the complete dataset.</p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-15_a913f2ed01f31bb07967182dbc92060d">
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1"></a><span class="fu">table</span>(<span class="fu">colSums</span>(positive.count) <span class="sc">==</span> <span class="dv">1</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-16_b09366941f19e703bd103d53d7782a5a">
<div class="cell-output-display">
<table class="table" style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:right;text-align: center;"> FALSE </th>
<th style="text-align:right;text-align: center;"> TRUE </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right;"> 5579 </td>
<td style="text-align:right;"> 18751 </td>
</tr>
</tbody>
</table>
</div>
</div>
<p><br></p>
<p>We discard them they are unanimously considered as rubbish.</p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-17_6a57789c5a23bf6c0653a8a21daed5d3">
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1"></a>are.not.singleton <span class="ot">=</span> <span class="fu">colSums</span>(positive.count) <span class="sc">&gt;</span> <span class="dv">1</span></span>
<span id="cb11-2"><a href="#cb11-2"></a>positive.count <span class="ot">=</span> positive.count[,are.not.singleton]</span>
<span id="cb11-3"><a href="#cb11-3"></a>positive.motus <span class="ot">=</span> positive.motus[are.not.singleton,]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<ul>
<li><code>positive.count</code> is now a <span class="math inline">\(192 \; PCRs \; \times \; 5579 \; MOTUs\)</span> matrix</li>
</ul>
</section>
<section id="not-all-the-pcr-have-the-same-number-of-reads" class="slide level2 flexbox vcenter">
<h2>Not all the PCR have the same number of reads</h2>
<p>Despite all standardization efforts</p>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-18-1.png" width="960" class="r-stretch"><div class="green">
<p>Is it related to the amount of DNA in the extract ?</p>
</div>
</section>
<section id="what-do-the-reading-numbers-per-pcr-mean" class="slide level2 smaller">
<h2>What do the reading numbers per PCR mean?</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-19_bec4aeb3fe98f4d9d879827492fcd3f5">
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1"></a><span class="fu">par</span>(<span class="at">bg=</span><span class="cn">NA</span>) </span>
<span id="cb12-2"><a href="#cb12-2"></a><span class="fu">boxplot</span>(<span class="fu">rowSums</span>(positive.count) <span class="sc">~</span> positive.samples<span class="sc">$</span>dilution,<span class="at">log=</span><span class="st">"y"</span>)</span>
<span id="cb12-3"><a href="#cb12-3"></a><span class="fu">abline</span>(<span class="at">h =</span> <span class="fu">median</span>(<span class="fu">rowSums</span>(positive.count)),<span class="at">lw=</span><span class="dv">2</span>,<span class="at">col=</span><span class="st">"red"</span>,<span class="at">lty=</span><span class="dv">2</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-19-1.png" width="960" class="r-stretch"><div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-20_97df4081b32c5a7d1223f099a89e5a0c">
</div>
<div class="red2">
<center>
Only 7.4% of the PCR read count variation is explain by dilution
</center>
</div>
</section>
<section id="you-must-normalize-your-read-counts" class="slide level2">
<h2>You must normalize your read counts</h2>
<p>Two options:</p>
<h3 id="rarefaction">Rarefaction</h3>
<p>Randomly subsample the same number of reads for all the PCRs</p>
<h3 id="relative-frequencies">Relative frequencies</h3>
<p>Divide the read count of each MOTU in each sample by the total total read count of the same sample</p>
<p><span class="math display">\[
\text{Relative fequency}(Motu_i,Sample_j) = \frac{\text{Read count}(Motu_i,Sample_j)}{\sum_{k=1}^n\text{Read count}(Motu_k,Sample_j)}
\]</span></p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-21_c85f9422f3fa85d69aa97bc99b274e49">
<div class="sourceCode cell-code" id="cb13"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1"></a><span class="fu">library</span>(vegan)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="rarefying-read-count-1" class="slide level2 flexbox vcenter">
<h2>Rarefying read count (1)</h2>
<ul>
<li>We look for the minimum read number per PCR</li>
</ul>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-22_6323efdf6d021e3924591e9f5911371e">
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1"></a><span class="fu">min</span>(<span class="fu">rowSums</span>(positive.count))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 2065</code></pre>
</div>
</div>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-23_78c18bdaaa30f23aaff1ee75f757b1fe">
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb16-1"><a href="#cb16-1"></a>positive.count.rarefied <span class="ot">=</span> <span class="fu">rrarefy</span>(positive.count,<span class="dv">2000</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="rarefying-read-count-2" class="slide level2 flexbox vcenter">
<h2>Rarefying read count (2)</h2>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-24-1.png" width="960" class="r-stretch"></section>
<section id="rarefying-read-count-3" class="slide level2 flexbox vcenter">
<h2>Rarefying read count (3)</h2>
<p>Identifying the MOTUs with reads count greater than <span class="math inline">\(0\)</span> after rarefaction.</p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-25_a54520957b6be2daad52bf077ecd7e9e">
<div class="sourceCode cell-code" id="cb17"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1"></a>are.still.present <span class="ot">=</span> <span class="fu">colSums</span>(positive.count.rarefied)<span class="sc">&gt;</span><span class="dv">0</span></span>
<span id="cb17-2"><a href="#cb17-2"></a>are.still.present[<span class="dv">1</span><span class="sc">:</span><span class="dv">5</span>]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>P000001 P000002 P000003 P000004 P000005
TRUE TRUE TRUE TRUE TRUE </code></pre>
</div>
</div>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-26_d8b1719ecef71c0f2523948477ecddb0">
<div class="sourceCode cell-code" id="cb19"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1"></a><span class="fu">table</span>(are.still.present)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>are.still.present
FALSE TRUE
1876 3703 </code></pre>
</div>
</div>
</section>
<section id="rarefying-read-count-4" class="slide level2 flexbox vcenter">
<h2>Rarefying read count (4)</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-27_102e713064323bb3c07fde4a539c786f">
<div class="sourceCode cell-code" id="cb21"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1"></a><span class="fu">par</span>(<span class="at">bg=</span><span class="cn">NA</span>) </span>
<span id="cb21-2"><a href="#cb21-2"></a><span class="fu">boxplot</span>(<span class="fu">colSums</span>(positive.count) <span class="sc">~</span> are.still.present, <span class="at">log=</span><span class="st">"y"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-27-1.png" width="960" class="r-stretch"><p>The MOTUs removed by rarefaction were at most occurring 20 times</p>
<p>The MOTUs kept by rarefaction were at least occurring 2 times</p>
</section>
<section id="rarefying-read-count-5" class="slide level2 vcenter">
<h2>Rarefying read count (5)</h2>
<h3 id="keep-only-sequences-with-reads-after-rarefaction">Keep only sequences with reads after rarefaction</h3>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-28_3085af6a3b6f3b587639a3592005c4cf">
<div class="sourceCode cell-code" id="cb22"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb22-1"><a href="#cb22-1"></a>positive.count.rarefied <span class="ot">=</span> positive.count.rarefied[,are.still.present]</span>
<span id="cb22-2"><a href="#cb22-2"></a>positive.motus.rare <span class="ot">=</span> positive.motus[are.still.present,]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<center>
positive.motus.rare is now a <span class="math inline">\(192 \; PCRs \; \times \; 3703 \; MOTUs\)</span>
</center>
</section>
<section id="why-rarefying" class="slide level2 vcenter columns-2">
<h2>Why rarefying ?</h2>
<img data-src="figures/subsampling.svg" width="200" class="r-stretch"><p><br><br><br><br> Increasing the number of reads just increase the description of the subpart of the PCR you have sequenced.</p>
</section>
<section id="transforming-read-counts-to-relative-frequencies" class="slide level2">
<h2>Transforming read counts to relative frequencies</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-30_e93ca8b263c45f19379af2b6c22d9dd6">
<div class="sourceCode cell-code" id="cb23"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb23-1"><a href="#cb23-1"></a>positive.count.relfreq <span class="ot">=</span> <span class="fu">decostand</span>(positive.count,</span>
<span id="cb23-2"><a href="#cb23-2"></a> <span class="at">method =</span> <span class="st">"total"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>No sequences will be set to zero</p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-31_fe65419ca442bc16a2c5f209e9b70b11">
<div class="sourceCode cell-code" id="cb24"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb24-1"><a href="#cb24-1"></a><span class="fu">table</span>(<span class="fu">colSums</span>(positive.count.relfreq) <span class="sc">==</span> <span class="dv">0</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
FALSE
5579 </code></pre>
</div>
</div>
</section></section>
<section>
<section id="measuring-diversity" class="title-slide slide level1 center">
<h1>Measuring diversity</h1>
</section>
<section id="the-different-types-of-diversity" class="slide level2 vcenter">
<h2>The different types of diversity</h2>
<div style="float: left; width: 40%;">
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-32_34d69e2ef17199ba7bcd66614bd08b2f">
<div class="cell-output-display">
<p><img data-src="figures/diversity.svg"></p>
</div>
</div>
</div>
<div style="float: left; width: 60%;">
<p><br><br> <span class="citation" data-cites="Whittaker:10:00">Whittaker (<a href="#/bibliography" role="doc-biblioref" onclick="">2010</a>)</span> <br><br><br><br></p>
<ul>
<li><p><span class="math inline">\(\alpha\text{-diversity}\)</span> : Mean diversity per site (<span class="math inline">\(species/site\)</span>)</p></li>
<li><p><span class="math inline">\(\gamma\text{-diversity}\)</span> : Regional biodiversity (<span class="math inline">\(species/region\)</span>)</p></li>
<li><p><span class="math inline">\(\beta\text{-diversity}\)</span> : <span class="math inline">\(\beta = \frac{\gamma}{\alpha}\)</span> (<span class="math inline">\(sites/region\)</span>)</p></li>
</ul>
</div>
</section></section>
<section>
<section id="alpha-diversity" class="title-slide slide level1 center">
<h1><span class="math inline">\(\alpha\)</span>-diversity</h1>
</section>
<section id="which-is-th-most-diverse-environment" class="slide level2 flexbox vcenter">
<h2>Which is th most diverse environment ?</h2>
<img data-src="figures/alpha_diversity.svg" width="400" class="r-stretch"><div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-34_eca58b8bda3f9e8afddd86aa4a7f9700">
<div class="cell-output-display">
<table class="table" style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:left;"> </th>
<th style="text-align:right;"> A </th>
<th style="text-align:right;"> B </th>
<th style="text-align:right;"> C </th>
<th style="text-align:right;"> D </th>
<th style="text-align:right;"> E </th>
<th style="text-align:right;"> F </th>
<th style="text-align:right;"> G </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Environment.1 </td>
<td style="text-align:right;"> 0.25 </td>
<td style="text-align:right;"> 0.25 </td>
<td style="text-align:right;"> 0.25 </td>
<td style="text-align:right;"> 0.25 </td>
<td style="text-align:right;"> 0.00 </td>
<td style="text-align:right;"> 0.00 </td>
<td style="text-align:right;"> 0.00 </td>
</tr>
<tr>
<td style="text-align:left;"> Environment.2 </td>
<td style="text-align:right;"> 0.55 </td>
<td style="text-align:right;"> 0.07 </td>
<td style="text-align:right;"> 0.02 </td>
<td style="text-align:right;"> 0.17 </td>
<td style="text-align:right;"> 0.07 </td>
<td style="text-align:right;"> 0.07 </td>
<td style="text-align:right;"> 0.03 </td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="richness" class="slide level2 flexbox vcenter">
<h2>Richness</h2>
<p>The actual number of species present in your environement whatever their aboundances</p>
<img data-src="figures/alpha_diversity.svg" width="400" class="r-stretch"><div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-36_d3863c48cb5a6e4e3df49b14983f069b">
<div class="sourceCode cell-code" id="cb26"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb26-1"><a href="#cb26-1"></a>S <span class="ot">=</span> <span class="fu">rowSums</span>(environments <span class="sc">&gt;</span> <span class="dv">0</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-37_0788f06197008111ca9939f5d35a00e4">
<div class="cell-output-display">
<table class="table" style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:left;"> </th>
<th style="text-align:right;"> S </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Environment.1 </td>
<td style="text-align:right;"> 4 </td>
</tr>
<tr>
<td style="text-align:left;"> Environment.2 </td>
<td style="text-align:right;"> 7 </td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="gini-simpsons-index" class="slide level2 smaller">
<h2>Gini-Simpsons index</h2>
<div style="float: left; width: 60%;">
<p>The Simpsons index is the probability of having the same species twice when you randomly select two specimens. <br> <br></p>
</div>
<div style="float: right; width: 40%;">
<p><span class="math display">\[
\lambda =\sum _{i=1}^{S}p_{i}^{2}
\]</span> <br></p>
</div>
<center>
<p><span class="math inline">\(\lambda\)</span> decrease when complexity of your ecosystem increase.</p>
<p>Gini-Simpsons index defined as <span class="math inline">\(1-\lambda\)</span> increase with diversity</p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-38_2aecca5507daaf318a80a02b8dfde0a8">
<div class="cell-output-display">
<p><img data-src="figures/alpha_diversity.svg" width="250"></p>
</div>
</div>
</center>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-39_5af0dad8d680563cb52deb6cf4589162">
<div class="sourceCode cell-code" id="cb27"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb27-1"><a href="#cb27-1"></a>GS <span class="ot">=</span> <span class="dv">1</span> <span class="sc">-</span> <span class="fu">rowSums</span>(environments<span class="sc">^</span><span class="dv">2</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-40_1d490d6d3e84745dcec9736b6bbd795c">
<div class="cell-output-display">
<table class="table" style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:left;"> </th>
<th style="text-align:right;"> Gini.Simpson </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Environment.1 </td>
<td style="text-align:right;"> 0.7500 </td>
</tr>
<tr>
<td style="text-align:left;"> Environment.2 </td>
<td style="text-align:right;"> 0.6526 </td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="shannon-entropy" class="slide level2 smaller">
<h2>Shannon entropy</h2>
<p>Shannon entropy is based on information theory:</p>
<center>
<span class="math inline">\(H^{\prime }=-\sum _{i=1}^{S}p_{i}\log p_{i}\)</span>
</center>
<p>if <span class="math inline">\(A\)</span> is a community where every species are equally represented then <span class="math display">\[
H(A) = \log|A|
\]</span></p>
<center>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-41_fd31ed6a57082c3705a99ab6178e84dd">
<div class="cell-output-display">
<p><img data-src="figures/alpha_diversity.svg" width="400"></p>
</div>
</div>
</center>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-42_158d506138598bcce463cc8dae0014f7">
<div class="sourceCode cell-code" id="cb28"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb28-1"><a href="#cb28-1"></a>H <span class="ot">=</span> <span class="sc">-</span> <span class="fu">rowSums</span>(environments <span class="sc">*</span> <span class="fu">log</span>(environments),<span class="at">na.rm =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-43_6e706231ba0e50af5de5d06ebc4ae62d">
<div class="cell-output-display">
<table class="table" style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:left;"> </th>
<th style="text-align:right;"> Shannon.index </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Environment.1 </td>
<td style="text-align:right;"> 1.386294 </td>
</tr>
<tr>
<td style="text-align:left;"> Environment.2 </td>
<td style="text-align:right;"> 1.371925 </td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="hills-number" class="slide level2 smaller">
<h2>Hills number</h2>
<div style="float: left; width: 50%;">
<p>As : <span class="math display">\[
H(A) = \log|A| \;\Rightarrow\; ^1D = e^{H(A)}
\]</span> <br></p>
</div>
<div style="float: right; width: 50%;">
<p>where <span class="math inline">\(^1D\)</span> is the theoretical number of species in a evenly distributed community that would have the same Shannons entropy than ours.</p>
</div>
<center>
<p><br> <br></p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-44_98f1b0859a3e5d2caaea86763d3dfd06">
<div class="cell-output-display">
<p><img data-src="figures/alpha_diversity.svg" width="400"></p>
</div>
</div>
</center>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-45_8c468bf456e88271e0a88a0f819abaf0">
<div class="sourceCode cell-code" id="cb29"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb29-1"><a href="#cb29-1"></a>D2 <span class="ot">=</span> <span class="fu">exp</span>(<span class="sc">-</span> <span class="fu">rowSums</span>(environments <span class="sc">*</span> <span class="fu">log</span>(environments),<span class="at">na.rm =</span> <span class="cn">TRUE</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-46_6383aa90ab3cc8ece63baa4de81b4e84">
<div class="cell-output-display">
<table class="table" style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:left;"> </th>
<th style="text-align:right;"> Hill.Numbers </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;"> Environment.1 </td>
<td style="text-align:right;"> 4.000000 </td>
</tr>
<tr>
<td style="text-align:left;"> Environment.2 </td>
<td style="text-align:right;"> 3.942933 </td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section id="generalized-logaritmic-function" class="slide level2 smaller">
<h2>Generalized logaritmic function</h2>
<p>Based on the generalized entropy <span class="citation" data-cites="Tsallis:94:00">Tsallis (<a href="#/bibliography" role="doc-biblioref" onclick="">1994</a>)</span> we can propose a generalized form of logarithm.</p>
<p><span class="math display">\[
^q\log(x) = \frac{x^{(1-q)}-1}{1-q}
\]</span></p>
<p>The function is not defined for <span class="math inline">\(q=1\)</span> but when <span class="math inline">\(q \longrightarrow 1\;,\; ^q\log(x) \longrightarrow \log(x)\)</span></p>
<p><span class="math display">\[
^q\log(x) = \left\{
\begin{align}
\log(x),&amp; \text{if } q = 1\\
\frac{x^{(1-q)}-1}{1-q},&amp; \text{otherwise}
\end{align}
\right.
\]</span></p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-47_9472654bcff153f84cce31a9620c2086">
<div class="sourceCode cell-code" id="cb30"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb30-1"><a href="#cb30-1"></a>log_q <span class="ot">=</span> <span class="cf">function</span>(x,<span class="at">q=</span><span class="dv">1</span>) {</span>
<span id="cb30-2"><a href="#cb30-2"></a> <span class="cf">if</span> (q<span class="sc">==</span><span class="dv">1</span>)</span>
<span id="cb30-3"><a href="#cb30-3"></a> <span class="fu">log</span>(x)</span>
<span id="cb30-4"><a href="#cb30-4"></a> <span class="cf">else</span> </span>
<span id="cb30-5"><a href="#cb30-5"></a> (x<span class="sc">^</span>(<span class="dv">1</span><span class="sc">-</span>q)<span class="sc">-</span><span class="dv">1</span>)<span class="sc">/</span>(<span class="dv">1</span><span class="sc">-</span>q)</span>
<span id="cb30-6"><a href="#cb30-6"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="impact-of-q-on-the-log_q-function" class="slide level2">
<h2>Impact of <span class="math inline">\(q\)</span> on the <code>log_q</code> function</h2>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-48-1.png" width="960" class="r-stretch"></section>
<section id="and-its-inverse-function" class="slide level2 flexbox vcenter">
<h2>And its inverse function</h2>
<p><span class="math display">\[
^qe^x = \left\{
\begin{align}
e^x,&amp; \text{if } x = 1 \\
(1 + x(1-q))^{(\frac{1}{1-q})},&amp; \text{otherwise}
\end{align}
\right.
\]</span></p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-49_2648e0c8057c83ac743fb18953ba9632">
<div class="sourceCode cell-code" id="cb31"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb31-1"><a href="#cb31-1"></a>exp_q <span class="ot">=</span> <span class="cf">function</span>(x,<span class="at">q=</span><span class="dv">1</span>) {</span>
<span id="cb31-2"><a href="#cb31-2"></a> <span class="cf">if</span> (q<span class="sc">==</span><span class="dv">1</span>)</span>
<span id="cb31-3"><a href="#cb31-3"></a> <span class="fu">exp</span>(x)</span>
<span id="cb31-4"><a href="#cb31-4"></a> <span class="cf">else</span></span>
<span id="cb31-5"><a href="#cb31-5"></a> (<span class="dv">1</span> <span class="sc">+</span> (<span class="dv">1</span><span class="sc">-</span>q)<span class="sc">*</span>x)<span class="sc">^</span>(<span class="dv">1</span><span class="sc">/</span>(<span class="dv">1</span><span class="sc">-</span>q))</span>
<span id="cb31-6"><a href="#cb31-6"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="generalised-shannon-entropy" class="slide level2">
<h2>Generalised Shannon entropy</h2>
<p><span class="math display">\[
^qH = - \sum_{i=1}^S p_i \; ^q\log p_i
\]</span></p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-50_568c9e09c3b75d01f8b970798236e012">
<div class="sourceCode cell-code" id="cb32"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb32-1"><a href="#cb32-1"></a>H_q <span class="ot">=</span> <span class="cf">function</span>(x,<span class="at">q=</span><span class="dv">1</span>) {</span>
<span id="cb32-2"><a href="#cb32-2"></a> <span class="fu">sum</span>(x <span class="sc">*</span> <span class="fu">log_q</span>(<span class="dv">1</span><span class="sc">/</span>x,q),<span class="at">na.rm =</span> <span class="cn">TRUE</span>)</span>
<span id="cb32-3"><a href="#cb32-3"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p>and generalized the previously presented Hills number</p>
<p><span class="math display">\[
^qD=^qe^{^qH}
\]</span></p>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-51_83284650c9d855b57b868682f7bc2f01">
<div class="sourceCode cell-code" id="cb33"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb33-1"><a href="#cb33-1"></a> D_q <span class="ot">=</span> <span class="cf">function</span>(x,<span class="at">q=</span><span class="dv">1</span>) {</span>
<span id="cb33-2"><a href="#cb33-2"></a> <span class="fu">exp_q</span>(<span class="fu">H_q</span>(x,q),q)</span>
<span id="cb33-3"><a href="#cb33-3"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="biodiversity-spectrum-1" class="slide level2 flexbox vcenter">
<h2>Biodiversity spectrum (1)</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-52_7eb7545d22a76719d96ea4b95e03d55d">
<div class="sourceCode cell-code" id="cb34"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb34-1"><a href="#cb34-1"></a>H_spectrum <span class="ot">=</span> <span class="cf">function</span>(x,<span class="at">q=</span><span class="dv">1</span>) {</span>
<span id="cb34-2"><a href="#cb34-2"></a> <span class="fu">sapply</span>(q,<span class="cf">function</span>(Q) <span class="fu">H_q</span>(x,Q))</span>
<span id="cb34-3"><a href="#cb34-3"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-53_27aeb3c68698acd35d062c39b283938a">
<div class="sourceCode cell-code" id="cb35"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb35-1"><a href="#cb35-1"></a>D_spectrum <span class="ot">=</span> <span class="cf">function</span>(x,<span class="at">q=</span><span class="dv">1</span>) {</span>
<span id="cb35-2"><a href="#cb35-2"></a> <span class="fu">sapply</span>(q,<span class="cf">function</span>(Q) <span class="fu">D_q</span>(x,Q))</span>
<span id="cb35-3"><a href="#cb35-3"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="biodiversity-spectrum-2" class="slide level2">
<h2>Biodiversity spectrum (2)</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-54_2793ca778c041a0470d49c695356c062">
<div class="sourceCode cell-code" id="cb36"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb36-1"><a href="#cb36-1"></a><span class="fu">library</span>(MetabarSchool)</span>
<span id="cb36-2"><a href="#cb36-2"></a>qs <span class="ot">=</span> <span class="fu">seq</span>(<span class="at">from=</span><span class="dv">0</span>,<span class="at">to=</span><span class="dv">3</span>,<span class="at">by=</span><span class="fl">0.1</span>)</span>
<span id="cb36-3"><a href="#cb36-3"></a>environments.hq <span class="ot">=</span> <span class="fu">apply</span>(environments,<span class="at">MARGIN =</span> <span class="dv">1</span>,H_spectrum,<span class="at">q=</span>qs)</span>
<span id="cb36-4"><a href="#cb36-4"></a>environments.dq <span class="ot">=</span> <span class="fu">apply</span>(environments,<span class="at">MARGIN =</span> <span class="dv">1</span>,D_spectrum,<span class="at">q=</span>qs)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-55-1.png" width="960" class="r-stretch"></section>
<section id="generalized-entropy-vs-alpha-diversity-indices" class="slide level2">
<h2>Generalized entropy <span class="math inline">\(vs\)</span> <span class="math inline">\(\alpha\)</span>-diversity indices</h2>
<ul>
<li><p><span class="math inline">\(^0H(X) = S - 1\)</span> : the richness minus one.</p></li>
<li><p><span class="math inline">\(^1H(X) = H^{\prime}\)</span> : the Shannons entropy.</p></li>
<li><p><span class="math inline">\(^2H(X) = 1 - \lambda\)</span> : Gini-Simpsons index.</p></li>
</ul>
<h3 class="smaller" id="when-computing-the-exponential-of-entropy-hills-number">When computing the exponential of entropy : Hills number</h3>
<ul>
<li><p><span class="math inline">\(^0D(X) = S\)</span> : The richness.</p></li>
<li><p><span class="math inline">\(^1D(X) = e^{H^{\prime}}\)</span> : The number of species in an even community having the same <span class="math inline">\(H^{\prime}\)</span>.</p></li>
<li><p><span class="math inline">\(^2D(X) = 1 / \lambda\)</span> : The number of species in an even community having the same Gini-Simpsons index.</p></li>
</ul>
<p><br></p>
<center>
<p><span class="math inline">\(q\)</span> can be considered as a penality you give to rare species</p>
<p><strong>when</strong> <span class="math inline">\(q=0\)</span> all the species have the same weight</p>
</center>
</section>
<section id="biodiversity-spectrum-of-the-mock-community" class="slide level2">
<h2>Biodiversity spectrum of the mock community</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-56_cecee879e2d38cdd8e2e416204e432a8">
<div class="sourceCode cell-code" id="cb37"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb37-1"><a href="#cb37-1"></a>H.mock <span class="ot">=</span> <span class="fu">H_spectrum</span>(plants<span class="fl">.16</span><span class="sc">$</span>dilution,qs)</span>
<span id="cb37-2"><a href="#cb37-2"></a>D.mock <span class="ot">=</span> <span class="fu">D_spectrum</span>(plants<span class="fl">.16</span><span class="sc">$</span>dilution,qs)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-57-1.png" width="960" class="r-stretch"></section>
<section id="biodiversity-spectrum-and-metabarcoding-1" class="slide level2 smaller">
<h2>Biodiversity spectrum and metabarcoding (1)</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-58_a1de30705be4967d4674ed54ecdb8f33">
<div class="sourceCode cell-code" id="cb38"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb38-1"><a href="#cb38-1"></a>positive.H <span class="ot">=</span> <span class="fu">apply</span>(positive.count.relfreq,</span>
<span id="cb38-2"><a href="#cb38-2"></a> <span class="at">MARGIN =</span> <span class="dv">1</span>,</span>
<span id="cb38-3"><a href="#cb38-3"></a> <span class="at">FUN =</span> H_spectrum,</span>
<span id="cb38-4"><a href="#cb38-4"></a> <span class="at">q=</span>qs)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-59-1.png" width="960" class="r-stretch"></section>
<section id="biodiversity-spectrum-and-metabarcoding-2" class="slide level2 flexbox vcenter smaller">
<h2>Biodiversity spectrum and metabarcoding (2)</h2>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-60-1.png" width="960" class="r-stretch"></section>
<section id="biodiversity-spectrum-and-metabarcoding-3" class="slide level2 smaller">
<h2>Biodiversity spectrum and metabarcoding (3)</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-61_353bb7017238da3dd48975829953793c">
<div class="sourceCode cell-code" id="cb39"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb39-1"><a href="#cb39-1"></a>positive.D <span class="ot">=</span> <span class="fu">apply</span>(positive.count.relfreq,</span>
<span id="cb39-2"><a href="#cb39-2"></a> <span class="at">MARGIN =</span> <span class="dv">1</span>,</span>
<span id="cb39-3"><a href="#cb39-3"></a> <span class="at">FUN =</span> D_spectrum,</span>
<span id="cb39-4"><a href="#cb39-4"></a> <span class="at">q=</span>qs)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-62-1.png" width="960" class="r-stretch"></section>
<section id="impact-of-data-cleaning-on-alpha-diversity-1" class="slide level2">
<h2>Impact of data cleaning on <span class="math inline">\(\alpha\)</span>-diversity (1)</h2>
<p>We realize a basic cleaning:</p>
<ul>
<li>removing signletons</li>
<li>too short or long sequences</li>
<li>clustering data using <code>obiclean</code></li>
</ul>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-63_f37a925cf5fae9030349a50f0cda7092">
<div class="sourceCode cell-code" id="cb40"><pre class="sourceCode numberSource bash number-lines code-with-copy"><code class="sourceCode bash"><span id="cb40-1"><a href="#cb40-1"></a><span class="ex">obigrep</span> <span class="at">-p</span> <span class="st">'count &gt; 1'</span> <span class="dt">\</span></span>
<span id="cb40-2"><a href="#cb40-2"></a> positifs.uniq.annotated.fasta <span class="dt">\</span></span>
<span id="cb40-3"><a href="#cb40-3"></a> <span class="op">&gt;</span> positifs.uniq.annotated.no.singleton.fasta</span>
<span id="cb40-4"><a href="#cb40-4"></a></span>
<span id="cb40-5"><a href="#cb40-5"></a><span class="ex">obigrep</span> <span class="at">-l</span> 10 <span class="at">-L</span> 150 <span class="dt">\</span></span>
<span id="cb40-6"><a href="#cb40-6"></a> positifs.uniq.annotated.no.singleton.fasta <span class="dt">\</span></span>
<span id="cb40-7"><a href="#cb40-7"></a> <span class="op">&gt;</span> positifs.uniq.annotated.good.length.fasta</span>
<span id="cb40-8"><a href="#cb40-8"></a></span>
<span id="cb40-9"><a href="#cb40-9"></a><span class="ex">obiclean</span> <span class="at">-s</span> merged_sample <span class="at">-H</span> <span class="at">-C</span> <span class="at">-r</span> 0.1 <span class="dt">\</span></span>
<span id="cb40-10"><a href="#cb40-10"></a> positifs.uniq.annotated.good.length.fasta <span class="dt">\</span></span>
<span id="cb40-11"><a href="#cb40-11"></a> <span class="op">&gt;</span> positifs.uniq.annotated.clean.fasta</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="impact-of-data-cleaning-on-alpha-diversity-2" class="slide level2">
<h2>Impact of data cleaning on <span class="math inline">\(\alpha\)</span>-diversity (2)</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-64_3e757aba076ee73163ebe2cc1b3a9b68">
<div class="sourceCode cell-code" id="cb41"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb41-1"><a href="#cb41-1"></a><span class="fu">data</span>(positive.clean.count)</span>
<span id="cb41-2"><a href="#cb41-2"></a></span>
<span id="cb41-3"><a href="#cb41-3"></a>positive.clean.count.relfreq <span class="ot">=</span> <span class="fu">decostand</span>(positive.clean.count,</span>
<span id="cb41-4"><a href="#cb41-4"></a> <span class="at">method =</span> <span class="st">"total"</span>)</span>
<span id="cb41-5"><a href="#cb41-5"></a></span>
<span id="cb41-6"><a href="#cb41-6"></a>positive.clean.H <span class="ot">=</span> <span class="fu">apply</span>(positive.clean.count.relfreq,</span>
<span id="cb41-7"><a href="#cb41-7"></a> <span class="at">MARGIN =</span> <span class="dv">1</span>,</span>
<span id="cb41-8"><a href="#cb41-8"></a> <span class="at">FUN =</span> H_spectrum,</span>
<span id="cb41-9"><a href="#cb41-9"></a> <span class="at">q=</span>qs)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-65-1.png" width="960" class="r-stretch"></section>
<section id="impact-of-data-cleaning-on-alpha-diversity-3" class="slide level2">
<h2>Impact of data cleaning on <span class="math inline">\(\alpha\)</span>-diversity (3)</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-66_72d15948db7f70d0e6989e0928b2ac8d">
<div class="sourceCode cell-code" id="cb42"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb42-1"><a href="#cb42-1"></a>positive.clean.D <span class="ot">=</span> <span class="fu">apply</span>(positive.clean.count.relfreq,</span>
<span id="cb42-2"><a href="#cb42-2"></a> <span class="at">MARGIN =</span> <span class="dv">1</span>,</span>
<span id="cb42-3"><a href="#cb42-3"></a> <span class="at">FUN =</span> D_spectrum,</span>
<span id="cb42-4"><a href="#cb42-4"></a> <span class="at">q=</span>qs)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-67-1.png" width="960" class="r-stretch"></section></section>
<section>
<section id="beta-diversity" class="title-slide slide level1 center">
<h1><span class="math inline">\(\beta\)</span>-diversity</h1>
</section>
<section id="dissimilarity-indices-or-non-metric-distances" class="slide level2 flexbox vcenter">
<h2>Dissimilarity indices or non-metric distances</h2>
<center>
A dissimilarity index <span class="math inline">\(d(A,B)\)</span> is a numerical measurement <br> of how far apart objects <span class="math inline">\(A\)</span> and <span class="math inline">\(B\)</span> are.
</center>
<h3 id="properties">Properties</h3>
<p><span class="math display">\[
\begin{align}
d(A,B) \geqslant&amp; 0 \\
d(A,B) =&amp; d(B,A) \\
d(A,B) =&amp; 0 \iff A = B \\
\end{align}
\]</span></p>
</section>
<section id="some-dissimilarity-indices" class="slide level2">
<h2>Some dissimilarity indices</h2>
<h3 id="bray-curtis">Bray-Curtis</h3>
<p>Relying on contengency table (quantitative data)</p>
<p><span class="math display">\[
{\displaystyle BC(A,B)=1-{\frac {2\sum _{i=1}^{p}min(N_{Ai},N_{Bi})}{\sum _{i=1}^{p}(N_{Ai}+N_{Bi})}}}, \; \text{with }p\text{ the total number of species}
\]</span></p>
<h3 id="jaccard-indices">Jaccard indices</h3>
<p>Relying on presence absence data</p>
<p><span class="math display">\[
J(A,B) = {{|A \cap B|}\over{|A \cup B|}} = {{|A \cap B|}\over{|A| + |B| - |A \cap B|}}.
\]</span></p>
</section>
<section id="metrics-or-distances" class="slide level2">
<h2>Metrics or distances</h2>
<div style="float: left; width: 50%;">
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-68_328eefae5fdc68bcec29613e4ad1ad1a">
<div class="cell-output-display">
<p><img data-src="figures/metric.svg" width="400"></p>
</div>
</div>
</div>
<div style="float: right; width: 50%;">
<p>A metric is a dissimilarity index verifying the <em>subadditivity</em> also named <em>triangle inequality</em></p>
<p><span class="math display">\[
\begin{align}
d(A,B) \geqslant&amp; 0 \\
d(A,B) =&amp; \;d(B,A) \\
d(A,B) =&amp; \;0 \iff A = B \\
d(A,B) \leqslant&amp; \;d(A,C) + d(C,B)
\end{align}
\]</span></p>
</div>
</section>
<section id="some-metrics" class="slide level2">
<h2>Some metrics</h2>
<div class="columns">
<div class="column" style="width:40%;">
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-69_dc21b39f0933f03e1775c543720f5974">
<div class="cell-output-display">
<p><img data-src="figures/Distance.svg" width="400"></p>
</div>
</div>
</div><div class="column" style="width:60%;">
<h3 id="computing">Computing</h3>
<p><span class="math display">\[
\begin{align}
d_e =&amp; \sqrt{(x_A - x_B)^2 + (y_A - y_B)^2} \\
d_m =&amp; |x_A - x_B| + |y_A - y_B| \\
d_c =&amp; \max(|x_A - x_B| , |y_A - y_B|) \\
\end{align}
\]</span></p>
</div>
</div>
</section>
<section id="generalizable-on-a-n-dimension-space" class="slide level2 smaller">
<h2>Generalizable on a n-dimension space</h2>
<p>Considering 2 points <span class="math inline">\(A\)</span> and <span class="math inline">\(B\)</span> defined by <span class="math inline">\(n\)</span> variables</p>
<p><span class="math display">\[
\begin{align}
A :&amp; (a_1,a_2,a_3,...,a_n) \\
B :&amp; (b_1,b_2,b_3,...,b_n)
\end{align}
\]</span></p>
<p>with <span class="math inline">\(a_i\)</span> and <span class="math inline">\(b_i\)</span> being respectively the value of the <span class="math inline">\(i^{th}\)</span> variable for <span class="math inline">\(A\)</span> and <span class="math inline">\(B\)</span>.</p>
<p><span class="math display">\[
\begin{align}
d_e =&amp; \sqrt{\sum_{i=1}^{n}(a_i - b_i)^2 } \\
d_m =&amp; \sum_{i=1}^{n}\left| a_i - b_i \right| \\
d_c =&amp; \max\limits_{1\leqslant i \leqslant n}\left|a_i - b_i\right| \\
\end{align}
\]</span></p>
</section>
<section id="for-the-fun--" class="slide level2 flexbox vcenter">
<h2>For the fun… ;-)</h2>
<p>You can generalize those distances as a norm of order <span class="math inline">\(k\)</span></p>
<p><span class="math display">\[
d^k = \sqrt[k]{\sum_{i=1}^n|a_i - b_i|^k}
\]</span></p>
<ul>
<li><span class="math inline">\(k=1 \Rightarrow D_m\)</span> Manhatan distance</li>
<li><span class="math inline">\(k=2 \Rightarrow D_e\)</span> Euclidean distance</li>
<li><span class="math inline">\(k=\infty \Rightarrow D_c\)</span> Chebychev distance</li>
</ul>
</section>
<section id="metrics-and-ultrametrics" class="slide level2">
<h2>Metrics and ultrametrics</h2>
<div class="columns">
<div class="column" style="width:40%;">
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-70_1ba749b63a85cc676fe084e21fae4fd1">
<div class="cell-output-display">
<p><img data-src="figures/ultrametric.svg" width="400"></p>
</div>
</div>
</div><div class="column" style="width:60%;">
<h3 id="metric">Metric</h3>
<p><span class="math display">\[
d(x,z)\leqslant d(x,y)+d(y,z)
\]</span></p>
<h3 id="ultrametric">Ultrametric</h3>
<p><span class="math display">\[
d(x,z)\leq \max(d(x,y),d(y,z))
\]</span></p>
</div>
</div>
</section>
<section id="why-it-is-nice-to-use-metrics" class="slide level2 flexbox vcenter">
<h2>Why it is nice to use metrics ?</h2>
<ul>
<li>A metric induce a metric space</li>
<li>In a metric space rotations are isometries</li>
<li>This means that rotations are not changing distances between objects</li>
<li>Multidimensional scaling (PCA, PCoA, CoA…) are rotations</li>
</ul>
</section>
<section id="the-data-set" class="slide level2 flexbox vcenter">
<h2>The data set</h2>
<p><strong>We analyzed two forest sites in French Guiana</strong></p>
<ul>
<li><p>Mana : Soil is composed of white sands.</p></li>
<li><p>Petit Plateau : Terra firme (firm land). In the Amazon, it corresponds to the area of the forest that is not flooded during high water periods. The terra firme is characterized by old and poor soils.</p></li>
</ul>
<p><strong>At each site, twice sixteen samples where collected over an hectar</strong></p>
<ul>
<li><p>Sixteen samples of soil. Each of them is constituted by a mix of five cores of 50g from the 10 first centimeters of soil covering half square meter.</p></li>
<li><p>Sixteen samples of litter. Each of them is constituted by the total litter collecter over the same half square meter where soil was sampled</p></li>
</ul>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-71_01ce0a779c648e90483ee0bdb1098291">
<div class="sourceCode cell-code" id="cb43"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb43-1"><a href="#cb43-1"></a><span class="fu">data</span>(<span class="st">"guiana.count"</span>)</span>
<span id="cb43-2"><a href="#cb43-2"></a><span class="fu">data</span>(<span class="st">"guiana.motus"</span>)</span>
<span id="cb43-3"><a href="#cb43-3"></a><span class="fu">data</span>(<span class="st">"guiana.samples"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="clean-out-bad-pcr-cycle-1" class="slide level2 flexbox vcenter smaller">
<h2>Clean out bad PCR cycle 1</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-72_97ab5f0ca9e51eb48f804a224f5cc457">
<div class="sourceCode cell-code" id="cb44"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb44-1"><a href="#cb44-1"></a>s <span class="ot">=</span> <span class="fu">tag_bad_pcr</span>(guiana.samples<span class="sc">$</span>sample,guiana.count)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="sourceCode cell-code" id="cb45"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb45-1"><a href="#cb45-1"></a>guiana.count.clean <span class="ot">=</span> guiana.count[s<span class="sc">$</span>keep,]</span>
<span id="cb45-2"><a href="#cb45-2"></a>guiana.samples.clean <span class="ot">=</span> guiana.samples[s<span class="sc">$</span>keep,]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-72-1.png" width="960" class="r-stretch"><div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-73_a117177515c6f9d3b534ff8b58b086ae">
<div class="sourceCode cell-code" id="cb46"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb46-1"><a href="#cb46-1"></a><span class="fu">table</span>(s<span class="sc">$</span>keep)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
FALSE TRUE
42 299 </code></pre>
</div>
</div>
</section>
<section id="clean-out-bad-pcr-cycle-2" class="slide level2 flexbox vcenter smaller">
<h2>Clean out bad PCR cycle 2</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-74_b67354ed6b5a925f88b2313eb8dd8000">
<div class="sourceCode cell-code" id="cb48"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb48-1"><a href="#cb48-1"></a>s <span class="ot">=</span> <span class="fu">tag_bad_pcr</span>(guiana.samples.clean<span class="sc">$</span>sample,guiana.count.clean)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="sourceCode cell-code" id="cb49"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb49-1"><a href="#cb49-1"></a>guiana.count.clean <span class="ot">=</span> guiana.count.clean[s<span class="sc">$</span>keep,]</span>
<span id="cb49-2"><a href="#cb49-2"></a>guiana.samples.clean <span class="ot">=</span> guiana.samples.clean[s<span class="sc">$</span>keep,]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-74-1.png" width="960" class="r-stretch"><div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-75_b9d29c94c8006c8764c86a778a2be584">
<div class="sourceCode cell-code" id="cb50"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb50-1"><a href="#cb50-1"></a><span class="fu">table</span>(s<span class="sc">$</span>keep)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
FALSE TRUE
8 291 </code></pre>
</div>
</div>
</section>
<section id="clean-out-bad-pcr-cycle-3" class="slide level2 flexbox vcenter smaller">
<h2>Clean out bad PCR cycle 3</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-76_b1a54e4732a4d0938ea86f71d5a8b669">
<div class="sourceCode cell-code" id="cb52"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb52-1"><a href="#cb52-1"></a>s <span class="ot">=</span> <span class="fu">tag_bad_pcr</span>(guiana.samples.clean<span class="sc">$</span>sample,guiana.count.clean)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="sourceCode cell-code" id="cb53"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb53-1"><a href="#cb53-1"></a>guiana.count.clean <span class="ot">=</span> guiana.count.clean[s<span class="sc">$</span>keep,]</span>
<span id="cb53-2"><a href="#cb53-2"></a>guiana.samples.clean <span class="ot">=</span> guiana.samples.clean[s<span class="sc">$</span>keep,]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-76-1.png" width="960" class="r-stretch"><div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-77_4b51896e21d59a88a5c3bce1d93cc8b3">
<div class="sourceCode cell-code" id="cb54"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb54-1"><a href="#cb54-1"></a><span class="fu">table</span>(s<span class="sc">$</span>keep)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>
FALSE TRUE
4 287 </code></pre>
</div>
</div>
</section>
<section id="averaging-good-pcr-replicates-1" class="slide level2 flexbox vcenter">
<h2>Averaging good PCR replicates (1)</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-78_8e9c2357f9aa00b5c98cfa0e0f58352d">
<div class="sourceCode cell-code" id="cb56"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb56-1"><a href="#cb56-1"></a>guiana.samples.clean <span class="ot">=</span> <span class="fu">cbind</span>(guiana.samples.clean,s[<span class="fu">rownames</span>(guiana.samples.clean),])</span>
<span id="cb56-2"><a href="#cb56-2"></a></span>
<span id="cb56-3"><a href="#cb56-3"></a>guiana.count.mean <span class="ot">=</span> <span class="fu">aggregate</span>(<span class="fu">decostand</span>(guiana.count.clean,<span class="at">method =</span> <span class="st">"total"</span>),</span>
<span id="cb56-4"><a href="#cb56-4"></a> <span class="at">by =</span> <span class="fu">list</span>(guiana.samples.clean<span class="sc">$</span>sample),</span>
<span id="cb56-5"><a href="#cb56-5"></a> <span class="at">FUN=</span>mean)</span>
<span id="cb56-6"><a href="#cb56-6"></a></span>
<span id="cb56-7"><a href="#cb56-7"></a>n <span class="ot">=</span> guiana.count.mean[,<span class="dv">1</span>]</span>
<span id="cb56-8"><a href="#cb56-8"></a>guiana.count.mean <span class="ot">=</span> guiana.count.mean[,<span class="sc">-</span><span class="dv">1</span>]</span>
<span id="cb56-9"><a href="#cb56-9"></a><span class="fu">rownames</span>(guiana.count.mean)<span class="ot">=</span><span class="fu">as.character</span>(n)</span>
<span id="cb56-10"><a href="#cb56-10"></a>guiana.count.mean <span class="ot">=</span> <span class="fu">as.matrix</span>(guiana.count.mean)</span>
<span id="cb56-11"><a href="#cb56-11"></a></span>
<span id="cb56-12"><a href="#cb56-12"></a><span class="fu">dim</span>(guiana.count.mean)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 84 7884</code></pre>
</div>
</div>
</section>
<section id="averaging-good-pcr-replicates-2" class="slide level2 flexbox vcenter">
<h2>Averaging good PCR replicates (2)</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-79_83938f696d99c41b84de26e52b79db0b">
<div class="sourceCode cell-code" id="cb58"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb58-1"><a href="#cb58-1"></a>guiana.samples.mean <span class="ot">=</span> <span class="fu">aggregate</span>(guiana.samples.clean,</span>
<span id="cb58-2"><a href="#cb58-2"></a> <span class="at">by =</span> <span class="fu">list</span>(guiana.samples.clean<span class="sc">$</span>sample),</span>
<span id="cb58-3"><a href="#cb58-3"></a> <span class="at">FUN=</span><span class="cf">function</span>(i) i[<span class="dv">1</span>])</span>
<span id="cb58-4"><a href="#cb58-4"></a>n <span class="ot">=</span> guiana.samples.mean[,<span class="dv">1</span>]</span>
<span id="cb58-5"><a href="#cb58-5"></a>guiana.samples.mean <span class="ot">=</span> guiana.samples.mean[,<span class="sc">-</span><span class="dv">1</span>]</span>
<span id="cb58-6"><a href="#cb58-6"></a><span class="fu">rownames</span>(guiana.samples.mean)<span class="ot">=</span><span class="fu">as.character</span>(n)</span>
<span id="cb58-7"><a href="#cb58-7"></a></span>
<span id="cb58-8"><a href="#cb58-8"></a><span class="fu">dim</span>(guiana.samples.mean)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 84 17</code></pre>
</div>
</div>
<h3 class="flexbox vcenter" id="keep-only-samples">Keep only samples</h3>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-80_d438d027700718daeca4a5202cf924e9">
<div class="sourceCode cell-code" id="cb60"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb60-1"><a href="#cb60-1"></a>guiana.samples.final <span class="ot">=</span> guiana.samples.mean[<span class="sc">!</span> <span class="fu">is.na</span>(guiana.samples.mean<span class="sc">$</span>site_id),]</span>
<span id="cb60-2"><a href="#cb60-2"></a>guiana.count.final <span class="ot">=</span> guiana.count.mean[<span class="sc">!</span> <span class="fu">is.na</span>(guiana.samples.mean<span class="sc">$</span>site_id),]</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="estimating-similarity-between-samples" class="slide level2 flexbox vcenter">
<h2>Estimating similarity between samples</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-81_aee2293439a50bbd81ad54e062958eb2">
<div class="sourceCode cell-code" id="cb61"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb61-1"><a href="#cb61-1"></a>guiana.hellinger.final <span class="ot">=</span> <span class="fu">decostand</span>(guiana.count.final,<span class="at">method =</span> <span class="st">"hellinger"</span>)</span>
<span id="cb61-2"><a href="#cb61-2"></a>guiana.relfreq.final <span class="ot">=</span> <span class="fu">decostand</span>(guiana.count.final,<span class="at">method =</span> <span class="st">"total"</span>)</span>
<span id="cb61-3"><a href="#cb61-3"></a>guiana.presence.<span class="fl">1.</span>final <span class="ot">=</span> guiana.relfreq.final <span class="sc">&gt;</span> <span class="fl">0.001</span></span>
<span id="cb61-4"><a href="#cb61-4"></a>guiana.presence.<span class="fl">10.</span>final <span class="ot">=</span> guiana.relfreq.final <span class="sc">&gt;</span> <span class="fl">0.01</span></span>
<span id="cb61-5"><a href="#cb61-5"></a>guiana.presence.<span class="fl">50.</span>final <span class="ot">=</span> guiana.relfreq.final <span class="sc">&gt;</span> <span class="fl">0.05</span></span>
<span id="cb61-6"><a href="#cb61-6"></a></span>
<span id="cb61-7"><a href="#cb61-7"></a>guiana.bc.dist <span class="ot">=</span> <span class="fu">vegdist</span>(guiana.relfreq.final,<span class="at">method =</span> <span class="st">"bray"</span>)</span>
<span id="cb61-8"><a href="#cb61-8"></a>guiana.euc.dist <span class="ot">=</span> <span class="fu">vegdist</span>(guiana.hellinger.final,<span class="at">method =</span> <span class="st">"euclidean"</span>)</span>
<span id="cb61-9"><a href="#cb61-9"></a>guiana.jac.<span class="fl">1.</span>dist <span class="ot">=</span> <span class="fu">vegdist</span>(guiana.presence.<span class="fl">1.</span>final,<span class="at">method =</span> <span class="st">"jaccard"</span>)</span>
<span id="cb61-10"><a href="#cb61-10"></a>guiana.jac.<span class="fl">10.</span>dist <span class="ot">=</span> <span class="fu">vegdist</span>(guiana.presence.<span class="fl">10.</span>final,<span class="at">method =</span> <span class="st">"jaccard"</span>)</span>
<span id="cb61-11"><a href="#cb61-11"></a>guiana.jac.<span class="fl">50.</span>dist <span class="ot">=</span> <span class="fu">vegdist</span>(guiana.presence.<span class="fl">50.</span>final,<span class="at">method =</span> <span class="st">"jaccard"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="euclidean-distance-on-hellinger-transformation" class="slide level2">
<h2>Euclidean distance on Hellinger transformation</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-82_16dab7bee2b491a9f9adca47b9ee9473">
<div class="sourceCode cell-code" id="cb62"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb62-1"><a href="#cb62-1"></a>xy <span class="ot">=</span> guiana.count.final[,<span class="fu">order</span>(<span class="sc">-</span><span class="fu">colSums</span>(guiana.count.final))]</span>
<span id="cb62-2"><a href="#cb62-2"></a>xy <span class="ot">=</span> xy[,<span class="dv">1</span><span class="sc">:</span><span class="dv">2</span>]</span>
<span id="cb62-3"><a href="#cb62-3"></a>xy.hellinger <span class="ot">=</span> <span class="fu">decostand</span>(xy,<span class="at">method =</span> <span class="st">"hellinger"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="columns">
<div class="column" style="width:40%;">
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-83_0f81d847301b62294880e8f3c99f454d">
<div class="cell-output-display">
<p><img data-src="Lecture_files/figure-revealjs/unnamed-chunk-83-1.png" width="384"></p>
</div>
</div>
</div><div class="column" style="width:60%;">
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-84_33e2134d45f21fa015bcd413313fd9e3">
<div class="cell-output-display">
<p><img data-src="figures/euclidean_hellinger.svg" width="400"></p>
</div>
</div>
</div>
</div>
</section>
<section id="bray-curtis-distance-on-relative-frequencies" class="slide level2">
<h2>Bray-Curtis distance on relative frequencies</h2>
<p><span class="math display">\[
BC_{jk}=1-{\frac {2\sum _{i=1}^{p}min(N_{ij},N_{ik})}{\sum _{i=1}^{p}(N_{ij}+N_{ik})}}
\]</span></p>
<p><span class="math display">\[
BC_{jk}=\frac{\sum _{i=1}^{p}(N_{ij}+N_{ik})-\sum _{i=1}^{p}2\;min(N_{ij},N_{ik})}{\sum _{i=1}^{p}(N_{ij}+N_{ik})}
\]</span></p>
<p><span class="math display">\[
BC_{jk}=\frac{\sum _{i=1}^{p}(N_{ij} - min(N_{ij},N_{ik}) + (N_{ik} - min(N_{ij},N_{ik}))}{\sum _{i=1}^{p}(N_{ij}+N_{ik})}
\]</span></p>
<p><span class="math display">\[
BC_{jk}=\frac{\sum _{i=1}^{p}|N_{ij} - N_{ik}|}{\sum _{i=1}^{p}N_{ij}+\sum _{i=1}^{p}N_{ik}}
\]</span></p>
<p><span class="math display">\[
BC_{jk}=\frac{\sum _{i=1}^{p}|N_{ij} - N_{ik}|}{1+1}
\]</span></p>
<p><span class="math display">\[
BC_{jk}=\frac{1}{2}\sum _{i=1}^{p}|N_{ij} - N_{ik}|
\]</span></p>
</section>
<section id="principale-coordinate-analysis-1" class="slide level2 flexbox vcenter">
<h2>Principale coordinate analysis (1)</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-85_44c1ca76a58fa749434f02eafa4432ad">
<div class="sourceCode cell-code" id="cb63"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb63-1"><a href="#cb63-1"></a>guiana.bc.pcoa <span class="ot">=</span> <span class="fu">cmdscale</span>(guiana.bc.dist,<span class="at">k=</span><span class="dv">3</span>,<span class="at">eig =</span> <span class="cn">TRUE</span>)</span>
<span id="cb63-2"><a href="#cb63-2"></a>guiana.euc.pcoa <span class="ot">=</span> <span class="fu">cmdscale</span>(guiana.euc.dist,<span class="at">k=</span><span class="dv">3</span>,<span class="at">eig =</span> <span class="cn">TRUE</span>)</span>
<span id="cb63-3"><a href="#cb63-3"></a>guiana.jac.<span class="fl">1.</span>pcoa <span class="ot">=</span> <span class="fu">cmdscale</span>(guiana.jac.<span class="fl">1.</span>dist,<span class="at">k=</span><span class="dv">3</span>,<span class="at">eig =</span> <span class="cn">TRUE</span>)</span>
<span id="cb63-4"><a href="#cb63-4"></a>guiana.jac.<span class="fl">10.</span>pcoa <span class="ot">=</span> <span class="fu">cmdscale</span>(guiana.jac.<span class="fl">10.</span>dist,<span class="at">k=</span><span class="dv">3</span>,<span class="at">eig =</span> <span class="cn">TRUE</span>)</span>
<span id="cb63-5"><a href="#cb63-5"></a>guiana.jac.<span class="fl">50.</span>pcoa <span class="ot">=</span> <span class="fu">cmdscale</span>(guiana.jac.<span class="fl">50.</span>dist,<span class="at">k=</span><span class="dv">3</span>,<span class="at">eig =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="principale-coordinate-analysis-2" class="slide level2">
<h2>Principale coordinate analysis (2)</h2>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-86-1.png" width="720" class="r-stretch"></section>
<section id="principale-composante-analysis" class="slide level2 flexbox vcenter">
<h2>Principale composante analysis</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-87_0437e78f8a55ce95a82293791c9e678c">
<div class="sourceCode cell-code" id="cb64"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb64-1"><a href="#cb64-1"></a>guiana.hellinger.pca <span class="ot">=</span> <span class="fu">prcomp</span>(guiana.hellinger.final,<span class="at">center =</span> <span class="cn">TRUE</span>, <span class="at">scale. =</span> <span class="cn">FALSE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<!---
## Computation of norms
::: {.cell hash='Lecture_cache/revealjs/guiana_norm_a7444f802e2bdb92c0d0ff86a69616bb'}
```{.r .cell-code}
guiana.n1.dist = norm(guiana.relfreq.final,l=1)
guiana.n2.dist = norm(guiana.relfreq.final^(1/2),l=2)
guiana.n3.dist = norm(guiana.relfreq.final^(1/3),l=3)
guiana.n4.dist = norm(guiana.relfreq.final^(1/100),l=100)
```
:::
## pCoA on norms
::: {.cell hash='Lecture_cache/revealjs/unnamed-chunk-89_41435c59001a1474e38887420e68da34'}
:::
::: {.cell hash='Lecture_cache/revealjs/unnamed-chunk-90_95a53e07e55a28ed6e140bd6fd5e5d53'}
::: {.cell-output-display}
![](Lecture_files/figure-revealjs/unnamed-chunk-90-1.png){width=960}
:::
:::
--->
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-88-1.png" width="1152" class="r-stretch"></section>
<section id="comparing-diversity-of-the-environments" class="slide level2">
<h2>Comparing diversity of the environments</h2>
<div class="cell" data-hash="Lecture_cache/revealjs/unnamed-chunk-91_14e8f4295706e9451e3f71fc602ba671">
</div>
<img data-src="Lecture_files/figure-revealjs/unnamed-chunk-92-1.png" width="864" class="r-stretch"></section>
<section id="bibliography" class="slide level2 smaller scrollable">
<h2>Bibliography</h2>
<div class="footer footer-default">
</div>
<div id="refs" class="references csl-bib-body hanging-indent" role="doc-bibliography">
<div id="ref-Tsallis:94:00" class="csl-entry" role="doc-biblioentry">
Tsallis, Constantino. 1994. <span>“What Are the Numbers That Experiments Provide.”</span> <em>Quim. Nova</em> 17 (6): 46871.
</div>
<div id="ref-Whittaker:10:00" class="csl-entry" role="doc-biblioentry">
Whittaker, Robert J. 2010. <span>“Meta-Analyses and Mega-Mistakes: Calling Time on Meta-Analysis of the Species Richness-Productivity Relationship.”</span> <em>Ecology</em> 91 (9): 252233.
</div>
</div>
</section></section>
</div>
</div>
<script>window.backupDefine = window.define; window.define = undefined;</script>
<script src="Lecture_files/libs/revealjs/dist/reveal.js"></script>
<!-- reveal.js plugins -->
<script src="Lecture_files/libs/revealjs/plugin/quarto-line-highlight/line-highlight.js"></script>
<script src="Lecture_files/libs/revealjs/plugin/pdf-export/pdfexport.js"></script>
<script src="Lecture_files/libs/revealjs/plugin/reveal-menu/menu.js"></script>
<script src="Lecture_files/libs/revealjs/plugin/reveal-menu/quarto-menu.js"></script>
<script src="Lecture_files/libs/revealjs/plugin/quarto-support/support.js"></script>
<script src="Lecture_files/libs/revealjs/plugin/notes/notes.js"></script>
<script src="Lecture_files/libs/revealjs/plugin/search/search.js"></script>
<script src="Lecture_files/libs/revealjs/plugin/zoom/zoom.js"></script>
<script src="Lecture_files/libs/revealjs/plugin/math/math.js"></script>
<script>window.define = window.backupDefine; window.backupDefine = undefined;</script>
<script>
// Full list of configuration options available at:
// https://revealjs.com/config/
Reveal.initialize({
'controlsAuto': true,
'previewLinksAuto': false,
'smaller': true,
'pdfSeparateFragments': false,
'autoAnimateEasing': "ease",
'autoAnimateDuration': 1,
'autoAnimateUnmatched': true,
'menu': {"side":"left","useTextContentForMissingTitles":true,"markers":false,"loadIcons":false,"custom":[{"title":"Tools","icon":"<i class=\"fas fa-gear\"></i>","content":"<ul class=\"slide-menu-items\">\n<li class=\"slide-tool-item active\" data-item=\"0\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.fullscreen(event)\"><kbd>f</kbd> Fullscreen</a></li>\n<li class=\"slide-tool-item\" data-item=\"1\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.speakerMode(event)\"><kbd>s</kbd> Speaker View</a></li>\n<li class=\"slide-tool-item\" data-item=\"2\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.overview(event)\"><kbd>o</kbd> Slide Overview</a></li>\n<li class=\"slide-tool-item\" data-item=\"3\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.overview(event)\"><kbd>e</kbd> PDF Export Mode</a></li>\n<li class=\"slide-tool-item\" data-item=\"4\"><a href=\"#\" onclick=\"RevealMenuToolHandlers.keyboardHelp(event)\"><kbd>?</kbd> Keyboard Help</a></li>\n</ul>"}],"openButton":true},
'smaller': true,
// Display controls in the bottom right corner
controls: false,
// Help the user learn the controls by providing hints, for example by
// bouncing the down arrow when they first encounter a vertical slide
controlsTutorial: false,
// Determines where controls appear, "edges" or "bottom-right"
controlsLayout: 'edges',
// Visibility rule for backwards navigation arrows; "faded", "hidden"
// or "visible"
controlsBackArrows: 'faded',
// Display a presentation progress bar
progress: true,
// Display the page number of the current slide
slideNumber: false,
// 'all', 'print', or 'speaker'
showSlideNumber: 'all',
// Add the current slide number to the URL hash so that reloading the
// page/copying the URL will return you to the same slide
hash: true,
// Start with 1 for the hash rather than 0
hashOneBasedIndex: false,
// Flags if we should monitor the hash and change slides accordingly
respondToHashChanges: true,
// Push each slide change to the browser history
history: true,
// Enable keyboard shortcuts for navigation
keyboard: true,
// Enable the slide overview mode
overview: true,
// Disables the default reveal.js slide layout (scaling and centering)
// so that you can use custom CSS layout
disableLayout: false,
// Vertical centering of slides
center: false,
// Enables touch navigation on devices with touch input
touch: true,
// Loop the presentation
loop: false,
// Change the presentation direction to be RTL
rtl: false,
// see https://revealjs.com/vertical-slides/#navigation-mode
navigationMode: 'linear',
// Randomizes the order of slides each time the presentation loads
shuffle: false,
// Turns fragments on and off globally
fragments: true,
// Flags whether to include the current fragment in the URL,
// so that reloading brings you to the same fragment position
fragmentInURL: false,
// Flags if the presentation is running in an embedded mode,
// i.e. contained within a limited portion of the screen
embedded: false,
// Flags if we should show a help overlay when the questionmark
// key is pressed
help: true,
// Flags if it should be possible to pause the presentation (blackout)
pause: true,
// Flags if speaker notes should be visible to all viewers
showNotes: false,
// Global override for autoplaying embedded media (null/true/false)
autoPlayMedia: null,
// Global override for preloading lazy-loaded iframes (null/true/false)
preloadIframes: null,
// Number of milliseconds between automatically proceeding to the
// next slide, disabled when set to 0, this value can be overwritten
// by using a data-autoslide attribute on your slides
autoSlide: 0,
// Stop auto-sliding after user input
autoSlideStoppable: true,
// Use this method for navigation when auto-sliding
autoSlideMethod: null,
// Specify the average time in seconds that you think you will spend
// presenting each slide. This is used to show a pacing timer in the
// speaker view
defaultTiming: null,
// Enable slide navigation via mouse wheel
mouseWheel: false,
// The display mode that will be used to show slides
display: 'block',
// Hide cursor if inactive
hideInactiveCursor: true,
// Time before the cursor is hidden (in ms)
hideCursorTime: 5000,
// Opens links in an iframe preview overlay
previewLinks: false,
// Transition style (none/fade/slide/convex/concave/zoom)
transition: 'slide',
// Transition speed (default/fast/slow)
transitionSpeed: 'default',
// Transition style for full page slide backgrounds
// (none/fade/slide/convex/concave/zoom)
backgroundTransition: 'none',
// Number of slides away from the current that are visible
viewDistance: 3,
// Number of slides away from the current that are visible on mobile
// devices. It is advisable to set this to a lower number than
// viewDistance in order to save resources.
mobileViewDistance: 2,
// The "normal" size of the presentation, aspect ratio will be preserved
// when the presentation is scaled to fit different resolutions. Can be
// specified using percentage units.
width: 1050,
height: 700,
// Factor of the display size that should remain empty around the content
margin: 0.1,
math: {
mathjax: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js',
config: 'TeX-AMS_HTML-full',
tex2jax: {
inlineMath: [['\\(','\\)']],
displayMath: [['\\[','\\]']],
balanceBraces: true,
processEscapes: false,
processRefs: true,
processEnvironments: true,
preview: 'TeX',
skipTags: ['script','noscript','style','textarea','pre','code'],
ignoreClass: 'tex2jax_ignore',
processClass: 'tex2jax_process'
},
},
// reveal.js plugins
plugins: [QuartoLineHighlight, PdfExport, RevealMenu, QuartoSupport,
RevealMath,
RevealNotes,
RevealSearch,
RevealZoom
]
});
</script>
<script>
// htmlwidgets need to know to resize themselves when slides are shown/hidden.
// Fire the "slideenter" event (handled by htmlwidgets.js) when the current
// slide changes (different for each slide format).
(function () {
// dispatch for htmlwidgets
function fireSlideEnter() {
const event = window.document.createEvent("Event");
event.initEvent("slideenter", true, true);
window.document.dispatchEvent(event);
}
function fireSlideChanged(previousSlide, currentSlide) {
fireSlideEnter();
// dispatch for shiny
if (window.jQuery) {
if (previousSlide) {
window.jQuery(previousSlide).trigger("hidden");
}
if (currentSlide) {
window.jQuery(currentSlide).trigger("shown");
}
}
}
// hookup for slidy
if (window.w3c_slidy) {
window.w3c_slidy.add_observer(function (slide_num) {
// slide_num starts at position 1
fireSlideChanged(null, w3c_slidy.slides[slide_num - 1]);
});
}
})();
</script>
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
const toggleBodyColorMode = (bsSheetEl) => {
const mode = bsSheetEl.getAttribute("data-mode");
const bodyEl = window.document.querySelector("body");
if (mode === "dark") {
bodyEl.classList.add("quarto-dark");
bodyEl.classList.remove("quarto-light");
} else {
bodyEl.classList.add("quarto-light");
bodyEl.classList.remove("quarto-dark");
}
}
const toggleBodyColorPrimary = () => {
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
if (bsSheetEl) {
toggleBodyColorMode(bsSheetEl);
}
}
toggleBodyColorPrimary();
const tabsets = window.document.querySelectorAll(".panel-tabset-tabby")
tabsets.forEach(function(tabset) {
const tabby = new Tabby('#' + tabset.id);
});
const clipboard = new window.ClipboardJS('.code-copy-button', {
target: function(trigger) {
return trigger.previousElementSibling;
}
});
clipboard.on('success', function(e) {
// button target
const button = e.trigger;
// don't keep focus
button.blur();
// flash "checked"
button.classList.add('code-copy-button-checked');
var currentTitle = button.getAttribute("title");
button.setAttribute("title", "Copied!");
let tooltip;
if (window.bootstrap) {
button.setAttribute("data-bs-toggle", "tooltip");
button.setAttribute("data-bs-placement", "left");
button.setAttribute("data-bs-title", "Copied!");
tooltip = new bootstrap.Tooltip(button,
{ trigger: "manual",
customClass: "code-copy-button-tooltip",
offset: [0, -8]});
tooltip.show();
}
setTimeout(function() {
if (tooltip) {
tooltip.hide();
button.removeAttribute("data-bs-title");
button.removeAttribute("data-bs-toggle");
button.removeAttribute("data-bs-placement");
}
button.setAttribute("title", currentTitle);
button.classList.remove('code-copy-button-checked');
}, 1000);
// clear code selection
e.clearSelection();
});
function tippyHover(el, contentFn) {
const config = {
allowHTML: true,
content: contentFn,
maxWidth: 500,
delay: 100,
arrow: false,
appendTo: function(el) {
return el.closest('section.slide') || el.parentElement;
},
interactive: true,
interactiveBorder: 10,
theme: 'quarto-reveal',
placement: 'bottom-start'
};
config['offset'] = [0,0];
config['maxWidth'] = 700;
window.tippy(el, config);
}
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
for (var i=0; i<noterefs.length; i++) {
const ref = noterefs[i];
tippyHover(ref, function() {
// use id or data attribute instead here
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
try { href = new URL(href).hash; } catch {}
const id = href.replace(/^#\/?/, "");
const note = window.document.getElementById(id);
return note.innerHTML;
});
}
const findCites = (el) => {
const parentEl = el.parentElement;
if (parentEl) {
const cites = parentEl.dataset.cites;
if (cites) {
return {
el,
cites: cites.split(' ')
};
} else {
return findCites(el.parentElement)
}
} else {
return undefined;
}
};
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
for (var i=0; i<bibliorefs.length; i++) {
const ref = bibliorefs[i];
const citeInfo = findCites(ref);
if (citeInfo) {
tippyHover(citeInfo.el, function() {
var popup = window.document.createElement('div');
citeInfo.cites.forEach(function(cite) {
var citeDiv = window.document.createElement('div');
citeDiv.classList.add('hanging-indent');
citeDiv.classList.add('csl-entry');
var biblioDiv = window.document.getElementById('ref-' + cite);
if (biblioDiv) {
citeDiv.innerHTML = biblioDiv.innerHTML;
}
popup.appendChild(citeDiv);
});
return popup.innerHTML;
});
}
}
});
</script>
</body></html>