python - 如何在 snakemake 中引用规则的输出

标签 python workflow snakemake

我想知道是否可以将一个规则的输出直接用作下一个规则的输入,而不必再次指定路径。

我想也许这样的事情会奏效,但在我的测试中没有:

rule A:
    input:
         in_file = "path/to/in_file"

    output:
          out_file = "path/to/out_file"
    shell:
       "...."

rule B:
    input:
         in_file = A.output.out_file # reference the output of rule A doesnt work like this
         # in_file = "path/to/out_file" -> this works but is less elegant i think

    output:
          out_file = "path/to/out_file"
    shell:
       "...."

感谢任何帮助或见解!

干杯!

最佳答案

也许这就是您正在寻找的语法:

rule B:
    input:
         in_file = rules.A.output.out_file,
    ...

虽然我更喜欢硬编码文件名,因为它使脚本更具可读性。

关于python - 如何在 snakemake 中引用规则的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69709227/

相关文章:

python - Celery+Django -- KeyError 未注册任务

python - 如何调试 scrapy 管道?

python - 使用异步事件实现状态引擎的正确方法是什么?

bash - awk 命令在 snakemake --use-singularity 中失败

python - 使用snakemake从多个文件夹移动和重命名文件

python - MD任务为 `snakemake`

python - 从数据帧中的字符串中提取浮点值

python - 如何在 Ruby 中模拟 Python 的命名 printf 参数?

python - 了解 apache Airflow 中的 TreeView

php - 随着项目变大,我的工作效率正在下降。随着项目规模的增加,如何提高生产力?