annotate goprofiles.R @ 6:6afe8166a9a4 draft

planemo upload commit 4e898239997b7ef266b1d0ce0a4c7cdec31b4ecd-dirty
author proteore
date Fri, 21 Sep 2018 09:23:38 -0400
parents 781072a65600
children 3e138d54c105
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
6afe8166a9a4 planemo upload commit 4e898239997b7ef266b1d0ce0a4c7cdec31b4ecd-dirty
proteore
parents: 5
diff changeset
1 options(warn=-1) #TURN OFF WARNINGS !!!!!!
6afe8166a9a4 planemo upload commit 4e898239997b7ef266b1d0ce0a4c7cdec31b4ecd-dirty
proteore
parents: 5
diff changeset
2
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
3 # Load necessary libraries
6
6afe8166a9a4 planemo upload commit 4e898239997b7ef266b1d0ce0a4c7cdec31b4ecd-dirty
proteore
parents: 5
diff changeset
4 suppressMessages(library(goProfiles,quietly = TRUE))
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
5
4
715002a394ec planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty
proteore
parents: 2
diff changeset
6 # Read file and return file content as data.frame
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
7 readfile = function(filename, header) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
8 if (header == "true") {
4
715002a394ec planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty
proteore
parents: 2
diff changeset
9 # Read only first line of the file as header:
715002a394ec planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty
proteore
parents: 2
diff changeset
10 headers <- read.table(filename, nrows = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "")
715002a394ec planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty
proteore
parents: 2
diff changeset
11 #Read the data of the files (skipping the first row)
715002a394ec planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty
proteore
parents: 2
diff changeset
12 file <- read.table(filename, skip = 1, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "")
1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
13 # Remove empty rows
4
715002a394ec planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty
proteore
parents: 2
diff changeset
14 file <- file[!apply(is.na(file) | file == "", 1, all), , drop=FALSE]
715002a394ec planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty
proteore
parents: 2
diff changeset
15 #And assign the header to the data
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
16 names(file) <- headers
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
17 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
18 else {
4
715002a394ec planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty
proteore
parents: 2
diff changeset
19 file <- read.table(filename, header = FALSE, sep = "\t", stringsAsFactors = FALSE, fill = TRUE, na.strings=c("", "NA"), blank.lines.skip = TRUE, quote = "")
715002a394ec planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty
proteore
parents: 2
diff changeset
20 # Remove empty rows
715002a394ec planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty
proteore
parents: 2
diff changeset
21 file <- file[!apply(is.na(file) | file == "", 1, all), , drop=FALSE]
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
22 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
23 return(file)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
24 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
25
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
26 check_ids <- function(vector,type) {
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
27 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})$"
6
6afe8166a9a4 planemo upload commit 4e898239997b7ef266b1d0ce0a4c7cdec31b4ecd-dirty
proteore
parents: 5
diff changeset
28 entrez_id = "^([0-9]+|[A-Z]{1,2}_[0-9]+|[A-Z]{1,2}_[A-Z]{1,4}[0-9]+)$"
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
29 if (type == "Entrez"){
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
30 return(grepl(entrez_id,vector))
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
31 } else if (type == "UniProt") {
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
32 return(grepl(uniprot_pattern,vector))
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
33 }
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
34 }
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
35
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
36 getprofile = function(ids, id_type, level, duplicate,species) {
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
37 ####################################################################
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
38 # Arguments
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
39 # - ids: list of input IDs
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
40 # - id_type: type of input IDs (UniProt/ENTREZID)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
41 # - level
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
42 # - duplicate: if the duplicated IDs should be removed or not (TRUE/FALSE)
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
43 # - species
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
44 ####################################################################
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
45
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
46 library(species, character.only = TRUE, quietly = TRUE)
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
47
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
48 if (species=="org.Hs.eg.db"){
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
49 package=org.Hs.eg.db
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
50 } else if (species=="org.Mm.eg.db"){
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
51 package=org.Mm.eg.db
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
52 }
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
53
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
54
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
55
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
56 # Check if level is number
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
57 if (! as.numeric(level) %% 1 == 0) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
58 stop("Please enter an integer for level")
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
59 } else {
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
60 level = as.numeric(level)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
61 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
62 #genes = as.vector(file[,ncol])
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
63
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
64 # Extract Gene Entrez ID
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
65 if (id_type == "Entrez") {
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
66 id = select(package, ids, "ENTREZID", multiVals = "first")
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
67 genes_ids = id$ENTREZID[which( ! is.na(id$ENTREZID))]
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
68 } else {
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
69 genes_ids = c()
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
70 id = select(package, ids, "ENTREZID", "UNIPROT", multiVals = "first")
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
71 if (duplicate == "TRUE") {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
72 id = unique(id)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
73 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
74 print(id[[1]])
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
75 genes_ids = id$ENTREZID[which( ! is.na(id$ENTREZID))]
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
76 # IDs that have NA ENTREZID
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
77 NAs = id$UNIPROT[which(is.na(id$ENTREZID))]
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
78 print("IDs unable to convert to ENTREZID: ")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
79 print(NAs)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
80 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
81
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
82 # Create basic profiles
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
83 profile.CC = basicProfile(genes_ids, onto='CC', level=level, orgPackage=species, empty.cats=F, ord=T, na.rm=T)
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
84 profile.BP = basicProfile(genes_ids, onto='BP', level=level, orgPackage=species, empty.cats=F, ord=T, na.rm=T)
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
85 profile.MF = basicProfile(genes_ids, onto='MF', level=level, orgPackage=species, empty.cats=F, ord=T, na.rm=T)
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
86 profile.ALL = basicProfile(genes_ids, onto='ANY', level=level, orgPackage=species, empty.cats=F, ord=T, na.rm=T)
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
87
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
88 # Print profile
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
89 # printProfiles(profile)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
90
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
91 return(c(profile.CC, profile.MF, profile.BP, profile.ALL))
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
92 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
93
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
94 # Plot profiles to PNG
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
95 plotPNG = function(profile.CC = NULL, profile.BP = NULL, profile.MF = NULL, profile.ALL = NULL, per = TRUE, title = TRUE) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
96 if (!is.null(profile.CC)) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
97 png("profile.CC.png")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
98 plotProfiles(profile.CC, percentage=per, multiplePlots=FALSE, aTitle=title)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
99 dev.off()
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
100 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
101 if (!is.null(profile.BP)) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
102 png("profile.BP.png")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
103 plotProfiles(profile.BP, percentage=per, multiplePlots=FALSE, aTitle=title)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
104 dev.off()
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
105 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
106 if (!is.null(profile.MF)) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
107 png("profile.MF.png")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
108 plotProfiles(profile.MF, percentage=per, multiplePlots=FALSE, aTitle=title)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
109 dev.off()
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
110 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
111 if (!is.null(profile.ALL)) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
112 png("profile.ALL.png")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
113 plotProfiles(profile.ALL, percentage=per, multiplePlots=T, aTitle=title)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
114 dev.off()
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
115 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
116 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
117
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
118 # Plot profiles to JPEG
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
119 plotJPEG = function(profile.CC = NULL, profile.BP = NULL, profile.MF = NULL, profile.ALL = NULL, per = TRUE, title = TRUE) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
120 if (!is.null(profile.CC)) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
121 jpeg("profile.CC.jpeg")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
122 plotProfiles(profile.CC, percentage=per, multiplePlots=FALSE, aTitle=title)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
123 dev.off()
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
124 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
125 if (!is.null(profile.BP)) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
126 jpeg("profile.BP.jpeg")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
127 plotProfiles(profile.BP, percentage=per, multiplePlots=FALSE, aTitle=title)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
128 dev.off()
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
129 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
130 if (!is.null(profile.MF)) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
131 jpeg("profile.MF.jpeg")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
132 plotProfiles(profile.MF, percentage=per, multiplePlots=FALSE, aTitle=title)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
133 dev.off()
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
134 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
135 if (!is.null(profile.ALL)) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
136 jpeg("profile.ALL.jpeg")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
137 plotProfiles(profile.ALL, percentage=per, multiplePlots=FALSE, aTitle=title)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
138 dev.off()
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
139 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
140 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
141
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
142 # Plot profiles to PDF
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
143 plotPDF = function(profile.CC = NULL, profile.BP = NULL, profile.MF = NULL, profile.ALL = NULL, per = TRUE, title = TRUE) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
144 if (!is.null(profile.CC)) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
145 pdf("profile.CC.pdf")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
146 plotProfiles(profile.CC, percentage=per, multiplePlots=FALSE, aTitle=title)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
147 dev.off()
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
148 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
149 if (!is.null(profile.BP)) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
150 pdf("profile.BP.pdf")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
151 plotProfiles(profile.BP, percentage=per, multiplePlots=FALSE, aTitle=title)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
152 dev.off()
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
153 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
154 if (!is.null(profile.MF)) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
155 pdf("profile.MF.pdf")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
156 plotProfiles(profile.MF, percentage=per, multiplePlots=FALSE, aTitle=title)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
157 dev.off()
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
158 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
159 if (!is.null(profile.ALL)) {
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
160 #print("all")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
161 pdf("profile.ALL.pdf")
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
162 plotProfiles(profile.ALL, percentage=per, multiplePlots=FALSE, aTitle=title)
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
163 dev.off()
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
164 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
165 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
166
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
167 goprofiles = function() {
1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
168 args <- commandArgs(TRUE)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
169 if(length(args)<1) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
170 args <- c("--help")
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
171 }
1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
172
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
173 # Help section
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
174 if("--help" %in% args) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
175 cat("Selection and Annotation HPA
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
176 Arguments:
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
177 --input_type: type of input (list of id or filename)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
178 --input: input
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
179 --ncol: the column number which you would like to apply...
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
180 --header: true/false if your file contains a header
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
181 --id_type: the type of input IDs (UniProt/EntrezID)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
182 --onto_opt: ontology options
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
183 --plot_opt: plot extension options (PDF/JPEG/PNG)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
184 --level: 1-3
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
185 --per
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
186 --title: title of the plot
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
187 --duplicate: remove dupliate input IDs (true/false)
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
188 --text_output: text output filename \n
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
189 --species")
1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
190 q(save="no")
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
191 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
192
1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
193 # Parse arguments
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
194 parseArgs <- function(x) strsplit(sub("^--", "", x), "=")
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
195 argsDF <- as.data.frame(do.call("rbind", parseArgs(args)))
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
196 args <- as.list(as.character(argsDF$V2))
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
197 names(args) <- argsDF$V1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
198
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
199 #save(args,file="/home/dchristiany/proteore_project/ProteoRE/tools/goprofiles/args.Rda")
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
200 #load("/home/dchristiany/proteore_project/ProteoRE/tools/goprofiles/args.Rda")
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
201
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
202 id_type = args$id_type
1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
203 input_type = args$input_type
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
204 if (input_type == "text") {
4
715002a394ec planemo upload commit b36435833bf54f90f62cc240f2cda1c889161b23-dirty
proteore
parents: 2
diff changeset
205 input = strsplit(args$input, "[ \t\n]+")[[1]]
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
206 } else if (input_type == "file") {
1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
207 filename = args$input
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
208 ncol = args$ncol
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
209 # Check ncol
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
210 if (! as.numeric(gsub("c", "", ncol)) %% 1 == 0) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
211 stop("Please enter an integer for level")
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
212 } else {
1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
213 ncol = as.numeric(gsub("c", "", ncol))
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
214 }
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
215 header = args$header
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
216 # Get file content
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
217 file = readfile(filename, header)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
218 # Extract Protein IDs list
6
6afe8166a9a4 planemo upload commit 4e898239997b7ef266b1d0ce0a4c7cdec31b4ecd-dirty
proteore
parents: 5
diff changeset
219 input = unlist(strsplit(file[,ncol],";"))
6afe8166a9a4 planemo upload commit 4e898239997b7ef266b1d0ce0a4c7cdec31b4ecd-dirty
proteore
parents: 5
diff changeset
220 input = input [which(!is.na(input))]
1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
221 }
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
222
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
223 if (! any(check_ids(input,id_type))){
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
224 stop(paste(id_type,"not found in your ids list, please check your IDs in input or the selected column of your input file"))
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
225 }
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
226
1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
227 ontoopt = strsplit(args$onto_opt, ",")[[1]]
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
228 #print(ontoopt)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
229 #plotopt = strsplit(args[3], ",")
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
230 plotopt = args$plot_opt
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
231 level = args$level
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
232 per = as.logical(args$per)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
233 title = args$title
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
234 duplicate = args$duplicate
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
235 text_output = args$text_output
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
236 species=args$species
1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
237
5
781072a65600 planemo upload commit 0ce4c81e6d2f7af8c9b52f6c07e83b0319c2adb1-dirty
proteore
parents: 4
diff changeset
238 profiles = getprofile(input, id_type, level, duplicate,species)
1
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
239 profile.CC = profiles[1]
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
240 #print(profile.CC)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
241 profile.MF = profiles[2]
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
242 #print(profile.MF)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
243 profile.BP = profiles[3]
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
244 #print(profile.BP)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
245 profile.ALL = profiles[-3:-1]
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
246 #print(profile.ALL)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
247 #c(profile.ALL, profile.CC, profile.MF, profile.BP)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
248
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
249 if ("CC" %in% ontoopt) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
250 write.table(profile.CC, text_output, append = TRUE, sep="\t", row.names = FALSE, quote=FALSE)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
251 if (grepl("PNG", plotopt)) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
252 plotPNG(profile.CC=profile.CC, per=per, title=title)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
253 }
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
254 if (grepl("JPEG", plotopt)) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
255 plotJPEG(profile.CC = profile.CC, per=per, title=title)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
256 }
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
257 if (grepl("PDF", plotopt)) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
258 plotPDF(profile.CC = profile.CC, per=per, title=title)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
259 }
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
260 }
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
261 if ("MF" %in% ontoopt) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
262 write.table(profile.MF, text_output, append = TRUE, sep="\t", row.names = FALSE, quote=FALSE)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
263 if (grepl("PNG", plotopt)) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
264 plotPNG(profile.MF = profile.MF, per=per, title=title)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
265 }
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
266 if (grepl("JPEG", plotopt)) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
267 plotJPEG(profile.MF = profile.MF, per=per, title=title)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
268 }
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
269 if (grepl("PDF", plotopt)) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
270 plotPDF(profile.MF = profile.MF, per=per, title=title)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
271 }
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
272 }
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
273 if ("BP" %in% ontoopt) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
274 write.table(profile.BP, text_output, append = TRUE, sep="\t", row.names = FALSE, quote=FALSE)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
275 if (grepl("PNG", plotopt)) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
276 plotPNG(profile.BP = profile.BP, per=per, title=title)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
277 }
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
278 if (grepl("JPEG", plotopt)) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
279 plotJPEG(profile.BP = profile.BP, per=per, title=title)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
280 }
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
281 if (grepl("PDF", plotopt)) {
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
282 plotPDF(profile.BP = profile.BP, per=per, title=title)
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
283 }
1236ee08ccb8 planemo upload commit 5774fd6a5a746f36f6bf4671a51a39ea2b978300-dirty
proteore
parents: 0
diff changeset
284 }
0
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
285 }
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
286
d89c09253c8d planemo upload commit abb24d36c776520e73220d11386252d848173697-dirty
proteore
parents:
diff changeset
287 goprofiles()