-
Notifications
You must be signed in to change notification settings - Fork 1k
Big slice imp modules #11034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Big slice imp modules #11034
Changes from all commits
15d27bd
4edc137
2d142cf
4e0e985
c321854
bfedf4c
f8542ca
572c806
4de6d51
ed38681
cbd886a
f281cf2
59c156d
eb1d391
8814ea4
90fac06
a3e6cb4
4f9ca65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,25 +8,28 @@ process BIGSLICE { | |
| : 'biocontainers/bigslice:2.0.2--pyh8ed023e_0'}" | ||
|
|
||
| input: | ||
| tuple val(meta), path(bgc, stageAs: 'bgc_files/*') | ||
| path hmmdb | ||
| tuple val(meta), path(bgc, stageAs: 'bgc_files/s*/*') | ||
| path(hmmdb) | ||
| val(export_tsv) | ||
|
|
||
| output: | ||
| tuple val(meta), path("${prefix}/result/data.db"), emit: db | ||
| tuple val(meta), path("${prefix}/result/tmp/**/*.fa"), emit: fa | ||
| tuple val(meta), path("${prefix}/result") , emit: output | ||
| tuple val(meta), path("${prefix}/result/tsv_export") , emit: tsv, optional: true | ||
| // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. | ||
| tuple val("${task.process}"), val('bigslice'), val("2.0.2"), topic: versions, emit: versions_bigslice | ||
|
|
||
| when: | ||
| task.ext.when == null || task.ext.when | ||
|
|
||
| script: | ||
| def args = task.ext.args ?: '' | ||
| prefix = task.ext.prefix ?: "${meta.id}" | ||
| def args = task.ext.args ?: '' | ||
| def args2 = task.ext.args2 ?: '' | ||
| prefix = task.ext.prefix ?: "${meta.id}" | ||
| def sample = meta.id | ||
| def export_tsv_cmd = export_tsv ? "bigslice --export-tsv ${prefix}/result/tsv_export --program_db_folder ${hmmdb} ${args2} ${prefix}" : '' | ||
| """ | ||
| mkdir -p input/dataset/${sample} input/taxonomy | ||
| cp bgc_files/* input/dataset/${sample}/ | ||
| find bgc_files -name '*.gbk' | xargs -I{} cp {} input/dataset/${sample}/ | ||
|
|
||
| printf "# dataset_name\\tdataset_path\\ttaxonomy_path\\tdescription\\n" > input/datasets.tsv | ||
| printf "dataset\\tdataset\\ttaxonomy/taxonomy.tsv\\tBGC dataset\\n" >> input/datasets.tsv | ||
|
|
@@ -39,16 +42,22 @@ process BIGSLICE { | |
| -i input \\ | ||
| --program_db_folder ${hmmdb} \\ | ||
| ${prefix} | ||
|
|
||
| ${export_tsv_cmd} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add this tsv then as optional output and have it be accessible for downstream analyses? |
||
| """ | ||
|
|
||
| stub: | ||
| def args = task.ext.args ?: '' | ||
| prefix = task.ext.prefix ?: "${meta.id}" | ||
| def args = task.ext.args ?: '' | ||
| prefix = task.ext.prefix ?: "${meta.id}" | ||
| """ | ||
| echo ${args} | ||
|
|
||
| mkdir -p ${prefix}/result/tmp/2e555308dfc411186cf012334262f127 | ||
| touch ${prefix}/result/data.db | ||
| touch ${prefix}/result/tmp/2e555308dfc411186cf012334262f127/test.fa | ||
| if ${export_tsv}; then | ||
| mkdir -p ${prefix}/result/tsv_export | ||
| touch ${prefix}/result/tsv_export/bgcs.tsv | ||
| fi | ||
| """ | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,16 +67,76 @@ nextflow_process { | |
| [ meta, gbk_files ] | ||
| } | ||
| input[1] = UNTAR_HMMDB.out.untar.map{ it -> it[1] } | ||
| input[2] = false | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assert process.success | ||
| def resultDir = file(process.out.output[0][1]) | ||
| def allNames = [] | ||
| def tmpFaCount = 0 | ||
| resultDir.eachFileRecurse { f -> | ||
| if (!f.isDirectory()) { | ||
| def rel = resultDir.toPath().relativize(f.toPath()).toString() | ||
| if (rel.startsWith('tmp/') || rel.startsWith('tmp\\')) { | ||
| if (f.name.endsWith('.fa')) tmpFaCount++ | ||
| } else { | ||
| allNames.add(f.name) | ||
| } | ||
| } | ||
| } | ||
| assertAll( | ||
| { assert resultDir.isDirectory() }, | ||
| { assert tmpFaCount > 0 }, | ||
| { assert snapshot( | ||
| allNames.sort(), | ||
| process.out.findAll { key, val -> key.startsWith("versions")} | ||
| ).match() } | ||
|
Comment on lines
+91
to
+96
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add other files to this snapshot as well? Ideally we want all outputs to be at least present by name in the snapshot. |
||
| ) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| test("streptomyces_coelicolor - bigslice - gbk - export_tsv") { | ||
|
|
||
| when { | ||
| process { | ||
| """ | ||
| // Flatten the GBK directory into a list of individual GBK files with meta | ||
| input[0] = UNTAR_GBK.out.untar.map { meta, dir -> | ||
| def gbk_files = [] | ||
| dir.eachFileRecurse { if (it.name.endsWith('.gbk')) gbk_files << it } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| [ meta, gbk_files ] | ||
| } | ||
| input[1] = UNTAR_HMMDB.out.untar.map{ it -> it[1] } | ||
| input[2] = true | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assert process.success | ||
| def resultDir = file(process.out.output[0][1]) | ||
| def allNames = [] | ||
| def tmpFaCount = 0 | ||
| resultDir.eachFileRecurse { f -> | ||
| if (!f.isDirectory()) { | ||
| def rel = resultDir.toPath().relativize(f.toPath()).toString() | ||
| if (rel.startsWith('tmp/') || rel.startsWith('tmp\\')) { | ||
| if (f.name.endsWith('.fa')) tmpFaCount++ | ||
| } else { | ||
| allNames.add(f.name) | ||
| } | ||
| } | ||
| } | ||
| assertAll( | ||
| { assert resultDir.isDirectory() }, | ||
| { assert tmpFaCount > 0 }, | ||
| { assert file(process.out.tsv[0][1]).isDirectory() }, | ||
| { assert snapshot( | ||
| file(process.out.db[0][1]).name, | ||
| process.out.fa[0][1].size(), | ||
| allNames.sort(), | ||
| process.out.findAll { key, val -> key.startsWith("versions")} | ||
| ).match() } | ||
| ) | ||
|
|
@@ -98,6 +158,7 @@ nextflow_process { | |
| [ meta, gbk_files ] | ||
| } | ||
| input[1] = UNTAR_HMMDB.out.untar.map{ it -> it[1] } | ||
| input[2] = false | ||
| """ | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put all these inputs into one tuple? That will make sure you're sure that EVERY time everything comes together in the right combination.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmdb is a shared reference database (not sample-specific) and export_tsv is a boolean flag (not a file), so neither belongs in the sample tuple. In nf-core, tuples group a meta map with the data files of that specific sample mixing in shared resources or behaviour flags would break this convention.