Skip to content

Commit

Permalink
Implement #508
Browse files Browse the repository at this point in the history
  • Loading branch information
dpryan79 committed Apr 23, 2017
1 parent 290dfd3 commit c025b2b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
17 changes: 13 additions & 4 deletions deeptools/plotCoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 '
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)')
Expand Down
15 changes: 15 additions & 0 deletions galaxy/wrapper/deepTools_macros.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@
</conditional>
</xml>

<token name="@PLOTWIDTHHEIGHT@">
--plotWidth '$advancedOp.plotWidth'
--plotHeight '$advancedOp.plotHeight'
</token>

<xml name="plotWidthHeight">
<param argument="--plotHeight" type="float" value="@PLOTHEIGHT@" min="1"
label="Plot height"
help="Height in cm. The default for the plot height is @PLOTHEIGHT@ centimeters. The minimum value is 1 cm." />

<param argument="--plotWidth" type="float" value="@PLOTWIDTH@" min="1"
label="Plot width"
help="Width in cm. The default value is @PLOTWIDTH@ centimeters. The minimum value is 1 cm." />
</xml>

<token name="@ADVANCED_OPTS_READ_PROCESSING@">
#if $advancedOpt.doExtendCustom.doExtend == 'custom':
--extendReads $advancedOpt.doExtendCustom.extendReadsValue
Expand Down
2 changes: 2 additions & 0 deletions galaxy/wrapper/plotCoverage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
--plotTitle '$advancedOpt.plotTitle'
#end if
@ADVANCED_OPTS_READ_PROCESSING@
@PLOTWIDTHHEIGHT@
@blacklist@
#end if
Expand All @@ -57,6 +58,7 @@
<param argument="--numberOfSamples" type="integer" value="100000" min="1"
label="Number of samples"
help="Number of samples taken from the genome to compute the scaling factors."/>
<expand macro="plotWidthHeight" width="15" height="5" />
<expand macro="region_limit_operation" />
<expand macro="read_processing_options" />
<expand macro="skipZeros" />
Expand Down

0 comments on commit c025b2b

Please sign in to comment.