-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathload_reference_data.sh
More file actions
executable file
·65 lines (54 loc) · 1.76 KB
/
load_reference_data.sh
File metadata and controls
executable file
·65 lines (54 loc) · 1.76 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
64
65
#!/bin/bash
# data directory is always mounted in the /data
#BBMAP_VERSION=38.73
check_exists() {
if ! [ -d $1 ] ; then
echo "Error initializing reference data; failed on: $1"
fail=1
fi
}
safe_execute() {
cmd=$1
echo "running $cmd"
eval $cmd
ret_code=$?
if [ $ret_code != 0 ]; then
echo $2
exit $ret_code
fi
}
fail=0
date
# Move to /data - that's got room for the big tar file.
cd /data
# Fetch the monster compilation of reference data that Brian Bushnell set up.
echo "Downloading RQCFilterData from NERSC Portal"
safe_execute "wget -L --no-verbose https://portal.nersc.gov/dna/microbial/assembly/bushnell/RQCFilterData.tar" "failed to download reference data!"
safe_execute "tar -xf RQCFilterData.tar -C /data" "failed to untar reference data!"
safe_execute "rm -f RQCFilterData.tar" "failed to remove reference data!"
check_exists /data/RQCFilterData
if [ $fail -eq 1 ] ; then
echo "Unable to expand RQCFilterData.tar! Failing."
exit 1
fi
echo "Done expanding RQCFilterData"
# Now, we need another pull of BBMap, and copy its bundled datasets into the location where
# the RQCFilterData.tar landed.
date
echo "Fetching BBMap $BBMAP_VERSION"
BBMAP=BBMap_$BBMAP_VERSION.tar.gz
safe_execute "wget -O $BBMAP https://sourceforge.net/projects/bbmap/files/$BBMAP/download" "failed to download $BBMAP"
safe_execute "tar -xf $BBMAP -C /data" "failed to expand $BBMAP"
check_exists /data/bbmap
if [ $fail -eq 1 ] ; then
echo "Unable to expand $BBMAP! Failing."
exit 1
fi
echo "Copying BBMap resources data"
safe_execute "cp /data/bbmap/resources/* /data/RQCFilterData/" "failed to move BBMap data!"
echo "Cleaning up"
rm $BBMAP
rm -rf /data/bbmap
date
echo "Success. Writing __READY__ file."
touch /data/__READY__