#########################################################################
# LASTZ rat/rn6 vs. chicken/galGal5 - (DONE - 2016-05-03 - Hiram)
    mkdir /hive/data/genomes/rn6/bed/lastzGalGal5.2016-05-03
    cd /hive/data/genomes/rn6/bed/lastzGalGal5.2016-05-03

    printf '# Rat vs. chicken
BLASTZ=/cluster/bin/penn/lastz-distrib-1.03.66/bin/lastz
BLASTZ_O=400
BLASTZ_E=30
BLASTZ_Y=3400
BLASTZ_L=6000
BLASTZ_K=2200
BLASTZ_M=50
BLASTZ_Q=/scratch/data/blastz/HoxD55.q
#      A    C    G    T
#     91  -90  -25 -100
#    -90  100 -100  -25
#    -25 -100  100  -90
#   -100  -25  -90  91

# TARGET: Rat Rn6
SEQ1_DIR=/hive/data/genomes/rn6/rn6.2bit
SEQ1_LEN=/hive/data/genomes/rn6/chrom.sizes
SEQ1_CHUNK=20000000
SEQ1_LAP=10000
SEQ1_LIMIT=15

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

BASE=/hive/data/genomes/rn6/bed/lastzGalGal5.2016-05-03
TMPDIR=/dev/shm
' > DEF

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

    cat fb.rn6.chainGalGal5Link.txt
    # 108740749 bases of 2729860805 (3.983%) in intersection

    time (doRecipBest.pl -buildDir=`pwd` rn6 galGal5) > rbest.log 2>&1 &
    # real    206m46.355s

    # and for the swap:
    mkdir /hive/data/genomes/galGal5/bed/blastz.rn6.swap
    cd /hive/data/genomes/galGal5/bed/blastz.rn6.swap

    time (doBlastzChainNet.pl -verbose=2 \
      /hive/data/genomes/rn6/bed/lastzGalGal5.2016-05-03/DEF \
        -swap -chainMinScore=5000 -chainLinearGap=loose \
          -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
            -syntenicNet) > swap.log 2>&1
    #  real    16m43.312s

    cat fb.galGal5.chainRn6Link.txt
    # 95694615 bases of 1218501075 (7.853%) in intersection

    time (doRecipBest.pl -buildDir=`pwd` galGal5 rn6) > rbest.log 2>&1
    # real    171m15.342s

#########################################################################
# LASTZ zebrafish/danRer10 vs. chicken/galGal5 - (DONE - 2016-05-03 - Hiram)
    mkdir /hive/data/genomes/danRer10/bed/lastzGalGal5.2016-05-03
    cd /hive/data/genomes/danRer10/bed/lastzGalGal5.2016-05-03

    printf '# zebrafish vs. chicken
BLASTZ=/cluster/bin/penn/lastz-distrib-1.03.66/bin/lastz
BLASTZ_O=400
BLASTZ_E=30
BLASTZ_Y=3400
BLASTZ_L=6000
BLASTZ_K=2200
BLASTZ_M=50
BLASTZ_Q=/scratch/data/blastz/HoxD55.q
#      A    C    G    T
#     91  -90  -25 -100
#    -90  100 -100  -25
#    -25 -100  100  -90
#   -100  -25  -90  91

# TARGET: Rat DanRer10
SEQ1_DIR=/hive/data/genomes/danRer10/danRer10.2bit
SEQ1_LEN=/hive/data/genomes/danRer10/chrom.sizes
SEQ1_CHUNK=20000000
SEQ1_LAP=10000
SEQ1_LIMIT=15

# QUERY: chicken galGal5
SEQ2_DIR=/hive/data/genomes/galGal5/galGal5.2bit
SEQ2_LEN=/hive/data/genomes/galGal5/chrom.sizes
SEQ2_CHUNK=10000000
SEQ2_LIMIT=100
SEQ2_LAP=0

