-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathquickstart.bash
More file actions
executable file
·52 lines (46 loc) · 1.44 KB
/
quickstart.bash
File metadata and controls
executable file
·52 lines (46 loc) · 1.44 KB
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
#!/usr/bin/env bash
# Supported genomes
GENOMES=("hg19" "hg38" "rn6" "mm10" "sacCer3" "hg19mito" "hg38mito" "mm10mito")
# Help function
function print_usage() {
echo "USAGE: $0 tool databasename data" >&2
echo " tool: make, build, run, manual" >&2
echo " make: Build the docker container" >&2
echo " build: Build RNA database into a docker volume" >&2
echo " manual: Run container with prebuilt docker volume" >&2
echo " databasename: ${GENOMES[@]}" >&2
echo " data: Directory to mount with the data (optional)" >&2
}
# Function to build the Docker container
function docker_make() {
docker build --no-cache -f Dockerfile -t trax .
}
# Function to start the container and build a RNA database
function docker_build_db() {
if [ -z "$1" ]; then
echo "supply a databasename: ${GENOMES[@]}"
else
docker volume create rnadb-${1}
docker run --rm -it --name trax-build-rnadb-${1} \
-v rnadb-${1}:/rnadb \
trax \
quickdb.bash ${1}
fi
}
# Function to start a manual Docker TRAX container
function docker_manual() {
docker run --rm -it --name trax-${USER}-2 \
--user=$(id -u):$(id -g) \
-v rnadb-${1}:/rnadb \
trax
}
# Init function
if [[ ${1} = "make" ]]; then
docker_make
elif [[ ${1} = "build" ]]; then
[[ ${GENOMES[*]} =~ ${2} ]] && docker_build_db ${@:2} || print_usage
elif [[ ${1} = "manual" ]]; then
[[ ${GENOMES[*]} =~ ${2} ]] && docker_manual ${@:2} || print_usage
else
print_usage
fi