def test_skip_last_node(): tool_1 = Tool(tool_1_def, "T1") tool_2 = Tool(tool_1_def, "T2") tool_3 = Tool(tool_1_def, "T3") p = Pipeline() node_1 = p.run(tool_1, input='/infile.txt') node_2 = p.run(tool_2) node_3 = p.run(tool_3, output='/outfile.txt') node_1 | node_2 | node_3 groups = list(p.groups()) assert len(groups) == 1 assert node_1._tool.options['input'].get() == '/infile.txt' assert node_1._tool.options['output'].raw() == sys.stdout assert node_2._tool.options['input'].raw() == sys.stdout # output of 1 assert node_2._tool.options['output'].raw() == sys.stdout assert node_3._tool.options['input'].raw() == sys.stdout assert node_3._tool.options['output'].get() == '/outfile.txt' p.skip(node_3) assert len(list(p.nodes())) == 2 assert node_1._tool.options['input'].get() == '/infile.txt' assert node_1._tool.options['output'].raw() == sys.stdout assert node_2._tool.options['input'].raw() == sys.stdout assert node_2._tool.options['output'].get() == '/outfile.txt'
def test_graph_create(): p = Pipeline() a = p.run('nop') b = p.run('nop') p.run('nop') assert len(p._nodes) == 3 assert p.add_edge(a, b) is not None assert len(p._edges) == 1
def test_remove_node(): p = Pipeline() a = p.run('nop') b = p.run('nop') c = p.run('nop') p.add_edge(c, b) p.add_edge(b, a) p.remove(b) assert len(p._nodes) == 2 assert len(p._edges) == 0 for node in p.nodes(): assert len(node._edges) == 0
def test_topological_sort(): p = Pipeline() a = p.run('nop') assert a.name == "nop" b = p.run('nop') assert a.name == "nop.0" assert b.name == "nop.1" c = p.run('nop') assert a.name == "nop.0" assert b.name == "nop.1" assert c.name == "nop.2" p.add_edge(c, b) p.add_edge(b, a) sorted_nodes = [n for n in p.topological_order()] assert sorted_nodes == [c, b, a]
def test_edge_equality(): p = Pipeline() a = p.run('nop') b = p.run('nop') assert p.add_edge(a, b) is not None assert p.add_edge(a, b) is not None assert len(p._edges) == 1
def test_node_naming_and_auto_indexing_no_names_assigned(): p = Pipeline() p.run('bash', cmd="ls") p.run('bash', cmd="ls") assert p.get("bash.0") is not None assert p.get("bash.1") is not None
outputs = { "output": None } command = """ ../tools/quantifier --log DEBUG --annotation ${annotation} -i ${alignment} -o ${output} """ if __name__ == "__main__": pipeline = Pipeline() # add tools to the pipeline interleaver = pipeline.add(Interleaver()) aligner = pipeline.add(Aligner()) quantifier = pipeline.add(Quantifier()) # configure the tools interleaver.reads = "../data/reads_1.fastq ../data/reads_2.fastq" interleaver.output = "reads.fastq" aligner.reads = interleaver.output aligner.index = "../data/genome.gem" aligner.result = "alignment.map" quantifier.alignment = aligner.result quantifier.annotation = "../data/genome.gtf" quantifier.output = "counts.txt" pipeline.validate() pipeline.run()