def test_ec20_xlsx_unit(capsys): """If the input worklist file doesn't even exist...""" error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'foo.xlsx')) assert error_code == 20 check_run_qc(capsys, 1, 'Input file is missing:', RESOURCE_BASE / 'empty_file')
def test_ec18_unit(capsys): """If the input worklist file has the wrong extension...""" error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'foo.foo')) assert error_code == 18 check_run_qc(capsys, 1, 'Input file has bad extension:', RESOURCE_BASE / 'empty_file')
def test_ec19_unit(capsys): """If the input worklist file isn't a file...""" error_code = mplx_qc.run_qc(str(RESOURCE_BASE)) assert error_code == 19 check_run_qc(capsys, 1, 'Input is not a file:', RESOURCE_BASE / 'empty_file')
def test_ec15_unit(capsys): """If a CRAM is missing or not a file...""" error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'tsv_main/ec_15.tsv')) assert error_code == 15 check_run_qc(capsys, 1, 'CRAM is missing:', RESOURCE_BASE / 'tsv_main/ec_15_expect.tsv')
def test_ec17_xlsx_unit(capsys): """If the input worklist file has bad contents...""" error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'bad.xlsx')) assert error_code == 17 check_run_qc(capsys, 1, 'Input file has bad contents:', RESOURCE_BASE / 'empty_file')
def test_ec13_unit(capsys): """If a CRAM file is too bad to read...""" error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'tsv_main/ec_13.tsv')) assert error_code == 13 check_run_qc(capsys, 1, 'CRAM is bad:', RESOURCE_BASE / 'tsv_main/ec_13_expect.tsv')
def test_ec14_unit(capsys): """If a JSON is missing or not a file...""" error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'tsv_main/ec_14.tsv')) assert error_code == 14 check_run_qc(capsys, 1, 'JSON is missing:', RESOURCE_BASE / 'tsv_main/ec_14_expect.tsv')
def test_ec10_unit(capsys): """If an RG in a CRAM file is missing an SM...""" error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'tsv_main/ec_10.tsv')) assert error_code == 10 check_run_qc(capsys, 1, 'An RG in the CRAM is missing its SM:', RESOURCE_BASE / 'tsv_main/ec_10_expect.tsv')
def test_ec12_unit(capsys): """If a JSON file is too bad to read...""" error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'tsv_main/ec_12.tsv')) assert error_code == 12 check_run_qc(capsys, 1, 'JSON is bad:', RESOURCE_BASE / 'tsv_main/ec_12_expect.tsv')
def test_ec7_unit(capsys): error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'tsv_main/ec_7.xlsx.tsv')) assert error_code == 7 check_run_qc(capsys, 1, 'CRAM contains multiple values for sample.', RESOURCE_BASE / 'tsv_main/ec_7_expect.tsv')
def test_ec9_unit(capsys): """If an RG in a CRAM file is missing a PU...""" error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'tsv_main/ec_9.tsv')) assert error_code == 9 check_run_qc(capsys, 1, 'An RG in the CRAM is missing its PU:', RESOURCE_BASE / 'tsv_main/ec_9_expect.tsv')
def test_ec6_unit(capsys): error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'tsv_main/ec_6.xlsx.tsv')) assert error_code == 6 check_run_qc(capsys, 1, 'CRAM has wrong sample name.', RESOURCE_BASE / 'tsv_main/ec_6_expect.tsv')
def test_ec5_unit(capsys): error_code = mplx_qc.run_qc( str(RESOURCE_BASE / 'tsv_jwatt/ec_5_b.xlsx.tsv')) assert error_code == 5 check_run_qc(capsys, 3, 'CRAM and JSON have different sample names.', RESOURCE_BASE / 'tsv_jwatt/ec_5_expect.tsv')
def test_ec4_unit(capsys): error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'tsv_main/ec_4.xlsx.tsv')) assert error_code == 4 check_run_qc(capsys, 1, 'Duplicate barcodes in CRAM.', RESOURCE_BASE / 'tsv_main/ec_4_expect.tsv')
def test_ec2_unit(capsys): error_code = mplx_qc.run_qc( str(RESOURCE_BASE / 'tsv_jwatt/ec_2_b.xlsx.tsv')) assert error_code == 2 check_run_qc(capsys, 3, 'CRAM and JSON have mismatching sets of barcodes.', RESOURCE_BASE / 'tsv_jwatt/ec_2_expect.tsv')
def test_ec0_unit(capsys): error_code = mplx_qc.run_qc(str(RESOURCE_BASE / 'tsv_main/ec_0.xlsx.tsv')) out, err = capsys.readouterr() print(out) print(err, file=sys.stderr) assert error_code == 0