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')

Boxplot


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()


Hierarchical clustering


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)


Differential analysis with limma


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 )


  1. 'Div30_GBA1'
  2. 'Div30_GBA2'
  3. 'Div30_GBA3'
  4. 'Div30_WT1'
  5. 'Div30_WT2'
  6. 'Div30_WT3'
  7. 'Div60_GBA1'
  8. 'Div60_GBA2'
  9. 'Div60_GBA3'
  10. 'Div60_WT1'
  11. 'Div60_WT2'
  12. 'Div60_WT3'
  13. 'Div90_GBA1'
  14. 'Div90_GBA2'
  15. 'Div90_GBA3'
  16. 'Div90_WT1'
  17. 'Div90_WT2'
  18. 'Div90_WT3'
  1. 'GBA'
  2. 'GBA'
  3. 'GBA'
  4. 'WT'
  5. 'WT'
  6. 'WT'
  7. 'GBA'
  8. 'GBA'
  9. 'GBA'
  10. 'WT'
  11. 'WT'
  12. 'WT'
  13. 'GBA'
  14. 'GBA'
  15. 'GBA'
  16. 'WT'
  17. 'WT'
  18. 'WT'
(Intercept)as.factor(groups)WT
110
210
310
411
511
611
710
810
910
1011
1111
1211
1310
1410
1510
1611
1711
1811

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 )


  1. 'Div30_GBA'
  2. 'Div30_GBA'
  3. 'Div30_GBA'
  4. 'Div30_WT'
  5. 'Div30_WT'
  6. 'Div30_WT'
  7. 'Div60_GBA'
  8. 'Div60_GBA'
  9. 'Div60_GBA'
  10. 'Div60_WT'
  11. 'Div60_WT'
  12. 'Div60_WT'
  13. 'Div90_GBA'
  14. 'Div90_GBA'
  15. 'Div90_GBA'
  16. 'Div90_WT'
  17. 'Div90_WT'
  18. 'Div90_WT'
Div30_GBADiv30_WTDiv60_GBADiv60_WTDiv90_GBADiv90_WT
1100000
2100000
3100000
4010000
5010000
6010000
7001000
8001000
9001000
10000100
11000100
12000100
13000010
14000010
15000010
16000001
17000001
18000001

In [ ]: