Merge remote-tracking branch 'nf-core/master'

This commit is contained in:
Chris Cheshire 2021-01-05 09:10:11 +00:00
commit 7e9cbfc8d1
99 changed files with 4307 additions and 3795 deletions

42
.github/workflows/bowtie_align.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: bowtie_align
on:
push:
paths:
- software/bowtie/align/**
- software/bowtie/index/**
- .github/workflows/bowtie_align.yml
- tests/software/bowtie/**
pull_request:
paths:
- software/bowtie/align/**
- software/bowtie/index/**
- .github/workflows/bowtie_align.yml
- tests/software/bowtie/**
jobs:
ci_test:
runs-on: ubuntu-latest
strategy:
matrix:
nxf_version: [20.11.0-edge]
env:
NXF_ANSI_LOG: false
steps:
- uses: actions/checkout@v2
- name: Install Nextflow
env:
NXF_VER: ${{ matrix.nxf_version }}
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: python -m pip install --upgrade pip pytest-workflow
# Test the module
- run: pytest --tag bowtie_align --symlink --wt 2

40
.github/workflows/bowtie_index.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: bowtie_index
on:
push:
paths:
- software/bowtie/index/**
- .github/workflows/bowtie_index.yml
- tests/software/bowtie/**
pull_request:
paths:
- software/bowtie/index/**
- .github/workflows/bowtie_index.yml
- tests/software/bowtie/**
jobs:
ci_test:
runs-on: ubuntu-latest
strategy:
matrix:
nxf_version: [20.11.0-edge]
env:
NXF_ANSI_LOG: false
steps:
- uses: actions/checkout@v2
- name: Install Nextflow
env:
NXF_VER: ${{ matrix.nxf_version }}
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: python -m pip install --upgrade pip pytest-workflow
# Test the module
- run: pytest --tag bowtie_index --symlink --wt 2

View file

@ -17,20 +17,20 @@ jobs:
- name: Run Markdownlint - name: Run Markdownlint
run: markdownlint ${GITHUB_WORKSPACE} -c ${GITHUB_WORKSPACE}/.markdownlint.yml run: markdownlint ${GITHUB_WORKSPACE} -c ${GITHUB_WORKSPACE}/.markdownlint.yml
# EditorConfig: EditorConfig:
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# steps: steps:
# - uses: actions/checkout@v2 - uses: actions/checkout@v2
# - uses: actions/setup-node@v1 - uses: actions/setup-node@v1
# with: with:
# node-version: "10" node-version: "10"
# - name: Install ECLint - name: Install editorconfig-checker
# run: npm install -g eclint run: npm install -g editorconfig-checker
# - name: Run ECLint check - name: Run ECLint check
# run: eclint check $(git ls-files | grep -v test) run: editorconfig-checker -exclude README.md $(git ls-files | grep -v test)
YAML: YAML:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -34,4 +34,3 @@ process INTERSECT_BED {
bedtools --version | sed -n "s/.*\\(v.*\$\\)/\\1/p" > bedtools.version.txt bedtools --version | sed -n "s/.*\\(v.*\$\\)/\\1/p" > bedtools.version.txt
""" """
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -50,7 +50,7 @@ process SOFTWARE_TOOL {
} else { } else {
container "quay.io/biocontainers/samtools:1.10--h9402c20_2" container "quay.io/biocontainers/samtools:1.10--h9402c20_2"
} }
input: input:
// TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group" // TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group"
// MUST be provided as an input via a Groovy Map called "meta". // MUST be provided as an input via a Groovy Map called "meta".
@ -59,7 +59,7 @@ process SOFTWARE_TOOL {
// TODO nf-core: Where applicable please provide/convert compressed files as input/output // TODO nf-core: Where applicable please provide/convert compressed files as input/output
// e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc. // e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc.
tuple val(meta), path(reads) tuple val(meta), path(reads)
output: output:
// TODO nf-core: Named file extensions MUST be emitted for ALL output channels // 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) // TODO nf-core: If meta is provided in "input:" section then it MUST be added to ALL output channels (except version)

View file

@ -0,0 +1,60 @@
/*
* -----------------------------------------------------
* 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,59 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
def options = initOptions(params.options)
process BOWTIE_ALIGN {
tag "$meta.id"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? 'bioconda::bowtie=1.3.0 bioconda::samtools=1.10' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container 'https://depot.galaxyproject.org/singularity/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:9e14e16c284d6860574cf5b624bbc44c793cb024-0'
} else {
container 'quay.io/biocontainers/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:9e14e16c284d6860574cf5b624bbc44c793cb024-0'
}
input:
tuple val(meta), path(reads)
path index
output:
tuple val(meta), path('*.bam'), emit: bam
tuple val(meta), path('*.out'), emit: log
path '*.version.txt' , emit: version
tuple val(meta), path('*fastq.gz'), optional:true, emit: fastq
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def unaligned = params.save_unaligned ? "--un ${prefix}.unmapped.fastq" : ''
def endedness = meta.single_end ? "$reads" : "-1 ${reads[0]} -2 ${reads[1]}"
"""
INDEX=`find -L ./ -name "*.3.ebwt" | sed 's/.3.ebwt//'`
bowtie \\
--threads $task.cpus \\
--sam \\
-x \$INDEX \\
-q \\
$unaligned \\
$options.args \\
$endedness \\
2> ${prefix}.out \\
| samtools view $options.args2 -@ $task.cpus -bS -o ${prefix}.bam -
if [ -f ${prefix}.unmapped.fastq ]; then
gzip ${prefix}.unmapped.fastq
fi
if [ -f ${prefix}.unmapped_1.fastq ]; then
gzip ${prefix}.unmapped_1.fastq
gzip ${prefix}.unmapped_2.fastq
fi
echo \$(bowtie --version 2>&1) | sed 's/^.*bowtie-align-s version //; s/ .*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1,69 @@
name: bowtie_align
description: Align reads to a reference genome using bowtie
keywords:
- align
- fasta
- genome
- reference
tools:
- bowtie:
description: |
bowtie is a software package for mapping DNA sequences against
a large reference genome, such as the human genome.
homepage: http://bowtie-bio.sourceforge.net/index.shtml
documentation: http://bowtie-bio.sourceforge.net/manual.shtml
arxiv: arXiv:1303.3997
params:
- outdir:
type: string
description: |
The pipeline's output directory. By default, the module will
output files into `$params.outdir/<SOFTWARE>`
- publish_dir_mode:
type: string
description: |
Value for the Nextflow `publishDir` mode parameter.
Available: symlink, rellink, link, copy, copyNoFollow, move.
- enable_conda:
type: boolean
description: |
Run the module with Conda using the software specified
via the `conda` directive
- singularity_pull_docker_container:
type: boolean
description: |
Instead of directly downloading Singularity images for use with Singularity,
force the workflow to pull and convert Docker containers instead.
- save_unaligned:
type: boolean
description: Save unaligned reads
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
type: file
description: |
List of input FastQ files of size 1 and 2 for single-end and paired-end data,
respectively.
- index:
type: file
description: Bowtie genome index files
pattern: "*.ebwt"
output:
- bam:
type: file
description: Output BAM file containing read alignments
pattern: "*.{bam}"
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
- fastq:
type: file
description: Unaligned FastQ files
pattern: "*.fastq.gz"
authors:
- "@kevinmenden"

View file

@ -0,0 +1,60 @@
/*
* -----------------------------------------------------
* 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,35 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
def options = initOptions(params.options)
process BOWTIE_INDEX {
tag "$fasta"
label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') }
conda (params.enable_conda ? 'bioconda::bowtie=1.3.0' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container 'https://depot.galaxyproject.org/singularity/bowtie:1.3.0--py38hed8969a_1'
} else {
container 'quay.io/biocontainers/bowtie:1.3.0--py38hed8969a_1'
}
input:
path fasta
output:
path 'bowtie', emit: index
path '*.version.txt', emit: version
script:
def software = getSoftwareName(task.process)
"""
mkdir bowtie
bowtie-build --threads $task.cpus $fasta bowtie/${fasta.baseName}
echo \$(bowtie --version 2>&1) | sed 's/^.*bowtie-align-s version //; s/ .*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1,51 @@
name: bowtie_index
description: Create bowtie index for reference genome
keywords:
- index
- fasta
- genome
- reference
tools:
- bowtie:
description: |
bowtie is a software package for mapping DNA sequences against
a large reference genome, such as the human genome.
homepage: http://bowtie-bio.sourceforge.net/index.shtml
documentation: http://bowtie-bio.sourceforge.net/manual.shtml
arxiv: arXiv:1303.3997
params:
- outdir:
type: string
description: |
The pipeline's output directory. By default, the module will
output files into `$params.outdir/<SOFTWARE>`
- publish_dir_mode:
type: string
description: |
Value for the Nextflow `publishDir` mode parameter.
Available: symlink, rellink, link, copy, copyNoFollow, move.
- enable_conda:
type: boolean
description: |
Run the module with Conda using the software specified
via the `conda` directive
- singularity_pull_docker_container:
type: boolean
description: |
Instead of directly downloading Singularity images for use with Singularity,
force the workflow to pull and convert Docker containers instead.
input:
- fasta:
type: file
description: Input genome fasta file
output:
- index:
type: file
description: Bowtie genome index files
pattern: "*.ebwt"
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
authors:
- "@kevinmenden"

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -20,7 +20,7 @@ process BWA_INDEX {
input: input:
path fasta path fasta
output: output:
path "${fasta}.*" , emit: index path "${fasta}.*" , emit: index
path "*.version.txt", emit: version path "*.version.txt", emit: version

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -17,12 +17,12 @@ process BWA_MEM {
} else { } else {
container "quay.io/biocontainers/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:eabfac3657eda5818bae4090db989e3d41b01542-0" container "quay.io/biocontainers/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:eabfac3657eda5818bae4090db989e3d41b01542-0"
} }
input: input:
tuple val(meta), path(reads) tuple val(meta), path(reads)
path index path index
path fasta path fasta
output: output:
tuple val(meta), path("*.bam"), emit: bam tuple val(meta), path("*.bam"), emit: bam
path "*.version.txt" , emit: version path "*.version.txt" , emit: version

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -21,7 +21,7 @@ process DEEPTOOLS_COMPUTEMATRIX {
input: input:
tuple val(meta), path(bigwig) tuple val(meta), path(bigwig)
path bed path bed
output: output:
tuple val(meta), path("*.mat.gz") , emit: matrix tuple val(meta), path("*.mat.gz") , emit: matrix
tuple val(meta), path("*.mat.tab"), emit: table tuple val(meta), path("*.mat.tab"), emit: table

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -20,7 +20,7 @@ process DEEPTOOLS_PLOTFINGERPRINT {
input: input:
tuple val(meta), path(bams), path(bais) tuple val(meta), path(bams), path(bais)
output: output:
tuple val(meta), path("*.pdf") , emit: pdf tuple val(meta), path("*.pdf") , emit: pdf
tuple val(meta), path("*.raw.txt") , emit: matrix tuple val(meta), path("*.raw.txt") , emit: matrix

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -20,7 +20,7 @@ process DEEPTOOLS_PLOTHEATMAP {
input: input:
tuple val(meta), path(matrix) tuple val(meta), path(matrix)
output: output:
tuple val(meta), path("*.pdf"), emit: pdf tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.tab"), emit: table tuple val(meta), path("*.tab"), emit: table

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -20,7 +20,7 @@ process DEEPTOOLS_PLOTPROFILE {
input: input:
tuple val(meta), path(matrix) tuple val(meta), path(matrix)
output: output:
tuple val(meta), path("*.pdf"), emit: pdf tuple val(meta), path("*.pdf"), emit: pdf
tuple val(meta), path("*.tab"), emit: table tuple val(meta), path("*.tab"), emit: table

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -17,10 +17,10 @@ process FASTQC {
} else { } else {
container "quay.io/biocontainers/fastqc:0.11.9--0" container "quay.io/biocontainers/fastqc:0.11.9--0"
} }
input: input:
tuple val(meta), path(reads) tuple val(meta), path(reads)
output: output:
tuple val(meta), path("*.html"), emit: html tuple val(meta), path("*.html"), emit: html
tuple val(meta), path("*.zip") , emit: zip tuple val(meta), path("*.zip") , emit: zip

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

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

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -19,12 +19,12 @@ process HISAT2_ALIGN {
} else { } else {
container "quay.io/biocontainers/mulled-v2-a97e90b3b802d1da3d6958e0867610c718cb5eb1:2880dd9d8ad0a7b221d4eacda9a818e92983128d-0" container "quay.io/biocontainers/mulled-v2-a97e90b3b802d1da3d6958e0867610c718cb5eb1:2880dd9d8ad0a7b221d4eacda9a818e92983128d-0"
} }
input: input:
tuple val(meta), path(reads) tuple val(meta), path(reads)
path index path index
path splicesites path splicesites
output: output:
tuple val(meta), path("*.bam"), emit: bam tuple val(meta), path("*.bam"), emit: bam
tuple val(meta), path("*.log"), emit: summary tuple val(meta), path("*.log"), emit: summary

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

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

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -17,7 +17,7 @@ process HISAT2_EXTRACTSPLICESITES {
} else { } else {
container "quay.io/biocontainers/hisat2:2.2.0--py37hfa133b6_4" container "quay.io/biocontainers/hisat2:2.2.0--py37hfa133b6_4"
} }
input: input:
path gtf path gtf

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else { } else {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -21,7 +21,7 @@ process MACS2_CALLPEAK {
input: input:
tuple val(meta), path(ipbam), path(controlbam) tuple val(meta), path(ipbam), path(controlbam)
val macs2_gsize val macs2_gsize
output: output:
tuple val(meta), path("*.{narrowPeak,broadPeak}"), emit: peak tuple val(meta), path("*.{narrowPeak,broadPeak}"), emit: peak
tuple val(meta), path("*.xls") , emit: xls tuple val(meta), path("*.xls") , emit: xls
@ -44,7 +44,7 @@ process MACS2_CALLPEAK {
--format $format \\ --format $format \\
--name $prefix \\ --name $prefix \\
--treatment $ipbam \\ --treatment $ipbam \\
$control $control
macs2 --version | sed -e "s/macs2 //g" > ${software}.version.txt macs2 --version | sed -e "s/macs2 //g" > ${software}.version.txt
""" """

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -19,10 +19,10 @@ process PHANTOMPEAKQUALTOOLS {
} else { } else {
container "quay.io/biocontainers/phantompeakqualtools:1.2.2--0" container "quay.io/biocontainers/phantompeakqualtools:1.2.2--0"
} }
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
output: output:
tuple val(meta), path("*.out") , emit: spp tuple val(meta), path("*.out") , emit: spp
tuple val(meta), path("*.pdf") , emit: pdf tuple val(meta), path("*.pdf") , emit: pdf

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -10,7 +10,7 @@ process PICARD_MARKDUPLICATES {
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::picard=2.23.9" : null) conda (params.enable_conda ? "bioconda::picard=2.23.9" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/picard:2.23.9--0" container "https://depot.galaxyproject.org/singularity/picard:2.23.9--0"
@ -20,7 +20,7 @@ process PICARD_MARKDUPLICATES {
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
output: output:
tuple val(meta), path("*.bam") , emit: bam tuple val(meta), path("*.bam") , emit: bam
tuple val(meta), path("*.metrics.txt"), emit: metrics tuple val(meta), path("*.metrics.txt"), emit: metrics

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -20,7 +20,7 @@ process PICARD_MERGESAMFILES {
input: input:
tuple val(meta), path(bams) tuple val(meta), path(bams)
output: output:
tuple val(meta), path("*.bam"), emit: bam tuple val(meta), path("*.bam"), emit: bam
path "*.version.txt" , emit: version path "*.version.txt" , emit: version

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -18,10 +18,10 @@ process PRESEQ_LCEXTRAP {
} else { } else {
container "quay.io/biocontainers/preseq:2.0.3--hf53bd2b_3" container "quay.io/biocontainers/preseq:2.0.3--hf53bd2b_3"
} }
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
output: output:
tuple val(meta), path("*.ccurve.txt"), emit: ccurve tuple val(meta), path("*.ccurve.txt"), emit: ccurve
tuple val(meta), path("*.log") , emit: log tuple val(meta), path("*.log") , emit: log

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -21,7 +21,7 @@ process QUALIMAP_RNASEQ {
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
path gtf path gtf
output: output:
tuple val(meta), path("${prefix}"), emit: results tuple val(meta), path("${prefix}"), emit: results
path "*.version.txt" , emit: version path "*.version.txt" , emit: version

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

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

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,68 +1,68 @@
// Import generic module functions // Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions' include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
def options = initOptions(params.options) def options = initOptions(params.options)
process RSEM_PREPAREREFERENCE { process RSEM_PREPAREREFERENCE {
tag "$fasta" tag "$fasta"
label 'process_high' label 'process_high'
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') }
conda (params.enable_conda ? "bioconda::rsem=1.3.3 bioconda::star=2.7.6a" : null) conda (params.enable_conda ? "bioconda::rsem=1.3.3 bioconda::star=2.7.6a" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/mulled-v2-cf0123ef83b3c38c13e3b0696a3f285d3f20f15b:606b713ec440e799d53a2b51a6e79dbfd28ecf3e-0" container "https://depot.galaxyproject.org/singularity/mulled-v2-cf0123ef83b3c38c13e3b0696a3f285d3f20f15b:606b713ec440e799d53a2b51a6e79dbfd28ecf3e-0"
} else { } else {
container "quay.io/biocontainers/mulled-v2-cf0123ef83b3c38c13e3b0696a3f285d3f20f15b:606b713ec440e799d53a2b51a6e79dbfd28ecf3e-0" container "quay.io/biocontainers/mulled-v2-cf0123ef83b3c38c13e3b0696a3f285d3f20f15b:606b713ec440e799d53a2b51a6e79dbfd28ecf3e-0"
} }
input: input:
path fasta path fasta
path gtf path gtf
output: output:
path "rsem" , emit: index path "rsem" , emit: index
path "*.version.txt", emit: version path "*.version.txt", emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def args = options.args.tokenize() def args = options.args.tokenize()
if (args.contains('--star')) { if (args.contains('--star')) {
args.removeIf { it.contains('--star') } args.removeIf { it.contains('--star') }
def memory = task.memory ? "--limitGenomeGenerateRAM ${task.memory.toBytes() - 100000000}" : '' def memory = task.memory ? "--limitGenomeGenerateRAM ${task.memory.toBytes() - 100000000}" : ''
""" """
mkdir rsem mkdir rsem
STAR \\ STAR \\
--runMode genomeGenerate \\ --runMode genomeGenerate \\
--genomeDir rsem/ \\ --genomeDir rsem/ \\
--genomeFastaFiles $fasta \\ --genomeFastaFiles $fasta \\
--sjdbGTFfile $gtf \\ --sjdbGTFfile $gtf \\
--runThreadN $task.cpus \\ --runThreadN $task.cpus \\
$memory \\ $memory \\
$options.args2 $options.args2
rsem-prepare-reference \\ rsem-prepare-reference \\
--gtf $gtf \\ --gtf $gtf \\
--num-threads $task.cpus \\ --num-threads $task.cpus \\
${args.join(' ')} \\ ${args.join(' ')} \\
$fasta \\ $fasta \\
rsem/genome rsem/genome
rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g" > ${software}.version.txt rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g" > ${software}.version.txt
""" """
} else { } else {
""" """
mkdir rsem mkdir rsem
rsem-prepare-reference \\ rsem-prepare-reference \\
--gtf $gtf \\ --gtf $gtf \\
--num-threads $task.cpus \\ --num-threads $task.cpus \\
$options.args \\ $options.args \\
$fasta \\ $fasta \\
rsem/genome rsem/genome
rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g" > ${software}.version.txt rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g" > ${software}.version.txt
""" """
} }
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

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

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,41 +1,41 @@
// Import generic module functions // Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions' include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
def options = initOptions(params.options) def options = initOptions(params.options)
process RSEQC_INFEREXPERIMENT { process RSEQC_INFEREXPERIMENT {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1"
} else { } else {
container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1"
} }
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
path bed path bed
output: output:
tuple val(meta), path("*.infer_experiment.txt"), emit: txt tuple val(meta), path("*.infer_experiment.txt"), emit: txt
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
""" """
infer_experiment.py \\ infer_experiment.py \\
-i $bam \\ -i $bam \\
-r $bed \\ -r $bed \\
$options.args \\ $options.args \\
> ${prefix}.infer_experiment.txt > ${prefix}.infer_experiment.txt
infer_experiment.py --version | sed -e "s/infer_experiment.py //g" > ${software}.version.txt infer_experiment.py --version | sed -e "s/infer_experiment.py //g" > ${software}.version.txt
""" """
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

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

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

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

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

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

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,40 +1,40 @@
// Import generic module functions // Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions' include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
def options = initOptions(params.options) def options = initOptions(params.options)
process RSEQC_READDISTRIBUTION { process RSEQC_READDISTRIBUTION {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1"
} else { } else {
container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1"
} }
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
path bed path bed
output: output:
tuple val(meta), path("*.read_distribution.txt"), emit: txt tuple val(meta), path("*.read_distribution.txt"), emit: txt
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
""" """
read_distribution.py \\ read_distribution.py \\
-i $bam \\ -i $bam \\
-r $bed \\ -r $bed \\
> ${prefix}.read_distribution.txt > ${prefix}.read_distribution.txt
read_distribution.py --version | sed -e "s/read_distribution.py //g" > ${software}.version.txt read_distribution.py --version | sed -e "s/read_distribution.py //g" > ${software}.version.txt
""" """
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

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

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,51 +1,51 @@
// Import generic module functions // Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions' include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
def options = initOptions(params.options) def options = initOptions(params.options)
process SALMON_INDEX { process SALMON_INDEX {
tag "$transcript_fasta" tag "$transcript_fasta"
label "process_medium" label "process_medium"
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') }
conda (params.enable_conda ? "bioconda::salmon=1.4.0" : null) conda (params.enable_conda ? "bioconda::salmon=1.4.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/salmon:1.4.0--hf69c8f4_0" container "https://depot.galaxyproject.org/singularity/salmon:1.4.0--hf69c8f4_0"
} else { } else {
container "quay.io/biocontainers/salmon:1.4.0--hf69c8f4_0" container "quay.io/biocontainers/salmon:1.4.0--hf69c8f4_0"
} }
input: input:
path genome_fasta path genome_fasta
path transcript_fasta path transcript_fasta
output: output:
path "salmon" , emit: index path "salmon" , emit: index
path "*.version.txt", emit: version path "*.version.txt", emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def get_decoy_ids = "grep '^>' $genome_fasta | cut -d ' ' -f 1 > decoys.txt" def get_decoy_ids = "grep '^>' $genome_fasta | cut -d ' ' -f 1 > decoys.txt"
def gentrome = "gentrome.fa" def gentrome = "gentrome.fa"
if (genome_fasta.endsWith('.gz')) { if (genome_fasta.endsWith('.gz')) {
get_decoy_ids = "grep '^>' <(gunzip -c $genome_fasta) | cut -d ' ' -f 1 > decoys.txt" get_decoy_ids = "grep '^>' <(gunzip -c $genome_fasta) | cut -d ' ' -f 1 > decoys.txt"
gentrome = "gentrome.fa.gz" gentrome = "gentrome.fa.gz"
} }
""" """
$get_decoy_ids $get_decoy_ids
sed -i.bak -e 's/>//g' decoys.txt sed -i.bak -e 's/>//g' decoys.txt
cat $transcript_fasta $genome_fasta > $gentrome cat $transcript_fasta $genome_fasta > $gentrome
salmon \\ salmon \\
index \\ index \\
--threads $task.cpus \\ --threads $task.cpus \\
-t $gentrome \\ -t $gentrome \\
-d decoys.txt \\ -d decoys.txt \\
$options.args \\ $options.args \\
-i salmon -i salmon
salmon --version | sed -e "s/salmon //g" > ${software}.version.txt salmon --version | sed -e "s/salmon //g" > ${software}.version.txt
""" """
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -24,7 +24,7 @@ process SALMON_QUANT {
path gtf path gtf
path transcript_fasta path transcript_fasta
val alignment_mode val alignment_mode
output: output:
tuple val(meta), path("${prefix}"), emit: results tuple val(meta), path("${prefix}"), emit: results
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
@ -39,7 +39,7 @@ process SALMON_QUANT {
reference = "-t $transcript_fasta" reference = "-t $transcript_fasta"
input_reads = "-a $reads" input_reads = "-a $reads"
} }
def strandedness = meta.single_end ? 'U' : 'IU' def strandedness = meta.single_end ? 'U' : 'IU'
if (meta.strandedness == 'forward') { if (meta.strandedness == 'forward') {
strandedness = meta.single_end ? 'SF' : 'ISF' strandedness = meta.single_end ? 'SF' : 'ISF'

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,32 +1,32 @@
// Import generic module functions // Import generic module functions
include { saveFiles; getSoftwareName } from './functions' include { saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
process SAMTOOLS_FLAGSTAT { process SAMTOOLS_FLAGSTAT {
tag "$meta.id" tag "$meta.id"
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::samtools=1.10" : null) conda (params.enable_conda ? "bioconda::samtools=1.10" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2"
} else { } else {
container "quay.io/biocontainers/samtools:1.10--h9402c20_2" container "quay.io/biocontainers/samtools:1.10--h9402c20_2"
} }
input: input:
tuple val(meta), path(bam), path(bai) tuple val(meta), path(bam), path(bai)
output: output:
tuple val(meta), path("*.flagstat"), emit: flagstat tuple val(meta), path("*.flagstat"), emit: flagstat
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
""" """
samtools flagstat $bam > ${bam}.flagstat samtools flagstat $bam > ${bam}.flagstat
echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt
""" """
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,32 +1,32 @@
// Import generic module functions // Import generic module functions
include { saveFiles; getSoftwareName } from './functions' include { saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
process SAMTOOLS_IDXSTATS { process SAMTOOLS_IDXSTATS {
tag "$meta.id" tag "$meta.id"
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::samtools=1.10" : null) conda (params.enable_conda ? "bioconda::samtools=1.10" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2"
} else { } else {
container "quay.io/biocontainers/samtools:1.10--h9402c20_2" container "quay.io/biocontainers/samtools:1.10--h9402c20_2"
} }
input: input:
tuple val(meta), path(bam), path(bai) tuple val(meta), path(bam), path(bai)
output: output:
tuple val(meta), path("*.idxstats"), emit: idxstats tuple val(meta), path("*.idxstats"), emit: idxstats
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
""" """
samtools idxstats $bam > ${bam}.idxstats samtools idxstats $bam > ${bam}.idxstats
echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt
""" """
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,32 +1,32 @@
// Import generic module functions // Import generic module functions
include { saveFiles; getSoftwareName } from './functions' include { saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
process SAMTOOLS_INDEX { process SAMTOOLS_INDEX {
tag "$meta.id" tag "$meta.id"
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::samtools=1.10" : null) conda (params.enable_conda ? "bioconda::samtools=1.10" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2"
} else { } else {
container "quay.io/biocontainers/samtools:1.10--h9402c20_2" container "quay.io/biocontainers/samtools:1.10--h9402c20_2"
} }
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
output: output:
tuple val(meta), path("*.bai"), emit: bai tuple val(meta), path("*.bai"), emit: bai
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
""" """
samtools index $bam samtools index $bam
echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt
""" """
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,35 +1,35 @@
// Import generic module functions // Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions' include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
def options = initOptions(params.options) def options = initOptions(params.options)
process SAMTOOLS_SORT { process SAMTOOLS_SORT {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::samtools=1.10" : null) conda (params.enable_conda ? "bioconda::samtools=1.10" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2"
} else { } else {
container "quay.io/biocontainers/samtools:1.10--h9402c20_2" container "quay.io/biocontainers/samtools:1.10--h9402c20_2"
} }
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
output: output:
tuple val(meta), path("*.bam"), emit: bam tuple val(meta), path("*.bam"), emit: bam
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
""" """
samtools sort $options.args -@ $task.cpus -o ${prefix}.bam -T $prefix $bam samtools sort $options.args -@ $task.cpus -o ${prefix}.bam -T $prefix $bam
echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt
""" """
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,32 +1,32 @@
// Import generic module functions // Import generic module functions
include { saveFiles; getSoftwareName } from './functions' include { saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
process SAMTOOLS_STATS { process SAMTOOLS_STATS {
tag "$meta.id" tag "$meta.id"
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::samtools=1.10" : null) conda (params.enable_conda ? "bioconda::samtools=1.10" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2"
} else { } else {
container "quay.io/biocontainers/samtools:1.10--h9402c20_2" container "quay.io/biocontainers/samtools:1.10--h9402c20_2"
} }
input: input:
tuple val(meta), path(bam), path(bai) tuple val(meta), path(bam), path(bai)
output: output:
tuple val(meta), path("*.stats"), emit: stats tuple val(meta), path("*.stats"), emit: stats
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
""" """
samtools stats $bam > ${bam}.stats samtools stats $bam > ${bam}.stats
echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt
""" """
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

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

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

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

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,55 +1,55 @@
// Import generic module functions // Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions' include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
def options = initOptions(params.options) def options = initOptions(params.options)
process STRINGTIE { process STRINGTIE {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::stringtie=2.1.4" : null) conda (params.enable_conda ? "bioconda::stringtie=2.1.4" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/stringtie:2.1.4--h7e0af3c_0" container "https://depot.galaxyproject.org/singularity/stringtie:2.1.4--h7e0af3c_0"
} else { } else {
container "quay.io/biocontainers/stringtie:2.1.4--h7e0af3c_0" container "quay.io/biocontainers/stringtie:2.1.4--h7e0af3c_0"
} }
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
path gtf path gtf
output: output:
tuple val(meta), path("*.coverage.gtf") , emit: coverage_gtf tuple val(meta), path("*.coverage.gtf") , emit: coverage_gtf
tuple val(meta), path("*.transcripts.gtf"), emit: transcript_gtf tuple val(meta), path("*.transcripts.gtf"), emit: transcript_gtf
tuple val(meta), path("*.txt") , emit: abundance tuple val(meta), path("*.txt") , emit: abundance
tuple val(meta), path("*.ballgown") , emit: ballgown tuple val(meta), path("*.ballgown") , emit: ballgown
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def strandedness = '' def strandedness = ''
if (meta.strandedness == 'forward') { if (meta.strandedness == 'forward') {
strandedness = '--fr' strandedness = '--fr'
} else if (meta.strandedness == 'reverse') { } else if (meta.strandedness == 'reverse') {
strandedness = '--rf' strandedness = '--rf'
} }
""" """
stringtie \\ stringtie \\
$bam \\ $bam \\
$strandedness \\ $strandedness \\
-G $gtf \\ -G $gtf \\
-o ${prefix}.transcripts.gtf \\ -o ${prefix}.transcripts.gtf \\
-A ${prefix}.gene_abundance.txt \\ -A ${prefix}.gene_abundance.txt \\
-C ${prefix}.coverage.gtf \\ -C ${prefix}.coverage.gtf \\
-b ${prefix}.ballgown \\ -b ${prefix}.ballgown \\
$options.args $options.args
stringtie --version > ${software}.version.txt stringtie --version > ${software}.version.txt
""" """
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -20,7 +20,7 @@ process SUBREAD_FEATURECOUNTS {
input: input:
tuple val(meta), path(bams), path(annotation) tuple val(meta), path(bams), path(annotation)
output: output:
tuple val(meta), path("*featureCounts.txt") , emit: counts tuple val(meta), path("*featureCounts.txt") , emit: counts
tuple val(meta), path("*featureCounts.txt.summary"), emit: summary tuple val(meta), path("*featureCounts.txt.summary"), emit: summary

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -19,11 +19,11 @@ process UCSC_BEDGRAPHTOBIGWIG {
} else { } else {
container "quay.io/biocontainers/ucsc-bedgraphtobigwig:377--h446ed27_1" container "quay.io/biocontainers/ucsc-bedgraphtobigwig:377--h446ed27_1"
} }
input: input:
tuple val(meta), path(bedgraph) tuple val(meta), path(bedgraph)
path sizes path sizes
output: output:
tuple val(meta), path("*.bigWig"), emit: bigwig tuple val(meta), path("*.bigWig"), emit: bigwig
path "*.version.txt" , emit: version path "*.version.txt" , emit: version

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,41 +1,41 @@
// Import generic module functions // Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions' include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
def options = initOptions(params.options) def options = initOptions(params.options)
process UMITOOLS_DEDUP { process UMITOOLS_DEDUP {
tag "$meta.id" tag "$meta.id"
label "process_medium" label "process_medium"
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::umi_tools=1.1.1" : null) conda (params.enable_conda ? "bioconda::umi_tools=1.1.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/umi_tools:1.1.1--py38h0213d0e_1" container "https://depot.galaxyproject.org/singularity/umi_tools:1.1.1--py38h0213d0e_1"
} else { } else {
container "quay.io/biocontainers/umi_tools:1.1.1--py38h0213d0e_1" container "quay.io/biocontainers/umi_tools:1.1.1--py38h0213d0e_1"
} }
input: input:
tuple val(meta), path(bam), path(bai) tuple val(meta), path(bam), path(bai)
output: output:
tuple val(meta), path("*.bam"), emit: bam tuple val(meta), path("*.bam"), emit: bam
tuple val(meta), path("*.tsv"), emit: tsv tuple val(meta), path("*.tsv"), emit: tsv
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
""" """
umi_tools dedup \\ umi_tools dedup \\
-I $bam \\ -I $bam \\
-S ${prefix}.bam \\ -S ${prefix}.bam \\
--output-stats=$prefix \\ --output-stats=$prefix \\
$options.args \\ $options.args \\
umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt
""" """
} }

View file

@ -1,59 +1,59 @@
/* /*
* ----------------------------------------------------- * -----------------------------------------------------
* Utility functions used in nf-core DSL2 module files * Utility functions used in nf-core DSL2 module files
* ----------------------------------------------------- * -----------------------------------------------------
*/ */
/* /*
* Extract name of software tool from process name using $task.process * Extract name of software tool from process name using $task.process
*/ */
def getSoftwareName(task_process) { def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() 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 * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
*/ */
def initOptions(Map args) { def initOptions(Map args) {
def Map options = [:] def Map options = [:]
options.args = args.args ?: '' options.args = args.args ?: ''
options.args2 = args.args2 ?: '' options.args2 = args.args2 ?: ''
options.publish_by_id = args.publish_by_id ?: false options.publish_by_id = args.publish_by_id ?: false
options.publish_dir = args.publish_dir ?: '' options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files options.publish_files = args.publish_files
options.suffix = args.suffix ?: '' options.suffix = args.suffix ?: ''
return options return options
} }
/* /*
* Tidy up and join elements of a list to return a path string * Tidy up and join elements of a list to return a path string
*/ */
def getPathFromList(path_list) { def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/') return paths.join('/')
} }
/* /*
* Function to save/publish module results * Function to save/publish module results
*/ */
def saveFiles(Map args) { def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) { if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options) def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ] def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
if (ioptions.publish_by_id) { if (ioptions.publish_by_id) {
path_list.add(args.publish_id) path_list.add(args.publish_id)
} }
if (ioptions.publish_files instanceof Map) { if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) { for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) { if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect() def ext_list = path_list.collect()
ext_list.add(ext.value) ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename" return "${getPathFromList(ext_list)}/$args.filename"
} }
} }
} else if (ioptions.publish_files == null) { } else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename" return "${getPathFromList(path_list)}/$args.filename"
} }
} }
} }

View file

@ -1,57 +1,57 @@
// Import generic module functions // Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions' include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:] params.options = [:]
def options = initOptions(params.options) def options = initOptions(params.options)
process UMITOOLS_EXTRACT { process UMITOOLS_EXTRACT {
tag "$meta.id" tag "$meta.id"
label "process_low" label "process_low"
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::umi_tools=1.1.1" : null) conda (params.enable_conda ? "bioconda::umi_tools=1.1.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/umi_tools:1.1.1--py38h0213d0e_1" container "https://depot.galaxyproject.org/singularity/umi_tools:1.1.1--py38h0213d0e_1"
} else { } else {
container "quay.io/biocontainers/umi_tools:1.1.1--py38h0213d0e_1" container "quay.io/biocontainers/umi_tools:1.1.1--py38h0213d0e_1"
} }
input: input:
tuple val(meta), path(reads) tuple val(meta), path(reads)
output: output:
tuple val(meta), path("*.fastq.gz"), emit: reads tuple val(meta), path("*.fastq.gz"), emit: reads
tuple val(meta), path("*.log") , emit: log tuple val(meta), path("*.log") , emit: log
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
if (meta.single_end) { if (meta.single_end) {
""" """
umi_tools \\ umi_tools \\
extract \\ extract \\
-I $reads \\ -I $reads \\
-S ${prefix}.umi_extract.fastq.gz \\ -S ${prefix}.umi_extract.fastq.gz \\
$options.args \\ $options.args \\
> ${prefix}.umi_extract.log > ${prefix}.umi_extract.log
umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt
""" """
} else { } else {
""" """
umi_tools \\ umi_tools \\
extract \\ extract \\
-I ${reads[0]} \\ -I ${reads[0]} \\
--read2-in=${reads[1]} \\ --read2-in=${reads[1]} \\
-S ${prefix}.umi_extract_1.fastq.gz \\ -S ${prefix}.umi_extract_1.fastq.gz \\
--read2-out=${prefix}.umi_extract_2.fastq.gz \\ --read2-out=${prefix}.umi_extract_2.fastq.gz \\
$options.args \\ $options.args \\
> ${prefix}.umi_extract.log > ${prefix}.umi_extract.log
umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt
""" """
} }
} }

