Skip to content

Commit

Permalink
Merge pull request #1325 from deeptools/np2
Browse files Browse the repository at this point in the history
Np2
  • Loading branch information
WardDeb authored Oct 5, 2024
2 parents bf29fae + 60bec9a commit df7573b
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 90 deletions.
20 changes: 0 additions & 20 deletions .github/test_and_build.yml

This file was deleted.

40 changes: 10 additions & 30 deletions .github/workflows/planemo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,56 +16,40 @@ 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
planemo_combine_outputs:
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
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,19 @@ 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
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
micromamba activate test_and_build
twine upload dist/*
39 changes: 16 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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'
Expand All @@ -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
2 changes: 1 addition & 1 deletion deeptools/computeMatrixOperations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]):
Expand Down
2 changes: 1 addition & 1 deletion deeptools/heatmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def compute_sub_matrix_worker(self, chrom, start, end, score_file_list, paramete

# 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 = []
Expand Down
10 changes: 5 additions & 5 deletions deeptools/plotFingerprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -339,7 +339,7 @@ def signalAndBinDist(x):

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
Expand Down
13 changes: 10 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ authors = [
{name="Thomas Manke"},
{email="[email protected]"}
]
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",
Expand All @@ -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/"
Expand Down

0 comments on commit df7573b

Please sign in to comment.