Skip to content

Commit 97ad74b

Browse files
Jon PalmerJon Palmer
authored andcommitted
updates
1 parent 156251c commit 97ad74b

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

funannotate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def fmtcols(mylist, cols):
3131
for i in range(0,num_lines))
3232
return "\n".join(lines)
3333

34-
version = '0.1.5'
34+
version = '0.1.6'
3535

3636
default_help = """
3737
Usage: funannotate <command> <arguments>

setup.sh

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ command -v makeblastdb >/dev/null 2>&1 || { echo "Funannotate setup requires BLA
1111

1212
#try to be smart about finding previous databases if a user updates via homebrew.
1313

14-
dir=$PWD
14+
dir=$(pwd)
1515
#check if softlink is already present, if so get target
1616
if [ -e 'DB' ]; then
17+
echo "Found DB symlinked folder"
1718
if [[ "$OSTYPE" == "darwin"* ]]; then
1819
outputdir=$(readlink DB)
1920
else
@@ -28,26 +29,24 @@ if [ -e 'DB' ]; then
2829
fi
2930
else
3031
#no softlink found, check if in libexec folder which means homebrew install, try to look for previous version
31-
#if [[ $dir == *"libexec"* ]]; then
32-
#IFS='/ ' read -r -a array <<< "$dir"
33-
#version="${array[@]: -2:1}"
34-
#IFS='. ' read -r -a nums <<< "$version"
35-
#lastnum="${nums[@]: -1:1}"
36-
#prev=$(($lastnum - 1))
37-
#preversion="${nums[0]}.${nums[1]}.$prev"
38-
#now check if previous version folder exists
39-
#if [[ -d ../$preversion ]]; then
40-
# readlink ../$preversion
41-
#function joinString { local IFS="$1"; shift; echo "$*"; }
42-
#length=$((${#array[@]} - 3))
43-
#prevpath=$(joinString \/ ${array[@]:1:$length})
44-
outputdir='/usr/local/share/funannotate'
45-
echo -n "DB directory set to ($outputdir), continue [y/n]: "
46-
read question1
47-
if [ $question1 == 'n' ]; then
48-
echo -n "Enter path to DB directory: "
49-
read dbname
50-
outputdir=$dbname
32+
if [[ $dir == *"libexec"* ]]; then
33+
echo "HomeBrew installation detected, looking for any previous versions"
34+
pre_vers=$(ls ../../ | sort | tail -2 | head -1)
35+
if [[ "$OSTYPE" == "darwin"* ]]; then
36+
outputdir=$(readlink ../../$pre_vers/libexec/DB)
37+
else:
38+
outputdir=$(realink -f ../../$pre_vers/libexec/DB)
39+
echo "Symlink found to $outputdir, setting up DB"
40+
else
41+
echo "HomeBrew installation not detected, specify DB installation directory"
42+
outputdir='/usr/local/share/funannotate'
43+
echo -n "DB directory set to ($outputdir), continue [y/n]: "
44+
read question1
45+
if [ $question1 == 'n' ]; then
46+
echo -n "Enter path to DB directory: "
47+
read dbname
48+
outputdir=$dbname
49+
fi
5150
fi
5251
fi
5352

0 commit comments

Comments
 (0)