Skip to content

humann: offer only reference data the tool accepts; make the data manager emit stable identities - #9094

Open
bernt-matthias wants to merge 9 commits into
galaxyproject:mainfrom
bernt-matthias:humann-reference-data
Open

bernt-matthias wants to merge 9 commits into
galaxyproject:mainfrom
bernt-matthias:humann-reference-data

Conversation

@bernt-matthias

@bernt-matthias bernt-matthias commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

supersedes #7679 and #5309
reuses parts from #8361
requires bioconda/bioconda-recipes#72292

Problems solved

  • The cached-marker-database selector was dead. humann.xml read the legacy 4-column metaphlan_database table, which the MetaPhlAn data manager no longer writes, and filtered it with a 3.8-era regexp that hid every vJun23 database while offering exactly the releases HUMAnN 3.9 rejects.
  • Legacy (pre-v4) marker databases could never be used — HUMAnN needs --mpa3 for them, which was never passed. It is now derived from the db_version column.
  • The nucleotide/protein selectors offered bundles HUMAnN aborts on, e.g. the HUMAnN 3.0.0 cohort (…v296_201901b.ffn.gz … are not of the expected version). The filters now match the literal strings humann itself checks at runtime.
  • Regroup/rename mapping lists were wrong. The .map.(?!_name) denylist is a no-op (with re.match, .* always stretches past _name), so name mappings appeared as groupings and vice versa; the filters are now anchored on the mapping file name.
  • Data manager values were not portable. value embedded date.today(), so the same 2019 bundle was stored once per install date and workflow steps broke on a different server. value is now derived from the immutable upstream artifact name.
  • The tables' semantics were undocumented and the samples were wrong (headers claimed db-build-version-date / db-name / build / path; fixtures carried stale junk values).
  • Nothing explained which data belongs to which HUMAnN, so the 3.0.0 cohort and future v4_alpha bundles looked interchangeable with the current ones.

Main changes

  • tools/humann/humann.xml: prescreen reads metaphlan_database_versioned (5 columns) with a denylist filter for incompatible marker releases; --mpa3 when db_version == legacy; nucleotide requires v201901_v31, protein 201901b; regroup/rename filters anchored on the mapping file name; +galaxy2.
  • tools/humann/tool_data_table_conf.xml.{sample,test} and the .loc samples/tests: the versioned MetaPhlAn table replaces metaphlan_database; all headers now read value, name, dbkey, path (plus db_version), with a description of each column.
  • data_manager_humann_downloader: value = -- (mappings add the file name), name carries the artifact name, dbkey stays the HUMAnN version (provenance, not a data version). Table names and column counts unchanged. New long documenting the data generations, the HUMAnN 3.0.0 exception, the accepted marker releases and the re-install behaviour; DM bumped to 3.9+galaxy2.
  • Adopts the humann hunks of Stabilize GTDB-Tk, HUMAnN, Kaiju, and MAPseq Data Manager identities #8361 and the two hunks of humann: use versioned metaphlan cached reference #5309 (both credited in the commit bodies); Update humann DM #7679's data manager rewrite is not taken — it re-introduces the install date and breaks humann_regroup_table.

