Move R path to install_dependencies

This commit is contained in:
2024-08-04 21:38:33 -04:00
parent 9250b1b335
commit b77f459692

View File

@@ -508,24 +508,6 @@ interactive_header() {
fi fi
echo "" echo ""
# Ask to make our custom R library the default
if [[ -z $R_LIBS_USER || $R_LIBS_USER != "$HOME/R/$SCRIPT_NAME" ]]; then
echo "This script uses a local R library at $HOME/R/$SCRIPT_NAME"
echo "You can install the R dependencies to this library using the install_dependencies module"
if ((YES)) || ask "Would you like to make this R library the default for your user?"; then
line="export R_LIBS_USER=$HOME/R/$SCRIPT_NAME"
if ! grep -qF "$line" ~/.bashrc; then
echo "Adding $line to your .bashrc"
echo "If you use a different shell, update your R_LIBS_USER environment variable accordingly"
echo "$line" >> ~/.bashrc
fi
fi
declare -gx R_LIBS_USER="$HOME/R/$SCRIPT_NAME"
else
debug "R_LIBS_USER already set to $HOME/R/$SCRIPT_NAME"
fi
echo ""
# Let user choose or add project(s) # Let user choose or add project(s)
if [[ ${#PROJECTS[@]} -eq 0 ]]; then if [[ ${#PROJECTS[@]} -eq 0 ]]; then
num=$((${#projects[@]})) num=$((${#projects[@]}))
@@ -533,11 +515,10 @@ interactive_header() {
ask_pn && PROJECTS+=("${ADD_PROJECTS[@]}") ask_pn && PROJECTS+=("${ADD_PROJECTS[@]}")
else else
for ((c=1; c<2; c++)); do # safe loop that only runs once for ((c=1; c<2; c++)); do # safe loop that only runs once
echo
cat <<-EOF cat <<-EOF
Enter project number(s) to analyze: ${underline}Enter project number(s) to analyze${nounderline}
* <Enter> for the latest project ($num) (default) * <Enter> for the latest project (default)
* A comma-separated list of project numbers (2,5,12) * A comma-separated list of project numbers: 2,5,12
* 0 to add a new project * 0 to add a new project
EOF EOF
((YES)) || read -r -p "($num): " response ((YES)) || read -r -p "($num): " response
@@ -730,6 +711,23 @@ install_dependencies() {
"$RSCRIPT" -e "BiocManager::install(\"$d\", lib=\"$R_LIBS_USER\")" "$RSCRIPT" -e "BiocManager::install(\"$d\", lib=\"$R_LIBS_USER\")"
done done
# Ask to make our custom R library the default
if [[ $R_LIBS_USER == "$HOME/R/$SCRIPT_NAME" ]]; then
line="export R_LIBS_USER=$R_LIBS_USER"
if ! grep -qF "$line" "$HOME/.bashrc"; then
echo "This script uses a local R library at $HOME/R/$SCRIPT_NAME"
echo "You can install the R dependencies to this library using the install_dependencies module"
fi
if ((YES)) || ask "Would you like to make this R library the default for your user?"; then
echo "Adding $line to your .bashrc"
echo "If you use a different shell, update your R_LIBS_USER environment variable accordingly"
echo "$line" >> ~/.bashrc
fi
else
debug "R_LIBS_USER is set to a custom path"
fi
echo ""
hash "$MATLAB" &>/dev/null || echo "You will also need MATLAB installed for GUI modules" hash "$MATLAB" &>/dev/null || echo "You will also need MATLAB installed for GUI modules"
} }