Reputation: 1070
Is there a way to access the name of the snakefile that is being run with snakemake? It seems to be accessible by parsing sys.argv, but I'm wondering if there is a variable available that includes environmental information like that?
Upvotes: 1
Views: 145
Reputation: 1103
Within a snakefile, you can access the full path of the snakefile being used via workflow.snakefile
. The workflow
object exposes other invocation information; you can explore the full range of attributes and methods via print(dir(workflow))
(within a snakefile).
If you want just the filename of the Snakefile
, you can parse it out with os.path.basename()
:
import os
print(os.path.basename(workflow.snakefile))
Upvotes: 4