-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path12-confounders-reads.Rmd
41 lines (36 loc) · 1.41 KB
/
12-confounders-reads.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
---
knit: bookdown::preview_chapter
---
# Identifying confounding factors (Reads)
```{r, echo=FALSE, message=FALSE, warning=FALSE}
library(scater, quietly = TRUE)
library(knitr)
options(stringsAsFactors = FALSE)
opts_chunk$set(out.width='90%', fig.align = 'center', echo=FALSE)
reads <- readRDS("tung/reads.rds")
reads.qc <- reads[fData(reads)$use, pData(reads)$use]
endog_genes <- !fData(reads.qc)$is_feature_control
```
```{r confound-pca-reads, fig.cap = "PCA plot of the tung data"}
scater::plotPCA(reads.qc[endog_genes, ],
colour_by = "batch",
size_by = "total_features",
exprs_values = "log2_counts")
```
```{r confound-find-pcs-total-features-reads, fig.cap = "PC correlation with the number of detected genes", fig.asp=1}
scater::plotQC(reads.qc[endog_genes, ],
type = "find-pcs",
variable = "total_features",
exprs_values = "log2_counts")
```
```{r confound-find-expl-vars-reads, fig.cap = "Explanatory variables"}
scater::plotQC(reads.qc[endog_genes, ],
type = "expl",
exprs_values = "log2_counts",
variables = c("total_features",
"total_counts",
"batch",
"individual",
"pct_counts_feature_controls_ERCC",
"pct_counts_feature_controls_MT"))
```