Skip to content

Commit

Permalink
fix: add batch test to test integration
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysnewell committed Apr 9, 2024
1 parent 95f00d3 commit c50b6b5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/example_batch.tsv → test/data/example_batch.tsv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sample short_reads_1 short_reads_2 long_reads long_read_type assembly coassemble
sample_1 test/data/wgsim.1.fq.gz test/data/wgsim.2.fq.gz NA ont NA NA
sample_2 NA NA test/data/pbsim.fq.gz pacbio NA NA
sample_2 test/data/wgsim.1.fq.gz test/data/wgsim.2.fq.gz test/data/pbsim.fq.gz ont NA NA
36 changes: 35 additions & 1 deletion test/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ def test_short_read_recovery_queue_submission(self):

cmd = (
f"aviary recover "
f"--output {output_dir} "
f"-o {output_dir}/aviary_out "
f"-1 {data}/wgsim.1.fq.gz "
f"-2 {data}/wgsim.2.fq.gz "
Expand All @@ -180,6 +179,41 @@ def test_short_read_recovery_queue_submission(self):
num_lines = sum(1 for _ in f)
self.assertEqual(num_lines, 3)

def test_batch_recovery(self):
output_dir = os.path.join("example", "test_batch_recovery")
self.setup_output_dir(output_dir)
cmd = (
f"aviary batch "
f"-o {output_dir}/aviary_out "
f"-f {data}/example_batch.tsv "
f"--conda-prefix {path_to_conda} "
f"--skip-binners rosella vamb metabat "
f"--skip-qc "
f"--refinery-max-iterations 0 "
f"--min-read-size 10 --min-mean-q 1 "
f"-n 32 -t 32 "
)
subprocess.run(cmd, shell=True, check=True)

self.assertTrue(os.path.isfile(f"{output_dir}/aviary_out/sample_1/data/final_contigs.fasta"))
self.assertTrue(os.path.isfile(f"{output_dir}/aviary_out/sample_2/data/final_contigs.fasta"))

bin_info_path_1 = f"{output_dir}/aviary_out/sample_1/bins/bin_info.tsv"
bin_info_path_2 = f"{output_dir}/aviary_out/sample_2/bins/bin_info.tsv"
self.assertTrue(os.path.isfile(bin_info_path_1))
self.assertTrue(os.path.isfile(bin_info_path_2))
with open(bin_info_path_1) as f:
num_lines = sum(1 for _ in f)
self.assertEqual(num_lines, 3)

self.assertTrue(os.path.isdir(f"{output_dir}/aviary_out/aviary_cluster_ani_0.95"))
self.assertTrue(os.path.isdir(f"{output_dir}/aviary_out/aviary_cluster_ani_0.97"))
self.assertTrue(os.path.isdir(f"{output_dir}/aviary_out/aviary_cluster_ani_0.99"))

self.assertTrue(os.path.isdir(f"{output_dir}/aviary_out/aviary_cluster_ani_0.95/pangenomes"))
self.assertTrue(os.path.isdir(f"{output_dir}/aviary_out/aviary_cluster_ani_0.97/pangenomes"))
self.assertTrue(os.path.isdir(f"{output_dir}/aviary_out/aviary_cluster_ani_0.99/pangenomes"))


if __name__ == "__main__":
unittest.main()

0 comments on commit c50b6b5

Please sign in to comment.