For my workflow, the scripts & snakefile are in a different directory than the output files. I specify the latter using the workdir
directive, which seems to work fine.
Now in some cases there are static input files in other directories, whose paths I want to specify relative to the snakefile. According to the documentation, I should use workflow.get_source("path/relative/to/snakefile")
. However this gives me
'Workflow' object has no attribute 'get_source'. Do I need some additional imports?
Looking at the documentation, it looks like what's used in the code example is workflow.source_path("path/relative/to/snakefile")
rather than get_source
- you can give that a try.
Otherwise, though I don't think it's officially documented, workflow.basedir
gives you the path of the directory the Snakefile lives in, and you can build the rest of the path off that.