Skip to content

Commit

Permalink
Merge branch 'nf-core:master' into shigapass
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlcummins authored Oct 31, 2024
2 parents 826c3bd + adf071f commit bc6e41d
Show file tree
Hide file tree
Showing 12 changed files with 395 additions and 588 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,12 @@ jobs:
path: modules/nf-core/parabricks/fq2bammeth
- profile: singularity
path: modules/nf-core/parabricks/fq2bammeth
- profile: conda
path: modules/nf-core/parabricks/fq2bam
- profile: docker_self_hosted
path: modules/nf-core/parabricks/fq2bam
- profile: singularity
path: modules/nf-core/parabricks/fq2bam
- profile: conda
path: subworkflows/nf-core/vcf_annotate_ensemblvep
- profile: conda
Expand Down
37 changes: 14 additions & 23 deletions modules/nf-core/parabricks/fq2bam/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@ process PARABRICKS_FQ2BAM {
tag "$meta.id"
label 'process_high'

container "nvcr.io/nvidia/clara/clara-parabricks:4.3.0-1"
container "nvcr.io/nvidia/clara/clara-parabricks:4.3.2-1"

input:
tuple val(meta), path(reads), path(interval_file)
tuple val(meta), path(reads)
tuple val(meta2), path(fasta)
tuple val(meta3), path(index)
path known_sites
tuple val(meta4), path(interval_file)
path(known_sites)

output:
tuple val(meta), path("*.bam") , emit: bam
tuple val(meta), path("*.bai") , emit: bai
path "versions.yml" , emit: versions
path "qc_metrics", optional:true , emit: qc_metrics
path("*.table"), optional:true , emit: bqsr_table
path("duplicate-metrics.txt"), optional:true , emit: duplicate_metrics
tuple val(meta), path("*.bam") , emit: bam
tuple val(meta), path("*.bai") , emit: bai
tuple val(meta), path("*.table"), emit: bqsr_table , optional:true
path "versions.yml" , emit: versions
path "qc_metrics" , emit: qc_metrics , optional:true
path("duplicate-metrics.txt") , emit: duplicate_metrics , optional:true

when:
task.ext.when == null || task.ext.when
Expand All @@ -32,21 +33,20 @@ process PARABRICKS_FQ2BAM {
def known_sites_command = known_sites ? known_sites.collect{"--knownSites $it"}.join(' ') : ""
def known_sites_output = known_sites ? "--out-recal-file ${prefix}.table" : ""
def interval_file_command = interval_file ? interval_file.collect{"--interval-file $it"}.join(' ') : ""
def num_gpus = task.accelerator ? "--num-gpus $task.accelerator.request" : ''
"""
INDEX=`find -L ./ -name "*.amb" | sed 's/\\.amb\$//'`
mv $fasta \$INDEX
cp $fasta \$INDEX
pbrun \\
fq2bam \\
--ref \$INDEX \\
$in_fq_command \\
--read-group-sm $meta.id \\
--out-bam ${prefix}.bam \\
$known_sites_command \\
$known_sites_output \\
$interval_file_command \\
--num-gpus $task.accelerator.request \\
$num_gpus \\
$args
cat <<-END_VERSIONS > versions.yml
Expand All @@ -62,19 +62,10 @@ process PARABRICKS_FQ2BAM {
}
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def in_fq_command = meta.single_end ? "--in-se-fq $reads" : "--in-fq $reads"
def known_sites_command = known_sites ? known_sites.collect{"--knownSites $it"}.join(' ') : ""
def known_sites_output = known_sites ? "--out-recal-file ${prefix}.table" : ""
def interval_file_command = interval_file ? interval_file.collect{"--interval-file $it"}.join(' ') : ""
def metrics_output_command = args = "--out-duplicate-metrics duplicate-metrics.txt" ? "touch duplicate-metrics.txt" : ""
def known_sites_output_command = known_sites ? "touch ${prefix}.table" : ""
def qc_metrics_output_command = args = "--out-qc-metrics-dir qc_metrics " ? "mkdir qc_metrics && touch qc_metrics/alignment.txt" : ""
"""
touch ${prefix}.bam
touch ${prefix}.bam.bai
$metrics_output_command
$known_sites_output_command
$qc_metrics_output_command
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pbrun: \$(echo \$(pbrun version 2>&1) | sed 's/^Please.* //' )
Expand Down
32 changes: 21 additions & 11 deletions modules/nf-core/parabricks/fq2bam/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ input:
type: file
description: fastq.gz files
pattern: "*.fastq.gz"
- interval_file:
type: file
description: (optional) file(s) containing genomic intervals for use in base
quality score recalibration (BQSR)
pattern: "*.{bed,interval_list,picard,list,intervals}"
- - meta2:
type: map
description: |
Expand All @@ -45,6 +40,15 @@ input:
type: file
description: reference BWA index
pattern: "*.{amb,ann,bwt,pac,sa}"
- - meta4:
type: map
description: |
Groovy Map containing index information
- interval_file:
type: file
description: (optional) file(s) containing genomic intervals for use in base
quality score recalibration (BQSR)
pattern: "*.{bed,interval_list,picard,list,intervals}"
- - known_sites:
type: file
description: (optional) known sites file(s) for calculating BQSR. markdups must
Expand All @@ -71,6 +75,17 @@ output:
type: file
description: index corresponding to sorted BAM file
pattern: "*.bai"
- bqsr_table:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test']
- "*.table":
type: file
description: (optional) table from base quality score recalibration calculation,
to be used with parabricks/applybqsr
pattern: "*.table"
- versions:
- versions.yml:
type: file
Expand All @@ -81,12 +96,6 @@ output:
type: directory
description: (optional) optional directory of qc metrics
pattern: "qc_metrics"
- bqsr_table:
- "*.table":
type: file
description: (optional) table from base quality score recalibration calculation,
to be used with parabricks/applybqsr
pattern: "*.table"
- duplicate_metrics:
- duplicate-metrics.txt:
type: file
Expand All @@ -99,3 +108,4 @@ authors:
maintainers:
- "@bsiranosian"
- "@adamrtalbot"
- "@gallvp"
174 changes: 174 additions & 0 deletions modules/nf-core/parabricks/fq2bam/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
nextflow_process {

name "Test Process PARABRICKS_FQ2BAM"
script "../main.nf"
process "PARABRICKS_FQ2BAM"
config "./nextflow.config"

tag "bwa/index"
tag "modules"
tag "parabricks/fq2bam"
tag "modules_nfcore"
tag "parabricks"

setup {
run("BWA_INDEX") {
script "../../../bwa/index/main.nf"
process {
"""
input[0] = Channel.of([
[ id:'test' ], // meta map
file('https://github.com/nf-core/test-datasets/raw/methylseq/reference/genome.fa', checkIfExists: true)
])
"""
}
}

run("BWA_INDEX", alias: 'BWA_INDEX_PE') {
script "../../../bwa/index/main.nf"
process {
"""
input[0] = Channel.of([
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
])
"""
}
}
}

test("SRR389222 - fastq - se") {

when {
process {
"""
input[0] = Channel.of([
[ id:'test', single_end:true ], // meta map
[
file('https://github.com/nf-core/test-datasets/raw/methylseq/testdata/SRR389222_sub1.fastq.gz', checkIfExists: true)
]
])
input[1] = Channel.of([
[ id:'test' ], // meta map
file('https://github.com/nf-core/test-datasets/raw/methylseq/reference/genome.fa', checkIfExists: true)
])
input[2] = BWA_INDEX.out.index
input[3] = [ [], [] ]
input[4] = []
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
bam(process.out.bam[0][1]).getReadsMD5(),
file(process.out.bai[0][1]).name,
process.out.versions
).match() }
)
}
}

test("SRR389222 - fastq - se - stub") {
options '-stub'

when {
process {
"""
input[0] = Channel.of([
[ id:'test', single_end:true ], // meta map
[
file('https://github.com/nf-core/test-datasets/raw/methylseq/testdata/SRR389222_sub1.fastq.gz', checkIfExists: true)
]
])
input[1] = Channel.of([
[ id:'test' ], // meta map
file('https://github.com/nf-core/test-datasets/raw/methylseq/reference/genome.fa', checkIfExists: true)
])
input[2] = BWA_INDEX.out.index
input[3] = [ [], [] ]
input[4] = []
"""
}
}

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

test("sarscov2 - fastq - pe") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
]
]
input[1] = Channel.of([
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
])
input[2] = BWA_INDEX_PE.out.index
input[3] = [ [], [] ]
input[4] = []
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
bam(process.out.bam[0][1]).getReadsMD5(),
file(process.out.bai[0][1]).name,
process.out.versions
).match() }
)
}

}

test("sarscov2 - fastq - pe - stub") {
options '-stub'

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
]
]
input[1] = Channel.of([
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
])
input[2] = BWA_INDEX_PE.out.index
input[3] = [ [], [] ]
input[4] = []
"""
}
}

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

}

}
Loading

0 comments on commit bc6e41d

Please sign in to comment.