Skip to content

Instantly share code, notes, and snippets.

@samesense
Last active August 2, 2020 20:55
Show Gist options
  • Save samesense/9be3bc76abee29b0720ec235511fa887 to your computer and use it in GitHub Desktop.
Save samesense/9be3bc76abee29b0720ec235511fa887 to your computer and use it in GitHub Desktop.
Dynamic rule for snakemake
def mk_rule(in_file, out_file, tmp_snake='tmp_snake.py'):
'''input is single file
output is single file
'''
with open(tmp_snake, 'w') as f:
rule_str = f"""rule auto:
input:
'{in_file}'
output:
'{out_file}'
shell:
'touch {{output}}'"""
print(rule_str, file=f)
return tmp_snake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment