# for emacs: -*- mode: sh; -*-
#########################################################################
# DOWNLOAD SEQUENCE (DONE, Fan, 09/06/06)

    ssh hgwhiv1
    mkdir /cluster/store12/hivmn
    cd /cluster/store12/hivmn

# Get HIV MN strand sequence from NCBI 
# >gi|3511259|gb|AF075719.1|AF075719 HIV-1 isolate MN clone MNTQ from the USA, complete genome
# Save it as mn.fa 

# translate to nib
    ln -s /cluster/store12/hivmn ~/hivmn
    cd ~/hivmn
    mkdir nib
    ln -s mn.fa chr1.fa
    faToNib chr1.fa nib/chr1.nib

# CREATING DATABASE (DONE 09/05/06)

# Create the hivmn database.
    
    echo 'create database hivmn' | hgsql ''

# make a semi-permanent read-only alias:
    alias hivmn "mysql -u meduser -pmeduserstuff -A hivmn"

# CREATING GRP TABLE FOR TRACK GROUPING (DONE 04/15/03)
    
    echo "create table grp (PRIMARY KEY(NAME)) select * from hiv1.grp" \
      | hgsql hivmn

# STORING O+O SEQUENCE AND ASSEMBLY INFORMATION  (DONE 09/05/06)

    # Make symbolic links from /gbdb/hivmn/nib to the real nibs.

    mkdir -p /gbdb/hivmn/nib
    foreach f (/cluster/store12/hivmn/nib/*.nib)
      ln -s $f /gbdb/hivmn/nib
    end
    # Load /gbdb/hivmn/nib paths into database and save size info.
    hgsql hivmn  < ~/src/hg/lib/chromInfo.sql

    cd ~/hivmn
    hgNibSeq -preMadeNib hivmn /gbdb/hivmn/nib chr1.fa
    echo "select chrom,size from chromInfo" | hgsql -N hivmn > chrom.sizes

# MAKE HGCENTRALTEST ENTRY AND TRACKDB TABLE FOR HIVMN (DONE 08/02/06)
    echo 'insert into defaultDb values("HIV (MN)", "hivmn");' \
      | hgsql -h localhost hgcentraltest

    echo 'insert into dbDb values("hivmn", "Sep. 1998", \
          "/gbdb/hivmn/nib", "Human immunodeficiency virus 1", "chr1", 1, 99.5, "HIV (MN)","Human immunodeficiency virus 1", "/gbdb/hivmn/html/description.html", 0, 0, "GenBank sequence as of Sep. 2nd, 1998");' \
      | hgsql hgcentraltest -h localhost

    echo 'insert into genomeClade values("HIV (MN)", "other", 100);'\
      | hgsql hgcentraltest -h localhost

    # Make trackDb table so browser knows what tracks to expect:

    cd ~/src/hg/makeDb/trackDb
    cvs up -d -P

    # Edit that makefile to add hivmn in all the right places

    vi makefile

    make update
    make alpha
    cvs commit makefile

# MAKE HGCENTRALTEST BLATSERVERS ENTRY FOR HIVMN
    ssh hiv1
    echo 'insert into blatServers values("hivmn", "hiv1", "17780", "1", "0"); \
          insert into blatServers values("hivmn", "hiv1", "17781", "0", "0");' \
      | hgsql hgcentraltest -h localhost


