'Custom patterns with snakemake's paramspace
Is it possible to use a custom wildcard_pattern and instance_patterns with snakemake.utils.Paramspace?
Example:
Say the Paramspace looks like this
import snakemake
import pandas as pd
df = pd.DataFrame([
["default","2030"],
["default","2050"],
], columns=["scenario","year"])
paramspace = snakemake.utils.Paramspace(df)
Then the wildcard_pattern and instance_pattern look like this
print(paramsapce.wildcard_pattern)
# 'scenario~{scenario}/year~{year}'
print(list(paramspace.instance_patterns))
# ['scenario~default/year~2030', 'scenario~default/year~2050']
What I want to do is have both patterns without the name of the wildcard prepended, i.e. I would like it to look like this:
print(paramsapce.wildcard_pattern)
# '{scenario}/{year}'
print(list(paramspace.instance_patterns))
# ['default/2030', 'default/2050']
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
