Mercurial > repos > yhoogstrate > edger_with_design_matrix
comparison edgeR_Differential_Gene_Expression.xml @ 32:87bf067cfc53 draft
Uploaded
author | yhoogstrate |
---|---|
date | Wed, 21 May 2014 04:55:20 -0400 |
parents | 27efc93c1ca6 |
children | 7e45df99a6fc |
comparison
equal
deleted
inserted
replaced
31:9e9b98a1cb12 | 32:87bf067cfc53 |
---|---|
245 | 245 |
246 ## todo EXPORT FPKM | 246 ## todo EXPORT FPKM |
247 write.table(file=output_raw_counts,dge\$counts,sep="\t",row.names=TRUE,col.names=NA) | 247 write.table(file=output_raw_counts,dge\$counts,sep="\t",row.names=TRUE,col.names=NA) |
248 | 248 |
249 | 249 |
250 if(output_MAplot != "/dev/null") { | 250 if(output_MAplot != "/dev/null" or output_PValue_distribution_plot != "/dev/null") { |
251 write("Creating MA plot...",stdout()) | |
252 | |
253 etable <- topTags(lrt, n=nrow(dge))\$table | 251 etable <- topTags(lrt, n=nrow(dge))\$table |
254 etable <- etable[order(etable\$FDR), ] | 252 etable <- etable[order(etable\$FDR), ] |
255 pdf(output_MAplot) | 253 |
256 with(etable, plot(logCPM, logFC, pch=20, main="edgeR: Fold change vs abundance")) | 254 if(output_MAplot != "/dev/null") { |
257 with(subset(etable, FDR < fdr), points(logCPM, logFC, pch=20, col="red")) | 255 write("Creating MA plot...",stdout()) |
258 abline(h=c(-1,1), col="blue") | 256 pdf(output_MAplot) |
259 dev.off() | 257 with(etable, plot(logCPM, logFC, pch=20, main="edgeR: Fold change vs abundance")) |
260 } | 258 with(subset(etable, FDR < fdr), points(logCPM, logFC, pch=20, col="red")) |
261 | 259 abline(h=c(-1,1), col="blue") |
262 if(output_PValue_distribution_plot != "/dev/null") { | 260 dev.off() |
263 write("Creating P-value distribution plot...",stdout()) | 261 } |
264 pdf(output_PValue_distribution_plot) | 262 |
265 expressed_genes <- subset(etable, PValue < 0.99) | 263 if(output_PValue_distribution_plot != "/dev/null") { |
266 h <- hist(expressed_genes\$PValue,breaks=nrow(expressed_genes)/15,main="Binned P-Values (< 0.99)") | 264 write("Creating P-value distribution plot...",stdout()) |
267 center <- sum(h\$counts) / length(h\$counts) | 265 pdf(output_PValue_distribution_plot) |
268 lines(c(0,1),c(center,center),lty=2,col="red",lwd=2) | 266 expressed_genes <- subset(etable, PValue < 0.99) |
269 k <- ksmooth(h\$mid, h\$counts) | 267 h <- hist(expressed_genes\$PValue,breaks=nrow(expressed_genes)/15,main="Binned P-Values (< 0.99)") |
270 lines(k\$x,k\$y,col="red",lwd=2) | 268 center <- sum(h\$counts) / length(h\$counts) |
271 rmsd <- (h\$counts) - center | 269 lines(c(0,1),c(center,center),lty=2,col="red",lwd=2) |
272 rmsd <- rmsd^2 | 270 k <- ksmooth(h\$mid, h\$counts) |
273 rmsd <- sum(rmsd) | 271 lines(k\$x,k\$y,col="red",lwd=2) |
274 rmsd <- sqrt(rmsd) | 272 rmsd <- (h\$counts) - center |
275 text(0,max(h\$counts),paste("e=",round(rmsd,2),sep=""),pos=4,col="blue") | 273 rmsd <- rmsd^2 |
276 ## change e into epsilon somehow | 274 rmsd <- sum(rmsd) |
277 dev.off() | 275 rmsd <- sqrt(rmsd) |
276 text(0,max(h\$counts),paste("e=",round(rmsd,2),sep=""),pos=4,col="blue") | |
277 ## change e into epsilon somehow | |
278 dev.off() | |
279 } | |
278 } | 280 } |
279 | 281 |
280 ##output_hierarchical_clustering_plot = args[13] | 282 ##output_hierarchical_clustering_plot = args[13] |
281 ##output_heatmap_plot = args[14] | 283 ##output_heatmap_plot = args[14] |
282 | 284 |