Skip to content
Snippets Groups Projects
Commit bad714b4 authored by Venkat Malladi's avatar Venkat Malladi
Browse files

Update testing setup.

parent f5b86f8f
No related merge requests found
Pipeline #1558 canceled with stages
in 33 seconds
......@@ -4,7 +4,22 @@ before_script:
- module load nextflow/0.24.1-SNAPSHOT
- ln -s /project/shared/bicf_workflow_ref/workflow_testdata/chipseq/*fastq.gz test_data/
test:
stages:
- unit
- integration
- acceptance
user_configuration:
stage: unit
script:
- pytest -m unit
single_end_mouse:
stage: integration
script:
- nextflow run workflow/main.nf
single_end_acceptance:
stage: unit
script:
- nextflow run workflow/main.nf
- pytest
- pytest -m acceptance
......@@ -8,6 +8,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/callPeaksMACS/'
@pytest.mark.acceptance
def test_call_peaks_macs_singleend():
assert os.path.exists(os.path.join(test_output_path, 'ENCLB144FDT.fc_signal.bw'))
assert os.path.exists(os.path.join(test_output_path, 'ENCLB144FDT.pvalue_signal.bw'))
......@@ -15,6 +16,7 @@ def test_call_peaks_macs_singleend():
assert utils.count_lines(peak_file) == 210349
@pytest.mark.acceptance
def test_call_peaks_macs_pairedend():
# Do the same thing for paired end data
pass
......@@ -70,6 +70,7 @@ def fastq_files_1(fastq_files):
return fastq_df
@pytest.mark.unit
def test_check_headers_singleend(design_1):
paired = False
with pytest.raises(Exception) as excinfo:
......@@ -77,6 +78,7 @@ def test_check_headers_singleend(design_1):
assert str(excinfo.value) == "Missing column headers: ['fastq_read1']"
@pytest.mark.unit
def test_check_headers_pairedend(design):
paired = True
with pytest.raises(Exception) as excinfo:
......@@ -84,12 +86,14 @@ def test_check_headers_pairedend(design):
assert str(excinfo.value) == "Missing column headers: ['fastq_read2']"
@pytest.mark.unit
def test_check_controls(design_2):
with pytest.raises(Exception) as excinfo:
check_design.check_controls(design_2)
assert str(excinfo.value) == "Missing control experiments: ['B_1']"
@pytest.mark.unit
def test_check_files_missing_files(design, fastq_files_1):
paired = False
with pytest.raises(Exception) as excinfo:
......@@ -97,18 +101,22 @@ def test_check_files_missing_files(design, fastq_files_1):
assert str(excinfo.value) == "Missing files from design file: ['B_2.fastq.gz']"
@pytest.mark.unit
def test_check_files_output_singleend(design, fastq_files):
paired = False
new_design = check_design.check_files(design, fastq_files, paired)
assert new_design.loc[0, 'fastq_read1'] == "/path/to/file/A_1.fastq.gz"
@pytest.mark.unit
def test_check_files_output_pairedend(design_3, fastq_files):
paired = True
new_design = check_design.check_files(design_3, fastq_files, paired)
assert new_design.loc[0, 'fastq_read2'] == "/path/to/file/A_2.fastq.gz"
@pytest.mark.unit
def test_check_replicates(design_4):
paired = False
with pytest.raises(Exception) as excinfo:
......
......@@ -7,11 +7,13 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/convertReads/'
@pytest.mark.acceptance
def test_convert_reads_singleend():
assert os.path.exists(os.path.join(test_output_path, 'ENCFF646LXU.filt.nodup.tagAlign.gz'))
assert os.path.exists(os.path.join(test_output_path, 'ENCFF646LXU.filt.nodup.bedse.gz'))
@pytest.mark.integration
def test_map_qc_pairedend():
# Do the same thing for paired end data
# Also check that bedpe exists
......
......@@ -24,11 +24,13 @@ def design_tag():
return design_df
@pytest.mark.unit
def test_check_update_controls_tag(design_tag):
new_design = experiment_design.update_controls(design_tag)
assert new_design.loc[0, 'control_tag_align'] == "B_1.tagAlign.gz"
@pytest.mark.acceptance
def test_experiment_design_single_end():
design_file = os.path.join(test_output_path, 'ENCSR238SGC.tsv')
assert os.path.exists(design_file)
......@@ -36,6 +38,7 @@ def test_experiment_design_single_end():
assert design_df.shape[0] == 2
@pytest.mark.acceptance
def test_experiment_design_paired_end():
# Do the same thing for paired end data
pass
......@@ -24,11 +24,13 @@ def design_bam():
return design_df
@pytest.mark.unit
def test_check_update_controls(design_bam):
new_design = experiment_qc.update_controls(design_bam)
assert new_design.loc[0, 'control_reads'] == "B_1.bam"
@pytest.mark.acceptance
def test_experiment_qc_singleend():
assert os.path.exists(os.path.join(test_output_path, 'sample_mbs.npz'))
assert os.path.exists(os.path.join(test_output_path, 'heatmap_SpearmanCorr.png'))
......@@ -36,7 +38,7 @@ def test_experiment_qc_singleend():
assert os.path.exists(os.path.join(test_output_path, 'ENCLB144FDT_fingerprint.png'))
assert os.path.exists(os.path.join(test_output_path, 'ENCLB831RUI_fingerprint.png'))
@pytest.mark.acceptance
def test_experiment_qc_pairedend():
# Do the same thing for paired end data
pass
......@@ -8,6 +8,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/filterReads/'
@pytest.mark.acceptance
def test_map_qc_singleend():
assert os.path.exists(os.path.join(test_output_path, 'ENCFF646LXU.filt.nodup.bam'))
assert os.path.exists(os.path.join(test_output_path, 'ENCFF646LXU.filt.nodup.bam.bai'))
......
......@@ -7,6 +7,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/alignReads/'
@pytest.mark.acceptance
def test_map_reads_singleend():
assert os.path.exists(os.path.join(test_output_path, 'ENCFF646LXU.srt.bam'))
aligned_reads_report = test_output_path + 'ENCFF646LXU.srt.bam.flagstat.qc'
......@@ -15,6 +16,7 @@ def test_map_reads_singleend():
assert '80050072 + 0 mapped (99.08% : N/A)' in samtools_report[4]
@pytest.mark.acceptance
def test_map_reads_pairedend():
# Do the same thing for paired end data
pass
......@@ -25,6 +25,7 @@ def design_diff():
return design_df
@pytest.mark.unit
def test_check_update_design(design_diff):
new_design = overlap_peaks.update_design(design_diff)
assert new_design.shape[0] == 2
......@@ -32,12 +33,14 @@ def test_check_update_design(design_diff):
assert new_design.loc[0, 'peak_caller'] == "bed"
@pytest.mark.acceptance
def test_overlap_peaks_singleend():
assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC.rejected.narrowPeak'))
peak_file = test_output_path + 'ENCSR238SGC.replicated.narrowPeak'
assert utils.count_lines(peak_file) == 150096
assert utils.count_lines(peak_file) == 150302
@pytest.mark.acceptance
def test_call_peaks_macs_pairedend():
# Do the same thing for paired end data
pass
......@@ -36,26 +36,31 @@ def design_experiment_3(design_experiment):
return design_experiment
@pytest.mark.unit
def test_check_replicates(design_experiment):
no_reps = pool_and_psuedoreplicate.check_replicates(design_experiment)
assert no_reps == 2
@pytest.mark.unit
def test_check_replicates_single(design_experiment_2):
no_reps = pool_and_psuedoreplicate.check_replicates(design_experiment_2)
assert no_reps == 1
@pytest.mark.unit
def test_check_controls(design_experiment):
no_controls = pool_and_psuedoreplicate.check_controls(design_experiment)
assert no_controls == 2
@pytest.mark.unit
def test_check_controls_single(design_experiment_3):
no_controls = pool_and_psuedoreplicate.check_controls(design_experiment_3)
assert no_controls == 1
@pytest.mark.acceptance
def test_pool_and_psuedoreplicate_single_end():
design_file = os.path.join(test_output_path, 'ENCSR238SGC_ppr.tsv')
assert os.path.exists(design_file)
......@@ -63,6 +68,7 @@ def test_pool_and_psuedoreplicate_single_end():
assert design_df.shape[0] == 5
@pytest.mark.acceptance
def test_experiment_design_paired_end():
# Do the same thing for paired end data
pass
......@@ -9,6 +9,8 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/trimReads/'
@pytest.mark.acceptance
def test_trim_reads_singleend():
raw_fastq = test_data_path + 'ENCFF833BLU.fastq.gz'
trimmed_fastq = test_output_path + 'ENCFF833BLU_trimmed.fq.gz'
......@@ -19,6 +21,7 @@ def test_trim_reads_singleend():
assert 'Trimming mode: single-end' in open(trimmed_fastq_report).readlines()[4]
@pytest.mark.acceptance
def test_trim_reads_pairedend():
# Do the same thing for paired end data
pass
......@@ -29,6 +29,7 @@ def steps_2(steps_1):
return steps_1
@pytest.mark.unit
def test_run_one_step(steps_1, capsys):
check_output = 'ENCLB144FDT\tENCSR238SGC\tlimb\tH3K4me1\tNone\t1\tENCLB304SBJ\tENCFF833BLU.fastq.gz'.encode('UTF-8')
out, err = utils.run_pipe(steps_1)
......@@ -37,6 +38,7 @@ def test_run_one_step(steps_1, capsys):
assert check_output in out
@pytest.mark.unit
def test_run_two_step(steps_2, capsys):
check_output = 'ENCFF833BLU.fastq.gz\nENCFF646LXU.fastq.gz'.encode('UTF-8')
out, err = utils.run_pipe(steps_2)
......@@ -45,6 +47,7 @@ def test_run_two_step(steps_2, capsys):
assert check_output in out
@pytest.mark.unit
def test_run_last_step_file(steps_2, capsys, tmpdir):
check_output = 'ENCFF833BLU.fastq.gz\nENCFF646LXU.fastq.gz'
tmp_outfile = tmpdir.join('output.txt')
......@@ -54,16 +57,19 @@ def test_run_last_step_file(steps_2, capsys, tmpdir):
assert check_output in tmp_outfile.read()
@pytest.mark.unit
def test_strip_extensions():
filename = utils.strip_extensions('ENCFF833BLU.fastq.gz', STRIP_EXTENSIONS)
assert filename == 'ENCFF833BLU'
@pytest.mark.unit
def test_strip_extensions_not_valid():
filename = utils.strip_extensions('ENCFF833BLU.not.valid', STRIP_EXTENSIONS)
assert filename == 'ENCFF833BLU.not.valid'
@pytest.mark.unit
def test_strip_extensions_missing_basename():
filename = utils.strip_extensions('.fastq.gz', STRIP_EXTENSIONS)
assert filename == '.fastq'
......@@ -8,6 +8,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/crossReads/'
@pytest.mark.acceptance
def test_convert_reads_singleend():
assert os.path.exists(os.path.join(test_output_path, 'ENCFF833BLU.filt.nodup.tagAlign.15.tagAlign.gz.cc.plot.pdf'))
qc_file = os.path.join(test_output_path,"ENCFF833BLU.filt.nodup.tagAlign.15.tagAlign.gz.cc.qc")
......@@ -17,6 +18,7 @@ def test_convert_reads_singleend():
assert df_xcor[9].iloc[0] == 1.266678
@pytest.mark.acceptance
def test_map_qc_pairedend():
# Do the same thing for paired end data
pass
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment