简体   繁体   English

Snakemake,“ lambda通配符,尝试,线程”麻烦

[英]Snakemake, trouble with “lambda wildcards, attempt, threads”

I was using snakemake to implement a new tool in a pipeline and i had some trouble with those lines: 我正在使用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)
    )

the error is : 错误是:

TypeError: <lambda>() missing 1 required positional argument: 'threads'
Wildcards:
sample=test_GATK
genome=fakefile

To make those lines i used the documentation on this page : snakemake documentation 为了使这些行,我使用了此页面上的文档: snakemake文档

To fix this issue i use this code instead: 要解决此问题,我改用以下代码:

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"])
    )

I don't know why the previous one is not working, can you help me figure it out ? 我不知道为什么前一个不起作用,您能帮我解决一下吗?

Thanks for the help :) 谢谢您的帮助 :)

My reading of the docs is that callable requires 4 parameters and you supply 3 out of order. 我对文档的阅读是,callable需要4个参数,而您却提供了3个乱序。

Maybe make a lambda with 4 args? 也许用4个参数组成一个lambda? If it where mot an init file, I would also say - make a function instead of a lambda and then 3 keyword args can fit. 如果它位于初始化文件的位置,我也要说-制作一个函数而不是lambda,然后可以使用3个关键字args。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM