Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add section on using lambda for params #165

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/reference/snakemake-style-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,16 @@ global variable. 3 ways are supported, but only 2 should be used:
3. ``config.get(key)``: Never use this. All use cases should be covered
by (1) and (2). Using this will only mask errors that may be due to a
missing required key.

Use lambda on ``params`` that may have ``{`` or ``}`` in the value
==================================================================

If the value passed to a param contains curly braces, Snakemake will attempt to
resolve it as a wildcard. To keep the value as-is, `use a lambda expression <https://github.com/snakemake/snakemake/issues/2166#issuecomment-1464202922>`__.

Example:

.. code-block:: python

params:
key=lambda w: config["value_may_contain_curlies"]