diff --git a/workflow/.DS_Store b/workflow/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..1cfdf47763f95697736ca7303755f243846e9ca2 Binary files /dev/null and b/workflow/.DS_Store differ diff --git a/workflow/main.nf b/workflow/main.nf index 29afb260c8dee81e663e4031fbf6625398eaa321..6c69edad2ea2dd0dc0af40c704c0e15ff974c932 100644 --- a/workflow/main.nf +++ b/workflow/main.nf @@ -198,7 +198,7 @@ process experimentQC { output: - file '*.{png,npz}' into deepToolsStats + file '*.{pdf,npz}' into deepToolsStats script: diff --git a/workflow/scripts/experiment_qc.py b/workflow/scripts/experiment_qc.py index 7386fcffd8e982d4d432e99becfc2aacb23ad2f2..affbbc4946327810a366c59b44c58469466d91a4 100644 --- a/workflow/scripts/experiment_qc.py +++ b/workflow/scripts/experiment_qc.py @@ -76,10 +76,10 @@ def generate_read_summary(design, extension): return mbs_filename -def check_correlation(mbs): +def check_spearman_correlation(mbs): '''Check Spearman pairwise correlation of samples based on read counts.''' - spearman_filename = 'heatmap_SpearmanCorr.png' + spearman_filename = 'heatmap_SpearmanCorr.pdf' spearman_params = "--corMethod spearman --skipZero" + \ " --plotTitle \"Spearman Correlation of Read Counts\"" + \ " --whatToPlot heatmap --colorMap RdYlBu --plotNumbers" @@ -95,6 +95,25 @@ def check_correlation(mbs): out, err = spearman_correlation.communicate() +def check_pearson_correlation(mbs): + '''Check Pearson pairwise correlation of samples based on read counts.''' + + pearson_filename = 'heatmap_PearsonCorr.pdf' + pearson_params = "--corMethod pearson --skipZero" + \ + " --plotTitle \"Pearson Correlation of Read Counts\"" + \ + " --whatToPlot heatmap --colorMap RdYlBu --plotNumbers" + + pearson_command = ( + "plotCorrelation -in %s %s -o %s" + % (mbs, pearson_params, pearson_filename) + ) + + logger.info("Running deeptools with %s", pearson_command) + + pearson_correlation = subprocess.Popen(pearson_command, shell=True) + out, err = pearson_correlation.communicate() + + def check_coverage(design, extension): '''Asses the sequencing depth of samples.''' @@ -166,7 +185,9 @@ def main(): # Run correlation mbs_filename = generate_read_summary(design_df, extension) - check_correlation(mbs_filename) + check_spearman_correlation(mbs_filename) + check_pearson_correlation(mbs_filename) + # Run coverage check_coverage(design_df, extension) diff --git a/workflow/tests/test_experiment_qc.py b/workflow/tests/test_experiment_qc.py index 5256da5fbebc424ea29a1977d9257bfc95060ae3..695095074b0e571fc052a8cff2b933b5da505e06 100644 --- a/workflow/tests/test_experiment_qc.py +++ b/workflow/tests/test_experiment_qc.py @@ -33,7 +33,8 @@ def test_check_update_controls(design_bam): @pytest.mark.singleend def test_experiment_qc_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, 'heatmap_SpearmanCorr.pdf')) + assert os.path.exists(os.path.join(test_output_path, 'heatmap_PearsonCorr.pdf')) assert os.path.exists(os.path.join(test_output_path, 'coverage.png')) 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')) @@ -41,7 +42,8 @@ def test_experiment_qc_singleend(): @pytest.mark.pairdend def test_experiment_qc_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, 'heatmap_SpearmanCorr.pdf')) + assert os.path.exists(os.path.join(test_output_path, 'heatmap_PearsonCorr.pdf')) assert os.path.exists(os.path.join(test_output_path, 'coverage.png')) 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'))