Add new modules

This commit is contained in:
drpatelh 2020-09-10 16:09:54 +01:00
parent 46edf8ae4c
commit cbf8329ffd
44 changed files with 2344 additions and 0 deletions

View file

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

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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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