forked from mpg-age-bioinformatics/htseq-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QC.R
164 lines (132 loc) · 3.37 KB
/
QC.R
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/usr/bin/env Rscript
rm(list = ls())
args<-commandArgs(TRUE)
input=toString(args[1])
output=toString(args[2])
setwd(input)
# ****************************************************
# Quality control
# ****************************************************
#source('http://www.bioconductor.org/biocLite.R')
#biocLite('cummeRbund', ask=FALSE)
library(cummeRbund)
setwd(input)
cuff<-readCufflinks()
cuff
print("dispersionPlot")
disp<-dispersionPlot(genes(cuff))
pdf(paste(output,"/dispersionPlot.pdf", sep=""))
disp
dev.off()
rm(disp)
print("fpkmSCVPlot")
genes.scv<-fpkmSCVPlot(genes(cuff))
pdf(paste(output,"/genes.scv.pdf", sep=""))
genes.scv
dev.off()
rm(genes.scv)
print("fpkmSCVPlot")
isoforms.scv<-fpkmSCVPlot(isoforms(cuff))
pdf(paste(output,"/isoforms.scv.pdf", sep=""))
isoforms.scv
dev.off()
rm(isoforms.scv)
print("csDensity")
dens<-csDensity(genes(cuff))
pdf(paste(output,"/csDensity.pdf",sep=""))
dens
dev.off()
rm(dens)
print("csDensity")
densRep<-csDensity(genes(cuff),replicates=T)
pdf(paste(output,"/csDensRep.pdf",sep=""))
densRep
dev.off()
rm(densRep)
print("csBoxplot")
b<-csBoxplot(genes(cuff))
pdf(paste(output,"/csBoxplot.pdf",sep=""))
b
dev.off()
rm(b)
print("csBoxplot")
brep<-csBoxplot(genes(cuff),replicates=T)
# brep
brepY<-brep+coord_cartesian(ylim=c(-5.15,5.15))
pdf(paste(output,"/csBoxplotrep.pdf", sep=""))
brepY
dev.off()
rm(brepY)
print("csScatterMatrix")
s<-csScatterMatrix(genes(cuff))
pdf(paste(output,"/csScatterMatrix.pdf",sep=""))
s
dev.off()
rm(s)
# srep<-csScatterMatrix(genes(cuff),replicates=T)
# srep
print("csDendro")
pdf(paste(output,"/csDendro.pdf",sep=""))
dend<-csDendro(genes(cuff))
dev.off()
rm(dend)
print("csDendro")
pdf(paste(output,"/csDendrorep.pdf",sep=""))
dend.rep<-csDendro(genes(cuff),replicates=T)
dev.off()
rm(dend.rep)
print("PCAplot")
genes.PCA<-PCAplot(genes(cuff),"PC1","PC2")
pdf(paste(output,"/genes.PCA.pdf",sep=""))
genes.PCA
dev.off()
rm(genes.PCA)
print("PCAplot")
genes.PCA.rep<-PCAplot(genes(cuff),"PC1","PC2",replicates=T)
pdf(paste(output,"/genes.PCA.rep.pdf",sep=""))
genes.PCA.rep
dev.off()
rm(genes.PCA.rep)
print("MDSplot")
cond.PCoA <- MDSplot(genes(cuff))
pdf(paste(output,"/cond.PCoA.pdf",sep=""))
cond.PCoA
dev.off()
print("MDSplot")
cond.PCoA.rep <- MDSplot(genes(cuff), replicates = T)
pdf(paste(output,"/cond.PCoA.rep.pdf",sep=""))
cond.PCoA.rep
dev.off()
print("csHeatmap")
mySigGeneIds<-getSig(cuff,alpha=0.05,level='genes')
mySigGenes<-getGenes(cuff,mySigGeneIds)
h<-csHeatmap(mySigGenes,cluster='both')
h$scales$scales[[2]]$labels <- sub("\\|.*", "",h$scales$scales[[2]]$labels)
h$scales$scales[[2]]$labels <- sub(",.*", "",h$scales$scales[[2]]$labels)
pdf(paste(output,"/heatmap.pdf",sep=""))
h
dev.off()
#tiff(filename = paste(output,"/heatmap.tiff",sep=""),width=2400,height=1350)
#h
#dev.off()
rm(h)
print("csHeatmap")
h.rep<-csHeatmap(mySigGenes,cluster='both',replicates=T)
h.rep$scales$scales[[2]]$labels <- sub("\\|.*", "",h.rep$scales$scales[[2]]$labels)
h.rep$scales$scales[[2]]$labels <- sub(",.*", "",h.rep$scales$scales[[2]]$labels)
pdf(paste(output,"/heatmaprep.pdf",sep=""))
h.rep
dev.off()
rm(h.rep)
#tiff(filename = paste(output,"/heatmaprep.tiff",sep=""),width=2400,height=1350)
#h.rep
#dev.off()
#rm(h.rep)
print("sigMatrix")
sigMatrix(cuff)
pdf(paste(output,"/Significance_matrix.pdf",sep=""))
sigMatrix(cuff)
dev.off()
rm(list = ls())
q(save="no")
# ****************************************************