###########################################################################
# Gorilla Lastz run (DONE - 2016-08-04 - Hiram)
    screen -S panTro5GorGor5  # use a screen to manage this longish running job
    mkdir /hive/data/genomes/panTro5/bed/lastzGorGor5.2016-08-04
    cd /hive/data/genomes/panTro5/bed/lastzGorGor5.2016-08-04

    # always set the BLASTZ program so we know what version was used
    printf "# chimp vs. gorilla
BLASTZ=/cluster/bin/penn/lastz-distrib-1.03.66/bin/lastz
BLASTZ_T=2
BLASTZ_O=600
BLASTZ_E=150
BLASTZ_M=254
BLASTZ_K=4500
BLASTZ_L=4500
BLASTZ_Y=15000
BLASTZ_Q=/scratch/data/blastz/human_chimp.v2.q
#    A    C    G    T
#    90 -330 -236 -356
#  -330  100 -318 -236
#  -236 -318  100 -330
#  -356 -236 -330   90

# TARGET: Chimp panTro5
SEQ1_DIR=/hive/data/genomes/panTro5/panTro5.2bit
SEQ1_LEN=/hive/data/genomes/panTro5/chrom.sizes
SEQ1_CHUNK=40000000
SEQ1_LAP=10000
SEQ1_IN_CONTIGS=0
SEQ1_LIMIT=200

# QUERY: Gorilla gorGor5
SEQ2_DIR=/hive/data/genomes/gorGor5/gorGor5.2bit
SEQ2_LEN=/hive/data/genomes/gorGor5/chrom.sizes
SEQ2_CHUNK=20000000
SEQ2_LAP=0
SEQ2_LIMIT=200
SEQ2_IN_CONTIGS=0

BASE=/hive/data/genomes/panTro5/bed/lastzGorGor5.2016-08-04
TMPDIR=/dev/shm
" > DEF

    time (doBlastzChainNet.pl `pwd`/DEF -verbose=2 \
        -chainMinScore=3000 -chainLinearGap=medium \
        -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
        -syntenicNet) > do.log 2>&1
    # real    204m8.839s

    cat fb.panTro5.chainGorGor5Link.txt
    # 2899634368 bases of 3132620660 (92.563%) in intersection

    # filter with doRecipBest.pl
    time (doRecipBest.pl -workhorse=hgwdev -buildDir=`pwd` \
        panTro5 gorGor5) > rbest.log 2>&1
    # real    136m0.379s

    # running the swap
    mkdir /hive/data/genomes/gorGor5/bed/blastz.panTro5.swap
    cd /hive/data/genomes/gorGor5/bed/blastz.panTro5.swap
    time (doBlastzChainNet.pl -verbose=2 \
        -swap /hive/data/genomes/panTro5/bed/lastzGorGor5.2016-08-04/DEF \
        -chainMinScore=3000 -chainLinearGap=medium \
        -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
        -syntenicNet) > swap.log 2>&1
    # real    102m31.679s

    cat fb.gorGor5.chainPanTro5Link.txt
    # 2755486334 bases of 3080431298 (89.451%) in intersection

    time (doRecipBest.pl -workhorse=hgwdev -buildDir=`pwd` \
        gorGor5 panTro5) > rbest.log 2>&1
    # real    118m53.869s

#############################################################################
# swap hg19 chainNet (DONE - 2017-05-11 - Hiram)
    # alignment to hg19
    cd /hive/data/genomes/hg19/bed/lastzPanTro5.2017-05-04
    cat fb.hg19.chainPanTro5Link.txt
    # 2824333913 bases of 2897316137 (97.481%) in intersection

    # running the swap
    mkdir /hive/data/genomes/panTro5/bed/blastz.hg19.swap
    cd /hive/data/genomes/panTro5/bed/blastz.hg19.swap
    time (doBlastzChainNet.pl -verbose=2 \
        -swap /hive/data/genomes/hg19/bed/lastzPanTro5.2017-05-04/DEF \
        -chainMinScore=5000 -chainLinearGap=medium \
        -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
        -syntenicNet) > swap.log 2>&1
    # real    111m15.418s

    cat fb.panTro5.chainHg19Link.txt
    # 2929713252 bases of 3132620660 (93.523%) in intersection

    time (doRecipBest.pl -workhorse=hgwdev -buildDir=`pwd` \
        panTro5 hg19) > rbest.log 2>&1
    # real    279m26.262s

#############################################################################
# Rhesus lastz/chainNet run (DONE - 2017-08-08 - Hiram)
    screen -S panTro5RheMac8  # use a screen to manage this longish running job
    mkdir /hive/data/genomes/panTro5/bed/lastzRheMac8.2017-08-08
    cd /hive/data/genomes/panTro5/bed/lastzRheMac8.2017-08-08

    # always set the BLASTZ program so we know what version was used
    printf "# chimp vs. rhesus
BLASTZ=/cluster/bin/penn/lastz-distrib-1.03.66/bin/lastz
BLASTZ_T=2
BLASTZ_O=600
BLASTZ_E=150
BLASTZ_M=254
BLASTZ_K=4500
BLASTZ_L=4500
BLASTZ_Y=15000
BLASTZ_Q=/scratch/data/blastz/human_chimp.v2.q
#    A    C    G    T
#    90 -330 -236 -356
#  -330  100 -318 -236
#  -236 -318  100 -330
#  -356 -236 -330   90

# TARGET: Chimp panTro5
SEQ1_DIR=/hive/data/genomes/panTro5/panTro5.2bit
SEQ1_LEN=/hive/data/genomes/panTro5/chrom.sizes
SEQ1_CHUNK=40000000
SEQ1_LAP=10000
SEQ1_IN_CONTIGS=0
SEQ1_LIMIT=400

# QUERY: Rhesus rheMac8
SEQ2_DIR=/hive/data/genomes/rheMac8/rheMac8.2bit
SEQ2_LEN=/hive/data/genomes/rheMac8/chrom.sizes
SEQ2_CHUNK=20000000
SEQ2_LAP=0
SEQ2_LIMIT=1000
SEQ2_IN_CONTIGS=0

BASE=/hive/data/genomes/panTro5/bed/lastzRheMac8.2017-08-08
TMPDIR=/dev/shm
" > DEF

    time (doBlastzChainNet.pl `pwd`/DEF -verbose=2 \
        -chainMinScore=3000 -chainLinearGap=medium \
        -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
        -syntenicNet) > do.log 2>&1
    # real    187m26.960s

    cat fb.panTro5.chainRheMac8Link.txt
    # 2586883104 bases of 3132620660 (82.579%) in intersection

    # filter with doRecipBest.pl
    time (doRecipBest.pl -workhorse=hgwdev -buildDir=`pwd` \
        panTro5 rheMac8) > rbest.log 2>&1
    # real    368m0.695s

    # running the swap
    mkdir /hive/data/genomes/rheMac8/bed/blastz.panTro5.swap
    cd /hive/data/genomes/rheMac8/bed/blastz.panTro5.swap
    time (doBlastzChainNet.pl -verbose=2 \
        -swap /hive/data/genomes/panTro5/bed/lastzRheMac8.2017-08-08/DEF \
        -chainMinScore=3000 -chainLinearGap=medium \
        -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
        -syntenicNet) > swap.log 2>&1
    # real    214m12.404s

    cat fb.rheMac8.chainPanTro5Link.txt
    # 2494854251 bases of 3142093174 (79.401%) in intersection

    time (doRecipBest.pl -workhorse=hgwdev -buildDir=`pwd` \
        rheMac8 panTro5) > rbest.log 2>&1
    # real    567m24.754s

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