Skip to content

--denovo: rootHOGs by mmseqs clustering instead of OMAmer, plus an mmseqs wrapper - #134

Merged
alpae merged 6 commits into
devfrom
feature/denovo-clustering
Nov 25, 2026
Merged

alpae merged 6 commits into
devfrom
feature/denovo-clustering

Conversation

@alpae

@alpae alpae commented Nov 25, 2026

Copy link
Copy Markdown
Member

Summary

Adds a --denovo mode that skips OMAmer and infers the rootHOGs by clustering all proteins with
mmseqs easy-cluster. This is meant for simulated proteomes, where placing proteins against the
OMA database makes little sense. It also replaces the ad-hoc mmseqs call in infer-roothogs with a
small wrapper, in the style of the mafft/FastTree wrappers.

De-novo mode

  • --denovo on the pipeline, fastoma-infer-roothogs and fastoma-check-input. OMAmer is not run and
    no OMAmer database is needed or staged; a placeholder file stands in for the channel, so the 7.7 GB
    default db is never downloaded.
  • Every protein goes into the unmapped set and from there to the mmseqs clustering. Isoform selection
    (splice files) and the check that every protein is accounted for work as in the OMAmer mode.
  • Needs mmseqs; check-input and infer-roothogs fail early if it is missing.

mmseqs wrapper (FastOMA/zoo/wrappers/clusterers/mmseqs.py)

  • Thread limit: mmseqs now uses the CPUs Nextflow gives the task (--mmseqs-threads ${task.cpus}).
    Before, it used every core of the node.
  • Exit codes: if mmseqs fails or is killed, infer-roothogs exits with the same code (137 when killed
    for running out of memory), as with mafft and FastTree, so Nextflow can retry the task with more
    resources. Before, it always exited with 1.
  • Clustering options: --mmseqs_coverage, --mmseqs_cov_mode, --mmseqs_sensitivity and
    --mmseqs_min_seq_id are new pipeline params, and are also exposed by the CLI. If they are unset,
    mmseqs uses its defaults as before. They also apply without --denovo, to the proteins OMAmer could
    not place and the singletons.
  • Ids: the sequences go to mmseqs under index ids and are mapped back afterwards. mmseqs reduces
    UniProt-style ids (sp|X|NAME) to the accession in its cluster table, so its ids can't be used
    directly. This also removes the parsing of the FASTA-like output.
  • Cleanup: the temporary files are removed afterwards. Before, singleton_unmapped_* and
    tmp_linclust/ were left in the work directory. run_linclust and the dead commented-out code in
    _wrappers.py are removed.

Tests

  • New tests/test_mmseqs_wrapper.py: real clustering with UniProt ids, options passed only when set,
    exit codes 1 and 137 (with a fake mmseqs), no records, find_mmseqs. CLI tests for --denovo, and a
    stage test that a killed mmseqs makes infer-roothogs exit with 137.
  • New nf-test "de-novo clustering without OMAmer" in nf-tests/options.nf.test.
  • Locally: pytest 435 passed / 23 skipped / 10 xfailed; nf-test 22/22 with docker (image built from
    this branch). With --denovo --mmseqs_sensitivity 7.5, the task runs
    mmseqs easy-cluster … --threads 2 -s 7.5.

Docs

README section "De-novo gene families without OMAmer"; schema entries; CHANGELOG entries under
Added and Fixed.

  • feat: --denovo infers the rootHOGs by mmseqs clustering instead of OMAmer
  • fix: parse params.denovo as boolean also when Nextflow passes it as a string
  • feat: mmseqs wrapper with thread limit, exit-code propagation and clustering options
  • fixes wrong rebase fix

alpae and others added 6 commits November 25, 2026 17:27
…Amer

For simulated proteomes, placing proteins into the OMA gene families with OMAmer makes little sense.
With --denovo (params.denovo in the pipeline):

- omamer_run is skipped and the OMAmer db is never staged; a placeholder (assets/NO_OMAMER_DB) is
  passed instead, so the default 7.7 GB LUCA.h5 is not downloaded.
- fastoma-check-input --denovo needs neither an OMAmer db nor hogmaps, but checks that mmseqs is
  available.
- fastoma-infer-roothogs --denovo treats all proteins as unmapped, so they all go to the existing
  mmseqs easy-cluster step; clusters with proteins of at least two species become rootHOGs
  (HOG_clust*). Without mmseqs it exits with an error instead of producing no rootHOGs.
- the number of species (resources of hog_big, threshold for pairwise orthologs) is counted from the
  proteomes instead of the hogmaps.

Tests: nf-test case with a non-existent omamer_db, check-input and infer-roothogs CLI tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… string

Nextflow 26 passes command-line params as strings, and "false" is truthy in Groovy.
…stering options

The clustering of unmapped proteins and singletons (with --denovo: of all proteins) now goes through
FastOMA/zoo/wrappers/clusterers/mmseqs.py instead of run_linclust:

- --mmseqs-threads: Nextflow passes task.cpus; before, mmseqs used all cores of the machine.
- When mmseqs fails or is killed (e.g. out of memory), infer-roothogs exits with its exit code
  (128 + signal), like the mafft/FastTree wrappers, so Nextflow retries the task.
- --mmseqs-coverage, --mmseqs-cov-mode, --mmseqs-sensitivity, --mmseqs-min-seq-id (pipeline params
  mmseqs_*); unset, the mmseqs defaults are used as before.
- The records are passed to mmseqs under their index and the clusters mapped back, so the cluster
  TSV is read instead of parsing the "fasta-like" all_seqs output (mmseqs reduces UniProt-style ids
  to their accession in the TSV). The temporary files are removed; before, singleton_unmapped_* and
  tmp_linclust/ were left in the working directory.
- check-input and infer-roothogs share one availability check (find_mmseqs).

The rootHOG files are identical to before on testdata (OMAmer and --denovo) and on the synthetic
stage dataset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
infer_roothogs asked for 2 GB in --denovo mode whatever the input, as its
memory was sized from the number of hogmaps, while it clusters all proteins
with mmseqs. It is now sized from the number of species and the size of the
proteomes (passed to the process as values), and mmseqs gets
--split-memory-limit at 60% of the task memory, so it no longer sizes its
prefilter from the total RAM of the machine.

Splice genes without any OMAmer hit (with --denovo: all of them) kept the
first isoform listed, even a fragment that then did not cluster with its
orthologs, so the family was lost. They now keep the longest isoform that
passed the length filter.
Below ~1.1 GB, the mmseqs prefilter stops with "Cannot fit databases"
(exit 1, not retried), even for a few sequences. The limit is now at
least 2 GB.
@alpae
alpae merged commit cfb3069 into dev Nov 25, 2026
26 checks passed
@alpae
alpae deleted the feature/denovo-clustering branch November 25, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant