diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 99d55cbc6fe1073e9f7e1cd98005aa2cd89295df..60a430b8ca42df54100f950d9e52cf3daafda7a8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,7 +35,7 @@ single_end_diff: stage: integration script: - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_diff_SE.txt" --genome 'GRCm38' -resume - - pytest -m pairedend + - pytest -m singlediff - pytest --cov=./workflow/scripts artifacts: expire_in: 2 days @@ -44,7 +44,7 @@ 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 -resume - - pytest -m pairedend + - pytest -m paireddiff - pytest --cov=./workflow/scripts artifacts: expire_in: 2 days diff --git a/workflow/tests/test_diff_peaks.py b/workflow/tests/test_diff_peaks.py new file mode 100644 index 0000000000000000000000000000000000000000..6b4a6ed272f2ef8ad530a600aee52745da9e2656 --- /dev/null +++ b/workflow/tests/test_diff_peaks.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 + +import pytest +import pandas as pd +from io import StringIO +import os +import utils + +test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ + '/../output/diffPeaks/' + + +@pytest.mark.singleend +def test_diff_peaks_singleend_single_rep(): + assert os.path.exists(os.path.join(test_output_path, 'no_diffbind.bed')) + assert os.path.exists(os.path.join(test_output_path, 'no_diffbind.csv')) + assert os.path.exists(os.path.join(test_output_path, 'no_heatmap.pdf')) + assert os.path.exists(os.path.join(test_output_path, 'no_pca.pdf')) + assert os.path.exists(os.path.join(test_output_path, 'normcount_peaksets.pdf')) + + +@pytest.mark.pairedend +def test_annotate_peaks_pairedend_single_rep(): + assert os.path.exists(os.path.join(test_output_path, 'no_diffbind.bed')) + assert os.path.exists(os.path.join(test_output_path, 'no_diffbind.csv')) + assert os.path.exists(os.path.join(test_output_path, 'no_heatmap.pdf')) + assert os.path.exists(os.path.join(test_output_path, 'no_pca.pdf')) + assert os.path.exists(os.path.join(test_output_path, 'normcount_peaksets.pdf')) + +@pytest.mark.singlediff +def test_diff_peaks_singleend_multiple_rep(): + assert os.path.exists(os.path.join(test_output_path, 'heatmap.pdf')) + assert os.path.exists(os.path.join(test_output_path, 'pca.pdf')) + assert os.path.exists(os.path.join(test_output_path, 'normcount_peaksets.txt')) + assert os.path.exists(os.path.join(test_output_path, 'ENCSR272GNQ_vs_ENCSR238SGC_diffbind.bed')) + diffbind_file = test_output_path + 'ENCSR272GNQ_vs_ENCSR238SGC_diffbind.csv' + assert os.path.exists(diffbind_file) + assert utils.count_lines(diffbind_file) == 201039 + +@pytest.mark.paireddiff +def test_annotate_peaks_pairedend_single_rep(): + assert os.path.exists(os.path.join(test_output_path, 'heatmap.pdf')) + assert os.path.exists(os.path.join(test_output_path, 'pca.pdf')) + assert os.path.exists(os.path.join(test_output_path, 'normcount_peaksets.txt')) + assert os.path.exists(os.path.join(test_output_path, 'ENCSR729LGA_vs_ENCSR757EMK_diffbind.bed')) + diffbind_file = test_output_path + 'ENCSR729LGA_vs_ENCSR757EMK_diffbind.csv' + assert os.path.exists(diffbind_file) + assert utils.count_lines(diffbind_file) == 112652