Mercurial > repos > proteore > proteore_clusterprofiler
annotate GO-enrich.R @ 4:18275725e7cf draft
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
| author | proteore |
|---|---|
| date | Mon, 17 Sep 2018 10:30:30 -0400 |
| parents | 67a796154e2a |
| children | 36c586c918eb |
| rev | line source |
|---|---|
|
2
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
1 suppressMessages(library(clusterProfiler,quietly = TRUE)) |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
2 |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
3 # Read file and return file content as data.frame |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
4 readfile = function(filename, header) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
5 if (header == "true") { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
6 # Read only first line of the file as header: |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
7 headers <- read.table(filename, nrows = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "") |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
8 #Read the data of the files (skipping the first row) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
9 file <- read.table(filename, skip = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "") |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
10 # Remove empty rows |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
11 file <- file[!apply(is.na(file) | file == "", 1, all), , drop=FALSE] |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
12 #And assign the header to the data |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
13 names(file) <- headers |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
14 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
15 else { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
16 file <- read.table(filename, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "") |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
17 # Remove empty rows |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
18 file <- file[!apply(is.na(file) | file == "", 1, all), , drop=FALSE] |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
19 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
20 return(file) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
21 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
22 |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
23 max_str_length_10_first <- function(vector){ |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
24 vector <- as.vector(vector) |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
25 nb_description = length(vector) |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
26 if (nb_description >= 10){nb_description=10} |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
27 return(max(nchar(vector[1:nb_description]))) |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
28 } |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
29 |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
30 |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
31 repartition.GO <- function(geneid, orgdb, ontology, level=3, readable=TRUE) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
32 ggo<-groupGO(gene=geneid, |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
33 OrgDb = orgdb, |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
34 ont=ontology, |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
35 level=level, |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
36 readable=TRUE) |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
37 |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
38 if (max_str_length_10_first(ggo$Description) > 50 ){ |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
39 width=720 |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
40 } else { |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
41 width=600 |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
42 } |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
43 |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
44 name <- paste("GGO_", ontology, "_bar-plot", sep = "") |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
45 png(name,height = 720, width = width) |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
46 p <- barplot(ggo, showCategory=10) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
47 print(p) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
48 dev.off() |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
49 return(ggo) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
50 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
51 |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
52 # GO over-representation test |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
53 enrich.GO <- function(geneid, universe, orgdb, ontology, pval_cutoff, qval_cutoff,plot) { |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
54 ego<-enrichGO(gene=geneid, |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
55 universe=universe, |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
56 OrgDb=orgdb, |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
57 ont=ontology, |
|
3
67a796154e2a
planemo upload commit 07fb0efd8a1badeb395fa1dc435037998b4de25f
proteore
parents:
2
diff
changeset
|
58 keytype="ENTREZID", |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
59 pAdjustMethod="BH", |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
60 pvalueCutoff=pval_cutoff, |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
61 qvalueCutoff=qval_cutoff, |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
62 readable=TRUE) |
|
2
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
63 |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
64 if (max_str_length_10_first(ego$Description) > 50 ){ |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
65 width=800 |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
66 } else { |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
67 width=600 |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
68 } |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
69 |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
70 # Plot bar & dot plots |
|
2
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
71 #if there are enriched GopTerms |
|
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
72 if (length(ego$ID)>0){ |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
73 if ("dotplot" %in% plot ){ |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
74 dot_name <- paste("EGO_", ontology, "_dot-plot", sep = "") |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
75 png(dot_name,height = 720, width = width) |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
76 p <- dotplot(ego, showCategory=10) |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
77 print(p) |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
78 dev.off() |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
79 } |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
80 |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
81 if ("barplot" %in% plot ){ |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
82 bar_name <- paste("EGO_", ontology, "_bar-plot", sep = "") |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
83 png(bar_name,height = 720, width = width) |
|
2
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
84 p <- barplot(ego) |
|
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
85 print(p) |
|
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
86 dev.off() |
|
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
87 return(ego) |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
88 } |
|
2
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
89 } else { |
|
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
90 warning(paste("No Go terms enriched (EGO) found for ",ontology,"ontology"),immediate. = TRUE,noBreaks. = TRUE,call. = FALSE) |
|
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
91 } |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
92 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
93 |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
94 check_ids <- function(vector,type) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
95 uniprot_pattern = "^([OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2})$" |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
96 entrez_id = "^([0-9]+|[A-Z]{1,2}_[0-9]+|[A-Z]{1,2}_[A-Z]{1,4}[0-9]+)$" |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
97 if (type == "entrez") |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
98 return(grepl(entrez_id,vector)) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
99 else if (type == "uniprot") { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
100 return(grepl(uniprot_pattern,vector)) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
101 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
102 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
103 |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
104 clusterProfiler = function() { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
105 args <- commandArgs(TRUE) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
106 if(length(args)<1) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
107 args <- c("--help") |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
108 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
109 |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
110 # Help section |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
111 if("--help" %in% args) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
112 cat("clusterProfiler Enrichment Analysis |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
113 Arguments: |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
114 --input_type: type of input (list of id or filename) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
115 --input: input |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
116 --ncol: the column number which contains list of input IDs |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
117 --header: true/false if your file contains a header |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
118 --id_type: the type of input IDs (UniProt/EntrezID) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
119 --universe_type: list or filename |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
120 --universe: background IDs list |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
121 --uncol: the column number which contains background IDs list |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
122 --uheader: true/false if the background IDs file contains header |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
123 --universe_id_type: the type of universe IDs (UniProt/EntrezID) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
124 --species |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
125 --onto_opt: ontology options |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
126 --go_function: groupGO/enrichGO |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
127 --level: 1-3 |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
128 --pval_cutoff |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
129 --qval_cutoff |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
130 --text_output: text output filename |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
131 --plot : type of visualization, dotplot or/and barplot \n") |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
132 q(save="no") |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
133 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
134 # Parse arguments |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
135 parseArgs <- function(x) strsplit(sub("^--", "", x), "=") |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
136 argsDF <- as.data.frame(do.call("rbind", parseArgs(args))) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
137 args <- as.list(as.character(argsDF$V2)) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
138 names(args) <- argsDF$V1 |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
139 plot = unlist(strsplit(args$plot,",")) |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
140 #print(args) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
141 |
|
2
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
142 #save(args,file="/home/dchristiany/proteore_project/ProteoRE/tools/cluster_profiler/args.Rda") |
|
1
91b9b48d07b3
planemo upload commit 4244759c3ec402d4309369b46aec75dc49e4c0b1-dirty
proteore
parents:
0
diff
changeset
|
143 #load("/home/dchristiany/proteore_project/ProteoRE/tools/cluster_profiler/args.Rda") |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
144 |
|
2
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
145 suppressMessages(library(args$species, character.only = TRUE, quietly = TRUE)) |
|
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
146 |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
147 # Extract OrgDb |
|
2
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
148 if (args$species=="org.Hs.eg.db") { |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
149 orgdb<-org.Hs.eg.db |
|
2
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
150 } else if (args$species=="org.Mm.eg.db") { |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
151 orgdb<-org.Mm.eg.db |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
152 } else if (args$species=="org.Rn.eg.db") { |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
153 orgdb<-org.Rn.eg.db |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
154 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
155 |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
156 # Extract input IDs |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
157 input_type = args$input_type |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
158 if (input_type == "text") { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
159 input = strsplit(args$input, "[ \t\n]+")[[1]] |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
160 } else if (input_type == "file") { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
161 filename = args$input |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
162 ncol = args$ncol |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
163 # Check ncol |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
164 if (! as.numeric(gsub("c", "", ncol)) %% 1 == 0) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
165 stop("Please enter the right format for column number: c[number]") |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
166 } else { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
167 ncol = as.numeric(gsub("c", "", ncol)) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
168 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
169 header = args$header |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
170 # Get file content |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
171 file = readfile(filename, header) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
172 # Extract Protein IDs list |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
173 input = sapply(as.character(file[,ncol]),function(x) rapply(strsplit(x,";"),c),USE.NAMES = FALSE) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
174 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
175 id_type = args$id_type |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
176 ## Get input gene list from input IDs |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
177 #ID format Conversion |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
178 #This case : from UNIPROT (protein id) to ENTREZ (gene id) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
179 #bitr = conversion function from clusterProfiler |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
180 if (id_type=="Uniprot" & any(check_ids(input,"uniprot"))) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
181 any(check_ids(input,"uniprot")) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
182 idFrom<-"UNIPROT" |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
183 idTo<-"ENTREZID" |
|
2
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
184 suppressMessages(gene<-bitr(input, fromType=idFrom, toType=idTo, OrgDb=orgdb)) |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
185 gene<-unique(gene$ENTREZID) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
186 } else if (id_type=="Entrez" & any(check_ids(input,"entrez"))) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
187 gene<-unique(input) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
188 } else { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
189 print(paste(id_type,"not found in your ids list, please check your IDs in input or the selected column of your input file")) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
190 stop() |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
191 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
192 |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
193 ontology <- strsplit(args$onto_opt, ",")[[1]] |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
194 ## Extract GGO/EGO arguments |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
195 if (args$go_represent == "true") { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
196 go_represent <- args$go_represent |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
197 level <- as.numeric(args$level) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
198 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
199 if (args$go_enrich == "true") { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
200 go_enrich <- args$go_enrich |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
201 pval_cutoff <- as.numeric(args$pval_cutoff) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
202 qval_cutoff <- as.numeric(args$qval_cutoff) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
203 # Extract universe background genes (same as input file) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
204 if (!is.null(args$universe_type)) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
205 universe_type = args$universe_type |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
206 if (universe_type == "text") { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
207 universe = strsplit(args$universe, "[ \t\n]+")[[1]] |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
208 } else if (universe_type == "file") { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
209 universe_filename = args$universe |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
210 universe_ncol = args$uncol |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
211 # Check ncol |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
212 if (! as.numeric(gsub("c", "", universe_ncol)) %% 1 == 0) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
213 stop("Please enter the right format for column number: c[number]") |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
214 } else { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
215 universe_ncol = as.numeric(gsub("c", "", universe_ncol)) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
216 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
217 universe_header = args$uheader |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
218 # Get file content |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
219 universe_file = readfile(universe_filename, universe_header) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
220 # Extract Protein IDs list |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
221 universe <- sapply(universe_file[,universe_ncol], function(x) rapply(strsplit(x,";"),c),USE.NAMES = FALSE) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
222 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
223 universe_id_type = args$universe_id_type |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
224 ##to initialize |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
225 if (universe_id_type=="Uniprot" & any(check_ids(universe,"uniprot"))) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
226 idFrom<-"UNIPROT" |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
227 idTo<-"ENTREZID" |
|
2
1c98865a8508
planemo upload commit 01102a33a5c3fc56de61cd12784691b49334054b-dirty
proteore
parents:
1
diff
changeset
|
228 suppressMessages(universe_gene<-bitr(universe, fromType=idFrom, toType=idTo, OrgDb=orgdb)) |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
229 universe_gene<-unique(universe_gene$ENTREZID) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
230 } else if (universe_id_type=="Entrez" & any(check_ids(universe,"entrez"))) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
231 universe_gene<-unique(universe) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
232 } else { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
233 if (universe_type=="text"){ |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
234 print(paste(universe_id_type,"not found in your background IDs list",sep=" ")) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
235 } else { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
236 print(paste(universe_id_type,"not found in the column",universe_ncol,"of your background IDs file",sep=" ")) |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
237 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
238 universe_gene = NULL |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
239 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
240 } else { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
241 universe_gene = NULL |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
242 } |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
243 } else { |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
244 universe_gene = NULL |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
245 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
246 |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
247 ##enrichGO : GO over-representation test |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
248 for (onto in ontology) { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
249 if (args$go_represent == "true") { |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
250 ggo<-repartition.GO(gene, orgdb, onto, level, readable=TRUE) |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
251 output_path = paste("cluster_profiler_GGO_",onto,".csv",sep="") |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
252 write.table(ggo, output_path, sep="\t", row.names = FALSE, quote=FALSE) |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
253 } |
|
4
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
254 |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
255 if (args$go_enrich == "true") { |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
256 ego<-enrich.GO(gene, universe_gene, orgdb, onto, pval_cutoff, qval_cutoff,plot) |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
257 output_path = paste("cluster_profiler_EGO_",onto,".csv",sep="") |
|
18275725e7cf
planemo upload commit 9bdfcce89bdea8a0a85bfbf8f0fa9b943b17bea1-dirty
proteore
parents:
3
diff
changeset
|
258 write.table(ego, output_path, append = TRUE, sep="\t", row.names = FALSE, quote=FALSE) |
|
0
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
259 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
260 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
261 } |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
262 |
|
076349b72690
planemo upload commit 2e441b4969ae7cf9aeb227a1d47c43ef7268a5e6-dirty
proteore
parents:
diff
changeset
|
263 clusterProfiler() |
