diff --git a/workflow/scripts/pool_and_psuedoreplicate.py b/workflow/scripts/pool_and_psuedoreplicate.py index 04ce605b21505f1ca6aa72757e6b7efd73970f51..ea454da3bcb8f609595fc70eb91a453b0e23c369 100644 --- a/workflow/scripts/pool_and_psuedoreplicate.py +++ b/workflow/scripts/pool_and_psuedoreplicate.py @@ -99,6 +99,20 @@ def pool(tag_files, outfile, paired): return pooled_filename +def bedpe_to_tagalign(tag_file, outfile): + '''Convert read pairs to reads into standard tagAlign file.''' + + se_tag_filename = outfile + ".tagAlign.gz" + + # Convert read pairs to reads into standard tagAlign file + tag_steps = ["zcat -f %s" % (tag_file)] + tag_steps.extend([r"""awk 'BEGIN{OFS="\t"}{printf "%s\t%s\t%s\tN\t1000\t%s\n%s\t%s\t%s\tN\t1000\t%s\n",$1,$2,$3,$9,$4,$5,$6,$10}'"""]) + tag_steps.extend(['gzip -cn']) + out, err = utils.run_pipe(tag_steps, outfile=se_tag_filename) + + return se_tag_filename + + def self_psuedoreplication(tag_file, prefix, paired): '''Make 2 self-psuedoreplicates.''' diff --git a/workflow/tests/test_pool_and_psuedoreplicate.py b/workflow/tests/test_pool_and_psuedoreplicate.py index 0a6c899d88fd18f60df8077f45ee6110ac4c0180..f969dfcb6f819e8d41d2792fb33e7c8c1ab6587c 100644 --- a/workflow/tests/test_pool_and_psuedoreplicate.py +++ b/workflow/tests/test_pool_and_psuedoreplicate.py @@ -46,7 +46,7 @@ def test_pool_and_psuedoreplicate_singleend_human(): design_file = os.path.join(test_output_path, 'ENCSR265ZXX_ppr.tsv') assert os.path.exists(design_file) design_df = pd.read_csv(design_file, sep="\t") - assert design_df.shape[0] == 7 + assert design_df.shape[0] == 6 @pytest.mark.pairedend_mouse @@ -59,4 +59,4 @@ def test_pool_and_psuedoreplicate_pairedend_mouse(): design_file = os.path.join(test_output_path, 'ENCSR451NAE_ppr.tsv') assert os.path.exists(design_file) design_df = pd.read_csv(design_file, sep="\t") - assert design_df.shape[0] == 6 + assert design_df.shape[0] == 5 diff --git a/workflow/tests/test_xcor.py b/workflow/tests/test_xcor.py index 7e837afff321af6694253d62f15c0ba4e81b54a2..1b6418f5942e3083d1ab2ab939bab6a68efc1227 100644 --- a/workflow/tests/test_xcor.py +++ b/workflow/tests/test_xcor.py @@ -17,9 +17,9 @@ def test_cross_plot_singleend_human(): def test_cross_qc_singleend_human(): qc_file = os.path.join(test_output_path,"ENCLB622FZX/ENCLB622FZX.cc.qc") df_xcor = pd.read_csv(qc_file, sep="\t", header=None) - assert df_xcor[2].iloc[0] == '0' - assert df_xcor[8].iloc[0] == 1.347895 - assert df_xcor[9].iloc[0] == 1.970438 + assert df_xcor[2].iloc[0] == 0 + assert round(df_xcor[8].iloc[0],6) == 1.332028 + assert df_xcor[9].iloc[0] == 2.152459 @pytest.mark.pairedend_mouse