Skip to content

Commit 9ef6d18

Browse files
committed
Fix clusterdb symlinks in database downloads
1 parent fa6c530 commit 9ef6d18

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

data/structdatabases.sh

+19-2
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,18 @@ case "${INPUT_TYPE}" in
180180
"FOLDSEEK_DB")
181181
eval "set -- $ARR"
182182
IN="${*}"
183-
for SUFFIX in ".source" "_mapping" "_taxonomy"; do
183+
for SUFFIX in ".source" "_mapping" "_taxonomy" ".lookup"; do
184184
if [ -e "${IN}_seq${SUFFIX}" ]; then
185-
mv -f -- "${IN}_seq${SUFFIX}" "${OUTDB}_seq${SUFFIX}"
185+
if [ -L "${IN}_seq${SUFFIX}" ]; then
186+
# recreate symlinks
187+
BASE=$(basename "${OUTDB}")
188+
DIRN=$(dirname "${OUTDB}")
189+
(cd "${DIRN}"; ln -sf -- "${BASE}${SUFFIX}" "${BASE}_seq${SUFFIX}")
190+
else
191+
mv -f -- "${IN}_seq${SUFFIX}" "${OUTDB}_seq${SUFFIX}"
192+
fi
186193
fi
194+
187195
if [ -e "${IN}${SUFFIX}" ]; then
188196
mv -f -- "${IN}${SUFFIX}" "${OUTDB}${SUFFIX}"
189197
fi
@@ -199,6 +207,15 @@ case "${INPUT_TYPE}" in
199207
done
200208

201209
if [ -e "${IN}_clu.dbtype" ]; then
210+
# fix symlinks of clusterdbs
211+
for SUFFIX in "" "_ss" "_h" "_ca"; do
212+
if [ -L "${OUTDB}_seq${SUFFIX}.0" ] && [ ! -e "${OUTDB}_seq${SUFFIX}.0" ]; then
213+
BASE=$(basename "${OUTDB}")
214+
DIRN=$(dirname "${OUTDB}")
215+
(cd "${DIRN}"; ln -sf -- "${BASE}${SUFFIX}" "${BASE}_seq${SUFFIX}.0")
216+
fi
217+
done
218+
202219
# shellcheck disable=SC2086
203220
"${MMSEQS}" mvdb "${IN}_clu" "${OUTDB}_clu" || fail "mv died"
204221
fi

0 commit comments

Comments
 (0)