Revision 887f1ec9256045b4959e4caf30dcc60509973c60 authored by Dannon Baker on 25 September 2023, 22:06:55 UTC, committed by Dannon Baker on 25 September 2023, 22:06:55 UTC
1 parent c99bde3
updateucsc.sh.sample
#!/bin/sh
#
# Script to update UCSC shared data tables. The idea is to update, but if
# the update fails, not replace current data/tables with error
# messages.
## Change the Galaxy path on the next line if needed:
GALAXY=$(dirname "$0")/..
GALAXY_VIRTUAL_ENV="${GALAXY_VIRTUAL_ENV:-$GALAXY/.venv}"
if [ -d "$GALAXY_VIRTUAL_ENV" ]; then
echo "Activating virtualenv at $GALAXY_VIRTUAL_ENV"
. "$GALAXY_VIRTUAL_ENV/bin/activate"
fi
PYTHONPATH=${GALAXY}/lib
export PYTHONPATH
# Setup directories
echo "Creating required directories."
DIRS="
${GALAXY}/tool-data/shared/ucsc/new
${GALAXY}/tool-data/shared/ucsc/chrom
${GALAXY}/tool-data/shared/ucsc/chrom/new
"
for dir in $DIRS; do
if [ ! -d "$dir" ]; then
echo "Creating $dir"
mkdir "$dir"
else
echo "$dir already exists, continuing."
fi
done
date
echo "Updating UCSC shared data tables."
# Try to build "builds.txt"
echo "Updating builds.txt"
python "${GALAXY}/cron/parse_builds.py" > "${GALAXY}/tool-data/shared/ucsc/new/builds.txt"
if [ $? -eq 0 ]
then
diff "${GALAXY}/tool-data/shared/ucsc/new/builds.txt" "${GALAXY}/tool-data/shared/ucsc/builds.txt" > /dev/null 2>&1
if [ $? -ne 0 ]
then
cp -f "${GALAXY}/tool-data/shared/ucsc/new/builds.txt" "${GALAXY}/tool-data/shared/ucsc/builds.txt"
fi
else
echo "Failed to update builds.txt" >&2
fi
# Try to build ucsc_build_sites.txt
echo "Updating ucsc_build_sites.txt"
python "${GALAXY}/cron/parse_builds_3_sites.py" > "${GALAXY}/tool-data/shared/ucsc/new/ucsc_build_sites.txt"
if [ $? -eq 0 ]
then
diff "${GALAXY}/tool-data/shared/ucsc/new/ucsc_build_sites.txt" "${GALAXY}/tool-data/shared/ucsc/ucsc_build_sites.txt" > /dev/null 2>&1
if [ $? -ne 0 ]
then
cp -f "${GALAXY}/tool-data/shared/ucsc/new/ucsc_build_sites.txt" "${GALAXY}/tool-data/shared/ucsc/ucsc_build_sites.txt"
fi
else
echo "Failed to update ucsc_build_sites.txt" >&2
fi
# Try to build chromInfo tables
echo "Building chromInfo tables."
python "${GALAXY}/cron/build_chrom_db.py" "${GALAXY}/tool-data/shared/ucsc/chrom/new/" "${GALAXY}/tool-data/shared/ucsc/builds.txt"
if [ $? -eq 0 ]
then
for src in "${GALAXY}"/tool-data/shared/ucsc/chrom/new/*.len
do
dst=${GALAXY}/tool-data/shared/ucsc/chrom/$(basename "$src")
diff "$src" "$dst" > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo "cp -f \"$src\" \"$dst\""
cp -f "$src" "$dst"
fi
done
else
echo "Failed to update chromInfo tables." >&2
fi
rm -rf "${GALAXY}/tool-data/shared/ucsc/new"
rm -rf "${GALAXY}/tool-data/shared/ucsc/chrom/new"
echo "Update complete."
# Perform Manual Additions here
echo "Adding Manual Builds."
python "${GALAXY}/cron/add_manual_builds.py" "${GALAXY}/tool-data/shared/ucsc/manual_builds.txt" "${GALAXY}/tool-data/shared/ucsc/builds.txt" "${GALAXY}/tool-data/shared/ucsc/chrom/"
if [ $? -eq 0 ]
then
echo "Manual addition was successful."
else
echo "Manual addition failed" >&2
fi
Computing file changes ...