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