From 680ef5967cc9ca457b1bcc5ca946085ecaaabf98 Mon Sep 17 00:00:00 2001 From: milnus <44769523+milnus@users.noreply.github.com> Date: Thu, 9 Apr 2026 19:56:14 +0200 Subject: [PATCH 01/12] Fix depricated biopython Bio.applications Use subprocess rather than depricated bio.applications from biopython --- .gitignore | 3 ++ Magphi/.gitignore | 2 +- Magphi/__main__.py | 6 +-- Magphi/search_insertion_sites.py | 63 ++++++++++++--------------- functional_tests/test_data/Magphi.log | 25 +++++++++++ requirements-dev.txt | 3 +- requirements.txt | 3 +- setup.py | 5 ++- 8 files changed, 67 insertions(+), 43 deletions(-) create mode 100644 functional_tests/test_data/Magphi.log diff --git a/.gitignore b/.gitignore index 914c268..d49d898 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ code_to_transfer/ extractor.yml functional_tests/test_data/test_folder/ venv/ +CLAUDE.md +build/ +Magphi.egg-info/ diff --git a/Magphi/.gitignore b/Magphi/.gitignore index 0d20b64..7e99e36 100644 --- a/Magphi/.gitignore +++ b/Magphi/.gitignore @@ -1 +1 @@ -*.pyc +*.pyc \ No newline at end of file diff --git a/Magphi/__main__.py b/Magphi/__main__.py index b461653..36cb6ae 100644 --- a/Magphi/__main__.py +++ b/Magphi/__main__.py @@ -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 @@ -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" diff --git a/Magphi/search_insertion_sites.py b/Magphi/search_insertion_sites.py index 55c45c6..eddfc74 100644 --- a/Magphi/search_insertion_sites.py +++ b/Magphi/search_insertion_sites.py @@ -6,11 +6,7 @@ import gzip from itertools import combinations from shutil import copyfile, copyfileobj -from Bio.Blast.Applications import NcbimakeblastdbCommandline -from Bio.Blast.Applications import NcbitblastnCommandline -from Bio.Blast.Applications import NcbiblastnCommandline -from Bio.Sequencing.Applications import SamtoolsFaidxCommandline -from Bio.Application import ApplicationError +import subprocess from Bio import SearchIO from Bio.Seq import Seq, complement, reverse_complement import pybedtools as bedtools @@ -24,7 +20,6 @@ from Magphi.split_gff_file import split_single_gff except ModuleNotFoundError: from split_gff_file import split_single_gff -# pylint: disable=E1123 def tblastn_insertion_site(seeds, genome_file, tmp_name): @@ -37,22 +32,20 @@ def tblastn_insertion_site(seeds, genome_file, tmp_name): """ # Construct genome_db path and name genome_db = f'{genome_file}_tmp_db' - # Make blast database command for given genome - c_line_makedb = NcbimakeblastdbCommandline(dbtype='nucl', input_file=genome_file, out=genome_db) - - # Run makeblastdb in command line - c_line_makedb() + # Make blast database command for given genome and run + subprocess.run( + ['makeblastdb', '-dbtype', 'nucl', '-in', genome_file, '-out', genome_db], + check=True, capture_output=True, text=True + ) blast_out_xml = f'{tmp_name}.xml' - c_line = NcbitblastnCommandline(query=seeds, - db=genome_db, - evalue=0.001, - outfmt=5, - qcov_hsp_perc=50, - out=blast_out_xml) - # Run the blast command in commandline blast - c_line() + subprocess.run( + ['tblastn', '-query', seeds, '-db', genome_db, + '-evalue', '0.001', '-outfmt', '5', '-qcov_hsp_perc', '50', + '-out', blast_out_xml], + check=True, capture_output=True, text=True + ) # Delete blast database file_list = glob.glob(f'{genome_file}_tmp_db.*') @@ -72,22 +65,20 @@ def blast_insertion_site(seeds, genome_file, tmp_name): """ # Construct genome_db path and name genome_db = f'{genome_file}_tmp_db' - # Make blast database command for given genome - c_line_makedb = NcbimakeblastdbCommandline(dbtype='nucl', input_file=genome_file, out=genome_db) - - # Run makeblastdb in command line - c_line_makedb() + # Make blast database command for given genome and run + subprocess.run( + ['makeblastdb', '-dbtype', 'nucl', '-in', genome_file, '-out', genome_db], + check=True, capture_output=True, text=True + ) blast_out_xml = f'{tmp_name}.xml' - c_line = NcbiblastnCommandline(query=seeds, - db=genome_db, - evalue=0.001, - outfmt=5, - qcov_hsp_perc=50, - out=blast_out_xml) - # Run the blast command in commandline blast - c_line() + subprocess.run( + ['blastn', '-query', seeds, '-db', genome_db, + '-evalue', '0.001', '-outfmt', '5', '-qcov_hsp_perc', '50', + '-out', blast_out_xml], + check=True, capture_output=True, text=True + ) # Delete blast database file_list = glob.glob(f'{genome_file}_tmp_db.*') @@ -428,10 +419,12 @@ def check_seeds_placement(bed_files, seed_pairs, seed_hits, max_seed_dist, genom :return: A genome file in the temporary directory and an evidence score for each bed file and its seed connections """ # Produce genome index file using samtools - samtools_faidx_cmd = SamtoolsFaidxCommandline(ref=genome_file) try: - samtools_faidx_cmd() - except ApplicationError: + subprocess.run( + ['samtools', 'faidx', genome_file], + check=True, capture_output=True, text=True + ) + except subprocess.CalledProcessError: exit_with_error(f"Samtools failed when running the command 'samtools faidx {genome_file}'", EXIT_INPUT_FILE_ERROR) # Initialise the dict to hold the support for a seed hit diff --git a/functional_tests/test_data/Magphi.log b/functional_tests/test_data/Magphi.log new file mode 100644 index 0000000..66c7394 --- /dev/null +++ b/functional_tests/test_data/Magphi.log @@ -0,0 +1,25 @@ +[2026-04-09T19:50:49+0200] INFO - __main__ - command line: /Users/magnus.jespersen/miniforge3/envs/Magphi/bin/Magphi -g test_fasta.fna test_GFF.gff -S -s empty_file +[2026-04-09T19:50:50+0200] WARNING - __main__ - Some dependencies are untested version(s) +[2026-04-09T19:50:50+0200] INFO - __main__ - Processing started +[2026-04-09T19:50:50+0200] ERROR - check_inputs - Input files were found to be of mixed type with some being recognised as fasta! +Please make sure that all your input files are only either Fasta or GFF3, not mixed +[2026-04-09T19:50:51+0200] INFO - __main__ - command line: /Users/magnus.jespersen/miniforge3/envs/Magphi/bin/Magphi -g test_fasta.fna random_text.txt -S -s empty_file +[2026-04-09T19:50:51+0200] WARNING - __main__ - Some dependencies are untested version(s) +[2026-04-09T19:50:51+0200] INFO - __main__ - Processing started +[2026-04-09T19:50:51+0200] ERROR - check_inputs - Input files were found to be of mixed type with some being recognised as fasta! +Please make sure that all your input files are only either Fasta or GFF3, not mixed +[2026-04-09T19:50:52+0200] INFO - __main__ - command line: /Users/magnus.jespersen/miniforge3/envs/Magphi/bin/Magphi -g test_GFF.gff random_text.txt -S -s empty_file +[2026-04-09T19:50:52+0200] WARNING - __main__ - Some dependencies are untested version(s) +[2026-04-09T19:50:52+0200] INFO - __main__ - Processing started +[2026-04-09T19:50:52+0200] ERROR - check_inputs - Input files were found to be of mixed type with some being recognised as GFF! +Please make sure that all your input files are only either Fasta or GFF3, not mixed +[2026-04-09T19:50:52+0200] INFO - __main__ - command line: /Users/magnus.jespersen/miniforge3/envs/Magphi/bin/Magphi -g random_text.txt -S -s empty_file +[2026-04-09T19:50:52+0200] WARNING - __main__ - Some dependencies are untested version(s) +[2026-04-09T19:50:52+0200] INFO - __main__ - Processing started +[2026-04-09T19:50:52+0200] ERROR - check_inputs - The given input files could not be recognised as either Fasta or GFF3 with a genome. +NoneType: None +[2026-04-09T19:50:53+0200] INFO - __main__ - command line: /Users/magnus.jespersen/miniforge3/envs/Magphi/bin/Magphi -g empty_file -S -s empty_file +[2026-04-09T19:50:53+0200] WARNING - __main__ - Some dependencies are untested version(s) +[2026-04-09T19:50:53+0200] INFO - __main__ - Processing started +[2026-04-09T19:50:53+0200] ERROR - check_inputs - The given input files could not be recognised as either Fasta or GFF3 with a genome. +NoneType: None diff --git a/requirements-dev.txt b/requirements-dev.txt index c54010e..d53e981 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,6 @@ # Dependencies, with versions explicitly declared for development and testing -biopython>=1.79 +biopython>=1.87 pybedtools==0.8.2 +setuptools # Packages that are not dependencies but used for building or testing pylint diff --git a/requirements.txt b/requirements.txt index 9a51a45..1da197c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ # Dependencies, with versions explicitly declared for development and testing -biopython==1.79 +biopython==1.87 pybedtools==0.8.2 +setuptools # Packages that are not dependencies but used for building or testing pylint diff --git a/setup.py b/setup.py index 87fdaa6..d6b95fb 100644 --- a/setup.py +++ b/setup.py @@ -24,8 +24,9 @@ license='MIT license', description=('A bioinformatics tool allowing for examnination and extraction of genomic features using seed sequences.'), long_description=LONG_DESCRIPTION, - install_requires=['biopython>=1.79', - 'pybedtools==0.8.2'], + install_requires=['biopython>=1.87', + 'setuptools', + 'pybedtools>=0.12.0'], keywords=['Genomic', 'extraction', 'bacteria', 'prokaryotes', 'bioinformatics'], classifiers=[ 'Programming Language :: Python :: 3.9', From f3be420521ac191fc3de7dc01fe4d28fb3eb7039 Mon Sep 17 00:00:00 2001 From: milnus <44769523+milnus@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:09:11 +0200 Subject: [PATCH 02/12] Update check_depencies.py Improve dependency version check --- Magphi/check_depencies.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Magphi/check_depencies.py b/Magphi/check_depencies.py index 4630c93..0be271a 100644 --- a/Magphi/check_depencies.py +++ b/Magphi/check_depencies.py @@ -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: @@ -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 @@ -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__ @@ -72,7 +74,7 @@ def check_for_bedtools(verbose): cmd_return = subprocess.run(['bedtools', '-version'], capture_output=True) version = cmd_return.stdout.decode().rsplit('v', 1)[-1] - if version >= '2.29.2': + if Version(version) >= Version('2.29.2'): if verbose: print("Bedtools version is valid") return version @@ -111,7 +113,7 @@ def check_for_samtools(verbose): version = cmd_return.stdout.decode().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 @@ -149,7 +151,7 @@ def check_for_blast_plus(verbose=False): 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 From a732236336b8aab350d93a8c0c3a42de4adf0e18 Mon Sep 17 00:00:00 2001 From: milnus <44769523+milnus@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:09:30 +0200 Subject: [PATCH 03/12] Pump version --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d6b95fb..b6ae16c 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name='Magphi', - version='2.0.1', + version='2.0.3', author='Magnus Ganer Jespersen', author_email='magnus.ganer.j@gmail.com', packages=['Magphi'], @@ -26,6 +26,7 @@ long_description=LONG_DESCRIPTION, install_requires=['biopython>=1.87', 'setuptools', + 'packaging', 'pybedtools>=0.12.0'], keywords=['Genomic', 'extraction', 'bacteria', 'prokaryotes', 'bioinformatics'], classifiers=[ From 82e6d183cb626429a44ec777ff61bfcb1d0b36a7 Mon Sep 17 00:00:00 2001 From: milnus <44769523+milnus@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:34:42 +0200 Subject: [PATCH 04/12] Update CI workflows --- .github/workflows/Compile_paper.yml | 4 +-- .github/workflows/Mapghi_test_suite.yml | 16 --------- .github/workflows/build_n_publish.yml | 29 +++++---------- .github/workflows/test.yml | 48 +++++++++++++++++++------ .travis.yml | 18 ---------- .travis/install-dependencies.sh | 9 ----- .travis/unit-test.sh | 23 ------------ 7 files changed, 48 insertions(+), 99 deletions(-) delete mode 100644 .github/workflows/Mapghi_test_suite.yml delete mode 100644 .travis.yml delete mode 100755 .travis/install-dependencies.sh delete mode 100755 .travis/unit-test.sh diff --git a/.github/workflows/Compile_paper.yml b/.github/workflows/Compile_paper.yml index 8535d32..4f94eb4 100644 --- a/.github/workflows/Compile_paper.yml +++ b/.github/workflows/Compile_paper.yml @@ -6,7 +6,7 @@ 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: @@ -14,7 +14,7 @@ jobs: # 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 diff --git a/.github/workflows/Mapghi_test_suite.yml b/.github/workflows/Mapghi_test_suite.yml deleted file mode 100644 index 81a125c..0000000 --- a/.github/workflows/Mapghi_test_suite.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: 'Magphi_test_suite' -on: - push: - branches: - - dev -jobs: - build: - runs-on: ubuntu-latest - 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 diff --git a/.github/workflows/build_n_publish.yml b/.github/workflows/build_n_publish.yml index b60aa50..a0f42d6 100644 --- a/.github/workflows/build_n_publish.yml +++ b/.github/workflows/build_n_publish.yml @@ -7,31 +7,18 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@main + - uses: actions/checkout@v4 - name: Set up Python 3.9 - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: '3.9' + 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 }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3fda51b..e2b4de8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,17 +1,45 @@ -name: 'Test' +name: Test + on: push: + branches: [main, dev] pull_request: - branches: - - main + branches: [main] + jobs: test: runs-on: ubuntu-latest + 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@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + 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 . + pip install -r requirements-dev.txt + + - 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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ac17947..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -sudo: true -dist: xenial -services: - - docker -language: python -python: - - "3.9" - -before_install: - - pip3 install cwltool - - docker build -t magphi . - -script: - # Both of these same tests, in Docker - # Functional tests - - docker run --entrypoint /Magphi/.travis/unit-test.sh magphi - # Unit tests - - docker run --entrypoint /Magphi/functional_tests/Magphi-test.sh magphi -p Magphi -d /Magphi/functional_tests/test_data -v diff --git a/.travis/install-dependencies.sh b/.travis/install-dependencies.sh deleted file mode 100755 index bef6e6c..0000000 --- a/.travis/install-dependencies.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Install Python dependencies - -echo 'Python install' -( - pip install -r requirements-dev.txt - pip install . -) diff --git a/.travis/unit-test.sh b/.travis/unit-test.sh deleted file mode 100755 index 9110506..0000000 --- a/.travis/unit-test.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -set -e -errors=0 - -# Run unit tests -python unit_tests/Magphi_test.py || { - echo "'python python/Magphi/Magphi_test.py' failed" - let errors+=1 -} - -# Check program style -pylint -E Magphi/*.py || { - echo 'pylint -E Magphi/*.py failed' - let errors+=1 -} - -[ "$errors" -gt 0 ] && { - echo "There were $errors errors found" - exit 1 -} - -echo "Ok : Python specific tests" From 9a1bf3cd43eb043e5650f27b5ab834b9e019a917 Mon Sep 17 00:00:00 2001 From: milnus <44769523+milnus@users.noreply.github.com> Date: Thu, 9 Apr 2026 20:39:21 +0200 Subject: [PATCH 05/12] relax biopython and install setuptools --- .github/workflows/test.yml | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e2b4de8..ce8ef41 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,7 @@ jobs: - name: Install Python dependencies run: | pip install --upgrade pip + pip install setuptools pip install . pip install -r requirements-dev.txt diff --git a/setup.py b/setup.py index b6ae16c..149000f 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ license='MIT license', description=('A bioinformatics tool allowing for examnination and extraction of genomic features using seed sequences.'), long_description=LONG_DESCRIPTION, - install_requires=['biopython>=1.87', + install_requires=['biopython>=1.79', 'setuptools', 'packaging', 'pybedtools>=0.12.0'], From d3aa04f0828bfcbda69eddd9ba3258e5089cda02 Mon Sep 17 00:00:00 2001 From: milnus <44769523+milnus@users.noreply.github.com> Date: Fri, 10 Apr 2026 06:16:14 +0200 Subject: [PATCH 06/12] change dependency requirements --- requirements-dev.txt | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index d53e981..3be827d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,6 @@ # Dependencies, with versions explicitly declared for development and testing biopython>=1.87 -pybedtools==0.8.2 +pybedtools==0.12.0 setuptools # Packages that are not dependencies but used for building or testing pylint diff --git a/requirements.txt b/requirements.txt index 1da197c..921907c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # Dependencies, with versions explicitly declared for development and testing biopython==1.87 -pybedtools==0.8.2 +pybedtools==0.12.0 setuptools # Packages that are not dependencies but used for building or testing pylint From 554e59d5b8cc01f64ee9eeb9f5a48235f3332246 Mon Sep 17 00:00:00 2001 From: milnus <44769523+milnus@users.noreply.github.com> Date: Fri, 10 Apr 2026 06:46:12 +0200 Subject: [PATCH 07/12] Fix setup --- Magphi/search_insertion_sites.py | 1 + requirements-dev.txt | 2 +- requirements.txt | 2 +- setup.py | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Magphi/search_insertion_sites.py b/Magphi/search_insertion_sites.py index eddfc74..3adbc4f 100644 --- a/Magphi/search_insertion_sites.py +++ b/Magphi/search_insertion_sites.py @@ -935,6 +935,7 @@ def screen_genome_for_seeds(genome_file, seed_pairs, seed_path, tmp_folder, tmp_genome_folder = os.path.join(tmp_folder, genome_name) os.mkdir(tmp_genome_folder) + annotation_file = None if file_type == 'fasta': tmp_genome = os.path.join(tmp_genome_folder, genome_file.rsplit('/')[-1]) diff --git a/requirements-dev.txt b/requirements-dev.txt index 3be827d..a6b4f86 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,5 @@ # Dependencies, with versions explicitly declared for development and testing -biopython>=1.87 +biopython>=1.85 pybedtools==0.12.0 setuptools # Packages that are not dependencies but used for building or testing diff --git a/requirements.txt b/requirements.txt index 921907c..b76b0f2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Dependencies, with versions explicitly declared for development and testing -biopython==1.87 +biopython==1.85 pybedtools==0.12.0 setuptools # Packages that are not dependencies but used for building or testing diff --git a/setup.py b/setup.py index 149000f..83b7c85 100644 --- a/setup.py +++ b/setup.py @@ -24,13 +24,13 @@ license='MIT license', description=('A bioinformatics tool allowing for examnination and extraction of genomic features using seed sequences.'), long_description=LONG_DESCRIPTION, - install_requires=['biopython>=1.79', + install_requires=['biopython>=1.85', 'setuptools', 'packaging', 'pybedtools>=0.12.0'], keywords=['Genomic', 'extraction', 'bacteria', 'prokaryotes', 'bioinformatics'], classifiers=[ - 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Intended Audience :: Science/Research', From 692e4b69487eb0cc85676a73cbcc7e16e7186a3a Mon Sep 17 00:00:00 2001 From: milnus <44769523+milnus@users.noreply.github.com> Date: Fri, 10 Apr 2026 06:55:09 +0200 Subject: [PATCH 08/12] Make help message test more dynamic --- functional_tests/Magphi-test.sh | 39 +++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/functional_tests/Magphi-test.sh b/functional_tests/Magphi-test.sh index 789b45f..7e2a20b 100755 --- a/functional_tests/Magphi-test.sh +++ b/functional_tests/Magphi-test.sh @@ -164,6 +164,41 @@ function test_exit_status { fi } +# Run a command and check that all expected strings appear in the output +# ARG1: command we want to test as a string +# ARG2: expected exit status +# ARG3+: strings that must appear in the output +function test_stdout_contains { + let num_tests+=1 + local cmd=$1 + local expected_exit_status=$2 + shift 2 + local expected_strings=("$@") + output=$(eval $cmd 2>&1) + exit_status=$? + verbose_message "Testing stdout contains strings: $cmd" + local failed=0 + for s in "${expected_strings[@]}"; do + if [[ "$output" != *"$s"* ]]; then + let num_errors+=1 + echo "TEST FAILED!" + echo "Test output failed (missing expected string): $cmd" + echo "Expected to find: $s" + echo "Actual output:" + echo "$output" + failed=1 + break + fi + done + if [ "$failed" -eq 0 ] && [ "$exit_status" -ne "$expected_exit_status" ]; then + let num_errors+=1 + echo "TEST FAILED!" + echo "Test exit status failed: $cmd" + echo "Actual exit status: $exit_status" + echo "Expected exit status: $expected_exit_status" + fi +} + function call_new_test { echo '' echo $1 @@ -177,10 +212,10 @@ cd $test_data_dir ## Test commandline exit status # Test output for no arguments call_new_test "Test output for no arguments" -test_stdout_exit "$test_program" no_input.expected 2 +test_stdout_contains "$test_program" 2 "Magphi" "Welcome to Magphi" "--input_genomes" "--input_seeds" "--help" # Test output for -help argument given call_new_test "Test output for -help argument given" -test_stdout_exit "$test_program -help" no_input.expected 0 +test_stdout_contains "$test_program -help" 0 "Magphi" "Welcome to Magphi" "--input_genomes" "--input_seeds" "--help" # Test exit status for a bad command line invocation call_new_test "Test exit status for a bad command line invocation" test_exit_status "$test_program --this_is_not_a_valid_argument > /dev/null 2>&1" 2 From 9c6e17b9cc6a08a592ddbba8dd4202c5f2beec56 Mon Sep 17 00:00:00 2001 From: milnus <44769523+milnus@users.noreply.github.com> Date: Fri, 10 Apr 2026 07:33:04 +0200 Subject: [PATCH 09/12] Fix up CI workflow --- .github/workflows/test.yml | 10 +++++- functional_tests/Magphi-test.sh | 50 +++++++++++++-------------- functional_tests/test_data/Magphi.log | 25 ++++++++++++++ 3 files changed, 59 insertions(+), 26 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ce8ef41..dfd4fa8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: @@ -35,6 +35,14 @@ jobs: 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 diff --git a/functional_tests/Magphi-test.sh b/functional_tests/Magphi-test.sh index 7e2a20b..c66a145 100755 --- a/functional_tests/Magphi-test.sh +++ b/functional_tests/Magphi-test.sh @@ -207,7 +207,7 @@ function call_new_test { # 1. Parse command line arguments. parse_args $@ # 2. Change to test directory -cd $test_data_dir +cd "$test_data_dir" || exit_with_error "could not cd to $test_data_dir" 1 # 2. Run tests ## Test commandline exit status # Test output for no arguments @@ -240,61 +240,61 @@ test_exit_status "$test_program -g empty_file -S -s empty_file > /dev/null 2>&1" # Run test for evidence level when no seed hits are found call_new_test "Run test for evidence level when no seed hits are found" -Magphi -g evidence_levels_simple_genome.fasta -S -s no_primers_match_primers.fasta -o test_out_folder +$test_program -g evidence_levels_simple_genome.fasta -S -s no_primers_match_primers.fasta -o test_out_folder test_output_file test_out_folder/master_seed_evidence.csv no_primers_match_evidence_levels.expected rm -r test_out_folder # Run test for evidence level when a single seed hit is found call_new_test "Test for evidence level when a single seed hit is found" -Magphi -g evidence_levels_simple_genome.fasta -S -s single_primer_match_primers.fasta -o test_out_folder +$test_program -g evidence_levels_simple_genome.fasta -S -s single_primer_match_primers.fasta -o test_out_folder test_output_file test_out_folder/master_seed_evidence.csv one_primer_match_evidence_level.expected rm -r test_out_folder # Run test for evidence level when two primers hit multiple times on same contig, but cannot connect call_new_test "Test for evidence level when two primers hit multiple times on same contig, but cannot connect" -Magphi -g evidence_levels_simple_genome.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 1 +$test_program -g evidence_levels_simple_genome.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 1 test_output_file test_out_folder/master_seed_evidence.csv two_primers_multiple_hits_single_contig_no_connections.expected rm -r test_out_folder # Run test for evidence level when two primers hit the same contig multiple times and they can connect multiple ways call_new_test "Test for evidence level when two primers hit the same contig multiple times and they can connect multiple ways" -Magphi -g evidence_levels_simple_genome.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 1000 +$test_program -g evidence_levels_simple_genome.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 1000 test_output_file test_out_folder/master_seed_evidence.csv two_primers_multiple_hits_single_contig_multiple_connections.expected rm -r test_out_folder # Run test for evidence level when two primers hit multiple contigs multiple times and no connection between them call_new_test "Test for evidence level when two primers hit multiple contigs multiple times and no connection between them" -Magphi -g evidence_levels_simple_two_contigs.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 1 +$test_program -g evidence_levels_simple_two_contigs.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 1 test_output_file test_out_folder/master_seed_evidence.csv two_primers_two_contigs_multipe_hits_no_connection.expected rm -r test_out_folder # run test for evidence level when two seeds hit multiple contigs multiple times and multiple connections call_new_test "Test for evidence level when two seeds hit multiple contigs multiple times and multiple connections" -Magphi -g evidence_levels_simple_two_contigs.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 1000 +$test_program -g evidence_levels_simple_two_contigs.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 1000 test_output_file test_out_folder/master_seed_evidence.csv two_primers_two_contigs_multi_hit_multi_connect.expected rm -r test_out_folder # Run test for evidence level when two seeds overlap and are excluded because primers are deleted call_new_test "Test for evidence level when two seeds overlap and are excluded because primers are deleted" -Magphi -g evidence_levels_overlap_two_contigs.fasta -S -s overlap_primers.fasta -o test_out_folder -md 1 +$test_program -g evidence_levels_overlap_two_contigs.fasta -S -s overlap_primers.fasta -o test_out_folder -md 1 test_output_file test_out_folder/master_seed_evidence.csv evidence_levels_overlapping_seeds.expected rm -r test_out_folder # Run test for evidence level when one seed is on the edge of a contig and is deleted due to being excluded call_new_test "Test for evidence level when one seed is on the edge of a contig and is deleted due to being excluded" -Magphi -g evidence_levels_overlap_two_contigs.fasta -S -s contig_edge_primers.fasta -o test_out_folder -md 180 +$test_program -g evidence_levels_overlap_two_contigs.fasta -S -s contig_edge_primers.fasta -o test_out_folder -md 180 test_output_file test_out_folder/master_seed_evidence.csv evidence_levels_contig_edge.expected rm -r test_out_folder # Run test for evidence level when only two unique seeds hit but can not connect call_new_test "Test for evidence level when only two unique seeds hit but can not connect" -Magphi -g two_contigs_two_primers_single_hit.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 1 +$test_program -g two_contigs_two_primers_single_hit.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 1 test_output_file test_out_folder/master_seed_evidence.csv evidence_levels_simple_hits_cross_contig_no_connect.expected rm -r test_out_folder # Run test for evidence level when only two unique seeds hit with connection but no annotation call_new_test "Test for evidence level when only two unique seeds hit with connection but no annotation" -Magphi -g two_contigs_two_primers_single_hit.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -b -md 70 +$test_program -g two_contigs_two_primers_single_hit.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -b -md 70 test_output_file test_out_folder/master_seed_evidence.csv evidence_levels_simple_hits_cross_contig_connected/master_seed_evidence.csv test_output_file test_out_folder/inter_seed_distance.csv evidence_levels_simple_hits_cross_contig_connected/inter_seed_distance.csv test_output_file test_out_folder/two_primers_simple/two_contigs_two_primers_single_hit-two_primers_simple_1_break.fasta evidence_levels_simple_hits_cross_contig_connected/two_contigs_two_primers_single_hit-two_primers_simple_1_break.fasta @@ -303,7 +303,7 @@ rm -r test_out_folder # Run test for evidence level when only two unique seeds hit with connection and annotation call_new_test "Test for evidence level when only two unique seeds hit with connection and annotation" -Magphi -g two_contigs_two_primers_single_hit.gff -S -s two_seeds_w_annotation_between.fasta -o test_out_folder -b -md 375 +$test_program -g two_contigs_two_primers_single_hit.gff -S -s two_seeds_w_annotation_between.fasta -o test_out_folder -b -md 375 test_output_file test_out_folder/master_seed_evidence.csv evidence_levels_simple_primers_connect_cross_contig_with_annotations/master_seed_evidence.csv test_output_file test_out_folder/inter_seed_distance.csv evidence_levels_simple_primers_connect_cross_contig_with_annotations/inter_seed_distance.csv test_output_file test_out_folder/annotation_num_matrix.csv evidence_levels_simple_primers_connect_cross_contig_with_annotations/annotation_num_matrix.csv @@ -315,13 +315,13 @@ rm -r test_out_folder # Run test on a gff with a single contig no connection between primers call_new_test 'Test of a gff with a single contig no connection between primers' -Magphi -g evidence_levels_single_contig.gff -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 1 +$test_program -g evidence_levels_single_contig.gff -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 1 test_output_file test_out_folder/master_seed_evidence.csv evidence_levels_single_contig_no_connection/master_seed_evidence.csv rm -r test_out_folder # Run test on a gff with a single contig with connection between primers call_new_test "Test of a gff with a single contig with connection between primers" -Magphi -g evidence_levels_single_contig.gff -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 100 +$test_program -g evidence_levels_single_contig.gff -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 100 test_output_file test_out_folder/master_seed_evidence.csv evidence_levels_single_contig_connection/master_seed_evidence.csv test_output_file test_out_folder/inter_seed_distance.csv evidence_levels_single_contig_connection/inter_seed_distance.csv test_output_file test_out_folder/two_primers_simple/evidence_levels_single_contig-two_primers_simple.fasta evidence_levels_single_contig_connection/evidence_levels_single_contig-two_primers_simple.fasta @@ -330,7 +330,7 @@ rm -r test_out_folder # Run test on a gff with a single contig with connection and annotation between primers - exclude seeds call_new_test "Test of a gff with a single contig with connection and annotation between primers - exclude seeds" -Magphi -g evidence_levels_single_contig.gff -S -s two_seeds_w_annotation_between.fasta -o test_out_folder -md 750 -is +$test_program -g evidence_levels_single_contig.gff -S -s two_seeds_w_annotation_between.fasta -o test_out_folder -md 750 -is test_output_file test_out_folder/master_seed_evidence.csv evidence_level_single_contigs_connect_annotations_include_seeds/master_seed_evidence.csv test_output_file test_out_folder/inter_seed_distance.csv evidence_level_single_contigs_connect_annotations_include_seeds/inter_seed_distance.csv test_output_file test_out_folder/annotation_primers/evidence_levels_single_contig-annotation_primers.gff evidence_level_single_contigs_connect_annotations_include_seeds/evidence_levels_single_contig-annotation_primers.gff @@ -340,7 +340,7 @@ rm -r test_out_folder # Test output when seeds hit multiple times and one and only one connection can be made between seeds on same contig call_new_test "Test output when seeds hit multiple times and one and only one connection can be made between seeds on same contig" -Magphi -g evidence_levels_simple_two_contigs.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 130 +$test_program -g evidence_levels_simple_two_contigs.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -md 130 test_output_file test_out_folder/master_seed_evidence.csv evidence_level_multi_hit_multi_contig_single_same_contig_overlap/master_seed_evidence.csv test_output_file test_out_folder/inter_seed_distance.csv evidence_level_multi_hit_multi_contig_single_same_contig_overlap/inter_seed_distance.csv test_output_file test_out_folder/contig_hit_matrix.csv evidence_level_multi_hit_multi_contig_single_same_contig_overlap/contig_hit_matrix.csv @@ -349,7 +349,7 @@ rm -r test_out_folder # Test output when seeds hit multiple times and one and only one connection can be made between seeds on different contig call_new_test "Test output when seeds hit multiple times and one and only one connection can be made between seeds on different contig" -Magphi -g evidence_levels_simple_two_contigs_cross_conenct.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -b -md 180 +$test_program -g evidence_levels_simple_two_contigs_cross_conenct.fasta -S -s two_primers_simple_match_primers.fasta -o test_out_folder -b -md 180 test_output_file test_out_folder/master_seed_evidence.csv evidence_level_multi_seed_hit_cross_contig_connect/master_seed_evidence.csv test_output_file test_out_folder/inter_seed_distance.csv evidence_level_multi_seed_hit_cross_contig_connect/inter_seed_distance.csv test_output_file test_out_folder/contig_hit_matrix.csv evidence_level_multi_seed_hit_cross_contig_connect/contig_hit_matrix.csv @@ -359,7 +359,7 @@ rm -r test_out_folder # Test gzipped gff file call_new_test 'Test gzipped file' -test_exit_status "Magphi -g evidence_levels_single_contig.gff.gz -S -s two_seeds_w_annotation_between.fasta -o test_out_folder -md 750 -is" 0 +test_exit_status "$test_program -g evidence_levels_single_contig.gff.gz -S -s two_seeds_w_annotation_between.fasta -o test_out_folder -md 750 -is" 0 test_output_file test_out_folder/master_seed_evidence.csv evidence_level_single_contigs_connect_annotations_include_seeds/master_seed_evidence.csv test_output_file test_out_folder/inter_seed_distance.csv evidence_level_single_contigs_connect_annotations_include_seeds/inter_seed_distance.csv test_output_file test_out_folder/annotation_primers/evidence_levels_single_contig-annotation_primers.gff evidence_level_single_contigs_connect_annotations_include_seeds/evidence_levels_single_contig-annotation_primers.gff @@ -369,7 +369,7 @@ rm -r test_out_folder # Test gzipped fasta file evidence level when only two unique seeds hit with connection but no annotation call_new_test "Test gzipped fasta file evidence level when only two unique seeds hit with connection but no annotation" -Magphi -g two_contigs_two_primers_single_hit.fasta.gz -S -s two_primers_simple_match_primers.fasta -o test_out_folder -b -md 70 +$test_program -g two_contigs_two_primers_single_hit.fasta.gz -S -s two_primers_simple_match_primers.fasta -o test_out_folder -b -md 70 test_output_file test_out_folder/master_seed_evidence.csv evidence_levels_simple_hits_cross_contig_connected/master_seed_evidence.csv test_output_file test_out_folder/inter_seed_distance.csv evidence_levels_simple_hits_cross_contig_connected/inter_seed_distance.csv test_output_file test_out_folder/two_primers_simple/two_contigs_two_primers_single_hit-two_primers_simple_1_break.fasta evidence_levels_simple_hits_cross_contig_connected/two_contigs_two_primers_single_hit-two_primers_simple_1_break.fasta @@ -379,7 +379,7 @@ rm -r test_out_folder # Chaws problem. call_new_test "Test larger mock up of problem reported in emm4" -Magphi -g \ +$test_program -g \ gff3_files_larger_test/*.gff -S -s larger_test_primers.fa -o test_out_folder -md 15000 -is test_output_file test_out_folder/annotation_num_matrix.csv larger_Magphi_test/annotation_num_matrix.csv test_output_file test_out_folder/inter_seed_distance.csv larger_Magphi_test/inter_seed_distance.csv @@ -390,7 +390,7 @@ rm -r test_out_folder # Test input seeds being proteins and the tblastn function call_new_test "Test input seeds being proteins and the tblastn function - with correct -p flag" -Magphi -g tblasn_test/tblastn_genome.fasta -S -s tblasn_test/prot_seeds.fasta -o test_out_folder -md 140 -p +$test_program -g tblasn_test/tblastn_genome.fasta -S -s tblasn_test/prot_seeds.fasta -o test_out_folder -md 140 -p test_output_file test_out_folder/master_seed_evidence.csv tblastn_simple_expected/master_seed_evidence.expected test_output_file test_out_folder/inter_seed_distance.csv tblastn_simple_expected/inter_seed_distance.expected test_output_file test_out_folder/contig_hit_matrix.csv tblastn_simple_expected/contig_hit_matrix.expected @@ -398,7 +398,7 @@ rm -r test_out_folder # Test input seeds being proteins and the tblastn function call_new_test "Test input seeds being proteins and the tblastn function - No -p flag" -Magphi -g tblasn_test/tblastn_genome.fasta -S -s tblasn_test/prot_seeds.fasta -o test_out_folder -md 140 +$test_program -g tblasn_test/tblastn_genome.fasta -S -s tblasn_test/prot_seeds.fasta -o test_out_folder -md 140 test_output_file test_out_folder/master_seed_evidence.csv tblastn_simple_expected/master_seed_evidence.expected test_output_file test_out_folder/inter_seed_distance.csv tblastn_simple_expected/inter_seed_distance.expected test_output_file test_out_folder/contig_hit_matrix.csv tblastn_simple_expected/contig_hit_matrix.expected @@ -406,7 +406,7 @@ rm -r test_out_folder # Test output fasta when they are reverse complemented to orient seed call_new_test "Test output fasta when they are reverse complemented to orient seed" -Magphi -g Fix_start_genome.fasta -s fixstart_seeds.fasta -o test_out_folder -b -md 5 +$test_program -g Fix_start_genome.fasta -s fixstart_seeds.fasta -o test_out_folder -b -md 5 test_output_file test_out_folder/fixstart/Fix_start_genome-fixstart.fasta fix_start/Fix_start_genome-fixstart_rev_comp.fasta.expected rm -r test_out_folder @@ -424,7 +424,7 @@ rm -r test_out_folder # Test output gff when they are reverse complemented to orient seed call_new_test "Test output gff when they are reverse complemented to orient seed" -Magphi -g Fix_start_genome.gff -s fixstart_seeds.fasta -o test_out_folder -b -md 5 +$test_program -g Fix_start_genome.gff -s fixstart_seeds.fasta -o test_out_folder -b -md 5 test_output_file test_out_folder/fixstart/Fix_start_genome-fixstart.gff fix_start/Fix_start_genome-fixstart_reverse_complemented.gff.expected rm -r test_out_folder @@ -442,7 +442,7 @@ rm -r test_out_folder # Test output gff when two genes are present and they are reverse complemented to orient seed call_new_test "Test output gff when two genes are present and they are reverse complemented to orient seed" -Magphi -g Fix_start_genome_2.gff -s fixstart_seeds.fasta -o test_out_folder -b -md 5 +$test_program -g Fix_start_genome_2.gff -s fixstart_seeds.fasta -o test_out_folder -b -md 5 test_output_file test_out_folder/fixstart/Fix_start_genome_2-fixstart.gff fix_start/Fix_start_genome_2-fixstart_reverse_complement.gff.expected rm -r test_out_folder diff --git a/functional_tests/test_data/Magphi.log b/functional_tests/test_data/Magphi.log index 66c7394..6006626 100644 --- a/functional_tests/test_data/Magphi.log +++ b/functional_tests/test_data/Magphi.log @@ -23,3 +23,28 @@ NoneType: None [2026-04-09T19:50:53+0200] INFO - __main__ - Processing started [2026-04-09T19:50:53+0200] ERROR - check_inputs - The given input files could not be recognised as either Fasta or GFF3 with a genome. NoneType: None +[2026-04-10T06:57:43+0200] INFO - __main__ - command line: /Users/magnus.jespersen/miniforge3/envs/Magphi/bin/Magphi -g test_fasta.fna test_GFF.gff -S -s empty_file +[2026-04-10T06:57:44+0200] WARNING - __main__ - Some dependencies are untested version(s) +[2026-04-10T06:57:44+0200] INFO - __main__ - Processing started +[2026-04-10T06:57:44+0200] ERROR - check_inputs - Input files were found to be of mixed type with some being recognised as fasta! +Please make sure that all your input files are only either Fasta or GFF3, not mixed +[2026-04-10T06:57:44+0200] INFO - __main__ - command line: /Users/magnus.jespersen/miniforge3/envs/Magphi/bin/Magphi -g test_fasta.fna random_text.txt -S -s empty_file +[2026-04-10T06:57:44+0200] WARNING - __main__ - Some dependencies are untested version(s) +[2026-04-10T06:57:44+0200] INFO - __main__ - Processing started +[2026-04-10T06:57:44+0200] ERROR - check_inputs - Input files were found to be of mixed type with some being recognised as fasta! +Please make sure that all your input files are only either Fasta or GFF3, not mixed +[2026-04-10T06:57:45+0200] INFO - __main__ - command line: /Users/magnus.jespersen/miniforge3/envs/Magphi/bin/Magphi -g test_GFF.gff random_text.txt -S -s empty_file +[2026-04-10T06:57:45+0200] WARNING - __main__ - Some dependencies are untested version(s) +[2026-04-10T06:57:45+0200] INFO - __main__ - Processing started +[2026-04-10T06:57:45+0200] ERROR - check_inputs - Input files were found to be of mixed type with some being recognised as GFF! +Please make sure that all your input files are only either Fasta or GFF3, not mixed +[2026-04-10T06:57:46+0200] INFO - __main__ - command line: /Users/magnus.jespersen/miniforge3/envs/Magphi/bin/Magphi -g random_text.txt -S -s empty_file +[2026-04-10T06:57:46+0200] WARNING - __main__ - Some dependencies are untested version(s) +[2026-04-10T06:57:46+0200] INFO - __main__ - Processing started +[2026-04-10T06:57:46+0200] ERROR - check_inputs - The given input files could not be recognised as either Fasta or GFF3 with a genome. +NoneType: None +[2026-04-10T06:57:47+0200] INFO - __main__ - command line: /Users/magnus.jespersen/miniforge3/envs/Magphi/bin/Magphi -g empty_file -S -s empty_file +[2026-04-10T06:57:47+0200] WARNING - __main__ - Some dependencies are untested version(s) +[2026-04-10T06:57:47+0200] INFO - __main__ - Processing started +[2026-04-10T06:57:47+0200] ERROR - check_inputs - The given input files could not be recognised as either Fasta or GFF3 with a genome. +NoneType: None From 5b72fbd6c3138c11f5694265065b4b2e06e715c7 Mon Sep 17 00:00:00 2001 From: milnus <44769523+milnus@users.noreply.github.com> Date: Fri, 10 Apr 2026 07:36:36 +0200 Subject: [PATCH 10/12] Fix utf-8 problem --- Magphi/check_depencies.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Magphi/check_depencies.py b/Magphi/check_depencies.py index 0be271a..69b4b59 100644 --- a/Magphi/check_depencies.py +++ b/Magphi/check_depencies.py @@ -73,7 +73,7 @@ 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] + 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") @@ -110,7 +110,7 @@ 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(version) >= Version('1.11'): @@ -147,7 +147,7 @@ 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] From b3aff7a47a5100069222d7d8838f8603fe4a1cc4 Mon Sep 17 00:00:00 2001 From: milnus <44769523+milnus@users.noreply.github.com> Date: Fri, 10 Apr 2026 08:30:02 +0200 Subject: [PATCH 11/12] Update actions for deprication --- .github/workflows/build_n_publish.yml | 6 +++--- .github/workflows/test.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_n_publish.yml b/.github/workflows/build_n_publish.yml index a0f42d6..eb28321 100644 --- a/.github/workflows/build_n_publish.yml +++ b/.github/workflows/build_n_publish.yml @@ -8,10 +8,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python 3.9 - uses: actions/setup-python@v5 + - 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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dfd4fa8..71c84ac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,10 +15,10 @@ jobs: python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} cache: 'pip' From b8ba4935229391eac1a184e81c4a7f08aa8aa244 Mon Sep 17 00:00:00 2001 From: milnus <44769523+milnus@users.noreply.github.com> Date: Fri, 10 Apr 2026 08:34:52 +0200 Subject: [PATCH 12/12] Bump version Indicate with version that there are some major changes, without interface changing --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 83b7c85..e066f9b 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name='Magphi', - version='2.0.3', + version='2.1.0', author='Magnus Ganer Jespersen', author_email='magnus.ganer.j@gmail.com', packages=['Magphi'],