-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExosome_Microarray_Analysis.Rmd
More file actions
144 lines (88 loc) · 3.61 KB
/
Exosome_Microarray_Analysis.Rmd
File metadata and controls
144 lines (88 loc) · 3.61 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
title: "Exosome Microarray Analysis"
author: "Claire Levy"
date: "January 11, 2017"
output: github_document
---
```{r setup, include=FALSE, cache = TRUE}
knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE)
library(dplyr)
library(lumi)
library(limma)
library(pander)
library(stringr)
library(ggplot2)
##It turns out that you can just use this lumiR.batch function instead of all that stuff that I used in the HVE and explant MA read-in
#Even though I only have one MA file to read in, I am using lumiR.BATCH because I also want to use the argument where I can put in a pData file. The pData must be a tab delim txt file. I converted the .csv file that I already had from Lucia to a .txt file.
lumibatch<-lumiR.batch(fileList = "..\\raw_data\\FinalReport.txt",
detectionTh = 0.05, sampleInfoFile = "..\\raw_data\\SampleInformation.txt")
#note that control data is here
#getControlData(lumibatch)
#and pData is here
#pData(lumibatch)
#and that the QC of non-normalized data has been done
#summary(lumibatch, 'QC')
```
```{r density plot of nonnorm data}
density(lumibatch)#number of probes for each sample that occur
#at a certain log2 intensity
```
```{r sample relations plot}
plot(lumibatch, what='sampleRelation',method="mds")
```
```{r boxplot}
#boxplot
boxplot(lumibatch)
```
```{r background correction, results = 'hide'}
#the data we got from the core had no background correction (I don't think it did anyway...) so I will do it here.
B_lumibatch<-lumiB(lumibatch, method = "bgAdjust")
# VST TRANSFORMATION
#"Stabilizing the expression variance based on
#the bead level expression variance and mean relations"
TB_lumibatch <-lumiT (B_lumibatch, method = 'vst')
#can do this to look at a plot. plotting doesn't work if I do method = "log2"
#plotVST(TB_lumibatch)
```
This looks good, right?
```{r quantile normalization and plots}
#trying quantile normalization here (not robust spline as before)
NTB_lumibatch<-lumiN(TB_lumibatch,method="quantile")
#this seems to be fine with quantile normalization...
density(NTB_lumibatch)
```
```{r quantile norm boxplot}
boxplot(NTB_lumibatch)
```
This density plot looks weird but the boxplot looks ok I guess?
```{r RSN normalization and plot}
#trying quantile normalization here (not robust spline as before)
NrsnTB_lumibatch<-lumiN(TB_lumibatch,method="rsn")
density(NrsnTB_lumibatch)
```
```{r rns boxplot}
boxplot(NrsnTB_lumibatch)
```
```{r QC of normalized data}
#I'm going to use the quantile normalized data for now.
QNTB_lumibatch<-lumiQ(NTB_lumibatch)
```
```{r MDS plot}
#to get data into dataframe form for nice plotting...
dimensional_data <- plotMDS(QNTB_lumibatch)#make the plot, it invisibly returns a large object that has the actual dimensions data in matrices called x and y (one for each dimension)
#make a data frame where
d <- data.frame(Dim1 = dimensional_data$x, #Dim1 is a column containing the values from the x matrix
Dim2 = dimensional_data$y, #Dim2 is a column containing the values from the y matrix
sampleID = names(dimensional_data$x))#SampleNames is a column that holds the column names from the x matrix, which happen to be the microarray wells.
d <- as_data_frame(merge(d, pData(QNTB_lumibatch)), by = "sampleID")
```
Clustering appears to be primarily by cell type, then by Virus, then donor and Exosomes are sort of mixed.
```{r plot dims}
ggplot(d, aes(x=Dim1, y = Dim2))+
geom_point(aes(color = Exosomes, shape = Virus), size = 3)
```
```{r plot dims facet donor}
ggplot(d, aes(x=Dim1, y = Dim2))+
geom_point(aes(color = Exosomes, shape = Virus), size = 3)+
facet_wrap(~Donor)
```