8000 Update test images, skip testing if the wrong matplotlib version is used by dpryan79 · Pull Request #865 · deeptools/deepTools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update test images, skip testing if the wrong matplotlib version is used #865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .azure-pipelines/test-template.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
steps:
- bash: conda create -n foo -q --yes -c conda-forge -c bioconda python=$(python.version) numpy scipy matplotlib==2.1.2 nose flake8 plotly==2.0.12 pysam pyBigWig py2bit deeptoolsintervals cython
- bash: conda create -n foo -q --yes -c conda-forge -c bioconda python=$(python.version) numpy scipy matplotlib==3.1.1 nose flake8 plotly pysam pyBigWig py2bit deeptoolsintervals
displayName: Installing dependencies
- bash: |
source activate foo
python setup.py install
python -m pip install . --no-deps --ignore-installed -vvv
displayName: Installing deeptools
- bash: |
source activate foo
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.3.1

* Fixed compatibility with matplotlib 3
* The Y-axis labels should once again appear in both plotHeatmap and plotProfile (issue #844). This was related to the previous point.
* Testing is no longer performed with python 2.7, which will reach end of life in a couple months

3.3.0

* `plotCoverage` now has a `--BED` option, to restrict plots and output to apply to a specific set of regions given by a BED or GTF file or files (issue #829).
Expand Down
6 changes: 1 addition & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ jobs:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python27:
python.version: '2.7'
Python37:
python.version: '3.7'
maxParallel: 4
Expand All @@ -24,8 +22,6 @@ jobs:
vmImage: 'macOS-10.13'
strategy:
matrix:
Python27:
python.version: '2.7'
Python37:
python.version: '3.7'
maxParallel: 1
Expand Down Expand Up @@ -54,7 +50,7 @@ jobs:
steps:
- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH
- bash: conda create -n foo -q --yes -c conda-forge -c bioconda python=$(python.version) numpy scipy matplotlib==2.1.2 nose flake8 plotly==2.0.12 pysam pyBigWig py2bit deeptoolsintervals cython planemo setuptools
- bash: conda create -n foo -q --yes -c conda-forge -c bioconda python=$(python.version) numpy scipy matplotlib==3.1.1 nose flake8 plotly pysam pyBigWig py2bit deeptoolsintervals planemo samtools
displayName: Installing dependencies
- bash: |
source activate foo
Expand Down
6 changes: 3 additions & 3 deletions deeptools/heatmapper_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def getProfileTicks(hm, referencePointLabel, startLabel, endLabel, idx):
correspond to the heatmap

As of deepTools 3, the various parameters can be lists, in which case we then need to index things (the idx parameter)

As of matplotlib 3 the ticks in the heatmap need to have 0.5 added to them.
"""
w = hm.parameters['bin size']
b = hm.parameters['upstream']
Expand Down Expand Up @@ -164,7 +166,6 @@ def getProfileTicks(hm, referencePointLabel, startLabel, endLabel, idx):
xtickslabel = ['{0:.1f}'.format(-(float(b) / quotient)),
referencePointLabel,
'{0:.1f}{1}'.format(float(a) / quotient, symbol)]

else:
xticks_values = [0]
xtickslabel = []
Expand Down Expand Up @@ -194,7 +195,6 @@ def getProfileTicks(hm, referencePointLabel, startLabel, endLabel, idx):
xtickslabel.append('{0:.1f}{1}'.format(float(a) / quotient, symbol))

xticks = [(k / w) - tickPlotAdj for k in xticks_values]

xticks = [max(x, 0.5) for x in xticks]
xticks = [max(x, 0) for x in xticks]

return xticks, xtickslabel
1 change: 1 addition & 0 deletions deeptools/plotHeatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ def plotMatrix(hm, outFileName,
# add xticks to the bottom heatmap (last group)
ax.axes.get_xaxis().set_visible(True)
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]
Expand Down
13 changes: 5 additions & 8 deletions deeptools/plotProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,8 @@ def plot_heatmap(self):
ax.axes.set_yticklabels(labels[::-1])
else:
ax.axes.set_yticklabels([])
# matplotlib 3.1.1 (and likely some earlier versions) will change the ylim if you change the tick locations!
ax.axes.set_ylim([ymin, ymax])

ax_list.append(ax)

Expand Down Expand Up @@ -743,14 +745,9 @@ def plot_profile(self):
globalYmin = min(np.float64(globalYmin), ax.get_ylim()[0])
globalYmax = max(globalYmax, ax.get_ylim()[1])

# remove the numbers of the y axis for all plots
plt.setp(ax.get_yticklabels(), visible=False)

if col == 0 or len(self.y_min) > 1 or len(self.y_max) > 1:
# add the y axis label for the first plot
# on each row and make the numbers and ticks visible
plt.setp(ax.get_yticklabels(), visible=True)
ax.axes.set_ylabel(self.y_axis_label)
# Exclude ticks from all but one subplot by default
if col > 0 and len(self.y_min) == 1 and len(self.y_max) == 1:
plt.setp(ax.get_yticklabels(), visible=False)

totalWidth = sub_matrix['matrix'].shape[1]
xticks, xtickslabel = self.getTicks(tickIdx)
Expand Down
Binary file modified deeptools/test/test_heatmapper/heatmap_master_multi_color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified deeptools/test/test_heatmapper/master.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified deeptools/test/test_heatmapper/master_relabeled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified deeptools/test/test_heatmapper/master_scale_reg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified deeptools/test/test_heatmapper/profile_master.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified deeptools/test/test_heatmapper/profile_master_multi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified deeptools/test/test_heatmapper/profile_master_multi_pergroup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions deeptools/test/testskip_heatmapper_images.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os
import matplotlib
matplotlib.use('Agg')
from matplotlib.testing.compare import compare_images
from tempfile import NamedTemporaryFile

Expand All @@ -12,6 +14,10 @@
ROOT = os.path.dirname(os.path.abspath(__file__)) + "/test_heatmapper/"
tolerance = 30

skip = False
if matplotlib.__version__ != "3.1.1":
skip = True


def test_plotHeatmap_simple_plot():
"""
Expand All @@ -22,6 +28,8 @@ def test_plotHeatmap_simple_plot():
-R {test_path}/test.bed -o /tmp/mat.gz -bs 25

"""
if skip:
return
outfile = NamedTemporaryFile(suffix='.png', prefix='plotHeatmap_test_', delete=False)
args = "-m {}/master.mat.gz --outFileName {}".format(ROOT, outfile.name).split()
deeptools.plotHeatmap.main(args)
Expand All @@ -31,6 +39,8 @@ def test_plotHeatmap_simple_plot():


def test_plotHeatmap_rename_labels():
if skip:
return
outfile = NamedTemporaryFile(suffix='.png', prefix='plotHeatmap_test_', delete=False)

args = "-m {}/master.mat.gz --outFileName {} --regionsLabel uno dos".format(ROOT, outfile.name).split()
Expand All @@ -41,6 +51,8 @@ def test_plotHeatmap_rename_labels():


def test_plotHeatmap_scale_regions():
if skip:
return
outfile = NamedTemporaryFile(suffix='.png', prefix='plotHeatmap_test_', delete=False)
args = "-m {}/master_scale_reg.mat.gz --outFileName {}".format(ROOT, outfile.name).split()
deeptools.plotHeatmap.main(args)
Expand All @@ -50,6 +62,8 @@ def test_plotHeatmap_scale_regions():


def test_plotHeatmap_multi_bigwig_pergroup():
if skip:
return
outfile = NamedTemporaryFile(suffix='.png', prefix='plotHeatmap_test_', delete=False)
args = "-m {}/master_multi.mat.gz --perGroup --samplesLabel file1 file2 file3 file4 " \
"--outFileName {}".format(ROOT, outfile.name).split()
BEA9 Expand All @@ -60,6 +74,8 @@ def test_plotHeatmap_multi_bigwig_pergroup():


def test_plotHeatmap_multiple_colors_muti_scales():
if skip:
return
outfile = NamedTemporaryFile(suffix='.png', prefix='plotHeatmap_test_', delete=False)
args = "-m {}/master_multi.mat.gz --colorList white,blue white,red --zMin 1 0 --zMax 4 5 " \
"--outFileName {}".format(ROOT, outfile.name).split()
Expand All @@ -70,6 +86,8 @@ def test_plotHeatmap_multiple_colors_muti_scales():


def test_plotHeatmap_multiple_colormap_no_boxes():
if skip:
return
outfile = NamedTemporaryFile(suffix='.png', prefix='plotHeatmap_test_', delete=False)
args = "-m {}/master_multi.mat.gz --colorMap Reds binary terrain --boxAroundHeatmaps no " \
"--outFileName {}".format(ROOT, outfile.name).split()
Expand All @@ -80,6 +98,8 @@ def test_plotHeatmap_multiple_colormap_no_boxes():


def test_plotHeatmap_interpolation():
if skip:
return
outfile = NamedTemporaryFile(suffix='.png', prefix='plotHeatmap_test_', delete=False)
args = "-m {}/large_matrix.mat.gz --interpolation bilinear " \
"--outFileName {}".format(ROOT, outfile.name).split()
Expand All @@ -90,6 +110,8 @@ def test_plotHeatmap_interpolation():


def test_plotProfiler():
if skip:
return
outfile = NamedTemporaryFile(suffix='.png', prefix='plotHeatmap_test_', delete=False)
args = "-m {}/master.mat.gz --outFileName {} --regionsLabel uno dos " \
"--plotType std".format(ROOT, outfile.name).split()
Expand All @@ -100,6 +122,8 @@ def test_plotProfiler():


def test_plotProfiler_heatmap():
if skip:
return
outfile = NamedTemporaryFile(suffix='.png', prefix='plotHeatmap_test_', delete=False)
args = "-m {}/master.mat.gz --outFileName {} --plotType heatmap".format(ROOT, outfile.name).split()
deeptools.plotProfile.main(args)
Expand All @@ -109,6 +133,8 @@ def test_plotProfiler_heatmap():


def test_plotProfiler_overlapped_lines():
if skip:
return
outfile = NamedTemporaryFile(suffix='.png', prefix='plotHeatmap_test_', delete=False)
args = "-m {}/master.mat.gz --outFileName {} " \
"--plotType overlapped_lines --yMin -1".format(ROOT, outfile.name).split()
Expand All @@ -119,6 +145,8 @@ def test_plotProfiler_overlapped_lines():


def test_plotProfiler_multibigwig():
if skip:
return
outfile = NamedTemporaryFile(suffix='.png', prefix='plotHeatmap_test_', delete=False)
args = "-m {}/master_multi.mat.gz --outFileName {} " \
"--numPlotsPerRow 2 --yMax 1.5".format(ROOT, outfile.name).split()
Expand All @@ -129,6 +157,8 @@ def test_plotProfiler_multibigwig():


def test_plotProfiler_multibigwig_pergroup():
if skip:
return
outfile = NamedTemporaryFile(suffix='.png', prefix='plotHeatmap_test_', delete=False)
args = "-m {}/master_multi.mat.gz --outFileName {} " \
"--perGroup --yMax 1.5".format(ROOT, outfile.name).split()
Expand Down
Binary file modified galaxy/wrapper/test-data/heatmapper_result1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified galaxy/wrapper/test-data/heatmapper_result2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion galaxy/wrapper/test-data/test.bw

This file was deleted.

Binary file added galaxy/wrapper/test-data/test.bw
Binary file not shown.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
numpy>=1.9.0
scipy>=0.17.0
matplotlib>=2.1.2
matplotlib>=3.0.0
pysam>=0.14.0
py2bit>=0.2.0
numpydoc>=0.5
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def openREADME():
install_requires=[
"numpy >= 1.9.0",
"scipy >= 0.17.0",
"matplotlib >= 2.1.2",
"matplotlib >= 3.0.0",
"pysam >= 0.14.0",
"numpydoc >= 0.5",
"pyBigWig >= 0.2.1",
Expand Down
0