Index: src/hg/makeDb/doc/susScr1.txt
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/makeDb/doc/susScr1.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 4 -r1.1 -r1.2
--- src/hg/makeDb/doc/susScr1.txt	16 Nov 2009 19:40:42 -0000	1.1
+++ src/hg/makeDb/doc/susScr1.txt	16 Nov 2009 19:44:04 -0000	1.2
@@ -194,4 +194,168 @@
     cvs ci -m "Added susScr1 - Tetraodon Nigirividis" \
 	etc/align.dbs etc/hgwdev.dbs
     make etc-update
 
+##########################################################################
+# HUMAN (hg18) PROTEINS TRACK (Working...
+    # bash  if not using bash shell already
+
+    cd /cluster/data/susScr1
+    mkdir /cluster/data/susScr1/blastDb
+
+    awk '{if ($2 > 1000000) print $1}' chrom.sizes > 1meg.lst
+    twoBitToFa -seqList=1meg.lst  susScr1.2bit temp.fa
+    faSplit gap temp.fa 1000000 blastDb/x -lift=blastDb.lft
+    rm temp.fa 1meg.lst
+
+    awk '{if ($2 <= 1000000) print $1}' chrom.sizes > less1meg.lst
+    twoBitToFa -seqList=less1meg.lst  susScr1.2bit temp.fa
+    faSplit about temp.fa 1000000 blastDb/y 
+    rm temp.fa less1meg.lst
+
+    cd blastDb
+    for i in *.fa
+    do
+	/hive/data/outside/blast229/formatdb -i $i -p F
+    done
+    rm *.fa
+    ls *.nsq | wc -l
+# 2915
+
+    mkdir -p /cluster/data/susScr1/bed/tblastn.hg18KG
+    cd /cluster/data/susScr1/bed/tblastn.hg18KG
+    echo  ../../blastDb/*.nsq | xargs ls -S | sed "s/\.nsq//"  > query.lst
+    wc -l query.lst
+# 2915 query.lst
+
+   # we want around 200000 jobs
+   calc `wc /cluster/data/hg18/bed/blat.hg18KG/hg18KG.psl | awk '{print $1}'`/\(200000/`wc query.lst | awk '{print $1}'`\)
+
+# 36727/(200000/2915) = 535.296025
+
+   mkdir -p kgfa
+   split -l 535 /cluster/data/hg18/bed/blat.hg18KG/hg18KG.psl  kgfa/kg
+   cd kgfa
+   for i in *; do 
+     nice pslxToFa $i $i.fa; 
+     rm $i; 
+   done
+   cd ..
+   ls -1S kgfa/*.fa > kg.lst
+   wc kg.lst
+# 69  69 897 kg.lst
+
+
+   mkdir -p blastOut
+   for i in `cat kg.lst`; do  mkdir blastOut/`basename $i .fa`; done
+   tcsh
+   cd /cluster/data/susScr1/bed/tblastn.hg18KG
+   cat << '_EOF_' > blastGsub
+#LOOP
+blastSome $(path1) {check in line $(path2)} {check out exists blastOut/$(root2)/q.$(root1).psl }
+#ENDLOOP
+'_EOF_'
+
+   cat << '_EOF_' > blastSome
+#!/bin/sh
+BLASTMAT=/hive/data/outside/blast229/data
+export BLASTMAT
+g=`basename $2`
+f=/tmp/`basename $3`.$g
+for eVal in 0.01 0.001 0.0001 0.00001 0.000001 1E-09 1E-11
+do
+if /hive/data/outside/blast229/blastall -M BLOSUM80 -m 0 -F no -e $eVal -p tblastn -d $1 -i $2 -o $f.8
+then
+        mv $f.8 $f.1
+        break;
+fi
+done
+if test -f  $f.1
+then
+    if /cluster/bin/i386/blastToPsl $f.1 $f.2
+    then
+	liftUp -nosort -type=".psl" -nohead $f.3 /cluster/data/susScr1/blastDb.lft carry $f.2
+        liftUp -nosort -type=".psl" -pslQ -nohead $3.tmp /cluster/data/hg18/bed/blat.hg18KG/protein.lft warn $f.3
+        if pslCheck -prot $3.tmp
+        then                  
+            mv $3.tmp $3     
+            rm -f $f.1 $f.2 $f.3 $f.4
+        fi
+        exit 0               
+    fi                      
+fi                         
+rm -f $f.1 $f.2 $3.tmp $f.8 $f.3 $f.4
+exit 1
+'_EOF_'
+    # << happy emacs
+    chmod +x blastSome
+    exit 
+    
+    ssh swarm
+    cd /cluster/data/susScr1/bed/tblastn.hg18KG
+    gensub2 query.lst kg.lst blastGsub blastSpec
+    para create blastSpec
+#    para try, check, push, check etc.
+
+    para time
+# Completed: 201135 of 201135 jobs
+# CPU time in finished jobs:   13017817s  216963.62m  3616.06h  150.67d  0.413 y
+# IO & Wait Time:               1450739s   24178.98m   402.98h   16.79d  0.046 y
+# Average job time:                  72s       1.20m     0.02h    0.00d
+# Longest finished job:             244s       4.07m     0.07h    0.00d
+# Submission to last job:         18278s     304.63m     5.08h    0.21d
+
+
+    ssh swarm
+    cd /cluster/data/susScr1/bed/tblastn.hg18KG
+    mkdir chainRun
+    cd chainRun
+    tcsh
+    cat << '_EOF_' > chainGsub
+#LOOP
+chainOne $(path1)
+#ENDLOOP
+'_EOF_'
+
+    cat << '_EOF_' > chainOne
+(cd $1; cat q.*.psl | simpleChain -prot -outPsl -maxGap=12000 stdin ../c.`basename $1`.psl)
+'_EOF_'
+    chmod +x chainOne
+    ls -1dS ../blastOut/kg?? > chain.lst
+    gensub2 chain.lst single chainGsub chainSpec
+    # do the cluster run for chaining
+    para create chainSpec
+    para try, check, push, check etc.
+
+# Completed: 64 of 64 jobs
+# CPU time in finished jobs:      29478s     491.30m     8.19h    0.34d  0.001 y
+# IO & Wait Time:                 19822s     330.37m     5.51h    0.23d  0.001 y
+# Average job time:                 770s      12.84m     0.21h    0.01d
+# Longest finished job:            2868s      47.80m     0.80h    0.03d
+# Submission to last job:          2882s      48.03m     0.80h    0.03d
+
+    cd /cluster/data/susScr1/bed/tblastn.hg18KG/blastOut
+    for i in kg??
+    do
+       cat c.$i.psl | awk "(\$13 - \$12)/\$11 > 0.6 {print}" > c60.$i.psl
+       sort -rn c60.$i.psl | pslUniq stdin u.$i.psl
+       awk "((\$1 / \$11) ) > 0.60 { print   }" c60.$i.psl > m60.$i.psl
+       echo $i
+    done
+    sort u.*.psl m60* | uniq | sort -T /tmp -k 14,14 -k 16,16n -k 17,17n > ../blastHg18KG.psl
+    cd ..
+    pslCheck blastHg18KG.psl
+# checked: 43305 failed: 0 errors: 0
+
+    # load table 
+    ssh hgwdev
+    cd /cluster/data/susScr1/bed/tblastn.hg18KG
+    hgLoadPsl susScr1 blastHg18KG.psl
+
+    # check coverage
+    featureBits susScr1 blastHg18KG 
+# 42480830 bases of 3118565340 (1.362%) in intersection
+
+    featureBits susScr1 blastHg18KG xenoRefGene  -enrichment
+# blastHg18KG 1.362%, xenoRefGene 1.615%, both 0.695%, cover 51.03%, enrich 31.60x
+    rm -rf blastOut
+#end tblastn

