Beispiel #1
0
def prepare_run_instructions_input_file(tool: Tool, user_inps: dict,
                                        other_inps: dict,
                                        reference_information: str):
    yaml_user_inps = CwlTranslator.stringify_translated_inputs(user_inps)
    yaml_other_inps = CwlTranslator.stringify_translated_inputs(other_inps)
    indented_user = "".join(" " * 7 + s
                            for s in yaml_user_inps.splitlines(True))
    indented_other = "".join(" " * 7 + s
                             for s in yaml_other_inps.splitlines(True))

    not_localising_secondary_warning = ""
    if isinstance(tool, WorkflowBase):
        inputs_that_arent_localising_secondary_files = [
            t.id() for t in tool.tool_inputs()
            if t.doc.skip_sourcing_secondary_files
        ]
        if len(inputs_that_arent_localising_secondary_files) > 0:
            not_localising_secondary_warning = f"""\
.. warning::

   The secondary files for the inputs '{"', '".join(inputs_that_arent_localising_secondary_files)}' will not automatically \
   localise using janis prepare and are built just after download. Please note this can take a few hours to build \
   before the pipeline runs. 
"""

    has_static = len(other_inps) > 0

    tb = " " * 4
    run_args = ["janis run [...run options]", tb + "--inputs inputs.yaml"]

    static_generation = ("" if not has_static else f"""\
   # static inputs
   janis inputs --static {tool.id()} > static.yaml""")
    static_yaml = ("" if not has_static else f"""\
**static.yaml**

.. code-block:: yaml

{indented_other}""")
    if has_static:
        run_args.append(tb + "--inputs static.yaml")

    if isinstance(tool, CommandTool) and not tool.container():
        run_args.append(
            tb +
            f"--container-override '{tool.id()}=<organisation/container:version>'"
        )

    run_args.append(tb + tool.id())
    run_statement = " \\\n".join(" " * 3 + el for el in run_args)

    if reference_information:
        reference_information = f"The following inputs have a suggested source. Using janis prepare with the relevant \
        ``--source-hint`` will automatically download these files. See `below <#additional-configuration-inputs>`_ for \
        more information about inputs for {tool.id()}.\n{reference_information}"

    return f"""\
Beispiel #2
0
def prepare_run_instructions_input_file(tool: Tool, user_inps: dict,
                                        other_inps: dict,
                                        reference_information: str):
    yaml_user_inps = CwlTranslator.stringify_translated_inputs(user_inps)
    yaml_other_inps = CwlTranslator.stringify_translated_inputs(other_inps)
    indented_user = "".join(" " * 7 + s
                            for s in yaml_user_inps.splitlines(True))
    indented_other = "".join(" " * 7 + s
                             for s in yaml_other_inps.splitlines(True))

    has_static = len(other_inps) > 0

    tb = " " * 4
    run_args = ["janis run [...run options]", tb + "--inputs inputs.yaml"]

    static_generation = ("" if not has_static else f"""\
   # static inputs
   janis inputs --static {tool.id()} > static.yaml""")
    static_yaml = ("" if not has_static else f"""\
**static.yaml**

.. code-block:: yaml

{indented_other}""")
    if has_static:
        run_args.append(tb + "--inputs static.yaml")

    if isinstance(tool, CommandTool) and not tool.container():
        run_args.append(
            tb +
            f"--container-override '{tool.id()}=<organisation/container:version>'"
        )

    run_args.append(tb + tool.id())
    run_statement = " \\\n".join(" " * 3 + el for el in run_args)

    return f"""\