forked from bobthecat/R-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqualitycontrol.r
More file actions
executable file
·63 lines (51 loc) · 1.91 KB
/
Copy pathqualitycontrol.r
File metadata and controls
executable file
·63 lines (51 loc) · 1.91 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
# R script for automatic quality control
# argument: the affybatch
qa <- function(abatch) {
require(affy)
require(simpleaffy)
require(RColorBrewer)
require(affyPLM)
if (class(abatch)!= 'AffyBatch') {
stop("argument must be AffyBatch!")
}
# colors
cols <- brewer.pal(12, "Set3")
# Boxplot
pdf(file='boxplot.pdf', height=8, width=10)
boxplot(abatch, col=cols, main="Unprocessed log scale probe-level data", xlab="If discrepancy, they are not conclusive\n Difference can be reduce by normalization")
dev.off()
# Histogram
pdf(file='histogram.pdf', height=8, width=8)
hist(abatch, col=cols, xlab="Log(base2) intensities; Bimodal distribution indicate spatial artifact\n Second mode is the result of array(s) having abnormally high value")
legend("topright", sampleNames(abatch), lty=1,col=cols)
dev.off()
#RNA degradation
pdf(file="RNAdeg.pdf", height=8, width=8)
RNAdeg <- AffyRNAdeg(abatch)
plotAffyRNAdeg(RNAdeg, cols=cols)
legend("topleft", sampleNames(abatch), lty=1,col=cols)
box()
dev.off()
# simpleaffy graph
abatch.qc <- qc(abatch)
pdf(file="QC-simpleaffy.pdf", height=8, width=10)
plot(abatch.qc)
dev.off()
source("./my_img_Test.r")
pset <- fitPLM(abatch)
# false color image control
for (n in 1:length(abatch)) {
filename <- paste("QC",as.vector(sampleNames(abatch))[n],".png")
png(file=filename, height=900, width=800)
img.Test(abatch,pset,n)
dev.off()
}
# RLE plot
pdf(file="RLE.pdf", height=8, width= 8)
Mbox(pset, col = cols, main ="RLE (Relative Log Expression)", xlab="Assuming that the majority of the gene are not changing\n Ideally these boxes would have small spread and be centered at M=0")
dev.off()
# NUSE plot
pdf(file="NUSE.pdf", height=8, width= 8)
boxplot(pset, col=cols, main= "NUSE (Normalized Unscaled Standard Error)", xlab="High values of median NUSE are indicative of a problematic array")
dev.off()
}