| 1 |
#!/bin/sh |
|---|
| 2 |
# |
|---|
| 3 |
# Script to update UCSC shared data tables. The idea is to update, but if |
|---|
| 4 |
# the update fails, not replace current data/tables with error |
|---|
| 5 |
# messages. |
|---|
| 6 |
|
|---|
| 7 |
# Edit this line to refer to galaxy's path: |
|---|
| 8 |
GALAXY=/galaxy/path |
|---|
| 9 |
export PYTHONPATH=${GALAXY}/modules:${GALAXY}/eggs:${GALAXY}/lib |
|---|
| 10 |
|
|---|
| 11 |
# setup directories |
|---|
| 12 |
mkdir ${GALAXY}/tool-data/shared/ucsc/new |
|---|
| 13 |
mkdir ${GALAXY}/tool-data/shared/ucsc/chrom/new |
|---|
| 14 |
|
|---|
| 15 |
date |
|---|
| 16 |
echo "Updating UCSC shared data tables." |
|---|
| 17 |
|
|---|
| 18 |
# Try to build "builds.txt" |
|---|
| 19 |
echo "Updating builds.txt" |
|---|
| 20 |
python ${GALAXY}/cron/parse_builds.py > ${GALAXY}/tool-data/shared/ucsc/new/builds.txt |
|---|
| 21 |
if [ $? -eq 0 ] |
|---|
| 22 |
then |
|---|
| 23 |
cp -uf ${GALAXY}/tool-data/shared/ucsc/new/builds.txt ${GALAXY}/tool-data/shared/ucsc/builds.txt |
|---|
| 24 |
else |
|---|
| 25 |
echo "Failed to update builds.txt" >&2 |
|---|
| 26 |
fi |
|---|
| 27 |
|
|---|
| 28 |
# Try to build ucsc_build_sites.txt |
|---|
| 29 |
echo "Updating ucsc_build_sites.txt" |
|---|
| 30 |
python ${GALAXY}/cron/parse_builds_3_sites.py > ${GALAXY}/tool-data/shared/ucsc/new/ucsc_build_sites.txt |
|---|
| 31 |
if [ $? -eq 0 ] |
|---|
| 32 |
then |
|---|
| 33 |
cp -uf ${GALAXY}/tool-data/shared/ucsc/new/ucsc_build_sites.txt ${GALAXY}/tool-data/shared/ucsc/ucsc_build_sites.txt |
|---|
| 34 |
else |
|---|
| 35 |
echo "Failed to update builds.txt" >&2 |
|---|
| 36 |
fi |
|---|
| 37 |
|
|---|
| 38 |
# Try to build chromInfo tables |
|---|
| 39 |
echo "Building chromInfo tables." |
|---|
| 40 |
python ${GALAXY}/cron/build_chrom_db.py ${GALAXY}/tool-data/shared/ucsc/chrom/new/ ${GALAXY}/tool-data/shared/ucsc/builds.txt |
|---|
| 41 |
if [ $? -eq 0 ] |
|---|
| 42 |
then |
|---|
| 43 |
cp -uf ${GALAXY}/tool-data/shared/ucsc/chrom/new/*.len ${GALAXY}/tool-data/shared/ucsc/chrom/ |
|---|
| 44 |
else |
|---|
| 45 |
echo "Failed to update chromInfo tables." >&2 |
|---|
| 46 |
fi |
|---|
| 47 |
|
|---|
| 48 |
rm -rf ${GALAXY}/tool-data/shared/ucsc/new |
|---|
| 49 |
rm -rf ${GALAXY}/tool-data/shared/ucsc/chrom/new |
|---|
| 50 |
echo "Update complete." |
|---|
| 51 |
|
|---|
| 52 |
#Perform Manual Additions here |
|---|
| 53 |
echo "Adding Manual Builds." |
|---|
| 54 |
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/ |
|---|
| 55 |
if [ $? -eq 0 ] |
|---|
| 56 |
then |
|---|
| 57 |
echo "Manual addition was successful." |
|---|
| 58 |
else |
|---|
| 59 |
echo "Manual addition failed" >&2 |
|---|
| 60 |
fi |
|---|