changeset 1:cc6707a1e044 draft default tip

added fixes from Brad Langhorst; https://bitbucket.org/account/notifications/read/3443176/patch-for-proportional-venn-tool-in-galaxy; added tool_dependencies for Mako template untested
author Ido Tamir <ido.tamir@imp.ac.at>
date Mon, 24 Sep 2012 16:46:21 +0200
parents 8ea9b4e5a389
children
files README.md prop_venn.xml tool_dependencies.xml venner.py
diffstat 4 files changed, 31 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Wed Jun 22 03:28:25 2011 -0400
+++ b/README.md	Mon Sep 24 16:46:21 2012 +0200
@@ -11,7 +11,8 @@
 
 contains an integration test for the cli interface (vennerTest.py), no galaxy unit tests.
 
-
+CLI example:
+python venner.py --files testFiles/fileA.tab,testFiles/fileB.tab --columns 1,1 --outname out.html --asNames As,Bs
 
 Proportional Venn Diagram:
 --------------------------
@@ -26,6 +27,6 @@
 
 Outputs:
 --------
-- Html page with the proportional Venn diagram and a table for the counts in each section.
+- Html page with the proportional Venn diagram and a table for the counts in each set.
 
 
--- a/prop_venn.xml	Wed Jun 22 03:28:25 2011 -0400
+++ b/prop_venn.xml	Mon Sep 24 16:46:21 2012 +0200
@@ -1,14 +1,14 @@
-<tool id="prop_venn" name="proportional venn" version="0.4">
+<tool id="prop_venn" name="proportional venn" version="0.5">
 <description> from 2-3 sets</description>
 <command interpreter="python">venner.py
 	#if str( $twoThree['tt']) == 'three':
 		--files $inputFile1,$inputFile2,$twoThree.inputFile3
 		--columns $column1,$column2,$twoThree.column3
-        --asNames $asName1,$asName2,$twoThree.asName3
+        --asNames "$asName1","$asName2","$twoThree.asName3"
     #else:
     	--file $inputFile1,$inputFile2
         --columns $column1,$column2
-        --asNames $asName1,$asName2
+        --asNames "$asName1","$asName2"
     #end if
      --title '$title'
      --size $size
@@ -16,7 +16,6 @@
 </command>
 <inputs>
   <param name="title" label="title" type="text" help="title of plot" optional="true" value=""/>
-  <param name="name" label="name" type="text" help="name of output file" value="venn of NA"/>
   <param name="size" label="size" type="integer" help="size of plot ( &lt; 540)" optional="true" value="300"/>
   
   <param format="tabular" name="inputFile1" label="input file 1" type="data" help="tabular input file" optional="false"/>
@@ -43,7 +42,7 @@
 </inputs>
 
 <outputs>
-  <data name="outPath" format="html" label="${name}"/>
+  <data name="outPath" format="html" label="${title}"/>
 </outputs>
 
 <help>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Mon Sep 24 16:46:21 2012 +0200
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="Mako" version="0.7.2">
+        <install version="1.0">
+            <actions>
+	        <action type="download_by_url">http://pypi.python.org/packages/source/M/Mako/Mako-0.7.2.tar.gz</action>
+                <action type="make_directory">$INSTALL_DIR/lib/python</action>
+                <action type="shell_command">export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python &amp;&amp; python setup.py install --home $INSTALL_DIR --install-scripts $INSTALL_DIR/bin</action>
+                <action type="set_environment">
+                    <environment_variable name="PYTHONPATH" action="append_to">$INSTALL_DIR/lib/python</environment_variable>
+                    <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/bin</environment_variable>
+                </action>
+            </actions>
+        </install>
+	<readme>
+	  prop_venn uses a templating engine called mako
+        </readme>
+    </package>
+</tool_dependency>
--- a/venner.py	Wed Jun 22 03:28:25 2011 -0400
+++ b/venner.py	Mon Sep 24 16:46:21 2012 +0200
@@ -27,6 +27,7 @@
         cleanname = re.sub("/","",name)
         self.name = urllib.quote(cleanname, safe="%/:=&?~#+!$,;'@()*[]")
         self.dict = {}
+    
     def read(self):
         dict = {}
         lineNr = 0
@@ -88,13 +89,12 @@
      <title>Venn diagram ${title}</title>
   </head>
   <body>
-     <h3>${ title }</h3>
      <div>
         <img src="${ url }"/>
      </div>
      <div>
         <table>
-           <tr><th>Segment</th><th>Count</th></tr>
+           <tr><th>Set</th><th>Count</th></tr>
            <tr><td>${ one }</td><td>${ n.one_keys }</td></tr>
            <tr><td>${ two }</td><td>${ n.two_keys }</td></tr>
            <tr><td>${ one } \ ${ two }</td><td>${ n.one_only }</td></tr>
@@ -104,7 +104,7 @@
      </div>
   </body>
 </html>"""
-        result = Template(template).render(one=self.one.name, two=self.two.name, n=numbers, title=self.title, url=self.toUrl())
+        result = Template(template).render(one=urllib.unquote(self.one.name), two=urllib.unquote(self.two.name), n=numbers, title=self.title, url=self.toUrl())
         return(result)
 
 
@@ -158,13 +158,12 @@
      <title>Venn diagram ${title}</title>
   </head>
   <body>
-     <h3>${ title }</h3>
      <div>
         <img src="${ url }"/>
      </div>
      <div>
         <table>
-           <tr><th>Segment</th><th>Count</th></tr>
+           <tr><th>Set</th><th>Count</th></tr>
            <tr><td>${ one }</td><td>${ n.one_keys }</td></tr>
            <tr><td>${ two }</td><td>${ n.two_keys }</td></tr>
            <tr><td>${ three }</td><td>${ n.three_keys }</td></tr>
@@ -179,7 +178,7 @@
      </div>
   </body>
 </html>"""
-        result = Template(template).render(one=self.one.name, two=self.two.name, three=self.three.name, n=numbers, title=self.title, url=self.toUrl())
+        result = Template(template).render(one=urllib.unquote(self.one.name), two=urllib.unquote(self.two.name), three=urllib.unquote(self.three.name), n=numbers, title=self.title, url=self.toUrl())
         return(result)