예제 #1
0
 def _workflow_to_dict_run(self, trans, stored):
     """
     Builds workflow dictionary used by run workflow form
     """
     workflow = stored.latest_workflow
     if len(workflow.steps) == 0:
         raise exceptions.MessageException(
             'Workflow cannot be run because it does not have any steps.')
     if attach_ordered_steps(workflow, workflow.steps):
         raise exceptions.MessageException(
             'Workflow cannot be run because it contains cycles.')
     trans.workflow_building_mode = workflow_building_modes.USE_HISTORY
     module_injector = WorkflowModuleInjector(trans)
     has_upgrade_messages = False
     step_version_changes = []
     missing_tools = []
     errors = {}
     for step in workflow.steps:
         try:
             module_injector.inject(step,
                                    steps=workflow.steps,
                                    exact_tools=False)
         except exceptions.ToolMissingException:
             if step.tool_id not in missing_tools:
                 missing_tools.append(step.tool_id)
             continue
         if step.upgrade_messages:
             has_upgrade_messages = True
         if step.type == 'tool' or step.type is None:
             if step.module.version_changes:
                 step_version_changes.extend(step.module.version_changes)
             step_errors = step.module.get_errors()
             if step_errors:
                 errors[step.id] = step_errors
     if missing_tools:
         workflow.annotation = self.get_item_annotation_str(
             trans.sa_session, trans.user, workflow)
         raise exceptions.MessageException('Following tools missing: %s' %
                                           ', '.join(missing_tools))
     workflow.annotation = self.get_item_annotation_str(
         trans.sa_session, trans.user, workflow)
     step_order_indices = {}
     for step in workflow.steps:
         step_order_indices[step.id] = step.order_index
     step_models = []
     for i, step in enumerate(workflow.steps):
         step_model = None
         if step.type == 'tool':
             incoming = {}
             tool = trans.app.toolbox.get_tool(
                 step.tool_id, tool_version=step.tool_version)
             params_to_incoming(incoming, tool.inputs, step.state.inputs,
                                trans.app)
             step_model = tool.to_json(
                 trans,
                 incoming,
                 workflow_building_mode=workflow_building_modes.USE_HISTORY)
             step_model['post_job_actions'] = [{
                 'short_str':
                 ActionBox.get_short_str(pja),
                 'action_type':
                 pja.action_type,
                 'output_name':
                 pja.output_name,
                 'action_arguments':
                 pja.action_arguments
             } for pja in step.post_job_actions]
         else:
             inputs = step.module.get_runtime_inputs(
                 connections=step.output_connections)
             step_model = {
                 'inputs':
                 [input.to_dict(trans) for input in inputs.values()]
             }
         step_model['step_type'] = step.type
         step_model['step_label'] = step.label
         step_model['step_name'] = step.module.get_name()
         step_model['step_version'] = step.module.get_version()
         step_model['step_index'] = step.order_index
         step_model['output_connections'] = [{
             'input_step_index':
             step_order_indices.get(oc.input_step_id),
             'output_step_index':
             step_order_indices.get(oc.output_step_id),
             'input_name':
             oc.input_name,
             'output_name':
             oc.output_name
         } for oc in step.output_connections]
         if step.annotations:
             step_model['annotation'] = step.annotations[0].annotation
         if step.upgrade_messages:
             step_model['messages'] = step.upgrade_messages
         step_models.append(step_model)
     return {
         'id':
         trans.app.security.encode_id(stored.id),
         'history_id':
         trans.app.security.encode_id(trans.history.id)
         if trans.history else None,
         'name':
         stored.name,
         'steps':
         step_models,
         'step_version_changes':
         step_version_changes,
         'has_upgrade_messages':
         has_upgrade_messages,
         'workflow_resource_parameters':
         self._workflow_resource_parameters(trans, stored, workflow),
     }
