Skip to content

Commit

Permalink
Merge branch 'master' into clipkit
Browse files Browse the repository at this point in the history
  • Loading branch information
vagkaratzas authored Nov 14, 2024
2 parents 95a278b + 9208952 commit 35dda74
Show file tree
Hide file tree
Showing 49 changed files with 839 additions and 531 deletions.
4 changes: 2 additions & 2 deletions modules/nf-core/biscuit/align/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ channels:
- conda-forge
- bioconda
dependencies:
- bioconda::biscuit=1.1.0.20220707
- bioconda::samtools=1.16.1
- bioconda::biscuit=1.5.0.20240506
- bioconda::samtools=1.21
33 changes: 25 additions & 8 deletions modules/nf-core/biscuit/align/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ process BISCUIT_ALIGN {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0':
'biocontainers/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0' }"
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/5b/5b542bbe1f99afd494ef07423ea8b52f2b8a081b85f92db2726c283c78da3cf0/data':
'community.wave.seqera.io/library/biscuit_samtools:84373c8a97fa63b8' }"

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

output:
tuple val(meta), path("*.bam"), emit: bam
Expand All @@ -23,18 +24,34 @@ process BISCUIT_ALIGN {
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def biscuit_cpus = (int) Math.max(Math.floor(task.cpus*0.9),1)
def samtools_cpus = task.cpus-biscuit_cpus
def biscuit_cpus = [(task.cpus * 0.9) as int, 1].max()
def samtools_cpus = (task.cpus - biscuit_cpus < 1) ? biscuit_cpus : (task.cpus - biscuit_cpus)
"""
INDEX=`find -L ./ -name "*.bis.amb" | sed 's/\\.bis.amb\$//'`
ln -sf \$(readlink $fasta) $index/$fasta
biscuit align \\
$args \\
-@ $biscuit_cpus \\
\$INDEX \\
$index/$fasta \\
$reads \\
| samtools sort $args2 --threads $samtools_cpus --write-index -o ${prefix}.bam##idx##${prefix}.bam.bai -
| samtools sort $args2 --threads $samtools_cpus --write-index -o ${prefix}.bam -O BAM -
samtools index ${prefix}.bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
biscuit: \$( biscuit version |& sed '1!d; s/^.*BISCUIT Version: //' )
samtools: \$( samtools --version |& sed '1!d; s/^.*samtools //' )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.bam
touch ${prefix}.bam.bai
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
21 changes: 17 additions & 4 deletions modules/nf-core/biscuit/align/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,24 @@ input:
- reads:
type: file
description: |
List of input fastq files of size 1 and 2 for single-end and paired-end data,
List of input FastQ files of size 1 and 2 for single-end and paired-end data,
respectively.
- - index:
- - meta2:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- fasta:
type: file
description: Input genome fasta file
- - meta3:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- index:
type: directory
description: Biscuit genome index directory (generated with 'biscuit index')
pattern: "BiscuitIndex"
description: Directory containing biscuit genome index
output:
- bam:
- meta:
Expand Down Expand Up @@ -63,3 +75,4 @@ authors:
- "@njspix"
maintainers:
- "@njspix"
- "@sateeshperi"
70 changes: 58 additions & 12 deletions modules/nf-core/biscuit/align/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ nextflow_process {

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

test("Single-End sarscov2 test_methylated_1 [fastq_gz]") {
test("sarscov2 single-end [fastq_gz]") {

when {
process {
Expand All @@ -30,22 +33,29 @@ nextflow_process {
[ id:'test' ], // meta map
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true) ]
]
input[1] = BISCUIT_INDEX.out.index
input[1] = Channel.of([
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
])
input[2] = BISCUIT_INDEX.out.index
"""
}
}

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

