Repository: deeptools/deepTools

Issue:
Typo/Bug in heatmapper.py script
Hi,
I recently came across this and thought to open an issue for it, I think in line 379, it should be `np.nan` instead of `np.NAN`

https://github.com/deeptools/deepTools/blob/master/deeptools/heatmapper.py#L379

For me changing it to `np.nan` fixed the error.

Hints from issue comments:
@myliu221: Hi,

I encountered similar issue with error "AttributeError: module 'numpy' has no attribute 'NAN'" after installing deeptools , and solved using the above method. Thanks. @WardDeb: Thanks for the report, this is taken up with #1325, and will be released soon.

Solution patch:
diff --git a/.github/workflows/planemo.yml b/.github/workflows/planemo.yml
index 067a303c..40d09cb5 100644
--- a/.github/workflows/planemo.yml
+++ b/.github/workflows/planemo.yml
@@ -2,16 +2,12 @@ name: Planemo
 on: [push, pull_request]
 
 env:
-  GALAXY_BRANCH: release_23.1
+  GALAXY_BRANCH: release_24.1
 
 defaults:
   run:
     shell: bash -l {0}
 
-# setup micromamba doesn't work as galaxy setup by planemo requires conda.
-# installing conda over into micromamba built env screws up the PATH
-# setup-miniconda + changing over to libmamba to solve is the easiest workaround
-
 jobs:
   planemo_test:
     name: Planemo test
@@ -20,26 +16,22 @@ jobs:
       matrix:
         chunk: [1, 2, 3]
     steps:
-    - uses: actions/checkout@v3
-    - uses: conda-incubator/setup-miniconda@v2
+    - uses: actions/checkout@v4
+    - uses: conda-incubator/setup-miniconda@v3
       with:
         miniconda-version: "latest"
         auto-activate-base: true
-    - name: setup env
+        python-version: "3.12"
+    - name: get samtools
       run: |
-        conda env list
-        conda install -n base conda-libmamba-solver
-        conda config --set solver libmamba
-        conda env create -f .github/test_and_build.yml -n test_and_build
+        conda install -c conda-forge -c bioconda samtools
     - name: pip install
       run: |
-        conda activate test_and_build
-        pip install .
+        pip install .[actions]
     - name: planemo
       run: |
-        conda activate test_and_build
         ./.planemo.sh ${{ matrix.chunk }} ${{ env.GALAXY_BRANCH }}
-    - uses: actions/upload-artifact@v3
+    - uses: actions/upload-artifact@v4
       with:
         name: 'Tool test output ${{ matrix.chunk }}'
         path: upload
@@ -47,29 +39,17 @@ jobs:
     name: Combine chunked test results
     needs: planemo_test
     runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        python-version: ['3.8', '3.11']
     steps:
-    - uses: actions/download-artifact@v3
+    - uses: actions/download-artifact@v4
       with:
         path: artifacts
-    - uses: actions/setup-python@v4
-      with:
-        python-version: ${{ matrix.python-version }}
-    - name: Cache .cache/pip
-      uses: actions/cache@v3
-      id: cache-pip
-      with:
-        path: ~/.cache/pip
-        key: pip_cache_py_${{ matrix.python-version }}_gxy_${{ env.GALAXY_BRANCH }}
     - name: Combine outputs
       uses: galaxyproject/planemo-ci-action@v1
       id: combine
       with:
         mode: combine
         html-report: true
-    - uses: actions/upload-artifact@v3
+    - uses: actions/upload-artifact@v4
       with:
         name: 'All tool test results'
         path: upload
diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml
index a04d98c2..a7f63162 100644
--- a/.github/workflows/pypi.yml
+++ b/.github/workflows/pypi.yml
@@ -15,15 +15,14 @@ jobs:
     name: upload to pypi
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
-    - uses: mamba-org/setup-micromamba@main
+    - uses: actions/checkout@v4
+    - uses: actions/setup-python@v5
       with:
