I have a sample rule defined as:
#!/usr/bin/env python
def test(path):
print(path)test(snakemake.input[0])
A config.yml like:
executor: slurm
jobs: 100
samples: “config/samples.csv”
And a Snakefile like:
import os
import glob
import pandas as pdconfigfile: “config/config.yml”
rule get_samples:
resources:
mem_mb = 512
threads: 1
input: config[“samples”]
output: “out/sampleFASTQs.csv”
shell: “scripts/getFASTQs.py”
When I run snakemake –cores 1 I get the following error:
Building DAG of jobs…
Using shell: /usr/bin/bash
Provided cores: 1 (use –cores to define parallelism)
Rules claiming more threads will be scaled down.
Job stats:
job count min threads max threads
get_samples 1 1 1
total 1 1 1Select jobs to execute…
[Wed May 15 05:36:05 2024]
rule get_samples:
input: config/samples.csv
output: out/sampleFASTQs.csv
jobid: 0
reason: Missing output files: out/sampleFASTQs.csv
resources: tmpdir=/tmp, mem_mb=512, mem_mib=489Traceback (most recent call last):
File “[redacted]/tools/snakemake/scrnaseq/workflow/scripts/getFASTQs.py”, line 6, in
test(snakemake.input[0])
NameError: name ‘snakemake’ is not defined
[Wed May 15 05:36:05 2024]
Error in rule get_samples:
jobid: 0
input: config/samples.csv
output: out/sampleFASTQs.csv
shell:
scripts/getFASTQs.py
(one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: .snakemake/log/2024-05-15T053604.329295.snakemake.log
I can’t find this error pretty much anywhere and don’t understand why snakemake is not defined in the python environment automatically. Any help would be greatly appreciated.
user25056150 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.