Skip to content

Commit

Permalink
Implement #924 (#925)
Browse files Browse the repository at this point in the history
* Basic implementation of --linesAtTickMarks and galaxy wrapper

* bump version to 3.4.0

* typo

* stupid eigenvalues
  • Loading branch information
dpryan79 authored Mar 5, 2020
1 parent 1c40e47 commit e7bc375
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
3.4.0

* Fixed a bug in one of the Galaxy wrappers.
* Added the `--lineAtTickMarks` option to `plotHeatmap` so that there are dashed vertical lines for each tick mark in the plot. (issue #924)

3.3.2

* Fixed --yAxisLabel in plotProfile (issue #889)
Expand Down
2 changes: 1 addition & 1 deletion deeptools/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# This file is originally generated from Git information by running 'setup.py
# version'. Distribution tarballs contain a pre-generated copy of this file.

__version__ = '3.3.2'
__version__ = '3.4.0'
6 changes: 6 additions & 0 deletions deeptools/parserCommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,12 @@ def heatmapperOptionalArgs(mode=['heatmap', 'profile'][0]):
'example: --sortUsingSamples 1 3',
type=int, nargs='+')

optional.add_argument('--linesAtTickMarks',
help='Draw dashed lines from all tick marks through the heatmap. '
'This is then similar to the dashed line draw at region bounds '
'when using a reference point and --sortUsing region_length',
action='store_true')

optional.add_argument('--clusterUsingSamples',
help='List of sample numbers (order as in '
'matrix), that are used for clustering by '
Expand Down
14 changes: 14 additions & 0 deletions deeptools/plotHeatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ def plotMatrix(hm, outFileName,
heatmapWidth=7.5,
perGroup=False, whatToShow='plot, heatmap and colorbar',
plot_type='lines',
linesAtTickMarks=False,
image_format=None,
legend_location='upper-left',
box_around_heatmaps=True,
Expand Down Expand Up @@ -659,6 +660,18 @@ def plotMatrix(hm, outFileName,
elif not perGroup and sample == 0:
ax.axes.set_ylabel(sub_matrix['group'])

# Plot vertical lines at tick marks if desired
if linesAtTickMarks:
xticks_heat, xtickslabel_heat = hm.getTicks(sample)
xticks_heat = [x + 0.5 for x in xticks_heat] # There's an offset of 0.5 compared to the profile plot
if np.ceil(max(xticks_heat)) != float(sub_matrix['matrix'].shape[1]):
tickscale = float(sub_matrix['matrix'].shape[1]) / max(xticks_heat)
xticks_heat_use = [x * tickscale for x in xticks_heat]
else:
xticks_heat_use = xticks_heat
for x in xticks_heat_use:
ax.axvline(x=x, color='black', linewidth=0.5, dashes=(3, 2))

# add labels to last block in a column
if (perGroup and sample == numsamples - 1) or \
(not perGroup and group_idx == numgroups - 1):
Expand Down Expand Up @@ -845,6 +858,7 @@ def main(args=None):
args.heatmapWidth,
args.perGroup,
args.whatToShow,
linesAtTickMarks=args.linesAtTickMarks,
plot_type=args.plotType,
image_format=args.plotFileFormat,
legend_location=args.legendLocation,
Expand Down
4 changes: 2 additions & 2 deletions galaxy/wrapper/deepTools_macros.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<macros>

<token name="@THREADS@">--numberOfProcessors "\${GALAXY_SLOTS:-4}"</token>
<token name="@WRAPPER_VERSION@">3.3.2.0</token>
<token name="@WRAPPER_VERSION@">3.4.0.0</token>
<xml name="requirements">
<requirements>
<requirement type="package" version="3.3.2">deeptools</requirement>
<requirement type="package" version="3.4.0">deeptools</requirement>
<requirement type="package" version="1.9">samtools</requirement>
</requirements>
<expand macro="stdio" />
Expand Down
6 changes: 6 additions & 0 deletions galaxy/wrapper/plotHeatmap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
--sortRegions '$advancedOpt.sortRegions'
#end if
#if $advancedOpt.linesAtTickMarks:
--linesAtTickMarks
#end if
#if $advancedOpt.sortUsing:
--sortUsing '$advancedOpt.sortUsing'
#end if
Expand Down Expand Up @@ -130,6 +134,8 @@
<when value="yes">
<expand macro="sortRegions" />
<expand macro="sortUsing" />
<param argument="--linesAtTickMarks" type="boolean" truevalue="--linesAtTickMarks" falsevalue=""
label="Draw dashed lines in heatmap above all tick marks?" />
<param argument="--averageTypeSummaryPlot" type="select"
label="Type of statistic that should be plotted in the summary image above the heatmap"
help="">
Expand Down
2 changes: 1 addition & 1 deletion galaxy/wrapper/test-data/plotPCA_result2.tabular
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#plotPCA --outFileNameData
Component bowtie2-test1.bam bowtie2-test1.bam Eigenvalue
1 -0.7071067811865476 -0.7071067811865475 4.0
2 -0.7071067811865475 0.7071067811865476 2.49319462166397e-32
2 -0.7071067811865475 0.7071067811865476 1.2325951644078315e-32

0 comments on commit e7bc375

Please sign in to comment.