Mercurial > repos > fubar > tool_factory_docker
diff toolfactory_docker/rgToolFactory2.py @ 3:12331d91c4ad draft
Uploaded
author | fubar |
---|---|
date | Thu, 07 Jan 2021 23:34:14 +0000 |
parents | a5c5652823a6 |
children | f17a2b1972f1 |
line wrap: on
line diff
--- a/toolfactory_docker/rgToolFactory2.py Tue Jan 05 00:35:40 2021 +0000 +++ b/toolfactory_docker/rgToolFactory2.py Thu Jan 07 23:34:14 2021 +0000 @@ -19,13 +19,6 @@ # calling venv. Hilarity ensues. -# # expects tarball as first, html out as second parameter -# cp $1 foo.tar.gz -# tar -xvzf foo.tar.gz -# TOOLNAME=`find . -name "*.xml"` -# echo "*****TOOLNAME = $TOOLNAME" -# planemo test --test_output $2 $TOOLNAME - import argparse import copy import logging @@ -133,17 +126,6 @@ return "".join([cheetah_escape_table.get(c, c) for c in text]) -def html_unescape(text): - """Revert entities within text. Multiple character targets so use replace""" - t = text.replace("&", "&") - t = t.replace(">", ">") - t = t.replace("<", "<") - t = t.replace("\\$", "$") - t = t.replace("$", "$") - t = t.replace("#", "#") - return t - - def parse_citations(citations_text): """""" citations = [c for c in citations_text.split("**ENTRY**") if c.strip()] @@ -462,7 +444,6 @@ tp = gxtp.TestOutput( name=newname, value="%s_sample" % newname, - format=newfmt, compare=c, lines_diff=ld, ) @@ -479,7 +460,6 @@ tp = gxtp.TestOutput( name=newname, value="%s_sample" % newname, - format=newfmt, compare=c, delta=delta, delta_frac=delta_frac, @@ -591,7 +571,7 @@ anout.positional = self.is_positional self.toutputs.append(anout) tp = gxtp.TestOutput( - name=newname, value="%s_sample" % newname, format=newfmt + name=newname, value="%s_sample" % newname, ) self.testparam.append(tp) @@ -605,28 +585,34 @@ self.newtool.command_override = self.command_override # config file else: self.newtool.command_override = self.xmlcl + cite = gxtp.Citations() + acite = gxtp.Citation(type="doi", value="10.1093/bioinformatics/bts573") + cite.append(acite) + self.newtool.citations = cite + safertext = "" if self.args.help_text: helptext = open(self.args.help_text, "r").readlines() safertext = "\n".join([cheetah_escape(x) for x in helptext]) - if self.args.script_path: - scr = [x for x in self.spacedScript if x.strip() > ""] - scr.insert(0, "\n------\n\n\nScript::\n") - if len(scr) > 300: - scr = ( - scr[:100] - + [" >300 lines - stuff deleted", " ......"] - + scr[-100:] - ) - scr.append("\n") - safertext = safertext + "\n".join(scr) - self.newtool.help = safertext - else: - self.newtool.help = ( - "Please ask the tool author (%s) for help \ - as none was supplied at tool generation\n" + if len(safertext.strip()) == 0: + safertext = ( + "Ask the tool author (%s) to rebuild with help text please\n" % (self.args.user_email) ) - self.newtool.version_command = None # do not want + if self.args.script_path: + if len(safertext) > 0: + safertext = safertext + "\n\n------\n" # transition allowed! + scr = [x for x in self.spacedScript if x.strip() > ""] + scr.insert(0, "\n\nScript::\n") + if len(scr) > 300: + scr = ( + scr[:100] + + [" >300 lines - stuff deleted", " ......"] + + scr[-100:] + ) + scr.append("\n") + safertext = safertext + "\n".join(scr) + self.newtool.help = safertext + self.newtool.version_command = f'echo "{self.args.tool_version}"' requirements = gxtp.Requirements() if self.args.packages: for d in self.args.packages.split(","): @@ -640,7 +626,7 @@ requirements.append( gxtp.Requirement("package", packg.strip(), ver.strip()) ) - self.newtool.requirements = requirements + self.newtool.requirements = requirements if self.args.parampass == "0": self.doNoXMLparam() else: @@ -664,9 +650,6 @@ % (self.args.user_email, timenow()) ) self.newtool.add_comment("Source in git at: %s" % (toolFactoryURL)) - self.newtool.add_comment( - "Cite: Creating re-usable tools from scripts doi:10.1093/bioinformatics/bts573" - ) exml0 = self.newtool.export() exml = exml0.replace(FAKEEXE, "") # temporary work around until PR accepted if ( @@ -683,6 +666,7 @@ xf.close() # ready for the tarball + def run(self): """ generate test outputs by running a command line