Reputation: 968
I'm wondering how to manage paths in my Snakefiles. Say I have this configuration:
current_dir
current_dir/snakefiles
current_dir/configfiles
and I execute my workflows this way:
current_dir$ snakemake -s snakefiles/my_snakefile --configfile configfiles/my_config.yml
I know I can get the path to my Snakefile using the global variable workflow.snakefile
, but I would like to get also:
current_dir
How to achieve this? Are there other global variables in Snakemake, that I'm not aware of?
Thank you
Upvotes: 2
Views: 3761
Reputation: 1947
The working directory is set via Python. You can get it with os.getcwd()
. Also please note that there is a canonical way to organize Snakemake workflows: http://snakemake.readthedocs.io/en/latest/project_info/faq.html#what-is-the-recommended-way-to-distribute-a-snakemake-workflow.
While you can of course use something else, following this scheme helps others to understand your workflow. There might of course be cases where this does not fit.
Upvotes: 6