annotate SMART/DiffExpAnal/DESeqTools/exportDiff.R @ 33:aa0420172fc6

Deleted selected files
author m-zytnicki
date Tue, 30 Apr 2013 14:34:53 -0400
parents 94ab73e8a190
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
1 # exportDiff
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
2 # export differentially expressed genes
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
3
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
4 # input : complete, alpha, adjMethod, projectName
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
5 # output : diff genes, up and down in xls files
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
6
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
7 # created Feb 14th, 2012
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
8
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
9
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
10 exportDiff <- function( complete, alpha, adjMethod, OUT_upName, OUT_downName, out = T ){
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
11
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
12 diff <- complete[which(complete[,grep("adjp",colnames(complete))] < alpha),]
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
13
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
14 gup <- up( diff )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
15 gdown <- down( diff )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
16
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
17 if (out){
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
18 gup[,(ncol(gup)-4):ncol(gup)] <- format( gup[,(ncol(gup)-4):ncol(gup)], digits=3, dec=",")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
19 gdown[,(ncol(gdown)-4):ncol(gdown)] <- format( gdown[,(ncol(gdown)-4):ncol(gdown)], digits=3, dec=",")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
20 write.table(gup, file=OUT_upName, row.names=F, sep="\t")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
21 write.table(gdown, file=OUT_downName, row.names=F, sep="\t")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
22 }
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
23 return( diff )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
24 }
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
25
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
26
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
27 up <- function( diff ){
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
28
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
29 up <- diff[diff$log2FC > 0,]
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
30 up <- up[order(up[,grep("adjp",colnames(up))]),]
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
31
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
32 return( up )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
33 }
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
34
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
35
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
36 down <- function( diff ){
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
37
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
38 down <- diff[diff$log2FC < 0,]
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
39 down <- down[order(down[,grep("adjp",colnames(down))]),]
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
40
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
41 return( down )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
42 }