Skip to content

Commit

Permalink
small rephrasing
Browse files Browse the repository at this point in the history
  • Loading branch information
lgatto committed Nov 17, 2024
1 parent 68229b5 commit b1225ff
Show file tree
Hide file tree
Showing 29 changed files with 142 additions and 141 deletions.
18 changes: 9 additions & 9 deletions 64-dimred.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ data(xy)
```

We are going to use the following dataset to illustrate some important
concepts that are scale and central to PCA. The small dataset show
below represents the measurement of genes *x* and *y* in 20
samples. We will be using the scaled and centred version of this data.
concepts related to PCA. The small dataset show below represents the
measurement of genes *x* and *y* in 20 samples. We will be using the
scaled and centred version of this dataset.

```{r xyplot, echo = FALSE, fig.cap = "Raw (left) and scale/centred (right) expression data for genes *x* and *y* in 20 samples", fig.height = 5, fig.width = 11}
library("ggplot2")
Expand Down Expand Up @@ -195,8 +195,9 @@ pca + pca2
var <- .pca$sdev^2
pve <- var/sum(var)
```

In the example above the variance, the variance along the PCs are
`r round(var[1], 2)` and `r round(var[2], 2)`. The first one explains
`r round(var[1], 2)` and `r round(var[2], 2)` respectively. The first one explains
`r round(pve[1] * 100, 1)`% or that variance, and the second one merely
`r round(pve[2] * 100, 1)`%. This is also reflected in the different
scales along the x and y axis.
Expand All @@ -220,15 +221,14 @@ pca_final
Principal components are linear combinations of the variables that
were originally measured, they provide a new coordinate system. The
PC in the previous example is a linear combination of *gene_x* and
*gene_y*, more specifically
*gene_y*:

$$ PC = c_{1} ~ gene_{x} + c_{2} ~ gene_{y} $$

It has coefficients $(c_1, c_2)$, also called loading.

PCA in general will find linear combinations of the original
variables. These new linear combinations will maximise the variance
of the data.
PCA will find linear combinations of the original variables. These new
linear combinations will maximise the variance of the data.

## Summary and application

Expand Down Expand Up @@ -430,7 +430,7 @@ expressed than others.
`r msmbstyle::solution_end()`

Real datasets often come with *missing values*. In R, these should be
encoded using `NA`. Unfortunately, PCA cannot deal with missing
encoded using `NA`. Unfortunately, `prcomp()` cannot deal with missing
values, and observations containing `NA` values will be dropped
automatically. This is a viable solution only when the proportion of
missing values is low. Otherwise, it is possible to impute missing
Expand Down
4 changes: 2 additions & 2 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<meta name="author" content="Laurent Gatto" />

<meta name="date" content="2024-10-28" />
<meta name="date" content="2024-11-17" />

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down Expand Up @@ -205,7 +205,7 @@ <h1>Page not found</h1>
<p style="text-align: center;">
</p>
<p class="build-date">Page built:
2024-10-28
2024-11-17
using
R version 4.4.1 (2024-06-14)
</p>
Expand Down
Binary file modified docs/WSBIM1322_files/figure-html/exdists-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/WSBIM1322_files/figure-html/logtrans2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/WSBIM1322_files/figure-html/quantnormex-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/WSBIM1322_files/figure-html/showdots-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/WSBIM1322_files/figure-html/sim-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/WSBIM1322_files/figure-html/unnamed-chunk-55-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/WSBIM1322_files/figure-html/unnamed-chunk-55-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/WSBIM1322_files/figure-html/unnamed-chunk-55-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/WSBIM1322_files/figure-html/unnamed-chunk-60-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/WSBIM1322_files/figure-html/unnamed-chunk-61-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/WSBIM1322_files/figure-html/unnamed-chunk-61-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/WSBIM1322_files/figure-html/unnamed-chunk-76-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<meta name="author" content="Laurent Gatto" />

<meta name="date" content="2024-10-28" />
<meta name="date" content="2024-11-17" />

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down Expand Up @@ -349,7 +349,7 @@ <h2>Setup<div class="tooltip"><button class="internal-link-btn" onclick="copy_li
<a href="sec-refresher.html"><button class="btn btn-default">Next</button></a>
</p>
<p class="build-date">Page built:
2024-10-28
2024-11-17
using
R version 4.4.1 (2024-06-14)
</p>
Expand Down
6 changes: 3 additions & 3 deletions docs/sec-biostrings.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<meta name="author" content="Laurent Gatto" />

<meta name="date" content="2024-10-28" />
<meta name="date" content="2024-11-17" />

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down Expand Up @@ -252,7 +252,7 @@ <h2>
<span class="header-section-number">4.2</span> Working with sequences - using <code>Biostrings</code>
<div class="tooltip"><button class="internal-link-btn" onclick="copy_link('working-with-sequences---using-biostrings')" onmouseout="reset_tooltip('working-with-sequences---using-biostrings-tooltip')"><span class="tooltiptext" id="working-with-sequences---using-biostrings-tooltip">Copy link</span><i class="fa fa-link"></i></button></div>
</h2>
<p>The Bioconductor <em><a href="https://bioconductor.org/packages/3.19/Biostrings">Biostrings</a></em>
<p>The Bioconductor <em><a href="https://bioconductor.org/packages/3.20/Biostrings">Biostrings</a></em>
package can do all that base R can do, in addition to knowing about
the semantics of the sequences is handles. Let’s start by loading the
package:</p>
Expand Down Expand Up @@ -937,7 +937,7 @@ <h2>
<a href="sec-norm.html"><button class="btn btn-default">Next</button></a>
</p>
<p class="build-date">Page built:
2024-10-28
2024-11-17
using
R version 4.4.1 (2024-06-14)
</p>
Expand Down
10 changes: 5 additions & 5 deletions docs/sec-biovis.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<meta name="author" content="Laurent Gatto" />

<meta name="date" content="2024-10-28" />
<meta name="date" content="2024-11-17" />

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down Expand Up @@ -211,7 +211,7 @@ <h1>
<li>Visualisation of intersections, in particular <strong>Venn</strong> and <strong>UpSet</strong>
plots.</li>
</ul>
<!-- - The *[Gviz](https://bioconductor.org/packages/3.19/Gviz)* to visualise genomic data. --><div id="heatmaps" class="section level2" number="11.1">
<!-- - The *[Gviz](https://bioconductor.org/packages/3.20/Gviz)* to visualise genomic data. --><div id="heatmaps" class="section level2" number="11.1">
<h2>
<span class="header-section-number">11.1</span> Heatmaps<div class="tooltip"><button class="internal-link-btn" onclick="copy_link('heatmaps')" onmouseout="reset_tooltip('heatmaps-tooltip')"><span class="tooltiptext" id="heatmaps-tooltip">Copy link</span><i class="fa fa-link"></i></button></div>
</h2>
Expand Down Expand Up @@ -275,8 +275,8 @@ <h2>
<p>Based on the caveats above, it is essential to present and interpret
heatmaps with great care.</p>
<p>There exists several packages that allow to produce heatmaps with
various levels of sophistication, such as <code>heatmap.2</code> from the <code>r CRANpkg("gplots")</code> package, the <em><a href="https://bioconductor.org/packages/3.19/Heatplus">Heatplus</a></em> package, or
the <em><a href="https://bioconductor.org/packages/3.19/ComplexHeatmap">ComplexHeatmap</a></em> packages (full documentation
various levels of sophistication, such as <code>heatmap.2</code> from the <code>r CRANpkg("gplots")</code> package, the <em><a href="https://bioconductor.org/packages/3.20/Heatplus">Heatplus</a></em> package, or
the <em><a href="https://bioconductor.org/packages/3.20/ComplexHeatmap">ComplexHeatmap</a></em> packages (full documentation
<a href="https://jokergoo.github.io/ComplexHeatmap-reference/book/index.html">here</a>),
demonstrated below.</p>
<div class="sourceCode" id="cb427"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb427-1"><a href="sec-biovis.html#cb427-1" tabindex="-1"></a><span class="fu">library</span>(<span class="st">"ComplexHeatmap"</span>)</span>
Expand Down Expand Up @@ -487,7 +487,7 @@ <h2>
<a href="sec-ccl.html"><button class="btn btn-default">Next</button></a>
</p>
<p class="build-date">Page built:
2024-10-28
2024-11-17
using
R version 4.4.1 (2024-06-14)
</p>
Expand Down
4 changes: 2 additions & 2 deletions docs/sec-ccl.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<meta name="author" content="Laurent Gatto" />

<meta name="date" content="2024-10-28" />
<meta name="date" content="2024-11-17" />

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down Expand Up @@ -511,7 +511,7 @@ <h3>Exercise 3<div class="tooltip"><button class="internal-link-btn" onclick="co
<a href="sec-si.html"><button class="btn btn-default">Next</button></a>
</p>
<p class="build-date">Page built:
2024-10-28
2024-11-17
using
R version 4.4.1 (2024-06-14)
</p>
Expand Down
21 changes: 10 additions & 11 deletions docs/sec-dimred.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<meta name="author" content="Laurent Gatto" />

<meta name="date" content="2024-10-28" />
<meta name="date" content="2024-11-17" />

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down Expand Up @@ -265,9 +265,9 @@ <h2>
we will focus on here. We are going to focus on a widerly used method
called Principal Component Analysis (PCA).</p>
<p>We are going to use the following dataset to illustrate some important
concepts that are scale and central to PCA. The small dataset show
below represents the measurement of genes <em>x</em> and <em>y</em> in 20
samples. We will be using the scaled and centred version of this data.</p>
concepts related to PCA. The small dataset show below represents the
measurement of genes <em>x</em> and <em>y</em> in 20 samples. We will be using the
scaled and centred version of this dataset.</p>
<div class="figure">
<span style="display:block;" id="fig:xyplot"></span>
<p class="caption marginnote shownote">
Expand Down Expand Up @@ -331,7 +331,7 @@ <h2>
<img src="WSBIM1322_files/figure-html/pxaex2-1.png" alt="The second prinicpal component is orthogonal to the second one." width="1056">
</div>
<p>In the example above the variance, the variance along the PCs are
1.77 and 0.23. The first one explains
1.77 and 0.23 respectively. The first one explains
88.6% or that variance, and the second one merely
11.4%. This is also reflected in the different
scales along the x and y axis.</p>
Expand All @@ -353,12 +353,11 @@ <h2>
<p>Principal components are linear combinations of the variables that
were originally measured, they provide a new coordinate system. The
PC in the previous example is a linear combination of <em>gene_x</em> and
<em>gene_y</em>, more specifically</p>
<em>gene_y</em>:</p>
<p><span class="math display">\[ PC = c_{1} ~ gene_{x} + c_{2} ~ gene_{y} \]</span></p>
<p>It has coefficients <span class="math inline">\((c_1, c_2)\)</span>, also called loading.</p>
<p>PCA in general will find linear combinations of the original
variables. These new linear combinations will maximise the variance
of the data.</p>
<p>PCA will find linear combinations of the original variables. These new
linear combinations will maximise the variance of the data.</p>
</div>
<div id="summary-and-application" class="section level2" number="8.4">
<h2>
Expand Down Expand Up @@ -648,7 +647,7 @@ <h2>
</div>
</div>
<p>Real datasets often come with <em>missing values</em>. In R, these should be
encoded using <code>NA</code>. Unfortunately, PCA cannot deal with missing
encoded using <code>NA</code>. Unfortunately, <code>prcomp()</code> cannot deal with missing
values, and observations containing <code>NA</code> values will be dropped
automatically. This is a viable solution only when the proportion of
missing values is low. Otherwise, it is possible to impute missing
Expand Down Expand Up @@ -1341,7 +1340,7 @@ <h2>
<a href="sec-ul.html"><button class="btn btn-default">Next</button></a>
</p>
<p class="build-date">Page built:
2024-10-28
2024-11-17
using
R version 4.4.1 (2024-06-14)
</p>
Expand Down
4 changes: 2 additions & 2 deletions docs/sec-mlintro.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<meta name="author" content="Laurent Gatto" />

<meta name="date" content="2024-10-28" />
<meta name="date" content="2024-11-17" />

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down Expand Up @@ -758,7 +758,7 @@ <h2>
<a href="sec-testing.html"><button class="btn btn-default">Next</button></a>
</p>
<p class="build-date">Page built:
2024-10-28
2024-11-17
using
R version 4.4.1 (2024-06-14)
</p>
Expand Down
4 changes: 2 additions & 2 deletions docs/sec-norm.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<meta name="author" content="Laurent Gatto" />

<meta name="date" content="2024-10-28" />
<meta name="date" content="2024-11-17" />

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down Expand Up @@ -759,7 +759,7 @@ <h2>
<a href="sec-mlintro.html"><button class="btn btn-default">Next</button></a>
</p>
<p class="build-date">Page built:
2024-10-28
2024-11-17
using
R version 4.4.1 (2024-06-14)
</p>
Expand Down
24 changes: 12 additions & 12 deletions docs/sec-obj.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<meta name="author" content="Laurent Gatto" />

<meta name="date" content="2024-10-28" />
<meta name="date" content="2024-11-17" />

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down Expand Up @@ -430,19 +430,19 @@ <h3>
<span class="header-section-number">3.4.1</span> Common Bioconductor classes<div class="tooltip"><button class="internal-link-btn" onclick="copy_link('common-bioconductor-classes')" onmouseout="reset_tooltip('common-bioconductor-classes-tooltip')"><span class="tooltiptext" id="common-bioconductor-classes-tooltip">Copy link</span><i class="fa fa-link"></i></button></div>
</h3>
<ul>
<li>Rectangular feature x sample data – <em><a href="https://bioconductor.org/packages/3.19/SummarizedExperiment">SummarizedExperiment</a></em><code>::SummarizedExperiment()</code> (RNAseq count matrix, microarray, …)</li>
<li>Genomic coordinates – <em><a href="https://bioconductor.org/packages/3.19/GenomicRanges">GenomicRanges</a></em><code>::GRanges()</code> (1-based, closed interval)</li>
<li>DNA / RNA / AA sequences – <em><a href="https://bioconductor.org/packages/3.19/Biostrings">Biostrings</a></em><code>::*StringSet()</code>
<li>Rectangular feature x sample data – <em><a href="https://bioconductor.org/packages/3.20/SummarizedExperiment">SummarizedExperiment</a></em><code>::SummarizedExperiment()</code> (RNAseq count matrix, microarray, …)</li>
<li>Genomic coordinates – <em><a href="https://bioconductor.org/packages/3.20/GenomicRanges">GenomicRanges</a></em><code>::GRanges()</code> (1-based, closed interval)</li>
<li>DNA / RNA / AA sequences – <em><a href="https://bioconductor.org/packages/3.20/Biostrings">Biostrings</a></em><code>::*StringSet()</code>
</li>
<li>Gene sets – <em><a href="https://bioconductor.org/packages/3.19/GSEABase">GSEABase</a></em><code>::GeneSet()</code> <em><a href="https://bioconductor.org/packages/3.19/GSEABase">GSEABase</a></em><code>::GeneSetCollection()</code>
<li>Gene sets – <em><a href="https://bioconductor.org/packages/3.20/GSEABase">GSEABase</a></em><code>::GeneSet()</code> <em><a href="https://bioconductor.org/packages/3.20/GSEABase">GSEABase</a></em><code>::GeneSetCollection()</code>
</li>
<li>Multi-omics data – <em><a href="https://bioconductor.org/packages/3.19/MultiAssayExperiment">MultiAssayExperiment</a></em><code>::MultiAssayExperiment()</code>
<li>Multi-omics data – <em><a href="https://bioconductor.org/packages/3.20/MultiAssayExperiment">MultiAssayExperiment</a></em><code>::MultiAssayExperiment()</code>
</li>
<li>Single cell data – <em><a href="https://bioconductor.org/packages/3.19/SingleCellExperiment">SingleCellExperiment</a></em><code>::SingleCellExperiment()</code>
<li>Single cell data – <em><a href="https://bioconductor.org/packages/3.20/SingleCellExperiment">SingleCellExperiment</a></em><code>::SingleCellExperiment()</code>
</li>
<li>Mass spectrometry data – <em><a href="https://bioconductor.org/packages/3.19/Spectra">Spectra</a></em><code>::Spectra()</code>
<li>Mass spectrometry data – <em><a href="https://bioconductor.org/packages/3.20/Spectra">Spectra</a></em><code>::Spectra()</code>
</li>
<li>Quantitative proteomics data – <em><a href="https://bioconductor.org/packages/3.19/QFeatures">QFeatures</a></em><code>::QFeatures()</code>
<li>Quantitative proteomics data – <em><a href="https://bioconductor.org/packages/3.20/QFeatures">QFeatures</a></em><code>::QFeatures()</code>
</li>
</ul>
</div>
Expand All @@ -455,8 +455,8 @@ <h3>
<code>require</code> will return <code>FALSE</code>, otherwise it returns <code>TRUE</code> and
loads the packages. Given that we negate the return value of
<code>require</code> using <code>!</code>, the packages will be installed only when
missing.</span> the<em><a href="https://bioconductor.org/packages/3.19/SummarizedExperiment">SummarizedExperiment</a></em>
package, that implements the class, and the <em><a href="https://bioconductor.org/packages/3.19/airway">airway</a></em>
missing.</span> the<em><a href="https://bioconductor.org/packages/3.20/SummarizedExperiment">SummarizedExperiment</a></em>
package, that implements the class, and the <em><a href="https://bioconductor.org/packages/3.20/airway">airway</a></em>
data package, that provides an RNA-Seq example data.</p>
<div class="sourceCode" id="cb66"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb66-1"><a href="sec-obj.html#cb66-1" tabindex="-1"></a><span class="cf">if</span> (<span class="sc">!</span><span class="fu">require</span>(<span class="st">"SummarizedExperiment"</span>))</span>
<span id="cb66-2"><a href="sec-obj.html#cb66-2" tabindex="-1"></a> BiocManager<span class="sc">::</span><span class="fu">install</span>(<span class="st">"SummarizedExperiment"</span>)</span>
Expand Down Expand Up @@ -1029,7 +1029,7 @@ <h2>
<a href="sec-biostrings.html"><button class="btn btn-default">Next</button></a>
</p>
<p class="build-date">Page built:
2024-10-28
2024-11-17
using
R version 4.4.1 (2024-06-14)
</p>
Expand Down
4 changes: 2 additions & 2 deletions docs/sec-refresher.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<meta name="author" content="Laurent Gatto" />

<meta name="date" content="2024-10-28" />
<meta name="date" content="2024-11-17" />

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
Expand Down Expand Up @@ -430,7 +430,7 @@ <h2>
<a href="sec-vis.html"><button class="btn btn-default">Next</button></a>
</p>
<p class="build-date">Page built:
2024-10-28
2024-11-17
using
R version 4.4.1 (2024-06-14)
</p>
Expand Down
Loading

0 comments on commit b1225ff

Please sign in to comment.