Mercurial > repos > fubar > brokenandnotdeletablebyowneroradmin
diff rgToolFactory.py @ 13:7725e4ab27e1
Adding tests - problem to find the script - needs a fixed string somewhere.
Updated readme
| author | ross lazarus ross.lazarus@gmail.com |
|---|---|
| date | Sun, 03 Jun 2012 22:25:46 +1000 |
| parents | d12728e33c3d |
| children | 8594478e8d2c |
line wrap: on
line diff
--- a/rgToolFactory.py Sun Jun 03 15:39:20 2012 +1000 +++ b/rgToolFactory.py Sun Jun 03 22:25:46 2012 +1000 @@ -93,7 +93,52 @@ def makeXML(self): """ Create a Galaxy xml tool wrapper for the new script as a string to write out - fixme - use templating or something less fugly than this + fixme - use templating or something less fugly than this. + Here's an example of what we produce + + <tool id="reverse" name="reverse" version="0.01"> + <description>a tabular file</description> + <command interpreter="python"> + reverse.py --script_path "$runMe" --interpreter "python" + --tool_name "reverse" --input_tab "$input1" --output_tab "$tab_file" + </command> + <inputs> + <param name="input1" type="data" format="tabular" label="Select a suitable input file from your history"/><param name="job_name" type="text" label="Supply a name for the outputs to remind you what they contain" value="reverse"/> + + </inputs> + <outputs> + <data format="tabular" name="tab_file" label="${job_name}"/> + + </outputs> + <help> + +**What it Does** + +Reverse the columns in a tabular file + + </help> + <configfiles> + <configfile name="runMe"> + +# reverse order of columns in a tabular file +import sys +inp = sys.argv[1] +outp = sys.argv[2] +i = open(inp,'r') +o = open(outp,'w') +for row in i: + rs = row.rstrip().split('\t') + rs.reverse() + o.write('\t'.join(rs)) + o.write('\n') +i.close() +o.close() + + + </configfile> + </configfiles> + </tool> + """ newXML="""<tool id="%(toolid)s" name="%(toolname)s" version="0.01"> %(tooldesc)s @@ -112,13 +157,18 @@ %(script)s </configfile> </configfiles> + %(tooltests)s </tool>""" # needs a dict with toolname, toolid, interpreter, scriptname, command, inputs as a multi line string ready to write, outputs ditto, help ditto newCommand="""<command interpreter="python"> %(toolname)s.py --script_path "$runMe" --interpreter "%(interpreter)s" --tool_name "%(toolname)s" %(command_inputs)s %(command_outputs)s </command>""" # may NOT be an input or htmlout - + tooltests = """<tests><test> + <param name="input1" value="%s" ftype="%s"/> + <param name="job_name" value="test1"/> + <param name="runMe" value="$runMe"/> + </test><tests>""" xdict = {} xdict['script'] = self.script # configfile is least painful way to embed script to avoid external dependencies if self.opts.help_text:
