Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
15 changes: 14 additions & 1 deletion conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ process {
]
}

withName: SNIPPY_RUN {
withName: SNIPPY_RUN_READS {
publishDir = [
path: { "${params.outdir}/${meta.id}/VARIANTS/SNIPPY" },
mode: params.publish_dir_mode,
Expand All @@ -610,6 +610,19 @@ process {
ext.prefix = { "${meta.id}_${meta.mode}" }
}

withName: SNIPPY_RUN_CONTIGS {
publishDir = [
path: { "${params.outdir}/${meta.id}/VARIANTS/SNIPPY" },
mode: params.publish_dir_mode,
saveAs: { filename ->
return filename.replaceAll('^.+/', '')
}
]
ext.args = { "--mincov ${params.snp_mincov} --minqual ${params.snp_minqual}"
}
ext.prefix = { "${meta.id}_${meta.mode}" }
}

withName: IGVREPORTS_VCF {
publishDir = [
path: { "${params.outdir}/AGGREGATE/VARIANTS/IGVREPORTS" },
Expand Down
5 changes: 5 additions & 0 deletions modules/local/snippy/run/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::snippy=4.6.0
56 changes: 56 additions & 0 deletions modules/local/snippy/run/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
process SNIPPY_RUN_CONTIGS {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/snippy:4.6.0--hdfd78af_2' :
'biocontainers/snippy:4.6.0--hdfd78af_2' }"

input:
tuple val(meta), path(contigs)
path reference

output:
tuple val(meta), path("${prefix}/${prefix}.tab") , emit: tab
tuple val(meta), path("${prefix}/${prefix}.csv") , emit: csv
tuple val(meta), path("${prefix}/${prefix}.html") , emit: html
tuple val(meta), path("${prefix}/${prefix}.vcf") , emit: vcf
tuple val(meta), path("${prefix}/${prefix}.bed") , emit: bed
tuple val(meta), path("${prefix}/${prefix}.gff") , emit: gff
tuple val(meta), path("${prefix}/${prefix}.bam") , emit: bam
tuple val(meta), path("${prefix}/${prefix}.bam.bai") , emit: bai
tuple val(meta), path("${prefix}/${prefix}.log") , emit: log
tuple val(meta), path("${prefix}/${prefix}.aligned.fa") , emit: aligned_fa
tuple val(meta), path("${prefix}/${prefix}.consensus.fa") , emit: consensus_fa
tuple val(meta), path("${prefix}/${prefix}.consensus.subs.fa"), emit: consensus_subs_fa
tuple val(meta), path("${prefix}/${prefix}.raw.vcf") , emit: raw_vcf
tuple val(meta), path("${prefix}/${prefix}.filt.vcf") , emit: filt_vcf
tuple val(meta), path("${prefix}/${prefix}.vcf.gz") , emit: vcf_gz
tuple val(meta), path("${prefix}/${prefix}.vcf.gz.csi") , emit: vcf_csi
tuple val(meta), path("${prefix}/${prefix}.txt") , emit: txt
path "versions.yml" , emit: versions

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

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"

"""
snippy \\
$args \\
--cpus $task.cpus \\
--ram $task.memory \\
--outdir $prefix \\
--reference $reference \\
--prefix $prefix \\
--ctgs $contigs

cat <<-END_VERSIONS > versions.yml
"${task.process}":
snippy: \$(echo \$(snippy --version 2>&1) | sed 's/snippy //')
END_VERSIONS
"""
}
213 changes: 213 additions & 0 deletions modules/local/snippy/run/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
name: snippy_run
description: Rapid haploid variant calling
keywords:
- variant
- fastq
- bacteria
tools:
- snippy:
description: "Rapid bacterial SNP calling and core genome alignments"
homepage: "https://github.com/tseemann/snippy"
documentation: "https://github.com/tseemann/snippy"
tool_dev_url: "https://github.com/tseemann/snippy"
licence: ["GPL v2"]
identifier: biotools:snippy
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
type: file
description: |
List of input FastQ files of size 1 and 2 for single-end and paired-end data,
respectively.
pattern: "*.{fq,fastq,fq.gz,fastq.gz}"
- - reference:
type: file
description: Reference genome in FASTA format
pattern: "*.{fasta,fna,fa}"
output:
- tab:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.tab:
type: file
description: A simple tab-separated summary of all the variants
pattern: "*.tab"
- csv:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.csv:
type: file
description: A comma-separated version of the .tab file
pattern: "*.csv"
- html:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.html:
type: file
description: A HTML version of the .tab file
pattern: "*.html"
- vcf:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.vcf:
type: file
description: The final annotated variants in VCF format
pattern: "*.vcf"
- bed:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.bed:
type: file
description: The variants in BED format
pattern: "*.bed"
- gff:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.gff:
type: file
description: The variants in GFF3 format
pattern: "*.gff"
- bam:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.bam:
type: file
description: The alignments in BAM format. Includes unmapped, multimapping reads.
Excludes duplicates.
pattern: "*.bam"
- bai:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.bam.bai:
type: file
description: Index for the .bam file
pattern: "*.bam.bai"
- log:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.log:
type: file
description: A log file with the commands run and their outputs
pattern: "*.log"
- aligned_fa:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.aligned.fa:
type: file
description: A version of the reference but with - at position with depth=0
and N for 0 < depth < --mincov (does not have variants)
pattern: "*.aligned.fa"
- consensus_fa:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.consensus.fa:
type: file
description: A version of the reference genome with all variants instantiated
pattern: "*.consensus.fa"
- consensus_subs_fa:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.consensus.subs.fa:
type: file
description: A version of the reference genome with only substitution variants
instantiated
pattern: "*.consensus.subs.fa"
- raw_vcf:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.raw.vcf:
type: file
description: The unfiltered variant calls from Freebayes
pattern: "*.raw.vcf"
- filt_vcf:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.filt.vcf:
type: file
description: The filtered variant calls from Freebayes
pattern: "*.filt.vcf"
- vcf_gz:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.vcf.gz:
type: file
description: Compressed .vcf file via BGZIP
pattern: "*.vcf.gz"
- vcf_csi:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.vcf.gz.csi:
type: file
description: Index for the .vcf.gz via bcftools index
pattern: "*.vcf.gz.csi"
- txt:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- ${prefix}/${prefix}.txt:
type: file
description: Tab-separated columnar list of statistics
pattern: "*.txt"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@rpetit3"
maintainers:
- "@rpetit3"
59 changes: 59 additions & 0 deletions modules/local/snippy/run/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

nextflow_process {

name "Test Process SNIPPY_RUN"
script "../main.nf"
process "SNIPPY_RUN"

tag "modules"
tag "modules_nfcore"
tag "snippy"
tag "snippy/run"

test("test-snippy-run") {

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] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)

"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.tab,
process.out.csv,
process.out.html,
path(process.out.vcf[0][1]).vcf.summary,
file(process.out.bed[0][1]).name, // empty: d41d8cd98f00b204e9800998ecf8427e
process.out.gff,
bam(process.out.bam[0][1]).getReadsMD5(),
file(process.out.bai[0][1]).name,
file(process.out.log[0][1]).name,
process.out.aligned_fa,
process.out.consensus_fa,
process.out.consensus_subs_fa,
path(process.out.raw_vcf[0][1]).vcf.summary,
path(process.out.filt_vcf[0][1]).vcf.summary,
path(process.out.vcf_gz[0][1]).vcf.summary,
file(process.out.vcf_csi[0][1]).name,
file(process.out.txt[0][1]).readLines()[3..5],
process.out.versions
).match()
}
)
}
}

}
Loading
Loading