예제 #1
0
 def doNoXMLparam(self):
     """filter style package - stdin to stdout"""
     if len(self.infiles) > 0:
         alab = self.infiles[0]["label"]
         if len(alab) == 0:
             alab = self.infiles[0]["infilename"]
         max1s = (
             "Maximum one input if parampass is 0 but multiple input files supplied - %s"
             % str(self.infiles))
         assert len(self.infiles) == 1, max1s
         newname = self.infiles[0]["infilename"]
         aninput = gxtp.DataParam(
             newname,
             optional=False,
             label=alab,
             help=self.infiles[0]["help"],
             format=self.infiles[0]["format"],
             multiple=False,
             num_dashes=0,
         )
         aninput.command_line_override = "< $%s" % newname
         aninput.positional = True
         self.tinputs.append(aninput)
         tp = gxtp.TestParam(name=newname, value="%s_sample" % newname)
         self.testparam.append(tp)
     if len(self.outfiles) > 0:
         newname = self.outfiles[0]["name"]
         newfmt = self.outfiles[0]["format"]
         anout = gxtp.OutputData(newname, format=newfmt, num_dashes=0)
         anout.command_line_override = "> $%s" % newname
         anout.positional = self.is_positional
         self.toutputs.append(anout)
         tp = gxtp.TestOutput(name=newname, value="%s_sample" % newname)
         self.testparam.append(tp)
