是否可以在 Snakemake 文件的所有规则中传递一组(多个)通配符?
所以,由于我是 Snakemake 的新手,我不确定我是否完全理解它,所以尽我最大的努力以我理解的方式。我正在尝试运行我的规则,该规则实际上使用另一个不同的规则,并根据其输出创建一组新文件。然而,这两个有不同的通配符,这就带来了麻烦。
configfile: "config.yaml"
include: "rules/rule_with_query.smk"
rule all:
expand(rules.query_hail.output, id=config['listID'], conf=config['confs'])
rule all
实际上不接受多个通配符。然而,我的规则需要两个,因为前一个规则使用 confs
,当前规则需要 id
。
这是我的规则:
def get_query_fName(wildcards):
return config["listID"][wildcards.listID]
rule query_hail:
input:
rules.prev_rule.output
params:
config['id1_or_id2']
output:
"file_with_data{id}.tsv"
script:
"../scripts/script_for_data.py"
因此,如果我同时尝试两个通配符(我放置第二个的通配符)将不起作用。我还尝试将它们放在方括号中,即作为列表,但这也不起作用。
expand(rules.query_hail.output, [conf=config['conf'], idlocus=config['listID']])
那么我应该怎么做,我应该如何调用通配符以便我的规则起作用?
So, as I am new at Snakemake I'm not sure whether I am fully getting it, so trying my best the way I understand it. I am trying to run my rule, which actually uses another different rule and based on its output creates a new set of files. However, those two have different wildcards and here comes trouble.
configfile: "config.yaml"
include: "rules/rule_with_query.smk"
rule all:
expand(rules.query_hail.output, id=config['listID'], conf=config['confs'])
The rule all
actually doesn't accept several wildcards. However my rule needs two, as there the previous rule, which uses confs
and the current one requiring id
.
Here's my rule:
def get_query_fName(wildcards):
return config["listID"][wildcards.listID]
rule query_hail:
input:
rules.prev_rule.output
params:
config['id1_or_id2']
output:
"file_with_data{id}.tsv"
script:
"../scripts/script_for_data.py"
So, if I try two wildcards at the same time either (the one I put the second) won't work. I have also tried to put them in square brackets, i.e. as a list, but that doesn't work either.
expand(rules.query_hail.output, [conf=config['conf'], idlocus=config['listID']])
What should I do then, how should I call wildcards so my rule will work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于
conf
不在query_hail
的输出中,Snakemake 不知道如何处理它 -expand
本质上相当于对于 listID 中的所有 id 和confs 中的所有conf。
conf
无处可去。如果仅编写
rule all
as不起作用,您可能需要更多内容来确保可以从
query_hail
推断出prev_rule
中的通配符。Since
conf
isn't in the output ofquery_hail
, Snakemake doesn't know what to do with it - thatexpand
is essentially the equivalent offor all ids in listID and all confs in confs. There's nowhere for that
conf
to go.If just writing
rule all
asdoesn't work, you may need something more to make sure the wildcards in
prev_rule
can be inferred fromquery_hail
.