Skip to content

add readgroup to fq2bam #8624

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

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
11 changes: 10 additions & 1 deletion modules/nf-core/parabricks/fq2bam/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ process PARABRICKS_FQ2BAM {
container "nvcr.io/nvidia/clara/clara-parabricks:4.4.0-1"

input:
tuple val(meta) , path(reads)
tuple val(meta) , path(reads), val(rg_map)
tuple val(meta2), path(fasta)
tuple val(meta3), path(index)
tuple val(meta4), path(interval_file)
Expand Down Expand Up @@ -38,6 +38,11 @@ process PARABRICKS_FQ2BAM {
def in_fq_command = meta.single_end ? "--in-se-fq $reads" : "--in-fq $reads"
def extension = "$output_fmt"

def rg_sample_cmd = rg_map.SM ? "--read-group-sm ${rg_map.SM}" : ""
def rg_library_cmd = rg_map.LB ? "--read-group-lb ${rg_map.LB}" : ""
def rg_platform_cmd = rg_map.PL ? "--read-group-pl ${rg_map.PL}" : ""
def rg_id_prefix_cmd = rg_map.ID_PU ? "--read-group-id-prefix ${rg_map.ID_PU}" : ""

def known_sites_command = known_sites ? (known_sites instanceof List ? known_sites.collect { "--knownSites $it" }.join(' ') : "--knownSites ${known_sites}") : ""
def known_sites_output_cmd = known_sites ? "--out-recal-file ${prefix}.table" : ""
def interval_file_command = interval_file ? (interval_file instanceof List ? interval_file.collect { "--interval-file $it" }.join(' ') : "--interval-file ${interval_file}") : ""
Expand All @@ -51,6 +56,10 @@ process PARABRICKS_FQ2BAM {
fq2bam \\
--ref \$INDEX \\
$in_fq_command \\
$rg_sample_cmd \\
$rg_library_cmd \\
$rg_platform_cmd \\
$rg_id_prefix_cmd \\
--out-bam ${prefix}.${extension} \\
$known_sites_command \\
$known_sites_output_cmd \\
Expand Down
5 changes: 5 additions & 0 deletions modules/nf-core/parabricks/fq2bam/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ input:
type: file
description: fastq.gz files
pattern: "*.fastq.gz"
- rg_map:
type: map
description: |
Groovy Map containing readgroup information
e.g. [ SM:'NA12878', LB:'Solexa-272222', PL:'illumina', ID_PU:'H0164ALXX140820:2:1101:10003:23460' ]
- - meta2:
type: map
description: |
Expand Down
118 changes: 108 additions & 10 deletions modules/nf-core/parabricks/fq2bam/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,48 @@ nextflow_process {

test("SRR389222 - fastq - se") {

config './nextflow.config'
when {
params {
module_args = '--low-memory'
// Ref: https://forums.developer.nvidia.com/t/problem-with-gpu/256825/6
// Parabricks’s fq2bam requires 24GB of memory.
// Using --low-memory for testing
}
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these files in the methylseq repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are tests that were already there @sateeshperi might be responsible

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move them all in the modules branch

])
input[2] = BWA_INDEX.out.index
input[3] = [ [], [] ]
input[4] = [ [], [] ]
input[5] = 'bam'
"""
}
}

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

test("SRR389222 - fastq - se - rg") {

when {
params {
Expand All @@ -68,7 +109,11 @@ nextflow_process {
[ id:'test', single_end:true ], // meta map
[
file('https://github.com/nf-core/test-datasets/raw/methylseq/testdata/SRR389222_sub1.fastq.gz', checkIfExists: true)
]
],
[ SM:'NA12878',
LB:'Solexa-272222',
PL:'illumina',
ID_PU:'H0164ALXX140820:2:1101:10003:23460' ]
])
input[1] = Channel.of([
[ id:'test' ], // meta map
Expand Down Expand Up @@ -96,7 +141,7 @@ nextflow_process {
}

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

options '-stub'

when {
Expand All @@ -109,7 +154,8 @@ nextflow_process {
[ 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
Expand Down Expand Up @@ -138,7 +184,52 @@ nextflow_process {

when {
params {
module_args = '--low-memory'
module_args = '--low-memory --bwa-options="-K 10000000"'
// Ref: https://forums.developer.nvidia.com/t/problem-with-gpu/256825/6
// Parabricks’s fq2bam requires 24GB of memory.
// Using --low-memory for testing
}
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] = [ [], [] ]
input[5] = 'bam'
"""
}
}

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

}

test("sarscov2 - fastq - pe - rg") {

when {
params {
module_args = '--low-memory --bwa-options="-K 10000000"'
// Ref: https://forums.developer.nvidia.com/t/problem-with-gpu/256825/6
// Parabricks’s fq2bam requires 24GB of memory.
// Using --low-memory for testing
Expand All @@ -150,7 +241,11 @@ nextflow_process {
[
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)
]
],
[ SM:'NA12878',
LB:'Solexa-272222',
PL:'illumina',
ID_PU:'H0164ALXX140820:2:1101:10003:23460' ]
]
input[1] = Channel.of([
[ id:'test' ], // meta map
Expand Down Expand Up @@ -193,7 +288,8 @@ nextflow_process {
[
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
Expand Down Expand Up @@ -234,7 +330,8 @@ nextflow_process {
[ id:'test', single_end:true ], // meta map
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)
]
],
[]
]
input[1] = [[id: 'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]
input[2] = BWA_INDEX_CRAM.out.index
Expand Down Expand Up @@ -278,7 +375,8 @@ nextflow_process {
[
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
Expand All @@ -298,7 +396,7 @@ nextflow_process {
{ assert snapshot(
process.out,
path(process.out.versions[0]).yaml
).match()
).match()
}
)
}
Expand Down
38 changes: 38 additions & 0 deletions modules/nf-core/parabricks/fq2bam/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,44 @@
},
"timestamp": "2024-12-16T12:25:23.63061876"
},
"SRR389222 - fastq - se - rg": {
"content": [
"3d5b94990c7fdf90a682edb5ee0f59de",
"test.bam.bai",
[
"versions.yml:md5,55d1e67ef8fa9d0ea3065363a653ffef"
],
{
"PARABRICKS_FQ2BAM": {
"pbrun": "4.4.0-1"
}
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.3"
},
"timestamp": "2025-06-16T11:24:03.502485885"
},
"sarscov2 - fastq - pe - rg": {
"content": [
"2d64e4363d9f3c0e2167fce49d5087cf",
"test.bam.bai",
[
"versions.yml:md5,55d1e67ef8fa9d0ea3065363a653ffef"
],
{
"PARABRICKS_FQ2BAM": {
"pbrun": "4.4.0-1"
}
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "25.04.3"
},
"timestamp": "2025-06-16T11:25:42.845212163"
},
"sarscov2 - fastq - se - cram": {
"content": [
"30c325e1e032eb1782a280d34c0fb1c7",
Expand Down
Loading