I want to use a function on params.
Snakemake:
def mitico(x):
res =int(x)+1
return res
I I have a wildcard {sample} that are integer. And I want to use {sample}+1 How can do this inside the snakemake params?
In the function:
rule create_pt:
input:
read="CALL2/{sample}.vcf",
output:
out="OUT/{sample}.txt
conda:
"envs/mb.yml"
params:
db_ens = "/mnt/mpwor2k/",
fst = "/Homo_sapiens.GRCh37.75.dna.primary_assembly.fa",
tumor_id="{sample}",
normal_id=lambda wildcards: mitico('{sample}')
shell:
I have this error
ValueError: invalid literal for int() with base 10: '{sample}'
Wildcards:
sample=432
{sample}
in your lambda function is just a string and not wildcard. This is how to use wildcard in lambda