nf-core_modules/modules/cnvpytor/view/main.nf

61 lines
1.8 KiB
Text
Raw Normal View History

2022-05-03 12:26:46 +00:00
process CNVPYTOR_VIEW {
tag "$meta.id"
label 'process_medium'
conda (params.enable_conda ? "bioconda::cnvpytor=1.2.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/cnvpytor:1.2.1--pyhdfd78af_0':
'quay.io/biocontainers/cnvpytor:1.2.1--pyhdfd78af_0' }"
input:
2022-05-05 21:59:12 +00:00
tuple val(meta), path(pytor_files)
2022-05-03 12:26:46 +00:00
val bin_sizes
val output_format
output:
tuple val(meta), path("*.vcf"), emit: vcf , optional: true
tuple val(meta), path("*.tsv"), emit: tsv , optional: true
tuple val(meta), path("*.xls"), emit: xls , optional: true
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def output_suffix = output_format ?: 'vcf'
2022-05-05 21:59:12 +00:00
def bins = bin_sizes ?: '1000'
def input = pytor_files.join(" ")
def prefix = task.ext.prefix ?: "${meta.id}"
2022-05-03 12:26:46 +00:00
"""
python3 <<CODE
import cnvpytor,os
2022-05-03 12:53:56 +00:00
binsizes = "${bins}".split(" ")
2022-05-05 15:28:49 +00:00
for binsize in binsizes:
2022-05-05 21:59:12 +00:00
file_list = "${input}".split(" ")
app = cnvpytor.Viewer(file_list, params={} )
outputfile = "{}_{}.{}".format("${prefix}",binsize.strip(),"${output_suffix}")
2022-05-05 15:28:49 +00:00
app.print_filename = outputfile
app.bin_size = int(binsize)
app.print_calls_file()
2022-05-03 12:26:46 +00:00
CODE
cat <<-END_VERSIONS > versions.yml
"${task.process}":
cnvpytor: \$(echo \$(cnvpytor --version 2>&1) | sed 's/CNVpytor //' )
2022-05-03 12:26:46 +00:00
END_VERSIONS
"""
stub:
def output_suffix = output_format ?: 'vcf'
2022-05-05 21:59:12 +00:00
def prefix = task.ext.prefix ?: "${meta.id}"
2022-05-03 12:26:46 +00:00
"""
2022-05-05 21:59:12 +00:00
touch ${prefix}.${output_suffix}
2022-05-03 12:26:46 +00:00
cat <<-END_VERSIONS > versions.yml
"${task.process}":
cnvpytor: \$(echo \$(cnvpytor --version 2>&1) | sed 's/CNVpytor //' )
2022-05-03 12:26:46 +00:00
END_VERSIONS
"""
}