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
4
votes
1 answer

Snakemake: dependencies which are not input

I'd like to know if there is a way in Snakemake to define a dependency which is actually not an input file. What I mean by that is that there are programs that expect some files to exists while there are not provided on the command line. Let's…
user378147
4
votes
1 answer

snakemake: how to deal with variable number of output from a rule

I want to run bcl2fastq to generate fastq files from bcl format. Depending on the sequencing set up with respect to sequencing mode and how many indexes were used, it can generate either read1,read2,index1 or read1,read2,index1,index2, etc. What I…
olala
  • 4,146
  • 9
  • 34
  • 44
4
votes
2 answers

Snakemake: name rule instead of target file

Here is a short example from the advanced section of snakemake tutorial: rule bwa_map: input: "data/genome.fa", lambda wildcards: config["samples"][wildcards.sample] output: "mapped_reads/{sample}.bam" threads: 8 shell: "bwa mem -t…
user378147
4
votes
1 answer

Why does setting `wildcard_constraints` in a snakefile prevent the deletion of files marked `temp`?

Consider the following snakefile: NUMS = ["1", "2"] #wildcard_constraints: # num="\d+" rule all: input: "all_text.txt" rule generate_text: output: text_file = temp("text_{num}.txt") shell: """ echo…
bli
  • 7,549
  • 7
  • 48
  • 94
4
votes
1 answer

Process multiple directories and all files within using snakemake

I've got a directory with 10 sub-directories (dir01 to dir10) and a number of files in each of those (new files are added every day to the sub-directories). I'm trying to write a snakemake file that will go through all of the sub-directories and all…
VickiT05
  • 101
  • 2
  • 10
3
votes
1 answer

How to make Snakemake wildcard work for empty string?

I expected Snakemake to allow wildcards to be empty strings, alas, this isn't the case. How can I make a wildcard accept an empty string?
Cornelius Roemer
  • 3,772
  • 1
  • 24
  • 55
3
votes
2 answers

Run short python code directly on snakemake

I have a snakemake pipeline where I need to do a small step of processing the data (applying a rolling average to a dataframe). I would like to write something like this: rule average_df: input: # script = , df_raw =…
Ulises Rey
  • 75
  • 8
3
votes
0 answers

Snakemake cannot activate an existing conda environment

I understood from the Snakemake docs that the conda directive can take the name of an existing conda environment. However, I am faced with the error EnvironmentNameNotFound: Could not find conda environment. Why can Snakemake not find the existing…
3
votes
1 answer

Add version to pipeline

Is there any standard or recommended way to add a version number to a pipeline (written in snakemake in my case)? For example, I have this pipeline and just now I added a CHANGELOG.md file with the current version on top. Are there better ways to…
dariober
  • 8,240
  • 3
  • 30
  • 47
3
votes
2 answers

snakemake - dynamically set log for each rule

I'd like to set the log file (log directive) for each of the workflow rules dynamically, so it contains the rule name. I tried to use the set_log() function like I do with set_params(), but am getting a cryptic error. Here is what I tried: logs_dir…
soungalo
  • 1,106
  • 2
  • 19
  • 34
3
votes
1 answer

Snakemake expand using dictionary values

I have a dictionary with keys as patient IDs and a list of fastq files as values. patient_samples = { "patientA": ["sample1", "sample2", "sample3"], "patientB": ["sample1", "sample4", "sample5", "sample6"] } I want to align each sample.fastq…
3
votes
1 answer

Snakemake Salsa2 CreateCondaEnvironmentException with python 2.7. and openssl

I´m trying to integrate Salsa2 into my workflow. Since this tool runs on python 2.7 I definitely want to create a separate conda environment for this purpose. My yaml file looks like this: channels: - conda-forge - anaconda -…
snakelake
  • 139
  • 5
3
votes
2 answers

Logging Snakemake's own console output - how to change what file Snakemake logs to?

I'm trying to save Snakemake's own console output (not the logs generated by the individual jobs) to an arbitrary file while still having it written to stdout/stderr. (Unfortunately, my setup means I can't just use tee.) It looks to me like…
KeyboardCat
  • 442
  • 3
  • 12
3
votes
1 answer

Snakemake input and output according to a dictionary

I am trying to rename some files in the snakemake pipeline. Let's say I have three files: "FileA.txt", "FileB.txt", "FileC.txt" and I want them renamed according to a dictionary dict = {"A": "0", "B": "1", "C": "2"} to get "RenamedFile0.txt",…
zzabaa
  • 86
  • 5
3
votes
1 answer

A way to iterate over one rule by changing an index in the filename using wildcards (in snakemake)

I am attempting to create an iterative rule in snakemake. I have an empty text file in data/ called basic_0. I am hoping to apply a rule to it "x" times (where "x" is an integer) by calling $ snakemake data/basic_.txt --cores 1, where the…
jabbo12
  • 31
  • 1