-        environment-file: .github/test_and_build.yml
-        cache-downloads: true
-        environment-name: test_and_build
+        python-version: '3.12'
+        cache: 'pip'
     - name: build
       run: |
-        micromamba activate test_and_build
+        pip install .[actions]
         rm -f dist/*
         python -m build
     - name: upload
@@ -31,5 +30,4 @@ jobs:
         TWINE_USERNAME: "__token__"
         TWINE_PASSWORD: ${{ secrets.pypi_password }}
       run: |
-        micromamba activate test_and_build
         twine upload dist/*
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 07ffd664..201633d0 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -11,7 +11,7 @@ jobs:
     runs-on: ubuntu-latest
     if: github.base_ref == 'master'
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
     - name: Check path
       run: find /home/runner/work/deepTools/deepTools -name "pyproject.toml"
     - name: Get Version of Deeptools
@@ -40,30 +40,26 @@ jobs:
     name: Test on Linux
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/checkout@v3
-    - uses: mamba-org/setup-micromamba@main
+    - uses: actions/checkout@v4
+    - uses: actions/setup-python@v5
       with:
-        environment-file: .github/test_and_build.yml
-        cache-downloads: true
-        environment-name: test_and_build
+        python-version: '3.12'
+        cache: 'pip'
     - name: pip install
       run: |
-        micromamba activate test_and_build
-        pip install .
+        pip install .[actions]
     - name: PEP8
       run: |
         micromamba activate test_and_build
         flake8 . --exclude=.venv,.build,build --ignore=E501,F403,E402,F999,F405,E722,W504,W605
     - name: Test deepTools
       run: |
-        micromamba activate test_and_build
         pytest -v
     - name: make an artifact
       run: |
-        micromamba activate test_and_build
         rm -f dist/*
         python -m build
-    - uses: actions/upload-artifact@v3
+    - uses: actions/upload-artifact@v4
       with:
         name: "distfiles"
         path: "dist"
@@ -73,14 +69,14 @@ jobs:
     needs: build-linux
     strategy:
       matrix:
-        python-version: ['3.8','3.9','3.10', '3.11', '3.12']
+        python-version: ['3.9','3.10', '3.11', '3.12']
     steps:
-      - uses: actions/checkout@v3
-      - uses: actions/download-artifact@v3
+      - uses: actions/checkout@v4
+      - uses: actions/download-artifact@v4
         with:
           name: "distfiles"
           path: ~/dist/
-      - uses: actions/setup-python@v4
+      - uses: actions/setup-python@v5
         with:
           python-version: ${{ matrix.python-version }}
           cache: 'pip'
@@ -96,17 +92,14 @@ jobs:
     name: Test on OSX
     runs-on: macOS-latest
     steps:
-    - uses: actions/checkout@v3
-    - uses: mamba-org/setup-micromamba@main
+    - uses: actions/checkout@v4
+    - uses: actions/setup-python@v5
       with:
-        environment-file: .github/test_and_build.yml
-        cache-downloads: true
-        environment-name: test_and_build
+        python-version: '3.12'
+        cache: 'pip'
     - name: pip install
       run: |
-        micromamba activate test_and_build
-        pip install .
+        pip install .[actions]
     - name: Test deepTools
       run: |
-        micromamba activate test_and_build
         pytest -v
diff --git a/deeptools/computeMatrixOperations.py b/deeptools/computeMatrixOperations.py
index 6b3272d4..0224f00a 100755
--- a/deeptools/computeMatrixOperations.py
+++ b/deeptools/computeMatrixOperations.py
@@ -546,7 +546,7 @@ def cbindMatrices(hm, args):
         # Add on additional NA initialized columns
         ncol = hm.matrix.matrix.shape[1]
         hm.matrix.matrix = np.hstack((hm.matrix.matrix, np.empty(hm2.matrix.matrix.shape)))
-        hm.matrix.matrix[:, ncol:] = np.NAN
+        hm.matrix.matrix[:, ncol:] = np.nan
 
         # Update the values
         for idx2, group in enumerate(hm2.parameters["group_labels"]):
diff --git a/deeptools/heatmapper.py b/deeptools/heatmapper.py
index f67afaf4..f86b85e2 100644
--- a/deeptools/heatmapper.py
+++ b/deeptools/heatmapper.py
@@ -376,7 +376,7 @@ class heatmapper(object):
 
         # create an empty matrix to store the values
         sub_matrix = np.zeros((len(regions), matrix_cols))
-        sub_matrix[:] = np.NAN
+        sub_matrix[:] = np.nan
 
         j = 0
         sub_regions = []
diff --git a/deeptools/plotFingerprint.py b/deeptools/plotFingerprint.py
index 3adce87a..a5a46880 100755
--- a/deeptools/plotFingerprint.py
+++ b/deeptools/plotFingerprint.py
@@ -203,10 +203,10 @@ def getCHANCE(args, idx, mat):
     """
     # Get the index of the reference sample
     if args.JSDsample not in args.bamfiles:
-        return [np.NAN, np.NAN, np.NAN]
+        return [np.nan, np.nan, np.nan]
     refIdx = args.bamfiles.index(args.JSDsample)
     if refIdx == idx:
-        return [np.NAN, np.NAN, np.NAN]
+        return [np.nan, np.nan, np.nan]
 
     subMatrix = np.copy(mat[:, [idx, refIdx]])
     subMatrix[np.isnan(subMatrix)] = 0
@@ -272,10 +272,10 @@ def getJSD(args, idx, mat):
 
     # Get the index of the reference sample
     if args.JSDsample not in args.bamfiles:
-        return np.NAN
+        return np.nan
     refIdx = args.bamfiles.index(args.JSDsample)
     if refIdx == idx:
-        return np.NAN
+        return np.nan
 
     # These will hold the coverage histograms
     chip = np.zeros(MAXLEN, dtype=int)
@@ -339,7 +339,7 @@ def getJSDcommon(chip, input):
 
     if abs(sum(PMFinput) - 1) > 0.01 or abs(sum(PMFchip) - 1) > 0.01:
         sys.stderr.write("Warning: At least one PMF integral is significantly different from 1! The JSD will not be returned")
-        return np.NAN
+        return np.nan
 
     # Compute the JSD from the PMFs
     M = (PMFinput + PMFchip) / 2.0
diff --git a/pyproject.toml b/pyproject.toml
index 84f14f48..2072ec1f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -19,9 +19,9 @@ authors = [
     {name="Thomas Manke"},
     {email="bioinfo-core@ie-freiburg.mpg.de"}
 ]
-requires-python = ">=3.8"
+requires-python = "> 3.8"
 dependencies = [
-    "numpy >= 1.9.0",
+    "numpy >= 2.0.0",
     "scipy >= 0.17.0",
     "matplotlib >= 3.5.0",
     "pysam >= 0.14.0",
@@ -38,7 +38,14 @@ classifiers = [
     "Topic :: Scientific/Engineering :: Bio-Informatics"
 ]
 readme = "README.rst"
-
+[project.optional-dependencies]
+actions = [
+    "flake8",
+    "pytest",
+    "twine",
+    "build",
+    "planemo"
+]
 [project.urls]
 homepage = "https://pypi.python.org/pypi/deepTools/"
 documentation = "https://deeptools.readthedocs.io/en/latest/"


Test patch:
diff --git a/.github/test_and_build.yml b/.github/test_and_build.yml
deleted file mode 100644
index 0d1c77b2..00000000
--- a/.github/test_and_build.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-channels:
-  - conda-forge
-  - bioconda
-dependencies:
-  - python > 3.7
-  - numpy
-  - scipy
-  - flake8
-  - pysam
-  - deeptoolsintervals
-  - pytest
-  - samtools
-  - py2bit
-  - pyBigWig
-  - twine
-  - pip
-  - tomli  # remove dependency when lowest supported version is py 3.11
-  - pip:
-    - build
-    - planemo
\ No newline at end of file