Snakemake provides access to a workflow object within a Snakefile. This allows one to, for example, have dynamic programmatic access to the directory containing the Snakefile (via the workflow.basedir attribute). Is there a similar way to access the working directory that is specified on the command line using --directory?
Through a bit of exploration I was able to figure out that the workflow object has a workdir() method, but it appears this is used internally by Snakemake for registering working directories, not for access.
UPDATE: It looks like the working directory is stored internally as the _workdir attribute of the workflow object. However, this attribute is unset (default value None) when I'm creating static/global objects in the Snakefile. Is it impossible to access the working directory prior to building the workflow DAG?
--directoryuntil I tried it out. I guess it's an implementation detail but seems unlikely to me it'll change. – Jesse Aug 02 '19 at 21:47