Esempio n. 1
0
 def test_generate_split_libraries_fastq_cmd_notimplementederror(self):
     fps = [("s1.fastq.gz", "raw_forward_seqs"),
            ("s2.fastq.gz", "raw_forward_seqs"),
            ("s3.fastq.gz", "raw_forward_seqs"),
            ("s1_rev.fastq.gz", "raw_reverse_seqs"),
            ("s2_rev.fastq.gz", "raw_reverse_seqs"),
            ("s3_rev.fastq.gz", "raw_reverse_seqs"),
            ("s1_barcodes.fastq.gz", "raw_barcodes"),
            ("s2_barcodes.fastq.gz", "raw_barcodes"),
            ("s3_barcodes.fastq.gz", "whopsies")]
     with self.assertRaises(NotImplementedError):
         generate_split_libraries_fastq_cmd(fps, "", "", "", {})
Esempio n. 2
0
 def test_generate_split_libraries_fastq_cmd_per_sample_FASTQ(self):
     fps = [("s1.fastq.gz", "raw_forward_seqs"),
            ("s2.fastq.gz", "raw_forward_seqs"),
            ("s3.fastq.gz", "raw_forward_seqs"),
            ("s1_rev.fastq.gz", "raw_reverse_seqs"),
            ("s2_rev.fastq.gz", "raw_reverse_seqs"),
            ("s3_rev.fastq.gz", "raw_reverse_seqs")]
     fd, fp = mkstemp()
     with open(fp, 'w') as f:
         f.write(MAPPING_FILE)
     self._clean_up_files.append(fp)
     mapping_file = fp
     atype = "per_sample_FASTQ"
     out_dir = "/output/dir"
     parameters = {
         "max_bad_run_length": 3, "min_per_read_length_fraction": 0.75,
         "sequence_max_n": 0, "rev_comp_barcode": False,
         "rev_comp_mapping_barcodes": True, "rev_comp": False,
         "phred_quality_threshold": 3, "barcode_type": "golay_12",
         "max_barcode_errors": 1.5, "input_data": 1}
     obs_cmd, obs_outdir = generate_split_libraries_fastq_cmd(
         fps, mapping_file, atype, out_dir, parameters)
     exp_cmd = (
         "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/sl_out "
         "--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_cmd, exp_cmd)
     self.assertEqual(obs_outdir, "/output/dir/sl_out")
Esempio n. 3
0
 def test_generate_split_libraries_fastq_cmd_valueerror(self):
     out_dir = "/output/dir"
     fps = [("s1.fastq.gz", "raw_forward_seqs"),
            ("s2.fastq.gz", "raw_forward_seqs"),
            ("s3.fastq.gz", "raw_forward_seqs"),
            ("s1_rev.fastq.gz", "raw_reverse_seqs"),
            ("s2_rev.fastq.gz", "raw_reverse_seqs"),
            ("s3_rev.fastq.gz", "raw_reverse_seqs"),
            ("s1_barcodes.fastq.gz", "raw_barcodes"),
            ("s3_barcodes.fastq.gz", "raw_barcodes")]
     mapping_file = "mapping_file.txt"
     atype = "FASTQ"
     parameters = {
         "max_bad_run_length": 3, "min_per_read_length_fraction": 0.75,
         "sequence_max_n": 0, "rev_comp_barcode": False,
         "rev_comp_mapping_barcodes": True, "rev_comp": False,
         "phred_quality_threshold": 3, "barcode_type": "golay_12",
         "max_barcode_errors": 1.5, "input_data": 1}
     with self.assertRaises(ValueError):
         generate_split_libraries_fastq_cmd(
             fps, mapping_file, atype, out_dir, parameters)
Esempio n. 4
0
 def test_generate_split_libraries_fastq_cmd(self):
     out_dir = mkdtemp()
     fps = [("s1.fastq.gz", "raw_forward_seqs"),
            ("s2.fastq.gz", "raw_forward_seqs"),
            ("s3.fastq.gz", "raw_forward_seqs"),
            ("s1_rev.fastq.gz", "raw_reverse_seqs"),
            ("s2_rev.fastq.gz", "raw_reverse_seqs"),
            ("s3_rev.fastq.gz", "raw_reverse_seqs"),
            ("s1_barcodes.fastq.gz", "raw_barcodes"),
            ("s2_barcodes.fastq.gz", "raw_barcodes"),
            ("s3_barcodes.fastq.gz", "raw_barcodes"),
            ("artifact_summary.html", "html_summary")]
     self._clean_up_files.append(out_dir)
     fd, fp = mkstemp()
     with open(fp, 'w') as f:
         f.write(MAPPING_FILE)
     self._clean_up_files.append(fp)
     mapping_file = fp
     atype = "FASTQ"
     parameters = {
         "max_bad_run_length": 3, "min_per_read_length_fraction": 0.75,
         "sequence_max_n": 0, "rev_comp_barcode": False,
         "rev_comp_mapping_barcodes": True, "rev_comp": False,
         "phred_quality_threshold": 3, "barcode_type": "golay_12",
         "max_barcode_errors": 1.5, "input_data": 1}
     obs_cmd, obs_outdir = generate_split_libraries_fastq_cmd(
         fps, mapping_file, atype, out_dir, parameters)
     exp_cmd = (
         "split_libraries_fastq.py --store_demultiplexed_fastq -i "
         "s1.fastq.gz,s2.fastq.gz,s3.fastq.gz -b "
         "s1_barcodes.fastq.gz,s2_barcodes.fastq.gz,s3_barcodes.fastq.gz "
         "-m {0}/mappings/s1_mapping_file.txt,"
         "{0}/mappings/s2_mapping_file.txt,"
         "{0}/mappings/s3_mapping_file.txt "
         "-o {0}/sl_out --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".format(out_dir))
     self.assertEqual(obs_cmd, exp_cmd)
     self.assertEqual(obs_outdir, join(out_dir, "sl_out"))