BASE=/hive/data/genomes/danRer10/bed/lastzGalGal5.2016-05-03
TMPDIR=/dev/shm
' > DEF

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

    cat fb.danRer10.chainGalGal5Link.txt
    # 58108752 bases of 1369683683 (4.242%) in intersection

    time (doRecipBest.pl -buildDir=`pwd` danRer10 galGal5) > rbest.log 2>&1 &
    # real    92m11.817s

    # and for the swap:
    mkdir /hive/data/genomes/galGal5/bed/blastz.danRer10.swap
    cd /hive/data/genomes/galGal5/bed/blastz.danRer10.swap

    time (doBlastzChainNet.pl -verbose=2 \
      /hive/data/genomes/danRer10/bed/lastzGalGal5.2016-05-03/DEF \
        -swap -chainMinScore=5000 -chainLinearGap=loose \
          -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
            -syntenicNet) > swap.log 2>&1
    #  real    8m52.412s

    cat fb.galGal5.chainDanRer10Link.txt
    # 49128539 bases of 1218501075 (4.032%) in intersection

    time (doRecipBest.pl -buildDir=`pwd` galGal5 danRer10) > rbest.log 2>&1
    # real    83m20.585s

#########################################################################
# LASTZ chicken/galGal5 vs. Chinese softshell turtle - (DONE - 2016-05-10 - Hiram)
    mkdir /hive/data/genomes/galGal5/bed/lastzPelSin1.2016-05-10
    cd /hive/data/genomes/galGal5/bed/lastzPelSin1.2016-05-10

    printf '# chicken vs. Chinese softshell turtle
BLASTZ=/cluster/bin/penn/lastz-distrib-1.03.66/bin/lastz
BLASTZ_M=254

# TARGET: chicken galGal5
SEQ1_DIR=/hive/data/genomes/galGal5/galGal5.2bit
SEQ1_LEN=/hive/data/genomes/galGal5/chrom.sizes
SEQ1_CHUNK=20000000
SEQ1_LIMIT=100
SEQ1_LAP=10000

# QUERY: Chinese softshell turtle pelSin1
SEQ2_DIR=/hive/data/genomes/pelSin1/pelSin1.2bit
SEQ2_LEN=/hive/data/genomes/pelSin1/chrom.sizes
SEQ2_CHUNK=20000000
SEQ2_LAP=0
SEQ2_LIMIT=100

BASE=/hive/data/genomes/galGal5/bed/lastzPelSin1.2016-05-10
TMPDIR=/dev/shm
' > DEF

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

    cat fb.galGal5.chainPelSin1Link.txt
    #  269146297 bases of 1218501075 (22.088%) in intersection

    time (doRecipBest.pl -workhorse=hgwdev -buildDir=`pwd` galGal5 pelSin1) \
          > rbest.log 2>&1 &
    #  real    68m22.787s

    # and for the swap:
    mkdir /hive/data/genomes/pelSin1/bed/blastz.galGal5.swap
    cd /hive/data/genomes/pelSin1/bed/blastz.galGal5.swap

    time (doBlastzChainNet.pl -verbose=2 \
      /hive/data/genomes/galGal5/bed/lastzPelSin1.2016-05-10/DEF \
        -swap -chainMinScore=5000 -chainLinearGap=loose \
          -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
            -syntenicNet) > swap.log 2>&1
    #  real    38m32.377s

    cat fb.pelSin1.chainGalGal5Link.txt
    # 275358706 bases of 2106639384 (13.071%) in intersection


    time (doRecipBest.pl -workhorse=hgwdev -buildDir=`pwd` pelSin1 galGal5) \
       > rbest.log 2>&1
    # real    132m33.263s

#########################################################################
# LASTZ chicken/galGal5 vs. turkey - (DONE - 2017-01-19 - Hiram)
    mkdir /hive/data/genomes/galGal5/bed/lastzMelGal5.2017-01-19
    cd /hive/data/genomes/galGal5/bed/lastzMelGal5.2017-01-19

    printf '# chicken vs. turkey
BLASTZ=/cluster/bin/penn/lastz-distrib-1.03.66/bin/lastz
BLASTZ_M=254

# TARGET: chicken galGal5
SEQ1_DIR=/hive/data/genomes/galGal5/galGal5.2bit
SEQ1_LEN=/hive/data/genomes/galGal5/chrom.sizes
SEQ1_CHUNK=20000000
SEQ1_LIMIT=100
SEQ1_LAP=10000

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

BASE=/hive/data/genomes/galGal5/bed/lastzMelGal5.2017-01-19
TMPDIR=/dev/shm
' > DEF

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

    cat fb.galGal5.chainMelGal5Link.txt
    #  1029400481 bases of 1218501075 (84.481%) in intersection

    time (doRecipBest.pl -workhorse=hgwdev -buildDir=`pwd` galGal5 melGal5) \
          > rbest.log 2>&1 &
    #  real    312m39.922s

    # and for the swap:
    mkdir /hive/data/genomes/melGal5/bed/blastz.galGal5.swap
    cd /hive/data/genomes/melGal5/bed/blastz.galGal5.swap

    time (doBlastzChainNet.pl -verbose=2 \
      /hive/data/genomes/galGal5/bed/lastzMelGal5.2017-01-19/DEF \
        -swap -chainMinScore=5000 -chainLinearGap=loose \
          -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
            -syntenicNet) > swap.log 2>&1
    #  real    284m22.838s

    cat fb.melGal5.chainGalGal5Link.txt
    # 984928299 bases of 1093044709 (90.109%) in intersection

    time (doRecipBest.pl -workhorse=hgwdev -buildDir=`pwd` melGal5 galGal5) \
       > rbest.log 2>&1
    # real    487m51.030s

#########################################################################
# LASTZ Golden eagle/aquChr2 vs. chicken/galGal5 - (DONE - 2017-03-17 - Hiram)
    mkdir /hive/data/genomes/galGal5/bed/lastzAquChr2.2017-03-17
    cd /hive/data/genomes/galGal5/bed/lastzAquChr2.2017-03-17

    printf '# Golden eagle vs. chicken
BLASTZ=/cluster/bin/penn/lastz-distrib-1.03.66/bin/lastz
BLASTZ_M=254

# TARGET: chicken galGal5
SEQ1_DIR=/hive/data/genomes/galGal5/galGal5.2bit
SEQ1_LEN=/hive/data/genomes/galGal5/chrom.sizes
SEQ1_CHUNK=20000000
SEQ1_LIMIT=50
SEQ1_LAP=10000

# QUERY: Golden eagle aquChr2
SEQ2_DIR=/hive/data/genomes/aquChr2/aquChr2.2bit
SEQ2_LEN=/hive/data/genomes/aquChr2/chrom.sizes
SEQ2_CHUNK=20000000
SEQ2_LAP=0
SEQ2_LIMIT=20

BASE=/hive/data/genomes/galGal5/bed/lastzAquChr2.2017-03-17
TMPDIR=/dev/shm
' > DEF

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

    cat fb.galGal5.chainAquChr2Link.txt
    #  919609897 bases of 1218501075 (75.471%) in intersection

    time (doRecipBest.pl -workhorse=hgwdev -buildDir=`pwd` galGal5 aquChr2) \
          > rbest.log 2>&1 &
    #  real    183m23.066s

    # and for the swap:
    mkdir /hive/data/genomes/aquChr2/bed/blastz.galGal5.swap
    cd /hive/data/genomes/aquChr2/bed/blastz.galGal5.swap

    time (doBlastzChainNet.pl -verbose=2 \
      /hive/data/genomes/galGal5/bed/lastzAquChr2.2017-03-17/DEF \
        -swap -chainMinScore=5000 -chainLinearGap=loose \
          -workhorse=hgwdev -smallClusterHub=ku -bigClusterHub=ku \
            -syntenicNet) > swap.log 2>&1
    #  real    60m38.086s

    cat fb.aquChr2.chainGalGal5Link.txt
    # 854022282 bases of 1180019022 (72.374%) in intersection

    time (doRecipBest.pl -workhorse=hgwdev -buildDir=`pwd` aquChr2 galGal5) \
       > rbest.log 2>&1
    # real    167m4.022s

#########################################################################
# LASTZ chicken GCF_016699485.2 vs. Chicken GalGal5
#    (DONE - 2023-08-15 - Gerardo)

    mkdir /hive/data/genomes/asmHubs/allBuild/GCF/016/699/485/GCF_016699485.2_bGalGal1.mat.broiler.GRCg7b/trackData/lastzGalGal5.2023-08-15
    cd /hive/data/genomes/asmHubs/allBuild/GCF/016/699/485/GCF_016699485.2_bGalGal1.mat.broiler.GRCg7b/trackData/lastzGalGal5.2023-08-15

    printf '# Chicken GalGal5 vs. chicken GCF_016699485.2
BLASTZ=/cluster/bin/penn/lastz-distrib-1.04.03/bin/lastz

