Skip to content

Commit

Permalink
Fix compositional heatmap
Browse files Browse the repository at this point in the history
  • Loading branch information
RiboRings committed Jul 9, 2024
1 parent bc381df commit 914edce
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 28 deletions.
36 changes: 11 additions & 25 deletions docs/compositional_heatmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link href="site_libs/quarto-html/light-border.css" rel="stylesheet">
<link href="site_libs/quarto-html/quarto-html.min.css" rel="stylesheet" data-mode="light">
<link href="site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles"><meta charset="utf-8">
<meta name="generator" content="quarto-1.4.506">
<meta name="generator" content="quarto-1.3.450">

<title>Compositional Heatmaps</title>
<meta name="apple-mobile-web-app-capable" content="yes">
Expand All @@ -30,7 +30,7 @@
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
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; }
Expand Down Expand Up @@ -220,8 +220,7 @@
}

.callout.callout-titled .callout-body > .callout-content > :last-child {
padding-bottom: 0.5rem;
margin-bottom: 0;
margin-bottom: 0.5rem;
}

.callout.callout-titled .callout-icon::before {
Expand Down Expand Up @@ -425,7 +424,7 @@ <h2>Example 1.1</h2>
<h2>Why relative abundances?</h2>
<p>Microbiome data is compositional. Relative abundance helps us draw less biased comparisons between samples.</p>
<div class="cell">
<details class="code-fold">
<details>
<summary>Show code</summary>
<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><span class="co"># Import packages</span></span>
<span id="cb5-2"><a href="#cb5-2"></a><span class="fu">library</span>(miaViz)</span>
Expand All @@ -445,9 +444,7 @@ <h2>Why relative abundances?</h2>
</details>

</div>
<img data-src="compositional_heatmap_files/figure-revealjs/fig-abund-1.png" width="960" class="r-stretch quarto-figure-center"><p class="caption">
Figure&nbsp;1: Sample composition by counts (left) or relative abundance (right).
</p></section>
<img data-src="compositional_heatmap_files/figure-revealjs/fig-abund-1.png" width="960" class="r-stretch quarto-figure-center"><p class="caption">Figure&nbsp;1: Sample composition by counts (left) or relative abundance (right).</p></section>
<section id="example-1.2" class="slide level2">
<h2>Example 1.2</h2>
<p>To reduce data skewness, we further transform the relative abundance assay with the <strong>Centered-Log Ratio</strong> (CLR), which is defined as follows:</p>
Expand Down Expand Up @@ -482,9 +479,7 @@ <h2>Example 1.3</h2>
<span id="cb8-3"><a href="#cb8-3"></a>clrz_hm</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>

</div>
<img data-src="compositional_heatmap_files/figure-revealjs/fig-compheat-1.png" width="960" class="r-stretch quarto-figure-center"><p class="caption">
Figure&nbsp;2: Heatmap of CLR-Z assay where columns correspond to samples and rows to taxa agglomerated by order.
</p></section>
<img data-src="compositional_heatmap_files/figure-revealjs/fig-compheat-1.png" width="960" class="r-stretch quarto-figure-center"><p class="caption">Figure&nbsp;2: Heatmap of CLR-Z assay where columns correspond to samples and rows to taxa agglomerated by order.</p></section>
<section id="why-clr-z-transformation" class="slide level2">
<h2>Why clr-z transformation?</h2>
<p>A CLR-z transformation improves comparability in two steps:</p>
Expand All @@ -493,9 +488,7 @@ <h2>Why clr-z transformation?</h2>
<li>Find <strong>Z score</strong> to standardise features <strong>row-wise</strong></li>
</ol>

<img data-src="compositional_heatmap_files/figure-revealjs/fig-comparison-1.png" width="960" class="r-stretch quarto-figure-center"><p class="caption">
Figure&nbsp;3: Visual comparison between counts, relative abundance, clr and clr-z assays (from left to right).
</p></section>
<img data-src="compositional_heatmap_files/figure-revealjs/fig-comparison-1.png" width="960" class="r-stretch quarto-figure-center"><p class="caption">Figure&nbsp;3: Visual comparison between counts, relative abundance, clr and clr-z assays (from left to right).</p></section>
<section id="exercise-1" class="slide level2">
<h2>Exercise 1</h2>
<ul>
Expand Down Expand Up @@ -544,6 +537,7 @@ <h2>Resources</h2>
Reveal.initialize({
'controlsAuto': true,
'previewLinksAuto': false,
'smaller': true,
'pdfSeparateFragments': false,
'autoAnimateEasing': "ease",
'autoAnimateDuration': 1,
Expand Down Expand Up @@ -842,9 +836,10 @@ <h2>Resources</h2>
// clear code selection
e.clearSelection();
});
function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
function tippyHover(el, contentFn) {
const config = {
allowHTML: true,
content: contentFn,
maxWidth: 500,
delay: 100,
arrow: false,
Expand All @@ -854,17 +849,8 @@ <h2>Resources</h2>
interactive: true,
interactiveBorder: 10,
theme: 'light-border',
placement: 'bottom-start',
placement: 'bottom-start'
};
if (contentFn) {
config.content = contentFn;
}
if (onTriggerFn) {
config.onTrigger = onTriggerFn;
}
if (onUntriggerFn) {
config.onUntrigger = onUntriggerFn;
}
config['offset'] = [0,0];
config['maxWidth'] = 700;
window.tippy(el, config);
Expand Down
Binary file modified docs/compositional_heatmap_files/figure-revealjs/fig-abund-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@
"href": "compositional_heatmap.html#why-relative-abundances",
"title": "Compositional Heatmaps",
"section": "Why relative abundances?",
"text": "Why relative abundances?\nMicrobiome data is compositional. Relative abundance helps us draw less biased comparisons between samples.\n\n\nShow code\n# Import packages\nlibrary(miaViz)\nlibrary(patchwork)\n\n# Plot composition by counts\ncounts_bar &lt;- plotAbundance(tse_order, rank = \"Phylum\", use_relative = FALSE) +\n ylab(\"Counts\")\n\n# Plot composition by relative abundance\nrelab_bar &lt;- plotAbundance(tse_order, rank = \"Phylum\") +\n ylab(\"Relative Abundance\")\n\n# Combine plots\n(counts_bar | relab_bar) +\n plot_layout(guides = \"collect\")\n\n\n\n\nFigure 1: Sample composition by counts (left) or relative abundance (right)."
"text": "Why relative abundances?\nMicrobiome data is compositional. Relative abundance helps us draw less biased comparisons between samples.\n\n\nShow code\n# Import packages\nlibrary(miaViz)\nlibrary(patchwork)\n\n# Plot composition by counts\ncounts_bar &lt;- plotAbundance(tse_order, rank = \"Phylum\", use_relative = FALSE) +\n ylab(\"Counts\")\n\n# Plot composition by relative abundance\nrelab_bar &lt;- plotAbundance(tse_order, rank = \"Phylum\") +\n ylab(\"Relative Abundance\")\n\n# Combine plots\n(counts_bar | relab_bar) +\n plot_layout(guides = \"collect\")\n\n\n\nFigure 1: Sample composition by counts (left) or relative abundance (right)."
},
{
"objectID": "compositional_heatmap.html#example-1.2",
Expand All @@ -501,14 +501,14 @@
"href": "compositional_heatmap.html#example-1.3",
"title": "Compositional Heatmaps",
"section": "Example 1.3",
"text": "Example 1.3\nFinally, we visualise the clr-z assay with ComplexHeatmap.\n\n# Visualise clr-z assay with a heatmap\nclrz_hm &lt;- Heatmap(assay(tse_order, \"clr_z\"), name = \"clr-z\")\nclrz_hm\n\n\n\nFigure 2: Heatmap of CLR-Z assay where columns correspond to samples and rows to taxa agglomerated by order."
"text": "Example 1.3\nFinally, we visualise the clr-z assay with ComplexHeatmap.\n\n# Visualise clr-z assay with a heatmap\nclrz_hm &lt;- Heatmap(assay(tse_order, \"clr_z\"), name = \"clr-z\")\nclrz_hm\n\n\nFigure 2: Heatmap of CLR-Z assay where columns correspond to samples and rows to taxa agglomerated by order."
},
{
"objectID": "compositional_heatmap.html#why-clr-z-transformation",
"href": "compositional_heatmap.html#why-clr-z-transformation",
"title": "Compositional Heatmaps",
"section": "Why clr-z transformation?",
"text": "Why clr-z transformation?\nA CLR-z transformation improves comparability in two steps:\n\nApply CLR transform to center features column-wise\nFind Z score to standardise features row-wise\n\n\n\nFigure 3: Visual comparison between counts, relative abundance, clr and clr-z assays (from left to right)."
"text": "Why clr-z transformation?\nA CLR-z transformation improves comparability in two steps:\n\nApply CLR transform to center features column-wise\nFind Z score to standardise features row-wise\n\n\nFigure 3: Visual comparison between counts, relative abundance, clr and clr-z assays (from left to right)."
},
{
"objectID": "compositional_heatmap.html#exercise-1",
Expand Down

0 comments on commit 914edce

Please sign in to comment.