-
Notifications
You must be signed in to change notification settings - Fork 11
/
bootstrap_apollo.sh
executable file
·70 lines (59 loc) · 2.34 KB
/
bootstrap_apollo.sh
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
69
70
#!/bin/bash
SHOULD_LAUNCH_DOCKER=1
for arg in "$@"
do
case $arg in
--nodocker)
SHOULD_LAUNCH_DOCKER=0
shift
;;
*)
shift
;;
esac
done
export GALAXY_SHARED_DIR=`pwd`/apollo_shared_dir
mkdir -p "$GALAXY_SHARED_DIR"
if ! [[ $SHOULD_LAUNCH_DOCKER -eq 0 ]]; then
docker run --memory=4g -d -it -p 8888:8080 -v `pwd`/apollo_shared_dir/:`pwd`/apollo_shared_dir/ quay.io/gmod/apollo:latest
fi
echo "[BOOTSTRAP] Waiting while Apollo starts up..."
# Wait for apollo to be online
for ((i=0;i<30;i++))
do
APOLLO_UP=$(arrow users get_users 2> /dev/null | head -1 | grep '^\[$' -q; echo "$?")
if [[ $APOLLO_UP -eq 0 ]]; then
break
fi
sleep 10
done
if ! [[ $APOLLO_UP -eq 0 ]]; then
echo "Cannot connect to apollo for bootstrapping"
arrow users get_users
exit "${APOLLO_UP}"
fi
echo "[BOOTSTRAP] Apollo is up, bootstrapping for tests"
# Create some groups
arrow groups create_group one_group
arrow groups create_group another_group
# Create a user
arrow users create_user "[email protected]" Junior Galaxy password
# Add some organisms
cp -r test-data/dataset_1_files/data/ "${GALAXY_SHARED_DIR}/org1"
cp -r test-data/dataset_1_files/data/ "${GALAXY_SHARED_DIR}/org2"
cp -r test-data/dataset_1_files/data/ "${GALAXY_SHARED_DIR}/org3"
cp -r test-data/dataset_1_files/data/ "${GALAXY_SHARED_DIR}/org4"
arrow organisms add_organism --genus Testus --species organus test_organism $GALAXY_SHARED_DIR/org1
arrow organisms add_organism --genus Foo --species barus alt_org $GALAXY_SHARED_DIR/org2
arrow organisms add_organism --genus Foo3 --species barus org3 $GALAXY_SHARED_DIR/org3
arrow organisms add_organism --genus Foo4 --species barus org4 $GALAXY_SHARED_DIR/org4
# Give access to organisms for test user
arrow users update_organism_permissions --write --read --export "[email protected]" test_organism
arrow users update_organism_permissions --write --read --export "[email protected]" alt_org
arrow users update_organism_permissions --write --read --export "[email protected]" org3
arrow users update_organism_permissions --write --read --export "[email protected]" org4
# Load some annotations
arrow annotations load_gff3 test_organism test-data/merlin.gff
arrow annotations load_gff3 alt_org test-data/merlin.gff
arrow annotations load_gff3 org3 test-data/merlin.gff
arrow annotations load_gff3 org4 test-data/merlin.gff