Skip to content

Commit

Permalink
Fix smoove output when using --output_callers (#89)
Browse files Browse the repository at this point in the history
* fix smoove output

* fix copy paste error

* fix smoove tests

* update changelog
  • Loading branch information
nvnieuwk authored Apr 29, 2024
1 parent 4313b86 commit e71fddc
Show file tree
Hide file tree
Showing 7 changed files with 334 additions and 198 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### `Fixed`

1. The smoove outputs are now correct when using `--output_callers`

## v0.1.0 - [3 April 2024] - Amazing Atomium

Initial release of nf-cmgg/structural, created with the [nf-core](https://nf-co.re/) template.
Expand Down
3 changes: 2 additions & 1 deletion conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ process {
]]
}

withName: "^.*:BAM_VARIANT_CALLING_SMOOVE:TABIX_TABIX\$" {
withName: "^.*:BAM_VARIANT_CALLING_SMOOVE:TABIX_CALLER\$" {
ext.when = output_callers || (!params.annotate && foundSvCallers.size() == 1 && (count_types == 1 || !params.concat_output))
publishDir = [[
enabled: !params.annotate && foundSvCallers.size() == 1 && (count_types == 1 || !params.concat_output),
overwrite: true,
Expand Down
16 changes: 11 additions & 5 deletions subworkflows/local/bam_variant_calling_smoove/main.nf
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//
// Run Delly
// Run Smoove
//

include { SMOOVE_CALL } from '../../../modules/nf-core/smoove/call/main'
include { BCFTOOLS_SORT } from '../../../modules/nf-core/bcftools/sort/main'
include { TABIX_TABIX } from '../../../modules/nf-core/tabix/tabix/main'
include { SVYNC } from '../../../modules/nf-core/svync/main'
include { SMOOVE_CALL } from '../../../modules/nf-core/smoove/call/main'
include { BCFTOOLS_SORT } from '../../../modules/nf-core/bcftools/sort/main'
include { TABIX_TABIX } from '../../../modules/nf-core/tabix/tabix/main'
include { TABIX_TABIX as TABIX_CALLER } from '../../../modules/nf-core/tabix/tabix/main'
include { SVYNC } from '../../../modules/nf-core/svync/main'

workflow BAM_VARIANT_CALLING_SMOOVE {
take:
Expand Down Expand Up @@ -41,6 +42,11 @@ workflow BAM_VARIANT_CALLING_SMOOVE {
)
ch_versions = ch_versions.mix(BCFTOOLS_SORT.out.versions.first())

TABIX_CALLER(
BCFTOOLS_SORT.out.vcf
)
ch_versions = ch_versions.mix(TABIX_CALLER.out.versions.first())

BCFTOOLS_SORT.out.vcf
.map(
{ meta, vcf ->
Expand Down
61 changes: 43 additions & 18 deletions tests/pipeline/all_types/all.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,9 @@ nextflow_pipeline {

path("$outputDir")
.list()
.findAll {
!it.toString().endsWith("pipeline_info")
}
.collect {
it.list().collect { it.toString().split("/")[-1] }
},
path("$outputDir").list().collect{
it.toString().split("/")[-1]
}
.findAll { !it.toString().endsWith("pipeline_info") }
.collect { getRecursiveFileNames(it, "${outputDir}") }
.flatten()
).match("all")}
)
}
Expand Down Expand Up @@ -64,19 +58,50 @@ nextflow_pipeline {

path("$outputDir")
.list()
.findAll {
!it.toString().endsWith("pipeline_info")
}
.collect {
it.list().collect { it.toString().split("/")[-1] }
},
path("$outputDir").list().collect{
it.toString().split("/")[-1]
}
.findAll { !it.toString().endsWith("pipeline_info") }
.collect { getRecursiveFileNames(it, "${outputDir}") }
.flatten()
).match("concat")}
)
}

}

test("output callers") {

when {
params {
outdir = "${outputDir}"
callers = "all"
max_cpus = 2
max_memory = '6.GB'
max_time = '6.h'
output_callers = true
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(
workflow.stdout,

path("$outputDir")
.list()
.findAll { !it.toString().endsWith("pipeline_info") }
.collect { getRecursiveFileNames(it, "${outputDir}") }
.flatten()
).match("output callers")}
)
}

}

}

def getRecursiveFileNames(fileOrDir, outputDir) {
if(file(fileOrDir.toString()).isDirectory()) {
return fileOrDir.list().collect { getRecursiveFileNames(it, outputDir) }
}
return fileOrDir.toString().replace("${outputDir}/", "")
}
Loading

0 comments on commit e71fddc

Please sign in to comment.