Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
docs:
name: Push Sphinx Pages
runs-on: ubuntu-latest
runs-on: Linux-x64
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
Expand Down
94 changes: 64 additions & 30 deletions .github/workflows/pypi-test.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,74 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test the library

on:
push:
branches: [ main ]
branches:
- master # for legacy repos
- main
pull_request:
branches: [ main ]
branches:
- master # for legacy repos
- main
workflow_dispatch: # Allow manually triggering the workflow
schedule:
# Run roughly every 15 days at 00:00 UTC
# (useful to check if updates on dependencies break the package)
- cron: "0 0 1,16 * *"

jobs:
build:
permissions:
contents: read

concurrency:
group: >-
${{ github.workflow }}-${{ github.ref_type }}-
${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

runs-on: ubuntu-latest
jobs:
test:
strategy:
matrix:
python-version: [ '3.10' ]

name: Python ${{ matrix.python-version }}
python: ["3.10"] # , "3.11", "3.12", "3.13", "3.14"
platform:
- Linux-x64
# - ubuntu-latest
# - macos-latest
# - windows-latest
runs-on: ${{ matrix.platform }}
name: Python ${{ matrix.python }}, ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest tox
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with tox
run: |
tox
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox coverage

- name: Run tests
run: >-
pipx run --python '${{ steps.setup-python.outputs.python-path }}'
tox
-- -rFEx --durations 10 --color yes --cov --cov-branch --cov-report=xml # pytest args

- name: Check for codecov token availability
id: codecov-check
shell: bash
run: |
if [ ${{ secrets.CODECOV_TOKEN }} != '' ]; then
echo "codecov=true" >> $GITHUB_OUTPUT;
else
echo "codecov=false" >> $GITHUB_OUTPUT;
fi

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
if: ${{ steps.codecov-check.outputs.codecov == 'true' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
slug: ${{ github.repository }}
flags: ${{ matrix.platform }} - py${{ matrix.python }}
8 changes: 4 additions & 4 deletions tests/test_interpret.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_scan_sequences():
'fimo_p-value': [0.000244140625, 0.000244140625],
'matched_seq': ['CACGTG', 'TGCGTG']
})
assert out.equals(expected)
pd.testing.assert_frame_equal(out, expected, atol=1e-3)

# Allow reverse complement
out = scan_sequences(seqs, motifs=meme_file, rc=True, pthresh=1e-3)
Expand All @@ -248,7 +248,7 @@ def test_scan_sequences():
'matched_seq': ['CACGTG', 'CACGTG', 'CACGCA', 'TGCGTG']
})

assert out.equals(expected)
pd.testing.assert_frame_equal(out, expected, atol=1e-3)

# Reverse complement with attributions
attrs = get_attributions(model, seqs, method="inputxgradient")
Expand All @@ -266,7 +266,7 @@ def test_scan_sequences():
'site_attr_score': np.float32([0.0, 0.0, 0.009259258396923542, -0.009259259328246117]),
'motif_attr_score': [0.003703703731298441, 0.0, 0.0, -0.03549381507926434]
})
assert out.equals(expected)
pd.testing.assert_frame_equal(out, expected, atol=1e-3)


def test_compare_motifs():
Expand All @@ -288,7 +288,7 @@ def test_compare_motifs():
'fimo_score_ref': [11.60498046875, -2.9944558143615723],
'fimo_score_diff': [-26.253820657730103, 13.22646164894104]
})
assert out.equals(expected)
pd.testing.assert_frame_equal(out, expected, atol=1e-3)


def test_run_tomtom():
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ description = Invoke pytest to run automated tests
setenv =
TOXINIDIR = {toxinidir}
CONDA_EXE = mamba
WANDB_MODE = disabled
WANDB_API_KEY = dummy
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IF you end up creating an api key and storing it as a secret, delete this line

passenv =
HOME
SETUPTOOLS_*
Expand Down
Loading