changeset 7:b25f272d3505 draft

planemo upload commit 46cd1d44f3be3058caa036851d95194ebff3caaf-dirty
author proteore
date Tue, 18 Sep 2018 09:20:27 -0400
parents 2b14f4f8e128
children ea5fecd4aa69
files GO-enrich.R cluster_profiler.xml
diffstat 2 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/GO-enrich.R	Tue Sep 18 08:28:16 2018 -0400
+++ b/GO-enrich.R	Tue Sep 18 09:20:27 2018 -0400
@@ -47,16 +47,18 @@
                ont=ontology, 
                level=level, 
                readable=TRUE)
-  
-  ggo@result$Description <- sapply(ggo@result$Description, function(x) {ifelse(nchar(x)>100, substr(x,1,100),x)},USE.NAMES = FALSE)
-  nb_max_char = max_str_length_10_first(ggo$Description)
-  width = width_by_max_char(nb_max_char)
-  name <- paste("GGO_", ontology, "_bar-plot", sep = "")
-  png(name,height = 720, width = width)
-  p <- barplot(ggo, showCategory=10)
-  print(p)
-  dev.off()
-  return(ggo)
+
+  if (length(ggo@result$ID) > 0 ) {
+    ggo@result$Description <- sapply(as.vector(ggo@result$Description), function(x) {ifelse(nchar(x)>100, substr(x,1,100),x)},USE.NAMES = FALSE)
+    nb_max_char = max_str_length_10_first(ggo$Description)
+    width = width_by_max_char(nb_max_char)
+    name <- paste("GGO_", ontology, "_bar-plot", sep = "")
+    png(name,height = 720, width = width)
+    p <- barplot(ggo, showCategory=10)
+    print(p)
+    dev.off()
+    return(ggo)
+  }
 }
 
 # GO over-representation test
@@ -75,6 +77,8 @@
   #if there are enriched GopTerms
   if (length(ego$ID)>0){
     
+    print ('ego')
+    print (ego@result$Description)
     ego@result$Description <- sapply(ego@result$Description, function(x) {ifelse(nchar(x)>100, substr(x,1,100),x)},USE.NAMES = FALSE)
     nb_max_char = max_str_length_10_first(ego$Description)
     width = width_by_max_char(nb_max_char)
--- a/cluster_profiler.xml	Tue Sep 18 08:28:16 2018 -0400
+++ b/cluster_profiler.xml	Tue Sep 18 09:20:27 2018 -0400
@@ -1,4 +1,4 @@
-<tool id="cluter_profiler" name="clusterProfiler" version="2018.09.18.2">
+<tool id="cluter_profiler" name="clusterProfiler" version="2018.09.18.3">
     <description>
     GO terms classification and enrichment analysis
     </description>