def test_task_trim_galore_PE_exceptions():
    ## 2 inputs 1 output
    passed= False
    try:
        tg= oxbs_qc_func.task_trim_galore(inFastq= ['test_data/mjb042_oxBS_R1.fastq.gz', 'test_data/mjb042_oxBS_R2.fastq.gz'], outFastq= ['fq1.fq.gz'], tmpdir= 'test_out', opts= '', path= '')
    except oxbs_qc_func.TrimGaloreException:
        passed= True
    assert passed

    ## 1 inputs 2 output
    passed= False
    try:
        tg= oxbs_qc_func.task_trim_galore(inFastq= ['test_data/mjb042_oxBS_R1.fastq.gz'], outFastq= ['fq1.fq.gz', 'fq2.fq.gz'], tmpdir= 'test_out', opts= '', path= '')
    except oxbs_qc_func.TrimGaloreException:
        passed= True
    assert passed

    ## same input twice
    passed= False
    try:
        tg= oxbs_qc_func.task_trim_galore(inFastq= ['test_data/mjb042_oxBS_R1.fastq.gz', 'test_data/mjb042_oxBS_R1.fastq.gz'], outFastq= ['fq1.fq.gz', 'fq2.fq.gz'], tmpdir= 'test_out', opts= '', path= '')
    except oxbs_qc_func.TrimGaloreException:
        passed= True
    assert passed

    ## same Output twice
    passed= False
    try:
        tg= oxbs_qc_func.task_trim_galore(inFastq= ['test_data/mjb042_oxBS_R1.fastq.gz', 'test_data/mjb042_oxBS_R2.fastq.gz'], outFastq= ['fq1.fq.gz', 'fq1.fq.gz'], tmpdir= 'test_out', opts= '', path= '')
    except oxbs_qc_func.TrimGaloreException:
        passed= True
    assert passed
def test_task_trim_galore_PE_exceptions():
    ## 2 inputs 1 output
    passed = False
    try:
        tg = oxbs_qc_func.task_trim_galore(inFastq=[
            'test_data/mjb042_oxBS_R1.fastq.gz',
            'test_data/mjb042_oxBS_R2.fastq.gz'
        ],
                                           outFastq=['fq1.fq.gz'],
                                           tmpdir='test_out',
                                           opts='',
                                           path='')
    except oxbs_qc_func.TrimGaloreException:
        passed = True
    assert passed

    ## 1 inputs 2 output
    passed = False
    try:
        tg = oxbs_qc_func.task_trim_galore(
            inFastq=['test_data/mjb042_oxBS_R1.fastq.gz'],
            outFastq=['fq1.fq.gz', 'fq2.fq.gz'],
            tmpdir='test_out',
            opts='',
            path='')
    except oxbs_qc_func.TrimGaloreException:
        passed = True
    assert passed

    ## same input twice
    passed = False
    try:
        tg = oxbs_qc_func.task_trim_galore(inFastq=[
            'test_data/mjb042_oxBS_R1.fastq.gz',
            'test_data/mjb042_oxBS_R1.fastq.gz'
        ],
                                           outFastq=['fq1.fq.gz', 'fq2.fq.gz'],
                                           tmpdir='test_out',
                                           opts='',
                                           path='')
    except oxbs_qc_func.TrimGaloreException:
        passed = True
    assert passed

    ## same Output twice
    passed = False
    try:
        tg = oxbs_qc_func.task_trim_galore(inFastq=[
            'test_data/mjb042_oxBS_R1.fastq.gz',
            'test_data/mjb042_oxBS_R2.fastq.gz'
        ],
                                           outFastq=['fq1.fq.gz', 'fq1.fq.gz'],
                                           tmpdir='test_out',
                                           opts='',
                                           path='')
    except oxbs_qc_func.TrimGaloreException:
        passed = True
    assert passed
def test_task_trim_galore_PE_1():
    tg= oxbs_qc_func.task_trim_galore(inFastq= ['test_data/mjb042_oxBS_R1.fastq.gz', 'test_data/mjb042_oxBS_R2.fastq.gz'], outFastq= ['fq1.fq.gz', 'fq2.fq.gz'], tmpdir= 'test_out', opts= '-o test_out/trim_galore_pe1', path= '')
    print(tg)
    assert tg['fastq'][0] == 'test_out/trim_galore_pe1/fq1.fq.gz' ## Files are named as you expect
    assert tg['fastq'][1] == 'test_out/trim_galore_pe1/fq2.fq.gz'
    assert os.path.exists(tg['fastq'][0]) ## Files do exist
    assert os.path.exists(tg['fastq'][1])
def test_task_trim_galore_SE():
    passed= False
    try:
        tg= oxbs_qc_func.task_trim_galore(inFastq= ['test_data/mjb042_oxBS_R1.fastq.gz'], outFastq= ['bla/fq1.fq.gz'], tmpdir= 'test_out', opts= '-o test_out/trim_galore', path= '')
    except oxbs_qc_func.TrimGaloreException:
        "outFastq has path attached"
        passed= True
    assert passed
