Snakemake输出具有扩展和不同数量的参数

问题描述 投票:0回答:1

我在snakemake中有此规则:

    output:
        RESULTS + folderdestination + "/{feats}/{edges}/{labels}/predictions_{e}_{n}_{h}_run{r}.csv"
        dir=directory(RESULTS + folderdestination + "/{feats}/{edges}/{labels}/")

我需要传递另一个规则,只需传递文件夹:

    dir=directory(RESULTS + folderdestination + "/{feats}/{edges}/{labels}/")

但是使用的通配符数量不同,snakemake不允许我使用第二条语句,因为它产生了相同的规则

Not all output, log and benchmark files of rule analysis contain the same wildcards. This is crucial though, in order to avoid that two or more jobs write to the same file.

是否有任何方法可以以snakemake的方式“提取”文件夹,而无需重新编写程序代码?谢谢

directory wildcard snakemake
1个回答
0
投票

对于所有可能面临相同问题的人们。经过一些测试,我通过创建一个虚拟的“中间件”规则来做到这一点。所以第一个规则是:

 output:
        RESULTS + folderdestination + "/{feats}/{edges}/{labels}/predictions_{e}_{n}_{h}_run{r}.csv"

[featsedgeslabelsenhr上的扩展调用。

然后在下面,我用选择性扩展创建了这个虚拟规则,该扩展接受刚创建的文件并仅返回文件夹:

rule dummy:
    input:
        expand(RESULTS + folderdt + "/{{feats}}/{{edges}}/{{labels}}/predictions_{e}_{n}_{h}_run{r}.csv",  e=e, n=n, h=h, r=r),
    output:
        RESULTS + folderdt + "/{feats}/{edges}/{labels}/",

最后,我得到的规则将在虚拟规则中创建的输出文件夹作为输入:

rule summary:
    input:
        folder=RESULTS + folderdt +"/{feats}/{edges}/{labels}/"
    output:
        file=RESULTS + folderdt +"/{feats}/{edges}/{labels}/summary.csv"
© www.soinside.com 2019 - 2024. All rights reserved.