comparison deseq/differential_expression_analysis_pipeline_for_rnaseq_data-a03838a6eb54/DiffExpAnal/DESeqTools/majSequence.R @ 10:6e573fd3c41b draft

Uploaded
author yufei-luo
date Mon, 13 May 2013 10:06:30 -0400
parents
children
comparison
equal deleted inserted replaced
9:a03838a6eb54 10:6e573fd3c41b
1 # majSequence
2 # compute proportion of reads associated with most expressed sequence
3
4 # input : counts, target, projectName
5 # output : barplot, % associated with majority gene
6
7 # created Feb 7th, 2012
8 # modified Feb 20th, 2012
9 # modified April 30th, 2012
10 # Marie-Agnes Dillies
11
12
13 majSequence <- function( counts, group, OUT_majSequenceName, out = T, position = "topright" ){
14
15 if (out) png( file=OUT_majSequenceName )
16
17 maj <- apply(counts, 2, function(x){x <- x[order(x, decreasing=T)]; x[1]*100/sum(x)})
18 seqname <- apply(counts, 2, function(x){x <- x[order(x, decreasing=T)]; names(x)[1]})
19
20 x <- barplot( maj, col=as.integer(group)+1, main = "Proportion of reads from most expressed gene",
21 ylim = c(0, max(maj)*1.2), cex.main=0.8 )
22 for (i in 1:length(seqname)) text( x[i], maj[i]/2, seqname[i], cex=0.8, srt=90, adj=0)
23 legend( position, as.character(unique(group)), lty=1, col=as.integer(unique(group))+1 )
24
25 if (out) dev.off()
26 }