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

#########################################################################
# LASTZ Crab-eating macaque/macFas5 Green monkey/chlSab1 -
#              (DONE - 2014-05-15 - Hiram)
    mkdir /hive/data/genomes/macFas5/bed/lastzChlSab1.2014-05-15
    cd /hive/data/genomes/macFas5/bed/lastzChlSab1.2014-05-15

    cat << '_EOF_' > DEF
# Crab-eating macaque vs. Green monkey
# parameters used are from the human-chimp tuning from long ago

BLASTZ=/cluster/bin/penn/lastz-distrib-1.03.52/bin/lastz
BLASTZ_M=245
BLASTZ_O=600
BLASTZ_E=150

BLASTZ_T=2
BLASTZ_Y=15000
BLASTZ_K=4500
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: Crab-eating macaque
SEQ1_DIR=/hive/data/genomes/macFas5/macFas5.2bit
SEQ1_LEN=/hive/data/genomes/macFas5/chrom.sizes
SEQ1_CHUNK=20000000
SEQ1_LAP=10000
SEQ1_LIMIT=50

# QUERY: Green monkey chlSab1
SEQ2_DIR=/hive/data/genomes/chlSab1/chlSab1.2bit
SEQ2_LEN=/hive/data/genomes/chlSab1/chrom.sizes
SEQ2_CHUNK=10000000
SEQ2_LAP=0
SEQ2_LIMIT=200

BASE=/hive/data/genomes/macFas5/bed/lastzChlSab1.2014-05-15
TMPDIR=/dev/shm
'_EOF_'
    # << happy emacs

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

    cat fb.macFas5.chainChlSab1Link.txt 
    # 2602112483 bases of 2803866698 (92.804%) in intersection

    time (doRecipBest.pl -buildDir=`pwd` macFas5 chlSab1) > rbest.log 2>&1 &
    # real    73m55.625s

    # and for the swap:
    mkdir /hive/data/genomes/chlSab1/bed/blastz.macFas5.swap
    cd /hive/data/genomes/chlSab1/bed/blastz.macFas5.swap

    time (doBlastzChainNet.pl -verbose=2 \
      /hive/data/genomes/macFas5/bed/lastzChlSab1.2014-05-15/DEF \
     -chainMinScore=5000 -chainLinearGap=medium \
        -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
             -swap -syntenicNet) > do.log 2>&1
XXX - running - Wed Jan 21 09:38:12 PST 2015
    #  real    117m56.319s

    cat fb.chlSab1.chainMacFas5Link.txt 
    # 2665801248 bases of 2725905606 (97.795%) in intersection

    time (doRecipBest.pl -buildDir=`pwd` chlSab1 macFas5) > rbest.log 2>&1
    # real    79m30.931s

#########################################################################
# LASTZ Crab-eating macaque/macFas5 Green monkey/papHam1 -
#              (DONE - 2014-05-15 - Hiram)
    mkdir /hive/data/genomes/macFas5/bed/lastzPapHam1.2014-05-15
    cd /hive/data/genomes/macFas5/bed/lastzPapHam1.2014-05-15

    cat << '_EOF_' > DEF
# Crab-eating macaque vs. Baboon
# parameters used are from the human-chimp tuning from long ago

BLASTZ=/cluster/bin/penn/lastz-distrib-1.03.52/bin/lastz
BLASTZ_M=245
BLASTZ_O=600
BLASTZ_E=150

BLASTZ_T=2
BLASTZ_Y=15000
BLASTZ_K=4500
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: Crab-eating macaque
SEQ1_DIR=/hive/data/genomes/macFas5/macFas5.2bit
SEQ1_LEN=/hive/data/genomes/macFas5/chrom.sizes
SEQ1_CHUNK=20000000
SEQ1_LAP=10000
SEQ1_LIMIT=50

# QUERY: Baboon papHam1
SEQ2_DIR=/hive/data/genomes/papHam1/papHam1.2bit
SEQ2_LEN=/hive/data/genomes/papHam1/chrom.sizes
SEQ2_CHUNK=10000000
SEQ2_LAP=0
SEQ2_LIMIT=1500

BASE=/hive/data/genomes/macFas5/bed/lastzPapHam1.2014-05-15
TMPDIR=/dev/shm
'_EOF_'
    # << happy emacs

    time (doBlastzChainNet.pl -verbose=2 `pwd`/DEF \
     -chainMinScore=5000 -chainLinearGap=medium \
        -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
             -syntenicNet) > do.log 2>&1
    # real    525m11.457s
    # real    73m16.304s

    cat fb.macFas5.chainPapHam1Link.txt 
    # 2486618688 bases of 2803866698 (88.685%) in intersection

    time (doRecipBest.pl -buildDir=`pwd` macFas5 papHam1) > rbest.log 2>&1 &
    # real    109m2.057s

    # and for the swap:   (DONE - 2015-01-26 - Hiram)
    mkdir /hive/data/genomes/papHam1/bed/blastz.macFas5.swap
    cd /hive/data/genomes/papHam1/bed/blastz.macFas5.swap

    time (doBlastzChainNet.pl -verbose=2 \
      /hive/data/genomes/macFas5/bed/lastzPapHam1.2014-05-15/DEF \
     -chainMinScore=5000 -chainLinearGap=medium \
        -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
             -swap -syntenicNet) > do.log 2>&1
    #  real    619m9.663s

    cat fb.papHam1.chainMacFas5Link.txt 
    # 2522131870 bases of 2741849051 (91.987%) in intersection

    time (doRecipBest.pl -buildDir=`pwd` papHam1 macFas5) > rbest.log 2>&1
    # real    244m37.728s

##############################################################################
# LASTZ Crab-eating macaque MacFas5 vs. Rhesus RheMac2
#	(DONE - 2021-10-12 - hiram)

    cd /cluster/home/hiram/kent/src/hg/makeDb/doc/macFas5

    time (~/kent/src/hg/utils/automation/pairLastz.sh macFas5 rheMac2 \
      primate primate) > macFas5.rheMac2.log 2>&1 &
    #	real	366m28.349s
    #	user	0m1.422s
    #	sys	0m1.082s

    # the following make doc is in that log file, copied here:

    mkdir /hive/data/genomes/macFas5/bed/lastzRheMac2.2021-10-12
    cd /hive/data/genomes/macFas5/bed/lastzRheMac2.2021-10-12

    printf '# Rhesus RheMac2 vs. Crab-eating macaque MacFas5
BLASTZ=/cluster/bin/penn/lastz-distrib-1.04.03/bin/lastz
BLASTZ_T=2
BLASTZ_O=600
BLASTZ_E=150
BLASTZ_M=254
BLASTZ_K=4500
BLASTZ_Y=15000
BLASTZ_Q=/hive/data/staging/data/blastz/human_chimp.v2.q
#       A     C     G     T
# A    90  -330  -236  -356
# C  -330   100  -318  -236
# G  -236  -318   100  -330
# T  -356  -236  -330    90

# TARGET: Crab-eating macaque MacFas5
SEQ1_DIR=/hive/data/genomes/macFas5/macFas5.2bit
SEQ1_LEN=/hive/data/genomes/macFas5/chrom.sizes
SEQ1_CHUNK=20000000
SEQ1_LAP=10000
SEQ1_LIMIT=40

# QUERY: Rhesus RheMac2
SEQ2_DIR=/hive/data/genomes/rheMac2/rheMac2.2bit
SEQ2_LEN=/hive/data/genomes/rheMac2/chrom.sizes
SEQ2_CHUNK=20000000
SEQ2_LAP=0
SEQ2_LIMIT=100

BASE=/hive/data/genomes/macFas5/bed/lastzRheMac2.2021-10-12
TMPDIR=/dev/shm

