Questions tagged [snakemake]

Snakemake is a workflow management system with a Python-style specification language.

Snakemake is a workflow management system with a Python-style specification language.

1634 questions
3
votes
3 answers

how to quickly identify if a rule in Snakemake needs an input function

I'm following the snakemake tutorial on their documentation page and really got stuck on the concept of input functions https://snakemake.readthedocs.io/en/stable/tutorial/advanced.html#step-3-input-functions Basically they define a config.yaml as…
3
votes
0 answers

How do I set the default python version for conda envs in snakemake

I'm running an NGS pipeline that's supposedly intended to run on Python 3.6. I am getting some errors and warnings if I just run with Python 3.10. So, I am starting my snakefile from an conda env that has Python 3.6 installed. Anyway, if creating…
gernophil
  • 177
  • 2
  • 6
3
votes
1 answer

Invalid threads definition: entries have to be defined as RULE=THREADS pairs (with THREADS being a positive integer). Unparseable value

Did you notice that set-threads do not work with a recent version of snakemake? It looks long but you just have to copy/paste. Here is a MRE: mkdir snakemake-test && cd snakemake-test touch snakeFile mkdir profile && touch profile/config.yaml &&…
nicoluca
  • 105
  • 7
3
votes
2 answers

How to use a wildcard within expand function parameters in snakemake?

I have a json file like so: { "foo": { "bar1": {"A1": {"name": "A1", "path": "/path/to/A1"}, "B1": {"name": "B1", "path": "/path/to/B1"}, "C1": {"name": "C1", "path": "/path/to/C1"}, …
3
votes
1 answer

How to use pandas within snakemake pipelines

I would like to improve the reproducibility of some python codes I made by transforming some codes into a data pipeline. I am used to targets in R and would like to find an equivalent in Python. I have the impression that snakemake is quite close to…
linog
  • 5,786
  • 3
  • 14
  • 28
3
votes
2 answers

Snakemake on SLURM: retry attempt counter does not change

I have a workflow rule with varying time requirements for a slurm cluster. I decorated the workflow as per documentation to increase the slurm time limit for resubmitted jobs (my cluster config.yaml has the arg restart-times: 3), look for…
Brendy
  • 41
  • 4
3
votes
3 answers

Snakemake integrate the multiple command lines in a rule

The output of my first command line "bcftools query -l {input.invcf} | head -n 1" prints the name of the first individual of vcf file (i.e. IND1). I want to use that output in selectvariants GATK in -sn IND1 option. How is it possible to integrate…
user3224522
  • 1,119
  • 8
  • 19
3
votes
0 answers

Optional output files for snakemake?

Essentially, I am trying to make a snakemake rule for trimming for both paired-end and single-end reads. My problem is that for unpaired reads, there is 1 output, but for paired reads, there are 2 outputs (technically 4 but for my rule, I've…
Hannah
  • 51
  • 5
3
votes
1 answer

How to reference the output of a rule in snakemake

I was wondering if it is possible to use the output of a rule directly as the input of the next rule, without having to specify the path again. I thought maybe something like this would work, but it does not in my tests: rule A: input: …
nhaus
  • 786
  • 3
  • 13
3
votes
1 answer

Snakemake explicit handling for Out Of Memory (OOM) failures

A Snakemake workflow can re-attempt for each restart after any type of failure, including if the error is of an Out Of Memory (OOM) doing e.g. def get_mem_mb(wildcards, attempt): return attempt * 100 rule: input: ... output: ... …
pmb59
  • 31
  • 3
3
votes
0 answers

snakemake: WildcardError

this is a follow-up question to this one: snakemake: Missing input files for rule all I have changed my pipeline for variant calling; it now handles only the files for one single patient. It is supposed to find all samples in that patient's folder,…
OhWeh
  • 31
  • 2
3
votes
2 answers

Snakemake ignore failed path and redefine inputs for a common rule

I'm currently writing a pipeline that looks like this (code for the minimal example is below, the input files are just blank files which names are in the SAMPLES list in the example). What I would like, is, if a sample fails in one of the first two…
Plopp
  • 947
  • 8
  • 16
3
votes
2 answers

Snakemake help function

What's a good way to add a help function to my Snakemake pipeline to describe config parameter usage? I'm seeing this for printing rule docstrings, but I'm not sure if/how that can be used for config values.
amm
  • 81
  • 1
  • 3
3
votes
1 answer

How to implement splitting of files in snakemake when number of files is known

Context rule A uses the split command in a shell directive. The number of files generated by rule A depends on a user specified value from the config and is thus known. In this question there is a difference because the number of output files is…
RonaldN
  • 129
  • 8
3
votes
1 answer

Global variables in Snakemake rules

I'm creating a simple snakemake pipeline that contains global variables in the Snakefile. What's the recommended way to use these global variables in the Python scripts called in my rules? I'm currently using argparse command line arguments as…
amm
  • 81
  • 1
  • 3