From c508559bf4b80849bd2975512681df59d5c247cf Mon Sep 17 00:00:00 2001 From: Venkat Malladi <venkat.malladi@utsouthwestern.edu> Date: Thu, 27 Dec 2018 08:17:21 -0600 Subject: [PATCH] Fix tests so they run on single end and paired end. --- .gitlab-ci.yml | 14 ++++++++++---- workflow/tests/test_annotate_peaks.py | 4 ++-- workflow/tests/test_call_peaks_macs.py | 4 ++-- workflow/tests/test_convert_reads.py | 4 ++-- workflow/tests/test_experiment_design.py | 8 ++++---- workflow/tests/test_experiment_qc.py | 4 ++-- workflow/tests/test_map_qc.py | 4 ++-- workflow/tests/test_map_reads.py | 4 ++-- workflow/tests/test_overlap_peaks.py | 4 ++-- workflow/tests/test_pool_and_psuedoreplicate.py | 8 ++++---- workflow/tests/test_trim_reads.py | 5 ++--- workflow/tests/test_xcor.py | 4 ++-- 12 files changed, 36 insertions(+), 31 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cc3b607..99d55cb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,7 @@ single_end_mouse: stage: integration script: - nextflow run workflow/main.nf -resume - - pytest -m integration + - pytest -m singleend - pytest --cov=./workflow/scripts artifacts: expire_in: 2 days @@ -25,20 +25,26 @@ single_end_mouse: paired_end_human: stage: integration script: - - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_ENCSR729LGA_PE.txt" --genome 'GRCh38' --pairedEnd true + - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_ENCSR729LGA_PE.txt" --genome 'GRCh38' --pairedEnd true -resume + - pytest -m pairedend + - pytest --cov=./workflow/scripts artifacts: expire_in: 2 days single_end_diff: stage: integration script: - - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_diff_SE.txt" --genome 'GRCm38' + - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_diff_SE.txt" --genome 'GRCm38' -resume + - pytest -m pairedend + - pytest --cov=./workflow/scripts artifacts: expire_in: 2 days paired_end_diff: stage: integration script: - - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_diff_PE.txt" --genome 'GRCh38' --pairedEnd true + - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_diff_PE.txt" --genome 'GRCh38' --pairedEnd true -resume + - pytest -m pairedend + - pytest --cov=./workflow/scripts artifacts: expire_in: 2 days diff --git a/workflow/tests/test_annotate_peaks.py b/workflow/tests/test_annotate_peaks.py index 01152c8..2603c36 100644 --- a/workflow/tests/test_annotate_peaks.py +++ b/workflow/tests/test_annotate_peaks.py @@ -17,7 +17,7 @@ B_2\tB_2.bam\tB_2.bai\tB\tLiver\tH3K27ac\tNone\t2\tB_2 """ -@pytest.mark.integration +@pytest.mark.singleend def test_annotate_peaks_singleend(): assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC.chipseeker_pie.pdf')) assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC.chipseeker_pie.pdf')) @@ -27,7 +27,7 @@ def test_annotate_peaks_singleend(): assert utils.count_lines(annotation_file) == 152839 -@pytest.mark.integration +@pytest.mark.pairedend def test_annotate_peaks_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCSR217LRF.chipseeker_pie.pdf')) assert os.path.exists(os.path.join(test_output_path, 'ENCSR217LRF.chipseeker_pie.pdf')) diff --git a/workflow/tests/test_call_peaks_macs.py b/workflow/tests/test_call_peaks_macs.py index cba14bf..a0792c6 100644 --- a/workflow/tests/test_call_peaks_macs.py +++ b/workflow/tests/test_call_peaks_macs.py @@ -8,7 +8,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ '/../output/callPeaksMACS/' -@pytest.mark.integration +@pytest.mark.singleend 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')) @@ -16,7 +16,7 @@ def test_call_peaks_macs_singleend(): assert utils.count_lines(peak_file) == 210349 -@pytest.mark.integration +@pytest.mark.pairedend def test_call_peaks_macs_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX.fc_signal.bw')) assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX.pvalue_signal.bw')) diff --git a/workflow/tests/test_convert_reads.py b/workflow/tests/test_convert_reads.py index 52f3fa4..ff8a003 100644 --- a/workflow/tests/test_convert_reads.py +++ b/workflow/tests/test_convert_reads.py @@ -7,13 +7,13 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ '/../output/convertReads/' -@pytest.mark.integration +@pytest.mark.singleend 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 +@pytest.mark.pairedend def test_map_qc_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCFF293YFE_val_2ENCFF330MCZ_val_1.filt.nodup.tagAlign.gz')) assert os.path.exists(os.path.join(test_output_path, 'ENCFF293YFE_val_2ENCFF330MCZ_val_1.filt.nodup.bedpe.gz')) diff --git a/workflow/tests/test_experiment_design.py b/workflow/tests/test_experiment_design.py index 1679018..3efcca0 100644 --- a/workflow/tests/test_experiment_design.py +++ b/workflow/tests/test_experiment_design.py @@ -30,16 +30,16 @@ def test_check_update_controls_tag(design_tag): assert new_design.loc[0, 'control_tag_align'] == "B_1.tagAlign.gz" -@pytest.mark.integration -def test_experiment_design_single_end(): +@pytest.mark.singleend +def test_experiment_design_singleend(): design_file = os.path.join(test_output_path, 'ENCSR238SGC.tsv') assert os.path.exists(design_file) design_df = pd.read_csv(design_file, sep="\t") assert design_df.shape[0] == 2 -@pytest.mark.integration -def test_experiment_design_paired_end(): +@pytest.mark.pairedend +def test_experiment_design_pairedend(): design_file = os.path.join(test_output_path, 'ENCSR729LGA.tsv') assert os.path.exists(design_file) design_df = pd.read_csv(design_file, sep="\t") diff --git a/workflow/tests/test_experiment_qc.py b/workflow/tests/test_experiment_qc.py index 308ebe2..5256da5 100644 --- a/workflow/tests/test_experiment_qc.py +++ b/workflow/tests/test_experiment_qc.py @@ -30,7 +30,7 @@ def test_check_update_controls(design_bam): assert new_design.loc[0, 'control_reads'] == "B_1.bam" -@pytest.mark.integration +@pytest.mark.singleend 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')) @@ -38,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.integration +@pytest.mark.pairdend def test_experiment_qc_pairedend(): 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')) diff --git a/workflow/tests/test_map_qc.py b/workflow/tests/test_map_qc.py index f2c4e74..78e3b39 100644 --- a/workflow/tests/test_map_qc.py +++ b/workflow/tests/test_map_qc.py @@ -8,7 +8,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ '/../output/filterReads/' -@pytest.mark.integration +@pytest.mark.singleend 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')) @@ -23,7 +23,7 @@ def test_map_qc_singleend(): assert df_library_complexity["PBC2"].iloc[0] == 13.706885 -@pytest.mark.integration +@pytest.mark.pairedend def test_map_qc_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCFF293YFE_val_2ENCFF330MCZ_val_1.filt.nodup.bam')) assert os.path.exists(os.path.join(test_output_path, 'ENCFF293YFE_val_2ENCFF330MCZ_val_1.filt.nodup.bambai')) diff --git a/workflow/tests/test_map_reads.py b/workflow/tests/test_map_reads.py index 54948bf..3288582 100644 --- a/workflow/tests/test_map_reads.py +++ b/workflow/tests/test_map_reads.py @@ -7,7 +7,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ '/../output/alignReads/' -@pytest.mark.integration +@pytest.mark.singleend 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' @@ -16,7 +16,7 @@ def test_map_reads_singleend(): assert '80050072 + 0 mapped (99.08% : N/A)' in samtools_report[4] -@pytest.mark.integration +@pytest.mark.pairedend def test_map_reads_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCFF002DTU_val_1ENCFF002EFI_val_2.srt.bam')) aligned_reads_report = test_output_path + 'ENCFF002DTU_val_1ENCFF002EFI_val_2.srt.bam.flagstat.qc' diff --git a/workflow/tests/test_overlap_peaks.py b/workflow/tests/test_overlap_peaks.py index ce83540..a239b41 100644 --- a/workflow/tests/test_overlap_peaks.py +++ b/workflow/tests/test_overlap_peaks.py @@ -33,14 +33,14 @@ def test_check_update_design(design_diff): assert new_design.loc[0, 'peak_caller'] == "bed" -@pytest.mark.integration +@pytest.mark.singleend 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) == 150302 -@pytest.mark.integration +@pytest.mark.pairedend def test_overlap_peaks_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCSR729LGA.rejected.narrowPeak')) peak_file = test_output_path + 'ENCSR729LGA.replicated.narrowPeak' diff --git a/workflow/tests/test_pool_and_psuedoreplicate.py b/workflow/tests/test_pool_and_psuedoreplicate.py index ed4bb80..31fffc5 100644 --- a/workflow/tests/test_pool_and_psuedoreplicate.py +++ b/workflow/tests/test_pool_and_psuedoreplicate.py @@ -60,16 +60,16 @@ def test_check_controls_single(design_experiment_3): assert no_controls == 1 -@pytest.mark.integration -def test_pool_and_psuedoreplicate_single_end(): +@pytest.mark.singleend +def test_pool_and_psuedoreplicate_singleend(): design_file = os.path.join(test_output_path, 'ENCSR238SGC_ppr.tsv') assert os.path.exists(design_file) design_df = pd.read_csv(design_file, sep="\t") assert design_df.shape[0] == 5 -@pytest.mark.integration -def test_experiment_design_paired_end(): +@pytest.mark.pairedend +def test_experiment_design_pairedend(): design_file = os.path.join(test_output_path, 'ENCSR729LGA_ppr.tsv') assert os.path.exists(design_file) design_df = pd.read_csv(design_file, sep="\t") diff --git a/workflow/tests/test_trim_reads.py b/workflow/tests/test_trim_reads.py index f759245..b925627 100644 --- a/workflow/tests/test_trim_reads.py +++ b/workflow/tests/test_trim_reads.py @@ -10,7 +10,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ -@pytest.mark.integration +@pytest.mark.singleend def test_trim_reads_singleend(): raw_fastq = test_data_path + 'ENCFF833BLU.fastq.gz' trimmed_fastq = test_output_path + 'ENCFF833BLU_trimmed.fq.gz' @@ -21,7 +21,7 @@ def test_trim_reads_singleend(): assert 'Trimming mode: single-end' in open(trimmed_fastq_report).readlines()[4] -@pytest.mark.integration +@pytest.mark.pairedend def test_trim_reads_pairedend(): raw_fastq = test_data_path + 'ENCFF582IOZ.fastq.gz' trimmed_fastq = test_output_path + ' ENCFF582IOZ_val_2.fq.gz' @@ -30,4 +30,3 @@ def test_trim_reads_pairedend(): assert os.path.getsize(raw_fastq) != os.path.getsize(trimmed_fastq) assert os.path.getsize(trimmed_fastq) == 2229312710 assert 'Trimming mode: paired-end' in open(trimmed_fastq_report).readlines()[4] - diff --git a/workflow/tests/test_xcor.py b/workflow/tests/test_xcor.py index 87e0304..0c27795 100644 --- a/workflow/tests/test_xcor.py +++ b/workflow/tests/test_xcor.py @@ -8,7 +8,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ '/../output/crossReads/' -@pytest.mark.integration +@pytest.mark.singleend 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") @@ -18,7 +18,7 @@ def test_convert_reads_singleend(): assert df_xcor[9].iloc[0] == 1.266678 -@pytest.mark.integration +@pytest.mark.pairedend def test_map_qc_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCFF582IOZ_val_2ENCFF957SQS_val_1.filt.nodup.tagAlign.15.tagAlign.gz.cc.plot.pdf')) qc_file = os.path.join(test_output_path,"ENCFF582IOZ_val_2ENCFF957SQS_val_1.filt.nodup.tagAlign.15.tagAlign.gz.cc.qc") -- GitLab