We've moved!
For WDL questions, see the WDL specification and WDL docs.
For Cromwell questions, see the Cromwell docs and please post any issues on Github.

alternative command execution based on input parameters?

bhaasbhaas Broad InstituteMember, Broadie

Do you have an example of a WDL workflow that accepts alternative input parameters, and based on the inputs will execute the workflow accordingly? For example, having a WDL that accepts either bam or fastq files as input. If the bam file is selected, then it will process a different set of initial tasks than if the fastq file was provided.

Tagged:

Best Answers

Answers

  • bhaasbhaas Broad InstituteMember, Broadie

    perfect. thanks!!

  • bhaasbhaas Broad InstituteMember, Broadie

    Is it possible to have the suggested code/logic within the task section rather than in the workflow section?

  • bhaasbhaas Broad InstituteMember, Broadie

    This is how it looks right now in my workflow section, and this seems to be working, but it requires that I have almost identical 3 tasks rather than 1 task that is flexible on the input parameters:

    workflow ctat_fusion_wf {
    
        String sample_name
        File genome_lib_tar
        File? rnaseq_aligned_bam
        File? left_fq
        File? right_fq
        File? fastq_pair_tar_gz
    
        if (defined(rnaseq_aligned_bam)) {
            call CTAT_FUSION_TASK_BAM {
                input:
                  input_bam=rnaseq_aligned_bam,
                     sample_name=sample_name,
                     genome_lib_tar=genome_lib_tar
            }
        }
    
        if (defined(left_fq)) {
            call CTAT_FUSION_TASK_FASTQ {
                   input:
                  sample_name=sample_name,
                  genome_lib_tar=genome_lib_tar,
                  left_fq=left_fq,
                  right_fq=right_fq
            }
        }
    
        if (defined(fastq_pair_tar_gz)) {
            call CTAT_FUSION_TASK_FQPAIRTARGZ {
                input:
                  sample_name=sample_name,
                  genome_lib_tar=genome_lib_tar,
                  fastq_pair_tar_gz=fastq_pair_tar_gz
            }
    
        }
    
    }
    
  • bhaasbhaas Broad InstituteMember, Broadie

    awesome! that's a huge help. thanks!!

  • bhaasbhaas Broad InstituteMember, Broadie

    Is it possibly now to have a string variable where you can have conditional logic based on its value?

    ie. in a workflow section:

    String mode
    
    if (mode == 'A') {
          # run this task
    }
    if (mode == 'B') {
          # run this other task
    }
    

    or have if/else settings?

Sign In or Register to comment.