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

Parallelizing snakemake rule

Sorry if this is a naive question, but I'm still trying to wrap my head around the intricacies of Snakemake. I have a directory containing a number of files that I want to apply a rule to in parallel (i.e. I want to submit the same script to the…
bdevil
  • 185
  • 1
  • 12
4
votes
2 answers

Snakemake: Avoid removing output files before executing the shell command

Is there a possibility to avoid that the output files defined in a snakemake rule are deleted before executing the shell command? I found a description of this behaviour here:…
SarahH
  • 43
  • 4
4
votes
1 answer

How to set threads based on number of cores available?

I have a workflow that runs on different machines with different numbers of CPUs, and I'd like to be able to setup a rule that uses "all but N" cores. I.e. I'd like to be able to do: threads: lambda cores: max(2, cores-4) But I cannot find any way…
tfenne
  • 63
  • 3
4
votes
1 answer

Snakemake one wildcard and also expand

Is it possible to have a snakemake with a wildcard and expand: rule a: input: "input/{first}.txt", expand("data/{second}.txt", second=A_LIST) output: expand("output/{first}_{second}, second=A_LIST)
Parsa
  • 3,054
  • 3
  • 19
  • 35
4
votes
2 answers

How to keep the snakemake shell file while running in cluster

While running my snakemake file in cluster I keep getting an error, snakemake -j 20 --cluster "qsub -o out.txt -e err.txt -q debug" -s seadragon/scripts/viral_hisat.snake --config json="" output="" Now this gives me the…
Hirak Sarkar
  • 125
  • 8
4
votes
3 answers

Snakemake: How do I use a function that takes in a wildcard and returns a value?

I have cram(bam) files that I want to split by read group. This requires reading the header and extracting the read group ids. I have this function which does that in my Snakemake file: def identify_read_groups(cram_file): import subprocess …
David M
  • 149
  • 1
  • 9
4
votes
5 answers

How to perform simple string operations in snakemake output

I am creating my first snakemake file, and I got to the point where I need to perform a simple string operation on the value of my output, so that my shell command works as expected: rule sketch: input: 'out/genomes.txt' output: …
mgalardini
  • 1,397
  • 2
  • 16
  • 30
4
votes
1 answer

Use of argparse in Snakemake script

Is it possible to pass custom command line arguments to snakemake scripts? I have tried, but executing Snakefile with argparse results in error snakemake: error: unrecognized arguments: -zz. Below is an example script. import argparse def…
4
votes
2 answers

snakemake wildcards or expand command

I want a rule to perform realignment between normal and tumor. The main problem is I don't know how to manage that problem. Is it the wildcard or the expand the answer to my problem? This is my list of samples: conditions: pair1: tumor:…
mau_who
  • 315
  • 2
  • 13
4
votes
1 answer

Thread.py error snakemake

I am trying to run a simple one-rule snakemake file as following: resources_dir='resources' rule downloadReference: output: fa = resources_dir+'/human_g1k_v37.fasta', fai = resources_dir+'/human_g1k_v37.fasta.fai', shell: …
Masih
  • 920
  • 2
  • 19
  • 36
4
votes
1 answer

MissinOutputException in snakemake

I'm planning to move my bioinformatics pipeline into snakemake as my current pipeline is a collection of multiple scripts that are increasingly hard to follow. On the basis of tutorials and documentation, snakemake seems to be very clear and…
Jokhe
  • 77
  • 1
  • 7
4
votes
1 answer

Using pyenv in a snakemake rule

I am using snakemake for a long and complicated pipeline which involves some externally written python2 scripts. When I try to specify python2 with pyenv, pyenv shell command fails while pyenv global and pyenv local have no effect. I have two…
rbrisk
  • 306
  • 1
  • 7
4
votes
1 answer

Subprocess: Can't convert '_io.BufferedReader' object to str implicitly

I am working on writing a script which is a combination of snakemake and python code to automate a large number of files that comes in pair. More precisely, I am working on aligning reads with BWA MEM with paired end reads…
Zen
  • 41
  • 1
  • 5
4
votes
1 answer

Snakemake best practice for demultiplexing

I have a question about best practices. Specifically, about the best snakemake pattern for demultiplexing reads from illumina sequencing. Our workflow needs to demultiplex multiple lanes of sequencing, and then combine these in a single analysis.…
kdmurrray91
  • 365
  • 1
  • 8
4
votes
4 answers

snakemake: is there a way to specify an output directory for each rule?

The scripts I used all put the output files to the current directory where the script was called so in my shell script pipeline I would have cd commands to go to a particular directory to run commands and output files will just be saved in relevant…
olala
  • 4,146
  • 9
  • 34
  • 44