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

# This file describes browser build for the rheMac8
# Rhesus - Macaca mulatta

# Assembly Name:  Mmul_8.0.1
# Organism name:  Macaca mulatta
# Taxid:          9544
# Submitter:      Baylor College of Medicine Genome Sequencing Center
# Date:           2015-11-30
# BioSample:      SAMN02981228
# Assembly type:  haploid
# Release type:   major
# Assembly level: Chromosome
# Genome representation: full
# GenBank Assembly Accession: GCA_000772875.3 (latest)
# RefSeq Assembly Accession: GCF_000772875.2 (species-representative latest)
# RefSeq Assembly and GenBank Assemblies Identical: no
#
## Assembly-Units:
## GenBank Unit Accession       RefSeq Unit Accession   Assembly-Unit name
## GCA_000772885.3      GCF_000772885.2 Primary Assembly
##      GCF_000005875.1 non-nuclear

#############################################################################
# fetch sequence from new style download directory (DONE - 2016-01-08 - Hiram)
    mkdir -p /hive/data/genomes/rheMac8/refseq
    cd /hive/data/genomes/rheMac8/refseq

export asmName="GCF_000772875.2_Mmul_8.0.1"
export asmType="refseq"
export D="vertebrate_mammalian/Macaca_mulatta/latest_assembly_versions/${asmName}"

rsync -a -P -L \
   rsync://ftp.ncbi.nlm.nih.gov/genomes/${asmType}/${D}/ ./

    # measure what we have here:
    faSize *genomic.fna.gz
# 3236224332 bases (94132579 N's 3142091753 real 1857179349 upper
#      1284912404 lower) in 284728 sequences in 1 files
# Total size: mean 11366.0 sd 1223261.8 min 116 (NW_014950235.1)
#      max 225584828 (NC_027893.1) median 941
# %39.70 masked total, %40.89 masked real

    # check for duplicate sequences:

    mkdir /hive/data/genomes/rheMac8/ucsc
    cd /hive/data/genomes/rheMac8/ucsc
    faToTwoBit ../refseq/GCF_000772875.2_Mmul_8.0.1_genomic.fna.gz refseq.2bit
    #  real    1m32.684s
    twoBitDup refseq.2bit
    # no output is a good result
    rm refseq.2bit

#############################################################################
# fixup to UCSC naming scheme (DONE - 2016-01-29 - Hiram)
    mkdir /hive/data/genomes/rheMac8/ucsc
    cd /hive/data/genomes/rheMac8/ucsc

    time ~/kent/src/hg/utils/automation/ucscCompositeAgp.pl \
       ../refseq/*_assembly_structure/Primary_Assembly
NC_027904.1 12
NC_027902.1 10
NC_027913.1 X
NC_027897.1 5
NC_027903.1 11
NC_027896.1 4
NC_027901.1 9
NC_027912.1 20
NC_027898.1 6
NC_027899.1 7
NC_027905.1 13
NC_027907.1 15
NC_027911.1 19
NC_027906.1 14
NC_027914.1 Y
NC_027910.1 18
NC_027909.1 17
NC_027908.1 16
NC_027900.1 8
NC_027895.1 3
NC_027894.1 2
NC_027893.1 1

real    0m42.032s

    time ~/kent/src/hg/utils/automation/unplacedWithChroms.pl \
       ../refseq/*_assembly_structure/Primary_Assembly
    #  real    0m8.257s

    zcat \
  ../refseq/*_assembly_structure/non-nuclear/assem*/AGP/chrMT.comp.agp.gz \
     | grep -v "^#" | sed -e 's/^NC_005943.1/chrM/;' > chrM.agp

    zcat ../refseq/*_assembly_structure/non-nuclear/assem*/FASTA/*.fna.gz \
      | sed -e 's/^>.*/>chrM/;' > chrM.fa

    # verify nothing lost compared to genbank:
    faSize *.fa
#  3236224332 bases (94132579 N's 3142091753 real 3142091753 upper
#    0 lower) in 284728 sequences in 24 files
#  Total size: mean 11366.0 sd 1223261.8 min 116 (chrUn_NW_014950235v1)
#    max 225584828 (chr1) median 941
#  %0.00 masked total, %0.00 masked real

    # same totals as above: (except for masking)
# 3236224332 bases (94132579 N's 3142091753 real 1857179349 upper
#      1284912404 lower) in 284728 sequences in 1 files

#############################################################################
#  Initial database build (DONE - 2016-01-29 - Hiram)

    cd /hive/data/genomes/rheMac8
    printf "%s" \
# Config parameters for makeGenomeDb.pl:
db rheMac8
clade primate
genomeCladePriority 15
scientificName Macaca mulatta
commonName rhesus
assemblyDate Nov. 2015
assemblyLabel Baylor College of Medicine Genome Sequencing Center
assemblyShortLabel BCM Mmul_8.0.1
orderKey 18411
# chrM GCF_000005875.1 included in assembly
# mitoAcc NC_005943.1
mitoAcc none
fastaFiles /hive/data/genomes/rheMac8/ucsc/*.fa
agpFiles /hive/data/genomes/rheMac8/ucsc/*.agp
# qualFiles none
dbDbSpeciesDir rhesus
photoCreditURL http://www.wakehealth.edu/Faculty/Kaplan-Jay-R.htm
# photoCreditURL http://caplab.yale.edu/
# http://www.ncbi.nlm.nih.gov/sutils/static/GP_IMAGE/rhesus.jpg
# photoCreditName Dr. Laurie Santos
photoCreditName J.R. Kaplan
ncbiGenomeId 215
ncbiAssemblyId 2715158
ncbiAssemblyName Mmul_8.0.1
ncbiBioProject 12537
genBankAccessionID GCF_000772875.2
taxId 9544' > rheMac8.config.ra

    # verify sequence and AGP are OK:
    time makeGenomeDb.pl -workhorse=hgwdev -dbHost=hgwdev -fileServer=hgwdev \
         -stop=agp rheMac8.config.ra > agp.log 2>&1
    # real    4m50.591s

    # then finish it off:
    time (makeGenomeDb.pl -workhorse=hgwdev -dbHost=hgwdev \
       -fileServer=hgwdev -continue=db rheMac8.config.ra) > db.log 2>&1
    # real    30m6.878s

    # check in the trackDb files created and add to trackDb/makefile

#########################################################################
# ucscToINSDC table/track (DONE - 2016-02-05 - Hiram)
    # fixup the translateNames.sh file from rn6 work to use the new
    # genbank structure  (copied over from rn6/bed/ucscToINSDC)

    mkdir /hive/data/genomes/rheMac8/bed/ucscToINSDC
    cd /hive/data/genomes/rheMac8/bed/ucscToINSDC

    # find accession for chrM
    grep chrM ../../rheMac8.agp
# chrM    1       16564   1       O       NC_005943.1     1       16564   +
    # use that accession here:
    ~/kent/src/hg/utils/automation/ucscToINSDC.sh \
        ../../refseq/GCF_*structure/Primary_Assembly NC_005943.1 

    awk '{printf "%s\t0\t%d\n", $1,$2}' ../../chrom.sizes \
         | sort > name.coordinate.tab
    join name.coordinate.tab ucscToINSDC.txt | tr '[ ]' '[\t]' \
         > ucscToINSDC.bed
    # should be same line counts throughout:
    wc -l *
    # 284728 name.coordinate.tab
    # 284728 ucscToINSDC.bed
    # 284728 ucscToINSDC.txt

    cut -f1 ucscToINSDC.bed | awk '{print length($0)}' | sort -n | tail -1
    # 20
    # use the 16 in this sed
    sed -e "s/21/20/" $HOME/kent/src/hg/lib/ucscToINSDC.sql \
         | hgLoadSqlTab rheMac8 ucscToINSDC stdin ucscToINSDC.bed
    checkTableCoords rheMac8
    # should cover %100 entirely:
    featureBits -countGaps rheMac8 ucscToINSDC
    # 3236224332 bases of 3236224332 (100.000%) in intersection

#########################################################################
# fixup search rule for assembly track/gold table (DONE - 2016-02-05 - Hiram)
    hgsql -N -e "select frag from gold;" rheMac8 | sort | head -1
AC205186.3

    hgsql -N -e "select frag from gold;" rheMac8 | sort | tail -2
JSUE03348490.1
NC_005943.1

    # verify this rule will find them all or eliminate them all:
    hgsql -N -e "select frag from gold;" rheMac8 | wc -l
    # 348580

    hgsql -N -e "select frag from gold;" rheMac8 \
       | egrep -e '[AJN][CS][U2_][E0-9][0-9]+(\.[0-9]+)?' | wc -l
    # 348580

    hgsql -N -e "select frag from gold;" rheMac8 \
       | egrep -v -e '[AJN][CS][U2_][E0-9][0-9]+(\.[0-9]+)?' | wc -l
    # 0

    # hence, add to trackDb/rhesus/rheMac8/trackDb.ra
searchTable gold
shortCircuit 1
termRegex [AJN][CS][U2_][E0-9][0-9]+(\.[0-9]+)?
query select chrom,chromStart,chromEnd,frag from %s where frag like '%s%%'
searchPriority 8

    # verify searches work in the position box

#########################################################################

##########################################################################
# running repeat masker (DONE - 2016-01-29 - Hiram)
    mkdir /hive/data/genomes/rheMac8/bed/repeatMasker
    cd /hive/data/genomes/rheMac8/bed/repeatMasker
    time  (doRepeatMasker.pl -buildDir=`pwd` \
        -bigClusterHub=ku -dbHost=hgwdev -workhorse=hgwdev \
        -smallClusterHub=ku rheMac8) > do.log 2>&1
    # real    481m50.689s

    # broken cluster run due to sick machines, no real problem, it
    # completed, continuing:
    time  (doRepeatMasker.pl -buildDir=`pwd` \
        -bigClusterHub=ku -dbHost=hgwdev -workhorse=hgwdev \
        -continue=cat -smallClusterHub=ku rheMac8) > cat.log 2>&1
    #  real    61m1.143s

    cat faSize.rmsk.txt
    # 3236224332 bases (94132579 N's 3142091753 real 1436601310 upper
    #    1705490443 lower) in 284728 sequences in 1 files
    # Total size: mean 11366.0 sd 1223261.8 min 116 (chrUn_NW_014950235v1)
    #    max 225584828 (chr1) median 941
    # %52.70 masked total, %54.28 masked real

    egrep -i "versi|relea" do.log
    # RepeatMasker version open-4.0.5
    #    January 31 2015 (open-4-0-5) version of RepeatMasker
    # CC   RELEASE 20140131;

    time featureBits -countGaps rheMac8 rmsk
    # 1705908888 bases of 3236224332 (52.713%) in intersection
    # real    2m52.924s

    # why is it different than the faSize above ?
    # because rmsk masks out some N's as well as bases, the count above
    #   separates out the N's from the bases, it doesn't show lower case N's

    # faster way to get the same result:
    time hgsql -N -e 'select genoName,genoStart,genoEnd from rmsk;' rheMac8 \
        | bedSingleCover.pl stdin | ave -col=4 stdin | grep "^total"
    # total 1705908888.000000
    # real    0m39.734s

##########################################################################
# running simple repeat (DONE - 2016-01-29 - Hiram)

    mkdir /hive/data/genomes/rheMac8/bed/simpleRepeat
    cd /hive/data/genomes/rheMac8/bed/simpleRepeat
    time (doSimpleRepeat.pl -buildDir=`pwd` -bigClusterHub=ku \
        -dbHost=hgwdev -workhorse=hgwdev -smallClusterHub=ku \
        rheMac8) > do.log 2>&1
    # real    140m2.826s

    cat fb.simpleRepeat
    # 298982788 bases of 3142093174 (9.515%) in intersection

    # add to rmsk after it is done:
    cd /hive/data/genomes/rheMac8
    twoBitMask rheMac8.rmsk.2bit \
        -add bed/simpleRepeat/trfMask.bed rheMac8.2bit
    #   you can safely ignore the warning about fields >= 13
    twoBitToFa rheMac8.2bit stdout | faSize stdin > faSize.rheMac8.2bit.txt
    cat faSize.rheMac8.2bit.txt
    # 3236224332 bases (94132579 N's 3142091753 real 1434869663 upper
    #    1707222090 lower) in 284728 sequences in 1 files
    # Total size: mean 11366.0 sd 1223261.8 min 116 (chrUn_NW_014950235v1)
    #    max 225584828 (chr1) median 941
    # %52.75 masked total, %54.33 masked real

    rm /gbdb/rheMac8/rheMac8.2bit
    ln -s `pwd`/rheMac8.2bit /gbdb/rheMac8/rheMac8.2bit

#########################################################################
# CREATE MICROSAT TRACK (DONE - 2016-02-10 - Hiram)
    ssh hgwdev
    mkdir /cluster/data/rheMac8/bed/microsat
    cd /cluster/data/rheMac8/bed/microsat

    awk '($5==2 || $5==3) && $6 >= 15 && $8 == 100 && $9 == 0 {printf("%s\t%s\t%s\t%dx%s\n", $1, $2, $3, $6, $16);}' \
       ../simpleRepeat/simpleRepeat.bed > microsat.bed

    hgLoadBed rheMac8 microsat microsat.bed

##########################################################################
## WINDOWMASKER (DONE - 2016-02-02 - Hiram)

    mkdir /hive/data/genomes/rheMac8/bed/windowMasker
    cd /hive/data/genomes/rheMac8/bed/windowMasker
    time (doWindowMasker.pl -buildDir=`pwd` -workhorse=hgwdev \
        -dbHost=hgwdev rheMac8) > do.log 2>&1
    # real    665m37.329s

    # Masking statistics
    cat faSize.rheMac8.cleanWMSdust.txt
    # 3236224332 bases (94132579 N's 3142091753 real 1839176720 upper
    #    1302915033 lower) in 284728 sequences in 1 files
    # Total size: mean 11366.0 sd 1223261.8 min 116 (chrUn_NW_014950235v1)
    #    max 225584828 (chr1) median 941
    # %40.26 masked total, %41.47 masked real

    cat fb.rheMac8.rmsk.windowmaskerSdust.txt
    # 1061810183 bases of 3236224332 (32.810%) in intersection

##########################################################################
# cpgIslands - (DONE - 2016-02-04 - Hiram)
    mkdir /hive/data/genomes/rheMac8/bed/cpgIslands
    cd /hive/data/genomes/rheMac8/bed/cpgIslands
    time (doCpgIslands.pl -dbHost=hgwdev -bigClusterHub=ku \
      -workhorse=hgwdev -smallClusterHub=ku rheMac8) > do.log 2>&1
    # real    45m39.560s

    cat fb.rheMac8.cpgIslandExt.txt
    # 21989740 bases of 3142093174 (0.700%) in intersection

##############################################################################
# cpgIslands on UNMASKED sequence (DONE - 2016-01-29 - Hiram)
    mkdir /hive/data/genomes/rheMac8/bed/cpgIslandsUnmasked
    cd /hive/data/genomes/rheMac8/bed/cpgIslandsUnmasked

    # run stepwise so the loading can be done in a different table
    time (doCpgIslands.pl -dbHost=hgwdev -bigClusterHub=ku -buildDir=`pwd` \
       -tableName=cpgIslandExtUnmasked \
          -maskedSeq=/hive/data/genomes/rheMac8/rheMac8.unmasked.2bit \
             -workhorse=hgwdev -smallClusterHub=ku rheMac8) > do.log 2>&1
    # real    60m39.280s

    cat fb.rheMac8.cpgIslandExtUnmasked.txt
    # 41820506 bases of 3142093174 (1.331%) in intersection

#############################################################################
# cytoBandIdeo - (DONE - 2016-01-29 - Hiram)
    mkdir /hive/data/genomes/rheMac8/bed/cytoBand
    cd /hive/data/genomes/rheMac8/bed/cytoBand
    makeCytoBandIdeo.csh rheMac8

#########################################################################
# genscan - (DONE - 2016-02-04 - Hiram)
    mkdir /hive/data/genomes/rheMac8/bed/genscan
    cd /hive/data/genomes/rheMac8/bed/genscan
    time (doGenscan.pl -buildDir=`pwd` -workhorse=hgwdev -dbHost=hgwdev \
      -bigClusterHub=ku rheMac8) > do.log 2>&1
    # real    65m53.319s
    # two broken, run with window size 2,000,000 to finish, then continue:
    time (doGenscan.pl -buildDir=`pwd` -workhorse=hgwdev -dbHost=hgwdev \
      -continue=makeBed -bigClusterHub=ku rheMac8) > makeBed.log 2>&1
    # real    21m55.093s

    cat fb.rheMac8.genscan.txt
    # 54559229 bases of 3142093174 (1.736%) in intersection

    cat fb.rheMac8.genscanSubopt.txt
    # 52580737 bases of 3142093174 (1.673%) in intersection

########################################################################
# Create kluster run files (DONE - 2016-02-03 - Hiram)

    # numerator is rheMac8 gapless bases "real" as reported by:
    featureBits -noRandom -noHap rheMac8 gap
    # 72500454 bases of 2763479500 (2.624%) in intersection

    # denominator is hg19 gapless bases as reported by:
    #   featureBits -noRandom -noHap hg19 gap
    #     234344806 bases of 2861349177 (8.190%) in intersection
    # 1024 is threshold used for human -repMatch:
    calc \( 2763479500 / 2861349177 \) \* 1024
    #  ( 2763479500 / 2861349177 ) * 1024 = 988.975072

    # ==> use -repMatch=900 according to size scaled down from 1024 for human.
    #   and rounded down to nearest 50
    cd /hive/data/genomes/rheMac8
    blat rheMac8.2bit \
         /dev/null /dev/null -tileSize=11 -makeOoc=jkStuff/rheMac8.11.ooc \
        -repMatch=900
    #   Wrote 43065 overused 11-mers to jkStuff/rheMac8.11.ooc

    #   check non-bridged gaps to see what the typical size is:
    hgsql -N \
        -e 'select * from gap where bridge="no" order by size;' rheMac8 \
        | sort -k7,7nr | ave -col=7 stdin
    #   most non-bridged gaps have size = 100
    #   decide on a minimum gap for this break, use either 100 or 5000 will
    #   generate 13387 liftOver rows, but if use 6000, only got 11703 rows.
    #   so use 100 here to get more liftOver row.
    gapToLift -verbose=2 -minGap=100 rheMac8 jkStuff/nonBridged.lft \
        -bedFile=jkStuff/nonBridged.bed

########################################################################
# GENBANK AUTO UPDATE (DONE - 2016-02-03,10 - Hiram)
    ssh hgwdev
    cd $HOME/kent/src/hg/makeDb/genbank
    git pull
    # /cluster/data/genbank/data/organism.lst shows:
    # #organism       mrnaCnt estCnt  refSeqCnt
    # Macaca mulatta  378586  60372   5778

    # edit etc/genbank.conf to add rheMac8 just before rheMac2
# rheMac8 Macaca mulatta (rhesus)
rheMac8.serverGenome = /hive/data/genomes/rheMac8/rheMac8.2bit
rheMac8.clusterGenome = /hive/data/genomes/rheMac8/rheMac8.2bit
rheMac8.ooc = /hive/data/genomes/rheMac8/jkStuff/rheMac8.11.ooc
rheMac8.lift = /hive/data/genomes/rheMac8/jkStuff/rheMac8.nonBridged.lft
rheMac8.perChromTables = no
rheMac8.refseq.mrna.native.pslCDnaFilter  = ${finished.refseq.mrna.native.pslCDnaFilter}
rheMac8.refseq.mrna.xeno.pslCDnaFilter    = ${finished.refseq.mrna.xeno.pslCDnaFilter}
rheMac8.genbank.mrna.native.pslCDnaFilter = ${finished.genbank.mrna.native.pslCDnaFilter}
rheMac8.genbank.mrna.xeno.pslCDnaFilter   = ${finished.genbank.mrna.xeno.pslCDnaFilter}
rheMac8.genbank.est.native.pslCDnaFilter  = ${finished.genbank.est.native.pslCDnaFilter}
rheMac8.genbank.est.xeno.pslCDnaFilter    = ${finished.genbank.est.xeno.pslCDnaFilter}
rheMac8.downloadDir = rheMac8
rheMac8.genbank.mrna.xeno.load = yes
rheMac8.refseq.mrna.native.load  = yes
rheMac8.refseq.mrna.xeno.load  = yes
rheMac8.upstreamGeneTbl = refGene

    git commit -m "Added rheMac8; refs #16744" etc/genbank.conf
    git push
    # update /cluster/data/genbank/:
    make etc-update

    screen      #  control this business with a screen since it takes a while
    cd /cluster/data/genbank

    time ./bin/gbAlignStep -initial rheMac8
    # logFile: var/build/logs/2016.02.04-11:28:59.rheMac8.initalign.log
    #   real    2229m7.259s
    #   To re-do, rm the dir first:
    #     /cluster/data/genbank/work/initial.rheMac8

    # load database when finished
    ssh hgwdev
    cd /cluster/data/genbank
    time ./bin/gbDbLoadStep -drop -initialLoad rheMac8
    # logFile: var/dbload/hgwdev/logs/2016.02.09-14:37:59.rheMac8.dbload.log
    #  real    205m12.078s

    # enable daily alignment and update of hgwdev
    cd ~/kent/src/hg/makeDb/genbank
    git pull
    # add rheMac8 to:
    #   etc/align.dbs etc/hgwdev.dbs
    git add etc/align.dbs etc/hgwdev.dbs
    git commit -m "Added rheMac8 - Rhesus refs #16744" etc/align.dbs etc/hgwdev.dbs
    git push
    make etc-update

#############################################################################
# augustus gene track (DONE - 2016-02-05 - Hiram)

    mkdir /hive/data/genomes/rheMac8/bed/augustus
    cd /hive/data/genomes/rheMac8/bed/augustus
    time (doAugustus.pl -buildDir=`pwd` -bigClusterHub=ku \
        -species=human -dbHost=hgwdev \
           -workhorse=hgwdev rheMac8) > do.log 2>&1
    # real    95m5.905s

    cat fb.rheMac8.augustusGene.txt
    # 49244982 bases of 3142093174 (1.567%) in intersection

#########################################################################
# LIFTOVER TO rheMac3 (DONE - 2016-02-05 - Hiram)
    ssh hgwdev
    mkdir /hive/data/genomes/rheMac8/bed/blat.rheMac3.2016-02-05
    cd /hive/data/genomes/rheMac8/bed/blat.rheMac3.2016-02-05
    doSameSpeciesLiftOver.pl -verbose=2 \
        -debug -bigClusterHub=ku -dbHost=hgwdev -workhorse=hgwdev \
        -ooc=/hive/data/genomes/rheMac8/jkStuff/rheMac8.11.ooc \
         rheMac8 rheMac3
    time (doSameSpeciesLiftOver.pl -verbose=2 \
        -bigClusterHub=ku -dbHost=hgwdev -workhorse=hgwdev \
        -ooc=/hive/data/genomes/rheMac8/jkStuff/rheMac8.11.ooc \
         rheMac8 rheMac3) > doLiftOverToRheMac3.log 2>&1
    # real    1015m0.435s

    # see if the liftOver menus function in the browser from rheMac8 to Mac3

#########################################################################
# LIFTOVER TO rheMac2 (DONE - 2016-02-05 - Hiram)
    ssh hgwdev
    mkdir /hive/data/genomes/rheMac8/bed/blat.rheMac2.2016-02-05
    cd /hive/data/genomes/rheMac8/bed/blat.rheMac2.2016-02-05
    doSameSpeciesLiftOver.pl -verbose=2 -buildDir=`pwd` \
        -debug -bigClusterHub=ku -dbHost=hgwdev -workhorse=hgwdev \
        -ooc=/hive/data/genomes/rheMac8/jkStuff/rheMac8.11.ooc \
         rheMac8 rheMac2
    time (doSameSpeciesLiftOver.pl -verbose=2 -buildDir=`pwd` \
        -bigClusterHub=ku -dbHost=hgwdev -workhorse=hgwdev \
        -ooc=/hive/data/genomes/rheMac8/jkStuff/rheMac8.11.ooc \
         rheMac8 rheMac2) > doLiftOverToRheMac2.log 2>&1
    # real    873m23.446s
    # failed cluster run, continuing with chain:
    time (doSameSpeciesLiftOver.pl -verbose=2 -buildDir=`pwd` \
        -bigClusterHub=ku -dbHost=hgwdev -workhorse=hgwdev \
        -ooc=/hive/data/genomes/rheMac8/jkStuff/rheMac8.11.ooc \
         -continue=chain rheMac8 rheMac2) > chain.log 2>&1
    # real    31m30.389s

    # see if the liftOver menus function in the browser from rheMac8 to Mac2

##########################################################################
#  BLATSERVERS ENTRY (DONE - 2016-03-21 - Hiram)
#	After getting a blat server assigned by the Blat Server Gods,
    ssh hgwdev

    hgsql -e 'INSERT INTO blatServers (db, host, port, isTrans, canPcr) \
	VALUES ("rheMac8", "blat1b", "17860", "1", "0"); \
	INSERT INTO blatServers (db, host, port, isTrans, canPcr) \
	VALUES ("rheMac8", "blat1b", "17861", "0", "1");' \
	    hgcentraltest
    #	test it with some sequence

############################################################################
## reset default position to rheMac3 position (DONE - 2016-02-09 - Hiram)
    ssh hgwdev
    hgsql -e 'update dbDb set defaultPos="chr14:63580522-63594072"
	where name="rheMac8";' hgcentraltest

#########################################################################
# all.joiner update, downloads and in pushQ - (TBD 2014-10-21 - Hiram)
    cd $HOME/kent/src/hg/makeDb/schema
    # fixup all.joiner until this is a clean output
    joinerCheck -database=rheMac8 -tableCoverage all.joiner
    joinerCheck -database=rheMac8 -times all.joiner
    joinerCheck -database=rheMac8 -keys all.joiner

    cd /hive/data/genomes/rheMac8
    time (makeDownloads.pl rheMac8) > downloads.log 2>&1
    #  real    27m1.207s

    #   now ready for pushQ entry
    mkdir /hive/data/genomes/rheMac8/pushQ
    cd /hive/data/genomes/rheMac8/pushQ
    time makePushQSql.pl rheMac8 > rheMac8.pushQ.sql 2> stderr.out
    #  real    5m51.393s

    #   check for errors in stderr.out, some are OK, e.g.:
    # WARNING: hgwdev does not have /gbdb/rheMac8/wib/gc5Base.wib
    # WARNING: hgwdev does not have /gbdb/rheMac8/wib/quality.wib
    # WARNING: hgwdev does not have /gbdb/rheMac8/bbi/quality.bw
    # WARNING: rheMac8 does not have seq
    # WARNING: rheMac8 does not have extFile

    #   copy it to hgwbeta
    scp -p rheMac8.pushQ.sql qateam@hgwbeta:/tmp/
    ssh qateam@hgwbeta "./bin/x86_64/hgsql qapushq < /tmp/rheMac8.pushQ.sql"

    #   in that pushQ entry walk through each entry and see if the
    #   sizes will set properly

#########################################################################
# LIFTOVER TO rheMac10 (DONE - 2019-07-02 - Hiram)
    ssh hgwdev
    mkdir /hive/data/genomes/rheMac8/bed/blat.rheMac10.2019-07-02
    cd /hive/data/genomes/rheMac8/bed/blat.rheMac10.2019-07-02
    doSameSpeciesLiftOver.pl -verbose=2 \
        -debug -bigClusterHub=ku -dbHost=hgwdev -workhorse=hgwdev \
        -ooc=/hive/data/genomes/rheMac8/jkStuff/rheMac8.11.ooc \
         rheMac8 rheMac10
    time (doSameSpeciesLiftOver.pl -verbose=2 \
        -bigClusterHub=ku -dbHost=hgwdev -workhorse=hgwdev \
        -ooc=/hive/data/genomes/rheMac8/jkStuff/rheMac8.11.ooc \
         rheMac8 rheMac10) > doLiftOverToRheMac10.log 2>&1
XXX - running - Tue Jul  2 08:12:49 PDT 2019
    # real    1015m0.435s

    # see if the liftOver menus function in the browser from rheMac8 to rheMac10

#########################################################################
