2021-03-22 17:14:24 +00:00
|
|
|
// Import generic module functions
|
2021-09-27 08:41:24 +00:00
|
|
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
2021-03-22 17:14:24 +00:00
|
|
|
|
|
|
|
params.options = [:]
|
|
|
|
options = initOptions(params.options)
|
|
|
|
|
|
|
|
process UNICYCLER {
|
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_high'
|
|
|
|
publishDir "${params.outdir}",
|
|
|
|
mode: params.publish_dir_mode,
|
2021-04-09 16:23:56 +00:00
|
|
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
2021-03-22 17:14:24 +00:00
|
|
|
|
|
|
|
conda (params.enable_conda ? 'bioconda::unicycler=0.4.8' : null)
|
|
|
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
|
|
|
container "https://depot.galaxyproject.org/singularity/unicycler:0.4.8--py38h8162308_3"
|
|
|
|
} else {
|
|
|
|
container "quay.io/biocontainers/unicycler:0.4.8--py38h8162308_3"
|
|
|
|
}
|
|
|
|
|
|
|
|
input:
|
2021-11-15 11:48:56 +00:00
|
|
|
tuple val(meta), path(shortreads), path(longreads)
|
2021-03-22 17:14:24 +00:00
|
|
|
|
|
|
|
output:
|
2021-11-15 11:48:56 +00:00
|
|
|
tuple val(meta), path('*.scaffolds.fa.gz'), emit: scaffolds
|
|
|
|
tuple val(meta), path('*.assembly.gfa.gz'), emit: gfa
|
|
|
|
tuple val(meta), path('*.log') , emit: log
|
|
|
|
path "versions.yml" , emit: versions
|
2021-03-22 17:14:24 +00:00
|
|
|
|
|
|
|
script:
|
|
|
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
2021-11-15 11:48:56 +00:00
|
|
|
def short_reads = shortreads ? ( meta.single_end ? "-s $shortreads" : "-1 ${shortreads[0]} -2 ${shortreads[1]}" ) : ""
|
|
|
|
def long_reads = longreads ? "-l $longreads" : ""
|
2021-03-22 17:14:24 +00:00
|
|
|
"""
|
|
|
|
unicycler \\
|
|
|
|
--threads $task.cpus \\
|
|
|
|
$options.args \\
|
2021-11-15 11:48:56 +00:00
|
|
|
$short_reads \\
|
|
|
|
$long_reads \\
|
2021-03-22 17:14:24 +00:00
|
|
|
--out ./
|
|
|
|
|
|
|
|
mv assembly.fasta ${prefix}.scaffolds.fa
|
2021-11-15 11:48:56 +00:00
|
|
|
gzip -n ${prefix}.scaffolds.fa
|
2021-03-22 17:14:24 +00:00
|
|
|
mv assembly.gfa ${prefix}.assembly.gfa
|
2021-11-15 11:48:56 +00:00
|
|
|
gzip -n ${prefix}.assembly.gfa
|
2021-03-22 17:14:24 +00:00
|
|
|
mv unicycler.log ${prefix}.unicycler.log
|
|
|
|
|
2021-09-27 08:41:24 +00:00
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
${getProcessName(task.process)}:
|
2021-09-28 13:37:47 +00:00
|
|
|
${getSoftwareName(task.process)}: \$(echo \$(unicycler --version 2>&1) | sed 's/^.*Unicycler v//; s/ .*\$//')
|
2021-09-27 08:41:24 +00:00
|
|
|
END_VERSIONS
|
2021-03-22 17:14:24 +00:00
|
|
|
"""
|
|
|
|
}
|