def test_compress_in_place(self, mock_pbar): for input_file in os.listdir(os.path.join(test_data, 'single_reads')): # We copy file by file as copytree won't work to an existing directory shutil.copy(os.path.join(test_data, 'single_reads', input_file), self.save_path) self.assertCompressed(self.save_path, GZIP, read_count=4, file_count=4) in_files = set(os.listdir(self.save_path)) compress_batch(self.save_path, output_folder=None, target_compression=VBZ, in_place=True) self.assertCompressed(self.save_path, VBZ, read_count=4, file_count=4) self.assertEqual(in_files, set(os.listdir(self.save_path)))
def test_conversion_script_multi(self, mock_pbar): input_folder = os.path.join(test_data, 'multi_read') compress_batch(input_folder=input_folder, output_folder=self.save_path, target_compression=VBZ) count_files = 0 count_reads = 0 for out_file in get_fast5_file_list(self.save_path, recursive=True, follow_symlinks=True): count_files += 1 with get_fast5_file(out_file) as f5: self.assertTrue(isinstance(f5, MultiFast5File)) for read in f5.get_reads(): self.assertCompressed(read) count_reads += 1 self.assertEqual(1, count_files) self.assertEqual(4, count_reads)
def test_conversion_script_single(self, mock_pbar): input_folder = os.path.join(test_data, 'single_reads') compress_batch(input_folder=input_folder, output_folder=self.save_path, target_compression=VBZ) self.assertCompressed(self.save_path, VBZ, read_count=4, file_count=4)