#!/bin/bash

# load config dirs from config.yaml
BIN_DIR=`python -c 'import yaml,os.path;f=open("config.yaml");print(os.path.expanduser(yaml.safe_load(f)["bin_dir"]));f.close()'`
N_CORES=`python -c 'import yaml;f=open("config.yaml");print(yaml.safe_load(f)["n_cores"]);f.close()'`
MAX_RAM=`python -c 'import yaml;f=open("config.yaml");print(yaml.safe_load(f)["max_ram"]);f.close()'`

# execute snakemake on this machine with specified resources
snakemake --timestamp --rerun-incomplete --keep-going \
	--jobs $N_CORES --resources mem=$MAX_RAM \
	-s $BIN_DIR/pipes/ref_assisted/Snakefile \
	"$@"
