Skip to content
Snippets Groups Projects
Commit ef9a113d authored by Jeremy Mathews's avatar Jeremy Mathews
Browse files

Update tests for xcor change

parent c505f1cb
No related merge requests found
...@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. ...@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
- Add and Update tests - Add and Update tests
- Use GTF files instead of TxDb and org libraries in Annotate Peaks - Use GTF files instead of TxDb and org libraries in Annotate Peaks
- Make gtf and geneName files as param inputs - Make gtf and geneName files as param inputs
- Fix xcor to increase file size for --random-source
## [publish_1.0.6 ] - 2019-05-31 ## [publish_1.0.6 ] - 2019-05-31
### Added ### Added
......
...@@ -107,10 +107,16 @@ def xcor(tag, paired): ...@@ -107,10 +107,16 @@ def xcor(tag, paired):
subsampled_tag_filename = \ subsampled_tag_filename = \
tag_basename + ".%d.tagAlign.gz" % (number_reads/1000000) tag_basename + ".%d.tagAlign.gz" % (number_reads/1000000)
tag_extended = 'cat.tagAlign.gz'
out, err = utils.run_pipe([
"zcat %s %s %s" %
(tag, tag, tag)
], outfile=tag_extended)
steps = [ steps = [
'zcat %s' % (tag), 'zcat %s' % (tag),
'grep -v "chrM"', 'grep -v "chrM"',
'shuf -n %d --random-source=%s' % (number_reads, tag)] 'shuf -n %d --random-source=%s' % (number_reads, tag_extended)]
if paired: if paired:
steps.extend([r"""awk 'BEGIN{OFS="\t"}{$4="N";$5="1000";print $0}'"""]) steps.extend([r"""awk 'BEGIN{OFS="\t"}{$4="N";$5="1000";print $0}'"""])
......
...@@ -26,7 +26,7 @@ def test_peaks_xls_singleend(): ...@@ -26,7 +26,7 @@ def test_peaks_xls_singleend():
@pytest.mark.singleend @pytest.mark.singleend
def test_peaks_bed_singleend(): def test_peaks_bed_singleend():
peak_file = test_output_path + 'ENCSR238SGC/1/' + 'ENCLB144FDT.narrowPeak' peak_file = test_output_path + 'ENCSR238SGC/1/' + 'ENCLB144FDT.narrowPeak'
assert utils.count_lines(peak_file) == 227389 assert utils.count_lines(peak_file) == 199317
@pytest.mark.pairedend @pytest.mark.pairedend
......
...@@ -71,4 +71,4 @@ def test_diffbind_pairedend_single_rep(): ...@@ -71,4 +71,4 @@ def test_diffbind_pairedend_single_rep():
assert os.path.exists(os.path.join(test_output_path, 'ENCSR729LGA_vs_ENCSR757EMK_diffbind.bed')) 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' diffbind_file = test_output_path + 'ENCSR729LGA_vs_ENCSR757EMK_diffbind.csv'
assert os.path.exists(diffbind_file) assert os.path.exists(diffbind_file)
assert utils.count_lines(diffbind_file) >= 66201 assert utils.count_lines(diffbind_file) >= 65182
...@@ -17,9 +17,9 @@ def test_cross_plot_singleend(): ...@@ -17,9 +17,9 @@ def test_cross_plot_singleend():
def test_cross_qc_singleend(): def test_cross_qc_singleend():
qc_file = os.path.join(test_output_path,"ENCLB144FDT/ENCLB144FDT.cc.qc") qc_file = os.path.join(test_output_path,"ENCLB144FDT/ENCLB144FDT.cc.qc")
df_xcor = pd.read_csv(qc_file, sep="\t", header=None) df_xcor = pd.read_csv(qc_file, sep="\t", header=None)
assert df_xcor[2].iloc[0] == '190,200,210' assert df_xcor[2].iloc[0] == '220,240,255'
assert df_xcor[8].iloc[0] == 1.025906 assert df_xcor[8].iloc[0] == 1.024935
assert round(df_xcor[9].iloc[0], 6) == 1.139671 assert round(df_xcor[9].iloc[0], 6) == 0.697252
@pytest.mark.pairedend @pytest.mark.pairedend
...@@ -31,6 +31,6 @@ def test_cross_qc_pairedend(): ...@@ -31,6 +31,6 @@ def test_cross_qc_pairedend():
def test_cross_plot_pairedend(): def test_cross_plot_pairedend():
qc_file = os.path.join(test_output_path,"ENCLB568IYX/ENCLB568IYX.cc.qc") qc_file = os.path.join(test_output_path,"ENCLB568IYX/ENCLB568IYX.cc.qc")
df_xcor = pd.read_csv(qc_file, sep="\t", header=None) df_xcor = pd.read_csv(qc_file, sep="\t", header=None)
assert df_xcor[2].iloc[0] == '220,430,475' assert df_xcor[2].iloc[0] == '220,420,450'
assert round(df_xcor[8].iloc[0],6) == 1.060018 assert round(df_xcor[8].iloc[0],6) == 1.058694
assert df_xcor[9].iloc[0] == 4.099357 assert df_xcor[9].iloc[0] == 3.004596
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