Skip to content
Snippets Groups Projects
Commit 5e64d135 authored by Marc's avatar Marc
Browse files

download_databases_from_s3bucket.sh tests now if folders are misssing in...

download_databases_from_s3bucket.sh tests now if folders are misssing in datadir and download only these
parent 7a246f03
No related branches found
No related tags found
No related merge requests found
......@@ -8,32 +8,56 @@ S3BUCKET='psot-databases'
list='ghostx uniprot pfam-31'
function test_datadir () {
if ! [[ -e $DATADIR && -d $DATADIR ]]; then
mkdir $DATADIR
sync_data
elif [ -z "$(ls -A $DATADIR)" ]; then
sync_data
sync_data "$list"
elif ! all_folders_in_datadir "test_true"; then
sync_data "$(all_folders_in_datadir 'return_missing')"
fi
}
}
function all_folders_in_datadir () {
new_list=""
for ele in $list; do
if ! $(ls $DATADIR | grep -qx "$ele"); then
if [ $1 == "test_true" ]; then
return 1
else
new_list="$new_list $ele"
fi
fi
done
if [ $1 == "test_true" ]; then
return 0
else
echo "$new_list"
fi
}
function sync_data () {
echo "Could not find databases in config given path"
echo "Download databases... "
cd $DATADIR
for ele in $list; do
download_list=$1
for ele in $download_list; do
wget -q "https://${S3BUCKET}.s3.computational.bio.uni-giessen.de/${ele}.tar.gz"
tar -zxf "${ele}.tar.gz"
rm "${ele}.tar.gz"
done
ln -s 'pfam-31/' 'pfam'
echo "[$(date)] psot (PID $$) downloaded databases to $DATADIR" >> $LOGFILE
}
if [[ -e $LOGFILE ]]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment