我正在使用snakemake在管道中实现新工具,但在这些代码行上遇到了一些麻烦:
resources:
# Samtools sort requires by default 768M per threads
# Here, be set the maximum amount of memory are 1.5Go per threads
mem_mb = (
lambda wildcards, attempt, threads: min(
attempt * 250 + threads * 768,
1536 * threads)
)
错误是:
TypeError: <lambda>() missing 1 required positional argument: 'threads'
Wildcards:
sample=test_GATK
genome=fakefile
为了使这些行,我使用了此页面上的文档: snakemake documentation
要解决此问题,我改用以下代码:
resources:
# Samtools sort requires by default 768M per threads
# Here, be set the maximum amount of memory are 1.5Go per threads
mem_mb = (
lambda wildcards, attempt: min(
attempt * 250 + config["threads"] * 768,
1536 * config["threads"])
)
我不知道为什么前一个不起作用,您能帮我解决一下吗?
感谢您的帮助:)
答案 0 :(得分:0)
我对文档的阅读是,callable需要4个参数,而您却提供了3个乱序。
也许用4个参数组成一个lambda?如果它位于初始化文件的位置,我也要说-制作一个函数而不是lambda,然后可以使用3个关键字args。