-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·44 lines (35 loc) · 1.1 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
function set_script_dir() {
local ORIG_DIR="$(pwd)" || return 1
local REL_SCRIPT_DIR="$(dirname ${BASH_SOURCE[0]})" || return 1
cd "${REL_SCRIPT_DIR}" || return 1
SCRIPT_DIR="$(pwd)" || return 1
cd "${ORIG_DIR}" || return 1
}
function install_r_package() {
Rscript install_package.R || return 1
}
function install_conda() {
conda create --prefix "${CONDA_ENV_PREFIX}" || return 1
conda activate "${CONDA_ENV_PREFIX}" || return 1
conda install -c conda-forge -c bioconda --file \
"${SCRIPT_DIR}/conda_requirements.txt" || return 1
install_r_package || return 1
conda deactivate || return 1
}
function write_config_paths() {
echo "conda_wrapper: '${SCRIPT_DIR}/conda_wrapper'" \
>> "${SCRIPT_DIR}/snakemake_config.yaml" || return 1
echo "scripts_dir: '${SCRIPT_DIR}/aux_scripts'" \
>> "${SCRIPT_DIR}/snakemake_config.yaml" || return 1
}
function install() {
install_conda || return 1
write_config_paths || return 1
}
function main() {
set_script_dir || return 1
source "${SCRIPT_DIR}/set_env_vars.sh" || return 1
install || return 1
}
main "$@"