' > DEF

    time (~/kent/src/hg/utils/automation/doBlastzChainNet.pl  -verbose=2 `pwd`/DEF -syntenicNet \
        -workhorse=hgwdev -smallClusterHub=hgwdev -bigClusterHub=ku \
        -chainMinScore=5000 -chainLinearGap=medium) > do.log 2>&1
    grep -w real do.log | sed -e 's/^/    # /;'
    # real	158m45.932s

    sed -e 's/^/    # /;' fb.macFas5.chainRheMac2Link.txt
    # 2614119665 bases of 2803866698 (93.233%) in intersection
    sed -e 's/^/    # /;' fb.macFas5.chainSynRheMac2Link.txt
    # 2604737022 bases of 2803866698 (92.898%) in intersection

    time (~/kent/src/hg/utils/automation/doRecipBest.pl  -load -workhorse=hgwdev -buildDir=`pwd` \
       \
       \
        macFas5 rheMac2) > rbest.log 2>&1

    grep -w real rbest.log | sed -e 's/^/    # /;'
    # real	77m6.953s

    sed -e 's/^/    # /;' fb.macFas5.chainRBest.RheMac2.txt
    # 2596696673 bases of 2803866698 (92.611%) in intersection

    ### and for the swap

    cd /hive/data/genomes/rheMac2/bed/blastz.macFas5.swap

   time (~/kent/src/hg/utils/automation/doBlastzChainNet.pl  -swap -verbose=2 \
    /hive/data/genomes/macFas5/bed/lastzRheMac2.2021-10-12/DEF -swapDir=`pwd` \
  -syntenicNet -workhorse=hgwdev -smallClusterHub=hgwdev -bigClusterHub=ku \
    -chainMinScore=5000 -chainLinearGap=medium) > swap.log 2>&1

    grep -w real swap.log | sed -e 's/^/    # /;'
    # real	76m2.171s

    sed -e 's/^/    # /;' fb.rheMac2.chainMacFas5Link.txt
    # 2600572513 bases of 2646704109 (98.257%) in intersection
    sed -e 's/^/    # /;' fb.rheMac2.chainSynMacFas5Link.txt
    # 2595637716 bases of 2646704109 (98.071%) in intersection
\    time (~/kent/src/hg/utils/automation/doRecipBest.pl  -load -workhorse=hgwdev -buildDir=`pwd` \
    \
    \
   rheMac2 macFas5) > rbest.log 2>&1

    grep -w real rbest.log | sed -e 's/^/    # /;'
    # real	54m32.803s

    sed -e 's/^/    # /;' fb.rheMac2.chainRBest.MacFas5.txt
    # 2596730835 bases of 2646704109 (98.112%) in intersection


##############################################################################
# LASTZ crab-eating macaque GCA_011100615.1 vs. Crab-eating macaque MacFas5
#    (DONE - 2023-07-19 - Gerardo)

    mkdir /hive/data/genomes/asmHubs/allBuild/GCA/011/100/615/GCA_011100615.1_Macaca_fascicularis_6.0/trackData/lastzMacFas5.2023-07-19
    cd /hive/data/genomes/asmHubs/allBuild/GCA/011/100/615/GCA_011100615.1_Macaca_fascicularis_6.0/trackData/lastzMacFas5.2023-07-19

    printf '# Crab-eating macaque MacFas5 vs. crab-eating macaque GCA_011100615.1
BLASTZ=/cluster/bin/penn/lastz-distrib-1.04.03/bin/lastz
BLASTZ_T=2
BLASTZ_O=600
BLASTZ_E=150
BLASTZ_M=254
BLASTZ_K=4500
BLASTZ_Y=15000
BLASTZ_Q=/hive/data/staging/data/blastz/human_chimp.v2.q
#       A     C     G     T
# A    90  -330  -236  -356
# C  -330   100  -318  -236
# G  -236  -318   100  -330
# T  -356  -236  -330    90

# TARGET: crab-eating macaque 2020-03-10 GCA_011100615.1_Macaca_fascicularis_6.0
SEQ1_DIR=/hive/data/genomes/asmHubs/GCA/011/100/615/GCA_011100615.1/GCA_011100615.1.2bit
SEQ1_LEN=/hive/data/genomes/asmHubs/GCA/011/100/615/GCA_011100615.1/GCA_011100615.1.chrom.sizes.txt
SEQ1_CHUNK=20000000
SEQ1_LAP=10000
SEQ1_LIMIT=40

# QUERY: Crab-eating macaque  macFas5
SEQ2_DIR=/hive/data/genomes/macFas5/macFas5.2bit
SEQ2_LEN=/hive/data/genomes/macFas5/chrom.sizes
SEQ2_CHUNK=20000000
SEQ2_LAP=0
SEQ2_LIMIT=100

BASE=/hive/data/genomes/asmHubs/allBuild/GCA/011/100/615/GCA_011100615.1_Macaca_fascicularis_6.0/trackData/lastzMacFas5.2023-07-19
TMPDIR=/dev/shm

' > DEF

    time (~/kent/src/hg/utils/automation/doBlastzChainNet.pl -trackHub -noDbNameCheck -verbose=2 `pwd`/DEF -syntenicNet \
      -tAsmId GCA_011100615.1_Macaca_fascicularis_6.0  -workhorse=hgwdev -smallClusterHub=hgwdev -bigClusterHub=ku \
        -chainMinScore=5000 -chainLinearGap=medium) > do.log 2>&1
    grep -w real do.log | sed -e 's/^/    # /;'
    # real	115m11.046s

    sed -e 's/^/    # /;' fb.GCA_011100615.1.chainMacFas5Link.txt
    # 2761984914 bases of 2906138557 (95.040%) in intersection
    sed -e 's/^/    # /;' fb.GCA_011100615.1.chainSynMacFas5Link.txt
    # 2731406308 bases of 2906138557 (93.987%) in intersection

    time (~/kent/src/hg/utils/automation/doRecipBest.pl -trackHub -load -workhorse=hgwdev -buildDir=`pwd` \
      -target2Bit="/hive/data/genomes/asmHubs/GCA/011/100/615/GCA_011100615.1/GCA_011100615.1.2bit" \
-targetSizes="/hive/data/genomes/asmHubs/GCA/011/100/615/GCA_011100615.1/GCA_011100615.1.chrom.sizes.txt" \
       \
        GCA_011100615.1 macFas5) > rbest.log 2>&1

    grep -w real rbest.log | sed -e 's/^/    # /;'
    # real	75m47.657s

    sed -e 's/^/    # /;' fb.GCA_011100615.1.chainRBest.MacFas5.txt
    # 2678569575 bases of 2906138557 (92.169%) in intersection

    ### and for the swap

    cd /hive/data/genomes/macFas5/bed/blastz.GCA_011100615.1.swap

   time (~/kent/src/hg/utils/automation/doBlastzChainNet.pl -trackHub -noDbNameCheck -swap -verbose=2 \
  -tAsmId GCA_011100615.1_Macaca_fascicularis_6.0  /hive/data/genomes/asmHubs/allBuild/GCA/011/100/615/GCA_011100615.1_Macaca_fascicularis_6.0/trackData/lastzMacFas5.2023-07-19/DEF -swapDir=`pwd` \
  -syntenicNet -workhorse=hgwdev -smallClusterHub=hgwdev -bigClusterHub=ku \
    -chainMinScore=5000 -chainLinearGap=medium) > swap.log 2>&1

    grep -w real swap.log | sed -e 's/^/    # /;'
    # real	90m44.045s

    sed -e 's/^/    # /;' fb.macFas5.chainGCA_011100615.1Link.txt
    # 2690649811 bases of 2946843737 (91.306%) in intersection
    sed -e 's/^/    # /;' fb.macFas5.chainSynGCA_011100615.1Link.txt
    # 2679307687 bases of 2946843737 (90.921%) in intersection
\    time (~/kent/src/hg/utils/automation/doRecipBest.pl -trackHub -load -workhorse=hgwdev -buildDir=`pwd` \
   -query2bit="/hive/data/genomes/asmHubs/GCA/011/100/615/GCA_011100615.1/GCA_011100615.1.2bit" \
-querySizes="/hive/data/genomes/asmHubs/GCA/011/100/615/GCA_011100615.1/GCA_011100615.1.chrom.sizes.txt" \
    \
   macFas5 GCA_011100615.1) > rbest.log 2>&1

    grep -w real rbest.log | sed -e 's/^/    # /;'
    # real	72m23.439s

    sed -e 's/^/    # /;' fb.macFas5.chainRBest.GCA_011100615.1.txt
    # 2680072146 bases of 2946843737 (90.947%) in intersection

real	354m14.218s
user	0m3.158s
sys	0m3.325s
##############################################################################
# LASTZ Chimp PanTro6 vs. Crab-eating macaque MacFas5
#    (DONE - 2023-12-11 - gperez2)

    mkdir /hive/data/genomes/panTro6/bed/lastzMacFas5.2023-12-11
    cd /hive/data/genomes/panTro6/bed/lastzMacFas5.2023-12-11

    printf '# Crab-eating macaque MacFas5 vs. Chimp PanTro6