View file

@ -0,0 +1,33 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { BOWTIE_INDEX } from '../../../software/bowtie/index/main.nf' addParams( options: [:] )
include { BOWTIE_ALIGN } from '../../../software/bowtie/align/main.nf' addParams( options: [:] )
workflow test_bowtie_index {
fasta = file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true)
BOWTIE_INDEX ( fasta )
}
workflow test_bowtie_alignment_single_end {
fasta = file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true)
BOWTIE_INDEX ( fasta )
def input = []
input = [ [ id:'test', single_end:true ], // meta map
[ file("${launchDir}/tests/data/fastq/rna/test_R1.fastq.gz", checkIfExists: true) ] ]
BOWTIE_ALIGN ( input, BOWTIE_INDEX.out.index )
}
workflow test_bowtie_alignment_paired_end {
fasta = file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true)
BOWTIE_INDEX ( fasta )
def input = []
input = [ [ id:'test', single_end:false ], // meta map
[ file("${launchDir}/tests/data/fastq/rna/test_R1.fastq.gz", checkIfExists: true),
file("${launchDir}/tests/data/fastq/rna/test_R2.fastq.gz", checkIfExists: true) ] ]
BOWTIE_ALIGN ( input, BOWTIE_INDEX.out.index )
}

View file

@ -0,0 +1,64 @@
- name: Run bowtie index
command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_index -c tests/config/nextflow.config
tags:
- bowtie
- bowtie_index
files:
- path: output/bowtie/bowtie/NC_010473.1.ebwt
md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c
- path: output/bowtie/bowtie/NC_010473.2.ebwt
md5sum: bfd10c5319c6a0dbc540fd789254a5dd
- path: output/bowtie/bowtie/NC_010473.3.ebwt
md5sum: cd201e81724f3099131aec16ef2cc53b
- path: output/bowtie/bowtie/NC_010473.4.ebwt
md5sum: bbb9d6d21ad765d135f95290204e8433
- path: output/bowtie/bowtie/NC_010473.rev.1.ebwt
md5sum: 44f719c2fe42e1f35d54e798775846d1
- path: output/bowtie/bowtie/NC_010473.rev.2.ebwt
md5sum: f3c398bba5158f4039334a932d79c051
- name: Run bowtie index and align single-end
command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_alignment_single_end -c tests/config/nextflow.config
tags:
- bowtie
- bowtie_align
files:
- path: output/bowtie/bowtie/NC_010473.1.ebwt
md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c
- path: output/bowtie/bowtie/NC_010473.2.ebwt
md5sum: bfd10c5319c6a0dbc540fd789254a5dd
- path: output/bowtie/bowtie/NC_010473.3.ebwt
md5sum: cd201e81724f3099131aec16ef2cc53b
- path: output/bowtie/bowtie/NC_010473.4.ebwt
md5sum: bbb9d6d21ad765d135f95290204e8433
- path: output/bowtie/bowtie/NC_010473.rev.1.ebwt
md5sum: 44f719c2fe42e1f35d54e798775846d1
- path: output/bowtie/bowtie/NC_010473.rev.2.ebwt
md5sum: f3c398bba5158f4039334a932d79c051
- path: output/bowtie/test.out
md5sum: a81cb18024616415a6cec3108a36fccd
- path: output/bowtie/test.bam
md5sum: 9feed8a55d4b5e600dcc577768ef07fc
- name: Run bowtie index and align paired-end
command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_alignment_paired_end -c tests/config/nextflow.config
tags:
- bowtie
- bowtie_align
files:
- path: output/bowtie/bowtie/NC_010473.1.ebwt
md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c
- path: output/bowtie/bowtie/NC_010473.2.ebwt
md5sum: bfd10c5319c6a0dbc540fd789254a5dd
- path: output/bowtie/bowtie/NC_010473.3.ebwt
md5sum: cd201e81724f3099131aec16ef2cc53b
- path: output/bowtie/bowtie/NC_010473.4.ebwt
md5sum: bbb9d6d21ad765d135f95290204e8433
- path: output/bowtie/bowtie/NC_010473.rev.1.ebwt
md5sum: 44f719c2fe42e1f35d54e798775846d1
- path: output/bowtie/bowtie/NC_010473.rev.2.ebwt
md5sum: f3c398bba5158f4039334a932d79c051
- path: output/bowtie/test.out
md5sum: a23e9a2a76e949aeb3693bcfae41a615
- path: output/bowtie/test.bam
md5sum: cf6a6381aa504e8342638ff3b509721e