Add clean rule and packrat snakemake file

replace/ff5ca7398c91833ef26c79fe161f5838435f8c3a
JulioV 2019-12-18 00:28:23 -05:00
parent dbc26f9853
commit c411f99cc6
2 changed files with 25 additions and 21 deletions

View File

@ -1,4 +1,5 @@
configfile: "config.yaml"
include: "rules/packrat.snakefile"
include: "rules/preprocessing.snakefile"
include: "rules/features.snakefile"
include: "rules/reports.snakefile"
@ -37,25 +38,6 @@ rule all:
expand("reports/figures/{pid}/compliance_heatmap.html", pid=config["PIDS"]),
expand("reports/figures/{pid}/battery_consumption_rates_barchart.html", pid=config["PIDS"]),
# --- Packrat Rules --- #
## Taken from https://github.com/lachlandeer/snakemake-econ-r
## packrat_install: installs packrat onto machine
rule packrat_install:
rule clean:
shell:
"R -e 'install.packages(\"packrat\", repos=\"http://cran.us.r-project.org\")'"
## packrat_install: initialize a packrat environment for this project
rule packrat_init:
shell:
"R -e 'packrat::init()'"
## packrat_snap : Look for new R packages in files & archives them
rule packrat_snap:
shell:
"R -e 'packrat::snapshot()'"
## packrat_restore: Installs archived packages onto a new machine
rule packrat_restore:
shell:
"R -e 'packrat::restore()'"
"rm -rf data/raw/* && rm -rf data/interim/* && rm -rf data/processed/* && rm -rf reports/figures/* && rm -rf reports/*.zip"

View File

@ -0,0 +1,22 @@
# --- Packrat Rules --- #
## Taken from https://github.com/lachlandeer/snakemake-econ-r
## packrat_install: installs packrat onto machine
rule packrat_install:
shell:
"R -e 'install.packages(\"packrat\", repos=\"http://cran.us.r-project.org\")'"
## packrat_install: initialize a packrat environment for this project
rule packrat_init:
shell:
"R -e 'packrat::init()'"
## packrat_snap : Look for new R packages in files & archives them
rule packrat_snap:
shell:
"R -e 'packrat::snapshot()'"
## packrat_restore: Installs archived packages onto a new machine
rule packrat_restore:
shell:
"R -e 'packrat::restore()'"