예제 #2
0
 def doXMLparam(self):  # noqa
     """Add all needed elements to tool"""
     for p in self.outfiles:
         newname = p["name"]
         newfmt = p["format"]
         newcl = p["CL"]
         test = p["test"]
         oldcl = p["origCL"]
         test = test.strip()
         ndash = self.getNdash(newcl)
         aparm = gxtp.OutputData(name=newname,
                                 format=newfmt,
                                 num_dashes=ndash,
                                 label=newname)
         aparm.positional = self.is_positional
         if self.is_positional:
             if oldcl.upper() == "STDOUT":
                 aparm.positional = 9999999
                 aparm.command_line_override = "> $%s" % newname
             else:
                 aparm.positional = int(oldcl)
                 aparm.command_line_override = "$%s" % newname
         self.toutputs.append(aparm)
         ld = None
         if test.strip() > "":
             if test.startswith("diff"):
                 c = "diff"
                 ld = 0
                 if test.split(":")[1].isdigit:
                     ld = int(test.split(":")[1])
                 tp = gxtp.TestOutput(
                     name=newname,
                     value="%s_sample" % newname,
                     compare=c,
                     lines_diff=ld,
                 )
             elif test.startswith("sim_size"):
                 c = "sim_size"
                 tn = test.split(":")[1].strip()
                 if tn > "":
                     if "." in tn:
                         delta = None
                         delta_frac = min(1.0, float(tn))
                     else:
                         delta = int(tn)
                         delta_frac = None
                 tp = gxtp.TestOutput(
                     name=newname,
                     value="%s_sample" % newname,
                     compare=c,
                     delta=delta,
                     delta_frac=delta_frac,
                 )
             else:
                 c = test
                 tp = gxtp.TestOutput(
                     name=newname,
                     value="%s_sample" % newname,
                     compare=c,
                 )
             self.testparam.append(tp)
     for p in self.infiles:
         newname = p["infilename"]
         newfmt = p["format"]
         ndash = self.getNdash(newname)
         reps = p.get("repeat", "0") == "1"
         if not len(p["label"]) > 0:
             alab = p["CL"]
         else:
             alab = p["label"]
         aninput = gxtp.DataParam(
             newname,
             optional=False,
             label=alab,
             help=p["help"],
             format=newfmt,
             multiple=False,
             num_dashes=ndash,
         )
         aninput.positional = self.is_positional
         if self.is_positional:
             if p["origCL"].upper() == "STDIN":
                 aninput.positional = 9999998
                 aninput.command_line_override = "> $%s" % newname
             else:
                 aninput.positional = int(p["origCL"])
                 aninput.command_line_override = "$%s" % newname
         if reps:
             repe = gxtp.Repeat(name=f"R_{newname}",
                                title=f"Add as many {alab} as needed")
             repe.append(aninput)
             self.tinputs.append(repe)
             tparm = gxtp.TestRepeat(name=f"R_{newname}")
             tparm2 = gxtp.TestParam(newname, value="%s_sample" % newname)
             tparm.append(tparm2)
             self.testparam.append(tparm)
         else:
             self.tinputs.append(aninput)
             tparm = gxtp.TestParam(newname, value="%s_sample" % newname)
             self.testparam.append(tparm)
     for p in self.addpar:
         newname = p["name"]
         newval = p["value"]
         newlabel = p["label"]
         newhelp = p["help"]
         newtype = p["type"]
         newcl = p["CL"]
         oldcl = p["origCL"]
         reps = p["repeat"] == "1"
         if not len(newlabel) > 0:
             newlabel = newname
         ndash = self.getNdash(newname)
         if newtype == "text":
             aparm = gxtp.TextParam(
                 newname,
                 label=newlabel,
                 help=newhelp,
                 value=newval,
                 num_dashes=ndash,
             )
         elif newtype == "integer":
             aparm = gxtp.IntegerParam(
                 newname,
                 label=newlabel,
                 help=newhelp,
                 value=newval,
                 num_dashes=ndash,
             )
         elif newtype == "float":
             aparm = gxtp.FloatParam(
                 newname,
                 label=newlabel,
                 help=newhelp,
                 value=newval,
                 num_dashes=ndash,
             )
         elif newtype == "boolean":
             aparm = gxtp.BooleanParam(
                 newname,
                 label=newlabel,
                 help=newhelp,
                 value=newval,
                 num_dashes=ndash,
             )
         else:
             raise ValueError('Unrecognised parameter type "%s" for\
              additional parameter %s in makeXML' % (newtype, newname))
         aparm.positional = self.is_positional
         if self.is_positional:
             aparm.positional = int(oldcl)
         if reps:
             repe = gxtp.Repeat(name=f"R_{newname}",
                                title=f"Add as many {newlabel} as needed")
             repe.append(aparm)
             self.tinputs.append(repe)
             tparm = gxtp.TestRepeat(name=f"R_{newname}")
             tparm2 = gxtp.TestParam(newname, value=newval)
             tparm.append(tparm2)
             self.testparam.append(tparm)
         else:
             self.tinputs.append(aparm)
             tparm = gxtp.TestParam(newname, value=newval)
             self.testparam.append(tparm)
     for p in self.selpar:
         newname = p["name"]
         newval = p["value"]
         newlabel = p["label"]
         newhelp = p["help"]
         newtype = p["type"]
         newcl = p["CL"]
         if not len(newlabel) > 0:
             newlabel = newname
         ndash = self.getNdash(newname)
         if newtype == "selecttext":
             newtext = p["texts"]
             aparm = gxtp.SelectParam(
                 newname,
                 label=newlabel,
                 help=newhelp,
                 num_dashes=ndash,
             )
             for i in range(len(newval)):
                 anopt = gxtp.SelectOption(
                     value=newval[i],
                     text=newtext[i],
                 )
                 aparm.append(anopt)
             aparm.positional = self.is_positional
             if self.is_positional:
                 aparm.positional = int(newcl)
             self.tinputs.append(aparm)
             tparm = gxtp.TestParam(newname, value=newval)
             self.testparam.append(tparm)
         else:
             raise ValueError('Unrecognised parameter type "%s" for\
              selecttext parameter %s in makeXML' % (newtype, newname))
     for p in self.collections:
         newkind = p["kind"]
         newname = p["name"]
         newlabel = p["label"]
         newdisc = p["discover"]
         collect = gxtp.OutputCollection(newname,
                                         label=newlabel,
                                         type=newkind)
         disc = gxtp.DiscoverDatasets(pattern=newdisc,
                                      directory=f"{newname}",
                                      visible="false")
         collect.append(disc)
         self.toutputs.append(collect)
         try:
             tparm = gxtp.TestOutputCollection(
                 newname)  # broken until PR merged.
             self.testparam.append(tparm)
         except Exception:
             print(
                 "#### WARNING: Galaxyxml version does not have the PR merged yet - tests for collections must be over-ridden until then!"
             )
예제 #3
0
 def doXMLparam(self):
     """flake8 made me do this..."""
     for p in self.outfiles:
         newname = p["name"]
         newfmt = p["format"]
         newcl = p["CL"]
         test = p["test"]
         oldcl = p["origCL"]
         test = test.strip()
         ndash = self.getNdash(newcl)
         aparm = gxtp.OutputData(name=newname,
                                 format=newfmt,
                                 num_dashes=ndash,
                                 label=newname)
         aparm.positional = self.is_positional
         if self.is_positional:
             if oldcl.upper() == "STDOUT":
                 aparm.positional = 9999999
                 aparm.command_line_override = "> $%s" % newname
             else:
                 aparm.positional = int(oldcl)
                 aparm.command_line_override = "$%s" % newname
         self.toutputs.append(aparm)
         ld = None
         if test.strip() > "":
             if test.startswith("diff"):
                 c = "diff"
                 ld = 0
                 if test.split(":")[1].isdigit:
                     ld = int(test.split(":")[1])
                 tp = gxtp.TestOutput(
                     name=newname,
                     value="%s_sample" % newname,
                     compare=c,
                     lines_diff=ld,
                 )
             elif test.startswith("sim_size"):
                 c = "sim_size"
                 tn = test.split(":")[1].strip()
                 if tn > "":
                     if "." in tn:
                         delta = None
                         delta_frac = min(1.0, float(tn))
                     else:
                         delta = int(tn)
                         delta_frac = None
                 tp = gxtp.TestOutput(
                     name=newname,
                     value="%s_sample" % newname,
                     compare=c,
                     delta=delta,
                     delta_frac=delta_frac,
                 )
             else:
                 c = test
                 tp = gxtp.TestOutput(
                     name=newname,
                     value="%s_sample" % newname,
                     compare=c,
                 )
             self.testparam.append(tp)
     for p in self.infiles:
         newname = p["infilename"]
         newfmt = p["format"]
         ndash = self.getNdash(newname)
         if not len(p["label"]) > 0:
             alab = p["CL"]
         else:
             alab = p["label"]
         aninput = gxtp.DataParam(
             newname,
             optional=False,
             label=alab,
             help=p["help"],
             format=newfmt,
             multiple=False,
             num_dashes=ndash,
         )
         aninput.positional = self.is_positional
         if self.is_positional:
             if p["origCL"].upper() == "STDIN":
                 aparm.positional = 9999998
                 aparm.command_line_override = "> $%s" % newname
             else:
                 aparm.positional = int(p["origCL"])
                 aparm.command_line_override = "$%s" % newname
         self.tinputs.append(aninput)
         tparm = gxtp.TestParam(name=newname, value="%s_sample" % newname)
         self.testparam.append(tparm)
     for p in self.addpar:
         newname = p["name"]
         newval = p["value"]
         newlabel = p["label"]
         newhelp = p["help"]
         newtype = p["type"]
         newcl = p["CL"]
         oldcl = p["origCL"]
         if not len(newlabel) > 0:
             newlabel = newname
         ndash = self.getNdash(newname)
         if newtype == "text":
             aparm = gxtp.TextParam(
                 newname,
                 label=newlabel,
                 help=newhelp,
                 value=newval,
                 num_dashes=ndash,
             )
         elif newtype == "integer":
             aparm = gxtp.IntegerParam(
                 newname,
                 label=newname,
                 help=newhelp,
                 value=newval,
                 num_dashes=ndash,
             )
         elif newtype == "float":
             aparm = gxtp.FloatParam(
                 newname,
                 label=newname,
                 help=newhelp,
                 value=newval,
                 num_dashes=ndash,
             )
         elif newtype == "boolean":
             aparm = gxtp.BooleanParam(
                 newname,
                 label=newname,
                 help=newhelp,
                 value=newval,
                 num_dashes=ndash,
             )
         else:
             raise ValueError('Unrecognised parameter type "%s" for\
              additional parameter %s in makeXML' % (newtype, newname))
         aparm.positional = self.is_positional
         if self.is_positional:
             aparm.positional = int(oldcl)
         self.tinputs.append(aparm)
         tparm = gxtp.TestParam(newname, value=newval)
         self.testparam.append(tparm)
     for p in self.selpar:
         newname = p["name"]
         newval = p["value"]
         newlabel = p["label"]
         newhelp = p["help"]
         newtype = p["type"]
         newcl = p["CL"]
         if not len(newlabel) > 0:
             newlabel = newname
         ndash = self.getNdash(newname)
         if newtype == "selecttext":
             newtext = p["texts"]
             aparm = gxtp.SelectParam(
                 newname,
                 label=newlabel,
                 help=newhelp,
                 num_dashes=ndash,
             )
             for i in range(len(newval)):
                 anopt = gxtp.SelectOption(
                     value=newval[i],
                     text=newtext[i],
                 )
                 aparm.append(anopt)
             aparm.positional = self.is_positional
             if self.is_positional:
                 aparm.positional = int(newcl)
             self.tinputs.append(aparm)
             tparm = gxtp.TestParam(newname, value=newval)
             self.testparam.append(tparm)
         else:
             raise ValueError('Unrecognised parameter type "%s" for\
              selecttext parameter %s in makeXML' % (newtype, newname))
     for p in self.collections:
         newkind = p["kind"]
         newname = p["name"]
         newlabel = p["label"]
         newdisc = p["discover"]
         collect = gxtp.OutputCollection(newname,
                                         label=newlabel,
                                         type=newkind)
         disc = gxtp.DiscoverDatasets(pattern=newdisc,
                                      directory=f"{newname}",
                                      visible="false")
         collect.append(disc)
         self.toutputs.append(collect)
         tparm = gxtp.TestOutput(newname, ftype="pdf")
         self.testparam.append(tparm)