From c025b2b086004e7bf9c224cc88b27b709d5e378e Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Sun, 23 Apr 2017 22:39:38 +0200 Subject: [PATCH] Implement #508 --- deeptools/plotCoverage.py | 17 +++++++++++++---- galaxy/wrapper/deepTools_macros.xml | 15 +++++++++++++++ galaxy/wrapper/plotCoverage.xml | 2 ++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/deeptools/plotCoverage.py b/deeptools/plotCoverage.py index ecad83c15..ba8bcea27 100644 --- a/deeptools/plotCoverage.py +++ b/deeptools/plotCoverage.py @@ -110,6 +110,16 @@ def required_args(): help='Save raw counts (coverages) to file.', metavar='FILE') + optional.add_argument('--plotHeight', + help='Plot height in cm.', + type=float, + default=5.) + + optional.add_argument('--plotWidth', + help='Plot width in cm. The minimum value is 1 cm.', + type=float, + default=15) + optional.add_argument('--plotFileFormat', metavar='FILETYPE', help='Image format type. If given, this option ' @@ -165,7 +175,7 @@ def main(args=None): if args.skipZeros: num_reads_per_bin = countR.remove_row_of_zeros(num_reads_per_bin) - fig, axs = plt.subplots(1, 2, figsize=(15, 5)) + fig, axs = plt.subplots(1, 2, figsize=(args.plotWidth, args.plotHeight)) plt.suptitle(args.plotTitle) # plot up to two std from mean num_reads_per_bin = num_reads_per_bin.astype(int) @@ -212,9 +222,8 @@ def main(args=None): sample_max[idx], )) - # The 'good' x-axis is computed for each sample. The lower value is favored in which - # distributions with a wider x-range can better be seen. - y_max = min(y_max) + # Don't clip plots + y_max = max(y_max) axs[0].set_ylim(0, min(1, y_max + (y_max * 0.10))) axs[0].set_xlim(0, x_max) axs[0].set_xlabel('coverage (#reads per bp)') diff --git a/galaxy/wrapper/deepTools_macros.xml b/galaxy/wrapper/deepTools_macros.xml index bff287ffb..d8f40f479 100644 --- a/galaxy/wrapper/deepTools_macros.xml +++ b/galaxy/wrapper/deepTools_macros.xml @@ -25,6 +25,21 @@ + + --plotWidth '$advancedOp.plotWidth' + --plotHeight '$advancedOp.plotHeight' + + + + + + + + #if $advancedOpt.doExtendCustom.doExtend == 'custom': --extendReads $advancedOpt.doExtendCustom.extendReadsValue diff --git a/galaxy/wrapper/plotCoverage.xml b/galaxy/wrapper/plotCoverage.xml index 6cc46b632..ef17add13 100644 --- a/galaxy/wrapper/plotCoverage.xml +++ b/galaxy/wrapper/plotCoverage.xml @@ -38,6 +38,7 @@ --plotTitle '$advancedOpt.plotTitle' #end if @ADVANCED_OPTS_READ_PROCESSING@ + @PLOTWIDTHHEIGHT@ @blacklist@ #end if @@ -57,6 +58,7 @@ +