diff --git a/workflow/tests/test_annotate_peaks.py b/workflow/tests/test_annotate_peaks.py index 4608f6665ae051db36e0f8798649a29af6dfbb9e..5c676406e8fb7cf58fd463fa5f855d115f60f4a2 100644 --- a/workflow/tests/test_annotate_peaks.py +++ b/workflow/tests/test_annotate_peaks.py @@ -11,18 +11,33 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ @pytest.mark.singleend -def test_annotate_peaks_singleend(): +def test_pie_singleend(): assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC.chipseeker_pie.pdf')) + + +@pytest.mark.singleend +def test_upsetplot_singleend(): assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC.chipseeker_upsetplot.pdf')) + +@pytest.mark.singleend +def test_annotation_singleend(): annotation_file = test_output_path + 'ENCSR238SGC.chipseeker_annotation.tsv' assert os.path.exists(annotation_file) assert utils.count_lines(annotation_file) == 149820 @pytest.mark.pairedend -def test_annotate_peaks_pairedend(): +def test_pie_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCSR729LGA.chipseeker_pie.pdf')) + + +@pytest.mark.pairedend +def test_upsetplot_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCSR729LGA.chipseeker_upsetplot.pdf')) + + +@pytest.mark.pairedend +def test_annotation_pairedend(): annotation_file = test_output_path + 'ENCSR729LGA.chipseeker_annotation.tsv' assert os.path.exists(annotation_file) assert utils.count_lines(annotation_file) == 25579 diff --git a/workflow/tests/test_call_peaks_macs.py b/workflow/tests/test_call_peaks_macs.py index 628a91432a1bee6eea9e6529f6dd26e8f838180f..91c1d0e43460ed663d1c59bf6caa8ad800e8fd61 100644 --- a/workflow/tests/test_call_peaks_macs.py +++ b/workflow/tests/test_call_peaks_macs.py @@ -9,18 +9,42 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ @pytest.mark.singleend -def test_call_peaks_macs_singleend(): +def test_fc_signal_singleend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB144FDT.fc_signal.bw')) + + +@pytest.mark.singleend +def test_pvalue_signal_singleend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB144FDT.pvalue_signal.bw')) + + +@pytest.mark.singleend +def test_peaks_xls_singleend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB144FDT_peaks.xls')) + + +@pytest.mark.singleend +def test_peaks_bed_singleend(): peak_file = test_output_path + 'ENCLB144FDT.narrowPeak' assert utils.count_lines(peak_file) == 227389 @pytest.mark.pairedend -def test_call_peaks_macs_pairedend(): +def test_fc_signal_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX.fc_signal.bw')) + + +@pytest.mark.pairedend +def test_pvalue_signal_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX.pvalue_signal.bw')) + + +@pytest.mark.pairedend +def test_peaks_xls_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX_peak.xls')) + + +@pytest.mark.pairedend +def test_peaks_bed_pairedend(): peak_file = test_output_path + 'ENCLB568IYX.narrowPeak' assert utils.count_lines(peak_file) == 113821 diff --git a/workflow/tests/test_convert_reads.py b/workflow/tests/test_convert_reads.py index d1ef0454f02fec0cfc631d3477daa522d4bd2030..8dda74678d42c0049eb74caa205ad8b662772bb5 100644 --- a/workflow/tests/test_convert_reads.py +++ b/workflow/tests/test_convert_reads.py @@ -8,12 +8,20 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ @pytest.mark.singleend -def test_convert_reads_singleend(): +def test_tag_reads_singleend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB831RUI.tagAlign.gz')) + + +@pytest.mark.singleend +def test_bed_reads_singleend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB831RUI.bedse.gz')) @pytest.mark.pairedend -def test_map_qc_pairedend(): +def test_tag_reads_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX.tagAlign.gz')) + + +@pytest.mark.pairedend +def test_bed_reads_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX.bedpe.gz')) diff --git a/workflow/tests/test_diff_peaks.py b/workflow/tests/test_diff_peaks.py index 59b1e3a27d774a1b1a2ef648369c2c3385cff97f..84c5179f021abd676a818ac24e698b54bd7b648d 100644 --- a/workflow/tests/test_diff_peaks.py +++ b/workflow/tests/test_diff_peaks.py @@ -15,14 +15,26 @@ def test_diff_peaks_singleend_single_rep(): assert os.path.isdir(test_output_path) == False @pytest.mark.pairedend -def test_annotate_peaks_pairedend_single_rep(): +def test_diff_peaks_pairedend_single_rep(): assert os.path.isdir(test_output_path) == False @pytest.mark.singlediff -def test_diff_peaks_singleend_multiple_rep(): +def test_heatmap_singleend_multiple_rep(): assert os.path.exists(os.path.join(test_output_path, 'heatmap.pdf')) + + +@pytest.mark.singlediff +def test_pca_singleend_multiple_rep(): assert os.path.exists(os.path.join(test_output_path, 'pca.pdf')) + + +@pytest.mark.singlediff +def test_normcount_singleend_multiple_rep(): assert os.path.exists(os.path.join(test_output_path, 'normcount_peaksets.txt')) + + +@pytest.mark.singlediff +def test_diffbind_singleend_multiple_rep(): if os.path.isfile(os.path.join(test_output_path, 'ENCSR272GNQ_vs_ENCSR238SGC_diffbind.bed')): 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' @@ -32,11 +44,24 @@ def test_diff_peaks_singleend_multiple_rep(): assert os.path.exists(diffbind_file) assert utils.count_lines(diffbind_file) == 201039 + @pytest.mark.paireddiff -def test_annotate_peaks_pairedend_single_rep(): +def test_heatmap_pairedend_single_rep(): assert os.path.exists(os.path.join(test_output_path, 'heatmap.pdf')) + + +@pytest.mark.paireddiff +def test_pca_pairedend_single_rep(): assert os.path.exists(os.path.join(test_output_path, 'pca.pdf')) + + +@pytest.mark.paireddiff +def test_normcount_pairedend_single_rep(): assert os.path.exists(os.path.join(test_output_path, 'normcount_peaksets.txt')) + + +@pytest.mark.paireddiff +def test_diffbind_pairedend_single_rep(): if os.path.isfile(os.path.join(test_output_path, 'ENCSR757EMK_vs_ENCSR729LGA_diffbind.bed')): assert os.path.exists(os.path.join(test_output_path, 'ENCSR757EMK_vs_ENCSR729LGA_diffbind.bed')) diffbind_file = test_output_path + 'ENCSR757EMK_vs_ENCSR729LGA_diffbind.csv' diff --git a/workflow/tests/test_experiment_qc.py b/workflow/tests/test_experiment_qc.py index 5256da5fbebc424ea29a1977d9257bfc95060ae3..98853b9d6c2eabc4e4b9887cfb51c07a6af08fa4 100644 --- a/workflow/tests/test_experiment_qc.py +++ b/workflow/tests/test_experiment_qc.py @@ -31,17 +31,34 @@ def test_check_update_controls(design_bam): @pytest.mark.singleend -def test_experiment_qc_singleend(): +def test_coverage_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')) assert os.path.exists(os.path.join(test_output_path, 'coverage.png')) + + +@pytest.mark.singleend +def test_spearman_singleend(): + assert os.path.exists(os.path.join(test_output_path, 'heatmap_SpearmanCorr.png')) + + +@pytest.mark.singleend +def test_fingerprint_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.pairdend -def test_experiment_qc_pairedend(): +def test_coverage_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')) assert os.path.exists(os.path.join(test_output_path, 'coverage.png')) + + +@pytest.mark.pairdend +def test_spearman_pairedend(): + assert os.path.exists(os.path.join(test_output_path, 'heatmap_SpearmanCorr.png')) + + +@pytest.mark.pairdend +def test_fingerprint_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX_fingerprint.png')) assert os.path.exists(os.path.join(test_output_path, 'ENCLB637LZP_fingerprint.png')) diff --git a/workflow/tests/test_map_qc.py b/workflow/tests/test_map_qc.py index 1c0d23ec0f500c2416efbd41c5ee9986726c616f..f292559871fef4d5fd33f242cb78af10c7cfae37 100644 --- a/workflow/tests/test_map_qc.py +++ b/workflow/tests/test_map_qc.py @@ -9,14 +9,22 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ @pytest.mark.singleend -def test_map_qc_singleend(): +def test_dedup_files_singleend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB831RUI.dedup.bam')) assert os.path.exists(os.path.join(test_output_path, 'ENCLB831RUI.dedup.bam.bai')) assert os.path.exists(os.path.join(test_output_path, 'ENCLB831RUI.dedup.qc')) + + +@pytest.mark.singleend +def test_map_qc_singleend(): filtered_reads_report = test_output_path + 'ENCLB831RUI.dedup.flagstat.qc' samtools_report = open(filtered_reads_report).readlines() assert '64962570 + 0 in total' in samtools_report[0] assert '64962570 + 0 mapped (100.00%:N/A)' in samtools_report[4] + + +@pytest.mark.singleend +def test_library_complexity_singleend(): library_complexity = test_output_path + 'ENCLB831RUI.pbc.qc' df_library_complexity = pd.read_csv(library_complexity, sep='\t') assert df_library_complexity["NRF"].iloc[0] == 0.926192 @@ -25,14 +33,22 @@ def test_map_qc_singleend(): @pytest.mark.pairedend -def test_map_qc_pairedend(): +def test_dedup_files_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX.dedup.bam')) assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX.dedup.bam.bai')) assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX.dedup.qc')) + + +@pytest.mark.pairedend +def test_map_qc_pairedend(): filtered_reads_report = test_output_path + 'ENCLB568IYX.dedup.flagstat.qc' samtools_report = open(filtered_reads_report).readlines() assert '47388510 + 0 in total' in samtools_report[0] assert '47388510 + 0 mapped (100.00%:N/A)' in samtools_report[4] + + +@pytest.mark.pairedend +def test_library_complexity_pairedend(): library_complexity = test_output_path + 'ENCLB568IYX.pbc.qc' df_library_complexity = pd.read_csv(library_complexity, sep='\t') assert df_library_complexity["NRF"].iloc[0] == 0.947064 diff --git a/workflow/tests/test_motif_search.py b/workflow/tests/test_motif_search.py index 09b4ca949df62603f68807bc016b076f9baff68f..8c1265211b87da7d006b9020087ce04994889fd0 100644 --- a/workflow/tests/test_motif_search.py +++ b/workflow/tests/test_motif_search.py @@ -11,17 +11,26 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ @pytest.mark.singleend -def test_motif_search_singleend(): - assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC_memechip', 'ENCSR238SGC.fa')) - assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC_memechip', 'index.html')) +def test_limited_peaks_singleend(): peak_file_ENCSR238SGC = test_output_path + 'ENCSR238SGC.600.narrowPeak' assert os.path.exists(peak_file_ENCSR238SGC) assert utils.count_lines(peak_file_ENCSR238SGC) == 600 + +@pytest.mark.singleend +def test_motif_search_singleend(): + assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC_memechip', 'ENCSR238SGC.fa')) + assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC_memechip', 'index.html')) + + @pytest.mark.pairedend -def test_motif_search_pairedend(): - assert os.path.exists(os.path.join(test_output_path, 'ENCSR729LGA_memechip', 'ENCSR729LGA.fa')) - assert os.path.exists(os.path.join(test_output_path, 'ENCSR729LGA_memechip', 'index.html')) +def test_limited_peaks_pairedend(): peak_file_ENCSR729LGA= test_output_path + 'ENCSR729LGA.600.narrowPeak' assert os.path.exists(peak_file_ENCSR729LGA) assert utils.count_lines(peak_file_ENCSR729LGA) == 600 + + +@pytest.mark.pairedend +def test_motif_search_pairedend(): + assert os.path.exists(os.path.join(test_output_path, 'ENCSR729LGA_memechip', 'ENCSR729LGA.fa')) + assert os.path.exists(os.path.join(test_output_path, 'ENCSR729LGA_memechip', 'index.html')) diff --git a/workflow/tests/test_trim_reads.py b/workflow/tests/test_trim_reads.py index dd3f779152fa15919cfa497a9d4e71c185c6d3c9..449b5fd872ad21e079ae1b13e9bbfd4458f72182 100644 --- a/workflow/tests/test_trim_reads.py +++ b/workflow/tests/test_trim_reads.py @@ -14,6 +14,10 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ def test_trim_reads_singleend(): raw_fastq = test_data_path + 'ENCFF833BLU.fastq.gz' trimmed_fastq = test_output_path + 'ENCLB144FDT_R1_trimmed.fq.gz' + + +@pytest.mark.singleend +def test_trim_report_singleend(): trimmed_fastq_report = test_output_path + \ 'ENCLB144FDT_R1_trimmed.fq.gz_trimming_report.txt' assert os.path.getsize(raw_fastq) != os.path.getsize(trimmed_fastq) @@ -25,6 +29,10 @@ def test_trim_reads_singleend(): def test_trim_reads_pairedend(): raw_fastq = test_data_path + 'ENCFF582IOZ.fastq.gz' trimmed_fastq = test_output_path + 'ENCLB637LZP_R2_val_2.fq.gz' + + +@pytest.mark.pairedend +def test_trim_report_pairedend(): trimmed_fastq_report = test_output_path + \ 'ENCLB637LZP_R2.fastq.gz_trimming_report.txt' assert os.path.getsize(raw_fastq) != os.path.getsize(trimmed_fastq) diff --git a/workflow/tests/test_xcor.py b/workflow/tests/test_xcor.py index c408c9810ed8744298f07fb14c9a2aab73309e4a..259ecfb1f82ce80e79ee14539c4bb603bb5ddfb4 100644 --- a/workflow/tests/test_xcor.py +++ b/workflow/tests/test_xcor.py @@ -9,8 +9,12 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ @pytest.mark.singleend -def test_cross_singleend(): +def test_cross_plot_singleend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB144FDT.cc.plot.pdf')) + + +@pytest.mark.singleend +def test_cross_qc_singleend(): qc_file = os.path.join(test_output_path,"ENCLB144FDT.cc.qc") df_xcor = pd.read_csv(qc_file, sep="\t", header=None) assert df_xcor[2].iloc[0] == '190,200,210' @@ -19,8 +23,12 @@ def test_cross_singleend(): @pytest.mark.pairedend -def test_cross_pairedend(): +def test_cross_qc_pairedend(): assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX.cc.plot.pdf')) + + +@pytest.mark.pairedend +def test_cross_plot_pairedend(): qc_file = os.path.join(test_output_path,"ENCLB568IYX.cc.qc") df_xcor = pd.read_csv(qc_file, sep="\t", header=None) assert df_xcor[2].iloc[0] == '220,430,475'