Merge branch 'master' into tkhalilullah/issue946

This commit is contained in:
Harshil Patel 2021-11-15 18:01:13 +00:00 committed by GitHub
commit 403784aeb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
394 changed files with 13027 additions and 524 deletions

View file

@ -49,7 +49,7 @@ process ADAPTERREMOVAL {
"""
AdapterRemoval \\
--file1 ${reads[0]} \\
--file2 ${reads[0]} \\
--file2 ${reads[1]} \\
$options.args \\
--basename $prefix \\
--threads $task.cpus \\
@ -68,7 +68,7 @@ process ADAPTERREMOVAL {
"""
AdapterRemoval \\
--file1 ${reads[0]} \\
--file2 ${reads[0]} \\
--file2 ${reads[1]} \\
--collapse \\
$options.args \\
--basename $prefix \\

View file

@ -11,11 +11,11 @@ process AGRVATE {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::agrvate=1.0.1" : null)
conda (params.enable_conda ? "bioconda::agrvate=1.0.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/agrvate:1.0.1--hdfd78af_0"
container "https://depot.galaxyproject.org/singularity/agrvate:1.0.2--hdfd78af_0"
} else {
container "quay.io/biocontainers/agrvate:1.0.1--hdfd78af_0"
container "quay.io/biocontainers/agrvate:1.0.2--hdfd78af_0"
}
input:

View file

@ -19,8 +19,9 @@ process ALLELECOUNTER {
}
input:
tuple val(meta), path(bam), path(bai)
tuple val(meta), path(input), path(input_index)
path loci
path fasta
output:
tuple val(meta), path("*.alleleCount"), emit: allelecount
@ -28,11 +29,14 @@ process ALLELECOUNTER {
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def reference_options = fasta ? "-r $fasta": ""
"""
alleleCounter \\
$options.args \\
-l $loci \\
-b $bam \\
-b $input \\
$reference_options \\
-o ${prefix}.alleleCount
cat <<-END_VERSIONS > versions.yml

View file

@ -19,11 +19,11 @@ input:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
- input:
type: file
description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
- bai:
- input_index:
type: file
description: BAM/CRAM/SAM index file
pattern: "*.{bai,crai,sai}"
@ -31,7 +31,9 @@ input:
type: file
description: loci file <CHR><tab><POS1>
pattern: "*.{tsv}"
- fasta:
type: file
description: Input genome fasta file. Required when passing CRAM files.
output:
- meta:
@ -50,3 +52,4 @@ output:
authors:
- "@fullama"
- "@fbdtemme"

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,38 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process ASSEMBLYSCAN {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::assembly-scan=0.4.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/assembly-scan:0.4.1--pyhdfd78af_0"
} else {
container "quay.io/biocontainers/assembly-scan:0.4.1--pyhdfd78af_0"
}
input:
tuple val(meta), path(assembly)
output:
tuple val(meta), path("*.json"), emit: json
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
assembly-scan $assembly > ${prefix}.json
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( assembly-scan --version 2>&1 | sed 's/^.*assembly-scan //; s/Using.*\$//' )
END_VERSIONS
"""
}

View file

@ -0,0 +1,43 @@
name: assemblyscan
description: Assembly summary statistics in JSON format
keywords:
- assembly
- statistics
tools:
- assemblyscan:
description: Assembly summary statistics in JSON format
homepage: https://github.com/rpetit3/assembly-scan
documentation: https://github.com/rpetit3/assembly-scan
tool_dev_url: https://github.com/rpetit3/assembly-scan
doi: ""
licence: ['MIT']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- assembly:
type: file
description: FASTA file for a given assembly
pattern: "*.fasta"
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"
- json:
type: file
description: Assembly statistics in JSON format
pattern: "*.json"
authors:
- "@sateeshperi"
- "@mjcipriano"

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,56 @@
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process ATAQV_ATAQV {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::ataqv=1.2.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/ataqv:1.2.1--py39ha23c084_2"
} else {
container "quay.io/biocontainers/ataqv:1.2.1--py36hfdecbe1_2"
}
input:
tuple val(meta), path(bam), path(bai), path(peak_file)
val organism
path tss_file
path excl_regs_file
path autosom_ref_file
output:
tuple val(meta), path("*.ataqv.json"), emit: json
tuple val(meta), path("*.problems") , emit: problems, optional: true
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def peak = peak_file ? "--peak-file $peak_file" : ''
def tss = tss_file ? "--tss-file $tss_file" : ''
def excl_regs = excl_regs_file ? "--excluded-region-file $excl_regs_file" : ''
def autosom_ref = autosom_ref_file ? "--autosomal-reference-file $autosom_ref_file" : ''
"""
ataqv \\
$options.args \\
$peak \\
$tss \\
$excl_regs \\
$autosom_ref \\
--metrics-file "${prefix}.ataqv.json" \\
--threads $task.cpus \\
--name $prefix \\
$organism \\
$bam
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( ataqv --version )
END_VERSIONS
"""
}

View file

@ -0,0 +1,66 @@
name: ataqv_ataqv
description: ataqv function of a corresponding ataqv tool
keywords:
- ataqv
tools:
- ataqv:
description: ataqv is a toolkit for measuring and comparing ATAC-seq results. It was written to help understand how well ATAC-seq assays have worked, and to make it easier to spot differences that might be caused by library prep or sequencing.
homepage: https://github.com/ParkerLab/ataqv/blob/master/README.rst
documentation: https://github.com/ParkerLab/ataqv/blob/master/README.rst
tool_dev_url: https://github.com/ParkerLab/ataqv
doi: "https://doi.org/10.1016/j.cels.2020.02.009"
licence: ['GPL v3']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: BAM file
pattern: "*.bam"
- bai:
type: file
description: BAM index file with the same prefix as bam file. Required if tss_file input is provided.
pattern: "*.bam.bai"
- peak_file:
type: file
description: A BED file of peaks called for alignments in the BAM file
pattern: "*.bed"
- organism:
type: string
description: The subject of the experiment, which determines the list of autosomes (see "Reference Genome Configuration" section at https://github.com/ParkerLab/ataqv).
- tss_file:
type: file
description: A BED file of transcription start sites for the experiment organism. If supplied, a TSS enrichment score will be calculated according to the ENCODE data standards. This calculation requires that the BAM file of alignments be indexed.
pattern: "*.bed"
- excl_regs_file:
type: file
description: A BED file containing excluded regions. Peaks or TSS overlapping these will be ignored.
pattern: "*.bed"
- autosom_ref_file:
type: file
description: A file containing autosomal reference names, one per line. The names must match the reference names in the alignment file exactly, or the metrics based on counts of autosomal alignments will be wrong.
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- json:
type: file
description: The JSON file to which metrics will be written.
- problems:
type: file
description: If given, problematic reads will be logged to a file per read group, with names derived from the read group IDs, with ".problems" appended. If no read groups are found, the reads will be written to one file named after the BAM file.
pattern: "*.problems"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@i-pletenev"

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,44 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BAMUTIL_TRIMBAM {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bamutil=1.0.15" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/bamutil:1.0.15--h2e03b76_1"
} else {
container "quay.io/biocontainers/bamutil:1.0.15--h2e03b76_1"
}
input:
tuple val(meta), path(bam), val(trim_left), val(trim_right)
output:
tuple val(meta), path("*.bam"), emit: bam
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
bam \\
trimBam \\
$bam \\
${prefix}.bam \\
$options.args \\
-L $trim_left \\
-R $trim_right
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( echo \$( bam trimBam 2>&1 ) | sed 's/^Version: //;s/;.*//' )
END_VERSIONS
"""
}

View file

@ -0,0 +1,51 @@
name: bamutil_trimbam
description: trims the end of reads in a SAM/BAM file, changing read ends to N and quality to !, or by soft clipping
keywords:
- bam
- trim
- clipping
- bamUtil
- trimBam
tools:
- bamutil:
description: Programs that perform operations on SAM/BAM files, all built into a single executable, bam.
homepage: https://genome.sph.umich.edu/wiki/BamUtil
documentation: https://genome.sph.umich.edu/wiki/BamUtil:_trimBam
tool_dev_url: https://github.com/statgen/bamUtil
doi: "10.1101/gr.176552.114"
licence: ['GPL v3']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: BAM file
pattern: "*.bam"
- trim_left:
type: integer
description: Number of bases to trim off the right-hand side of a read. Reverse strands are reversed before trimming.
- trim_right:
type: integer
description: Number of bases to trim off the right-hand side of a read. Reverse strands are reversed before trimming.
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"
- bam:
type: file
description: Trimmed but unsorted BAM file
pattern: "*.bam"
authors:
- "@jfy133"

View file

@ -24,6 +24,7 @@ process BBMAP_ALIGN {
output:
tuple val(meta), path("*.bam"), emit: bam
tuple val(meta), path("*.log"), emit: log
path "versions.yml" , emit: versions
script:
@ -51,7 +52,8 @@ process BBMAP_ALIGN {
out=${prefix}.bam \\
$options.args \\
threads=$task.cpus \\
-Xmx${task.memory.toGiga()}g
-Xmx${task.memory.toGiga()}g \\
&> ${prefix}.bbmap.log
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:

View file

@ -19,7 +19,7 @@ process BEDTOOLS_GENOMECOV {
}
input:
tuple val(meta), path(intervals)
tuple val(meta), path(intervals), val(scale)
path sizes
val extension
@ -28,13 +28,21 @@ process BEDTOOLS_GENOMECOV {
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def args_token = options.args.tokenize()
def args = options.args
args += (scale > 0 && scale != 1) ? " -scale $scale" : ""
if (!args_token.contains('-bg') && (scale > 0 && scale != 1)) {
args += " -bg"
}
if (intervals.name =~ /\.bam/) {
"""
bedtools \\
genomecov \\
-ibam $intervals \\
$options.args \\
$args \\
> ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml
@ -48,7 +56,7 @@ process BEDTOOLS_GENOMECOV {
genomecov \\
-i $intervals \\
-g $sizes \\
$options.args \\
$args \\
> ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml

View file

@ -20,6 +20,9 @@ input:
type: file
description: BAM/BED/GFF/VCF
pattern: "*.{bam|bed|gff|vcf}"
- scale:
type: value
description: Number containing the scale factor for the output. Set to 1 to disable. Setting to a value other than 1 will also get the -bg bedgraph output format as this is required for this command switch
- sizes:
type: file
description: Tab-delimited table of chromosome names in the first column and chromosome sizes in the second column
@ -45,3 +48,4 @@ authors:
- "@sruthipsuresh"
- "@drpatelh"
- "@sidorov-si"
- "@chris-cheshire"

View file

@ -19,20 +19,21 @@ process BEDTOOLS_SORT {
}
input:
tuple val(meta), path(bed)
tuple val(meta), path(intervals)
val extension
output:
tuple val(meta), path('*.bed'), emit: bed
path "versions.yml" , emit: versions
tuple val(meta), path("*.${extension}"), emit: sorted
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
bedtools \\
sort \\
-i $bed \\
-i $intervals \\
$options.args \\
> ${prefix}.bed
> ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:

View file

@ -15,20 +15,26 @@ input:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bed:
- intervals:
type: file
description: Input BED file
pattern: "*.{bed}"
description: BED/BEDGRAPH
pattern: "*.{bed|bedGraph}"
- extension:
type: string
description: Extension of the output file (e. g., ".bg", ".bedgraph", ".txt", ".tab", etc.) It is set arbitrarily by the user and corresponds to the file format which depends on arguments.
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bed:
- sorted:
type: file
description: Sorted BED file
pattern: "*.{bed}"
description: Sorted output file
pattern: "*.${extension}"
- versions:
type: file
description: File containing software versions
@ -37,3 +43,4 @@ authors:
- "@Emiller88"
- "@sruthipsuresh"
- "@drpatelh"
- "@chris-cheshire"

View file

@ -31,8 +31,8 @@ process BWA_INDEX {
bwa \\
index \\
$options.args \\
$fasta \\
-p bwa/${fasta.baseName}
-p bwa/${fasta.baseName} \\
$fasta
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:

View file

@ -32,6 +32,10 @@ process BWAMETH_ALIGN {
"""
INDEX=`find -L ${index} -name "*.bwameth.c2t" | sed 's/.bwameth.c2t//'`
# Modify the timestamps so that bwameth doesn't complain about building the index
# See https://github.com/nf-core/methylseq/pull/217
touch -c -- *
bwameth.py \\
$options.args \\
$read_group \\

View file

@ -0,0 +1,21 @@
FROM continuumio/miniconda3:4.8.2
LABEL authors="Gisela Gabernet <gisela.gabernet@gmail.com>" \
description="Docker image containing Cell Ranger"
# Disclaimer: this container is not provided nor supported by 10x Genomics.
# Install procps and clean apt cache
RUN apt-get update \
&& apt-get install -y procps \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
# Copy pre-downloaded cellranger file
ENV CELLRANGER_VER 6.0.2
COPY cellranger-$CELLRANGER_VER.tar.gz /opt/cellranger-$CELLRANGER_VER.tar.gz
# Install cellranger
RUN \
cd /opt && \
tar -xzvf cellranger-$CELLRANGER_VER.tar.gz && \
export PATH=/opt/cellranger-$CELLRANGER_VER:$PATH && \
ln -s /opt/cellranger-$CELLRANGER_VER/cellranger /usr/bin/cellranger && \
rm -rf /opt/cellranger-$CELLRANGER_VER.tar.gz

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,40 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process CELLRANGER_MKREF {
tag 'mkref'
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
if (params.enable_conda) {
exit 1, "Conda environments cannot be used when using the Cell Ranger tool. Please use docker or singularity containers."
}
container "nfcore/cellranger:6.0.2"
input:
path fasta
path gtf
val(reference_name)
output:
path "versions.yml" , emit: versions
path "${reference_name}", emit: reference
script:
"""
cellranger mkref \\
--genome=${reference_name} \\
--fasta=${fasta} \\
--genes=${gtf}
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$( cellranger --version 2>&1) | sed 's/^.*[^0-9]\\([0-9]*\\.[0-9]*\\.[0-9]*\\).*\$/\\1/' )
END_VERSIONS
"""
}

View file

@ -0,0 +1,39 @@
name: cellranger_mkref
description: Module to build the reference needed by the 10x Genomics Cell Ranger tool. Uses the cellranger mkref command.
keywords:
- reference
- mkref
- index
tools:
- cellranger:
description: Cell Ranger by 10x Genomics is a set of analysis pipelines that process Chromium single-cell data to align reads, generate feature-barcode matrices, perform clustering and other secondary analysis, and more.
homepage: https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/what-is-cell-ranger
documentation: https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/using/tutorial_ov
tool_dev_url: https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/using/tutorial_ov
doi: ""
licence: 10x Genomics EULA
input:
- fasta:
type: file
description: fasta genome file
pattern: "*.{fasta,fa}"
- gtf:
type: file
description: gtf transcriptome file
pattern: "*.gtf"
- reference_name:
type: val
description: name to give the reference folder
pattern: str
output:
- versions:
type: file
description: File containing software version
pattern: "versions.yml"
- reference:
type: folder
description: Folder containing all the reference indices needed by Cell Ranger
authors:
- "@ggabernet"

View file

@ -0,0 +1,18 @@
# Updating the docker container and making a new module release
Cell Ranger is a commercial tool by 10X Genomics. The container provided for the cellranger nf-core module is not provided nor supported by 10x Genomics. Updating the Cell Ranger version in the container and pushing the update to Dockerhub needs to be done manually.
1. Navigate to the [Cell Ranger download page](https://support.10xgenomics.com/single-cell-gene-expression/software/downloads/latest) and download the tar ball of the desired Cell Ranger version with `curl` or `wget`. Place this file in the same folder where the Dockerfile lies.
2. Edit the Dockerfile: update the Cell Ranger version in this line:
```bash
ENV CELLRANGER_VER <VERSION>
```
3. Create the container:
```bash
docker build . -t nfcore/cellranger:<VERSION>
docker push nfcore/cellranger:<VERSION>
```

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,46 @@
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
def VERSION = '1.0.4'
process CMSEQ_POLYMUT {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::cmseq=1.0.4" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/cmseq:1.0.4--pyhb7b1952_0"
} else {
container "quay.io/biocontainers/cmseq:1.0.4--pyhb7b1952_0"
}
input:
tuple val(meta), path(bam), path(bai), path(gff), path(fasta)
output:
tuple val(meta), path("*.txt"), emit: polymut
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def fasta_refid = fasta ? "-c $fasta" : ""
def sortindex = bai ? "" : "--sortindex"
"""
polymut.py \\
$options.args \\
$sortindex \\
$fasta_refid \\
--gff_file $gff \\
$bam > ${prefix}.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( echo $VERSION )
END_VERSIONS
"""
}

View file

@ -0,0 +1,61 @@
name: cmseq_polymut
description: Calculates polymorphic site rates over protein coding genes
keywords:
- polymut
- polymorphic
- mags
- assembly
- polymorphic sites
- estimation
- protein coding genes
- cmseq
- bam
- coverage
tools:
- cmseq:
description: Set of utilities on sequences and BAM files
homepage: https://github.com/SegataLab/cmseq
documentation: https://github.com/SegataLab/cmseq
tool_dev_url: https://github.com/SegataLab/cmseq
licence: ['MIT License']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: BAM file
pattern: "*.bam"
- bai:
type: file
description: BAM index file
pattern: "*.bai"
- gff:
type: file
description: GFF file used to extract protein-coding genes
pattern: "*.gff"
- fasta:
type: file
description: Optional fasta file to run on a subset of references in the BAM file.
pattern: .{fa,fasta,fas,fna}
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"
- polymut:
type: file
description: Polymut report in `.txt` format.
pattern: "*.txt"
authors:
- "@maxibor"

View file

@ -20,18 +20,20 @@ process COOLER_DUMP {
input:
tuple val(meta), path(cool)
val resolution
output:
tuple val(meta), path("*.bedpe"), emit: bedpe
path "versions.yml" , emit: versions
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def suffix = resolution ? "::$resolution" : ""
"""
cooler dump \\
$options.args \\
-o ${prefix}.bedpe \\
$cool
$cool$suffix
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,41 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process COOLER_MERGE {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::cooler=0.8.11" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/cooler:0.8.11--pyh3252c3a_0"
} else {
container "quay.io/biocontainers/cooler:0.8.11--pyh3252c3a_0"
}
input:
tuple val(meta), path(cool)
output:
tuple val(meta), path("*.cool"), emit: cool
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
cooler merge \\
$options.args \\
${prefix}.cool \\
${cool}
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(cooler --version 2>&1 | sed 's/cooler, version //')
END_VERSIONS
"""
}

View file

@ -0,0 +1,41 @@
name: cooler_merge
description: Merge multiple coolers with identical axes
keywords:
- merge
tools:
- cooler:
description: Sparse binary format for genomic interaction matrices
homepage: https://cooler.readthedocs.io/en/latest/index.html
documentation: https://cooler.readthedocs.io/en/latest/index.html
tool_dev_url: https://github.com/open2c/cooler
doi: "10.1093/bioinformatics/btz540"
licence: ['BSD-3-clause']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- cool:
type: file
description: Path to COOL file
pattern: "*.{cool,mcool}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- versions:
type: file
description: File containing software version
pattern: "versions.yml"
- cool:
type: file
description: Path to COOL file
pattern: "*.cool"
authors:
- "@jianhong"

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,42 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process COOLER_ZOOMIFY {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::cooler=0.8.11" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/cooler:0.8.11--pyh3252c3a_0"
} else {
container "quay.io/biocontainers/cooler:0.8.11--pyh3252c3a_0"
}
input:
tuple val(meta), path(cool)
output:
tuple val(meta), path("*.mcool"), emit: mcool
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
cooler zoomify \\
$options.args \\
-n $task.cpus \\
-o ${prefix}.mcool \\
$cool
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(cooler --version 2>&1 | sed 's/cooler, version //')
END_VERSIONS
"""
}

View file

@ -0,0 +1,41 @@
name: cooler_zoomify
description: Generate a multi-resolution cooler file by coarsening
keywords:
- mcool
tools:
- cooler:
description: Sparse binary format for genomic interaction matrices
homepage: https://cooler.readthedocs.io/en/latest/index.html
documentation: https://cooler.readthedocs.io/en/latest/index.html
tool_dev_url: https://github.com/open2c/cooler
doi: "10.1093/bioinformatics/btz540"
licence: ['BSD-3-clause']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- cool:
type: file
description: Path to COOL file
pattern: "*.{cool,mcool}"
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"
- mcool:
type: file
description: Output mcool file
pattern: "*.mcool"
authors:
- "@jianhong"

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

47
modules/dedup/main.nf Normal file
View file

@ -0,0 +1,47 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process DEDUP {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::dedup=0.12.8" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/dedup:0.12.8--hdfd78af_1"
} else {
container "quay.io/biocontainers/dedup:0.12.8--hdfd78af_1"
}
input:
tuple val(meta), path(bam)
output:
tuple val(meta), path("*_rmdup.bam"), emit: bam // _rmdup is hardcoded output from dedup
tuple val(meta), path("*.json") , emit: json
tuple val(meta), path("*.hist") , emit: hist
tuple val(meta), path("*log") , emit: log
path "versions.yml" , emit: versions
script:
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
dedup \\
-Xmx${task.memory.toGiga()}g \\
-i $bam \\
-o . \\
$options.args
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( echo \$(dedup --version 2>&1) | tail -n 1 | sed 's/.* v//')
END_VERSIONS
"""
}

60
modules/dedup/meta.yml Normal file
View file

@ -0,0 +1,60 @@
name: dedup
description: DeDup is a tool for read deduplication in paired-end read merging (e.g. for ancient DNA experiments).
keywords:
- dedup
- deduplication
- pcr duplicates
- ancient DNA
- paired-end
- bam
tools:
- dedup:
description: DeDup is a tool for read deduplication in paired-end read merging (e.g. for ancient DNA experiments).
homepage: https://github.com/apeltzer/DeDup
documentation: https://dedup.readthedocs.io/en/latest/
tool_dev_url: https://github.com/apeltzer/DeDup
doi: "10.1186/s13059-016-0918-z"
licence: ['GPL v3']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: BAM/SAM file
pattern: "*.{bam,sam}"
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"
- bam:
type: file
description: Deduplicated BAM file
pattern: "*_rmdup.bam"
- json:
type: file
description: JSON file for MultiQC
pattern: "*.json"
- hist:
type: file
description: Histogram data of amount of deduplication
pattern: "*.hist"
- log:
type: file
description: Dedup log information
pattern: "*log"
authors:
- "@jfy133"

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

41
modules/emmtyper/main.nf Normal file
View file

@ -0,0 +1,41 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process EMMTYPER {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::emmtyper=0.2.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/emmtyper:0.2.0--py_0"
} else {
container "quay.io/biocontainers/emmtyper:0.2.0--py_0"
}
input:
tuple val(meta), path(fasta)
output:
tuple val(meta), path("*.tsv"), emit: tsv
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
emmtyper \\
$options.args \\
$fasta \\
> ${prefix}.tsv
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( echo \$(emmtyper --version 2>&1) | sed 's/^.*emmtyper v//' )
END_VERSIONS
"""
}

43
modules/emmtyper/meta.yml Normal file
View file

@ -0,0 +1,43 @@
name: emmtyper
description: EMM typing of Streptococcus pyogenes assemblies
keywords:
- fasta
- Streptococcus pyogenes
- typing
tools:
- emmtyper:
description: Streptococcus pyogenes in silico EMM typer
homepage: https://github.com/MDU-PHL/emmtyper
documentation: https://github.com/MDU-PHL/emmtyper
tool_dev_url: https://github.com/MDU-PHL/emmtyper
doi: ""
licence: ['GNU General Public v3 (GPL v3)']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- fasta:
type: file
description: FASTA assembly file
pattern: "*.{fasta,fasta.gz,fa,fa.gz,fna,fna.gz}"
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"
- tsv:
type: file
description: Tab-delimited result file
pattern: "*.tsv"
authors:
- "@rpetit3"

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

63
modules/fargene/main.nf Normal file
View file

@ -0,0 +1,63 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
def VERSION = '0.1'
process FARGENE {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::fargene=0.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/fargene:0.1--py27h21c881e_4"
} else {
container "quay.io/biocontainers/fargene:0.1--py27h21c881e_4"
}
input:
// input may be fasta (for genomes or longer contigs) or paired-end fastq (for metagenome), the latter in addition with --meta flag
tuple val(meta), path(input)
val hmm_model
output:
path "*.log" , emit: log
path "${prefix}/results_summary.txt" , emit: txt
tuple val(meta), path("${prefix}/hmmsearchresults/*.out") , optional: true, emit: hmm
tuple val(meta), path("${prefix}/predictedGenes/predicted-orfs.fasta") , optional: true, emit: orfs
tuple val(meta), path("${prefix}/predictedGenes/predicted-orfs-amino.fasta") , optional: true, emit: orfs_amino
tuple val(meta), path("${prefix}/predictedGenes/retrieved-contigs.fasta") , optional: true, emit: contigs
tuple val(meta), path("${prefix}/predictedGenes/retrieved-contigs-peptides.fasta") , optional: true, emit: contigs_pept
tuple val(meta), path("${prefix}/predictedGenes/*filtered.fasta") , optional: true, emit: filtered
tuple val(meta), path("${prefix}/predictedGenes/*filtered-peptides.fasta") , optional: true, emit: filtered_pept
tuple val(meta), path("${prefix}/retrievedFragments/all_retrieved_*.fastq") , optional: true, emit: fragments
tuple val(meta), path("${prefix}/retrievedFragments/retrievedFragments/trimmedReads/*.fasta"), optional: true, emit: trimmed
tuple val(meta), path("${prefix}/spades_assembly/*") , optional: true, emit: spades
tuple val(meta), path("${prefix}/tmpdir/*.fasta") , optional: true, emit: metagenome
tuple val(meta), path("${prefix}/tmpdir/*.out") , optional: true, emit: tmp
path "versions.yml" , emit: versions
script:
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
gzip \\
-cdf $input \\
> unziped.fa |
fargene \\
$options.args \\
-p $task.cpus \\
-i unziped.fa \\
--hmm-model $hmm_model \\
-o $prefix
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo $VERSION)
END_VERSIONS
"""
}

101
modules/fargene/meta.yml Normal file
View file

@ -0,0 +1,101 @@
name: fargene
description: tool that takes either fragmented metagenomic data or longer sequences as input and predicts and delivers full-length antiobiotic resistance genes as output.
keywords:
- antibiotic resistance genes
- ARGs
- identifier
- metagenomic
- contigs
tools:
- fargene:
description: Fragmented Antibiotic Resistance Gene Identifier takes either fragmented metagenomic data or longer sequences as input and predicts and delivers full-length antiobiotic resistance genes as output
homepage: https://github.com/fannyhb/fargene
documentation: https://github.com/fannyhb/fargene
tool_dev_url: https://github.com/fannyhb/fargene
doi: ""
licence: ['MIT']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- input:
type: file
description: fasta or paired-end fastq file containing either genomes or longer contigs as nucleotide or protein sequences (fasta) or fragmented metagenomic reads (fastq)
pattern: "*.{fasta}"
- hmm_model:
type: string
description: name of custom hidden markov model to be used [pre-defined class_a, class_b_1_2, class_b_3, class_c, class_d_1, class_d_2, qnr, tet_efflux, tet_rpg, tet_enzyme]
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"
- log:
type: file
description: log file
pattern: "*.{log}"
- txt:
type: file
description: analysis summary text file
pattern: "*.{txt}"
- hmm:
type: file
description: output from hmmsearch
pattern: "*.{out}"
- orfs:
type: file
description: open reading frames (ORFs)
pattern: "*.{fasta}"
- orfs_amino:
type: file
description: protein translation of open reading frames (ORFs)
pattern: "*.{fasta}"
- contigs:
type: file
description: (complete) contigs that passed the final full-length classification
pattern: "*.{fasta}"
- contigs_pept:
type: file
description: parts of the contigs that passed the final classification step that aligned with the HMM, as amino acid sequences
pattern: "*.{fasta}"
- filtered:
type: file
description: sequences that passed the final classification step, but only the parts that where predicted by the HMM to be part of the gene
pattern: "*.{fasta}"
- filtered_pept:
type: file
description: sequences from filtered.fasta, translated in the same frame as the gene is predicted to be located
pattern: "*.{fasta}"
- fragments:
type: file
description: All quality controlled retrieved fragments that were classified as positive, together with its read-pair, gathered in two files
pattern: "*.{fastq}"
- trimmed:
type: file
description: The quality controlled retrieved fragments from each input file.
pattern: "*.{fasta}"
- spades:
type: directory
description: The output from the SPAdes assembly
pattern: "spades_assembly"
- metagenome:
type: file
description: The FASTQ to FASTA converted input files from metagenomic reads.
pattern: "*.{fasta}"
- tmp:
type: file
description: The from FASTQ to FASTA converted input files and their translated input sequences. Are only saved if option --store-peptides is used.
pattern: "*.{fasta}"
authors:
- "@louperelo"

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

40
modules/fastqscan/main.nf Normal file
View file

@ -0,0 +1,40 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process FASTQSCAN {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::fastq-scan=0.4.4" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/fastq-scan:0.4.4--h7d875b9_0"
} else {
container "quay.io/biocontainers/fastq-scan:0.4.4--h7d875b9_0"
}
input:
tuple val(meta), path(reads)
output:
tuple val(meta), path("*.json"), emit: json
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
zcat $reads | \\
fastq-scan \\
$options.args > ${prefix}.json
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( echo \$(fastq-scan -v 2>&1) | sed 's/^.*fastq-scan //' )
END_VERSIONS
"""
}

