Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Initial release of nf-core/seqinspector, created with the [nf-core](https://nf-c
- [#151](https://github.com/nf-core/seqinspector/pull/151) Added a prepare_genome subworkflow to handle bwamem2 indexing
- [#159](https://github.com/nf-core/seqinspector/pull/159) Added a subworkflow QC_BAM including picard_collecthsmetrics for alignment QC of hybrid-selection data
- [#158](https://github.com/nf-core/seqinspector/pull/158) Moved picard_collectmultiplemetrics to the subworkflow QC_BAM
- [#162](https://github.com/nf-core/seqinspector/pull/162) Add tests for prepare_genome subworkflow

### `Fixed`

Expand All @@ -40,6 +41,7 @@ Initial release of nf-core/seqinspector, created with the [nf-core](https://nf-c
- [#107](https://github.com/nf-core/seqinspector/pull/107) Put SeqFU-stats section reports together
- [#112](https://github.com/nf-core/seqinspector/pull/112) Making fastq_screen_references value to use parentDir
- [#94] (https://github.com/nf-core/seqinspector/issues/94) Go through and validate test data
- [#162](https://github.com/nf-core/seqinspector/pull/162) Fix bugs in qc_bam and prepare_genome subworkflows and add tests
- [#163](https://github.com/nf-core/seqinspector/pull/163) Run fastqscreen with subsampled data if available

### `Dependencies`
Expand Down
8 changes: 8 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ process {
]
}

withName: 'PICARD_CREATESEQUENCEDICTIONARY' {
publishDir = [
path: { "${params.outdir}/picard_createsequencedictionary" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'BWAMEM2_MEM' {
publishDir = [
path: { "${params.outdir}/bwamem2_mem" },
Expand Down
5 changes: 2 additions & 3 deletions subworkflows/local/prepare_genome/main.nf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//
// Prepare reference genome files

include { BWAMEM2_INDEX } from '../../../modules/nf-core/bwamem2/index'
include { SAMTOOLS_FAIDX } from '../../../modules/nf-core/samtools/faidx'
include { BWAMEM2_INDEX } from '../../../modules/nf-core/bwamem2/index'
include { SAMTOOLS_FAIDX } from '../../../modules/nf-core/samtools/faidx'
include { PICARD_CREATESEQUENCEDICTIONARY } from '../../../modules/nf-core/picard/createsequencedictionary/main'

workflow PREPARE_GENOME {
Expand All @@ -18,7 +18,6 @@ workflow PREPARE_GENOME {
// Initialize all channels that might be used later
ch_bwamem2_index = channel.empty()
ch_reference_fai = channel.empty()
ch_reference_fasta = channel.empty()
ch_ref_dict = channel.empty()
ch_versions = channel.empty()

Expand Down
146 changes: 146 additions & 0 deletions subworkflows/local/prepare_genome/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
nextflow_workflow {

name "Test Workflow PREPARE_GENOME"
script "subworkflows/local/prepare_genome/main.nf"
workflow "PREPARE_GENOME"
tag 'subworkflows'
tag 'prepare_genome'

test("Test without bwamem2 index file path and with run_picard_collecthsmetrics=false") {

when {
config "./nextflow.config"
params {
outdir = "$outputDir"
run_picard_collecthsmetrics = true

}
workflow {
"""
input[0] = channel.of([id:'genome'], file(params.pipelines_testdata_base_path + '/reference/reference.fasta', checkIfExists: true)).collect()
input[1] = null
input[2] = ''
input[3] = false
input[4] = null
"""
}
}

then {
// All files + folders produced by BWAMEM2_INDEX
def bwamem2_index_files = getAllFilesFromDir(
params.outdir + '/bwamem2_index',
relative: true, includeDir: true
)
// All files + folders produced by SAMTOOLS_FAIDX
def samtools_faidx_files = getAllFilesFromDir(
params.outdir + '/samtools_faidx',
relative: true, includeDir: true
)

assert workflow.success

assert snapshot(
bwamem2_index_files,
samtools_faidx_files
).match()

// BWAMEM2_INDEX and SAMTOOLS_FAIDX should run
assert workflow.out.versions.size() == 2
}

}

test("Test without bwamem2 index file path, with run_picard_collecthsmetrics=true and with ref_dict") {

when {
config "./nextflow.config"
params {
outdir = "$outputDir"
run_picard_collecthsmetrics = true

}
workflow {
"""
input[0] = channel.of([id:'genome'], file(params.pipelines_testdata_base_path + '/reference/reference.fasta', checkIfExists: true)).collect()
input[1] = null
input[2] = ''
input[3] = true
input[4] = params.pipelines_testdata_base_path + '/reference/reference.dict'
"""
}
}

then {
// All files + folders produced by BWAMEM2_INDEX
def bwamem2_index_files = getAllFilesFromDir(
params.outdir + '/bwamem2_index',
relative: true, includeDir: true
)
// All files + folders produced by SAMTOOLS_FAIDX
def samtools_faidx_files = getAllFilesFromDir(
params.outdir + '/samtools_faidx',
relative: true, includeDir: true
)

assert workflow.success
assert snapshot(
bwamem2_index_files,
samtools_faidx_files
).match()
// BWAMEM2_INDEX and SAMTOOLS_FAIDX should run
assert workflow.out.versions.size() == 2
}

}

test("Test without bwamem2 index file path, with run_picard_collecthsmetrics=true and without ref_dict") {

when {
config "./nextflow.config"
params {
outdir = "$outputDir"
run_picard_collecthsmetrics = true

}
workflow {
"""
input[0] = channel.of([id:'genome'], file(params.pipelines_testdata_base_path + '/reference/reference.fasta', checkIfExists: true)).collect()
input[1] = null
input[2] = ''
input[3] = true
input[4] = null
"""
}
}

then {
// All files + folders produced by BWAMEM2_INDEX
def bwamem2_index_files = getAllFilesFromDir(
params.outdir + '/bwamem2_index',
relative: true, includeDir: true
)
// All files + folders produced by SAMTOOLS_FAIDX
def samtools_faidx_files = getAllFilesFromDir(
params.outdir + '/samtools_faidx',
relative: true, includeDir: true
)
// All files + folders produced by PICARD_CREATESEQUENCEDICTIONARY
def picard_createsequencedictionary_files = getAllFilesFromDir(
params.outdir + '/picard_createsequencedictionary',
relative: true, includeDir: true
)

assert workflow.success
assert snapshot(
bwamem2_index_files,
samtools_faidx_files,
picard_createsequencedictionary_files
).match()
// BWAMEM2_INDEX, SAMTOOLS_FAIDX and PICARD_CREATESEQUENCEDICTIONARY should run
assert workflow.out.versions.size() == 3
}

}

}
75 changes: 75 additions & 0 deletions subworkflows/local/prepare_genome/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"Test without bwamem2 index file path, with run_picard_collecthsmetrics=true and without ref_dict": {
"content": [
[
"",
"bwamem2",
"bwamem2/reference.fasta.0123",
"bwamem2/reference.fasta.amb",
"bwamem2/reference.fasta.ann",
"bwamem2/reference.fasta.bwt.2bit.64",
"bwamem2/reference.fasta.pac"
],
[
"",
"reference.fasta.fai",
"reference.fasta.sizes"
],
[
"",
"genome.dict"
]
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-12-02T11:58:24.141721"
},
"Test without bwamem2 index file path, with run_picard_collecthsmetrics=true and with ref_dict": {
"content": [
[
"",
"bwamem2",
"bwamem2/reference.fasta.0123",
"bwamem2/reference.fasta.amb",
"bwamem2/reference.fasta.ann",
"bwamem2/reference.fasta.bwt.2bit.64",
"bwamem2/reference.fasta.pac"
],
[
"",
"reference.fasta.fai",
"reference.fasta.sizes"
]
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-12-02T11:57:18.592897"
},
"Test without bwamem2 index file path and with run_picard_collecthsmetrics=false": {
"content": [
[
"",
"bwamem2",
"bwamem2/reference.fasta.0123",
"bwamem2/reference.fasta.amb",
"bwamem2/reference.fasta.ann",
"bwamem2/reference.fasta.bwt.2bit.64",
"bwamem2/reference.fasta.pac"
],
[
"",
"reference.fasta.fai",
"reference.fasta.sizes"
]
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.2"
},
"timestamp": "2025-12-02T11:56:19.206085"
}
}
7 changes: 7 additions & 0 deletions subworkflows/local/prepare_genome/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Load the basic test config
includeConfig '../../../../tests/nextflow.config'


params {
pipelines_testdata_base_path = params.pipelines_testdata_base_path + 'raredisease/'
}
Loading