-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadd-sample.sh
executable file
·47 lines (38 loc) · 1 KB
/
add-sample.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
#!/bin/bash
set -e
#Use environment vars to load the secret bucket link
source .env
fasta=$1
#Pull the existing saves from a bucket here
# <bucket> --> saves
#Get the latest saves from the bucket
latest=$(curl -SsL $bucket | jq -r '.objects[].name' | sort | tail -n 1)
echo Using $latest
echo Getting from bucket
curl -SsL $bucket/$latest > $latest
echo
echo untaring
tar --use-compress-program=pigz -xf $latest
echo
#<><><><><><>
#Get comparisons with the new ones
echo comparing
#Ensure file exists and is empty beforehand
[ -e comparisons.txt ] && rm comparisons.txt
touch comparisons.txt
./fn5 --add $fasta --cutoff 20 --output_file comparisons.txt
echo
#<><><><><><>
#Push new saves to a bucket here
# saves/* --> <bucket>
output="$(date +%s).tar.gz"
echo compressing
tar --use-compress-program=pigz -cf $output saves
echo
echo uploading
curl -s -X PUT --data-binary "@$(pwd)/$output" $bucket/$output
#<><><><><><>
#Do something with comparions.txt here
# Parse into DB?
# Upload to bucket?
#<><><><><><>