Skip to content

accessing mem_mb from resources in params #3271

@jd3234

Description

@jd3234

Maybe this is not a bug but a wanted change in behavior in v8.

Snakemake version

  • 8.27.1

Describe the bug
I started to move my pipelines from v7 to v8. In one of my rules I am accessing mem_mb from resources in params to calculate Gb -> Mb (stored in params.mem_gb). This worked so far without problems but now I am running into an error. I will first post my rule and then the error (log).

Any idea how to solve this? Thanks!

Rule

rule make_ref_dict:
    message: "Create a GATK ref dictionary."
    input:
        reference = rules.reference.output.reference
    output:
        dict = REFERENCE_PREFIX + '.dict'
    resources:
        mem_mb =  lambda wildcards, attempt: attempt * 2000,
        cpus_per_task = 1
    params:
        mem_gb = lambda wildcards, resources: int(resources.mem_mb / 1000)
    shell:
        """
           picard -Xmx{params.mem_gb}g CreateSequenceDictionary -R {input.reference} -O {output.dict}
        """

Logs

Building DAG of jobs...
InputFunctionException in rule variant-qc.make_ref_dict in file snakefile.smk, line 109:
Error:
  TypeError: __int__ returned non-int (type TBDString)
Wildcards:

Traceback:
  File "snakefile.smk", line 124, in <lambda> (rule variant-qc.make_ref_dict, line 153, snakefile.smk)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions