From cc3d872f6c0faebfd2e6a38a7c40076f31b0352a Mon Sep 17 00:00:00 2001 From: KatherineCaley Date: Sat, 31 Aug 2024 15:59:20 +1000 Subject: [PATCH] TST: add tests for graphbin, fixes #2 --- tests/test_cli_graphbin.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/test_cli_graphbin.py b/tests/test_cli_graphbin.py index 5d04a07..fb74b48 100644 --- a/tests/test_cli_graphbin.py +++ b/tests/test_cli_graphbin.py @@ -12,6 +12,7 @@ DATADIR = pathlib.Path(__file__).parent / "data" + @pytest.fixture(scope="session") def tmp_dir(tmpdir_factory): return tmpdir_factory.mktemp("tmp") @@ -29,7 +30,7 @@ def runner(): return CliRunner() -def test_graphbin_run(runner, tmp_dir): +def test_graphbin_spades_run(runner, tmp_dir): outpath = tmp_dir graph = DATADIR / "5G_metaSPAdes" / "assembly_graph_with_scaffolds.gfa" contigs = DATADIR / "5G_metaSPAdes" / "contigs.fasta" @@ -38,3 +39,24 @@ def test_graphbin_run(runner, tmp_dir): args = f"--assembler spades --graph {graph} --contigs {contigs} --paths {paths} --binned {binned} --output {outpath}".split() r = runner.invoke(graphbin, args, catch_exceptions=False) assert r.exit_code == 0, r.output + + +def test_graphbin_megahit_run(runner, tmp_dir): + outpath = tmp_dir + graph = DATADIR / "5G_MEGAHIT" / "final.gfa" + contigs = DATADIR / "5G_MEGAHIT" / "final.contigs.fa" + binned = DATADIR / "5G_MEGAHIT" / "initial_contig_bins.csv" + args = f"--assembler megahit --graph {graph} --contigs {contigs} --binned {binned} --output {outpath}".split() + r = runner.invoke(graphbin, args, catch_exceptions=False) + assert r.exit_code == 0, r.output + + +def test_graphbin_flye_run(runner, tmp_dir): + outpath = tmp_dir + graph = DATADIR / "1Y3B_Flye" / "assembly_graph.gfa" + contigs = DATADIR / "1Y3B_Flye" / "assembly.fasta" + paths = DATADIR / "1Y3B_Flye" / "assembly_info.txt" + binned = DATADIR / "1Y3B_Flye" / "initial_contig_bins.csv" + args = f"--assembler flye --graph {graph} --contigs {contigs} --paths {paths} --binned {binned} --output {outpath}".split() + r = runner.invoke(graphbin, args, catch_exceptions=False) + assert r.exit_code == 0, r.output