Added support for Cleanifier tool: cleanifier/download, cleanifier/index and cleanifier/filter#12360
Added support for Cleanifier tool: cleanifier/download, cleanifier/index and cleanifier/filter#12360LeonHornich wants to merge 5 commits into
Conversation
|
I would suggest to split this up into one PR by subtool / command :) regarding the md5sum instability I will add a comment |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
You can run
nextflow lint -format -sort-declarations -spaces 4 -harshil-alignmenton this file to clean this up nicely.
There was a problem hiding this comment.
Please remove this file :)
| @@ -0,0 +1,5 @@ | |||
| process { | |||
| withName: CLEANIFIER_INDEX { | |||
| ext.args = "-k 31" | |||
There was a problem hiding this comment.
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() } |
There was a problem hiding this comment.
I would just first assert the txt content of the filter output and then we can probably see why the md5sum is instable
| { 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
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
You need to add this line:
process.out.findAll { key, val -> key.startsWith("versions") },
because otherwise the versions are not asserted
| @@ -35,7 +35,7 @@ nextflow_process { | |||
| { assert snapshot( | |||
| path(process.out.index[0][1]).getFileName().toString(), | |||
| path(process.out.info[0][1]).getFileName().toString(), | |||
There was a problem hiding this comment.
Was the info output also instable? Otherwise we couls just keep it
There was a problem hiding this comment.
Yes, the .info file also seems unstable. My assumption is that is stores data on the probabilistic cuckoo filter. Since these are unstable to begin with, this would make the .info files unstable as well :)
There was a problem hiding this comment.
Is there now way to test the real download? Maybe for a small subsection?
There was a problem hiding this comment.
The download command essentially allows us to download pre-computed index for human data. This is based on the t2t human reference genome. While there are 2 index files you can download, they are 7 and 14GB large. There is no option to download only parts of that. Since this sounded like too large of a testing case i only implemented strip cases for the cleanifier/download module.
| setup { | ||
| run("CLEANIFIER_INDEX") { | ||
| script "../../index/main.nf" | ||
| config "./nextflow.config" |
There was a problem hiding this comment.
| config "./nextflow.config" |
duplicated to above
| echo "" | gzip > ${prefix}.clean_keep.fastq.gz | ||
| ${keep_host ? "echo \"\" | gzip > ${prefix}.clean_filter.fastq.gz" : ""} | ||
| """ | ||
| } | ||
| else { | ||
| """ | ||
| echo "" | gzip > ${prefix}.clean_1_keep.fastq.gz | ||
| echo "" | gzip > ${prefix}.clean_2_keep.fastq.gz | ||
| ${keep_host ? "echo \"\" | gzip > ${prefix}.clean_1_filter.fastq.gz" : ""} | ||
| ${keep_host ? "echo \"\" | gzip > ${prefix}.clean_2_filter.fastq.gz" : ""} | ||
| """ |
There was a problem hiding this comment.
We usually do not need the "" in the echo statement :)
| echo "" | gzip > ${prefix}.clean_keep.fastq.gz | |
| ${keep_host ? "echo \"\" | gzip > ${prefix}.clean_filter.fastq.gz" : ""} | |
| """ | |
| } | |
| else { | |
| """ | |
| echo "" | gzip > ${prefix}.clean_1_keep.fastq.gz | |
| echo "" | gzip > ${prefix}.clean_2_keep.fastq.gz | |
| ${keep_host ? "echo \"\" | gzip > ${prefix}.clean_1_filter.fastq.gz" : ""} | |
| ${keep_host ? "echo \"\" | gzip > ${prefix}.clean_2_filter.fastq.gz" : ""} | |
| """ | |
| echo | gzip > ${prefix}.clean_keep.fastq.gz | |
| ${keep_host ? "echo | gzip > ${prefix}.clean_filter.fastq.gz" : ""} | |
| """ | |
| } | |
| else { | |
| """ | |
| echo | gzip > ${prefix}.clean_1_keep.fastq.gz | |
| echo | gzip > ${prefix}.clean_2_keep.fastq.gz | |
| ${keep_host ? "echo | gzip > ${prefix}.clean_1_filter.fastq.gz" : ""} | |
| ${keep_host ? "echo | gzip > ${prefix}.clean_2_filter.fastq.gz" : ""} | |
| """ |
There was a problem hiding this comment.
If I do that the linter is complaining, I will be defaulting back to using the "".
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/filter │ modules/nf-core/cleanifi… │ test_stub_gzip_syntax: │
│ │ │ Stub gzip files must use │
│ │ │ 'echo "" | gzip >' syntax. │
│ │ │ Invalid patterns found: │
│ │ │ echo | gzip > │
│ │ │ ${prefix}.clean_keep.fastq │
│ │ │ .gz │
│ ╵ ╵ │
╰──────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────╮
│ LINT RESULTS SUMMARY │
├───────────────────────┤
│ [✔] 166 Tests Passed │
│ [!] 0 Test Warnings │
│ [✗] 1 Test Failed │
╰───────────────────────╯
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
topic: versions- See version_topicslabelnf-core modules test <MODULE> --profile dockernf-core modules test <MODULE> --profile singularitynf-core modules test <MODULE> --profile conda