View file

@ -0,0 +1,43 @@
name: fastqscan
description: FASTQ summary statistics in JSON format
keywords:
- fastq
- summary
- statistics
tools:
- fastqscan:
description: FASTQ summary statistics in JSON format
homepage: https://github.com/rpetit3/fastq-scan
documentation: https://github.com/rpetit3/fastq-scan
tool_dev_url: https://github.com/rpetit3/fastq-scan
doi: ""
licence: ['MIT']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
type: file
description: FASTQ file
pattern: "*.{fastq.gz,fq.gz}"
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"
- json:
type: file
description: JSON formatted file of summary statistics
pattern: "*.json"
authors:
- "@rpetit3"

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,50 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process FGBIO_GROUPREADSBYUMI {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::fgbio=1.4.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/fgbio:1.4.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/fgbio:1.4.0--hdfd78af_0"
}
input:
tuple val(meta), path(taggedbam)
val(strategy)
output:
tuple val(meta), path("*_umi-grouped.bam") , emit: bam
tuple val(meta), path("*_umi_histogram.txt"), emit: histogram
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
mkdir tmp
fgbio \\
--tmp-dir=${PWD}/tmp \\
GroupReadsByUmi \\
-s $strategy \\
${options.args} \\
-i $taggedbam \\
-o ${prefix}_umi-grouped.bam \\
-f ${prefix}_umi_histogram.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( echo \$(fgbio --version 2>&1 | tr -d '[:cntrl:]' ) | sed -e 's/^.*Version: //;s/\\[.*\$//')
END_VERSIONS
"""
}

View file

@ -0,0 +1,59 @@
name: fgbio_groupreadsbyumi
description: |
Groups reads together that appear to have come from the same original molecule.
Reads are grouped by template, and then templates are sorted by the 5 mapping positions
of the reads from the template, used from earliest mapping position to latest.
Reads that have the same end positions are then sub-grouped by UMI sequence.
(!) Note: the MQ tag is required on reads with mapped mates (!)
This can be added using samblaster with the optional argument --addMateTags.
keywords:
- UMI
- groupreads
- fgbio
tools:
- fgbio:
description: A set of tools for working with genomic and high throughput sequencing data, including UMIs
homepage: http://fulcrumgenomics.github.io/fgbio/
documentation: http://fulcrumgenomics.github.io/fgbio/tools/latest/
tool_dev_url: https://github.com/fulcrumgenomics/fgbio
doi: ""
licence: ['MIT']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: |
BAM file. Note: the MQ tag is required on reads with mapped mates (!)
pattern: "*.bam"
- strategy:
type: value
description: |
Reguired argument: defines the UMI assignment strategy.
Must be chosen among: Identity, Edit, Adjacency, Paired.
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"
- bam:
type: file
description: UMI-grouped BAM
pattern: "*.bam"
- histogram:
type: file
description: A text file containing the tag family size counts
pattern: "*.txt"
authors:
- "@lescai"

View file

@ -19,24 +19,26 @@ process FREEBAYES {
}
input:
tuple val(meta), path(bam), path(bai)
tuple path(fasta), path(fai)
path(targets)
path(samples)
path(populations)
path(cnv)
tuple val(meta), path(input_1), path(input_1_index), path(input_2), path(input_2_index)
path fasta
path fai
path targets
path samples
path populations
path cnv
output:
tuple val(meta), path("*.vcf.gz") , emit: vcf
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def targets_file = targets ? "--target ${targets}" : ""
def samples_file = samples ? "--samples ${samples}" : ""
def populations_file = populations ? "--populations ${populations}" : ""
def cnv_file = cnv ? "--cnv-map ${cnv}" : ""
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def input = input_2 ? "${input_1} ${input_2}" : "${input_1}"
def targets_file = targets ? "--target ${targets}" : ""
def samples_file = samples ? "--samples ${samples}" : ""
def populations_file = populations ? "--populations ${populations}" : ""
def cnv_file = cnv ? "--cnv-map ${cnv}" : ""
if (task.cpus > 1) {
"""
freebayes-parallel \\
@ -47,7 +49,7 @@ process FREEBAYES {
$populations_file \\
$cnv_file \\
$options.args \\
$bam > ${prefix}.vcf
$input > ${prefix}.vcf
gzip --no-name ${prefix}.vcf
@ -66,7 +68,7 @@ process FREEBAYES {
$populations_file \\
$cnv_file \\
$options.args \\
$bam > ${prefix}.vcf
$input > ${prefix}.vcf
gzip --no-name ${prefix}.vcf

View file

@ -4,15 +4,18 @@ keywords:
- variant caller
- SNP
- genotyping
- variant calling
- somatic variant calling
- germline variant calling
- bacterial variant calling
- bayesian
tools:
- freebayes:
description: Bayesian haplotype-based polymorphism discovery and genotyping
homepage: https://github.com/freebayes/freebayes
documentation: https://github.com/freebayes/freebayes
tool_dev_url: https://github.com/freebayes/freebayes
doi: ""
doi: "arXiv:1207.3907"
licence: ['MIT']
input:
@ -21,11 +24,11 @@ input:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
- input:
type: file
description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
- bai:
- input_index:
type: file
description: BAM/CRAM/SAM index file
pattern: "*.bam.bai"
@ -59,7 +62,6 @@ input:
seq_name start end sample_name copy_number
pattern: "*.bed"
output:
- meta:
type: map
@ -74,5 +76,8 @@ output:
type: file
description: Compressed VCF file
pattern: "*.vcf.gz"
authors:
- "@maxibor"
- "@FriederikeHanssen"
- "@maxulysse"

View file

@ -11,17 +11,17 @@ process GATK4_APPLYBQSR {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:
tuple val(meta), path(bam), path(bai), path(bqsr_table)
tuple val(meta), path(input), path(input_index), path(bqsr_table)
path fasta
path fastaidx
path fai
path dict
path intervals
@ -32,12 +32,18 @@ process GATK4_APPLYBQSR {
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def interval = intervals ? "-L ${intervals}" : ""
if (!task.memory) {
log.info '[GATK ApplyBQSR] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
gatk ApplyBQSR \\
-R $fasta \\
-I $bam \\
-I $input \\
--bqsr-recal-file $bqsr_table \\
$interval \\
--tmp-dir . \\
-O ${prefix}.bam \\
$options.args

View file

@ -20,22 +20,29 @@ input:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
- input:
type: file
description: BAM file from alignment
pattern: "*.{bam}"
description: BAM/CRAM file from alignment
pattern: "*.{bam,cram}"
- input_index:
type: file
description: BAI/CRAI file from alignment
pattern: "*.{bai,crai}"
- bqsr_table:
type: file
description: Recalibration table from gatk4_baserecalibrator
- fasta:
type: file
description: The reference fasta file
- fastaidx:
pattern: "*.fasta"
- fai:
type: file
description: Index of reference fasta file
pattern: "*.fasta.fai"
- dict:
type: file
description: GATK sequence dictionary
pattern: "*.dict"
- intervalsBed:
type: file
description: Bed file with the genomic regions included in the library (optional)
@ -57,3 +64,4 @@ output:
authors:
- "@yocra3"
- "@FriederikeHanssen"

View file

@ -11,17 +11,17 @@ process GATK4_BASERECALIBRATOR {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:
tuple val(meta), path(bam), path(bai)
tuple val(meta), path(input), path(input_index)
path fasta
path fastaidx
path fai
path dict
path intervalsBed
path knownSites
@ -35,12 +35,19 @@ process GATK4_BASERECALIBRATOR {
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def intervalsCommand = intervalsBed ? "-L ${intervalsBed}" : ""
def sitesCommand = knownSites.collect{"--known-sites ${it}"}.join(' ')
if (!task.memory) {
log.info '[GATK BaseRecalibrator] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
gatk BaseRecalibrator \
-R $fasta \
-I $bam \
-I $input \
$sitesCommand \
$intervalsCommand \
--tmp-dir . \
$options.args \
-O ${prefix}.table

View file

@ -20,19 +20,26 @@ input:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
- input:
type: file
description: BAM file from alignment
pattern: "*.{bam}"
description: BAM/CRAM file from alignment
pattern: "*.{bam,cram}"
- input_index:
type: file
description: BAI/CRAI file from alignment
pattern: "*.{bai,crai}"
- fasta:
type: file
description: The reference fasta file
- fastaidx:
pattern: "*.fasta"
- fai:
type: file
description: Index of reference fasta file
pattern: "*.fasta.fai"
- dict:
type: file
description: GATK sequence dictionary
pattern: "*.dict"
- intervalsBed:
type: file
description: Bed file with the genomic regions included in the library (optional)
@ -57,3 +64,4 @@ output:
authors:
- "@yocra3"
- "@FriederikeHanssen"

View file

@ -11,11 +11,11 @@ process GATK4_BEDTOINTERVALLIST {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:

View file

@ -11,11 +11,11 @@ process GATK4_CALCULATECONTAMINATION {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:

View file

@ -11,11 +11,11 @@ process GATK4_CREATESEQUENCEDICTIONARY {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:

View file

@ -11,17 +11,17 @@ process GATK4_CREATESOMATICPANELOFNORMALS {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:
tuple val(meta), path(genomicsdb)
path fasta
path fastaidx
path fai
path dict
output:

View file

@ -28,10 +28,10 @@ input:
type: file
description: The reference fasta file
pattern: "*.fasta"
- fastaidx:
- fai:
type: file
description: Index of reference fasta file
pattern: "fasta.fai"
pattern: "*.fasta.fai"
- dict:
type: file
description: GATK sequence dictionary

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,54 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process GATK4_ESTIMATELIBRARYCOMPLEXITY {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:
tuple val(meta), path(cram)
path(fasta)
path(fai)
path(dict)
output:
tuple val(meta), path('*.metrics'), emit: metrics
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def crams = cram.collect(){ x -> "-I ".concat(x.toString()) }.join(" ")
def avail_mem = 3
if (!task.memory) {
log.info '[GATK EstimateLibraryComplexity] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
gatk EstimateLibraryComplexity \
${crams} \
-O ${prefix}.metrics \
--REFERENCE_SEQUENCE ${fasta} \
--VALIDATION_STRINGENCY SILENT \
--TMP_DIR . $options.args
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -0,0 +1,56 @@
name: gatk4_estimatelibrarycomplexity
description: Estimates the numbers of unique molecules in a sequencing library.
keywords:
- gatk4
- gatk4_estimatelibrarycomplexity
- duplication_metrics
- reporting
tools:
- gatk4:
description: Genome Analysis Toolkit (GATK4)
homepage: https://gatk.broadinstitute.org/hc/en-us
documentation: https://gatk.broadinstitute.org/hc/en-us
tool_dev_url: https://github.com/broadinstitute/gatk
doi: "10.1158/1538-7445.AM2017-3590"
licence: ['Apache-2.0']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- cram:
type: file
description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
- fasta:
type: file
description: The reference fasta file
pattern: "*.fasta"
- fai:
type: file
description: Index of reference fasta file
pattern: "fasta.fai"
- dict:
type: file
description: GATK sequence dictionary
pattern: "*.dict"
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"
- metrics:
type: file
description: File containing metrics on the input files
pattern: "*.{metrics}"
authors:
- "@FriederikeHanssen"

View file

@ -11,11 +11,11 @@ process GATK4_FASTQTOSAM {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:

View file

@ -11,17 +11,17 @@ process GATK4_FILTERMUTECTCALLS {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:
tuple val(meta), path(vcf), path(tbi), path(stats), path(orientationbias), path(segmentation), path(contaminationfile), val(contaminationest)
path fasta
path fastaidx
path fai
path dict
output:

View file

@ -53,10 +53,10 @@ input:
type: file
description: The reference fasta file
pattern: "*.fasta"
- fastaidx:
- fai:
type: file
description: Index of reference fasta file
pattern: "fasta.fai"
pattern: "*.fasta.fai"
- dict:
type: file
description: GATK sequence dictionary

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,67 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process GATK4_GENOMICSDBIMPORT {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:
tuple val(meta), path(vcf), path(tbi), path(intervalfile), val(intervalval), path(wspace)
val run_intlist
val run_updatewspace
val input_map
output:
tuple val(meta), path("${prefix}") , optional:true, emit: genomicsdb
tuple val(meta), path("$updated_db") , optional:true, emit: updatedb
tuple val(meta), path("*.interval_list"), optional:true, emit: intervallist
path "versions.yml" , emit: versions
script:
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
// settings for running default create gendb mode
inputs_command = input_map ? "--sample-name-map ${vcf[0]}" : "${'-V ' + vcf.join(' -V ')}"
dir_command = "--genomicsdb-workspace-path ${prefix}"
intervals_command = intervalfile ? " -L ${intervalfile} " : " -L ${intervalval} "
// settings changed for running get intervals list mode if run_intlist is true
if (run_intlist) {
inputs_command = ''
dir_command = "--genomicsdb-update-workspace-path ${wspace}"
intervals_command = "--output-interval-list-to-file ${prefix}.interval_list"
}
// settings changed for running update gendb mode. inputs_command same as default, update_db forces module to emit the updated gendb
if (run_updatewspace) {
dir_command = "--genomicsdb-update-workspace-path ${wspace}"
intervals_command = ''
updated_db = wspace.toString()
}
"""
gatk GenomicsDBImport \\
$inputs_command \\
$dir_command \\
$intervals_command \\
$options.args
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -0,0 +1,84 @@
name: gatk4_genomicsdbimport
description: merge GVCFs from multiple samples. For use in joint genotyping or somatic panel of normal creation.
keywords:
- gatk4
- genomicsdbimport
- genomicsdb
- panelofnormalscreation
- jointgenotyping
tools:
- gatk4:
description: |
Developed in the Data Sciences Platform at the Broad Institute, the toolkit offers a wide variety of tools
with a primary focus on variant discovery and genotyping. Its powerful processing engine
and high-performance computing features make it capable of taking on projects of any size.
homepage: https://gatk.broadinstitute.org/hc/en-us
documentation: https://gatk.broadinstitute.org/hc/en-us/categories/360002369672s
doi: 10.1158/1538-7445.AM2017-3590
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test']
- vcf:
type: list
description: either a list of vcf files to be used to create or update a genomicsdb, or a file that contains a map to vcf files to be used.
pattern: "*.vcf.gz"
- tbi:
type: list
description: list of tbi files that match with the input vcf files
pattern: "*.vcf.gz_tbi"
- wspace:
type: path
description: path to an existing genomicsdb to be used in update db mode or get intervals mode. This WILL NOT specify name of a new genomicsdb in create db mode.
pattern: "/path/to/existing/gendb"
- intervalfile:
type: file
description: file containing the intervals to be used when creating the genomicsdb
pattern: "*.interval_list"
- intervalval:
type: string
description: if an intervals file has not been spcified, the value enetered here will be used as an interval via the "-L" argument
pattern: "example: chr1:1000-10000"
- run_intlist:
type: boolean
description: Specify whether to run get interval list mode, this option cannot be specified at the same time as run_updatewspace.
pattern: "true/false"
- run_updatewspace:
type: boolean
description: Specify whether to run update genomicsdb mode, this option takes priority over run_intlist.
pattern: "true/false"
- input_map:
type: boolean
description: Specify whether the vcf input is providing a list of vcf file(s) or a single file containing a map of paths to vcf files to be used to create or update a genomicsdb.
pattern: "*.sample_map"
output:
- genomicsdb:
type: directory
description: Directory containing the files that compose the genomicsdb workspace, this is only output for create mode, as update changes an existing db
pattern: "*/$prefix"
- updatedb:
type: directory
description: Directory containing the files that compose the updated genomicsdb workspace, this is only output for update mode, and should be the same path as the input wspace.
pattern: "same/path/as/wspace"
- intervallist:
type: file
description: File containing the intervals used to generate the genomicsdb, only created by get intervals mode.
pattern: "*.interval_list"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@GCJMackenzie"

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,54 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process GATK4_GENOTYPEGVCFS {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
}
input:
tuple val(meta), path(gvcf), path(gvcf_index)
path fasta
path fasta_index
path fasta_dict
path dbsnp
path dbsnp_index
path intervals_bed
output:
tuple val(meta), path("*.vcf.gz"), emit: vcf
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def dbsnp_options = dbsnp ? "-D ${dbsnp}" : ""
def interval_options = intervals_bed ? "-L ${intervals_bed}" : ""
def gvcf_options = gvcf.name.endsWith(".vcf") || gvcf.name.endsWith(".vcf.gz") ? "$gvcf" : "gendb://$gvcf"
"""
gatk \\
GenotypeGVCFs \\
$options.args \\
$interval_options \\
$dbsnp_options \\
-R $fasta \\
-V $gvcf_options \\
-O ${prefix}.vcf.gz
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -0,0 +1,69 @@
name: gatk4_genotypegvcfs
description: |
Perform joint genotyping on one or more samples pre-called with HaplotypeCaller.
keywords:
- joint genotyping
- genotype
- gvcf
tools:
- gatk4:
description: Genome Analysis Toolkit (GATK4)
homepage: https://gatk.broadinstitute.org/hc/en-us
documentation: https://gatk.broadinstitute.org/hc/en-us/categories/360002369672s
tool_dev_url: https://github.com/broadinstitute/gatk
doi: "10.1158/1538-7445.AM2017-3590"
licence: ['BSD-3-clause']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- gvcf:
type: tuple of files
description: |
Tuple of gVCF(.gz) file (first) and its index (second) or the path to a GenomicsDB (and empty)
pattern: ["*.{vcf,vcf.gz}", "*.{idx,tbi}"]
- fasta:
type: file
description: Reference fasta file
pattern: "*.fasta"
- fasta_index:
type: file
description: Reference fasta index file
pattern: "*.fai"
- fasta_dict:
type: file
description: Reference fasta sequence dict file
pattern: "*.dict"
- dbsnp:
type: file
description: dbSNP VCF file
pattern: "*.vcf.gz"
- dbsnp_index:
type: tuple of files
description: dbSNP VCF index file
pattern: "*.tbi"
- intervals_bed:
type: file
description: An intevals BED file
pattern: "*.bed"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- vcf:
type: file
description: Genotyped VCF file
pattern: "*.vcf.gz"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@santiagorevale"

View file

@ -11,17 +11,17 @@ process GATK4_GETPILEUPSUMMARIES {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:
tuple val(meta), path(bam), path(bai)
path variants
path variants_idx
path variants_tbi
path sites
output:

View file

@ -35,7 +35,7 @@ input:
type: file
description: Population vcf of germline sequencing, containing allele fractions. Is also used as sites file if no separate sites file is specified.
pattern: "*.vcf.gz"
- variants_idx:
- variants_tbi:
type: file
description: Index file for the germline resource.
pattern: "*.vcf.gz.tbi"

View file

@ -11,18 +11,21 @@ process GATK4_HAPLOTYPECALLER {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:
tuple val(meta), path(bam), path(bai)
tuple val(meta), path(input), path(input_index)
path fasta
path fai
path dict
path dbsnp
path dbsnp_tbi
path interval
output:
tuple val(meta), path("*.vcf.gz"), emit: vcf
@ -30,8 +33,10 @@ process GATK4_HAPLOTYPECALLER {
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def avail_mem = 3
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def interval_option = interval ? "-L ${interval}" : ""
def dbsnp_option = dbsnp ? "-D ${dbsnp}" : ""
def avail_mem = 3
if (!task.memory) {
log.info '[GATK HaplotypeCaller] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
@ -42,9 +47,12 @@ process GATK4_HAPLOTYPECALLER {
--java-options "-Xmx${avail_mem}g" \\
HaplotypeCaller \\
-R $fasta \\
-I $bam \\
-I $input \\
${dbsnp_option} \\
${interval_option} \\
-O ${prefix}.vcf.gz \\
$options.args
$options.args \\
--tmp-dir .
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:

View file

@ -21,14 +21,14 @@ input:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
- input:
type: file
description: BAM file
pattern: "*.bam"
- bai:
description: BAM/CRAM file from alignment
pattern: "*.{bam,cram}"
- input_index:
type: file
description: Index of BAM file
pattern: "*.bam.bai"
description: BAI/CRAI file from alignment
pattern: "*.{bai,crai}"
- fasta:
type: file
description: The reference fasta file
@ -41,6 +41,16 @@ input:
type: file
description: GATK sequence dictionary
pattern: "*.dict"
- dbsnp:
type: file
description: VCF file containing known sites (optional)
- dbsnp_tbi:
type: file
description: VCF index of dbsnp (optional)
- interval:
type: file
description: Bed file with the genomic regions included in the library (optional)
output:
- meta:
type: map
@ -62,3 +72,4 @@ output:
authors:
- "@suzannejin"
- "@FriederikeHanssen"

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,40 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process GATK4_INDEXFEATUREFILE {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
}
input:
tuple val(meta), path(feature_file)
output:
tuple val(meta), path("*.{tbi,idx}"), emit: index
path "versions.yml" , emit: versions
script:
"""
gatk \\
IndexFeatureFile \\
$options.args \\
-I $feature_file
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -0,0 +1,42 @@
name: gatk4_indexfeaturefile
description: Creates an index for a feature file, e.g. VCF or BED file.
keywords:
- index
- feature
tools:
- gatk4:
description: Genome Analysis Toolkit (GATK4)
homepage: https://gatk.broadinstitute.org/hc/en-us
documentation: https://gatk.broadinstitute.org/hc/en-us/categories/360002369672s
tool_dev_url: https://github.com/broadinstitute/gatk
doi: "10.1158/1538-7445.AM2017-3590"
licence: ['BSD-3-clause']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- feature_file:
type: file
description: VCF/BED file
pattern: "*.{vcf,vcf.gz,bed,bed.gz}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- index:
type: file
description: Index for VCF/BED file
pattern: "*.{tbi,idx}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@santiagorevale"

View file

@ -11,11 +11,11 @@ process GATK4_INTERVALLISTTOOLS {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--hdfd78af_1"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--hdfd78af_1"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:

View file

@ -11,11 +11,11 @@ process GATK4_LEARNREADORIENTATIONMODEL {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:

View file

@ -11,29 +11,36 @@ process GATK4_MARKDUPLICATES {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:
tuple val(meta), path(bam)
tuple val(meta), path(bams)
output:
tuple val(meta), path("*.bam") , emit: bam
tuple val(meta), path("*.bai") , emit: bai
tuple val(meta), path("*.metrics"), emit: metrics
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def bam_list = bams.collect(){ bam -> "--INPUT ".concat(bam.toString()) }.join(" ")
def avail_mem = 3
if (!task.memory) {
log.info '[GATK HaplotypeCaller] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
gatk MarkDuplicates \\
--INPUT $bam \\
$bam_list \\
--METRICS_FILE ${prefix}.metrics \\
--TMP_DIR . \\
--ASSUME_SORT_ORDER coordinate \\
--CREATE_INDEX true \\
--OUTPUT ${prefix}.bam \\
$options.args

View file

@ -47,3 +47,4 @@ output:
authors:
- "@ajodeh-juma"
- "@FriederikeHanssen"

View file

@ -11,11 +11,11 @@ process GATK4_MERGEBAMALIGNMENT {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:

View file

@ -11,11 +11,11 @@ process GATK4_MERGEVCFS {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:

View file

@ -11,24 +11,26 @@ process GATK4_MUTECT2 {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:
tuple val(meta) , path(bam) , path(bai) , val(which_norm)
val run_single
val run_pon
tuple val(meta) , path(input) , path(input_index) , val(which_norm)
val run_single
val run_pon
val run_mito
val interval_label
path fasta
path fastaidx
path fai
path dict
path germline_resource
path germline_resource_idx
path germline_resource_tbi
path panel_of_normals
path panel_of_normals_idx
path panel_of_normals_tbi
output:
tuple val(meta), path("*.vcf.gz") , emit: vcf
@ -39,35 +41,34 @@ process GATK4_MUTECT2 {
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def inputsList = []
def normalsList = []
def inputsCommand = ''
def panelsCommand = ''
def normalsCommand = ''
def panels_command = ''
def normals_command = ''
bam.each() {a -> inputsList.add(" -I " + a ) }
inputsCommand = inputsList.join( ' ')
def inputs_command = '-I ' + input.join( ' -I ')
if(run_pon) {
panelsCommand = ''
normalsCommand = ''
panels_command = ''
normals_command = ''
} else if(run_single) {
panelsCommand = " --germline-resource $germline_resource --panel-of-normals $panel_of_normals"
normalsCommand = ''
panels_command = " --germline-resource $germline_resource --panel-of-normals $panel_of_normals"
normals_command = ''
} else if(run_mito){
panels_command = "-L ${interval_label} --mitochondria-mode"
normals_command = ''
} else {
panelsCommand = " --germline-resource $germline_resource --panel-of-normals $panel_of_normals --f1r2-tar-gz ${prefix}.f1r2.tar.gz"
which_norm.each() {a -> normalsList.add(" -normal " + a ) }
normalsCommand = normalsList.join( ' ')
panels_command = " --germline-resource $germline_resource --panel-of-normals $panel_of_normals --f1r2-tar-gz ${prefix}.f1r2.tar.gz"
normals_command = '-normal ' + which_norm.join( ' -normal ')
}
"""
gatk Mutect2 \\
-R ${fasta} \\
${inputsCommand} \\
${normalsCommand} \\
${panelsCommand} \\
${inputs_command} \\
${normals_command} \\
${panels_command} \\
-O ${prefix}.vcf.gz \\
$options.args

View file

@ -22,31 +22,42 @@ input:
description: |
Groovy Map containing sample information
e.g. [ id:'test']
- bam:
- input:
type: list
description: list of BAM files
pattern: "*.bam"
- bai:
description: list of BAM files, also able to take CRAM as an input
pattern: "*.{bam/cram}"
- input_index:
type: list
description: list of BAM file indexes
pattern: "*.bam.bai"
description: list of BAM file indexes, also able to take CRAM indexes as an input
pattern: "*.{bam.bai/cram.crai}"
- which_norm:
type: list
description: optional list of sample headers contained in the normal sample bam files (these are required for tumor_normal_pair mode)
pattern: "testN"
- run_single:
type: boolean
description: Specify whether or not to run in tumor_single mode instead of tumor_normal_pair mode (will be ignored if run_pon is also true)
pattern: "true/false"
- run_pon:
type: boolean
description: Specify whether or not to run in panel_of_normal mode instead of tumor_normal_pair mode
pattern: "true/false"
- run_mito:
type: boolean
description: Specify whether or not to run in mitochondria-mode instead of tumor_normal_pair mode
pattern: "true/false"
- interval_label:
type: string
description: Specify the label used for mitochondrial chromosome when mutect2 is run in mitochondria mode.
pattern: "chrM"
- fasta:
type: file
description: The reference fasta file
pattern: "*.fasta"
- fastaidx:
- fai:
type: file
description: Index of reference fasta file
pattern: "fasta.fai"
pattern: "*.fasta.fai"
- dict:
type: file
description: GATK sequence dictionary
@ -55,18 +66,18 @@ input:
type: file
description: Population vcf of germline sequencing, containing allele fractions.
pattern: "*.vcf.gz"
- germline_resource_idx:
- germline_resource_tbi:
type: file
description: Index file for the germline resource.
pattern: "*.vcf.gz_tbi"
pattern: "*.vcf.gz.tbi"
- panel_of_normals:
type: file
description: vcf file to be used as a panel of normals.
pattern: "*.vcf.gz"
- panel_of_normals_idx:
- panel_of_normals_tbi:
type: file
description: Index for the panel of normals.
pattern: "*.vcf.gz_tbi"
pattern: "*.vcf.gz.tbi"
output:
- vcf:

View file

@ -11,11 +11,11 @@ process GATK4_REVERTSAM {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:

View file

@ -11,11 +11,11 @@ process GATK4_SAMTOFASTQ {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:

View file

@ -11,11 +11,11 @@ process GATK4_SPLITNCIGARREADS {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:

View file

@ -11,11 +11,11 @@ process GATK4_VARIANTFILTRATION {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gatk4=4.2.0.0" : null)
conda (params.enable_conda ? "bioconda::gatk4=4.2.3.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.3.0--hdfd78af_0"
} else {
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
container "quay.io/biocontainers/gatk4:4.2.3.0--hdfd78af_0"
}
input:

View file

@ -22,6 +22,10 @@ process GENRICH {
tuple val(meta), path(treatment_bam)
path control_bam
path blacklist_bed
val save_pvalues
val save_pileup
val save_bed
val save_duplicates
output:
tuple val(meta), path("*narrowPeak") , emit: peaks
@ -32,14 +36,14 @@ process GENRICH {
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def control = params.control_bam ? "-c $control_bam" : ''
def pvalues = params.pvalues ? "-f ${prefix}.pvalues.bedGraph" : ""
def pileup = params.pileup ? "-k ${prefix}.pileup.bedGraph" : ""
def bed = params.bed ? "-b ${prefix}.intervals.bed" : ""
def blacklist = params.blacklist_bed ? "-E $blacklist_bed" : ""
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def control = control_bam ? "-c $control_bam" : ''
def blacklist = blacklist_bed ? "-E $blacklist_bed" : ""
def pvalues = save_pvalues ? "-f ${prefix}.pvalues.bedGraph" : ""
def pileup = save_pileup ? "-k ${prefix}.pileup.bedGraph" : ""
def bed = save_bed ? "-b ${prefix}.intervals.bed" : ""
def duplicates = ""
if (params.save_duplicates) {
if (save_duplicates) {
if (options.args.contains('-r')) {
duplicates = "-R ${prefix}.duplicates.txt"
} else {
@ -58,7 +62,6 @@ process GENRICH {
$pileup \\
$bed \\
$duplicates \\
$blacklist \\
$control
cat <<-END_VERSIONS > versions.yml

View file

@ -15,7 +15,6 @@ tools:
tool_dev_url: https://github.com/jsh58/Genrich
doi: ""
licence: ['MIT']
input:
- meta:
type: map
@ -34,7 +33,18 @@ input:
type: file
description: Bed file containing genomic intervals to exclude from the analysis
pattern: "*.{bed}"
- save_pvalues:
type: boolean
description: Create bedgraph-ish file for p/q-values file
- save_pileup:
type: boolean
description: Create bedgraph-ish file for pileups and p-values
- save_bed:
type: boolean
description: Create BED file for reads/fragments/intervals
- save_duplicates:
type: boolean
description: Create PCR duplicates file (only works if -r option is set)
output:
- meta:
type: map
@ -65,7 +75,6 @@ output:
type: file
description: File containing software version
pattern: "*.{version.txt}"
authors:
- "@JoseEspinosa"

View file

@ -11,11 +11,12 @@ process GSTAMA_COLLAPSE {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gs-tama=1.0.2" : null)
conda (params.enable_conda ? "bioconda::gs-tama=1.0.3" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gs-tama:1.0.2--hdfd78af_0"
container "https://depot.galaxyproject.org/singularity/gs-tama:1.0.3--hdfd78af_0"
} else {
container "quay.io/biocontainers/gs-tama:1.0.2--hdfd78af_0"
container "quay.io/biocontainers/gs-tama:1.0.3--hdfd78af_0"
}
input:
@ -23,7 +24,7 @@ process GSTAMA_COLLAPSE {
path fasta
output:
tuple val(meta), path("*.bed") , emit: bed
tuple val(meta), path("*_collapsed.bed") , emit: bed
tuple val(meta), path("*_trans_read.bed") , emit: bed_trans_reads
tuple val(meta), path("*_local_density_error.txt"), emit: local_density_error
tuple val(meta), path("*_polya.txt") , emit: polya

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -0,0 +1,37 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process GUNC_DOWNLOADDB {
tag '$db_name'
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
conda (params.enable_conda ? "bioconda::gunc=1.0.5" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gunc:1.0.5--pyhdfd78af_0"
} else {
container "quay.io/biocontainers/gunc:1.0.5--pyhdfd78af_0"
}
input:
val db_name
output:
path "*.dmnd" , emit: db
path "versions.yml" , emit: versions
script:
"""
gunc download_db . -db $db_name $options.args
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( gunc --version )
END_VERSIONS
"""
}

View file

@ -0,0 +1,36 @@
name: gunc_downloaddb
description: Download database for GUNC detection of Chimerism and Contamination in Prokaryotic Genomes
keywords:
- download
- prokaryote
- assembly
- genome
- quality control
- chimeras
tools:
- gunc:
description: Python package for detection of chimerism and contamination in prokaryotic genomes.
homepage: https://grp-bork.embl-community.io/gunc/
documentation: https://grp-bork.embl-community.io/gunc/
tool_dev_url: https://github.com/grp-bork/gunc
doi: "10.1186/s13059-021-02393-0"
licence: ['GNU General Public v3 or later (GPL v3+)']
input:
- db_name:
type: string
description: "Which database to download. Options: progenomes or gtdb"
pattern: "progenomes|gtdb"
output:
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- db:
type: file
description: GUNC database file
pattern: "*.dmnd"
authors:
- "@jfy133"

View file

@ -0,0 +1,78 @@
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

45
modules/gunc/run/main.nf Normal file
View file

@ -0,0 +1,45 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process GUNC_RUN {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::gunc=1.0.5" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/gunc:1.0.5--pyhdfd78af_0"
} else {
container "quay.io/biocontainers/gunc:1.0.5--pyhdfd78af_0"
}
input:
tuple val(meta), path(fasta)
path(db)
output:
tuple val(meta), path("*maxCSS_level.tsv") , emit: maxcss_level_tsv
tuple val(meta), path("*all_levels.tsv") , optional: true, emit: all_levels_tsv
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
gunc \\
run \\
--input_fasta $fasta \\
--db_file $db \\
--threads $task.cpus \\
$options.args
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( gunc --version )
END_VERSIONS
"""
}

Some files were not shown because too many files have changed in this diff Show more