Skip to content

New module: fairbioheaders/combine - #13492

Draft
adamjohnwright wants to merge 1 commit into
nf-core:masterfrom
adamjohnwright:fairbioheaders-combine
Draft

adamjohnwright wants to merge 1 commit into
nf-core:masterfrom
adamjohnwright:fairbioheaders-combine

Conversation

@adamjohnwright

Copy link
Copy Markdown

Adds fairbioheaders/combine, which wraps bioheaders combine from fair-bioheaders. It validates FAIR-bioHeaders provenance metadata against its schema, attaches it to a FASTA, protein FASTA, GFA or GFF3 file as a header, and records the SHA-512/256 checksum of the result in the header. Headers: FHR for genome FASTA and GFA, FHP for protein FASTA and FHGFF3 for GFF3 (doi:10.1093/bib/bbae122).

Motivation: nf-core/genomeassembler#250 adds an optional FHR export of assembly outputs (nf-core/genomeassembler#242), and the review there asked for it to use nf-core modules. This is the step that PR relies on most. Follow-up PRs will add fairbioheaders/verify, fairbioheaders/convert and fairbioheaders/validate.

Input: [ meta, metadata (JSON/YAML), sequence ], where the sequence is plain, gzip or BGZF.
Outputs:

  • fasta: <prefix>.fhr.fasta or <prefix>.fhp.fasta
  • gfa: <prefix>.fhr.gfa
  • gff3: <prefix>.fhgff3.gff3
  • each gets .gz (BGZF) when the input was compressed
  • the version, via topic: versions

Notes for reviewers:

  • Software: Bioconda fair-bioheaders=0.8.5 (MPL-2.0, bio.tools fair-bioheaders). Containers were built with nf-core modules containers create (Seqera, linux/amd64 and linux/arm64). About 1,950 of the added lines are the two generated .conda-lock files.
  • Version: bioheaders --version prints a bare version (0.8.5), emitted via topic: versions.
  • Shell quoting: file names and prefix are single-quoted in the script, and -- comes before positional arguments, because sample IDs in assembly pipelines can contain spaces, quotes or a leading - (tested by hand with it's $x and -dash). Happy to drop this if reviewers prefer the plainer style.
  • Test data: only existing nf-core/test-datasets files. The metadata is a few lines of YAML written inline with collectFile, so no test-datasets PR is needed; I can move it to test-datasets if preferred.
  • Licence of the module code: these files started as nf-core-style modules in FAIR-bioHeaders-Nextflow (MPL-2.0) and were reworked here. Its copyright holders (@adamjohnwright, plus @molikd for one commit) contribute it to nf-core/modules under the MIT licence.
  • Output naming: the header type is only known from the metadata's schema URL, so the module stages the input as <prefix>.<fasta|gfa|gff3>[.gz] and lets the tool name the output <stem>.<fhr|fhp|fhgff3>.<type>. That is why there are three optional typed output channels. A run produces exactly one of them, and the tests assert which one.
  • Failures: an unsupported extension fails early with a clear message (case-insensitive matching; .gz and .bgz handled). The task also fails, with the tool's exit code, on:
    • invalid metadata
    • a header type that does not suit the file (tested: FHP on GFA)
    • an output that would overwrite the input
  • Tests (9): FASTA, FASTA.gz, GFA, protein FASTA (FHP), GFF3 (FHGFF3), two failure cases and two stubs. The stub creates one file per output channel.

AI assistance: the module was prepared with Claude Code (Claude Opus 5.5), which also ran an adversarial review. I have reviewed the code, the tests and the snapshots, and I will handle review comments.

Generated by Claude Code

PR checklist

Part of #13491 (first of four fairbioheaders modules).

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the module conventions in the contribution docs
  • If necessary, include test data in your PR. (Not needed: tests use nf-core/test-datasets files plus small inline metadata.)
  • Remove all TODO statements.
  • Broadcast software version numbers to topic: versions - See version_topics
  • Follow the naming conventions.
  • Follow the parameters requirements.
  • Follow the input/output options guidelines.
  • Add a resource label
  • Use BioConda and BioContainers if possible to fulfil software requirements.
  • Ensure that the test works with either Docker / Singularity. Conda CI tests can be quite flaky:
    • For modules:
      • nf-core modules test <MODULE> --profile docker
      • nf-core modules test <MODULE> --profile singularity (not run locally; the Seqera Singularity image was pulled and smoke-tested by hand)
      • nf-core modules test <MODULE> --profile conda

🤖 Generated with Claude Code

Add FAIRBIOHEADERS_COMBINE, which wraps `bioheaders combine` from the
fair-bioheaders toolkit (Bioconda) to attach FAIR-bioHeaders provenance
metadata (FHR, FHP or FHGFF3) to a FASTA, protein FASTA, GFA or GFF3 file
and record the file's checksum in the header. The header type comes from
the metadata's schema URL and names the output; compressed input gives
BGZF output.

Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@adamjohnwright

Copy link
Copy Markdown
Author

On the size warning: this is one module. 1,955 of the 2,721 added lines are the two generated .conda-lock files from nf-core modules containers create. The hand-written part is main.nf (62 lines), meta.yml (145) and the tests (306), plus the snapshot (246).

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant