执行一个规则,通配符是通过规则中的参数获取的。

huangapple go评论51阅读模式
英文:

execute a rule that the wildcard is obtained via the params in the rule

问题

我有一个包含通配符的规则,通配符是从参数中获取的(由函数决定)。是否可以通过名称调用这个单个规则,例如,通过调用 snakemake a 来运行它?

rule a:
    input: file1, file2
    output: directory(1), directory("2/{domain}.txt")
    params:
        domain_cat = lambda wc, input: pd.read_csv(input[1], index_col=0).loc[wc.domain, "cat"]
    shell:
        """
        example.py {input} {output} {params.domain_cat}
        """
英文:

I have a rule that contains a wildcard that is taken from the params (decided by a function). Is it possible to run this single rule by calling it by name, e.g., snakemake a

rule a:
    input: file1, file2
    output: directory(1), directory("2/{domain}.txt")
    params:
        domain_cat = lambda wc, input: pd.read_csv(input[1], index_col=0).loc[wc.domain, "cat"]
    shell:
        """
        example.py {input} {output} {params.domain_cat}"
        """

答案1

得分: 1

如果规则包含通配符,就不能再通过名称调用它来运行。snakemake 需要知道通配符的值,这通过文件名传递。

英文:

No. If a rule contains a wildcard, you can no longer run it by calling it by name. snakemake needs to know the value for the wildcard, which is passed through the filename.

huangapple
  • 本文由 发表于 2023年1月9日 06:38:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75051780.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定