diff --git a/workflow/tests/test_overlap_peaks.py b/workflow/tests/test_overlap_peaks.py new file mode 100644 index 0000000000000000000000000000000000000000..6305d3793c0100b9449771c164ec0e3e5b08071d --- /dev/null +++ b/workflow/tests/test_overlap_peaks.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 + +import pytest +import pandas as pd +from io import StringIO +import os +import overlap_peaks + +test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ + '/../output/consensusPeaks/' + +DESIGN_STRING = """sample_id\tbam_reads\tbam_index\texperiment_id\tbiosample\tfactor\ttreatment\treplicate\tcontrol_id +A_1\tA_1.bam\tA_1.bai\tA\tLiver\tH3K27ac\tNone\t1\tB_1 +A_2\tA_2.bam\tA_2.bai\tA\tLiver\tH3K27ac\tNone\t2\tB_2 +B_1\tB_1.bam\tB_1.bai\tB\tLiver\tH3K27ac\tNone\t1\tB_1 +B_2\tB_2.bam\tB_2.bai\tB\tLiver\tH3K27ac\tNone\t2\tB_2 +""" + + +@pytest.fixture +def design_diff(): + design_file = StringIO(DESIGN_STRING) + design_df = pd.read_csv(design_file, sep="\t") + return design_df + + +def test_check_update_design(design_diff): + new_design = overlap_peaks.update_design(design_diff) + assert df.shape[0] == 2 + assert new_design.loc[0, 'control_bam_reads'] == "B_1.bam" + assert new_design.loc[0, 'peak_caller'] == "bed" + + +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' + + +def test_call_peaks_macs_pairedend(): + # Do the same thing for paired end data + pass