From d84a3b62089c24a748e1297065456b1807f15e3b Mon Sep 17 00:00:00 2001 From: Venkat Malladi <venkat.malladi@utsouthwestern.edu> Date: Thu, 27 Dec 2018 08:29:15 -0600 Subject: [PATCH] Check differential peaks. --- .gitlab-ci.yml | 4 +-- workflow/tests/test_diff_peaks.py | 48 +++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 workflow/tests/test_diff_peaks.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 99d55cb..60a430b 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 0000000..6b4a6ed --- /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 -- GitLab