def test_task_trim_galore_SE_4():
    tg = oxbs_qc_func.task_trim_galore(
        inFastq=['test_data/mjb042_oxBS_R1.txt.gz'],
        outFastq=['fq1.txt'],
        tmpdir='test_out',
        opts='-o test_out/trim_galore_4 --dont_gzip',
        path='')
    print(tg)
    assert tg['fastq'][0] == 'test_out/trim_galore_4/fq1.txt'
    assert os.path.exists(tg['fastq'][0])
def test_task_trim_galore_PE_3():
    tg= oxbs_qc_func.task_trim_galore(inFastq= ['test_data/mjb042_oxBS_R1.txt', 'test_data/mjb042_oxBS_R2.txt'], outFastq= ['fq1.txt', 'fq2.txt'], tmpdir= 'test_out', opts= '-o test_out/trim_galore_pe3', path= '')
    print(tg)
    assert tg['fastq'][0] == 'test_out/trim_galore_pe3/fq1.txt' ## Files are named as you expect
    assert tg['fastq'][1] == 'test_out/trim_galore_pe3/fq2.txt'
    for x in tg['fastq']:
        assert os.path.exists(x) ## files do exist
    for x in tg['report']:
        assert os.path.exists(x) ## Reports do exist
    assert len(os.listdir('test_out/trim_galore_pe3/')) == 4
def test_task_trim_galore_SE_1():
    tg = oxbs_qc_func.task_trim_galore(
        inFastq=['test_data/mjb042_oxBS_R1.fastq.gz'],
        outFastq=['fq1.fq.gz'],
        tmpdir='test_out',
        opts='-o test_out/trim_galore_1',
        path='')
    print(tg)
    assert tg['fastq'][0] == 'test_out/trim_galore_1/fq1.fq.gz'
    assert os.path.exists(tg['fastq'][0])
    assert os.path.exists(
        'test_out/trim_galore_1/mjb042_oxBS_R1.fastq.gz_trimming_report.txt')
def test_task_trim_galore_SE():
    passed = False
    try:
        tg = oxbs_qc_func.task_trim_galore(
            inFastq=['test_data/mjb042_oxBS_R1.fastq.gz'],
            outFastq=['bla/fq1.fq.gz'],
            tmpdir='test_out',
            opts='-o test_out/trim_galore',
            path='')
    except oxbs_qc_func.TrimGaloreException:
        "outFastq has path attached"
        passed = True
    assert passed
def test_task_trim_galore_PE_1():
    tg = oxbs_qc_func.task_trim_galore(inFastq=[
        'test_data/mjb042_oxBS_R1.fastq.gz',
        'test_data/mjb042_oxBS_R2.fastq.gz'
    ],
                                       outFastq=['fq1.fq.gz', 'fq2.fq.gz'],
                                       tmpdir='test_out',
                                       opts='-o test_out/trim_galore_pe1',
                                       path='')
    print(tg)
    assert tg['fastq'][
        0] == 'test_out/trim_galore_pe1/fq1.fq.gz'  ## Files are named as you expect
    assert tg['fastq'][1] == 'test_out/trim_galore_pe1/fq2.fq.gz'
    assert os.path.exists(tg['fastq'][0])  ## Files do exist
    assert os.path.exists(tg['fastq'][1])
def test_task_trim_galore_PE_3():
    tg = oxbs_qc_func.task_trim_galore(inFastq=[
        'test_data/mjb042_oxBS_R1.txt', 'test_data/mjb042_oxBS_R2.txt'
    ],
                                       outFastq=['fq1.txt', 'fq2.txt'],
                                       tmpdir='test_out',
                                       opts='-o test_out/trim_galore_pe3',
                                       path='')
    print(tg)
    assert tg['fastq'][
        0] == 'test_out/trim_galore_pe3/fq1.txt'  ## Files are named as you expect
    assert tg['fastq'][1] == 'test_out/trim_galore_pe3/fq2.txt'
    for x in tg['fastq']:
        assert os.path.exists(x)  ## files do exist
    for x in tg['report']:
        assert os.path.exists(x)  ## Reports do exist
    assert len(os.listdir('test_out/trim_galore_pe3/')) == 4
def test_task_trim_galore_SE_4():
    tg= oxbs_qc_func.task_trim_galore(inFastq= ['test_data/mjb042_oxBS_R1.txt.gz'], outFastq= ['fq1.txt'], tmpdir= 'test_out', opts= '-o test_out/trim_galore_4 --dont_gzip', path= '')
    print(tg)
    assert tg['fastq'][0] == 'test_out/trim_galore_4/fq1.txt'
    assert os.path.exists(tg['fastq'][0])
def test_task_trim_galore_SE_1():
    tg= oxbs_qc_func.task_trim_galore(inFastq= ['test_data/mjb042_oxBS_R1.fastq.gz'], outFastq= ['fq1.fq.gz'], tmpdir= 'test_out', opts= '-o test_out/trim_galore_1', path= '')
    print(tg)
    assert tg['fastq'][0] == 'test_out/trim_galore_1/fq1.fq.gz'
    assert os.path.exists(tg['fastq'][0])
    assert os.path.exists('test_out/trim_galore_1/mjb042_oxBS_R1.fastq.gz_trimming_report.txt')