# TARGET: chicken 2021-01-19 GCF_016699485.2_bGalGal1.mat.broiler.GRCg7b
SEQ1_DIR=/hive/data/genomes/asmHubs/GCF/016/699/485/GCF_016699485.2/GCF_016699485.2.2bit
SEQ1_LEN=/hive/data/genomes/asmHubs/GCF/016/699/485/GCF_016699485.2/GCF_016699485.2.chrom.sizes.txt
SEQ1_CHUNK=20000000
SEQ1_LAP=10000
SEQ1_LIMIT=40

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

BASE=/hive/data/genomes/asmHubs/allBuild/GCF/016/699/485/GCF_016699485.2_bGalGal1.mat.broiler.GRCg7b/trackData/lastzGalGal5.2023-08-15
TMPDIR=/dev/shm

' > DEF

    time (~/kent/src/hg/utils/automation/doBlastzChainNet.pl -trackHub -noDbNameCheck -verbose=2 `pwd`/DEF -syntenicNet \
      -tAsmId GCF_016699485.2_bGalGal1.mat.broiler.GRCg7b  -workhorse=hgwdev -smallClusterHub=hgwdev -bigClusterHub=ku \
        -chainMinScore=5000 -chainLinearGap=loose) > do.log 2>&1
    grep -w real do.log | sed -e 's/^/    # /;'
    # real	232m0.504s

    sed -e 's/^/    # /;' fb.GCF_016699485.2.chainGalGal5Link.txt
    # 1036760370 bases of 1053332251 (98.427%) in intersection
    sed -e 's/^/    # /;' fb.GCF_016699485.2.chainSynGalGal5Link.txt
    # 1015115099 bases of 1053332251 (96.372%) in intersection

    time (~/kent/src/hg/utils/automation/doRecipBest.pl -trackHub -load -workhorse=hgwdev -buildDir=`pwd` \
      -target2Bit="/hive/data/genomes/asmHubs/GCF/016/699/485/GCF_016699485.2/GCF_016699485.2.2bit" \
-targetSizes="/hive/data/genomes/asmHubs/GCF/016/699/485/GCF_016699485.2/GCF_016699485.2.chrom.sizes.txt" \
       \
        GCF_016699485.2 galGal5) > rbest.log 2>&1

    grep -w real rbest.log | sed -e 's/^/    # /;'
    # real	33m10.138s

    sed -e 's/^/    # /;' fb.GCF_016699485.2.chainRBest.GalGal5.txt
    # 1014531342 bases of 1053332251 (96.316%) in intersection

    ### and for the swap

    cd /hive/data/genomes/galGal5/bed/blastz.GCF_016699485.2.swap

   time (~/kent/src/hg/utils/automation/doBlastzChainNet.pl -trackHub -noDbNameCheck -swap -verbose=2 \
  -tAsmId GCF_016699485.2_bGalGal1.mat.broiler.GRCg7b  /hive/data/genomes/asmHubs/allBuild/GCF/016/699/485/GCF_016699485.2_bGalGal1.mat.broiler.GRCg7b/trackData/lastzGalGal5.2023-08-15/DEF -swapDir=`pwd` \
  -syntenicNet -workhorse=hgwdev -smallClusterHub=hgwdev -bigClusterHub=ku \
    -chainMinScore=5000 -chainLinearGap=loose) > swap.log 2>&1

    grep -w real swap.log | sed -e 's/^/    # /;'
    # real	79m10.913s

    sed -e 's/^/    # /;' fb.galGal5.chainGCF_016699485.2Link.txt
    # 1125580117 bases of 1230258557 (91.491%) in intersection
    sed -e 's/^/    # /;' fb.galGal5.chainSynGCF_016699485.2Link.txt
    # 1109811364 bases of 1230258557 (90.210%) in intersection
\    time (~/kent/src/hg/utils/automation/doRecipBest.pl -trackHub -load -workhorse=hgwdev -buildDir=`pwd` \
   -query2bit="/hive/data/genomes/asmHubs/GCF/016/699/485/GCF_016699485.2/GCF_016699485.2.2bit" \
-querySizes="/hive/data/genomes/asmHubs/GCF/016/699/485/GCF_016699485.2/GCF_016699485.2.chrom.sizes.txt" \
    \
   galGal5 GCF_016699485.2) > rbest.log 2>&1

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

    sed -e 's/^/    # /;' fb.galGal5.chainRBest.GCF_016699485.2.txt
    # 1021179381 bases of 1230258557 (83.005%) in intersection

real	386m37.712s
user	0m3.674s
sys	0m4.972s
##############################################################################
