forked from hemberg-lab/scRNA.seq.course
-
Notifications
You must be signed in to change notification settings - Fork 0
/
19-confounders-reads.Rmd
53 lines (47 loc) · 1.22 KB
/
19-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
42
43
44
45
46
47
48
49
50
51
52
53
---
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[rowData(reads)$use, colData(reads)$use]
endog_genes <- !rowData(reads.qc)$is_feature_control
```
```{r confound-pca-reads, fig.cap = "PCA plot of the tung data"}
plotPCA(
reads.qc[endog_genes, ],
exprs_values = "logcounts_raw",
colour_by = "batch",
size_by = "total_features"
)
```
```{r confound-find-pcs-total-features-reads, fig.cap = "PC correlation with the number of detected genes", fig.asp=1}
plotQC(
reads.qc[endog_genes, ],
type = "find-pcs",
exprs_values = "logcounts_raw",
variable = "total_features"
)
```
```{r confound-find-expl-vars-reads, fig.cap = "Explanatory variables"}
plotQC(
reads.qc[endog_genes, ],
type = "expl",
exprs_values = "logcounts_raw",
variables = c(
"total_features",
"total_counts",
"batch",
"individual",
"pct_counts_ERCC",
"pct_counts_MT"
)
)
```
```{r}
sessionInfo()
```