test("Paired-End sarscov2 test_methylated_1 [fastq_gz]") {
test("sarscov2 paired-end [fastq_gz]") {

when {
process {
Expand All @@ -55,17 +65,53 @@ nextflow_process {
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_2.fastq.gz', checkIfExists: true) ]
]
input[1] = BISCUIT_INDEX.out.index
input[1] = Channel.of([
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
])
input[2] = BISCUIT_INDEX.out.index
"""
}
}

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

test("sarscov2 paired-end [fastq_gz] - stub") {
options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_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] = BISCUIT_INDEX.out.index
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match()
}
)
}
}
Expand Down
87 changes: 77 additions & 10 deletions modules/nf-core/biscuit/align/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,26 +1,93 @@
{
"single-end-versions": {
"sarscov2 single-end [fastq_gz]": {
"content": [
"499055250804bb3674c724bd9adf9d02",
[
"versions.yml:md5,0b2a8c4c438a785a890110a458399bfd"
[
{
"id": "test"
},
"test.bam.bai:md5,a748afc3cec6c27906ae80638e2024f5"
]
],
[
"versions.yml:md5,18c276eafa69dc43fa4d5b83b8392016"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.1"
"nf-test": "0.9.2",
"nextflow": "24.10.0"
},
"timestamp": "2024-05-22T20:06:02.295706212"
"timestamp": "2024-11-14T10:03:51.461022384"
},
"paired-end-versions": {
"sarscov2 paired-end [fastq_gz]": {
"content": [
"6b5afc62da5533472e1479950bb5f09a",
[
[
{
"id": "test"
},
"test.bam.bai:md5,ba60b802f583496e330c555bca9f0b97"
]
],
[
"versions.yml:md5,0b2a8c4c438a785a890110a458399bfd"
"versions.yml:md5,18c276eafa69dc43fa4d5b83b8392016"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.1"
"nf-test": "0.9.2",
"nextflow": "24.10.0"
},
"timestamp": "2024-11-14T10:04:02.88266119"
},
"sarscov2 paired-end [fastq_gz] - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
{
"id": "test"
},
"test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
"versions.yml:md5,18c276eafa69dc43fa4d5b83b8392016"
],
"bai": [
[
{
"id": "test"
},
"test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"bam": [
[
{
"id": "test"
},
"test.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,18c276eafa69dc43fa4d5b83b8392016"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.0"
},
"timestamp": "2024-05-22T20:06:17.879689395"
"timestamp": "2024-11-13T06:48:19.558887499"
}
}
3 changes: 0 additions & 3 deletions modules/nf-core/biscuit/align/tests/tags.yml

This file was deleted.

4 changes: 2 additions & 2 deletions modules/nf-core/biscuit/biscuitblaster/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ channels:
- conda-forge
- bioconda
dependencies:
- bioconda::biscuit=1.1.0.20220707
- bioconda::biscuit=1.5.0.20240506
- bioconda::samblaster=0.1.26
- bioconda::samtools=1.16.1
- bioconda::samtools=1.21
32 changes: 17 additions & 15 deletions modules/nf-core/biscuit/biscuitblaster/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ process BISCUIT_BLASTER {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0':
'biocontainers/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0' }"
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22f141a92e12f98040054b9a47a51fb4de9c544174bbfa6d251a110f5e26fddc/data':
'community.wave.seqera.io/library/biscuit_samblaster_samtools:a683d0887e7a91bf' }"

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

output:
tuple val(meta), path("*.bam"), emit: bam
Expand All @@ -24,23 +25,24 @@ process BISCUIT_BLASTER {
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def args3 = task.ext.args3 ?: ''
def biscuit_cpus = (int) Math.max(Math.floor(task.cpus*0.95),1)
def samtools_cpus = task.cpus-biscuit_cpus
def biscuit_cpus = [(task.cpus * 0.9) as int, 1].max()
def samtools_cpus = (task.cpus - biscuit_cpus < 1) ? biscuit_cpus : (task.cpus - biscuit_cpus)
"""
INDEX=`find -L ./ -name "*.bis.amb" | sed 's/\\.bis.amb\$//'`
ln -sf \$(readlink $fasta) $index/$fasta
biscuit align \\
-@ $biscuit_cpus \\
$args \\
\$INDEX \\
$reads | \\
samblaster \\
$args2 | \\
samtools sort \\
-@ $samtools_cpus \\
$args3 \\
--write-index \\
-o ${prefix}.bam##idx##${prefix}.bam.bai
$index/$fasta\\
$reads \\
| samblaster $args2 \\
| samtools sort \\
-@ $samtools_cpus \\
$args3 \\
--write-index \\
-o ${prefix}.bam -O BAM -
samtools index ${prefix}.bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
Loading

0 comments on commit 35dda74

Please sign in to comment.