diff --git a/sequence_processing_pipeline/NuQCJob.py b/sequence_processing_pipeline/NuQCJob.py index 8933579b..b2ffd3a9 100644 --- a/sequence_processing_pipeline/NuQCJob.py +++ b/sequence_processing_pipeline/NuQCJob.py @@ -410,8 +410,10 @@ def _generate_mmi_filter_cmds(self, working_dir): # been annotated with. Samtools will safely ignore tags that # are not present. tags = " -T %s" % ','.join(self.additional_fastq_tags) + t_switch = " -y" else: tags = "" + t_switch = "" for count, mmi_db_path in enumerate(self.mmi_file_paths): if count == 0: @@ -428,7 +430,7 @@ def _generate_mmi_filter_cmds(self, working_dir): input = tmp_file1 output = tmp_file2 - cmds.append(f"minimap2 -2 -ax sr -y -t {cores_to_allocate} " + cmds.append(f"minimap2 -2 -ax sr{t_switch} -t {cores_to_allocate} " f"{mmi_db_path} {input} -a | samtools fastq -@ " f"{cores_to_allocate} -f 12 -F 256{tags} > " f"{output}") diff --git a/sequence_processing_pipeline/tests/test_NuQCJob.py b/sequence_processing_pipeline/tests/test_NuQCJob.py index c72c2287..a3cfdada 100644 --- a/sequence_processing_pipeline/tests/test_NuQCJob.py +++ b/sequence_processing_pipeline/tests/test_NuQCJob.py @@ -2108,10 +2108,10 @@ def test_generate_mmi_filter_cmds(self): obs = job._generate_mmi_filter_cmds("/my_work_dir") exp = [ - "minimap2 -2 -ax sr -y -t 2 db_path/mmi_1.db /my_work_dir/seqs." + "minimap2 -2 -ax sr -t 2 db_path/mmi_1.db /my_work_dir/seqs." "interleaved.fastq -a | samtools fastq -@ 2 -f 12 -F 256 > " "/my_work_dir/foo", - "minimap2 -2 -ax sr -y -t 2 db_path/mmi_2.db /my_work_dir/foo -a" + "minimap2 -2 -ax sr -t 2 db_path/mmi_2.db /my_work_dir/foo -a" " | samtools fastq -@ 2 -f 12 -F 256 > /my_work_dir/bar", "mv /my_work_dir/bar /my_work_dir/seqs.interleaved.filter_" "alignment.fastq", @@ -2123,6 +2123,48 @@ def test_generate_mmi_filter_cmds(self): self.assertEqual(obs, exp) + def test_generate_mmi_filter_cmds_w_descriptions(self): + double_db_paths = ["db_path/mmi_1.db", "db_path/mmi_2.db"] + job = NuQCJob( + self.fastq_root_path, + self.output_path, + self.good_sample_sheet_path, + double_db_paths, + "queue_name", + 1, + 1440, + "8", + "fastp", + "minimap2", + "samtools", + [], + self.qiita_job_id, + 1000, + "", + self.movi_path, + self.gres_value, + self.pmls_path, + ["BX"] + ) + + obs = job._generate_mmi_filter_cmds("/my_work_dir") + + exp = [ + "minimap2 -2 -ax sr -y -t 2 db_path/mmi_1.db /my_work_dir/seqs." + "interleaved.fastq -a | samtools fastq -@ 2 -f 12 -F 256 -T BX > " + "/my_work_dir/foo", + "minimap2 -2 -ax sr -y -t 2 db_path/mmi_2.db /my_work_dir/foo -a" + " | samtools fastq -@ 2 -f 12 -F 256 -T BX > /my_work_dir/bar", + "mv /my_work_dir/bar /my_work_dir/seqs.interleaved.filter_" + "alignment.fastq", + "[ -e /my_work_dir/foo ] && rm /my_work_dir/foo", + "[ -e /my_work_dir/bar ] && rm /my_work_dir/bar", + ] + + exp = "\n".join(exp) + + self.assertEqual(obs, exp) + def test_generate_mmi_filter_cmds_w_annotate_fastq(self): double_db_paths = ["db_path/mmi_1.db", "db_path/mmi_2.db"] job = NuQCJob(