diff kegg_maps_visualization.R @ 2:8a6863adcd09 draft

planemo upload commit 9af2cf12c26c94e7206751ccf101a3368f92d0ba
author proteore
date Tue, 18 Dec 2018 09:23:35 -0500
parents 789acaab8255
children 4cc2265d1294
line wrap: on
line diff
--- a/kegg_maps_visualization.R	Thu Dec 13 04:16:02 2018 -0500
+++ b/kegg_maps_visualization.R	Tue Dec 18 09:23:35 2018 -0500
@@ -169,6 +169,12 @@
   return(res)
 }
 
+get_limit <- function(mat) {
+  min = min(apply(mat,2,min))
+  max = max(apply(mat,2,max))
+  return(c(min,max))
+}
+
 get_args <- function(){
   
   ## Collect arguments
@@ -291,9 +297,11 @@
     geneID=mat$geneID
     mat = as.data.frame(mat[,-1])
     row.names(mat)=geneID
+    limit = get_limit(mat)
   } else {
     mat = unique(as.character(tab$geneID[!is.na(tab$geneID[tab$geneID!=""])]))
     geneID=mat
+    limit=1
   }
   
   #####mapping geneID (with or without expression values) on KEGG pathway
@@ -304,7 +312,7 @@
   if (!fold_change_data) {
     plot.col.key= FALSE   #if there's no exrepession data, we don't show the color key
     high_color = "#81BEF7" #blue
-  }
+  } 
   
   #create graph(s) and text output
   for (id in ids) {
@@ -322,7 +330,8 @@
              na.col="#D8D8D8", #gray
              cpd.data=NULL,
              plot.col.key = plot.col.key,
-             pdf.size=c(9,9)))
+             pdf.size=c(9,9),
+             limit=list(gene=limit, cpd=limit)))
     
     if (is.list(pv.out)){