Mercurial > repos > yufei-luo > s_mart
comparison SMART/DiffExpAnal/DESeqTools/densityPlot.R @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
17:b0e8584489e6 | 18:94ab73e8a190 |
---|---|
1 # densityPlot | |
2 # density plot of all samples | |
3 | |
4 # input : counts, target, projectName | |
5 # output : densplot (png) | |
6 | |
7 # created Feb 7th, 2012 | |
8 # modified April 30th, 2012 | |
9 | |
10 | |
11 densityPlot <- function( counts, group, OUT_densityPlotName, out = TRUE ){ | |
12 | |
13 if (out) png( file=OUT_densityPlotName ) | |
14 | |
15 couleurs <- as.integer( group ) + 1 | |
16 ylim <- c(0, max(density(log2(counts)+1)$y)*1.5) | |
17 plot( density(log2(counts[,1])+1), main="Density of counts distribution", col=couleurs[1], ylim = ylim ) | |
18 for (i in 2:ncol(counts)) | |
19 lines( density(log2(counts[,i])+1), col=couleurs[i] ) | |
20 legend( "topright", as.character(unique(group)), lty=1, col=as.integer(unique(group))+1 ) | |
21 | |
22 if (out) dev.off() | |
23 } |