def test_filter_mapped_paired(testdir, mock_testclass): bam = 'POLR2A.bam' output = 'POLR2A-out.bam' subprocess.run = MagicMock(side_effect=create_file) fb.filter_mapped(bam, output, True) subprocess.run.assert_any_call( ['samtools', 'view', '-b', '-F', '2048', '-f', '2', '-o', ANY, bam], check=True) subprocess.run.assert_any_call(['samtools', 'sort', '-o', output, ANY], check=True) assert subprocess.run.call_args_list[0].args[0][ 8] == subprocess.run.call_args_list[1].args[0][4]
def test_filter_mapped_single_threads(testdir, mock_testclass): bam = 'POLR2A.bam' output = 'POLR2A-out.bam' threads = 3 subprocess.run = MagicMock(side_effect=create_file) fb.filter_mapped(bam, output, False, threads) subprocess.run.assert_any_call([ 'samtools', 'view', '-b', '-F', '2048', '-F', '4', '--threads', str(threads - 1), '-o', ANY, bam ], check=True) subprocess.run.assert_any_call( ['samtools', 'sort', '--threads', str(threads - 1), '-o', output, ANY], check=True) assert subprocess.run.call_args_list[0].args[0][ 10] == subprocess.run.call_args_list[1].args[0][6]