Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accessing mem_mb from resources in params #3271

Open
jd3234 opened this issue Jan 24, 2025 · 0 comments
Open

accessing mem_mb from resources in params #3271

jd3234 opened this issue Jan 24, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@jd3234
Copy link

jd3234 commented Jan 24, 2025

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)
@jd3234 jd3234 added the bug Something isn't working label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant