annotate GO-enrich.R @ 3:ad1244024bd8 draft

planemo upload commit 08f1831e097df5d74bf60ff5955e7e9c8e524cc8-dirty
author proteore
date Wed, 14 Mar 2018 12:40:35 -0400
parents bd052861852b
children 710414ebb6db
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
1 library(clusterProfiler)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
2
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
3 #library(org.Sc.sgd.db)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
4 library(org.Hs.eg.db)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
5 library(org.Mm.eg.db)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
6
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
7 # Read file and return file content as data.frame?
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
8 readfile = function(filename, header) {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
9 if (header == "true") {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
10 # Read only the first line of the files as data (without headers):
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
11 headers <- read.table(filename, nrows = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
12 #Read the data of the files (skipping the first row):
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
13 file <- read.table(filename, skip = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
14 # Remove empty rows
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
15 file <- file[!apply(is.na(file) | file == "", 1, all), , drop=FALSE]
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
16 #And assign the headers of step two to the data:
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
17 names(file) <- headers
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
18 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
19 else {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
20 file <- read.table(filename, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
21 file <- file[!apply(is.na(file) | file == "", 1, all), , drop=FALSE]
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
22 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
23 return(file)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
24 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
25
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
26 repartition.GO <- function(geneid, orgdb, ontology, level=3, readable=TRUE) {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
27 ggo<-groupGO(gene=geneid,
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
28 OrgDb = orgdb,
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
29 ont=ontology,
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
30 level=level,
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
31 readable=TRUE)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
32 name <- paste("GGO.", ontology, ".png", sep = "")
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
33 png(name)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
34 p <- barplot(ggo)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
35 print(p)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
36 dev.off()
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
37 return(ggo)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
38 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
39
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
40 # GO over-representation test
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
41 enrich.GO <- function(geneid, orgdb, ontology, pval_cutoff, qval_cutoff) {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
42 ego<-enrichGO(gene=geneid,
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
43 OrgDb=orgdb,
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
44 keytype="ENTREZID",
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
45 ont=ontology,
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
46 pAdjustMethod="BH",
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
47 pvalueCutoff=pval_cutoff,
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
48 qvalueCutoff=qval_cutoff,
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
49 readable=TRUE)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
50 bar_name <- paste("EGO.", ontology, ".bar.png", sep = "")
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
51 png(bar_name)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
52 p <- barplot(ego)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
53 print(p)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
54 dev.off()
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
55 dot_name <- paste("EGO.", ontology, ".dot.png", sep = "")
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
56 png(dot_name)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
57 p <- dotplot(ego)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
58 print(p)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
59 dev.off()
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
60 return(ego)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
61 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
62
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
63 clusterProfiler = function() {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
64 args <- commandArgs(TRUE)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
65 if(length(args)<1) {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
66 args <- c("--help")
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
67 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
68
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
69 # Help section
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
70 if("--help" %in% args) {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
71 cat("clusterProfiler Enrichment Analysis
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
72 Arguments:
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
73 --input_type: type of input (list of id or filename)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
74 --input: input
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
75 --ncol: the column number which you would like to apply...
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
76 --header: true/false if your file contains a header
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
77 --id_type: the type of input IDs (UniProt/EntrezID)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
78 --species
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
79 --onto_opt: ontology options
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
80 --go_function: groupGO/enrichGO
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
81 --level: 1-3
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
82 --pval_cutoff
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
83 --qval_cutoff
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
84 --text_output: text output filename \n")
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
85 q(save="no")
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
86 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
87 # Parse arguments
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
88 parseArgs <- function(x) strsplit(sub("^--", "", x), "=")
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
89 argsDF <- as.data.frame(do.call("rbind", parseArgs(args)))
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
90 args <- as.list(as.character(argsDF$V2))
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
91 names(args) <- argsDF$V1
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
92
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
93 input_type = args$input_type
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
94 if (input_type == "text") {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
95 input = args$input
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
96 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
97 else if (input_type == "file") {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
98 filename = args$input
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
99 ncol = args$ncol
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
100 # Check ncol
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
101 if (! as.numeric(gsub("c", "", ncol)) %% 1 == 0) {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
102 stop("Please enter an integer for level")
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
103 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
104 else {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
105 ncol = as.numeric(gsub("c", "", ncol))
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
106 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
107 header = args$header
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
108 # Get file content
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
109 file = readfile(filename, header)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
110 # Extract Protein IDs list
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
111 input = c()
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
112 for (row in as.character(file[,ncol])) {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
113 input = c(input, strsplit(row, ";")[[1]][1])
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
114 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
115 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
116 id_type = args$id_type
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
117
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
118
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
119 #ID format Conversion
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
120 #This case : from UNIPROT (protein id) to ENTREZ (gene id)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
121 #bitr = conversion function from clusterProfiler
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
122
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
123 if (args$species=="human") {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
124 orgdb<-org.Hs.eg.db
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
125 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
126 else if (args$species=="mouse") {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
127 orgdb<-org.Mm.eg.db
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
128 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
129 else if (args$species=="rat") {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
130 orgdb<-org.Rn.eg.db
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
131 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
132
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
133 ##to initialize
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
134 if (id_type=="Uniprot") {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
135 idFrom<-"UNIPROT"
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
136 idTo<-"ENTREZID"
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
137 gene<-bitr(input, fromType=idFrom, toType=idTo, OrgDb=orgdb)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
138 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
139 else if (id_type=="Entrez") {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
140 gene<-input
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
141 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
142
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
143 ontology <- strsplit(args$onto_opt, ",")[[1]]
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
144 if (args$go_represent == "true") {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
145 go_represent <- args$go_represent
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
146 level <- as.numeric(args$level)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
147 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
148 if (args$go_enrich == "true") {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
149 go_enrich <- args$go_enrich
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
150 pval_cutoff <- as.numeric(args$pval_cutoff)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
151 qval_cutoff <- as.numeric(args$qval_cutoff)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
152 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
153
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
154 ##enrichGO : GO over-representation test
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
155 for (onto in ontology) {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
156 if (args$go_represent == "true") {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
157 ggo<-repartition.GO(gene$ENTREZID, orgdb, onto, level, readable=TRUE)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
158 write.table(ggo, args$text_output, append = TRUE, sep="\t", row.names = FALSE, quote=FALSE)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
159 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
160 if (args$go_enrich == "true") {
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
161 ego<-enrich.GO(gene$ENTREZID, orgdb, onto, pval_cutoff, qval_cutoff)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
162 write.table(ego, args$text_output, append = TRUE, sep="\t", row.names = FALSE, quote=FALSE)
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
163 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
164 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
165 }
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
166
bd052861852b planemo upload commit ffa3be72b850aecbfbd636de815967c06a8f643f-dirty
proteore
parents:
diff changeset
167 clusterProfiler()