def test_multiple_output_files(self): """ properly writes multiple fasta files for each sampleID""" convert_fastq( self.fasta_file_path, self.qual_file_path, multiple_output_files=True, output_directory=self.output_dir, per_file_buffer_size=23, ) sample_ids = [ ("PC.634", expected_fastq_634_default), ("PC.354", expected_fastq_354_default), ("PC.481", expected_fastq_481_default), ] for sample_id, expected_output in sample_ids: actual_output_file_path = get_filename_with_new_ext( self.fasta_file_path, "_" + sample_id + ".fastq", self.output_dir ) actual_output_file = open(actual_output_file_path) actual_output = actual_output_file.read() actual_output_file.close() self._files_to_remove.append(actual_output_file_path) self.assertEquals(actual_output, expected_output)
def test_full_fasta_headers(self): """ Properly retains full fasta headers """ convert_fastq(self.fasta_file_path, self.qual_file_path, \ full_fasta_headers = True, output_directory = self.output_dir) actual_output_file_path = self.output_dir + \ splitext(split(self.fasta_file_path)[1])[0] + '.fastq' actual_output_file = open(actual_output_file_path) actual_output = actual_output_file.read() actual_output_file.close() self._files_to_remove.append(actual_output_file_path) self.assertEquals(actual_output, expected_fastq_full_fasta_headers)
def test_default_settings(self): """ Handles conversions with default settings """ convert_fastq(self.fasta_file_path, self.qual_file_path, output_directory=self.output_dir) actual_output_file_path = self.output_dir + \ splitext(split(self.fasta_file_path)[1])[0] + '.fastq' actual_output_file = open(actual_output_file_path) actual_output = actual_output_file.read() actual_output_file.close() self._files_to_remove.append(actual_output_file_path) self.assertEquals(actual_output, expected_fastq_default_options)
def test_full_fasta_headers(self): """ Properly retains full fasta headers """ convert_fastq( self.fasta_file_path, self.qual_file_path, full_fasta_headers=True, output_directory=self.output_dir ) actual_output_file_path = get_filename_with_new_ext(self.fasta_file_path, ".fastq", self.output_dir) actual_output_file = open(actual_output_file_path) actual_output = actual_output_file.read() actual_output_file.close() self._files_to_remove.append(actual_output_file_path) self.assertEquals(actual_output, expected_fastq_full_fasta_headers)
def test_multiple_output_files(self): """ properly writes multiple fasta files for each sampleID""" convert_fastq(self.fasta_file_path, self.qual_file_path, multiple_output_files = True, output_directory = self.output_dir) sample_ids = [('PC.634', expected_fastq_634_default), ('PC.354', expected_fastq_354_default), ('PC.481', expected_fastq_481_default)] for sample_id, expected_output in sample_ids: actual_output_file_path = self.output_dir + \ splitext(split(self.fasta_file_path)[1])[0] +'_%s.fastq' %\ sample_id actual_output_file = open(actual_output_file_path) actual_output = actual_output_file.read() actual_output_file.close() self._files_to_remove.append(actual_output_file_path) self.assertEquals(actual_output, expected_output)
def test_multiple_output_files(self): """ properly writes multiple fasta files for each sampleID""" convert_fastq(self.fasta_file_path, self.qual_file_path, multiple_output_files=True, output_directory=self.output_dir) sample_ids = [('PC.634', expected_fastq_634_default), ('PC.354', expected_fastq_354_default), ('PC.481', expected_fastq_481_default)] for sample_id, expected_output in sample_ids: actual_output_file_path = self.output_dir + \ splitext(split(self.fasta_file_path)[1])[0] +'_%s.fastq' %\ sample_id actual_output_file = open(actual_output_file_path) actual_output = actual_output_file.read() actual_output_file.close() self._files_to_remove.append(actual_output_file_path) self.assertEquals(actual_output, expected_output)