From db4400dc83e1878b11c5941db7312c61f42d7532 Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Mon, 29 Jan 2018 00:31:10 +0100 Subject: [PATCH] Galaxy python3 (#659) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Do planemo tests in a python 3 environment * Try again * Not sure if this will work * Copy over fix from Björn's PR * Handle python3 loading of python2 files * Update tests, do Galaxy in both python 2.7 and 3.6 * Right, can't do both * last test * Bump to 2.5.6 --- .planemo.sh | 7 +++---- .travis.yml | 21 ++++++++----------- CHANGES.txt | 4 ++++ deeptools/_version.py | 2 +- deeptools/correlation.py | 4 +++- galaxy/wrapper/deepTools_macros.xml | 4 ++-- .../test-data/bamPEFragmentSize_result1.txt | 4 ++-- .../test-data/plotEnrichment_output.txt | 2 +- .../plotFingerprint_quality_metrics.tabular | 4 ++-- .../wrapper/test-data/plotPCA_result2.tabular | 4 ++-- .../test-data/profiler_result2.tabular | 2 +- 11 files changed, 30 insertions(+), 28 deletions(-) diff --git a/.planemo.sh b/.planemo.sh index 05f6465fa..f60924fdc 100755 --- a/.planemo.sh +++ b/.planemo.sh @@ -1,12 +1,11 @@ #!/bin/bash -#!/bin/bash planemo=./foo/bin/planemo owd=`pwd` temp_dir=`mktemp -d` cd $temp_dir conda config --add channels conda-forge conda config --add channels bioconda -conda create -y --name gxtest numpy bx-python pysam +conda create -y --name gxtest numpy pysam source activate gxtest git clone --depth 1 https://github.com/galaxyproject/galaxy.git cd galaxy @@ -15,8 +14,8 @@ make client cd .. # reset what's available in conda cd $owd -conda install --yes -c conda-forge python=2.7 numpy scipy matplotlib==2.1.0 nose flake8 plotly==2.0.12 -conda install --yes -c bioconda -c conda-forge pysam pyBigWig py2bit planemo +conda install --yes -c conda-forge numpy scipy matplotlib==2.1.0 plotly==2.0.12 +conda install --yes -c bioconda -c conda-forge pysam pyBigWig py2bit python setup.py install #galaxy/wrapper/correctGCBias.xml \ diff --git a/.travis.yml b/.travis.yml index 4f2a72fba..3125747fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,25 @@ language: c env: - TRAVIS_PYTHON_VERSION=2.7 - - TRAVIS_PYTHON_VERSION=3.5 + - TRAVIS_PYTHON_VERSION=3.6 os: - linux - osx jobs: include: - - stage: galaxy + - stage: galaxy36 env: - TESTGALAXY="1" - - TRAVIS_PYTHON_VERSION=2.7 + - TRAVIS_PYTHON_VERSION=3.6 # Setup anaconda before_install: - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PYTHON_VERSION" == "2.7" ]] ; then pip install virtualenv --user ; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PYTHON_VERSION" == "2.7" ]] ; then virtualenv foo; source foo/bin/activate; pip install planemo ; deactivate ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" && ${TESTGALAXY:-"0"} == "1" ]] ; then pip install virtualenv --user ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" && ${TESTGALAXY:-"0"} == "1" ]] ; then virtualenv foo; source foo/bin/activate; pip install planemo ; deactivate ; fi - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PYTHON_VERSION" == "2.7" ]] ; then curl https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -o miniconda.sh ; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PYTHON_VERSION" == "3.5" ]] ; then curl https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PYTHON_VERSION" == "3.6" ]] ; then curl https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh ; fi - if [[ "$TRAVIS_OS_NAME" == "osx" && "$TRAVIS_PYTHON_VERSION" == "2.7" ]] ; then curl https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh -o miniconda.sh ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" && "$TRAVIS_PYTHON_VERSION" == "3.5" ]] ; then curl https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o miniconda.sh ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" && "$TRAVIS_PYTHON_VERSION" == "3.6" ]] ; then curl https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o miniconda.sh ; fi - bash miniconda.sh -b -p $HOME/miniconda - export PATH="$HOME/miniconda/bin:$PATH" - hash -r @@ -41,9 +41,6 @@ script: - if [[ ${TESTGALAXY:-"2"} == "2" ]] ; then cd ~/ && nosetests --with-doctest -sv deeptools ; fi - if [[ ${TESTGALAXY:-"2"} == "2" ]] ; then nosetests --with-doctest -sv deeptoolsintervals ; fi - if [[ ${TESTGALAXY:-"2"} == "2" ]] ; then cd ${owd} ; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PYTHON_VERSION" == "2.7" && ${TESTGALAXY:-"0"} == "1" ]] ; then /home/travis/build/deeptools/deepTools/foo/bin/planemo lint galaxy/wrapper/ ; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PYTHON_VERSION" == "2.7" && ${TESTGALAXY:-"0"} == "1" ]] ; then ./.planemo.sh ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" && ${TESTGALAXY:-"0"} == "1" ]] ; then /home/travis/build/deeptools/deepTools/foo/bin/planemo lint galaxy/wrapper/ ; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" && ${TESTGALAXY:-"0"} == "1" ]] ; then ./.planemo.sh ; fi sudo: false - -services: - - postgresql diff --git a/CHANGES.txt b/CHANGES.txt index b91eabbd1..74f3b9fed 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +2.5.6 + + * Fixed a bug where deepTools in python3 can't handle npz file labels created under python 2. + 2.5.5 * Updated blacklist handling such that an error is thrown on overlapping regions. diff --git a/deeptools/_version.py b/deeptools/_version.py index f952ec860..62ad489af 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__ = '2.5.5' +__version__ = '2.5.6' diff --git a/deeptools/correlation.py b/deeptools/correlation.py index f95783cb4..def829d58 100644 --- a/deeptools/correlation.py +++ b/deeptools/correlation.py @@ -12,6 +12,8 @@ import matplotlib.ticker import matplotlib.mlab import matplotlib.markers +from deeptools.utilities import toString + old_settings = np.seterr(all='ignore') @@ -83,7 +85,7 @@ def load_matrix(self, matrix_file): self.matrix = np.ma.compress_rows(np.ma.masked_invalid(self.matrix)) - self.labels = _ma['labels'] + self.labels = list(map(toString, _ma['labels'])) assert len(self.labels) == self.matrix.shape[1], "ERROR, length of labels is not equal " \ "to length of matrix samples" diff --git a/galaxy/wrapper/deepTools_macros.xml b/galaxy/wrapper/deepTools_macros.xml index 53f939112..79c0e1dd2 100644 --- a/galaxy/wrapper/deepTools_macros.xml +++ b/galaxy/wrapper/deepTools_macros.xml @@ -1,10 +1,10 @@ --numberOfProcessors "\${GALAXY_SLOTS:-4}" - 2.5.5 + 2.5.6 - deeptools + deeptools diff --git a/galaxy/wrapper/test-data/bamPEFragmentSize_result1.txt b/galaxy/wrapper/test-data/bamPEFragmentSize_result1.txt index d02bb237d..fb1b7d294 100644 --- a/galaxy/wrapper/test-data/bamPEFragmentSize_result1.txt +++ b/galaxy/wrapper/test-data/bamPEFragmentSize_result1.txt @@ -6,11 +6,11 @@ Sample size: 3 Fragment lengths: Min.: 241.0 1st Qu.: 241.5 -Mean: 244.666666667 +Mean: 244.66666666666666 Median: 242.0 3rd Qu.: 246.5 Max.: 251.0 -Std: 4.49691252108 +Std: 4.496912521077347 Read lengths: Min.: 251.0 diff --git a/galaxy/wrapper/test-data/plotEnrichment_output.txt b/galaxy/wrapper/test-data/plotEnrichment_output.txt index 8d234e0a9..786ede09a 100644 --- a/galaxy/wrapper/test-data/plotEnrichment_output.txt +++ b/galaxy/wrapper/test-data/plotEnrichment_output.txt @@ -1,5 +1,5 @@ file featureType percent -bowtie2 test1.bam down 100.00 bowtie2 test1.bam up 100.00 bowtie2 test1.bam down 100.00 bowtie2 test1.bam up 100.00 +bowtie2 test1.bam down 100.00 diff --git a/galaxy/wrapper/test-data/plotFingerprint_quality_metrics.tabular b/galaxy/wrapper/test-data/plotFingerprint_quality_metrics.tabular index c48cebbf5..1a5bb2d70 100644 --- a/galaxy/wrapper/test-data/plotFingerprint_quality_metrics.tabular +++ b/galaxy/wrapper/test-data/plotFingerprint_quality_metrics.tabular @@ -1,3 +1,3 @@ Sample AUC Synthetic AUC X-intercept Synthetic X-intercept Elbow Point Synthetic Elbow Point JS Distance Synthetic JS Distance % genome enriched diff. enrichment CHANCE divergence -bowtie2 test1.bam 0.00493632029864 0.481650684758 0.984443061605 1.15310443503e-24 0.984940883634 0.523268829811 NA 0.269004498068 NA NA NA -bowtie2 test1.bam 0.00493632029864 0.481650684758 0.984443061605 1.15310443503e-24 0.984940883634 0.523268829811 0.0 0.269004498068 0 0 0 +bowtie2 test1.bam 0.00493632029863651 0.481650684757865 0.984443061605476 1.1531044350267195e-24 0.9849408836341008 0.5232688298112538 NA 0.26900449806812143 NA NA NA +bowtie2 test1.bam 0.00493632029863651 0.481650684757865 0.984443061605476 1.1531044350267195e-24 0.9849408836341008 0.5232688298112538 0.0 0.26900449806812143 0 0 0 diff --git a/galaxy/wrapper/test-data/plotPCA_result2.tabular b/galaxy/wrapper/test-data/plotPCA_result2.tabular index d6ac0ce08..2aea4fe07 100644 --- a/galaxy/wrapper/test-data/plotPCA_result2.tabular +++ b/galaxy/wrapper/test-data/plotPCA_result2.tabular @@ -1,3 +1,3 @@ Component bowtie2-test1.bam bowtie2-test1.bam Eigenvalue -1 -0.707106781187 -0.707106781187 6.0 -2 -0.707106781187 0.707106781187 1.23259516441e-32 +1 -0.7071067811865476 -0.7071067811865475 6.000000000000001 +2 -0.7071067811865475 0.7071067811865476 1.2325951644078315e-32 diff --git a/galaxy/wrapper/test-data/profiler_result2.tabular b/galaxy/wrapper/test-data/profiler_result2.tabular index 2e71ff799..c6cab1174 100644 --- a/galaxy/wrapper/test-data/profiler_result2.tabular +++ b/galaxy/wrapper/test-data/profiler_result2.tabular @@ -1,3 +1,3 @@ bin labels -0.0Kb 0.0Kb -bins 1 2 +bins 1.0 2.0 bamCoverage_result4_bw_0 genes 2477942.875 2610260.125