Why is only one call allowed for a task even when different arguments are used?

mmahmmah Member, Broadie

I am trying to collect the output from a scatter operation's jobs into a single directory, similarly to this question. Each scattered job outputs two files, so I want to save two arrays of files while gathering. I wrote a single task and called it twice, once to save each array, but WDL validation does not like this: ERROR: Two or more calls have the same name for copy_output. Why is it an error to call the same task twice but with different inputs? This makes it difficult to reuse WDL code.

scatter(sam in demultiplex.demultiplexed_sam){
    call sort{ input: 
        picard_jar = picard_jar,
        unsorted = sam
    }
    call deduplicate{ input:
        picard_jar = picard_jar,
        sorted = sort.sorted,
        sample_id = sort.id
    }
}
call copy_output{ input:
    files = deduplicate.deduplicated,
    output_path = output_path
}
call copy_output{ input:
    files = deduplicate.statistics,
    output_path = output_path
}
task copy_output{
    Array[File] files
    String output_path

    command{
        mkdir -p ${output_path};
        for file in ${sep=' ' files}  ; do 
            cp -l $file "${output_path}"
        done
    }
}

Best Answer

Answers

Sign In or Register to comment.