python - 如何在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 - 在另一个页面上单击它的 ImageField 后,如何打开只有一个 django 模型对象信息的页面?
- javascript - 重新格式化内插字符串AngularJS
- ios - 将元素分配给另一个数组时崩溃
- python - 为什么 PyCharm 在终止时会尝试重新获取标准输入?
- google-chrome - 我可以仅对本地主机禁用 Chrome 密码检查吗?
- python - Python DTW包相关性和余弦距离不起作用
- sql - SQL - 根据列的值为变量分配来自不同列的值
- entity-framework-core - .NET Core Entity Framework Core:使用take时,如何获取totalrecords以及
- azure - Azure 部署组访问
- c# - 实体框架通用表达式有选择地隐藏属性