# for emacs: -*- mode: sh; -*-

                                                                                # This is a browser for Vibrio cholerae O1 biovar eltor str. N16961

mkdir -p /cluster/store5/bacteria/vibCho1
ln -s /cluster/store5/bacteria/vibCho1 /cluster/data/vibCho1
cd /cluster/data/vibCho1

# DOWNLOAD SEQUENCE

# chrI
wget ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Vibrio_cholerae/NC_002505.fna
# chrII
wget ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Vibrio_cholerae/NC_002506.fna
sed 's/^>.*/>chrI/' NC_002505.fna > chrI.fa
sed 's/^>.*/>chrII/' NC_002506.fna > chrII.fa
rm *.fna
faSize -detailed *.fa > chrom.sizes

# CREATE DB

echo "create database vibCho1" | hgsql ''
hgNibSeq vibCho1 /cluster/data/vibCho1/nib chrI.fa chrII.fa
echo "create table grp (PRIMARY KEY(NAME)) select * from hg16.grp" \
            | hgsql vibCho1
echo "INSERT INTO dbDb \
     (name, description, nibPath, organism, \
            defaultPos, active, orderKey, genome, scientificName, \
            htmlPath, hgNearOk) values \
     (\"vibCho1\", \"Vibrio cholerae O1 biovar eltor str. N16961\", \"/gbdb/vibCho1/nib\", \"V. cholerae\", \
            \"chrI:50000-55000\", 1, 85, \"Bacteria\", \
            \"Vibrio cholerae O1 biovar eltor str. N16961\", \"/gbdb/vibCho1/html/description.html\",0);" \
      | hgsql -h genome-testdb hgcentraltest
echo "INSERT INTO defaultDb VALUES (\"Bacteria\",\"vibCho1\")" | hgsql -h genome-testdb hgcentraltest

# OTHER DIRECTORY STUFF

mkdir -p /gbdb/vibCho1/nib
cd /gbdb/vibCho1/nib
ln -s /cluster/store5/bacteria/vibCho1/nib/chrI.nib chrI.nib
ln -s /cluster/store5/bacteria/vibCho1/nib/chrII.nib chrII.nib
cd /cluster/data/vibCho1
mkdir html
ln -s /cluster/data/vibCho1/html /gbdb/vibCho1/html
cd html
echo '<H3>About the <em>Vibrio cholerae O1 biovar eltor str. N16961</em> Sequence</H3>
<P>
There are two chromosomes: chrI and chrII.  This strain of V. cholerae was sequenced by <a href="http://www.tigr.org/">TIGR</a>, and <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=pubmed&dopt=Abstract&list_uids=10952301">published in 2000 in Nature</a>.  The <a href="http://www.etox.ucsc.edu/fac_res/yildiz_lab.html">lab of Fitnat Yildiz</a> in the <a href="http://www.etox.ucsc.edu/">Environmental Toxicology Dept</a> is interested in a bunch of things with V. cholerae, and her lab will add to this browser.
</P>' > description.html

cd ~/kent/src/hg/makeDb/trackDb/
mkdir bacteria/vibCho1
touch bacteria/vibCho1/trackDb.ra
cvs add bacteria/vibCho1
cvs add bacteria/vibCho1/trackDb.ra
# edit 'makefile' and add vibCho1 to the list of genome DBs.
# save this file
cd ..
cvs commit
cd trackDb
make update
make alpha
