-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·68 lines (54 loc) · 2.18 KB
/
setup
File metadata and controls
executable file
·68 lines (54 loc) · 2.18 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
usage() {
cat <<EOF
================================================================================
setup
================================================================================
Purpose: Sets up the conda and renv environments for the scripts to run.
Also deletes possible unwanted SLURM directives.
Author: Sam Fletcher
Contact: s.o.fletcher@exeter.ac.uk
Dependencies: conda
================================================================================
EOF
exit 0
}
if [ "$#" -eq 0 ]; then usage; fi
config_file_location=$1
source "${config_file_location}" || { echo "could not find config file at:
${config_file_location}"; exit 1; }
## =========================== ##
## REMOVE SLURM DIRECITVES ##
## =========================== ##
script_list=$(find "${REPO_DIR}" -type f -name "*.sh")
echo "Do you want to remove SLURM directives associated with UoE's HPC?"
echo "(y/n)"
read -r delete_slurm_directives
if [[ "${delete_slurm_directives}" == "y" ]]; then
for file in $script_list; do
sed -i "s/#SBATCH -A Research_Project-MRC190311//g" "${file}"
sed -i "s/#SBATCH -p mrcq//g" "${file}"
done
fi
## ====================== ##
## CONDA ENVIRONMENTS ##
## ====================== ##
source "${CONDA_SHELL}" || { echo "Could not find conda shell at:
${CONDA_SHELL}"; exit 1; }
conda config --add channels bioconda
conda config --add channels conda-forge
conda config --add channels anaconda
conda create --name ChromBinarize-R --file "${REPO_DIR}/requirements-R.txt"
conda create --name ChromBinarize-bedtools --file "${REPO_DIR}/requirements-bedtools.txt"
conda activate ChromBinarize-R
## ==================== ##
## RENV ENVIRONMENT ##
## ==================== ##
# Loading an R script whilst in REPO_DIR will automatically download renv
# but only for that R session. The next R session will not have access to
# renv, resulting in errors. There is no renv environment in RSCRIPT_DIR so
# we execute the install packages function from there to avoid this.
cd "${RSCRIPT_DIR}" || exit 1
Rscript -e "install.packages('renv', repo='https://cloud.r-project.org')"
cd "${REPO_DIR}" || exit 1
Rscript -e "renv::restore(); library(fitdistrplus); print('success')"