def test_interleaved_no_paired_output(): with temporary_path("temp-paired.1.fastq") as p1: with temporary_path("temp-paired.2.fastq") as p2: params = '-a XX --interleaved'.split() with raises(SystemExit), redirect_stderr(): params += [ '-o', p1, '-p1', p2, 'paired.1.fastq', 'paired.2.fastq'] execute_cli(params)
def test_no_trimming_legacy(): # make sure that this doesn't divide by zero execute_cli([ '-a', 'XXXXX', '-o', '/dev/null', '-p', '/dev/null', '-pe1', datapath('paired.1.fastq'), '-pe2', datapath('paired.2.fastq') ])
def test_two_fastqs(): with raises(SystemExit), redirect_stderr(): execute_cli([ '-pe1', datapath('paired.1.fastq'), '-pe2', datapath('paired.2.fastq') ])
def test_E3M(): '''Read the E3M dataset''' # not really colorspace, but a fasta/qual file pair execute_cli([ '-o', '/dev/null', '-se', datapath("E3M.fasta"), '-sq', datapath("E3M.qual") ])
def test_interleaved_no_paired_output(): with temporary_path("temp-paired.1.fastq") as p1: with temporary_path("temp-paired.2.fastq") as p2: params = '-a XX --interleaved'.split() with raises(SystemExit), redirect_stderr(): params += [ '-o', p1, '-p1', p2, 'paired.1.fastq', 'paired.2.fastq' ] execute_cli(params)
def test_second_too_short(): with temporary_path("truncated.2.fastq") as trunc2: # Create a truncated file in which the last read is missing with open(datapath('paired.2.fastq')) as f: lines = f.readlines() lines = lines[:-4] with open(trunc2, 'w') as f: f.writelines(lines) with raises(SystemExit), redirect_stderr(): execute_cli('-a XX --paired-output out.fastq'.split() + [datapath('paired.1.fastq'), trunc2])
def test_quiet_is_quiet(): captured_standard_output = StringIO() captured_standard_error = StringIO() try: old_stdout = sys.stdout old_stderr = sys.stderr sys.stdout = captured_standard_output sys.stderr = captured_standard_error execute_cli(['-o', '/dev/null', '--quiet', '-a', 'XXXX', '-se', datapath('illumina.fastq.gz')]) finally: sys.stdout = old_stdout sys.stderr = old_stderr print(captured_standard_output.getvalue()) assert captured_standard_output.getvalue() == '' assert captured_standard_error.getvalue() == ''
def test_quiet_is_quiet(): captured_standard_output = StringIO() captured_standard_error = StringIO() try: old_stdout = sys.stdout old_stderr = sys.stderr sys.stdout = captured_standard_output sys.stderr = captured_standard_error execute_cli([ '-o', '/dev/null', '--quiet', '-a', 'XXXX', '-se', datapath('illumina.fastq.gz') ]) finally: sys.stdout = old_stdout sys.stderr = old_stderr print(captured_standard_output.getvalue()) assert captured_standard_output.getvalue() == '' assert captured_standard_error.getvalue() == ''
def test_missing_file(): with raises(SystemExit), redirect_stderr(): execute_cli([ '-a', 'XX', '--paired-output', 'out.fastq', datapath('paired.1.fastq') ])
def test_missing_file(): with raises(SystemExit), redirect_stderr(): execute_cli(['-a', 'XX', '--paired-output', 'out.fastq', datapath('paired.1.fastq')])
def test_qualfile_only(): with raises(SystemExit), redirect_stderr(): execute_cli(['-sq', datapath('E3M.qual')])
def test_two_fastqs(): with raises(SystemExit), redirect_stderr(): execute_cli(['-pe1', datapath('paired.1.fastq'), '-pe2', datapath('paired.2.fastq')])
def test_no_args(): with redirect_stderr(): assert execute_cli() != 0
def test_E3M(): '''Read the E3M dataset''' # not really colorspace, but a fasta/qual file pair execute_cli(['-o', '/dev/null', '-se', datapath("E3M.fasta"), '-sq', datapath("E3M.qual")])
def test_no_trimming(): # make sure that this doesn't divide by zero execute_cli(['-a', 'XXXXX', '-A', 'XXXXX', '-o', '/dev/null', '-p', '/dev/null', '-pe1', datapath('paired.1.fastq'), '-pe2', datapath('paired.2.fastq')])