diff --git a/test/example_batch.tsv b/test/data/example_batch.tsv similarity index 62% rename from test/example_batch.tsv rename to test/data/example_batch.tsv index bb246ed9..e014b39a 100755 --- a/test/example_batch.tsv +++ b/test/data/example_batch.tsv @@ -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 \ No newline at end of file +sample_2 test/data/wgsim.1.fq.gz test/data/wgsim.2.fq.gz test/data/pbsim.fq.gz ont NA NA \ No newline at end of file diff --git a/test/test_integration.py b/test/test_integration.py index 687143dd..fe17f77f 100755 --- a/test/test_integration.py +++ b/test/test_integration.py @@ -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 " @@ -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()