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

Merge branch '27_pdfs_plots' into 'master'

27 pdfs plots

See merge request BICF/Astrocyte/chipseq_analysis!19
parents 21f00e65 419a82ca
No related merge requests found
File added
...@@ -198,7 +198,7 @@ process experimentQC { ...@@ -198,7 +198,7 @@ process experimentQC {
output: output:
file '*.{png,npz}' into deepToolsStats file '*.{pdf,npz}' into deepToolsStats
script: script:
......
...@@ -76,10 +76,10 @@ def generate_read_summary(design, extension): ...@@ -76,10 +76,10 @@ def generate_read_summary(design, extension):
return mbs_filename return mbs_filename
def check_correlation(mbs): def check_spearman_correlation(mbs):
'''Check Spearman pairwise correlation of samples based on read counts.''' '''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" + \ spearman_params = "--corMethod spearman --skipZero" + \
" --plotTitle \"Spearman Correlation of Read Counts\"" + \ " --plotTitle \"Spearman Correlation of Read Counts\"" + \
" --whatToPlot heatmap --colorMap RdYlBu --plotNumbers" " --whatToPlot heatmap --colorMap RdYlBu --plotNumbers"
...@@ -95,12 +95,31 @@ def check_correlation(mbs): ...@@ -95,12 +95,31 @@ def check_correlation(mbs):
out, err = spearman_correlation.communicate() 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): def check_coverage(design, extension):
'''Asses the sequencing depth of samples.''' '''Asses the sequencing depth of samples.'''
bam_files = ' '.join(design['bam_reads']) bam_files = ' '.join(design['bam_reads'])
labels = ' '.join(design['sample_id']) labels = ' '.join(design['sample_id'])
coverage_filename = 'coverage.png' coverage_filename = 'coverage.pdf'
coverage_params = "-n 1000000 --plotTitle \"Sample Coverage\"" + \ coverage_params = "-n 1000000 --plotTitle \"Sample Coverage\"" + \
" --ignoreDuplicates --minMappingQuality 10" " --ignoreDuplicates --minMappingQuality 10"
...@@ -136,7 +155,7 @@ def update_controls(design): ...@@ -136,7 +155,7 @@ def update_controls(design):
def check_enrichment(sample_id, control_id, sample_reads, control_reads, extension): def check_enrichment(sample_id, control_id, sample_reads, control_reads, extension):
'''Asses the enrichment per sample.''' '''Asses the enrichment per sample.'''
fingerprint_filename = sample_id + '_fingerprint.png' fingerprint_filename = sample_id + '_fingerprint.pdf'
fingerprint_command = ( fingerprint_command = (
"plotFingerprint -b %s %s --extendReads %d --labels %s %s --plotFile %s" "plotFingerprint -b %s %s --extendReads %d --labels %s %s --plotFile %s"
...@@ -166,7 +185,9 @@ def main(): ...@@ -166,7 +185,9 @@ def main():
# Run correlation # Run correlation
mbs_filename = generate_read_summary(design_df, extension) mbs_filename = generate_read_summary(design_df, extension)
check_correlation(mbs_filename) check_spearman_correlation(mbs_filename)
check_pearson_correlation(mbs_filename)
# Run coverage # Run coverage
check_coverage(design_df, extension) check_coverage(design_df, extension)
......
...@@ -33,15 +33,17 @@ def test_check_update_controls(design_bam): ...@@ -33,15 +33,17 @@ def test_check_update_controls(design_bam):
@pytest.mark.singleend @pytest.mark.singleend
def test_experiment_qc_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, '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, 'coverage.png')) assert os.path.exists(os.path.join(test_output_path, 'heatmap_PearsonCorr.pdf'))
assert os.path.exists(os.path.join(test_output_path, 'ENCLB144FDT_fingerprint.png')) assert os.path.exists(os.path.join(test_output_path, 'coverage.pdf'))
assert os.path.exists(os.path.join(test_output_path, 'ENCLB831RUI_fingerprint.png')) assert os.path.exists(os.path.join(test_output_path, 'ENCLB144FDT_fingerprint.pdf'))
assert os.path.exists(os.path.join(test_output_path, 'ENCLB831RUI_fingerprint.pdf'))
@pytest.mark.pairdend @pytest.mark.pairdend
def test_experiment_qc_pairedend(): 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, '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, 'coverage.png')) assert os.path.exists(os.path.join(test_output_path, 'heatmap_PearsonCorr.pdf'))
assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX_fingerprint.png')) assert os.path.exists(os.path.join(test_output_path, 'coverage.pdf'))
assert os.path.exists(os.path.join(test_output_path, 'ENCLB637LZP_fingerprint.png')) assert os.path.exists(os.path.join(test_output_path, 'ENCLB568IYX_fingerprint.pdf'))
assert os.path.exists(os.path.join(test_output_path, 'ENCLB637LZP_fingerprint.pdf'))
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