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
13 changes: 8 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -50,9 +52,10 @@ jobs:
- 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
Expand Down
20 changes: 18 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,11 +34,11 @@ LORA — Long Read Assembly pipeline
Journal of Open Source Software, 2(16), 352,
`doi:10.21105/joss.00352 <https://doi.org/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


Expand Down Expand Up @@ -383,6 +387,18 @@ Changelog
========= ====================================================================
Version Description
========= ====================================================================
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
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
* 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
Expand Down
34 changes: 16 additions & 18 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
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
- fastp
- pulp>=2.8
- pip:
- sequana
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion sequana_pipelines/lora/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
51 changes: 34 additions & 17 deletions sequana_pipelines/lora/info.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

import requests
from bs4 import BeautifulSoup

Expand Down Expand Up @@ -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 = requests.get(base_url, timeout=30)
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 (<a>) 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<name>.+)_{re.escape(version)}\.(?P<date>\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 = {}
36 changes: 27 additions & 9 deletions sequana_pipelines/lora/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down Expand Up @@ -218,16 +240,20 @@ 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(
"--busco-print-lineages",
"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(
Expand Down Expand Up @@ -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()

Expand Down
Loading