combine multiple pytor

This commit is contained in:
Ramprasad Neethiraj 2022-05-05 23:59:12 +02:00
parent c183d7b397
commit e4e4f8090c
2 changed files with 12 additions and 10 deletions

View file

@ -8,7 +8,7 @@ process CNVPYTOR_VIEW {
'quay.io/biocontainers/cnvpytor:1.2.1--pyhdfd78af_0' }" 'quay.io/biocontainers/cnvpytor:1.2.1--pyhdfd78af_0' }"
input: input:
tuple val(meta), path(pytor) tuple val(meta), path(pytor_files)
val bin_sizes val bin_sizes
val output_format val output_format
@ -23,17 +23,18 @@ process CNVPYTOR_VIEW {
script: script:
def output_suffix = output_format ?: 'vcf' def output_suffix = output_format ?: 'vcf'
def bins = bin_sizes ?: '1000' def bins = bin_sizes ?: '1000'
def input = pytor_files.join(" ")
def prefix = task.ext.prefix ?: "${meta.id}"
""" """
python3 <<CODE python3 <<CODE
import cnvpytor,os import cnvpytor,os
from pathlib import Path
pytor_file = Path("$pytor")
binsizes = "${bins}".split(" ") binsizes = "${bins}".split(" ")
for binsize in binsizes: for binsize in binsizes:
app = cnvpytor.Viewer(["$pytor"], params={} ) file_list = "${input}".split(" ")
outputfile = "{}_{}.{}".format(pytor_file.stem,binsize.strip(),"${output_suffix}") app = cnvpytor.Viewer(file_list, params={} )
outputfile = "{}_{}.{}".format("${prefix}",binsize.strip(),"${output_suffix}")
app.print_filename = outputfile app.print_filename = outputfile
app.bin_size = int(binsize) app.bin_size = int(binsize)
app.print_calls_file() app.print_calls_file()
@ -47,8 +48,9 @@ process CNVPYTOR_VIEW {
stub: stub:
def output_suffix = output_format ?: 'vcf' def output_suffix = output_format ?: 'vcf'
def prefix = task.ext.prefix ?: "${meta.id}"
""" """
touch ${pytor.baseName}.${output_suffix} touch ${prefix}.${output_suffix}
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
"${task.process}": "${task.process}":

View file

@ -8,7 +8,7 @@ workflow test_cnvpytor_view {
input = [ input = [
[ id:'test'], // meta map [ id:'test'], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_pytor'], checkIfExists: true) [file(params.test_data['homo_sapiens']['illumina']['test_pytor'], checkIfExists: true)]
] ]
bin_sizes = "10000 100000" bin_sizes = "10000 100000"
@ -20,7 +20,7 @@ workflow test_cnvpytor_view_tsvout {
input = [ input = [
[ id:'test'], // meta map [ id:'test'], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_pytor'], checkIfExists: true) [file(params.test_data['homo_sapiens']['illumina']['test_pytor'], checkIfExists: true)]
] ]
output_suffix = "tsv" output_suffix = "tsv"
@ -32,7 +32,7 @@ workflow test_cnvpytor_view_stub {
input = [ input = [
[ id:'test'], // meta map [ id:'test'], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_pytor'], checkIfExists: true) [file(params.test_data['homo_sapiens']['illumina']['test_pytor'], checkIfExists: true)]
] ]
bin_sizes = [] bin_sizes = []