-
Notifications
You must be signed in to change notification settings - Fork 1
/
05_multivariate_methods_pca.Rmd
78 lines (62 loc) · 2.09 KB
/
05_multivariate_methods_pca.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: "Многомерные методы (PCA)"
author: "Марина Варфоломеева"
output:
html_document:
toc: yes
toc_depth: 2
toc_float:
collapsed: no
theme: flatly
highlight: haddock
include:
after_body: _footer.html
css: my_styles.css
lib_dir: site_libs
self_contained: no
bibliography:
- "bibs/references.bib"
- "bibs/05_packages.bib"
csl: "bibs/ecology.csl"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library("knitcitations")
cleanbib()
options("citation_format" = "pandoc")
```
# Многомерные методы выявления белков с похожим паттерном экспрессии (PCA)
Для PCA можно использовать несколько вариантов: в базовом пакете это функция `prcomp()`, `rda()` из пакета `vegan` `r citep(citation("vegan"))` и многие другие.
# Данные
```{r message=FALSE}
library(prot2D)
data(pecten)
data(pecten.fac)
library(limma)
pecten_norm <- normalizeQuantiles(pecten)
pecten_log <- log2(pecten_norm)
```
# Сходство проб
Построим тепловую карту коэффициентов корреляции между пробами при помощи функции `aheatmap()` из пакета `NMF` `r citep(citation("NMF"))`.
```{r message=FALSE}
library(NMF)
aheatmap(cor(pecten_log), color = "-RdBu:256", annCol = pecten.fac$Condition)
```
# PCA
```{r fig.show='hold'}
pca_pect <- prcomp(t(pecten_log))
PCA <- pca_pect$x
pal <- brewer.pal(9, "Set1")
cols <- pal[pecten.fac$Condition]
op <- par(mfrow = c(2, 2), mar = c(4, 4, 0.5, 0.5))
barplot(summary(pca_pect)$importance["Proportion of Variance", ], ylim = c(0, 1))
plot(PCA[, c(1, 3)], bg = cols, pch = 21, cex = 1, lwd = 1)
plot(PCA[, 3:2], bg = cols, pch = 21, cex = 1, lwd = 1)
plot(PCA, bg = cols, pch = 21, cex = 1, lwd = 1)
legend("topleft", legend = levels(pecten.fac$Condition), pt.bg = pal[1:2], pch = 21)
par(op)
```
## Ссылки
```{r include=FALSE}
write.bibtex(file="bibs/05_packages.bib")
```