In [1]:
#filename_tbl <- '../../data/03_ShawnJe/Je201710_Lipidomics/201612_OrganoidLipidomics.refined.txt'
#filename_qnorm <- '../../data/03_ShawnJe/Je201710_Lipidomics/201612_OrganoidLipidomics.qnorm.txt'
filename_tbl <- '../../data/03_ShawnJe/Je201710_Lipidomics/201708_OrganoidLipidomics.refined.txt'
filename_qnorm <- '../../data/03_ShawnJe/Je201710_Lipidomics/201708_OrganoidLipidomics.qnorm.txt'
tbl <- read.table(filename_tbl, row.names="TargetName", header=T)
## quantile normalization
# installation
#source('http://bioconductor.org/biocLite.R')
#biocLite('preprocessCore')
# loading package
library(preprocessCore)
tbl_norm <- normalize.quantiles( as.matrix(tbl) )
rownames(tbl_norm) <- rownames(tbl)
colnames(tbl_norm) <- colnames(tbl)
write.table(tbl_norm, file=filename_qnorm, sep='\t')
In [7]:
library(repr)
options(repr.plot.width=8, repr.plot.height=5)
par(mar = c(8,5,2,2) + 0.1)
boxplot(log(tbl+0.001, 2), las=2, ylab="log2(signal)", cex.axis=0.5)
grid()
In [8]:
library(repr)
options(repr.plot.width=8, repr.plot.height=5)
par(mar = c(8,5,2,2) + 0.1)
boxplot(log(tbl_norm+0.001, 2), las=2, ylab="log2(signal)", cex.axis=0.5)
grid()
In [10]:
tmp_cor <- dist( 1 - cor(as.matrix(tbl_norm),method='spearman') )
tmp_clust <- hclust( tmp_cor, method="average")
plot(tmp_clust, main="1 - SpearmanR", cex=0.5)
In [11]:
tmp_cor <- dist( 1 - cor(as.matrix(tbl_norm),method='pearson') )
tmp_clust <- hclust( tmp_cor, method="average")
plot(tmp_clust, main="1 - PearsonR", cex=0.5)
In [75]:
library(limma)
filename_limma <- '../../data/03_ShawnJe/Je201710_Lipidomics/201612_OrganoidLipidomics.GBA-WT.limma_out.txt'
tbl_MA <- new("MAList",list(M=tbl_norm,A=tbl_norm))
colnames(tbl_MA)
groups <- gsub('[123]$','', colnames(tbl_MA))
groups <- gsub('Div[369]0_','', groups)
groups
design <- model.matrix( ~ as.factor(groups) )
design
v <- voom(tbl_MA, design)
fit <- lmFit(v, design)
fit <- eBayes(fit, trend=TRUE)
write.table( topTable(fit, coef=ncol(design), confint=TRUE, n=Inf, adjust="BH"), filename_limma )
In [87]:
groups <- gsub('[123]$','', colnames(tbl_MA))
#groups <- gsub('Div[369]0_','', groups)
groups
design <- model.matrix(~ 0+as.factor(groups))
colnames(design) <- c("Div30_GBA", "Div30_WT", "Div60_GBA", "Div60_WT", "Div90_GBA", "Div90_WT")
design
v <- voom(tbl_MA, design)
fit <- lmFit(v, design)
contrast.matrix <- makeContrasts(Div30_GBA-Div30_WT, Div60_GBA-Div60_WT, Div90_GBA-Div90_WT, levels=design)
fit2 <- contrasts.fit(fit, contrast.matrix)
fit2 <- eBayes(fit2, trend=TRUE)
filename_limma <- '../../data/03_ShawnJe/Je201710_Lipidomics/201612_OrganoidLipidomics.Div30_GBA-WT.limma_out.txt'
write.table( topTable(fit2, coef=1, confint=TRUE, n=Inf, adjust="BH"), filename_limma )
filename_limma <- '../../data/03_ShawnJe/Je201710_Lipidomics/201612_OrganoidLipidomics.Div60_GBA-WT.limma_out.txt'
write.table( topTable(fit2, coef=2, confint=TRUE, n=Inf, adjust="BH"), filename_limma )
filename_limma <- '../../data/03_ShawnJe/Je201710_Lipidomics/201612_OrganoidLipidomics.Div90_GBA-WT.limma_out.txt'
write.table( topTable(fit2, coef=3, confint=TRUE, n=Inf, adjust="BH"), filename_limma )
In [ ]: