def test_dot_4(self): w = WorkflowBuilder("sbmf") w.input("inp", Array(str)) w.input("inp2", Array(str)) w.input("inp3", Array(str)) w.input("inp4", Array(str)) step = w.step( "dotTool", SingleTestTool(inputs=w.inp, input2=w.inp2, input3=w.inp3, input4=w.inp4), scatter=ScatterDescription( fields=["inputs", "input2", "input3", "input4"], method=ScatterMethods.dot, ), ) outp = wdl.translate_step_node( step, "A.SingleTestTool", {}, {"inp", "inp2", "inp3", "inp4"} ) expected = """\ scatter (Q in zip(inp, zip(inp2, zip(inp3, inp4)))) { call A.SingleTestTool as dotTool { input: inputs=Q.left, input2=Q.right.left, input3=Q.right.right.left, input4=Q.right.right.right } }""" self.assertEqual(expected, outp.get_string(indent=0))
def test_translate_single_to_array_edge(self): w = WorkflowBuilder("wf") w.input("inp", str) stp1 = w.step("stp1", TestTool(testtool=w.inp), ignore_missing=True) stp2 = w.step("stp2", TestTool(arrayInp=stp1.std, testtool=w.inp), ignore_missing=True) outp = wdl.translate_step_node(stp2, stp2.id(), {}, set()) self.assertEqual(outp.get_string().split("\n")[3].strip(), f"arrayInp=[{stp1.id()}.std]")
def test_scatter_single_no_description(self): w = WorkflowBuilder("sbmf") w.input("inp", Array(str)) w.input("inp2", str) step = w.step( "dotTool", SingleTestTool(inputs=w.inp, input2=w.inp2), scatter="inputs" ) outp = wdl.translate_step_node(step, "A.SingleTestTool", {}, {"inp", "inp2"}) expected = """\ scatter (i in inp) { call A.SingleTestTool as dotTool { input: inputs=i, input2=inp2 } }""" self.assertEqual(expected, outp.get_string(indent=0))
def test_dot_2_secondary(self): w = WorkflowBuilder("sbmf") w.input("inp", Array(TxtSecondary)) w.input("inp2", Array(str)) step = w.step( "dotTool", MultipleEcho(input1=w.inp, input2=w.inp2), scatter=ScatterDescription( fields=["input1", "input2"], method=ScatterMethods.dot ), ) outp = wdl.translate_step_node(step, "A.SingleTestTool", {}, {"inp", "inp2"}) expected = """\ scatter (Q in zip(transpose([inp, inp_qt]), inp2)) { call A.SingleTestTool as dotTool { input: input1=Q.left[0], input1_qt=Q.left[1], input2=Q.right } }""" self.assertEqual(expected, outp.get_string(indent=0))