Skip to content

Commit

Permalink
Automatically determine DEseq2 threads based on Twitter note from Mik…
Browse files Browse the repository at this point in the history
…e Love.
  • Loading branch information
johanneskoester committed Oct 13, 2017
1 parent 39f55b9 commit 77e1c16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 0 additions & 3 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,3 @@ params:
star: ""
cutadapt-se: ""
cutadapt-pe: ""
deseq2:
# if you have many samples or conditions, you can use more than 1 thread here.
threads: 1
10 changes: 8 additions & 2 deletions rules/diffexp.smk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ rule count_matrix:
"../scripts/count-matrix.py"


def get_deseq2_threads(wildcards=None):
# https://twitter.com/mikelove/status/918770188568363008
few_coeffs = False if wildcards is None else len(get_contrast(wildcards)) < 10
return 1 if len(samples) < 100 or few_coeffs else 6


rule deseq2_init:
input:
counts="counts/all.tsv",
Expand All @@ -19,7 +25,7 @@ rule deseq2_init:
"../envs/deseq2.yaml"
log:
"logs/deseq2/init.log"
threads: config["params"]["deseq2"]["threads"]
threads: get_deseq2_threads(None)
script:
"../scripts/deseq2-init.R"

Expand Down Expand Up @@ -55,6 +61,6 @@ rule deseq2:
"../envs/deseq2.yaml"
log:
"logs/deseq2/{contrast}.diffexp.log"
threads: config["params"]["deseq2"]["threads"]
threads: get_deseq2_threads
script:
"../scripts/deseq2.R"

0 comments on commit 77e1c16

Please sign in to comment.