improve readability

This commit is contained in:
SusiJo 2022-05-20 13:29:49 +02:00
parent bdf222649d
commit 9096be5464

View file

@ -27,17 +27,17 @@ process CNVKIT_BATCH {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
// execute samtools only when cram files are input, cnvkit runs natively on bam but is prohibitively slow // execute samtools only when cram files are input, cnvkit runs natively on bam but is prohibitively slow
// input pair is assumed to have same extension if both exist // input pair is assumed to have same extension if both exist
def is_cram = tumor.Extension == "cram" ? true : false def is_cram = tumor.Extension == "cram" ? true : false
def tumor_out = is_cram ? tumor.BaseName + ".bam" : "${tumor}" def tumor_out = is_cram ? tumor.BaseName + ".bam" : "${tumor}"
// do not run samtools on normal samples in tumor_only mode // do not run samtools on normal samples in tumor_only mode
def normal_exists = normal ? true: false def normal_exists = normal ? true: false
// tumor_only mode does not need fasta & target // tumor_only mode does not need fasta & target
// instead it requires a pre-computed reference.cnn which is built from fasta & target // instead it requires a pre-computed reference.cnn which is built from fasta & target
def (normal_out, normal_args, fasta_args) = ["", "", ""] def (normal_out, normal_args, fasta_args) = ["", "", ""]
def target_args = targets ? "--targets $targets" : ""
def reference_args = reference ? "--reference $reference" : ""
if (normal_exists){ if (normal_exists){
def normal_prefix = normal.BaseName def normal_prefix = normal.BaseName
@ -46,6 +46,9 @@ process CNVKIT_BATCH {
fasta_args = fasta ? "--fasta $fasta" : "" fasta_args = fasta ? "--fasta $fasta" : ""
} }
def target_args = targets ? "--targets $targets" : ""
def reference_args = reference ? "--reference $reference" : ""
""" """
if $is_cram; then if $is_cram; then
samtools view -T $fasta $tumor -@ $task.cpus -o $tumor_out samtools view -T $fasta $tumor -@ $task.cpus -o $tumor_out