From f22bbcb92b2ca36b995b0edd31655ee080f341cb Mon Sep 17 00:00:00 2001 From: Thomas Cokelaer Date: Tue, 7 Apr 2026 20:32:34 +0200 Subject: [PATCH 1/5] Fix CI: update mamba-org/setup-micromamba to v2 --- .github/workflows/main.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9705baf..afcf059 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,25 +17,27 @@ jobs: strategy: max-parallel: 5 matrix: - python: [3.9, '3.10', '3.11'] + python: ['3.11', '3.12'] fail-fast: false - steps: - name: install graphviz run: | + sudo apt-get update -qq sudo apt-get install -y graphviz - name: checkout git repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: conda/mamba - uses: mamba-org/setup-micromamba@v1 + uses: mamba-org/setup-micromamba@v2 with: environment-file: environment.yml create-args: >- python=${{ matrix.python }} + cache-environment: true + cache-downloads: true - name: install package itself shell: bash -l {0} @@ -45,14 +47,15 @@ jobs: - name: Install dependencies shell: bash -l {0} run: | - pip install coveralls pytest-cov pytest pytest-xdist pytest-mock pytest-asyncio + pip install coveralls pytest-cov pytest pytest-xdist - name: testing shell: bash -l {0} run: | - pytest --cov-report term --cov=sequana_pipelines.lora + pytest -v --cov-report term-missing --cov=sequana_pipelines.lora - name: coveralls + continue-on-error: true shell: bash -l {0} run: | echo $COVERALLS_REPO_TOKEN From 5b4ca7b3c39c7be8d590448ed6fa5f86031509ce Mon Sep 17 00:00:00 2001 From: Thomas Cokelaer Date: Tue, 8 Sep 2026 18:30:22 +0200 Subject: [PATCH 2/5] Fix BUSCO lineage retrieval and --busco-print-lineages The lineage listing was fetched from busco-data.ezlab.org/v5/data/lineages/, which now 301-redirects to an empty S3 index (HTTP 200, 0 bytes). As a result no lineage was ever found: --busco-print-lineages printed nothing and any --busco-lineage value was rejected as invalid, while BeautifulSoup emitted "Some characters could not be decoded". - fetch from the v6 listing, which hosts both odb10 and odb12 datasets - match lineage names with a regex on the exact ODB version and release date instead of splitting on "_odbXX": odb12.2 is a distinct release from odb12 and the two were silently mixed. Keep the most recent date per lineage - add odb12.2 to --busco-db-version choices - use response.text and catch RequestException instead of ConnectionError - make --busco-print-lineages an eager option so it prints and exits without requiring --assembler, --genome-size and the other mandatory options. --busco-db-version is eager too, with a sys.argv fallback so the order of the two options does not matter Also included: fastp container updated to 1.0.1, pulp>=2.8 added to environment.yml, Python badge in README. Version stays at 1.1.0. --- README.rst | 21 +++++++++++-- environment.yml | 35 +++++++++++---------- sequana_pipelines/lora/config.yaml | 2 +- sequana_pipelines/lora/info.py | 49 ++++++++++++++++++++---------- sequana_pipelines/lora/main.py | 36 ++++++++++++++++------ 5 files changed, 96 insertions(+), 47 deletions(-) diff --git a/README.rst b/README.rst index 4159e8d..cf7bf08 100644 --- a/README.rst +++ b/README.rst @@ -13,6 +13,10 @@ :target: https://app.codacy.com/gh/sequana/lora/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade :alt: Codacy grade +.. image:: https://img.shields.io/badge/python-3.11%20%7C%203.12-blue.svg + :target: https://pypi.python.org/pypi/sequana_lora + :alt: Python 3.11 | 3.12 + LORA — Long Read Assembly pipeline @@ -30,11 +34,11 @@ LORA — Long Read Assembly pipeline Journal of Open Source Software, 2(16), 352, `doi:10.21105/joss.00352 `_ - Zenodo DOI: + Zenodo DOI: .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.19330782.svg :target: https://doi.org/10.5281/zenodo.18337877 - Biorxiv: + Biorxiv: https://www.biorxiv.org/content/10.64898/2026.01.06.697901v1 @@ -383,7 +387,18 @@ Changelog ========= ==================================================================== Version Description ========= ==================================================================== -1.1.0 * remote BLAST via NCBI URL API (no local database needed); sequential +1.1.0 * fix BUSCO lineage retrieval: the v5 listing on busco-data.ezlab.org + now redirects to an empty S3 index, so no lineage could be found + (--busco-print-lineages printed nothing and any --busco-lineage was + rejected as invalid). We now use the v6 listing, which hosts both + odb10 and odb12 datasets + * BUSCO lineage names are matched on the exact ODB version (odb12.2 is + a distinct release from odb12) and the most recent release date is + kept for a given lineage. odb12.2 added to --busco-db-version + * --busco-print-lineages is now an eager option: it prints the + lineages and exits without requiring --assembler, --genome-size and + the other mandatory options + * remote BLAST via NCBI URL API (no local database needed); sequential submission to avoid IP-level CPU throttling * entrez_query support to restrict BLAST to a taxonomic group (e.g. Bacteria[Organism], refseq_genomic) — equivalent to the diff --git a/environment.yml b/environment.yml index 1dc5fae..cded15f 100644 --- a/environment.yml +++ b/environment.yml @@ -1,21 +1,20 @@ name: mapper - channels: - - conda-forge - - bioconda - - defaults - +- conda-forge +- bioconda +- defaults dependencies: - - flye - - minimap2 - - bowtie2 - - samtools - - seqkit - - seqtk - - quast - - prokka - - blast - - blast - - fastp - - pip: - - sequana +- flye +- minimap2 +- bowtie2 +- samtools +- seqkit +- seqtk +- quast +- prokka +- blast +- blast +- fastp +- pulp>=2.8 +- pip: + - sequana diff --git a/sequana_pipelines/lora/config.yaml b/sequana_pipelines/lora/config.yaml index c750e72..9a38ceb 100644 --- a/sequana_pipelines/lora/config.yaml +++ b/sequana_pipelines/lora/config.yaml @@ -23,7 +23,7 @@ apptainers: ccs: https://zenodo.org/record/7817325/files/ccs_6.4.0.img circlator: https://zenodo.org/record/7821905/files/circlator_1.5.5.img flye: https://zenodo.org/record/10409326/files/flye_2.9.3.img - fastp: https://zenodo.org/record/8036563/files/fastp_0.23.3.img + fastp: https://zenodo.org/record/17097941/files/fastp_1.0.1.img graphviz: https://zenodo.org/record/7928262/files/graphviz_7.0.5.img hifiasm: https://zenodo.org/record/10610397/files/hifiasm_0.19.8.img medaka: https://zenodo.org/record/7846295/files/medaka_1.7.3.img diff --git a/sequana_pipelines/lora/info.py b/sequana_pipelines/lora/info.py index 3a8e097..0139f79 100644 --- a/sequana_pipelines/lora/info.py +++ b/sequana_pipelines/lora/info.py @@ -1,3 +1,5 @@ +import re + import requests from bs4 import BeautifulSoup @@ -1455,33 +1457,48 @@ ] -def get_busco_lineages_and_urls(base_url="https://busco-data.ezlab.org/v5/data/lineages/", version="odb10"): - """ - Fetches and prints the list of files and their URLs from the given URL. +def get_busco_lineages_and_urls(base_url="https://busco-data.ezlab.org/v6/data/lineages/", version="odb12"): + """Fetch the list of BUSCO lineages and their URLs for a given ODB version. + + The listing hosted on busco-data.ezlab.org contains all datasets of all + versions. Note that a dataset name such as *odb12.2* is a different release + from *odb12*, so we match the version exactly (the version must be followed + by the release date). + + When several dates are available for the same lineage, the most recent one + is kept. :param base_url: URL of the page to scrape - :return: List of tuples containing file names and their corresponding URLs + :param version: the ODB version (e.g. odb10, odb12, odb12.2) + :return: dictionary of lineage names and their corresponding URLs """ response = requests.get(base_url) response.raise_for_status() # Raise an exception for HTTP errors - # Parse the HTML content with BeautifulSoup - soup = BeautifulSoup(response.content, "html.parser") + # Parse the HTML content with BeautifulSoup (use .text so that the encoding + # advertised by the server is honoured) + soup = BeautifulSoup(response.text, "html.parser") - # Find all anchor tags () that have an href attribute - links = soup.find_all("a", href=True) + # e.g. euglenozoa_odb12.2026-05-22.tar.gz --> (euglenozoa, 2026-05-22) + pattern = re.compile( + rf"^(?P.+)_{re.escape(version)}\.(?P\d{{4}}-\d{{2}}-\d{{2}})\.(?:tar\.gz|tgz|tar|zip|gz)$" + ) - # Extract file names and their full URLs, filtering to the requested version only - files = [ - (link.get_text().split(f"_{version}")[0], base_url + link["href"]) - for link in links - if link["href"].endswith(("tar.gz", "zip", "tar", "gz")) and f"_{version}" in link["href"] - ] + lineages = {} + for link in soup.find_all("a", href=True): + match = pattern.match(link["href"]) + if not match: + continue + name, date = match.group("name"), match.group("date") + # several dates may co-exist for a given lineage; keep the most recent + if name not in lineages or date > lineages[name][0]: + lineages[name] = (date, base_url + link["href"]) - return dict(files) + return {name: url for name, (_, url) in lineages.items()} try: busco = get_busco_lineages_and_urls(version="odb12") -except requests.exceptions.ConnectionError: +except requests.exceptions.RequestException: # pragma: no cover + # no network (or the server is down); lineage names are validated in main() busco = {} diff --git a/sequana_pipelines/lora/main.py b/sequana_pipelines/lora/main.py index b6d3506..eb5fcf5 100644 --- a/sequana_pipelines/lora/main.py +++ b/sequana_pipelines/lora/main.py @@ -104,6 +104,28 @@ def convert(self, value, param, ctx): return value +def print_busco_lineages(ctx, param, value): + """Print available lineages and exit (eager, so no other option is required).""" + if not value or ctx.resilient_parsing: + return + + # --busco-db-version may not have been processed yet, hence the fallback on sys.argv + version = ctx.params.get("busco_db_version") + if version is None: + version = "odb12" + for i, arg in enumerate(sys.argv): + if arg == "--busco-db-version" and i + 1 < len(sys.argv): + version = sys.argv[i + 1] + elif arg.startswith("--busco-db-version="): + version = arg.split("=", 1)[1] + + busco_db = get_busco_lineages_and_urls(version=version) + click.echo(f"Available BUSCO lineages for {version} ({len(busco_db)} entries):") + for name in sorted(busco_db): + click.echo(f" {name}") + ctx.exit(0) + + # BUSCO_OR_DIR = ChoiceOrDir(busco.keys()) @@ -218,9 +240,10 @@ def convert(self, value, param, ctx): @click.option( "--busco-db-version", "busco_db_version", - type=click.Choice(["odb10", "odb12"]), + type=click.Choice(["odb10", "odb12", "odb12.2"]), default="odb12", show_default=True, + is_eager=True, help="BUSCO lineage database version to use.", ) @click.option( @@ -228,6 +251,9 @@ def convert(self, value, param, ctx): "busco_print_lineages", is_flag=True, default=False, + is_eager=True, + expose_value=False, + callback=print_busco_lineages, help="Print all available BUSCO lineages for the selected --busco-db-version and exit.", ) @click.option( @@ -305,14 +331,6 @@ def main(**options): manager = SequanaManager(options, NAME) options = manager.options - # print lineages and exit early (no working directory needed) - if options.busco_print_lineages: - busco_db = get_busco_lineages_and_urls(version=options.busco_db_version) - click.echo(f"Available BUSCO lineages for {options.busco_db_version}:") - for name in sorted(busco_db.keys()): - click.echo(f" {name}") - sys.exit(0) - # creates the working directory manager.setup() From 9f3d976d1be31da7d462278393da1f3f5dbb9b7b Mon Sep 17 00:00:00 2001 From: Thomas Cokelaer Date: Tue, 8 Sep 2026 18:34:18 +0200 Subject: [PATCH 3/5] Bump version to 1.2.0 The BUSCO lineage fixes get their own release entry instead of being folded into the already-released 1.1.0. The fastp 1.0.1 container and the pulp>=2.8 dependency move to 1.2.0 as well. --- README.rst | 5 +++-- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index cf7bf08..cde8b1f 100644 --- a/README.rst +++ b/README.rst @@ -387,7 +387,7 @@ Changelog ========= ==================================================================== Version Description ========= ==================================================================== -1.1.0 * fix BUSCO lineage retrieval: the v5 listing on busco-data.ezlab.org +1.2.0 * fix BUSCO lineage retrieval: the v5 listing on busco-data.ezlab.org now redirects to an empty S3 index, so no lineage could be found (--busco-print-lineages printed nothing and any --busco-lineage was rejected as invalid). We now use the v6 listing, which hosts both @@ -398,7 +398,8 @@ Version Description * --busco-print-lineages is now an eager option: it prints the lineages and exits without requiring --assembler, --genome-size and the other mandatory options - * remote BLAST via NCBI URL API (no local database needed); sequential + * update fastp container to 1.0.1; add pulp>=2.8 to environment.yml +1.1.0 * remote BLAST via NCBI URL API (no local database needed); sequential submission to avoid IP-level CPU throttling * entrez_query support to restrict BLAST to a taxonomic group (e.g. Bacteria[Organism], refseq_genomic) — equivalent to the diff --git a/pyproject.toml b/pyproject.toml index 7ec4d1c..4090479 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [project] name = "sequana-lora" -version = "1.1.0" +version = "1.2.0" description = "Run assembler (Canu, Flye, Hifiasm) on a set of long read files" authors =[{name="Sequana Team", email="thomas.cokelaer@pasteur.fr"}] license = "BSD-3" From ddc4524f40810ad27885ee8a1154777e9ff18914 Mon Sep 17 00:00:00 2001 From: Thomas Cokelaer Date: Tue, 8 Sep 2026 18:55:52 +0200 Subject: [PATCH 4/5] Remove duplicated blast entry and add a timeout to the BUSCO request blast was listed twice in environment.yml. The BUSCO lineage listing request had no timeout, so the CLI could hang indefinitely if the server stalls. --- environment.yml | 1 - sequana_pipelines/lora/info.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index cded15f..f145baf 100644 --- a/environment.yml +++ b/environment.yml @@ -13,7 +13,6 @@ dependencies: - quast - prokka - blast -- blast - fastp - pulp>=2.8 - pip: diff --git a/sequana_pipelines/lora/info.py b/sequana_pipelines/lora/info.py index 0139f79..225ba6a 100644 --- a/sequana_pipelines/lora/info.py +++ b/sequana_pipelines/lora/info.py @@ -1472,7 +1472,7 @@ def get_busco_lineages_and_urls(base_url="https://busco-data.ezlab.org/v6/data/l :param version: the ODB version (e.g. odb10, odb12, odb12.2) :return: dictionary of lineage names and their corresponding URLs """ - response = requests.get(base_url) + response = requests.get(base_url, timeout=30) response.raise_for_status() # Raise an exception for HTTP errors # Parse the HTML content with BeautifulSoup (use .text so that the encoding From e4be508fc973fe7ed2bc3457247cc40abb3ddb6f Mon Sep 17 00:00:00 2001 From: Thomas Cokelaer Date: Tue, 8 Sep 2026 19:01:28 +0200 Subject: [PATCH 5/5] CI: install pytest-mock and pytest-asyncio The test suite uses the mocker fixture and async tests, but the CI only installed pytest, pytest-cov and pytest-xdist, so collection failed with ModuleNotFoundError: No module named 'pytest_mock'. pytest-asyncio was missing too and would have failed right after (asyncio_mode is strict). --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index afcf059..0ed7927 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,7 +47,7 @@ jobs: - name: Install dependencies shell: bash -l {0} run: | - pip install coveralls pytest-cov pytest pytest-xdist + pip install coveralls pytest-cov pytest pytest-xdist pytest-mock pytest-asyncio - name: testing shell: bash -l {0}