Skip to content

Added support for Cleanifier tool: cleanifier/download, cleanifier/index and cleanifier/filter#12360

Merged
LeonHornich merged 5 commits into
nf-core:masterfrom
LeonHornich:cleanifier
Jul 17, 2026
Merged

Added support for Cleanifier tool: cleanifier/download, cleanifier/index and cleanifier/filter#12360
LeonHornich merged 5 commits into
nf-core:masterfrom
LeonHornich:cleanifier

Conversation

@LeonHornich

@LeonHornich LeonHornich commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

With this PR I want to add support for the Cleanifier tool for species contamination removal. There are 3 added modules: download, index and filter.

Unfortunately I am still experiencing some issues with nf-test snapshot stability. If anyone has an idea on how to fix them i'd very much appreciate that. Of course other feedback is also highly appreciated.

PR checklist

Closes #XXX

  • 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.
  • 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
      • nf-core modules test <MODULE> --profile conda

@famosab

famosab commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

I would suggest to split this up into one PR by subtool / command :) regarding the md5sum instability I will add a comment

@famosab famosab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few hints :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want the ext.args to be present in the main.nf.test file. That makes everything more readable in one go. See the module specifications for more info.

Comment thread modules/nf-core/cleanifier/filter/main.nf

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file :)

@@ -0,0 +1,5 @@
process {
withName: CLEANIFIER_INDEX {
ext.args = "-k 31"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want the ext.args to be present in the main.nf.test file. That makes everything more readable in one go. See the module specifications for more info.

"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(sanitizeOutput(process.out)).match() }
{ assert snapshot(process.out).match() }

@famosab famosab Jul 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just first assert the txt content of the filter output and then we can probably see why the md5sum is instable

Suggested change
{ assert snapshot(process.out).match() }
{ assert snapshot(
file(process.out.filter[0][1]).name,
process.out.info,
process.out.findAll { key, val -> key.startsWith("versions") },
).match() }

Edit: I updated to just use the name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I played around with the index tests. From my understanding the core issue is that cleanifier/index generates a index file using a probabilistic cuckoo filter. These are not deterministic and therefore differ between snapshots.

Since this doesn't seem avoidable i am now only assessing the files existence (via file path) in the most recent commit.

While this seems to improve my snapshots locally, I now get an error while linting:

nf-core modules lint cleanifier                       (nextflow_env) 


                                          ,--./,-.
          ___     __   __   __   ___     /,-._.--~\ 
    |\ | |__  __ /  ` /  \ |__) |__         }  {
    | \| |       \__, \__/ |  \ |___     \`-._,-`-,
                                          `._,._,'

    nf-core/tools version 4.0.2 - https://nf-co.re


INFO     Linting modules repo: '.'                                              
INFO     Linting module: 'cleanifier'                                           

╭─ [✗] 1 Module Test Failed ───────────────────────────────────────────────────╮
│                     ╷                           ╷                            │
│ Module name         │ File path                 │ Test message               │
│╶────────────────────┼───────────────────────────┼───────────────────────────╴│
│ cleanifier/index    │ modules/nf-core/cleanifi… │ test_snap_versions:        │
│                     │                           │ versions not found in      │
│                     │                           │ snapshot file              │
│                     ╵                           ╵                            │
╰──────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────╮
│ LINT RESULTS SUMMARY  │
├───────────────────────┤
│ [✔] 166 Tests Passed  │
│ [!]   0 Test Warnings │
│ [✗]   1 Test Failed   │
╰───────────────────────╯

How would you usually handle this according to nf-core guidelines? Thank you :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add this line:

process.out.findAll { key, val -> key.startsWith("versions") },

because otherwise the versions are not asserted

Comment thread modules/nf-core/cleanifier/index/tests/main.nf.test
Comment thread modules/nf-core/cleanifier/download/tests/main.nf.test
setup {
run("CLEANIFIER_INDEX") {
script "../../index/main.nf"
config "./nextflow.config"

@famosab famosab Jul 16, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
config "./nextflow.config"

duplicated to above

Comment thread modules/nf-core/cleanifier/filter/main.nf

@famosab famosab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, I think these can be merged :)

@LeonHornich
LeonHornich added this pull request to the merge queue Jul 17, 2026
Merged via the queue into nf-core:master with commit 49e0546 Jul 17, 2026
133 of 135 checks passed
@LeonHornich
LeonHornich deleted the cleanifier branch July 17, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new module Adding a new module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants