Hi,

please find attached a small patch that add the gen_image()
functionality to the export-workflow UI.

I was not able to figure out how to add a patch to the trello card. But
at least i created one ;).

https://trello.com/c/PGz7JNzO

Ciao,
Bjoern

> Thanks for sharing Peter.
> 
> FWIW, there is already code in Galaxy to generate SVG from a workflow. See 
> the gen_image function in web/controllers/workflow.py I think this code is 
> used when workflows are included in the tool shed as well.
> 
> If your code is better in some way(s), please consider a pull request. It 
> should be fairly straightforward to add an option to a workflow's menu to 
> generate SVG for it. 
> 
> Best,
> J.
> 
> On May 23, 2012, at 4:44 PM, Peter van Heusden wrote:
> 
> > Hi there
> > 
> > Because my Galaxy workflows tend to sprawl outside the viewable space in
> > my browser, I've written a script that, when given a workflow JSON file
> > as input, writes out a graphviz dot format graph of the workflow. By
> > default the graph treats datasets as nodes and analyses as edges (unlike
> > the Galaxy workflow editor, but quite like the way the history is
> > presented), but you can choose to have analyses as nodes (and thus
> > datasets as edges) too.
> > 
> > In case anyone else finds this useful, the code can be downloaded from
> > my bitbucket:
> > 
> > https://bitbucket.org/pvanheus/galaxy/src/f29453f3d9d8/contrib/workflow_to_dot.py
> > 
> > Usage is something like:
> > 
> > ./workflow_to_dot.py Galaxy-Workflow.ga  |dot -Tsvg >workflow.svg
> > 
> > and then you can view your workflow.svg with eog or another viewer.
> > 
> > Peter
> > 
> > ___________________________________________________________
> > Please keep all replies on the list by using "reply all"
> > in your mail client.  To manage your subscriptions to this
> > and other Galaxy lists, please use the interface at:
> > 
> >  http://lists.bx.psu.edu/
> 
> 
> ___________________________________________________________
> Please keep all replies on the list by using "reply all"
> in your mail client.  To manage your subscriptions to this
> and other Galaxy lists, please use the interface at:
> 
>   http://lists.bx.psu.edu/

diff -r 34404f848979 lib/galaxy/webapps/galaxy/controllers/workflow.py
--- a/lib/galaxy/webapps/galaxy/controllers/workflow.py	Sat Jan 19 17:54:48 2013 -0500
+++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py	Sun Jan 20 16:32:39 2013 +0100
@@ -993,6 +993,14 @@
         stored = self.get_stored_workflow( trans, id, check_ownership=False, check_accessible=True )
         return self._workflow_to_dict( trans, stored )
 
+    @web.expose
+    def export_to_image( self, trans, id ):
+        """
+        Get the latest Workflow for the StoredWorkflow identified by `id` and plot it to a canvas XML object.
+        
+        """
+        return self.gen_image(trans, id)
+
     @web.json_pretty
     def export_to_file( self, trans, id ):
         """
diff -r 34404f848979 templates/export_base.mako
--- a/templates/export_base.mako	Sat Jan 19 17:54:48 2013 -0500
+++ b/templates/export_base.mako	Sun Jan 20 16:32:39 2013 +0100
@@ -92,6 +92,13 @@
         Download ${get_class_display_name( item.__class__ ).lower()} to file so that it can be saved or imported into another Galaxy server.</a>
 </%def>
 
+<%def name="render_workflow_to_image(item)">
+    <h3>Download as Image</h3>
+    
+    <a href="${h.url_for( action='export_to_image', id=trans.security.encode_id( item.id ) )}">
+        Create ${get_class_display_name( item.__class__ ).lower()} image and download it as vector image.</a>
+</%def>
+
 <%def name="render_more(item)">
     ## Override.
 </%def>
@@ -109,9 +116,11 @@
     
     ${self.render_download_to_file(item)}
     
+    ${self.render_workflow_to_image(item)}
+    
     ${self.render_url_for_importing(item)}
     
     ${self.render_more(item)}
     
     ${self.render_footer()}
-</%def>
\ No newline at end of file
+</%def>
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:

  http://lists.bx.psu.edu/

Reply via email to