changeset 38:0d954174e0e9 draft

planemo upload commit 3ff0fa577362e757a1e7692a0a397bdda3d4dfc8-dirty
author proteore
date Thu, 27 Jun 2019 11:48:18 -0400
parents 7269aea2cb95
children 3d4cdea0ea20
files GO-enrich.R
diffstat 1 files changed, 7 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/GO-enrich.R	Thu Jun 27 09:44:07 2019 -0400
+++ b/GO-enrich.R	Thu Jun 27 11:48:18 2019 -0400
@@ -44,7 +44,7 @@
   return (width)
 }
 
-repartition_GO <- function(geneid, orgdb, ontology, level=3, readable=TRUE, plot) {
+repartition_GO <- function(geneid, orgdb, ontology, level=3, readable=TRUE) {
   ggo<-groupGO(gene=geneid, 
                OrgDb = orgdb, 
                ont=ontology, 
@@ -55,23 +55,11 @@
     ggo@result$Description <- sapply(as.vector(ggo@result$Description), function(x) {ifelse(nchar(x)>50, substr(x,1,50),x)},USE.NAMES = FALSE)
     #nb_max_char = max_str_length_10_first(ggo$Description)
     #width = width_by_max_char(nb_max_char)
-    
-    if ("dotplot" %in% plot ){
-      dot_name <- paste("GGO_", ontology, "_dot-plot", sep = "")
-      png(dot_name,height = 720, width = 600)
-      p <- dotplot(ggo, showCategory=10)
-      print(p)
-      dev.off()
-    }
-    
-    if ("barplot" %in% plot ){
-      bar_name <- paste("GGO_", ontology, "_bar-plot", sep = "")
-      png(bar_name,height = 720, width = 600)
-      p <- barplot(ggo, showCategory=10)
-      print(p)
-      dev.off()
-    }
-
+    name <- paste("GGO_", ontology, "_bar-plot", sep = "")
+    png(name,height = 720, width = 600)
+    p <- barplot(ggo, showCategory=10)
+    print(p)
+    dev.off()
     ggo <- as.data.frame(ggo)
     return(ggo)
   }
@@ -292,12 +280,10 @@
     universe_gene = NULL
   }
 
-  print(plot)
-  
   ##enrichGO : GO over-representation test
   for (onto in ontology) {
     if (go_represent) {
-      ggo<-repartition_GO(gene, orgdb, onto, level, readable=TRUE,plot)
+      ggo<-repartition_GO(gene, orgdb, onto, level, readable=TRUE)
       if (is.list(ggo)){ggo <- as.data.frame(apply(ggo, c(1,2), function(x) gsub("^$|^ $", NA, x)))}  #convert "" and " " to NA
       output_path = paste("cluster_profiler_GGO_",onto,".tsv",sep="")
       write.table(ggo, output_path, sep="\t", row.names = FALSE, quote = FALSE )