Rollup for java clustering
This commit is contained in:
@@ -348,14 +348,11 @@ backup() {
|
||||
debug "Running: ${FUNCNAME[0]} $*"
|
||||
for f in "$@"; do
|
||||
[[ -e $f ]] || continue
|
||||
count=1
|
||||
declare count=1
|
||||
while [[ -e $f.bk.$count ]]; do
|
||||
((count++))
|
||||
done
|
||||
echo "Backing up $f to $f.bk.$count"
|
||||
debug "rsync -a $f $f.bk.$count"
|
||||
rsync -a "$f" "$f.bk.$count" &&
|
||||
rm -rf "$f"
|
||||
execute mv "$f" "$f.bk.$count"
|
||||
done
|
||||
}
|
||||
|
||||
@@ -827,14 +824,14 @@ init_project() {
|
||||
u)
|
||||
echo "Updating project from template"
|
||||
echo "Only files that are newer in the template will be overwritten"
|
||||
if rsync --archive --update "$QHTCP_TEMPLATE_DIR"/ "$QHTCP_RESULTS_DIR"; then
|
||||
if execute rsync --archive --update "$QHTCP_TEMPLATE_DIR"/ "$QHTCP_RESULTS_DIR"; then
|
||||
echo "Project updated with template"
|
||||
fi
|
||||
;;
|
||||
b)
|
||||
if backup "$QHTCP_RESULTS_DIR"; then
|
||||
mkdir "$QHTCP_RESULTS_DIR"
|
||||
rsync --archive "$QHTCP_TEMPLATE_DIR"/ "$QHTCP_RESULTS_DIR"
|
||||
execute rsync --archive "$QHTCP_TEMPLATE_DIR"/ "$QHTCP_RESULTS_DIR"
|
||||
echo "Created new project at $QHTCP_RESULTS_DIR"
|
||||
fi
|
||||
;;
|
||||
@@ -850,10 +847,8 @@ init_project() {
|
||||
done
|
||||
else
|
||||
echo "Creating project results dir at $QHTCP_RESULTS_DIR"
|
||||
debug "mkdir $QHTCP_RESULTS_DIR"
|
||||
mkdir "$QHTCP_RESULTS_DIR"
|
||||
debug "rsync --archive $QHTCP_TEMPLATE_DIR/ $QHTCP_RESULTS_DIR"
|
||||
rsync --archive "$QHTCP_TEMPLATE_DIR"/ "$QHTCP_RESULTS_DIR"
|
||||
execute mkdir "$QHTCP_RESULTS_DIR"
|
||||
execute rsync --archive "$QHTCP_TEMPLATE_DIR"/ "$QHTCP_RESULTS_DIR"
|
||||
fi
|
||||
|
||||
study_info
|
||||
@@ -1279,8 +1274,6 @@ module qhtcp
|
||||
#
|
||||
# TODO
|
||||
#
|
||||
# * Suggest renaming StudiesQHTCP to something like qhtcp qhtcp_output or output
|
||||
# * Move (hide) the study template somewhere else
|
||||
# * StudiesArchive should be smarter:
|
||||
# * Create a database with as much information as possible
|
||||
# * Write a function that easily loads and parses databse into easy-to-use variables
|
||||
@@ -1366,13 +1359,10 @@ qhtcp() {
|
||||
|
||||
# Run R interactions script on all studies
|
||||
for study in "${STUDIES[@]}"; do
|
||||
read -r num sd dir <<< "$study"
|
||||
[[ -d $dir/zscores ]] ||
|
||||
execute mkdir "$dir/zscores"
|
||||
[[ -d $dir/zscores/qc ]] ||
|
||||
execute mkdir "$dir/zscores/qc"
|
||||
r_interactions "$num" "$sd"
|
||||
read -r num sd _ <<< "$study"
|
||||
r_interactions "$num" "$sd" & # run in parallel, catch with wait below
|
||||
done \
|
||||
&& wait -n \
|
||||
&& remc \
|
||||
&& gtf \
|
||||
&& gta
|
||||
@@ -1750,8 +1740,9 @@ r_interactions() {
|
||||
declare script="$APPS_DIR/r/interactions.R"
|
||||
declare out_dir="${6:-"$QHTCP_RESULTS_DIR/Exp$1/zscores"}"
|
||||
|
||||
[[ -d $out_dir ]] && backup "$out_dir"
|
||||
mkdir "$out_dir"
|
||||
backup "$out_dir"
|
||||
execute mkdir "$out_dir"
|
||||
execute mkdir "$out_dir/qc"
|
||||
|
||||
execute "$RSCRIPT" "$script" \
|
||||
"$1" \
|
||||
@@ -1850,7 +1841,7 @@ wrapper java_extract
|
||||
# @exitcode 1 if expected output file does not exist
|
||||
java_extract() {
|
||||
debug "Running: ${FUNCNAME[0]}"
|
||||
classpath="$APPS_DIR/java/javaExtract.jar"
|
||||
classpath="$APPS_DIR/java/weka-clustering.jar"
|
||||
|
||||
output_file="${1:-$QHTCP_RESULTS_DIR}/REMcRdy_lm_only.csv-finalTable.csv"
|
||||
|
||||
@@ -2337,7 +2328,7 @@ main() {
|
||||
|
||||
parse_input "$@" # parse arguments with getopt
|
||||
|
||||
# ((DEBUG)) && declare -p
|
||||
((DEBUG)) && declare -p
|
||||
|
||||
interactive_header "$@"
|
||||
|
||||
@@ -2347,8 +2338,8 @@ main() {
|
||||
# fi
|
||||
|
||||
for i in "${!PROJECTS[@]}"; do
|
||||
if ! sanitize_pn "${PROJECTS[i]}"; then
|
||||
echo "Project name ${PROJECTS[i]} is invalid"
|
||||
if ! sanitize_pn "${PROJECTS[$i]}"; then
|
||||
echo "Project name ${PROJECTS[$i]} is invalid"
|
||||
echo "Enter a replacement"
|
||||
ask_pn && unset "PROJECTS[i]" && PROJECTS+=("${ADD_PROJECTS[@]}")
|
||||
fi
|
||||
@@ -2356,15 +2347,13 @@ main() {
|
||||
|
||||
# Exclude modules from --exclude
|
||||
for i in "${!MODULES[@]}"; do
|
||||
[[ " ${EXCLUDE_MODULES[*]} " =~ [[:space:]]${MODULES[i]}[[:space:]] ]] && unset "MODULES[i]"
|
||||
[[ " ${EXCLUDE_MODULES[*]} " =~ [[:space:]]${MODULES[i]}[[:space:]] ]] && unset "MODULES[$i]"
|
||||
done
|
||||
|
||||
# Sanitize MODULES
|
||||
for i in "${!MODULES[@]}"; do
|
||||
if ! [[ " ${ALL_MODULES[*]} " =~ [[:space:]]${MODULES[i]}[[:space:]] ]]; then
|
||||
echo "Module ${MODULES[$i]} not in the module list"
|
||||
echo "Available modules:"
|
||||
printf "%s\n" "${ALL_MODULES[@]}"
|
||||
read -r -p "Enter replacement module name: " module
|
||||
! [[ " ${ALL_MODULES[*]} " =~ [[:space:]]${module}[[:space:]] ]] || (echo "RTFM"; return 1)
|
||||
MODULES[i]="$module"
|
||||
@@ -2376,7 +2365,7 @@ main() {
|
||||
for i in "${!WRAPPERS[@]}"; do
|
||||
if ! [[ " ${ALL_WRAPPERS[*]} " =~ [[:space:]]${WRAPPERS[i]}[[:space:]] ]]; then
|
||||
echo "Wrapper ${WRAPPERS[$i]} not in the module list, removing"
|
||||
unset "WRAPPERS[i]" "WRAPPERS[$((i+1))]"
|
||||
unset "WRAPPERS[$i]" "WRAPPERS[$((i+1))]"
|
||||
fi
|
||||
continue 2 # skip the arguments string
|
||||
done
|
||||
@@ -2426,12 +2415,13 @@ main() {
|
||||
unset MODULES WRAPPERS EXCLUDE_MODULES STUDIES SET_STUDIES YES
|
||||
}
|
||||
|
||||
# (Safe) main loop
|
||||
if main "$@"; then
|
||||
for ((i=1; i<2; i++)); do
|
||||
main &&
|
||||
i=0
|
||||
done
|
||||
fi
|
||||
# (Safe) main loop if we want to rerun automatically
|
||||
# if main "$@"; then
|
||||
# for ((i=1; i<2; i++)); do
|
||||
# main &&
|
||||
# i=0
|
||||
# done
|
||||
# fi
|
||||
|
||||
main "$@"
|
||||
exit $?
|
||||
|
||||
Reference in New Issue
Block a user