This repository has been archived by the owner on Mar 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Report_CEL.Rmd
128 lines (91 loc) · 2.96 KB
/
Report_CEL.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
---
title: "Pipeline CEL Report"
author: "Sergi Aguiló Castillo"
date: "`r date()`"
output:
html_document:
toc: true
toc_float: true
params:
Folder: ""
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r echo=FALSE, message=FALSE, results='hide'}
###Import libraries
library(ggplot2)
library(affyPLM)
library(affy)
#### Read the files
celfiles <- affy::ReadAffy(celfile.path = params$Folder)
```
# Pseudo-images
```{r, echo=FALSE, cache=FALSE, results=FALSE, warning=FALSE, comment=FALSE, message= FALSE, eval =T, out.width='.7\\linewidth', fig.asp=1, fig.ncol = 1}
### Change the class of the files with a robut linear model
### Necessary for creating the Pseudo-images
cel_PLM <- affyPLM::fitPLM(celfiles)
# Make the image for each file
for (i in celfiles$sample){
# Weighted image
image(cel_PLM, which=i, add.legend = T)
# Residuals
image(cel_PLM, which=i, type="resids", add.legend = T)
}
```
# Processed data
```{r, echo=FALSE, results='hide'}
### Apply RMA and extract the expression values
norm_cel <- rma(celfiles)
norm_exp <- exprs(norm_cel)
# Vectors to do the dataframe
norm_sampleNames <- rep(colnames(norm_exp),each = nrow(norm_exp))
norm_logs = vector()
for (i in celfiles$sample){
norm_logs = c(norm_logs, norm_exp[,i])
}
# Create a data frame
norm_logData = data.frame(logInt=norm_logs,sampleName=norm_sampleNames)
```
### Boxplot
```{r, echo=FALSE, results='hide'}
### Change size of the plot
par(mar=c(20,8,4.1,2.1))
ggplot(norm_logData, aes(sampleName, logInt)) + geom_boxplot() +
xlab("Sample number") + ylab("Normalised expression values") +
scale_y_log10() +
theme(axis.text.x = element_text(colour = "aquamarine4",
angle = 50, size = 6.5, hjust = 1 ,
face = "bold"))
```
### Density plot
```{r, echo=FALSE, results='hide'}
ggplot(norm_logData, aes(logInt, color= sampleName)) +
geom_line(stat="density") + scale_x_log10() +
scale_color_discrete("Sample Name") + xlab("Normalised expression values")
```
# Comparison plots
### MA plot
```{r,echo=FALSE, fig.align='center'}
for (i in celfiles$sample){
affy::MAplot(norm_cel, which = i)
}
```
### Relative Log Expression (RLE)
```{r, echo=FALSE, fig.width=10, fig.height=9}
### RLE can also be done by the following command
# RLE(cel_PLM, names = celfiles$sample)
par(mar = c(16, 10, 4.1, 2.1))
Mbox(norm_cel, main = "RLE", ylim = c(-0.4, 0.4),
outline = FALSE, col = "mistyrose",
las = 3, whisklty = 0, staplelty = 0, ylab = "RLE value")
abline(h=0)
```
### Normalised Unscaled Standard Error
```{r, echo=FALSE,fig.width=10, fig.height=9}
par(mar = c(16, 10, 4.1, 2.1))
boxplot(cel_PLM, main = "NUSE", outline = F,
ylim = c(0.95,1.15),col = "lightblue", las = 3,
whisklty = 0, staplelty = 0, ylab = "NUSE value")
abline(h=1)
```