diff --git a/bin/add_exps_to_collection.sh b/bin/add_exps_to_collection.sh index 26c6a95..b34ca09 100755 --- a/bin/add_exps_to_collection.sh +++ b/bin/add_exps_to_collection.sh @@ -2,7 +2,7 @@ set -e -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) dbConnection=${dbConnection:-$1} COLL_ID=${COLL_ID:-$2} diff --git a/bin/create_collection.sh b/bin/create_collection.sh index 6d163e8..d119e66 100755 --- a/bin/create_collection.sh +++ b/bin/create_collection.sh @@ -2,7 +2,7 @@ set -e -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) source $scriptDir/common_routines.sh dbConnection=${dbConnection:-$1} diff --git a/bin/delete_collection.sh b/bin/delete_collection.sh index fba267c..2283983 100755 --- a/bin/delete_collection.sh +++ b/bin/delete_collection.sh @@ -2,7 +2,7 @@ set -e -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) dbConnection=${dbConnection:-$1} COLL_ID=${COLL_ID:-$2} diff --git a/bin/delete_exp_from_collection.sh b/bin/delete_exp_from_collection.sh index 219e84c..7cd696a 100755 --- a/bin/delete_exp_from_collection.sh +++ b/bin/delete_exp_from_collection.sh @@ -2,7 +2,7 @@ set -e -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) source $scriptDir/common_routines.sh dbConnection=${dbConnection:-$1} diff --git a/bin/get_experiment_info.sh b/bin/get_experiment_info.sh index b062f37..490dd78 100755 --- a/bin/get_experiment_info.sh +++ b/bin/get_experiment_info.sh @@ -2,7 +2,7 @@ set -e -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) postgres_scripts_dir=$scriptDir/../postgres_routines diff --git a/bin/load_db_scxa_analytics.sh b/bin/load_db_scxa_analytics.sh index 804c9c3..567880a 100755 --- a/bin/load_db_scxa_analytics.sh +++ b/bin/load_db_scxa_analytics.sh @@ -12,7 +12,7 @@ # - Postprocess table and attach it to the main scxa-analytics table. set -e -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) source $scriptDir/common_routines.sh postgres_scripts_dir=$scriptDir/../postgres_routines diff --git a/bin/load_db_scxa_analytics_pg9.sh b/bin/load_db_scxa_analytics_pg9.sh index 31bb295..8a46264 100755 --- a/bin/load_db_scxa_analytics_pg9.sh +++ b/bin/load_db_scxa_analytics_pg9.sh @@ -10,7 +10,7 @@ # PG10, which loads each experiment into a different partition. set -e -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) source $scriptDir/common_routines.sh dbConnection=${dbConnection:-$1} diff --git a/bin/load_db_scxa_cell_clusters.sh b/bin/load_db_scxa_cell_clusters.sh index 569830c..bc7e18a 100755 --- a/bin/load_db_scxa_cell_clusters.sh +++ b/bin/load_db_scxa_cell_clusters.sh @@ -5,7 +5,7 @@ # scxa_cell_group_membership table of AtlasProd. set -e -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) source $scriptDir/common_routines.sh dbConnection=${dbConnection:-$1} diff --git a/bin/load_db_scxa_dimred.sh b/bin/load_db_scxa_dimred.sh index c9412aa..2878f07 100755 --- a/bin/load_db_scxa_dimred.sh +++ b/bin/load_db_scxa_dimred.sh @@ -5,7 +5,7 @@ # parameterisations, and loads it into the scxa_coords table of AtlasProd. set -e -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) source $scriptDir/common_routines.sh dbConnection=${dbConnection:-$1} @@ -13,7 +13,7 @@ EXP_ID=${EXP_ID:-$2} DIMRED_TYPE=${DIMRED_TYPE:-$3} DIMRED_FILE_PATH=${DIMRED_FILE_PATH:-$4} DIMRED_PARAM_JSON=${DIMRED_PARAM_JSON:-$5} -SCRATCH_DIR=${SCRATCH_DIR:-"$(dirname ${DIMRED_FILE_PATH})"} +SCRATCH_DIR=${SCRATCH_DIR:-"$DIMRED_FILE_PATH"} # Check that necessary environment variables are defined. [ -n ${dbConnection+x} ] || (echo "Env var dbConnection for the database connection needs to be defined. This includes the database name." && exit 1) diff --git a/bin/load_db_scxa_marker_genes.sh b/bin/load_db_scxa_marker_genes.sh index 3f817ba..ea9e05b 100755 --- a/bin/load_db_scxa_marker_genes.sh +++ b/bin/load_db_scxa_marker_genes.sh @@ -6,7 +6,7 @@ # scxa_cell_groups_marker_genes table of AtlasProd. set -e -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) source $scriptDir/common_routines.sh dbConnection=${dbConnection:-$1} diff --git a/bin/load_experiment_web_cli.sh b/bin/load_experiment_web_cli.sh index eb629df..14f9baf 100755 --- a/bin/load_experiment_web_cli.sh +++ b/bin/load_experiment_web_cli.sh @@ -11,7 +11,7 @@ jar_dir=$CONDA_PREFIX/share/atlas-cli -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) source $scriptDir/common_routines.sh echo "CONDA_PREFIX: $CONDA_PREFIX" diff --git a/bin/modify_collection.sh b/bin/modify_collection.sh index 01ad084..0af83f2 100755 --- a/bin/modify_collection.sh +++ b/bin/modify_collection.sh @@ -2,7 +2,7 @@ set -e -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) dbConnection=${dbConnection:-$1} COLL_ID=${COLL_ID:-$2} diff --git a/bin/update_experiment_web_cli.sh b/bin/update_experiment_web_cli.sh index 293dac7..f2ebd80 100755 --- a/bin/update_experiment_web_cli.sh +++ b/bin/update_experiment_web_cli.sh @@ -11,7 +11,7 @@ jar_dir=$CONDA_PREFIX/share/atlas-cli -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) source $scriptDir/common_routines.sh echo "CONDA_PREFIX: $CONDA_PREFIX" diff --git a/fixtures/generate-fixtures.sh b/fixtures/generate-fixtures.sh index 840a621..dbd91f8 100755 --- a/fixtures/generate-fixtures.sh +++ b/fixtures/generate-fixtures.sh @@ -22,7 +22,7 @@ # https://stackoverflow.com/questions/59895/how-can-i-get-the-source-directory-of-a-bash-script-from-within-the-script-itsel # https://stackoverflow.com/a/246128 -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd )" export POSTGRES_HOST=${POSTGRES_HOST:-localhost} export POSTGRES_PORT=${POSTGRES_PORT:-5432} diff --git a/fixtures/generate-tsv-fixture.sh b/fixtures/generate-tsv-fixture.sh index e55bf4b..8bf89eb 100755 --- a/fixtures/generate-tsv-fixture.sh +++ b/fixtures/generate-tsv-fixture.sh @@ -10,7 +10,7 @@ # We choose 100 genes that are expressed in those cells via analytics table set -e -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd )" source ${SCRIPT_DIR}/utils.sh diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 17e2ede..4c00250 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +scriptDir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}" )" &> /dev/null && pwd ) export testsDir=$scriptDir export PATH=$scriptDir/../bin:$scriptDir/../tests:$PATH @@ -33,7 +33,7 @@ export EXPERIMENT_DESIGN_FILES=$SCRATCH_DIR if [ "$#" -eq 0 ]; then - bats --tap "$(dirname "${BASH_SOURCE[0]}")" + bats --tap "$(dirname "${BASH_SOURCE[0]:-$0}")" else bats random-data-set.bats fi diff --git a/tests/test_dimred_load.sh b/tests/test_dimred_load.sh index e9f2c1b..46e1dc3 100755 --- a/tests/test_dimred_load.sh +++ b/tests/test_dimred_load.sh @@ -6,7 +6,7 @@ delete_db_scxa_dimred.sh # do it just for testing ls ${EXPERIMENT_DIMRED_PATH}/${EXP_ID}.tsne*.tsv | while read -r l; do - export DIMRED_TYPE=tsne + export DIMRED_TYPE=t-SNE export DIMRED_FILE_PATH=$l paramval=$(echo "$l" | sed 's/.*[^0-9]\([0-9]*\).tsv/\1/g') export DIMRED_PARAM_JSON='[{"perplexity": '$paramval'}]' @@ -14,7 +14,7 @@ ls ${EXPERIMENT_DIMRED_PATH}/${EXP_ID}.tsne*.tsv | while read -r l; do done ls ${EXPERIMENT_DIMRED_PATH}/${EXP_ID}.umap*.tsv | while read -r l; do - export DIMRED_TYPE=umap + export DIMRED_TYPE=UMAP export DIMRED_FILE_PATH=$l paramval=$(echo "$l" | sed 's/.*[^0-9]\([0-9]*\).tsv/\1/g') export DIMRED_PARAM_JSON='[{"n_neighbors": '$paramval'}]'