Mercurial > repos > idot > prop_venn
comparison venner.py @ 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 |
comparison
equal
deleted
inserted
replaced
0:8ea9b4e5a389 | 1:cc6707a1e044 |
---|---|
25 self.filePath = filePath | 25 self.filePath = filePath |
26 self.column = column | 26 self.column = column |
27 cleanname = re.sub("/","",name) | 27 cleanname = re.sub("/","",name) |
28 self.name = urllib.quote(cleanname, safe="%/:=&?~#+!$,;'@()*[]") | 28 self.name = urllib.quote(cleanname, safe="%/:=&?~#+!$,;'@()*[]") |
29 self.dict = {} | 29 self.dict = {} |
30 | |
30 def read(self): | 31 def read(self): |
31 dict = {} | 32 dict = {} |
32 lineNr = 0 | 33 lineNr = 0 |
33 for line in open( self.filePath, 'rb'): | 34 for line in open( self.filePath, 'rb'): |
34 key = line.split("\t")[self.column].strip() | 35 key = line.split("\t")[self.column].strip() |
86 <html> | 87 <html> |
87 <head> | 88 <head> |
88 <title>Venn diagram ${title}</title> | 89 <title>Venn diagram ${title}</title> |
89 </head> | 90 </head> |
90 <body> | 91 <body> |
91 <h3>${ title }</h3> | |
92 <div> | 92 <div> |
93 <img src="${ url }"/> | 93 <img src="${ url }"/> |
94 </div> | 94 </div> |
95 <div> | 95 <div> |
96 <table> | 96 <table> |
97 <tr><th>Segment</th><th>Count</th></tr> | 97 <tr><th>Set</th><th>Count</th></tr> |
98 <tr><td>${ one }</td><td>${ n.one_keys }</td></tr> | 98 <tr><td>${ one }</td><td>${ n.one_keys }</td></tr> |
99 <tr><td>${ two }</td><td>${ n.two_keys }</td></tr> | 99 <tr><td>${ two }</td><td>${ n.two_keys }</td></tr> |
100 <tr><td>${ one } \ ${ two }</td><td>${ n.one_only }</td></tr> | 100 <tr><td>${ one } \ ${ two }</td><td>${ n.one_only }</td></tr> |
101 <tr><td>${ two } \ ${ one }</td><td>${ n.two_only }</td></tr> | 101 <tr><td>${ two } \ ${ one }</td><td>${ n.two_only }</td></tr> |
102 <tr><td>${ one } ∩ ${ two }</td><td>${ n.one_i_two }</td></tr> | 102 <tr><td>${ one } ∩ ${ two }</td><td>${ n.one_i_two }</td></tr> |
103 </table> | 103 </table> |
104 </div> | 104 </div> |
105 </body> | 105 </body> |
106 </html>""" | 106 </html>""" |
107 result = Template(template).render(one=self.one.name, two=self.two.name, n=numbers, title=self.title, url=self.toUrl()) | 107 result = Template(template).render(one=urllib.unquote(self.one.name), two=urllib.unquote(self.two.name), n=numbers, title=self.title, url=self.toUrl()) |
108 return(result) | 108 return(result) |
109 | 109 |
110 | 110 |
111 | 111 |
112 class Venn3(Venn2): | 112 class Venn3(Venn2): |
156 <html> | 156 <html> |
157 <head> | 157 <head> |
158 <title>Venn diagram ${title}</title> | 158 <title>Venn diagram ${title}</title> |
159 </head> | 159 </head> |
160 <body> | 160 <body> |
161 <h3>${ title }</h3> | |
162 <div> | 161 <div> |
163 <img src="${ url }"/> | 162 <img src="${ url }"/> |
164 </div> | 163 </div> |
165 <div> | 164 <div> |
166 <table> | 165 <table> |
167 <tr><th>Segment</th><th>Count</th></tr> | 166 <tr><th>Set</th><th>Count</th></tr> |
168 <tr><td>${ one }</td><td>${ n.one_keys }</td></tr> | 167 <tr><td>${ one }</td><td>${ n.one_keys }</td></tr> |
169 <tr><td>${ two }</td><td>${ n.two_keys }</td></tr> | 168 <tr><td>${ two }</td><td>${ n.two_keys }</td></tr> |
170 <tr><td>${ three }</td><td>${ n.three_keys }</td></tr> | 169 <tr><td>${ three }</td><td>${ n.three_keys }</td></tr> |
171 <tr><td>${ one } \ (${ two } ∪ ${ three })</td><td>${ n.one_only }</td></tr> | 170 <tr><td>${ one } \ (${ two } ∪ ${ three })</td><td>${ n.one_only }</td></tr> |
172 <tr><td>${ two } \ (${ one } ∪ ${ three})</td><td>${ n.two_only }</td></tr> | 171 <tr><td>${ two } \ (${ one } ∪ ${ three})</td><td>${ n.two_only }</td></tr> |
177 <tr><td>${ one } ∩ ${ two } ∩ ${ three }</td><td>${ n.one_i_two_i_three }</td></tr> | 176 <tr><td>${ one } ∩ ${ two } ∩ ${ three }</td><td>${ n.one_i_two_i_three }</td></tr> |
178 </table> | 177 </table> |
179 </div> | 178 </div> |
180 </body> | 179 </body> |
181 </html>""" | 180 </html>""" |
182 result = Template(template).render(one=self.one.name, two=self.two.name, three=self.three.name, n=numbers, title=self.title, url=self.toUrl()) | 181 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()) |
183 return(result) | 182 return(result) |
184 | 183 |
185 | 184 |
186 | 185 |
187 | 186 |