def test_task_bismark_aln_2():
    x = oxbs_qc_func.task_bismark_aln(inFastq=[
        'test_data/mjb042_oxBS_R1.txt.gz', 'test_data/mjb042_oxBS_R2.txt.gz'
    ],
                                      ref='control_reference/bsseq_synthetic4',
                                      tmpdir='test_out',
                                      outSam='mjb042.sam',
                                      opts='-o test_out')
    print(x)
    assert x['sam'] == 'test_out/mjb042.sam'  ## Outut sam is what you expect
    assert os.path.exists(x['sam'])  ## Sam exists
    assert len(x['all_out']) > 1  ## There are more files in output dir
def test_task_bismark_exceptions():
    passed = False
    try:
        oxbs_qc_func.task_bismark_aln(inFastq=['NA'],
                                      ref='control_reference/bsseq_synthetic4',
                                      outSam='mjb042_oxBS_R1.sam',
                                      opts='')  ## No input fastq
    except oxbs_qc_func.BismarkException:
        passed = True
    assert passed

    passed = False
    try:
        oxbs_qc_func.task_bismark_aln(
            inFastq=['test_data/mjb042_oxBS_R1.txt.gz'],
            ref='control_reference/bsseq_synthetic4',
            outSam='mjb042_oxBS_R1',
            opts='')  ## No exts on sam
    except oxbs_qc_func.BismarkException:
        passed = True
    assert passed

    passed = False
    try:
        oxbs_qc_func.task_bismark_aln(
            inFastq=['test_data/mjb042_oxBS_R1.txt.gz'],
            ref='control_reference/bsseq_synthetic4/',
            outSam='mjb042_oxBS_R1.sam',
            opts='')  ## No ref
    except oxbs_qc_func.BismarkException:
        passed = True
    assert passed
def test_task_bismark_exceptions():
    passed= False
    try:
        oxbs_qc_func.task_bismark_aln(inFastq= ['NA'], ref= 'control_reference/bsseq_synthetic4', outSam= 'mjb042_oxBS_R1.sam', opts= '') ## No input fastq
    except oxbs_qc_func.BismarkException:
        passed= True
    assert passed

    passed= False
    try:
        oxbs_qc_func.task_bismark_aln(inFastq= ['test_data/mjb042_oxBS_R1.txt.gz'], ref= 'control_reference/bsseq_synthetic4', outSam= 'mjb042_oxBS_R1', opts= '') ## No exts on sam
    except oxbs_qc_func.BismarkException:
        passed= True
    assert passed

    passed= False
    try:
        oxbs_qc_func.task_bismark_aln(inFastq= ['test_data/mjb042_oxBS_R1.txt.gz'], ref= 'control_reference/bsseq_synthetic4/', outSam= 'mjb042_oxBS_R1.sam', opts= '') ## No ref
    except oxbs_qc_func.BismarkException:
        passed= True
    assert passed
def test_task_bismark_aln_2():
    x= oxbs_qc_func.task_bismark_aln(inFastq= ['test_data/mjb042_oxBS_R1.txt.gz', 'test_data/mjb042_oxBS_R2.txt.gz'], ref= 'control_reference/bsseq_synthetic4', tmpdir= 'test_out', outSam= 'mjb042.sam', opts= '-o test_out')
    print(x)
    assert x['sam'] == 'test_out/mjb042.sam' ## Outut sam is what you expect
    assert os.path.exists(x['sam']) ## Sam exists
    assert len(x['all_out']) > 1 ## There are more files in output dir