interactions.R refactor

This commit is contained in:
2024-08-19 03:15:29 -04:00
parent 46f1e4d4d4
commit a300484ceb
4 changed files with 287 additions and 3791 deletions

34
workflow/.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,34 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"bierner.markdown-preview-github-styles",
"davidanson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"eamodio.gitlens",
"github.remotehub",
"github.vscode-pull-request-github",
"koppt.vscode-view-in-browser",
"mathworks.language-matlab",
"ms-python.debugpy",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode-remote.remote-ssh",
"ms-vscode.remote-explorer",
"ms-vscode.remote-repositories",
"redhat.java",
"redhat.vscode-yaml",
"reditorsupport.r",
"rogalmic.bash-debug",
"streetsidesoftware.code-spell-checker",
"timonwong.shellcheck",
"yzhang.markdown-all-in-one"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [
]
}

50
workflow/.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,50 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "R-Debugger",
"request": "attach",
"name": "Attach to R process",
"splitOverwrittenOutput": true
},
{
"type": "R-Debugger",
"name": "Launch R-Workspace",
"request": "launch",
"debugMode": "workspace",
"workingDirectory": "${workspaceFolder}"
},
{
"type": "R-Debugger",
"name": "Debug R-File",
"request": "launch",
"debugMode": "file",
"workingDirectory": "${fileFolder}",
"file": "${file}",
},
{
"type": "R-Debugger",
"name": "Debug R-Function",
"request": "launch",
"debugMode": "function",
"workingDirectory": "${workspaceFolder}",
"file": "${file}",
"mainFunction": "main",
"allowGlobalDebugging": false
},
{
"type": "R-Debugger",
"name": "Debug R-Package",
"request": "launch",
"debugMode": "workspace",
"workingDirectory": "${workspaceFolder}",
"includePackageScopes": true,
"loadPackages": [
"."
]
}
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -209,7 +209,12 @@ parse_input() {
# @section Modules # @section Modules
# @description # @description
# #
# A module contains a cohesive set of actions/experiments to run on a project # A module contains a cohesive set of tasks, including:
#
# * Filesystem operations
# * Variable setting
# * Executing other modules
# * Executing wrappers
# #
# Use a module to: # Use a module to:
# #
@@ -217,8 +222,7 @@ parse_input() {
# * Generate project directories # * Generate project directories
# * Group multiple wrappers (and modules) into a larger task # * Group multiple wrappers (and modules) into a larger task
# * Dictate the ordering of multiple wrappers # * Dictate the ordering of multiple wrappers
# * Competently handle pushd and popd for their wrappers if they do not reside in the SCANS/PROJECT_DIR # * Call wrappers with the appropriate arguments
# * Call their wrappers with the appropriate arguments
# #
# @description # @description
module() { module() {
@@ -580,7 +584,6 @@ interactive_header() {
unset response arr i unset response arr i
done done
fi fi
echo ""
# Project selection # Project selection
if [[ ${#PROJECTS[@]} -eq 0 ]]; then if [[ ${#PROJECTS[@]} -eq 0 ]]; then
@@ -685,7 +688,7 @@ install_dependencies() {
depends_r=( depends_r=(
BiocManager ontologyIndex ggrepel tidyverse sos openxlsx ggplot2 BiocManager ontologyIndex ggrepel tidyverse sos openxlsx ggplot2
plyr extrafont gridExtra gplots stringr plotly ggthemes pandoc plyr extrafont gridExtra gplots stringr plotly ggthemes pandoc
rmarkdown plotly htmlwidgets gplots gdata) rmarkdown plotly htmlwidgets gplots gdata Hmisc)
depends_bioc=(UCSC.utils org.Sc.sgd.db) depends_bioc=(UCSC.utils org.Sc.sgd.db)
[[ $1 == "--get-depends" ]] && return 0 # if we just want to read the depends vars [[ $1 == "--get-depends" ]] && return 0 # if we just want to read the depends vars
@@ -693,6 +696,7 @@ install_dependencies() {
# Install system-wide dependencies # Install system-wide dependencies
echo "Installing system dependencies" echo "Installing system dependencies"
echo "You may be prompted for your sudo password to install packages using your system package manager" echo "You may be prompted for your sudo password to install packages using your system package manager"
echo "If you do not have sudo access, you may want to use toolbox"
case "$(uname -s)" in case "$(uname -s)" in
Linux*|CYGWIN*|MINGW*) Linux*|CYGWIN*|MINGW*)
if hash dnf &>/dev/null; then if hash dnf &>/dev/null; then
@@ -1360,9 +1364,9 @@ qhtcp() {
# Run R interactions script on all studies # Run R interactions script on all studies
for study in "${STUDIES[@]}"; do for study in "${STUDIES[@]}"; do
read -r num sd _ <<< "$study" read -r num sd _ <<< "$study"
r_interactions "$num" "$sd" & # run in parallel, catch with wait below r_interactions "$num" "$sd" &
done \ done
&& wait -n \ wait -n \
&& remc \ && remc \
&& gtf \ && gtf \
&& gta && gta
@@ -1790,7 +1794,7 @@ r_join_interactions() {
"${1:-$QHTCP_RESULTS_DIR}/parameters.csv" "${1:-$QHTCP_RESULTS_DIR}/parameters.csv"
) )
((DEBUG)) && declare -p # ((DEBUG)) && declare -p # for when the going gets tough
backup "${out_files[@]}" backup "${out_files[@]}"
@@ -2368,6 +2372,10 @@ main() {
fi fi
done done
# If module equals install_dependencies run install_dependencies
declare -gx R_LIBS_USER=${R_LIBS_USER:-"$HOME/R/$SCRIPT_NAME"}
[[ ${MODULES[*]} == "install_dependencies" ]] && install_dependencies
# Loop over projects # Loop over projects
for PROJECT_NAME in "${PROJECTS[@]}"; do for PROJECT_NAME in "${PROJECTS[@]}"; do
declare -gx PROJECT_NAME declare -gx PROJECT_NAME
@@ -2383,7 +2391,6 @@ main() {
declare -gx EASY_RESULTS_DIR="$EASY_OUT_DIR/$PROJECT_PREFIX" declare -gx EASY_RESULTS_DIR="$EASY_OUT_DIR/$PROJECT_PREFIX"
declare -gx GTA_OUT_DIR="$QHTCP_RESULTS_DIR/gta" declare -gx GTA_OUT_DIR="$QHTCP_RESULTS_DIR/gta"
declare -gx GTF_OUT_DIR="$QHTCP_RESULTS_DIR/gtf" declare -gx GTF_OUT_DIR="$QHTCP_RESULTS_DIR/gtf"
declare -gx R_LIBS_USER=${R_LIBS_USER:-"$HOME/R/$SCRIPT_NAME"}
# ((DEBUG)) && declare -p # for when the going gets rough # ((DEBUG)) && declare -p # for when the going gets rough
debug "Project: $PROJECT_NAME" debug "Project: $PROJECT_NAME"