Previous changeset 1:323982517b30 (2015-01-10) Next changeset 3:d75fd880fce2 (2015-01-11) |
Commit message:
Uploaded |
modified:
rgToolFactory2.py rgToolFactory2.xml |
b |
diff -r 323982517b30 -r 6a3c292412fa rgToolFactory2.py --- a/rgToolFactory2.py Sat Jan 10 19:39:33 2015 -0500 +++ b/rgToolFactory2.py Sun Jan 11 21:32:15 2015 -0500 |
[ |
b'@@ -121,7 +121,7 @@\n </tool_dependency>\n """\n \n-toolhtmldepskel = """<?xml version="1.0"?>\n+emptytoolhtmldepskel = """<?xml version="1.0"?>\n <tool_dependency>\n <readme>\n %s\n@@ -230,48 +230,56 @@\n self.test1Inputs = \'\'\n # we always pass path,name pairs in using python optparse append\n # but the command line has to be different\n- self.infile_paths = \',\'.join([x.split(\',\')[0] for x in self.opts.input_tab])\n- self.infile_names = \',\'.join([x.split(\',\')[1] for x in self.opts.input_tab])\n+ self.infile_paths = \'\'\n+ self.infile_names = \'\'\n+ if self.opts.input_tab:\n+ self.infile_paths = \',\'.join([x.split(\',\')[0].strip() for x in self.opts.input_tab])\n+ self.infile_names = \',\'.join([x.split(\',\')[1].strip() for x in self.opts.input_tab])\n if self.opts.interpreter == \'python\':\n # yes, this is how additional parameters are always passed in python - to the TF itself and to\n # scripts to avoid having unknown parameter names (yes, they can be parsed but...) on the command line\n- a(\'--INPATHS "%s"\' % (self.infile_paths)) \n- a(\'--INNAMES "%s"\' % (self.infile_names)) \n+ if self.opts.input_tab:\n+ a(\'--INPATHS "%s"\' % (self.infile_paths)) \n+ a(\'--INNAMES "%s"\' % (self.infile_names)) \n if self.opts.output_tab:\n a(\'--OUTPATH "%s"\' % self.opts.output_tab) \n for p in opts.additional_parameters:\n p = p.replace(\'"\',\'\')\n- psplit=p.split(\',\')\n- param = psplit[0]\n- value = psplit[1]\n- a(\'--additional_parameters "%s,%s"\' % (param,value))\n+ ps = p.split(\',\')\n+ a(\'%s="%s"\' % (ps[0],ps[1]))\n if (self.opts.interpreter == \'Rscript\'):\n # pass params on command line\n- a(\'INPATHS "%s"\' % self.infile_paths)\n- a(\'INNAMES "%s"\' % self.infile_names)\n+ if self.opts.input_tab:\n+ a(\'INPATHS="%s"\' % self.infile_paths)\n+ a(\'INNAMES="%s"\' % self.infile_names)\n if self.opts.output_tab:\n- a(\'OUTPATH "%s"\' % self.opts.output_tab) \n- for param in opts.additional_parameters:\n- param, value=param.split(\',\')\n- a(\'%s="%s"\' % (param,value))\n+ a(\'OUTPATH="%s"\' % self.opts.output_tab) \n+ for p in opts.additional_parameters:\n+ p = p.replace(\'"\',\'\')\n+ ps = p.split(\',\')\n+ a(\'%s="%s"\' % (ps[0],ps[1]))\n if (self.opts.interpreter == \'perl\'):\n # pass params on command line\n- a(\'%s\' % self.infile_paths)\n- a(\'%s\' % self.infile_names)\n+ if self.opts.input_tab:\n+ a(\'%s\' % self.infile_paths)\n+ a(\'%s\' % self.infile_names)\n if self.opts.output_tab:\n a(\'%s\' % self.opts.output_tab)\n- for param in opts.additional_parameters:\n- param, value=param.split(\',\')\n+ for p in opts.additional_parameters:\n+ p = p.replace(\'"\',\'\')\n+ ps = p.split(\',\')\n+ param = ps[0]\n+ value = ps[1]\n if (value.find(\' \') <> -1):\n a(\'%s="%s"\' % (param,value))\n else:\n a(\'%s=%s\' % (param,value))\n- \n if self.opts.interpreter == \'sh\' or self.opts.interpreter == \'bash\':\n # more is better - now move all params into environment AND drop on to command line.\n self.cl.insert(0,\'env\')\n- self.cl.insert(1,\'INPATHS=%s\' % (self.infile_paths))\n- self.cl.insert(2,\'INNAMES=%s\' % (self.infile_names))\n+ if self.opts.input_tab:\n+ self.cl.insert(1,\'INPATHS=%s\' % (self.infile_paths))\n+ self.cl.insert(2,\'I'..b' xdict[\'command_outputs\'] = \'\' \n xdict[\'outputs\'] = \'\' \n- if self.opts.input_tab <> \'None\':\n+ if self.opts.input_tab:\n cins = [\'\\n\',]\n+ cins.append(\'--input_formats %s\' % self.opts.input_formats)\n cins.append(\'#for intab in $input1:\')\n- cins.append(\'--input_tab "$intab,$intab.name"\')\n+ cins.append(\'--input_tab "${intab},${intab.name}"\')\n cins.append(\'#end for\\n\')\n xdict[\'command_inputs\'] = \'\\n\'.join(cins)\n xdict[\'inputs\'] = \'\'\'<param name="input_tab" multiple="true" type="data" format="%s" label="Select one or more %s input files from your history"\n@@ -469,12 +478,13 @@\n if (len(self.opts.additional_parameters) > 0):\n cins = [\'\\n\',]\n for params in self.opts.additional_parameters:\n- if self.opts.edit_additional_parameters:\n psplit = params.split(\',\') # name,value...\n- psplit[1] = \'$%s\' % psplit[0] # replace with form value\n- cins.append(\'--additional_parameters "%s"\' % \',\'.join(psplit)) \n- else:\n- cins.append(\'--additional_parameters "%s"\' % params)\n+ psplit[3] = html_escape(psplit[3])\n+ if self.opts.edit_additional_parameters:\n+ psplit[1] = \'$%s\' % psplit[0] # replace with form value\n+ else:\n+ psplit[1] = html_escape(psplit[1]) # leave prespecified value\n+ cins.append(\'--additional_parameters """%s"""\' % \',\'.join(psplit)) \n xdict[\'command_inputs\'] = \'%s\\n%s\' % (xdict[\'command_inputs\'],\'\\n\'.join(cins))\n xdict[\'inputs\'] += \'<param name="job_name" type="text" size="60" label="Supply a name for the outputs to remind you what they contain" value="%s"/> \\n\' % self.toolname\n xdict[\'toolname\'] = self.toolname\n@@ -520,20 +530,19 @@\n tdir = self.toolname\n os.mkdir(tdir)\n self.makeXML()\n- if self.opts.make_HTML:\n- if self.opts.help_text:\n- hlp = open(self.opts.help_text,\'r\').read()\n- else:\n- hlp = \'Please ask the tool author for help as none was supplied at tool generation\\n\'\n- if self.opts.include_dependencies == "yes":\n- tooldepcontent = toolhtmldepskel % hlp\n- else:\n- tooldepcontent = emptytoolhtmldepskel % hlp\n- depf = open(os.path.join(tdir,\'tool_dependencies.xml\'),\'w\')\n- depf.write(tooldepcontent)\n- depf.write(\'\\n\')\n- depf.close()\n- if self.opts.input_tab <> \'None\': # no reproducible test otherwise? TODO: maybe..\n+ if self.opts.help_text:\n+ hlp = open(self.opts.help_text,\'r\').read()\n+ else:\n+ hlp = \'Please ask the tool author for help as none was supplied at tool generation\\n\'\n+ if self.opts.include_dependencies == "yes":\n+ tooldepcontent = toolhtmldepskel % hlp\n+ else:\n+ tooldepcontent = emptytoolhtmldepskel % hlp\n+ depf = open(os.path.join(tdir,\'tool_dependencies.xml\'),\'w\')\n+ depf.write(tooldepcontent)\n+ depf.write(\'\\n\')\n+ depf.close()\n+ if self.opts.input_tab: # no reproducible test otherwise? TODO: maybe..\n testdir = os.path.join(tdir,\'test-data\')\n os.mkdir(testdir) # make tests directory\n for i,intab in enumerate(self.opts.input_tab):\n@@ -544,7 +553,7 @@\n dest = os.path.join(testdir,os.path.basename(si))\n if si <> dest:\n shutil.copyfile(si,dest)\n- if self.opts.output_tab <> None:\n+ if self.opts.output_tab:\n shutil.copyfile(self.opts.output_tab,os.path.join(testdir,self.test1Output))\n if self.opts.make_HTML:\n shutil.copyfile(self.opts.output_html,os.path.join(testdir,self.test1HTML))\n' |
b |
diff -r 323982517b30 -r 6a3c292412fa rgToolFactory2.xml --- a/rgToolFactory2.xml Sat Jan 10 19:39:33 2015 -0500 +++ b/rgToolFactory2.xml Sun Jan 11 21:32:15 2015 -0500 |
b |
@@ -40,10 +40,12 @@ #else: --output_dir "." #end if - #if $input_tab != 'None': + #if len($input_tab) != 0: --input_formats "$input_formats" - #for intab in $input_tab: - --input_tab "$intab,$intab.name" + #for $intab in $input_tab: + #if $intab.ext != 'data': + --input_tab "${intab},${intab.name}" + #end if #end for #end if #end if @@ -153,34 +155,34 @@ <mapping initial="none"/> </sanitizer> </param> - <param name="param_type" type="select" label="Select the type for this parameter"> + <param name="param_type" type="select" label="Select the type for this parameter"> <option value="text" selected="true">text</option> <option value="integer">integer</option> <option value="float">float</option> <option value="file">file</option> <option value="library_data">library_data</option> - </param> - <param name="param_value" type="text" value="parameter_value" label="Enter this parameter's default value" size="60" + </param> + <param name="param_value" type="text" value="parameter_value" label="Enter this parameter's default value" size="60" help="Note that commas and double quotes cannot be used in this text field - please work around this technical limitation" > <sanitizer invalid_char=""> <valid initial="string.printable"> <remove value=','/> <remove value='"'/> </valid> <mapping initial="none"/> </sanitizer> - </param> - <param name="param_label" type="text" value="parameter_label" label="Enter this parameter's label for the form" size="60" - help="Note that commas and double quotes cannot be used in this text field - please creatively work around this technical limitation" > + </param> + <param name="param_label" type="text" value="parameter_label" label="Enter this parameter's label for the form" size="60" + help="Note that commas and double quotes cannot be used in this text field - please creatively work around this technical limitation" > <sanitizer invalid_char=""> <valid initial="string.printable"> <remove value=','/> <remove value='"'/> </valid> <mapping initial="none"/> </sanitizer> - </param> - <param name="param_help" type="text" value="parameter_help" label="Help for this parameter" - help="Note that commas and double quotes cannot be used in this text field - please work around this technical limitation" size="60"> + </param> + <param name="param_help" type="text" value="parameter_help" label="Help for this parameter" + help="Note that commas and double quotes cannot be used in this text field - please work around this technical limitation" size="60"> <sanitizer invalid_char=""> <valid initial="string.printable"> <remove value=','/> <remove value='"'/> </valid> <mapping initial="none"/> </sanitizer> - </param> + </param> </repeat> <param name="dynScript" label="Cut and paste the script to be executed here" type="text" value="" area="True" size="20x120" help="Script must deal with three command line parameters: please cut and paste from examples below for the appropriate scripting language"> @@ -394,7 +396,6 @@ ]]> -**Citation** Paper_ : @@ -403,7 +404,6 @@ Ross Lazarus; Antony Kaspi; Mark Ziemann; The Galaxy Team Bioinformatics 2012; doi: 10.1093/bioinformatics/bts573 - **Licensing** Copyright Ross Lazarus (ross period lazarus at gmail period com) May 2012 @@ -417,7 +417,9 @@ </help> - +<citations> + <citation type="doi">doi: 10.1093/bioinformatics/bts573</citation> +</citations> </tool> |