Why is Snakemake introducing whitespaces in my path to submodules?

67 Views Asked by At

I have a workflow with modules that uses conda and singularity.

Problem

When I try to run the workflow with snakemake -c 8 --use-conda --use-singularity (Snakemake 7.32.4), I get the following error:

WorkflowError in file /home/user/src/project/workflow/Snakefile, line 33:
Failed to open source file /home/user/src/project/workflow/  workflows/ extract /  Snakefile
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/src/project/workflow/  workflows/ extract /  Snakefile '
  File "/home/user/src/project/workflow/Snakefile", line 33, in <module>

Question

Why do I get this error, when

  1. The f-strings for the extract module are correct, and
  2. the file ../workflow/workflows/extract/Snakefile does actually exist?

Setup

I run the whole affair from within a Miniforge3 conda env on Ubuntu 22.04.3 LTS within WSL2.

name: project
channels:
  - bioconda
  - conda-forge
dependencies:
  - snakemake=7.32.4
  - singularityce

The Snakefile in ../workflow/ includes the following relevant snippets:

MODULES_ROOT = "workflows/"

EXTRACT = "extract"
MODULE_EXTRACT = f"{MODULES_ROOT}{EXTRACT}/"
module extract:
    snakefile:
        f"{MODULE_EXTRACT}Snakefile"
    config: config[EXTRACT]

use rule * from extract as extract_*

What I tried (to no avail)

  • lsd and catd the Snakefiles and checked correctness of spelling
  • Rewrote the f-strings
  • Updated Snakemake from an older version to the one described above
  • Removed and re-created the conda environment
1

There are 1 best solutions below

1
On BEST ANSWER

I think it is related to the fstring! Once I remove all the f string it works.

These are the environments I am using
(base) [hsher@tscc-11-15 oligoCLIP]$ python --version
Python 3.12.0
(base) [hsher@tscc-11-15 oligoCLIP]$ snakemake --version
7.32.4