changeset 9:948fecb6a40b draft

planemo upload commit 973d782455fd6a7df7ba9bce0a7878de53bc1e68-dirty
author proteore
date Mon, 04 Mar 2019 05:48:48 -0500
parents 386145573c19
children 2138e0035e57
files goprofiles.R goprofiles.xml
diffstat 2 files changed, 41 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/goprofiles.R	Tue Dec 18 09:54:57 2018 -0500
+++ b/goprofiles.R	Mon Mar 04 05:48:48 2019 -0500
@@ -79,30 +79,42 @@
     #print("IDs unable to convert to ENTREZID: ")
     #print(NAs)
   }
-  
   # Create basic profiles
   profile.CC = basicProfile(genes_ids, onto='CC', level=level, orgPackage=species, empty.cats=F, ord=T, na.rm=T)
   profile.BP = basicProfile(genes_ids, onto='BP', level=level, orgPackage=species, empty.cats=F, ord=T, na.rm=T)
   profile.MF = basicProfile(genes_ids, onto='MF', level=level, orgPackage=species, empty.cats=F, ord=T, na.rm=T)
   profile.ALL = basicProfile(genes_ids, onto='ANY', level=level, orgPackage=species, empty.cats=F, ord=T, na.rm=T)
-  
   # Print profile
   # printProfiles(profile)
   
   return(c(profile.CC, profile.MF, profile.BP, profile.ALL))
 }
 
+#return height and width of plot in inches from profile
+plot_size_from_nb_onto <- function(profile){
+    width=10
+    range = seq(50, 2000, by=25)
+    names(range) = seq(8,242, by=3)
+    nb_onto = round(nrow(profile[[1]])/25)*25
+    height= as.integer(names(which(range==nb_onto)))
+  return (c(width,height))
+}
+
 make_plot <- function(profile,percent,title,onto,plot_opt){
   
+  tmp <- plot_size_from_nb_onto (profile)
+  width <- tmp[1]
+  height <- tmp[2]
+  
   if (plot_opt == "PDF") {
     file_name=paste("profile_",onto,".pdf",collapse="",sep="")
-    pdf(file_name)
+    pdf(file_name, width=width, heigh=height)
   } else if (plot_opt == "JPEG"){
     file_name=paste("profile_",onto,".jpeg",collapse="",sep="")
-    jpeg(file_name)
+    jpeg(file_name,width=width, height=height, units = "in", res=100)
   } else if (plot_opt == "PNG"){
     file_name=paste("profile_",onto,".png",collapse="",sep="")
-    png(file_name)
+    png(file_name,width=width, height=height, units = "in", res=100)
   }
   plotProfiles(profile, percentage=percent, multiplePlots=FALSE, aTitle=title)
   dev.off()
@@ -179,7 +191,7 @@
   species=args$species
 
   profiles = getprofile(input, id_type, level, duplicate,species)
-
+  
   for (index in onto_pos) {
     onto = names(profiles[index])
     profile=profiles[index]
--- a/goprofiles.xml	Tue Dec 18 09:54:57 2018 -0500
+++ b/goprofiles.xml	Mon Mar 04 05:48:48 2019 -0500
@@ -1,4 +1,4 @@
-<tool id="goProfiles" name="Statistical analysis of functional profiles" version="2018.12.12">
+<tool id="goProfiles" name="Statistical analysis of functional profiles" version="2019.02.27">
     <description>(Human, Mouse) [goProfiles]</description>
     <requirements> 
         <requirement type="package" version="3.4.1">R</requirement>
@@ -8,6 +8,7 @@
         <requirement type="package" version="1.40.0">bioconductor-annotationdbi</requirement>
         <requirement type="package" version="2.38.0">bioconductor-biobase</requirement>
         <requirement type="package" version="1.38.0">goprofiles</requirement>
+        
     </requirements>
     <stdio>
         <exit_code range="1:" />
@@ -59,7 +60,9 @@
             </when>
             <when value="file" >
                 <param name="file" type="data" format="txt,tabular" label="Select your file" help="" />
-                <param name="ncol" type="text" value="c1" label="Column number of IDs" help='For example, fill in "c1" if it is the first column, "c2" if it is the second column and so on' />
+                <param name="ncol" type="text" value="c1" label="Column number of IDs" help='For example, fill in "c1" if it is the first column, "c2" if it is the second column and so on'>
+                    <validator type="regex" message="Please enter a column number, for example: 'c1' for the first column">[c]{0,1}[0-9]+</validator>
+                </param>
                 <param name="header" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Does file contain header?" />
                 <param name="id_type" type="select" label="Select type of IDs list" >
                     <option value="Entrez">Entrez Gene ID</option>
@@ -82,13 +85,26 @@
             <option value="1">1</option>
             <option value="2" selected="True">2</option>
             <option value="3">3</option>
+            <option value="4">4</option>
+            <option value="5">5</option>
+            <option value="6">6</option>
         </param>
         <param type="boolean" name="per" label="Plot absolute frequencies?" truevalue="TRUE" falsevalue="FALSE" />
-        <param type="text" name="title" label="Enter title of your figure" />
+        <param type="text" name="title" label="Enter title of your figure">
+            <sanitizer invalid_char=''>
+                <valid initial="string.printable">
+                    <remove value="&apos;"/>
+                    <remove value="/"/>
+                </valid>
+                <mapping>
+                    <add source="&#x20;" target=""/> 
+                </mapping>
+            </sanitizer>
+        </param>
         <param type="select" name="plot_opt" label="Plot file format">
-            <option value="PNG">png</option>
+            <option value="PNG" selected="True">png</option>
             <option value="JPEG">jpeg</option>
-            <option value="PDF" selected="True">pdf</option>
+            <option value="PDF">pdf</option>
         </param>
 
     </inputs>
@@ -148,13 +164,13 @@
 
 "Select GO terms category": you can choose one or more GO categories which are Biological Process (BP), Cellular Component (CC) and Molecular Function (MF) 
 
-"Ontology level (the higher this number, the deeper the GO level)": correspond to the level of GO hierarchy (from 1 to 3). In general the higher the level, the more semantically specific the term is.
+"Ontology level (the higher this number, the deeper the GO level)": correspond to the level of GO hierarchy (from 1 to 6). In general the higher the level, the more semantically specific the term is.
 
 -----
 
 **Ouput**
 
-Diagram output: graphical output in the form of bar-plot or dot-plot (png, jpeg or pdf format), one figure for each GO category. 
+Diagram output: graphical output in the form of bar-plot or dot-plot (png (default format), jpeg or pdf format), one figure for each GO category. 
 
 text output: with the following information GO category description (e.g.BP.Description), GO term identifier (e.g. BP.GOID) and GO term frequency (e.g. BP.Frequency)