BLASTZ=/cluster/bin/penn/lastz-distrib-1.04.03/bin/lastz
BLASTZ_T=2
BLASTZ_O=600
BLASTZ_E=150
BLASTZ_M=254
BLASTZ_K=4500
BLASTZ_Y=15000
BLASTZ_Q=/hive/data/staging/data/blastz/human_chimp.v2.q
#       A     C     G     T
# A    90  -330  -236  -356
# C  -330   100  -318  -236
# G  -236  -318   100  -330
# T  -356  -236  -330    90

# TARGET: Chimp  panTro6
SEQ1_DIR=/hive/data/genomes/panTro6/panTro6.2bit
SEQ1_LEN=/hive/data/genomes/panTro6/chrom.sizes
SEQ1_CHUNK=20000000
SEQ1_LAP=10000
SEQ1_LIMIT=40

# QUERY: Crab-eating macaque  macFas5
SEQ2_DIR=/hive/data/genomes/macFas5/macFas5.2bit
SEQ2_LEN=/hive/data/genomes/macFas5/chrom.sizes
SEQ2_CHUNK=20000000
SEQ2_LAP=0
SEQ2_LIMIT=100

BASE=/hive/data/genomes/panTro6/bed/lastzMacFas5.2023-12-11
TMPDIR=/dev/shm

' > DEF

    time (~/kent/src/hg/utils/automation/doBlastzChainNet.pl  -verbose=2 `pwd`/DEF -syntenicNet \
        -workhorse=hgwdev -smallClusterHub=hgwdev -bigClusterHub=ku \
        -chainMinScore=5000 -chainLinearGap=medium) > do.log 2>&1
    grep -w real do.log | sed -e 's/^/    # /;'
    # real	93m4.325s

    sed -e 's/^/    # /;' fb.panTro6.chainMacFas5Link.txt
    # 2482510656 bases of 3018592990 (82.241%) in intersection
    sed -e 's/^/    # /;' fb.panTro6.chainSynMacFas5Link.txt
    # 2446198446 bases of 3018592990 (81.038%) in intersection

    time (~/kent/src/hg/utils/automation/doRecipBest.pl  -load -workhorse=hgwdev -buildDir=`pwd` \
       \
       \
        panTro6 macFas5) > rbest.log 2>&1

    grep -w real rbest.log | sed -e 's/^/    # /;'
    # real	113m36.180s

    sed -e 's/^/    # /;' fb.panTro6.chainRBest.MacFas5.txt
    # 2400158905 bases of 3018592990 (79.513%) in intersection

    ### and for the swap

    cd /hive/data/genomes/macFas5/bed/blastz.panTro6.swap

   time (~/kent/src/hg/utils/automation/doBlastzChainNet.pl  -swap -verbose=2 \
    /hive/data/genomes/panTro6/bed/lastzMacFas5.2023-12-11/DEF -swapDir=`pwd` \
  -syntenicNet -workhorse=hgwdev -smallClusterHub=hgwdev -bigClusterHub=ku \
    -chainMinScore=5000 -chainLinearGap=medium) > swap.log 2>&1

    grep -w real swap.log | sed -e 's/^/    # /;'
    # real	57m31.785s

    sed -e 's/^/    # /;' fb.macFas5.chainPanTro6Link.txt
    # 2430179833 bases of 2803866698 (86.672%) in intersection
    sed -e 's/^/    # /;' fb.macFas5.chainSynPanTro6Link.txt
    # 2406117748 bases of 2803866698 (85.814%) in intersection
\    time (~/kent/src/hg/utils/automation/doRecipBest.pl  -load -workhorse=hgwdev -buildDir=`pwd` \
    \
    \
   macFas5 panTro6) > rbest.log 2>&1

    grep -w real rbest.log | sed -e 's/^/    # /;'
    # real	106m35.531s

    sed -e 's/^/    # /;' fb.macFas5.chainRBest.PanTro6.txt
    # 2400398207 bases of 2803866698 (85.610%) in intersection

real	370m48.159s
user	0m1.744s
sys	0m1.977s
##############################################################################
