Skip to content

Instantly share code, notes, and snippets.

@explodecomputer
Created September 9, 2021 11:53
Show Gist options
  • Save explodecomputer/468ca341ed40262a82d58364bb1b975a to your computer and use it in GitHub Desktop.
Save explodecomputer/468ca341ed40262a82d58364bb1b975a to your computer and use it in GitHub Desktop.
Snakefile example
CHUNKSIZE=250
NCHUNK=864
CHUNK=range(0,NCHUNK)
rule all:
input:
"instrument_specificity_analysis.html"
rule dl:
output:
"../data/ld/AFR.bed"
shell:
"mkdir -p ../data/ld; cd ../data/ld; wget http://fileserve.mrcieu.ac.uk/ld/1kg.v3.tgz; tar xzvf 1kg.v3.tgz"
rule ld:
input:
"../data/ld/AFR.bed"
output:
"../data/ld/maps.rdata"
shell:
"Rscript generate_ld.r"
rule instrument_specificity:
input:
"../data/ld/maps.rdata",
"instrument_specificity.r"
output:
"../results/instrument_specificity/{CHUNK}.rdata"
shell:
"Rscript instrument_specificity.r {wildcards.CHUNK} {CHUNKSIZE}"
rule aggregate:
input:
expand("../results/instrument_specificity/{CHUNK}.rdata", CHUNK=CHUNK)
output:
"../results/instrument_specificity.rdata"
shell:
"Rscript instrument_specificity_aggregate.r {NCHUNK}"
rule analysis:
input:
"../results/instrument_specificity.rdata",
"instrument_specificity_analysis.rmd"
output:
"instrument_specificity_analysis.html"
shell:
"Rscript -e 'rmarkdown::render(\"instrument_specificity_analysis.rmd\")'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment