Extract command from tool xml file

I’d like to extract the information of a tool XML file into a usable form. Specifically I’d like to extract and parse the command (i.e. replace all the macros and parse the cheetah template) for a custom list of variables (inputs, outputs, etc). Essentially, I’m looking to create the executable that galaxy would call in a workflow job. Ideally, this would be done outside of a galaxy server.

I’ve been able to use galaxy.tool_util.parser.factory.get_tool_source to extract a large part of this information, but I can’t seem to find the list of input or output variables nor find a way to parse the resultant cheetah template.

Is this function the best option? I wonder if planemo could parse an existing XML tool since it is a tool used to generate these files. And what options do I have to parse the cheetah template? This latter question is of lesser importance since I could parse the template directly with cheetah.

Hello @david.deepwell

One way is to run the tool, then examine the command-line on the job information view. Find that by clicking on the “i” icon. You could use the API if not interested in interacting with a web service.

Thank you @jennaj. This would work with a running galaxy server, but I’d like avoid the overhead of the server. Without having all the other galaxy features (job scheduling, file management, etc), I’d like to simply parse the tool file into an executable command given a set of input files.

Hi @david.deepwell

That is the way I know how-to. And, you could query a public server too. Run a workflow with representative data (if you care about the input flags), then query out the command strings, all through the API.

And remember, most tools hosted in Galaxy are just wrapped 3rd party public tools. So whatever their documentation is for the original command line is pretty much what Galaxy is doing underneath it all. That means attempting to derive the command for non-Galaxy use is sort of routing through Galaxy as an extra step. You could just do that directly instead.

Maybe someone else reading this has better advice.