diff --git a/CHANGES.txt b/CHANGES.txt index 3c8f999bf..3e5964f23 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4c30def94..e970e281b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,7 +19,7 @@ jobs: - job: 'OSX' pool: - vmImage: 'macOS-10.13' + vmImage: 'macOS-10.14' strategy: matrix: Python37: diff --git a/deeptools/_version.py b/deeptools/_version.py index fe1c1a888..c551a1e1c 100644 --- a/deeptools/_version.py +++ b/deeptools/_version.py @@ -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' diff --git a/deeptools/parserCommon.py b/deeptools/parserCommon.py index c76eb603f..0b4a38779 100644 --- a/deeptools/parserCommon.py +++ b/deeptools/parserCommon.py @@ -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 ' diff --git a/deeptools/plotHeatmap.py b/deeptools/plotHeatmap.py index 8bd6b42e6..0cabe046d 100644 --- a/deeptools/plotHeatmap.py +++ b/deeptools/plotHeatmap.py @@ -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, @@ -539,7 +540,7 @@ def plotMatrix(hm, outFileName, _len *= 0.5 _reg_len.append((hm.parameters['upstream'][idx] + _len) / hm.parameters['bin size'][idx]) elif hm.parameters['ref point'][idx] == 'TES': - _reg_len.append((hm.parameters['downstream'][idx] - _len) / hm.parameters['bin size'][idx]) + _reg_len.append((hm.parameters['upstream'][idx] - _len) / hm.parameters['bin size'][idx]) foo.append(_reg_len) regions_length_in_bins[idx] = foo @@ -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): @@ -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, diff --git a/docs/content/example_api_tutorial.rst b/docs/content/example_api_tutorial.rst index 09556d3b1..1770be665 100644 --- a/docs/content/example_api_tutorial.rst +++ b/docs/content/example_api_tutorial.rst @@ -261,7 +261,7 @@ a tuple with the parameters: chromosome name, start position, end position, and f_lens_list = [] for fetch_start in range(start, end, 1000000): # simply get the reads over a region of 10000 bases - fetch_end = min(end, start + 10000) + fetch_end = min(end, fetch_start + 10000) f_lens_list.append(np.array([abs(read.template_length) for read in bam.fetch(chrom, fetch_start, fetch_end) @@ -290,7 +290,7 @@ to the function, the BAM file name. The next two positional arguments are the na result = mapReduce.mapReduce([bam_file_name], get_fragment_length, - chrom_sizes, + chroms_sizes, genomeChunkLength=10000000, numberOfProcessors=20, verbose=True) diff --git a/galaxy/wrapper/deepTools_macros.xml b/galaxy/wrapper/deepTools_macros.xml index 5c947f0e5..4d4797036 100644 --- a/galaxy/wrapper/deepTools_macros.xml +++ b/galaxy/wrapper/deepTools_macros.xml @@ -1,10 +1,10 @@ --numberOfProcessors "\${GALAXY_SLOTS:-4}" - 3.3.2.0 + 3.4.0.0 - deeptools + deeptools samtools diff --git a/galaxy/wrapper/plotHeatmap.xml b/galaxy/wrapper/plotHeatmap.xml index 57f9b605a..9f7b34e94 100644 --- a/galaxy/wrapper/plotHeatmap.xml +++ b/galaxy/wrapper/plotHeatmap.xml @@ -34,6 +34,10 @@ --sortRegions '$advancedOpt.sortRegions' #end if + #if $advancedOpt.linesAtTickMarks: + --linesAtTickMarks + #end if + #if $advancedOpt.sortUsing: --sortUsing '$advancedOpt.sortUsing' #end if @@ -130,6 +134,8 @@ +