Overall class analysis
#pdf("lipidomics_charts_classes.pdf")
# subset
y<-t(x[,776:816])
#MDS plot
plotMDS(y)
mtext("MDS plot for lipid classes")
# remove PC
y<-y[which(row.names(y)!="PC"),]
# sample correlation
heatmap(cor(y,method="s"),scale="none")
mtext("Spearman correlation b/w samples for lipid classes, dark colours are higher correlation" )
# lipid class correlation
heatmap(cor(t(y),method="s"),scale="none")
mtext("Spearman correlation between lipid classes, dark colours are higher correlation" )
# Make a heatmap of class differences
colfunc <- colorRampPalette(c("blue", "white", "red"))
heatmap.2(y,scale="row",trace="none",margins = c(5,5),,col=colfunc(25))
mtext("heatmap of lipid classes")
# set up sample list
group<-sapply(strsplit(colnames(y),"_"),"[[",1)
WT vs Mst-TG
# ttest
tres<-apply(y , 1 , function(x) { t.test( x[which(group=="Mst-TG")] , x[which(group=="WT")]) } )
pvals<-sapply(tres,"[[",3)
fdr<-p.adjust(pvals,method="BH")
means<-t(sapply(tres,"[[",5))
lfc<-log2(means[,2]/means[,1])
res<-cbind(pvals,fdr,lfc,y[,c( which(group=="WT") , which(group=="Mst-TG") )])
res<-as.data.frame(res)
res<-res[order(res$pvals),]
head(res,10) %>% kbl(caption = "Top 10 lipid classes for WT vs TG") %>% kable_paper("hover", full_width = F)
Top 10 lipid classes for WT vs TG
|
pvals
|
fdr
|
lfc
|
WT_1
|
WT_10
|
WT_2
|
WT_3
|
WT_4
|
WT_5
|
WT_6
|
WT_7
|
WT_8
|
WT_9
|
Mst-TG_21
|
Mst-TG_22
|
Mst-TG_23
|
Mst-TG_24
|
Mst-TG_25
|
Mst-TG_26
|
Mst-TG_27
|
Mst-TG_28
|
Mst-TG_29
|
Mst-TG_30
|
Ubiquinone.1
|
0.0e+00
|
0.00e+00
|
1.9096090
|
69440.50
|
94234.70
|
84368.76
|
91888.87
|
78190.70
|
102821.72
|
89319.69
|
84853.82
|
84420.87
|
81675.58
|
22108.73
|
30522.51
|
19628.26
|
28518.31
|
23993.07
|
20805.09
|
20628.13
|
22532.67
|
21849.45
|
18638.85
|
DHC
|
1.0e-07
|
1.70e-06
|
-0.7982886
|
1400.63
|
1660.82
|
1124.54
|
1341.88
|
1080.33
|
1494.04
|
1132.05
|
1117.33
|
964.18
|
1575.07
|
2659.95
|
1697.54
|
2390.99
|
2301.05
|
2263.70
|
2032.43
|
2245.66
|
2047.97
|
2296.20
|
2482.21
|
SM
|
1.0e-07
|
1.70e-06
|
-0.8247198
|
129593.56
|
115927.18
|
123323.82
|
124765.14
|
118901.15
|
122924.13
|
119945.68
|
126784.98
|
104776.26
|
120019.92
|
186172.45
|
195166.56
|
240743.14
|
196976.01
|
218784.23
|
209062.21
|
218878.92
|
201137.02
|
208811.66
|
262027.76
|
MHC
|
2.0e-07
|
2.10e-06
|
-1.1985088
|
749.30
|
615.98
|
582.60
|
795.49
|
1244.07
|
596.03
|
642.10
|
933.57
|
989.87
|
807.48
|
1766.55
|
1417.66
|
1981.18
|
1982.94
|
2326.77
|
1607.89
|
1751.03
|
2284.39
|
1514.46
|
1627.46
|
PS
|
2.8e-06
|
2.22e-05
|
-0.4437706
|
206058.33
|
180052.07
|
206707.82
|
246156.89
|
212697.12
|
188468.88
|
235447.96
|
186304.19
|
185490.48
|
236096.49
|
256900.12
|
324559.01
|
298023.46
|
278198.83
|
286018.18
|
297218.39
|
311293.61
|
267598.99
|
277180.48
|
236864.06
|
COH.1
|
3.4e-06
|
2.25e-05
|
-0.3786773
|
415973.17
|
410295.99
|
410678.35
|
430875.54
|
485252.15
|
475017.09
|
395077.94
|
432397.27
|
403230.79
|
478520.00
|
544449.00
|
514400.53
|
611671.79
|
650897.73
|
552959.80
|
525837.82
|
601992.79
|
580842.08
|
566323.19
|
489786.64
|
PE
|
4.9e-06
|
2.51e-05
|
0.5218124
|
5886110.35
|
5036781.03
|
5477237.33
|
6964716.93
|
4887244.17
|
5667202.15
|
6204941.35
|
5033420.16
|
5237042.41
|
5860565.75
|
3938260.90
|
5043402.09
|
3732113.12
|
4269089.98
|
4340068.38
|
3445959.96
|
3624499.16
|
3792878.03
|
3881193.37
|
3114116.65
|
PC.P.
|
5.0e-06
|
2.51e-05
|
0.4728615
|
40088.22
|
51624.90
|
47535.20
|
47643.24
|
36768.93
|
49757.30
|
47627.95
|
46257.08
|
39526.64
|
43308.40
|
30327.82
|
35370.79
|
31825.80
|
32237.90
|
34620.07
|
31746.62
|
30401.80
|
27747.37
|
34240.79
|
35820.69
|
TG.O.
|
6.2e-06
|
2.77e-05
|
0.6397977
|
5248.90
|
6065.19
|
5251.28
|
5677.64
|
6435.93
|
5318.91
|
5337.77
|
4632.58
|
5384.85
|
6863.77
|
4872.30
|
4633.82
|
2940.97
|
3550.94
|
2602.45
|
3399.24
|
3814.41
|
4188.60
|
2961.04
|
3116.35
|
LPC
|
9.2e-06
|
3.67e-05
|
-0.5157493
|
34760.29
|
42331.93
|
36095.46
|
39123.34
|
41049.69
|
39126.90
|
33598.81
|
34991.14
|
29371.54
|
37345.15
|
44929.98
|
56513.64
|
49323.57
|
54633.72
|
63702.44
|
45531.13
|
51893.36
|
46079.23
|
52067.56
|
61174.24
|
write.table(res,file="WTvsMst-TG_lipid_classes.tsv",sep="\t",quote=F,row.names=T)
# Now do a volcano plot
sig<-subset(res,fdr<0.05)
plot(res$lfc,-log10(res$pvals),pch=19,cex=0.9,xlim=c(-2.5,1.5),xlab="log2 fold change",ylab="-log10(p-value)")
points(sig$lfc,-log10(sig$pvals),pch=19,col="red",cex=0.95)
grid()
abline(v=0,lty=2)
text(sig$lfc,-log10(sig$pvals)+0.2,labels=rownames(sig))
mtext("volcano plot of lipid class differences: WT vs Mst1-TG")
# Now do some boxplots with jitter on top
lapply( rownames(res)[1:10] , function(NAME) {
z<-as.data.frame(y[which(rownames(y) %in% NAME ) ,])
colnames(z)=NAME
z$group<-factor(group)
MAX=max(z[,1])*1.1
p<-z %>% ggplot(aes(group,z[,1]))+ geom_boxplot(outlier.shape=NA ) + geom_jitter(width = 0.05,col="red") + ylim(0, MAX) + ggtitle(NAME)
print(p)
} )
## [[1]]
##
## [[2]]
##
## [[3]]
##
## [[4]]
##
## [[5]]
##
## [[6]]
##
## [[7]]
##
## [[8]]
##
## [[9]]
##
## [[10]]
WT vs Gal-3 KO
# ttest
tres<-apply(y , 1 , function(x) { t.test( x[which(group=="Gal-3 KO")] , x[which(group=="WT")] ) } )
pvals<-sapply(tres,"[[",3)
fdr<-p.adjust(pvals,method="BH")
means<-t(sapply(tres,"[[",5))
lfc<-log2(means[,2]/means[,1])
res<-cbind(pvals,fdr,lfc,y[,c( which(group=="WT") , which(group=="Gal-3 KO") )])
res<-as.data.frame(res)
head(res,10) %>% kbl(caption = "Top 10 lipid classes for WT vs KO") %>% kable_paper("hover", full_width = F)
Top 10 lipid classes for WT vs KO
|
pvals
|
fdr
|
lfc
|
WT_1
|
WT_10
|
WT_2
|
WT_3
|
WT_4
|
WT_5
|
WT_6
|
WT_7
|
WT_8
|
WT_9
|
Gal-3 KO_11
|
Gal-3 KO_12
|
Gal-3 KO_13
|
Gal-3 KO_14
|
Gal-3 KO_15
|
Gal-3 KO_16
|
Gal-3 KO_17
|
Gal-3 KO_18
|
Gal-3 KO_19
|
Gal-3 KO_20
|
Sph
|
0.0039170
|
0.0156678
|
-0.2415801
|
583.32
|
638.32
|
479.43
|
632.85
|
530.80
|
505.70
|
620.62
|
598.04
|
433.98
|
653.16
|
595.38
|
615.21
|
795.21
|
701.60
|
703.58
|
687.83
|
655.45
|
633.68
|
722.96
|
600.02
|
S1P
|
0.0114421
|
0.0352064
|
0.3345190
|
64.51
|
56.20
|
69.42
|
71.69
|
104.17
|
71.08
|
72.82
|
59.71
|
95.79
|
81.50
|
61.20
|
69.74
|
46.94
|
59.67
|
61.41
|
58.93
|
62.91
|
58.72
|
55.83
|
56.97
|
dhCer
|
0.0005209
|
0.0052092
|
-0.2922900
|
872.95
|
731.46
|
823.99
|
890.99
|
756.78
|
815.93
|
924.98
|
805.51
|
804.78
|
907.65
|
831.88
|
1172.06
|
1059.33
|
1073.98
|
1063.81
|
1135.74
|
832.22
|
1031.04
|
1059.82
|
947.04
|
Cer
|
0.0148005
|
0.0422871
|
-0.1883775
|
24898.05
|
25519.12
|
20835.14
|
30692.76
|
23722.15
|
25584.07
|
23055.37
|
23090.36
|
19645.09
|
27617.23
|
24286.18
|
25725.38
|
29425.82
|
28216.24
|
27466.34
|
29948.10
|
30495.98
|
27615.47
|
30802.74
|
24802.55
|
C1P
|
0.3634940
|
0.5013710
|
-0.1862685
|
1.01
|
2.29
|
1.36
|
1.67
|
1.52
|
2.72
|
2.10
|
1.02
|
2.32
|
2.13
|
1.38
|
2.70
|
2.22
|
2.46
|
2.83
|
2.67
|
1.95
|
1.01
|
1.79
|
1.63
|
MHC
|
0.0307400
|
0.0723295
|
0.3719164
|
749.30
|
615.98
|
582.60
|
795.49
|
1244.07
|
596.03
|
642.10
|
933.57
|
989.87
|
807.48
|
562.72
|
734.90
|
744.74
|
504.42
|
793.46
|
593.81
|
469.95
|
592.06
|
573.99
|
578.37
|
DHC
|
0.0024653
|
0.0133371
|
-0.6226913
|
1400.63
|
1660.82
|
1124.54
|
1341.88
|
1080.33
|
1494.04
|
1132.05
|
1117.33
|
964.18
|
1575.07
|
1520.94
|
2248.55
|
2143.51
|
2433.03
|
1780.66
|
1221.04
|
1831.88
|
2389.01
|
2905.43
|
1374.60
|
THC
|
0.1927813
|
0.3084501
|
-0.1645101
|
109.96
|
183.48
|
145.65
|
150.23
|
245.99
|
171.27
|
160.96
|
151.57
|
194.49
|
173.11
|
190.10
|
230.13
|
230.75
|
200.94
|
154.94
|
205.83
|
203.99
|
137.58
|
173.10
|
163.08
|
GM3
|
0.0000401
|
0.0016059
|
0.5230165
|
11130.63
|
10595.92
|
10890.82
|
10605.90
|
15374.76
|
12213.94
|
9906.28
|
10363.66
|
11083.33
|
10590.30
|
7194.44
|
8498.71
|
9204.49
|
7408.90
|
8986.38
|
9263.75
|
7313.35
|
8377.98
|
5752.27
|
6468.03
|
GM1
|
0.0035320
|
0.0156678
|
0.9656636
|
0.62
|
0.79
|
1.22
|
1.02
|
1.69
|
0.96
|
0.71
|
1.21
|
2.01
|
0.98
|
0.60
|
0.58
|
0.67
|
0.65
|
0.59
|
0.70
|
0.84
|
0.53
|
0.00
|
0.58
|
res<-res[order(res$pvals),]
write.table(res,file="WTvsGal3KO_lipid_classes.tsv",sep="\t",quote=F,row.names=T)
# Now do a volcano plot
sig<-subset(res,fdr<0.05)
plot(res$lfc,-log10(res$pvals),pch=19,cex=0.9,xlim=c(-1.5,1.5),xlab="log2 fold change",ylab="-log10(p-value)")
points(sig$lfc,-log10(sig$pvals),pch=19,col="red",cex=0.95)
grid()
abline(v=0,lty=2)
text(sig$lfc,-log10(sig$pvals)+0.1,labels=rownames(sig))
mtext("volcano plot of lipid class differences: WT vs Gal3KO")
# Now do some boxplots with jitter on top
lapply( rownames(res)[1:10] , function(NAME) {
z<-as.data.frame(y[which(rownames(y) %in% NAME ) ,])
colnames(z)=NAME
z$group<-factor(group)
MAX=max(z[,1])*1.1
p<-z %>% ggplot(aes(group,z[,1]))+ geom_boxplot(outlier.shape=NA ) + geom_jitter(width = 0.05,col="red") + ylim(0, MAX) + ggtitle(NAME)
print(p)
} )
## Warning: Removed 1 rows containing missing values (geom_point).
## [[1]]
##
## [[2]]
##
## [[3]]
##
## [[4]]
##
## [[5]]
##
## [[6]]
##
## [[7]]
##
## [[8]]
##
## [[9]]
## Warning: Removed 1 rows containing missing values (geom_point).
##
## [[10]]
Mst1-TG vs TG KO
# ttest
tres<-apply(y , 1 , function(x) { t.test( x[which(group=="TG KO")] , x[which(group=="Mst-TG")] ) } )
pvals<-sapply(tres,"[[",3)
fdr<-p.adjust(pvals,method="BH")
means<-t(sapply(tres,"[[",5))
lfc<-log2(means[,2]/means[,1])
res<-cbind(pvals,fdr,lfc,y[,c( which(group=="Mst-TG") , which(group=="TG KO") )])
res<-as.data.frame(res)
res<-res[order(res$pvals),]
head(res,10) %>% kbl(caption = "Top 10 lipid classes for TG vs TGKO") %>% kable_paper("hover", full_width = F)
Top 10 lipid classes for TG vs TGKO
|
pvals
|
fdr
|
lfc
|
Mst-TG_21
|
Mst-TG_22
|
Mst-TG_23
|
Mst-TG_24
|
Mst-TG_25
|
Mst-TG_26
|
Mst-TG_27
|
Mst-TG_28
|
Mst-TG_29
|
Mst-TG_30
|
TG KO_31
|
TG KO_32
|
TG KO_33
|
TG KO_34
|
TG KO_35
|
TG KO_36
|
TG KO_37
|
TG KO_38
|
TG KO_39
|
TG KO_40
|
MHC
|
0.0003160
|
0.0126417
|
0.6293783
|
1766.55
|
1417.66
|
1981.18
|
1982.94
|
2326.77
|
1607.89
|
1751.03
|
2284.39
|
1514.46
|
1627.46
|
1515.47
|
1180.99
|
1526.62
|
1058.02
|
749.72
|
1100.58
|
1827.61
|
962.91
|
879.73
|
1002.83
|
CE
|
0.0048351
|
0.0967016
|
-0.3548359
|
60317.81
|
57642.35
|
58466.46
|
78116.27
|
63169.91
|
50213.34
|
58817.30
|
57223.12
|
77709.94
|
69237.48
|
69873.11
|
62218.87
|
61346.62
|
76803.19
|
101741.62
|
89360.49
|
91084.00
|
74445.99
|
98187.41
|
81776.83
|
Sph
|
0.0086360
|
0.1011539
|
0.2717791
|
667.83
|
758.51
|
664.57
|
683.06
|
921.78
|
670.03
|
888.11
|
721.26
|
844.33
|
839.23
|
896.64
|
575.04
|
599.19
|
610.84
|
638.32
|
678.68
|
647.39
|
554.22
|
573.93
|
569.44
|
PC.P.
|
0.0101154
|
0.1011539
|
-0.3471938
|
30327.82
|
35370.79
|
31825.80
|
32237.90
|
34620.07
|
31746.62
|
30401.80
|
27747.37
|
34240.79
|
35820.69
|
39092.11
|
37203.20
|
38318.15
|
43609.07
|
61508.71
|
42616.81
|
27258.64
|
42169.52
|
37765.28
|
43045.76
|
THC
|
0.0134002
|
0.1072015
|
0.3370801
|
203.07
|
238.60
|
261.59
|
318.74
|
294.87
|
261.42
|
313.27
|
364.35
|
211.46
|
274.64
|
279.36
|
224.26
|
187.05
|
221.63
|
183.43
|
219.16
|
295.95
|
159.56
|
207.16
|
193.13
|
TG.O…NL.
|
0.0164175
|
0.1094501
|
-0.6991282
|
263.08
|
607.36
|
219.34
|
207.34
|
236.32
|
255.23
|
320.10
|
447.70
|
313.21
|
582.46
|
584.36
|
711.63
|
279.01
|
377.01
|
510.80
|
339.79
|
461.19
|
865.02
|
612.50
|
863.32
|
PC.O.
|
0.0296513
|
0.1536026
|
-0.2447030
|
21266.79
|
26951.31
|
21817.71
|
22514.62
|
22538.87
|
21861.51
|
22607.75
|
20939.36
|
24195.60
|
23670.15
|
26510.11
|
25745.89
|
25645.53
|
27317.24
|
40301.84
|
26108.75
|
20700.95
|
25360.28
|
24725.50
|
28160.34
|
LPE
|
0.0307205
|
0.1536026
|
0.2256225
|
52763.02
|
28970.20
|
40037.37
|
44411.38
|
35022.44
|
33762.28
|
36121.02
|
34637.51
|
38419.85
|
39149.95
|
33594.74
|
33781.02
|
30721.73
|
31922.15
|
37457.31
|
35676.41
|
28695.93
|
28725.68
|
31308.30
|
35920.56
|
PI
|
0.0513911
|
0.2188437
|
-0.1386641
|
658019.88
|
800978.51
|
749995.65
|
776203.43
|
773124.87
|
624898.72
|
683314.38
|
654400.39
|
701806.59
|
577477.68
|
865885.27
|
727780.66
|
677775.61
|
671856.84
|
861964.80
|
703628.00
|
752329.47
|
769865.32
|
799269.96
|
876083.23
|
PE
|
0.0584529
|
0.2188437
|
-0.1681670
|
3938260.90
|
5043402.09
|
3732113.12
|
4269089.98
|
4340068.38
|
3445959.96
|
3624499.16
|
3792878.03
|
3881193.37
|
3114116.65
|
4489186.42
|
4276699.78
|
4271488.13
|
3985580.44
|
5810090.24
|
4005966.37
|
4367211.20
|
4022500.25
|
4620537.85
|
4176337.81
|
write.table(res,file="Mst-TGvsTGKO_lipid_classes.tsv",sep="\t",quote=F,row.names=T)
# Now do a volcano plot
sig<-subset(res,fdr<0.05)
plot(res$lfc,-log10(res$pvals),pch=19,cex=0.9,xlim=c(-1.5,1.5),xlab="log2 fold change",ylab="-log10(p-value)")
points(sig$lfc,-log10(sig$pvals),pch=19,col="red",cex=0.95)
grid()
abline(v=0,lty=2)
text(sig$lfc,-log10(sig$pvals)+0.1,labels=rownames(sig))
mtext("volcano plot of lipid class differences: Mst-TG vs TG-KO")
# Now do some boxplots with jitter on top
lapply( rownames(res)[1:10] , function(NAME) {
z<-as.data.frame(y[which(rownames(y) %in% NAME ) ,])
colnames(z)=NAME
z$group<-factor(group)
MAX=max(z[,1])*1.1
p<-z %>% ggplot(aes(group,z[,1]))+ geom_boxplot(outlier.shape=NA ) + geom_jitter(width = 0.05,col="red") + ylim(0, MAX) + ggtitle(NAME)
print(p)
} )
## [[1]]
##
## [[2]]
##
## [[3]]
##
## [[4]]
##
## [[5]]
##
## [[6]]
##
## [[7]]
##
## [[8]]
##
## [[9]]
##
## [[10]]
dev.off()
## null device
## 1
Subset x for individual lipid species
#pdf("lipidomics_charts_species.pdf")
x<-t(x[,1:775])
#MDS plot
plotMDS(x)
mtext("MDS plot for individual lipids")
# sample correlation
heatmap(cor(x,method="s"),scale="none")
mtext("Spearman correlation b/w samples for lipid species, dark colours are higher correlation" )
#remove lipids with SD=0
x<-x[which(!rownames(x) %in% names(which(apply(x,1,sd)==0))),]
# lipid class correlation
heatmap(cor(t(x),method="s"),scale="none")
mtext("Spearman correlation between lipid species, dark colours are higher correlation" )
# Make a heatmap of class differences
colfunc <- colorRampPalette(c("blue", "white", "red"))
heatmap.2(x,scale="row",trace="none",margins = c(5,5),,col=colfunc(25))
mtext("heatmap of lipid species")
# set up sample list
group<-sapply(strsplit(colnames(x),"_"),"[[",1)
WT vs Mst-TG
# ttest
tres<-apply(x , 1 , function(x) { t.test( x[which(group=="WT")] , x[which(group=="Mst-TG")] ) } )
pvals<-sapply(tres,"[[",3)
fdr<-p.adjust(pvals,method="BH")
means<-t(sapply(tres,"[[",5))
lfc<-log2(means[,2]/means[,1])
res<-cbind(pvals,fdr,lfc,x[,c( which(group=="WT") , which(group=="Mst-TG") )])
res<-as.data.frame(res)
res<-res[order(res$pvals),]
head(res,20) %>% kbl(caption = "Top 20 lipid species for WT vs TG") %>% kable_paper("hover", full_width = F)
Top 20 lipid species for WT vs TG
|
pvals
|
fdr
|
lfc
|
WT_1
|
WT_10
|
WT_2
|
WT_3
|
WT_4
|
WT_5
|
WT_6
|
WT_7
|
WT_8
|
WT_9
|
Mst-TG_21
|
Mst-TG_22
|
Mst-TG_23
|
Mst-TG_24
|
Mst-TG_25
|
Mst-TG_26
|
Mst-TG_27
|
Mst-TG_28
|
Mst-TG_29
|
Mst-TG_30
|
PC.18.0_18.1.
|
0
|
0e+00
|
1.7254945
|
24504.86
|
17277.21
|
25676.66
|
26243.62
|
27129.20
|
19208.69
|
20790.91
|
24548.82
|
18295.67
|
22297.25
|
67443.18
|
63714.17
|
78948.50
|
72329.75
|
75042.83
|
75260.25
|
77187.94
|
76003.69
|
74767.80
|
86579.46
|
PC.P.18.1.18.1.
|
0
|
0e+00
|
2.0622720
|
110.74
|
77.81
|
115.53
|
138.28
|
97.57
|
78.95
|
79.42
|
90.25
|
72.54
|
95.41
|
393.11
|
406.49
|
439.68
|
358.74
|
388.44
|
453.10
|
395.28
|
348.75
|
363.15
|
448.02
|
PC.O.34.1.
|
0
|
0e+00
|
1.1263383
|
1839.31
|
2116.37
|
1844.36
|
1717.39
|
1890.96
|
1755.93
|
1536.68
|
1567.26
|
1275.99
|
1687.32
|
3345.06
|
4100.97
|
3561.33
|
3557.31
|
3505.45
|
3695.87
|
4225.42
|
3735.39
|
3823.26
|
4067.14
|
Ubiquinone
|
0
|
0e+00
|
-1.9096090
|
69440.50
|
94234.70
|
84368.76
|
91888.87
|
78190.70
|
102821.72
|
89319.69
|
84853.82
|
84420.87
|
81675.58
|
22108.73
|
30522.51
|
19628.26
|
28518.31
|
23993.07
|
20805.09
|
20628.13
|
22532.67
|
21849.45
|
18638.85
|
PS.36.1.
|
0
|
0e+00
|
1.1349891
|
12781.57
|
13240.14
|
11170.60
|
14107.65
|
19779.85
|
11096.07
|
11770.12
|
13071.26
|
10587.40
|
15479.93
|
27624.62
|
25600.78
|
30333.46
|
31983.52
|
29581.94
|
31237.34
|
32170.85
|
31656.31
|
27403.86
|
24683.58
|
SM.d18.1.24.1.
|
0
|
1e-07
|
1.2063640
|
11367.62
|
13602.89
|
9332.74
|
10718.32
|
13081.21
|
11494.75
|
8766.85
|
12189.55
|
7496.89
|
13721.46
|
23867.21
|
21727.38
|
27968.76
|
22801.84
|
29394.05
|
25006.27
|
25164.66
|
24990.41
|
25922.91
|
31077.01
|
PE.P.16.0.18.1.
|
0
|
1e-07
|
1.2023068
|
7202.58
|
8025.94
|
7715.38
|
9667.64
|
8843.98
|
7464.89
|
6989.02
|
6669.02
|
6167.23
|
9880.73
|
15696.66
|
20876.60
|
16430.85
|
20019.82
|
21522.00
|
16439.49
|
17658.73
|
17510.19
|
17595.90
|
17174.88
|
PE.18.0_18.1.
|
0
|
1e-07
|
0.8189492
|
21360.04
|
16666.59
|
17370.51
|
23705.98
|
21341.14
|
18823.88
|
17755.25
|
15346.34
|
16082.06
|
21407.68
|
31458.96
|
37465.01
|
31544.92
|
35432.36
|
36458.04
|
32454.94
|
32535.32
|
35935.39
|
32976.47
|
28673.59
|
PC.16.0_18.1.
|
0
|
1e-07
|
0.5819789
|
63364.51
|
76173.40
|
64386.55
|
67590.70
|
82863.67
|
74768.30
|
62525.18
|
74024.95
|
60597.34
|
70678.64
|
110013.99
|
97425.68
|
103684.64
|
101679.55
|
94976.74
|
104638.87
|
106513.88
|
107527.63
|
101115.69
|
115723.37
|
PC.P.16.0.16.1.
|
0
|
1e-07
|
1.5822021
|
45.24
|
53.16
|
42.55
|
53.99
|
54.64
|
44.64
|
42.26
|
63.27
|
32.78
|
55.73
|
152.84
|
144.47
|
150.03
|
140.18
|
161.98
|
145.82
|
151.10
|
101.49
|
142.27
|
171.80
|
LPC.20.1…sn1.
|
0
|
2e-07
|
0.8160187
|
74.40
|
80.19
|
96.72
|
78.36
|
100.61
|
82.37
|
63.94
|
86.02
|
78.65
|
76.04
|
126.97
|
121.81
|
138.73
|
145.16
|
160.96
|
138.24
|
151.71
|
150.79
|
138.89
|
165.63
|
SM.d18.1.24.0.
|
0
|
2e-07
|
0.9041109
|
9622.53
|
6425.50
|
9313.23
|
8921.02
|
9724.42
|
8296.79
|
10026.16
|
9019.54
|
9744.21
|
7903.94
|
14379.56
|
13944.52
|
18686.11
|
17379.05
|
17086.56
|
16099.73
|
18521.90
|
14979.90
|
17365.45
|
18106.03
|
Hex2Cer.d18.1.22.0.
|
0
|
2e-07
|
0.8183770
|
438.24
|
362.60
|
338.06
|
464.62
|
252.26
|
412.80
|
369.03
|
333.90
|
337.54
|
417.91
|
686.24
|
555.47
|
718.97
|
635.96
|
655.95
|
588.46
|
642.25
|
645.27
|
730.58
|
713.05
|
PC.O.18.1.18.1.
|
0
|
2e-07
|
0.8672917
|
147.57
|
158.57
|
173.23
|
152.84
|
136.50
|
134.70
|
124.70
|
117.14
|
102.73
|
137.28
|
220.03
|
291.28
|
248.60
|
223.84
|
257.94
|
225.02
|
247.55
|
271.71
|
249.12
|
291.95
|
PC.P.18.1.22.6.
|
0
|
5e-07
|
-0.9876941
|
3625.98
|
4034.51
|
3992.15
|
4331.49
|
2995.99
|
3659.25
|
3469.77
|
3279.70
|
3241.57
|
3940.79
|
1633.11
|
2218.98
|
1559.09
|
1876.18
|
2147.81
|
1670.05
|
1673.70
|
1733.68
|
2003.77
|
1925.87
|
PE.18.1_22.6…a.
|
0
|
6e-07
|
-1.0530455
|
683129.91
|
826556.51
|
776076.74
|
877109.53
|
669771.58
|
852434.08
|
864780.69
|
689009.51
|
615909.41
|
776951.41
|
371026.85
|
459195.56
|
301933.39
|
406502.98
|
433603.26
|
322963.53
|
341306.87
|
351653.50
|
356831.71
|
333092.08
|
PC.20.0_20.4.
|
0
|
7e-07
|
1.0342401
|
353.51
|
193.53
|
411.45
|
351.91
|
232.13
|
242.17
|
397.62
|
299.10
|
375.50
|
225.44
|
543.72
|
555.75
|
676.92
|
596.04
|
587.28
|
602.77
|
655.35
|
764.13
|
659.67
|
671.15
|
SM.d18.0.16.0.
|
0
|
7e-07
|
0.8971226
|
3642.66
|
3498.69
|
3227.21
|
3321.26
|
3340.91
|
2873.18
|
3836.88
|
3007.61
|
3186.03
|
3761.68
|
5818.58
|
5822.77
|
6236.79
|
5755.50
|
6352.26
|
5644.97
|
6916.77
|
7409.20
|
5613.61
|
7183.43
|
PC.P.16.0.18.1.
|
0
|
8e-07
|
2.2759353
|
820.37
|
919.07
|
1065.36
|
1056.11
|
710.35
|
924.46
|
717.81
|
819.64
|
509.34
|
960.22
|
3423.16
|
4734.08
|
3975.62
|
3952.43
|
4230.07
|
4280.71
|
3653.39
|
3191.61
|
4312.11
|
5426.52
|
PS.40.5.
|
0
|
8e-07
|
0.5347556
|
20112.38
|
18435.13
|
22070.10
|
23067.34
|
22809.89
|
19086.58
|
25071.80
|
20849.23
|
19517.96
|
23550.63
|
27559.96
|
32881.94
|
32765.56
|
29491.06
|
32365.76
|
33384.26
|
34255.46
|
28284.00
|
30675.73
|
29184.64
|
write.table(res,file="WTvsMst-TG_lipid_species.tsv",sep="\t",quote=F,row.names=T)
# Now do a volcano plot
sig<-subset(res,fdr<0.05)
plot(res$lfc,-log10(res$pvals),pch=19,cex=0.9,xlim=c(-4,4),xlab="log2 fold change",ylab="-log10(p-value)")
points(sig$lfc,-log10(sig$pvals),pch=19,col="red",cex=0.95)
grid()
abline(v=0,lty=2)
text(head(sig$lfc,10),-log10(head(sig$pvals,10))+0.2,labels=head(rownames(sig),10),cex=0.6)
mtext("volcano plot of lipid species differences: WT vs Mst1-TG")
heatmap.2(as.matrix(res[1:50,4:ncol(res)]),trace="none",scale="row",cexRow=0.5,col=colfunc(25))
mtext("Top 50 lipid species, by small p-values: WT vs Mst1-TG")
# Now do some boxplots with jitter on top
lapply( rownames(res)[1:20] , function(NAME) {
z<-as.data.frame(x[which(rownames(x) %in% NAME ) ,])
colnames(z)=NAME
z$group<-factor(group)
MAX=max(z[,1])*1.1
p<-z %>% ggplot(aes(group,z[,1]))+ geom_boxplot(outlier.shape=NA ) + geom_jitter(width = 0.05,col="red") + ylim(0, MAX) + ggtitle(NAME)
print(p)
} )
## [[1]]
##
## [[2]]
##
## [[3]]
##
## [[4]]
##
## [[5]]
##
## [[6]]
##
## [[7]]
##
## [[8]]
##
## [[9]]
##
## [[10]]
##
## [[11]]
##
## [[12]]
##
## [[13]]
##
## [[14]]
##
## [[15]]
##
## [[16]]
##
## [[17]]
##
## [[18]]
##
## [[19]]
##
## [[20]]
WT vs Gal-3 KO
# ttest
tres<-apply(x , 1 , function(x) { t.test( x[which(group=="Gal-3 KO")] , x[which(group=="WT")] ) } )
pvals<-sapply(tres,"[[",3)
fdr<-p.adjust(pvals,method="BH")
means<-t(sapply(tres,"[[",5))
lfc<-log2(means[,2]/means[,1])
res<-cbind(pvals,fdr,lfc,x[,c( which(group=="WT") , which(group=="Gal-3 KO") )])
res<-as.data.frame(res)
res<-res[order(res$pvals),]
head(res,20) %>% kbl(caption = "Top 20 lipid species for WT vs KO") %>% kable_paper("hover", full_width = F)
Top 20 lipid species for WT vs KO
|
pvals
|
fdr
|
lfc
|
WT_1
|
WT_10
|
WT_2
|
WT_3
|
WT_4
|
WT_5
|
WT_6
|
WT_7
|
WT_8
|
WT_9
|
Gal-3 KO_11
|
Gal-3 KO_12
|
Gal-3 KO_13
|
Gal-3 KO_14
|
Gal-3 KO_15
|
Gal-3 KO_16
|
Gal-3 KO_17
|
Gal-3 KO_18
|
Gal-3 KO_19
|
Gal-3 KO_20
|
PC.16.1_22.6.
|
3.00e-07
|
0.0001916
|
-0.5772205
|
2005.90
|
2581.91
|
2255.13
|
2110.27
|
2090.41
|
2949.89
|
2272.74
|
2577.04
|
2029.41
|
2338.19
|
2742.98
|
3883.29
|
3790.62
|
3482.08
|
3390.94
|
3754.98
|
3334.15
|
3544.86
|
3537.70
|
3168.40
|
Cer.d18.2.23.0.
|
1.10e-06
|
0.0004012
|
-0.8297307
|
313.88
|
257.09
|
393.35
|
438.12
|
286.97
|
339.26
|
443.92
|
364.56
|
375.41
|
343.93
|
505.89
|
517.06
|
646.55
|
660.44
|
573.86
|
731.74
|
804.29
|
608.13
|
699.42
|
573.76
|
PC.P.17.0.20.4…b.
|
2.30e-06
|
0.0004012
|
-0.6793725
|
60.98
|
55.66
|
71.99
|
76.11
|
51.33
|
56.85
|
73.37
|
45.02
|
58.96
|
76.19
|
105.45
|
68.92
|
110.41
|
100.07
|
101.73
|
104.14
|
107.48
|
109.24
|
110.58
|
85.22
|
PI.36.2.
|
2.70e-06
|
0.0004012
|
0.4042892
|
66461.56
|
83395.60
|
70628.62
|
76388.92
|
81113.86
|
80454.68
|
78704.32
|
80084.05
|
66223.20
|
77079.46
|
54551.99
|
57771.11
|
46554.39
|
62868.96
|
52125.67
|
52126.91
|
67431.81
|
59573.43
|
59033.67
|
62628.22
|
PC.P.17.0.20.4…a.
|
2.90e-06
|
0.0004012
|
-0.6883036
|
30.25
|
30.16
|
30.39
|
36.81
|
26.59
|
24.50
|
38.63
|
23.79
|
27.55
|
38.68
|
47.14
|
36.86
|
61.93
|
49.04
|
53.09
|
54.16
|
48.34
|
53.67
|
47.59
|
43.44
|
LPC.19.0…a…sn1…104_sn1.
|
3.20e-06
|
0.0004012
|
-1.0402278
|
116.46
|
62.06
|
124.63
|
95.58
|
58.73
|
54.18
|
82.21
|
57.18
|
99.27
|
71.24
|
112.48
|
144.31
|
213.26
|
199.08
|
164.28
|
137.47
|
179.44
|
190.91
|
192.83
|
155.48
|
Cer.d17.1.22.0.
|
4.90e-06
|
0.0004480
|
-1.0673785
|
198.64
|
95.07
|
176.86
|
269.41
|
97.26
|
126.02
|
210.75
|
127.51
|
173.78
|
143.47
|
276.63
|
209.45
|
392.59
|
405.61
|
340.97
|
310.22
|
401.75
|
322.08
|
417.99
|
315.04
|
Cer.d17.1.24.0.
|
5.70e-06
|
0.0004480
|
-0.7402628
|
100.00
|
72.12
|
100.85
|
136.47
|
61.95
|
81.86
|
93.50
|
76.09
|
96.37
|
86.35
|
118.24
|
112.67
|
178.77
|
153.29
|
170.09
|
157.19
|
158.52
|
149.65
|
173.91
|
140.39
|
Cer.d17.1.20.0.
|
5.90e-06
|
0.0004480
|
-0.7533047
|
67.65
|
70.98
|
73.58
|
97.80
|
57.90
|
71.39
|
77.99
|
71.59
|
56.77
|
92.03
|
104.08
|
82.17
|
146.84
|
134.29
|
115.61
|
133.87
|
134.73
|
128.64
|
145.61
|
117.63
|
PC.39.5..b.
|
6.00e-06
|
0.0004480
|
-0.8417115
|
268.18
|
261.02
|
333.50
|
255.35
|
168.42
|
253.74
|
301.05
|
223.64
|
280.33
|
202.25
|
388.79
|
400.66
|
409.99
|
580.97
|
359.63
|
530.06
|
478.48
|
373.69
|
548.08
|
495.18
|
Cer.d18.0.22.0.
|
9.10e-06
|
0.0006183
|
-0.5765950
|
279.42
|
194.50
|
290.22
|
337.77
|
198.18
|
246.72
|
285.89
|
240.10
|
287.83
|
226.78
|
295.33
|
413.52
|
393.90
|
413.44
|
355.00
|
440.13
|
337.50
|
416.82
|
436.70
|
356.33
|
PI.38.6.
|
1.14e-05
|
0.0007089
|
-0.5901676
|
3985.77
|
2320.35
|
3894.46
|
3856.82
|
2309.54
|
3499.73
|
3684.30
|
2642.95
|
3491.17
|
2594.10
|
4483.15
|
5531.18
|
4761.39
|
4372.28
|
4822.92
|
5274.06
|
4914.87
|
5433.40
|
4815.89
|
4184.65
|
PE.18.0_18.2.
|
1.29e-05
|
0.0007366
|
0.4253943
|
84087.61
|
92241.40
|
94072.14
|
98088.36
|
96865.75
|
94344.96
|
104900.82
|
104838.46
|
74884.75
|
96293.97
|
70859.87
|
75818.13
|
56679.74
|
77345.46
|
60130.50
|
58320.77
|
80002.33
|
66668.56
|
73880.54
|
80711.53
|
PC.O.16.0.22.6.
|
1.65e-05
|
0.0008751
|
-0.4184049
|
15901.12
|
19765.67
|
17360.50
|
17013.95
|
13248.82
|
18913.11
|
15805.49
|
13732.36
|
13792.92
|
15374.44
|
20458.81
|
22941.15
|
22303.39
|
20914.58
|
18376.87
|
20720.27
|
22659.39
|
21122.02
|
25460.41
|
20088.97
|
Cer.d16.1.20.0.
|
2.02e-05
|
0.0009582
|
-0.5540988
|
17.96
|
19.43
|
17.47
|
25.37
|
21.29
|
21.88
|
19.83
|
17.55
|
16.80
|
21.01
|
24.83
|
22.05
|
33.24
|
30.55
|
27.46
|
33.25
|
31.80
|
28.11
|
34.21
|
26.08
|
SM.d18.2.23.0.
|
2.08e-05
|
0.0009582
|
-0.7563716
|
797.29
|
429.61
|
1022.86
|
904.04
|
654.48
|
658.24
|
999.76
|
688.44
|
940.65
|
577.74
|
1146.94
|
1075.95
|
1310.04
|
1253.31
|
1255.30
|
1258.02
|
1399.53
|
1101.59
|
1838.84
|
1322.18
|
LPC.20.0…sn2.
|
2.19e-05
|
0.0009582
|
-0.7941525
|
39.26
|
31.30
|
40.81
|
28.69
|
33.48
|
26.39
|
36.64
|
39.20
|
46.75
|
20.45
|
53.76
|
50.16
|
50.80
|
72.76
|
47.32
|
54.79
|
72.30
|
55.93
|
78.93
|
57.98
|
Cer.d18.2.21.0.
|
2.72e-05
|
0.0010663
|
-0.8164422
|
59.77
|
62.34
|
84.97
|
87.40
|
68.42
|
97.45
|
102.13
|
74.96
|
85.01
|
67.95
|
96.45
|
107.26
|
148.05
|
151.62
|
124.06
|
175.13
|
182.48
|
124.99
|
143.83
|
138.07
|
PE.P.17.0.22.6…a.
|
2.99e-05
|
0.0010663
|
-0.7212752
|
2647.38
|
2183.71
|
2251.27
|
3451.15
|
1499.42
|
2163.31
|
3199.44
|
1745.78
|
1826.15
|
3488.75
|
3815.83
|
3319.29
|
3823.00
|
4361.89
|
3810.77
|
4355.55
|
4689.81
|
3436.46
|
3981.49
|
4725.61
|
Cer.d18.2.24.0.
|
3.02e-05
|
0.0010663
|
-0.4960995
|
372.92
|
439.76
|
488.60
|
432.20
|
501.65
|
494.31
|
479.64
|
515.60
|
457.86
|
424.97
|
546.32
|
562.57
|
671.73
|
621.56
|
617.96
|
713.55
|
786.20
|
630.63
|
779.87
|
568.02
|
write.table(res,file="WTvsGal3KO_lipid_species.tsv",sep="\t",quote=F,row.names=T)
# Now do a volcano plot
sig<-subset(res,fdr<0.05)
plot(res$lfc,-log10(res$pvals),pch=19,cex=0.9,xlim=c(-2,2),xlab="log2 fold change",ylab="-log10(p-value)")
points(sig$lfc,-log10(sig$pvals),pch=19,col="red",cex=0.95)
grid()
abline(v=0,lty=2)
text(head(sig$lfc,10),-log10(head(sig$pvals,10))+0.2,labels=head(rownames(sig),10),cex=0.6)
mtext("volcano plot of lipid species differences: WT vs Gal-3 KO")
# Heatmap top 50 differences
heatmap.2(as.matrix(res[1:50,4:ncol(res)]),trace="none",scale="row",cexRow=0.5,col=colfunc(25))
mtext("Top 50 lipid species, by small p-values: WT vs Gal-3 KO")
# Now do some boxplots with jitter on top
lapply( rownames(res)[1:20] , function(NAME) {
z<-as.data.frame(x[which(rownames(x) %in% NAME ) ,])
colnames(z)=NAME
z$group<-factor(group)
MAX=max(z[,1])*1.1
p<-z %>% ggplot(aes(group,z[,1]))+ geom_boxplot(outlier.shape=NA ) + geom_jitter(width = 0.05,col="red") + ylim(0, MAX) + ggtitle(NAME)
print(p)
} )
## [[1]]
##
## [[2]]
##
## [[3]]
##
## [[4]]
##
## [[5]]
##
## [[6]]
##
## [[7]]
##
## [[8]]
##
## [[9]]
##
## [[10]]
##
## [[11]]
##
## [[12]]
##
## [[13]]
##
## [[14]]
##
## [[15]]
##
## [[16]]
##
## [[17]]
##
## [[18]]
##
## [[19]]
##
## [[20]]
Mst1-TG vs TG KO
# ttest
tres<-apply(x , 1 , function(x) { t.test( x[which(group=="TG KO")] , x[which(group=="Mst-TG")] ) } )
pvals<-sapply(tres,"[[",3)
fdr<-p.adjust(pvals,method="BH")
means<-t(sapply(tres,"[[",5))
lfc<-log2(means[,2]/means[,1])
res<-cbind(pvals,fdr,lfc,x[,c( which(group=="Mst-TG") , which(group=="TG KO") )])
res<-as.data.frame(res)
res<-res[order(res$pvals),]
head(res,20) %>% kbl(caption = "Top 20 lipid species for TG vs TGKO") %>% kable_paper("hover", full_width = F)
Top 20 lipid species for TG vs TGKO
|
pvals
|
fdr
|
lfc
|
Mst-TG_21
|
Mst-TG_22
|
Mst-TG_23
|
Mst-TG_24
|
Mst-TG_25
|
Mst-TG_26
|
Mst-TG_27
|
Mst-TG_28
|
Mst-TG_29
|
Mst-TG_30
|
TG KO_31
|
TG KO_32
|
TG KO_33
|
TG KO_34
|
TG KO_35
|
TG KO_36
|
TG KO_37
|
TG KO_38
|
TG KO_39
|
TG KO_40
|
Cer.d18.1.24.1.
|
0.0000012
|
0.0008849
|
0.6036648
|
3526.01
|
3305.75
|
3921.43
|
4083.66
|
5022.14
|
4075.87
|
4268.58
|
3942.11
|
4032.92
|
4345.82
|
3006.73
|
3381.17
|
2132.27
|
2314.70
|
2260.59
|
2835.40
|
2370.07
|
2804.53
|
2770.54
|
2792.23
|
PE.18.0_18.1.
|
0.0000110
|
0.0023424
|
0.3601459
|
31458.96
|
37465.01
|
31544.92
|
35432.36
|
36458.04
|
32454.94
|
32535.32
|
35935.39
|
32976.47
|
28673.59
|
27016.78
|
31506.59
|
23270.88
|
24044.72
|
21961.07
|
24748.49
|
28401.66
|
26266.53
|
27522.74
|
26203.64
|
PC.18.0_20.4.
|
0.0000116
|
0.0023424
|
0.2891204
|
86691.44
|
103606.27
|
103656.76
|
95137.77
|
103757.42
|
94115.13
|
98681.67
|
101831.12
|
98820.16
|
90786.98
|
86924.72
|
88633.28
|
84800.70
|
86667.40
|
75302.75
|
82004.93
|
69284.80
|
73081.40
|
71262.24
|
81684.79
|
PC.P.35.2..b.
|
0.0000149
|
0.0023424
|
-0.5050396
|
15.64
|
22.91
|
16.33
|
18.47
|
19.51
|
19.91
|
16.75
|
13.96
|
15.75
|
16.74
|
26.45
|
19.95
|
24.21
|
22.26
|
27.82
|
29.84
|
25.72
|
22.28
|
24.25
|
26.95
|
HexCer.d18.1.24.1.
|
0.0000157
|
0.0023424
|
0.9034402
|
300.49
|
257.73
|
346.11
|
369.78
|
457.69
|
272.86
|
301.36
|
442.16
|
298.09
|
347.94
|
212.69
|
199.63
|
197.60
|
165.73
|
96.62
|
197.46
|
265.70
|
164.04
|
143.47
|
171.64
|
PE.P.18.0.22.5…n3.
|
0.0000207
|
0.0025648
|
-0.6777362
|
12433.00
|
11374.51
|
14402.02
|
16007.38
|
10713.37
|
11445.38
|
11553.77
|
12293.85
|
14164.74
|
10832.54
|
18177.39
|
21534.40
|
19075.93
|
19744.63
|
28710.02
|
19164.45
|
16528.24
|
18329.26
|
20006.42
|
19035.54
|
Cer.d19.1.22.0.
|
0.0000536
|
0.0050541
|
-0.5961892
|
5.90
|
9.32
|
7.12
|
6.99
|
6.93
|
5.25
|
8.26
|
8.83
|
6.08
|
7.43
|
13.31
|
9.80
|
11.46
|
9.66
|
14.19
|
10.83
|
10.18
|
8.72
|
11.37
|
9.49
|
PI.16.0_20.4.
|
0.0000543
|
0.0050541
|
-0.3017549
|
8692.45
|
10284.39
|
8854.23
|
10836.13
|
10995.99
|
8180.19
|
9368.89
|
10449.17
|
9019.86
|
9754.62
|
12499.46
|
12023.32
|
13009.91
|
10167.07
|
12924.40
|
10543.53
|
12359.58
|
11459.45
|
11753.24
|
12131.09
|
SM.44.3.
|
0.0000629
|
0.0051146
|
0.5058036
|
179.45
|
103.02
|
140.83
|
136.24
|
141.50
|
147.10
|
161.59
|
137.56
|
132.83
|
166.46
|
101.70
|
111.29
|
90.43
|
97.73
|
75.68
|
106.58
|
112.14
|
110.96
|
102.25
|
110.02
|
PE.P.18.0.20.3…a.
|
0.0000722
|
0.0051146
|
-0.4143817
|
617.22
|
806.25
|
817.41
|
932.21
|
726.67
|
621.05
|
713.83
|
753.86
|
829.80
|
713.09
|
1118.87
|
975.79
|
854.32
|
924.47
|
1250.78
|
996.87
|
1036.06
|
856.75
|
1006.14
|
1017.24
|
Cer.d18.1.16.0.
|
0.0000756
|
0.0051146
|
0.5608687
|
1971.19
|
1995.44
|
2197.82
|
2337.49
|
3064.00
|
2700.57
|
2789.42
|
2742.38
|
2280.58
|
3019.70
|
2157.74
|
1931.41
|
1638.94
|
1597.68
|
1451.17
|
1993.21
|
1417.09
|
1671.13
|
1507.39
|
1648.42
|
SM.44.2.
|
0.0000969
|
0.0060091
|
0.4112218
|
258.11
|
180.71
|
240.11
|
199.07
|
258.62
|
228.59
|
258.83
|
205.16
|
243.56
|
248.20
|
178.82
|
195.60
|
150.05
|
169.04
|
130.15
|
188.47
|
177.90
|
200.91
|
157.21
|
197.18
|
Cer.d17.1.22.0.
|
0.0001062
|
0.0060795
|
-0.6440653
|
133.19
|
272.17
|
137.44
|
139.17
|
193.95
|
127.03
|
145.81
|
184.07
|
159.24
|
133.64
|
254.96
|
264.88
|
255.07
|
280.37
|
329.78
|
245.82
|
267.47
|
223.57
|
189.78
|
228.84
|
SM.d16.1.23.0..SM.d17.1.22.0.
|
0.0001191
|
0.0062500
|
-0.5032421
|
1941.30
|
3466.74
|
3056.03
|
1947.53
|
2711.38
|
2330.15
|
2341.65
|
2483.62
|
2352.19
|
2898.93
|
3283.80
|
3920.93
|
3224.24
|
3880.38
|
4217.32
|
3590.20
|
3461.22
|
3486.56
|
2743.97
|
4376.80
|
PI.38.5…a.
|
0.0001260
|
0.0062500
|
-0.4758094
|
11996.63
|
13584.02
|
8929.17
|
13043.50
|
12460.26
|
11133.14
|
11256.13
|
12576.95
|
11578.12
|
11287.78
|
15084.24
|
16313.17
|
13941.39
|
15266.50
|
22550.40
|
14719.22
|
16070.92
|
16895.72
|
17821.82
|
15224.43
|
PE.P.20.0.22.6.
|
0.0001344
|
0.0062500
|
-0.6131068
|
8676.96
|
15578.79
|
11101.14
|
13163.79
|
12978.24
|
8923.03
|
9711.28
|
9435.58
|
12338.09
|
10596.36
|
19261.87
|
15160.40
|
15504.55
|
13181.92
|
23673.45
|
16546.29
|
17275.01
|
14950.92
|
16207.91
|
20316.98
|
PC.P.35.2..a.
|
0.0001753
|
0.0074497
|
-0.4079258
|
30.39
|
36.17
|
27.46
|
26.38
|
31.27
|
25.90
|
27.21
|
29.44
|
27.13
|
29.46
|
35.34
|
27.80
|
40.65
|
33.54
|
41.29
|
44.90
|
42.01
|
42.31
|
36.51
|
41.49
|
SM.41.0.
|
0.0001859
|
0.0074497
|
-0.4390849
|
344.00
|
486.10
|
593.89
|
388.80
|
391.06
|
386.30
|
499.65
|
436.41
|
370.80
|
461.91
|
696.59
|
601.59
|
502.42
|
548.05
|
562.46
|
583.04
|
648.53
|
528.18
|
528.91
|
709.81
|
PI.18.1_18.2.
|
0.0001902
|
0.0074497
|
-0.9436883
|
4471.72
|
5446.83
|
2558.48
|
3782.57
|
4590.78
|
3400.89
|
3485.65
|
4562.18
|
3602.20
|
4152.42
|
5749.94
|
7611.73
|
5632.66
|
6033.38
|
11871.90
|
5620.12
|
8449.45
|
8224.63
|
9615.17
|
8231.92
|
PC.18.0_18.1.
|
0.0002145
|
0.0078130
|
0.4126401
|
67443.18
|
63714.17
|
78948.50
|
72329.75
|
75042.83
|
75260.25
|
77187.94
|
76003.69
|
74767.80
|
86579.46
|
66237.18
|
63944.90
|
53062.36
|
52850.81
|
30182.28
|
64502.12
|
58705.00
|
58509.77
|
53176.98
|
60218.89
|
write.table(res,file="MstTGvsTGKO_lipid_species.tsv",sep="\t",quote=F,row.names=T)
# Now do a volcano plot
sig<-subset(res,fdr<0.05)
plot(res$lfc,-log10(res$pvals),pch=19,cex=0.9,xlim=c(-2,2),xlab="log2 fold change",ylab="-log10(p-value)")
points(sig$lfc,-log10(sig$pvals),pch=19,col="red",cex=0.95)
grid()
abline(v=0,lty=2)
text(head(sig$lfc,10),-log10(head(sig$pvals,10))+0.2,labels=head(rownames(sig),10),cex=0.6)
mtext("volcano plot of lipid species differences: Mst-TG vs TG KO")
# Heatmap top 50 differences
heatmap.2(as.matrix(res[1:50,4:ncol(res)]),trace="none",scale="row",cexRow=0.5,col=colfunc(25))
mtext("Top 50 lipid species, by small p-values: Mst-TG vs TG KO")
# Now do some boxplots with jitter on top
lapply( rownames(res)[1:20] , function(NAME) {
z<-as.data.frame(x[which(rownames(x) %in% NAME ) ,])
colnames(z)=NAME
z$group<-factor(group)
MAX=max(z[,1])*1.1
p<-z %>% ggplot(aes(group,z[,1]))+ geom_boxplot(outlier.shape=NA ) + geom_jitter(width = 0.05,col="red") + ylim(0, MAX) + ggtitle(NAME)
print(p)
} )
## [[1]]
##
## [[2]]
##
## [[3]]
##
## [[4]]
##
## [[5]]
##
## [[6]]
##
## [[7]]
##
## [[8]]
##
## [[9]]
##
## [[10]]
##
## [[11]]
##
## [[12]]
##
## [[13]]
##
## [[14]]
##
## [[15]]
##
## [[16]]
##
## [[17]]
##
## [[18]]
##
## [[19]]
##
## [[20]]
dev.off()
## null device
## 1