Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
adamrtalbot committed Jun 5, 2023
2 parents 66f4ba1 + fe54581 commit e8f1195
Show file tree
Hide file tree
Showing 21 changed files with 316 additions and 31 deletions.
6 changes: 3 additions & 3 deletions modules/nf-core/annotsv/annotsv/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ process ANNOTSV_ANNOTSV {
tag "$meta.id"
label 'process_low'

conda "bioconda::annotsv=3.3.4"
conda "bioconda::annotsv=3.3.6"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/annotsv:3.3.4--py311hdfd78af_1' :
'biocontainers/annotsv:3.3.4--py311hdfd78af_1' }"
'https://depot.galaxyproject.org/singularity/annotsv:3.3.6--py311hdfd78af_0' :
'biocontainers/annotsv:3.3.6--py311hdfd78af_0' }"

input:
tuple val(meta), path(sv_vcf), path(sv_vcf_index), path(candidate_small_variants)
Expand Down
6 changes: 3 additions & 3 deletions modules/nf-core/annotsv/installannotations/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ process ANNOTSV_INSTALLANNOTATIONS {
tag 'AnnotSV annotations'
label 'process_single'

conda "bioconda::annotsv=3.3.4"
conda "bioconda::annotsv=3.3.6"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/annotsv:3.3.4--py311hdfd78af_1':
'biocontainers/annotsv:3.3.4--py311hdfd78af_1' }"
'https://depot.galaxyproject.org/singularity/annotsv:3.3.6--py311hdfd78af_0' :
'biocontainers/annotsv:3.3.6--py311hdfd78af_0' }"

output:
path "AnnotSV_annotations", emit: annotations
Expand Down
49 changes: 49 additions & 0 deletions modules/nf-core/bacphlip/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
process BACPHLIP {
tag "$meta.id"
label 'process_high'

conda "bioconda::bacphlip=0.9.6 conda-forge::numpy=1.23.5 bioconda::hmmer=3.3.2"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-e16bfb0f667f2f3c236b32087aaf8c76a0cd2864:c64689d7d5c51670ff5841ec4af982edbe7aa406-0':
'biocontainers/mulled-v2-e16bfb0f667f2f3c236b32087aaf8c76a0cd2864:c64689d7d5c51670ff5841ec4af982edbe7aa406-0' }"

input:
tuple val(meta), path(fasta)

output:
tuple val(meta), path("*.bacphlip") , emit: bacphlip_results
tuple val(meta), path("*.hmmsearch.tsv") , emit: hmmsearch_results
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = '0.9.6' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
"""
bacphlip \\
-i $fasta \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bacphlip: $VERSION
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def VERSION = '0.9.6' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
"""
touch ${fasta}.bacphlip
touch ${fasta}.hmmsearch.tsv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bacphlip: $VERSION
END_VERSIONS
"""
}
50 changes: 50 additions & 0 deletions modules/nf-core/bacphlip/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "bacphlip"
description: A bacteriophage lifestyle prediction tool
keywords:
- phage
- lifestyle
- temperate
- virulent
- bacphlip
- hmmsearch
tools:
- "bacphlip":
description: "A Random Forest classifier to predict bacteriophage lifestyle"
homepage: https://github.com/adamhockenberry/bacphlip
documentation: https://github.com/adamhockenberry/bacphlip
tool_dev_url: https://github.com/adamhockenberry/bacphlip
doi: 10.7717/peerj.11396
licence: "['MIT']"

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- fasta:
type: file
description: FASTA file containing phage contigs/scaffolds/chromosomes (if it is a multi-FASTA file be sure to add the `--multi_fasta` argument)
pattern: "*.{fasta,fna,fa}"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- bacphlip_results:
type: file
description: TSV file containing Temperate and Virulent scores for each phage sequence
pattern: "*.bacphlip"
- hmmsearch_results:
type: file
description: TSV file containing binary output indicating gene presence/absence based on hmmsearch results
pattern: "*.hmmsearch.tsv"

authors:
- "@CarsonJM"
33 changes: 28 additions & 5 deletions modules/nf-core/bowtie2/align/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ process BOWTIE2_ALIGN {
val sort_bam

output:
tuple val(meta), path("*.bam") , emit: bam
tuple val(meta), path("*.log") , emit: log
tuple val(meta), path("*fastq.gz"), emit: fastq, optional:true
path "versions.yml" , emit: versions
tuple val(meta), path("*.{bam,sam}"), emit: aligned
tuple val(meta), path("*.log") , emit: log
tuple val(meta), path("*fastq.gz") , emit: fastq, optional:true
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -38,6 +38,8 @@ process BOWTIE2_ALIGN {
}

def samtools_command = sort_bam ? 'sort' : 'view'
def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/
def extension = (args2 ==~ extension_pattern) ? (args2 =~ extension_pattern)[0][2].toLowerCase() : "bam"

"""
INDEX=`find -L ./ -name "*.rev.1.bt2" | sed "s/\\.rev.1.bt2\$//"`
Expand All @@ -51,7 +53,7 @@ process BOWTIE2_ALIGN {
$unaligned \\
$args \\
2> ${prefix}.bowtie2.log \\
| samtools $samtools_command $args2 --threads $task.cpus -o ${prefix}.bam -
| samtools $samtools_command $args2 --threads $task.cpus -o ${prefix}.${extension} -
if [ -f ${prefix}.unmapped.fastq.1.gz ]; then
mv ${prefix}.unmapped.fastq.1.gz ${prefix}.unmapped_1.fastq.gz
Expand All @@ -68,4 +70,25 @@ process BOWTIE2_ALIGN {
pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
END_VERSIONS
"""

stub:
def args2 = task.ext.args2 ?: ""
def prefix = task.ext.prefix ?: "${meta.id}"
def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/
def extension = (args2 ==~ extension_pattern) ? (args2 =~ extension_pattern)[0][2].toLowerCase() : "bam"

"""
touch ${prefix}.${extension}
touch ${prefix}.bowtie2.log
touch ${prefix}.unmapped_1.fastq.gz
touch ${prefix}.unmapped_2.fastq.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bowtie2: \$(echo \$(bowtie2 --version 2>&1) | sed 's/^.*bowtie2-align-s version //; s/ .*\$//')
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
END_VERSIONS
"""

}
6 changes: 3 additions & 3 deletions modules/nf-core/bowtie2/align/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ input:
description: use samtools sort (true) or samtools view (false)
pattern: "true or false"
output:
- bam:
- aligned:
type: file
description: Output BAM file containing read alignments
pattern: "*.{bam}"
description: Output BAM/SAM file containing read alignments
pattern: "*.{bam,sam}"
- versions:
type: file
description: File containing software versions
Expand Down
13 changes: 13 additions & 0 deletions modules/nf-core/cutadapt/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,17 @@ process CUTADAPT {
cutadapt: \$(cutadapt --version)
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def trimmed = meta.single_end ? "${prefix}.trim.fastq.gz" : "${prefix}_1.trim.fastq.gz ${prefix}_2.trim.fastq.gz"
"""
touch ${prefix}.cutadapt.log
touch ${trimmed}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
cutadapt: \$(cutadapt --version)
END_VERSIONS
"""
}
2 changes: 2 additions & 0 deletions modules/nf-core/semibin/singleeasybin/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: semibin_singleeasybin
description: metagenomic binning with self-supervised learning
keywords:
- binning
- assembly-binning
- metagenomics
tools:
- "semibin":
description: "Metagenomic binning with semi-supervised siamese neural network"
Expand Down
10 changes: 5 additions & 5 deletions subworkflows/nf-core/fastq_align_bowtie2/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ workflow FASTQ_ALIGN_BOWTIE2 {
// Map reads with Bowtie2
//
BOWTIE2_ALIGN ( ch_reads, ch_index, save_unaligned, sort_bam )
ch_versions = ch_versions.mix(BOWTIE2_ALIGN.out.versions.first())
ch_versions = ch_versions.mix(BOWTIE2_ALIGN.out.versions)

//
// Sort, index BAM file and run samtools stats, flagstat and idxstats
//
BAM_SORT_STATS_SAMTOOLS ( BOWTIE2_ALIGN.out.bam, ch_fasta )
BAM_SORT_STATS_SAMTOOLS ( BOWTIE2_ALIGN.out.aligned, ch_fasta )
ch_versions = ch_versions.mix(BAM_SORT_STATS_SAMTOOLS.out.versions)

emit:
bam_orig = BOWTIE2_ALIGN.out.bam // channel: [ val(meta), bam ]
log_out = BOWTIE2_ALIGN.out.log // channel: [ val(meta), log ]
fastq = BOWTIE2_ALIGN.out.fastq // channel: [ val(meta), fastq ]
bam_orig = BOWTIE2_ALIGN.out.aligned // channel: [ val(meta), aligned ]
log_out = BOWTIE2_ALIGN.out.log // channel: [ val(meta), log ]
fastq = BOWTIE2_ALIGN.out.fastq // channel: [ val(meta), fastq ]

bam = BAM_SORT_STATS_SAMTOOLS.out.bam // channel: [ val(meta), [ bam ] ]
bai = BAM_SORT_STATS_SAMTOOLS.out.bai // channel: [ val(meta), [ bai ] ]
Expand Down
2 changes: 1 addition & 1 deletion subworkflows/nf-core/fastq_align_dna/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ workflow FASTQ_ALIGN_DNA {
switch (aligner) {
case 'bowtie2':
BOWTIE2_ALIGN(ch_reads, ch_aligner_index, false, sort) // if aligner is bowtie2
ch_bam = ch_bam.mix(BOWTIE2_ALIGN.out.bam)
ch_bam = ch_bam.mix(BOWTIE2_ALIGN.out.aligned)
ch_versions = ch_versions.mix(BOWTIE2_ALIGN.out.versions)
break
case 'bwamem':
Expand Down
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ backsub:
- modules/nf-core/backsub/**
- tests/modules/nf-core/backsub/**

bacphlip:
- modules/nf-core/bacphlip/**
- tests/modules/nf-core/bacphlip/**

bakta/bakta:
- modules/nf-core/bakta/bakta/**
- tests/modules/nf-core/bakta/bakta/**
Expand Down
15 changes: 15 additions & 0 deletions tests/modules/nf-core/bacphlip/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2

include { BACPHLIP } from '../../../../modules/nf-core/bacphlip/main.nf'

workflow test_bacphlip {

input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['candidatus_portiera_aleyrodidarum']['genome']['genome_fasta'], checkIfExists: true)
]

BACPHLIP ( input )
}
5 changes: 5 additions & 0 deletions tests/modules/nf-core/bacphlip/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {

publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

}
19 changes: 19 additions & 0 deletions tests/modules/nf-core/bacphlip/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- name: bacphlip test_bacphlip
command: nextflow run ./tests/modules/nf-core/bacphlip -entry test_bacphlip -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bacphlip/nextflow.config
tags:
- bacphlip
files:
- path: output/bacphlip/genome.fasta.bacphlip
md5sum: 3d07000f244d3a44b45c37adb2bcac4a
- path: output/bacphlip/genome.fasta.hmmsearch.tsv
md5sum: e4f0f3d4a75300ab4ee1d760cbded532
- path: output/bacphlip/versions.yml

- name: bacphlip test_bacphlip_stub
command: nextflow run ./tests/modules/nf-core/bacphlip -entry test_bacphlip -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bacphlip/nextflow.config -stub-run
tags:
- bacphlip
files:
- path: output/bacphlip/genome.fasta.bacphlip
- path: output/bacphlip/genome.fasta.hmmsearch.tsv
- path: output/bacphlip/versions.yml
36 changes: 36 additions & 0 deletions tests/modules/nf-core/bowtie2/align/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,42 @@ workflow test_bowtie2_align_single_end {
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned, sort )
}

workflow test_bowtie2_align_single_end_sam {
input = [
[ id:'test', single_end:true ], // meta map
[
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)
]
]
fasta = [
[ id:'test'],
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
save_unaligned = false
sort = false

BOWTIE2_BUILD ( fasta )
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned, sort )
}

workflow test_bowtie2_align_single_end_sam2 {
input = [
[ id:'test', single_end:true ], // meta map
[
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)
]
]
fasta = [
[ id:'test'],
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
save_unaligned = false
sort = false

BOWTIE2_BUILD ( fasta )
BOWTIE2_ALIGN ( input, BOWTIE2_BUILD.out.index, save_unaligned, sort )
}

workflow test_bowtie2_align_single_end_sorted {
input = [
[ id:'test', single_end:true ], // meta map
Expand Down
8 changes: 8 additions & 0 deletions tests/modules/nf-core/bowtie2/align/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ process {
withName: BOWTIE2_BUILD {
publishDir = [ enabled: false ]
}

withName: "test_bowtie2_align_single_end_sam:BOWTIE2_ALIGN" {
ext.args2 = '--output-fmt SAM'
}

withName: "test_bowtie2_align_single_end_sam2:BOWTIE2_ALIGN" {
ext.args2 = '-O SAM'
}
}

if (params.force_large_index) {
Expand Down
Loading

0 comments on commit e8f1195

Please sign in to comment.