broadinstitute / viral-pipelines

viral-ngs: complete pipelines
Other
60 stars 28 forks source link

Fixing duplicate inputs bug #514

Closed jpramosbarroso closed 8 months ago

jpramosbarroso commented 8 months ago

With the changed that were made in the previous PR re. nested inputs, the resulting WDL led to duplicates in the Terra workflow setup UI (see attached screenshot). This preserves stylistic edits made while insuring inputs only appear once in the Terra UI. I could not find a workaround that did not involve passing in all of the inputs after call create_vis. ![Screenshot 2024-02-15 at 2 45 56 PM] (https://github.com/broadinstitute/viral-pipelines/assets/78126657/c294b272-5c98-487c-9f4c-4d161db44e67)

dpark01 commented 8 months ago

So basically (and I can't suggest edits to lines that weren't changed by your PR, so here's another approach) you want the workflow WDL to look like this:

version 1.0

workflow CreateEntericsQCViz {

    meta {
        allowNestedInputs: true
    }

    call create_viz

    output {
        File    visualization_html     =   create_viz.html
    }
}

task create_viz {
    input {
        Array[String]   sample_ids
        String          workspace_name
        String          workspace_project
        String          input_table_name

        String           grouping_column_name            =   "gambit_predicted_taxon"
        String           output_filename                 =   "QC_visualizations.html"

        String?         custom_est_coverage_thresholds
        String?         custom_contig_thresholds
        String?         custom_assembly_thresholds
        String?         custom_mean_q_thresholds

        String          docker                          =   "us-central1-docker.pkg.dev/pgs-automation/enterics-visualizations/create_visualization_html:v1"       
    }

    parameter_meta {
        sample_ids: {description: "selected rows of data from data table which will be used for plotting"}
        input_table_name: {description: "name of the Terra data table - root entity type - from where input data is selected"}
        workspace_name: {description: "name of Terra workspace where data lives"}
        workspace_project: {description: "name of Terra project associated with Terra workspace"}
        grouping_column_name: {description: "name of column to be used for grouping/coloring - ex. gambit_predicted_taxon (organism)"}
        output_filename: {description: "name of output file containing visualizations"}
        custom_est_coverage_thresholds: {description: "json string with custom estimated coverage threshlds"}
        custom_contig_thresholds: {description: "json string with custom number contig thresholds"}
        custom_assembly_thresholds: {description: "json string with custom assembly length thresholds"}
        custom_mean_q_thresholds: {description: "json string with custom mean q thresholds"}
    }

    command {
        python3 /scripts/create_enterics_visualizations_html.py -s ~{sep=' ' sample_ids} \
                                                                -dt ~{input_table_name} \
                                                                -w ~{workspace_name} \
                                                                -bp ~{workspace_project} \
                                                                ~{"-g" + grouping_column_name} \
                                                                ~{"-o" + output_filename} \
                                                                ~{"-ect" + custom_est_coverage_thresholds} \
                                                                ~{"-cnt" + custom_contig_thresholds} \
                                                                ~{"-at" + custom_assembly_thresholds} \
                                                                ~{"-mqt" + custom_mean_q_thresholds} \
    }

    runtime {
        docker: docker
    }

    output {
        File html = output_filename
    }
}
jpramosbarroso commented 8 months ago

@dpark01 I've incorporated your feedback — thank you for taking the time to look this over!