Not in this PR: the MetaPhlAn version pin. It belongs to the humann conda package (bioconda/bioconda-recipes#72292), not to a wrapper , which cannot constrain what the package pulls in.

Full analysis: https://gist.github.com/bernt-matthias/1b49e242a977655b21fe5c4828d40fa2

FOR CONTRIBUTOR:

  • I have read the CONTRIBUTING.md document and this tool is appropriate for the tools-iuc repo.
  • Use of AI
    • The contribution is mostly AI generated
    • The contribution has been assisted by AI
    • AI harness (required if AI was used): pi
    • Model (required if AI was used): deepseek 4.1
  • License permits unrestricted use (educational + commercial)
  • This PR adds a new tool or tool collection
  • This PR updates an existing tool or tool collection (see the
    tool update guide)
  • This PR does something else (explain below)

There are two labels that allow to ignore specific (false positive) tool linter errors:

  • skip-version-check: Use it if only a subset of the tools has been updated in a suite.
  • skip-url-check: Use it if github CI sees 403 errors, but the URLs work.

To request a review once your PR is ready, comment "please review" on the PR. This will
automatically apply the ready-for-review label if the PR is not a draft, all review
threads are resolved, and all CI checks have passed. The label is removed once a reviewer
submits a review; after addressing it, comment "please review" again to ping the reviewers.

@bernt-matthias
bernt-matthias marked this pull request as draft November 27, 2026 20:15
@bernt-matthias bernt-matthias changed the title Humann overhaul humann: offer only reference data the tool accepts; make the data manager emit stable identities Nov 27, 2026
…names

Galaxy workflows serialize data table selector values, so a value built
from `date.today()` makes identical reference data incompatible across
Galaxy instances and non-reproducible across two installs on the same
instance (galaxyproject#5681). The three HUMAnN tables are affected.

HUMAnN advertises its reference bundles by artifact name (queried via
`humann_databases --available`), e.g. `full_chocophlan.v201901_v31`. That
name changes when the data changes and is identical everywhere, so use it
as the identity:

    value = "<database>-<build>-<source id>"
    name  = "<label> (<source id>)"
    dbkey = the HUMAnN version the entry was installed for (provenance)

The managed path is derived from `value` (data_manager_conf.xml), so the
same bundle now lands on the same path on every server instead of a
dated one. `name` carries the artifact name because the labels alone are
not unique across data generations (HUMAnN 3.0.x shipped
`chocophlan.v296_201901b`, 3.1.1-3.9 shipped `v201901_v31`, a future
HUMAnN 4 will ship `v4_alpha`), and it is what the tool form shows.

Also pass the download command as an argument list instead of a shell
string, and drop a stray `args.` from `download_humann_db()` (it made the
function depend on the module globals).

Based on the humann part of galaxyproject#8361 only (the MetaPhlAn data manager changes
in that PR are not included).

Co-authored-by: Matthias Bernt <m.bernt@ufz.de>
@bernt-matthias
bernt-matthias marked this pull request as ready for review November 27, 2026 20:43
The help was two lines: nothing told an admin which of the installed
bundles works with which HUMAnN, or why two entries can carry the same
label. Document the properties that matter for choosing data:

- what the three tables feed (ChocoPhlAn/UniRef/mappings);
- that the data generation is part of the artifact name and that
  `v201901_v31` + `201901b` are the same for every HUMAnN 3.1.1 - 3.9,
  i.e. `dbkey` is provenance, not a data version;
- the HUMAnN 3.0.x exception (`chocophlan.v296_201901b`) and the runtime
  error it causes in later releases;
- the independent MetaPhlAn marker database and which releases HUMAnN
  accepts, plus the `metaphlan >=4.0,<4.2` pin of the humann package;
- the column semantics, in particular why `value` never carries a date;
- how to add data by hand and what a re-install does.

The `.loc.sample` headers claimed the columns were
`db-build-version-date / db-name / build / path`, which is wrong in all
six files (the columns are `value, name, dbkey, path`); replace them with
a description of the actual scheme and one example row.

Also drop the stale "HUMAnN2" wording from `.shed.yml`.
HUMAnN validates the version strings in the file names of the reference
data directories and aborts if one does not match, so the selectors must
not offer incompatible data:

- ChocoPhlAn: HUMAnN 3.1.1 - 3.9 require `v201901_v31`; HUMAnN 3.0.x
  installed `v296_201901b`, which aborts any later release with
  "CRITICAL ERROR: The directory provided for ChocoPhlAn contains files
  ... that are not of the expected version". Such rows exist on live
  servers (a 3.0.0 cohort next to the working 3.6.0/3.9 ones).
- UniRef: every HUMAnN 3.x release requires the `201901b` bundle.

Entries installed by older versions of the data manager carry an install
date instead of the artifact name, so both spellings are accepted; the
incompatible 3.0.x cohort is excluded by `dbkey`, which is the HUMAnN
version the entry was installed for and the only structural marker for
the v296_201901b generation. A future HUMAnN 4 data generation
(`v4_alpha`) matches neither spelling and is therefore excluded as well.

Additionally fix the utility mapping filters, which did not filter what
they claimed: `.*map.*(?!_name)` in the regroup tool keeps every row
(`utility_mapping` alone matches `.*map`, and the lookahead at the end of
the pattern always succeeds), so name mappings were offered as groupings.
Anchor both filters on the mapping file name instead: the regroup tool
now selects `map_*` mappings without `_name`, the rename tool exactly the
`*_name` ones.

Verified against Galaxy's implementation: `<filter type="regexp">` uses
`re.match` (anchored at the start) and resolves column names to indices.
The prescreen step runs MetaPhlAn and HUMAnN then checks the profile for
the marker database generation it was built for ("v3" or "vJun23" in a
header comment); a profile from any other release is rejected with "The
MetaPhlAn taxonomic profile provided was not generated with the database
version ...". HUMAnN 3.9 therefore accepts the vJun23 databases and pre-v4
ones, but not vJan21 (HUMAnN 3.5/3.6) or vOct22 (3.7/3.8).

The wrapper read the unversioned `metaphlan_database` table, whose rows
carry no marker-database generation, and its filter was an accidental
allowlist ("" keeps the matching rows) of exactly the values of vOct22,
TOY and demo databases: on usegalaxy.eu the only row offered was
`mpa_vOct22_SGBCHOCOPhlAn_202212`, which HUMAnN 3.9 rejects, while the
vJun23 database installed by the MetaPhlAn data manager was not visible at
all.

Read `metaphlan_database_versioned` instead, which the MetaPhlAn data
manager writes (5 columns, the last one recording whether the database is
pre-v4), and hide the generations that this HUMAnN cannot consume. Entries
with `db_version` "legacy" additionally get the `--mpa3` switch, which is
what makes MetaPhlAn 4 read a pre-v4 database.

Note that the `value` column of the versioned table still ends with the
install date, so selecting from the table keeps the wrapper unusable for
HUMAnN in workflows shared between servers; that is a separate defect in
the MetaPhlAn data manager.
…aning

The comment headers of the tool test data tables still listed the columns
as "db-build-version-date / db-name / build / path", which is not what the
tables hold, and they are what an admin sees when copying a sample file.
Point them at the documented samples instead of repeating the explanation
and fix the marker database sample, whose value column documents the
install date that the data manager writes.
The humann tool no longer selects the same marker database (the versioned
table, incompatible generations hidden, mpa3 for pre-v4 databases), and
the regroup/rename tools no longer offer the mapping files they used to
offer, so the behaviour of the suite changes. The data manager writes
different `value`s, which changes what existing and new selections mean.

Also let the humann tool use @VERSION_SUFFIX@ like every other wrapper of
the suite instead of hardcoding +galaxy1.
The pin in the bioconda recipe had to be tightened from <4.2 to <4.1.2:
MetaPhlAn 4.1.2 made `metaphlan --version` print a second line, and humann
3.9 parses the last line of that output, so any nucleotide-mode run without
a default MetaPhlAn database stops with "Can not call software version for
metaphlan".
The help said which databases exist, but not how their names relate to
versions: ``vOct22`` is the marker release tag that HUMAnN tests in the
profile header, while ``_202212`` is only the build date of that tarball
(and the same date suffix can appear under different release tags).

Describe that scheme, the fact that the 3.x bundles are unchanged from
3.1.1 to 3.9, and which marker releases each HUMAnN generation accepts.
The MetaPhlAn version coupling is mentioned as a property of the tools
rather than of a package recipe, since that is what a Galaxy user can act
on.
The data manager help was a single sentence, so an admin had no way to
tell which index to install, how the names are built (marker release tag
versus build date), how large the download is, which HUMAnN accepts which
release, or why the pre-v4 database is missing from the list (MetaPhlAn
4.x looks for it under a path where it no longer exists).

The tool help gains the same naming scheme and notes that the chosen
database ends up in the profile header, which is what downstream tools
check.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage/Discuss

Development

Successfully merging this pull request may close these issues.

2 participants