File: init.sh

package info (click to toggle)
milib 1.10-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 3,272 kB
  • sloc: java: 32,232; xml: 309; sh: 53; makefile: 2
file content (66 lines) | stat: -rwxr-xr-x 1,679 bytes parent folder | download
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
66
#!/bin/bash

scriptDir=""

os=`uname`

# OS scecific initialization
case $os in
    Darwin)
        scriptDir=$(cd "$(dirname "$0")"; pwd)
    ;;
    Linux)
        scriptDir="$(dirname "$(readlink -f "$0")")"
    ;;
    *)
       echo "Unknown OS."
       exit 1
    ;;
esac

echo ${scriptDir}

if type blastn > /dev/null 2>/dev/null ; then
    echo "Blast already installed."
else
    set -e
    distFilter=""
    case $os in
        Darwin)
            distFilter="universal-macosx"
        ;;
        Linux)
            distFilter="x64-linux"
        ;;
        *)
           echo "Unknown OS."
           exit 1
        ;;
    esac
    fileName=$(curl https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ 2> /dev/null | grep tar.gz | sed 's/.*>\(.*\)<.*/\1/' | grep -o -E 'ncbi-blast.*.gz$' | grep -o -E 'ncbi-blast.*.tar.gz' | grep ${distFilter} )
    #echo ${fileName}
    blastVersion=$(echo ${fileName} | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\++')
    #echo ${blastVersion}
    versionMarker="blast/ncbi-blast-${blastVersion}"
    if [[ ! -f ${versionMarker} ]]
    then
        echo " Upgrading..."
        rm -rf blast
        mkdir -p blast
        (cd blast; curl https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/${fileName} 2> /dev/null | tar -xzv )
        mv ${versionMarker} blast/blast
        touch ${versionMarker}
    else
        echo " Latest version is already installed.."
    fi

fi

set -e

if [[ ! -f src/test/resources/big/16SMicrobial.nsq ]]
then
    mkdir -p ${scriptDir}/src/test/resources/big
    (cd ${scriptDir}/src/test/resources/big; curl https://ftp.ncbi.nlm.nih.gov/blast/db/16SMicrobial.tar.gz 2> /dev/null | tar -xzv)
fi