def test_generate_per_sample_fastq_command_error_barcodes(self): fd, fp = mkstemp() close(fd) with open(fp, 'w') as f: f.write(MAPPING_FILE) self._clean_up_files.append(fp) forward_seqs = ["s1.fastq.gz", "s2.fastq.gz", "s3.fastq.gz"] reverse_seqs = [ "s1_rev.fastq.gz", "s2_rev.fastq.gz", "s3_rev.fastq.gz" ] barcode_fps = [ "s1_barcodes.fastq.gz", "s2_barcodes.fastq.gz", "s3_barcodes.fastq.gz" ] mapping_file = fp output_dir = "/output/dir" params_str = ( "--max_bad_run_length 3 --min_per_read_length_fraction 0.75 " "--sequence_max_n 0 --phred_quality_threshold 3 " "--barcode_type golay_12 --max_barcode_errors 1.5 " "--rev_comp_mapping_barcodes") with self.assertRaises(ValueError): generate_per_sample_fastq_command(forward_seqs, reverse_seqs, barcode_fps, mapping_file, output_dir, params_str)
def test_generate_per_sample_fastq_command_regex(self): fd, fp = mkstemp() close(fd) with open(fp, 'w') as f: f.write(MAPPING_FILE) self._clean_up_files.append(fp) forward_seqs = ["1_s1.fastq.gz", "1_s2.fastq.gz", "1_s3.fastq.gz"] reverse_seqs = ["1_s1_rev.fastq.gz", "1_s2_rev.fastq.gz", "1_s3_rev.fastq.gz"] barcode_fps = [] mapping_file = fp output_dir = "/output/dir" params_str = ( "--max_bad_run_length 3 --min_per_read_length_fraction 0.75 " "--sequence_max_n 0 --phred_quality_threshold 3 " "--barcode_type golay_12 --max_barcode_errors 1.5 " "--rev_comp_mapping_barcodes") obs = generate_per_sample_fastq_command( forward_seqs, reverse_seqs, barcode_fps, mapping_file, output_dir, params_str) exp = ("split_libraries_fastq.py --store_demultiplexed_fastq -i " "1_s1.fastq.gz,1_s2.fastq.gz,1_s3.fastq.gz --sample_ids " "SKB8.640193,SKD8.640184,SKB7.640196 -o /output/dir " "--max_bad_run_length 3 --min_per_read_length_fraction 0.75 " "--sequence_max_n 0 --phred_quality_threshold 3 " "--barcode_type golay_12 --max_barcode_errors 1.5 " "--rev_comp_mapping_barcodes") self.assertEqual(obs, exp)
def test_generate_per_sample_fastq_command(self): fd, fp = mkstemp() close(fd) with open(fp, 'w') as f: f.write(MAPPING_FILE) self._clean_up_files.append(fp) forward_seqs = ["s1.fastq.gz", "s2.fastq.gz", "s3.fastq.gz"] reverse_seqs = [ "s1_rev.fastq.gz", "s2_rev.fastq.gz", "s3_rev.fastq.gz" ] barcode_fps = [] mapping_file = fp output_dir = "/output/dir" params_str = ( "--max_bad_run_length 3 --min_per_read_length_fraction 0.75 " "--sequence_max_n 0 --phred_quality_threshold 3 " "--barcode_type golay_12 --max_barcode_errors 1.5 " "--rev_comp_mapping_barcodes") obs = generate_per_sample_fastq_command(forward_seqs, reverse_seqs, barcode_fps, mapping_file, output_dir, params_str) exp = ("split_libraries_fastq.py --store_demultiplexed_fastq -i " "s1.fastq.gz,s2.fastq.gz,s3.fastq.gz --sample_ids " "SKB8.640193,SKD8.640184,SKB7.640196 -o /output/dir " "--max_bad_run_length 3 --min_per_read_length_fraction 0.75 " "--sequence_max_n 0 --phred_quality_threshold 3 " "--barcode_type golay_12 --max_barcode_errors 1.5 " "--rev_comp_mapping_barcodes") self.assertEqual(obs, exp)
def test_generate_per_sample_fastq_command_error_prefixes(self): fd, fp = mkstemp() close(fd) with open(fp, 'w') as f: f.write(MAPPING_FILE) self._clean_up_files.append(fp) forward_seqs = ["s1.fastq.gz", "s2.fastq.gz", "sX.fastq.gz"] reverse_seqs = ["s1_rev.fastq.gz", "s2_rev.fastq.gz", "sX_rev.fastq.gz"] barcode_fps = [] mapping_file = fp output_dir = "/output/dir" params_str = ( "--max_bad_run_length 3 --min_per_read_length_fraction 0.75 " "--sequence_max_n 0 --phred_quality_threshold 3 " "--barcode_type golay_12 --max_barcode_errors 1.5 " "--rev_comp_mapping_barcodes") with self.assertRaises(ValueError): generate_per_sample_fastq_command( forward_seqs, reverse_seqs, barcode_fps, mapping_file, output_dir, params_str)