2021-04-09 07:00:33 +00:00
|
|
|
// Import generic module functions
|
2021-09-27 08:41:24 +00:00
|
|
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
2021-04-09 07:00:33 +00:00
|
|
|
|
|
|
|
params.options = [:]
|
|
|
|
options = initOptions(params.options)
|
|
|
|
|
|
|
|
process SNPSITES {
|
|
|
|
label 'process_medium'
|
|
|
|
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:[:], publish_by_meta:[]) }
|
2021-04-09 07:00:33 +00:00
|
|
|
|
|
|
|
conda (params.enable_conda ? "bioconda::snp-sites=2.5.1" : null)
|
|
|
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
|
|
|
container "https://depot.galaxyproject.org/singularity/snp-sites:2.5.1--hed695b0_0"
|
|
|
|
} else {
|
|
|
|
container "quay.io/biocontainers/snp-sites:2.5.1--hed695b0_0"
|
|
|
|
}
|
|
|
|
|
|
|
|
input:
|
|
|
|
path alignment
|
|
|
|
|
|
|
|
output:
|
|
|
|
path "*.fas" , emit: fasta
|
|
|
|
path "*.sites.txt" , emit: constant_sites
|
2021-09-27 08:41:24 +00:00
|
|
|
path "versions.yml" , emit: version
|
2021-04-10 17:49:35 +00:00
|
|
|
env CONSTANT_SITES, emit: constant_sites_string
|
2021-04-09 07:00:33 +00:00
|
|
|
|
|
|
|
script:
|
|
|
|
def software = getSoftwareName(task.process)
|
|
|
|
"""
|
2021-05-06 15:05:07 +00:00
|
|
|
snp-sites \\
|
2021-04-09 07:00:33 +00:00
|
|
|
$alignment \\
|
2021-05-06 15:05:07 +00:00
|
|
|
$options.args \\
|
2021-04-09 07:00:33 +00:00
|
|
|
> filtered_alignment.fas
|
|
|
|
|
|
|
|
echo \$(snp-sites -C $alignment) > constant.sites.txt
|
|
|
|
|
2021-04-10 17:49:35 +00:00
|
|
|
CONSTANT_SITES=\$(cat constant.sites.txt)
|
|
|
|
|
2021-09-27 08:41:24 +00:00
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
${getProcessName(task.process)}:
|
|
|
|
${getSoftwareName(task.process)}: \$(snp-sites -V 2>&1 | sed 's/snp-sites //')
|
|
|
|
END_VERSIONS
|
2021-04-09 07:00:33 +00:00
|
|
|
"""
|
|
|
|
}
|