Merge pull request #67 from drpatelh/master

Add rnaseq DSL2 modules
This commit is contained in:
Harshil Patel 2020-09-10 16:49:26 +01:00 committed by GitHub
commit 436e37bcd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
91 changed files with 3146 additions and 733 deletions

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -53,14 +53,14 @@ process SOFTWARE_TOOL {
// e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc.
tuple val(meta), path(reads)
// TODO nf-core: List additional required input channels/values here
val options
val options
output:
// TODO nf-core: Named file extensions MUST be emitted for ALL output channels
// TODO nf-core: If meta is provided in "input:" section then it MUST be added to ALL output channels (except version)
tuple val(meta), path("*.bam"), emit: bam
// TODO nf-core: List additional required output channels/values here
path "*.version.txt", emit: version
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -15,10 +15,10 @@ process BWA_INDEX {
input:
path fasta
val options
val options
output:
path "${fasta}.*", emit: index
path "${fasta}.*" , emit: index
path "*.version.txt", emit: version
script:

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,42 +1,42 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process BWA_MEM {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:eabfac3657eda5818bae4090db989e3d41b01542-0"
//container "https://depot.galaxyproject.org/singularity/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:eabfac3657eda5818bae4090db989e3d41b01542-0"
conda (params.conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.10" : null)
input:
tuple val(meta), path(reads)
path index
path fasta
val options
output:
tuple val(meta), path("*.bam"), emit: bam
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def rg = meta.read_group ? "-R ${meta.read_group}" : ""
"""
bwa mem \\
$ioptions.args \\
$rg \\
-t $task.cpus \\
$fasta \\
$reads \\
| samtools view $ioptions.args2 -@ $task.cpus -bS -o ${prefix}.bam -
echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//' > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process BWA_MEM {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:eabfac3657eda5818bae4090db989e3d41b01542-0"
//container "https://depot.galaxyproject.org/singularity/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:eabfac3657eda5818bae4090db989e3d41b01542-0"
conda (params.conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.10" : null)
input:
tuple val(meta), path(reads)
path index
path fasta
val options
output:
tuple val(meta), path("*.bam"), emit: bam
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def read_group = meta.read_group ? "-R ${meta.read_group}" : ""
"""
bwa mem \\
$ioptions.args \\
$read_group \\
-t $task.cpus \\
$fasta \\
$reads \\
| samtools view $ioptions.args2 -@ $task.cpus -bS -o ${prefix}.bam -
echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//' > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,41 +1,41 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process DEEPTOOLS_COMPUTEMATRIX {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/deeptools:3.4.3--py_0"
//container "https://depot.galaxyproject.org/singularity/deeptools:3.4.3--py_0"
conda (params.conda ? "bioconda::deeptools=3.4.3" : null)
input:
tuple val(meta), path(bigwig)
path bed
val options
output:
tuple val(meta), path("*.mat.gz"), emit: matrix
tuple val(meta), path("*.mat.tab"), emit: table
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
computeMatrix \\
$ioptions.args \\
--regionsFileName $bed \\
--scoreFileName $bigwig \\
--outFileName ${prefix}.computeMatrix.mat.gz \\
--outFileNameMatrix ${prefix}.computeMatrix.vals.mat.tab \\
--numberOfProcessors $task.cpus
computeMatrix --version | sed -e "s/computeMatrix //g" > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process DEEPTOOLS_COMPUTEMATRIX {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/deeptools:3.4.3--py_0"
//container "https://depot.galaxyproject.org/singularity/deeptools:3.4.3--py_0"
conda (params.conda ? "bioconda::deeptools=3.4.3" : null)
input:
tuple val(meta), path(bigwig)
path bed
val options
output:
tuple val(meta), path("*.mat.gz") , emit: matrix
tuple val(meta), path("*.mat.tab"), emit: table
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
computeMatrix \\
$ioptions.args \\
--regionsFileName $bed \\
--scoreFileName $bigwig \\
--outFileName ${prefix}.computeMatrix.mat.gz \\
--outFileNameMatrix ${prefix}.computeMatrix.vals.mat.tab \\
--numberOfProcessors $task.cpus
computeMatrix --version | sed -e "s/computeMatrix //g" > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,43 +1,43 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process DEEPTOOLS_PLOTFINGERPRINT {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/deeptools:3.4.3--py_0"
//container "https://depot.galaxyproject.org/singularity/deeptools:3.4.3--py_0"
conda (params.conda ? "bioconda::deeptools=3.4.3" : null)
input:
tuple val(meta), path(bams), path(bais)
val options
output:
tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.raw.txt"), emit: matrix
tuple val(meta), path("*.qcmetrics.txt"), emit: metrics
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def extend = (meta.single_end && params.fragment_size > 0) ? "--extendReads ${params.fragment_size}" : ''
"""
plotFingerprint \\
$ioptions.args \\
$extend \\
--bamfiles ${bams.join(' ')} \\
--plotFile ${prefix}.plotFingerprint.pdf \\
--outRawCounts ${prefix}.plotFingerprint.raw.txt \\
--outQualityMetrics ${prefix}.plotFingerprint.qcmetrics.txt \\
--numberOfProcessors $task.cpus
plotFingerprint --version | sed -e "s/plotFingerprint //g" > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process DEEPTOOLS_PLOTFINGERPRINT {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/deeptools:3.4.3--py_0"
//container "https://depot.galaxyproject.org/singularity/deeptools:3.4.3--py_0"
conda (params.conda ? "bioconda::deeptools=3.4.3" : null)
input:
tuple val(meta), path(bams), path(bais)
val options
output:
tuple val(meta), path("*.pdf") , emit: pdf
tuple val(meta), path("*.raw.txt") , emit: matrix
tuple val(meta), path("*.qcmetrics.txt"), emit: metrics
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def extend = (meta.single_end && params.fragment_size > 0) ? "--extendReads ${params.fragment_size}" : ''
"""
plotFingerprint \\
$ioptions.args \\
$extend \\
--bamfiles ${bams.join(' ')} \\
--plotFile ${prefix}.plotFingerprint.pdf \\
--outRawCounts ${prefix}.plotFingerprint.raw.txt \\
--outQualityMetrics ${prefix}.plotFingerprint.qcmetrics.txt \\
--numberOfProcessors $task.cpus
plotFingerprint --version | sed -e "s/plotFingerprint //g" > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,38 +1,38 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process DEEPTOOLS_PLOTHEATMAP {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/deeptools:3.4.3--py_0"
//container "https://depot.galaxyproject.org/singularity/deeptools:3.4.3--py_0"
conda (params.conda ? "bioconda::deeptools=3.4.3" : null)
input:
tuple val(meta), path(matrix)
val options
output:
tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.tab"), emit: table
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
plotHeatmap \\
$ioptions.args \\
--matrixFile $matrix \\
--outFileName ${prefix}.plotHeatmap.pdf \\
--outFileNameMatrix ${prefix}.plotHeatmap.mat.tab
plotHeatmap --version | sed -e "s/plotHeatmap //g" > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process DEEPTOOLS_PLOTHEATMAP {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/deeptools:3.4.3--py_0"
//container "https://depot.galaxyproject.org/singularity/deeptools:3.4.3--py_0"
conda (params.conda ? "bioconda::deeptools=3.4.3" : null)
input:
tuple val(meta), path(matrix)
val options
output:
tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.tab"), emit: table
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
plotHeatmap \\
$ioptions.args \\
--matrixFile $matrix \\
--outFileName ${prefix}.plotHeatmap.pdf \\
--outFileNameMatrix ${prefix}.plotHeatmap.mat.tab
plotHeatmap --version | sed -e "s/plotHeatmap //g" > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,38 +1,38 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process DEEPTOOLS_PLOTPROFILE {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/deeptools:3.4.3--py_0"
//container "https://depot.galaxyproject.org/singularity/deeptools:3.4.3--py_0"
conda (params.conda ? "bioconda::deeptools=3.4.3" : null)
input:
tuple val(meta), path(matrix)
val options
output:
tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.tab"), emit: table
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
plotProfile \\
$ioptions.args \\
--matrixFile $matrix \\
--outFileName ${prefix}.plotProfile.pdf \\
--outFileNameData ${prefix}.plotProfile.tab
plotProfile --version | sed -e "s/plotProfile //g" > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process DEEPTOOLS_PLOTPROFILE {
tag "$meta.id"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/deeptools:3.4.3--py_0"
//container "https://depot.galaxyproject.org/singularity/deeptools:3.4.3--py_0"
conda (params.conda ? "bioconda::deeptools=3.4.3" : null)
input:
tuple val(meta), path(matrix)
val options
output:
tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.tab"), emit: table
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
plotProfile \\
$ioptions.args \\
--matrixFile $matrix \\
--outFileName ${prefix}.plotProfile.pdf \\
--outFileNameData ${prefix}.plotProfile.tab
plotProfile --version | sed -e "s/plotProfile //g" > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -15,12 +15,12 @@ process FASTQC {
input:
tuple val(meta), path(reads)
val options
val options
output:
tuple val(meta), path("*.html"), emit: html
tuple val(meta), path("*.zip"), emit: zip
path "*.version.txt", emit: version
tuple val(meta), path("*.zip") , emit: zip
path "*.version.txt" , emit: version
script:
// Add soft-links to original FastQs for consistent naming in pipeline

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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"
}
}
}

30
software/gffread/main.nf Normal file
View file

@ -0,0 +1,30 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process GFFREAD {
tag "$gff"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:'') }
container "quay.io/biocontainers/gffread:0.11.7--h8b12597_0"
//container https://depot.galaxyproject.org/singularity/gffread:0.11.7--h8b12597_0
conda (params.conda ? "bioconda::gffread=0.11.7" : null)
input:
path gff
val options
output:
path "*.gtf" , emit: gtf
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
"""
gffread $gff $ioptions.args -o ${gff.baseName}.gtf
echo \$(gffread --version 2>&1) > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,90 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
def VERSION = '2.2.0'
process HISAT2_ALIGN {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/mulled-v2-a97e90b3b802d1da3d6958e0867610c718cb5eb1:2880dd9d8ad0a7b221d4eacda9a818e92983128d-0"
//container "https://depot.galaxyproject.org/singularity/mulled-v2-a97e90b3b802d1da3d6958e0867610c718cb5eb1:2880dd9d8ad0a7b221d4eacda9a818e92983128d-0"
conda (params.conda ? "bioconda::hisat2=2.2.0 bioconda::samtools=1.10" : null)
input:
tuple val(meta), path(reads)
path index
path splicesites
val options
output:
tuple val(meta), path("*.bam"), emit: bam
tuple val(meta), path("*.log"), emit: summary
path "*.version.txt" , emit: version
tuple val(meta), path("*fastq.gz"), optional:true, emit: fastq
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def strandedness = ''
if (meta.strandedness == 'forward') {
strandedness = meta.single_end ? '--rna-strandness F' : '--rna-strandness FR'
} else if (meta.strandedness == 'reverse') {
strandedness = meta.single_end ? '--rna-strandness R' : '--rna-strandness RF'
}
def seq_center = params.seq_center ? "--rg-id ${prefix} --rg CN:${params.seq_center.replaceAll('\\s','_')} SM:$prefix" : "--rg-id ${prefix} --rg SM:$prefix"
if (meta.single_end) {
def unaligned = params.save_unaligned ? "--un-gz ${prefix}.unmapped.fastq.gz" : ''
"""
INDEX=`find -L ./ -name "*.1.ht2" | sed 's/.1.ht2//'`
hisat2 \\
-x \$INDEX \\
-U $reads \\
$strandedness \\
--known-splicesite-infile $splicesites \\
--summary-file ${prefix}.hisat2.summary.log \\
--threads $task.cpus \\
$seq_center \\
$unaligned \\
$ioptions.args \\
| samtools view -bS -F 4 -F 256 - > ${prefix}.bam
echo $VERSION > ${software}.version.txt
"""
} else {
def unaligned = params.save_unaligned ? "--un-conc-gz ${prefix}.unmapped.fastq.gz" : ''
"""
INDEX=`find -L ./ -name "*.1.ht2" | sed 's/.1.ht2//'`
hisat2 \\
-x \$INDEX \\
-1 ${reads[0]} \\
-2 ${reads[1]} \\
$strandedness \\
--known-splicesite-infile $splicesites \\
--summary-file ${prefix}.hisat2.summary.log \\
--threads $task.cpus \\
$seq_center \\
$unaligned \\
--no-mixed \\
--no-discordant \\
$ioptions.args \\
| samtools view -bS -F 4 -F 8 -F 256 - > ${prefix}.bam
if [ -f ${prefix}.unmapped.fastq.1.gz ]; then
mv ${prefix}.unmapped.fastq.1.gz ${prefix}.unmapped_1.fastq.gz
fi
if [ -f ${prefix}.unmapped.fastq.2.gz ]; then
mv ${prefix}.unmapped.fastq.2.gz ${prefix}.unmapped_2.fastq.gz
fi
echo $VERSION > ${software}.version.txt
"""
}
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,64 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
def VERSION = '2.2.0'
process HISAT2_BUILD {
tag "$fasta"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:'') }
container "quay.io/biocontainers/hisat2:2.2.0--py37hfa133b6_4"
//container "https://depot.galaxyproject.org/singularity/hisat2:2.2.0--py37hfa133b6_4"
conda (params.conda ? "bioconda::hisat2=2.2.0" : null)
input:
path fasta
path gtf
path splicesites
val options
output:
path "hisat2", emit: index
path "*.version.txt", emit: version
script:
def avail_mem = 0
if (!task.memory) {
log.info "[HISAT2 index build] Available memory not known - defaulting to 0. Specify process memory requirements to change this."
} else {
log.info "[HISAT2 index build] Available memory: ${task.memory}"
avail_mem = task.memory.toGiga()
}
def extract_exons = ''
def ss = ''
def exon = ''
if (avail_mem > params.hisat_build_memory) {
log.info "[HISAT2 index build] Over ${params.hisat_build_memory} GB available, so using splice sites and exons in HISAT2 index"
extract_exons = "hisat2_extract_exons.py $gtf > ${gtf.baseName}.exons.txt"
ss = "--ss $splicesites"
exon = "--exon ${gtf.baseName}.exons.txt"
} else {
log.info "[HISAT2 index build] Less than ${params.hisat_build_memory} GB available, so NOT using splice sites and exons in HISAT2 index."
log.info "[HISAT2 index build] Use --hisat_build_memory [small number] to skip this check."
}
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
"""
mkdir hisat2
$extract_exons
hisat2-build \\
-p $task.cpus \\
$ss \\
$exon \\
$ioptions.args \\
$fasta \\
hisat2/${fasta.baseName}
echo $VERSION > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,31 @@
// Import generic module functions
include { saveFiles; getSoftwareName } from './functions'
def VERSION = '2.2.0'
process HISAT2_EXTRACTSPLICESITES {
tag "$gtf"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:'') }
container "quay.io/biocontainers/hisat2:2.2.0--py37hfa133b6_4"
//container "https://depot.galaxyproject.org/singularity/hisat2:2.2.0--py37hfa133b6_4"
conda (params.conda ? "bioconda::hisat2=2.2.0" : null)
input:
path gtf
val options
output:
path "*.splice_sites.txt", emit: txt
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
"""
hisat2_extract_splice_sites.py $gtf > ${gtf.baseName}.splice_sites.txt
echo $VERSION > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,43 +1,43 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
def VERSION = '4.11'
process HOMER_ANNOTATEPEAKS {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/homer:4.11--pl526h9a982cc_2"
//container "https://depot.galaxyproject.org/singularity/homer:4.11--pl526h9a982cc_2"
conda (params.conda ? "bioconda::homer=4.11" : null)
input:
tuple val(meta), path(peak)
path fasta
path gtf
val options
output:
tuple val(meta), path("*annotatePeaks.txt"), emit: txt
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
annotatePeaks.pl \\
$peak \\
$fasta \\
$ioptions.args \\
-gtf $gtf \\
-cpu $task.cpus \\
> ${prefix}.annotatePeaks.txt
echo $VERSION > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
def VERSION = '4.11'
process HOMER_ANNOTATEPEAKS {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/homer:4.11--pl526h9a982cc_2"
//container "https://depot.galaxyproject.org/singularity/homer:4.11--pl526h9a982cc_2"
conda (params.conda ? "bioconda::homer=4.11" : null)
input:
tuple val(meta), path(peak)
path fasta
path gtf
val options
output:
tuple val(meta), path("*annotatePeaks.txt"), emit: txt
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
annotatePeaks.pl \\
$peak \\
$fasta \\
$ioptions.args \\
-gtf $gtf \\
-cpu $task.cpus \\
> ${prefix}.annotatePeaks.txt
echo $VERSION > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,47 +1,48 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process MACS2_CALLPEAK {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/macs2:2.2.7.1--py37h516909a_0"
//container "https://depot.galaxyproject.org/singularity/macs2:2.2.7.1--py37h516909a_0"
conda (params.conda ? "bioconda::macs2=2.2.7.1" : null)
input:
tuple val(meta), path(ipbam), path(controlbam)
val macs2_gsize
val options
output:
tuple val(meta), path("*.{narrowPeak,broadPeak}"), emit: peak
tuple val(meta), path("*.xls"), emit: xls
tuple val(meta), path("*.gappedPeak"), emit: gapped optional true
tuple val(meta), path("*.bed"), emit: bed optional true
tuple val(meta), path("*.bdg"), emit: bdg optional true
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def format = meta.single_end ? 'BAM' : 'BAMPE'
def control = controlbam ? "--control $controlbam" : ''
"""
macs2 \\
callpeak \\
$ioptions.args \\
--gsize $macs2_gsize \\
--format $format \\
--name $prefix \\
--treatment $ipbam \\
$control
macs2 --version | sed -e "s/macs2 //g" > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process MACS2_CALLPEAK {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/macs2:2.2.7.1--py37h516909a_0"
//container "https://depot.galaxyproject.org/singularity/macs2:2.2.7.1--py37h516909a_0"
conda (params.conda ? "bioconda::macs2=2.2.7.1" : null)
input:
tuple val(meta), path(ipbam), path(controlbam)
val macs2_gsize
val options
output:
tuple val(meta), path("*.{narrowPeak,broadPeak}"), emit: peak
tuple val(meta), path("*.xls") , emit: xls
path "*.version.txt" , emit: version
tuple val(meta), path("*.gappedPeak"), optional:true, emit: gapped
tuple val(meta), path("*.bed") , optional:true, emit: bed
tuple val(meta), path("*.bdg") , optional:true, emit: bdg
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def format = meta.single_end ? 'BAM' : 'BAMPE'
def control = controlbam ? "--control $controlbam" : ''
"""
macs2 \\
callpeak \\
$ioptions.args \\
--gsize $macs2_gsize \\
--format $format \\
--name $prefix \\
--treatment $ipbam \\
$control
macs2 --version | sed -e "s/macs2 //g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,37 +1,37 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
def VERSION = '1.2.2'
process PHANTOMPEAKQUALTOOLS {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/phantompeakqualtools:1.2.2--0"
//container "https://depot.galaxyproject.org/singularity/phantompeakqualtools:1.2.2--0"
conda (params.conda ? "bioconda::phantompeakqualtools=1.2.2" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*.out"), emit: spp
tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.Rdata"), emit: rdata
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
RUN_SPP=`which run_spp.R`
Rscript -e "library(caTools); source(\\"\$RUN_SPP\\")" -c="$bam" -savp="${prefix}.spp.pdf" -savd="${prefix}.spp.Rdata" -out="${prefix}.spp.out" -p=$task.cpus
echo $VERSION > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
def VERSION = '1.2.2'
process PHANTOMPEAKQUALTOOLS {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/phantompeakqualtools:1.2.2--0"
//container "https://depot.galaxyproject.org/singularity/phantompeakqualtools:1.2.2--0"
conda (params.conda ? "bioconda::phantompeakqualtools=1.2.2" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*.out") , emit: spp
tuple val(meta), path("*.pdf") , emit: pdf
tuple val(meta), path("*.Rdata"), emit: rdata
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
RUN_SPP=`which run_spp.R`
Rscript -e "library(caTools); source(\\"\$RUN_SPP\\")" -c="$bam" -savp="${prefix}.spp.pdf" -savd="${prefix}.spp.Rdata" -out="${prefix}.spp.out" -p=$task.cpus
echo $VERSION > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,47 +1,47 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process PICARD_COLLECTMULTIPLEMETRICS {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/picard:2.23.2--0"
//container "https://depot.galaxyproject.org/singularity/picard:2.23.2--0"
conda (params.conda ? "bioconda::picard=2.23.2" : null)
input:
tuple val(meta), path(bam)
path fasta
val options
output:
tuple val(meta), path("*_metrics"), emit: metrics
tuple val(meta), path("*.pdf"), emit: pdf
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def avail_mem = 3
if (!task.memory) {
log.info '[Picard CollectMultipleMetrics] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
picard \\
-Xmx${avail_mem}g \\
CollectMultipleMetrics \\
$ioptions.args \\
INPUT=$bam \\
OUTPUT=${prefix}.CollectMultipleMetrics \\
REFERENCE_SEQUENCE=$fasta
echo \$(picard CollectMultipleMetrics --version 2>&1) | awk -F' ' '{print \$NF}' > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process PICARD_COLLECTMULTIPLEMETRICS {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/picard:2.23.2--0"
//container "https://depot.galaxyproject.org/singularity/picard:2.23.2--0"
conda (params.conda ? "bioconda::picard=2.23.2" : null)
input:
tuple val(meta), path(bam)
path fasta
val options
output:
tuple val(meta), path("*_metrics"), emit: metrics
tuple val(meta), path("*.pdf") , emit: pdf
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def avail_mem = 3
if (!task.memory) {
log.info '[Picard CollectMultipleMetrics] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
picard \\
-Xmx${avail_mem}g \\
CollectMultipleMetrics \\
$ioptions.args \\
INPUT=$bam \\
OUTPUT=${prefix}.CollectMultipleMetrics \\
REFERENCE_SEQUENCE=$fasta
echo \$(picard CollectMultipleMetrics --version 2>&1) | awk -F' ' '{print \$NF}' > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,46 +1,46 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process PICARD_MARKDUPLICATES {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/picard:2.23.2--0"
//container "https://depot.galaxyproject.org/singularity/picard:2.23.2--0"
conda (params.conda ? "bioconda::picard=2.23.2" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*.bam"), emit: bam
tuple val(meta), path("*.metrics.txt"), emit: metrics
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def avail_mem = 3
if (!task.memory) {
log.info '[Picard MarkDuplicates] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
picard \\
-Xmx${avail_mem}g \\
MarkDuplicates \\
$ioptions.args \\
INPUT=$bam \\
OUTPUT=${prefix}.bam \\
METRICS_FILE=${prefix}.MarkDuplicates.metrics.txt
echo \$(picard MarkDuplicates --version 2>&1) | awk -F' ' '{print \$NF}' > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process PICARD_MARKDUPLICATES {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/picard:2.23.2--0"
//container "https://depot.galaxyproject.org/singularity/picard:2.23.2--0"
conda (params.conda ? "bioconda::picard=2.23.2" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*.bam") , emit: bam
tuple val(meta), path("*.metrics.txt"), emit: metrics
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def avail_mem = 3
if (!task.memory) {
log.info '[Picard MarkDuplicates] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
"""
picard \\
-Xmx${avail_mem}g \\
MarkDuplicates \\
$ioptions.args \\
INPUT=$bam \\
OUTPUT=${prefix}.bam \\
METRICS_FILE=${prefix}.MarkDuplicates.metrics.txt
echo \$(picard MarkDuplicates --version 2>&1) | awk -F' ' '{print \$NF}' > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,51 +1,51 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process PICARD_MERGESAMFILES {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/picard:2.23.2--0"
//container "https://depot.galaxyproject.org/singularity/picard:2.23.2--0"
conda (params.conda ? "bioconda::picard=2.23.2" : null)
input:
tuple val(meta), path(bams)
val options
output:
tuple val(meta), path("*.bam"), emit: bam
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def bam_files = bams.sort()
def avail_mem = 3
if (!task.memory) {
log.info '[Picard MergeSamFiles] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
if (bam_files.size() > 1) {
"""
picard \\
-Xmx${avail_mem}g \\
MergeSamFiles \\
$ioptions.args \\
${'INPUT='+bam_files.join(' INPUT=')} \\
OUTPUT=${prefix}.bam
echo \$(picard MergeSamFiles --version 2>&1) | awk -F' ' '{print \$NF}' > ${software}.version.txt
"""
} else {
"""
ln -s ${bam_files[0]} ${prefix}.bam
echo \$(picard MergeSamFiles --version 2>&1) | awk -F' ' '{print \$NF}' > ${software}.version.txt
"""
}
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process PICARD_MERGESAMFILES {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/picard:2.23.2--0"
//container "https://depot.galaxyproject.org/singularity/picard:2.23.2--0"
conda (params.conda ? "bioconda::picard=2.23.2" : null)
input:
tuple val(meta), path(bams)
val options
output:
tuple val(meta), path("*.bam"), emit: bam
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def bam_files = bams.sort()
def avail_mem = 3
if (!task.memory) {
log.info '[Picard MergeSamFiles] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
if (bam_files.size() > 1) {
"""
picard \\
-Xmx${avail_mem}g \\
MergeSamFiles \\
$ioptions.args \\
${'INPUT='+bam_files.join(' INPUT=')} \\
OUTPUT=${prefix}.bam
echo \$(picard MergeSamFiles --version 2>&1) | awk -F' ' '{print \$NF}' > ${software}.version.txt
"""
} else {
"""
ln -s ${bam_files[0]} ${prefix}.bam
echo \$(picard MergeSamFiles --version 2>&1) | awk -F' ' '{print \$NF}' > ${software}.version.txt
"""
}
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,42 +1,42 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process PRESEQ_LCEXTRAP {
tag "$meta.id"
label 'process_medium'
label 'error_ignore'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/preseq:2.0.3--hf53bd2b_3"
//container "https://depot.galaxyproject.org/singularity/preseq:2.0.3--hf53bd2b_3"
conda (params.conda ? "bioconda::preseq=2.0.3" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*.ccurve.txt"), emit: ccurve
tuple val(meta), path("*.log"), emit: log
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def pe = meta.single_end ? '' : '-pe'
"""
preseq \\
lc_extrap \\
$ioptions.args \\
$pe \\
-output ${prefix}.ccurve.txt \\
$bam
cp .command.err ${prefix}.command.log
echo \$(preseq 2>&1) | sed 's/^.*Version: //; s/Usage:.*\$//' > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process PRESEQ_LCEXTRAP {
tag "$meta.id"
label 'process_medium'
label 'error_ignore'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/preseq:2.0.3--hf53bd2b_3"
//container "https://depot.galaxyproject.org/singularity/preseq:2.0.3--hf53bd2b_3"
conda (params.conda ? "bioconda::preseq=2.0.3" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*.ccurve.txt"), emit: ccurve
tuple val(meta), path("*.log") , emit: log
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def paired_end = meta.single_end ? '' : '-pe'
"""
preseq \\
lc_extrap \\
$ioptions.args \\
$paired_end \\
-output ${prefix}.ccurve.txt \\
$bam
cp .command.err ${prefix}.command.log
echo \$(preseq 2>&1) | sed 's/^.*Version: //; s/Usage:.*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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 } from './functions'
process QUALIMAP_RNASEQ {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/qualimap:2.2.2d--1"
//container "https://depot.galaxyproject.org/singularity/qualimap:2.2.2d--1"
conda (params.conda ? "bioconda::qualimap=2.2.2d" : null)
input:
tuple val(meta), path(bam)
path gtf
val options
output:
tuple val(meta), path("${prefix}"), emit: results
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def paired_end = meta.single_end ? '' : '-pe'
def memory = task.memory.toGiga() + "G"
def strandedness = 'non-strand-specific'
if (meta.strandedness == 'forward') {
strandedness = 'strand-specific-forward'
} else if (meta.strandedness == 'reverse') {
strandedness = 'strand-specific-reverse'
}
"""
unset DISPLAY
mkdir tmp
export _JAVA_OPTIONS=-Djava.io.tmpdir=./tmp
qualimap \\
--java-mem-size=$memory \\
rnaseq \\
$ioptions.args \\
-bam $bam \\
-gtf $gtf \\
-p $strandedness \\
$paired_end \\
-outdir $prefix
echo \$(qualimap 2>&1) | sed 's/^.*QualiMap v.//; s/Built.*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,49 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process RSEM_CALCULATEEXPRESSION {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/rsem:1.3.3--pl526ha52163a_0"
//container "https://depot.galaxyproject.org/singularity/rsem:1.3.3--pl526ha52163a_0"
conda (params.conda ? "bioconda::rsem=1.3.3" : null)
input:
tuple val(meta), path(reads)
path index
val options
output:
tuple val(meta), path("*.genes.results") , emit: counts_gene
tuple val(meta), path("*.isoforms.results"), emit: counts_transcript
tuple val(meta), path("*.stat") , emit: stat
path "*.version.txt" , emit: version
tuple val(meta), path("*.STAR.genome.bam") , optional:true, emit: bam_star
tuple val(meta), path("${prefix}.genome.bam") , optional:true, emit: bam_genome
tuple val(meta), path("${prefix}.transcript.bam"), optional:true, emit: bam_transcript
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def paired_end = meta.single_end ? "" : "--paired-end"
"""
INDEX=`find -L ./ -name "*.grp" | sed 's/.grp//'`
rsem-calculate-expression \\
--num-threads $task.cpus \\
--temporary-folder ./tmp/ \\
$paired_end \\
$ioptions.args \\
$reads \\
\$INDEX \\
$prefix
rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,39 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process RSEM_PREPAREREFERENCE {
tag "$fasta"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:'') }
container "quay.io/biocontainers/rsem:1.3.3--pl526ha52163a_0"
//container "https://depot.galaxyproject.org/singularity/rsem:1.3.3--pl526ha52163a_0"
conda (params.conda ? "bioconda::rsem=1.3.3" : null)
input:
path fasta
path gtf
val options
output:
path "rsem" , emit: index
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
"""
mkdir rsem
rsem-prepare-reference \\
--gtf $gtf \\
--num-threads $task.cpus \\
$ioptions.args \\
$fasta \\
rsem/genome
rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,36 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process RSEQC_BAMSTAT {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1"
//container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1"
conda (params.conda ? "bioconda::rseqc=3.0.1" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*.bam_stat.txt"), emit: txt
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
bam_stat.py \\
-i $bam \\
$ioptions.args \\
> ${prefix}.bam_stat.txt
bam_stat.py --version | sed -e "s/bam_stat.py //g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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 } from './functions'
process RSEQC_INFEREXPERIMENT {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1"
//container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1"
conda (params.conda ? "bioconda::rseqc=3.0.1" : null)
input:
tuple val(meta), path(bam)
path bed
val options
output:
tuple val(meta), path("*.infer_experiment.txt"), emit: txt
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
infer_experiment.py \\
-i $bam \\
-r $bed \\
$ioptions.args \\
> ${prefix}.infer_experiment.txt
infer_experiment.py --version | sed -e "s/infer_experiment.py //g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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 } from './functions'
process RSEQC_INNERDISTANCE {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1"
//container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1"
conda (params.conda ? "bioconda::rseqc=3.0.1" : null)
input:
tuple val(meta), path(bam)
path bed
val options
output:
tuple val(meta), path("*distance.txt"), optional:true, emit: distance
tuple val(meta), path("*freq.txt") , optional:true, emit: freq
tuple val(meta), path("*mean.txt") , optional:true, emit: mean
tuple val(meta), path("*.pdf") , optional:true, emit: pdf
tuple val(meta), path("*.r") , optional:true, emit: rscript
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
if (!meta.single_end) {
"""
inner_distance.py \\
-i $bam \\
-r $bed \\
-o $prefix \\
$ioptions.args \\
> stdout.txt
head -n 2 stdout.txt > ${prefix}.inner_distance_mean.txt
inner_distance.py --version | sed -e "s/inner_distance.py //g" > ${software}.version.txt
"""
} else {
"""
inner_distance.py --version | sed -e "s/inner_distance.py //g" > ${software}.version.txt
"""
}
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,45 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process RSEQC_JUNCTIONANNOTATION {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1"
//container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1"
conda (params.conda ? "bioconda::rseqc=3.0.1" : null)
input:
tuple val(meta), path(bam)
path bed
val options
output:
tuple val(meta), path("*.junction.bed"), emit: bed
tuple val(meta), path("*.Interact.bed"), emit: interact_bed
tuple val(meta), path("*.xls") , emit: xls
tuple val(meta), path("*junction.pdf") , emit: pdf
tuple val(meta), path("*events.pdf") , emit: events_pdf
tuple val(meta), path("*.r") , emit: rscript
tuple val(meta), path("*.log") , emit: log
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
junction_annotation.py \\
-i $bam \\
-r $bed \\
-o $prefix \\
$ioptions.args \\
2> ${prefix}.junction_annotation.log
junction_annotation.py --version | sed -e "s/junction_annotation.py //g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,39 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process RSEQC_JUNCTIONSATURATION {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1"
//container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1"
conda (params.conda ? "bioconda::rseqc=3.0.1" : null)
input:
tuple val(meta), path(bam)
path bed
val options
output:
tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.r") , emit: rscript
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
junction_saturation.py \\
-i $bam \\
-r $bed \\
-o $prefix \\
$ioptions.args
junction_saturation.py --version | sed -e "s/junction_saturation.py //g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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 } from './functions'
process RSEQC_READDISTRIBUTION {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1"
//container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1"
conda (params.conda ? "bioconda::rseqc=3.0.1" : null)
input:
tuple val(meta), path(bam)
path bed
val options
output:
tuple val(meta), path("*.read_distribution.txt"), emit: txt
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
read_distribution.py \\
-i $bam \\
-r $bed \\
> ${prefix}.read_distribution.txt
read_distribution.py --version | sed -e "s/read_distribution.py //g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,39 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process RSEQC_READDUPLICATION {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1"
//container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1"
conda (params.conda ? "bioconda::rseqc=3.0.1" : null)
input:
tuple val(meta), path(bam)
val options
output:
tuple val(meta), path("*seq.DupRate.xls"), emit: seq_xls
tuple val(meta), path("*pos.DupRate.xls"), emit: pos_xls
tuple val(meta), path("*.pdf") , emit: pdf
tuple val(meta), path("*.r") , emit: rscript
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
read_duplication.py \\
-i $bam \\
-o $prefix \\
$ioptions.args
read_duplication.py --version | sed -e "s/read_duplication.py //g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,36 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process SALMON_INDEX {
tag "$fasta"
label "process_medium"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:'') }
container "quay.io/biocontainers/salmon:1.3.0--hf69c8f4_0"
//container "https://depot.galaxyproject.org/singularity/salmon:1.3.0--hf69c8f4_0"
conda (params.conda ? "bioconda::salmon=1.3.0" : null)
input:
path fasta
val options
output:
path "salmon" , emit: index
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
"""
salmon \\
index \\
--threads $task.cpus \\
-t $fasta \\
$ioptions.args \\
-i salmon
salmon --version | sed -e "s/salmon //g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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 } from './functions'
process SALMON_QUANT {
tag "$meta.id"
label "process_medium"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/salmon:1.3.0--hf69c8f4_0"
//container "https://depot.galaxyproject.org/singularity/salmon:1.3.0--hf69c8f4_0"
conda (params.conda ? "bioconda::salmon=1.3.0" : null)
input:
tuple val(meta), path(reads)
path index
path gtf
val options
output:
tuple val(meta), path("${prefix}"), emit: results
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def endedness = meta.single_end ? "-r $reads" : "-1 ${reads[0]} -2 ${reads[1]}"
def strandedness = meta.single_end ? 'U' : 'IU'
if (meta.strandedness == 'forward') {
strandedness = meta.single_end ? 'SF' : 'ISF'
} else if (meta.strandedness == 'reverse') {
strandedness = meta.single_end ? 'SR' : 'ISR'
}
"""
salmon quant \\
--geneMap $gtf \\
--threads $task.cpus \\
--libType=$strandedness \\
--index $index \\
$endedness \\
$ioptions.args \\
-o $prefix
salmon --version | sed -e "s/salmon //g" > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -14,11 +14,11 @@ process SAMTOOLS_FLAGSTAT {
input:
tuple val(meta), path(bam), path(bai)
val options
val options
output:
tuple val(meta), path("*.flagstat"), emit: flagstat
path "*.version.txt", emit: version
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -14,11 +14,11 @@ process SAMTOOLS_IDXSTATS {
input:
tuple val(meta), path(bam), path(bai)
val options
val options
output:
tuple val(meta), path("*.idxstats"), emit: idxstats
path "*.version.txt", emit: version
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -14,11 +14,11 @@ process SAMTOOLS_INDEX {
input:
tuple val(meta), path(bam)
val options
val options
output:
tuple val(meta), path("*.bai"), emit: bai
path "*.version.txt", emit: version
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -15,11 +15,11 @@ process SAMTOOLS_SORT {
input:
tuple val(meta), path(bam)
val options
val options
output:
tuple val(meta), path("*.bam"), emit: bam
path "*.version.txt", emit: version
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -14,11 +14,11 @@ process SAMTOOLS_STATS {
input:
tuple val(meta), path(bam), path(bai)
val options
val options
output:
tuple val(meta), path("*.stats"), emit: stats
path "*.version.txt", emit: version
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,70 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process SORTMERNA {
tag "$meta.id"
label "process_high"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/sortmerna:4.2.0--0"
//container "https://depot.galaxyproject.org/singularity/sortmerna:4.2.0--0"
conda (params.conda ? "bioconda::sortmerna=4.2.0" : null)
input:
tuple val(meta), path(reads)
path fasta
val options
output:
tuple val(meta), path("*.fastq.gz"), emit: reads
tuple val(meta), path("*.log") , emit: log
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def Refs = ""
for (i=0; i<fasta.size(); i++) { Refs+= " --ref ${fasta[i]}" }
if (meta.single_end) {
"""
sortmerna \\
$Refs \\
--reads $reads \\
--threads $task.cpus \\
--workdir . \\
--aligned rRNA_reads \\
--other non_rRNA_reads \\
$ioptions.args
gzip -f < non_rRNA_reads.fq > ${prefix}.fastq.gz
mv rRNA_reads.log ${prefix}.sortmerna.log
echo \$(sortmerna --version 2>&1) | sed 's/^.*SortMeRNA version //; s/ Build Date.*\$//' > ${software}.version.txt
"""
} else {
"""
sortmerna \\
$Refs \\
--reads ${reads[0]} \\
--reads ${reads[1]} \\
--threads $task.cpus \\
--workdir . \\
--aligned rRNA_reads \\
--other non_rRNA_reads \\
--paired_in \\
--out2 \\
$ioptions.args
gzip -f < non_rRNA_reads_fwd.fq > ${prefix}_1.fastq.gz
gzip -f < non_rRNA_reads_rev.fq > ${prefix}_2.fastq.gz
mv rRNA_reads.log ${prefix}.sortmerna.log
echo \$(sortmerna --version 2>&1) | sed 's/^.*SortMeRNA version //; s/ Build Date.*\$//' > ${software}.version.txt
"""
}
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,62 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process STAR_ALIGN {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
// Don't upgrade me - 2.7X indices incompatible with iGenomes.
container "quay.io/biocontainers/star:2.6.1d--0"
//container "https://depot.galaxyproject.org/singularity/star:2.6.1d--0"
conda (params.conda ? "bioconda::star=2.6.1d" : null)
input:
tuple val(meta), path(reads)
path index
path gtf
val options
output:
tuple val(meta), path("*Aligned.out.bam") , emit: bam
tuple val(meta), path("*Log.final.out") , emit: log_final
tuple val(meta), path("*Log.out") , emit: log_out
tuple val(meta), path("*Log.progress.out"), emit: log_progress
path "*.version.txt" , emit: version
tuple val(meta), path("*sortedByCoord.out.bam") , optional:true, emit: bam_sorted
tuple val(meta), path("*toTranscriptome.out.bam"), optional:true, emit: bam_transcript
tuple val(meta), path("*fastq.gz") , optional:true, emit: fastq
tuple val(meta), path("*.tab") , optional:true, emit: tab
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def ignore_gtf = params.star_ignore_sjdbgtf ? '' : "--sjdbGTFfile $gtf"
def seq_center = params.seq_center ? "--outSAMattrRGline ID:$prefix 'CN:$params.seq_center' 'SM:$prefix'" : "--outSAMattrRGline ID:$prefix 'SM:$prefix'"
"""
STAR \\
--genomeDir $index \\
--readFilesIn $reads \\
--runThreadN $task.cpus \\
--outFileNamePrefix $prefix. \\
$ignore_gtf \\
$seq_center \\
$ioptions.args
if [ -f ${prefix}.Unmapped.out.mate1 ]; then
mv ${prefix}.Unmapped.out.mate1 ${prefix}.unmapped_1.fastq
gzip ${prefix}.unmapped_1.fastq
fi
if [ -f ${prefix}.Unmapped.out.mate2 ]; then
mv ${prefix}.Unmapped.out.mate2 ${prefix}.unmapped_2.fastq
gzip ${prefix}.unmapped_2.fastq
fi
STAR --version | sed -e "s/STAR_//g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,43 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process STAR_GENOMEGENERATE {
tag "$fasta"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:'') }
// Don't upgrade me - 2.7X indices incompatible with iGenomes.
container "quay.io/biocontainers/star:2.6.1d--0"
//container "https://depot.galaxyproject.org/singularity/star:2.6.1d--0"
conda (params.conda ? "bioconda::star=2.6.1d" : null)
input:
path fasta
path gtf
val options
output:
path "star" , emit: index
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def memory = task.memory ? "--limitGenomeGenerateRAM ${task.memory.toBytes() - 100000000}" : ''
"""
mkdir star
STAR \\
--runMode genomeGenerate \\
--genomeDir star/ \\
--genomeFastaFiles $fasta \\
--sjdbGTFfile $gtf \\
--runThreadN $task.cpus \\
$memory \\
$ioptions.args
STAR --version | sed -e "s/STAR_//g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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,52 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process STRINGTIE {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/stringtie:2.1.2--h7e0af3c_1"
//container "https://depot.galaxyproject.org/singularity/stringtie:2.1.2--h7e0af3c_1"
conda (params.conda ? "bioconda::stringtie=2.1.2" : null)
input:
tuple val(meta), path(bam)
path gtf
val options
output:
tuple val(meta), path("*.coverage.gtf") , emit: coverage_gtf
tuple val(meta), path("*.transcripts.gtf"), emit: transcript_gtf
tuple val(meta), path("*.txt") , emit: abundance
tuple val(meta), path("*.ballgown") , emit: ballgown
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def strandedness = ''
if (meta.strandedness == 'forward') {
strandedness = '--fr'
} else if (meta.strandedness == 'reverse') {
strandedness = '--rf'
}
"""
stringtie \\
$bam \\
$strandedness \\
-G $gtf \\
-o ${prefix}.transcripts.gtf \\
-A ${prefix}.gene_abundance.txt \\
-C ${prefix}.coverage.gtf \\
-b ${prefix}.ballgown \\
$ioptions.args
stringtie --version > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,41 +1,49 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process SUBREAD_FEATURECOUNTS {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/subread:2.0.1--hed695b0_0"
//container "https://depot.galaxyproject.org/singularity/subread:2.0.1--hed695b0_0"
conda (params.conda ? "bioconda::subread=2.0.1" : null)
input:
tuple val(meta), path(bams), path(annotation)
val options
output:
tuple val(meta), path("*featureCounts.txt"), emit: txt
tuple val(meta), path("*featureCounts.txt.summary"), emit: summary
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def pe = meta.single_end ? '' : '-p'
"""
featureCounts \\
$ioptions.args \\
$pe \\
-T $task.cpus \\
-a $annotation \\
-o ${prefix}.featureCounts.txt \\
${bams.join(' ')}
echo \$(featureCounts -v 2>&1) | sed -e "s/featureCounts v//g" > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process SUBREAD_FEATURECOUNTS {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/subread:2.0.1--hed695b0_0"
//container "https://depot.galaxyproject.org/singularity/subread:2.0.1--hed695b0_0"
conda (params.conda ? "bioconda::subread=2.0.1" : null)
input:
tuple val(meta), path(bams), path(annotation)
val options
output:
tuple val(meta), path("*featureCounts.txt") , emit: counts
tuple val(meta), path("*featureCounts.txt.summary"), emit: summary
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
def paired_end = meta.single_end ? '' : '-p'
def strandedness = 0
if (meta.strandedness == 'forward') {
strandedness = 1
} else if (meta.strandedness == 'reverse') {
strandedness = 2
}
"""
featureCounts \\
$ioptions.args \\
$paired_end \\
-T $task.cpus \\
-a $annotation \\
-s $strandedness \\
-o ${prefix}.featureCounts.txt \\
${bams.join(' ')}
echo \$(featureCounts -v 2>&1) | sed -e "s/featureCounts v//g" > ${software}.version.txt
"""
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,79 +1,80 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process TRIMGALORE {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/trim-galore:0.6.5--0"
//container "https://depot.galaxyproject.org/singularity/trim-galore:0.6.5--0"
conda (params.conda ? "bioconda::trim-galore=0.6.5" : null)
input:
tuple val(meta), path(reads)
val options
output:
tuple val(meta), path("*.fq.gz"), emit: reads
tuple val(meta), path("*.html"), emit: html optional true
tuple val(meta), path("*.zip"), emit: zip optional true
tuple val(meta), path("*report.txt"), emit: log
path "*.version.txt", emit: version
script:
// Calculate number of --cores for TrimGalore based on value of task.cpus
// See: https://github.com/FelixKrueger/TrimGalore/blob/master/Changelog.md#version-060-release-on-1-mar-2019
// See: https://github.com/nf-core/atacseq/pull/65
def cores = 1
if (task.cpus) {
cores = (task.cpus as int) - 4
if (meta.single_end) cores = (task.cpus as int) - 3
if (cores < 1) cores = 1
if (cores > 4) cores = 4
}
// Clipping presets have to be evaluated in the context of SE/PE
def c_r1 = params.clip_r1 > 0 ? "--clip_r1 ${params.clip_r1}" : ''
def c_r2 = params.clip_r2 > 0 ? "--clip_r2 ${params.clip_r2}" : ''
def tpc_r1 = params.three_prime_clip_r1 > 0 ? "--three_prime_clip_r1 ${params.three_prime_clip_r1}" : ''
def tpc_r2 = params.three_prime_clip_r2 > 0 ? "--three_prime_clip_r2 ${params.three_prime_clip_r2}" : ''
// Added soft-links to original fastqs for consistent naming in MultiQC
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
if (meta.single_end) {
"""
[ ! -f ${prefix}.fastq.gz ] && ln -s $reads ${prefix}.fastq.gz
trim_galore \\
$ioptions.args \\
--cores $cores \\
--gzip \\
$c_r1 \\
$tpc_r1 \\
${prefix}.fastq.gz
echo \$(trim_galore --version 2>&1) | sed 's/^.*version //; s/Last.*\$//' > ${software}.version.txt
"""
} else {
"""
[ ! -f ${prefix}_1.fastq.gz ] && ln -s ${reads[0]} ${prefix}_1.fastq.gz
[ ! -f ${prefix}_2.fastq.gz ] && ln -s ${reads[1]} ${prefix}_2.fastq.gz
trim_galore \\
$ioptions.args \\
--cores $cores \\
--paired \\
--gzip \\
$c_r1 \\
$c_r2 \\
$tpc_r1 \\
$tpc_r2 \\
${prefix}_1.fastq.gz \\
${prefix}_2.fastq.gz
echo \$(trim_galore --version 2>&1) | sed 's/^.*version //; s/Last.*\$//' > ${software}.version.txt
"""
}
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
process TRIMGALORE {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/trim-galore:0.6.5--0"
//container "https://depot.galaxyproject.org/singularity/trim-galore:0.6.5--0"
conda (params.conda ? "bioconda::trim-galore=0.6.5" : null)
input:
tuple val(meta), path(reads)
val options
output:
tuple val(meta), path("*.fq.gz") , emit: reads
tuple val(meta), path("*report.txt"), emit: log
path "*.version.txt" , emit: version
tuple val(meta), path("*.html"), emit: html optional true
tuple val(meta), path("*.zip") , emit: zip optional true
script:
// Calculate number of --cores for TrimGalore based on value of task.cpus
// See: https://github.com/FelixKrueger/TrimGalore/blob/master/Changelog.md#version-060-release-on-1-mar-2019
// See: https://github.com/nf-core/atacseq/pull/65
def cores = 1
if (task.cpus) {
cores = (task.cpus as int) - 4
if (meta.single_end) cores = (task.cpus as int) - 3
if (cores < 1) cores = 1
if (cores > 4) cores = 4
}
// Clipping presets have to be evaluated in the context of SE/PE
def c_r1 = params.clip_r1 > 0 ? "--clip_r1 ${params.clip_r1}" : ''
def c_r2 = params.clip_r2 > 0 ? "--clip_r2 ${params.clip_r2}" : ''
def tpc_r1 = params.three_prime_clip_r1 > 0 ? "--three_prime_clip_r1 ${params.three_prime_clip_r1}" : ''
def tpc_r2 = params.three_prime_clip_r2 > 0 ? "--three_prime_clip_r2 ${params.three_prime_clip_r2}" : ''
// Added soft-links to original fastqs for consistent naming in MultiQC
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
if (meta.single_end) {
"""
[ ! -f ${prefix}.fastq.gz ] && ln -s $reads ${prefix}.fastq.gz
trim_galore \\
$ioptions.args \\
--cores $cores \\
--gzip \\
$c_r1 \\
$tpc_r1 \\
${prefix}.fastq.gz
echo \$(trim_galore --version 2>&1) | sed 's/^.*version //; s/Last.*\$//' > ${software}.version.txt
"""
} else {
"""
[ ! -f ${prefix}_1.fastq.gz ] && ln -s ${reads[0]} ${prefix}_1.fastq.gz
[ ! -f ${prefix}_2.fastq.gz ] && ln -s ${reads[1]} ${prefix}_2.fastq.gz
trim_galore \\
$ioptions.args \\
--cores $cores \\
--paired \\
--gzip \\
$c_r1 \\
$c_r2 \\
$tpc_r1 \\
$tpc_r2 \\
${prefix}_1.fastq.gz \\
${prefix}_2.fastq.gz
echo \$(trim_galore --version 2>&1) | sed 's/^.*version //; s/Last.*\$//' > ${software}.version.txt
"""
}
}

View file

@ -20,7 +20,7 @@ def initOptions(Map args) {
options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
@ -52,7 +52,7 @@ def saveFiles(Map args) {
return "${getPathFromList(ext_list)}/$args.filename"
}
}
} else {
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}

View file

@ -1,35 +1,35 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
def VERSION = '377'
process UCSC_BEDRAPHTOBIGWIG {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/ucsc-bedgraphtobigwig:377--h446ed27_1"
//container "https://depot.galaxyproject.org/singularity/ucsc-bedgraphtobigwig:377--h446ed27_1"
conda (params.conda ? "bioconda::ucsc-bedgraphtobigwig=377" : null)
input:
tuple val(meta), path(bedgraph)
path sizes
val options
output:
tuple val(meta), path("*.bigWig"), emit: bigwig
path "*.version.txt", emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
bedGraphToBigWig $bedgraph $sizes ${prefix}.bigWig
echo $VERSION > ${software}.version.txt
"""
}
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
def VERSION = '377'
process UCSC_BEDRAPHTOBIGWIG {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/ucsc-bedgraphtobigwig:377--h446ed27_1"
//container "https://depot.galaxyproject.org/singularity/ucsc-bedgraphtobigwig:377--h446ed27_1"
conda (params.conda ? "bioconda::ucsc-bedgraphtobigwig=377" : null)
input:
tuple val(meta), path(bedgraph)
path sizes
val options
output:
tuple val(meta), path("*.bigWig"), emit: bigwig
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
bedGraphToBigWig $bedgraph $sizes ${prefix}.bigWig
echo $VERSION > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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 } from './functions'
process UMITOOLS_DEDUP {
tag "$meta.id"
label "process_medium"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/umi_tools:1.0.1--py37h516909a_1"
//container "https://depot.galaxyproject.org/singularity/umi_tools:1.0.1--py37h516909a_1"
conda (params.conda ? "bioconda::umi_tools=1.0.1" : null)
input:
tuple val(meta), path(bam), path(bai)
val options
output:
tuple val(meta), path("*.bam"), emit: bam
tuple val(meta), path("*.tsv"), emit: tsv
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
"""
umi_tools dedup \\
-I $bam \\
-S ${prefix}.bam \\
--output-stats=$prefix \\
$ioptions.args \\
umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt
"""
}

View file

@ -0,0 +1,59 @@
/*
* -----------------------------------------------------
* 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()
}
/*
* 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.publish_by_id = args.publish_by_id ?: false
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) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) {
path_list.add(args.publish_id)
}
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 } from './functions'
process UMITOOLS_EXTRACT {
tag "$meta.id"
label "process_low"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
container "quay.io/biocontainers/umi_tools:1.0.1--py37h516909a_1"
//container "https://depot.galaxyproject.org/singularity/umi_tools:1.0.1--py37h516909a_1"
conda (params.conda ? "bioconda::umi_tools=1.0.1" : null)
input:
tuple val(meta), path(reads)
val options
output:
tuple val(meta), path("*.fastq.gz"), emit: reads
tuple val(meta), path("*.log") , emit: log
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def ioptions = initOptions(options)
def prefix = ioptions.suffix ? "${meta.id}${ioptions.suffix}" : "${meta.id}"
if (meta.single_end) {
"""
umi_tools \\
extract \\
-I $reads \\
-S ${prefix}.umi_extract.fastq.gz \\
$ioptions.args \\
> ${prefix}.umi_extract.log
umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt
"""
} else {
"""
umi_tools \\
extract \\
-I ${reads[0]} \\
--read2-in=${reads[1]} \\
-S ${prefix}.umi_extract_1.fastq.gz \\
--read2-out=${prefix}.umi_extract_2.fastq.gz \\
$ioptions.args \\
> ${prefix}.umi_extract.log
umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt
"""
}
}