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
4 changes: 2 additions & 2 deletions .github/workflows/Compile_paper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ jobs:
name: Paper Draft
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Build draft PDF
uses: openjournals/openjournals-draft-action@master
with:
journal: joss
# This should be the path to the paper within your repo.
paper-path: paper/paper.md
- name: Upload
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: paper
# This is the output path where Pandoc will write the compiled
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/Mapghi_test_suite.yml

This file was deleted.

31 changes: 9 additions & 22 deletions .github/workflows/build_n_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,18 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Set up Python 3.9
uses: actions/setup-python@v1
- uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: '3.13'
cache: 'pip'
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
# - name: Publish distribution 📦 to Test PyPI
# uses: pypa/gh-action-pypi-publish@master
# with:
# password: ${{ secrets.TEST_PYPI_TOKEN_CICD }}
# repository_url: https://test.pypi.org/legacy/
run: python -m pip install build --user
- name: Publish distribution 📦 to Test PyPI
run: python -m build --sdist --wheel --outdir dist/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN_SECRET }}
59 changes: 48 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,54 @@
name: 'Test'
name: Test

on:
push:
branches: [main, dev]
pull_request:
branches:
- main
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- name: 'Build Docker image'
run: docker build -t magphi .
- name: 'Run unit tests'
run: docker run --entrypoint /Magphi/.travis/unit-test.sh magphi
- name: 'Run functional tests'
run: docker run --entrypoint /Magphi/functional_tests/Magphi-test.sh magphi -p Magphi -d /Magphi/functional_tests/test_data -v
- uses: actions/checkout@v5

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y bedtools samtools ncbi-blast+

- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install setuptools
pip install .
pip install -r requirements-dev.txt

- name: Verify installation
run: |
which Magphi
Magphi --check
blastn -version
samtools --version | head -1
bedtools --version

- name: Run unit tests
working-directory: unit_tests
run: python Magphi_test.py

- name: Run pylint
run: pylint -E Magphi/*.py

- name: Run functional tests
run: bash functional_tests/Magphi-test.sh -p Magphi -d functional_tests/test_data -v
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ code_to_transfer/
extractor.yml
functional_tests/test_data/test_folder/
venv/
CLAUDE.md
build/
Magphi.egg-info/
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .travis/install-dependencies.sh

This file was deleted.

23 changes: 0 additions & 23 deletions .travis/unit-test.sh

This file was deleted.

2 changes: 1 addition & 1 deletion Magphi/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.pyc
*.pyc
6 changes: 3 additions & 3 deletions Magphi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import logging
from sys import argv
from math import ceil
import pkg_resources
import concurrent.futures
from tempfile import TemporaryDirectory
from importlib.metadata import version, PackageNotFoundError

try:
from Magphi.commandline_interface import get_commandline_arguments
Expand Down Expand Up @@ -79,8 +79,8 @@


try:
PROGRAM_VERSION = pkg_resources.require(PROGRAM_NAME)[0].version
except pkg_resources.DistributionNotFound:
PROGRAM_VERSION = version(PROGRAM_NAME)
except PackageNotFoundError:
PROGRAM_VERSION = "undefined_version"


Expand Down
20 changes: 11 additions & 9 deletions Magphi/check_depencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import warnings
import sys

from packaging.version import Version

try:
from Magphi.exit_with_error import exit_with_error
except ModuleNotFoundError:
Expand All @@ -20,10 +22,10 @@ def check_for_biopython(verbose):
if verbose:
print("Biopython was successfully found")

if float(Bio.__version__) >= 1.78:
if Version(Bio.__version__) >= Version('1.78'):
if verbose:
print("Biopython version is valid")
return float(Bio.__version__)
return Bio.__version__

warnings.warn('Biopython seems to be an untested version! Make sure it is version = 1.78 or above.')
return False
Expand All @@ -44,7 +46,7 @@ def check_for_pybedtools(verbose):
if verbose:
print("pybedtools was successfully found")

if pybedtools.__version__ >= '0.8.2':
if Version(pybedtools.__version__) >= Version('0.8.2'):
if verbose:
print("pybedtools version is valid")
return pybedtools.__version__
Expand All @@ -71,8 +73,8 @@ def check_for_bedtools(verbose):
print("Bedtools was successfully found")

cmd_return = subprocess.run(['bedtools', '-version'], capture_output=True)
version = cmd_return.stdout.decode().rsplit('v', 1)[-1]
if version >= '2.29.2':
version = cmd_return.stdout.decode('utf-8', errors='ignore').rsplit('v', 1)[-1]
if Version(version) >= Version('2.29.2'):
if verbose:
print("Bedtools version is valid")
return version
Expand Down Expand Up @@ -108,10 +110,10 @@ def check_for_samtools(verbose):

cmd_return = subprocess.run(['samtools', '--version'], capture_output=True)
# Isolate version tag
version = cmd_return.stdout.decode().split(' ', 1)[-1]
version = cmd_return.stdout.decode('utf-8', errors='ignore').split(' ', 1)[-1]
version = version.split('\n', 1)[0]

if version >= '1.11':
if Version(version) >= Version('1.11'):
if verbose:
print("Samtools version is valid")
return version
Expand Down Expand Up @@ -145,11 +147,11 @@ def check_for_blast_plus(verbose=False):
print("Blast+ was successfully found")

# Isolate version tag
version = cmd_return.stdout.decode().split('\n')[1]
version = cmd_return.stdout.decode('utf-8', errors='ignore').split('\n')[1]
version = version.split(' ')[3]
version = version.rsplit(',', 1)[0]

if version == '2.6.0' or version >= '2.11.0':
if Version(version) == Version('2.6.0') or Version(version) >= Version('2.11.0'):
if verbose:
print("Blast+ version is valid")
return version
Expand Down
Loading