Skip to content
Snippets Groups Projects
Commit 0bd2c988 authored by Venkat Malladi's avatar Venkat Malladi
Browse files

Split tests to make more readable.

parent 89340f9c
Branches
Tags
No related merge requests found
......@@ -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
......@@ -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
......@@ -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'))
......@@ -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'
......
......@@ -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'))
......@@ -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
......
......@@ -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'))
......@@ -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)
......
......@@ -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'
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment