snakemake:指定由glob_wildcard获得的文件
如何指定glob_wildcards
获得的文件?
假设我有sample1.txt,sample2.txt,sample3.txt和sample4.txt在同一目录中。
以下代码只是一个示例:
FILES = glob_wildcards("data/{sample}.txt")
SAMPLES = FILES.sample
rule all:
input:
expand("{sample}txt", sample=SAMPLES),
"concat.txt"
rule concat:
input:
SAMPLES[0],
SAMPLES[1]
output:
"concat.txt"
shell:
"cat {input[0]} {input[1]} > {output}"
当我要concat sample1.txt和sample2.txt时,如rule concat
中所示,如何指定这些文件?编写样本[0]
和样本[1]
是正确的吗?
How can I specify the file obtained by glob_wildcards
?
Suppose I have sample1.txt, sample2.txt, sample3.txt, and sample4.txt are in the same directory.
The following code is just an example:
FILES = glob_wildcards("data/{sample}.txt")
SAMPLES = FILES.sample
rule all:
input:
expand("{sample}txt", sample=SAMPLES),
"concat.txt"
rule concat:
input:
SAMPLES[0],
SAMPLES[1]
output:
"concat.txt"
shell:
"cat {input[0]} {input[1]} > {output}"
When I want to concat sample1.txt and sample2.txt as shown in rule concat
, how can I specify those files? Is it correct to write SAMPLES[0]
and SAMPLES[1]
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您几乎是正确的,除非请记住,
glob_wildcards
将仅返回通配符值,因此,当在规则中引用文件时,您需要将这些通配符值提供为特定的文件路径。为了保持一致性,您可以继续使用
expliving()
:You are almost correct, except keep in mind that
glob_wildcards
will return only the wildcard values, so when referencing files in rules you will need to provide these wildcard values into the specific file path.For consistency, you can continue using
expand()
: