Convert CWL input/output into a nextflow process definition.

    Needs to handle scattered/parallel variables.

def nf_io_to_process(ios, def_ios, scatter_ios=None):
    """Convert CWL input/output into a nextflow process definition.

    Needs to handle scattered/parallel variables.
    """
    scatter_names = {k: v for k, v in scatter_ios} if scatter_ios else {}
    var_types = {}
    for def_io in def_ios:
        var_types[def_io["name"]] = nf_type(def_io["variable_type"])
    out = []
    for io in ios:
        cur_id = io["id"]
        if scatter_names:
            input_id = scatter_names[io["value"]]
        else:
            input_id = io.get("value")
        vtype = var_types[cur_id]
        if input_id and cur_id != input_id:
            out.append("%s %s as %s" % (vtype, input_id, cur_id))
        else:
            out.append("%s %s" % (vtype, cur_id))
    return out