# # # R代码从装饰图案的ffpe来源。Rnw“# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块1号:foo # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #(保持选项。源= TRUE)选项(宽度= 60)选项(每股收益= FALSE) foo <——packageDescription (ffpe) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块2号:预备考试# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #选项(设备= pdf) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块3号:sortediqrplot # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #库(ffpe)库(ffpeExampleData)数据(lumibatch.GSE17565) sortediqrplot (lumibatch.GSE17565 dolog2 = TRUE) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块数量4:sampleqc # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # QC <——sampleqc (lumibatch.GSE17565 xaxis =“指数”,cor.to =“pseudochip QCmeasure =“差”)# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块5号:dotchart # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # QCvsRNA < - data.frame (inputRNA.ng = lumibatch.GSE17565 inputRNA.ng美元,rejectQC = QC rejectQC美元)QCvsRNA < - QCvsRNA[秩序(QCvsRNA rejectQC美元,-QCvsRNA inputRNA.ng美元)]par (mgp = c (4 2 0)) dotchart (log10 (QCvsRNA inputRNA.ng美元),QCvsRNA rejectQC美元,xlab = " log10 (RNA浓缩的。ng)”,ylab = "拒绝吗?”坳= ifelse (QCvsRNA rejectQC美元,“红色”,“黑”))# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块6号:sampleqc2 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # QC <——sampleQC (lumibatch.GSE17565 xaxis =“指数”,cor.to =“pseudochip QCmeasure = log10 (lumibatch.GSE17565 inputRNA.ng美元),labelnote =“log10 (RNA浓度)”)# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块7号:keepQC # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # lumibatch。QC < - lumibatch.GSE17565 [, !QC rejectQC美元)# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块8号:process_rep # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 1 lumibatch复制。rep1 < - lumibatch.QC [lumibatch。QC复制= = 1]lumbiatch美元。rep1 < - lumiT lumbiatch (lumibatch.rep1,“log2”)。rep1 < - lumiN (lumibatch.rep1分位数)# # 2 lumibatch复制。rep2 < - lumibatch.QC [lumibatch。QC复制= = 2]lumibatch美元。rep2 < - lumiT lumibatch (lumibatch.rep2,“log2”)。rep2 <- lumiN(lumibatch.rep2,"quantile") ################################################### ### code chunk number 9: keepsamples ################################################### available.samples <- intersect(lumibatch.rep1$source,lumibatch.rep2$source) lumibatch.rep1 <- lumibatch.rep1[,na.omit(match(available.samples,lumibatch.rep1$source))] lumibatch.rep2 <- lumibatch.rep2[,na.omit(match(available.samples,lumibatch.rep2$source))] all.equal(lumibatch.rep1$source,lumibatch.rep2$source) ################################################### ### code chunk number 10: repcor ################################################### probe.var <- apply(exprs(lumibatch.rep1),1,var) rowCors = function(x, y) { ##rowCors function borrowed from the arrayMagic Bioconductor package sqr = function(x) x*x if(!is.matrix(x)||!is.matrix(y)||any(dim(x)!=dim(y))) stop("Please supply two matrices of equal size.") x = sweep(x, 1, rowMeans(x)) y = sweep(y, 1, rowMeans(y)) cor = rowSums(x*y) / sqrt(rowSums(sqr(x))*rowSums(sqr(y))) } probe.cor <- rowCors(exprs(lumibatch.rep1),exprs(lumibatch.rep2)) ##the plot will be easier to see if we bin variance into deciles: quants <- seq(from=0,to=1,by=0.1) probe.var.cut <- cut(probe.var,breaks=quantile(probe.var,quants),include.lowest=TRUE,labels=FALSE) boxplot(probe.cor~probe.var.cut, xlab="decile", ylab="Pearson correlation between technical replicate probes") ################################################### ### code chunk number 11: medianvar ################################################### lumibatch.rep1 <- lumibatch.rep1[probe.var > median(probe.var),] lumibatch.rep2 <- lumibatch.rep2[probe.var > median(probe.var),] ################################################### ### code chunk number 12: ttest ################################################### library(genefilter) ttests.rep1 <- rowttests(exprs(lumibatch.rep1),fac=factor(lumibatch.rep1$cell.type)) ttests.rep2 <- rowttests(exprs(lumibatch.rep2),fac=factor(lumibatch.rep2$cell.type)) pvals.rep1 <- ttests.rep1$p.value;names(pvals.rep1) <- rownames(ttests.rep1) pvals.rep2 <- ttests.rep2$p.value;names(pvals.rep2) <- rownames(ttests.rep2) ################################################### ### code chunk number 13: catplot ################################################### x <- CATplot(pvals.rep1,pvals.rep2,maxrank=1000,xlab="Size of top-ranked gene lists",ylab="Concordance") legend("topleft",lty=1:2,legend=c("Actual concordance","Concordance expected by chance"), bty="n")