root/galaxy-central/cron/updateucsc.sh.sample

リビジョン 2, 2.7 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
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:
8GALAXY=/galaxy/path
9PYTHONPATH=${GALAXY}/lib
10export PYTHONPATH
11
12# setup directories
13echo "Creating required directories."
14DIRS="
15${GALAXY}/tool-data/shared/ucsc/new
16${GALAXY}/tool-data/shared/ucsc/chrom
17${GALAXY}/tool-data/shared/ucsc/chrom/new
18"
19for dir in $DIRS; do
20    if [ ! -d $dir ]; then
21        echo "Creating $dir"
22        mkdir $dir
23    else
24        echo "$dir already exists, continuing."
25    fi
26done
27
28date
29echo "Updating UCSC shared data tables."
30
31# Try to build "builds.txt"
32echo "Updating builds.txt"
33python ${GALAXY}/cron/parse_builds.py > ${GALAXY}/tool-data/shared/ucsc/new/builds.txt
34if [ $? -eq 0 ]
35then
36    diff ${GALAXY}/tool-data/shared/ucsc/new/builds.txt ${GALAXY}/tool-data/shared/ucsc/builds.txt > /dev/null 2>&1
37    if [ $? -ne 0 ]
38    then
39        cp -f ${GALAXY}/tool-data/shared/ucsc/new/builds.txt ${GALAXY}/tool-data/shared/ucsc/builds.txt
40    fi
41else
42    echo "Failed to update builds.txt" >&2
43fi
44
45# Try to build ucsc_build_sites.txt
46echo "Updating ucsc_build_sites.txt"
47python ${GALAXY}/cron/parse_builds_3_sites.py > ${GALAXY}/tool-data/shared/ucsc/new/ucsc_build_sites.txt
48if [ $? -eq 0 ]
49then
50    diff ${GALAXY}/tool-data/shared/ucsc/new/ucsc_build_sites.txt ${GALAXY}/tool-data/shared/ucsc/ucsc_build_sites.txt > /dev/null 2>&1
51    if [ $? -ne 0 ]
52    then
53        cp -f ${GALAXY}/tool-data/shared/ucsc/new/ucsc_build_sites.txt ${GALAXY}/tool-data/shared/ucsc/ucsc_build_sites.txt
54    fi
55else
56    echo "Failed to update builds.txt" >&2
57fi
58
59# Try to build chromInfo tables
60echo "Building chromInfo tables."
61python ${GALAXY}/cron/build_chrom_db.py ${GALAXY}/tool-data/shared/ucsc/chrom/new/ ${GALAXY}/tool-data/shared/ucsc/builds.txt
62if [ $? -eq 0 ]
63then
64    for src in ${GALAXY}/tool-data/shared/ucsc/chrom/new/*.len
65    do
66        dst=${GALAXY}/tool-data/shared/ucsc/chrom/`basename $src`
67        diff $src $dst > /dev/null 2>&1
68        if [ $? -ne 0 ]
69        then
70            echo "cp -f $src $dst"
71            cp -f $src $dst
72        fi
73    done
74else
75    echo "Failed to update chromInfo tables." >&2
76fi
77
78rm -rf ${GALAXY}/tool-data/shared/ucsc/new
79rm -rf ${GALAXY}/tool-data/shared/ucsc/chrom/new
80echo "Update complete."
81
82#Perform Manual Additions here
83echo "Adding Manual Builds."
84python ${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/
85if [ $? -eq 0 ]
86then
87    echo "Manual addition was successful."
88else
89    echo "Manual addition failed" >&2
90fi
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。