# The spToDb program will create a relational database out of
# SwissProt flat files.  To do this take the following steps.

# First set up your database name, which by convention is
# 'sp' plus the date in MMDDYY format, and fill in passwords
# and set the date directory to a recent download of SwissProt.
set date 090703
set db sp$date
set password BIGSECRET
set data /cluster/store5/swissprot/$data

# Create tab-separated files, which should take about 5 minutes
# at least if the i/o is local.
pushd .
cd $data/build
zcat *.data.gz | spToDb stdin ../tabFiles

# Now create the database
ssh hgwdev
mysqladmin -u hgcat -p$password create $db

# Load up the table definitions from here:
hgsql $db < spDb.sql

# Load up the data from tab files.  This takes about 30 minutes.
cd $data/tabFiles
foreach i (*.tab)
    mysqlimport $db $i.tab
end

# Clean up tab files
cd ..
rm -r tabFiles

# If you need to grab the swissProt data files do something
# like this:
ssh eieio
cd /cluster/store5/swissprot
mkdir $date
cd $date
mkdir build
cd build
wget ftp://us.expasy.org/databases/sp_tr_nrdb/sprot.dat.gz
wget ftp://us.expasy.org/databases/sp_tr_nrdb/trembl.dat.gz
wget ftp://us.expasy.org/databases/sp_tr_nrdb/trembl_new.dat.gz