예제 #2
0
def render_body(context, **pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        basestring = context.get('basestring', UNDEFINED)
        errors = context.get('errors', UNDEFINED)
        tuple = context.get('tuple', UNDEFINED)
        int = context.get('int', UNDEFINED)
        h = context.get('h', UNDEFINED)
        app = context.get('app', UNDEFINED)
        workflow = context.get('workflow', UNDEFINED)

        def do_inputs(inputs, values, errors, prefix, step, other_values=None):
            return render_do_inputs(context.locals_(__M_locals), inputs,
                                    values, errors, prefix, step, other_values)

        len = context.get('len', UNDEFINED)
        dict = context.get('dict', UNDEFINED)
        t = context.get('t', UNDEFINED)
        enumerate = context.get('enumerate', UNDEFINED)
        has_upgrade_messages = context.get('has_upgrade_messages', UNDEFINED)
        steps = context.get('steps', UNDEFINED)
        isinstance = context.get('isinstance', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n\n')
        # SOURCE LINE 13
        __M_writer(u'\n\n')
        # SOURCE LINE 32
        __M_writer(u'\n\n')
        # SOURCE LINE 34

        from galaxy.tools.parameters import DataToolParameter, RuntimeValue
        from galaxy.jobs.actions.post import ActionBox
        import re
        import colorsys
        import random

        wf_parms = {}
        for step in steps:
            for v in step.state.inputs.itervalues():
                if isinstance(v, basestring):
                    for rematch in re.findall('\$\{.+?\}', v):
                        if rematch[2:-1] not in wf_parms:
                            wf_parms[rematch[2:-1]] = ""
        if wf_parms:
            hue_offset = 1.0 / len(wf_parms)
            hue = 0.0
            for k in wf_parms.iterkeys():
                wf_parms[k] = "#%X%X%X" % tuple(
                    [int(x * 255) for x in colorsys.hsv_to_rgb(hue, .1, .9)])
                hue += hue_offset

        __M_locals.update(
            __M_dict_builtin([
                (__M_key, __M_locals_builtin()[__M_key]) for __M_key in [
                    'hue', 'hue_offset', 'wf_parms', 'ActionBox',
                    'DataToolParameter', 'rematch', 'k', 'random', 're',
                    'step', 'RuntimeValue', 'colorsys', 'v', 'x'
                ] if __M_key in __M_locals_builtin()
            ]))
        # SOURCE LINE 54
        __M_writer(u'\n\n')
        # SOURCE LINE 91
        __M_writer(u'\n\n')
        # SOURCE LINE 163
        __M_writer(u'\n\n<h2>Running workflow "')
        # SOURCE LINE 165
        __M_writer(unicode(h.to_unicode(workflow.name)))
        __M_writer(u'"</h2>\n\n')
        # SOURCE LINE 167
        if has_upgrade_messages:
            # SOURCE LINE 168
            __M_writer(
                u'<div class="warningmessage">\n    Problems were encountered when loading this workflow, likely due to tool\n    version changes. Missing parameter values have been replaced with default.\n    Please review the parameter values below.\n</div>\n'
            )
        # SOURCE LINE 174
        __M_writer(u'\n')
        # SOURCE LINE 175
        if workflow.annotation:
            # SOURCE LINE 176
            __M_writer(u'    <div class="workflow-annotation">Annotation: ')
            __M_writer(unicode(workflow.annotation))
            __M_writer(u'</div>\n    <hr/>\n')
        # SOURCE LINE 179
        __M_writer(u'\n<form id="tool_form" name="tool_form" method="POST">\n')
        # SOURCE LINE 182
        __M_writer(u'\n\n')
        # SOURCE LINE 184
        if wf_parms:
            # SOURCE LINE 185
            __M_writer(
                u'<div class="metadataForm">\n    <div class="metadataFormTitle">Workflow Parameters</div>\n    <div class="metadataFormBody">\n'
            )
            # SOURCE LINE 188
            for parm in wf_parms:
                # SOURCE LINE 189
                __M_writer(
                    u"        <div class='form-row'><label style='width:100px;'>"
                )
                __M_writer(unicode(parm))
                __M_writer(u'<input style="border:2px solid ')
                __M_writer(unicode(wf_parms[parm]))
                __M_writer(
                    u';border-left-width:8px;" type="text" class=\'wf_parm_input ptag_'
                )
                __M_writer(unicode(parm))
                __M_writer(u'\' name="wf_parm|')
                __M_writer(unicode(parm))
                __M_writer(u'" value=""/></label></div>\n')
            # SOURCE LINE 191
            __M_writer(
                u'    </div>\n</div>\n    <script type="text/javascript">\n    // Set the change hooks for workflow parameters.\n    $(document).ready(function () {\n        $(\'.wf_parm_input\').bind(\'change keypress keyup\', function(event){\n            // DBTODO This is probably not reliable.  Ensure we have the right class.\n            var new_text = $(this).val();\n            if (new_text === \'\'){\n                var tag_id = $(this).attr("class").split(\' \')[1].substring(5);\n                // Set text properly.\n                $(\'.wfpspan.wf_parm__\'+tag_id).text(tag_id);\n            }else{\n                var tag_id = $(this).attr("class").split(\' \')[1].substring(5);\n                // Set text properly.\n                $(\'.wfpspan.wf_parm__\'+tag_id).text(new_text);\n                // Now set the hidden input to the generated text.\n                $(\'.wfpspan.wf_parm__\'+tag_id).not(\'.pja_wfp\').each(function(){\n                    // var new_text = $(this).parent().text();\n                    $(this).parent().siblings().children().val(new_text);\n                });\n            }\n        });\n    });\n    </script>\n'
            )
        # SOURCE LINE 217
        __M_writer(u'\n')
        # SOURCE LINE 218
        for i, step in enumerate(steps):
            # SOURCE LINE 219
            if step.type == 'tool' or step.type is None:
                # SOURCE LINE 220
                __M_writer(u'      ')
                tool = app.toolbox.tools_by_id[step.tool_id]

                __M_locals.update(
                    __M_dict_builtin([(__M_key, __M_locals_builtin()[__M_key])
                                      for __M_key in ['tool']
                                      if __M_key in __M_locals_builtin()]))
                __M_writer(u'\n      <input type="hidden" name="')
                # SOURCE LINE 221
                __M_writer(unicode(step.id))
                __M_writer(u'|tool_state" value="')
                __M_writer(unicode(step.state.encode(tool, app)))
                __M_writer(
                    u'">\n      <div class="toolForm">\n          <div class="toolFormTitle">\n              Step '
                )
                # SOURCE LINE 224
                __M_writer(unicode(int(step.order_index) + 1))
                __M_writer(u': ')
                __M_writer(unicode(tool.name))
                __M_writer(u'\n')
                # SOURCE LINE 225
                if step.annotations:
                    # SOURCE LINE 226
                    __M_writer(
                        u'                <div class="step-annotation">Annotation: '
                    )
                    __M_writer(
                        unicode(h.to_unicode(step.annotations[0].annotation)))
                    __M_writer(u'</div>\n')
                # SOURCE LINE 228
                __M_writer(
                    u'          </div>\n          <div class="toolFormBody">\n            '
                )
                # SOURCE LINE 230
                __M_writer(
                    unicode(
                        do_inputs(tool.inputs, step.state.inputs,
                                  errors.get(step.id, dict()), "", step)))
                __M_writer(u'\n')
                # SOURCE LINE 231
                if step.post_job_actions:
                    # SOURCE LINE 232
                    __M_writer(
                        u"                <hr/>\n                <div class='form-row'>\n"
                    )
                    # SOURCE LINE 234
                    if len(step.post_job_actions) > 1:
                        # SOURCE LINE 235
                        __M_writer(
                            u'                    <label>Actions:</label>\n')
                        # SOURCE LINE 236
                    else:
                        # SOURCE LINE 237
                        __M_writer(
                            u'                    <label>Action:</label>\n')
                    # SOURCE LINE 239

                    pja_ss_all = []
                    for pja_ss in [
                            ActionBox.get_short_str(pja)
                            for pja in step.post_job_actions
                    ]:
                        for rematch in re.findall('\$\{.+?\}', pja_ss):
                            pja_ss = pja_ss.replace(
                                rematch,
                                '<span style="background-color:%s" class="wfpspan wf_parm__%s pja_wfp">%s</span>'
                                % (wf_parms[rematch[2:-1]], rematch[2:-1],
                                   rematch[2:-1]))
                        pja_ss_all.append(pja_ss)

                    __M_locals.update(
                        __M_dict_builtin([
                            (__M_key, __M_locals_builtin()[__M_key])
                            for __M_key in
                            ['rematch', 'pja_ss_all', 'pja', 'pja_ss']
                            if __M_key in __M_locals_builtin()
                        ]))
                    # SOURCE LINE 245
                    __M_writer(u'\n                ')
                    # SOURCE LINE 246
                    __M_writer(unicode('<br/>'.join(pja_ss_all)))
                    __M_writer(u'\n                </div>\n')
                # SOURCE LINE 249
                __M_writer(u'          </div>\n      </div>\n')
                # SOURCE LINE 251
            else:
                # SOURCE LINE 252
                __M_writer(u'    ')
                module = step.module

                __M_locals.update(
                    __M_dict_builtin([(__M_key, __M_locals_builtin()[__M_key])
                                      for __M_key in ['module']
                                      if __M_key in __M_locals_builtin()]))
                __M_writer(u'\n      <input type="hidden" name="')
                # SOURCE LINE 253
                __M_writer(unicode(step.id))
                __M_writer(u'|tool_state" value="')
                __M_writer(unicode(module.encode_runtime_state(t, step.state)))
                __M_writer(
                    u'">\n      <div class="toolForm">\n          <div class="toolFormTitle">\n              Step '
                )
                # SOURCE LINE 256
                __M_writer(unicode(int(step.order_index) + 1))
                __M_writer(u': ')
                __M_writer(unicode(module.name))
                __M_writer(u'\n')
                # SOURCE LINE 257
                if step.annotations:
                    # SOURCE LINE 258
                    __M_writer(
                        u'                <div class="step-annotation">Annotation: '
                    )
                    __M_writer(unicode(step.annotations[0].annotation))
                    __M_writer(u'</div>\n')
                # SOURCE LINE 260
                __M_writer(
                    u'          </div>\n          <div class="toolFormBody">\n              '
                )
                # SOURCE LINE 262
                __M_writer(
                    unicode(
                        do_inputs(module.get_runtime_inputs(),
                                  step.state.inputs,
                                  errors.get(step.id, dict()), "", step)))
                __M_writer(u'\n          </div>\n      </div>\n')
        # SOURCE LINE 267
        __M_writer(
            u'<input type="submit" name="run_workflow" value="Run workflow" />\n</form>'
        )
        return ''
    finally:
        context.caller_stack._pop_frame()
예제 #3
0
def render_body(context, **pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        isinstance = context.get('isinstance', UNDEFINED)
        basestring = context.get('basestring', UNDEFINED)
        errors = context.get('errors', UNDEFINED)
        tuple = context.get('tuple', UNDEFINED)
        int = context.get('int', UNDEFINED)
        h = context.get('h', UNDEFINED)
        history_id = context.get('history_id', UNDEFINED)
        workflow = context.get('workflow', UNDEFINED)

        def do_inputs(inputs,
                      values,
                      errors,
                      prefix,
                      step,
                      other_values=None,
                      already_used=None):
            return render_do_inputs(context.locals_(__M_locals), inputs,
                                    values, errors, prefix, step, other_values,
                                    already_used)

        len = context.get('len', UNDEFINED)
        step_version_changes = context.get('step_version_changes', UNDEFINED)
        dict = context.get('dict', UNDEFINED)
        t = context.get('t', UNDEFINED)
        enumerate = context.get('enumerate', UNDEFINED)
        has_upgrade_messages = context.get('has_upgrade_messages', UNDEFINED)
        steps = context.get('steps', UNDEFINED)
        trans = context.get('trans', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n\n')
        # SOURCE LINE 243
        __M_writer(u'\n\n')
        # SOURCE LINE 298
        __M_writer(u'\n\n')
        # SOURCE LINE 300

        from galaxy.tools.parameters import DataToolParameter, RuntimeValue
        from galaxy.tools.parameters import DataCollectionToolParameter
        from galaxy.jobs.actions.post import ActionBox
        import re
        import colorsys
        import random

        used_accumulator = []

        wf_parms = {}
        for step in steps:
            for v in [
                    ActionBox.get_short_str(pja)
                    for pja in step.post_job_actions
            ] + step.state.inputs.values():
                if isinstance(v, basestring):
                    for rematch in re.findall('\$\{.+?\}', v):
                        if rematch[2:-1] not in wf_parms:
                            wf_parms[rematch[2:-1]] = ""
        if wf_parms:
            hue_offset = 1.0 / len(wf_parms)
            hue = 0.0
            for k in wf_parms.iterkeys():
                wf_parms[k] = "#%X%X%X" % tuple(
                    [int(x * 255) for x in colorsys.hsv_to_rgb(hue, .1, .9)])
                hue += hue_offset

        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(
            __M_dict_builtin([
                (__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in [
                    'hue', 'hue_offset', 'wf_parms', 'ActionBox',
                    'DataToolParameter', 'rematch', 'used_accumulator', 'k',
                    'random', 'pja', 're', 'step', 'RuntimeValue', 'colorsys',
                    'v', 'DataCollectionToolParameter', 'x'
                ] if __M_key in __M_locals_builtin_stored
            ]))
        # SOURCE LINE 323
        __M_writer(u'\n\n')
        # SOURCE LINE 365
        __M_writer(u'\n\n')
        # SOURCE LINE 470
        __M_writer(
            u'\n\n<div id=\'ec_button_container\'>\n    <span class="action-button" id="show_all_tool_body">Expand All</span>\n    <span class="action-button" id="hide_all_tool_body">Collapse</span>\n</div>\n\n<h2>Running workflow "'
        )
        # SOURCE LINE 477
        __M_writer(unicode(h.to_unicode(workflow.name)))
        __M_writer(u'"</h2>\n\n')
        # SOURCE LINE 479
        if has_upgrade_messages:
            # SOURCE LINE 480
            __M_writer(
                u'<div class="warningmessage">\n    Problems were encountered when loading this workflow, likely due to tool\n    version changes. Missing parameter values have been replaced with default.\n    Please review the parameter values below.\n</div>\n'
            )
            pass
        # SOURCE LINE 486
        __M_writer(u'\n')
        # SOURCE LINE 487
        if step_version_changes:
            # SOURCE LINE 488
            __M_writer(
                u'    <div class="infomessage">\n        The following tools are beinge executed with a different version from\n        what was available when this workflow was last saved because the\n        previous version is no longer available for use on this galaxy\n        instance.\n        To upgrade your workflow and dismiss this message simply edit the\n        workflow and re-save it to update the stored tool version.\n        <ul>\n'
            )
            # SOURCE LINE 496
            for vc in step_version_changes:
                # SOURCE LINE 497
                __M_writer(u'                <li>')
                __M_writer(unicode(vc))
                __M_writer(u'</li>\n')
                pass
            # SOURCE LINE 499
            __M_writer(u'        </ul>\n    </div>\n')
            pass
        # SOURCE LINE 502
        __M_writer(u'\n')
        # SOURCE LINE 503
        if workflow.annotation:
            # SOURCE LINE 504
            __M_writer(u'    <div class="workflow-annotation">')
            __M_writer(unicode(workflow.annotation))
            __M_writer(u'</div>\n    <hr/>\n')
            pass
        # SOURCE LINE 507
        __M_writer(u'\n<form id="tool_form" name="tool_form" method="POST">\n')
        # SOURCE LINE 510
        __M_writer(u'\n')
        # SOURCE LINE 511
        if wf_parms:
            # SOURCE LINE 512
            __M_writer(
                u'<div class="metadataForm">\n    <div class="metadataFormTitle">Workflow Parameters</div>\n    <div class="metadataFormBody">\n'
            )
            # SOURCE LINE 515
            for parm in wf_parms:
                # SOURCE LINE 516
                __M_writer(
                    u"        <div class='form-row'><label style='width:100px;'>"
                )
                __M_writer(unicode(parm))
                __M_writer(u'<input style="border:2px solid ')
                __M_writer(unicode(wf_parms[parm]))
                __M_writer(
                    u';border-left-width:8px;" type="text" class=\'wf_parm_input ptag_'
                )
                __M_writer(unicode(parm))
                __M_writer(u'\' name="wf_parm|')
                __M_writer(unicode(parm))
                __M_writer(u'" value=""/></label></div>\n')
                pass
            # SOURCE LINE 518
            __M_writer(
                u'    </div>\n</div>\n    <script type="text/javascript">\n    // Set the change hooks for workflow parameters.\n    $(document).ready(function () {\n        $(\'.wf_parm_input\').bind(\'change keypress keyup\', function(event){\n            // DBTODO This is probably not reliable.  Ensure we have the right class.\n            var new_text = $(this).val();\n            if (new_text === \'\'){\n                var tag_id = $(this).attr("class").split(\' \')[1].substring(5);\n                // Set text properly.\n                $(\'.wfpspan.wf_parm__\'+tag_id).text(tag_id);\n            }else{\n                var tag_id = $(this).attr("class").split(\' \')[1].substring(5);\n                // Set text properly.\n                $(\'.wfpspan.wf_parm__\'+tag_id).text(new_text);\n                // Now set the hidden input to the generated text.\n                $(\'.wfpspan.wf_parm__\'+tag_id).not(\'.pja_wfp\').each(function(){\n                    var new_text = $(this).parent().text();\n                    $(this).parent().siblings().children().val(new_text);\n                });\n            }\n        });\n    });\n    </script>\n'
            )
            pass
        # SOURCE LINE 544
        for i, step in enumerate(steps):
            # SOURCE LINE 545
            __M_writer(
                u'    <!-- Only way module would be missing is if tool is missing, but\n         that would cause missing_tools.mako to render instead of this\n         template. -->\n    '
            )
            # SOURCE LINE 548
            module = step.module

            __M_locals_builtin_stored = __M_locals_builtin()
            __M_locals.update(
                __M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key])
                                  for __M_key in ['module']
                                  if __M_key in __M_locals_builtin_stored]))
            __M_writer(u'\n    <input type="hidden" name="')
            # SOURCE LINE 549
            __M_writer(unicode(step.id))
            __M_writer(u'|tool_state" value="')
            __M_writer(unicode(module.encode_runtime_state(t, step.state)))
            __M_writer(u'">\n')
            # SOURCE LINE 550
            if step.type == 'tool' or step.type is None:
                # SOURCE LINE 551
                __M_writer(u'      ')

                tool = trans.app.toolbox.get_tool(step.tool_id)

                __M_locals_builtin_stored = __M_locals_builtin()
                __M_locals.update(
                    __M_dict_builtin([
                        (__M_key, __M_locals_builtin_stored[__M_key])
                        for __M_key in ['tool']
                        if __M_key in __M_locals_builtin_stored
                    ]))
                # SOURCE LINE 553
                __M_writer(
                    u'\n      <div class="toolForm">\n          <div class="toolFormTitle">\n              <span class=\'title_ul_text\'>Step '
                )
                # SOURCE LINE 556
                __M_writer(unicode(int(step.order_index) + 1))
                __M_writer(u': ')
                __M_writer(unicode(tool.name))
                __M_writer(u'</span>\n')
                # SOURCE LINE 557
                if tool.version:
                    # SOURCE LINE 558
                    __M_writer(u'                  (version ')
                    __M_writer(unicode(tool.version))
                    __M_writer(u')\n')
                    pass
                # SOURCE LINE 560
                if step.annotations:
                    # SOURCE LINE 561
                    __M_writer(
                        u'                <div class="step-annotation">')
                    __M_writer(
                        unicode(h.to_unicode(step.annotations[0].annotation)))
                    __M_writer(u'</div>\n')
                    pass
                # SOURCE LINE 563
                __M_writer(
                    u'          </div>\n          <div class="toolFormBody">\n                '
                )
                # SOURCE LINE 565
                __M_writer(
                    unicode(
                        do_inputs(tool.inputs, step.state.inputs,
                                  errors.get(step.id, dict()), "", step, None,
                                  used_accumulator)))
                __M_writer(u'\n')
                # SOURCE LINE 566
                if step.post_job_actions:
                    # SOURCE LINE 567
                    __M_writer(
                        u"                    <hr/>\n                    <div class='form-row'>\n"
                    )
                    # SOURCE LINE 569
                    if len(step.post_job_actions) > 1:
                        # SOURCE LINE 570
                        __M_writer(
                            u'                        <label>Actions:</label>\n'
                        )
                        # SOURCE LINE 571
                    else:
                        # SOURCE LINE 572
                        __M_writer(
                            u'                        <label>Action:</label>\n'
                        )
                        pass
                    # SOURCE LINE 574
                    __M_writer(u'                    ')

                    pja_ss_all = []
                    for pja_ss in [
                            ActionBox.get_short_str(pja)
                            for pja in step.post_job_actions
                    ]:
                        for rematch in re.findall('\$\{.+?\}', pja_ss):
                            pja_ss = pja_ss.replace(
                                rematch,
                                '<span style="background-color:%s" class="wfpspan wf_parm__%s pja_wfp">%s</span>'
                                % (wf_parms[rematch[2:-1]], rematch[2:-1],
                                   rematch[2:-1]))
                        pja_ss_all.append(pja_ss)

                    __M_locals_builtin_stored = __M_locals_builtin()
                    __M_locals.update(
                        __M_dict_builtin([
                            (__M_key, __M_locals_builtin_stored[__M_key])
                            for __M_key in
                            ['rematch', 'pja_ss_all', 'pja', 'pja_ss']
                            if __M_key in __M_locals_builtin_stored
                        ]))
                    # SOURCE LINE 580
                    __M_writer(u'\n                    ')
                    # SOURCE LINE 581
                    __M_writer(unicode('<br/>'.join(pja_ss_all)))
                    __M_writer(u'\n                    </div>\n')
                    pass
                # SOURCE LINE 584
                __M_writer(u'              </div>\n          </div>\n')
                # SOURCE LINE 586
            else:
                # SOURCE LINE 587
                __M_writer(
                    u'          <div class="toolForm">\n              <div class="toolFormTitle">\n                  <span class=\'title_ul_text\'>Step '
                )
                # SOURCE LINE 589
                __M_writer(unicode(int(step.order_index) + 1))
                __M_writer(u': ')
                __M_writer(unicode(module.name))
                __M_writer(u'</span>\n')
                # SOURCE LINE 590
                if step.annotations:
                    # SOURCE LINE 591
                    __M_writer(
                        u'                    <div class="step-annotation">')
                    __M_writer(unicode(step.annotations[0].annotation))
                    __M_writer(u'</div>\n')
                    pass
                # SOURCE LINE 593
                __M_writer(
                    u'          </div>\n          <div class="toolFormBody">\n              '
                )
                # SOURCE LINE 595

                # Filter possible inputs to data types that are valid for subsequent steps
                type_filter = []
                for oc in step.output_connections:
                    for ic in oc.input_step.module.get_data_inputs():
                        if 'extensions' in ic and ic['name'] == oc.input_name:
                            type_filter += ic['extensions']
                if not type_filter:
                    type_filter = ['data']

                __M_locals_builtin_stored = __M_locals_builtin()
                __M_locals.update(
                    __M_dict_builtin([
                        (__M_key, __M_locals_builtin_stored[__M_key])
                        for __M_key in ['ic', 'oc', 'type_filter']
                        if __M_key in __M_locals_builtin_stored
                    ]))
                # SOURCE LINE 604
                __M_writer(u'\n              ')
                # SOURCE LINE 605
                __M_writer(
                    unicode(
                        do_inputs(module.get_runtime_inputs(type_filter),
                                  step.state.inputs,
                                  errors.get(step.id, dict()), "", step, None,
                                  used_accumulator)))
                __M_writer(u'\n          </div>\n      </div>\n')
                pass
            pass
        # SOURCE LINE 610
        if history_id is None:
            # SOURCE LINE 611
            __M_writer(
                u'    <p id=\'new_history_p\'>\n        <input type="checkbox" name=\'new_history\' value="true" id=\'new_history_cbx\'/><label for=\'new_history_cbx\'>Send results to a new history </label>\n        <span id="new_history_input">named: <input type=\'text\' name=\'new_history_name\' value=\''
            )
            # SOURCE LINE 613
            __M_writer(
                filters.html_escape(unicode(h.to_unicode(workflow.name))))
            __M_writer(u"'/></span>\n    </p>\n")
            pass
        # SOURCE LINE 616
        __M_writer(
            u'<input type="submit" class="btn btn-primary" name="run_workflow" value="Run workflow" />\n</form>\n'
        )
        return ''
    finally:
        context.caller_stack._pop_frame()
def render_body(context,**pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        isinstance = context.get('isinstance', UNDEFINED)
        basestring = context.get('basestring', UNDEFINED)
        errors = context.get('errors', UNDEFINED)
        tuple = context.get('tuple', UNDEFINED)
        int = context.get('int', UNDEFINED)
        h = context.get('h', UNDEFINED)
        history_id = context.get('history_id', UNDEFINED)
        workflow = context.get('workflow', UNDEFINED)
        def do_inputs(inputs,values,errors,prefix,step,other_values=None,already_used=None):
            return render_do_inputs(context.locals_(__M_locals),inputs,values,errors,prefix,step,other_values,already_used)
        len = context.get('len', UNDEFINED)
        step_version_changes = context.get('step_version_changes', UNDEFINED)
        dict = context.get('dict', UNDEFINED)
        t = context.get('t', UNDEFINED)
        enumerate = context.get('enumerate', UNDEFINED)
        has_upgrade_messages = context.get('has_upgrade_messages', UNDEFINED)
        steps = context.get('steps', UNDEFINED)
        trans = context.get('trans', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n\n')
        # SOURCE LINE 243
        __M_writer(u'\n\n')
        # SOURCE LINE 298
        __M_writer(u'\n\n')
        # SOURCE LINE 300

        from galaxy.tools.parameters import DataToolParameter, RuntimeValue
        from galaxy.tools.parameters import DataCollectionToolParameter
        from galaxy.jobs.actions.post import ActionBox
        import re
        import colorsys
        import random
        
        used_accumulator = []
        
        wf_parms = {}
        for step in steps:
            for v in [ActionBox.get_short_str(pja) for pja in step.post_job_actions] + step.state.inputs.values():
                if isinstance(v, basestring):
                    for rematch in re.findall('\$\{.+?\}', v):
                        if rematch[2:-1] not in wf_parms:
                            wf_parms[rematch[2:-1]] = ""
        if wf_parms:
            hue_offset = 1.0 / len(wf_parms)
            hue = 0.0
            for k in wf_parms.iterkeys():
                wf_parms[k] = "#%X%X%X" % tuple([int(x * 255) for x in colorsys.hsv_to_rgb(hue, .1, .9)])
                hue += hue_offset
        
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['hue','hue_offset','wf_parms','ActionBox','DataToolParameter','rematch','used_accumulator','k','random','pja','re','step','RuntimeValue','colorsys','v','DataCollectionToolParameter','x'] if __M_key in __M_locals_builtin_stored]))
        # SOURCE LINE 323
        __M_writer(u'\n\n')
        # SOURCE LINE 365
        __M_writer(u'\n\n')
        # SOURCE LINE 470
        __M_writer(u'\n\n<div id=\'ec_button_container\'>\n    <span class="action-button" id="show_all_tool_body">Expand All</span>\n    <span class="action-button" id="hide_all_tool_body">Collapse</span>\n</div>\n\n<h2>Running workflow "')
        # SOURCE LINE 477
        __M_writer(unicode(h.to_unicode( workflow.name )))
        __M_writer(u'"</h2>\n\n')
        # SOURCE LINE 479
        if has_upgrade_messages:
            # SOURCE LINE 480
            __M_writer(u'<div class="warningmessage">\n    Problems were encountered when loading this workflow, likely due to tool\n    version changes. Missing parameter values have been replaced with default.\n    Please review the parameter values below.\n</div>\n')
            pass
        # SOURCE LINE 486
        __M_writer(u'\n')
        # SOURCE LINE 487
        if step_version_changes:
            # SOURCE LINE 488
            __M_writer(u'    <div class="infomessage">\n        The following tools are beinge executed with a different version from\n        what was available when this workflow was last saved because the\n        previous version is no longer available for use on this galaxy\n        instance.\n        To upgrade your workflow and dismiss this message simply edit the\n        workflow and re-save it to update the stored tool version.\n        <ul>\n')
            # SOURCE LINE 496
            for vc in step_version_changes:
                # SOURCE LINE 497
                __M_writer(u'                <li>')
                __M_writer(unicode(vc))
                __M_writer(u'</li>\n')
                pass
            # SOURCE LINE 499
            __M_writer(u'        </ul>\n    </div>\n')
            pass
        # SOURCE LINE 502
        __M_writer(u'\n')
        # SOURCE LINE 503
        if workflow.annotation:
            # SOURCE LINE 504
            __M_writer(u'    <div class="workflow-annotation">')
            __M_writer(unicode(workflow.annotation))
            __M_writer(u'</div>\n    <hr/>\n')
            pass
        # SOURCE LINE 507
        __M_writer(u'\n<form id="tool_form" name="tool_form" method="POST">\n')
        # SOURCE LINE 510
        __M_writer(u'\n')
        # SOURCE LINE 511
        if wf_parms:
            # SOURCE LINE 512
            __M_writer(u'<div class="metadataForm">\n    <div class="metadataFormTitle">Workflow Parameters</div>\n    <div class="metadataFormBody">\n')
            # SOURCE LINE 515
            for parm in wf_parms:
                # SOURCE LINE 516
                __M_writer(u"        <div class='form-row'><label style='width:100px;'>")
                __M_writer(unicode(parm))
                __M_writer(u'<input style="border:2px solid ')
                __M_writer(unicode(wf_parms[parm]))
                __M_writer(u';border-left-width:8px;" type="text" class=\'wf_parm_input ptag_')
                __M_writer(unicode(parm))
                __M_writer(u'\' name="wf_parm|')
                __M_writer(unicode(parm))
                __M_writer(u'" value=""/></label></div>\n')
                pass
            # SOURCE LINE 518
            __M_writer(u'    </div>\n</div>\n    <script type="text/javascript">\n    // Set the change hooks for workflow parameters.\n    $(document).ready(function () {\n        $(\'.wf_parm_input\').bind(\'change keypress keyup\', function(event){\n            // DBTODO This is probably not reliable.  Ensure we have the right class.\n            var new_text = $(this).val();\n            if (new_text === \'\'){\n                var tag_id = $(this).attr("class").split(\' \')[1].substring(5);\n                // Set text properly.\n                $(\'.wfpspan.wf_parm__\'+tag_id).text(tag_id);\n            }else{\n                var tag_id = $(this).attr("class").split(\' \')[1].substring(5);\n                // Set text properly.\n                $(\'.wfpspan.wf_parm__\'+tag_id).text(new_text);\n                // Now set the hidden input to the generated text.\n                $(\'.wfpspan.wf_parm__\'+tag_id).not(\'.pja_wfp\').each(function(){\n                    var new_text = $(this).parent().text();\n                    $(this).parent().siblings().children().val(new_text);\n                });\n            }\n        });\n    });\n    </script>\n')
            pass
        # SOURCE LINE 544
        for i, step in enumerate( steps ):
            # SOURCE LINE 545
            __M_writer(u'    <!-- Only way module would be missing is if tool is missing, but\n         that would cause missing_tools.mako to render instead of this\n         template. -->\n    ')
            # SOURCE LINE 548
            module = step.module 
            
            __M_locals_builtin_stored = __M_locals_builtin()
            __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['module'] if __M_key in __M_locals_builtin_stored]))
            __M_writer(u'\n    <input type="hidden" name="')
            # SOURCE LINE 549
            __M_writer(unicode(step.id))
            __M_writer(u'|tool_state" value="')
            __M_writer(unicode(module.encode_runtime_state( t, step.state )))
            __M_writer(u'">\n')
            # SOURCE LINE 550
            if step.type == 'tool' or step.type is None:
                # SOURCE LINE 551
                __M_writer(u'      ')

                tool = trans.app.toolbox.get_tool( step.tool_id )
                      
                
                __M_locals_builtin_stored = __M_locals_builtin()
                __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['tool'] if __M_key in __M_locals_builtin_stored]))
                # SOURCE LINE 553
                __M_writer(u'\n      <div class="toolForm">\n          <div class="toolFormTitle">\n              <span class=\'title_ul_text\'>Step ')
                # SOURCE LINE 556
                __M_writer(unicode(int(step.order_index)+1))
                __M_writer(u': ')
                __M_writer(unicode(tool.name))
                __M_writer(u'</span>\n')
                # SOURCE LINE 557
                if tool.version:
                    # SOURCE LINE 558
                    __M_writer(u'                  (version ')
                    __M_writer(unicode(tool.version))
                    __M_writer(u')\n')
                    pass
                # SOURCE LINE 560
                if step.annotations:
                    # SOURCE LINE 561
                    __M_writer(u'                <div class="step-annotation">')
                    __M_writer(unicode(h.to_unicode( step.annotations[0].annotation )))
                    __M_writer(u'</div>\n')
                    pass
                # SOURCE LINE 563
                __M_writer(u'          </div>\n          <div class="toolFormBody">\n                ')
                # SOURCE LINE 565
                __M_writer(unicode(do_inputs( tool.inputs, step.state.inputs, errors.get( step.id, dict() ), "", step, None, used_accumulator )))
                __M_writer(u'\n')
                # SOURCE LINE 566
                if step.post_job_actions:
                    # SOURCE LINE 567
                    __M_writer(u"                    <hr/>\n                    <div class='form-row'>\n")
                    # SOURCE LINE 569
                    if len(step.post_job_actions) > 1:
                        # SOURCE LINE 570
                        __M_writer(u'                        <label>Actions:</label>\n')
                        # SOURCE LINE 571
                    else:
                        # SOURCE LINE 572
                        __M_writer(u'                        <label>Action:</label>\n')
                        pass
                    # SOURCE LINE 574
                    __M_writer(u'                    ')

                    pja_ss_all = []
                    for pja_ss in [ActionBox.get_short_str(pja) for pja in step.post_job_actions]:
                        for rematch in re.findall('\$\{.+?\}', pja_ss):
                            pja_ss = pja_ss.replace(rematch, '<span style="background-color:%s" class="wfpspan wf_parm__%s pja_wfp">%s</span>' % (wf_parms[rematch[2:-1]], rematch[2:-1], rematch[2:-1]))
                        pja_ss_all.append(pja_ss)
                    
                    
                    __M_locals_builtin_stored = __M_locals_builtin()
                    __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['rematch','pja_ss_all','pja','pja_ss'] if __M_key in __M_locals_builtin_stored]))
                    # SOURCE LINE 580
                    __M_writer(u'\n                    ')
                    # SOURCE LINE 581
                    __M_writer(unicode('<br/>'.join(pja_ss_all)))
                    __M_writer(u'\n                    </div>\n')
                    pass
                # SOURCE LINE 584
                __M_writer(u'              </div>\n          </div>\n')
                # SOURCE LINE 586
            else:
                # SOURCE LINE 587
                __M_writer(u'          <div class="toolForm">\n              <div class="toolFormTitle">\n                  <span class=\'title_ul_text\'>Step ')
                # SOURCE LINE 589
                __M_writer(unicode(int(step.order_index)+1))
                __M_writer(u': ')
                __M_writer(unicode(module.name))
                __M_writer(u'</span>\n')
                # SOURCE LINE 590
                if step.annotations:
                    # SOURCE LINE 591
                    __M_writer(u'                    <div class="step-annotation">')
                    __M_writer(unicode(step.annotations[0].annotation))
                    __M_writer(u'</div>\n')
                    pass
                # SOURCE LINE 593
                __M_writer(u'          </div>\n          <div class="toolFormBody">\n              ')
                # SOURCE LINE 595

              # Filter possible inputs to data types that are valid for subsequent steps
                type_filter = []
                for oc in step.output_connections:
                    for ic in oc.input_step.module.get_data_inputs():
                        if 'extensions' in ic and ic['name'] == oc.input_name:
                            type_filter += ic['extensions']
                if not type_filter:
                    type_filter = ['data']
                
                
                __M_locals_builtin_stored = __M_locals_builtin()
                __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['ic','oc','type_filter'] if __M_key in __M_locals_builtin_stored]))
                # SOURCE LINE 604
                __M_writer(u'\n              ')
                # SOURCE LINE 605
                __M_writer(unicode(do_inputs( module.get_runtime_inputs(type_filter), step.state.inputs, errors.get( step.id, dict() ), "", step, None, used_accumulator )))
                __M_writer(u'\n          </div>\n      </div>\n')
                pass
            pass
        # SOURCE LINE 610
        if history_id is None:
            # SOURCE LINE 611
            __M_writer(u'    <p id=\'new_history_p\'>\n        <input type="checkbox" name=\'new_history\' value="true" id=\'new_history_cbx\'/><label for=\'new_history_cbx\'>Send results to a new history </label>\n        <span id="new_history_input">named: <input type=\'text\' name=\'new_history_name\' value=\'')
            # SOURCE LINE 613
            __M_writer(filters.html_escape(unicode( h.to_unicode( workflow.name ) )))
            __M_writer(u"'/></span>\n    </p>\n")
            pass
        # SOURCE LINE 616
        __M_writer(u'<input type="submit" class="btn btn-primary" name="run_workflow" value="Run workflow" />\n</form>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
예제 #5
0
 def _workflow_to_dict_run(self, trans, stored):
     """
     Builds workflow dictionary used by run workflow form
     """
     workflow = stored.latest_workflow
     if len(workflow.steps) == 0:
         raise exceptions.MessageException('Workflow cannot be run because it does not have any steps.')
     if attach_ordered_steps(workflow, workflow.steps):
         raise exceptions.MessageException('Workflow cannot be run because it contains cycles.')
     trans.workflow_building_mode = workflow_building_modes.USE_HISTORY
     module_injector = WorkflowModuleInjector(trans)
     has_upgrade_messages = False
     step_version_changes = []
     missing_tools = []
     errors = {}
     for step in workflow.steps:
         try:
             module_injector.inject(step, steps=workflow.steps, exact_tools=False)
         except exceptions.ToolMissingException:
             if step.tool_id not in missing_tools:
                 missing_tools.append(step.tool_id)
             continue
         if step.upgrade_messages:
             has_upgrade_messages = True
         if step.type == 'tool' or step.type is None:
             if step.module.version_changes:
                 step_version_changes.extend(step.module.version_changes)
             step_errors = step.module.get_errors()
             if step_errors:
                 errors[step.id] = step_errors
     if missing_tools:
         workflow.annotation = self.get_item_annotation_str(trans.sa_session, trans.user, workflow)
         raise exceptions.MessageException('Following tools missing: %s' % missing_tools)
     workflow.annotation = self.get_item_annotation_str(trans.sa_session, trans.user, workflow)
     step_order_indices = {}
     for step in workflow.steps:
         step_order_indices[step.id] = step.order_index
     step_models = []
     for i, step in enumerate(workflow.steps):
         step_model = None
         if step.type == 'tool':
             incoming = {}
             tool = trans.app.toolbox.get_tool(step.tool_id, tool_version=step.tool_version)
             params_to_incoming(incoming, tool.inputs, step.state.inputs, trans.app)
             step_model = tool.to_json(trans, incoming, workflow_building_mode=workflow_building_modes.USE_HISTORY)
             step_model['post_job_actions'] = [{
                 'short_str'         : ActionBox.get_short_str(pja),
                 'action_type'       : pja.action_type,
                 'output_name'       : pja.output_name,
                 'action_arguments'  : pja.action_arguments
             } for pja in step.post_job_actions]
         else:
             inputs = step.module.get_runtime_inputs(connections=step.output_connections)
             step_model = {
                 'inputs' : [input.to_dict(trans) for input in inputs.values()]
             }
         step_model['step_type'] = step.type
         step_model['step_label'] = step.label
         step_model['step_name'] = step.module.get_name()
         step_model['step_version'] = step.module.get_version()
         step_model['step_index'] = step.order_index
         step_model['output_connections'] = [{
             'input_step_index'  : step_order_indices.get(oc.input_step_id),
             'output_step_index' : step_order_indices.get(oc.output_step_id),
             'input_name'        : oc.input_name,
             'output_name'       : oc.output_name
         } for oc in step.output_connections]
         if step.annotations:
             step_model['annotation'] = step.annotations[0].annotation
         if step.upgrade_messages:
             step_model['messages'] = step.upgrade_messages
         step_models.append(step_model)
     return {
         'id': trans.app.security.encode_id(stored.id),
         'history_id': trans.app.security.encode_id(trans.history.id) if trans.history else None,
         'name': stored.name,
         'steps': step_models,
         'step_version_changes': step_version_changes,
         'has_upgrade_messages': has_upgrade_messages,
         'workflow_resource_parameters': self._workflow_resource_parameters(trans, stored, workflow),
     }
예제 #6
0
def render_body(context,**pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        basestring = context.get('basestring', UNDEFINED)
        errors = context.get('errors', UNDEFINED)
        tuple = context.get('tuple', UNDEFINED)
        int = context.get('int', UNDEFINED)
        h = context.get('h', UNDEFINED)
        app = context.get('app', UNDEFINED)
        workflow = context.get('workflow', UNDEFINED)
        def do_inputs(inputs,values,errors,prefix,step,other_values=None):
            return render_do_inputs(context.locals_(__M_locals),inputs,values,errors,prefix,step,other_values)
        len = context.get('len', UNDEFINED)
        dict = context.get('dict', UNDEFINED)
        t = context.get('t', UNDEFINED)
        enumerate = context.get('enumerate', UNDEFINED)
        has_upgrade_messages = context.get('has_upgrade_messages', UNDEFINED)
        steps = context.get('steps', UNDEFINED)
        isinstance = context.get('isinstance', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n\n')
        # SOURCE LINE 13
        __M_writer(u'\n\n')
        # SOURCE LINE 32
        __M_writer(u'\n\n')
        # SOURCE LINE 34

        from galaxy.tools.parameters import DataToolParameter, RuntimeValue
        from galaxy.jobs.actions.post import ActionBox
        import re
        import colorsys
        import random
        
        wf_parms = {}
        for step in steps:
            for v in step.state.inputs.itervalues():
                if isinstance(v, basestring):
                    for rematch in re.findall('\$\{.+?\}', v):
                        if rematch[2:-1] not in wf_parms:
                            wf_parms[rematch[2:-1]] = ""
        if wf_parms:
            hue_offset = 1.0 / len(wf_parms)
            hue = 0.0
            for k in wf_parms.iterkeys():
                wf_parms[k] = "#%X%X%X" % tuple([int(x * 255) for x in colorsys.hsv_to_rgb(hue, .1, .9)])
                hue += hue_offset
        
        
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin()[__M_key]) for __M_key in ['hue','hue_offset','wf_parms','ActionBox','DataToolParameter','rematch','k','random','re','step','RuntimeValue','colorsys','v','x'] if __M_key in __M_locals_builtin()]))
        # SOURCE LINE 54
        __M_writer(u'\n\n')
        # SOURCE LINE 91
        __M_writer(u'\n\n')
        # SOURCE LINE 163
        __M_writer(u'\n\n<h2>Running workflow "')
        # SOURCE LINE 165
        __M_writer(unicode(h.to_unicode( workflow.name )))
        __M_writer(u'"</h2>\n\n')
        # SOURCE LINE 167
        if has_upgrade_messages:
            # SOURCE LINE 168
            __M_writer(u'<div class="warningmessage">\n    Problems were encountered when loading this workflow, likely due to tool\n    version changes. Missing parameter values have been replaced with default.\n    Please review the parameter values below.\n</div>\n')
        # SOURCE LINE 174
        __M_writer(u'\n')
        # SOURCE LINE 175
        if workflow.annotation:
            # SOURCE LINE 176
            __M_writer(u'    <div class="workflow-annotation">Annotation: ')
            __M_writer(unicode(workflow.annotation))
            __M_writer(u'</div>\n    <hr/>\n')
        # SOURCE LINE 179
        __M_writer(u'\n<form id="tool_form" name="tool_form" method="POST">\n')
        # SOURCE LINE 182
        __M_writer(u'\n\n')
        # SOURCE LINE 184
        if wf_parms:
            # SOURCE LINE 185
            __M_writer(u'<div class="metadataForm">\n    <div class="metadataFormTitle">Workflow Parameters</div>\n    <div class="metadataFormBody">\n')
            # SOURCE LINE 188
            for parm in wf_parms:
                # SOURCE LINE 189
                __M_writer(u"        <div class='form-row'><label style='width:100px;'>")
                __M_writer(unicode(parm))
                __M_writer(u'<input style="border:2px solid ')
                __M_writer(unicode(wf_parms[parm]))
                __M_writer(u';border-left-width:8px;" type="text" class=\'wf_parm_input ptag_')
                __M_writer(unicode(parm))
                __M_writer(u'\' name="wf_parm|')
                __M_writer(unicode(parm))
                __M_writer(u'" value=""/></label></div>\n')
            # SOURCE LINE 191
            __M_writer(u'    </div>\n</div>\n    <script type="text/javascript">\n    // Set the change hooks for workflow parameters.\n    $(document).ready(function () {\n        $(\'.wf_parm_input\').bind(\'change keypress keyup\', function(event){\n            // DBTODO This is probably not reliable.  Ensure we have the right class.\n            var new_text = $(this).val();\n            if (new_text === \'\'){\n                var tag_id = $(this).attr("class").split(\' \')[1].substring(5);\n                // Set text properly.\n                $(\'.wfpspan.wf_parm__\'+tag_id).text(tag_id);\n            }else{\n                var tag_id = $(this).attr("class").split(\' \')[1].substring(5);\n                // Set text properly.\n                $(\'.wfpspan.wf_parm__\'+tag_id).text(new_text);\n                // Now set the hidden input to the generated text.\n                $(\'.wfpspan.wf_parm__\'+tag_id).not(\'.pja_wfp\').each(function(){\n                    // var new_text = $(this).parent().text();\n                    $(this).parent().siblings().children().val(new_text);\n                });\n            }\n        });\n    });\n    </script>\n')
        # SOURCE LINE 217
        __M_writer(u'\n')
        # SOURCE LINE 218
        for i, step in enumerate( steps ):
            # SOURCE LINE 219
            if step.type == 'tool' or step.type is None:
                # SOURCE LINE 220
                __M_writer(u'      ')
                tool = app.toolbox.tools_by_id[step.tool_id] 
                
                __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin()[__M_key]) for __M_key in ['tool'] if __M_key in __M_locals_builtin()]))
                __M_writer(u'\n      <input type="hidden" name="')
                # SOURCE LINE 221
                __M_writer(unicode(step.id))
                __M_writer(u'|tool_state" value="')
                __M_writer(unicode(step.state.encode( tool, app )))
                __M_writer(u'">\n      <div class="toolForm">\n          <div class="toolFormTitle">\n              Step ')
                # SOURCE LINE 224
                __M_writer(unicode(int(step.order_index)+1))
                __M_writer(u': ')
                __M_writer(unicode(tool.name))
                __M_writer(u'\n')
                # SOURCE LINE 225
                if step.annotations:
                    # SOURCE LINE 226
                    __M_writer(u'                <div class="step-annotation">Annotation: ')
                    __M_writer(unicode(h.to_unicode( step.annotations[0].annotation )))
                    __M_writer(u'</div>\n')
                # SOURCE LINE 228
                __M_writer(u'          </div>\n          <div class="toolFormBody">\n            ')
                # SOURCE LINE 230
                __M_writer(unicode(do_inputs( tool.inputs, step.state.inputs, errors.get( step.id, dict() ), "", step )))
                __M_writer(u'\n')
                # SOURCE LINE 231
                if step.post_job_actions:
                    # SOURCE LINE 232
                    __M_writer(u"                <hr/>\n                <div class='form-row'>\n")
                    # SOURCE LINE 234
                    if len(step.post_job_actions) > 1:
                        # SOURCE LINE 235
                        __M_writer(u'                    <label>Actions:</label>\n')
                        # SOURCE LINE 236
                    else:
                        # SOURCE LINE 237
                        __M_writer(u'                    <label>Action:</label>\n')
                    # SOURCE LINE 239

                    pja_ss_all = []
                    for pja_ss in [ActionBox.get_short_str(pja) for pja in step.post_job_actions]:
                        for rematch in re.findall('\$\{.+?\}', pja_ss):
                            pja_ss = pja_ss.replace(rematch, '<span style="background-color:%s" class="wfpspan wf_parm__%s pja_wfp">%s</span>' % (wf_parms[rematch[2:-1]], rematch[2:-1], rematch[2:-1]))
                        pja_ss_all.append(pja_ss)
                    
                    
                    __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin()[__M_key]) for __M_key in ['rematch','pja_ss_all','pja','pja_ss'] if __M_key in __M_locals_builtin()]))
                    # SOURCE LINE 245
                    __M_writer(u'\n                ')
                    # SOURCE LINE 246
                    __M_writer(unicode('<br/>'.join(pja_ss_all)))
                    __M_writer(u'\n                </div>\n')
                # SOURCE LINE 249
                __M_writer(u'          </div>\n      </div>\n')
                # SOURCE LINE 251
            else:
                # SOURCE LINE 252
                __M_writer(u'    ')
                module = step.module 
                
                __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin()[__M_key]) for __M_key in ['module'] if __M_key in __M_locals_builtin()]))
                __M_writer(u'\n      <input type="hidden" name="')
                # SOURCE LINE 253
                __M_writer(unicode(step.id))
                __M_writer(u'|tool_state" value="')
                __M_writer(unicode(module.encode_runtime_state( t, step.state )))
                __M_writer(u'">\n      <div class="toolForm">\n          <div class="toolFormTitle">\n              Step ')
                # SOURCE LINE 256
                __M_writer(unicode(int(step.order_index)+1))
                __M_writer(u': ')
                __M_writer(unicode(module.name))
                __M_writer(u'\n')
                # SOURCE LINE 257
                if step.annotations:
                    # SOURCE LINE 258
                    __M_writer(u'                <div class="step-annotation">Annotation: ')
                    __M_writer(unicode(step.annotations[0].annotation))
                    __M_writer(u'</div>\n')
                # SOURCE LINE 260
                __M_writer(u'          </div>\n          <div class="toolFormBody">\n              ')
                # SOURCE LINE 262
                __M_writer(unicode(do_inputs( module.get_runtime_inputs(), step.state.inputs, errors.get( step.id, dict() ), "", step )))
                __M_writer(u'\n          </div>\n      </div>\n')
        # SOURCE LINE 267
        __M_writer(u'<input type="submit" name="run_workflow" value="Run workflow" />\n</form>')
        return ''
    finally:
        context.caller_stack._pop_frame()