Skip to content
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

Update bclconvert #7034

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
79 changes: 58 additions & 21 deletions modules/nf-core/bclconvert/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ process BCLCONVERT {
tuple val(meta), path(samplesheet), path(run_dir)

output:
tuple val(meta), path("output/**_S[1-9]*_R?_00?.fastq.gz") , emit: fastq
tuple val(meta), path("output/**_S[1-9]*_I?_00?.fastq.gz") , optional:true, emit: fastq_idx
tuple val(meta), path("output/**Undetermined_S0*_R?_00?.fastq.gz") , optional:true, emit: undetermined
tuple val(meta), path("output/**Undetermined_S0*_I?_00?.fastq.gz") , optional:true, emit: undetermined_idx
tuple val(meta), path("output/Reports") , emit: reports
tuple val(meta), path("output/Logs") , emit: logs
tuple val(meta), path("**/InterOp/*.bin", includeInputs: true), emit: interop
path("versions.yml") , emit: versions
tuple val(meta), path("output/**_S[1-9]*_R?_00?.fastq.gz") , emit: fastq
tuple val(meta), path("output/**_S[1-9]*_I?_00?.fastq.gz") , emit: fastq_idx, optional:true
tuple val(meta), path("output/**Undetermined_S0*_R?_00?.fastq.gz") , emit: undetermined, optional:true
tuple val(meta), path("output/**Undetermined_S0*_I?_00?.fastq.gz") , emit: undetermined_idx, optional:true
tuple val(meta), path("output/Reports") , emit: reports
tuple val(meta), path("output/Logs") , emit: logs
tuple val(meta), path("**/InterOp/*.bin", includeInputs: true) , emit: interop
path("versions.yml") , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -25,9 +25,9 @@ process BCLCONVERT {
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
error "BCLCONVERT module does not support Conda. Please use Docker / Singularity / Podman instead."
}
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def args3 = task.ext.args3 ?: ''
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def args3 = task.ext.args3 ?: ''
def input_tar = run_dir.toString().endsWith(".tar.gz") ? true : false
def input_dir = input_tar ? run_dir.toString() - '.tar.gz' : run_dir
"""
Expand All @@ -37,27 +37,27 @@ process BCLCONVERT {

if ${input_tar}; then
## Ensures --strip-components only applied when top level of tar contents is a directory
## If just files or multiple directories, place all in $input_dir
## If just files or multiple directories, place all in ${input_dir}

if [[ \$(tar -taf ${run_dir} | grep -o -P "^.*?\\/" | uniq | wc -l) -eq 1 ]]; then
tar \\
-C $input_dir --strip-components 1 \\
-C ${input_dir} --strip-components 1 \\
-xavf \\
$args2 \\
$run_dir \\
$args3
${args2} \\
${run_dir} \\
${args3}
else
tar \\
-C $input_dir \\
-C ${input_dir} \\
-xavf \\
$args2 \\
$run_dir \\
$args3
${args2} \\
${run_dir} \\
${args3}
fi
fi

bcl-convert \\
$args \\
${args} \\
--output-directory output \\
--bcl-input-directory ${input_dir} \\
--sample-sheet ${samplesheet}
Expand All @@ -67,4 +67,41 @@ process BCLCONVERT {
bclconvert: \$(bcl-convert -V 2>&1 | head -n 1 | sed 's/^.*Version //')
END_VERSIONS
"""

stub:
"""
mkdir -p output/Reports
mkdir -p output/Logs
echo "" | gzip > output/Sample1_S1_L001_R1_001.fastq.gz
echo "" | gzip > output/Undetermined_S0_L001_R1_001.fastq.gz
touch output/Reports/Adapter_Cycle_Metrics.csv
touch output/Reports/Adapter_Metrics.csv
touch output/Reports/Demultiplex_Stats.csv
touch output/Reports/Demultiplex_Tile_Stats.csv
touch output/Reports/fastq_list.csv
touch output/Reports/Index_Hopping_Counts.csv
touch output/Reports/IndexMetricsOut.bin
touch output/Reports/Quality_Metrics.csv
touch output/Reports/Quality_Tile_Metrics.csv
touch output/Reports/RunInfo.xml
touch output/Reports/SampleSheet.csv
touch output/Reports/Top_Unknown_Barcodes.csv
touch output/Logs/Errors.log
touch output/Logs/FastqComplete.log
touch output/Logs/Info.log
touch output/Logs/Warnings.log
mkdir -p flowcell/InterOp
touch flowcell/InterOp/ControlMetricsOut.bin
touch flowcell/InterOp/CorrectedIntMetricsOut.bin
touch flowcell/InterOp/ErrorMetricsOut.bin
touch flowcell/InterOp/ExtractionMetricsOut.bin
touch flowcell/InterOp/IndexMetricsOut.bin
touch flowcell/InterOp/QMetricsOut.bin
touch flowcell/InterOp/TileMetricsOut.bin

cat <<-END_VERSIONS > versions.yml
"${task.process}":
bclconvert: \$(bcl-convert -V 2>&1 | head -n 1 | sed 's/^.*Version //')
END_VERSIONS
"""
}
47 changes: 38 additions & 9 deletions modules/nf-core/bclconvert/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ nextflow_process {
script "../main.nf"
process "BCLCONVERT"
config "./nextflow.config"

tag "bclconvert"
tag "modules"
tag "modules_nfcore"

test("homo sapiens illumina [bcl]") {
test("homo_sapiens illumina [bcl]") {
when {
process {
//TODO use new test dataset when available, see https://github.com/nf-core/test-datasets/issues/996
SPPearce marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -26,15 +27,43 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.reports,
process.out.versions,
process.out.fastq,
file(process.out.logs.get(0).get(1)).list().sort(),
process.out.interop.get(0).get(1).findAll { file(it).name != "IndexMetricsOut.bin" },
).match()
},
{ assert process.out.undetermined.get(0).get(1) ==~ ".*/Undetermined_S0_L001_R1_001.fastq.gz"},
{ assert file(process.out.interop.get(0).get(1).find { file(it).name == "IndexMetricsOut.bin" }).exists() }
process.out.fastq_idx,
process.out.undetermined.collect { meta, fastq -> file(fastq).name },
process.out.undetermined_idx,
process.out.reports,
process.out.logs.collect { meta, logs -> file(logs).list().sort() },
process.out.interop.collect { meta, interop ->
interop.findAll { interopfile ->
file(interopfile).name != "IndexMetricsOut.bin" } },
process.out.versions
).match() },
{ assert process.out.interop.collect { meta, interop ->
interop.find { interopfile -> file(interopfile).name == "IndexMetricsOut.bin" } } }
)
}
}

test("homo_sapiens illumina [bcl] - stub") {
options "-stub"

when {
process {
//TODO use new test dataset when available, see https://github.com/nf-core/test-datasets/issues/996
"""
input[0] = [
[ id: 'test', lane:1 ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bcl/flowcell_samplesheet.csv', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bcl/flowcell.tar.gz', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
Expand Down
Loading
Loading