Closed irm-codebase closed 2 months ago
I'm going to close this issue, since it was caused by not understanding how snakemake
handles remote files (although admittedly it's quite hard to find this in the documentation). The docs are in need of some heavy rework.
Basically, you need to use the workflow.source_path("resources/some-file.txt")
command, which will look for files relative to the current .smk
file you are writing in.
snakemake
developers recommended to place small resource files that your workflow will need on this location:
.
├── config
├── LICENSE
├── README.md
├── results
└── workflow
├── envs
├── profiles
├── resources <-------- here!
├── rules
├── schemas
├── scripts
└── Snakefile
This bug is based on the following documentation text about
modules
:Snakemake version 8.18
Describe the bug
Files in the
resources/
folder are not adequately delivered alongside remotemodules
called using thegithub()
function.Following the recommended file structure, assume I call a file in
resources/
within my workflow.I am interpreting the documentation as "you should be able to read small files located in the
resources/
folder" when importing a workflow as amodule:
.This currently is not possible, as trying get the file located in the
resources/
folder of this workflow will fail if you call this workflow throughgithub()
. Basically,snakemake
does not deliver these files viagit
, meaning either the documentation should be made clearer, or there is a bug in the code.Logs
The following is returned. Essentially, the file does not exist.
Minimal example Create a
Snakefile
with the following:Then attempt
snakemake --use-conda -c 1 module-transport/results/electrified-transport.csv
Please use python>= 3.12, as there are other issues with 3.11 in snakemake (unrelated to this issue)
Additional context
I just want my workflow to work :')