First, here is a test example (Snakefile):
rule test:
input:"path/file1", "path/file2"
output:"path/file3"
shell:
"""
awk 'NR==FNR{score[$3]=$5;next}{{sum=0}for(i=$2;i<=$3;i++){sum+=score[i]}printf "%-10s\\t%-10s\\n",sum,$4}' {input[0]} {input[1]} >> {output}
"""
When I run this script, it returns NameError: The name 'score' is unknown in this context. Please make sure that you defined that variable. Also note that braces not used for variable access have to be escaped by repeating them, i.e. {{print $1}}, I have tried to {score} or replicate {}, but all doesn't work. So, I want to know how to solve this quetion. Thanks.