]> git.donarmstrong.com Git - dbsnp.git/blob - utils/load_snp_data.sh
add routines to load encode data
[dbsnp.git] / utils / load_snp_data.sh
1 #!/bin/sh
2
3 DATA_DIR=/srv/ncbi/db_snp/
4 SCHEMA_DIR=/srv/ncbi/db_snp_utils/schema
5 UTIL_DIR=${SCHEMA_DIR}/../utils/
6 DB=snp
7
8 psql -c "DROP DATABASE $DB";
9 psql -c "CREATE DATABASE $DB";
10
11
12
13 (cd ${SCHEMA_DIR}/shared_schema;
14     cat dbSNP_main_table_postgresql.sql |psql "$DB";
15 )
16 (cd ${SCHEMA_DIR}/human_9606_schema;
17     cat *_table_postgresql.sql|psql "$DB";
18     ${UTIL_DIR}/human_gty1_indexes_creation.pl create trigger |psql "$DB";
19 )
20 (cd ${DATA_DIR}/shared_data;
21     for a in $(find -type f -iname '*.bcp.gz' -printf '%f\n'|sort); do
22         echo $a;
23         zcat $a | perl -pe 's/\r/\\r/g' |psql "$DB" -c "COPY ${a%%.bcp.gz} FROM STDIN WITH NULL ''";
24     done;
25 )
26 (cd ${DATA_DIR}/organism_data;
27     for a in $(find -type f -iname '*.bcp.gz' -printf '%f\n'|sort); do
28         echo $a;
29         zcat $a | perl -pe 's/\r/\\r/g' |psql "$DB" -c "COPY ${a%%.bcp.gz} FROM STDIN WITH NULL ''";
30     done;
31 )
32 (cd ${SCHEMA_DIR}/shared_schema;
33     cat dbSNP_main_index_postgresql.sql dbSNP_main_constraint_postgresql.sql|psql "$DB";
34 )
35 (cd ${SCHEMA_DIR}/human_9606_schema;
36     cat *_{index,constraint}_postgresql.sql|psql "$DB";
37     ${UTIL_DIR}/human_gty1_indexes_creation.pl index |psql "$DB";
38 )