-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_corall_docker.sh
More file actions
executable file
·63 lines (55 loc) · 1.32 KB
/
run_corall_docker.sh
File metadata and controls
executable file
·63 lines (55 loc) · 1.32 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
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
usage() { echo "Usage: $0 [-a <gtf_file>] [-s <star_index] [-o <output_dir>] [-d <docker_image>] <rd1_fastq_gz|sample_csv> [<rd2_fastq_gz>]" 1>&2; exit 1; }
output_dir=corall_out
docker_img=corall:v1.0.1
while getopts ":a:s:o:d:" o; do
case "${o}" in
a)
gtf_file=${OPTARG}
;;
s)
star_index=${OPTARG}
;;
o)
output_dir=${OPTARG}
;;
d)
docker_img=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
[ $# -eq 0 ] && usage
if [[ $1 =~ \.fastq.gz$ ]]
then
[ $# -gt 2 ] && usage
#use dirname twice, don't want to write in "fastq" directory
input_dir=$(dirname $(dirname $1))
if [ $# -eq 1 ]
then
corall_opt="--r1 $1"
else
corall_opt="--r1 $1 --r2 $2"
fi
elif [[ $1 =~ \.csv$ ]]
then
[ $# -gt 1 ] && usage
corall_opt="--csv $1"
input_dir=$(dirname $1)
else
usage
fi
[ -z ${output_dir} ] && output_dir=${input_dir}/corall_batch_out
mkdir -p ${output_dir}
docker run -u $(id -u):$(id -g) --rm \
-v ${input_dir}:${input_dir} \
-v ${output_dir}:${output_dir} \
-v ${gtf_file}:${gtf_file} \
${docker_img} \
/corall_batch.sh ${corall_opt} \
--gtfFile ${gtf_file} \
--starGenomeDir ${star_index} \
--baseDir ${output_dir}