[med-svn] [seqtools] 06/09: New upstream version 4.44.1+dfsg

Andreas Tille tille at debian.org
Wed Oct 25 14:32:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository seqtools.

commit 75cf31dec02127664b2fba4881057bf849524c9f
Author: Andreas Tille <tille at debian.org>
Date:   Wed Oct 25 14:49:32 2017 +0200

    New upstream version 4.44.1+dfsg
---
 gbtools/src/blatSrc/Makefile.am                 |  277 --
 gbtools/src/blatSrc/Makefile.in                 | 2688 ------------
 gbtools/src/blatSrc/lib/aliType.c               |   33 -
 gbtools/src/blatSrc/lib/annoAssembly.c          |   77 -
 gbtools/src/blatSrc/lib/annoFilter.c            |  357 --
 gbtools/src/blatSrc/lib/annoFormatTab.c         |  230 -
 gbtools/src/blatSrc/lib/annoFormatter.c         |   29 -
 gbtools/src/blatSrc/lib/annoGrateWig.c          |  112 -
 gbtools/src/blatSrc/lib/annoGrator.c            |  291 --
 gbtools/src/blatSrc/lib/annoGratorQuery.c       |  150 -
 gbtools/src/blatSrc/lib/annoOption.c            |  100 -
 gbtools/src/blatSrc/lib/annoRow.c               |   73 -
 gbtools/src/blatSrc/lib/annoStreamBigBed.c      |  251 --
 gbtools/src/blatSrc/lib/annoStreamBigWig.c      |  185 -
 gbtools/src/blatSrc/lib/annoStreamTab.c         |  236 -
 gbtools/src/blatSrc/lib/annoStreamVcf.c         |  368 --
 gbtools/src/blatSrc/lib/annoStreamer.c          |  154 -
 gbtools/src/blatSrc/lib/apacheLog.c             |  211 -
 gbtools/src/blatSrc/lib/asParse.c               |  664 ---
 gbtools/src/blatSrc/lib/axt.c                   | 1106 -----
 gbtools/src/blatSrc/lib/axtAffine.c             |  781 ----
 gbtools/src/blatSrc/lib/bPlusTree.c             |  600 ---
 gbtools/src/blatSrc/lib/bamFile.c               |  797 ----
 gbtools/src/blatSrc/lib/base64.c                |  132 -
 gbtools/src/blatSrc/lib/basicBed.c              | 1752 --------
 gbtools/src/blatSrc/lib/bbiRead.c               |  797 ----
 gbtools/src/blatSrc/lib/bbiWrite.c              |  736 ----
 gbtools/src/blatSrc/lib/bigBed.c                |  651 ---
 gbtools/src/blatSrc/lib/binRange.c              |  392 --
 gbtools/src/blatSrc/lib/bits.c                  |  418 --
 gbtools/src/blatSrc/lib/blastOut.c              |  833 ----
 gbtools/src/blatSrc/lib/blastParse.c            |  900 ----
 gbtools/src/blatSrc/lib/boxClump.c              |  315 --
 gbtools/src/blatSrc/lib/boxLump.c               |  162 -
 gbtools/src/blatSrc/lib/bwgCreate.c             | 1238 ------
 gbtools/src/blatSrc/lib/bwgQuery.c              |  402 --
 gbtools/src/blatSrc/lib/bwgValsOnChrom.c        |  216 -
 gbtools/src/blatSrc/lib/cda.c                   |  477 ---
 gbtools/src/blatSrc/lib/chain.c                 |  647 ---
 gbtools/src/blatSrc/lib/chainBlock.c            |  453 --
 gbtools/src/blatSrc/lib/chainConnect.c          |  369 --
 gbtools/src/blatSrc/lib/chainToAxt.c            |  124 -
 gbtools/src/blatSrc/lib/chainToPsl.c            |  125 -
 gbtools/src/blatSrc/lib/cheapcgi.c              | 2306 ----------
 gbtools/src/blatSrc/lib/cirTree.c               |  635 ---
 gbtools/src/blatSrc/lib/codebias.c              |  147 -
 gbtools/src/blatSrc/lib/colHash.c               |   51 -
 gbtools/src/blatSrc/lib/colHash.h               |   41 -
 gbtools/src/blatSrc/lib/common.c                | 3537 ---------------
 gbtools/src/blatSrc/lib/common.ps               |   97 -
 gbtools/src/blatSrc/lib/common.pss              |   96 -
 gbtools/src/blatSrc/lib/correlate.c             |   80 -
 gbtools/src/blatSrc/lib/crTree.c                |  401 --
 gbtools/src/blatSrc/lib/dgRange.c               |  222 -
 gbtools/src/blatSrc/lib/diGraph.c               |  741 ----
 gbtools/src/blatSrc/lib/diGraph.c.97            |  764 ----
 gbtools/src/blatSrc/lib/diff                    |    0
 gbtools/src/blatSrc/lib/diffs                   |  599 ---
 gbtools/src/blatSrc/lib/dlist.c                 |  300 --
 gbtools/src/blatSrc/lib/dnaLoad.c               |  303 --
 gbtools/src/blatSrc/lib/dnaMarkov.c             |  242 --
 gbtools/src/blatSrc/lib/dnaMotif.c              |  631 ---
 gbtools/src/blatSrc/lib/dnaMotif.pss            |   61 -
 gbtools/src/blatSrc/lib/dnaseq.c                |  181 -
 gbtools/src/blatSrc/lib/dnautil.c               | 1186 -----
 gbtools/src/blatSrc/lib/dtdParse.c              |  469 --
 gbtools/src/blatSrc/lib/dyOut.c                 |  379 --
 gbtools/src/blatSrc/lib/dystring.c              |  250 --
 gbtools/src/blatSrc/lib/elmTree.c               |  277 --
 gbtools/src/blatSrc/lib/emblParse.c             |  159 -
 gbtools/src/blatSrc/lib/errAbort.c              |  377 --
 gbtools/src/blatSrc/lib/errCatch.c              |  139 -
 gbtools/src/blatSrc/lib/fa.c                    |  648 ---
 gbtools/src/blatSrc/lib/ffAli.c                 |  185 -
 gbtools/src/blatSrc/lib/ffScore.c               |  215 -
 gbtools/src/blatSrc/lib/fieldedTable.c          |  124 -
 gbtools/src/blatSrc/lib/filePath.c              |  134 -
 gbtools/src/blatSrc/lib/fixColor.c              |   23 -
 gbtools/src/blatSrc/lib/flydna.c                |  112 -
 gbtools/src/blatSrc/lib/fof.c                   |  581 ---
 gbtools/src/blatSrc/lib/foo                     |  781 ----
 gbtools/src/blatSrc/lib/fq.c                    |   65 -
 gbtools/src/blatSrc/lib/fuzzyShow.c             |  406 --
 gbtools/src/blatSrc/lib/gapCalc.c               |  354 --
 gbtools/src/blatSrc/lib/gdf.c                   |  153 -
 gbtools/src/blatSrc/lib/gemfont.c               |  200 -
 gbtools/src/blatSrc/lib/gemfont.h               |   69 -
 gbtools/src/blatSrc/lib/genomeRangeTree.c       |  201 -
 gbtools/src/blatSrc/lib/gfNet.c                 |   24 -
 gbtools/src/blatSrc/lib/gff.c                   |  474 --
 gbtools/src/blatSrc/lib/gff3.c                  | 1109 -----
 gbtools/src/blatSrc/lib/gfxPoly.c               |   50 -
 gbtools/src/blatSrc/lib/gifLabel.c              |  101 -
 gbtools/src/blatSrc/lib/gifcodes.h              |   48 -
 gbtools/src/blatSrc/lib/gifcomp.c               |  304 --
 gbtools/src/blatSrc/lib/gifdecomp.c             |  391 --
 gbtools/src/blatSrc/lib/gifread.c               |  186 -
 gbtools/src/blatSrc/lib/gifwrite.c              |   98 -
 gbtools/src/blatSrc/lib/hacTree.c               |  510 ---
 gbtools/src/blatSrc/lib/hash.c                  |  749 ----
 gbtools/src/blatSrc/lib/hex.c                   |   69 -
 gbtools/src/blatSrc/lib/histogram.c             |  270 --
 gbtools/src/blatSrc/lib/hmac.c                  |   65 -
 gbtools/src/blatSrc/lib/hmmPfamParse.c          |  194 -
 gbtools/src/blatSrc/lib/hmmstats.c              |   48 -
 gbtools/src/blatSrc/lib/htmlPage.c              | 1851 --------
 gbtools/src/blatSrc/lib/htmshell.c              |  670 ---
 gbtools/src/blatSrc/lib/https.c                 |  391 --
 gbtools/src/blatSrc/lib/intExp.c                |  153 -
 gbtools/src/blatSrc/lib/intValTree.c            |  105 -
 gbtools/src/blatSrc/lib/internet.c              |  162 -
 gbtools/src/blatSrc/lib/itsa.c                  |  187 -
 gbtools/src/blatSrc/lib/iupac.c                 |  216 -
 gbtools/src/blatSrc/lib/jointalign.c            |   74 -
 gbtools/src/blatSrc/lib/jpegSize.c              |  139 -
 gbtools/src/blatSrc/lib/jsonParse.c             |  687 ---
 gbtools/src/blatSrc/lib/jsonWrite.c             |  142 -
 gbtools/src/blatSrc/lib/keys.c                  |  558 ---
 gbtools/src/blatSrc/lib/knetUdc.c               |   97 -
 gbtools/src/blatSrc/lib/kxTok.c                 |  239 --
 gbtools/src/blatSrc/lib/lineFileOnBigBed.c      |  111 -
 gbtools/src/blatSrc/lib/linefile.c              | 1450 -------
 gbtools/src/blatSrc/lib/localmem.c              |  200 -
 gbtools/src/blatSrc/lib/log.c                   |  354 --
 gbtools/src/blatSrc/lib/longToList.c            |  103 -
 gbtools/src/blatSrc/lib/maf.c                   |  898 ----
 gbtools/src/blatSrc/lib/maf.doc                 |  222 -
 gbtools/src/blatSrc/lib/mafFromAxt.c            |   81 -
 gbtools/src/blatSrc/lib/mafScore.c              |  186 -
 gbtools/src/blatSrc/lib/mailViaPipe.c           |   30 -
 gbtools/src/blatSrc/lib/makefile                |   65 -
 gbtools/src/blatSrc/lib/md5.c                   |   86 -
 gbtools/src/blatSrc/lib/memalloc.c              |  519 ---
 gbtools/src/blatSrc/lib/memgfx.c                | 1325 ------
 gbtools/src/blatSrc/lib/meta.c                  |  405 --
 gbtools/src/blatSrc/lib/metaWig.c               |  188 -
 gbtools/src/blatSrc/lib/mgCircle.c              |   81 -
 gbtools/src/blatSrc/lib/mgPolygon.c             |  438 --
 gbtools/src/blatSrc/lib/mime.c                  |  687 ---
 gbtools/src/blatSrc/lib/net.c                   | 2076 ---------
 gbtools/src/blatSrc/lib/nib.c                   |  516 ---
 gbtools/src/blatSrc/lib/nibTwo.c                |  125 -
 gbtools/src/blatSrc/lib/nt4.c                   |  260 --
 gbtools/src/blatSrc/lib/numObscure.c            |  106 -
 gbtools/src/blatSrc/lib/obscure.c               |  823 ----
 gbtools/src/blatSrc/lib/oldGff.c                |  643 ---
 gbtools/src/blatSrc/lib/oligoTm.c               |  333 --
 gbtools/src/blatSrc/lib/options.c               |  450 --
 gbtools/src/blatSrc/lib/osunix.c                |  711 ---
 gbtools/src/blatSrc/lib/oswin9x.c               |   98 -
 gbtools/src/blatSrc/lib/pairDistance.c          |   80 -
 gbtools/src/blatSrc/lib/pairHmm.c               |  346 --
 gbtools/src/blatSrc/lib/paraFetch.c             |  703 ---
 gbtools/src/blatSrc/lib/peakCluster.c           |  247 --
 gbtools/src/blatSrc/lib/phyloTree.c             |  421 --
 gbtools/src/blatSrc/lib/pipeline.c              |  735 ----
 gbtools/src/blatSrc/lib/pngwrite.c              |  115 -
 gbtools/src/blatSrc/lib/portimpl.c              |  136 -
 gbtools/src/blatSrc/lib/portimpl.h              |   39 -
 gbtools/src/blatSrc/lib/psGfx.c                 |  413 --
 gbtools/src/blatSrc/lib/psPoly.c                |   53 -
 gbtools/src/blatSrc/lib/pscmGfx.c               |  816 ----
 gbtools/src/blatSrc/lib/psl.as                  |   25 -
 gbtools/src/blatSrc/lib/psl.c                   | 1961 ---------
 gbtools/src/blatSrc/lib/psl.sql                 |   33 -
 gbtools/src/blatSrc/lib/pslGenoShow.c           |  349 --
 gbtools/src/blatSrc/lib/pslShow.c               |  317 --
 gbtools/src/blatSrc/lib/pslTbl.c                |   90 -
 gbtools/src/blatSrc/lib/pslTransMap.c           |  328 --
 gbtools/src/blatSrc/lib/pslWScore.as            |   26 -
 gbtools/src/blatSrc/lib/pslWScore.sql           |   31 -
 gbtools/src/blatSrc/lib/pthreadDoList.c         |   82 -
 gbtools/src/blatSrc/lib/pthreadWrap.c           |  105 -
 gbtools/src/blatSrc/lib/qa.c                    |  222 -
 gbtools/src/blatSrc/lib/quickHeap.c             |  196 -
 gbtools/src/blatSrc/lib/quotedP.c               |  117 -
 gbtools/src/blatSrc/lib/ra.c                    |  400 --
 gbtools/src/blatSrc/lib/raToStruct.c            |  178 -
 gbtools/src/blatSrc/lib/rainbow.c               |  153 -
 gbtools/src/blatSrc/lib/rangeTree.c             |  354 --
 gbtools/src/blatSrc/lib/rbTree.c                |  740 ----
 gbtools/src/blatSrc/lib/regexHelper.c           |   93 -
 gbtools/src/blatSrc/lib/repMask.c               |  173 -
 gbtools/src/blatSrc/lib/rle.c                   |  102 -
 gbtools/src/blatSrc/lib/rnautil.c               |  223 -
 gbtools/src/blatSrc/lib/rqlEval.c               |  335 --
 gbtools/src/blatSrc/lib/rqlParse.c              |  767 ----
 gbtools/src/blatSrc/lib/rudp.c                  |  563 ---
 gbtools/src/blatSrc/lib/scoreWindow.c           |   51 -
 gbtools/src/blatSrc/lib/seg.c                   |  476 --
 gbtools/src/blatSrc/lib/seqOut.c                |  330 --
 gbtools/src/blatSrc/lib/seqStats.c              |   39 -
 gbtools/src/blatSrc/lib/servBrcMcw.c            |   47 -
 gbtools/src/blatSrc/lib/servCrunx.c             |   51 -
 gbtools/src/blatSrc/lib/servcis.c               |   48 -
 gbtools/src/blatSrc/lib/servcl.c                |   49 -
 gbtools/src/blatSrc/lib/servmsII.c              |   45 -
 gbtools/src/blatSrc/lib/servpws.c               |   44 -
 gbtools/src/blatSrc/lib/shaRes.c                |   80 -
 gbtools/src/blatSrc/lib/slog.c                  |   32 -
 gbtools/src/blatSrc/lib/snof.c                  |  293 --
 gbtools/src/blatSrc/lib/snofmake.c              |  228 -
 gbtools/src/blatSrc/lib/snofsig.c               |   24 -
 gbtools/src/blatSrc/lib/spaceSaver.c            |  144 -
 gbtools/src/blatSrc/lib/spacedColumn.c          |  137 -
 gbtools/src/blatSrc/lib/spacedSeed.c            |   68 -
 gbtools/src/blatSrc/lib/splatAli.as             |   12 -
 gbtools/src/blatSrc/lib/splatAli.c              |  234 -
 gbtools/src/blatSrc/lib/sqlList.c               | 1273 ------
 gbtools/src/blatSrc/lib/sqlNum.c                |  301 --
 gbtools/src/blatSrc/lib/status                  | 1638 -------
 gbtools/src/blatSrc/lib/subText.c               |  153 -
 gbtools/src/blatSrc/lib/sufa.c                  |  142 -
 gbtools/src/blatSrc/lib/sufx.c                  |  146 -
 gbtools/src/blatSrc/lib/synQueue.c              |  117 -
 gbtools/src/blatSrc/lib/tabRow.c                |  232 -
 gbtools/src/blatSrc/lib/textOut.c               |  196 -
 gbtools/src/blatSrc/lib/tokenizer.c             |  216 -
 gbtools/src/blatSrc/lib/trix.c                  |  760 ----
 gbtools/src/blatSrc/lib/twoBit.c                | 1235 ------
 gbtools/src/blatSrc/lib/udc.c                   | 1686 --------
 gbtools/src/blatSrc/lib/vGfx.c                  |   53 -
 gbtools/src/blatSrc/lib/vGfxPrivate.h           |   47 -
 gbtools/src/blatSrc/lib/vGif.c                  |   66 -
 gbtools/src/blatSrc/lib/vPng.c                  |   68 -
 gbtools/src/blatSrc/lib/valgrind.suppress       |  106 -
 gbtools/src/blatSrc/lib/vcf.c                   | 1285 ------
 gbtools/src/blatSrc/lib/vcfBits.c               |  696 ---
 gbtools/src/blatSrc/lib/verbose.c               |  131 -
 gbtools/src/blatSrc/lib/wildcmp.c               |  116 -
 gbtools/src/blatSrc/lib/wormdna.c               | 1212 ------
 gbtools/src/blatSrc/lib/xAli.as                 |   27 -
 gbtools/src/blatSrc/lib/xAli.c                  |  282 --
 gbtools/src/blatSrc/lib/xAli.sql                |   33 -
 gbtools/src/blatSrc/lib/xa.c                    |  230 -
 gbtools/src/blatSrc/lib/xap.c                   |  182 -
 gbtools/src/blatSrc/lib/xenshow.c               |   65 -
 gbtools/src/blatSrc/lib/xmlEscape.c             |   82 -
 gbtools/src/blatSrc/lib/xp.c                    |  553 ---
 gbtools/src/blatSrc/lib/zlibFace.c              |   94 -
 gbtools/src/include/blatSrc/ace.h               |   79 -
 gbtools/src/include/blatSrc/aliType.h           |   32 -
 gbtools/src/include/blatSrc/annoAssembly.h      |   35 -
 gbtools/src/include/blatSrc/annoFilter.h        |   83 -
 gbtools/src/include/blatSrc/annoFormatTab.h     |   11 -
 gbtools/src/include/blatSrc/annoFormatter.h     |   57 -
 gbtools/src/include/blatSrc/annoGrateWig.h      |   14 -
 gbtools/src/include/blatSrc/annoGrator.h        |   73 -
 gbtools/src/include/blatSrc/annoGratorQuery.h   |   30 -
 gbtools/src/include/blatSrc/annoOption.h        |   22 -
 gbtools/src/include/blatSrc/annoRow.h           |   43 -
 gbtools/src/include/blatSrc/annoStreamBigBed.h  |   13 -
 gbtools/src/include/blatSrc/annoStreamBigWig.h  |   11 -
 gbtools/src/include/blatSrc/annoStreamTab.h     |   13 -
 gbtools/src/include/blatSrc/annoStreamVcf.h     |   13 -
 gbtools/src/include/blatSrc/annoStreamer.h      |  114 -
 gbtools/src/include/blatSrc/apacheLog.h         |   43 -
 gbtools/src/include/blatSrc/asParse.h           |  151 -
 gbtools/src/include/blatSrc/axt.h               |  272 --
 gbtools/src/include/blatSrc/bPlusTree.h         |  127 -
 gbtools/src/include/blatSrc/bamFile.h           |  169 -
 gbtools/src/include/blatSrc/bandExt.h           |   42 -
 gbtools/src/include/blatSrc/base64.h            |   30 -
 gbtools/src/include/blatSrc/basicBed.h          |  312 --
 gbtools/src/include/blatSrc/bbiFile.h           |  454 --
 gbtools/src/include/blatSrc/bigBed.h            |  144 -
 gbtools/src/include/blatSrc/bigWig.h            |  124 -
 gbtools/src/include/blatSrc/binRange.h          |  120 -
 gbtools/src/include/blatSrc/bits.h              |  108 -
 gbtools/src/include/blatSrc/blastParse.h        |  116 -
 gbtools/src/include/blatSrc/boxClump.h          |   41 -
 gbtools/src/include/blatSrc/boxLump.h           |   25 -
 gbtools/src/include/blatSrc/bwgInternal.h       |  119 -
 gbtools/src/include/blatSrc/cda.h               |  104 -
 gbtools/src/include/blatSrc/cgi_build_rules.mk  |   48 -
 gbtools/src/include/blatSrc/chain.h             |  163 -
 gbtools/src/include/blatSrc/chainBlock.h        |   42 -
 gbtools/src/include/blatSrc/chainConnect.h      |   60 -
 gbtools/src/include/blatSrc/chainToAxt.h        |   15 -
 gbtools/src/include/blatSrc/chainToPsl.h        |   28 -
 gbtools/src/include/blatSrc/cheapcgi.h          |  564 ---
 gbtools/src/include/blatSrc/cirTree.h           |   85 -
 gbtools/src/include/blatSrc/codebias.h          |   33 -
 gbtools/src/include/blatSrc/common.h            | 1483 -------
 gbtools/src/include/blatSrc/common.mk           |  411 --
 gbtools/src/include/blatSrc/correlate.h         |   39 -
 gbtools/src/include/blatSrc/crTree.h            |   90 -
 gbtools/src/include/blatSrc/crudeali.h          |   26 -
 gbtools/src/include/blatSrc/diGraph.h           |  202 -
 gbtools/src/include/blatSrc/diGraph.h.97        |  210 -
 gbtools/src/include/blatSrc/dlist.h             |  138 -
 gbtools/src/include/blatSrc/dnaLoad.h           |   40 -
 gbtools/src/include/blatSrc/dnaMarkov.h         |   43 -
 gbtools/src/include/blatSrc/dnaMotif.h          |  126 -
 gbtools/src/include/blatSrc/dnaseq.h            |   73 -
 gbtools/src/include/blatSrc/dnautil.h           |  270 --
 gbtools/src/include/blatSrc/dtdParse.h          |   57 -
 gbtools/src/include/blatSrc/dyOut.h             |  141 -
 gbtools/src/include/blatSrc/dystring.h          |   98 -
 gbtools/src/include/blatSrc/elmTree.h           |  122 -
 gbtools/src/include/blatSrc/emblParse.h         |   75 -
 gbtools/src/include/blatSrc/ens.h               |  168 -
 gbtools/src/include/blatSrc/errAbort.h          |   93 -
 gbtools/src/include/blatSrc/errCatch.h          |   61 -
 gbtools/src/include/blatSrc/fa.h                |  129 -
 gbtools/src/include/blatSrc/fieldedTable.h      |   44 -
 gbtools/src/include/blatSrc/filePath.h          |   31 -
 gbtools/src/include/blatSrc/flydna.h            |   32 -
 gbtools/src/include/blatSrc/fof.h               |   82 -
 gbtools/src/include/blatSrc/fq.h                |   26 -
 gbtools/src/include/blatSrc/fuzzyFind.h         |  260 --
 gbtools/src/include/blatSrc/gapCalc.h           |   44 -
 gbtools/src/include/blatSrc/gdf.h               |   61 -
 gbtools/src/include/blatSrc/genoFind.h          |  385 --
 gbtools/src/include/blatSrc/genomeRangeTree.h   |  113 -
 gbtools/src/include/blatSrc/gfClientLib.h       |   26 -
 gbtools/src/include/blatSrc/gfPcrLib.h          |  100 -
 gbtools/src/include/blatSrc/gfWebLib.h          |   28 -
 gbtools/src/include/blatSrc/gff.h               |  142 -
 gbtools/src/include/blatSrc/gff3.h              |  268 --
 gbtools/src/include/blatSrc/gfxPoly.h           |   31 -
 gbtools/src/include/blatSrc/gifLabel.h          |   10 -
 gbtools/src/include/blatSrc/hacTree.h           |  108 -
 gbtools/src/include/blatSrc/hash.h              |  285 --
 gbtools/src/include/blatSrc/hex.h               |   27 -
 gbtools/src/include/blatSrc/hgGene.h            |  129 -
 gbtools/src/include/blatSrc/hgap.h              |  233 -
 gbtools/src/include/blatSrc/hgdb.h              |   46 -
 gbtools/src/include/blatSrc/histogram.h         |   26 -
 gbtools/src/include/blatSrc/hmac.h              |   12 -
 gbtools/src/include/blatSrc/hmmPfamParse.h      |   55 -
 gbtools/src/include/blatSrc/hmmstats.h          |   30 -
 gbtools/src/include/blatSrc/htmlPage.h          |  248 --
 gbtools/src/include/blatSrc/htmshell.h          |  180 -
 gbtools/src/include/blatSrc/https.h             |    9 -
 gbtools/src/include/blatSrc/intValTree.h        |   50 -
 gbtools/src/include/blatSrc/internet.h          |   43 -
 gbtools/src/include/blatSrc/itsa.h              |   90 -
 gbtools/src/include/blatSrc/iupac.h             |   42 -
 gbtools/src/include/blatSrc/jointalign.h        |   30 -
 gbtools/src/include/blatSrc/jpegSize.h          |   11 -
 gbtools/src/include/blatSrc/jsonParse.h         |  131 -
 gbtools/src/include/blatSrc/jsonWrite.h         |   56 -
 gbtools/src/include/blatSrc/keys.h              |   66 -
 gbtools/src/include/blatSrc/knetUdc.h           |   10 -
 gbtools/src/include/blatSrc/kxTok.h             |   65 -
 gbtools/src/include/blatSrc/linefile.h          |  296 --
 gbtools/src/include/blatSrc/localEnvironment.mk |    0
 gbtools/src/include/blatSrc/localmem.h          |   66 -
 gbtools/src/include/blatSrc/log.h               |   74 -
 gbtools/src/include/blatSrc/longToList.h        |   52 -
 gbtools/src/include/blatSrc/maDbRep.h           |   62 -
 gbtools/src/include/blatSrc/maToFf.h            |   21 -
 gbtools/src/include/blatSrc/maf.h               |  264 --
 gbtools/src/include/blatSrc/mailViaPipe.h       |    8 -
 gbtools/src/include/blatSrc/md5.h               |   32 -
 gbtools/src/include/blatSrc/memalloc.h          |   55 -
 gbtools/src/include/blatSrc/memgfx.h            |  398 --
 gbtools/src/include/blatSrc/meta.h              |   93 -
 gbtools/src/include/blatSrc/metaWig.h           |   44 -
 gbtools/src/include/blatSrc/mime.h              |   62 -
 gbtools/src/include/blatSrc/net.h               |  267 --
 gbtools/src/include/blatSrc/nib.h               |  113 -
 gbtools/src/include/blatSrc/nibTwo.h            |   55 -
 gbtools/src/include/blatSrc/nt4.h               |   45 -
 gbtools/src/include/blatSrc/obscure.h           |  185 -
 gbtools/src/include/blatSrc/oldGff.h            |  103 -
 gbtools/src/include/blatSrc/oligoTm.h           |   98 -
 gbtools/src/include/blatSrc/ooc.h               |   16 -
 gbtools/src/include/blatSrc/options.h           |  100 -
 gbtools/src/include/blatSrc/pairDistance.h      |   31 -
 gbtools/src/include/blatSrc/pairHmm.h           |   94 -
 gbtools/src/include/blatSrc/paraFetch.h         |   41 -
 gbtools/src/include/blatSrc/patSpace.h          |   48 -
 gbtools/src/include/blatSrc/peakCluster.h       |   98 -
 gbtools/src/include/blatSrc/phyloTree.h         |   77 -
 gbtools/src/include/blatSrc/pipeline.h          |  157 -
 gbtools/src/include/blatSrc/portable.h          |  168 -
 gbtools/src/include/blatSrc/psGfx.h             |  118 -
 gbtools/src/include/blatSrc/psPoly.h            |   31 -
 gbtools/src/include/blatSrc/pscmGfx.h           |   71 -
 gbtools/src/include/blatSrc/psl.h               |  316 --
 gbtools/src/include/blatSrc/pslTbl.h            |   42 -
 gbtools/src/include/blatSrc/pslTransMap.h       |   17 -
 gbtools/src/include/blatSrc/pthreadDoList.h     |   67 -
 gbtools/src/include/blatSrc/pthreadWrap.h       |   45 -
 gbtools/src/include/blatSrc/qa.h                |   65 -
 gbtools/src/include/blatSrc/quickHeap.h         |   53 -
 gbtools/src/include/blatSrc/quotedP.h           |   21 -
 gbtools/src/include/blatSrc/ra.h                |   81 -
 gbtools/src/include/blatSrc/raToStruct.h        |   64 -
 gbtools/src/include/blatSrc/rainbow.h           |   22 -
 gbtools/src/include/blatSrc/rangeTree.h         |  105 -
 gbtools/src/include/blatSrc/rbTree.h            |  102 -
 gbtools/src/include/blatSrc/regexHelper.h       |   29 -
 gbtools/src/include/blatSrc/repMask.h           |   56 -
 gbtools/src/include/blatSrc/rle.h               |   16 -
 gbtools/src/include/blatSrc/rnautil.h           |   55 -
 gbtools/src/include/blatSrc/rql.h               |  130 -
 gbtools/src/include/blatSrc/rudp.h              |  175 -
 gbtools/src/include/blatSrc/scoreWindow.h       |    7 -
 gbtools/src/include/blatSrc/seg.h               |  109 -
 gbtools/src/include/blatSrc/seqOut.h            |   91 -
 gbtools/src/include/blatSrc/seqStats.h          |   11 -
 gbtools/src/include/blatSrc/shaRes.h            |   45 -
 gbtools/src/include/blatSrc/sig.h               |  101 -
 gbtools/src/include/blatSrc/slog.h              |   18 -
 gbtools/src/include/blatSrc/snof.h              |   60 -
 gbtools/src/include/blatSrc/snofmake.h          |   35 -
 gbtools/src/include/blatSrc/spaceSaver.h        |   65 -
 gbtools/src/include/blatSrc/spacedColumn.h      |   46 -
 gbtools/src/include/blatSrc/spacedSeed.h        |   19 -
 gbtools/src/include/blatSrc/splatAli.h          |   80 -
 gbtools/src/include/blatSrc/splix.h             |   80 -
 gbtools/src/include/blatSrc/sqlList.h           |  142 -
 gbtools/src/include/blatSrc/sqlNum.h            |   83 -
 gbtools/src/include/blatSrc/subText.h           |   41 -
 gbtools/src/include/blatSrc/sufa.h              |   60 -
 gbtools/src/include/blatSrc/sufx.h              |   64 -
 gbtools/src/include/blatSrc/supStitch.h         |   73 -
 gbtools/src/include/blatSrc/synQueue.h          |   38 -
 gbtools/src/include/blatSrc/tabRow.h            |   45 -
 gbtools/src/include/blatSrc/textOut.h           |   48 -
 gbtools/src/include/blatSrc/tokenizer.h         |   66 -
 gbtools/src/include/blatSrc/trans3.h            |   59 -
 gbtools/src/include/blatSrc/trix.h              |   48 -
 gbtools/src/include/blatSrc/twoBit.h            |  209 -
 gbtools/src/include/blatSrc/udc.h               |  165 -
 gbtools/src/include/blatSrc/unfin.h             |   31 -
 gbtools/src/include/blatSrc/userApp.mk          |   49 -
 gbtools/src/include/blatSrc/vGfx.h              |  193 -
 gbtools/src/include/blatSrc/vcf.h               |  297 --
 gbtools/src/include/blatSrc/vcfBits.h           |  158 -
 gbtools/src/include/blatSrc/verbose.h           |   53 -
 gbtools/src/include/blatSrc/wormdna.h           |  245 --
 gbtools/src/include/blatSrc/xAli.h              |   73 -
 gbtools/src/include/blatSrc/xa.h                |   63 -
 gbtools/src/include/blatSrc/xap.h               |   78 -
 gbtools/src/include/blatSrc/xenalign.h          |   41 -
 gbtools/src/include/blatSrc/xmlEscape.h         |   17 -
 gbtools/src/include/blatSrc/xp.h                |   78 -
 gbtools/src/include/blatSrc/zlibFace.h          |   26 -
 gbtools/src/include/json/json-forwards.h        |  319 --
 gbtools/src/include/json/json.h                 | 2241 ----------
 gbtools/src/jsoncpp/Makefile.am                 |   15 -
 gbtools/src/jsoncpp/Makefile.in                 |  723 ----
 gbtools/src/jsoncpp/jsoncpp.cpp                 | 5247 -----------------------
 447 files changed, 120385 deletions(-)

diff --git a/gbtools/src/blatSrc/Makefile.am b/gbtools/src/blatSrc/Makefile.am
deleted file mode 100644
index 52aeeaa..0000000
--- a/gbtools/src/blatSrc/Makefile.am
+++ /dev/null
@@ -1,277 +0,0 @@
-
-include $(top_srcdir)/src/Makefile.am.common
-
-SUBDIRS = .
-
-noinst_LTLIBRARIES = libblatSrc.la
-
-libblatSrc_la_SOURCES = \
-lib/aliType.c \
-lib/annoAssembly.c \
-lib/annoFilter.c \
-lib/annoFormatTab.c \
-lib/annoFormatter.c \
-lib/annoGrateWig.c \
-lib/annoGrator.c \
-lib/annoGratorQuery.c \
-lib/annoOption.c \
-lib/annoRow.c \
-lib/annoStreamBigBed.c \
-lib/annoStreamBigWig.c \
-lib/annoStreamTab.c \
-lib/annoStreamVcf.c \
-lib/annoStreamer.c \
-lib/apacheLog.c \
-lib/asParse.c \
-lib/axt.c \
-lib/axtAffine.c \
-lib/bPlusTree.c \
-lib/bamFile.c \
-lib/base64.c \
-lib/basicBed.c \
-lib/bbiRead.c \
-lib/bbiWrite.c \
-lib/bigBed.c \
-lib/binRange.c \
-lib/bits.c \
-lib/blastOut.c \
-lib/blastParse.c \
-lib/boxClump.c \
-lib/boxLump.c \
-lib/bwgCreate.c \
-lib/bwgQuery.c \
-lib/bwgValsOnChrom.c \
-lib/cda.c \
-lib/chain.c \
-lib/chainBlock.c \
-lib/chainConnect.c \
-lib/chainToAxt.c \
-lib/chainToPsl.c \
-lib/cheapcgi.c \
-lib/cirTree.c \
-lib/codebias.c \
-lib/colHash.c \
-lib/colHash.h \
-lib/common.c \
-lib/common.ps \
-lib/common.pss \
-lib/correlate.c \
-lib/crTree.c \
-lib/dgRange.c \
-lib/diGraph.c \
-lib/diGraph.c.97 \
-lib/diff \
-lib/diffs \
-lib/dlist.c \
-lib/dnaLoad.c \
-lib/dnaMarkov.c \
-lib/dnaMotif.c \
-lib/dnaMotif.pss \
-lib/dnaseq.c \
-lib/dnautil.c \
-lib/dtdParse.c \
-lib/dyOut.c \
-lib/dystring.c \
-lib/elmTree.c \
-lib/emblParse.c \
-lib/errAbort.c \
-lib/errCatch.c \
-lib/fa.c \
-lib/ffAli.c \
-lib/ffScore.c \
-lib/fieldedTable.c \
-lib/filePath.c \
-lib/fixColor.c \
-lib/flydna.c \
-lib/fof.c \
-lib/foo \
-lib/fq.c \
-lib/fuzzyShow.c \
-lib/gapCalc.c \
-lib/gdf.c \
-lib/gemfont.c \
-lib/gemfont.h \
-lib/genomeRangeTree.c \
-lib/gfNet.c \
-lib/gff.c \
-lib/gff3.c \
-lib/gfxPoly.c \
-lib/gifLabel.c \
-lib/gifcodes.h \
-lib/gifcomp.c \
-lib/gifdecomp.c \
-lib/gifread.c \
-lib/gifwrite.c \
-lib/hacTree.c \
-lib/hash.c \
-lib/hex.c \
-lib/histogram.c \
-lib/hmac.c \
-lib/hmmPfamParse.c \
-lib/hmmstats.c \
-lib/htmlPage.c \
-lib/htmshell.c \
-lib/https.c \
-lib/intExp.c \
-lib/intValTree.c \
-lib/internet.c \
-lib/itsa.c \
-lib/iupac.c \
-lib/jointalign.c \
-lib/jpegSize.c \
-lib/jsonParse.c \
-lib/jsonWrite.c \
-lib/keys.c \
-lib/knetUdc.c \
-lib/kxTok.c \
-lib/lineFileOnBigBed.c \
-lib/linefile.c \
-lib/localmem.c \
-lib/log.c \
-lib/longToList.c \
-lib/maf.c \
-lib/maf.doc \
-lib/mafFromAxt.c \
-lib/mafScore.c \
-lib/mailViaPipe.c \
-lib/makefile \
-lib/md5.c \
-lib/memalloc.c \
-lib/memgfx.c \
-lib/meta.c \
-lib/metaWig.c \
-lib/mgCircle.c \
-lib/mgPolygon.c \
-lib/mime.c \
-lib/net.c \
-lib/nib.c \
-lib/nibTwo.c \
-lib/nt4.c \
-lib/numObscure.c \
-lib/obscure.c \
-lib/oldGff.c \
-lib/oligoTm.c \
-lib/options.c \
-lib/pairDistance.c \
-lib/pairHmm.c \
-lib/paraFetch.c \
-lib/peakCluster.c \
-lib/phyloTree.c \
-lib/pipeline.c \
-lib/pngwrite.c \
-lib/portimpl.c \
-lib/portimpl.h \
-lib/psGfx.c \
-lib/psPoly.c \
-lib/pscmGfx.c \
-lib/psl.as \
-lib/psl.c \
-lib/psl.sql \
-lib/pslGenoShow.c \
-lib/pslShow.c \
-lib/pslTbl.c \
-lib/pslTransMap.c \
-lib/pslWScore.as \
-lib/pslWScore.sql \
-lib/pthreadDoList.c \
-lib/pthreadWrap.c \
-lib/qa.c \
-lib/quickHeap.c \
-lib/quotedP.c \
-lib/ra.c \
-lib/raToStruct.c \
-lib/rainbow.c \
-lib/rangeTree.c \
-lib/rbTree.c \
-lib/regexHelper.c \
-lib/repMask.c \
-lib/rle.c \
-lib/rnautil.c \
-lib/rqlEval.c \
-lib/rqlParse.c \
-lib/rudp.c \
-lib/scoreWindow.c \
-lib/seg.c \
-lib/seqOut.c \
-lib/seqStats.c \
-lib/servBrcMcw.c \
-lib/servCrunx.c \
-lib/servcis.c \
-lib/servcl.c \
-lib/servmsII.c \
-lib/servpws.c \
-lib/shaRes.c \
-lib/slog.c \
-lib/snof.c \
-lib/snofmake.c \
-lib/snofsig.c \
-lib/spaceSaver.c \
-lib/spacedColumn.c \
-lib/spacedSeed.c \
-lib/splatAli.as \
-lib/splatAli.c \
-lib/sqlList.c \
-lib/sqlNum.c \
-lib/status \
-lib/subText.c \
-lib/sufa.c \
-lib/sufx.c \
-lib/synQueue.c \
-lib/tabRow.c \
-lib/textOut.c \
-lib/tokenizer.c \
-lib/trix.c \
-lib/twoBit.c \
-lib/udc.c \
-lib/vGfx.c \
-lib/vGfxPrivate.h \
-lib/vGif.c \
-lib/vPng.c \
-lib/valgrind.suppress \
-lib/vcf.c \
-lib/vcfBits.c \
-lib/verbose.c \
-lib/wildcmp.c \
-lib/wormdna.c \
-lib/xAli.as \
-lib/xAli.c \
-lib/xAli.sql \
-lib/xa.c \
-lib/xap.c \
-lib/xenshow.c \
-lib/xmlEscape.c \
-lib/xp.c \
-lib/zlibFace.c \
-$(NULL) 
-
-if LINUX
-libblatSrc_la_SOURCES += lib/osunix.c
-endif
-
-if DARWIN
-libblatSrc_la_SOURCES += lib/osunix.c
-endif
-
-if CYGWIN
-libblatSrc_la_SOURCES += lib/osunix.c
-endif
-
-if WINDOWS
-libblatSrc_la_SOURCES += lib/oswin9x.c
-endif
-
-
-
-libblatSrc_la_LDFLAGS  = \
-$(OPENSSL_LDFLAGS) \
-$(OPENSSL_LIBS) \
-$(NULL)
-
-libblatSrc_la_CFLAGS  = \
-$(OPENSSL_INCLUDES) \
-$(NULL)
-
-# Extra files to remove for the maintainer-clean target.
-#
-MAINTAINERCLEANFILES = $(top_srcdir)/src/blatSrc/Makefile.in
-
diff --git a/gbtools/src/blatSrc/Makefile.in b/gbtools/src/blatSrc/Makefile.in
deleted file mode 100644
index 07703ff..0000000
--- a/gbtools/src/blatSrc/Makefile.in
+++ /dev/null
@@ -1,2688 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-# Common includes for all compiles.....
-#
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \	]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-DIST_COMMON = $(top_srcdir)/src/Makefile.am.common \
-	$(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/config/depcomp
- at LINUX_TRUE@am__append_1 = lib/osunix.c
- at DARWIN_TRUE@am__append_2 = lib/osunix.c
- at CYGWIN_TRUE@am__append_3 = lib/osunix.c
- at WINDOWS_TRUE@am__append_4 = lib/oswin9x.c
-subdir = src/blatSrc
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/./gbtools_version.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libblatSrc_la_LIBADD =
-am__libblatSrc_la_SOURCES_DIST = lib/aliType.c lib/annoAssembly.c \
-	lib/annoFilter.c lib/annoFormatTab.c lib/annoFormatter.c \
-	lib/annoGrateWig.c lib/annoGrator.c lib/annoGratorQuery.c \
-	lib/annoOption.c lib/annoRow.c lib/annoStreamBigBed.c \
-	lib/annoStreamBigWig.c lib/annoStreamTab.c lib/annoStreamVcf.c \
-	lib/annoStreamer.c lib/apacheLog.c lib/asParse.c lib/axt.c \
-	lib/axtAffine.c lib/bPlusTree.c lib/bamFile.c lib/base64.c \
-	lib/basicBed.c lib/bbiRead.c lib/bbiWrite.c lib/bigBed.c \
-	lib/binRange.c lib/bits.c lib/blastOut.c lib/blastParse.c \
-	lib/boxClump.c lib/boxLump.c lib/bwgCreate.c lib/bwgQuery.c \
-	lib/bwgValsOnChrom.c lib/cda.c lib/chain.c lib/chainBlock.c \
-	lib/chainConnect.c lib/chainToAxt.c lib/chainToPsl.c \
-	lib/cheapcgi.c lib/cirTree.c lib/codebias.c lib/colHash.c \
-	lib/colHash.h lib/common.c lib/common.ps lib/common.pss \
-	lib/correlate.c lib/crTree.c lib/dgRange.c lib/diGraph.c \
-	lib/diGraph.c.97 lib/diff lib/diffs lib/dlist.c lib/dnaLoad.c \
-	lib/dnaMarkov.c lib/dnaMotif.c lib/dnaMotif.pss lib/dnaseq.c \
-	lib/dnautil.c lib/dtdParse.c lib/dyOut.c lib/dystring.c \
-	lib/elmTree.c lib/emblParse.c lib/errAbort.c lib/errCatch.c \
-	lib/fa.c lib/ffAli.c lib/ffScore.c lib/fieldedTable.c \
-	lib/filePath.c lib/fixColor.c lib/flydna.c lib/fof.c lib/foo \
-	lib/fq.c lib/fuzzyShow.c lib/gapCalc.c lib/gdf.c lib/gemfont.c \
-	lib/gemfont.h lib/genomeRangeTree.c lib/gfNet.c lib/gff.c \
-	lib/gff3.c lib/gfxPoly.c lib/gifLabel.c lib/gifcodes.h \
-	lib/gifcomp.c lib/gifdecomp.c lib/gifread.c lib/gifwrite.c \
-	lib/hacTree.c lib/hash.c lib/hex.c lib/histogram.c lib/hmac.c \
-	lib/hmmPfamParse.c lib/hmmstats.c lib/htmlPage.c \
-	lib/htmshell.c lib/https.c lib/intExp.c lib/intValTree.c \
-	lib/internet.c lib/itsa.c lib/iupac.c lib/jointalign.c \
-	lib/jpegSize.c lib/jsonParse.c lib/jsonWrite.c lib/keys.c \
-	lib/knetUdc.c lib/kxTok.c lib/lineFileOnBigBed.c \
-	lib/linefile.c lib/localmem.c lib/log.c lib/longToList.c \
-	lib/maf.c lib/maf.doc lib/mafFromAxt.c lib/mafScore.c \
-	lib/mailViaPipe.c lib/makefile lib/md5.c lib/memalloc.c \
-	lib/memgfx.c lib/meta.c lib/metaWig.c lib/mgCircle.c \
-	lib/mgPolygon.c lib/mime.c lib/net.c lib/nib.c lib/nibTwo.c \
-	lib/nt4.c lib/numObscure.c lib/obscure.c lib/oldGff.c \
-	lib/oligoTm.c lib/options.c lib/pairDistance.c lib/pairHmm.c \
-	lib/paraFetch.c lib/peakCluster.c lib/phyloTree.c \
-	lib/pipeline.c lib/pngwrite.c lib/portimpl.c lib/portimpl.h \
-	lib/psGfx.c lib/psPoly.c lib/pscmGfx.c lib/psl.as lib/psl.c \
-	lib/psl.sql lib/pslGenoShow.c lib/pslShow.c lib/pslTbl.c \
-	lib/pslTransMap.c lib/pslWScore.as lib/pslWScore.sql \
-	lib/pthreadDoList.c lib/pthreadWrap.c lib/qa.c lib/quickHeap.c \
-	lib/quotedP.c lib/ra.c lib/raToStruct.c lib/rainbow.c \
-	lib/rangeTree.c lib/rbTree.c lib/regexHelper.c lib/repMask.c \
-	lib/rle.c lib/rnautil.c lib/rqlEval.c lib/rqlParse.c \
-	lib/rudp.c lib/scoreWindow.c lib/seg.c lib/seqOut.c \
-	lib/seqStats.c lib/servBrcMcw.c lib/servCrunx.c lib/servcis.c \
-	lib/servcl.c lib/servmsII.c lib/servpws.c lib/shaRes.c \
-	lib/slog.c lib/snof.c lib/snofmake.c lib/snofsig.c \
-	lib/spaceSaver.c lib/spacedColumn.c lib/spacedSeed.c \
-	lib/splatAli.as lib/splatAli.c lib/sqlList.c lib/sqlNum.c \
-	lib/status lib/subText.c lib/sufa.c lib/sufx.c lib/synQueue.c \
-	lib/tabRow.c lib/textOut.c lib/tokenizer.c lib/trix.c \
-	lib/twoBit.c lib/udc.c lib/vGfx.c lib/vGfxPrivate.h lib/vGif.c \
-	lib/vPng.c lib/valgrind.suppress lib/vcf.c lib/vcfBits.c \
-	lib/verbose.c lib/wildcmp.c lib/wormdna.c lib/xAli.as \
-	lib/xAli.c lib/xAli.sql lib/xa.c lib/xap.c lib/xenshow.c \
-	lib/xmlEscape.c lib/xp.c lib/zlibFace.c lib/osunix.c \
-	lib/oswin9x.c
- at LINUX_TRUE@am__objects_1 = libblatSrc_la-osunix.lo
- at DARWIN_TRUE@am__objects_2 = libblatSrc_la-osunix.lo
- at CYGWIN_TRUE@am__objects_3 = libblatSrc_la-osunix.lo
- at WINDOWS_TRUE@am__objects_4 = libblatSrc_la-oswin9x.lo
-am_libblatSrc_la_OBJECTS = libblatSrc_la-aliType.lo \
-	libblatSrc_la-annoAssembly.lo libblatSrc_la-annoFilter.lo \
-	libblatSrc_la-annoFormatTab.lo libblatSrc_la-annoFormatter.lo \
-	libblatSrc_la-annoGrateWig.lo libblatSrc_la-annoGrator.lo \
-	libblatSrc_la-annoGratorQuery.lo libblatSrc_la-annoOption.lo \
-	libblatSrc_la-annoRow.lo libblatSrc_la-annoStreamBigBed.lo \
-	libblatSrc_la-annoStreamBigWig.lo \
-	libblatSrc_la-annoStreamTab.lo libblatSrc_la-annoStreamVcf.lo \
-	libblatSrc_la-annoStreamer.lo libblatSrc_la-apacheLog.lo \
-	libblatSrc_la-asParse.lo libblatSrc_la-axt.lo \
-	libblatSrc_la-axtAffine.lo libblatSrc_la-bPlusTree.lo \
-	libblatSrc_la-bamFile.lo libblatSrc_la-base64.lo \
-	libblatSrc_la-basicBed.lo libblatSrc_la-bbiRead.lo \
-	libblatSrc_la-bbiWrite.lo libblatSrc_la-bigBed.lo \
-	libblatSrc_la-binRange.lo libblatSrc_la-bits.lo \
-	libblatSrc_la-blastOut.lo libblatSrc_la-blastParse.lo \
-	libblatSrc_la-boxClump.lo libblatSrc_la-boxLump.lo \
-	libblatSrc_la-bwgCreate.lo libblatSrc_la-bwgQuery.lo \
-	libblatSrc_la-bwgValsOnChrom.lo libblatSrc_la-cda.lo \
-	libblatSrc_la-chain.lo libblatSrc_la-chainBlock.lo \
-	libblatSrc_la-chainConnect.lo libblatSrc_la-chainToAxt.lo \
-	libblatSrc_la-chainToPsl.lo libblatSrc_la-cheapcgi.lo \
-	libblatSrc_la-cirTree.lo libblatSrc_la-codebias.lo \
-	libblatSrc_la-colHash.lo libblatSrc_la-common.lo \
-	libblatSrc_la-correlate.lo libblatSrc_la-crTree.lo \
-	libblatSrc_la-dgRange.lo libblatSrc_la-diGraph.lo \
-	libblatSrc_la-dlist.lo libblatSrc_la-dnaLoad.lo \
-	libblatSrc_la-dnaMarkov.lo libblatSrc_la-dnaMotif.lo \
-	libblatSrc_la-dnaseq.lo libblatSrc_la-dnautil.lo \
-	libblatSrc_la-dtdParse.lo libblatSrc_la-dyOut.lo \
-	libblatSrc_la-dystring.lo libblatSrc_la-elmTree.lo \
-	libblatSrc_la-emblParse.lo libblatSrc_la-errAbort.lo \
-	libblatSrc_la-errCatch.lo libblatSrc_la-fa.lo \
-	libblatSrc_la-ffAli.lo libblatSrc_la-ffScore.lo \
-	libblatSrc_la-fieldedTable.lo libblatSrc_la-filePath.lo \
-	libblatSrc_la-fixColor.lo libblatSrc_la-flydna.lo \
-	libblatSrc_la-fof.lo libblatSrc_la-fq.lo \
-	libblatSrc_la-fuzzyShow.lo libblatSrc_la-gapCalc.lo \
-	libblatSrc_la-gdf.lo libblatSrc_la-gemfont.lo \
-	libblatSrc_la-genomeRangeTree.lo libblatSrc_la-gfNet.lo \
-	libblatSrc_la-gff.lo libblatSrc_la-gff3.lo \
-	libblatSrc_la-gfxPoly.lo libblatSrc_la-gifLabel.lo \
-	libblatSrc_la-gifcomp.lo libblatSrc_la-gifdecomp.lo \
-	libblatSrc_la-gifread.lo libblatSrc_la-gifwrite.lo \
-	libblatSrc_la-hacTree.lo libblatSrc_la-hash.lo \
-	libblatSrc_la-hex.lo libblatSrc_la-histogram.lo \
-	libblatSrc_la-hmac.lo libblatSrc_la-hmmPfamParse.lo \
-	libblatSrc_la-hmmstats.lo libblatSrc_la-htmlPage.lo \
-	libblatSrc_la-htmshell.lo libblatSrc_la-https.lo \
-	libblatSrc_la-intExp.lo libblatSrc_la-intValTree.lo \
-	libblatSrc_la-internet.lo libblatSrc_la-itsa.lo \
-	libblatSrc_la-iupac.lo libblatSrc_la-jointalign.lo \
-	libblatSrc_la-jpegSize.lo libblatSrc_la-jsonParse.lo \
-	libblatSrc_la-jsonWrite.lo libblatSrc_la-keys.lo \
-	libblatSrc_la-knetUdc.lo libblatSrc_la-kxTok.lo \
-	libblatSrc_la-lineFileOnBigBed.lo libblatSrc_la-linefile.lo \
-	libblatSrc_la-localmem.lo libblatSrc_la-log.lo \
-	libblatSrc_la-longToList.lo libblatSrc_la-maf.lo \
-	libblatSrc_la-mafFromAxt.lo libblatSrc_la-mafScore.lo \
-	libblatSrc_la-mailViaPipe.lo libblatSrc_la-md5.lo \
-	libblatSrc_la-memalloc.lo libblatSrc_la-memgfx.lo \
-	libblatSrc_la-meta.lo libblatSrc_la-metaWig.lo \
-	libblatSrc_la-mgCircle.lo libblatSrc_la-mgPolygon.lo \
-	libblatSrc_la-mime.lo libblatSrc_la-net.lo \
-	libblatSrc_la-nib.lo libblatSrc_la-nibTwo.lo \
-	libblatSrc_la-nt4.lo libblatSrc_la-numObscure.lo \
-	libblatSrc_la-obscure.lo libblatSrc_la-oldGff.lo \
-	libblatSrc_la-oligoTm.lo libblatSrc_la-options.lo \
-	libblatSrc_la-pairDistance.lo libblatSrc_la-pairHmm.lo \
-	libblatSrc_la-paraFetch.lo libblatSrc_la-peakCluster.lo \
-	libblatSrc_la-phyloTree.lo libblatSrc_la-pipeline.lo \
-	libblatSrc_la-pngwrite.lo libblatSrc_la-portimpl.lo \
-	libblatSrc_la-psGfx.lo libblatSrc_la-psPoly.lo \
-	libblatSrc_la-pscmGfx.lo libblatSrc_la-psl.lo \
-	libblatSrc_la-pslGenoShow.lo libblatSrc_la-pslShow.lo \
-	libblatSrc_la-pslTbl.lo libblatSrc_la-pslTransMap.lo \
-	libblatSrc_la-pthreadDoList.lo libblatSrc_la-pthreadWrap.lo \
-	libblatSrc_la-qa.lo libblatSrc_la-quickHeap.lo \
-	libblatSrc_la-quotedP.lo libblatSrc_la-ra.lo \
-	libblatSrc_la-raToStruct.lo libblatSrc_la-rainbow.lo \
-	libblatSrc_la-rangeTree.lo libblatSrc_la-rbTree.lo \
-	libblatSrc_la-regexHelper.lo libblatSrc_la-repMask.lo \
-	libblatSrc_la-rle.lo libblatSrc_la-rnautil.lo \
-	libblatSrc_la-rqlEval.lo libblatSrc_la-rqlParse.lo \
-	libblatSrc_la-rudp.lo libblatSrc_la-scoreWindow.lo \
-	libblatSrc_la-seg.lo libblatSrc_la-seqOut.lo \
-	libblatSrc_la-seqStats.lo libblatSrc_la-servBrcMcw.lo \
-	libblatSrc_la-servCrunx.lo libblatSrc_la-servcis.lo \
-	libblatSrc_la-servcl.lo libblatSrc_la-servmsII.lo \
-	libblatSrc_la-servpws.lo libblatSrc_la-shaRes.lo \
-	libblatSrc_la-slog.lo libblatSrc_la-snof.lo \
-	libblatSrc_la-snofmake.lo libblatSrc_la-snofsig.lo \
-	libblatSrc_la-spaceSaver.lo libblatSrc_la-spacedColumn.lo \
-	libblatSrc_la-spacedSeed.lo libblatSrc_la-splatAli.lo \
-	libblatSrc_la-sqlList.lo libblatSrc_la-sqlNum.lo \
-	libblatSrc_la-subText.lo libblatSrc_la-sufa.lo \
-	libblatSrc_la-sufx.lo libblatSrc_la-synQueue.lo \
-	libblatSrc_la-tabRow.lo libblatSrc_la-textOut.lo \
-	libblatSrc_la-tokenizer.lo libblatSrc_la-trix.lo \
-	libblatSrc_la-twoBit.lo libblatSrc_la-udc.lo \
-	libblatSrc_la-vGfx.lo libblatSrc_la-vGif.lo \
-	libblatSrc_la-vPng.lo libblatSrc_la-vcf.lo \
-	libblatSrc_la-vcfBits.lo libblatSrc_la-verbose.lo \
-	libblatSrc_la-wildcmp.lo libblatSrc_la-wormdna.lo \
-	libblatSrc_la-xAli.lo libblatSrc_la-xa.lo libblatSrc_la-xap.lo \
-	libblatSrc_la-xenshow.lo libblatSrc_la-xmlEscape.lo \
-	libblatSrc_la-xp.lo libblatSrc_la-zlibFace.lo $(am__objects_1) \
-	$(am__objects_2) $(am__objects_3) $(am__objects_4)
-libblatSrc_la_OBJECTS = $(am_libblatSrc_la_OBJECTS)
-AM_V_lt = $(am__v_lt_ at AM_V@)
-am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-libblatSrc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libblatSrc_la_CFLAGS) \
-	$(CFLAGS) $(libblatSrc_la_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_P = $(am__v_P_ at AM_V@)
-am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_ at AM_V@)
-am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_ at AM_V@)
-am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/config/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-	$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_ at AM_V@)
-am__v_CC_ = $(am__v_CC_ at AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(libblatSrc_la_SOURCES)
-DIST_SOURCES = $(am__libblatSrc_la_SOURCES_DIST)
-RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
-	ctags-recursive dvi-recursive html-recursive info-recursive \
-	install-data-recursive install-dvi-recursive \
-	install-exec-recursive install-html-recursive \
-	install-info-recursive install-pdf-recursive \
-	install-ps-recursive install-recursive installcheck-recursive \
-	installdirs-recursive pdf-recursive ps-recursive \
-	tags-recursive uninstall-recursive
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
-  distclean-recursive maintainer-clean-recursive
-am__recursive_targets = \
-  $(RECURSIVE_TARGETS) \
-  $(RECURSIVE_CLEAN_TARGETS) \
-  $(am__extra_recursive_targets)
-AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	distdir
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-am__relativize = \
-  dir0=`pwd`; \
-  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
-  sed_rest='s,^[^/]*/*,,'; \
-  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
-  sed_butlast='s,/*[^/]*$$,,'; \
-  while test -n "$$dir1"; do \
-    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
-    if test "$$first" != "."; then \
-      if test "$$first" = ".."; then \
-        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
-        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
-      else \
-        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
-        if test "$$first2" = "$$first"; then \
-          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
-        else \
-          dir2="../$$dir2"; \
-        fi; \
-        dir0="$$dir0"/"$$first"; \
-      fi; \
-    fi; \
-    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
-  done; \
-  reldir="$$dir2"
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DEPS_CFLAGS = @DEPS_CFLAGS@
-DEPS_LIBS = @DEPS_LIBS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIBTOOL_DEPS = @LIBTOOL_DEPS@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_BLATSRC = @USE_BLATSRC@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-AM_CPPFLAGS = \
-$(DEPS_CFLAGS) \
--I$(top_srcdir)/src/include \
--I$(top_srcdir)/src/include/blatSrc
-
-AM_CXXFLAGS = -std=c++11 -g -Wall
-SUBDIRS = .
-noinst_LTLIBRARIES = libblatSrc.la
-libblatSrc_la_SOURCES = lib/aliType.c lib/annoAssembly.c \
-	lib/annoFilter.c lib/annoFormatTab.c lib/annoFormatter.c \
-	lib/annoGrateWig.c lib/annoGrator.c lib/annoGratorQuery.c \
-	lib/annoOption.c lib/annoRow.c lib/annoStreamBigBed.c \
-	lib/annoStreamBigWig.c lib/annoStreamTab.c lib/annoStreamVcf.c \
-	lib/annoStreamer.c lib/apacheLog.c lib/asParse.c lib/axt.c \
-	lib/axtAffine.c lib/bPlusTree.c lib/bamFile.c lib/base64.c \
-	lib/basicBed.c lib/bbiRead.c lib/bbiWrite.c lib/bigBed.c \
-	lib/binRange.c lib/bits.c lib/blastOut.c lib/blastParse.c \
-	lib/boxClump.c lib/boxLump.c lib/bwgCreate.c lib/bwgQuery.c \
-	lib/bwgValsOnChrom.c lib/cda.c lib/chain.c lib/chainBlock.c \
-	lib/chainConnect.c lib/chainToAxt.c lib/chainToPsl.c \
-	lib/cheapcgi.c lib/cirTree.c lib/codebias.c lib/colHash.c \
-	lib/colHash.h lib/common.c lib/common.ps lib/common.pss \
-	lib/correlate.c lib/crTree.c lib/dgRange.c lib/diGraph.c \
-	lib/diGraph.c.97 lib/diff lib/diffs lib/dlist.c lib/dnaLoad.c \
-	lib/dnaMarkov.c lib/dnaMotif.c lib/dnaMotif.pss lib/dnaseq.c \
-	lib/dnautil.c lib/dtdParse.c lib/dyOut.c lib/dystring.c \
-	lib/elmTree.c lib/emblParse.c lib/errAbort.c lib/errCatch.c \
-	lib/fa.c lib/ffAli.c lib/ffScore.c lib/fieldedTable.c \
-	lib/filePath.c lib/fixColor.c lib/flydna.c lib/fof.c lib/foo \
-	lib/fq.c lib/fuzzyShow.c lib/gapCalc.c lib/gdf.c lib/gemfont.c \
-	lib/gemfont.h lib/genomeRangeTree.c lib/gfNet.c lib/gff.c \
-	lib/gff3.c lib/gfxPoly.c lib/gifLabel.c lib/gifcodes.h \
-	lib/gifcomp.c lib/gifdecomp.c lib/gifread.c lib/gifwrite.c \
-	lib/hacTree.c lib/hash.c lib/hex.c lib/histogram.c lib/hmac.c \
-	lib/hmmPfamParse.c lib/hmmstats.c lib/htmlPage.c \
-	lib/htmshell.c lib/https.c lib/intExp.c lib/intValTree.c \
-	lib/internet.c lib/itsa.c lib/iupac.c lib/jointalign.c \
-	lib/jpegSize.c lib/jsonParse.c lib/jsonWrite.c lib/keys.c \
-	lib/knetUdc.c lib/kxTok.c lib/lineFileOnBigBed.c \
-	lib/linefile.c lib/localmem.c lib/log.c lib/longToList.c \
-	lib/maf.c lib/maf.doc lib/mafFromAxt.c lib/mafScore.c \
-	lib/mailViaPipe.c lib/makefile lib/md5.c lib/memalloc.c \
-	lib/memgfx.c lib/meta.c lib/metaWig.c lib/mgCircle.c \
-	lib/mgPolygon.c lib/mime.c lib/net.c lib/nib.c lib/nibTwo.c \
-	lib/nt4.c lib/numObscure.c lib/obscure.c lib/oldGff.c \
-	lib/oligoTm.c lib/options.c lib/pairDistance.c lib/pairHmm.c \
-	lib/paraFetch.c lib/peakCluster.c lib/phyloTree.c \
-	lib/pipeline.c lib/pngwrite.c lib/portimpl.c lib/portimpl.h \
-	lib/psGfx.c lib/psPoly.c lib/pscmGfx.c lib/psl.as lib/psl.c \
-	lib/psl.sql lib/pslGenoShow.c lib/pslShow.c lib/pslTbl.c \
-	lib/pslTransMap.c lib/pslWScore.as lib/pslWScore.sql \
-	lib/pthreadDoList.c lib/pthreadWrap.c lib/qa.c lib/quickHeap.c \
-	lib/quotedP.c lib/ra.c lib/raToStruct.c lib/rainbow.c \
-	lib/rangeTree.c lib/rbTree.c lib/regexHelper.c lib/repMask.c \
-	lib/rle.c lib/rnautil.c lib/rqlEval.c lib/rqlParse.c \
-	lib/rudp.c lib/scoreWindow.c lib/seg.c lib/seqOut.c \
-	lib/seqStats.c lib/servBrcMcw.c lib/servCrunx.c lib/servcis.c \
-	lib/servcl.c lib/servmsII.c lib/servpws.c lib/shaRes.c \
-	lib/slog.c lib/snof.c lib/snofmake.c lib/snofsig.c \
-	lib/spaceSaver.c lib/spacedColumn.c lib/spacedSeed.c \
-	lib/splatAli.as lib/splatAli.c lib/sqlList.c lib/sqlNum.c \
-	lib/status lib/subText.c lib/sufa.c lib/sufx.c lib/synQueue.c \
-	lib/tabRow.c lib/textOut.c lib/tokenizer.c lib/trix.c \
-	lib/twoBit.c lib/udc.c lib/vGfx.c lib/vGfxPrivate.h lib/vGif.c \
-	lib/vPng.c lib/valgrind.suppress lib/vcf.c lib/vcfBits.c \
-	lib/verbose.c lib/wildcmp.c lib/wormdna.c lib/xAli.as \
-	lib/xAli.c lib/xAli.sql lib/xa.c lib/xap.c lib/xenshow.c \
-	lib/xmlEscape.c lib/xp.c lib/zlibFace.c $(NULL) \
-	$(am__append_1) $(am__append_2) $(am__append_3) \
-	$(am__append_4)
-libblatSrc_la_LDFLAGS = \
-$(OPENSSL_LDFLAGS) \
-$(OPENSSL_LIBS) \
-$(NULL)
-
-libblatSrc_la_CFLAGS = \
-$(OPENSSL_INCLUDES) \
-$(NULL)
-
-
-# Extra files to remove for the maintainer-clean target.
-#
-MAINTAINERCLEANFILES = $(top_srcdir)/src/blatSrc/Makefile.in
-all: all-recursive
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/src/Makefile.am.common $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/blatSrc/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign src/blatSrc/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-$(top_srcdir)/src/Makefile.am.common:
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-clean-noinstLTLIBRARIES:
-	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-	@list='$(noinst_LTLIBRARIES)'; \
-	locs=`for p in $$list; do echo $$p; done | \
-	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-	      sort -u`; \
-	test -z "$$locs" || { \
-	  echo rm -f $${locs}; \
-	  rm -f $${locs}; \
-	}
-
-libblatSrc.la: $(libblatSrc_la_OBJECTS) $(libblatSrc_la_DEPENDENCIES) $(EXTRA_libblatSrc_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(libblatSrc_la_LINK)  $(libblatSrc_la_OBJECTS) $(libblatSrc_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-aliType.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoAssembly.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoFilter.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoFormatTab.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoFormatter.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoGrateWig.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoGrator.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoGratorQuery.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoOption.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoRow.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoStreamBigBed.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoStreamBigWig.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoStreamTab.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoStreamVcf.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-annoStreamer.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-apacheLog.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-asParse.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-axt.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-axtAffine.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-bPlusTree.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-bamFile.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-base64.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-basicBed.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-bbiRead.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-bbiWrite.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-bigBed.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-binRange.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-bits.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-blastOut.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-blastParse.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-boxClump.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-boxLump.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-bwgCreate.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-bwgQuery.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-bwgValsOnChrom.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-cda.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-chain.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-chainBlock.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-chainConnect.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-chainToAxt.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-chainToPsl.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-cheapcgi.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-cirTree.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-codebias.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-colHash.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-common.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-correlate.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-crTree.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-dgRange.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-diGraph.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-dlist.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-dnaLoad.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-dnaMarkov.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-dnaMotif.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-dnaseq.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-dnautil.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-dtdParse.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-dyOut.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-dystring.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-elmTree.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-emblParse.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-errAbort.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-errCatch.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-fa.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-ffAli.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-ffScore.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-fieldedTable.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-filePath.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-fixColor.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-flydna.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-fof.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-fq.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-fuzzyShow.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-gapCalc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-gdf.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-gemfont.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-genomeRangeTree.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-gfNet.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-gff.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-gff3.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-gfxPoly.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-gifLabel.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-gifcomp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-gifdecomp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-gifread.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-gifwrite.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-hacTree.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-hash.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-hex.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-histogram.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-hmac.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-hmmPfamParse.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-hmmstats.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-htmlPage.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-htmshell.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-https.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-intExp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-intValTree.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-internet.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-itsa.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-iupac.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-jointalign.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-jpegSize.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-jsonParse.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-jsonWrite.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-keys.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-knetUdc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-kxTok.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-lineFileOnBigBed.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-linefile.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-localmem.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-log.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-longToList.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-maf.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-mafFromAxt.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-mafScore.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-mailViaPipe.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-md5.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-memalloc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-memgfx.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-meta.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-metaWig.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-mgCircle.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-mgPolygon.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-mime.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-net.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-nib.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-nibTwo.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-nt4.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-numObscure.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-obscure.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-oldGff.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-oligoTm.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-options.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-osunix.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-oswin9x.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-pairDistance.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-pairHmm.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-paraFetch.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-peakCluster.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-phyloTree.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-pipeline.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-pngwrite.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-portimpl.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-psGfx.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-psPoly.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-pscmGfx.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-psl.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-pslGenoShow.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-pslShow.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-pslTbl.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-pslTransMap.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-pthreadDoList.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-pthreadWrap.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-qa.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-quickHeap.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-quotedP.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-ra.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-raToStruct.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-rainbow.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-rangeTree.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-rbTree.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-regexHelper.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-repMask.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-rle.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-rnautil.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-rqlEval.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-rqlParse.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-rudp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-scoreWindow.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-seg.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-seqOut.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-seqStats.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-servBrcMcw.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-servCrunx.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-servcis.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-servcl.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-servmsII.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-servpws.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-shaRes.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-slog.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-snof.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-snofmake.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-snofsig.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-spaceSaver.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-spacedColumn.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-spacedSeed.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-splatAli.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-sqlList.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-sqlNum.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-subText.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-sufa.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-sufx.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-synQueue.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-tabRow.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-textOut.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-tokenizer.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-trix.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-twoBit.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-udc.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-vGfx.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-vGif.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-vPng.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-vcf.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-vcfBits.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-verbose.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-wildcmp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-wormdna.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-xAli.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-xa.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-xap.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-xenshow.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-xmlEscape.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-xp.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libblatSrc_la-zlibFace.Plo at am__quote@
-
-.c.o:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LTCOMPILE) -c -o $@ $<
-
-libblatSrc_la-aliType.lo: lib/aliType.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-aliType.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-aliType.Tpo -c -o libblatSrc_la-aliType.lo `test -f 'lib/aliType.c' || echo '$(srcdir)/'`lib/aliType.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-aliType.Tpo $(DEPDIR)/libblatSrc_la-aliType.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/aliType.c' object='libblatSrc_la-aliType.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-aliType.lo `test -f 'lib/aliType.c' || echo '$(srcdir)/'`lib/aliType.c
-
-libblatSrc_la-annoAssembly.lo: lib/annoAssembly.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoAssembly.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoAssembly.Tpo -c -o libblatSrc_la-annoAssembly.lo `test -f 'lib/annoAssembly.c' || echo '$(srcdir)/'`lib/annoAssembly.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoAssembly.Tpo $(DEPDIR)/libblatSrc_la-annoAssembly.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoAssembly.c' object='libblatSrc_la-annoAssembly.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoAssembly.lo `test -f 'lib/annoAssembly.c' || echo '$(srcdir)/'`lib/annoAssembly.c
-
-libblatSrc_la-annoFilter.lo: lib/annoFilter.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoFilter.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoFilter.Tpo -c -o libblatSrc_la-annoFilter.lo `test -f 'lib/annoFilter.c' || echo '$(srcdir)/'`lib/annoFilter.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoFilter.Tpo $(DEPDIR)/libblatSrc_la-annoFilter.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoFilter.c' object='libblatSrc_la-annoFilter.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoFilter.lo `test -f 'lib/annoFilter.c' || echo '$(srcdir)/'`lib/annoFilter.c
-
-libblatSrc_la-annoFormatTab.lo: lib/annoFormatTab.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoFormatTab.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoFormatTab.Tpo -c -o libblatSrc_la-annoFormatTab.lo `test -f 'lib/annoFormatTab.c' || echo '$(srcdir)/'`lib/annoFormatTab.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoFormatTab.Tpo $(DEPDIR)/libblatSrc_la-annoFormatTab.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoFormatTab.c' object='libblatSrc_la-annoFormatTab.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoFormatTab.lo `test -f 'lib/annoFormatTab.c' || echo '$(srcdir)/'`lib/annoFormatTab.c
-
-libblatSrc_la-annoFormatter.lo: lib/annoFormatter.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoFormatter.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoFormatter.Tpo -c -o libblatSrc_la-annoFormatter.lo `test -f 'lib/annoFormatter.c' || echo '$(srcdir)/'`lib/annoFormatter.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoFormatter.Tpo $(DEPDIR)/libblatSrc_la-annoFormatter.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoFormatter.c' object='libblatSrc_la-annoFormatter.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoFormatter.lo `test -f 'lib/annoFormatter.c' || echo '$(srcdir)/'`lib/annoFormatter.c
-
-libblatSrc_la-annoGrateWig.lo: lib/annoGrateWig.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoGrateWig.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoGrateWig.Tpo -c -o libblatSrc_la-annoGrateWig.lo `test -f 'lib/annoGrateWig.c' || echo '$(srcdir)/'`lib/annoGrateWig.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoGrateWig.Tpo $(DEPDIR)/libblatSrc_la-annoGrateWig.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoGrateWig.c' object='libblatSrc_la-annoGrateWig.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoGrateWig.lo `test -f 'lib/annoGrateWig.c' || echo '$(srcdir)/'`lib/annoGrateWig.c
-
-libblatSrc_la-annoGrator.lo: lib/annoGrator.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoGrator.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoGrator.Tpo -c -o libblatSrc_la-annoGrator.lo `test -f 'lib/annoGrator.c' || echo '$(srcdir)/'`lib/annoGrator.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoGrator.Tpo $(DEPDIR)/libblatSrc_la-annoGrator.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoGrator.c' object='libblatSrc_la-annoGrator.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoGrator.lo `test -f 'lib/annoGrator.c' || echo '$(srcdir)/'`lib/annoGrator.c
-
-libblatSrc_la-annoGratorQuery.lo: lib/annoGratorQuery.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoGratorQuery.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoGratorQuery.Tpo -c -o libblatSrc_la-annoGratorQuery.lo `test -f 'lib/annoGratorQuery.c' || echo '$(srcdir)/'`lib/annoGratorQuery.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoGratorQuery.Tpo $(DEPDIR)/libblatSrc_la-annoGratorQuery.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoGratorQuery.c' object='libblatSrc_la-annoGratorQuery.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoGratorQuery.lo `test -f 'lib/annoGratorQuery.c' || echo '$(srcdir)/'`lib/annoGratorQuery.c
-
-libblatSrc_la-annoOption.lo: lib/annoOption.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoOption.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoOption.Tpo -c -o libblatSrc_la-annoOption.lo `test -f 'lib/annoOption.c' || echo '$(srcdir)/'`lib/annoOption.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoOption.Tpo $(DEPDIR)/libblatSrc_la-annoOption.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoOption.c' object='libblatSrc_la-annoOption.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoOption.lo `test -f 'lib/annoOption.c' || echo '$(srcdir)/'`lib/annoOption.c
-
-libblatSrc_la-annoRow.lo: lib/annoRow.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoRow.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoRow.Tpo -c -o libblatSrc_la-annoRow.lo `test -f 'lib/annoRow.c' || echo '$(srcdir)/'`lib/annoRow.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoRow.Tpo $(DEPDIR)/libblatSrc_la-annoRow.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoRow.c' object='libblatSrc_la-annoRow.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoRow.lo `test -f 'lib/annoRow.c' || echo '$(srcdir)/'`lib/annoRow.c
-
-libblatSrc_la-annoStreamBigBed.lo: lib/annoStreamBigBed.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoStreamBigBed.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoStreamBigBed.Tpo -c -o libblatSrc_la-annoStreamBigBed.lo `test -f 'lib/annoStreamBigBed.c' || echo '$(srcdir)/'`lib/annoStreamBigBed.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoStreamBigBed.Tpo $(DEPDIR)/libblatSrc_la-annoStreamBigBed.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoStreamBigBed.c' object='libblatSrc_la-annoStreamBigBed.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoStreamBigBed.lo `test -f 'lib/annoStreamBigBed.c' || echo '$(srcdir)/'`lib/annoStreamBigBed.c
-
-libblatSrc_la-annoStreamBigWig.lo: lib/annoStreamBigWig.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoStreamBigWig.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoStreamBigWig.Tpo -c -o libblatSrc_la-annoStreamBigWig.lo `test -f 'lib/annoStreamBigWig.c' || echo '$(srcdir)/'`lib/annoStreamBigWig.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoStreamBigWig.Tpo $(DEPDIR)/libblatSrc_la-annoStreamBigWig.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoStreamBigWig.c' object='libblatSrc_la-annoStreamBigWig.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoStreamBigWig.lo `test -f 'lib/annoStreamBigWig.c' || echo '$(srcdir)/'`lib/annoStreamBigWig.c
-
-libblatSrc_la-annoStreamTab.lo: lib/annoStreamTab.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoStreamTab.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoStreamTab.Tpo -c -o libblatSrc_la-annoStreamTab.lo `test -f 'lib/annoStreamTab.c' || echo '$(srcdir)/'`lib/annoStreamTab.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoStreamTab.Tpo $(DEPDIR)/libblatSrc_la-annoStreamTab.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoStreamTab.c' object='libblatSrc_la-annoStreamTab.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoStreamTab.lo `test -f 'lib/annoStreamTab.c' || echo '$(srcdir)/'`lib/annoStreamTab.c
-
-libblatSrc_la-annoStreamVcf.lo: lib/annoStreamVcf.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoStreamVcf.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoStreamVcf.Tpo -c -o libblatSrc_la-annoStreamVcf.lo `test -f 'lib/annoStreamVcf.c' || echo '$(srcdir)/'`lib/annoStreamVcf.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoStreamVcf.Tpo $(DEPDIR)/libblatSrc_la-annoStreamVcf.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoStreamVcf.c' object='libblatSrc_la-annoStreamVcf.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoStreamVcf.lo `test -f 'lib/annoStreamVcf.c' || echo '$(srcdir)/'`lib/annoStreamVcf.c
-
-libblatSrc_la-annoStreamer.lo: lib/annoStreamer.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-annoStreamer.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-annoStreamer.Tpo -c -o libblatSrc_la-annoStreamer.lo `test -f 'lib/annoStreamer.c' || echo '$(srcdir)/'`lib/annoStreamer.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-annoStreamer.Tpo $(DEPDIR)/libblatSrc_la-annoStreamer.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/annoStreamer.c' object='libblatSrc_la-annoStreamer.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-annoStreamer.lo `test -f 'lib/annoStreamer.c' || echo '$(srcdir)/'`lib/annoStreamer.c
-
-libblatSrc_la-apacheLog.lo: lib/apacheLog.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-apacheLog.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-apacheLog.Tpo -c -o libblatSrc_la-apacheLog.lo `test -f 'lib/apacheLog.c' || echo '$(srcdir)/'`lib/apacheLog.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-apacheLog.Tpo $(DEPDIR)/libblatSrc_la-apacheLog.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/apacheLog.c' object='libblatSrc_la-apacheLog.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-apacheLog.lo `test -f 'lib/apacheLog.c' || echo '$(srcdir)/'`lib/apacheLog.c
-
-libblatSrc_la-asParse.lo: lib/asParse.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-asParse.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-asParse.Tpo -c -o libblatSrc_la-asParse.lo `test -f 'lib/asParse.c' || echo '$(srcdir)/'`lib/asParse.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-asParse.Tpo $(DEPDIR)/libblatSrc_la-asParse.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/asParse.c' object='libblatSrc_la-asParse.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-asParse.lo `test -f 'lib/asParse.c' || echo '$(srcdir)/'`lib/asParse.c
-
-libblatSrc_la-axt.lo: lib/axt.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-axt.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-axt.Tpo -c -o libblatSrc_la-axt.lo `test -f 'lib/axt.c' || echo '$(srcdir)/'`lib/axt.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-axt.Tpo $(DEPDIR)/libblatSrc_la-axt.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/axt.c' object='libblatSrc_la-axt.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-axt.lo `test -f 'lib/axt.c' || echo '$(srcdir)/'`lib/axt.c
-
-libblatSrc_la-axtAffine.lo: lib/axtAffine.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-axtAffine.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-axtAffine.Tpo -c -o libblatSrc_la-axtAffine.lo `test -f 'lib/axtAffine.c' || echo '$(srcdir)/'`lib/axtAffine.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-axtAffine.Tpo $(DEPDIR)/libblatSrc_la-axtAffine.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/axtAffine.c' object='libblatSrc_la-axtAffine.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-axtAffine.lo `test -f 'lib/axtAffine.c' || echo '$(srcdir)/'`lib/axtAffine.c
-
-libblatSrc_la-bPlusTree.lo: lib/bPlusTree.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-bPlusTree.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-bPlusTree.Tpo -c -o libblatSrc_la-bPlusTree.lo `test -f 'lib/bPlusTree.c' || echo '$(srcdir)/'`lib/bPlusTree.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-bPlusTree.Tpo $(DEPDIR)/libblatSrc_la-bPlusTree.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/bPlusTree.c' object='libblatSrc_la-bPlusTree.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-bPlusTree.lo `test -f 'lib/bPlusTree.c' || echo '$(srcdir)/'`lib/bPlusTree.c
-
-libblatSrc_la-bamFile.lo: lib/bamFile.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-bamFile.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-bamFile.Tpo -c -o libblatSrc_la-bamFile.lo `test -f 'lib/bamFile.c' || echo '$(srcdir)/'`lib/bamFile.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-bamFile.Tpo $(DEPDIR)/libblatSrc_la-bamFile.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/bamFile.c' object='libblatSrc_la-bamFile.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-bamFile.lo `test -f 'lib/bamFile.c' || echo '$(srcdir)/'`lib/bamFile.c
-
-libblatSrc_la-base64.lo: lib/base64.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-base64.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-base64.Tpo -c -o libblatSrc_la-base64.lo `test -f 'lib/base64.c' || echo '$(srcdir)/'`lib/base64.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-base64.Tpo $(DEPDIR)/libblatSrc_la-base64.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/base64.c' object='libblatSrc_la-base64.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-base64.lo `test -f 'lib/base64.c' || echo '$(srcdir)/'`lib/base64.c
-
-libblatSrc_la-basicBed.lo: lib/basicBed.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-basicBed.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-basicBed.Tpo -c -o libblatSrc_la-basicBed.lo `test -f 'lib/basicBed.c' || echo '$(srcdir)/'`lib/basicBed.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-basicBed.Tpo $(DEPDIR)/libblatSrc_la-basicBed.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/basicBed.c' object='libblatSrc_la-basicBed.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-basicBed.lo `test -f 'lib/basicBed.c' || echo '$(srcdir)/'`lib/basicBed.c
-
-libblatSrc_la-bbiRead.lo: lib/bbiRead.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-bbiRead.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-bbiRead.Tpo -c -o libblatSrc_la-bbiRead.lo `test -f 'lib/bbiRead.c' || echo '$(srcdir)/'`lib/bbiRead.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-bbiRead.Tpo $(DEPDIR)/libblatSrc_la-bbiRead.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/bbiRead.c' object='libblatSrc_la-bbiRead.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-bbiRead.lo `test -f 'lib/bbiRead.c' || echo '$(srcdir)/'`lib/bbiRead.c
-
-libblatSrc_la-bbiWrite.lo: lib/bbiWrite.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-bbiWrite.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-bbiWrite.Tpo -c -o libblatSrc_la-bbiWrite.lo `test -f 'lib/bbiWrite.c' || echo '$(srcdir)/'`lib/bbiWrite.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-bbiWrite.Tpo $(DEPDIR)/libblatSrc_la-bbiWrite.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/bbiWrite.c' object='libblatSrc_la-bbiWrite.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-bbiWrite.lo `test -f 'lib/bbiWrite.c' || echo '$(srcdir)/'`lib/bbiWrite.c
-
-libblatSrc_la-bigBed.lo: lib/bigBed.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-bigBed.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-bigBed.Tpo -c -o libblatSrc_la-bigBed.lo `test -f 'lib/bigBed.c' || echo '$(srcdir)/'`lib/bigBed.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-bigBed.Tpo $(DEPDIR)/libblatSrc_la-bigBed.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/bigBed.c' object='libblatSrc_la-bigBed.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-bigBed.lo `test -f 'lib/bigBed.c' || echo '$(srcdir)/'`lib/bigBed.c
-
-libblatSrc_la-binRange.lo: lib/binRange.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-binRange.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-binRange.Tpo -c -o libblatSrc_la-binRange.lo `test -f 'lib/binRange.c' || echo '$(srcdir)/'`lib/binRange.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-binRange.Tpo $(DEPDIR)/libblatSrc_la-binRange.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/binRange.c' object='libblatSrc_la-binRange.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-binRange.lo `test -f 'lib/binRange.c' || echo '$(srcdir)/'`lib/binRange.c
-
-libblatSrc_la-bits.lo: lib/bits.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-bits.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-bits.Tpo -c -o libblatSrc_la-bits.lo `test -f 'lib/bits.c' || echo '$(srcdir)/'`lib/bits.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-bits.Tpo $(DEPDIR)/libblatSrc_la-bits.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/bits.c' object='libblatSrc_la-bits.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-bits.lo `test -f 'lib/bits.c' || echo '$(srcdir)/'`lib/bits.c
-
-libblatSrc_la-blastOut.lo: lib/blastOut.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-blastOut.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-blastOut.Tpo -c -o libblatSrc_la-blastOut.lo `test -f 'lib/blastOut.c' || echo '$(srcdir)/'`lib/blastOut.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-blastOut.Tpo $(DEPDIR)/libblatSrc_la-blastOut.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/blastOut.c' object='libblatSrc_la-blastOut.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-blastOut.lo `test -f 'lib/blastOut.c' || echo '$(srcdir)/'`lib/blastOut.c
-
-libblatSrc_la-blastParse.lo: lib/blastParse.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-blastParse.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-blastParse.Tpo -c -o libblatSrc_la-blastParse.lo `test -f 'lib/blastParse.c' || echo '$(srcdir)/'`lib/blastParse.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-blastParse.Tpo $(DEPDIR)/libblatSrc_la-blastParse.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/blastParse.c' object='libblatSrc_la-blastParse.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-blastParse.lo `test -f 'lib/blastParse.c' || echo '$(srcdir)/'`lib/blastParse.c
-
-libblatSrc_la-boxClump.lo: lib/boxClump.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-boxClump.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-boxClump.Tpo -c -o libblatSrc_la-boxClump.lo `test -f 'lib/boxClump.c' || echo '$(srcdir)/'`lib/boxClump.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-boxClump.Tpo $(DEPDIR)/libblatSrc_la-boxClump.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/boxClump.c' object='libblatSrc_la-boxClump.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-boxClump.lo `test -f 'lib/boxClump.c' || echo '$(srcdir)/'`lib/boxClump.c
-
-libblatSrc_la-boxLump.lo: lib/boxLump.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-boxLump.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-boxLump.Tpo -c -o libblatSrc_la-boxLump.lo `test -f 'lib/boxLump.c' || echo '$(srcdir)/'`lib/boxLump.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-boxLump.Tpo $(DEPDIR)/libblatSrc_la-boxLump.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/boxLump.c' object='libblatSrc_la-boxLump.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-boxLump.lo `test -f 'lib/boxLump.c' || echo '$(srcdir)/'`lib/boxLump.c
-
-libblatSrc_la-bwgCreate.lo: lib/bwgCreate.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-bwgCreate.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-bwgCreate.Tpo -c -o libblatSrc_la-bwgCreate.lo `test -f 'lib/bwgCreate.c' || echo '$(srcdir)/'`lib/bwgCreate.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-bwgCreate.Tpo $(DEPDIR)/libblatSrc_la-bwgCreate.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/bwgCreate.c' object='libblatSrc_la-bwgCreate.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-bwgCreate.lo `test -f 'lib/bwgCreate.c' || echo '$(srcdir)/'`lib/bwgCreate.c
-
-libblatSrc_la-bwgQuery.lo: lib/bwgQuery.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-bwgQuery.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-bwgQuery.Tpo -c -o libblatSrc_la-bwgQuery.lo `test -f 'lib/bwgQuery.c' || echo '$(srcdir)/'`lib/bwgQuery.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-bwgQuery.Tpo $(DEPDIR)/libblatSrc_la-bwgQuery.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/bwgQuery.c' object='libblatSrc_la-bwgQuery.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-bwgQuery.lo `test -f 'lib/bwgQuery.c' || echo '$(srcdir)/'`lib/bwgQuery.c
-
-libblatSrc_la-bwgValsOnChrom.lo: lib/bwgValsOnChrom.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-bwgValsOnChrom.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-bwgValsOnChrom.Tpo -c -o libblatSrc_la-bwgValsOnChrom.lo `test -f 'lib/bwgValsOnChrom.c' || echo '$(srcdir)/'`lib/bwgValsOnChrom.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-bwgValsOnChrom.Tpo $(DEPDIR)/libblatSrc_la-bwgValsOnChrom.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/bwgValsOnChrom.c' object='libblatSrc_la-bwgValsOnChrom.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-bwgValsOnChrom.lo `test -f 'lib/bwgValsOnChrom.c' || echo '$(srcdir)/'`lib/bwgValsOnChrom.c
-
-libblatSrc_la-cda.lo: lib/cda.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-cda.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-cda.Tpo -c -o libblatSrc_la-cda.lo `test -f 'lib/cda.c' || echo '$(srcdir)/'`lib/cda.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-cda.Tpo $(DEPDIR)/libblatSrc_la-cda.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/cda.c' object='libblatSrc_la-cda.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-cda.lo `test -f 'lib/cda.c' || echo '$(srcdir)/'`lib/cda.c
-
-libblatSrc_la-chain.lo: lib/chain.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-chain.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-chain.Tpo -c -o libblatSrc_la-chain.lo `test -f 'lib/chain.c' || echo '$(srcdir)/'`lib/chain.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-chain.Tpo $(DEPDIR)/libblatSrc_la-chain.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/chain.c' object='libblatSrc_la-chain.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-chain.lo `test -f 'lib/chain.c' || echo '$(srcdir)/'`lib/chain.c
-
-libblatSrc_la-chainBlock.lo: lib/chainBlock.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-chainBlock.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-chainBlock.Tpo -c -o libblatSrc_la-chainBlock.lo `test -f 'lib/chainBlock.c' || echo '$(srcdir)/'`lib/chainBlock.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-chainBlock.Tpo $(DEPDIR)/libblatSrc_la-chainBlock.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/chainBlock.c' object='libblatSrc_la-chainBlock.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-chainBlock.lo `test -f 'lib/chainBlock.c' || echo '$(srcdir)/'`lib/chainBlock.c
-
-libblatSrc_la-chainConnect.lo: lib/chainConnect.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-chainConnect.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-chainConnect.Tpo -c -o libblatSrc_la-chainConnect.lo `test -f 'lib/chainConnect.c' || echo '$(srcdir)/'`lib/chainConnect.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-chainConnect.Tpo $(DEPDIR)/libblatSrc_la-chainConnect.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/chainConnect.c' object='libblatSrc_la-chainConnect.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-chainConnect.lo `test -f 'lib/chainConnect.c' || echo '$(srcdir)/'`lib/chainConnect.c
-
-libblatSrc_la-chainToAxt.lo: lib/chainToAxt.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-chainToAxt.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-chainToAxt.Tpo -c -o libblatSrc_la-chainToAxt.lo `test -f 'lib/chainToAxt.c' || echo '$(srcdir)/'`lib/chainToAxt.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-chainToAxt.Tpo $(DEPDIR)/libblatSrc_la-chainToAxt.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/chainToAxt.c' object='libblatSrc_la-chainToAxt.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-chainToAxt.lo `test -f 'lib/chainToAxt.c' || echo '$(srcdir)/'`lib/chainToAxt.c
-
-libblatSrc_la-chainToPsl.lo: lib/chainToPsl.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-chainToPsl.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-chainToPsl.Tpo -c -o libblatSrc_la-chainToPsl.lo `test -f 'lib/chainToPsl.c' || echo '$(srcdir)/'`lib/chainToPsl.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-chainToPsl.Tpo $(DEPDIR)/libblatSrc_la-chainToPsl.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/chainToPsl.c' object='libblatSrc_la-chainToPsl.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-chainToPsl.lo `test -f 'lib/chainToPsl.c' || echo '$(srcdir)/'`lib/chainToPsl.c
-
-libblatSrc_la-cheapcgi.lo: lib/cheapcgi.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-cheapcgi.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-cheapcgi.Tpo -c -o libblatSrc_la-cheapcgi.lo `test -f 'lib/cheapcgi.c' || echo '$(srcdir)/'`lib/cheapcgi.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-cheapcgi.Tpo $(DEPDIR)/libblatSrc_la-cheapcgi.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/cheapcgi.c' object='libblatSrc_la-cheapcgi.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-cheapcgi.lo `test -f 'lib/cheapcgi.c' || echo '$(srcdir)/'`lib/cheapcgi.c
-
-libblatSrc_la-cirTree.lo: lib/cirTree.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-cirTree.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-cirTree.Tpo -c -o libblatSrc_la-cirTree.lo `test -f 'lib/cirTree.c' || echo '$(srcdir)/'`lib/cirTree.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-cirTree.Tpo $(DEPDIR)/libblatSrc_la-cirTree.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/cirTree.c' object='libblatSrc_la-cirTree.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-cirTree.lo `test -f 'lib/cirTree.c' || echo '$(srcdir)/'`lib/cirTree.c
-
-libblatSrc_la-codebias.lo: lib/codebias.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-codebias.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-codebias.Tpo -c -o libblatSrc_la-codebias.lo `test -f 'lib/codebias.c' || echo '$(srcdir)/'`lib/codebias.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-codebias.Tpo $(DEPDIR)/libblatSrc_la-codebias.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/codebias.c' object='libblatSrc_la-codebias.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-codebias.lo `test -f 'lib/codebias.c' || echo '$(srcdir)/'`lib/codebias.c
-
-libblatSrc_la-colHash.lo: lib/colHash.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-colHash.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-colHash.Tpo -c -o libblatSrc_la-colHash.lo `test -f 'lib/colHash.c' || echo '$(srcdir)/'`lib/colHash.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-colHash.Tpo $(DEPDIR)/libblatSrc_la-colHash.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/colHash.c' object='libblatSrc_la-colHash.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-colHash.lo `test -f 'lib/colHash.c' || echo '$(srcdir)/'`lib/colHash.c
-
-libblatSrc_la-common.lo: lib/common.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-common.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-common.Tpo -c -o libblatSrc_la-common.lo `test -f 'lib/common.c' || echo '$(srcdir)/'`lib/common.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-common.Tpo $(DEPDIR)/libblatSrc_la-common.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/common.c' object='libblatSrc_la-common.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-common.lo `test -f 'lib/common.c' || echo '$(srcdir)/'`lib/common.c
-
-libblatSrc_la-correlate.lo: lib/correlate.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-correlate.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-correlate.Tpo -c -o libblatSrc_la-correlate.lo `test -f 'lib/correlate.c' || echo '$(srcdir)/'`lib/correlate.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-correlate.Tpo $(DEPDIR)/libblatSrc_la-correlate.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/correlate.c' object='libblatSrc_la-correlate.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-correlate.lo `test -f 'lib/correlate.c' || echo '$(srcdir)/'`lib/correlate.c
-
-libblatSrc_la-crTree.lo: lib/crTree.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-crTree.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-crTree.Tpo -c -o libblatSrc_la-crTree.lo `test -f 'lib/crTree.c' || echo '$(srcdir)/'`lib/crTree.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-crTree.Tpo $(DEPDIR)/libblatSrc_la-crTree.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/crTree.c' object='libblatSrc_la-crTree.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-crTree.lo `test -f 'lib/crTree.c' || echo '$(srcdir)/'`lib/crTree.c
-
-libblatSrc_la-dgRange.lo: lib/dgRange.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-dgRange.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-dgRange.Tpo -c -o libblatSrc_la-dgRange.lo `test -f 'lib/dgRange.c' || echo '$(srcdir)/'`lib/dgRange.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-dgRange.Tpo $(DEPDIR)/libblatSrc_la-dgRange.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/dgRange.c' object='libblatSrc_la-dgRange.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-dgRange.lo `test -f 'lib/dgRange.c' || echo '$(srcdir)/'`lib/dgRange.c
-
-libblatSrc_la-diGraph.lo: lib/diGraph.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-diGraph.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-diGraph.Tpo -c -o libblatSrc_la-diGraph.lo `test -f 'lib/diGraph.c' || echo '$(srcdir)/'`lib/diGraph.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-diGraph.Tpo $(DEPDIR)/libblatSrc_la-diGraph.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/diGraph.c' object='libblatSrc_la-diGraph.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-diGraph.lo `test -f 'lib/diGraph.c' || echo '$(srcdir)/'`lib/diGraph.c
-
-libblatSrc_la-dlist.lo: lib/dlist.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-dlist.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-dlist.Tpo -c -o libblatSrc_la-dlist.lo `test -f 'lib/dlist.c' || echo '$(srcdir)/'`lib/dlist.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-dlist.Tpo $(DEPDIR)/libblatSrc_la-dlist.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/dlist.c' object='libblatSrc_la-dlist.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-dlist.lo `test -f 'lib/dlist.c' || echo '$(srcdir)/'`lib/dlist.c
-
-libblatSrc_la-dnaLoad.lo: lib/dnaLoad.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-dnaLoad.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-dnaLoad.Tpo -c -o libblatSrc_la-dnaLoad.lo `test -f 'lib/dnaLoad.c' || echo '$(srcdir)/'`lib/dnaLoad.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-dnaLoad.Tpo $(DEPDIR)/libblatSrc_la-dnaLoad.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/dnaLoad.c' object='libblatSrc_la-dnaLoad.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-dnaLoad.lo `test -f 'lib/dnaLoad.c' || echo '$(srcdir)/'`lib/dnaLoad.c
-
-libblatSrc_la-dnaMarkov.lo: lib/dnaMarkov.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-dnaMarkov.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-dnaMarkov.Tpo -c -o libblatSrc_la-dnaMarkov.lo `test -f 'lib/dnaMarkov.c' || echo '$(srcdir)/'`lib/dnaMarkov.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-dnaMarkov.Tpo $(DEPDIR)/libblatSrc_la-dnaMarkov.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/dnaMarkov.c' object='libblatSrc_la-dnaMarkov.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-dnaMarkov.lo `test -f 'lib/dnaMarkov.c' || echo '$(srcdir)/'`lib/dnaMarkov.c
-
-libblatSrc_la-dnaMotif.lo: lib/dnaMotif.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-dnaMotif.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-dnaMotif.Tpo -c -o libblatSrc_la-dnaMotif.lo `test -f 'lib/dnaMotif.c' || echo '$(srcdir)/'`lib/dnaMotif.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-dnaMotif.Tpo $(DEPDIR)/libblatSrc_la-dnaMotif.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/dnaMotif.c' object='libblatSrc_la-dnaMotif.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-dnaMotif.lo `test -f 'lib/dnaMotif.c' || echo '$(srcdir)/'`lib/dnaMotif.c
-
-libblatSrc_la-dnaseq.lo: lib/dnaseq.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-dnaseq.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-dnaseq.Tpo -c -o libblatSrc_la-dnaseq.lo `test -f 'lib/dnaseq.c' || echo '$(srcdir)/'`lib/dnaseq.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-dnaseq.Tpo $(DEPDIR)/libblatSrc_la-dnaseq.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/dnaseq.c' object='libblatSrc_la-dnaseq.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-dnaseq.lo `test -f 'lib/dnaseq.c' || echo '$(srcdir)/'`lib/dnaseq.c
-
-libblatSrc_la-dnautil.lo: lib/dnautil.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-dnautil.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-dnautil.Tpo -c -o libblatSrc_la-dnautil.lo `test -f 'lib/dnautil.c' || echo '$(srcdir)/'`lib/dnautil.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-dnautil.Tpo $(DEPDIR)/libblatSrc_la-dnautil.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/dnautil.c' object='libblatSrc_la-dnautil.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-dnautil.lo `test -f 'lib/dnautil.c' || echo '$(srcdir)/'`lib/dnautil.c
-
-libblatSrc_la-dtdParse.lo: lib/dtdParse.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-dtdParse.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-dtdParse.Tpo -c -o libblatSrc_la-dtdParse.lo `test -f 'lib/dtdParse.c' || echo '$(srcdir)/'`lib/dtdParse.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-dtdParse.Tpo $(DEPDIR)/libblatSrc_la-dtdParse.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/dtdParse.c' object='libblatSrc_la-dtdParse.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-dtdParse.lo `test -f 'lib/dtdParse.c' || echo '$(srcdir)/'`lib/dtdParse.c
-
-libblatSrc_la-dyOut.lo: lib/dyOut.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-dyOut.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-dyOut.Tpo -c -o libblatSrc_la-dyOut.lo `test -f 'lib/dyOut.c' || echo '$(srcdir)/'`lib/dyOut.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-dyOut.Tpo $(DEPDIR)/libblatSrc_la-dyOut.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/dyOut.c' object='libblatSrc_la-dyOut.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-dyOut.lo `test -f 'lib/dyOut.c' || echo '$(srcdir)/'`lib/dyOut.c
-
-libblatSrc_la-dystring.lo: lib/dystring.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-dystring.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-dystring.Tpo -c -o libblatSrc_la-dystring.lo `test -f 'lib/dystring.c' || echo '$(srcdir)/'`lib/dystring.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-dystring.Tpo $(DEPDIR)/libblatSrc_la-dystring.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/dystring.c' object='libblatSrc_la-dystring.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-dystring.lo `test -f 'lib/dystring.c' || echo '$(srcdir)/'`lib/dystring.c
-
-libblatSrc_la-elmTree.lo: lib/elmTree.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-elmTree.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-elmTree.Tpo -c -o libblatSrc_la-elmTree.lo `test -f 'lib/elmTree.c' || echo '$(srcdir)/'`lib/elmTree.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-elmTree.Tpo $(DEPDIR)/libblatSrc_la-elmTree.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/elmTree.c' object='libblatSrc_la-elmTree.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-elmTree.lo `test -f 'lib/elmTree.c' || echo '$(srcdir)/'`lib/elmTree.c
-
-libblatSrc_la-emblParse.lo: lib/emblParse.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-emblParse.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-emblParse.Tpo -c -o libblatSrc_la-emblParse.lo `test -f 'lib/emblParse.c' || echo '$(srcdir)/'`lib/emblParse.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-emblParse.Tpo $(DEPDIR)/libblatSrc_la-emblParse.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/emblParse.c' object='libblatSrc_la-emblParse.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-emblParse.lo `test -f 'lib/emblParse.c' || echo '$(srcdir)/'`lib/emblParse.c
-
-libblatSrc_la-errAbort.lo: lib/errAbort.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-errAbort.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-errAbort.Tpo -c -o libblatSrc_la-errAbort.lo `test -f 'lib/errAbort.c' || echo '$(srcdir)/'`lib/errAbort.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-errAbort.Tpo $(DEPDIR)/libblatSrc_la-errAbort.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/errAbort.c' object='libblatSrc_la-errAbort.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-errAbort.lo `test -f 'lib/errAbort.c' || echo '$(srcdir)/'`lib/errAbort.c
-
-libblatSrc_la-errCatch.lo: lib/errCatch.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-errCatch.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-errCatch.Tpo -c -o libblatSrc_la-errCatch.lo `test -f 'lib/errCatch.c' || echo '$(srcdir)/'`lib/errCatch.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-errCatch.Tpo $(DEPDIR)/libblatSrc_la-errCatch.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/errCatch.c' object='libblatSrc_la-errCatch.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-errCatch.lo `test -f 'lib/errCatch.c' || echo '$(srcdir)/'`lib/errCatch.c
-
-libblatSrc_la-fa.lo: lib/fa.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-fa.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-fa.Tpo -c -o libblatSrc_la-fa.lo `test -f 'lib/fa.c' || echo '$(srcdir)/'`lib/fa.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-fa.Tpo $(DEPDIR)/libblatSrc_la-fa.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/fa.c' object='libblatSrc_la-fa.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-fa.lo `test -f 'lib/fa.c' || echo '$(srcdir)/'`lib/fa.c
-
-libblatSrc_la-ffAli.lo: lib/ffAli.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-ffAli.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-ffAli.Tpo -c -o libblatSrc_la-ffAli.lo `test -f 'lib/ffAli.c' || echo '$(srcdir)/'`lib/ffAli.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-ffAli.Tpo $(DEPDIR)/libblatSrc_la-ffAli.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/ffAli.c' object='libblatSrc_la-ffAli.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-ffAli.lo `test -f 'lib/ffAli.c' || echo '$(srcdir)/'`lib/ffAli.c
-
-libblatSrc_la-ffScore.lo: lib/ffScore.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-ffScore.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-ffScore.Tpo -c -o libblatSrc_la-ffScore.lo `test -f 'lib/ffScore.c' || echo '$(srcdir)/'`lib/ffScore.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-ffScore.Tpo $(DEPDIR)/libblatSrc_la-ffScore.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/ffScore.c' object='libblatSrc_la-ffScore.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-ffScore.lo `test -f 'lib/ffScore.c' || echo '$(srcdir)/'`lib/ffScore.c
-
-libblatSrc_la-fieldedTable.lo: lib/fieldedTable.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-fieldedTable.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-fieldedTable.Tpo -c -o libblatSrc_la-fieldedTable.lo `test -f 'lib/fieldedTable.c' || echo '$(srcdir)/'`lib/fieldedTable.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-fieldedTable.Tpo $(DEPDIR)/libblatSrc_la-fieldedTable.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/fieldedTable.c' object='libblatSrc_la-fieldedTable.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-fieldedTable.lo `test -f 'lib/fieldedTable.c' || echo '$(srcdir)/'`lib/fieldedTable.c
-
-libblatSrc_la-filePath.lo: lib/filePath.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-filePath.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-filePath.Tpo -c -o libblatSrc_la-filePath.lo `test -f 'lib/filePath.c' || echo '$(srcdir)/'`lib/filePath.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-filePath.Tpo $(DEPDIR)/libblatSrc_la-filePath.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/filePath.c' object='libblatSrc_la-filePath.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-filePath.lo `test -f 'lib/filePath.c' || echo '$(srcdir)/'`lib/filePath.c
-
-libblatSrc_la-fixColor.lo: lib/fixColor.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-fixColor.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-fixColor.Tpo -c -o libblatSrc_la-fixColor.lo `test -f 'lib/fixColor.c' || echo '$(srcdir)/'`lib/fixColor.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-fixColor.Tpo $(DEPDIR)/libblatSrc_la-fixColor.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/fixColor.c' object='libblatSrc_la-fixColor.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-fixColor.lo `test -f 'lib/fixColor.c' || echo '$(srcdir)/'`lib/fixColor.c
-
-libblatSrc_la-flydna.lo: lib/flydna.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-flydna.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-flydna.Tpo -c -o libblatSrc_la-flydna.lo `test -f 'lib/flydna.c' || echo '$(srcdir)/'`lib/flydna.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-flydna.Tpo $(DEPDIR)/libblatSrc_la-flydna.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/flydna.c' object='libblatSrc_la-flydna.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-flydna.lo `test -f 'lib/flydna.c' || echo '$(srcdir)/'`lib/flydna.c
-
-libblatSrc_la-fof.lo: lib/fof.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-fof.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-fof.Tpo -c -o libblatSrc_la-fof.lo `test -f 'lib/fof.c' || echo '$(srcdir)/'`lib/fof.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-fof.Tpo $(DEPDIR)/libblatSrc_la-fof.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/fof.c' object='libblatSrc_la-fof.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-fof.lo `test -f 'lib/fof.c' || echo '$(srcdir)/'`lib/fof.c
-
-libblatSrc_la-fq.lo: lib/fq.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-fq.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-fq.Tpo -c -o libblatSrc_la-fq.lo `test -f 'lib/fq.c' || echo '$(srcdir)/'`lib/fq.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-fq.Tpo $(DEPDIR)/libblatSrc_la-fq.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/fq.c' object='libblatSrc_la-fq.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-fq.lo `test -f 'lib/fq.c' || echo '$(srcdir)/'`lib/fq.c
-
-libblatSrc_la-fuzzyShow.lo: lib/fuzzyShow.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-fuzzyShow.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-fuzzyShow.Tpo -c -o libblatSrc_la-fuzzyShow.lo `test -f 'lib/fuzzyShow.c' || echo '$(srcdir)/'`lib/fuzzyShow.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-fuzzyShow.Tpo $(DEPDIR)/libblatSrc_la-fuzzyShow.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/fuzzyShow.c' object='libblatSrc_la-fuzzyShow.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-fuzzyShow.lo `test -f 'lib/fuzzyShow.c' || echo '$(srcdir)/'`lib/fuzzyShow.c
-
-libblatSrc_la-gapCalc.lo: lib/gapCalc.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-gapCalc.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-gapCalc.Tpo -c -o libblatSrc_la-gapCalc.lo `test -f 'lib/gapCalc.c' || echo '$(srcdir)/'`lib/gapCalc.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-gapCalc.Tpo $(DEPDIR)/libblatSrc_la-gapCalc.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/gapCalc.c' object='libblatSrc_la-gapCalc.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-gapCalc.lo `test -f 'lib/gapCalc.c' || echo '$(srcdir)/'`lib/gapCalc.c
-
-libblatSrc_la-gdf.lo: lib/gdf.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-gdf.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-gdf.Tpo -c -o libblatSrc_la-gdf.lo `test -f 'lib/gdf.c' || echo '$(srcdir)/'`lib/gdf.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-gdf.Tpo $(DEPDIR)/libblatSrc_la-gdf.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/gdf.c' object='libblatSrc_la-gdf.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-gdf.lo `test -f 'lib/gdf.c' || echo '$(srcdir)/'`lib/gdf.c
-
-libblatSrc_la-gemfont.lo: lib/gemfont.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-gemfont.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-gemfont.Tpo -c -o libblatSrc_la-gemfont.lo `test -f 'lib/gemfont.c' || echo '$(srcdir)/'`lib/gemfont.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-gemfont.Tpo $(DEPDIR)/libblatSrc_la-gemfont.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/gemfont.c' object='libblatSrc_la-gemfont.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-gemfont.lo `test -f 'lib/gemfont.c' || echo '$(srcdir)/'`lib/gemfont.c
-
-libblatSrc_la-genomeRangeTree.lo: lib/genomeRangeTree.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-genomeRangeTree.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-genomeRangeTree.Tpo -c -o libblatSrc_la-genomeRangeTree.lo `test -f 'lib/genomeRangeTree.c' || echo '$(srcdir)/'`lib/genomeRangeTree.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-genomeRangeTree.Tpo $(DEPDIR)/libblatSrc_la-genomeRangeTree.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/genomeRangeTree.c' object='libblatSrc_la-genomeRangeTree.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-genomeRangeTree.lo `test -f 'lib/genomeRangeTree.c' || echo '$(srcdir)/'`lib/genomeRangeTree.c
-
-libblatSrc_la-gfNet.lo: lib/gfNet.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-gfNet.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-gfNet.Tpo -c -o libblatSrc_la-gfNet.lo `test -f 'lib/gfNet.c' || echo '$(srcdir)/'`lib/gfNet.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-gfNet.Tpo $(DEPDIR)/libblatSrc_la-gfNet.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/gfNet.c' object='libblatSrc_la-gfNet.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-gfNet.lo `test -f 'lib/gfNet.c' || echo '$(srcdir)/'`lib/gfNet.c
-
-libblatSrc_la-gff.lo: lib/gff.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-gff.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-gff.Tpo -c -o libblatSrc_la-gff.lo `test -f 'lib/gff.c' || echo '$(srcdir)/'`lib/gff.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-gff.Tpo $(DEPDIR)/libblatSrc_la-gff.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/gff.c' object='libblatSrc_la-gff.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-gff.lo `test -f 'lib/gff.c' || echo '$(srcdir)/'`lib/gff.c
-
-libblatSrc_la-gff3.lo: lib/gff3.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-gff3.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-gff3.Tpo -c -o libblatSrc_la-gff3.lo `test -f 'lib/gff3.c' || echo '$(srcdir)/'`lib/gff3.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-gff3.Tpo $(DEPDIR)/libblatSrc_la-gff3.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/gff3.c' object='libblatSrc_la-gff3.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-gff3.lo `test -f 'lib/gff3.c' || echo '$(srcdir)/'`lib/gff3.c
-
-libblatSrc_la-gfxPoly.lo: lib/gfxPoly.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-gfxPoly.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-gfxPoly.Tpo -c -o libblatSrc_la-gfxPoly.lo `test -f 'lib/gfxPoly.c' || echo '$(srcdir)/'`lib/gfxPoly.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-gfxPoly.Tpo $(DEPDIR)/libblatSrc_la-gfxPoly.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/gfxPoly.c' object='libblatSrc_la-gfxPoly.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-gfxPoly.lo `test -f 'lib/gfxPoly.c' || echo '$(srcdir)/'`lib/gfxPoly.c
-
-libblatSrc_la-gifLabel.lo: lib/gifLabel.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-gifLabel.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-gifLabel.Tpo -c -o libblatSrc_la-gifLabel.lo `test -f 'lib/gifLabel.c' || echo '$(srcdir)/'`lib/gifLabel.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-gifLabel.Tpo $(DEPDIR)/libblatSrc_la-gifLabel.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/gifLabel.c' object='libblatSrc_la-gifLabel.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-gifLabel.lo `test -f 'lib/gifLabel.c' || echo '$(srcdir)/'`lib/gifLabel.c
-
-libblatSrc_la-gifcomp.lo: lib/gifcomp.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-gifcomp.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-gifcomp.Tpo -c -o libblatSrc_la-gifcomp.lo `test -f 'lib/gifcomp.c' || echo '$(srcdir)/'`lib/gifcomp.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-gifcomp.Tpo $(DEPDIR)/libblatSrc_la-gifcomp.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/gifcomp.c' object='libblatSrc_la-gifcomp.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-gifcomp.lo `test -f 'lib/gifcomp.c' || echo '$(srcdir)/'`lib/gifcomp.c
-
-libblatSrc_la-gifdecomp.lo: lib/gifdecomp.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-gifdecomp.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-gifdecomp.Tpo -c -o libblatSrc_la-gifdecomp.lo `test -f 'lib/gifdecomp.c' || echo '$(srcdir)/'`lib/gifdecomp.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-gifdecomp.Tpo $(DEPDIR)/libblatSrc_la-gifdecomp.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/gifdecomp.c' object='libblatSrc_la-gifdecomp.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-gifdecomp.lo `test -f 'lib/gifdecomp.c' || echo '$(srcdir)/'`lib/gifdecomp.c
-
-libblatSrc_la-gifread.lo: lib/gifread.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-gifread.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-gifread.Tpo -c -o libblatSrc_la-gifread.lo `test -f 'lib/gifread.c' || echo '$(srcdir)/'`lib/gifread.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-gifread.Tpo $(DEPDIR)/libblatSrc_la-gifread.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/gifread.c' object='libblatSrc_la-gifread.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-gifread.lo `test -f 'lib/gifread.c' || echo '$(srcdir)/'`lib/gifread.c
-
-libblatSrc_la-gifwrite.lo: lib/gifwrite.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-gifwrite.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-gifwrite.Tpo -c -o libblatSrc_la-gifwrite.lo `test -f 'lib/gifwrite.c' || echo '$(srcdir)/'`lib/gifwrite.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-gifwrite.Tpo $(DEPDIR)/libblatSrc_la-gifwrite.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/gifwrite.c' object='libblatSrc_la-gifwrite.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-gifwrite.lo `test -f 'lib/gifwrite.c' || echo '$(srcdir)/'`lib/gifwrite.c
-
-libblatSrc_la-hacTree.lo: lib/hacTree.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-hacTree.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-hacTree.Tpo -c -o libblatSrc_la-hacTree.lo `test -f 'lib/hacTree.c' || echo '$(srcdir)/'`lib/hacTree.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-hacTree.Tpo $(DEPDIR)/libblatSrc_la-hacTree.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/hacTree.c' object='libblatSrc_la-hacTree.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-hacTree.lo `test -f 'lib/hacTree.c' || echo '$(srcdir)/'`lib/hacTree.c
-
-libblatSrc_la-hash.lo: lib/hash.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-hash.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-hash.Tpo -c -o libblatSrc_la-hash.lo `test -f 'lib/hash.c' || echo '$(srcdir)/'`lib/hash.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-hash.Tpo $(DEPDIR)/libblatSrc_la-hash.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/hash.c' object='libblatSrc_la-hash.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-hash.lo `test -f 'lib/hash.c' || echo '$(srcdir)/'`lib/hash.c
-
-libblatSrc_la-hex.lo: lib/hex.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-hex.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-hex.Tpo -c -o libblatSrc_la-hex.lo `test -f 'lib/hex.c' || echo '$(srcdir)/'`lib/hex.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-hex.Tpo $(DEPDIR)/libblatSrc_la-hex.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/hex.c' object='libblatSrc_la-hex.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-hex.lo `test -f 'lib/hex.c' || echo '$(srcdir)/'`lib/hex.c
-
-libblatSrc_la-histogram.lo: lib/histogram.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-histogram.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-histogram.Tpo -c -o libblatSrc_la-histogram.lo `test -f 'lib/histogram.c' || echo '$(srcdir)/'`lib/histogram.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-histogram.Tpo $(DEPDIR)/libblatSrc_la-histogram.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/histogram.c' object='libblatSrc_la-histogram.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-histogram.lo `test -f 'lib/histogram.c' || echo '$(srcdir)/'`lib/histogram.c
-
-libblatSrc_la-hmac.lo: lib/hmac.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-hmac.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-hmac.Tpo -c -o libblatSrc_la-hmac.lo `test -f 'lib/hmac.c' || echo '$(srcdir)/'`lib/hmac.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-hmac.Tpo $(DEPDIR)/libblatSrc_la-hmac.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/hmac.c' object='libblatSrc_la-hmac.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-hmac.lo `test -f 'lib/hmac.c' || echo '$(srcdir)/'`lib/hmac.c
-
-libblatSrc_la-hmmPfamParse.lo: lib/hmmPfamParse.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-hmmPfamParse.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-hmmPfamParse.Tpo -c -o libblatSrc_la-hmmPfamParse.lo `test -f 'lib/hmmPfamParse.c' || echo '$(srcdir)/'`lib/hmmPfamParse.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-hmmPfamParse.Tpo $(DEPDIR)/libblatSrc_la-hmmPfamParse.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/hmmPfamParse.c' object='libblatSrc_la-hmmPfamParse.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-hmmPfamParse.lo `test -f 'lib/hmmPfamParse.c' || echo '$(srcdir)/'`lib/hmmPfamParse.c
-
-libblatSrc_la-hmmstats.lo: lib/hmmstats.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-hmmstats.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-hmmstats.Tpo -c -o libblatSrc_la-hmmstats.lo `test -f 'lib/hmmstats.c' || echo '$(srcdir)/'`lib/hmmstats.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-hmmstats.Tpo $(DEPDIR)/libblatSrc_la-hmmstats.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/hmmstats.c' object='libblatSrc_la-hmmstats.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-hmmstats.lo `test -f 'lib/hmmstats.c' || echo '$(srcdir)/'`lib/hmmstats.c
-
-libblatSrc_la-htmlPage.lo: lib/htmlPage.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-htmlPage.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-htmlPage.Tpo -c -o libblatSrc_la-htmlPage.lo `test -f 'lib/htmlPage.c' || echo '$(srcdir)/'`lib/htmlPage.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-htmlPage.Tpo $(DEPDIR)/libblatSrc_la-htmlPage.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/htmlPage.c' object='libblatSrc_la-htmlPage.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-htmlPage.lo `test -f 'lib/htmlPage.c' || echo '$(srcdir)/'`lib/htmlPage.c
-
-libblatSrc_la-htmshell.lo: lib/htmshell.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-htmshell.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-htmshell.Tpo -c -o libblatSrc_la-htmshell.lo `test -f 'lib/htmshell.c' || echo '$(srcdir)/'`lib/htmshell.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-htmshell.Tpo $(DEPDIR)/libblatSrc_la-htmshell.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/htmshell.c' object='libblatSrc_la-htmshell.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-htmshell.lo `test -f 'lib/htmshell.c' || echo '$(srcdir)/'`lib/htmshell.c
-
-libblatSrc_la-https.lo: lib/https.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-https.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-https.Tpo -c -o libblatSrc_la-https.lo `test -f 'lib/https.c' || echo '$(srcdir)/'`lib/https.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-https.Tpo $(DEPDIR)/libblatSrc_la-https.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/https.c' object='libblatSrc_la-https.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-https.lo `test -f 'lib/https.c' || echo '$(srcdir)/'`lib/https.c
-
-libblatSrc_la-intExp.lo: lib/intExp.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-intExp.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-intExp.Tpo -c -o libblatSrc_la-intExp.lo `test -f 'lib/intExp.c' || echo '$(srcdir)/'`lib/intExp.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-intExp.Tpo $(DEPDIR)/libblatSrc_la-intExp.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/intExp.c' object='libblatSrc_la-intExp.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-intExp.lo `test -f 'lib/intExp.c' || echo '$(srcdir)/'`lib/intExp.c
-
-libblatSrc_la-intValTree.lo: lib/intValTree.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-intValTree.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-intValTree.Tpo -c -o libblatSrc_la-intValTree.lo `test -f 'lib/intValTree.c' || echo '$(srcdir)/'`lib/intValTree.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-intValTree.Tpo $(DEPDIR)/libblatSrc_la-intValTree.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/intValTree.c' object='libblatSrc_la-intValTree.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-intValTree.lo `test -f 'lib/intValTree.c' || echo '$(srcdir)/'`lib/intValTree.c
-
-libblatSrc_la-internet.lo: lib/internet.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-internet.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-internet.Tpo -c -o libblatSrc_la-internet.lo `test -f 'lib/internet.c' || echo '$(srcdir)/'`lib/internet.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-internet.Tpo $(DEPDIR)/libblatSrc_la-internet.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/internet.c' object='libblatSrc_la-internet.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-internet.lo `test -f 'lib/internet.c' || echo '$(srcdir)/'`lib/internet.c
-
-libblatSrc_la-itsa.lo: lib/itsa.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-itsa.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-itsa.Tpo -c -o libblatSrc_la-itsa.lo `test -f 'lib/itsa.c' || echo '$(srcdir)/'`lib/itsa.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-itsa.Tpo $(DEPDIR)/libblatSrc_la-itsa.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/itsa.c' object='libblatSrc_la-itsa.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-itsa.lo `test -f 'lib/itsa.c' || echo '$(srcdir)/'`lib/itsa.c
-
-libblatSrc_la-iupac.lo: lib/iupac.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-iupac.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-iupac.Tpo -c -o libblatSrc_la-iupac.lo `test -f 'lib/iupac.c' || echo '$(srcdir)/'`lib/iupac.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-iupac.Tpo $(DEPDIR)/libblatSrc_la-iupac.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/iupac.c' object='libblatSrc_la-iupac.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-iupac.lo `test -f 'lib/iupac.c' || echo '$(srcdir)/'`lib/iupac.c
-
-libblatSrc_la-jointalign.lo: lib/jointalign.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-jointalign.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-jointalign.Tpo -c -o libblatSrc_la-jointalign.lo `test -f 'lib/jointalign.c' || echo '$(srcdir)/'`lib/jointalign.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-jointalign.Tpo $(DEPDIR)/libblatSrc_la-jointalign.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/jointalign.c' object='libblatSrc_la-jointalign.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-jointalign.lo `test -f 'lib/jointalign.c' || echo '$(srcdir)/'`lib/jointalign.c
-
-libblatSrc_la-jpegSize.lo: lib/jpegSize.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-jpegSize.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-jpegSize.Tpo -c -o libblatSrc_la-jpegSize.lo `test -f 'lib/jpegSize.c' || echo '$(srcdir)/'`lib/jpegSize.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-jpegSize.Tpo $(DEPDIR)/libblatSrc_la-jpegSize.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/jpegSize.c' object='libblatSrc_la-jpegSize.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-jpegSize.lo `test -f 'lib/jpegSize.c' || echo '$(srcdir)/'`lib/jpegSize.c
-
-libblatSrc_la-jsonParse.lo: lib/jsonParse.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-jsonParse.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-jsonParse.Tpo -c -o libblatSrc_la-jsonParse.lo `test -f 'lib/jsonParse.c' || echo '$(srcdir)/'`lib/jsonParse.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-jsonParse.Tpo $(DEPDIR)/libblatSrc_la-jsonParse.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/jsonParse.c' object='libblatSrc_la-jsonParse.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-jsonParse.lo `test -f 'lib/jsonParse.c' || echo '$(srcdir)/'`lib/jsonParse.c
-
-libblatSrc_la-jsonWrite.lo: lib/jsonWrite.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-jsonWrite.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-jsonWrite.Tpo -c -o libblatSrc_la-jsonWrite.lo `test -f 'lib/jsonWrite.c' || echo '$(srcdir)/'`lib/jsonWrite.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-jsonWrite.Tpo $(DEPDIR)/libblatSrc_la-jsonWrite.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/jsonWrite.c' object='libblatSrc_la-jsonWrite.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-jsonWrite.lo `test -f 'lib/jsonWrite.c' || echo '$(srcdir)/'`lib/jsonWrite.c
-
-libblatSrc_la-keys.lo: lib/keys.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-keys.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-keys.Tpo -c -o libblatSrc_la-keys.lo `test -f 'lib/keys.c' || echo '$(srcdir)/'`lib/keys.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-keys.Tpo $(DEPDIR)/libblatSrc_la-keys.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/keys.c' object='libblatSrc_la-keys.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-keys.lo `test -f 'lib/keys.c' || echo '$(srcdir)/'`lib/keys.c
-
-libblatSrc_la-knetUdc.lo: lib/knetUdc.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-knetUdc.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-knetUdc.Tpo -c -o libblatSrc_la-knetUdc.lo `test -f 'lib/knetUdc.c' || echo '$(srcdir)/'`lib/knetUdc.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-knetUdc.Tpo $(DEPDIR)/libblatSrc_la-knetUdc.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/knetUdc.c' object='libblatSrc_la-knetUdc.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-knetUdc.lo `test -f 'lib/knetUdc.c' || echo '$(srcdir)/'`lib/knetUdc.c
-
-libblatSrc_la-kxTok.lo: lib/kxTok.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-kxTok.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-kxTok.Tpo -c -o libblatSrc_la-kxTok.lo `test -f 'lib/kxTok.c' || echo '$(srcdir)/'`lib/kxTok.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-kxTok.Tpo $(DEPDIR)/libblatSrc_la-kxTok.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/kxTok.c' object='libblatSrc_la-kxTok.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-kxTok.lo `test -f 'lib/kxTok.c' || echo '$(srcdir)/'`lib/kxTok.c
-
-libblatSrc_la-lineFileOnBigBed.lo: lib/lineFileOnBigBed.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-lineFileOnBigBed.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-lineFileOnBigBed.Tpo -c -o libblatSrc_la-lineFileOnBigBed.lo `test -f 'lib/lineFileOnBigBed.c' || echo '$(srcdir)/'`lib/lineFileOnBigBed.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-lineFileOnBigBed.Tpo $(DEPDIR)/libblatSrc_la-lineFileOnBigBed.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/lineFileOnBigBed.c' object='libblatSrc_la-lineFileOnBigBed.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-lineFileOnBigBed.lo `test -f 'lib/lineFileOnBigBed.c' || echo '$(srcdir)/'`lib/lineFileOnBigBed.c
-
-libblatSrc_la-linefile.lo: lib/linefile.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-linefile.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-linefile.Tpo -c -o libblatSrc_la-linefile.lo `test -f 'lib/linefile.c' || echo '$(srcdir)/'`lib/linefile.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-linefile.Tpo $(DEPDIR)/libblatSrc_la-linefile.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/linefile.c' object='libblatSrc_la-linefile.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-linefile.lo `test -f 'lib/linefile.c' || echo '$(srcdir)/'`lib/linefile.c
-
-libblatSrc_la-localmem.lo: lib/localmem.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-localmem.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-localmem.Tpo -c -o libblatSrc_la-localmem.lo `test -f 'lib/localmem.c' || echo '$(srcdir)/'`lib/localmem.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-localmem.Tpo $(DEPDIR)/libblatSrc_la-localmem.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/localmem.c' object='libblatSrc_la-localmem.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-localmem.lo `test -f 'lib/localmem.c' || echo '$(srcdir)/'`lib/localmem.c
-
-libblatSrc_la-log.lo: lib/log.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-log.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-log.Tpo -c -o libblatSrc_la-log.lo `test -f 'lib/log.c' || echo '$(srcdir)/'`lib/log.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-log.Tpo $(DEPDIR)/libblatSrc_la-log.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/log.c' object='libblatSrc_la-log.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-log.lo `test -f 'lib/log.c' || echo '$(srcdir)/'`lib/log.c
-
-libblatSrc_la-longToList.lo: lib/longToList.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-longToList.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-longToList.Tpo -c -o libblatSrc_la-longToList.lo `test -f 'lib/longToList.c' || echo '$(srcdir)/'`lib/longToList.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-longToList.Tpo $(DEPDIR)/libblatSrc_la-longToList.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/longToList.c' object='libblatSrc_la-longToList.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-longToList.lo `test -f 'lib/longToList.c' || echo '$(srcdir)/'`lib/longToList.c
-
-libblatSrc_la-maf.lo: lib/maf.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-maf.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-maf.Tpo -c -o libblatSrc_la-maf.lo `test -f 'lib/maf.c' || echo '$(srcdir)/'`lib/maf.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-maf.Tpo $(DEPDIR)/libblatSrc_la-maf.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/maf.c' object='libblatSrc_la-maf.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-maf.lo `test -f 'lib/maf.c' || echo '$(srcdir)/'`lib/maf.c
-
-libblatSrc_la-mafFromAxt.lo: lib/mafFromAxt.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-mafFromAxt.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-mafFromAxt.Tpo -c -o libblatSrc_la-mafFromAxt.lo `test -f 'lib/mafFromAxt.c' || echo '$(srcdir)/'`lib/mafFromAxt.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-mafFromAxt.Tpo $(DEPDIR)/libblatSrc_la-mafFromAxt.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/mafFromAxt.c' object='libblatSrc_la-mafFromAxt.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-mafFromAxt.lo `test -f 'lib/mafFromAxt.c' || echo '$(srcdir)/'`lib/mafFromAxt.c
-
-libblatSrc_la-mafScore.lo: lib/mafScore.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-mafScore.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-mafScore.Tpo -c -o libblatSrc_la-mafScore.lo `test -f 'lib/mafScore.c' || echo '$(srcdir)/'`lib/mafScore.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-mafScore.Tpo $(DEPDIR)/libblatSrc_la-mafScore.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/mafScore.c' object='libblatSrc_la-mafScore.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-mafScore.lo `test -f 'lib/mafScore.c' || echo '$(srcdir)/'`lib/mafScore.c
-
-libblatSrc_la-mailViaPipe.lo: lib/mailViaPipe.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-mailViaPipe.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-mailViaPipe.Tpo -c -o libblatSrc_la-mailViaPipe.lo `test -f 'lib/mailViaPipe.c' || echo '$(srcdir)/'`lib/mailViaPipe.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-mailViaPipe.Tpo $(DEPDIR)/libblatSrc_la-mailViaPipe.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/mailViaPipe.c' object='libblatSrc_la-mailViaPipe.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-mailViaPipe.lo `test -f 'lib/mailViaPipe.c' || echo '$(srcdir)/'`lib/mailViaPipe.c
-
-libblatSrc_la-md5.lo: lib/md5.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-md5.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-md5.Tpo -c -o libblatSrc_la-md5.lo `test -f 'lib/md5.c' || echo '$(srcdir)/'`lib/md5.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-md5.Tpo $(DEPDIR)/libblatSrc_la-md5.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/md5.c' object='libblatSrc_la-md5.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-md5.lo `test -f 'lib/md5.c' || echo '$(srcdir)/'`lib/md5.c
-
-libblatSrc_la-memalloc.lo: lib/memalloc.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-memalloc.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-memalloc.Tpo -c -o libblatSrc_la-memalloc.lo `test -f 'lib/memalloc.c' || echo '$(srcdir)/'`lib/memalloc.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-memalloc.Tpo $(DEPDIR)/libblatSrc_la-memalloc.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/memalloc.c' object='libblatSrc_la-memalloc.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-memalloc.lo `test -f 'lib/memalloc.c' || echo '$(srcdir)/'`lib/memalloc.c
-
-libblatSrc_la-memgfx.lo: lib/memgfx.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-memgfx.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-memgfx.Tpo -c -o libblatSrc_la-memgfx.lo `test -f 'lib/memgfx.c' || echo '$(srcdir)/'`lib/memgfx.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-memgfx.Tpo $(DEPDIR)/libblatSrc_la-memgfx.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/memgfx.c' object='libblatSrc_la-memgfx.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-memgfx.lo `test -f 'lib/memgfx.c' || echo '$(srcdir)/'`lib/memgfx.c
-
-libblatSrc_la-meta.lo: lib/meta.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-meta.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-meta.Tpo -c -o libblatSrc_la-meta.lo `test -f 'lib/meta.c' || echo '$(srcdir)/'`lib/meta.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-meta.Tpo $(DEPDIR)/libblatSrc_la-meta.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/meta.c' object='libblatSrc_la-meta.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-meta.lo `test -f 'lib/meta.c' || echo '$(srcdir)/'`lib/meta.c
-
-libblatSrc_la-metaWig.lo: lib/metaWig.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-metaWig.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-metaWig.Tpo -c -o libblatSrc_la-metaWig.lo `test -f 'lib/metaWig.c' || echo '$(srcdir)/'`lib/metaWig.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-metaWig.Tpo $(DEPDIR)/libblatSrc_la-metaWig.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/metaWig.c' object='libblatSrc_la-metaWig.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-metaWig.lo `test -f 'lib/metaWig.c' || echo '$(srcdir)/'`lib/metaWig.c
-
-libblatSrc_la-mgCircle.lo: lib/mgCircle.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-mgCircle.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-mgCircle.Tpo -c -o libblatSrc_la-mgCircle.lo `test -f 'lib/mgCircle.c' || echo '$(srcdir)/'`lib/mgCircle.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-mgCircle.Tpo $(DEPDIR)/libblatSrc_la-mgCircle.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/mgCircle.c' object='libblatSrc_la-mgCircle.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-mgCircle.lo `test -f 'lib/mgCircle.c' || echo '$(srcdir)/'`lib/mgCircle.c
-
-libblatSrc_la-mgPolygon.lo: lib/mgPolygon.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-mgPolygon.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-mgPolygon.Tpo -c -o libblatSrc_la-mgPolygon.lo `test -f 'lib/mgPolygon.c' || echo '$(srcdir)/'`lib/mgPolygon.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-mgPolygon.Tpo $(DEPDIR)/libblatSrc_la-mgPolygon.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/mgPolygon.c' object='libblatSrc_la-mgPolygon.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-mgPolygon.lo `test -f 'lib/mgPolygon.c' || echo '$(srcdir)/'`lib/mgPolygon.c
-
-libblatSrc_la-mime.lo: lib/mime.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-mime.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-mime.Tpo -c -o libblatSrc_la-mime.lo `test -f 'lib/mime.c' || echo '$(srcdir)/'`lib/mime.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-mime.Tpo $(DEPDIR)/libblatSrc_la-mime.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/mime.c' object='libblatSrc_la-mime.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-mime.lo `test -f 'lib/mime.c' || echo '$(srcdir)/'`lib/mime.c
-
-libblatSrc_la-net.lo: lib/net.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-net.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-net.Tpo -c -o libblatSrc_la-net.lo `test -f 'lib/net.c' || echo '$(srcdir)/'`lib/net.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-net.Tpo $(DEPDIR)/libblatSrc_la-net.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/net.c' object='libblatSrc_la-net.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-net.lo `test -f 'lib/net.c' || echo '$(srcdir)/'`lib/net.c
-
-libblatSrc_la-nib.lo: lib/nib.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-nib.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-nib.Tpo -c -o libblatSrc_la-nib.lo `test -f 'lib/nib.c' || echo '$(srcdir)/'`lib/nib.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-nib.Tpo $(DEPDIR)/libblatSrc_la-nib.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/nib.c' object='libblatSrc_la-nib.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-nib.lo `test -f 'lib/nib.c' || echo '$(srcdir)/'`lib/nib.c
-
-libblatSrc_la-nibTwo.lo: lib/nibTwo.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-nibTwo.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-nibTwo.Tpo -c -o libblatSrc_la-nibTwo.lo `test -f 'lib/nibTwo.c' || echo '$(srcdir)/'`lib/nibTwo.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-nibTwo.Tpo $(DEPDIR)/libblatSrc_la-nibTwo.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/nibTwo.c' object='libblatSrc_la-nibTwo.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-nibTwo.lo `test -f 'lib/nibTwo.c' || echo '$(srcdir)/'`lib/nibTwo.c
-
-libblatSrc_la-nt4.lo: lib/nt4.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-nt4.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-nt4.Tpo -c -o libblatSrc_la-nt4.lo `test -f 'lib/nt4.c' || echo '$(srcdir)/'`lib/nt4.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-nt4.Tpo $(DEPDIR)/libblatSrc_la-nt4.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/nt4.c' object='libblatSrc_la-nt4.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-nt4.lo `test -f 'lib/nt4.c' || echo '$(srcdir)/'`lib/nt4.c
-
-libblatSrc_la-numObscure.lo: lib/numObscure.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-numObscure.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-numObscure.Tpo -c -o libblatSrc_la-numObscure.lo `test -f 'lib/numObscure.c' || echo '$(srcdir)/'`lib/numObscure.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-numObscure.Tpo $(DEPDIR)/libblatSrc_la-numObscure.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/numObscure.c' object='libblatSrc_la-numObscure.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-numObscure.lo `test -f 'lib/numObscure.c' || echo '$(srcdir)/'`lib/numObscure.c
-
-libblatSrc_la-obscure.lo: lib/obscure.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-obscure.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-obscure.Tpo -c -o libblatSrc_la-obscure.lo `test -f 'lib/obscure.c' || echo '$(srcdir)/'`lib/obscure.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-obscure.Tpo $(DEPDIR)/libblatSrc_la-obscure.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/obscure.c' object='libblatSrc_la-obscure.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-obscure.lo `test -f 'lib/obscure.c' || echo '$(srcdir)/'`lib/obscure.c
-
-libblatSrc_la-oldGff.lo: lib/oldGff.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-oldGff.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-oldGff.Tpo -c -o libblatSrc_la-oldGff.lo `test -f 'lib/oldGff.c' || echo '$(srcdir)/'`lib/oldGff.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-oldGff.Tpo $(DEPDIR)/libblatSrc_la-oldGff.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/oldGff.c' object='libblatSrc_la-oldGff.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-oldGff.lo `test -f 'lib/oldGff.c' || echo '$(srcdir)/'`lib/oldGff.c
-
-libblatSrc_la-oligoTm.lo: lib/oligoTm.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-oligoTm.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-oligoTm.Tpo -c -o libblatSrc_la-oligoTm.lo `test -f 'lib/oligoTm.c' || echo '$(srcdir)/'`lib/oligoTm.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-oligoTm.Tpo $(DEPDIR)/libblatSrc_la-oligoTm.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/oligoTm.c' object='libblatSrc_la-oligoTm.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-oligoTm.lo `test -f 'lib/oligoTm.c' || echo '$(srcdir)/'`lib/oligoTm.c
-
-libblatSrc_la-options.lo: lib/options.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-options.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-options.Tpo -c -o libblatSrc_la-options.lo `test -f 'lib/options.c' || echo '$(srcdir)/'`lib/options.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-options.Tpo $(DEPDIR)/libblatSrc_la-options.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/options.c' object='libblatSrc_la-options.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-options.lo `test -f 'lib/options.c' || echo '$(srcdir)/'`lib/options.c
-
-libblatSrc_la-pairDistance.lo: lib/pairDistance.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-pairDistance.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-pairDistance.Tpo -c -o libblatSrc_la-pairDistance.lo `test -f 'lib/pairDistance.c' || echo '$(srcdir)/'`lib/pairDistance.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-pairDistance.Tpo $(DEPDIR)/libblatSrc_la-pairDistance.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/pairDistance.c' object='libblatSrc_la-pairDistance.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-pairDistance.lo `test -f 'lib/pairDistance.c' || echo '$(srcdir)/'`lib/pairDistance.c
-
-libblatSrc_la-pairHmm.lo: lib/pairHmm.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-pairHmm.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-pairHmm.Tpo -c -o libblatSrc_la-pairHmm.lo `test -f 'lib/pairHmm.c' || echo '$(srcdir)/'`lib/pairHmm.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-pairHmm.Tpo $(DEPDIR)/libblatSrc_la-pairHmm.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/pairHmm.c' object='libblatSrc_la-pairHmm.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-pairHmm.lo `test -f 'lib/pairHmm.c' || echo '$(srcdir)/'`lib/pairHmm.c
-
-libblatSrc_la-paraFetch.lo: lib/paraFetch.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-paraFetch.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-paraFetch.Tpo -c -o libblatSrc_la-paraFetch.lo `test -f 'lib/paraFetch.c' || echo '$(srcdir)/'`lib/paraFetch.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-paraFetch.Tpo $(DEPDIR)/libblatSrc_la-paraFetch.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/paraFetch.c' object='libblatSrc_la-paraFetch.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-paraFetch.lo `test -f 'lib/paraFetch.c' || echo '$(srcdir)/'`lib/paraFetch.c
-
-libblatSrc_la-peakCluster.lo: lib/peakCluster.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-peakCluster.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-peakCluster.Tpo -c -o libblatSrc_la-peakCluster.lo `test -f 'lib/peakCluster.c' || echo '$(srcdir)/'`lib/peakCluster.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-peakCluster.Tpo $(DEPDIR)/libblatSrc_la-peakCluster.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/peakCluster.c' object='libblatSrc_la-peakCluster.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-peakCluster.lo `test -f 'lib/peakCluster.c' || echo '$(srcdir)/'`lib/peakCluster.c
-
-libblatSrc_la-phyloTree.lo: lib/phyloTree.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-phyloTree.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-phyloTree.Tpo -c -o libblatSrc_la-phyloTree.lo `test -f 'lib/phyloTree.c' || echo '$(srcdir)/'`lib/phyloTree.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-phyloTree.Tpo $(DEPDIR)/libblatSrc_la-phyloTree.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/phyloTree.c' object='libblatSrc_la-phyloTree.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-phyloTree.lo `test -f 'lib/phyloTree.c' || echo '$(srcdir)/'`lib/phyloTree.c
-
-libblatSrc_la-pipeline.lo: lib/pipeline.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-pipeline.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-pipeline.Tpo -c -o libblatSrc_la-pipeline.lo `test -f 'lib/pipeline.c' || echo '$(srcdir)/'`lib/pipeline.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-pipeline.Tpo $(DEPDIR)/libblatSrc_la-pipeline.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/pipeline.c' object='libblatSrc_la-pipeline.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-pipeline.lo `test -f 'lib/pipeline.c' || echo '$(srcdir)/'`lib/pipeline.c
-
-libblatSrc_la-pngwrite.lo: lib/pngwrite.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-pngwrite.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-pngwrite.Tpo -c -o libblatSrc_la-pngwrite.lo `test -f 'lib/pngwrite.c' || echo '$(srcdir)/'`lib/pngwrite.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-pngwrite.Tpo $(DEPDIR)/libblatSrc_la-pngwrite.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/pngwrite.c' object='libblatSrc_la-pngwrite.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-pngwrite.lo `test -f 'lib/pngwrite.c' || echo '$(srcdir)/'`lib/pngwrite.c
-
-libblatSrc_la-portimpl.lo: lib/portimpl.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-portimpl.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-portimpl.Tpo -c -o libblatSrc_la-portimpl.lo `test -f 'lib/portimpl.c' || echo '$(srcdir)/'`lib/portimpl.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-portimpl.Tpo $(DEPDIR)/libblatSrc_la-portimpl.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/portimpl.c' object='libblatSrc_la-portimpl.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-portimpl.lo `test -f 'lib/portimpl.c' || echo '$(srcdir)/'`lib/portimpl.c
-
-libblatSrc_la-psGfx.lo: lib/psGfx.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-psGfx.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-psGfx.Tpo -c -o libblatSrc_la-psGfx.lo `test -f 'lib/psGfx.c' || echo '$(srcdir)/'`lib/psGfx.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-psGfx.Tpo $(DEPDIR)/libblatSrc_la-psGfx.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/psGfx.c' object='libblatSrc_la-psGfx.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-psGfx.lo `test -f 'lib/psGfx.c' || echo '$(srcdir)/'`lib/psGfx.c
-
-libblatSrc_la-psPoly.lo: lib/psPoly.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-psPoly.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-psPoly.Tpo -c -o libblatSrc_la-psPoly.lo `test -f 'lib/psPoly.c' || echo '$(srcdir)/'`lib/psPoly.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-psPoly.Tpo $(DEPDIR)/libblatSrc_la-psPoly.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/psPoly.c' object='libblatSrc_la-psPoly.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-psPoly.lo `test -f 'lib/psPoly.c' || echo '$(srcdir)/'`lib/psPoly.c
-
-libblatSrc_la-pscmGfx.lo: lib/pscmGfx.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-pscmGfx.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-pscmGfx.Tpo -c -o libblatSrc_la-pscmGfx.lo `test -f 'lib/pscmGfx.c' || echo '$(srcdir)/'`lib/pscmGfx.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-pscmGfx.Tpo $(DEPDIR)/libblatSrc_la-pscmGfx.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/pscmGfx.c' object='libblatSrc_la-pscmGfx.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-pscmGfx.lo `test -f 'lib/pscmGfx.c' || echo '$(srcdir)/'`lib/pscmGfx.c
-
-libblatSrc_la-psl.lo: lib/psl.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-psl.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-psl.Tpo -c -o libblatSrc_la-psl.lo `test -f 'lib/psl.c' || echo '$(srcdir)/'`lib/psl.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-psl.Tpo $(DEPDIR)/libblatSrc_la-psl.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/psl.c' object='libblatSrc_la-psl.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-psl.lo `test -f 'lib/psl.c' || echo '$(srcdir)/'`lib/psl.c
-
-libblatSrc_la-pslGenoShow.lo: lib/pslGenoShow.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-pslGenoShow.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-pslGenoShow.Tpo -c -o libblatSrc_la-pslGenoShow.lo `test -f 'lib/pslGenoShow.c' || echo '$(srcdir)/'`lib/pslGenoShow.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-pslGenoShow.Tpo $(DEPDIR)/libblatSrc_la-pslGenoShow.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/pslGenoShow.c' object='libblatSrc_la-pslGenoShow.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-pslGenoShow.lo `test -f 'lib/pslGenoShow.c' || echo '$(srcdir)/'`lib/pslGenoShow.c
-
-libblatSrc_la-pslShow.lo: lib/pslShow.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-pslShow.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-pslShow.Tpo -c -o libblatSrc_la-pslShow.lo `test -f 'lib/pslShow.c' || echo '$(srcdir)/'`lib/pslShow.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-pslShow.Tpo $(DEPDIR)/libblatSrc_la-pslShow.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/pslShow.c' object='libblatSrc_la-pslShow.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-pslShow.lo `test -f 'lib/pslShow.c' || echo '$(srcdir)/'`lib/pslShow.c
-
-libblatSrc_la-pslTbl.lo: lib/pslTbl.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-pslTbl.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-pslTbl.Tpo -c -o libblatSrc_la-pslTbl.lo `test -f 'lib/pslTbl.c' || echo '$(srcdir)/'`lib/pslTbl.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-pslTbl.Tpo $(DEPDIR)/libblatSrc_la-pslTbl.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/pslTbl.c' object='libblatSrc_la-pslTbl.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-pslTbl.lo `test -f 'lib/pslTbl.c' || echo '$(srcdir)/'`lib/pslTbl.c
-
-libblatSrc_la-pslTransMap.lo: lib/pslTransMap.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-pslTransMap.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-pslTransMap.Tpo -c -o libblatSrc_la-pslTransMap.lo `test -f 'lib/pslTransMap.c' || echo '$(srcdir)/'`lib/pslTransMap.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-pslTransMap.Tpo $(DEPDIR)/libblatSrc_la-pslTransMap.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/pslTransMap.c' object='libblatSrc_la-pslTransMap.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-pslTransMap.lo `test -f 'lib/pslTransMap.c' || echo '$(srcdir)/'`lib/pslTransMap.c
-
-libblatSrc_la-pthreadDoList.lo: lib/pthreadDoList.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-pthreadDoList.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-pthreadDoList.Tpo -c -o libblatSrc_la-pthreadDoList.lo `test -f 'lib/pthreadDoList.c' || echo '$(srcdir)/'`lib/pthreadDoList.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-pthreadDoList.Tpo $(DEPDIR)/libblatSrc_la-pthreadDoList.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/pthreadDoList.c' object='libblatSrc_la-pthreadDoList.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-pthreadDoList.lo `test -f 'lib/pthreadDoList.c' || echo '$(srcdir)/'`lib/pthreadDoList.c
-
-libblatSrc_la-pthreadWrap.lo: lib/pthreadWrap.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-pthreadWrap.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-pthreadWrap.Tpo -c -o libblatSrc_la-pthreadWrap.lo `test -f 'lib/pthreadWrap.c' || echo '$(srcdir)/'`lib/pthreadWrap.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-pthreadWrap.Tpo $(DEPDIR)/libblatSrc_la-pthreadWrap.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/pthreadWrap.c' object='libblatSrc_la-pthreadWrap.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-pthreadWrap.lo `test -f 'lib/pthreadWrap.c' || echo '$(srcdir)/'`lib/pthreadWrap.c
-
-libblatSrc_la-qa.lo: lib/qa.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-qa.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-qa.Tpo -c -o libblatSrc_la-qa.lo `test -f 'lib/qa.c' || echo '$(srcdir)/'`lib/qa.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-qa.Tpo $(DEPDIR)/libblatSrc_la-qa.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/qa.c' object='libblatSrc_la-qa.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-qa.lo `test -f 'lib/qa.c' || echo '$(srcdir)/'`lib/qa.c
-
-libblatSrc_la-quickHeap.lo: lib/quickHeap.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-quickHeap.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-quickHeap.Tpo -c -o libblatSrc_la-quickHeap.lo `test -f 'lib/quickHeap.c' || echo '$(srcdir)/'`lib/quickHeap.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-quickHeap.Tpo $(DEPDIR)/libblatSrc_la-quickHeap.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/quickHeap.c' object='libblatSrc_la-quickHeap.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-quickHeap.lo `test -f 'lib/quickHeap.c' || echo '$(srcdir)/'`lib/quickHeap.c
-
-libblatSrc_la-quotedP.lo: lib/quotedP.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-quotedP.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-quotedP.Tpo -c -o libblatSrc_la-quotedP.lo `test -f 'lib/quotedP.c' || echo '$(srcdir)/'`lib/quotedP.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-quotedP.Tpo $(DEPDIR)/libblatSrc_la-quotedP.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/quotedP.c' object='libblatSrc_la-quotedP.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-quotedP.lo `test -f 'lib/quotedP.c' || echo '$(srcdir)/'`lib/quotedP.c
-
-libblatSrc_la-ra.lo: lib/ra.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-ra.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-ra.Tpo -c -o libblatSrc_la-ra.lo `test -f 'lib/ra.c' || echo '$(srcdir)/'`lib/ra.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-ra.Tpo $(DEPDIR)/libblatSrc_la-ra.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/ra.c' object='libblatSrc_la-ra.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-ra.lo `test -f 'lib/ra.c' || echo '$(srcdir)/'`lib/ra.c
-
-libblatSrc_la-raToStruct.lo: lib/raToStruct.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-raToStruct.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-raToStruct.Tpo -c -o libblatSrc_la-raToStruct.lo `test -f 'lib/raToStruct.c' || echo '$(srcdir)/'`lib/raToStruct.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-raToStruct.Tpo $(DEPDIR)/libblatSrc_la-raToStruct.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/raToStruct.c' object='libblatSrc_la-raToStruct.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-raToStruct.lo `test -f 'lib/raToStruct.c' || echo '$(srcdir)/'`lib/raToStruct.c
-
-libblatSrc_la-rainbow.lo: lib/rainbow.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-rainbow.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-rainbow.Tpo -c -o libblatSrc_la-rainbow.lo `test -f 'lib/rainbow.c' || echo '$(srcdir)/'`lib/rainbow.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-rainbow.Tpo $(DEPDIR)/libblatSrc_la-rainbow.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/rainbow.c' object='libblatSrc_la-rainbow.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-rainbow.lo `test -f 'lib/rainbow.c' || echo '$(srcdir)/'`lib/rainbow.c
-
-libblatSrc_la-rangeTree.lo: lib/rangeTree.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-rangeTree.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-rangeTree.Tpo -c -o libblatSrc_la-rangeTree.lo `test -f 'lib/rangeTree.c' || echo '$(srcdir)/'`lib/rangeTree.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-rangeTree.Tpo $(DEPDIR)/libblatSrc_la-rangeTree.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/rangeTree.c' object='libblatSrc_la-rangeTree.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-rangeTree.lo `test -f 'lib/rangeTree.c' || echo '$(srcdir)/'`lib/rangeTree.c
-
-libblatSrc_la-rbTree.lo: lib/rbTree.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-rbTree.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-rbTree.Tpo -c -o libblatSrc_la-rbTree.lo `test -f 'lib/rbTree.c' || echo '$(srcdir)/'`lib/rbTree.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-rbTree.Tpo $(DEPDIR)/libblatSrc_la-rbTree.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/rbTree.c' object='libblatSrc_la-rbTree.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-rbTree.lo `test -f 'lib/rbTree.c' || echo '$(srcdir)/'`lib/rbTree.c
-
-libblatSrc_la-regexHelper.lo: lib/regexHelper.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-regexHelper.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-regexHelper.Tpo -c -o libblatSrc_la-regexHelper.lo `test -f 'lib/regexHelper.c' || echo '$(srcdir)/'`lib/regexHelper.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-regexHelper.Tpo $(DEPDIR)/libblatSrc_la-regexHelper.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/regexHelper.c' object='libblatSrc_la-regexHelper.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-regexHelper.lo `test -f 'lib/regexHelper.c' || echo '$(srcdir)/'`lib/regexHelper.c
-
-libblatSrc_la-repMask.lo: lib/repMask.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-repMask.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-repMask.Tpo -c -o libblatSrc_la-repMask.lo `test -f 'lib/repMask.c' || echo '$(srcdir)/'`lib/repMask.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-repMask.Tpo $(DEPDIR)/libblatSrc_la-repMask.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/repMask.c' object='libblatSrc_la-repMask.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-repMask.lo `test -f 'lib/repMask.c' || echo '$(srcdir)/'`lib/repMask.c
-
-libblatSrc_la-rle.lo: lib/rle.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-rle.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-rle.Tpo -c -o libblatSrc_la-rle.lo `test -f 'lib/rle.c' || echo '$(srcdir)/'`lib/rle.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-rle.Tpo $(DEPDIR)/libblatSrc_la-rle.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/rle.c' object='libblatSrc_la-rle.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-rle.lo `test -f 'lib/rle.c' || echo '$(srcdir)/'`lib/rle.c
-
-libblatSrc_la-rnautil.lo: lib/rnautil.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-rnautil.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-rnautil.Tpo -c -o libblatSrc_la-rnautil.lo `test -f 'lib/rnautil.c' || echo '$(srcdir)/'`lib/rnautil.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-rnautil.Tpo $(DEPDIR)/libblatSrc_la-rnautil.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/rnautil.c' object='libblatSrc_la-rnautil.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-rnautil.lo `test -f 'lib/rnautil.c' || echo '$(srcdir)/'`lib/rnautil.c
-
-libblatSrc_la-rqlEval.lo: lib/rqlEval.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-rqlEval.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-rqlEval.Tpo -c -o libblatSrc_la-rqlEval.lo `test -f 'lib/rqlEval.c' || echo '$(srcdir)/'`lib/rqlEval.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-rqlEval.Tpo $(DEPDIR)/libblatSrc_la-rqlEval.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/rqlEval.c' object='libblatSrc_la-rqlEval.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-rqlEval.lo `test -f 'lib/rqlEval.c' || echo '$(srcdir)/'`lib/rqlEval.c
-
-libblatSrc_la-rqlParse.lo: lib/rqlParse.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-rqlParse.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-rqlParse.Tpo -c -o libblatSrc_la-rqlParse.lo `test -f 'lib/rqlParse.c' || echo '$(srcdir)/'`lib/rqlParse.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-rqlParse.Tpo $(DEPDIR)/libblatSrc_la-rqlParse.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/rqlParse.c' object='libblatSrc_la-rqlParse.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-rqlParse.lo `test -f 'lib/rqlParse.c' || echo '$(srcdir)/'`lib/rqlParse.c
-
-libblatSrc_la-rudp.lo: lib/rudp.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-rudp.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-rudp.Tpo -c -o libblatSrc_la-rudp.lo `test -f 'lib/rudp.c' || echo '$(srcdir)/'`lib/rudp.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-rudp.Tpo $(DEPDIR)/libblatSrc_la-rudp.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/rudp.c' object='libblatSrc_la-rudp.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-rudp.lo `test -f 'lib/rudp.c' || echo '$(srcdir)/'`lib/rudp.c
-
-libblatSrc_la-scoreWindow.lo: lib/scoreWindow.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-scoreWindow.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-scoreWindow.Tpo -c -o libblatSrc_la-scoreWindow.lo `test -f 'lib/scoreWindow.c' || echo '$(srcdir)/'`lib/scoreWindow.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-scoreWindow.Tpo $(DEPDIR)/libblatSrc_la-scoreWindow.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/scoreWindow.c' object='libblatSrc_la-scoreWindow.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-scoreWindow.lo `test -f 'lib/scoreWindow.c' || echo '$(srcdir)/'`lib/scoreWindow.c
-
-libblatSrc_la-seg.lo: lib/seg.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-seg.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-seg.Tpo -c -o libblatSrc_la-seg.lo `test -f 'lib/seg.c' || echo '$(srcdir)/'`lib/seg.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-seg.Tpo $(DEPDIR)/libblatSrc_la-seg.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/seg.c' object='libblatSrc_la-seg.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-seg.lo `test -f 'lib/seg.c' || echo '$(srcdir)/'`lib/seg.c
-
-libblatSrc_la-seqOut.lo: lib/seqOut.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-seqOut.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-seqOut.Tpo -c -o libblatSrc_la-seqOut.lo `test -f 'lib/seqOut.c' || echo '$(srcdir)/'`lib/seqOut.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-seqOut.Tpo $(DEPDIR)/libblatSrc_la-seqOut.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/seqOut.c' object='libblatSrc_la-seqOut.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-seqOut.lo `test -f 'lib/seqOut.c' || echo '$(srcdir)/'`lib/seqOut.c
-
-libblatSrc_la-seqStats.lo: lib/seqStats.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-seqStats.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-seqStats.Tpo -c -o libblatSrc_la-seqStats.lo `test -f 'lib/seqStats.c' || echo '$(srcdir)/'`lib/seqStats.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-seqStats.Tpo $(DEPDIR)/libblatSrc_la-seqStats.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/seqStats.c' object='libblatSrc_la-seqStats.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-seqStats.lo `test -f 'lib/seqStats.c' || echo '$(srcdir)/'`lib/seqStats.c
-
-libblatSrc_la-servBrcMcw.lo: lib/servBrcMcw.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-servBrcMcw.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-servBrcMcw.Tpo -c -o libblatSrc_la-servBrcMcw.lo `test -f 'lib/servBrcMcw.c' || echo '$(srcdir)/'`lib/servBrcMcw.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-servBrcMcw.Tpo $(DEPDIR)/libblatSrc_la-servBrcMcw.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/servBrcMcw.c' object='libblatSrc_la-servBrcMcw.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-servBrcMcw.lo `test -f 'lib/servBrcMcw.c' || echo '$(srcdir)/'`lib/servBrcMcw.c
-
-libblatSrc_la-servCrunx.lo: lib/servCrunx.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-servCrunx.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-servCrunx.Tpo -c -o libblatSrc_la-servCrunx.lo `test -f 'lib/servCrunx.c' || echo '$(srcdir)/'`lib/servCrunx.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-servCrunx.Tpo $(DEPDIR)/libblatSrc_la-servCrunx.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/servCrunx.c' object='libblatSrc_la-servCrunx.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-servCrunx.lo `test -f 'lib/servCrunx.c' || echo '$(srcdir)/'`lib/servCrunx.c
-
-libblatSrc_la-servcis.lo: lib/servcis.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-servcis.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-servcis.Tpo -c -o libblatSrc_la-servcis.lo `test -f 'lib/servcis.c' || echo '$(srcdir)/'`lib/servcis.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-servcis.Tpo $(DEPDIR)/libblatSrc_la-servcis.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/servcis.c' object='libblatSrc_la-servcis.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-servcis.lo `test -f 'lib/servcis.c' || echo '$(srcdir)/'`lib/servcis.c
-
-libblatSrc_la-servcl.lo: lib/servcl.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-servcl.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-servcl.Tpo -c -o libblatSrc_la-servcl.lo `test -f 'lib/servcl.c' || echo '$(srcdir)/'`lib/servcl.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-servcl.Tpo $(DEPDIR)/libblatSrc_la-servcl.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/servcl.c' object='libblatSrc_la-servcl.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-servcl.lo `test -f 'lib/servcl.c' || echo '$(srcdir)/'`lib/servcl.c
-
-libblatSrc_la-servmsII.lo: lib/servmsII.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-servmsII.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-servmsII.Tpo -c -o libblatSrc_la-servmsII.lo `test -f 'lib/servmsII.c' || echo '$(srcdir)/'`lib/servmsII.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-servmsII.Tpo $(DEPDIR)/libblatSrc_la-servmsII.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/servmsII.c' object='libblatSrc_la-servmsII.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-servmsII.lo `test -f 'lib/servmsII.c' || echo '$(srcdir)/'`lib/servmsII.c
-
-libblatSrc_la-servpws.lo: lib/servpws.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-servpws.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-servpws.Tpo -c -o libblatSrc_la-servpws.lo `test -f 'lib/servpws.c' || echo '$(srcdir)/'`lib/servpws.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-servpws.Tpo $(DEPDIR)/libblatSrc_la-servpws.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/servpws.c' object='libblatSrc_la-servpws.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-servpws.lo `test -f 'lib/servpws.c' || echo '$(srcdir)/'`lib/servpws.c
-
-libblatSrc_la-shaRes.lo: lib/shaRes.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-shaRes.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-shaRes.Tpo -c -o libblatSrc_la-shaRes.lo `test -f 'lib/shaRes.c' || echo '$(srcdir)/'`lib/shaRes.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-shaRes.Tpo $(DEPDIR)/libblatSrc_la-shaRes.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/shaRes.c' object='libblatSrc_la-shaRes.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-shaRes.lo `test -f 'lib/shaRes.c' || echo '$(srcdir)/'`lib/shaRes.c
-
-libblatSrc_la-slog.lo: lib/slog.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-slog.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-slog.Tpo -c -o libblatSrc_la-slog.lo `test -f 'lib/slog.c' || echo '$(srcdir)/'`lib/slog.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-slog.Tpo $(DEPDIR)/libblatSrc_la-slog.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/slog.c' object='libblatSrc_la-slog.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-slog.lo `test -f 'lib/slog.c' || echo '$(srcdir)/'`lib/slog.c
-
-libblatSrc_la-snof.lo: lib/snof.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-snof.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-snof.Tpo -c -o libblatSrc_la-snof.lo `test -f 'lib/snof.c' || echo '$(srcdir)/'`lib/snof.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-snof.Tpo $(DEPDIR)/libblatSrc_la-snof.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/snof.c' object='libblatSrc_la-snof.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-snof.lo `test -f 'lib/snof.c' || echo '$(srcdir)/'`lib/snof.c
-
-libblatSrc_la-snofmake.lo: lib/snofmake.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-snofmake.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-snofmake.Tpo -c -o libblatSrc_la-snofmake.lo `test -f 'lib/snofmake.c' || echo '$(srcdir)/'`lib/snofmake.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-snofmake.Tpo $(DEPDIR)/libblatSrc_la-snofmake.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/snofmake.c' object='libblatSrc_la-snofmake.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-snofmake.lo `test -f 'lib/snofmake.c' || echo '$(srcdir)/'`lib/snofmake.c
-
-libblatSrc_la-snofsig.lo: lib/snofsig.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-snofsig.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-snofsig.Tpo -c -o libblatSrc_la-snofsig.lo `test -f 'lib/snofsig.c' || echo '$(srcdir)/'`lib/snofsig.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-snofsig.Tpo $(DEPDIR)/libblatSrc_la-snofsig.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/snofsig.c' object='libblatSrc_la-snofsig.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-snofsig.lo `test -f 'lib/snofsig.c' || echo '$(srcdir)/'`lib/snofsig.c
-
-libblatSrc_la-spaceSaver.lo: lib/spaceSaver.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-spaceSaver.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-spaceSaver.Tpo -c -o libblatSrc_la-spaceSaver.lo `test -f 'lib/spaceSaver.c' || echo '$(srcdir)/'`lib/spaceSaver.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-spaceSaver.Tpo $(DEPDIR)/libblatSrc_la-spaceSaver.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/spaceSaver.c' object='libblatSrc_la-spaceSaver.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-spaceSaver.lo `test -f 'lib/spaceSaver.c' || echo '$(srcdir)/'`lib/spaceSaver.c
-
-libblatSrc_la-spacedColumn.lo: lib/spacedColumn.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-spacedColumn.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-spacedColumn.Tpo -c -o libblatSrc_la-spacedColumn.lo `test -f 'lib/spacedColumn.c' || echo '$(srcdir)/'`lib/spacedColumn.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-spacedColumn.Tpo $(DEPDIR)/libblatSrc_la-spacedColumn.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/spacedColumn.c' object='libblatSrc_la-spacedColumn.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-spacedColumn.lo `test -f 'lib/spacedColumn.c' || echo '$(srcdir)/'`lib/spacedColumn.c
-
-libblatSrc_la-spacedSeed.lo: lib/spacedSeed.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-spacedSeed.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-spacedSeed.Tpo -c -o libblatSrc_la-spacedSeed.lo `test -f 'lib/spacedSeed.c' || echo '$(srcdir)/'`lib/spacedSeed.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-spacedSeed.Tpo $(DEPDIR)/libblatSrc_la-spacedSeed.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/spacedSeed.c' object='libblatSrc_la-spacedSeed.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-spacedSeed.lo `test -f 'lib/spacedSeed.c' || echo '$(srcdir)/'`lib/spacedSeed.c
-
-libblatSrc_la-splatAli.lo: lib/splatAli.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-splatAli.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-splatAli.Tpo -c -o libblatSrc_la-splatAli.lo `test -f 'lib/splatAli.c' || echo '$(srcdir)/'`lib/splatAli.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-splatAli.Tpo $(DEPDIR)/libblatSrc_la-splatAli.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/splatAli.c' object='libblatSrc_la-splatAli.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-splatAli.lo `test -f 'lib/splatAli.c' || echo '$(srcdir)/'`lib/splatAli.c
-
-libblatSrc_la-sqlList.lo: lib/sqlList.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-sqlList.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-sqlList.Tpo -c -o libblatSrc_la-sqlList.lo `test -f 'lib/sqlList.c' || echo '$(srcdir)/'`lib/sqlList.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-sqlList.Tpo $(DEPDIR)/libblatSrc_la-sqlList.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/sqlList.c' object='libblatSrc_la-sqlList.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-sqlList.lo `test -f 'lib/sqlList.c' || echo '$(srcdir)/'`lib/sqlList.c
-
-libblatSrc_la-sqlNum.lo: lib/sqlNum.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-sqlNum.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-sqlNum.Tpo -c -o libblatSrc_la-sqlNum.lo `test -f 'lib/sqlNum.c' || echo '$(srcdir)/'`lib/sqlNum.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-sqlNum.Tpo $(DEPDIR)/libblatSrc_la-sqlNum.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/sqlNum.c' object='libblatSrc_la-sqlNum.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-sqlNum.lo `test -f 'lib/sqlNum.c' || echo '$(srcdir)/'`lib/sqlNum.c
-
-libblatSrc_la-subText.lo: lib/subText.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-subText.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-subText.Tpo -c -o libblatSrc_la-subText.lo `test -f 'lib/subText.c' || echo '$(srcdir)/'`lib/subText.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-subText.Tpo $(DEPDIR)/libblatSrc_la-subText.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/subText.c' object='libblatSrc_la-subText.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-subText.lo `test -f 'lib/subText.c' || echo '$(srcdir)/'`lib/subText.c
-
-libblatSrc_la-sufa.lo: lib/sufa.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-sufa.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-sufa.Tpo -c -o libblatSrc_la-sufa.lo `test -f 'lib/sufa.c' || echo '$(srcdir)/'`lib/sufa.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-sufa.Tpo $(DEPDIR)/libblatSrc_la-sufa.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/sufa.c' object='libblatSrc_la-sufa.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-sufa.lo `test -f 'lib/sufa.c' || echo '$(srcdir)/'`lib/sufa.c
-
-libblatSrc_la-sufx.lo: lib/sufx.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-sufx.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-sufx.Tpo -c -o libblatSrc_la-sufx.lo `test -f 'lib/sufx.c' || echo '$(srcdir)/'`lib/sufx.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-sufx.Tpo $(DEPDIR)/libblatSrc_la-sufx.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/sufx.c' object='libblatSrc_la-sufx.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-sufx.lo `test -f 'lib/sufx.c' || echo '$(srcdir)/'`lib/sufx.c
-
-libblatSrc_la-synQueue.lo: lib/synQueue.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-synQueue.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-synQueue.Tpo -c -o libblatSrc_la-synQueue.lo `test -f 'lib/synQueue.c' || echo '$(srcdir)/'`lib/synQueue.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-synQueue.Tpo $(DEPDIR)/libblatSrc_la-synQueue.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/synQueue.c' object='libblatSrc_la-synQueue.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-synQueue.lo `test -f 'lib/synQueue.c' || echo '$(srcdir)/'`lib/synQueue.c
-
-libblatSrc_la-tabRow.lo: lib/tabRow.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-tabRow.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-tabRow.Tpo -c -o libblatSrc_la-tabRow.lo `test -f 'lib/tabRow.c' || echo '$(srcdir)/'`lib/tabRow.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-tabRow.Tpo $(DEPDIR)/libblatSrc_la-tabRow.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/tabRow.c' object='libblatSrc_la-tabRow.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-tabRow.lo `test -f 'lib/tabRow.c' || echo '$(srcdir)/'`lib/tabRow.c
-
-libblatSrc_la-textOut.lo: lib/textOut.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-textOut.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-textOut.Tpo -c -o libblatSrc_la-textOut.lo `test -f 'lib/textOut.c' || echo '$(srcdir)/'`lib/textOut.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-textOut.Tpo $(DEPDIR)/libblatSrc_la-textOut.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/textOut.c' object='libblatSrc_la-textOut.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-textOut.lo `test -f 'lib/textOut.c' || echo '$(srcdir)/'`lib/textOut.c
-
-libblatSrc_la-tokenizer.lo: lib/tokenizer.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-tokenizer.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-tokenizer.Tpo -c -o libblatSrc_la-tokenizer.lo `test -f 'lib/tokenizer.c' || echo '$(srcdir)/'`lib/tokenizer.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-tokenizer.Tpo $(DEPDIR)/libblatSrc_la-tokenizer.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/tokenizer.c' object='libblatSrc_la-tokenizer.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-tokenizer.lo `test -f 'lib/tokenizer.c' || echo '$(srcdir)/'`lib/tokenizer.c
-
-libblatSrc_la-trix.lo: lib/trix.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-trix.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-trix.Tpo -c -o libblatSrc_la-trix.lo `test -f 'lib/trix.c' || echo '$(srcdir)/'`lib/trix.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-trix.Tpo $(DEPDIR)/libblatSrc_la-trix.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/trix.c' object='libblatSrc_la-trix.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-trix.lo `test -f 'lib/trix.c' || echo '$(srcdir)/'`lib/trix.c
-
-libblatSrc_la-twoBit.lo: lib/twoBit.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-twoBit.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-twoBit.Tpo -c -o libblatSrc_la-twoBit.lo `test -f 'lib/twoBit.c' || echo '$(srcdir)/'`lib/twoBit.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-twoBit.Tpo $(DEPDIR)/libblatSrc_la-twoBit.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/twoBit.c' object='libblatSrc_la-twoBit.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-twoBit.lo `test -f 'lib/twoBit.c' || echo '$(srcdir)/'`lib/twoBit.c
-
-libblatSrc_la-udc.lo: lib/udc.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-udc.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-udc.Tpo -c -o libblatSrc_la-udc.lo `test -f 'lib/udc.c' || echo '$(srcdir)/'`lib/udc.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-udc.Tpo $(DEPDIR)/libblatSrc_la-udc.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/udc.c' object='libblatSrc_la-udc.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-udc.lo `test -f 'lib/udc.c' || echo '$(srcdir)/'`lib/udc.c
-
-libblatSrc_la-vGfx.lo: lib/vGfx.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-vGfx.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-vGfx.Tpo -c -o libblatSrc_la-vGfx.lo `test -f 'lib/vGfx.c' || echo '$(srcdir)/'`lib/vGfx.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-vGfx.Tpo $(DEPDIR)/libblatSrc_la-vGfx.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/vGfx.c' object='libblatSrc_la-vGfx.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-vGfx.lo `test -f 'lib/vGfx.c' || echo '$(srcdir)/'`lib/vGfx.c
-
-libblatSrc_la-vGif.lo: lib/vGif.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-vGif.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-vGif.Tpo -c -o libblatSrc_la-vGif.lo `test -f 'lib/vGif.c' || echo '$(srcdir)/'`lib/vGif.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-vGif.Tpo $(DEPDIR)/libblatSrc_la-vGif.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/vGif.c' object='libblatSrc_la-vGif.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-vGif.lo `test -f 'lib/vGif.c' || echo '$(srcdir)/'`lib/vGif.c
-
-libblatSrc_la-vPng.lo: lib/vPng.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-vPng.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-vPng.Tpo -c -o libblatSrc_la-vPng.lo `test -f 'lib/vPng.c' || echo '$(srcdir)/'`lib/vPng.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-vPng.Tpo $(DEPDIR)/libblatSrc_la-vPng.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/vPng.c' object='libblatSrc_la-vPng.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-vPng.lo `test -f 'lib/vPng.c' || echo '$(srcdir)/'`lib/vPng.c
-
-libblatSrc_la-vcf.lo: lib/vcf.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-vcf.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-vcf.Tpo -c -o libblatSrc_la-vcf.lo `test -f 'lib/vcf.c' || echo '$(srcdir)/'`lib/vcf.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-vcf.Tpo $(DEPDIR)/libblatSrc_la-vcf.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/vcf.c' object='libblatSrc_la-vcf.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-vcf.lo `test -f 'lib/vcf.c' || echo '$(srcdir)/'`lib/vcf.c
-
-libblatSrc_la-vcfBits.lo: lib/vcfBits.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-vcfBits.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-vcfBits.Tpo -c -o libblatSrc_la-vcfBits.lo `test -f 'lib/vcfBits.c' || echo '$(srcdir)/'`lib/vcfBits.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-vcfBits.Tpo $(DEPDIR)/libblatSrc_la-vcfBits.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/vcfBits.c' object='libblatSrc_la-vcfBits.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-vcfBits.lo `test -f 'lib/vcfBits.c' || echo '$(srcdir)/'`lib/vcfBits.c
-
-libblatSrc_la-verbose.lo: lib/verbose.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-verbose.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-verbose.Tpo -c -o libblatSrc_la-verbose.lo `test -f 'lib/verbose.c' || echo '$(srcdir)/'`lib/verbose.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-verbose.Tpo $(DEPDIR)/libblatSrc_la-verbose.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/verbose.c' object='libblatSrc_la-verbose.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-verbose.lo `test -f 'lib/verbose.c' || echo '$(srcdir)/'`lib/verbose.c
-
-libblatSrc_la-wildcmp.lo: lib/wildcmp.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-wildcmp.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-wildcmp.Tpo -c -o libblatSrc_la-wildcmp.lo `test -f 'lib/wildcmp.c' || echo '$(srcdir)/'`lib/wildcmp.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-wildcmp.Tpo $(DEPDIR)/libblatSrc_la-wildcmp.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/wildcmp.c' object='libblatSrc_la-wildcmp.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-wildcmp.lo `test -f 'lib/wildcmp.c' || echo '$(srcdir)/'`lib/wildcmp.c
-
-libblatSrc_la-wormdna.lo: lib/wormdna.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-wormdna.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-wormdna.Tpo -c -o libblatSrc_la-wormdna.lo `test -f 'lib/wormdna.c' || echo '$(srcdir)/'`lib/wormdna.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-wormdna.Tpo $(DEPDIR)/libblatSrc_la-wormdna.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/wormdna.c' object='libblatSrc_la-wormdna.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-wormdna.lo `test -f 'lib/wormdna.c' || echo '$(srcdir)/'`lib/wormdna.c
-
-libblatSrc_la-xAli.lo: lib/xAli.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-xAli.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-xAli.Tpo -c -o libblatSrc_la-xAli.lo `test -f 'lib/xAli.c' || echo '$(srcdir)/'`lib/xAli.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-xAli.Tpo $(DEPDIR)/libblatSrc_la-xAli.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/xAli.c' object='libblatSrc_la-xAli.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-xAli.lo `test -f 'lib/xAli.c' || echo '$(srcdir)/'`lib/xAli.c
-
-libblatSrc_la-xa.lo: lib/xa.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-xa.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-xa.Tpo -c -o libblatSrc_la-xa.lo `test -f 'lib/xa.c' || echo '$(srcdir)/'`lib/xa.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-xa.Tpo $(DEPDIR)/libblatSrc_la-xa.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/xa.c' object='libblatSrc_la-xa.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-xa.lo `test -f 'lib/xa.c' || echo '$(srcdir)/'`lib/xa.c
-
-libblatSrc_la-xap.lo: lib/xap.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-xap.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-xap.Tpo -c -o libblatSrc_la-xap.lo `test -f 'lib/xap.c' || echo '$(srcdir)/'`lib/xap.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-xap.Tpo $(DEPDIR)/libblatSrc_la-xap.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/xap.c' object='libblatSrc_la-xap.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-xap.lo `test -f 'lib/xap.c' || echo '$(srcdir)/'`lib/xap.c
-
-libblatSrc_la-xenshow.lo: lib/xenshow.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-xenshow.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-xenshow.Tpo -c -o libblatSrc_la-xenshow.lo `test -f 'lib/xenshow.c' || echo '$(srcdir)/'`lib/xenshow.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-xenshow.Tpo $(DEPDIR)/libblatSrc_la-xenshow.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/xenshow.c' object='libblatSrc_la-xenshow.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-xenshow.lo `test -f 'lib/xenshow.c' || echo '$(srcdir)/'`lib/xenshow.c
-
-libblatSrc_la-xmlEscape.lo: lib/xmlEscape.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-xmlEscape.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-xmlEscape.Tpo -c -o libblatSrc_la-xmlEscape.lo `test -f 'lib/xmlEscape.c' || echo '$(srcdir)/'`lib/xmlEscape.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-xmlEscape.Tpo $(DEPDIR)/libblatSrc_la-xmlEscape.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/xmlEscape.c' object='libblatSrc_la-xmlEscape.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-xmlEscape.lo `test -f 'lib/xmlEscape.c' || echo '$(srcdir)/'`lib/xmlEscape.c
-
-libblatSrc_la-xp.lo: lib/xp.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-xp.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-xp.Tpo -c -o libblatSrc_la-xp.lo `test -f 'lib/xp.c' || echo '$(srcdir)/'`lib/xp.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-xp.Tpo $(DEPDIR)/libblatSrc_la-xp.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/xp.c' object='libblatSrc_la-xp.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-xp.lo `test -f 'lib/xp.c' || echo '$(srcdir)/'`lib/xp.c
-
-libblatSrc_la-zlibFace.lo: lib/zlibFace.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-zlibFace.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-zlibFace.Tpo -c -o libblatSrc_la-zlibFace.lo `test -f 'lib/zlibFace.c' || echo '$(srcdir)/'`lib/zlibFace.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-zlibFace.Tpo $(DEPDIR)/libblatSrc_la-zlibFace.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/zlibFace.c' object='libblatSrc_la-zlibFace.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-zlibFace.lo `test -f 'lib/zlibFace.c' || echo '$(srcdir)/'`lib/zlibFace.c
-
-libblatSrc_la-osunix.lo: lib/osunix.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-osunix.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-osunix.Tpo -c -o libblatSrc_la-osunix.lo `test -f 'lib/osunix.c' || echo '$(srcdir)/'`lib/osunix.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-osunix.Tpo $(DEPDIR)/libblatSrc_la-osunix.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/osunix.c' object='libblatSrc_la-osunix.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-osunix.lo `test -f 'lib/osunix.c' || echo '$(srcdir)/'`lib/osunix.c
-
-libblatSrc_la-oswin9x.lo: lib/oswin9x.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -MT libblatSrc_la-oswin9x.lo -MD -MP -MF $(DEPDIR)/libblatSrc_la-oswin9x.Tpo -c -o libblatSrc_la-oswin9x.lo `test -f 'lib/oswin9x.c' || echo '$(srcdir)/'`lib/oswin9x.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libblatSrc_la-oswin9x.Tpo $(DEPDIR)/libblatSrc_la-oswin9x.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='lib/oswin9x.c' object='libblatSrc_la-oswin9x.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblatSrc_la_CFLAGS) $(CFLAGS) -c -o libblatSrc_la-oswin9x.lo `test -f 'lib/oswin9x.c' || echo '$(srcdir)/'`lib/oswin9x.c
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run 'make' without going through this Makefile.
-# To change the values of 'make' variables: instead of editing Makefiles,
-# (1) if the variable is set in 'config.status', edit 'config.status'
-#     (which will cause the Makefiles to be regenerated when you run 'make');
-# (2) otherwise, pass the desired values on the 'make' command line.
-$(am__recursive_targets):
-	@fail=; \
-	if $(am__make_keepgoing); then \
-	  failcom='fail=yes'; \
-	else \
-	  failcom='exit 1'; \
-	fi; \
-	dot_seen=no; \
-	target=`echo $@ | sed s/-recursive//`; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	for subdir in $$list; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    dot_seen=yes; \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done; \
-	if test "$$dot_seen" = "no"; then \
-	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
-	fi; test -z "$$fail"
-
-ID: $(am__tagged_files)
-	$(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-recursive
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	set x; \
-	here=`pwd`; \
-	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
-	  include_option=--etags-include; \
-	  empty_fix=.; \
-	else \
-	  include_option=--include; \
-	  empty_fix=; \
-	fi; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    test ! -f $$subdir/TAGS || \
-	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
-	  fi; \
-	done; \
-	$(am__define_uniq_tagged_files); \
-	shift; \
-	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  if test $$# -gt 0; then \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      "$$@" $$unique; \
-	  else \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      $$unique; \
-	  fi; \
-	fi
-ctags: ctags-recursive
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	$(am__define_uniq_tagged_files); \
-	test -z "$(CTAGS_ARGS)$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && $(am__cd) $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-recursive
-
-cscopelist-am: $(am__tagged_files)
-	list='$(am__tagged_files)'; \
-	case "$(srcdir)" in \
-	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-	  *) sdir=$(subdir)/$(srcdir) ;; \
-	esac; \
-	for i in $$list; do \
-	  if test -f "$$i"; then \
-	    echo "$(subdir)/$$i"; \
-	  else \
-	    echo "$$sdir/$$i"; \
-	  fi; \
-	done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    $(am__make_dryrun) \
-	      || test -d "$(distdir)/$$subdir" \
-	      || $(MKDIR_P) "$(distdir)/$$subdir" \
-	      || exit 1; \
-	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
-	    $(am__relativize); \
-	    new_distdir=$$reldir; \
-	    dir1=$$subdir; dir2="$(top_distdir)"; \
-	    $(am__relativize); \
-	    new_top_distdir=$$reldir; \
-	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
-	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
-	    ($(am__cd) $$subdir && \
-	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$new_top_distdir" \
-	        distdir="$$new_distdir" \
-		am__remove_distdir=: \
-		am__skip_length_check=: \
-		am__skip_mode_fix=: \
-	        distdir) \
-	      || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-recursive
-all-am: Makefile $(LTLIBRARIES)
-installdirs: installdirs-recursive
-installdirs-am:
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-clean: clean-recursive
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
-	mostlyclean-am
-
-distclean: distclean-recursive
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-html-am:
-
-info: info-recursive
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-recursive
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-recursive
-
-install-html-am:
-
-install-info: install-info-recursive
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-pdf-am:
-
-install-ps: install-ps-recursive
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: $(am__recursive_targets) install-am install-strip
-
-.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
-	check-am clean clean-generic clean-libtool \
-	clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \
-	distclean-compile distclean-generic distclean-libtool \
-	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-	uninstall-am
-
-
-# these don't work....or maybe they do...try again...???
-#libgbtools_la_CPPFLAGS =  $(DEPS_CFLAGS)
-#libgbtools_la_CXXFLAGS = -g  -Wall -std=c++0x
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/gbtools/src/blatSrc/lib/aliType.c b/gbtools/src/blatSrc/lib/aliType.c
deleted file mode 100644
index 6668bff..0000000
--- a/gbtools/src/blatSrc/lib/aliType.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* aliType - some definitions for type of alignment. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-#include "common.h"
-#include "aliType.h"
-
-
-char *gfTypeName(enum gfType type)
-/* Return string representing type. */
-{
-if (type == gftDna) return "DNA";
-if (type == gftRna) return "RNA";
-if (type == gftProt) return "protein";
-if (type == gftDnaX) return "DNAX";
-if (type == gftRnaX) return "RNAX";
-internalErr();
-return NULL;
-}
-
-enum gfType gfTypeFromName(char *name)
-/* Return type from string. */
-{
-if (sameWord(name, "DNA")) return gftDna;
-if (sameWord(name, "RNA")) return gftRna;
-if (sameWord(name, "protein")) return gftProt;
-if (sameWord(name, "prot")) return gftProt;
-if (sameWord(name, "DNAX")) return gftDnaX;
-if (sameWord(name, "RNAX")) return gftRnaX;
-errAbort("Unknown sequence type '%s'", name);
-return 0;
-}
-
diff --git a/gbtools/src/blatSrc/lib/annoAssembly.c b/gbtools/src/blatSrc/lib/annoAssembly.c
deleted file mode 100644
index 1f74c8e..0000000
--- a/gbtools/src/blatSrc/lib/annoAssembly.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* annoAssembly -- basic metadata about an assembly for the annoGrator framework. */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoAssembly.h"
-#include "dnaseq.h"
-#include "obscure.h"
-#include "twoBit.h"
-
-struct annoAssembly *annoAssemblyNew(char *name, char *twoBitPath)
-/* Return an annoAssembly with open twoBitFile. */
-{
-struct annoAssembly *aa;
-AllocVar(aa);
-aa->name = cloneString(name);
-aa->twoBitPath = cloneString(twoBitPath);
-aa->tbf = twoBitOpen(aa->twoBitPath);
-aa->curSeq = NULL;
-return aa;
-}
-
-struct slName *annoAssemblySeqNames(struct annoAssembly *aa)
-/* Return a list of sequence names in this assembly. */
-{
-struct slName *seqNames = twoBitSeqNames(aa->twoBitPath);
-slSort(&seqNames, slNameCmp);
-return seqNames;
-}
-
-uint annoAssemblySeqSize(struct annoAssembly *aa, char *seqName)
-/* Return the number of bases in seq which must be in aa's twoBitFile. */
-{
-if (aa->seqSizes == NULL)
-    aa->seqSizes = hashNew(digitsBaseTwo(aa->tbf->seqCount));
-struct hashEl *hel = hashLookup(aa->seqSizes, seqName);
-uint seqSize;
-if (hel != NULL)
-    seqSize = (uint)(hel->val - NULL);
-else
-    {
-    seqSize = (uint)twoBitSeqSize(aa->tbf, seqName);
-    char *pt = NULL;
-    hashAdd(aa->seqSizes, seqName, pt + seqSize);
-    }
-return seqSize;
-}
-
-void annoAssemblyGetSeq(struct annoAssembly *aa, char *seqName, uint start, uint end,
-			char *buf, size_t bufSize)
-/* Copy sequence to buf; bufSize must be at least end-start+1 chars in length. */
-{
-if (aa->curSeq == NULL || differentString(aa->curSeq->name, seqName))
-    {
-    dnaSeqFree(&aa->curSeq);
-    aa->curSeq = twoBitReadSeqFragLower(aa->tbf, seqName, 0, 0);
-    }
-uint chromSize = aa->curSeq->size;
-if (end > chromSize || start > chromSize || start > end)
-    errAbort("annoAssemblyGetSeq: bad coords [%u,%u) (sequence %s size %u)",
-	     start, end, seqName, chromSize);
-safencpy(buf, bufSize, aa->curSeq->dna+start, end-start);
-}
-
-void annoAssemblyClose(struct annoAssembly **pAa)
-/* Close aa's twoBitFile and free mem. */
-{
-if (*pAa == NULL)
-    return;
-struct annoAssembly *aa = *pAa;
-freeMem(aa->name);
-freeMem(aa->twoBitPath);
-twoBitClose(&(aa->tbf));
-hashFree(&(aa->seqSizes));
-freez(pAa);
-}
-
diff --git a/gbtools/src/blatSrc/lib/annoFilter.c b/gbtools/src/blatSrc/lib/annoFilter.c
deleted file mode 100644
index 689697e..0000000
--- a/gbtools/src/blatSrc/lib/annoFilter.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/* annoFilter -- autoSql-driven data filtering for annoGratorQuery framework */
-
-/* Copyright (C) 2012 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoFilter.h"
-#include "sqlNum.h"
-
-static struct annoFilter *afFromAsColumnAndIx(struct asColumn *def, int ix,
-					      enum annoFilterOp op, void *values)
-/* Return a filter for def. */
-{
-struct annoFilter *newF;
-AllocVar(newF);
-newF->columnIx = ix;
-newF->label = cloneString(def->name);
-newF->type = def->lowType->type;
-newF->isList = def->isList;
-newF->op = op;
-newF->values = values;
-return newF;
-}
-
-static void *valuesFromSlName(struct asColumn *def, struct slName *valList)
-/* Parse valList according to def->type. */
-{
-if (valList != NULL)
-    {
-    if (asTypesIsFloating(def->lowType->type))
-	{
-	double *minMax = needMem(2*sizeof(double));
-	minMax[0] = atof(valList->name);
-	if (valList->next)
-	    minMax[1] = atof(valList->next->name);
-	return minMax;
-	}
-    else if (asTypesIsInt(def->lowType->type))
-	{
-	long long *minMax = needMem(2*sizeof(long long));
-	minMax[0] = atoll(valList->name);
-	if (valList->next)
-	    minMax[1] = atoll(valList->next->name);
-	return minMax;
-	}
-    else
-	return slNameCloneList(valList);
-    }
-return NULL;
-}
-
-struct annoFilter *annoFilterFromAsColumn(struct asObject *asObj, char *colName,
-					  enum annoFilterOp op, struct slName *valList)
-/* Look up description of colName in asObj and return an annoFilter
- * using values parsed from valList if applicable. */
-{
-struct asColumn *def = asColumnFind(asObj, colName);
-if (def == NULL)
-    errAbort("annoFilterFromAsColumn: asObject %s column name '%s' not found",
-	     asObj->name, colName);
-int ix = asColumnFindIx(asObj->columnList, colName);
-void *values = valuesFromSlName(def, valList);
-return afFromAsColumnAndIx(def, ix, op, values);
-}
-
-struct annoFilter *annoFilterFromFunction(AnnoFilterFunction *func, void *values)
-/* Return an annoFilter that calls func on each item, using values. */
-{
-struct annoFilter *newF;
-AllocVar(newF);
-newF->filterFunc = func;
-newF->values = values;
-return newF;
-}
-
-static boolean annoFilterDouble(struct annoFilter *filter, double val)
-/* Compare val to double(s) in filter->values according to filter->op,
- * return TRUE if comparison fails. */
-{
-double *filterVals = filter->values;
-if (filter->op == afInRange)
-    {
-    double min = filterVals[0], max = filterVals[1];
-    return (val < min || val > max);
-    }
-else
-    {
-    double threshold = filterVals[0];
-    switch (filter->op)
-	{
-	case afLT:
-	    return !(val < threshold);
-	case afLTE:
-	    return !(val <= threshold);
-	case afEqual:
-	    return !(val == threshold);
-	case afNotEqual:
-	    return !(val != threshold);
-	case afGTE:
-	    return !(val >= threshold);
-	case afGT:
-	    return !(val > threshold);
-	default:
-	    errAbort("annoFilterDouble: unexpected filter->op %d for %s",
-		     filter->op, filter->label);
-	}
-    }
-return FALSE;
-}
-
-static boolean annoFilterLongLong(struct annoFilter *filter, long long val)
-/* Compare val to long long(s) in filter->values according to filter->op,
- * return TRUE if comparison fails. */
-{
-long long *filterVals = filter->values;
-if (filter->op == afInRange)
-    {
-    long long min = filterVals[0], max = filterVals[1];
-    return (val < min || val > max);
-    }
-else
-    {
-    long long threshold = filterVals[0];
-    switch (filter->op)
-	{
-	case afLT:
-	    return !(val < threshold);
-	case afLTE:
-	    return !(val <= threshold);
-	case afEqual:
-	    return !(val == threshold);
-	case afNotEqual:
-	    return !(val != threshold);
-	case afGTE:
-	    return !(val >= threshold);
-	case afGT:
-	    return !(val > threshold);
-	default:
-	    errAbort("annoFilterLongLong: unexpected filter->op %d for %s",
-		     filter->op, filter->label);
-	}
-    }
-return FALSE;
-}
-
-static boolean matchOneVal(struct slName *wildList, char *val)
-/* Return TRUE if val matches at least one wildcard value in wildList. */
-{
-struct slName *wild;
-boolean match = FALSE;
-for (wild = wildList;  wild != NULL;  wild = wild->next)
-    {
-    if (wildMatch(wild->name, val))
-	{
-	match = TRUE;
-	break;
-	}
-    }
-return match;
-}
-
-static boolean matchArray(struct slName *wildList, char **rowVals, int valCount)
-/* Return TRUE if at least one item in rowVals matches at least one wildcard value in wildList. */
-{
-int i;
-for (i = 0;  i < valCount;  i++)
-    if (matchOneVal(wildList, rowVals[i]))
-	return TRUE;
-return FALSE;
-}
-
-static boolean singleFilter(struct annoFilter *filter, char **row, int rowSize)
-/* Apply one filter, using either filterFunc or type-based filter on column value.
- * Return TRUE if isExclude and filter passes, or if !isExclude and filter fails. */
-{
-boolean fail = FALSE;
-if (filter->filterFunc != NULL)
-    fail = filter->filterFunc(filter, row, rowSize);
-else if (filter->op == afMatch || filter->op == afNotMatch)
-    {
-    struct slName *filterVals = filter->values;
-    boolean match;
-    if (filter->isList)
-	{
-	int len = strlen(row[filter->columnIx]);
-	char copy[len+1];
-	safecpy(copy, len+1, row[filter->columnIx]);
-	int valCount = countChars(copy, ',') + 1;
-	char *rowVals[valCount];
-	valCount = chopCommas(copy, rowVals);
-	match = matchArray(filterVals, rowVals, valCount);
-	}
-    else
-	match = matchOneVal(filterVals, row[filter->columnIx]);
-    if (filter->op == afMatch)
-	fail = !match;
-    else
-	fail = match;
-    }
-else
-    {
-    // column is a number -- integer or floating point?
-    enum asTypes type = filter->type;
-    if (filter->isList)
-	errAbort("annoFilterRowFails: time to implement numeric lists!");
-    if (asTypesIsFloating(type))
-	fail = annoFilterDouble(filter, sqlDouble(row[filter->columnIx]));
-    else if (asTypesIsInt(type))
-	fail = annoFilterLongLong(filter, sqlLongLong(row[filter->columnIx]));
-    else
-	errAbort("annoFilterRowFails: unexpected enum asTypes %d for numeric filter op %d",
-		 type, filter->op);
-    }
-if ((filter->isExclude && !fail) || (!filter->isExclude && fail))
-    return TRUE;
-return FALSE;
-}
-
-boolean annoFilterRowFails(struct annoFilter *filterList, char **row, int rowSize,
-			   boolean *retRightJoin)
-/* Apply filters to row, using autoSql column definitions to interpret
- * each word of row.  Return TRUE if any filter fails (or passes, if isExclude).
- * Set retRightJoin to TRUE if a rightJoin filter has failed. */
-{
-if (retRightJoin != NULL)
-    *retRightJoin = FALSE;
-boolean hasRightJoin = FALSE;
-struct annoFilter *filter;
-// First pass: left-join filters (failure means ignore this row);
-for (filter = filterList;  filter != NULL;  filter = filter->next)
-    {
-    if (filter->op == afNoFilter || filter->values == NULL || filter->rightJoin)
-	{
-	hasRightJoin = TRUE;
-	continue;
-	}
-    if (singleFilter(filter, row, rowSize))
-	return TRUE;
-    }
-// Second pass: right-join filters (failure means omit not only this row, but the primary row too)
-if (hasRightJoin)
-    {
-    for (filter = filterList;  filter != NULL;  filter = filter->next)
-	{
-	if (filter->op == afNoFilter || filter->values == NULL || !filter->rightJoin)
-	    continue;
-	if (singleFilter(filter, row, rowSize))
-	    {
-	    if (retRightJoin != NULL)
-		*retRightJoin = TRUE;
-	    return TRUE;
-	    }
-	}
-    }
-return FALSE;
-}
-
-boolean annoFilterWigValueFails(struct annoFilter *filterList, double value,
-				boolean *retRightJoin)
-/* Apply filters to value.  Return TRUE if any filter fails (or passes, if isExclude).
- * Set retRightJoin to TRUE if a rightJoin filter has failed. */
-{
-if (retRightJoin != NULL)
-    *retRightJoin = FALSE;
-struct annoFilter *filter;
-// First pass: left-join filters (failure means omit this row from output);
-for (filter = filterList; filter != NULL; filter = filter->next)
-    {
-    if (filter->op == afNoFilter || filter->rightJoin)
-	continue;
-    boolean fail = annoFilterDouble(filter, value);
-    if ((filter->isExclude && !fail) || (!filter->isExclude && fail))
-	return TRUE;
-    }
-// Second pass: right-join filters (failure means omit not only this row, but the primary row too)
-for (filter = filterList; filter != NULL; filter = filter->next)
-    {
-    if (filter->op == afNoFilter || !filter->rightJoin)
-	continue;
-    boolean fail = annoFilterDouble(filter, value);
-    if ((filter->isExclude && !fail) || (!filter->isExclude && fail))
-	{
-	if (retRightJoin != NULL)
-	    *retRightJoin = TRUE;
-	return TRUE;
-	}
-    }
-return FALSE;
-}
-
-enum annoFilterOp afOpFromString(char *string)
-/* Translate string (e.g. "afNotEqual") into enum value (e.g. afNotEqual). */
-{
-if (sameString(string, "afNoFilter"))
-    return afNoFilter;
-else if (sameString(string, "afMatch"))
-    return afMatch;
-else if (sameString(string, "afNotMatch"))
-    return afNotMatch;
-else if (sameString(string, "afLT"))
-    return afLT;
-else if (sameString(string, "afLTE"))
-    return afLTE;
-else if (sameString(string, "afEqual"))
-    return afEqual;
-else if (sameString(string, "afNotEqual"))
-    return afNotEqual;
-else if (sameString(string, "afGTE"))
-    return afGTE;
-else if (sameString(string, "afGT"))
-    return afGT;
-else if (sameString(string, "afInRange"))
-    return afInRange;
-else
-    errAbort("afOpFromString: Can't translate \"%s\" into enum annoFilterOp", string);
-// happy compiler, never get here:
-return afNoFilter;
-}
-
-char *stringFromAfOp(enum annoFilterOp op)
-/* Translate op into a string.  Do not free result. */
-{
-char *str = "afNoFilter";
-switch (op)
-    {
-    case afNoFilter:
-	break;
-    case afMatch:
-	str = "afMatch";
-    case afNotMatch:
-	str = "afNotMatch";
-	break;
-    case afLT:
-	str = "afLT";
-	break;
-    case afLTE:
-	str = "afLTE";
-	break;
-    case afEqual:
-	str = "afEqual";
-	break;
-    case afNotEqual:
-	str = "afNotEqual";
-	break;
-    case afGTE:
-	str = "afGTE";
-	break;
-    case afGT:
-	str = "afGT";
-	break;
-    case afInRange:
-	str = "afInRange";
-	break;
-    default:
-	errAbort("stringFromAfOp: unrecognized enum annoFilterOp %d", op);
-    }
-return str;
-}
diff --git a/gbtools/src/blatSrc/lib/annoFormatTab.c b/gbtools/src/blatSrc/lib/annoFormatTab.c
deleted file mode 100644
index a8f1d45..0000000
--- a/gbtools/src/blatSrc/lib/annoFormatTab.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* annoFormatTab -- collect fields from all inputs and print them out, tab-separated. */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoFormatTab.h"
-#include "annoGratorQuery.h"
-#include "dystring.h"
-
-struct annoFormatTab
-    {
-    struct annoFormatter formatter;
-    char *fileName;
-    FILE *f;
-    boolean needHeader;			// TRUE if we should print out the header
-    };
-
-static void printHeaderColumns(FILE *f, struct annoStreamer *source, boolean isFirst)
-/* Print names of included columns from this source. */
-{
-if (source->rowType == arWig)
-    {
-    // Fudge in the row's chrom, start, end as output columns even though they're not in autoSql
-    if (isFirst)
-	{
-	fputs("#chrom", f);
-	isFirst = FALSE;
-	}
-    fputs("\tstart\tend", f);
-    }
-struct asColumn *col;
-int i;
-for (col = source->asObj->columnList, i = 0;  col != NULL;  col = col->next, i++)
-    {
-    if (isFirst && i == 0)
-	fputc('#', f);
-    else
-	fputc('\t', f);
-    fputs(col->name, f);
-    }
-}
-
-static void aftInitialize(struct annoFormatter *vSelf, struct annoStreamer *primary,
-			  struct annoStreamer *integrators)
-/* Print header, regardless of whether we get any data after this. */
-{
-struct annoFormatTab *self = (struct annoFormatTab *)vSelf;
-if (self->needHeader)
-    {
-    char *primaryHeader = primary->getHeader(primary);
-    if (isNotEmpty(primaryHeader))
-	fprintf(self->f, "# Header from primary input:\n%s", primaryHeader);
-    printHeaderColumns(self->f, primary, TRUE);
-    struct annoStreamer *grator;
-    for (grator = integrators;  grator != NULL;  grator = grator->next)
-	printHeaderColumns(self->f, grator, FALSE);
-    fputc('\n', self->f);
-    self->needHeader = FALSE;
-    }
-}
-
-static double wigRowAvg(struct annoRow *row)
-/* Return the average value of floats in row->data. */
-{
-float *vector = row->data;
-int len = row->end - row->start;
-double sum = 0.0;
-int i;
-for (i = 0;  i < len;  i++)
-    sum += vector[i];
-return sum / (double)len;
-}
-
-static char **wordsFromWigRowAvg(struct annoRow *row)
-/* Return an array of strings with a single string containing the average of values in row. */
-{
-double avg = wigRowAvg(row);
-char **words;
-AllocArray(words, 1);
-char avgStr[32];
-safef(avgStr, sizeof(avgStr), "%lf", avg);
-words[0] = cloneString(avgStr);
-return words;
-}
-
-static char **wordsFromWigRowVals(struct annoRow *row)
-/* Return an array of strings with a single string containing comma-sep per-base wiggle values. */
-{
-float *vector = row->data;
-int len = row->end - row->start;
-struct dyString *dy = dyStringNew(10*len);
-int i;
-for (i = 0;  i < len;  i++)
-    dyStringPrintf(dy, "%g,", vector[i]);
-char **words;
-AllocArray(words, 1);
-words[0] = dyStringCannibalize(&dy);
-return words;
-}
-
-static char **wordsFromRow(struct annoRow *row, struct annoStreamer *source,
-			   boolean *retFreeWhenDone)
-/* If source->rowType is arWords, return its words.  Otherwise translate row->data into words. */
-{
-if (row == NULL)
-    return NULL;
-boolean freeWhenDone = FALSE;
-char **words = NULL;
-if (source->rowType == arWords)
-    words = row->data;
-else if (source->rowType == arWig)
-    {
-    freeWhenDone = TRUE;
-    //#*** config options: avg? more stats? list of values?
-    boolean doAvg = FALSE;
-    if (doAvg)
-	words = wordsFromWigRowAvg(row);
-    else
-	words = wordsFromWigRowVals(row);
-    }
-else
-    errAbort("annoFormatTab: unrecognized row type %d from source %s",
-	     source->rowType, source->name);
-if (retFreeWhenDone != NULL)
-    *retFreeWhenDone = freeWhenDone;
-return words;
-}
-
-static void printColumns(FILE *f, struct annoStreamer *streamer, struct annoRow *row,
-			 boolean isFirst)
-/* Print columns in streamer's row (if NULL, print the right number of empty fields). */
-{
-boolean freeWhenDone = FALSE;
-char **words = wordsFromRow(row, streamer, &freeWhenDone);
-if (streamer->rowType == arWig)
-    {
-    // Fudge in the row's chrom, start, end as output columns even though they're not in autoSql
-    if (isFirst)
-	{
-	if (row != NULL)
-	    fputs(row->chrom, f);
-	isFirst = FALSE;
-	}
-    if (row != NULL)
-	fprintf(f, "\t%u\t%u", row->start, row->end);
-    else
-	fputs("\t\t", f);
-    }
-int colCount = slCount(streamer->asObj->columnList);
-int i;
-for (i = 0;  i < colCount;  i++)
-    {
-    if (!isFirst || i > 0)
-	fputc('\t', f);
-    if (words != NULL)
-	fputs((words[i] ? words[i] : ""), f);
-    }
-if (freeWhenDone)
-    {
-    freeMem(words[0]);
-    freeMem(words);
-    }
-}
-
-static void aftComment(struct annoFormatter *fSelf, char *content)
-/* Print out a comment line. */
-{
-if (strchr(content, '\n'))
-    errAbort("aftComment: no multi-line input");
-struct annoFormatTab *self = (struct annoFormatTab *)fSelf;
-fprintf(self->f, "# %s\n", content);
-}
-
-static void aftFormatOne(struct annoFormatter *vSelf, struct annoStreamRows *primaryData,
-			 struct annoStreamRows *gratorData, int gratorCount)
-/* Print out tab-separated columns that we have gathered in prior calls to aftCollect,
- * and start over fresh for the next line of output. */
-{
-struct annoFormatTab *self = (struct annoFormatTab *)vSelf;
-// Got one row from primary; what's the largest # of rows from any grator?
-int maxRows = 1;
-int iG;
-for (iG = 0;  iG < gratorCount;  iG++)
-    {
-    int gratorRowCount = slCount(gratorData[iG].rowList);
-    if (gratorRowCount > maxRows)
-	maxRows = gratorRowCount;
-    }
-// Print out enough rows to make sure that all grator rows are included.
-int iR;
-for (iR = 0;  iR < maxRows;  iR++)
-    {
-    printColumns(self->f, primaryData->streamer, primaryData->rowList, TRUE);
-    for (iG = 0;  iG < gratorCount;  iG++)
-	{
-	struct annoRow *gratorRow = slElementFromIx(gratorData[iG].rowList, iR);
-	printColumns(self->f, gratorData[iG].streamer, gratorRow, FALSE);
-	}
-    fputc('\n', self->f);
-    }
-}
-
-static void aftClose(struct annoFormatter **pVSelf)
-/* Close file handle, free self. */
-{
-if (pVSelf == NULL)
-    return;
-struct annoFormatTab *self = *(struct annoFormatTab **)pVSelf;
-freeMem(self->fileName);
-carefulClose(&(self->f));
-annoFormatterFree(pVSelf);
-}
-
-struct annoFormatter *annoFormatTabNew(char *fileName)
-/* Return a formatter that will write its tab-separated output to fileName. */
-{
-struct annoFormatTab *aft;
-AllocVar(aft);
-struct annoFormatter *formatter = &(aft->formatter);
-formatter->getOptions = annoFormatterGetOptions;
-formatter->setOptions = annoFormatterSetOptions;
-formatter->initialize = aftInitialize;
-formatter->comment = aftComment;
-formatter->formatOne = aftFormatOne;
-formatter->close = aftClose;
-aft->fileName = cloneString(fileName);
-aft->f = mustOpen(fileName, "w");
-aft->needHeader = TRUE;
-return (struct annoFormatter *)aft;
-}
diff --git a/gbtools/src/blatSrc/lib/annoFormatter.c b/gbtools/src/blatSrc/lib/annoFormatter.c
deleted file mode 100644
index ce97114..0000000
--- a/gbtools/src/blatSrc/lib/annoFormatter.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* annoFormatter -- aggregates, formats and writes output from multiple sources */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoFormatter.h"
-
-struct annoOption *annoFormatterGetOptions(struct annoFormatter *self)
-/* Return supported options and current settings.  Callers can modify and free when done. */
-{
-return annoOptionCloneList(self->options);
-}
-
-void annoFormatterSetOptions(struct annoFormatter *self, struct annoOption *newOptions)
-/* Free old options and use clone of newOptions. */
-{
-annoOptionFreeList(&(self->options));
-self->options = annoOptionCloneList(newOptions);
-}
-
-void annoFormatterFree(struct annoFormatter **pSelf)
-/* Free self. This should be called at the end of subclass close methods, after
- * subclass-specific connections are closed and resources are freed. */
-{
-if (pSelf == NULL)
-    return;
-annoOptionFreeList(&((*pSelf)->options));
-freez(pSelf);
-}
diff --git a/gbtools/src/blatSrc/lib/annoGrateWig.c b/gbtools/src/blatSrc/lib/annoGrateWig.c
deleted file mode 100644
index 47cda06..0000000
--- a/gbtools/src/blatSrc/lib/annoGrateWig.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* annoGrateWig -- subclass of annoGrator for bigWig or wiggle data */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoGrateWig.h"
-#include "annoStreamBigWig.h"
-
-struct annoGrateWig
-{
-    struct annoGrator grator;		// external annoGrator interface
-    struct annoGrator *mySource;	// internal annoGrator of wigDb rows
-    struct lm *lm;			// localmem for rows from mySource
-    int lmRowCount;			// counter for periodic cleanup
-};
-
-static void tidyUp(const struct annoRow *rowIn, struct annoRow **pOutList,
-		   uint primaryStart, uint primaryEnd, struct lm *callerLm)
-/* This takes a wiggle chunk coming from a .wig/database row and makes it into
- * zero or more tidy little NAN-less annoRows.  Trim rowIn to the bounds of
- * primary, trim NANs from beginning and break into multiple rows where there
- * are NANs in the middle.  If the rowIn is contiguous with the row at the
- * head of outList, expand that row to include rowIn's data. */
-{
-uint start = max(rowIn->start, primaryStart);
-uint end = min(rowIn->end, primaryEnd);
-float *vector = rowIn->data;
-while (end > start)
-    {
-    uint offset = start - rowIn->start;
-    if (vector[offset] == NAN)
-	start++;
-    else
-	{
-	// If there is a NAN before end, that's the end of this row:
-	uint thisEnd = start;
-	while (thisEnd < end && vector[thisEnd - rowIn->start] != NAN)
-	    thisEnd++;
-	struct annoRow *headRow = *pOutList;
-	if (headRow == NULL || rowIn->start > headRow->end)
-	    {
-	    // allocate a new row
-	    struct annoRow *rowOut = annoRowWigNew(rowIn->chrom, start, thisEnd, FALSE,
-						   vector + offset, callerLm);
-	    slAddHead(pOutList, rowOut);
-	    }
-	else
-	    {
-	    // glom new data onto headRow
-	    assert(thisEnd > headRow->end);
-	    uint oldEnd = headRow->end;
-	    uint oldLen = oldEnd - headRow->start;
-	    uint newLen = thisEnd - headRow->start;
-	    headRow->data = lmAllocMoreMem(callerLm, headRow->data, oldLen*sizeof(vector[0]),
-					   newLen*sizeof(vector[0]));
-	    headRow->end = thisEnd;
-	    float *newData = (float *)rowIn->data + (oldEnd - rowIn->start);
-	    float *newSpace = (float *)headRow->data + oldLen;
-	    CopyArray(newData, newSpace, (thisEnd - oldEnd));
-	    }
-	start = thisEnd;
-	}
-    }
-}
-
-static struct annoRow *agwIntegrate(struct annoGrator *gSelf, struct annoStreamRows *primaryData,
-				    boolean *retRJFilterFailed, struct lm *callerLm)
-/* Return wig annoRows that overlap primaryRow position, with NANs weeded out. */
-{
-struct annoGrateWig *self = (struct annoGrateWig *)gSelf;
-// Cleanup internal lm every so often:
-if (self->lmRowCount >= 4096)
-    {
-    lmCleanup(&(self->lm));
-    self->lmRowCount = 0;
-    }
-if (self->lm == NULL)
-    self->lm = lmInit(0);
-struct annoRow *rowsIn = annoGratorIntegrate(self->mySource, primaryData, retRJFilterFailed,
-					     self->lm);
-self->lmRowCount += slCount(rowsIn);
-if (retRJFilterFailed && *retRJFilterFailed)
-    return NULL;
-struct annoRow *primaryRow = primaryData->rowList;
-struct annoRow *rowIn, *rowOutList = NULL;;
-for (rowIn = rowsIn;  rowIn != NULL;  rowIn = rowIn->next)
-    tidyUp(rowIn, &rowOutList, primaryRow->start, primaryRow->end, callerLm);
-slReverse(&rowOutList);
-return rowOutList;
-}
-
-struct annoGrator *annoGrateWigNew(struct annoStreamer *wigSource)
-/* Create an annoGrator subclass for source with rowType == arWig. */
-{
-if (wigSource->rowType != arWig)
-    errAbort("annoGrateWigNew: expected source->rowType arWig (%d), got %d from source %s",
-	     arWig, wigSource->rowType, wigSource->name);
-struct annoGrateWig *self;
-AllocVar(self);
-struct annoGrator *gSelf = (struct annoGrator *)self;
-annoGratorInit(gSelf, wigSource);
-gSelf->integrate = agwIntegrate;
-self->mySource = annoGratorNew(wigSource);
-return gSelf;
-}
-
-struct annoGrator *annoGrateBigWigNew(char *fileOrUrl, struct annoAssembly *aa)
-/* Create an annoGrator subclass for bigWig file or URL. */
-{
-struct annoStreamer *bigWigSource = annoStreamBigWigNew(fileOrUrl, aa);
-return annoGrateWigNew(bigWigSource);
-}
diff --git a/gbtools/src/blatSrc/lib/annoGrator.c b/gbtools/src/blatSrc/lib/annoGrator.c
deleted file mode 100644
index 15a2396..0000000
--- a/gbtools/src/blatSrc/lib/annoGrator.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/* annoGrator -- join two inputs on position, keeping all original fields intact. */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoGrator.h"
-
-INLINE void agCheckPrimarySorting(struct annoGrator *self, struct annoRow *primaryRow)
-/* Die if primaryRow seems to have arrived out of order. */
-{
-if (self->prevPChrom == NULL)
-    self->prevPChrom = cloneString(primaryRow->chrom);
-else if (differentString(primaryRow->chrom, self->prevPChrom))
-    {
-    if (strcmp(primaryRow->chrom, self->prevPChrom) < 0)
-	errAbort("annoGrator %s: Unsorted input from primary source (%s < %s)",
-		 self->streamer.name, primaryRow->chrom, self->prevPChrom);
-    self->prevPChrom = cloneString(primaryRow->chrom);
-    }
-else if (primaryRow->start < self->prevPStart)
-    errAbort("annoGrator %s: Unsorted input from primary source (%s, %u < %u)",
-	     self->streamer.name, primaryRow->chrom, primaryRow->start, self->prevPStart);
-self->prevPStart = primaryRow->start;
-}
-
-INLINE void agTrimToStart(struct annoGrator *self, char *chrom, uint start)
-/* If queue contains items whose end is to the left of start, splice them out. */
-{
-struct annoRow *qRow, *prevQRow = NULL, *nextQRow;
-for (qRow = self->qHead;  qRow != NULL;  qRow = nextQRow)
-    {
-    nextQRow = qRow->next;
-    int cDifRowP = strcmp(qRow->chrom, chrom);
-    if (cDifRowP > 0 || (cDifRowP == 0 && qRow->start >= start))
-	break;
-    else if (cDifRowP < 0 || qRow->end < start)
-	{
-	if (prevQRow == NULL)
-	    self->qHead = qRow->next;
-	else
-	    prevQRow->next = qRow->next;
-	if (self->qTail == qRow)
-	    self->qTail = prevQRow;
-	}
-    else
-	prevQRow = qRow;
-    }
-if (self->qHead == NULL)
-    {
-    // Queue is empty - clean up lm
-    lmCleanup(&(self->qLm));
-    self->qLm = lmInit(0);
-    self->qSkippedCount = 0;
-    }
-}
-
-INLINE void agCheckInternalSorting(struct annoGrator *self, struct annoRow *newRow)
-/* Die if newRow precedes qTail. */
-{
-if (self->qTail != NULL)
-    {
-    int cDifNewTail = strcmp(newRow->chrom, self->qTail->chrom);
-    if (cDifNewTail < 0)
-	errAbort("annoGrator %s: Unsorted input from internal source %s (%s < %s)",
-		 self->streamer.name, self->mySource->name, newRow->chrom, self->qTail->chrom);
-    else if (cDifNewTail == 0 && newRow->start < self->qTail->start)
-	errAbort("annoGrator %s: Unsorted input from internal source %s (%s, %u < %u)",
-		 self->streamer.name, self->mySource->name,
-		 newRow->chrom, newRow->start, self->qTail->start);
-    }
-}
-
-INLINE void agFetchToEnd(struct annoGrator *self, char *chrom, uint start, uint end)
-/* Fetch rows until we are sure we have all items that start to the left of end,
- * i.e. we have an item that starts at/after end or we hit eof. */
-{
-while (!self->eof &&
-       (self->qTail == NULL || strcmp(self->qTail->chrom, chrom) < 0 ||
-	(sameString(self->qTail->chrom, chrom) && self->qTail->start < end)))
-    {
-    struct annoRow *newRow = self->mySource->nextRow(self->mySource, chrom, start, self->qLm);
-    if (newRow == NULL)
-	self->eof = TRUE;
-    else
-	{
-	agCheckInternalSorting(self, newRow);
-	int cDifNewP = strcmp(newRow->chrom, chrom);
-	if (cDifNewP >= 0)
-	    {
-	    // Add newRow to qTail
-	    if (self->qTail == NULL)
-		{
-		if (self->qHead != NULL)
-		    errAbort("annoGrator %s: qTail is NULL but qHead is non-NULL",
-			     self->streamer.name);
-		self->qHead = self->qTail = newRow;
-		}
-	    else
-		{
-		self->qTail->next = newRow;
-		self->qTail = newRow;
-		}
-	    if (cDifNewP > 0)
-		// newRow->chrom comes after chrom; we're done for now
-		break;
-	    }
-	// If we're skipping past large regions, keep qLm size under control:
-	else
-	    {
-	    self->qSkippedCount++;
-	    if (self->qSkippedCount > 1024 && self->qHead == NULL && self->qTail == NULL)
-		{
-		lmCleanup(&(self->qLm));
-		self->qLm = lmInit(0);
-		self->qSkippedCount = 0;
-		}
-	    }
-	}
-    }
-}
-
-struct annoRow *annoGratorIntegrate(struct annoGrator *self, struct annoStreamRows *primaryData,
-				    boolean *retRJFilterFailed, struct lm *callerLm)
-/* Given a single row from the primary source, get all overlapping rows from internal
- * source, and produce joined output rows.
- * If retRJFilterFailed is non-NULL:
- * - any overlapping row has a rightJoin filter failure (see annoFilter.h), or
- * - overlap rule is agoMustOverlap and no rows overlap, or
- * - overlap rule is agoMustNotOverlap and any overlapping row is found,
- * then set retRJFilterFailed and stop. */
-{
-struct annoRow *primaryRow = primaryData->rowList;
-struct annoRow *rowList = NULL;
-agCheckPrimarySorting(self, primaryRow);
-// In order to catch the intersection of two 0-length elements (i.e. two insertions),
-// we have to broaden our search a little:
-int pStart = primaryRow->start, pEnd = primaryRow->end;
-if (pStart == pEnd)
-    {
-    pStart--;
-    pEnd++;
-    }
-char *pChrom = primaryRow->chrom;
-agTrimToStart(self, pChrom, pStart);
-agFetchToEnd(self, pChrom, pStart, pEnd);
-boolean rjFailHard = (retRJFilterFailed != NULL);
-if (rjFailHard)
-    *retRJFilterFailed = FALSE;
-struct annoRow *qRow;
-for (qRow = self->qHead;  qRow != NULL;  qRow = qRow->next)
-    {
-    if (qRow->start < pEnd && qRow->end > pStart && sameString(qRow->chrom, pChrom))
-	{
-	int numCols = self->mySource->numCols;
-	enum annoRowType rowType = self->mySource->rowType;
-	slAddHead(&rowList, annoRowClone(qRow, rowType, numCols, callerLm));
-	if (rjFailHard && qRow->rightJoinFail)
-	    {
-	    *retRJFilterFailed = TRUE;
-	    break;
-	    }
-	}
-    }
-slReverse(&rowList);
-// If no rows overlapped primary, and there is a right-join, !isExclude (i.e. isInclude) filter,
-// then we need to set retRJFilterFailed because the condition was not met to include
-// the primary item.
-if (retRJFilterFailed &&
-    ((rowList == NULL && (self->haveRJIncludeFilter || self->overlapRule == agoMustOverlap)) ||
-     (rowList != NULL && self->overlapRule == agoMustNotOverlap)))
-    *retRJFilterFailed = TRUE;
-return rowList;
-}
-
-void annoGratorClose(struct annoStreamer **pSelf)
-/* Free self (including mySource). */
-{
-if (pSelf == NULL)
-    return;
-struct annoGrator *self = *(struct annoGrator **)pSelf;
-lmCleanup(&(self->qLm));
-self->mySource->close(&(self->mySource));
-freeMem(self->prevPChrom);
-freez(pSelf);
-}
-
-static struct annoRow *noNextRow(struct annoStreamer *self, char *minChrom, uint minEnd,
-				 struct lm *callerLm)
-/* nextRow() is N/A for annoGrator, which needs caller to use integrate() instead. */
-{
-errAbort("annoGrator %s: nextRow() called, but integrate() should be called instead",
-	 self->name);
-return NULL;
-}
-
-static void agReset(struct annoGrator *self)
-/* Reset all state associated with position */
-{
-freez(&(self->prevPChrom));
-self->prevPStart = 0;
-self->eof = FALSE;
-lmCleanup(&(self->qLm));
-self->qLm = lmInit(0);
-self->qHead = self->qTail = NULL;
-self->qSkippedCount = 0;
-}
-
-static boolean filtersHaveRJInclude(struct annoFilter *filters)
-/* Return TRUE if filters have at least one active filter with !isExclude && rightJoin. */
-{
-struct annoFilter *filter;
-for (filter = filters;  filter != NULL;  filter = filter->next)
-    if (filter->op != afNoFilter && !filter->isExclude && filter->rightJoin)
-	return TRUE;
-return FALSE;
-}
-
-static void agSetFilters(struct annoStreamer *vSelf, struct annoFilter *newFilters)
-/* Replace filters and re-evaluate self->haveRJIncludeFilter. Apply filters to
- * own streamer interface and to internal source. */
-{
-annoStreamerSetFilters(vSelf, newFilters);
-struct annoGrator *self = (struct annoGrator *)vSelf;
-self->haveRJIncludeFilter = filtersHaveRJInclude(vSelf->filters);
-self->mySource->setFilters(self->mySource, newFilters);
-}
-
-static void agAddFilters(struct annoStreamer *vSelf, struct annoFilter *newFilters)
-/* Add filters and re-evaluate self->haveRJIncludeFilter. Apply filters to
- * own streamer interface and to internal source. */
-{
-annoStreamerAddFilters(vSelf, newFilters);
-struct annoGrator *self = (struct annoGrator *)vSelf;
-annoStreamerSetFilters(self->mySource, vSelf->filters);
-self->haveRJIncludeFilter = filtersHaveRJInclude(vSelf->filters);
-}
-
-void annoGratorSetRegion(struct annoStreamer *vSelf, char *chrom, uint rStart, uint rEnd)
-/* Set genomic region for query, and reset internal state. */
-{
-struct annoGrator *self = (struct annoGrator *)vSelf;
-self->mySource->setRegion((struct annoStreamer *)(self->mySource), chrom, rStart, rEnd);
-agReset(self);
-}
-
-static void agSetAutoSqlObject(struct annoStreamer *sSelf, struct asObject *asObj)
-/* Use new asObj and update internal state derived from asObj. */
-{
-struct annoGrator *gSelf = (struct annoGrator *)sSelf;
-annoStreamerSetAutoSqlObject(sSelf, asObj);
-gSelf->haveRJIncludeFilter = filtersHaveRJInclude(sSelf->filters);
-}
-
-void agSetOverlapRule(struct annoGrator *self, enum annoGratorOverlap rule)
-/* Tell annoGrator how to handle overlap of its rows with primary row. */
-{
-self->overlapRule = rule;
-}
-
-void annoGratorInit(struct annoGrator *self, struct annoStreamer *mySource)
-/* Initialize an integrator of columns from mySource with (positions of)
- * rows passed to integrate().
- * mySource becomes property of the annoGrator. */
-{
-struct annoStreamer *streamer = &(self->streamer);
-annoStreamerInit(streamer, mySource->assembly, mySource->getAutoSqlObject(mySource),
-		 mySource->name);
-streamer->rowType = mySource->rowType;
-streamer->setAutoSqlObject = agSetAutoSqlObject;
-streamer->setFilters = agSetFilters;
-streamer->addFilters = agAddFilters;
-streamer->setRegion = annoGratorSetRegion;
-streamer->nextRow = noNextRow;
-streamer->close = annoGratorClose;
-self->qLm = lmInit(0);
-self->integrate = annoGratorIntegrate;
-self->setOverlapRule = agSetOverlapRule;
-self->overlapRule = agoNoConstraint;
-self->mySource = mySource;
-self->haveRJIncludeFilter = filtersHaveRJInclude(streamer->filters);
-}
-
-struct annoGrator *annoGratorNew(struct annoStreamer *mySource)
-/* Make a new integrator of columns from mySource with (positions of) rows passed to integrate().
- * mySource becomes property of the new annoGrator. */
-{
-struct annoGrator *self;
-AllocVar(self);
-annoGratorInit(self, mySource);
-return self;
-}
diff --git a/gbtools/src/blatSrc/lib/annoGratorQuery.c b/gbtools/src/blatSrc/lib/annoGratorQuery.c
deleted file mode 100644
index 97cb506..0000000
--- a/gbtools/src/blatSrc/lib/annoGratorQuery.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* annoGratorQuery -- framework for integrating genomic annotations from many sources */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoGratorQuery.h"
-#include "dystring.h"
-#include "errAbort.h"
-#include "obscure.h"
-
-struct annoGratorQuery
-/* Representation of a complex query: multiple sources, each with its own filters,
- * output data and means of integration, aggregated and output by a formatter. */
-    {
-    struct annoAssembly *assembly;	// Genome assembly to which annotations belong
-    struct annoStreamer *primarySource;	// Annotations to be integrated with other annos.
-    struct annoGrator *integrators;	// Annotations & methods for integrating w/primary
-    struct annoFormatter *formatters;	// Writers of output collected from primary & intg's
-    };
-
-struct annoGratorQuery *annoGratorQueryNew(struct annoAssembly *assembly,
-					   struct annoStreamer *primarySource,
-					   struct annoGrator *integrators,
-					   struct annoFormatter *formatters)
-/* Create an annoGratorQuery from all of its components, and introduce components to each other.
- * integrators may be NULL.  All other inputs must be non-NULL. */
-{
-if (assembly == NULL)
-    errAbort("annoGratorQueryNew: assembly can't be NULL");
-if (primarySource == NULL)
-    errAbort("annoGratorQueryNew: primarySource can't be NULL");
-if (formatters == NULL)
-    errAbort("annoGratorQueryNew: formatters can't be NULL");
-struct annoGratorQuery *query = NULL;
-AllocVar(query);
-query->assembly = assembly;
-query->primarySource = primarySource;
-query->integrators = integrators;
-query->formatters = formatters;
-struct annoFormatter *formatter;
-for (formatter = query->formatters;  formatter != NULL;  formatter = formatter->next)
-    formatter->initialize(formatter, primarySource, (struct annoStreamer *)integrators);
-return query;
-}
-
-void annoGratorQuerySetRegion(struct annoGratorQuery *query, char *chrom, uint rStart, uint rEnd)
-/* Set genomic region for query; if chrom is NULL, position is whole genome. */
-{
-if (chrom != NULL)
-    {
-    uint chromSize = annoAssemblySeqSize(query->assembly, chrom);
-    if (rEnd < rStart)
-	errAbort("annoGratorQuerySetRegion: rStart (%u) can't be greater than rEnd (%u)",
-		 rStart, rEnd);
-    if (rEnd > chromSize)
-	errAbort("annoGratorQuerySetRegion: rEnd (%u) can't be greater than chrom %s size (%u)",
-		 rEnd, chrom, chromSize);
-    if (rEnd == 0)
-	rEnd = chromSize;
-    }
-// Alert all streamers that they should now send data from a possibly different region:
-query->primarySource->setRegion(query->primarySource, chrom, rStart, rEnd);
-struct annoStreamer *grator = (struct annoStreamer *)(query->integrators);
-for (;  grator != NULL;  grator = grator->next)
-    grator->setRegion(grator, chrom, rStart, rEnd);
-}
-
-void annoGratorQueryExecute(struct annoGratorQuery *query)
-/* For each annoRow from query->primarySource, invoke integrators and pass their annoRows
- * to formatters. */
-{
-struct annoStreamer *primarySrc = query->primarySource;
-struct annoStreamRows *primaryData = annoStreamRowsNew(primarySrc);
-struct annoStreamRows *gratorData = NULL;
-int gratorCount = slCount(query->integrators);
-if (gratorCount > 0)
-    {
-    struct annoStreamer *gratorStreamList = (struct annoStreamer *)query->integrators;
-    gratorData = annoStreamRowsNew(gratorStreamList);
-    }
-char *regionChrom = primarySrc->chrom;
-struct annoRow *primaryRow = NULL;
-struct lm *lm = lmInit(0);
-boolean gotPrimaryData = FALSE;
-while ((primaryRow = primarySrc->nextRow(primarySrc, NULL, 0, lm)) != NULL)
-    {
-    if (regionChrom != NULL && strcmp(primaryRow->chrom, regionChrom) > 0)
-	{
-	// primarySrc's first row is on some chromosome past regionChrom, i.e. it has no
-	// items on regionChrom.
-	break;
-	}
-    if (primaryRow->rightJoinFail)
-	continue;
-    gotPrimaryData = TRUE;
-    primaryData->rowList = primaryRow;
-    boolean rjFilterFailed = FALSE;
-    int i;
-    for (i = 0;  i < gratorCount;  i++)
-	{
-
-	struct annoGrator *grator = (struct annoGrator *)gratorData[i].streamer;
-	gratorData[i].rowList = grator->integrate(grator, primaryData, &rjFilterFailed, lm);
-	if (rjFilterFailed)
-	    break;
-	}
-    struct annoFormatter *formatter = NULL;
-    for (formatter = query->formatters;  formatter != NULL;  formatter = formatter->next)
-	if (!rjFilterFailed)
-	    formatter->formatOne(formatter, primaryData, gratorData, gratorCount);
-    lmCleanup(&lm);
-    lm = lmInit(0);
-    }
-if (!gotPrimaryData)
-    {
-    struct dyString *dy = dyStringCreate("No data from %s", primarySrc->name);
-    if (regionChrom != NULL)
-	dyStringPrintf(dy, " in range %s:%d-%d; try changing 'region to annotate' to 'genome'",
-		       regionChrom, primarySrc->regionStart, primarySrc->regionEnd);
-    struct annoFormatter *formatter = NULL;
-    for (formatter = query->formatters;  formatter != NULL;  formatter = formatter->next)
-	formatter->comment(formatter, dy->string);
-    dyStringFree(&dy);
-    }
-freez(&primaryData);
-freez(&gratorData);
-lmCleanup(&lm);
-}
-
-void annoGratorQueryFree(struct annoGratorQuery **pQuery)
-/* Close and free all inputs and outputs; free self. */
-{
-if (pQuery == NULL)
-    return;
-struct annoGratorQuery *query = *pQuery;
-query->primarySource->close(&(query->primarySource));
-struct annoStreamer *grator = (struct annoStreamer *)(query->integrators), *nextGrator;
-for (;  grator != NULL;  grator = nextGrator)
-    {
-    nextGrator = grator->next;
-    grator->close(&grator);
-    }
-struct annoFormatter *formatter, *nextFormatter;
-for (formatter = query->formatters;  formatter != NULL;  formatter = nextFormatter)
-    {
-    nextFormatter = formatter->next;
-    formatter->close(&formatter);
-    }
-freez(pQuery);
-}
diff --git a/gbtools/src/blatSrc/lib/annoOption.c b/gbtools/src/blatSrc/lib/annoOption.c
deleted file mode 100644
index bb8ac6d..0000000
--- a/gbtools/src/blatSrc/lib/annoOption.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* annoOption -- optionSpec-style param plus its value */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoOption.h"
-
-struct annoOption *annoOptionCloneList(struct annoOption *list)
-/* Return a newly allocated copy of list. */
-{
-struct annoOption *newList = NULL, *afo;
-for (afo = list;  afo != NULL;  afo = afo->next)
-    {
-    struct annoOption *newAfo = CloneVar(afo);
-    newAfo->spec.name = cloneString(afo->spec.name);
-    newAfo->value = NULL;
-    unsigned opFlags = afo->spec.flags;
-    if (opFlags & OPTION_MULTI)
-	{
-	switch (opFlags & OPTION_TYPE_MASK)
-	    {
-	    case OPTION_STRING:
-		newAfo->value = slNameCloneList((struct slName *)(afo->value));
-		break;
-	    default:
-		errAbort("annoOptionCloneList: OPTION_MULTI implemented only for "
-			 "OPTION_STRING (not 0x%x)", opFlags);
-	    }
-	}
-    else
-	{
-	switch (opFlags & OPTION_TYPE_MASK)
-	    {
-	    // For numeric singleton values, we are overloading value.
-	    case OPTION_DOUBLE:
-	    case OPTION_FLOAT:
-	    case OPTION_LONG_LONG:
-	    case OPTION_INT:
-	    case OPTION_BOOLEAN:
-		newAfo->value = afo->value;
-		break;
-	    case OPTION_STRING:
-		newAfo->value = cloneString((char *)afo->value);
-		break;
-	    default:
-		errAbort("annoOptionCloneList: unrecognized op type 0x%x", opFlags);
-	    }
-	}
-    slAddHead(&newList, newAfo);
-    }
-slReverse(&newList);
-return newList;
-}
-
-void annoOptionFreeList(struct annoOption **pList)
-/* Free the same things that we clone above. */
-{
-if (pList == NULL)
-    return;
-struct annoOption *afo, *nextAfo;
-for (afo = *pList;  afo != NULL;  afo = nextAfo)
-    {
-    nextAfo = afo->next;
-    freeMem(afo->spec.name);
-    unsigned opFlags = afo->spec.flags;
-    if (opFlags & OPTION_MULTI)
-	{
-	switch (opFlags & OPTION_TYPE_MASK)
-	    {
-	    case OPTION_STRING:
-		slNameFreeList(&(afo->value));
-		break;
-	    default:
-		errAbort("annoOptionFreeList: OPTION_MULTI implemented only for "
-			 "OPTION_STRING (not 0x%x)", opFlags);
-	    }
-	}
-    else
-	{
-	switch (opFlags & OPTION_TYPE_MASK)
-	    {
-	    // No need to free overloaded numeric values
-	    case OPTION_DOUBLE:
-	    case OPTION_FLOAT:
-	    case OPTION_LONG_LONG:
-	    case OPTION_INT:
-	    case OPTION_BOOLEAN:
-		break;
-	    case OPTION_STRING:
-		freeMem(afo->value);
-		break;
-	    default:
-		errAbort("annoOptionFreeList: unrecognized op type 0x%x", opFlags);
-	    }
-	}
-    freeMem(afo);
-    }
-*pList = NULL;
-}
-
diff --git a/gbtools/src/blatSrc/lib/annoRow.c b/gbtools/src/blatSrc/lib/annoRow.c
deleted file mode 100644
index d5b0acf..0000000
--- a/gbtools/src/blatSrc/lib/annoRow.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* annoRow -- basic data interchange unit of annoGratorQuery framework. */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoRow.h"
-
-struct annoRow *annoRowFromStringArray(char *chrom, uint start, uint end, boolean rightJoinFail,
-				       char **wordsIn, int numCols, struct lm *lm)
-/* Allocate & return an annoRow with words cloned from wordsIn. */
-{
-struct annoRow *aRow;
-lmAllocVar(lm, aRow);
-aRow->chrom = lmCloneString(lm, chrom);
-aRow->start = start;
-aRow->end = end;
-aRow->rightJoinFail = rightJoinFail;
-char **words;
-lmAllocArray(lm, words, numCols);
-int i;
-for (i = 0;  i < numCols;  i++)
-    words[i] = lmCloneString(lm, wordsIn[i]);
-aRow->data = words;
-return aRow;
-}
-
-struct annoRow *annoRowWigNew(char *chrom, uint start, uint end, boolean rightJoinFail,
-			      float *values, struct lm *lm)
-/* Allocate & return an annoRowWig, with clone of values; length of values is (end-start). */
-{
-struct annoRow *row;
-lmAllocVar(lm, row);
-row->chrom = lmCloneString(lm, chrom);
-row->start = start;
-row->end = end;
-row->data = lmCloneMem(lm, values, (end - start) * sizeof(values[0]));
-row->rightJoinFail = rightJoinFail;
-return row;
-}
-
-struct annoRow *annoRowClone(struct annoRow *rowIn, enum annoRowType rowType, int numCols,
-			     struct lm *lm)
-/* Allocate & return a single annoRow cloned from rowIn.  If rowIn is NULL, return NULL.
- * If type is arWig, numCols is ignored. */
-{
-if (rowIn == NULL)
-    return NULL;
-if (rowType == arWords)
-    return annoRowFromStringArray(rowIn->chrom, rowIn->start, rowIn->end, rowIn->rightJoinFail,
-				  rowIn->data, numCols, lm);
-else if (rowType == arWig)
-    return annoRowWigNew(rowIn->chrom, rowIn->start, rowIn->end, rowIn->rightJoinFail,
-			 (float *)rowIn->data, lm);
-else
-    errAbort("annoRowClone: unrecognized type %d", rowType);
-return NULL;
-}
-
-int annoRowCmp(const void *va, const void *vb)
-/* Compare two annoRows' {chrom, start, end}. */
-{
-struct annoRow *rowA = *((struct annoRow **)va);
-struct annoRow *rowB = *((struct annoRow **)vb);
-int dif = strcmp(rowA->chrom, rowB->chrom);
-if (dif == 0)
-    {
-    dif = rowA->start - rowB->start;
-    if (dif == 0)
-	dif = rowA->end - rowB->end;
-    }
-return dif;
-}
-
diff --git a/gbtools/src/blatSrc/lib/annoStreamBigBed.c b/gbtools/src/blatSrc/lib/annoStreamBigBed.c
deleted file mode 100644
index 2d262a4..0000000
--- a/gbtools/src/blatSrc/lib/annoStreamBigBed.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/* annoStreamBigBed -- subclass of annoStreamer for bigBed file or URL */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoStreamBigBed.h"
-#include "bigBed.h"
-#include "localmem.h"
-#include "sqlNum.h"
-
-struct annoStreamBigBed
-    {
-    struct annoStreamer streamer;	// Parent class members & methods
-    // Private members
-    struct bbiFile *bbi;		// bbi handle for bigBed file/URL.
-    struct lm *intervalQueryLm;		// localmem object for bigBedIntervalQuery
-    struct bigBedInterval *intervalList;	// results of bigBedIntervalQuery
-    struct bigBedInterval *nextInterval;	// next result to be translated into row
-    struct bbiChromInfo *chromList;	// list of chromosomes for which bbi actually has data
-    struct bbiChromInfo *queryChrom;	// most recently queried chrom for whole-genome (or NULL)
-    boolean useMaxItems;		// TRUE if maxItems passed to annoStreamBigBedNew is > 0
-    int maxItems;			// max remaining annoRows that nextRow can return
-    boolean eof;			// TRUE when we are done (maxItems or no more items)
-    boolean doNextChunk;		// TRUE if intervalList ends before end of chrom/region
-    uint nextChunkStart;		// Start coord for next chunk of intervals to query
-    char **row;				// storage for results of bigBedIntervalToRow
-    char *startBuf;			// storage for stringified start from bigBedIntervalToRow
-    char *endBuf;			// storage for stringified end from bigBedIntervalToRow
-    };
-
-// For performance reasons, even if !useMaxItems (no limit), we need to limit the
-// number of intervals that are slurped into memory for a bigBedIntervalQuery, so
-// we don't sit waiting too long when a chromosome has millions of intervals.
-#define ASBB_CHUNK_SIZE 100000
-
-static void asbbSetRegion(struct annoStreamer *vSelf, char *chrom, uint regionStart, uint regionEnd)
-/* Set region -- and free localmem from previous query if necessary. */
-{
-annoStreamerSetRegion(vSelf, chrom, regionStart, regionEnd);
-struct annoStreamBigBed *self = (struct annoStreamBigBed *)vSelf;
-self->nextInterval = self->intervalList = NULL;
-self->queryChrom = NULL;
-self->eof = FALSE;
-self->doNextChunk = FALSE;
-lmCleanup(&(self->intervalQueryLm));
-}
-
-static void updateNextChunkState(struct annoStreamBigBed *self, int queryMaxItems)
-/* If the just-fetched interval list was limited to ASBB_CHUNK_SIZE, set doNextChunk
- * and trim the last interval(s) so that when we query the next chunk, we don't get
- * repeat rows due to querying a start coord that was already returned. */
-{
-if (queryMaxItems == ASBB_CHUNK_SIZE)
-    {
-    int itemCount = slCount(self->intervalList);
-    if (itemCount == ASBB_CHUNK_SIZE)
-	{
-	self->doNextChunk = TRUE;
-	struct bigBedInterval *lastIv = NULL, *iv;
-	for (iv = self->intervalList;  iv->next != NULL;  iv = iv->next)
-	    {
-	    if (iv->start != iv->next->start)
-		{
-		lastIv = iv;
-		self->nextChunkStart = iv->next->start;
-		}
-	    }
-	lastIv->next = NULL;
-	}
-    else
-	self->doNextChunk = FALSE;
-    }
-else
-    self->doNextChunk = FALSE;
-}
-
-static void asbbDoQuery(struct annoStreamBigBed *self, char *minChrom, uint minEnd)
-/* Store results of an interval query. */
-{
-struct annoStreamer *sSelf = &(self->streamer);
-if (sSelf->chrom != NULL && self->intervalList != NULL && !self->doNextChunk)
-    // We're doing a region query, we already got some rows, and don't need another chunk:
-    self->eof = TRUE;
-if (self->useMaxItems)
-    {
-    int lastIntervalCount = slCount(self->intervalList);
-    self->maxItems -= lastIntervalCount;
-    if (self->maxItems <= 0)
-	self->eof = TRUE;
-    }
-self->nextInterval = self->intervalList = NULL;
-lmCleanup(&self->intervalQueryLm);
-if (self->eof)
-    return;
-self->intervalQueryLm = lmInit(0);
-int queryMaxItems = ASBB_CHUNK_SIZE;
-if (self->useMaxItems && self->maxItems < queryMaxItems)
-    queryMaxItems = self->maxItems;
-if (sSelf->chrom != NULL)
-    {
-    uint start = sSelf->regionStart;
-    if (minChrom)
-	{
-	if (differentString(minChrom, sSelf->chrom))
-	    errAbort("annoStreamBigBed %s: nextRow minChrom='%s' but region chrom='%s'",
-		     sSelf->name, minChrom, sSelf->chrom);
-	if (start < minEnd)
-	    start = minEnd;
-	}
-    if (self->doNextChunk && start < self->nextChunkStart)
-	start = self->nextChunkStart;
-    self->intervalList = bigBedIntervalQuery(self->bbi, sSelf->chrom, start, sSelf->regionEnd,
-					     queryMaxItems, self->intervalQueryLm);
-    updateNextChunkState(self, queryMaxItems);
-    }
-else
-    {
-    // Genome-wide query: break it into chrom-by-chrom queries.
-    if (self->queryChrom == NULL)
-	self->queryChrom = self->chromList;
-    else if (!self->doNextChunk)
-	self->queryChrom = self->queryChrom->next;
-    if (minChrom != NULL)
-	{
-	// Skip chroms that precede minChrom
-	while (self->queryChrom != NULL && strcmp(self->queryChrom->name, minChrom) < 0)
-	    {
-	    self->queryChrom = self->queryChrom->next;
-	    self->doNextChunk = FALSE;
-	    }
-	}
-    if (self->queryChrom == NULL)
-	{
-	self->eof = TRUE;
-	}
-    else
-	{
-	char *chrom = self->queryChrom->name;
-	int start = 0;
-	if (minChrom != NULL && sameString(chrom, minChrom))
-	    start = minEnd;
-	if (self->doNextChunk && start < self->nextChunkStart)
-	    {
-	    start = self->nextChunkStart;
-	    }
-	uint end = self->queryChrom->size;
-	self->intervalList = bigBedIntervalQuery(self->bbi, chrom, start, end,
-						 queryMaxItems, self->intervalQueryLm);
-	updateNextChunkState(self, queryMaxItems);
-	}
-    }
-self->nextInterval = self->intervalList;
-}
-
-static char **nextRowUnfiltered(struct annoStreamBigBed *self, char *minChrom, uint minEnd)
-/* Convert the next available interval into a row of words, or return NULL. */
-{
-struct annoStreamer *sSelf = &(self->streamer);
-if (self->nextInterval == NULL ||
-    (minChrom != NULL && self->queryChrom != NULL &&
-     (strcmp(self->queryChrom->name, minChrom) < 0)))
-    asbbDoQuery(self, minChrom, minEnd);
-if (self->nextInterval == NULL)
-    return NULL;
-char *chrom = sSelf->chrom ? sSelf->chrom : self->queryChrom->name;
-// If current set of intervals is for minChrom, skip items to the left of minEnd:
-if (minChrom != NULL && sameString(chrom, minChrom))
-    {
-    while (self->nextInterval && self->nextInterval->end < minEnd)
-	self->nextInterval = self->nextInterval->next;
-    // If no more items are left in intervalList, query again:
-    if (self->nextInterval == NULL)
-	asbbDoQuery(self, minChrom, minEnd);
-    if (self->nextInterval == NULL)
-	return NULL;
-    }
-int fieldCount = bigBedIntervalToRow(self->nextInterval, chrom,
-				     self->startBuf, self->endBuf,
-				     self->row, sSelf->numCols+1);
-if (fieldCount != sSelf->numCols)
-    errAbort("annoStreamBigBed %s: expected %d columns, got %d",
-	     sSelf->name, sSelf->numCols, fieldCount);
-self->nextInterval = self->nextInterval->next;
-return self->row;
-}
-
-static struct annoRow *asbbNextRow(struct annoStreamer *vSelf, char *minChrom, uint minEnd,
-				   struct lm *lm)
-/* Return a single annoRow, or NULL if there are no more items. */
-{
-struct annoStreamBigBed *self = (struct annoStreamBigBed *)vSelf;
-if (self->eof)
-    return NULL;
-char **row = nextRowUnfiltered(self, minChrom, minEnd);
-if (row == NULL)
-    return NULL;
-// Skip past any left-join failures until we get a right-join failure, a passing row, or EOF.
-boolean rightFail = FALSE;
-while (annoFilterRowFails(vSelf->filters, row, vSelf->numCols, &rightFail))
-    {
-    if (rightFail)
-	break;
-    row = nextRowUnfiltered(self, minChrom, minEnd);
-    if (row == NULL)
-	return NULL;
-    }
-char *chrom = row[0];
-uint chromStart = sqlUnsigned(row[1]);
-uint chromEnd = sqlUnsigned(row[2]);
-return annoRowFromStringArray(chrom, chromStart, chromEnd, rightFail, row, vSelf->numCols, lm);
-}
-
-static void asbbClose(struct annoStreamer **pVSelf)
-/* Close bbi handle and free self. */
-{
-if (pVSelf == NULL)
-    return;
-struct annoStreamBigBed *self = *(struct annoStreamBigBed **)pVSelf;
-bigBedFileClose(&(self->bbi));
-self->intervalList = NULL;
-lmCleanup(&(self->intervalQueryLm));
-freeMem(self->row);
-freeMem(self->startBuf);
-freeMem(self->endBuf);
-annoStreamerFree(pVSelf);
-}
-
-struct annoStreamer *annoStreamBigBedNew(char *fileOrUrl, struct annoAssembly *aa, int maxItems)
-/* Create an annoStreamer (subclass) object from a file or URL; if
- * maxItems is 0, all items from a query will be returned, otherwise
- * output is limited to maxItems. */
-{
-struct bbiFile *bbi = bigBedFileOpen(fileOrUrl);
-struct asObject *asObj = bigBedAsOrDefault(bbi);
-struct annoStreamBigBed *self = NULL;
-AllocVar(self);
-struct annoStreamer *streamer = &(self->streamer);
-annoStreamerInit(streamer, aa, asObj, fileOrUrl);
-streamer->rowType = arWords;
-streamer->setRegion = asbbSetRegion;
-streamer->nextRow = asbbNextRow;
-streamer->close = asbbClose;
-self->bbi = bbi;
-self->useMaxItems = (maxItems > 0);
-self->maxItems = maxItems;
-AllocArray(self->row, streamer->numCols + 1);
-self->startBuf = needMem(32);
-self->endBuf = needMem(32);
-self->chromList = bbiChromList(bbi);
-return (struct annoStreamer *)self;
-}
diff --git a/gbtools/src/blatSrc/lib/annoStreamBigWig.c b/gbtools/src/blatSrc/lib/annoStreamBigWig.c
deleted file mode 100644
index 4ed2862..0000000
--- a/gbtools/src/blatSrc/lib/annoStreamBigWig.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* annoStreamBigWig -- subclass of annoStreamer for bigWig file or URL */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoStreamBigWig.h"
-#include "bigWig.h"
-
-char *annoRowBigWigAsText =
-"table annoRowBigWig\n"
-"\"autoSql description of a single annoRowBigWig value, for filtering\"\n"
-"    (\n"
-"    float value;  \"data value for this range\"\n"
-"    )\n"
-    ;
-
-struct annoStreamBigWig
-    {
-    struct annoStreamer streamer;	// Parent class members & methods
-    // Private members
-    struct bbiFile *bbi;		// bbi handle for bigBed file/URL.
-    struct lm *intervalQueryLm;		// localmem object for bigWigIntervalQuery
-    struct bbiInterval *intervalList;	// results of bigWigIntervalQuery
-    struct bbiInterval *nextInterval;	// next result to be translated into row
-    struct bbiChromInfo *chromList;	// list of chromosomes for which bbi actually has data
-    struct bbiChromInfo *queryChrom;	// most recently queried chrom for whole-genome (or NULL)
-    boolean eof;			// TRUE when we are done
-    };
-
-
-static void asbwSetRegion(struct annoStreamer *vSelf, char *chrom, uint regionStart, uint regionEnd)
-/* Set region -- and free localmem from previous query if necessary. */
-{
-annoStreamerSetRegion(vSelf, chrom, regionStart, regionEnd);
-struct annoStreamBigWig *self = (struct annoStreamBigWig *)vSelf;
-self->nextInterval = self->intervalList = NULL;
-self->queryChrom = NULL;
-self->eof = FALSE;
-lmCleanup(&(self->intervalQueryLm));
-}
-
-static void asbwDoQuery(struct annoStreamBigWig *self, char *minChrom, uint minEnd)
-/* Store results of an interval query. [Would be nice to make a streaming version of this.] */
-{
-struct annoStreamer *sSelf = &(self->streamer);
-if (self->intervalQueryLm == NULL)
-    self->intervalQueryLm = lmInit(0);
-if (sSelf->chrom != NULL)
-    {
-    uint start = sSelf->regionStart;
-    if (minChrom)
-	{
-	if (differentString(minChrom, sSelf->chrom))
-	    errAbort("annoStreamBigWig %s: nextRow minChrom='%s' but region chrom='%s'",
-		     sSelf->name, minChrom, sSelf->chrom);
-	if (start < minEnd)
-	    start = minEnd;
-	}
-    self->intervalList = bigWigIntervalQuery(self->bbi, sSelf->chrom, start, sSelf->regionEnd,
-					     self->intervalQueryLm);
-    }
-else
-    {
-    // Genome-wide query: break it into chrom-by-chrom queries.
-    if (self->queryChrom == NULL)
-	self->queryChrom = self->chromList;
-    else
-	self->queryChrom = self->queryChrom->next;
-    if (minChrom != NULL)
-	{
-	// Skip chroms that precede minChrom
-	while (self->queryChrom != NULL && strcmp(self->queryChrom->name, minChrom) < 0)
-	    self->queryChrom = self->queryChrom->next;
-	}
-    if (self->queryChrom == NULL)
-	{
-	self->eof = TRUE;
-	self->intervalList = NULL;
-	}
-    else
-	{
-	char *chrom = self->queryChrom->name;
-	int start = 0;
-	if (minChrom != NULL && sameString(chrom, minChrom))
-	    start = minEnd;
-	uint end = self->queryChrom->size;
-	self->intervalList = bigWigIntervalQuery(self->bbi, chrom, start, end,
-						 self->intervalQueryLm);
-	}
-    }
-self->nextInterval = self->intervalList;
-}
-
-static struct annoRow *annoRowFromContigBbiIntervals(char *name, char *chrom,
-				struct bbiInterval *startIv, struct bbiInterval *endIv,
-				boolean rightJoinFail, struct lm *callerLm)
-/* Given a range of non-NULL contiguous bbiIntervals (i.e. no gaps between intervals),
- * translate into annoRow with annoVector as data. */
-{
-float *vals;
-int baseCount = endIv->end - startIv->start;
-AllocArray(vals, baseCount);
-int vecOff = 0;
-struct bbiInterval *iv;
-for (iv = startIv;  iv != endIv->next;  iv = iv->next)
-    {
-    int i;
-    for (i = 0;  i < (iv->end - iv->start);  i++)
-	vals[vecOff++] = iv->val;
-    if (vecOff > baseCount)
-	errAbort("annoStreamBigWig %s: overflowed baseCount (%s:%d-%d)",
-		 name, chrom, startIv->start, endIv->end);
-    }
-return annoRowWigNew(chrom, startIv->start, endIv->end, rightJoinFail, vals, callerLm);
-}
-
-static struct annoRow *asbwNextRow(struct annoStreamer *sSelf, char *minChrom, uint minEnd,
-				   struct lm *callerLm)
-/* Return a single annoRow, or NULL if there are no more items. */
-{
-struct annoStreamBigWig *self = (struct annoStreamBigWig *)sSelf;
-if (self->intervalList == NULL)
-    asbwDoQuery(self, minChrom, minEnd);
-if (self->nextInterval == NULL)
-    return NULL;
-// Skip past any left-join failures until we get a right-join failure, a passing interval, or EOF.
-boolean rightFail = FALSE;
-struct bbiInterval *startIv = self->nextInterval;
-while (annoFilterWigValueFails(sSelf->filters, self->nextInterval->val, &rightFail))
-    {
-    if (rightFail)
-	break;
-    startIv = self->nextInterval = self->nextInterval->next;
-    if (self->nextInterval == NULL)
-	return NULL;
-    }
-char *chrom = sSelf->chrom ? sSelf->chrom : self->queryChrom->name;
-if (rightFail)
-    return annoRowFromContigBbiIntervals(sSelf->name, chrom, startIv, startIv, rightFail,
-					 callerLm);
-struct bbiInterval *endIv = startIv, *iv;
-int maxCount = 16 * 1024, count;
-for (iv = startIv->next, count = 0;  iv != NULL && count < maxCount;  iv = iv->next, count++)
-    {
-    // collect contiguous intervals; then make annoRow with vector.
-    if (annoFilterWigValueFails(sSelf->filters, iv->val, &rightFail))
-	break;
-    if (iv->start == endIv->end)
-	endIv = iv;
-    else
-	break;
-    }
-self->nextInterval = endIv->next;
-return annoRowFromContigBbiIntervals(sSelf->name, chrom, startIv, endIv, rightFail, callerLm);
-}
-
-static void asbwClose(struct annoStreamer **pVSelf)
-/* Close bbi handle and free self. */
-{
-if (pVSelf == NULL)
-    return;
-struct annoStreamBigWig *self = *(struct annoStreamBigWig **)pVSelf;
-bigWigFileClose(&(self->bbi));
-self->intervalList = NULL;
-lmCleanup(&(self->intervalQueryLm));
-annoStreamerFree(pVSelf);
-}
-
-struct annoStreamer *annoStreamBigWigNew(char *fileOrUrl, struct annoAssembly *aa)
-/* Create an annoStreamer (subclass) object from a file or URL. */
-{
-struct bbiFile *bbi = bigWigFileOpen(fileOrUrl);
-struct asObject *asObj = asParseText(annoRowBigWigAsText);
-struct annoStreamBigWig *self = NULL;
-AllocVar(self);
-struct annoStreamer *streamer = &(self->streamer);
-annoStreamerInit(streamer, aa, asObj, fileOrUrl);
-streamer->rowType = arWig;
-streamer->setRegion = asbwSetRegion;
-streamer->nextRow = asbwNextRow;
-streamer->close = asbwClose;
-self->chromList = bbiChromList(bbi);
-self->bbi = bbi;
-return (struct annoStreamer *)self;
-}
diff --git a/gbtools/src/blatSrc/lib/annoStreamTab.c b/gbtools/src/blatSrc/lib/annoStreamTab.c
deleted file mode 100644
index 17de91a..0000000
--- a/gbtools/src/blatSrc/lib/annoStreamTab.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* annoStreamTab -- subclass of annoStreamer for tab-separated text files/URLs */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoStreamTab.h"
-#include "linefile.h"
-#include "net.h"
-#include "sqlNum.h"
-
-struct annoStreamTab
-    {
-    struct annoStreamer streamer;	// Parent class members & methods
-    // Private members
-    char *fileOrUrl;			// File name or URL
-    struct lineFile *lf;		// file handle
-    char **asWords;			// Most recent row's words
-    int chromIx;			// Index of chrom-ish col in autoSql or bin-less table
-    int startIx;			// Index of chromStart-ish col in autoSql or bin-less table
-    int endIx;				// Index of chromEnd-ish col in autoSql or bin-less table
-    int fileWordCount;			// Number of columns in file including bin
-    boolean eof;			// Set when we have reached end of file.
-    boolean omitBin;			// 1 if file has bin and autoSql doesn't have bin
-    };
-
-static struct lineFile *astLFOpen(char *fileOrUrl)
-/* Figure out if fileOrUrl is file or URL and open an lf accordingly. */
-{
-if (startsWith("http://", fileOrUrl) || startsWith("https://", fileOrUrl) ||
-    startsWith("ftp://", fileOrUrl))
-    return netLineFileOpen(fileOrUrl);
-else
-    return lineFileOpen(fileOrUrl, TRUE);
-}
-
-static void unChop(char **words, int wordCount)
-/* Trust that words were chopped from a contiguous line and add back tabs for '\0's. */
-{
-int i;
-for (i = 0;  i < wordCount-1;  i++)
-    {
-    int len = strlen(words[i]);
-    words[i][len] = '\t';
-    }
-}
-
-static void astSetRegion(struct annoStreamer *vSelf, char *chrom, uint regionStart, uint regionEnd)
-/* Set region and re-open file or URL if necessary. */
-{
-struct annoStreamTab *self = (struct annoStreamTab *)vSelf;
-boolean keepOpen = FALSE;
-if (chrom != NULL && vSelf->chrom != NULL)
-    {
-    // If old region chrom precedes new region chrom, don't rewind to beginning of file.
-    if (strcmp(vSelf->chrom, chrom) < 0)
-	{
-	keepOpen = TRUE;
-	}
-    else
-	verbose(2, "annoStreamTab: inefficient when region chroms overlap or are out of order!"
-		" (current region: %s:%d-%d, new region: %s:%d-%d)",
-		vSelf->chrom, vSelf->regionStart, vSelf->regionEnd,
-		chrom, regionStart, regionEnd);
-    }
-annoStreamerSetRegion(vSelf, chrom, regionStart, regionEnd);
-if (keepOpen)
-    self->eof = FALSE;
-else
-    {
-    lineFileClose(&(self->lf));
-    self->lf = astLFOpen(self->fileOrUrl);
-    self->eof = FALSE;
-    }
-}
-
-INLINE boolean isAllDigits(char *s)
-{
-return (isNotEmpty(s) && countLeadingDigits(s) == strlen(s));
-}
-
-static void checkWordCountAndBin(struct annoStreamTab *self, int wordCount)
-/* Auto-detect initial bin column and set self->omitBin if autoSql doesn't have bin. */
-{
-if (wordCount == self->streamer.numCols + 1 &&
-    isAllDigits(self->asWords[0]))
-    {
-    self->fileWordCount = self->streamer.numCols + 1;
-    char *asFirstColumnName = self->streamer.asObj->columnList->name;
-    if (!sameString(asFirstColumnName, "bin"))
-	self->omitBin = 1;
-    }
-else
-    self->fileWordCount = self->streamer.numCols;
-}
-
-static char **nextRowUnfiltered(struct annoStreamTab *self, char *minChrom, uint minEnd)
-/* Get the next row from file, skipping rows that fall before the search region
- * (if a search region is defined).  If the row is strictly after the current region,
- * set self->eof and reuse the line, in case it's the first row of the next region.
- * Return pointer to self->asWords if we get a row in region, otherwise NULL. */
-{
-if (self->eof)
-    return NULL;
-struct annoStreamer *sSelf = &(self->streamer);
-char *regionChrom = sSelf->chrom;
-uint regionStart = sSelf->regionStart;
-uint regionEnd = sSelf->regionEnd;
-if (minChrom != NULL)
-    {
-    if (regionChrom == NULL)
-	{
-	regionChrom = minChrom;
-	regionStart = minEnd;
-	regionEnd = annoAssemblySeqSize(sSelf->assembly, minChrom);
-	}
-    else
-	{
-	if (differentString(minChrom, regionChrom))
-	    errAbort("annoStreamTab %s: nextRow minChrom='%s' but region chrom='%s'",
-		     sSelf->name, minChrom, sSelf->chrom);
-	regionStart = max(regionStart, minEnd);
-	}
-    }
-boolean done = FALSE;
-while (!done)
-    {
-    int wordCount;
-    if ((wordCount = lineFileChopNext(self->lf, self->asWords, sSelf->numCols)) <= 0)
-	{
-	self->eof = TRUE;
-	return NULL;
-	}
-    if (self->fileWordCount == 0)
-	checkWordCountAndBin(self, wordCount);
-    lineFileExpectWords(self->lf, self->fileWordCount, wordCount);
-    if (regionChrom == NULL)
-	// Whole-genome query and no minChrom hint; no need to check region.
-	done = TRUE;
-    else
-	{
-	// We're searching within a region -- is this row in range?
-	char *thisChrom = self->asWords[self->omitBin + self->chromIx];
-	uint thisStart = atoll(self->asWords[self->omitBin + self->startIx]);
-	uint thisEnd = atoll(self->asWords[self->omitBin + self->endIx]);
-	int chromDif = strcmp(thisChrom, regionChrom);
-	if (chromDif < 0 ||
-	    (chromDif == 0 && thisEnd <= regionStart))
-	    // This row precedes the region -- keep looking.
-	    continue;
-	else if (chromDif == 0 && thisEnd > regionStart && thisStart < regionEnd)
-	    // This row overlaps region; return it.
-	    done = TRUE;
-	else
-	    {
-	    // This row falls after the region. Undo the damage of lineFileChopNext,
-            // tell lf to reuse the line, set EOF and return NULL - we are all done
-	    // until & unless region changes.
-	    unChop(self->asWords, sSelf->numCols);
-	    lineFileReuse(self->lf);
-	    self->eof = TRUE;
-	    return NULL;
-	    }
-	}
-    }
-return self->asWords + self->omitBin;
-}
-
-static struct annoRow *astNextRow(struct annoStreamer *vSelf, char *minChrom, uint minEnd,
-				  struct lm *callerLm)
-/* Return the next annoRow that passes filters, or NULL if there are no more items. */
-{
-struct annoStreamTab *self = (struct annoStreamTab *)vSelf;
-char **words = nextRowUnfiltered(self, minChrom, minEnd);
-if (words == NULL)
-    return NULL;
-// Skip past any left-join failures until we get a right-join failure, a passing row, or EOF.
-boolean rightFail = FALSE;
-while (annoFilterRowFails(vSelf->filters, words, vSelf->numCols, &rightFail))
-    {
-    if (rightFail)
-	break;
-    words = nextRowUnfiltered(self, minChrom, minEnd);
-    if (words == NULL)
-	return NULL;
-    }
-char *chrom = words[self->chromIx];
-uint chromStart = sqlUnsigned(words[self->startIx]);
-uint chromEnd = sqlUnsigned(words[self->endIx]);
-return annoRowFromStringArray(chrom, chromStart, chromEnd, rightFail, words, vSelf->numCols,
-			      callerLm);
-}
-
-static boolean astInitBed3Fields(struct annoStreamTab *self)
-/* Use autoSql to figure out which table fields correspond to {chrom, chromStart, chromEnd}. */
-{
-struct annoStreamer *vSelf = &(self->streamer);
-return annoStreamerFindBed3Columns(vSelf, &(self->chromIx), &(self->startIx), &(self->endIx),
-				   NULL, NULL, NULL);
-}
-
-static void astClose(struct annoStreamer **pVSelf)
-/* Close file and free self. */
-{
-if (pVSelf == NULL)
-    return;
-struct annoStreamTab *self = *(struct annoStreamTab **)pVSelf;
-lineFileClose(&(self->lf));
-freeMem(self->asWords);
-freeMem(self->fileOrUrl);
-annoStreamerFree(pVSelf);
-}
-
-struct annoStreamer *annoStreamTabNew(char *fileOrUrl, struct annoAssembly *aa,
-				      struct asObject *asObj)
-/* Create an annoStreamer (subclass) object from a tab-separated text file/URL
- * whose columns are described by asObj (possibly excepting bin column at beginning). */
-{
-struct lineFile *lf = astLFOpen(fileOrUrl);
-struct annoStreamTab *self = NULL;
-AllocVar(self);
-struct annoStreamer *streamer = &(self->streamer);
-annoStreamerInit(streamer, aa, asObj, fileOrUrl);
-streamer->rowType = arWords;
-streamer->setRegion = astSetRegion;
-streamer->nextRow = astNextRow;
-streamer->close = astClose;
-AllocArray(self->asWords, streamer->numCols);
-self->lf = lf;
-self->eof = FALSE;
-self->fileOrUrl = cloneString(fileOrUrl);
-if (!astInitBed3Fields(self))
-    errAbort("annoStreamTabNew: can't figure out which fields of %s to use as "
-	     "{chrom, chromStart, chromEnd}.", fileOrUrl);
-return (struct annoStreamer *)self;
-
-}
diff --git a/gbtools/src/blatSrc/lib/annoStreamVcf.c b/gbtools/src/blatSrc/lib/annoStreamVcf.c
deleted file mode 100644
index 2c652b5..0000000
--- a/gbtools/src/blatSrc/lib/annoStreamVcf.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/* annoStreamVcf -- subclass of annoStreamer for VCF files */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoStreamVcf.h"
-#include "twoBit.h"
-#include "vcf.h"
-
-struct annoStreamVcf
-    {
-    struct annoStreamer streamer;	// Parent class members & methods
-    // Private members
-    struct vcfFile *vcff;		// VCF parsed header and file object
-    struct vcfRecord *record;		// Current parsed row of VCF (need this for chromEnd)
-    char *asWords[VCF_NUM_COLS];	// Current row of VCF with genotypes squashed for autoSql
-    struct dyString *dyGt;		// Scratch space for squashing genotype columns
-    struct hash *chromNameHash;		// Translate "chr"-less seq names if necessary.
-    struct annoRow *indelQ;		// FIFO for coord-tweaked indels, to maintain sorting
-    struct annoRow *nextPosQ;		// FIFO (max len=1) for stashing row while draining indelQ
-    struct lm *qLm;			// Local mem for saving rows in Q's (callerLm disappears)
-    int numFileCols;			// Number of columns in VCF file.
-    int maxRecords;			// Maximum number of annoRows to return.
-    int recordCount;			// Number of annoRows we have returned so far.
-    boolean isTabix;			// True if we are accessing compressed VCF via tabix index
-    boolean eof;			// True when we have hit end of file or maxRecords
-    };
-
-
-static void asvSetRegion(struct annoStreamer *vSelf, char *chrom, uint regionStart, uint regionEnd)
-/* Set region -- and free current sqlResult if there is one. */
-{
-annoStreamerSetRegion(vSelf, chrom, regionStart, regionEnd);
-struct annoStreamVcf *self = (struct annoStreamVcf *)vSelf;
-self->indelQ = self->nextPosQ = NULL;
-self->eof = FALSE;
-if (self->isTabix && chrom != NULL)
-    {
-    // If this region is not in tabix index, set self->eof so we won't keep grabbing rows
-    // from the old position.
-    boolean gotRegion = lineFileSetTabixRegion(self->vcff->lf, chrom, regionStart, regionEnd);
-    if (! gotRegion)
-	self->eof = TRUE;
-    }
-}
-
-static char *asvGetHeader(struct annoStreamer *vSelf)
-/* Return VCF header (e.g. for use by formatter) */
-{
-struct annoStreamVcf *self = (struct annoStreamVcf *)vSelf;
-return cloneString(self->vcff->headerString);
-}
-
-static char **nextRowRaw(struct annoStreamVcf *self)
-/* Get the next VCF record and put the row text into autoSql words.
- * Return pointer to self->asWords if we get a row, otherwise NULL. */
-{
-char *words[self->numFileCols];
-int wordCount;
-if ((wordCount = lineFileChop(self->vcff->lf, words)) <= 0)
-    return NULL;
-lineFileExpectWords(self->vcff->lf, self->numFileCols, wordCount);
-int i;
-// First 8 columns are always in the VCF file:
-for (i = 0;  i < 8;  i++)
-    {
-    freeMem(self->asWords[i]);
-    self->asWords[i] = cloneString(words[i]);
-    }
-// Depending on whether VCF contains genotypes, number of file columns may be
-// smaller or larger than number of autoSql columns:
-if (self->vcff->genotypeCount > 0)
-    {
-    self->asWords[8] = words[8];
-    dyStringClear(self->dyGt);
-    for (i = 0;  i < self->vcff->genotypeCount;  i++)
-	{
-	if (i > 0)
-	    dyStringAppendC(self->dyGt, '\t');
-	dyStringAppend(self->dyGt, words[9+i]);
-	}
-    self->asWords[9] = self->dyGt->string;
-    }
-else
-    {
-    self->asWords[8] = "";
-    self->asWords[9] = "";
-    }
-self->record = vcfRecordFromRow(self->vcff, words);
-return self->asWords;
-}
-
-static char *getProperChromName(struct annoStreamVcf *self, char *vcfChrom)
-/* We tolerate chr-less chrom names in VCF and BAM ("1" for "chr1" etc); to avoid
- * confusing the rest of the system, return the chr-ful version if it exists. */
-{
-char *name = hashFindVal(self->chromNameHash, vcfChrom);
-if (name == NULL)
-    {
-    name = vcfChrom;
-    struct twoBitFile *tbf = self->streamer.assembly->tbf;
-    char buf[256];
-    if (! twoBitIsSequence(tbf, vcfChrom))
-	{
-	safef(buf, sizeof(buf), "chr%s", vcfChrom);
-	if (twoBitIsSequence(tbf, buf))
-	    name = buf;
-	}
-    name = lmCloneString(self->chromNameHash->lm, name);
-    hashAdd(self->chromNameHash, vcfChrom, name);
-    }
-return name;
-}
-
-static char **nextRowUnfiltered(struct annoStreamVcf *self, char *minChrom, uint minEnd)
-/* Get the next VCF record and put the row text into autoSql words.
- * Return pointer to self->asWords if we get a row, otherwise NULL. */
-{
-struct annoStreamer *sSelf = (struct annoStreamer *)self;
-char *regionChrom = sSelf->chrom;
-uint regionStart = sSelf->regionStart;
-if (minChrom != NULL)
-    {
-    if (regionChrom == NULL)
-	{
-	regionChrom = minChrom;
-	regionStart = minEnd;
-	}
-    else
-	{
-	regionStart = max(regionStart, minEnd);
-	}
-    }
-char **words = nextRowRaw(self);
-if (regionChrom != NULL && words != NULL)
-    {
-    char *rowChrom = getProperChromName(self, words[0]);
-    if (self->isTabix && strcmp(rowChrom, regionChrom) < 0)
-	{
-	uint regionEnd = sSelf->regionEnd;
-	if (minChrom != NULL && sSelf->chrom == NULL)
-	    regionEnd = annoAssemblySeqSize(sSelf->assembly, minChrom);
-	// If lineFileSetTabixRegion fails, just keep the current file position
-	// -- hopefully we'll just be skipping to the next row after region{Chrom,Start,End}.
-	lineFileSetTabixRegion(self->vcff->lf, regionChrom, regionStart, regionEnd);
-	}
-    while (words != NULL &&
-	   (strcmp(rowChrom, regionChrom) < 0 ||
-	    (sameString(rowChrom, regionChrom) && self->record->chromEnd < regionStart)))
-	words = nextRowRaw(self);
-    }
-// Tabix doesn't give us any rows past end of region, but if not using tabix,
-// detect when we're past end of region:
-if (words != NULL && !self->isTabix && sSelf->chrom != NULL
-    && self->record->chromStart > sSelf->regionEnd)
-    {
-    words = NULL;
-    self->record = NULL;
-    }
-if (words != NULL)
-    self->recordCount++;
-if (words == NULL || (self->maxRecords > 0 && self->recordCount >= self->maxRecords))
-    self->eof = TRUE;
-return words;
-}
-
-static struct annoRow *nextRowFiltered(struct annoStreamVcf *self, char *minChrom, uint minEnd,
-				       struct lm *callerLm)
-/* Get the next record that passes our filters. */
-{
-char **words = nextRowUnfiltered(self, minChrom, minEnd);
-if (words == NULL)
-    return NULL;
-// Skip past any left-join failures until we get a right-join failure, a passing row, or EOF.
-struct annoStreamer *sSelf = (struct annoStreamer *)self;
-boolean rightFail = FALSE;
-while (annoFilterRowFails(sSelf->filters, words, sSelf->numCols, &rightFail))
-    {
-    if (rightFail)
-	break;
-    words = nextRowUnfiltered(self, minChrom, minEnd);
-    if (words == NULL)
-	return NULL;
-    }
-struct vcfRecord *rec = self->record;
-vcfRecordTrimIndelLeftBase(rec);
-vcfRecordTrimAllelesRight(rec);
-char *chrom = getProperChromName(self, rec->chrom);
-return annoRowFromStringArray(chrom, rec->chromStart, rec->chromEnd,
-			      rightFail, words, sSelf->numCols, callerLm);
-}
-
-INLINE boolean vcfAnnoRowIsIndel(struct annoRow *row)
-/* If vcf row's start is one base to the left of row->start, it's an indel whose start
- * coord and alleles required translation into our representation. */
-{
-char **words = (char **)(row->data);
-uint vcfStart = atoll(words[1]);
-return (row->start == vcfStart); // 0-based row->start, 1-based vcfStart
-}
-
-INLINE void nextPosQShouldBeEmpty(struct annoStreamVcf *self)
-/* errAbort if nextPosQ is not empty when expected. */
-{
-if (self->nextPosQ != NULL)
-    errAbort("annoStreamVcf %s: nextPosQ should be empty!", ((struct annoStreamer *)self)->name);
-}
-
-#define MAX_QLM_MEM (1024 * 1024)
-
-INLINE struct annoRow *asvCloneForQ(struct annoStreamVcf *self, struct annoRow *row)
-/* Rows that we store in our queues have to be clone with our own qLm for persistence
- * across calls to asvNextRow. */
-{
-if (self->indelQ == NULL && self->nextPosQ == NULL && lmSize(self->qLm) > MAX_QLM_MEM)
-    {
-    lmCleanup(&self->qLm);
-    self->qLm = lmInit(0);
-    }
-struct annoStreamer *sSelf = (struct annoStreamer *)self;
-return annoRowClone(row, sSelf->rowType, sSelf->numCols, self->qLm);
-}
-
-INLINE struct annoRow *asvPopQ(struct annoRow **pQ, struct annoStreamer *sSelf, struct lm *callerLm)
-/* Return the row at the head of the indel queue, cloned with caller's localmem. */
-{
-return annoRowClone(slPopHead(pQ), sSelf->rowType, sSelf->numCols, callerLm);
-}
-
-static struct annoRow *asvNextRow(struct annoStreamer *sSelf, char *minChrom, uint minEnd,
-				  struct lm *callerLm)
-/* Return an annoRow encoding the next VCF record, or NULL if there are no more items.
- * Use queues to save indels aside until we get to the following base, because VCF's
- * indel encoding starts one base to the left of the actual indel.  Thus, sorted VCF might
- * not be sorted in our internal coords, but it won't be off by more than one base. */
-{
-struct annoStreamVcf *self = (struct annoStreamVcf *)sSelf;
-if (minChrom != NULL && sSelf->chrom != NULL && differentString(minChrom, sSelf->chrom))
-    errAbort("annoStreamVcf %s: nextRow minChrom='%s' but region chrom='%s'",
-	     sSelf->name, minChrom, sSelf->chrom);
-if (self->nextPosQ != NULL || self->eof)
-    {
-    // We have found EOF or a variant at a position after the indels that we have been
-    // saving aside.  Let the indels drain first, then the stashed variant (if there is
-    // one, and it's not an indel).
-    if (self->indelQ != NULL)
-	return asvPopQ(&self->indelQ, sSelf, callerLm);
-    else if (self->nextPosQ != NULL)
-	{
-	if (vcfAnnoRowIsIndel(self->nextPosQ))
-	    {
-	    // Another indel at the next position -- move it from nextPosQ to indelQ
-	    // and keep searching below.
-	    self->indelQ = slPopHead(&self->nextPosQ);
-	    nextPosQShouldBeEmpty(self);
-	    }
-	else
-	    return asvPopQ(&self->nextPosQ, sSelf, callerLm);
-	}
-    else // eof
-	return NULL;
-    }
-struct annoRow *nextRow = NULL;
-while ((nextRow = nextRowFiltered(self, minChrom, minEnd, callerLm)) != NULL)
-    {
-    // nextRow has been allocated with callerLm; if we save it for later, we need a clone in qLm.
-    // If we're popping a row from qLm, we need to clone back to the (probably new) callerLm.
-    if (vcfAnnoRowIsIndel(nextRow))
-	{
-	if (self->indelQ != NULL)
-	    {
-	    // Coords are apples-to-apples (both indels), look for strict ordering:
-	    if (self->indelQ->start < nextRow->start
-		|| differentString(self->indelQ->chrom, nextRow->chrom))
-		{
-		// Another indel, but at some subsequent base -- store in nextPosQ & pop indelQ
-		nextPosQShouldBeEmpty(self);
-		self->nextPosQ = asvCloneForQ(self, nextRow);
-		return asvPopQ(&self->indelQ, sSelf, callerLm);
-		}
-	    else
-		// Another indel at same position -- queue it up and keep looking.
-		// I expect very few of these, so addTail OK
-		slAddTail(&self->indelQ, asvCloneForQ(self, nextRow));
-	    }
-	else
-	    // nextRow is first indel at this position -- queue it up and keep looking.
-	    self->indelQ = asvCloneForQ(self, nextRow);
-	}
-    else // i.e. nextRow is non-indel
-	{
-	// Coords are not apples-to-apples: having the same annoRow->start means
-	// that the indel VCF starts are one less than the non-indel VCF starts,
-	// so let indels go first:
-	if (self->indelQ != NULL
-	    && (self->indelQ->start <= nextRow->start
-		|| differentString(self->indelQ->chrom, nextRow->chrom)))
-	    {
-	    // nextRow is a non-indel at a subsequent *VCF* base; store in nextPosQ & pop indelQ
-	    nextPosQShouldBeEmpty(self);
-	    self->nextPosQ = asvCloneForQ(self, nextRow);
-	    return asvPopQ(&self->indelQ, sSelf, callerLm);
-	    }
-	else
-	    // No indelQ, or nextRow is a non-indel at the same *VCF* base (but prior UCSC base);
-	    // use it now (BTW I expect this to be the common case):
-	    return nextRow;
-	}
-    }
-nextPosQShouldBeEmpty(self);
-if (nextRow == NULL)
-    {
-    if (self->indelQ != NULL)
-	return asvPopQ(&self->indelQ, sSelf, callerLm);
-    else
-	return NULL;
-    }
-errAbort("annoStreamVcf %s: how did we get here?", sSelf->name);
-return NULL;  // avoid compiler warning
-}
-
-static void asvClose(struct annoStreamer **pVSelf)
-/* Close VCF file and free self. */
-{
-if (pVSelf == NULL)
-    return;
-struct annoStreamVcf *self = *(struct annoStreamVcf **)pVSelf;
-vcfFileFree(&(self->vcff));
-// Don't free self->record -- currently it belongs to vcff's localMem
-dyStringFree(&(self->dyGt));
-lmCleanup(&self->qLm);
-annoStreamerFree(pVSelf);
-}
-
-struct annoStreamer *annoStreamVcfNew(char *fileOrUrl, boolean isTabix, struct annoAssembly *aa,
-				      int maxRecords)
-/* Create an annoStreamer (subclass) object from a VCF file, which may
- * or may not have been compressed and indexed by tabix. */
-{
-int maxErr = -1; // don't errAbort on VCF format warnings/errs
-struct vcfFile *vcff;
-if (isTabix)
-    vcff = vcfTabixFileMayOpen(fileOrUrl, NULL, 0, 0, maxErr, 0);
-else
-    vcff = vcfFileMayOpen(fileOrUrl, NULL, 0, 0, maxErr, 0, FALSE);
-if (vcff == NULL)
-    errAbort("annoStreamVcfNew: unable to open VCF: '%s'", fileOrUrl);
-struct annoStreamVcf *self;
-AllocVar(self);
-struct annoStreamer *streamer = &(self->streamer);
-struct asObject *asObj = vcfAsObj();
-annoStreamerInit(streamer, aa, asObj, fileOrUrl);
-streamer->rowType = arWords;
-streamer->setRegion = asvSetRegion;
-streamer->getHeader = asvGetHeader;
-streamer->nextRow = asvNextRow;
-streamer->close = asvClose;
-self->vcff = vcff;
-self->dyGt = dyStringNew(1024);
-self->chromNameHash = hashNew(0);
-self->isTabix = isTabix;
-self->numFileCols = 8;
-if (vcff->genotypeCount > 0)
-    self->numFileCols = 9 + vcff->genotypeCount;
-self->maxRecords = maxRecords;
-self->qLm = lmInit(0);
-return (struct annoStreamer *)self;
-}
diff --git a/gbtools/src/blatSrc/lib/annoStreamer.c b/gbtools/src/blatSrc/lib/annoStreamer.c
deleted file mode 100644
index f44c733..0000000
--- a/gbtools/src/blatSrc/lib/annoStreamer.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/* annoStreamer -- returns items sorted by genomic position to successive nextRow calls */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "annoStreamer.h"
-#include "errAbort.h"
-
-// ----------------------- annoStreamer base methods --------------------------
-
-struct asObject *annoStreamerGetAutoSqlObject(struct annoStreamer *self)
-/* Return parsed autoSql definition of this streamer's data type. */
-{
-return self->asObj;
-}
-
-void annoStreamerSetAutoSqlObject(struct annoStreamer *self, struct asObject *asObj)
-/* Use new asObj and update internal state derived from asObj. */
-{
-self->asObj = asObj;
-self->numCols = slCount(asObj->columnList);
-}
-
-void annoStreamerSetRegion(struct annoStreamer *self, char *chrom, uint rStart, uint rEnd)
-/* Set genomic region for query; if chrom is NULL, position is genome.
- * Many subclasses should make their own setRegion method that calls this and
- * configures their data connection to change to the new position. */
-{
-freez(&(self->chrom));
-if (chrom == NULL)
-    {
-    self->positionIsGenome = TRUE;
-    self->regionStart = self->regionEnd = 0;
-    }
-else
-    {
-    self->positionIsGenome = FALSE;
-    self->chrom = cloneString(chrom);
-    self->regionStart = rStart;
-    if (rEnd == 0)
-	rEnd = annoAssemblySeqSize(self->assembly, chrom);
-    self->regionEnd = rEnd;
-    }
-}
-
-static char *annoStreamerGetHeader(struct annoStreamer *self)
-/* Default method: return NULL. */
-{
-return NULL;
-}
-
-void annoStreamerSetFilters(struct annoStreamer *self, struct annoFilter *newFilters)
-/* Replace any existing filters with newFilters.  It is up to calling code to
- * free old filters and allocate newFilters. */
-{
-self->filters = newFilters;
-}
-
-void annoStreamerAddFilters(struct annoStreamer *self, struct annoFilter *newFilters)
-/* Add newFilter(s).  It is up to calling code to allocate newFilters. */
-{
-self->filters = slCat(newFilters, self->filters);
-}
-
-void annoStreamerInit(struct annoStreamer *self, struct annoAssembly *assembly,
-		      struct asObject *asObj, char *name)
-/* Initialize a newly allocated annoStreamer with default annoStreamer methods and
- * default filters and columns based on asObj.
- * In general, subclasses' constructors will call this first; override nextRow, close,
- * and probably setRegion; and then initialize their private data. */
-{
-self->assembly = assembly;
-self->getAutoSqlObject = annoStreamerGetAutoSqlObject;
-self->setAutoSqlObject = annoStreamerSetAutoSqlObject;
-self->setRegion = annoStreamerSetRegion;
-self->getHeader = annoStreamerGetHeader;
-self->setFilters = annoStreamerSetFilters;
-self->addFilters = annoStreamerAddFilters;
-self->positionIsGenome = TRUE;
-self->setAutoSqlObject(self, asObj);
-if (name == NULL)
-    errAbort("annoStreamerInit: need non-NULL name");
-self->name = cloneString(name);
-}
-
-void annoStreamerFree(struct annoStreamer **pSelf)
-/* Free self. This should be called at the end of subclass close methods, after
- * subclass-specific connections are closed and resources are freed. */
-{
-if (pSelf == NULL)
-    return;
-struct annoStreamer *self = *pSelf;
-freez(&(self->name));
-freez(&(self->chrom));
-freez(pSelf);
-}
-
-INLINE boolean findColumn(struct asColumn *columns, char *name, int *retIx, char **retName)
-/* Scan columns for name.
- * If found, set retIx to column index, set retName to clone of name, and return TRUE.
- * If not found, set retIx to -1, set retName to NULL, and return FALSE; */
-{
-int ix = asColumnFindIx(columns, name);
-if (retIx != NULL)
-    *retIx = ix;
-if (retName != NULL)
-    {
-    if (ix >= 0)
-	*retName = cloneString(name);
-    else
-	*retName = NULL;
-    }
-return (ix >= 0);
-}
-
-boolean annoStreamerFindBed3Columns(struct annoStreamer *self,
-			    int *retChromIx, int *retStartIx, int *retEndIx,
-			    char **retChromField, char **retStartField, char **retEndField)
-/* Scan autoSql for recognized column names corresponding to BED3 columns.
- * Set ret*Ix to list index of each column if found, or -1 if not found.
- * Set ret*Field to column name if found, or NULL if not found.
- * If all three are found, return TRUE; otherwise return FALSE. */
-{
-struct asColumn *columns = self->asObj->columnList;
-if (findColumn(columns, "chrom", retChromIx, retChromField))
-    {
-    if (findColumn(columns, "chromStart", retStartIx, retStartField))
-	return findColumn(columns, "chromEnd", retEndIx, retEndField);
-    else return (findColumn(columns, "txStart", retStartIx, retStartField) &&
-		 findColumn(columns, "txEnd", retEndIx, retEndField));
-    }
-else if (findColumn(columns, "tName", retChromIx, retChromField))
-    return (findColumn(columns, "tStart", retStartIx, retStartField) &&
-	    findColumn(columns, "tEnd", retEndIx, retEndField));
-else if (findColumn(columns, "genoName", retChromIx, retChromField))
-    return (findColumn(columns, "genoStart", retStartIx, retStartField) &&
-	    findColumn(columns, "genoEnd", retEndIx, retEndField));
-return FALSE;
-}
-
-struct annoStreamRows *annoStreamRowsNew(struct annoStreamer *streamerList)
-/* Returns an array of aSR, one for each streamer in streamerList.
- * Typically array is reused by overwriting elements' rowList pointers.
- * Free array when done. */
-{
-int streamerCount = slCount(streamerList);
-struct annoStreamRows *data = NULL;
-AllocArray(data, streamerCount);
-struct annoStreamer *streamer = streamerList;
-int i = 0;
-for (;  i < streamerCount;  i++, streamer = streamer->next)
-    data[i].streamer = streamer;
-return data;
-}
diff --git a/gbtools/src/blatSrc/lib/apacheLog.c b/gbtools/src/blatSrc/lib/apacheLog.c
deleted file mode 100644
index d0f2186..0000000
--- a/gbtools/src/blatSrc/lib/apacheLog.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/* apacheLog - stuff to parse out apache web server logs, currently
- * just the access log. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "obscure.h"
-#include "apacheLog.h"
-
-
-void apacheAccessLogFree(struct apacheAccessLog **pLl)
-/* Free up apacheAccessLog. */
-{
-struct apacheAccessLog *ll = *pLl;
-if (ll != NULL)
-    {
-    freeMem(ll->buf);
-    freez(pLl);
-    }
-}
-
-
-static void badFormat(struct apacheAccessLog **pLl, char *line, char *fileName, 
-	int lineIx, char *message)
-/* Complain about format if verbose flag is on.  Free up
- * *pLl */
-{
-if (verboseLevel()  > 1)
-    {
-    if (fileName != NULL)
-	warn("%s line %d: %s", fileName, lineIx, message);
-    else
-	warn("%s", message);
-    }
-}
-
-static void unterminatedQuote(struct apacheAccessLog **pLl, char *line, 
-	char *fileName, int lineIx)
-/* Complain about unterminated quote. */
-{
-badFormat(pLl, line, fileName, lineIx, 
-	"missing closing quote");
-}
-
-static void shortLine(struct apacheAccessLog **pLl, char *line, 
-	char *fileName, int lineIx)
-/* Complain about short line. */
-{
-badFormat(pLl, line, fileName, lineIx, 
-	"short line");
-}
-
-static void badTimeStamp(struct apacheAccessLog **pLl, char *line, 
-	char *fileName, int lineIx)
-/* Complain about bad time stamp. */
-{
-badFormat(pLl, line, fileName, lineIx, 
-	"bad time stamp");
-}
-
-time_t apacheAccessLogTimeToTick(char *timeStamp)
-/* Convert something like 27/Aug/2009:09:25:32 to Unix timestamp (seconds since 1970).
- * On error returns zero. */
-
-{
-struct tm tm;
-ZeroVar(&tm);
-if (strptime(timeStamp, "%d/%b/%Y:%T", &tm) != NULL)
-    return mktime(&tm);
-else
-    return 0;
-}
-
-struct apacheAccessLog *apacheAccessLogParse(char *line, 
-	char *fileName, int lineIx)
-/* Return a apacheAccessLog from line.  Return NULL if there's a parsing 
- * problem, but don't abort. */
-{
-struct apacheAccessLog *ll;
-char *buf, *s, *e;
-AllocVar(ll);
-ll->buf = buf = cloneString(line);
-ll->ip = nextWord(&buf);
-ll->dash1 = nextWord(&buf);
-ll->dash2 = nextWord(&buf);
-if (buf == NULL)
-    {
-    shortLine(&ll, line, fileName, lineIx);
-    return NULL;
-    }
-
-/* Parse out bracket enclosed timeStamp and time zone. */
-s = strchr(buf, '[');
-if (s == NULL)
-    {
-    badTimeStamp(&ll, line, fileName, lineIx);
-    return NULL;
-    }
-s += 1;
-e = strchr(s, ']');
-if (e == NULL)
-    {
-    badTimeStamp(&ll, line, fileName, lineIx);
-    return NULL;
-    }
-*e = 0;
-ll->timeStamp = nextWord(&s);
-if (!isdigit(ll->timeStamp[0]))
-    {
-    badTimeStamp(&ll, line, fileName, lineIx);
-    return NULL;
-    }
-ll->timeZone = nextWord(&s);
-
-/* Convert time stamp to Unix tick. */
-ll->tick = apacheAccessLogTimeToTick(ll->timeStamp);
-
-
-buf = e+2;
-if (buf[0] != '"')
-    {
-    badFormat(&ll, line, fileName, lineIx, "Missing quote after time stamp");
-    return NULL;
-    }
-if (!parseQuotedString(buf, buf, &e))
-    {
-    unterminatedQuote(&ll, line, fileName, lineIx);
-    return NULL;
-    }
-ll->method = nextWord(&buf);
-ll->url = nextWord(&buf);
-ll->httpVersion = nextWord(&buf);
-if (ll->url == NULL)
-    {
-    badFormat(&ll, line, fileName, lineIx, "Missing URL");
-    return NULL;
-    }
-buf = e;
-s = nextWord(&buf);
-if (!isdigit(s[0]))
-    {
-    badFormat(&ll, line, fileName, lineIx, "Non-numerical status code");
-    return NULL;
-    }
-ll->status = atoi(s);
-ll->num1 = nextWord(&buf);
-if (buf == NULL)
-    {
-    shortLine(&ll, line, fileName, lineIx);
-    return NULL;
-    }
-if (buf[0] != '"')
-    {
-    badFormat(&ll, line, fileName, lineIx, "Missing quote after request");
-    return NULL;
-    }
-if (!parseQuotedString(buf, buf, &e))
-    {
-    unterminatedQuote(&ll, line, fileName, lineIx);
-    return NULL;
-    }
-if (!sameString(buf, "-"))
-    ll->referrer = buf;
-buf = e + 1;
-if (buf[0] != '"')
-    {
-    badFormat(&ll, line, fileName, lineIx, "Missing quote after referrer");
-    return NULL;
-    }
-if (!parseQuotedString(buf, buf, &e))
-    {
-    unterminatedQuote(&ll, line, fileName, lineIx);
-    return NULL;
-    }
-ll->program = buf;
-
-/* Parse out elapsed time if it's there. */
-ll->runTime = -1;		/* Marker for unset. */
-char *runTime = nextWord(&e);
-char *label = nextWord(&e);
-if (label != NULL)
-    {
-    if (!isdigit(runTime[0]))
-        {
-	badFormat(&ll, line, fileName, lineIx, "non-numerical seconds");
-	return NULL;
-	}
-    int x = atoi(runTime);
-    if (sameString(label, "seconds"))
-        ll->runTime = x*1000;
-    else if (sameString(label, "microseconds"))
-        ll->runTime = x/1000;
-    }
-
-return ll;
-}
-
-int apacheAccessLogCmpTick(const void *va, const void *vb)
-/* Compare items to sort by tick (which tracks timestamp) */
-{
-const struct apacheAccessLog *a = *((struct apacheAccessLog **)va);
-const struct apacheAccessLog *b = *((struct apacheAccessLog **)vb);
-if (a->tick < b->tick)
-    return -1;
-else if (a->tick == b->tick)
-    return 0;
-else
-    return 1;
-}
-
diff --git a/gbtools/src/blatSrc/lib/asParse.c b/gbtools/src/blatSrc/lib/asParse.c
deleted file mode 100644
index 2e4ae82..0000000
--- a/gbtools/src/blatSrc/lib/asParse.c
+++ /dev/null
@@ -1,664 +0,0 @@
-/* asParse - parse out an autoSql .as file. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "tokenizer.h"
-#include "dystring.h"
-#include "asParse.h"
-#include "sqlNum.h"
-
-
-/* n.b. switched double/float from %f to %g to partially address losing
- * precision.  Values like 2e-12 were being rounded to 0.0 with %f.  While %g
- * doesn't match the precision of the database fields, specifying a larger
- * precision with %g resulted in numbers like 1.9999999999999999597733e-12,
- *  which might impact load time.  This issue needs more investigation.*/
-struct asTypeInfo asTypes[] = {
-    {t_double,  "double",  FALSE, FALSE, "double",            "double",        "Double",   "Double",   "%g",   "FloatField"},
-    {t_float,   "float",   FALSE, FALSE, "float",             "float",         "Float",    "Float",    "%g",   "FloatField"},
-    {t_char,    "char",    FALSE, FALSE, "char",              "char",          "Char",     "Char",     "%c",   "CharField"},
-    {t_int,     "int",     FALSE, FALSE, "int",               "int",           "Signed",   "Signed",   "%d",   "IntegerField"},
-    {t_uint,    "uint",    TRUE,  FALSE, "int unsigned",      "unsigned",      "Unsigned", "Unsigned", "%u",   "PositiveIntegerField"},
-    {t_short,   "short",   FALSE, FALSE, "smallint",          "short",         "Short",    "Signed",   "%d",   "SmallIntegerField"},
-    {t_ushort,  "ushort",  TRUE,  FALSE, "smallint unsigned", "unsigned short","Ushort",   "Unsigned", "%u",   "SmallPositiveIntegerField"},
-    {t_byte,    "byte",    FALSE, FALSE, "tinyint",           "signed char",   "Byte",     "Signed",   "%d",   "SmallIntegerField"},
-    {t_ubyte,   "ubyte",   TRUE,  FALSE, "tinyint unsigned",  "unsigned char", "Ubyte",    "Unsigned", "%u",   "SmallPositiveIntegerField"},
-    {t_off,     "bigint",  FALSE, FALSE, "bigint",            "long long",     "LongLong", "LongLong", "%lld", "BigIntegerField"},
-    {t_string,  "string",  FALSE, TRUE,  "varchar(255)",      "char *",        "String",   "String",   "%s",   "CharField"},
-    {t_lstring, "lstring", FALSE, TRUE,  "longblob",          "char *",        "String",   "String",   "%s",   "TextField"},
-    {t_enum,    "enum",    FALSE, FALSE, "enum",              "!error!",       "Enum",     "Enum",     NULL,   "CharField"},
-    {t_set,     "set",     FALSE, FALSE, "set",               "unsigned",      "Set",      "Set",      NULL,   NULL},
-    {t_object,  "object",  FALSE, FALSE, "longblob",          "!error!",       "Object",   "Object",   NULL,   "TextField"},
-    {t_object,  "table",   FALSE, FALSE, "longblob",          "!error!",       "Object",   "Object",   NULL,   "TextField"},
-    {t_simple,  "simple",  FALSE, FALSE, "longblob",          "!error!",       "Simple",   "Simple",   NULL,   "TextField"},
-};
-
-struct asTypeInfo *asTypeFindLow(char *name)
-/* Return asType for a low level type of given name.  (Low level because may be decorated 
- * with array or pointer  stuff at a higher level).  Returns NULL if not found. */
-{
-int i;
-for (i=0; i<ArraySize(asTypes); ++i)
-    {
-    if (sameWord(asTypes[i].name, name))
-	return &asTypes[i];
-    }
-return NULL;
-}
-
-static struct asTypeInfo *findLowType(struct tokenizer *tkz)
-/* Return low type info.  Squawk and die if s doesn't
- * correspond to one. */
-{
-struct asTypeInfo *type = asTypeFindLow(tkz->string);
-if (type == NULL)
-    tokenizerErrAbort(tkz, "Unknown type '%s'", tkz->string);
-return type;
-}
-
-static void sqlSymDef(struct asColumn *col, struct dyString *dy)
-/* print symbolic column definition for sql */
-{
-dyStringPrintf(dy, "%s(", col->lowType->sqlName);
-struct slName *val;
-for (val = col->values; val != NULL; val = val->next)
-    {
-    dyStringPrintf(dy, "\"%s\"", val->name);
-    if (val->next != NULL)
-        dyStringAppend(dy, ", ");
-    }
-dyStringPrintf(dy, ")");
-}
-
-struct dyString *asColumnToSqlType(struct asColumn *col)
-/* Convert column to a sql type spec in returned dyString */
-{
-struct asTypeInfo *lt = col->lowType;
-struct dyString *type = dyStringNew(32);
-if ((lt->type == t_enum) || (lt->type == t_set))
-    sqlSymDef(col, type);
-else if (col->isList || col->isArray)
-    dyStringPrintf(type, "longblob");
-else if (lt->type == t_char)
-    dyStringPrintf(type, "char(%d)", col->fixedSize ? col->fixedSize : 1);
-else
-    dyStringPrintf(type, "%s", lt->sqlName);
-return type;
-}
-
-char *asTypeNameFromSqlType(char *sqlType)
-/* Return the autoSql type name (not enum) for the given SQL type, or NULL.
- * Don't attempt to free result. */
-// Unfortunately, when sqlType is longblob, we don't know whether it's a list
-// of some type or an lstring.  :(
-{
-if (sqlType == NULL)
-    return NULL;
-// For comparison with asTypes[*], we need to strip '(...)' strings from all types
-// except 'varchar' which must be 'varchar(255)'.  For 'char', we need to remember
-// what was in the '(...)' so we can add back the '[...]' after type comparison.
-boolean isArray = FALSE;
-int arraySize = 0;
-static char buf[1024];
-if (startsWith("varchar", sqlType))
-    safecpy(buf, sizeof(buf), "varchar(255)");
-else
-    {
-    safecpy(buf, sizeof(buf), sqlType);
-    char *leftParen = strstr(buf, " (");
-    if (leftParen == NULL)
-	leftParen = strchr(buf, '(');
-    if (leftParen != NULL)
-	{
-	isArray = startsWith("char", sqlType);
-	char *rightParen = strrchr(leftParen, ')');
-	if (rightParen != NULL)
-	    {
-	    *rightParen = '\0';
-	    arraySize = atoi(leftParen+1);
-	    strcpy(leftParen, rightParen+1);
-	    }
-	else
-	    errAbort("asTypeNameFromSqlType: mismatched ( in sql type def'%s'", sqlType);
-	}
-    }
-int i;
-for (i = 0;  i < ArraySize(asTypes);  i++)
-    if (sameString(buf, asTypes[i].sqlName))
-	{
-	if (isArray)
-	    {
-	    int typeLen = strlen(buf);
-	    safef(buf+typeLen, sizeof(buf)-typeLen, "[%d]", arraySize);
-	    return buf;
-	    }
-	else
-	    return asTypes[i].name;
-	}
-return NULL;
-}
-
-static struct asColumn *mustFindColumn(struct asObject *table, char *colName)
-/* Return column or die. */
-{
-struct asColumn *col;
-
-for (col = table->columnList; col != NULL; col = col->next)
-    {
-    if (sameWord(col->name, colName))
-	return col;
-    }
-errAbort("Couldn't find column %s", colName);
-return NULL;
-}
-
-static struct asObject *findObType(struct asObject *objList, char *obName)
-/* Find object with given name. */
-{
-struct asObject *obj;
-for (obj = objList; obj != NULL; obj = obj->next)
-    {
-    if (sameWord(obj->name, obName))
-	return obj;
-    }
-return NULL;
-}
-
-static void asParseColArraySpec(struct tokenizer *tkz, struct asObject *obj,
-                                struct asColumn *col)
-/* parse the array length specification for a column */
-{
-if (col->lowType->type == t_simple)
-    col->isArray = TRUE;
-else
-    col->isList = TRUE;
-tokenizerMustHaveNext(tkz);
-if (isdigit(tkz->string[0]))
-    {
-    col->fixedSize = atoi(tkz->string);
-    tokenizerMustHaveNext(tkz);
-    }
-else if (isalpha(tkz->string[0]))
-    {
-#ifdef OLD
-    if (obj->isSimple)
-        tokenizerErrAbort(tkz, "simple objects can't include variable length arrays\n");
-#endif /* OLD */
-    col->linkedSizeName = cloneString(tkz->string);
-    col->linkedSize = mustFindColumn(obj, col->linkedSizeName);
-    col->linkedSize->isSizeLink = TRUE;
-    tokenizerMustHaveNext(tkz);
-    }
-else
-    tokenizerErrAbort(tkz, "must have column name or integer inside []'s\n");
-tokenizerMustMatch(tkz, "]");
-}
-
-static void asParseColSymSpec(struct tokenizer *tkz, struct asObject *obj,
-                              struct asColumn *col)
-/* parse the enum or set symbolic values for a column */
-{
-tokenizerMustHaveNext(tkz);
-while (tkz->string[0] != ')')
-    {
-    slSafeAddHead(&col->values, slNameNew(tkz->string));
-    /* look for `,' or `)', but allow `,' after last token */
-    tokenizerMustHaveNext(tkz);
-    if (!((tkz->string[0] == ',') || (tkz->string[0] == ')')))
-        tokenizerErrAbort(tkz, "expected `,' or `)' got `%s'", tkz->string);
-    if (tkz->string[0] != ')')
-        tokenizerMustHaveNext(tkz);
-    }
-tokenizerMustMatch(tkz, ")");
-slReverse(&col->values);
-}
-
-int tokenizerUnsignedVal(struct tokenizer *tkz)
-/* Ensure current token is an unsigned integer and return value */
-{
-if (!isdigit(tkz->string[0]))
-    {
-    struct lineFile *lf = tkz->lf;
-    errAbort("expecting number got %s line %d of %s", tkz->string, lf->lineIx, lf->fileName);
-    }
-return sqlUnsigned(tkz->string);
-}
-
-struct asIndex *asParseIndex(struct tokenizer *tkz, struct asColumn *col)
-/* See if there's an index key word and if so parse it and return an asIndex
- * based on it.  If not an index key word then just return NULL. */
-{
-struct asIndex *index = NULL;
-if (sameString(tkz->string, "primary") || sameString(tkz->string, "unique")
-	|| sameString(tkz->string, "index") )
-    {
-    AllocVar(index);
-    index->type = cloneString(tkz->string);
-    tokenizerMustHaveNext(tkz);
-    if (tkz->string[0] == '[')
-	{
-	tokenizerMustHaveNext(tkz);
-	index->size = tokenizerUnsignedVal(tkz);
-	tokenizerMustHaveNext(tkz);
-	tokenizerMustMatch(tkz, "]");
-	}
-    }
-return index;
-}
-
-static void asParseColDef(struct tokenizer *tkz, struct asObject *obj)
-/* Parse a column definition */
-{
-struct asColumn *col;
-AllocVar(col);
-
-col->lowType = findLowType(tkz);
-tokenizerMustHaveNext(tkz);
-
-if (col->lowType->type == t_object || col->lowType->type == t_simple)
-    {
-    col->obName = cloneString(tkz->string);
-    tokenizerMustHaveNext(tkz);
-    }
-
-if (tkz->string[0] == '[')
-    asParseColArraySpec(tkz, obj, col);
-else if (tkz->string[0] == '(')
-    asParseColSymSpec(tkz, obj, col);
-
-col->name = cloneString(tkz->string);
-tokenizerMustHaveNext(tkz);
-col->index = asParseIndex(tkz, col);
-if (sameString(tkz->string, "auto"))
-    {
-    col->autoIncrement = TRUE;
-    if (!asTypesIsInt(col->lowType->type))
-        errAbort("error - auto with non-integer type for field %s", col->name);
-    tokenizerMustHaveNext(tkz);
-    }
-tokenizerMustMatch(tkz, ";");
-col->comment = cloneString(tkz->string);
-tokenizerMustHaveNext(tkz);
-if (col->lowType->type == t_char && col->fixedSize != 0)
-    col->isList = FALSE;	/* It's not really a list... */
-slAddHead(&obj->columnList, col);
-}
-
-static struct asObject *asParseTableDef(struct tokenizer *tkz)
-/* Parse a table or object definintion */
-{
-struct asObject *obj;
-AllocVar(obj);
-if (sameWord(tkz->string, "table"))
-    obj->isTable = TRUE;
-else if (sameWord(tkz->string, "simple"))
-    obj->isSimple = TRUE;
-else if (sameWord(tkz->string, "object"))
-    ;
-else
-    tokenizerErrAbort(tkz, "Expecting 'table' or 'object' got '%s'", tkz->string);
-tokenizerMustHaveNext(tkz);
-obj->name = cloneString(tkz->string);
-tokenizerMustHaveNext(tkz);
-obj->comment = cloneString(tkz->string);
-
-/* parse columns */
-tokenizerMustHaveNext(tkz);
-tokenizerMustMatch(tkz, "(");
-while (tkz->string[0] != ')')
-    asParseColDef(tkz, obj);
-slReverse(&obj->columnList);
-return obj;
-}
-
-static void asLinkEmbeddedObjects(struct asObject *obj, struct asObject *objList)
-/* Look up any embedded objects. */
-{
-struct asColumn *col;
-for (col = obj->columnList; col != NULL; col = col->next)
-    {
-    if (col->obName != NULL)
-        {
-        if ((col->obType = findObType(objList, col->obName)) == NULL)
-            errAbort("%s used but not defined", col->obName);
-        if (obj->isSimple)
-            {
-            if (!col->obType->isSimple)
-                errAbort("Simple object %s with embedded non-simple object %s",
-                    obj->name, col->name);
-            }
-        }
-    }
-}
-
-static struct asObject *asParseTokens(struct tokenizer *tkz)
-/* Parse file into a list of objects. */
-{
-struct asObject *objList = NULL;
-struct asObject *obj;
-
-while (tokenizerNext(tkz))
-    {
-    obj = asParseTableDef(tkz);
-    if (findObType(objList, obj->name))
-        tokenizerErrAbort(tkz, "Duplicate definition of %s", obj->name);
-    slAddTail(&objList, obj);
-    }
-
-for (obj = objList; obj != NULL; obj = obj->next)
-    asLinkEmbeddedObjects(obj, objList);
-
-return objList;
-}
-
-char *asTypesIntSizeDescription(enum asTypes type)
-/* Return description of integer size.  Do not free. */
-{
-int size = asTypesIntSize(type);
-switch (size)
-    {
-    case 1:
-	return "byte";
-    case 2:
-	return "short integer";
-    case 4:
-	return "integer";
-    case 8:
-	return "long long integer";
-    default:
-        errAbort("Unexpected error in asTypesIntSizeDescription: expecting integer type size of 1, 2, 4, or 8.  Got %d.", size);
-	return NULL; // happy compiler, never gets here
-    
-    }
-}
-
-int asTypesIntSize(enum asTypes type)
-/* Return size in bytes of any integer type - short, long, unsigned, etc. */
-{
-switch (type)
-    {
-    case t_int:
-    case t_uint:
-	return 4;
-    case t_short:
-    case t_ushort:
-	return 2;
-    case t_byte:
-    case t_ubyte:
-	return 1;
-    case t_off:
-	return 8;
-    default:
-        errAbort("Unexpected error in  asTypesIntSize: expecting integer type.  Got %d.", type);
-	return 0; // happy compiler, never gets here
-    }
-}
-
-boolean asTypesIsUnsigned(enum asTypes type)
-/* Return TRUE if it's any integer type - short, long, unsigned, etc. */
-{
-switch (type)
-    {
-    case t_uint:
-    case t_ushort:
-    case t_ubyte:
-       return TRUE;
-    default:
-       return FALSE;
-    }
-}
-
-boolean asTypesIsInt(enum asTypes type)
-/* Return TRUE if it's any integer type - short, long, unsigned, etc. */
-{
-switch (type)
-    {
-    case t_int:
-    case t_uint:
-    case t_short:
-    case t_ushort:
-    case t_byte:
-    case t_ubyte:
-    case t_off:
-       return TRUE;
-    default:
-       return FALSE;
-    }
-}
-
-boolean asTypesIsFloating(enum asTypes type)
-/* Return TRUE if it's any floating point type - float or double. */
-{
-switch (type)
-    {
-    case t_float:
-    case t_double:
-       return TRUE;
-    default:
-       return FALSE;
-    }
-}
-
-static struct asObject *asParseLineFile(struct lineFile *lf)
-/* Parse open line file.  Closes lf as a side effect. */
-{
-struct tokenizer *tkz = tokenizerOnLineFile(lf);
-struct asObject *objList = asParseTokens(tkz);
-tokenizerFree(&tkz);
-return objList;
-}
-
-
-void asColumnFree(struct asColumn **pAs)
-/* free a single asColumn */
-{
-struct asColumn *as = *pAs;
-if (as != NULL)
-    {
-    freeMem(as->name);
-    freeMem(as->comment);
-    freez(pAs);
-    }
-}
-
-
-void asColumnFreeList(struct asColumn **pList)
-/* free a list of asColumn */
-{
-struct asColumn *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    asColumnFree(&el);
-    }
-*pList = NULL;
-}
-
-void asObjectFree(struct asObject **pAs)
-/* free a single asObject */
-{
-struct asObject *as = *pAs;
-if (as != NULL)
-    {
-    freeMem(as->name);
-    freeMem(as->comment);
-    asColumnFreeList(&as->columnList);
-    freez(pAs);
-    }
-}
-
-
-void asObjectFreeList(struct asObject **pList)
-/* free a list of asObject */
-{
-struct asObject *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    asObjectFree(&el);
-    }
-*pList = NULL;
-}
-
-struct asObject *asParseFile(char *fileName)
-/* Parse autoSql .as file. */
-{
-return asParseLineFile(lineFileOpen(fileName, TRUE));
-}
-
-
-struct asObject *asParseText(char *text)
-/* Parse autoSql from text (as opposed to file). */
-{
-char *dupe = cloneString(text);
-struct lineFile *lf = lineFileOnString("text", TRUE, dupe);
-struct asObject *objList = asParseLineFile(lf);
-freez(&dupe);
-return objList;
-}
-
-struct asColumn *asColumnFind(struct asObject *asObj, char *name)
-// Return named column.
-{
-struct asColumn *asCol = NULL;
-if (asObj!= NULL)
-    {
-    for (asCol = asObj->columnList; asCol != NULL; asCol = asCol->next)
-        if (sameString(asCol->name, name))
-             break;
-    }
-return asCol;
-}
-
-int asColumnFindIx(struct asColumn *list, char *name)
-/* Return index of first element of asColumn list that matches name.
- * Return -1 if not found. */
-{
-struct asColumn *ac;
-int ix = 0;
-for (ac = list; ac != NULL; ac = ac->next, ix++)
-    if (sameString(name, ac->name))
-        return ix;
-return -1;
-}
-
-boolean asCompareObjs(char *name1, struct asObject *as1, char *name2, struct asObject *as2, int numColumnsToCheck,
- int *retNumColumnsSame, boolean abortOnDifference)
-/* Compare as-objects as1 and as2 making sure several important fields show they are the same name and type.
- * If difference found, print it to stderr.  If abortOnDifference, errAbort.
- * Othewise, return TRUE if the objects columns match through the first numColumnsToCheck fields. 
- * If retNumColumnsSame is not NULL, then it will be set to the number of contiguous matching columns. */
-{
-boolean differencesFound = FALSE;
-struct asColumn *col1 = as1->columnList, *col2 = as2->columnList;
-int checkCount = 0;
-int verboseLevel = 2;
-if (abortOnDifference)
-    verboseLevel = 1;
-if (as1->isTable != as2->isTable)
-    {
-    verbose(verboseLevel,"isTable does not match: %s=[%d]  %s=[%d]", name1, as1->isTable, name2, as2->isTable);
-    differencesFound = TRUE;
-    }
-else if (as1->isSimple != as2->isSimple)
-    {
-    verbose(verboseLevel,"isSimple does not match: %s=[%d]  %s=[%d]", name1, as1->isSimple, name2, as2->isSimple);
-    differencesFound = TRUE;
-    }
-else
-    {
-    if (!as1->isTable)
-	{
-	errAbort("asCompareObjLists only supports Table .as objects at this time.");
-	}
-    for (col1 = as1->columnList, col2 = as2->columnList; 
-	 col1 != NULL && col2 != NULL && checkCount < numColumnsToCheck; 
-	 col1 = col1->next, col2 = col2->next, ++checkCount)
-	{
-	if (!sameOk(col1->name, col2->name))
-	    {
-	    verbose(verboseLevel,"column #%d names do not match: %s=[%s]  %s=[%s]\n"
-		, checkCount+1, name1, col1->name, name2, col2->name);
-	    differencesFound = TRUE;
-	    break;
-	    }
-	else if (col1->isSizeLink != col2->isSizeLink)
-	    {
-	    verbose(verboseLevel,"column #%d isSizeLink do not match: %s=[%d]  %s=[%d]\n"
-		, checkCount+1, name1, col1->isSizeLink, name2, col2->isSizeLink);
-	    differencesFound = TRUE;
-	    break;
-	    }
-	else if (col1->isList != col2->isList)
-	    {
-	    verbose(verboseLevel,"column #%d isList do not match: %s=[%d]  %s=[%d]\n"
-		, checkCount+1, name1, col1->isList, name2, col2->isList);
-	    differencesFound = TRUE;
-	    break;
-	    }
-	else if (col1->isArray != col2->isArray)
-	    {
-	    verbose(verboseLevel,"column #%d isArray do not match: %s=[%d]  %s=[%d]\n"
-		, checkCount+1, name1, col1->isArray, name2, col2->isArray);
-	    differencesFound = TRUE;
-	    break;
-	    }
-	else if (!sameOk(col1->lowType->name, col2->lowType->name))
-	    {
-	    verbose(verboseLevel,"column #%d type names do not match: %s=[%s]  %s=[%s]\n"
-		, checkCount+1, name1, col1->lowType->name, name2, col2->lowType->name);
-	    differencesFound = TRUE;
-	    break;
-	    }
-	else if (col1->fixedSize != col2->fixedSize)
-	    {
-	    verbose(verboseLevel,"column #%d fixedSize do not match: %s=[%d]  %s=[%d]\n"
-		, checkCount+1, name1, col1->fixedSize, name2, col2->fixedSize);
-	    differencesFound = TRUE;
-	    break;
-	    }
-	else if (!sameOk(col1->linkedSizeName, col2->linkedSizeName))
-	    {
-	    verbose(verboseLevel,"column #%d linkedSizeName do not match: %s=[%s]  %s=[%s]\n"
-		, checkCount+1, name1, col1->linkedSizeName, name2, col2->linkedSizeName);
-	    differencesFound = TRUE;
-	    break;
-	    }
-	}
-    if (!differencesFound && checkCount < numColumnsToCheck)
-	errAbort("Unexpected error in asCompareObjLists: asked to compare %d columns in %s and %s, but only found %d in one or both asObjects."
-	    , numColumnsToCheck, name1, name2, checkCount);
-    }
-if (differencesFound)
-    {
-    if (abortOnDifference)
-    	errAbort("asObjects differ.");
-    else
-    	verbose(verboseLevel,"asObjects differ. Matching field count=%d\n", checkCount);
-    }
-if (retNumColumnsSame)
-    *retNumColumnsSame = checkCount;
-return (!differencesFound);
-}
-
-boolean asColumnNamesMatchFirstN(struct asObject *as1, struct asObject *as2, int n)
-/* Compare only the column names of as1 and as2, not types because if an asObj has been
- * created from sql type info, longblobs are cast to lstrings but in the proper autoSql
- * might be lists instead (e.g. longblob in sql, uint exonStarts[exonCount] in autoSql. */
-{
-struct asColumn *col1 = as1->columnList, *col2 = as2->columnList;
-int checkCount = 0;
-for (col1 = as1->columnList, col2 = as2->columnList;
-     col1 != NULL && col2 != NULL && checkCount < n;
-     col1 = col1->next, col2 = col2->next, ++checkCount)
-    {
-    if (!sameOk(col1->name, col2->name))
-	return FALSE;
-    }
-return TRUE;
-}
diff --git a/gbtools/src/blatSrc/lib/axt.c b/gbtools/src/blatSrc/lib/axt.c
deleted file mode 100644
index 3dca3a4..0000000
--- a/gbtools/src/blatSrc/lib/axt.c
+++ /dev/null
@@ -1,1106 +0,0 @@
-/* AXT - A simple alignment format with four lines per
- * alignment.  The first specifies the names of the
- * two sequences that align and the position of the
- * alignment, as well as the strand.  The next two
- * lines contain the alignment itself including dashes
- * for inserts.  The alignment is separated from the
- * next alignment with a blank line. 
- *
- * This file contains routines to read such alignments.
- * Note that though the coordinates are one based and
- * closed on disk, they get converted to our usual half
- * open zero based in memory. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "obscure.h"
-#include "linefile.h"
-#include "dnautil.h"
-#include "axt.h"
-
-
-void axtFree(struct axt **pEl)
-/* Free an axt. */
-{
-struct axt *el = *pEl;
-if (el != NULL)
-    {
-    freeMem(el->qName);
-    freeMem(el->tName);
-    freeMem(el->qSym);
-    freeMem(el->tSym);
-    freez(pEl);
-    }
-}
-
-void axtFreeList(struct axt **pList)
-/* Free a list of dynamically allocated axt's */
-{
-struct axt *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    axtFree(&el);
-    }
-*pList = NULL;
-}
-
-
-struct axt *axtReadWithPos(struct lineFile *lf, off_t *retOffset)
-/* Read next axt, and if retOffset is not-NULL, fill it with
- * offset of start of axt. */
-{
-char *words[10], *line;
-int wordCount, symCount;
-struct axt *axt;
-
-wordCount = lineFileChop(lf, words);
-if (retOffset != NULL)
-    *retOffset = lineFileTell(lf);
-if (wordCount <= 0)
-    return NULL;
-if (wordCount < 8)
-    {
-    errAbort("Expecting at least 8 words line %d of %s got %d\n", lf->lineIx, lf->fileName,
-    	wordCount);
-    }
-AllocVar(axt);
-
-axt->qName = cloneString(words[4]);
-axt->qStart = lineFileNeedNum(lf, words, 5) - 1;
-axt->qEnd = lineFileNeedNum(lf, words, 6);
-axt->qStrand = words[7][0];
-axt->tName = cloneString(words[1]);
-axt->tStart = lineFileNeedNum(lf, words, 2) - 1;
-axt->tEnd = lineFileNeedNum(lf, words, 3);
-axt->tStrand = '+';
-if (wordCount > 8)
-    axt->score = lineFileNeedNum(lf, words, 8);
-lineFileNeedNext(lf, &line, NULL);
-axt->symCount = symCount = strlen(line);
-axt->tSym = cloneMem(line, symCount+1);
-lineFileNeedNext(lf, &line, NULL);
-if (strlen(line) != symCount)
-    errAbort("Symbol count %d != %d inconsistent between sequences line %d and prev line of %s",
-    	symCount, (int)strlen(line), lf->lineIx, lf->fileName);
-axt->qSym = cloneMem(line, symCount+1);
-lineFileNext(lf, &line, NULL);	/* Skip blank line */
-return axt;
-}
-
-struct axt *axtRead(struct lineFile *lf)
-/* Read in next record from .axt file and return it.
- * Returns NULL at EOF. */
-{
-return axtReadWithPos(lf, NULL);
-}
-
-void axtWrite(struct axt *axt, FILE *f)
-/* Output axt to axt file. */
-{
-static int ix = 0;
-fprintf(f, "%d %s %d %d %s %d %d %c",
-	ix++, axt->tName, axt->tStart+1, axt->tEnd, 
-	axt->qName, axt->qStart+1, axt->qEnd, axt->qStrand);
-fprintf(f, " %d", axt->score);
-fputc('\n', f);
-mustWrite(f, axt->tSym, axt->symCount);
-fputc('\n', f);
-mustWrite(f, axt->qSym, axt->symCount);
-fputc('\n', f);
-fputc('\n', f);
-if ((strlen(axt->tSym) != strlen(axt->qSym)) || (axt->symCount > strlen(axt->tSym)))
-    fprintf(stderr,"Symbol count %d != %d || %d > %d inconsistent in %s in "
-	    "record %d.\n",
-	    (int)strlen(axt->qSym), (int)strlen(axt->tSym), axt->symCount,
-	    (int)strlen(axt->tSym), axt->qName, ix);
-}
-
-int axtCmpQuery(const void *va, const void *vb)
-/* Compare to sort based on query position. */
-{
-const struct axt *a = *((struct axt **)va);
-const struct axt *b = *((struct axt **)vb);
-int dif;
-dif = strcmp(a->qName, b->qName);
-if (dif == 0)
-    dif = a->qStart - b->qStart;
-return dif;
-}
-
-int axtCmpTarget(const void *va, const void *vb)
-/* Compare to sort based on target position. */
-{
-const struct axt *a = *((struct axt **)va);
-const struct axt *b = *((struct axt **)vb);
-int dif;
-dif = strcmp(a->tName, b->tName);
-if (dif == 0)
-    dif = a->tStart - b->tStart;
-return dif;
-}
-
-int axtCmpScore(const void *va, const void *vb)
-/* Compare to sort based on score. */
-{
-const struct axt *a = *((struct axt **)va);
-const struct axt *b = *((struct axt **)vb);
-return b->score - a->score;
-}
-
-int axtCmpTargetScoreDesc(const void *va, const void *vb)
-/* Compare to sort based on target name and score descending. */
-{
-const struct axt *a = *((struct axt **)va);
-const struct axt *b = *((struct axt **)vb);
-int dif;
-dif = strcmp(a->tName, b->tName);
-if (dif == 0)
-    dif = b->score - a->score;
-return dif;
-}
-
-boolean axtCheck(struct axt *axt, struct lineFile *lf)
-/* Return FALSE if there's a problem with axt. */
-{
-int tSize = countNonDash(axt->tSym, axt->symCount);
-int qSize = countNonDash(axt->qSym, axt->symCount);
-if (tSize != axt->tEnd - axt->tStart)
-    {
-    warn("%d non-dashes, but %d bases to cover at line %d of %s", 
-    	tSize, axt->tEnd - axt->tStart, lf->lineIx, lf->fileName);
-    return FALSE;
-    }
-if (qSize != axt->qEnd - axt->qStart)
-    {
-    warn("%d non-dashes, but %d bases to cover at line %d of %s", 
-    	tSize, axt->qEnd - axt->qStart, lf->lineIx, lf->fileName);
-    return FALSE;
-    }
-return TRUE;
-}
-
-int axtScoreUngapped(struct axtScoreScheme *ss, char *q, char *t, int size)
-/* Score ungapped alignment. */
-{
-int score = 0;
-int i;
-for (i=0; i<size; ++i)
-    score += ss->matrix[(int)q[i]][(int)t[i]];
-return score;
-}
-
-int axtScoreSym(struct axtScoreScheme *ss, int symCount, char *qSym, char *tSym)
-/* Return score without setting up an axt structure. */
-{
-int i;
-char q,t;
-int score = 0;
-boolean lastGap = FALSE;
-int gapStart = ss->gapOpen;
-int gapExt = ss->gapExtend;
-
-dnaUtilOpen();
-for (i=0; i<symCount; ++i)
-    {
-    q = qSym[i];
-    t = tSym[i];
-    if (q == '-' || t == '-')
-        {
-	if (lastGap)
-	    score -= gapExt;
-	else
-	    {
-	    /* Use gapStart+gapExt to be consistent with blastz: */
-	    score -= (gapStart + gapExt);
-	    lastGap = TRUE;
-	    }
-	}
-    else
-        {
-	score += ss->matrix[(int)q][(int)t];
-	lastGap = FALSE;
-	}
-    }
-return score;
-}
-
-boolean gapNotMasked(char q, char t)
-/* return true if gap on one side and upper case on other side */
-{
-if (q=='-' && t=='-')
-    return FALSE;
-if (q=='-' && t<'a')
-    return TRUE;
-if (t=='-' && q<'a')
-    return TRUE;
-return FALSE;
-}
-
-
-int axtScoreSymFilterRepeats(struct axtScoreScheme *ss, int symCount, char *qSym, char *tSym)
-/* Return score without setting up an axt structure. Do not penalize gaps if repeat masked (lowercase)*/
-{
-int i;
-char q,t;
-int score = 0;
-boolean lastGap = FALSE;
-int gapStart = ss->gapOpen;
-int gapExt = ss->gapExtend;
-
-dnaUtilOpen();
-for (i=0; i<symCount; ++i)
-    {
-    q = qSym[i];
-    t = tSym[i];
-    if ((q == '-' || t == '-') && gapNotMasked(q,t))
-        {
-	if (lastGap)
-	    score -= gapExt;
-	else
-	    {
-	    /* Use gapStart+gapExt to be consistent with blastz: */
-	    score -= (gapStart + gapExt);
-	    lastGap = TRUE;
-	    }
-	}
-    else
-        {
-	score += ss->matrix[(int)q][(int)t];
-	lastGap = FALSE;
-	}
-    }
-return score;
-}
-
-int axtScoreFilterRepeats(struct axt *axt, struct axtScoreScheme *ss)
-/* Return calculated score of axt. */
-{
-return axtScoreSymFilterRepeats(ss, axt->symCount, axt->qSym, axt->tSym);
-}
-
-int axtScore(struct axt *axt, struct axtScoreScheme *ss)
-/* Return calculated score of axt. */
-{
-return axtScoreSym(ss, axt->symCount, axt->qSym, axt->tSym);
-}
-
-int axtScoreDnaDefault(struct axt *axt)
-/* Score DNA-based axt using default scheme. */
-{
-static struct axtScoreScheme *ss;
-if (ss == NULL)
-    ss = axtScoreSchemeDefault();
-return axtScore(axt, ss);
-}
-
-int axtScoreProteinDefault(struct axt *axt)
-/* Score protein-based axt using default scheme. */
-{
-static struct axtScoreScheme *ss;
-if (ss == NULL)
-    ss = axtScoreSchemeProteinDefault();
-return axtScore(axt, ss);
-}
-
-boolean axtGetSubsetOnT(struct axt *axt, struct axt *axtOut,
-			int newStart, int newEnd, struct axtScoreScheme *ss,
-			boolean includeEdgeGaps)
-/* Return FALSE if axt is not in the new range.  Otherwise, set axtOut to
- * a subset that goes from newStart to newEnd in target coordinates. 
- * If includeEdgeGaps, don't trim target gaps before or after the range. */
-{
-if (axt == NULL)
-    return FALSE;
-if (newStart < axt->tStart)
-    newStart = axt->tStart;
-if (newEnd > axt->tEnd)
-    newEnd = axt->tEnd;
-if (includeEdgeGaps ? (newEnd < newStart) : (newEnd <= newStart)) 
-    return FALSE;
-if (newStart == axt->tStart && newEnd == axt->tEnd)
-    {
-    axt->score = axtScore(axt, ss);
-    *axtOut = *axt;
-    return TRUE;
-    }
-else
-    {
-    struct axt a = *axt;
-    char *tSymStart = skipIgnoringDash(a.tSym, newStart - a.tStart, TRUE);
-    char *tSymEnd = skipIgnoringDash(tSymStart, newEnd - newStart, FALSE);
-    if (includeEdgeGaps)
-	{
-	while (tSymStart > a.tSym)
-	    if (*(--tSymStart) != '-')
-		{
-		tSymStart++;
-		break;
-		}
-	while (tSymEnd < a.tSym + a.symCount)
-	    if (*(++tSymEnd) != '-')
-		{
-		tSymEnd--;
-		break;
-		}
-	if (newEnd == newStart && tSymEnd > tSymStart)
-	    {
-	    if (*tSymStart != '-')
-		tSymStart++;
-	    if (*(tSymEnd-1) != '-')
-		tSymEnd--;
-	    }
-	}
-    int symCount = tSymEnd - tSymStart;
-    char *qSymStart = a.qSym + (tSymStart - a.tSym);
-    a.qStart += countNonDash(a.qSym, qSymStart - a.qSym);
-    a.qEnd = a.qStart + countNonDash(qSymStart, symCount);
-    a.tStart = newStart;
-    a.tEnd = newEnd;
-    a.symCount = symCount;
-    a.qSym = qSymStart;
-    a.tSym = tSymStart;
-    a.score = axtScore(&a, ss);
-    if ((a.qStart < a.qEnd && a.tStart < a.tEnd) ||
-	(includeEdgeGaps && (a.qStart < a.qEnd || a.tStart < a.tEnd)))
-	{
-	*axtOut = a;
-	return TRUE;
-	}
-    return FALSE;
-    }
-}
-
-void axtSubsetOnT(struct axt *axt, int newStart, int newEnd, 
-	struct axtScoreScheme *ss, FILE *f)
-/* Write out subset of axt that goes from newStart to newEnd
- * in target coordinates. */
-{
-struct axt axtSub;
-if (axtGetSubsetOnT(axt, &axtSub, newStart, newEnd, ss, FALSE))
-    axtWrite(&axtSub, f);
-}
-
-int axtTransPosToQ(struct axt *axt, int tPos)
-/* Convert from t to q coordinates */
-{
-char *tSym = skipIgnoringDash(axt->tSym, tPos - axt->tStart, TRUE);
-int symIx = tSym - axt->tSym;
-int qPos = countNonDash(axt->qSym, symIx);
-return qPos + axt->qStart;
-}
-
-static void shortScoreScheme(struct lineFile *lf)
-/* Complain about score file being to short. */
-{
-errAbort("Scoring matrix file %s too short\n", lf->fileName);
-}
-
-static void propagateCase(struct axtScoreScheme *ss)
-/* Propagate score matrix from lower case to mixed case
- * in matrix. */
-{
-static int twoCase[2][4] = {{'a', 'c', 'g', 't'},{'A','C','G','T'},};
-int i1,i2,j1,j2;
-
-/* Propagate to other case combinations. */
-for (i1=0; i1<=1; ++i1)
-    for (i2=0; i2<=1; ++i2)
-       {
-       if (i1 == 0 && i2 == 0)
-           continue;
-       for (j1=0; j1<4; ++j1)
-	   for (j2=0; j2<4; ++j2)
-	      {
-	      ss->matrix[twoCase[i1][j1]][twoCase[i2][j2]] = ss->matrix[twoCase[0][j1]][twoCase[0][j2]];
-	      }
-       }
-}
-
-struct axtScoreScheme *axtScoreSchemeDefault()
-/* Return default scoring scheme (after blastz).  Do NOT axtScoreSchemeFree
- * this. */
-{
-static struct axtScoreScheme *ss;
-
-if (ss != NULL)
-    return ss;
-AllocVar(ss);
-
-/* Set up lower case elements of matrix. */
-ss->matrix['a']['a'] = 91;
-ss->matrix['a']['c'] = -114;
-ss->matrix['a']['g'] = -31;
-ss->matrix['a']['t'] = -123;
-
-ss->matrix['c']['a'] = -114;
-ss->matrix['c']['c'] = 100;
-ss->matrix['c']['g'] = -125;
-ss->matrix['c']['t'] = -31;
-
-ss->matrix['g']['a'] = -31;
-ss->matrix['g']['c'] = -125;
-ss->matrix['g']['g'] = 100;
-ss->matrix['g']['t'] = -114;
-
-ss->matrix['t']['a'] = -123;
-ss->matrix['t']['c'] = -31;
-ss->matrix['t']['g'] = -114;
-ss->matrix['t']['t'] = 91;
-
-propagateCase(ss);
-ss->gapOpen = 400;
-ss->gapExtend = 30;
-return ss;
-}
-
-struct axtScoreScheme *axtScoreSchemeSimpleDna(int match, int misMatch, int gapOpen, int gapExtend)
-/* Return a relatively simple scoring scheme for DNA. */
-{
-static struct axtScoreScheme *ss;
-AllocVar(ss);
-
-/* Set up lower case elements of matrix. */
-ss->matrix['a']['a'] = match;
-ss->matrix['a']['c'] = -misMatch;
-ss->matrix['a']['g'] = -misMatch;
-ss->matrix['a']['t'] = -misMatch;
-
-ss->matrix['c']['a'] = -misMatch;
-ss->matrix['c']['c'] = match;
-ss->matrix['c']['g'] = -misMatch;
-ss->matrix['c']['t'] = -misMatch;
-
-ss->matrix['g']['a'] = -misMatch;
-ss->matrix['g']['c'] = -misMatch;
-ss->matrix['g']['g'] = match;
-ss->matrix['g']['t'] = -misMatch;
-
-ss->matrix['t']['a'] = -misMatch;
-ss->matrix['t']['c'] = -misMatch;
-ss->matrix['t']['g'] = -misMatch;
-ss->matrix['t']['t'] = match;
-
-propagateCase(ss);
-ss->gapOpen = gapOpen;
-ss->gapExtend = gapExtend;
-return ss;
-}
-
-struct axtScoreScheme *axtScoreSchemeRnaDefault()
-/* Return default scoring scheme for RNA/DNA alignments
- * within the same species.  Do NOT axtScoreSchemeFree */
-{
-static struct axtScoreScheme *ss;
-if (ss == NULL)
-    ss = axtScoreSchemeSimpleDna(100, 200, 300, 300);
-return ss;
-}
-
-struct axtScoreScheme *axtScoreSchemeRnaFill()
-/* Return scoreing scheme a little more relaxed than 
- * RNA/DNA defaults for filling in gaps. */
-{
-static struct axtScoreScheme *ss;
-if (ss == NULL)
-    ss = axtScoreSchemeSimpleDna(100, 100, 200, 200);
-return ss;
-}
-
-struct axtScoreScheme *axtScoreSchemeFromBlastzMatrix(char *text, int gapOpen, int gapExtend)
-/* return scoring schema from a string in the following format */
-/* 91,-90,-25,-100,-90,100,-100,-25,-25,-100,100,-90,-100,-25,-90,91 */
-{
-char *matrixDna[32];
-struct axtScoreScheme *ss = axtScoreSchemeDefault();
-int matrixSize = chopString(text, ",", matrixDna, 32);
-if (matrixSize != 16)
-    return ss;
-if (ss == NULL)
-    return NULL;
-ss->gapOpen = gapOpen;
-ss->gapExtend = gapExtend;
-ss->matrix['a']['a'] = atoi(matrixDna[0]);
-ss->matrix['a']['c'] = atoi(matrixDna[1]);
-ss->matrix['a']['g'] = atoi(matrixDna[2]);
-ss->matrix['a']['t'] = atoi(matrixDna[3]);
-
-ss->matrix['c']['a'] = atoi(matrixDna[4]);
-ss->matrix['c']['c'] = atoi(matrixDna[5]);
-ss->matrix['c']['g'] = atoi(matrixDna[6]);
-ss->matrix['c']['t'] = atoi(matrixDna[7]);
-
-ss->matrix['g']['a'] = atoi(matrixDna[8]);
-ss->matrix['g']['c'] = atoi(matrixDna[9]);
-ss->matrix['g']['g'] = atoi(matrixDna[10]);
-ss->matrix['g']['t'] = atoi(matrixDna[11]);
-
-ss->matrix['t']['a'] = atoi(matrixDna[12]);
-ss->matrix['t']['c'] = atoi(matrixDna[13]);
-ss->matrix['t']['g'] = atoi(matrixDna[14]);
-ss->matrix['t']['t'] = atoi(matrixDna[15]);
-return ss;
-}
-
-char blosumText[] = {
-"#  Matrix made by matblas from blosum62.iij\n"
-"#  * column uses minimum score\n"
-"#  BLOSUM Clustered Scoring Matrix in 1/2 Bit Units\n"
-"#  Blocks Database = /data/blocks_5.0/blocks.dat\n"
-"#  Cluster Percentage: >= 62\n"
-"#  Entropy =   0.6979, Expected =  -0.5209\n"
-"   A  R  N  D  C  Q  E  G  H  I  L  K  M  F  P  S  T  W  Y  V  B  Z  X  *\n"
-"A  4 -1 -2 -2  0 -1 -1  0 -2 -1 -1 -1 -1 -2 -1  1  0 -3 -2  0 -2 -1  0 -4 \n"
-"R -1  5  0 -2 -3  1  0 -2  0 -3 -2  2 -1 -3 -2 -1 -1 -3 -2 -3 -1  0 -1 -4 \n"
-"N -2  0  6  1 -3  0  0  0  1 -3 -3  0 -2 -3 -2  1  0 -4 -2 -3  3  0 -1 -4 \n"
-"D -2 -2  1  6 -3  0  2 -1 -1 -3 -4 -1 -3 -3 -1  0 -1 -4 -3 -3  4  1 -1 -4 \n"
-"C  0 -3 -3 -3  9 -3 -4 -3 -3 -1 -1 -3 -1 -2 -3 -1 -1 -2 -2 -1 -3 -3 -2 -4 \n"
-"Q -1  1  0  0 -3  5  2 -2  0 -3 -2  1  0 -3 -1  0 -1 -2 -1 -2  0  3 -1 -4 \n"
-"E -1  0  0  2 -4  2  5 -2  0 -3 -3  1 -2 -3 -1  0 -1 -3 -2 -2  1  4 -1 -4 \n"
-"G  0 -2  0 -1 -3 -2 -2  6 -2 -4 -4 -2 -3 -3 -2  0 -2 -2 -3 -3 -1 -2 -1 -4 \n"
-"H -2  0  1 -1 -3  0  0 -2  8 -3 -3 -1 -2 -1 -2 -1 -2 -2  2 -3  0  0 -1 -4 \n"
-"I -1 -3 -3 -3 -1 -3 -3 -4 -3  4  2 -3  1  0 -3 -2 -1 -3 -1  3 -3 -3 -1 -4 \n"
-"L -1 -2 -3 -4 -1 -2 -3 -4 -3  2  4 -2  2  0 -3 -2 -1 -2 -1  1 -4 -3 -1 -4 \n"
-"K -1  2  0 -1 -3  1  1 -2 -1 -3 -2  5 -1 -3 -1  0 -1 -3 -2 -2  0  1 -1 -4 \n"
-"M -1 -1 -2 -3 -1  0 -2 -3 -2  1  2 -1  5  0 -2 -1 -1 -1 -1  1 -3 -1 -1 -4 \n"
-"F -2 -3 -3 -3 -2 -3 -3 -3 -1  0  0 -3  0  6 -4 -2 -2  1  3 -1 -3 -3 -1 -4 \n"
-"P -1 -2 -2 -1 -3 -1 -1 -2 -2 -3 -3 -1 -2 -4  7 -1 -1 -4 -3 -2 -2 -1 -2 -4 \n"
-"S  1 -1  1  0 -1  0  0  0 -1 -2 -2  0 -1 -2 -1  4  1 -3 -2 -2  0  0  0 -4 \n"
-"T  0 -1  0 -1 -1 -1 -1 -2 -2 -1 -1 -1 -1 -2 -1  1  5 -2 -2  0 -1 -1  0 -4 \n"
-"W -3 -3 -4 -4 -2 -2 -3 -2 -2 -3 -2 -3 -1  1 -4 -3 -2 11  2 -3 -4 -3 -2 -4 \n"
-"Y -2 -2 -2 -3 -2 -1 -2 -3  2 -1 -1 -2 -1  3 -3 -2 -2  2  7 -1 -3 -2 -1 -4 \n"
-"V  0 -3 -3 -3 -1 -2 -2 -3 -3  3  1 -2  1 -1 -2 -2  0 -3 -1  4 -3 -2 -1 -4 \n"
-"B -2 -1  3  4 -3  0  1 -1  0 -3 -4  0 -3 -3 -2  0 -1 -4 -3 -3  4  1 -1 -4 \n"
-"Z -1  0  0  1 -3  3  4 -2  0 -3 -3  1 -1 -3 -1  0 -1 -3 -2 -2  1  4 -1 -4 \n"
-"X  0 -1 -1 -1 -2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -2  0  0 -2 -1 -1 -1 -1 -1 -4 \n"
-"* -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4  1 \n"
-};
-
-static void badProteinMatrixLine(int lineIx, char *fileName)
-/* Explain line syntax for protein matrix and abort */
-{
-errAbort("Expecting letter and 25 numbers line %d of %s", lineIx, fileName);
-}
-
-struct axtScoreScheme *axtScoreSchemeFromProteinText(char *text, char *fileName)
-/* Parse text into a scoring scheme.  This should be in BLAST protein matrix
- * format as in blosumText above. */
-{
-char *line, *nextLine;
-int lineIx = 0;
-int realCount = 0;
-char columns[24];
-char *row[25];
-int i;
-struct axtScoreScheme *ss;
-
-AllocVar(ss);
-for (line = text; line != NULL; line = nextLine)
-    {
-    nextLine = strchr(line, '\n');
-    if (nextLine != NULL)
-        *nextLine++ = 0;
-    ++lineIx;
-    line = skipLeadingSpaces(line);
-    if (line[0] == '#' || line[0] == 0)
-        continue;
-    ++realCount;
-    if (realCount == 1)
-        {
-	int wordCount = chopLine(line, row);
-	if (wordCount != 24)
-	    errAbort("Not a good protein matrix - expecting 24 letters line %d of %s", lineIx, fileName);
-	for (i=0; i<wordCount; ++i)
-	    {
-	    char *letter = row[i];
-	    if (strlen(letter) != 1)
-		errAbort("Not a good protein matrix - got word not letter line %d of %s", lineIx, fileName);
-	    columns[i] = letter[0];
-	    }
-	}
-    else
-        {
-	int wordCount = chopLine(line, row);
-	char letter, lcLetter;
-	if (wordCount != 25)
-	    badProteinMatrixLine(lineIx, fileName);
-	letter = row[0][0];
-	if (strlen(row[0]) != 1 || isdigit(letter))
-	    badProteinMatrixLine(lineIx, fileName);
-	lcLetter = tolower(letter);
-	for (i=1; i<wordCount; ++i)
-	    {
-	    char *s = row[i];
-	    int val;
-	    char otherLetter, lcOtherLetter;
-	    if (s[0] == '-') ++s;
-	    if (!isdigit(s[0]))
-		badProteinMatrixLine(lineIx, fileName);
-	    otherLetter = columns[i-1];
-	    lcOtherLetter = tolower(otherLetter);
-	    val = atoi(row[i]);
-	    ss->matrix[(int)letter][(int)otherLetter] = val;
-	    ss->matrix[(int)lcLetter][(int)otherLetter] = val;
-	    ss->matrix[(int)letter][(int)lcOtherLetter] = val;
-	    ss->matrix[(int)lcLetter][(int)lcOtherLetter] = val;
-	    }
-	}
-    }
-if (realCount < 25)
-    errAbort("Unexpected end of %s", fileName);
-return ss;
-}
-
-struct axtScoreScheme *axtScoreSchemeProteinDefault()
-/* Returns default protein scoring scheme.  This is
- * scaled to be compatible with the blastz one. */
-{
-static struct axtScoreScheme *ss;
-int i,j;
-if (ss != NULL)
-    return ss;
-ss = axtScoreSchemeFromProteinText(blosumText, "blosum62");
-for (i=0; i<128; ++i)
-    for (j=0; j<128; ++j)
-        ss->matrix[i][j] *= 19;
-ss->gapOpen = 11 * 19;
-ss->gapExtend = 1 * 19;
-return ss;
-}
-
-void axtScoreSchemeFree(struct axtScoreScheme **pObj)
-/* Free up score scheme. */
-{
-freez(pObj);
-}
-
-struct axtScoreScheme *axtScoreSchemeProteinRead(char *fileName)
-{
-char *string;
-struct axtScoreScheme *ss;
-
-readInGulp(fileName, &string, NULL);
-ss = axtScoreSchemeFromProteinText(string, fileName);
-freeMem(string);
-
-return ss;
-}
-
-struct axtScoreScheme *axtScoreSchemeReadLf(struct lineFile *lf )
-/* Read in scoring scheme from file. Looks like
-    A    C    G    T
-    91 -114  -31 -123
-  -114  100 -125  -31
-   -31 -125  100 -114
-  -123  -31 -114   91
-  O = 400, E = 30
-
-2013-12-13 - upgrading to allow reading of newer format settings file
-from lastz tuning output.  This file has the matrix at the end of
-the file, and other settings before that.  Will include the other settings
-in the 'ss->extra' field *WITHOUT* the O= and E= which should always
-be O=400 and E=30 despite what the tuning settings file says.
-Example settings file:
-#############################################################################
-# (a LASTZ scoring set, created by "LASTZ --infer")
-
-bad_score          = X:-1736 # used for sub[X][*] and sub[*][X]
-fill_score         = -174    # used when sub[*][*] not otherwise defined
-
-# (score parameters added by expand_scores_file)
-
-T=2
-O=565
-E=43
-X=790
-Y=4865
-K=3000
-L=3000
-
-      A     C     G     T
-A    79   -84   -55  -128
-C   -84   100  -174   -55
-G   -55  -174   100   -84
-T  -128   -55   -84    79
-#############################################################################
-
-*/
-{
-char *line, *row[6], *parts[32];
-int i,j, partCount;
-struct axtScoreScheme *ss;
-boolean gotO = FALSE, gotE = FALSE;
-static int trans[4] = {'a', 'c', 'g', 't'};
-
-AllocVar(ss);
-ss->extra = NULL;
-struct dyString *dyExtra = newDyString(128);
-
-int wordCount = lineFileChopNext(lf, row, ArraySize(row));
-if (!wordCount)
-    shortScoreScheme(lf);   // empty file
-boolean done = FALSE;
-while (! done)
-    {
-    // a setting will have an '=' in either first or second word
-    if (stringIn("=",row[0]) || (wordCount > 1 && stringIn("=", row[1])))
-         {
-         // collapse words to eliminate white space confusion
-         struct dyString *dy = newDyString(128);
-         for (i = 0; i < wordCount; ++i)
-             {
-             dyStringPrintf(dy, "%s", row[i]);
-             }
-         char *line=dyStringCannibalize(&dy);
-         // eliminate trailing comments
-         chopSuffixAt(line, '#');
-         // only tag=value is left, extract those two:
-         chopString(line, "=", parts, ArraySize(parts));
-         if (!(sameString(parts[0],"O") || sameString(parts[0],"E")))
-             dyStringPrintf(dyExtra, "%s=%s,", parts[0], parts[1]);
-         freeMem(line);
-         wordCount = lineFileChopNext(lf, row, ArraySize(row));
-         }
-    // not a setting, expecting a matrix definition
-    else if (row[0][0] != 'A' || row[1][0] != 'C' || row[2][0] != 'G' 
-            || row[3][0] != 'T')
-        errAbort("%s doesn't seem to be a score matrix file", lf->fileName);
-    else  // have reached the matrix definition at end of the file
-        {
-        for (i=0; i<4; ++i)
-            {
-            wordCount = lineFileChopNext(lf, row, ArraySize(row));
-            if (!wordCount)
-               shortScoreScheme(lf);   // did not find four lines
-            int startColumn = 0;
-            if (5 == wordCount)  // skip first column when there are 5
-                startColumn = 1;
-            for (j=startColumn; j<(startColumn+4); ++j)
-                ss->matrix[trans[i]][trans[j-startColumn]] = lineFileNeedNum(lf, row, j);
-            }
-        if (lineFileNext(lf, &line, NULL))
-            {
-            dyStringPrintf(dyExtra, "%s,", line);
-            partCount = chopString(line, " =,\t", parts, ArraySize(parts));
-            for (i=0; i<partCount-1; i += 2)
-                {
-                if (sameString(parts[i], "O"))
-                    {
-                    gotO = TRUE;
-                    ss->gapOpen = atoi(parts[i+1]);
-                    }
-                if (sameString(parts[i], "E"))
-                    {
-                    gotE = TRUE;
-                    ss->gapExtend = atoi(parts[i+1]);
-                    }
-                }
-            if (!gotO || !gotE)
-                errAbort("Expecting O = and E = in last line of %s", lf->fileName);
-            if (ss->gapOpen <= 0 || ss->gapExtend <= 0)
-                errAbort("Must have positive gap scores");
-            }
-        else
-            {
-            ss->gapOpen = 400;
-            ss->gapExtend = 30;
-            }
-        done = TRUE;
-        }
-    }
-ss->extra = dyStringCannibalize(&dyExtra);
-if (',' == lastChar(ss->extra))
-   trimLastChar(ss->extra);
-propagateCase(ss);
-return ss;
-}
-
-struct axtScoreScheme *axtScoreSchemeRead(char *fileName)
-/* Read in scoring scheme from file. Looks like
-    A    C    G    T
-    91 -114  -31 -123
-    -114  100 -125  -31
-    -31 -125  100 -114
-    -123  -31 -114   91
-    O = 400, E = 30
-*/
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct axtScoreScheme *ss = axtScoreSchemeReadLf(lf);
-return ss;
-}
-
-void axtScoreSchemeDnaWrite(struct axtScoreScheme *ss, FILE *f, char *name)
-/* output the score dna based score matrix in meta Data format to File f,
-name should be set to the name of the program that is using the matrix */
-{
-if (ss == NULL)
-    return;
-if (f == NULL)
-    return;
-fprintf(f, "##matrix=%s 16 %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
-        name,
-    ss->matrix['a']['a'],
-    ss->matrix['a']['c'],
-    ss->matrix['a']['g'],
-    ss->matrix['a']['t'],
-
-    ss->matrix['c']['a'],
-    ss->matrix['c']['c'],
-    ss->matrix['c']['g'],
-    ss->matrix['c']['t'],
-
-    ss->matrix['g']['a'],
-    ss->matrix['g']['c'],
-    ss->matrix['g']['g'],
-    ss->matrix['g']['t'],
-
-    ss->matrix['t']['a'],
-    ss->matrix['t']['c'],
-    ss->matrix['t']['g'],
-    ss->matrix['t']['t']);
-fprintf(f, "##gapPenalties=%s O=%d E=%d\n", name, ss->gapOpen, ss->gapExtend);
-if (ss->extra!=NULL)
-    {
-    stripChar(ss->extra,' ');
-    stripChar(ss->extra,'"');
-    fprintf(f, "##blastzParms=%s\n", ss->extra);
-    }
-}
-
-void axtSwap(struct axt *axt, int tSize, int qSize)
-/* Flip target and query on one axt. */
-{
-struct axt old = *axt;
-
-/* Copy non-strand dependent stuff */
-axt->qName = old.tName;
-axt->tName = old.qName;
-axt->qSym = old.tSym;
-axt->tSym = old.qSym;
-axt->qStart = old.tStart;
-axt->qEnd = old.tEnd;
-axt->tStart = old.qStart;
-axt->tEnd = old.qEnd;
-
-/* Copy strand dependent stuff. */
-assert(axt->tStrand != '-');
-
-if (axt->qStrand == '-')
-    {
-    /* axt's are really set up so that the target is on the
-     * + strand and the query is on the minus strand.
-     * Therefore we need to reverse complement both 
-     * strands while swapping to preserve this. */
-    reverseIntRange(&axt->tStart, &axt->tEnd, qSize);
-    reverseIntRange(&axt->qStart, &axt->qEnd, tSize);
-    reverseComplement(axt->qSym, axt->symCount);
-    reverseComplement(axt->tSym, axt->symCount);
-    }
-}
-
-void axtBundleFree(struct axtBundle **pObj)
-/* Free a axtBundle. */
-{
-struct axtBundle *obj = *pObj;
-if (obj != NULL)
-    {
-    axtFreeList(&obj->axtList);
-    freez(pObj);
-    }
-}
-
-void axtBundleFreeList(struct axtBundle **pList)
-/* Free a list of axtBundles. */
-{
-struct axtBundle *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    axtBundleFree(&el);
-    }
-*pList = NULL;
-}
-
-void axtAddBlocksToBoxInList(struct cBlock **pList, struct axt *axt)
-/* Add blocks (gapless subalignments) from (non-NULL!) axt to block list. 
- * Note: list will be in reverse order of axt blocks. */
-{
-boolean thisIn, lastIn = FALSE;
-int qPos = axt->qStart, tPos = axt->tStart;
-int qStart = 0, tStart = 0;
-int i;
-
-for (i=0; i<=axt->symCount; ++i)
-    {
-    int advanceQ = (isalpha(axt->qSym[i]) ? 1 : 0);
-    int advanceT = (isalpha(axt->tSym[i]) ? 1 : 0);
-    thisIn = (advanceQ && advanceT);
-    if (thisIn)
-        {
-	if (!lastIn)
-	    {
-	    qStart = qPos;
-	    tStart = tPos;
-	    }
-	}
-    else
-        {
-	if (lastIn)
-	    {
-	    int size = qPos - qStart;
-	    assert(size == tPos - tStart);
-	    if (size > 0)
-	        {
-		struct cBlock *b;
-		AllocVar(b);
-		b->qStart = qStart;
-		b->qEnd = qPos;
-		b->tStart = tStart;
-		b->tEnd = tPos;
-		slAddHead(pList, b);
-		}
-	    }
-	}
-    lastIn = thisIn;
-    qPos += advanceQ;
-    tPos += advanceT;
-    }
-}
-
-void axtPrintTraditionalExtra(struct axt *axt, int maxLine,
-			      struct axtScoreScheme *ss, FILE *f,
-			      boolean reverseTPos, boolean reverseQPos)
-/* Print out an alignment with line-breaks.  If reverseTPos is true, then
- * the sequence has been reverse complemented, so show the coords starting
- * at tEnd and decrementing down to tStart; likewise for reverseQPos. */
-{
-int qPos = axt->qStart;
-int tPos = axt->tStart;
-int symPos;
-int aDigits = digitsBaseTen(axt->qEnd);
-int bDigits = digitsBaseTen(axt->tEnd);
-int digits = max(aDigits, bDigits);
-int qFlipOff = axt->qEnd + axt->qStart;
-int tFlipOff = axt->tEnd + axt->tStart;
-
-for (symPos = 0; symPos < axt->symCount; symPos += maxLine)
-    {
-    /* Figure out which part of axt to use for this line. */
-    int lineSize = axt->symCount - symPos;
-    int lineEnd, i;
-    if (lineSize > maxLine)
-        lineSize = maxLine;
-    lineEnd = symPos + lineSize;
-
-    /* Draw query line including numbers. */
-    fprintf(f, "%0*d ", digits, (reverseQPos ? qFlipOff - qPos: qPos+1));
-    for (i=symPos; i<lineEnd; ++i)
-        {
-	char c = axt->qSym[i];
-	fputc(c, f);
-	if (c != '.' && c != '-')
-	    ++qPos;
-	}
-    fprintf(f, " %0*d\n", digits, (reverseQPos? qFlipOff - qPos + 1 : qPos));
-
-    /* Draw line with match/mismatch symbols. */
-    spaceOut(f, digits+1);
-    for (i=symPos; i<lineEnd; ++i)
-        {
-	char q = axt->qSym[i];
-	char t = axt->tSym[i];
-	char out = ' ';
-	if (q == t)
-	    out = '|';
-	else if (ss != NULL && ss->matrix[(int)q][(int)t] > 0)
-	    out = '+';
-	fputc(out, f);
-	}
-    fputc('\n', f);
-
-    /* Draw target line including numbers. */
-    fprintf(f, "%0*d ", digits, (reverseTPos ? tFlipOff - tPos : tPos+1));
-    for (i=symPos; i<lineEnd; ++i)
-        {
-	char c = axt->tSym[i];
-	fputc(c, f);
-	if (c != '.' && c != '-')
-	    ++tPos;
-	}
-    fprintf(f, " %0*d\n", digits, (reverseTPos ? tFlipOff - tPos + 1: tPos));
-
-    /* Draw extra empty line. */
-    fputc('\n', f);
-    }
-}
-
-double axtIdWithGaps(struct axt *axt)
-/* Return ratio of matching bases to total symbols in alignment. */
-{
-int i;
-int matchCount = 0;
-for (i=0; i<axt->symCount; ++i)
-    {
-    if (toupper(axt->qSym[i]) == toupper(axt->tSym[i]))
-        ++matchCount;
-    }
-return (double)matchCount/axt->symCount;
-}
-
-void axtPrintTraditional(struct axt *axt, int maxLine, struct axtScoreScheme *ss, FILE *f)
-/* Print out an alignment with line-breaks. */
-{
-axtPrintTraditionalExtra(axt, maxLine, ss, f, FALSE, FALSE);
-}
-
-double axtCoverage(struct axt *axt, int qSize, int tSize)
-/* Return % of q and t covered. */
-{
-double cov = axt->tEnd - axt->tStart + axt->qEnd - axt->qStart;
-return cov/(qSize+tSize);
-}
-
-void axtOutPretty(struct axt *axt, int lineSize, FILE *f)
-/* Output axt in pretty format. */
-{
-char *q = axt->qSym;
-char *t = axt->tSym;
-int size = axt->symCount;
-int oneSize, sizeLeft = size;
-int i;
-
-fprintf(f, ">%s:%d%c%d %s:%d-%d %d\n", 
-	axt->qName, axt->qStart, axt->qStrand, axt->qEnd,
-	axt->tName, axt->tStart, axt->tEnd, axt->score);
-while (sizeLeft > 0)
-    {
-    oneSize = sizeLeft;
-    if (oneSize > lineSize)
-        oneSize = lineSize;
-    mustWrite(f, q, oneSize);
-    fputc('\n', f);
-
-    for (i=0; i<oneSize; ++i)
-        {
-	if (toupper(q[i]) == toupper(t[i]) && isalpha(q[i]))
-	    fputc('|', f);
-	else
-	    fputc(' ', f);
-	}
-    fputc('\n', f);
-
-    if (oneSize > lineSize)
-        oneSize = lineSize;
-    mustWrite(f, t, oneSize);
-    fputc('\n', f);
-    fputc('\n', f);
-    sizeLeft -= oneSize;
-    q += oneSize;
-    t += oneSize;
-    }
-}
diff --git a/gbtools/src/blatSrc/lib/axtAffine.c b/gbtools/src/blatSrc/lib/axtAffine.c
deleted file mode 100644
index 1c7e383..0000000
--- a/gbtools/src/blatSrc/lib/axtAffine.c
+++ /dev/null
@@ -1,781 +0,0 @@
-/* axtAffine - do alignment of two (shortish) sequences with
- * affine gap scoring, and return the result as an axt. 
- * This file is copyright 2000-2004 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "pairHmm.h"
-#include "axt.h"
-
-
-
-boolean axtAffineSmallEnough(double querySize, double targetSize)
-/* Return TRUE if it is reasonable to align sequences of given sizes
- * with axtAffine. */
-{
-return targetSize * querySize <= 1.0E9;
-}
-
-static void affineAlign(char *query, int querySize, 
-	char *target, int targetSize, struct axtScoreScheme *ss,
-	struct phmmMatrix **retMatrix, struct phmmAliPair **retPairList,
-	int *retScore)
-/* Use dynamic programming to do alignment including affine gap
- * scores. */
-{
-struct phmmMatrix *a;
-struct phmmState *hf, *iq, *it;
-int qIx, tIx, sIx;  /* Query, target, and state indices */
-int rowOffset, newCellOffset;
-int bestScore = -0x4fffffff;
-struct phmmMommy *bestCell = NULL;
-int matchPair;
-int gapStart, gapExt;
-
-/* Check that it's not too big. */
-if (!axtAffineSmallEnough(querySize, targetSize))
-    errAbort("Can't align %d x %d, too big\n", querySize, targetSize);
-
-gapStart = -ss->gapOpen;
-gapExt = -ss->gapExtend;
-
-/* Initialize 3 state matrix (match, query insert, target insert). */
-a = phmmMatrixNew(3, query, querySize, target, targetSize);
-hf = phmmNameState(a, 0, "match", 'M');
-iq = phmmNameState(a, 1, "qSlip", 'Q');
-it = phmmNameState(a, 2, "tSlip", 'T');
-
-for (tIx = 1; tIx < a->tDim; tIx += 1)
-    {
-    UBYTE mommy = 0;
-    int score, tempScore;
-
-/* Macros to make me less mixed up when accessing scores from row arrays.*/
-#define matchScore lastScores[qIx-1]
-#define qSlipScore lastScores[qIx]
-#define tSlipScore scores[qIx-1]
-#define newScore scores[qIx]
-
-/* Start up state block (with all ways to enter state) */
-#define startState(state) \
-   score = 0;
-
-/* Define a transition from state while advancing over both
- * target and query. */
-#define matchState(state, addScore) \
-   { \
-   if ((tempScore = state->matchScore + addScore) > score) \
-        { \
-        mommy = phmmPackMommy(state->stateIx, -1, -1); \
-        score = tempScore; \
-        } \
-   } 
-
-/* Define a transition from state while slipping query
- * and advancing target. */
-#define qSlipState(state, addScore) \
-   { \
-   if ((tempScore = state->qSlipScore + addScore) > score) \
-        { \
-        mommy = phmmPackMommy(state->stateIx, 0, -1); \
-        score = tempScore; \
-        } \
-   }
-
-/* Define a transition from state while slipping target
- * and advancing query. */
-#define tSlipState(state, addScore) \
-   { \
-   if ((tempScore = state->tSlipScore + addScore) > score) \
-        { \
-        mommy = phmmPackMommy(state->stateIx, -1, 0); \
-        score = tempScore; \
-        } \
-   }
-
-/* End a block of transitions into state. */
-#define endState(state) \
-    { \
-    struct phmmMommy *newCell = state->cells + newCellOffset; \
-    if (score <= 0) \
-        { \
-        mommy = phmmNullMommy; \
-        score = 0; \
-        } \
-    newCell->mommy = mommy; \
-    state->newScore = score; \
-    if (score > bestScore) \
-        { \
-        bestScore = score; \
-        bestCell = newCell; \
-        } \
-    } 
-
-/* End a state that you know won't produce an optimal
- * final score. */
-#define shortEndState(state) \
-    { \
-    struct phmmMommy *newCell = state->cells + newCellOffset; \
-    if (score <= 0) \
-        { \
-        mommy = phmmNullMommy; \
-        score = 0; \
-        } \
-    newCell->mommy = mommy; \
-    state->newScore = score; \
-    }
-
-
-    rowOffset = tIx*a->qDim;
-    for (qIx = 1; qIx < a->qDim; qIx += 1)
-        {
-        newCellOffset = rowOffset + qIx;
-        
-        /* Figure the cost or bonus for pairing target and query residue here. */
-        matchPair = ss->matrix[(int)a->query[qIx-1]][(int)a->target[tIx-1]];
-
-        /* Update hiFi space. */
-            {
-            startState(hf);
-            matchState(hf, matchPair);
-            matchState(iq, matchPair);
-            matchState(it, matchPair);
-            endState(hf);
-            }
-
-        /* Update query slip space. */
-            {
-            startState(iq);
-            qSlipState(iq, gapExt);
-            qSlipState(hf, gapStart);            
-	    qSlipState(it, gapStart);	/* Allow double gaps, T first always. */
-            shortEndState(iq);
-            }
-        
-        /* Update target slip space. */
-            {
-            startState(it);
-            tSlipState(it, gapExt);
-            tSlipState(hf, gapStart);            
-            shortEndState(it);
-            }
-
-        }
-    /* Swap score columns so current becomes last, and last gets
-     * reused. */
-    for (sIx = 0; sIx < a->stateCount; ++sIx)
-        {
-        struct phmmState *as = &a->states[sIx];
-        int *swapTemp = as->lastScores;
-        as->lastScores = as->scores;
-        as->scores = swapTemp;
-        }
-    }
-
-/* Trace back from best scoring cell. */
-*retPairList = phmmTraceBack(a, bestCell);
-*retMatrix = a;
-*retScore = bestScore;
-
-#undef matchScore
-#undef qSlipScore
-#undef tSlipScore
-#undef newScore
-#undef startState
-#undef matchState
-#undef qSlipState
-#undef tSlipState
-#undef shortEndState
-#undef endState
-}
-
-struct axt *axtAffine(bioSeq *query, bioSeq *target, struct axtScoreScheme *ss)
-/* Return alignment if any of query and target using scoring scheme. */
-{
-struct axt *axt;
-int score;
-struct phmmMatrix *matrix;
-struct phmmAliPair *pairList;
-
-affineAlign(query->dna, query->size, target->dna, target->size, ss,
-	&matrix, &pairList, &score);
-axt = phhmTraceToAxt(matrix, pairList, score, query->name, target->name);
-phmmMatrixFree(&matrix);
-slFreeList(&pairList);
-return axt;
-}
-
-
-/* ----- axtAffine2Level begins ----- 
-
- Written by Galt Barber, December 2004
- I wrote this on my own time and am donating this
- to the public domain.  The original concept 
- was Don Speck's, as described by Kevin Karplus.
-
- @article{Grice97,
-     author = "J. A. Grice and R. Hughey and D. Speck",
-     title = "Reduced space sequence alignment",
-     journal = cabios,
-     volume=13,
-     number=1,
-     year=1997,
-     month=feb,
-     pages="45-53"
-     }
-								 
-
-*/
-
-#define WORST 0xC0000000 /* WORST Score approx neg. inf. 0x80000000 overflowed, reduced by half */
-
-
-/* m d i notation: match, delete, insert in query */
-
-struct cell2L 
-{
-int  bestm;   /* best score array */
-int  bestd;                         
-int  besti;                          
-char backm;   /* back trace array */
-char backd;                         
-char backi;                          
-};
-
-#ifdef DEBUG
-void dump2L(struct cell2L* c)
-/* print matrix cell for debugging 
-   I redirect output to a file 
-   and look at it with a web browser
-   to see the long lines
-*/
-{
-    printf("%04d%c %04d%c %04d%c   ",
-     c->bestd, c->backd,
-     c->bestm, c->backm,
-     c->besti, c->backi
-     );
-}     
-#endif
-
-void kForwardAffine(
-struct cell2L *cells,  /* dyn prg arr cells */
-int row,      /* starting row base */
-int rowmax,   /* ending row */
-int rdelta,   /* convert between real targ seq row and logical row */                             
-int cmost,    /* track right edge, shrink as traces back */
-int lv,       /* width of array including sentinel col 0 */ 
-char *q,      /* query and target seqs */
-char *t,
-struct axtScoreScheme *ss,  /* score scheme passed in */
-int *bestbestOut,  /* return best overall found, and it's row and col */
-int *bestrOut,
-int *bestcOut,
-char *bestdirOut
-)
-/*
-Calculates filling dynprg mtx forward.
- Called 3 times from affine2Level.
-
-row is offset into the actual best and back arrays,
- so rdelta serves as a conversion between
- the real target seq row and the logical row
- used in best and back arrays.
-
-cmost is a column limiter that lets us avoid
- unused areas of the array when doing the
- backtrace 2nd pass. This can be an average
- of half of the total array saved.
-
-*/
-{
-int r=0, rr=0;
-int gapOpen  =ss->gapOpen;    
-int gapExtend=ss->gapExtend;  
-int doubleGap=ss->gapExtend;  // this can be gapOpen or gapExtend, or custom ?
-struct cell2L *cellp,*cellc;  /* current and previous row base */
-struct cell2L *u,*d,*l,*s;    /* up,diag,left,self pointers to hopefully speed things up */
-int c=0;
-int bestbest = *bestbestOut; /* make local copy of best best */
-cellc = cells+(row-1)*lv;     /* start it off one row back coming into loop */
-
-#ifdef DEBUG
-for(c=0;c<=cmost;c++) /* show prev row */
-    { dump2L(cellc+c); }
-printf("\n");
-#endif
-
-for(r=row; r<=rowmax; r++)
-    {
-    cellp = cellc;
-    cellc += lv;    /* initialize pointers to curr and prev rows */
-    
-    rr = r+rdelta;
-
-    d = cellp;   /* diag is prev row, prev col */
-    l = cellc;   /* left is curr row, prev col */
-    u = d+1;     /*   up is prev row, curr col */
-    s = l+1;     /* self is curr row, curr col */
-    
-    /* handle col 0 sentinel as a delete */
-    l->bestm=WORST; 
-    l->bestd=d->bestd-gapExtend;
-    l->besti=WORST;                 
-    l->backm='x';
-    l->backd='d';
-    l->backi='x';
-    if (rr==1)    /* special case row 1 col 0 */
-	{
-	l->bestd=-gapOpen;
-	l->backd='m';
-	}
-#ifdef DEBUG
-    dump2L(cellc); 
-#endif
-    
-    for(c=1; c<=cmost; c++)
-	{
-
-	int best=WORST;
-	int try  =WORST;
-	char dir=' ';
-	/* note: is matrix symmetrical? if not we could have dim 1 and 2 backwards */
-	int subst = ss->matrix[(int)q[c-1]][(int)t[rr-1]];  /* score for pairing target and query. */
-
-	/* find best M match query and target */
-	best=WORST;
-	try=d->bestd;    
-	if (try > best)
-	    {
-	    best=try;
-	    dir='d';
-	    }
-	try=d->bestm;   
-	if (try > best)
-	    {
-	    best=try;
-	    dir='m';
-	    }
-	try=d->besti;   
-	if (try > best)
-	    {
-	    best=try;
-	    dir='i';
-	    }
-	try=0;                   /* local ali can start anywhere */
-	if (try > best)
-	    {
-	    best=try;
-	    dir='s';         
-	    }
-	best += subst;
-	s->bestm = best;
-	s->backm = dir;
-	if (best > bestbest)
-	    {
-	    bestbest=best;
-	    *bestbestOut=best;
-	    *bestrOut=rr;
-	    *bestcOut=c;
-	    *bestdirOut=dir;
-	    }
-
-	/* find best D delete in query */
-	best=WORST;
-	try=u->bestd - gapExtend;
-	if (try > best)
-	    {
-	    best=try;
-	    dir='d';
-	    }
-	try=u->bestm - gapOpen;    
-	if (try > best)
-	    {
-	    best=try;
-	    dir='m';
-	    }
-	try=u->besti - doubleGap;    
-	if (try > best)
-	    {
-	    best=try;
-	    dir='i';
-	    }
-	s->bestd = best;
-	s->backd = dir;
-	if (best > bestbest)
-	    {
-	    bestbest=best;
-	    *bestbestOut=best;
-	    *bestrOut=rr;
-	    *bestcOut=c;
-	    *bestdirOut=dir;
-	    }
-
-	/* find best I insert in query */
-	best=WORST;
-	try=l->bestd - doubleGap;
-	if (try > best)
-	    {
-	    best=try;
-	    dir='d';
-	    }
-	try=l->bestm - gapOpen;    
-	if (try > best)
-	    {
-	    best=try;
-	    dir='m';
-	    }
-	try=l->besti - gapExtend;    
-	if (try > best)
-	    {
-	    best=try;
-	    dir='i';
-	    }
-	s->besti = best;
-	s->backi = dir;
-	if (best > bestbest)
-	    {
-	    bestbest=best;
-	    *bestbestOut=best;
-	    *bestrOut=rr;
-	    *bestcOut=c;
-	    *bestdirOut=dir;
-	    }
-
-#ifdef DEBUG
-    dump2L(cellc+c); 
-#endif
-
-	d++;l++;u++;s++;
-
-	}
-#ifdef DEBUG
-printf("\n");
-#endif
-  
-    }
-} 
-
-
-
-struct axt *axtAffine2Level(bioSeq *query, bioSeq *target, struct axtScoreScheme *ss)
-/* 
-
-   (Moving boundary version, allows target T size twice as large in same ram)
-
-   Return alignment if any of query and target using scoring scheme. 
-   
-   2Level uses an economical amount of ram and should work for large target sequences.
-   
-   If Q is query size and T is target size and M is memory size, then
-   Total memory used M = 30*Q*sqrt(T).  When the target is much larger than the query
-   this method saves ram, and average runtime is only 50% greater, or 1.5 QT.  
-   If Q=5000 and T=245,522,847 for hg17 chr1, then M = 2.2 GB ram.  
-   axtAffine would need M=3QT = 3.4 TB.
-   Of course massive alignments will be painfully slow anyway.
-
-   Works for protein as well as DNA given the correct scoreScheme.
-  
-   NOTES:
-   Double-gap cost is equal to gap-extend cost, but gap-open would also work.
-   On very large target, score integer may overflow.
-   Input sequences not checked for invalid chars.
-   Input not checked but query should be shorter than target.
-   
-*/
-{
-struct axt *axt=needMem(sizeof(struct axt));
-
-char *q = query->dna;
-char *t = target->dna;
-
-int Q= query->size;
-int T=target->size;
-int lv=Q+1;                    /* Q+1 is used so often let's call it lv for q-width */
-int lw=T+1;                    /* T+1 is used so often let's call it lw for t-height */
-
-
-int r = 0;                                 /* row matrix index */
-int c = 0;                                 /* col matrix index */
-char dir=' ';                              /* dir for bt */
-int bestbest = WORST;                      /* best score in entire mtx */
-
-int k=0;                                   /* save every kth row (k decreasing) */
-int ksize = 0;                             /* T+1 saved rows as ksize, ksize-1,...,1*/
-int arrsize = 0;                           /* dynprg array size, +1 for 0 sentinel col. */
-struct cell2L *cells = NULL;               /* best score dyn prog array */
-int ki = 0;                                /* base offset into array */
-int cmost = Q;                             /* track right edge shrinkage during backtrace */
-int kmax = 0;                              /* rows range from ki to kmax */
-int rr = 0;                                /* maps ki base to actual target seq */
-int nrows = 0;                             /* num rows to do, usually k or less */
-int bestr = 0;                             /* remember best r,c,dir for local ali */
-int bestc = 0;           
-char bestdir = 0;
-int temp = 0;
-
-
-char *btq=NULL;      /* temp pointers to track ends of string while accumulating */
-char *btt=NULL;
-
-ksize = (int) (-1 + sqrt(8*lw+1))/2;    
-if (((ksize*(ksize+1))/2) < lw) 
-    {ksize++;}
-arrsize = (ksize+1) * lv;                 /* dynprg array size, +1 for lastrow that moves back up. */
-cells = needLargeMem(arrsize * sizeof(struct cell2L));   /* best score dyn prog array */
-
-#ifdef DEBUG
-printf("\n k=%d \n ksize=%d \n arrsize=%d \n Q,lv=%d,%d T=%d \n \n",k,ksize,arrsize,Q,lv,T);
-#endif
-
-axt->next = NULL;
-axt->qName = cloneString(query->name);
-axt->tName = cloneString(target->name);
-axt->qStrand ='+';
-axt->tStrand ='+';
-axt->frame = 0;
-axt->score=0;
-axt->qStart=0;
-axt->tStart=0;
-axt->qEnd=0;
-axt->tEnd=0;
-axt->symCount=0;
-axt->qSym=NULL;
-axt->tSym=NULL;
-
-if ((Q==0) || (T==0))
-    {
-    axt->qSym=cloneString("");
-    axt->tSym=cloneString("");
-    freez(&cells);
-    return axt; 
-    }
-
-
-
-/* initialize origin corner */
-    cells[0].bestm=0;
-    cells[0].bestd=WORST;
-    cells[0].besti=WORST;                 
-    cells[0].backm='x';
-    cells[0].backd='x';
-    cells[0].backi='x';
-#ifdef DEBUG
-    dump2L(cells); 
-#endif
-
-/* initialize row 0 col 1 */
-    cells[1].bestm=WORST;
-    cells[1].bestd=WORST;
-    cells[1].besti=-ss->gapOpen;
-    cells[1].backm='x';
-    cells[1].backd='x';
-    cells[1].backi='m';
-#ifdef DEBUG
-    dump2L(cells+1); 
-#endif
-
-/* initialize first row of sentinels */
-for (c=2;c<lv;c++)
-    {
-    cells[c].bestm=WORST;
-    cells[c].bestd=WORST;
-    cells[c].besti=cells[c-1].besti-ss->gapExtend;
-    cells[c].backm='x';
-    cells[c].backd='x';
-    cells[c].backi='i';
-#ifdef DEBUG
-    dump2L(cells+c); 
-#endif
-    }
-#ifdef DEBUG
-printf("\n");
-printf("\n");
-#endif
-
-k=ksize;
-
-ki++;  /* advance to next row */
-
-r=1;   /* r is really the rows all done */
-while(1)
-    {
-    nrows = k;  /* do k rows at a time, save every kth row on 1st pass */
-    if (nrows > (lw-r)) {nrows=lw-r;}  /* may get less than k on last set */
-    kmax = ki+nrows-1;
-
-    kForwardAffine(cells, ki, kmax, r-ki, cmost, lv, q, t, ss, &bestbest, &bestr, &bestc, &bestdir);
-#ifdef DEBUG
-printf("\n");
-#endif
-
-    r += nrows;
-
-    if (nrows == k)   /* got full set of k rows */
-	{
-	/* compress, save every kth row */     
-	/* optimize as a mem-copy */
-	memcpy(cells+ki*lv,cells+kmax*lv,sizeof(struct cell2L) *lv);    
-	}
-
-    if (r >= lw){break;} /* we are done */
-    
-    ki++;
-    k--;        /* decreasing k is "moving boundary" */
-}
-
-#ifdef DEBUG
-printf("\nFWD PASS DONE. bestbest=%d bestr=%d bestc=%d bestdir=%c \n\n",bestbest,bestr,bestc,bestdir);
-#endif
-
-/* start doing backtrace */
-    
-/* adjust for reverse pass */
-
-/* for local we automatically skip to bestr, bestc to begin tb */
-
-if (bestbest <= 0)  /* null alignment */
-    {
-    bestr=0;
-    bestc=0;
-    /* bestdir won't matter */
-    }
-
-r = bestr;
-c = bestc;
-dir = bestdir;
-cmost = c;
-
-axt->qEnd=bestc;
-axt->tEnd=bestr;
-
-temp = (2*ksize)+1;
-ki = (int)(temp-sqrt((temp*temp)-(8*r)))/2;
-rr = ((2*ksize*ki)+ki-(ki*ki))/2;
-kmax = ki+(r-rr);
-k = ksize - ki;
-
-
-/* now that we jumped back into saved start-points,
-   let's fill the array forward and start backtrace from there.
-*/
-
-#ifdef DEBUG
-printf("bestr=%d, bestc=%d, bestdir=%c k=%d, ki=%d, kmax=%d\n",bestr,bestc,bestdir,k,ki,kmax);
-#endif
-
-kForwardAffine(cells, ki+1, kmax, rr-ki, cmost, lv, q, t, ss, &bestbest, &bestr, &bestc, &bestdir);
-   
-#ifdef DEBUG
-printf("\n(initial)BKWD PASS DONE. cmost=%d r=%d c=%d dir=%c \n\n",cmost,r,c,dir);
-#endif
-
-
-/* backtrace */   
-
-/* handling for resulting ali'd strings when very long */
-
-axt->symCount=0;
-axt->qSym = needLargeMem((Q+T+1)*sizeof(char));
-axt->tSym = needLargeMem((Q+T+1)*sizeof(char));
-btq=axt->qSym;
-btt=axt->tSym;
-while(1)
-    {
-    while(1)
-	{
-#ifdef DEBUG
-	printf("bt: r=%d, c=%d, dir=%c \n",r,c,dir);
-#endif
-
-	
-    	if ((r==0) && (c==0)){break;} /* hit origin, done */
-	if (r<rr){break;} /* ran out of targ seq, backup and reload */
-	if (dir=='x'){errAbort("unexpected error backtracing");} /* x only at origin */
-	if (dir=='s'){break;}   /* hit start, local ali */
-	if (dir=='m') /* match */
-	    {
-	    *btq++=q[c-1];  /* accumulate alignment output strings */
-	    *btt++=t[r-1];  /* accumulate alignment output strings */
-	    axt->symCount++; 
-	    dir = cells[lv*(ki+r-rr)+c].backm;  /* follow backtrace */
-	    r--;            /* adjust coords to move in dir spec'd by back ptr */
-	    c--;
-	    cmost--;        /* decreases as query seq is aligned, so saves on unused areas */
-	    }
-	else
-	    {
-	    if (dir=='d')  /* delete in query (gap) */
-		{
-		*btq++='-';     /* accumulate alignment output strings */
-    		*btt++=t[r-1];  /* accumulate alignment output strings */
-    		axt->symCount++; 
-		dir = cells[lv*(ki+r-rr)+c].backd;  /* follow backtrace */
-    		r--;            /* adjust coords to move in dir spec'd by back ptr */
-		}
-	    else    /* insert in query (gap) */
-		{
-		*btq++=q[c-1];  /* accumulate alignment output strings */
-    		*btt++='-';     /* accumulate alignment output strings */
-    		axt->symCount++; 
-		dir = cells[lv*(ki+r-rr)+c].backi;  /* follow backtrace */
-    		c--;
-    		cmost--;        /* decreases as query seq is aligned, so saves on unused areas */
-		}
-	    }
-	
-	}
-
-    /* back up and do it again */
-    ki--;
-    k++;   /* k grows as we move back up */ 
-    rr-=k;
-    kmax = ki+k-1;
-
-    /* check for various termination conditions to stop main loop */
-    if (ki < 0) {break;}
-    if ((r==0)&&(c==0)) {break;}
-    if (dir=='s') {break;}
-
-    /* re-calculate array from previous saved kth row going back
-       this is how we save memory, but have to regenerate half on average
-       we are re-using the same call 
-     */
-
-#ifdef DEBUG
-printf("bestr=%d, bestc=%d, bestdir=%c k=%d, ki=%d, kmax=%d\n",bestr,bestc,bestdir,k,ki,kmax);
-#endif
-
-
-    kForwardAffine(cells, ki+1, kmax, rr-ki, cmost, lv, q, t, ss, &bestbest, &bestr, &bestc, &bestdir);
-
-#ifdef DEBUG
-    printf("\nBKWD PASS DONE. cmost=%d r=%d c=%d\n\n",cmost,r,c);
-#endif
-
-    }
-
-axt->qStart=c;
-axt->tStart=r;
-
-/* reverse backwards trace and zero-terminate strings */
-
-reverseBytes(axt->qSym,axt->symCount);
-reverseBytes(axt->tSym,axt->symCount);
-axt->qSym[axt->symCount]=0;
-axt->tSym[axt->symCount]=0;
-
-axt->score=bestbest;
-
-
-/* 
-should I test stringsize and if massively smaller, realloc string to save ram? 
-*/
-
-freez(&cells);
-
-return axt;
-}
-
-
-
diff --git a/gbtools/src/blatSrc/lib/bPlusTree.c b/gbtools/src/blatSrc/lib/bPlusTree.c
deleted file mode 100644
index 6b09e15..0000000
--- a/gbtools/src/blatSrc/lib/bPlusTree.c
+++ /dev/null
@@ -1,600 +0,0 @@
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-/* bptFile - B+ Trees.  These are a method of indexing data similar to binary trees, but 
- * with many children rather than just two at each node. They work well when stored on disk,
- * since typically only two or three disk accesses are needed to locate any particular
- * piece of data.  This implementation is *just* for disk based storage.  For memory
- * use the rbTree instead. Currently the implementation is just useful for data warehouse
- * type applications.  That is it implements a function to create a b+ tree from bulk data
- * (bptFileCreate) and a function to lookup a value given a key (bptFileFind) but not functions
- * to add or delete individual items.
- *
- * The layout of the file on disk is:
- *    header
- *    root node
- *    (other nodes)
- * In general when the tree is first built the higher level nodes are stored before the
- * lower level nodes.  It is possible if a b+ tree is dynamically updated for this to
- * no longer be strictly true, but actually currently the b+ tree code here doesn't implement
- * dynamic updates - it just creates a b+ tree from a sorted list.
- *
- * Each node can be one of two types - index or leaf.  The index nodes contain pointers
- * to child nodes.  The leaf nodes contain the actual data. 
- *
- * The layout of the file header is:
- *       <magic number>  4 bytes - The value bptSig (0x78CA8C91)
- *       <block size>    4 bytes - Number of children per block (not byte size of block)
- *       <key size>      4 bytes - Number of significant bytes in key
- *       <val size>      4 bytes - Number of bytes in value
- *       <item count>    8 bytes - Number of items in index
- *       <reserved2>     4 bytes - Always 0 for now
- *       <reserved3>     4 bytes - Always 0 for now
- * The magic number may be byte-swapped, in which case all numbers in the file
- * need to be byte-swapped. 
- *
- * The nodes start with a header:
- *       <is leaf>       1 byte  - 1 for leaf nodes, 0 for index nodes.
- *       <reserved>      1 byte  - Always 0 for now.
- *       <count>         2 bytes - The number of children/items in node
- * This is followed by count items.  For the index nodes the items are
- *       <key>           key size bytes - always written most significant byte first
- *       <offset>        8 bytes - Offset of child node in index file.
- * For leaf nodes the items are
- *       <key>           key size bytes - always written most significant byte first
- *       <val>           val sized bytes - the value associated with the key.
- * Note in general the leaf nodes may not be the same size as the index nodes, though in
- * the important case where the values are file offsets they will be.
- */
-
-#include "common.h"
-#include "sig.h"
-#include "udc.h"
-#include "bPlusTree.h"
-
-/* This section of code deals with locating a value in a b+ tree. */
-
-struct bptFile *bptFileAttach(char *fileName, struct udcFile *udc)
-/* Open up index file on previously open file, with header at current file position. */
-{
-/* Open file and allocate structure to hold info from header etc. */
-struct bptFile *bpt = needMem(sizeof(*bpt));
-bpt->fileName = fileName;
-bpt->udc = udc;
-
-/* Read magic number at head of file and use it to see if we are proper file type, and
- * see if we are byte-swapped. */
-bits32 magic;
-boolean isSwapped = FALSE;
-udcMustReadOne(udc, magic);
-if (magic != bptSig)
-    {
-    magic = byteSwap32(magic);
-    isSwapped = bpt->isSwapped = TRUE;
-    if (magic != bptSig)
-       errAbort("%s is not a bpt b-plus tree index file", fileName);
-    }
-
-/* Read rest of defined bits of header, byte swapping as needed. */
-bpt->blockSize = udcReadBits32(udc, isSwapped);
-bpt->keySize = udcReadBits32(udc, isSwapped);
-bpt->valSize = udcReadBits32(udc, isSwapped);
-bpt->itemCount = udcReadBits64(udc, isSwapped);
-
-/* Skip over reserved bits of header. */
-bits32 reserved32;
-udcMustReadOne(udc, reserved32);
-udcMustReadOne(udc, reserved32);
-
-/* Save position of root block of b+ tree. */
-bpt->rootOffset = udcTell(udc);
-
-return bpt;
-}
-
-void bptFileDetach(struct bptFile **pBpt)
-/* Detach and free up cirTree file opened with cirTreeFileAttach. */
-{
-freez(pBpt);
-}
-
-struct bptFile *bptFileOpen(char *fileName)
-/* Open up index file - reading header and verifying things. */
-{
-return bptFileAttach(cloneString(fileName), udcFileOpen(fileName, udcDefaultDir()));
-}
-
-void bptFileClose(struct bptFile **pBpt)
-/* Close down and deallocate index file. */
-{
-struct bptFile *bpt = *pBpt;
-if (bpt != NULL)
-    {
-    udcFileClose(&bpt->udc);
-    freeMem(bpt->fileName);
-    bptFileDetach(pBpt);
-    }
-}
-
-static boolean rFind(struct bptFile *bpt, bits64 blockStart, void *key, void *val)
-/* Find value corresponding to key.  If found copy value to memory pointed to by val and return 
- * true. Otherwise return false. */
-{
-/* Seek to start of block. */
-udcSeek(bpt->udc, blockStart);
-
-/* Read block header. */
-UBYTE isLeaf;
-UBYTE reserved;
-bits16 i, childCount;
-udcMustReadOne(bpt->udc, isLeaf);
-udcMustReadOne(bpt->udc, reserved);
-boolean isSwapped = bpt->isSwapped;
-childCount = udcReadBits16(bpt->udc, isSwapped);
-
-UBYTE keyBuf[bpt->keySize];   /* Place to put a key, buffered on stack. */
-
-if (isLeaf)
-    {
-    for (i=0; i<childCount; ++i)
-        {
-	udcMustRead(bpt->udc, keyBuf, bpt->keySize);
-	udcMustRead(bpt->udc, val, bpt->valSize);
-	if (memcmp(key, keyBuf, bpt->keySize) == 0)
-	    return TRUE;
-	}
-    return FALSE;
-    }
-else
-    {
-    /* Read and discard first key. */
-    udcMustRead(bpt->udc, keyBuf, bpt->keySize);
-
-    /* Scan info for first file offset. */
-    bits64 fileOffset = udcReadBits64(bpt->udc, isSwapped);
-
-    /* Loop through remainder. */
-    for (i=1; i<childCount; ++i)
-	{
-	udcMustRead(bpt->udc, keyBuf, bpt->keySize);
-	if (memcmp(key, keyBuf, bpt->keySize) < 0)
-	    break;
-	fileOffset = udcReadBits64(bpt->udc, isSwapped);
-	}
-    return rFind(bpt, fileOffset, key, val);
-    }
-}
-
-static void rFindMulti(struct bptFile *bpt, bits64 blockStart, void *key, struct slRef **pList)
-/* Find values corresponding to key and add them to pList.  You'll need to 
- * Do a slRefFreeListAndVals() on the list when done. */
-{
-/* Seek to start of block. */
-udcSeek(bpt->udc, blockStart);
-
-/* Read block header. */
-UBYTE isLeaf;
-UBYTE reserved;
-bits16 i, childCount;
-udcMustReadOne(bpt->udc, isLeaf);
-udcMustReadOne(bpt->udc, reserved);
-boolean isSwapped = bpt->isSwapped;
-childCount = udcReadBits16(bpt->udc, isSwapped);
-
-int keySize = bpt->keySize;
-UBYTE keyBuf[keySize];   /* Place to put a key, buffered on stack. */
-UBYTE valBuf[bpt->valSize];   /* Place to put a value, buffered on stack. */
-
-if (isLeaf)
-    {
-    for (i=0; i<childCount; ++i)
-        {
-	udcMustRead(bpt->udc, keyBuf, keySize);
-	udcMustRead(bpt->udc, valBuf, bpt->valSize);
-	if (memcmp(key, keyBuf, keySize) == 0)
-	    {
-	    void *val = cloneMem(valBuf, bpt->valSize);
-	    refAdd(pList, val);
-	    }
-	}
-    }
-else
-    {
-    /* Read first key and first file offset. */
-    udcMustRead(bpt->udc, keyBuf, keySize);
-    bits64 lastFileOffset = udcReadBits64(bpt->udc, isSwapped);
-    bits64 fileOffset = lastFileOffset;
-    int lastCmp = memcmp(key, keyBuf, keySize);
-
-    /* Loop through remainder. */
-    for (i=1; i<childCount; ++i)
-	{
-	udcMustRead(bpt->udc, keyBuf, keySize);
-	fileOffset = udcReadBits64(bpt->udc, isSwapped);
-	int cmp = memcmp(key, keyBuf, keySize);
-	if (lastCmp >= 0 && cmp <= 0)
-	    {
-	    bits64 curPos = udcTell(bpt->udc);
-	    rFindMulti(bpt, lastFileOffset, key, pList);
-	    udcSeek(bpt->udc, curPos);
-	    }
-	if (cmp < 0)
-	    return;
-	lastCmp = cmp;
-	lastFileOffset = fileOffset;
-	}
-    /* If made it all the way to end, do last one too. */
-    rFindMulti(bpt, fileOffset, key, pList);
-    }
-}
-
-
-static void rTraverse(struct bptFile *bpt, bits64 blockStart, void *context, 
-    void (*callback)(void *context, void *key, int keySize, void *val, int valSize) )
-/* Recursively go across tree, calling callback at leaves. */
-{
-/* Seek to start of block. */
-udcSeek(bpt->udc, blockStart);
-
-/* Read block header. */
-UBYTE isLeaf;
-UBYTE reserved;
-bits16 i, childCount;
-udcMustReadOne(bpt->udc, isLeaf);
-udcMustReadOne(bpt->udc, reserved);
-boolean isSwapped = bpt->isSwapped;
-childCount = udcReadBits16(bpt->udc, isSwapped);
-
-char keyBuf[bpt->keySize], valBuf[bpt->valSize];
-if (isLeaf)
-    {
-    for (i=0; i<childCount; ++i)
-        {
-	udcMustRead(bpt->udc, keyBuf, bpt->keySize);
-	udcMustRead(bpt->udc, valBuf, bpt->valSize);
-	callback(context, keyBuf, bpt->keySize, valBuf, bpt->valSize);
-	}
-    }
-else
-    {
-    bits64 fileOffsets[childCount];
-    /* Loop through to get file offsets of children. */
-    for (i=0; i<childCount; ++i)
-	{
-	udcMustRead(bpt->udc, keyBuf, bpt->keySize);
-	fileOffsets[i] = udcReadBits64(bpt->udc, isSwapped);
-	}
-    /* Loop through recursing on child offsets. */
-    for (i=0; i<childCount; ++i)
-	rTraverse(bpt, fileOffsets[i], context, callback);
-    }
-}
-
-static bits64 bptDataStart(struct bptFile *bpt)
-/* Return offset of first bit of data (as opposed to index) in file.  In hind sight I wish
- * this were stored in the header, but fortunately it's not that hard to compute. */
-{
-bits64 offset = bpt->rootOffset;
-for (;;)
-    {
-    /* Seek to block start */
-    udcSeek(bpt->udc, offset);
-
-    /* Read block header,  break if we are leaf. */
-    UBYTE isLeaf;
-    UBYTE reserved;
-    bits16 childCount;
-    udcMustReadOne(bpt->udc, isLeaf);
-    if (isLeaf)
-         break;
-    udcMustReadOne(bpt->udc, reserved);
-    boolean isSwapped = bpt->isSwapped;
-    childCount = udcReadBits16(bpt->udc, isSwapped);
-
-    /* Read and discard first key. */
-    char keyBuf[bpt->keySize];
-    udcMustRead(bpt->udc, keyBuf, bpt->keySize);
-
-    /* Get file offset of sub-block. */
-    offset = udcReadBits64(bpt->udc, isSwapped);
-    }
-return offset;
-}
-
-static bits64 bptDataOffset(struct bptFile *bpt, bits64 itemPos)
-/* Return position of file of data corresponding to given itemPos.  For first piece of
- * data pass in 0. */
-{
-if (itemPos >= bpt->itemCount)
-    errAbort("Item index %lld greater than item count %lld in %s", 
-	itemPos, bpt->itemCount, bpt->fileName);
-bits64 blockPos = itemPos/bpt->blockSize;
-bits32 insidePos = itemPos - blockPos*bpt->blockSize;
-int blockHeaderSize = 4;
-bits64 itemByteSize = bpt->valSize + bpt->keySize;
-bits64 blockByteSize = bpt->blockSize * itemByteSize + blockHeaderSize;
-bits64 blockOffset = blockByteSize*blockPos + bptDataStart(bpt);
-bits64 itemOffset = blockOffset + blockHeaderSize + itemByteSize * insidePos;
-return itemOffset;
-}
-
-void bptKeyAtPos(struct bptFile *bpt, bits64 itemPos, void *result)
-/* Fill in result with the key at given itemPos.  For first piece of data itemPos is 0 
- * Result must be at least bpt->keySize.  If result is a string it won't be zero terminated
- * by this routine.  Use bptStringKeyAtPos instead. */
-{
-bits64 offset = bptDataOffset(bpt, itemPos);
-udcSeek(bpt->udc, offset);
-udcMustRead(bpt->udc, result, bpt->keySize);
-}
-
-void bptStringKeyAtPos(struct bptFile *bpt, bits64 itemPos, char *result, int maxResultSize)
-/* Fill in result with the key at given itemPos.  The maxResultSize should be 1+bpt->keySize
- * to accommodate zero termination of string. */
-{
-assert(maxResultSize > bpt->keySize);
-bptKeyAtPos(bpt, itemPos, result);
-result[bpt->keySize] = 0;
-}
-
-static boolean bptFileFindMaybeMulti(struct bptFile *bpt, void *key, int keySize, int valSize,
-    boolean multi, void *singleVal, struct slRef **multiVal)
-/* Do either a single or multiple find depending in multi parameter.  Only one of singleVal
- * or multiVal should be non-NULL, depending on the same parameter. */
-{
-/* Check key size vs. file key size, and act appropriately.  If need be copy key to a local
- * buffer and zero-extend it. */
-if (keySize > bpt->keySize)
-    return FALSE;
-char keyBuf[bpt->keySize];
-if (keySize != bpt->keySize)
-    {
-    memcpy(keyBuf, key, keySize);
-    memset(keyBuf+keySize, 0, bpt->keySize - keySize);
-    key = keyBuf;
-    }
-
-/* Make sure the valSize matches what's in file. */
-if (valSize != bpt->valSize)
-    errAbort("Value size mismatch between bptFileFind (valSize=%d) and %s (valSize=%d)",
-    	valSize, bpt->fileName, bpt->valSize);
-
-if (multi)
-    {
-    rFindMulti(bpt, bpt->rootOffset, key, multiVal);
-    return *multiVal != NULL;
-    }
-else
-    return rFind(bpt, bpt->rootOffset, key, singleVal);
-}
-
-boolean bptFileFind(struct bptFile *bpt, void *key, int keySize, void *val, int valSize)
-/* Find value associated with key.  Return TRUE if it's found. 
-*  Parameters:
-*     bpt - file handle returned by bptFileOpen
-*     key - pointer to key string, which needs to be bpt->keySize long
-*     val - pointer to where to put retrieved value
-*/
-{
-return bptFileFindMaybeMulti(bpt, key, keySize, valSize, FALSE, val, NULL);
-}
-
-struct slRef *bptFileFindMultiple(struct bptFile *bpt, void *key, int keySize, int valSize)
-/* Find all values associated with key.  Store this in ->val item of returned list. 
- * Do a slRefFreeListAndVals() on list when done. */
-{
-struct slRef *list = NULL;
-bptFileFindMaybeMulti(bpt, key, keySize, valSize, TRUE, NULL, &list);
-slReverse(&list);
-return list;
-}
-
-void bptFileTraverse(struct bptFile *bpt, void *context,
-    void (*callback)(void *context, void *key, int keySize, void *val, int valSize) )
-/* Traverse bPlusTree on file, calling supplied callback function at each
- * leaf item. */
-{
-return rTraverse(bpt, bpt->rootOffset, context, callback);
-}
-
-
-/* This section of code deals with making balanced b+ trees given a sorted array as input.
- * The difficult part is mostly just calculating the offsets of various things.  As an example
- * if you had the sorted array:
- *   01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
- * and wanted to create a tree of block size 4, the resulting tree would have three levels
- * as so:
- *  01 17
- *  01 05 09 13   17 21 25
- *  01 02 03 04   05 06 07 08  09 10 11 12   13 14 15 16   17 18 19 20   21 22 23 24  25 26 27
- */
-
-static long xToY(int x, unsigned y)
-/* Return x to the Y power, with y usually small. */
-{
-long i, val = 1;
-for (i=0; i<y; ++i)
-    val *= x;
-return val;
-}
-
-static int bptCountLevels(int maxBlockSize, int itemCount)
-/* Count up number of levels needed in tree of given maximum block size. */
-{
-int levels = 1;
-while (itemCount > maxBlockSize)
-    {
-    itemCount = (itemCount + maxBlockSize - 1)  / maxBlockSize;
-    levels += 1;
-    }
-return levels;
-}
-
-
-static bits32 writeIndexLevel(bits16 blockSize, 
-	void *itemArray, int itemSize, long itemCount, 
-	bits32 indexOffset, int level, 
-	void (*fetchKey)(const void *va, char *keyBuf), bits32 keySize, bits32 valSize,
-	FILE *f)
-/* Write out a non-leaf level. */
-{
-char *items = itemArray;
-
-/* Calculate number of nodes to write at this level. */
-long slotSizePer = xToY(blockSize, level);   // Number of items per slot in node
-long nodeSizePer = slotSizePer * blockSize;  // Number of items per node
-long nodeCount = (itemCount + nodeSizePer - 1)/nodeSizePer;	
-
-
-/* Calculate sizes and offsets. */
-long bytesInIndexBlock = (bptBlockHeaderSize + blockSize * (keySize+sizeof(bits64)));
-long bytesInLeafBlock = (bptBlockHeaderSize + blockSize * (keySize+valSize));
-bits64 bytesInNextLevelBlock = (level == 1 ? bytesInLeafBlock : bytesInIndexBlock);
-bits64 levelSize = nodeCount * bytesInIndexBlock;
-bits64 endLevel = indexOffset + levelSize;
-bits64 nextChild = endLevel;
-
-
-UBYTE isLeaf = FALSE;
-UBYTE reserved = 0;
-
-long i,j;
-char keyBuf[keySize+1];
-keyBuf[keySize] = 0;
-for (i=0; i<itemCount; i += nodeSizePer)
-    {
-    /* Calculate size of this block */
-    long countOne = (itemCount - i + slotSizePer - 1)/slotSizePer;
-    if (countOne > blockSize)
-        countOne = blockSize;
-    bits16 shortCountOne = countOne;
-
-    /* Write block header. */
-    writeOne(f, isLeaf);
-    writeOne(f, reserved);
-    writeOne(f, shortCountOne);
-
-    /* Write out the slots that are used one by one, and do sanity check. */
-    int slotsUsed = 0;
-    long endIx = i + nodeSizePer;
-    if (endIx > itemCount)
-        endIx = itemCount;
-    for (j=i; j<endIx; j += slotSizePer)
-        {
-	void *item = items + j*itemSize;
-	memset(keyBuf, 0, keySize);
-	(*fetchKey)(item, keyBuf);
-	mustWrite(f, keyBuf, keySize);
-	writeOne(f, nextChild);
-	nextChild += bytesInNextLevelBlock;
-	++slotsUsed;
-	}
-    assert(slotsUsed == shortCountOne);
-
-    /* Write out empty slots as all zero. */
-    int slotSize = keySize + sizeof(bits64);
-    for (j=countOne; j<blockSize; ++j)
-	repeatCharOut(f, 0, slotSize);
-    }
-return endLevel;
-}
-
-static void writeLeafLevel(bits16 blockSize, void *itemArray, int itemSize, int itemCount, 
-	void (*fetchKey)(const void *va, char *keyBuf), bits32 keySize,
-	void* (*fetchVal)(const void *va), bits32 valSize,
-	FILE *f)
-/* Write out leaf level blocks. */
-{
-char *items = itemArray;
-int i,j;
-UBYTE isLeaf = TRUE;
-UBYTE reserved = 0;
-bits16 countOne;
-int countLeft = itemCount;
-char keyBuf[keySize+1];
-keyBuf[keySize] = 0;
-for (i=0; i<itemCount; i += countOne)
-    {
-    /* Write block header */
-    if (countLeft > blockSize)
-        countOne = blockSize;
-    else
-        countOne = countLeft;
-    writeOne(f, isLeaf);
-    writeOne(f, reserved);
-    writeOne(f, countOne);
-
-    /* Write out position in genome and in file for each item. */
-    for (j=0; j<countOne; ++j)
-        {
-	assert(i+j < itemCount);
-	void *item = items + (i+j)*itemSize;
-	memset(keyBuf, 0, keySize);
-	(*fetchKey)(item, keyBuf);
-	mustWrite(f, keyBuf, keySize);
-	mustWrite(f, (*fetchVal)(item), valSize);
-	}
-    
-    /* Pad out any unused bits of last block with zeroes. */
-    int slotSize = keySize + valSize;
-    for (j=countOne; j<blockSize; ++j)
-	repeatCharOut(f, 0, slotSize);
-
-    countLeft -= countOne;
-    }
-}
-
-void bptFileBulkIndexToOpenFile(void *itemArray, int itemSize, bits64 itemCount, bits32 blockSize,
-	void (*fetchKey)(const void *va, char *keyBuf), bits32 keySize,
-	void* (*fetchVal)(const void *va), bits32 valSize, FILE *f)
-/* Create a b+ tree index from a sorted array, writing output starting at current position
- * of an already open file.  See bptFileCreate for explanation of parameters. */
-{
-bits32 magic = bptSig;
-bits32 reserved = 0;
-writeOne(f, magic);
-writeOne(f, blockSize);
-writeOne(f, keySize);
-writeOne(f, valSize);
-writeOne(f, itemCount);
-writeOne(f, reserved);
-writeOne(f, reserved);
-bits64 indexOffset = ftell(f);
-
-/* Write non-leaf nodes. */
-int levels = bptCountLevels(blockSize, itemCount);
-int i;
-for (i=levels-1; i > 0; --i)
-    {
-    bits32 endLevelOffset = writeIndexLevel(blockSize, itemArray, itemSize, itemCount, indexOffset, 
-    	i, fetchKey, keySize, valSize, f);
-    indexOffset = ftell(f);
-    if (endLevelOffset != indexOffset)
-        internalErr();
-    }
-
-/* Write leaf nodes */
-writeLeafLevel(blockSize, itemArray, itemSize, itemCount, 
-	fetchKey, keySize, fetchVal, valSize, f);
-}
-
-void bptFileCreate(
-	void *itemArray, 	/* Sorted array of things to index. */
-	int itemSize, 		/* Size of each element in array. */
-	bits64 itemCount, 	/* Number of elements in array. */
-	bits32 blockSize,	/* B+ tree block size - # of children for each node. */
-	void (*fetchKey)(const void *va, char *keyBuf),  /* Given item, copy key to keyBuf */ 
-	bits32 keySize,					 /* Size of key */
-	void* (*fetchVal)(const void *va), 		 /* Given item, return pointer to value */
-	bits32 valSize, 				 /* Size of value */
-	char *fileName)                                  /* Name of output file. */
-/* Create a b+ tree index file from a sorted array. */
-
-{
-/* Open file and write header. */
-FILE *f = mustOpen(fileName, "wb");
-bptFileBulkIndexToOpenFile(itemArray, itemSize, itemCount, blockSize, fetchKey, keySize, 
-	fetchVal, valSize, f);
-carefulClose(&f);
-}
-
diff --git a/gbtools/src/blatSrc/lib/bamFile.c b/gbtools/src/blatSrc/lib/bamFile.c
deleted file mode 100644
index 1e5f58f..0000000
--- a/gbtools/src/blatSrc/lib/bamFile.c
+++ /dev/null
@@ -1,797 +0,0 @@
-/* bamFile -- interface to binary alignment format files using Heng Li's samtools lib. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "portable.h"
-#include "bamFile.h"
-#ifdef USE_BAM
-#include "htmshell.h"
-#include "udc.h"
-
-#ifdef KNETFILE_HOOKS
-// If KNETFILE_HOOKS is used (as recommended!), then we can simply call bam_index_load
-// without worrying about the samtools lib creating local cache files in cgi-bin:
-
-static bam_index_t *bamOpenIdx(char *fileOrUrl)
-/* If fileOrUrl has a valid accompanying .bai file, parse and return the index;
- * otherwise return NULL. */
-{
-bam_index_t *idx = bam_index_load(fileOrUrl);
-return idx;
-}
-
-#else// no KNETFILE_HOOKS
-// Oh well.  The unmodified samtools lib downloads .bai files into the current
-// working directory, which is cgi-bin -- not good.  So we need to temporarily
-// change to a trash directory, let samtools download there, then pop back to
-// cgi-bin.
-
-static char *getSamDir()
-/* Return the name of a trash dir for samtools to run in (it creates files in current dir)
- * and make sure the directory exists. */
-{
-static char *samDir = NULL;
-char *dirName = "samtools";
-if (samDir == NULL)
-    {
-    mkdirTrashDirectory(dirName);
-    size_t len = strlen(trashDir()) + 1 + strlen(dirName) + 1;
-    samDir = needMem(len);
-    safef(samDir, len, "%s/%s", trashDir(), dirName);
-    }
-return samDir;
-}
-
-static bam_index_t *bamOpenIdx(char *fileOrUrl)
-/* If fileOrUrl has a valid accompanying .bai file, parse and return the index;
- * otherwise return NULL. */
-{
-// When file is an URL, this caches the index file in addition to validating:
-// Since samtools's url-handling code saves the .bai file to the current directory,
-// chdir to a trash directory before calling bam_index_load, then chdir back.
-char *runDir = getCurrentDir();
-char *samDir = getSamDir();
-boolean usingUrl = (strstr(fileOrUrl, "tp://") || strstr(fileOrUrl, "https://"));
-if (usingUrl)
-    setCurrentDir(samDir);
-bam_index_t *idx = bam_index_load(fileOrUrl);
-if (usingUrl)
-    setCurrentDir(runDir);
-return idx;
-}
-
-#endif//ndef KNETFILE_HOOKS
-
-static void bamCloseIdx(bam_index_t **pIdx)
-/* Free unless already NULL. */
-{
-if (pIdx != NULL && *pIdx != NULL)
-    {
-    free(*pIdx); // Not freeMem, freez etc -- sam just uses malloc/calloc.
-    *pIdx = NULL;
-    }
-}
-
-boolean bamFileExists(char *fileOrUrl)
-/* Return TRUE if we can successfully open the bam file and its index file.
- * NOTE: this doesn't give enough diagnostics */
-{
-char *bamFileName = fileOrUrl;
-samfile_t *fh = samopen(bamFileName, "rb", NULL);
-// Check both fh and fh->header; non-NULL fh can have NULL header if header doesn't parse!
-if (fh != NULL && fh->header != NULL)
-    {
-    bam_index_t *idx = bamOpenIdx(bamFileName);
-    samclose(fh);
-    if (idx == NULL)
-	{
-	warn("bamFileExists: failed to read index corresponding to %s", bamFileName);
-	return FALSE;
-	}
-    bamCloseIdx(&idx);
-    bamClose(&fh);
-    return TRUE;
-    }
-return FALSE;
-}
-
-samfile_t *bamOpen(char *fileOrUrl, char **retBamFileName)
-/* Return an open bam file or errAbort (should be named bamMustOpen).
- * Return parameter if NON-null will return the file name (vestigial; long ago
- * there was a plan to use udcFuse filenames instead of URLs) */
-{
-char *bamFileName = fileOrUrl;
-if (retBamFileName != NULL)
-    *retBamFileName = bamFileName;
-
-#ifdef BAM_VERSION
-// suppress too verbose messages in samtools >= 0.1.18; see redmine #6491
-// This variable didn't exist in older versions of samtools (where BAM_VERSION wasn't defined).
-bam_verbose = 1;
-#endif
-
-samfile_t *fh = samopen(bamFileName, "rb", NULL);
-// Check both fh and fh->header; non-NULL fh can have NULL header if header doesn't parse!
-if (fh == NULL || fh->header == NULL)
-    {
-    boolean usingUrl = (strstr(fileOrUrl, "tp://") || strstr(fileOrUrl, "https://"));
-    struct dyString *urlWarning = dyStringNew(0);
-    if (usingUrl && fh == NULL)
-	{
-	dyStringAppend(urlWarning,
-		       ". If you are able to access the URL with your web browser, "
-		       "please try reloading this page.");
-	}
-    else if (fh != NULL && fh->header == NULL)
-	dyStringAppend(urlWarning, ": parser error while reading the file header.");
-    errAbort("Failed to open %s%s", fileOrUrl, urlWarning->string);
-    }
-return fh;
-}
-
-samfile_t *bamMustOpenLocal(char *fileName, char *mode, void *extraHeader)
-/* Open up sam or bam file or die trying.  The mode parameter is 
- *    "r" - open SAM to read
- *    "rb" - open BAM to read
- *    "w" - open SAM to write
- *    "wb" - open BAM to write
- * The extraHeader is generally NULL in the read case, and the write case
- * contains a pointer to a bam_header_t with information about the header.
- * The implementation is just a wrapper around samopen from the samtools library
- * that aborts with error message if there's a problem with the open. */
-{
-samfile_t *sf = samopen(fileName, mode, extraHeader);
-if (sf == NULL)
-    errnoAbort("Couldn't open %s.\n", fileName);
-return sf;
-}
-
-void bamClose(samfile_t **pSamFile)
-/* Close down a samfile_t */
-{
-if (pSamFile != NULL)
-    {
-    samclose(*pSamFile);
-    *pSamFile = NULL;
-    }
-}
-
-void bamFileAndIndexMustExist(char *fileOrUrl)
-/* Open both a bam file and its accompanying index or errAbort; this is what it
- * takes for diagnostic info to propagate up through errCatches in calling code. */
-{
-samfile_t *bamF = bamOpen(fileOrUrl, NULL);
-bam_index_t *idx = bamOpenIdx(fileOrUrl);
-if (idx == NULL)
-    errAbort("failed to read index file (.bai) corresponding to %s", fileOrUrl);
-bamCloseIdx(&idx);
-bamClose(&bamF);
-}
-
-void bamFetchAlreadyOpen(samfile_t *samfile, bam_index_t *idx, char *bamFileName, 
-			 char *position, bam_fetch_f callbackFunc, void *callbackData)
-/* With the open bam file, return items the same way with the callbacks as with bamFetch() */
-/* except in this case use an already-open bam file and index (use bam_index_load and free() for */
-/* the index). It seems a little strange to pass the filename in with the open bam, but */
-/* it's just used to report errors. */
-{
-int chromId, start, end;
-int ret = bam_parse_region(samfile->header, position, &chromId, &start, &end);
-if (ret != 0 && startsWith("chr", position))
-    ret = bam_parse_region(samfile->header, position+strlen("chr"), &chromId, &start, &end);
-if (ret != 0)
-    // If the bam file does not cover the current chromosome, OK
-    return;
-ret = bam_fetch(samfile->x.bam, idx, chromId, start, end, callbackData, callbackFunc);
-if (ret != 0)
-    warn("bam_fetch(%s, %s (chromId=%d) failed (%d)", bamFileName, position, chromId, ret);
-}
-
-void bamFetch(char *fileOrUrl, char *position, bam_fetch_f callbackFunc, void *callbackData,
-		 samfile_t **pSamFile)
-/* Open the .bam file, fetch items in the seq:start-end position range,
- * and call callbackFunc on each bam item retrieved from the file plus callbackData.
- * This handles BAM files with "chr"-less sequence names, e.g. from Ensembl. 
- * The pSamFile parameter is optional.  If non-NULL it will be filled in, just for
- * the benefit of the callback function, with the open samFile.  */
-{
-char *bamFileName = NULL;
-samfile_t *fh = bamOpen(fileOrUrl, &bamFileName);
-if (pSamFile != NULL)
-    *pSamFile = fh;
-bam_index_t *idx = bamOpenIdx(bamFileName);
-if (idx == NULL)
-    warn("bam_index_load(%s) failed.", bamFileName);
-else
-    {
-    bamFetchAlreadyOpen(fh, idx, bamFileName, position, callbackFunc, callbackData);
-    bamCloseIdx(&idx);
-    }
-bamClose(&fh);
-}
-
-boolean bamIsRc(const bam1_t *bam)
-/* Return TRUE if alignment is on - strand. */
-{
-const bam1_core_t *core = &bam->core;
-return (core->flag & BAM_FREVERSE);
-}
-
-void bamGetSoftClipping(const bam1_t *bam, int *retLow, int *retHigh, int *retClippedQLen)
-/* If retLow is non-NULL, set it to the number of "soft-clipped" (skipped) bases at
- * the beginning of the query sequence and quality; likewise for retHigh at end.
- * For convenience, retClippedQLen is the original query length minus soft clipping
- * (and the length of the query sequence that will be returned). */
-{
-unsigned int *cigarPacked = bam1_cigar(bam);
-const bam1_core_t *core = &bam->core;
-char op;
-int n = bamUnpackCigarElement(cigarPacked[0], &op);
-int low = (op == 'S') ? n : 0;
-n = bamUnpackCigarElement(cigarPacked[core->n_cigar-1], &op);
-int high = (op == 'S') ? n : 0;
-if (retLow != NULL)
-    *retLow = low;
-if (retHigh != NULL)
-    *retHigh = high;
-if (retClippedQLen != NULL)
-    *retClippedQLen = (core->l_qseq - low - high);
-}
-
-
-void bamUnpackQuerySequence(const bam1_t *bam, boolean useStrand, char *qSeq)
-/* Fill in qSeq with the nucleotide sequence encoded in bam.  The BAM format 
- * reverse-complements query sequence when the alignment is on the - strand,
- * so if useStrand is given we rev-comp it back to restore the original query 
- * sequence. */
-{
-const bam1_core_t *core = &bam->core;
-int qLen = core->l_qseq;
-uint8_t *packedQSeq = bam1_seq(bam);
-int i;
-for (i = 0; i < qLen; i++)
-    qSeq[i] = bam_nt16_rev_table[bam1_seqi(packedQSeq, i)];
-qSeq[i] = '\0';
-if (useStrand && bamIsRc(bam))
-    reverseComplement(qSeq, qLen);
-}
-
-char *bamGetQuerySequence(const bam1_t *bam, boolean useStrand)
-/* Allocate and return the nucleotide sequence encoded in bam.  The BAM format 
- * reverse-complements query sequence when the alignment is on the - strand,
- * so if useStrand is given we rev-comp it back to restore the original query 
- * sequence. */
-{
-const bam1_core_t *core = &bam->core;
-int qLen = core->l_qseq;
-char *qSeq = needMem(qLen+1);
-bamUnpackQuerySequence(bam, useStrand, qSeq);
-return qSeq;
-}
-
-UBYTE *bamGetQueryQuals(const bam1_t *bam, boolean useStrand)
-/* Return the base quality scores encoded in bam as an array of ubytes. */
-{
-const bam1_core_t *core = &bam->core;
-int qLen = core->l_qseq;
-UBYTE *arr = needMem(qLen);
-boolean isRc = useStrand && bamIsRc(bam);
-UBYTE *qualStr = bam1_qual(bam);
-int i;
-for (i = 0;  i < core->l_qseq;  i++)
-    {
-    int offset = isRc ? (qLen - 1 - i) : i;
-    arr[i] = (qualStr[0] == 255) ? 255 : qualStr[offset];
-    }
-return arr;
-}
-
-void bamUnpackCigar(const bam1_t *bam, struct dyString *dyCigar)
-/* Unpack CIGAR string into dynamic string */
-{
-unsigned int *cigarPacked = bam1_cigar(bam);
-const bam1_core_t *core = &bam->core;
-int i;
-for (i = 0;  i < core->n_cigar;  i++)
-    {
-    char op;
-    int n = bamUnpackCigarElement(cigarPacked[i], &op);
-    dyStringPrintf(dyCigar, "%d", n);
-    dyStringAppendC(dyCigar, op);
-    }
-}
-
-char *bamGetCigar(const bam1_t *bam)
-/* Return a BAM-enhanced CIGAR string, decoded from the packed encoding in bam. */
-{
-const bam1_core_t *core = &bam->core;
-struct dyString *dyCigar = dyStringNew(min(8, core->n_cigar*4));
-bamUnpackCigar(bam, dyCigar);
-return dyStringCannibalize(&dyCigar);
-}
-
-void bamShowCigarEnglish(const bam1_t *bam)
-/* Print out cigar in English e.g. "20 (mis)Match, 1 Deletion, 3 (mis)Match" */
-{
-unsigned int *cigarPacked = bam1_cigar(bam);
-const bam1_core_t *core = &bam->core;
-int i;
-for (i = 0;  i < core->n_cigar;  i++)
-    {
-    char op;
-    int n = bamUnpackCigarElement(cigarPacked[i], &op);
-    if (i > 0)
-	printf(", ");
-    switch (op)
-	{
-	case 'M': // match or mismatch (gapless aligned block)
-	    printf("%d (mis)Match", n);
-	    break;
-	case '=': // match
-	    printf("%d Match", n);
-	    break;
-	case 'X': // mismatch
-	    printf("%d Mismatch", n);
-	    break;
-	case 'I': // inserted in query
-	    printf("%d Insertion", n);
-	    break;
-	case 'S': // skipped query bases at beginning or end ("soft clipping")
-	    printf("%d Skipped", n);
-	    break;
-	case 'D': // deleted from query
-	    printf("%d Deletion", n);
-	    break;
-	case 'N': // long deletion from query (intron as opposed to small del)
-	    printf("%d deletioN", n);
-	    break;
-	case 'H': // skipped query bases not stored in record's query sequence ("hard clipping")
-	    printf("%d Hard clipped query", n);
-	    break;
-	case 'P': // P="silent deletion from padded reference sequence"
-	    printf("%d Padded / silent deletion", n);
-	    break;
-	default:
-	    errAbort("bamShowCigarEnglish: unrecognized CIGAR op %c -- update me", op);
-	}
-    }
-}
-
-static void descFlag(unsigned flag, unsigned bitMask, char *desc, boolean makeRed,
-	      boolean *retFirst)
-/* Describe a flag bit (or multi-bit mask) if it is set in flag. */
-{
-if ((flag & bitMask) == bitMask) // *all* bits in bitMask are set in flag
-    {
-    if (!*retFirst)
-	printf(" | ");
-    printf("<span%s>(<TT>0x%02x</TT>) %s</span>",
-	   (makeRed ? " style='color: red'" : ""), bitMask, desc);
-    *retFirst = FALSE;
-    }
-}
-
-void bamShowFlagsEnglish(const bam1_t *bam)
-/* Print out flags in English, e.g. "Mate is on '-' strand; Properly paired". */
-{
-const bam1_core_t *core = &bam->core;
-unsigned flag = core->flag;
-boolean first = TRUE;
-descFlag(flag, BAM_FDUP, "Optical or PCR duplicate", TRUE, &first);
-descFlag(flag, BAM_FQCFAIL, "QC failure", TRUE, &first);
-descFlag(flag, BAM_FSECONDARY, "Not primary alignment", TRUE, &first);
-descFlag(flag, BAM_FREAD2, "Read 2 of pair", FALSE, &first);
-descFlag(flag, BAM_FREAD1, "Read 1 of pair", FALSE, &first);
-descFlag(flag, BAM_FMREVERSE, "Mate is on '-' strand", FALSE, &first);
-descFlag(flag, BAM_FREVERSE, "Read is on '-' strand", FALSE, &first);
-descFlag(flag, BAM_FMUNMAP, "Mate is unmapped", TRUE, &first);
-if (flag & BAM_FUNMAP)
-    errAbort("Read is unmapped (what is it doing here?!?)");
-descFlag(flag, (BAM_FPROPER_PAIR | BAM_FPAIRED), "Properly paired", FALSE, &first);
-if ((flag & BAM_FPAIRED) && !(flag & BAM_FPROPER_PAIR))
-    descFlag(flag, BAM_FPAIRED, "Not properly paired", TRUE, &first);
-}
-
-int bamGetTargetLength(const bam1_t *bam)
-/* Tally up the alignment's length on the reference sequence from
- * bam's packed-int CIGAR representation. */
-{
-unsigned int *cigarPacked = bam1_cigar(bam);
-const bam1_core_t *core = &bam->core;
-int tLength=0;
-int i;
-for (i = 0;  i < core->n_cigar;  i++)
-    {
-    char op;
-    int n = bamUnpackCigarElement(cigarPacked[i], &op);
-    switch (op)
-	{
-	case 'M': // match or mismatch (gapless aligned block)
-	case '=': // match
-	case 'X': // mismatch
-	    tLength += n;
-	    break;
-	case 'I': // inserted in query
-	    break;
-	case 'D': // deleted from query
-	case 'N': // long deletion from query (intron as opposed to small del)
-	    tLength += n;
-	    break;
-	case 'S': // skipped query bases at beginning or end ("soft clipping")
-	case 'H': // skipped query bases not stored in record's query sequence ("hard clipping")
-	case 'P': // P="silent deletion from padded reference sequence" -- ignore these.
-	    break;
-	default:
-	    errAbort("bamGetTargetLength: unrecognized CIGAR op %c -- update me", op);
-	}
-    }
-return tLength;
-}
-
-bam1_t *bamClone(const bam1_t *bam)
-/* Return a newly allocated copy of bam. */
-{
-// Using typecasts to get around compiler complaints about bam being const:
-bam1_t *newBam = cloneMem((void *)bam, sizeof(*bam));
-newBam->data = cloneMem((void *)bam->data, bam->data_len*sizeof(bam->data[0]));
-return newBam;
-}
-
-void bamShowTags(const bam1_t *bam)
-/* Print out tags in HTML: bold key, no type indicator for brevity. */
-{
-// adapted from part of bam.c bam_format1:
-uint8_t *s = bam1_aux(bam);
-while (s < bam->data + bam->data_len)
-    {
-    uint8_t type, key[2];
-    key[0] = s[0]; key[1] = s[1];
-    s += 2; type = *s; ++s;
-    printf(" <B>%c%c</B>:", key[0], key[1]);
-    if (type == 'A') { printf("%c", *s); ++s; }
-    else if (type == 'C') { printf("%u", *s); ++s; }
-    else if (type == 'c') { printf("%d", *(int8_t*)s); ++s; }
-    else if (type == 'S') { printf("%u", *(uint16_t*)s); s += 2; }
-    else if (type == 's') { printf("%d", *(int16_t*)s); s += 2; }
-    else if (type == 'I') { printf("%u", *(uint32_t*)s); s += 4; }
-    else if (type == 'i') { printf("%d", *(int32_t*)s); s += 4; }
-    else if (type == 'f') { printf("%g", *(float*)s); s += 4; }
-    else if (type == 'd') { printf("%lg", *(double*)s); s += 8; }
-    else if (type == 'Z' || type == 'H')
-	{
-	htmTextOut(stdout, (char *)s);
-	s += strlen((char *)s) + 1;
-	}
-    }
-putc('\n', stdout);
-}
-
-char *bamGetTagString(const bam1_t *bam, char *tag, char *buf, size_t bufSize)
-/* If bam's tags include the given 2-character tag, place the value into 
- * buf (zero-terminated, trunc'd if nec) and return a pointer to buf,
- * or NULL if tag is not present. */
-{
-if (tag == NULL)
-    errAbort("NULL tag passed to bamGetTagString");
-if (! (isalpha(tag[0]) && isalnum(tag[1]) && tag[2] == '\0'))
-    errAbort("bamGetTagString: invalid tag '%s'", htmlEncode(tag));
-char *val = NULL;
-// adapted from part of bam.c bam_format1:
-uint8_t *s = bam1_aux(bam);
-while (s < bam->data + bam->data_len)
-    {
-    uint8_t type, key[2];
-    key[0] = s[0]; key[1] = s[1];
-    s += 2; type = *s; ++s;
-    if (key[0] == tag[0] && key[1] == tag[1])
-	{
-	if (type == 'A') { snprintf(buf, bufSize, "%c", *s);}
-	else if (type == 'C') { snprintf(buf, bufSize, "%u", *s); }
-	else if (type == 'c') { snprintf(buf, bufSize, "%d", *s); }
-	else if (type == 'S') { snprintf(buf, bufSize, "%u", *(uint16_t*)s); }
-	else if (type == 's') { snprintf(buf, bufSize, "%d", *(int16_t*)s); }
-	else if (type == 'I') { snprintf(buf, bufSize, "%u", *(uint32_t*)s); }
-	else if (type == 'i') { snprintf(buf, bufSize, "%d", *(int32_t*)s); }
-	else if (type == 'f') { snprintf(buf, bufSize, "%g", *(float*)s); }
-	else if (type == 'd') { snprintf(buf, bufSize, "%lg", *(double*)s); }
-	else if (type == 'Z' || type == 'H') strncpy(buf, (char *)s, bufSize);
-	else buf[0] = '\0';
-	buf[bufSize-1] = '\0'; // TODO: is this nec?? see man pages
-	val = buf;
-	break;
-	}
-    else
-	{
-	if (type == 'A' || type == 'C' || type == 'c') { ++s; }
-	else if (type == 'S' || type == 's') { s += 2; }
-	else if (type == 'I' || type == 'i' || type == 'f') { s += 4; }
-	else if (type == 'd') { s += 8; }
-	else if (type == 'Z' || type == 'H')
-	    {
-	    while (*s++);
-	    }
-	}
-    }
-return val;
-}
-
-void bamUnpackAux(const bam1_t *bam, struct dyString *dy)
-/* Unpack the tag:type:val part of bam into dy */
-{
-// adapted from part of bam.c bam_format1:
-uint8_t *s = bam1_aux(bam);
-boolean firstTime = TRUE;
-while (s < bam->data + bam->data_len)
-    {
-    if (firstTime)
-        firstTime = FALSE;
-    else
-        dyStringAppendC(dy, '\t');
-    dyStringAppendC(dy, *s++);
-    dyStringAppendC(dy, *s++);
-    dyStringAppendC(dy, ':');
-    dyStringAppendC(dy, s[0]);
-    dyStringAppendC(dy, ':');
-    uint8_t type = *s++;
-    if (type == 'A') { dyStringPrintf(dy, "%c", *s); ++s; }
-    else if (type == 'C') { dyStringPrintf(dy, "%u", *s); ++s; }
-    else if (type == 'c') { dyStringPrintf(dy, "%d", *s); ++s; }
-    else if (type == 'S') { dyStringPrintf(dy, "%u", *(uint16_t*)s); s += 2; }
-    else if (type == 's') { dyStringPrintf(dy, "%d", *(int16_t*)s); s += 2; }
-    else if (type == 'I') { dyStringPrintf(dy, "%u", *(uint32_t*)s); s += 4; }
-    else if (type == 'i') { dyStringPrintf(dy, "%d", *(int32_t*)s); s += 4; }
-    else if (type == 'f') { dyStringPrintf(dy, "%g", *(float*)s); s += 4; }
-    else if (type == 'd') { dyStringPrintf(dy, "%lg", *(double*)s); s += 8; }
-    else if (type == 'Z' || type == 'H')
-	{
-	dyStringAppend(dy, (char *)s);
-	s += strlen((char *)s) + 1;
-	}
-    }
-}
-
-struct bamChromInfo *bamChromList(samfile_t *fh)
-{
-/* Return list of chromosomes from bam header. We make no attempty to normalize chromosome names to UCSC format,
-   so list may contain things like "1" for "chr1", "I" for "chrI", "MT" for "chrM" etc. */
-int i;
-struct bamChromInfo *list = NULL;
-bam_header_t *bamHeader = fh->header;
-if(bamHeader == NULL)
-    return NULL;
-for(i = 0; i < bamHeader->n_targets; i++)
-    {
-    struct bamChromInfo *info = NULL;
-    AllocVar(info);
-    info->name = cloneString(bamHeader->target_name[i]);
-    info->size = bamHeader->target_len[i];
-    slAddHead(&list, info);
-    }
-slReverse(&list);
-return list;
-}
-
-void samToOpenBed(char *samIn, FILE *f)
-/* Like samToOpenBed, but the output is the already open file f. */
-{
-samfile_t *sf = samopen(samIn, "r", NULL);
-bam_header_t *bamHeader = sf->header;
-bam1_t one;
-ZeroVar(&one);
-int err;
-while ((err = samread(sf, &one)) >= 0)
-    {
-    int32_t tid = one.core.tid;
-    if (tid < 0)
-        continue;
-    char *chrom = bamHeader->target_name[tid];
-    // Approximate here... can do better if parse cigar.
-    int start = one.core.pos;
-    int size = one.core.l_qseq;
-    int end = start + size;	
-    boolean isRc = (one.core.flag & BAM_FREVERSE);
-    char strand = '+';
-    if (isRc)
-	{
-	strand = '-';
-	reverseIntRange(&start, &end, bamHeader->target_len[tid]);
-	}
-    fprintf(f, "%s\t%d\t%d\t.\t0\t%c\n", chrom, start, end, strand);
-    }
-if (err < 0 && err != -1)
-    errnoAbort("samread err %d", err);
-samclose(sf);
-}
-
-void samToBed(char *samIn, char *bedOut)
-/* samToBed - Convert SAM file to a pretty simple minded bed file.. */
-{
-FILE *f = mustOpen(bedOut, "w");
-samToOpenBed(samIn, f);
-carefulClose(&f);
-}
-
-#else
-// If we're not compiling with samtools, make stub routines so compile won't fail:
-
-boolean bamFileExists(char *bamFileName)
-/* Return TRUE if we can successfully open the bam file and its index file. */
-{
-warn(COMPILE_WITH_SAMTOOLS, "bamFileExists");
-return FALSE;
-}
-
-void bamFileAndIndexMustExist(char *fileOrUrl)
-/* Open both a bam file and its accompanying index or errAbort; this is what it
- * takes for diagnostic info to propagate up through errCatches in calling code. */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamFileAndIndexMustExist");
-}
-
-samfile_t *bamOpen(char *fileOrUrl, char **retBamFileName)
-/* Return an open bam file */
-{
-warn(COMPILE_WITH_SAMTOOLS, "bamOpen");
-return FALSE;
-}
-
-samfile_t *bamMustOpenLocal(char *fileName, char *mode, void *extraHeader)
-/* Open up sam or bam file or die trying.  The mode parameter is 
- *    "r" - open SAM to read
- *    "rb" - open BAM to read
- *    "w" - open SAM to write
- *    "wb" - open BAM to write
- * The extraHeader is generally NULL in the read case, and the write case
- * contains a pointer to a bam_header_t with information about the header.
- * The implementation is just a wrapper around samopen from the samtools library
- * that aborts with error message if there's a problem with the open. */
-{
-warn(COMPILE_WITH_SAMTOOLS, "bamMustOpenLocal");
-return FALSE;
-}
-
-void bamClose(samfile_t **pSamFile)
-/* Close down a samefile_t */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamClose");
-}
-
-void bamFetch(char *fileOrUrl, char *position, bam_fetch_f callbackFunc, void *callbackData,
-	      samfile_t **pSamFile)
-/* Open the .bam file, fetch items in the seq:start-end position range,
- * and call callbackFunc on each bam item retrieved from the file plus callbackData.
- * This handles BAM files with "chr"-less sequence names, e.g. from Ensembl.
- * The pSamFile parameter is optional.  If non-NULL it will be filled in, just for
- * the benefit of the callback function, with the open samFile.  */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamFetch");
-}
-
-boolean bamIsRc(const bam1_t *bam)
-/* Return TRUE if alignment is on - strand. */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamIsRc");
-return FALSE;
-}
-
-void bamGetSoftClipping(const bam1_t *bam, int *retLow, int *retHigh, int *retClippedQLen)
-/* If retLow is non-NULL, set it to the number of "soft-clipped" (skipped) bases at
- * the beginning of the query sequence and quality; likewise for retHigh at end.
- * For convenience, retClippedQLen is the original query length minus soft clipping
- * (and the length of the query sequence that will be returned). */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamGetSoftClipping");
-}
-
-char *bamGetQuerySequence(const bam1_t *bam, boolean useStrand)
-/* Return the nucleotide sequence encoded in bam.  The BAM format
- * reverse-complements query sequence when the alignment is on the - strand,
- * so if useStrand is given we rev-comp it back to restore the original query
- * sequence. */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamGetQuerySequence");
-return NULL;
-}
-
-UBYTE *bamGetQueryQuals(const bam1_t *bam, boolean useStrand)
-/* Return the base quality scores encoded in bam as an array of ubytes. */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamGetQueryQuals");
-return NULL;
-}
-
-char *bamGetCigar(const bam1_t *bam)
-/* Return a BAM-enhanced CIGAR string, decoded from the packed encoding in bam. */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamGetCigar");
-return NULL;
-}
-
-void bamShowCigarEnglish(const bam1_t *bam)
-/* Print out cigar in English e.g. "20 (mis)Match, 1 Deletion, 3 (mis)Match" */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamShowCigarEnglish");
-}
-
-void bamShowFlagsEnglish(const bam1_t *bam)
-/* Print out flags in English, e.g. "Mate is on '-' strand; Properly paired". */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamShowFlagsEnglish");
-}
-
-int bamGetTargetLength(const bam1_t *bam)
-/* Tally up the alignment's length on the reference sequence from
- * bam's packed-int CIGAR representation. */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamGetTargetLength");
-return 0;
-}
-
-bam1_t *bamClone(const bam1_t *bam)
-/* Return a newly allocated copy of bam. */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamClone");
-return NULL;
-}
-
-void bamShowTags(const bam1_t *bam)
-/* Print out tags in HTML: bold key, no type indicator for brevity. */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamShowTags");
-}
-
-char *bamGetTagString(const bam1_t *bam, char *tag, char *buf, size_t bufSize)
-/* If bam's tags include the given 2-character tag, place the value into
- * buf (zero-terminated, trunc'd if nec) and return a pointer to buf,
- * or NULL if tag is not present. */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamGetTagString");
-return NULL;
-}
-
-struct bamChromInfo *bamChromList(samfile_t *fh)
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "bamChromList");
-return NULL;
-}
-
-void samToBed(char *samIn, char *bedOut)
-/* samToBed - Convert SAM file to a pretty simple minded bed file.. */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "samToBed");
-}
-
-void samToOpenBed(char *samIn, FILE *bedOut)
-/* samToBed - Convert SAM file to a pretty simple minded bed file.. */
-{
-errAbort(COMPILE_WITH_SAMTOOLS, "samToOpenBed");
-}
-
-#endif//ndef USE_BAM
-
-static void bamChromInfoFree(struct bamChromInfo **pInfo)
-/* Free up one chromInfo */
-{
-struct bamChromInfo *info = *pInfo;
-if (info != NULL)
-    {
-    freeMem(info->name);
-    freez(pInfo);
-    }
-}
-
-void bamChromInfoFreeList(struct bamChromInfo **pList)
-/* Free a list of dynamically allocated bamChromInfo's */
-{
-struct bamChromInfo *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    bamChromInfoFree(&el);
-    }
-*pList = NULL;
-}
-
diff --git a/gbtools/src/blatSrc/lib/base64.c b/gbtools/src/blatSrc/lib/base64.c
deleted file mode 100644
index e5daf53..0000000
--- a/gbtools/src/blatSrc/lib/base64.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "base64.h"
-
-
-char *base64Encode(char *input, size_t inplen)
-/* Use base64 to encode a string.  Returns one long encoded
- * string which need to be freeMem'd. Note: big-endian algorithm.
- * For some applications you may need to break the base64 output
- * of this function into lines no longer than 76 chars.
- */
-{
-char b64[] = B64CHARS;
-int words = (inplen+2)/3;
-int remains = inplen % 3;
-char *result = (char *)needMem(4*words+1);
-size_t i=0, j=0;
-int word = 0;
-unsigned char *p = (unsigned char*) input;  
-/* p must be unsigned char*,  because without "unsigned",
-sign extend messes up last group outputted
-when the value of the chars following last in input
-happens to be char 0x80 or higher */
-for(i=1; i<=words; i++)
-    {
-    word = 0;
-    word |= *p++;
-    word <<= 8;
-    word |= *p++;
-    word <<= 8;
-    word |= *p++;
-    if (i==words && remains>0)
-	{
-	word &= 0x00FFFF00;
-    	if (remains==1)
-    	    word &= 0x00FF0000;
-	}
-    result[j++]=b64[word >> 18 & 0x3F];
-    result[j++]=b64[word >> 12 & 0x3F];
-    result[j++]=b64[word >> 6 & 0x3F];
-    result[j++]=b64[word & 0x3F];
-    }
-result[j] = 0;
-if (remains >0) result[j-1] = '=';    
-if (remains==1) result[j-2] = '=';    
-return result;
-}
-
-
-boolean base64Validate(char *input)
-/* Return true if input is valid base64.
- * Note that the input string is changed by 
- * eraseWhiteSpace(). */
-{
-size_t i = 0, l = 0;
-char *p = input;
-boolean validB64 = TRUE;
-
-/* remove whitespace which is unnecessary and  */
-eraseWhiteSpace(input);  
-
-l = strlen(p);
-for(i=0;i<l;i++)
-    {
-    char c = ' ';
-    if (!strchr(B64CHARS,c=*p++))
-        {
-        if (c != '=')
-            {
-            validB64 = FALSE;
-            break;
-            }
-        }
-    }
-if (l%4)
-    validB64 = FALSE;
-return validB64;
-}
-
-char *base64Decode(char *input, size_t *returnSize)
-/* Use base64 to decode a string.  Return decoded
- * string which will be freeMem'd. Note: big-endian algorithm.
- * Call eraseWhiteSpace() and check for invalid input 
- * before passing in input if needed.  
- * Optionally set return size for use with binary data.
- */
-{
-static int *map=NULL;
-char b64[] = B64CHARS;
-size_t inplen = strlen(input);
-int words = (inplen+3)/4;
-char *result = (char *)needMem(3*words+1);
-size_t i=0, j=0;
-int word = 0;
-char *p = input;
-
-if (!map)
-    {
-    int i = 0;
-    map = needMem(256*sizeof(int));
-    for (i = 0; i < 256; ++i)
-	{
-	map[i]=0;
-	}
-    for (i = 0; i < 64; ++i)
-	{
-	map[(int)b64[i]]=i;
-	}
-    }
-for(i=0; i<words; i++)
-    {
-    word = 0;
-    word |= map[(int)*p++];
-    word <<= 6;
-    word |= map[(int)*p++];
-    word <<= 6;
-    word |= map[(int)*p++];
-    word <<= 6;
-    word |= map[(int)*p++];
-    result[j++]=word >> 16 & 0xFF;
-    result[j++]=word >> 8 & 0xFF;
-    result[j++]=word & 0xFF;
-    }
-result[j] = 0;
-if (returnSize)
-    *returnSize = j;
-     
-return result;
-}
-
diff --git a/gbtools/src/blatSrc/lib/basicBed.c b/gbtools/src/blatSrc/lib/basicBed.c
deleted file mode 100644
index 93d8280..0000000
--- a/gbtools/src/blatSrc/lib/basicBed.c
+++ /dev/null
@@ -1,1752 +0,0 @@
-/* basicBed contains the basic code for Browser Extensible Data (bed) files and tables.
- * The idea behind bed is that the first three fields are defined and required.
- * A total of 15 fields are defined, and the file can contain any number of these.
- * In addition after any number of defined fields there can be custom fields that
- * are not defined in the bed spec.
- *
- * There's additional bed-related code in src/hg/inc/bed.h.  This module contains the
- * stuff that's independent of the database and other genomic structures. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-
-#include "common.h"
-#include "hash.h"
-#include "linefile.h"
-#include "dystring.h"
-#include "sqlNum.h"
-#include "sqlList.h"
-#include "rangeTree.h"
-#include "binRange.h"
-#include "asParse.h"
-#include "basicBed.h"
-
-
-void bedStaticLoad(char **row, struct bed *ret)
-/* Load a row from bed table into ret.  The contents of ret will
- * be replaced at the next call to this function. */
-{
-ret->chrom = row[0];
-ret->chromStart = sqlUnsigned(row[1]);
-ret->chromEnd = sqlUnsigned(row[2]);
-ret->name = row[3];
-}
-
-struct bed *bedLoad(char **row)
-/* Load a bed from row fetched with select * from bed
- * from database.  Dispose of this with bedFree(). */
-{
-struct bed *ret;
-AllocVar(ret);
-ret->chrom = cloneString(row[0]);
-ret->chromStart = sqlUnsigned(row[1]);
-ret->chromEnd = sqlUnsigned(row[2]);
-ret->name = cloneString(row[3]);
-return ret;
-}
-
-struct bed *bedCommaIn(char **pS, struct bed *ret)
-/* Create a bed out of a comma separated string. 
- * This will fill in ret if non-null, otherwise will
- * return a new bed */
-{
-char *s = *pS;
-
-if (ret == NULL)
-    AllocVar(ret);
-ret->chrom = sqlStringComma(&s);
-ret->chromStart = sqlUnsignedComma(&s);
-ret->chromEnd = sqlUnsignedComma(&s);
-ret->name = sqlStringComma(&s);
-*pS = s;
-return ret;
-}
-
-void bedFree(struct bed **pEl)
-/* Free a single dynamically allocated bed such as created
- * with bedLoad(). */
-{
-struct bed *el;
-
-if ((el = *pEl) == NULL) return;
-freeMem(el->chrom);
-freeMem(el->name);
-freeMem(el->blockSizes);
-freeMem(el->chromStarts);
-freeMem(el->expIds);
-freeMem(el->expScores);
-freez(pEl);
-}
-
-void bedFreeList(struct bed **pList)
-/* Free a list of dynamically allocated bed's */
-{
-struct bed *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    bedFree(&el);
-    }
-*pList = NULL;
-}
-
-void bedOutput(struct bed *el, FILE *f, char sep, char lastSep) 
-/* Print out bed.  Separate fields with sep. Follow last field with lastSep. */
-{
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->chrom);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%u", el->chromStart);
-fputc(sep,f);
-fprintf(f, "%u", el->chromEnd);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->name);
-if (sep == ',') fputc('"',f);
-fputc(lastSep,f);
-}
-
-/* --------------- End of AutoSQL generated code. --------------- */
-
-int bedCmp(const void *va, const void *vb)
-/* Compare to sort based on chrom,chromStart. */
-{
-const struct bed *a = *((struct bed **)va);
-const struct bed *b = *((struct bed **)vb);
-int dif;
-dif = strcmp(a->chrom, b->chrom);
-if (dif == 0)
-    dif = a->chromStart - b->chromStart;
-return dif;
-}
-
-int bedCmpEnd(const void *va, const void *vb)
-/* Compare to sort based on chrom,chromEnd. */
-{
-const struct bed *a = *((struct bed **)va);
-const struct bed *b = *((struct bed **)vb);
-int dif;
-dif = strcmp(a->chrom, b->chrom);
-if (dif == 0)
-    dif = a->chromEnd - b->chromEnd;
-return dif;
-}
-
-int bedCmpScore(const void *va, const void *vb)
-/* Compare to sort based on score - lowest first. */
-{
-const struct bed *a = *((struct bed **)va);
-const struct bed *b = *((struct bed **)vb);
-return a->score - b->score;
-}
-
-int bedCmpPlusScore(const void *va, const void *vb)
-/* Compare to sort based on chrom,chromStart. */
-{
-const struct bed *a = *((struct bed **)va);
-const struct bed *b = *((struct bed **)vb);
-int dif;
-dif = strcmp(a->chrom, b->chrom);
-if (dif == 0)
-    {
-    dif = (a->chromStart - b->chromStart) * 1000 +(a->score - b->score);
-    }
-return dif;
-}
-
-int bedCmpSize(const void *va, const void *vb)
-/* Compare to sort based on size of element (end-start == size) */
-{
-const struct bed *a = *((struct bed **)va);
-const struct bed *b = *((struct bed **)vb);
-int a_size = a->chromEnd - a->chromStart;
-int b_size = b->chromEnd - b->chromStart;
-return (a_size - b_size);
-}
-
-int bedCmpChromStrandStart(const void *va, const void *vb)
-/* Compare to sort based on chrom,strand,chromStart. */
-{
-const struct bed *a = *((struct bed **)va);
-const struct bed *b = *((struct bed **)vb);
-int dif;
-dif = strcmp(a->chrom, b->chrom);
-if (dif == 0)
-    dif = strcmp(a->strand, b->strand);
-if (dif == 0)
-    dif = a->chromStart - b->chromStart;
-return dif;
-}
-
-struct bedLine *bedLineNew(char *line)
-/* Create a new bedLine based on tab-separated string s. */
-{
-struct bedLine *bl;
-char *s, c;
-
-AllocVar(bl);
-bl->chrom = cloneString(line);
-s = strchr(bl->chrom, '\t');
-if (s == NULL)
-    errAbort("Expecting tab in bed line %s", line);
-*s++ = 0;
-c = *s;
-if (isdigit(c) || (c == '-' && isdigit(s[1])))
-    {
-    bl->chromStart = atoi(s);
-    bl->line = s;
-    return bl;
-    }
-else
-    {
-    errAbort("Expecting start position in second field of %s", line);
-    return NULL;
-    }
-}
-
-void bedLineFree(struct bedLine **pBl)
-/* Free up memory associated with bedLine. */
-{
-struct bedLine *bl;
-
-if ((bl = *pBl) != NULL)
-    {
-    freeMem(bl->chrom);
-    freez(pBl);
-    }
-}
-
-void bedLineFreeList(struct bedLine **pList)
-/* Free a list of dynamically allocated bedLine's */
-{
-struct bedLine *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    bedLineFree(&el);
-    }
-*pList = NULL;
-}
-
-
-int bedLineCmp(const void *va, const void *vb)
-/* Compare to sort based on query. */
-{
-const struct bedLine *a = *((struct bedLine **)va);
-const struct bedLine *b = *((struct bedLine **)vb);
-int dif;
-dif = strcmp(a->chrom, b->chrom);
-if (dif == 0)
-    dif = a->chromStart - b->chromStart;
-return dif;
-}
-
-
-void bedSortFile(char *inFile, char *outFile)
-/* Sort a bed file (in place, overwrites old file. */
-{
-struct lineFile *lf = NULL;
-FILE *f = NULL;
-struct bedLine *blList = NULL, *bl;
-char *line;
-int lineSize;
-
-verbose(2, "Reading %s\n", inFile);
-lf = lineFileOpen(inFile, TRUE);
-while (lineFileNext(lf, &line, &lineSize))
-    {
-    if (line[0] == '#')
-        continue;
-    bl = bedLineNew(line);
-    slAddHead(&blList, bl);
-    }
-lineFileClose(&lf);
-
-verbose(2, "Sorting\n");
-slSort(&blList, bedLineCmp);
-
-verbose(2, "Writing %s\n", outFile);
-f = mustOpen(outFile, "w");
-for (bl = blList; bl != NULL; bl = bl->next)
-    {
-    fprintf(f, "%s\t%s\n", bl->chrom, bl->line);
-    if (ferror(f))
-        {
-	perror("Writing error\n");
-	errAbort("%s is truncated, sorry.", outFile);
-	}
-    }
-fclose(f);
-}
-
-struct bed *bedLoad3(char **row)
-/* Load first three fields of bed. */
-{
-struct bed *ret;
-AllocVar(ret);
-ret->chrom = cloneString(row[0]);
-ret->chromStart = sqlUnsigned(row[1]);
-ret->chromEnd = sqlUnsigned(row[2]);
-return ret;
-}
-
-struct bed *bedLoad5(char **row)
-/* Load first five fields of bed. */
-{
-struct bed *ret;
-AllocVar(ret);
-ret->chrom = cloneString(row[0]);
-ret->chromStart = sqlUnsigned(row[1]);
-ret->chromEnd = sqlUnsigned(row[2]);
-ret->name = cloneString(row[3]);
-ret->score = sqlSigned(row[4]);
-return ret;
-}
-
-struct bed *bedLoad6(char **row)
-/* Load first six fields of bed. */
-{
-struct bed *ret = bedLoad5(row);
-safef(ret->strand, sizeof(ret->strand), "%s", row[5]);
-return ret;
-}
-
-/* it turns out that it isn't just hgLoadBed and custom tracks
- *	that may encounter the r,g,b specification.  Any program that
- *	reads bed files may enconter them, so take care of them
- *	at any time.  The strchr() function is very fast which will
- *	be a failure in the vast majority of cases parsing integers,
- *	therefore, this shouldn't be too severe a performance hit.
- */
-static int itemRgbColumn(char *column9)
-{
-int itemRgb = 0;
-/*  Allow comma separated list of rgb values here   */
-char *comma = strchr(column9, ',');
-if (comma)
-    {
-    if (-1 == (itemRgb = bedParseRgb(column9)))
-	errAbort("ERROR: expecting r,g,b specification, "
-		    "found: '%s'", column9);
-    }
-else
-    itemRgb = sqlUnsigned(column9);
-return itemRgb;
-}
-
-struct bed *bedLoad12(char **row)
-/* Load a bed from row fetched with select * from bed
- * from database.  Dispose of this with bedFree(). */
-{
-struct bed *ret;
-int sizeOne;
-
-AllocVar(ret);
-ret->blockCount = sqlSigned(row[9]);
-ret->chrom = cloneString(row[0]);
-ret->chromStart = sqlUnsigned(row[1]);
-ret->chromEnd = sqlUnsigned(row[2]);
-ret->name = cloneString(row[3]);
-ret->score = sqlSigned(row[4]);
-strcpy(ret->strand, row[5]);
-ret->thickStart = sqlUnsigned(row[6]);
-ret->thickEnd = sqlUnsigned(row[7]);
-ret->itemRgb = itemRgbColumn(row[8]);
-sqlSignedDynamicArray(row[10], &ret->blockSizes, &sizeOne);
-assert(sizeOne == ret->blockCount);
-sqlSignedDynamicArray(row[11], &ret->chromStarts, &sizeOne);
-assert(sizeOne == ret->blockCount);
-return ret;
-}
-
-struct bed *bedLoadN(char *row[], int wordCount)
-/* Convert a row of strings to a bed. */
-{
-struct bed * bed;
-int count;
-
-AllocVar(bed);
-bed->chrom = cloneString(row[0]);
-bed->chromStart = sqlUnsigned(row[1]);
-bed->chromEnd = sqlUnsigned(row[2]);
-if (wordCount > 3)
-     bed->name = cloneString(row[3]);
-if (wordCount > 4)
-     bed->score = sqlSigned(row[4]);
-if (wordCount > 5)
-     bed->strand[0] = row[5][0];
-if (wordCount > 6)
-     bed->thickStart = sqlUnsigned(row[6]);
-else
-     bed->thickStart = bed->chromStart;
-if (wordCount > 7)
-     bed->thickEnd = sqlUnsigned(row[7]);
-else
-     bed->thickEnd = bed->chromEnd;
-if (wordCount > 8)
-    bed->itemRgb = itemRgbColumn(row[8]);
-if (wordCount > 9)
-    bed->blockCount = sqlUnsigned(row[9]);
-if (wordCount > 10)
-    sqlSignedDynamicArray(row[10], &bed->blockSizes, &count);
-if (wordCount > 11)
-    sqlSignedDynamicArray(row[11], &bed->chromStarts, &count);
-if (wordCount > 12)
-    bed->expCount = sqlUnsigned(row[12]);
-if (wordCount > 13)
-    sqlSignedDynamicArray(row[13], &bed->expIds, &count);
-if (wordCount > 14)
-    sqlFloatDynamicArray(row[14], &bed->expScores, &count);
-return bed;
-}
-
-struct bed *bedLoadNAllChrom(char *fileName, int numFields, char* chrom) 
-/* Load bed entries from a tab-separated file that have the given chrom.
- * Dispose of this with bedFreeList(). */
-{
-struct bed *list = NULL, *el;
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *row[numFields];
-
-while (lineFileRow(lf, row))
-    {
-    el = bedLoadN(row, numFields);
-    if(chrom == NULL || sameString(el->chrom, chrom))
-        slAddHead(&list, el);
-    else
-        bedFree(&el);
-    }
-lineFileClose(&lf);
-slReverse(&list);
-return list;
-}
-
-struct bed *bedLoadNAll(char *fileName, int numFields) 
-/* Load all bed from a tab-separated file.
- * Dispose of this with bedFreeList(). */
-{
-return bedLoadNAllChrom(fileName, numFields, NULL);
-}
-
-struct bed *bedLoadAll(char *fileName)
-/* Determines how many fields are in a bedFile and load all beds from
- * a tab-separated file.  Dispose of this with bedFreeList(). */
-{
-struct bed *list = NULL;
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *line, *row[bedKnownFields];
-
-while (lineFileNextReal(lf, &line))
-    {
-    int numFields = chopByWhite(line, row, ArraySize(row));
-    if (numFields < 4)
-	errAbort("file %s doesn't appear to be in bed format. At least 4 fields required, got %d", fileName, numFields);
-    slAddHead(&list, bedLoadN(row, numFields));
-    }
-lineFileClose(&lf);
-slReverse(&list);
-return list;
-}
-
-void bedLoadAllReturnFieldCountAndRgb(char *fileName, struct bed **retList, int *retFieldCount, 
-    boolean *retRgb)
-/* Load bed of unknown size and return number of fields as well as list of bed items.
- * Ensures that all lines in bed file have same field count.  Also returns whether 
- * column 9 is being used as RGB or not. */
-{
-struct bed *list = NULL;
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *line, *row[bedKnownFields];
-int fieldCount = 0;
-boolean isRgb = FALSE;
-
-while (lineFileNextReal(lf, &line))
-    {
-    int numFields = chopByWhite(line, row, ArraySize(row));
-    if (numFields < 4)
-	errAbort("file %s doesn't appear to be in bed format. At least 4 fields required, got %d", 
-		fileName, numFields);
-    if (fieldCount == 0)
-	{
-        fieldCount = numFields;
-	if (fieldCount >= 9)
-	    isRgb =  (strchr(row[8], ',') != NULL);
-	}
-    else
-        if (fieldCount != numFields)
-	    errAbort("Inconsistent number of fields in file. %d on line %d of %s, %d previously.",
-	        numFields, lf->lineIx, lf->fileName, fieldCount);
-    slAddHead(&list, bedLoadN(row, fieldCount));
-    }
-lineFileClose(&lf);
-slReverse(&list);
-*retList = list;
-*retFieldCount = fieldCount;
-if (retRgb != NULL)
-   *retRgb = isRgb;
-}
-
-void bedLoadAllReturnFieldCount(char *fileName, struct bed **retList, int *retFieldCount)
-/* Load bed of unknown size and return number of fields as well as list of bed items.
- * Ensures that all lines in bed file have same field count. */
-{
-bedLoadAllReturnFieldCountAndRgb(fileName, retList, retFieldCount, NULL);
-}
-
-void bedOutFlexible(struct bed *el, int wordCount, FILE *f,
-	char sep, char lastSep, boolean useItemRgb)
-/* Write a bed of wordCount fields, optionally interpreting field nine as R,G,B values. */
-{
-int i;
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->chrom);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%u", el->chromStart);
-fputc(sep,f);
-fprintf(f, "%u", el->chromEnd);
-if (wordCount <= 3)
-    {
-    fputc(lastSep, f);
-    return;
-    }
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->name);
-if (sep == ',') fputc('"',f);
-if (wordCount <= 4)
-    {
-    fputc(lastSep, f);
-    return;
-    }
-fputc(sep,f);
-fprintf(f, "%d", el->score);
-if (wordCount <= 5)
-    {
-    fputc(lastSep, f);
-    return;
-    }
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->strand);
-if (sep == ',') fputc('"',f);
-if (wordCount <= 6)
-    {
-    fputc(lastSep, f);
-    return;
-    }
-fputc(sep,f);
-fprintf(f, "%u", el->thickStart);
-if (wordCount <= 7)
-    {
-    fputc(lastSep, f);
-    return;
-    }
-fputc(sep,f);
-fprintf(f, "%u", el->thickEnd);
-if (wordCount <= 8)
-    {
-    fputc(lastSep, f);
-    return;
-    }
-fputc(sep,f);
-if (useItemRgb)
-    fprintf(f, "%d,%d,%d", (el->itemRgb & 0xff0000) >> 16,
-        (el->itemRgb & 0xff00) >> 8, (el->itemRgb & 0xff));
-else
-    fprintf(f, "%u", el->itemRgb);
-if (wordCount <= 9)
-    {
-    fputc(lastSep, f);
-    return;
-    }
-fputc(sep,f);
-fprintf(f, "%d", el->blockCount);
-if (wordCount <= 10)
-    {
-    fputc(lastSep, f);
-    return;
-    }
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->blockCount; ++i)
-    {
-    fprintf(f, "%d", el->blockSizes[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-if (wordCount <= 11)
-    {
-    fputc(lastSep, f);
-    return;
-    }
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->blockCount; ++i)
-    {
-    fprintf(f, "%d", el->chromStarts[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-
-if (wordCount <= 12)
-    {
-    fputc(lastSep, f);
-    return;
-    }
-fputc(sep,f);
-fprintf(f, "%d", el->expCount);
-
-if (wordCount <= 13)
-    {
-    fputc(lastSep, f);
-    return;
-    }
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->expCount; ++i)
-    {
-    fprintf(f, "%d", el->expIds[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-
-
-if (wordCount <= 14)
-    {
-    fputc(lastSep, f);
-    return;
-    }
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->expCount; ++i)
-    {
-    fprintf(f, "%g", el->expScores[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-
-
-fputc(lastSep,f);
-}
-
-void bedOutputN(struct bed *el, int wordCount, FILE *f, char sep, char lastSep)
-/* Write a bed of wordCount fields. */
-{
-bedOutFlexible(el, wordCount, f, sep, lastSep, FALSE);
-}
-
-void bedOutputNitemRgb(struct bed *el, int wordCount, FILE *f,
-	char sep, char lastSep)
-/* Write a bed of wordCount fields, interpret column 9 as RGB. */
-{
-bedOutFlexible(el, wordCount, f, sep, lastSep, TRUE);
-}
-
-
-int bedTotalBlockSize(struct bed *bed)
-/* Return total size of all blocks. */
-{
-int total = 0;
-int i;
-if (bed->blockCount == 0)
-    return bed->chromEnd - bed->chromStart;
-for (i=0; i<bed->blockCount; ++i)
-    total += bed->blockSizes[i];
-return total;
-}
-
-int bedBlockSizeInRange(struct bed *bed, int rangeStart, int rangeEnd)
-/* Get size of all parts of all exons between rangeStart and rangeEnd. */
-{
-int total = 0;
-int i;
-for (i=0; i<bed->blockCount; ++i)
-    {
-    int start = bed->chromStart + bed->chromStarts[i];
-    int end = start + bed->blockSizes[i];
-    total += positiveRangeIntersection(start, end, rangeStart, rangeEnd);
-    }
-return total;
-}
-
-int bedTotalThickBlockSize(struct bed *bed)
-/* Return total size of all thick blocks. */
-{
-return bedBlockSizeInRange(bed, bed->thickStart, bed->thickEnd);
-}
-
-int bedStartThinSize(struct bed *bed)
-/* Return total size of all blocks before thick part. */
-{
-return bedBlockSizeInRange(bed, bed->chromStart, bed->thickStart);
-}
-
-int bedEndThinSize(struct bed *bed)
-/* Return total size of all blocks after thick part. */
-{
-return bedBlockSizeInRange(bed, bed->thickEnd, bed->chromEnd);
-}
-
-struct bed *bedFromPsl(struct psl *psl)
-/* Convert a single psl to a bed structure */
-{
-struct bed *bed;
-int i, blockCount, *chromStarts, chromStart;
-
-/* A tiny bit of error checking on the psl. */
-if (psl->qStart >= psl->qEnd || psl->qEnd > psl->qSize 
-    || psl->tStart >= psl->tEnd || psl->tEnd > psl->tSize)
-    {
-    errAbort("mangled psl format for %s", psl->qName);
-    }
-
-/* Allocate bed and fill in from psl. */
-AllocVar(bed);
-bed->chrom = cloneString(psl->tName);
-bed->chromStart = bed->thickStart = chromStart = psl->tStart;
-bed->chromEnd = bed->thickEnd = psl->tEnd;
-bed->score = 1000 - 2*pslCalcMilliBad(psl, TRUE);
-if (bed->score < 0) bed->score = 0;
-bed->strand[0] = psl->strand[0];
-bed->blockCount = blockCount = psl->blockCount;
-bed->blockSizes = (int *)cloneMem(psl->blockSizes,(sizeof(int)*psl->blockCount));
-if (pslIsProtein(psl))
-    {
-    /* Convert blockSizes from protein to dna. */
-    for (i=0; i<blockCount; ++i)
-	bed->blockSizes[i] *= 3;
-    }
-bed->chromStarts = chromStarts = (int *)cloneMem(psl->tStarts, (sizeof(int)*psl->blockCount));
-bed->name = cloneString(psl->qName);
-
-/* Switch minus target strand to plus strand. */
-if (psl->strand[1] == '-')
-    {
-    int chromSize = psl->tSize;
-    reverseInts(bed->blockSizes, blockCount);
-    reverseInts(chromStarts, blockCount);
-    for (i=0; i<blockCount; ++i)
-	chromStarts[i] = chromSize - chromStarts[i] - bed->blockSizes[i];
-    if (bed->strand[0] == '-')
-	bed->strand[0] = '+';
-    else
-	bed->strand[0] = '-';
-    }
-
-/* Convert coordinates to relative. */
-for (i=0; i<blockCount; ++i)
-    chromStarts[i] -= chromStart;
-return bed;
-}
-
-void makeItBed12(struct bed *bedList, int numFields)
-/* If it's less than bed 12, make it bed 12. The numFields */
-/* param is for how many fields the bed *currently* has. */
-{
-int i = 1;
-struct bed *cur;
-for (cur = bedList; cur != NULL; cur = cur->next)
-    {
-    /* it better be bigger than bed 3. */
-    if (numFields < 4)
-	{
-	char name[50];
-	safef(name, ArraySize(name), "item.%d", i+1);
-	cur->name = cloneString(name);
-	}
-    if (numFields < 5)
-	cur->score = 1000;
-    if (numFields < 6)
-	{
-	cur->strand[0] = '?';
-	cur->strand[1] = '\0';
-	}
-    if (numFields < 8)
-	{
-	cur->thickStart = cur->chromStart;
-	cur->thickEnd = cur->chromEnd;
-	}
-    if (numFields < 9)
-	cur->itemRgb = 0;
-    if (numFields < 12)
-	{
-	cur->blockSizes = needMem(sizeof(int));
-	cur->chromStarts = needMem(sizeof(int));
-	cur->blockCount = 1;
-	cur->chromStarts[0] = 0;
-	cur->blockSizes[0] = cur->chromEnd - cur->chromStart;
-	}
-    i++;
-    }
-}
-
-struct bed *lmCloneBed(struct bed *bed, struct lm *lm)
-/* Make a copy of bed in local memory. */
-{
-struct bed *newBed;
-if (bed == NULL)
-    return NULL;
-lmAllocVar(lm, newBed);
-newBed->chrom = lmCloneString(lm, bed->chrom);
-newBed->chromStart = bed->chromStart;
-newBed->chromEnd = bed->chromEnd;
-newBed->name = lmCloneString(lm, bed->name);
-newBed->score = bed->score;
-strncpy(newBed->strand, bed->strand, sizeof(bed->strand));
-newBed->thickStart = bed->thickStart;
-newBed->thickEnd = bed->thickEnd;
-newBed->itemRgb = bed->itemRgb;
-newBed->blockCount = bed->blockCount;
-if (bed->blockCount > 0)
-    {
-    newBed->blockSizes = lmCloneMem(lm, bed->blockSizes, 
-    	sizeof(bed->blockSizes[0]) * bed->blockCount);
-    newBed->chromStarts = lmCloneMem(lm, bed->chromStarts, 
-    	sizeof(bed->chromStarts[0]) * bed->blockCount);
-    }
-newBed->expCount = bed->expCount;
-if (bed->expCount > 0)
-    {
-    newBed->expIds = lmCloneMem(lm, bed->expIds, 
-    	sizeof(bed->expIds[0]) * bed->expCount);
-    newBed->expScores = lmCloneMem(lm, bed->expScores, 
-    	sizeof(bed->expScores[0]) * bed->expCount);
-    }
-return(newBed);
-}
-
-
-struct bed *cloneBed(struct bed *bed)
-/* Make an all-newly-allocated copy of a single bed record. */
-{
-struct bed *newBed;
-if (bed == NULL)
-    return NULL;
-AllocVar(newBed);
-newBed->chrom = cloneString(bed->chrom);
-newBed->chromStart = bed->chromStart;
-newBed->chromEnd = bed->chromEnd;
-newBed->name = cloneString(bed->name);
-newBed->score = bed->score;
-strncpy(newBed->strand, bed->strand, sizeof(bed->strand));
-newBed->thickStart = bed->thickStart;
-newBed->thickEnd = bed->thickEnd;
-newBed->itemRgb = bed->itemRgb;
-newBed->blockCount = bed->blockCount;
-if (bed->blockCount > 0)
-    {
-    newBed->blockSizes = needMem(sizeof(int) * bed->blockCount);
-    memcpy(newBed->blockSizes, bed->blockSizes,
-	   sizeof(int) * bed->blockCount);
-    newBed->chromStarts = needMem(sizeof(int) * bed->blockCount);
-    memcpy(newBed->chromStarts, bed->chromStarts,
-	   sizeof(int) * bed->blockCount);
-    }
-newBed->expCount = bed->expCount;
-if (bed->expCount > 0)
-    {
-    newBed->expIds = needMem(sizeof(int) * bed->expCount);
-    memcpy(newBed->expIds, bed->expIds,
-	   sizeof(int) * bed->expCount);
-    newBed->expScores = needMem(sizeof(float) * bed->expCount);
-    memcpy(newBed->expScores, bed->expScores,
-	   sizeof(float) * bed->expCount);
-    }
-return(newBed);
-}
-
-
-struct bed *cloneBedList(struct bed *bedList)
-/* Make an all-newly-allocated list copied from bed. */
-{
-struct bed *bedListOut = NULL, *bed=NULL;
-
-for (bed=bedList;  bed != NULL;  bed=bed->next)
-    {
-    struct bed *newBed = cloneBed(bed);
-    slAddHead(&bedListOut, newBed);
-    }
-
-slReverse(&bedListOut);
-return bedListOut;
-}
-
-struct bed *bedListNextDifferentChrom(struct bed *bedList)
-/* Return next bed in list that is from a different chrom than the start of the list. */
-{
-char *firstChrom = bedList->chrom;
-struct bed *bed;
-for (bed = bedList->next; bed != NULL; bed = bed->next)
-    if (!sameString(firstChrom, bed->chrom))
-        break;
-return bed;
-}
-
-struct bed *bedCommaInN(char **pS, struct bed *ret, int fieldCount)
-/* Create a bed out of a comma separated string looking for fieldCount
- * fields. This will fill in ret if non-null, otherwise will return a
- * new bed */
-{
-char *s = *pS;
-int i;
-
-if (ret == NULL)
-    AllocVar(ret);
-ret->chrom = sqlStringComma(&s);
-ret->chromStart = sqlUnsignedComma(&s);
-ret->chromEnd = sqlUnsignedComma(&s);
-if (fieldCount > 3)
-    ret->name = sqlStringComma(&s);
-if (fieldCount > 4)
-    ret->score = sqlUnsignedComma(&s);
-if (fieldCount > 5)
-    sqlFixedStringComma(&s, ret->strand, sizeof(ret->strand));
-if (fieldCount > 6)
-    ret->thickStart = sqlUnsignedComma(&s);
-else
-    ret->thickStart = ret->chromStart;
-if (fieldCount > 7)
-    ret->thickEnd = sqlUnsignedComma(&s);
-else
-     ret->thickEnd = ret->chromEnd;
-if (fieldCount > 8)
-    ret->itemRgb = sqlUnsignedComma(&s);
-if (fieldCount > 9)
-    ret->blockCount = sqlUnsignedComma(&s);
-if (fieldCount > 10)
-    {
-    s = sqlEatChar(s, '{');
-    AllocArray(ret->blockSizes, ret->blockCount);
-    for (i=0; i<ret->blockCount; ++i)
-	{
-	ret->blockSizes[i] = sqlSignedComma(&s);
-	}
-    s = sqlEatChar(s, '}');
-    s = sqlEatChar(s, ',');
-    }
-if(fieldCount > 11)
-    {
-    s = sqlEatChar(s, '{');
-    AllocArray(ret->chromStarts, ret->blockCount);
-    for (i=0; i<ret->blockCount; ++i)
-	{
-	ret->chromStarts[i] = sqlSignedComma(&s);
-	}
-    s = sqlEatChar(s, '}');
-    s = sqlEatChar(s, ',');
-    }
-if (fieldCount > 12)
-    ret->expCount = sqlSignedComma(&s);
-if (fieldCount > 13)
-    {
-    s = sqlEatChar(s, '{');
-    AllocArray(ret->expIds, ret->expCount);
-    for (i=0; i<ret->expCount; ++i)
-	{
-	ret->expIds[i] = sqlSignedComma(&s);
-	}
-    s = sqlEatChar(s, '}');
-    s = sqlEatChar(s, ',');
-    }
-if (fieldCount > 14)
-    {
-    s = sqlEatChar(s, '{');
-    AllocArray(ret->expScores, ret->expCount);
-    for (i=0; i<ret->expCount; ++i)
-	{
-	ret->expScores[i] = sqlFloatComma(&s);
-	}
-    s = sqlEatChar(s, '}');
-    s = sqlEatChar(s, ',');
-    }
-*pS = s;
-return ret;
-}
-
-struct hash *readBedToBinKeeper(char *sizeFileName, char *bedFileName, int wordCount)
-/* Read a list of beds and return results in hash of binKeeper structure for fast query
- * See also bedsIntoKeeperHash, which takes the beds read into a list already, but
- * dispenses with the need for the sizeFile. */
-{
-struct binKeeper *bk; 
-struct bed *bed;
-struct lineFile *lf = lineFileOpen(sizeFileName, TRUE);
-struct lineFile *bf = lineFileOpen(bedFileName , TRUE);
-struct hash *hash = newHash(0);
-char *chromRow[2];
-char *row[3] ;
-
-assert (wordCount == 3);
-while (lineFileRow(lf, chromRow))
-    {
-    char *name = chromRow[0];
-    int size = lineFileNeedNum(lf, chromRow, 1);
-
-    if (hashLookup(hash, name) != NULL)
-        warn("Duplicate %s, ignoring all but first\n", name);
-    else
-        {
-        bk = binKeeperNew(0, size);
-        assert(size > 1);
-	hashAdd(hash, name, bk);
-        }
-    }
-while (lineFileNextRow(bf, row, ArraySize(row)))
-    {
-    bed = bedLoadN(row, wordCount);
-    bk = hashMustFindVal(hash, bed->chrom);
-    binKeeperAdd(bk, bed->chromStart, bed->chromEnd, bed);
-    }
-lineFileClose(&bf);
-lineFileClose(&lf);
-return hash;
-}
-
-int bedParseRgb(char *itemRgb)
-/*      parse a string: "r,g,b" into three unsigned char values
-        returned as 24 bit number, or -1 for failure */
-{
-char dupe[64];
-int wordCount;
-char *row[4];
-
-strncpy(dupe, itemRgb, sizeof(dupe));
-wordCount = chopString(dupe, ",", row, ArraySize(row));
-
-if ((wordCount != 3) || (!isdigit(row[0][0]) ||
-    !isdigit(row[1][0]) || !isdigit(row[2][0])))
-        return (-1);
-
-return ( ((atoi(row[0]) & 0xff) << 16) |
-        ((atoi(row[1]) & 0xff) << 8) |
-        (atoi(row[2]) & 0xff) );
-}
-
-long long bedTotalSize(struct bed *bedList)
-/* Add together sizes of all beds in list. */
-{
-long long total=0;
-struct bed *bed;
-for (bed = bedList; bed != NULL; bed = bed->next)
-    total += (bed->chromEnd - bed->chromStart);
-return total;
-}
-
-void bedIntoRangeTree(struct bed *bed, struct rbTree *rangeTree)
-/* Add all blocks in bed to range tree.  For beds without blocks,
- * add entire bed. */
-{
-int i;
-if (bed->blockCount == 0)
-    rangeTreeAdd(rangeTree, bed->chromStart, bed->chromEnd);
-else
-    {
-    for (i=0; i < bed->blockCount; ++i)
-	{
-	int start = bed->chromStart + bed->chromStarts[i];
-	int end = start + bed->blockSizes[i];
-	rangeTreeAdd(rangeTree, start, end);
-	}
-    }
-}
-
-struct rbTree *bedToRangeTree(struct bed *bed)
-/* Convert bed into a range tree. */
-{
-struct rbTree *rangeTree = rangeTreeNew();
-bedIntoRangeTree(bed, rangeTree);
-return rangeTree;
-}
-
-int bedRangeTreeOverlap(struct bed *bed, struct rbTree *rangeTree)
-/* Return number of bases bed overlaps with rangeTree. */
-{
-int totalOverlap = 0;
-if (bed->blockCount == 0)
-    totalOverlap = rangeTreeOverlapSize(rangeTree, bed->chromStart, bed->chromEnd);
-else
-    {
-    int i;
-    for (i=0; i < bed->blockCount; ++i)
-	{
-	int start = bed->chromStart + bed->chromStarts[i];
-	int end = start + bed->blockSizes[i];
-	totalOverlap += rangeTreeOverlapSize(rangeTree, start, end);
-	}
-    }
-return totalOverlap;
-}
-
-int bedSameStrandOverlap(struct bed *a, struct bed *b)
-/* Return amount of block-level overlap on same strand between a and b */
-{
-/* Make sure on same strand, chromosome, and that overlap
- * at the non-block level. */
-if (a->strand[0] != b->strand[0])
-    return 0;
-if (!sameString(a->chrom, b->chrom))
-    return 0;
-int outerOverlap = rangeIntersection(a->chromStart, a->chromEnd, 
-	b->chromStart, b->chromEnd);
-if (outerOverlap <= 0)
-    return 0;
-
-/* If both beds are non-blocked then we're pretty much done. */
-if (a->blockCount == 0 && b->blockCount == 0)
-    return outerOverlap;
-
-/* Otherwise make up a range tree containing regions covered by a,
- * and figure out how much b overlaps it.. */
-struct rbTree *rangeTree = bedToRangeTree(a);
-int overlap = bedRangeTreeOverlap(b, rangeTree);
-
-/* Clean up and return result. */
-rangeTreeFree(&rangeTree);
-return overlap;
-}
-
-boolean bedExactMatch(struct bed *oldBed, struct bed *newBed)
-/* Return TRUE if it's an exact match. */
-{
-boolean oldCoding = (oldBed->thickStart != oldBed->thickEnd);
-boolean newCoding = (newBed->thickStart != newBed->thickEnd);
-
-if (oldCoding != newCoding)
-    return FALSE;
-/* non-coding bed's have different standards for what exactly
- * goes into these fields.  The standard just says they should
- * be equal */
-if (oldCoding && ((oldBed->thickStart != newBed->thickStart) ||
-    (oldBed->thickEnd != newBed->thickEnd)))
-    return FALSE;
-if (oldBed->blockCount != newBed->blockCount)
-    return FALSE;
-int oldSize = bedTotalBlockSize(oldBed);
-int newSize = bedTotalBlockSize(newBed);
-int overlap = bedSameStrandOverlap(oldBed, newBed);
-return  (oldSize == newSize && oldSize == overlap);
-}
-
-boolean bedCompatibleExtension(struct bed *oldBed, struct bed *newBed)
-/* Return TRUE if newBed is a compatible extension of oldBed, meaning
- * all internal exons and all introns of old bed are contained, in the 
- * same order in the new bed. */
-{
-/* New bed must have at least as many exons as old bed... */
-if (oldBed->blockCount > newBed->blockCount)
-    return FALSE;
-
-/* New bed must also must also encompass old bed. */
-if (newBed->chromStart > oldBed->chromStart)
-    return FALSE;
-if (newBed->chromEnd < oldBed->chromEnd)
-    return FALSE;
-
-/* Look for an exact match */
-int oldSize = bedTotalBlockSize(oldBed);
-int newSize = bedTotalBlockSize(newBed);
-int overlap = bedSameStrandOverlap(oldBed, newBed);
-if (oldSize == newSize && oldSize == overlap)
-    return TRUE;
-
-/* If overlap is smaller than old size then we can't be a superset. */
-if (overlap < oldSize)
-    return FALSE;
-
-/* If we're a single exon bed then we're done. */
-if (oldBed->blockCount <= 1)
-    return TRUE;
-
-/* Otherwise we look for first intron start in old bed, and then
- * flip through new bed until we find an intron that starts at the
- * same place. */
-int oldFirstIntronStart = oldBed->chromStart + oldBed->chromStarts[0] + oldBed->blockSizes[0];
-int newLastBlock = newBed->blockCount-1, oldLastBlock = oldBed->blockCount-1;
-int newIx, oldIx;
-for (newIx=0; newIx < newLastBlock; ++newIx)
-    {
-    int iStartNew = newBed->chromStart + newBed->chromStarts[newIx] + newBed->blockSizes[newIx];
-    if (iStartNew == oldFirstIntronStart)
-        break;
-    }
-if (newIx == newLastBlock)
-    return FALSE;
-
-/* Now we go through all introns in old bed, and make sure they match. */
-for (oldIx=0; oldIx < oldLastBlock; ++oldIx, ++newIx)
-    {
-    int iStartOld = oldBed->chromStart + oldBed->chromStarts[oldIx] + oldBed->blockSizes[oldIx];
-    int iEndOld = oldBed->chromStart + oldBed->chromStarts[oldIx+1];
-    int iStartNew = newBed->chromStart + newBed->chromStarts[newIx] + newBed->blockSizes[newIx];
-    int iEndNew = newBed->chromStart + newBed->chromStarts[newIx+1];
-    if (iStartOld != iStartNew || iEndOld != iEndNew)
-        return FALSE;
-    }
-
-/* Finally, make sure that the new bed doesn't contain any introns that overlap with the
- * last exon of the old bed */
-for(; newIx < newLastBlock; ++newIx)
-    {
-    int iStartNew = newBed->chromStart + newBed->chromStarts[newIx] + newBed->blockSizes[newIx];
-    if (iStartNew < oldBed->chromEnd)
-        return FALSE;
-    else if (iStartNew >= oldBed->chromEnd)
-        break;
-    }
-
-return TRUE;
-}
-
-struct bed3 *bed3New(char *chrom, int start, int end)
-/* Make new bed3. */
-{
-struct bed3 *bed;
-AllocVar(bed);
-bed->chrom = cloneString(chrom);
-bed->chromStart = start;
-bed->chromEnd = end;
-return bed;
-}
-
-struct bed *bedThickOnly(struct bed *in)
-/* Return a bed that only has the thick part. (Which is usually the CDS). */
-{
-if (in->thickStart >= in->thickEnd)
-     return NULL;
-if (in->expCount != 0 || in->expIds != NULL || in->expScores != NULL)
-   errAbort("Sorry, bedThickOnly only works on beds with up to 12 fields.");
-
-/* Allocate output, and fill in simple fields. */
-struct bed *out;
-AllocVar(out);
-out->chrom = cloneString(in->chrom);
-out->chromStart = out->thickStart = in->thickStart;
-out->chromEnd = out->thickEnd = in->thickEnd;
-out->name = cloneString(in->name);
-out->strand[0] = in->strand[0];
-out->score = in->score;
-out->itemRgb = in->itemRgb;
-
-/* If need be fill in blocks. */
-if (in->blockCount > 0)
-   {
-   /* Count up blocks inside CDS. */
-   int i;
-   int outBlockCount = 0;
-   for (i=0; i<in->blockCount; ++i)
-       {
-       int start = in->chromStart + in->chromStarts[i];
-       int end = start + in->blockSizes[i];
-       if (start < in->thickStart) start = in->thickStart;
-       if (end > in->thickEnd) end = in->thickEnd;
-       if (start < end)
-           outBlockCount += 1;
-	}
-
-    /* This trivieal case shouldn't happen, but just in case, we deal with it. */
-    if (outBlockCount == 0)
-        {
-	freeMem(out);
-	return NULL;
-	}
-
-    /* Allocate block arrays for output. */
-    out->blockCount = outBlockCount;
-    AllocArray(out->chromStarts, outBlockCount);
-    AllocArray(out->blockSizes, outBlockCount);
-
-    /* Scan through input one more time, copying to out. */
-    int outBlockIx = 0;
-    for (i=0; i<in->blockCount; ++i)
-	{
-	int start = in->chromStart + in->chromStarts[i];
-	int end = start + in->blockSizes[i];
-	if (start < in->thickStart) start = in->thickStart;
-	if (end > in->thickEnd) end = in->thickEnd;
-	if (start < end)
-	    {
-	    out->chromStarts[outBlockIx] = start - out->chromStart;
-	    out->blockSizes[outBlockIx] = end - start;
-	    outBlockIx += 1;
-	    }
-	}
-    }
-return out;
-}
-
-struct bed *bedThickOnlyList(struct bed *inList)
-/* Return a list of beds that only are the thick part of input. */
-{
-struct bed *outList = NULL, *out, *in;
-for (in = inList; in != NULL; in = in->next)
-    {
-    if ((out = bedThickOnly(in)) != NULL)
-        slAddHead(&outList, out);
-    }
-slReverse(&outList);
-return outList;
-}
-
-char *bedAsDef(int bedFieldCount, int totalFieldCount)
-/* Return an autoSql definition for a bed of given number of fields. 
- * Normally totalFieldCount is equal to bedFieldCount.  If there are extra
- * fields they are just given the names field16, field17, etc and type string. */
-{
-if (bedFieldCount < 3 || bedFieldCount > 15)
-    errAbort("bedFieldCount is %d, but must be between %d and %d in bedAsDef", bedFieldCount, 3, 15);
-struct dyString *dy = dyStringNew(0);
-dyStringAppend(dy, 
-    "table bed\n"
-    "\"Browser Extensible Data\"\n"
-    "   (\n"
-    "   string chrom;       \"Reference sequence chromosome or scaffold\"\n"
-    "   uint   chromStart;  \"Start position in chromosome\"\n"
-    "   uint   chromEnd;    \"End position in chromosome\"\n"
-    );
-if (bedFieldCount >= 4)
-    dyStringAppend(dy, "   string name;        \"Name of item.\"\n");
-if (bedFieldCount >= 5)
-    dyStringAppend(dy, "   uint score;          \"Score (0-1000)\"\n");
-if (bedFieldCount >= 6)
-    dyStringAppend(dy, "   char[1] strand;     \"+ or - for strand\"\n");
-if (bedFieldCount >= 7)
-    dyStringAppend(dy, "   uint thickStart;   \"Start of where display should be thick (start codon)\"\n");
-if (bedFieldCount >= 8)
-    dyStringAppend(dy, "   uint thickEnd;     \"End of where display should be thick (stop codon)\"\n");
-if (bedFieldCount >= 9)
-    dyStringAppend(dy, "   uint reserved;     \"Used as itemRgb as of 2004-11-22\"\n");
-if (bedFieldCount >= 10)
-    dyStringAppend(dy, "   int blockCount;    \"Number of blocks\"\n");
-if (bedFieldCount >= 11)
-    dyStringAppend(dy, "   int[blockCount] blockSizes; \"Comma separated list of block sizes\"\n");
-if (bedFieldCount >= 12)
-    dyStringAppend(dy, "   int[blockCount] chromStarts; \"Start positions relative to chromStart\"\n");
-if (bedFieldCount >= 13)
-    dyStringAppend(dy, "   int expCount;	\"Experiment count\"\n");
-if (bedFieldCount >= 14)
-    dyStringAppend(dy, "   int[expCount] expIds;	\"Comma separated list of experiment ids. Always 0,1,2,3....\"\n");
-if (bedFieldCount >= 15)
-    dyStringAppend(dy, "   float[expCount] expScores; \"Comma separated list of experiment scores.\"\n");
-int i;
-for (i=bedFieldCount+1; i<=totalFieldCount; ++i)
-    dyStringPrintf(dy, "lstring field%d;	\"Undocumented field\"\n", i+1);
-dyStringAppend(dy, "   )\n");
-return dyStringCannibalize(&dy);
-}
-
-
-boolean asCompareObjAgainstStandardBed(struct asObject *asYours, int numColumnsToCheck, boolean abortOnDifference)
-/* Compare user's .as object asYours to the standard BED.
- * abortOnDifference specifies whether to warn or abort if they differ within the first numColumnsToCheck columns.
- * Returns TRUE if they match. */
-{
-boolean result = FALSE;
-struct asObject *asStandard = NULL;
-if (numColumnsToCheck > 15)
-    errAbort("There are only 15 standard BED columns defined and you have asked for %d.", numColumnsToCheck);
-if (numColumnsToCheck < 3)
-    errAbort("All BED files have at least the first 3 columns the same.");
-char *asStandardText = bedAsDef(15,15);
-asStandard = asParseText(asStandardText);
-result = asCompareObjs("Yours", asYours, "BED Standard", asStandard, numColumnsToCheck, NULL, abortOnDifference);
-freeMem(asStandardText);
-asObjectFreeList(&asStandard);
-return result;
-}
-
-
-void loadAndValidateBed(char *row[], int bedFieldCount, int fieldCount, struct lineFile *lf, struct bed * bed, struct asObject *as, boolean isCt)
-/* Convert a row of strings to a bed and validate the contents.  Abort with message if invalid data. Optionally validate bedPlus via asObject.
- * If a customTrack, then some errors are tolerated. */
-{
-int count;
-int *blockSizes = NULL;
-int *chromStarts;
-int *expIds;
-float *expScores;
-
-bed->chrom = row[0];  // note this value is not cloned for speed, callers may need to clone it.
-
-// This check is usually redundant since the caller should be checking it against actual chromInfo names
-// however hgLoadBed might not always have that info available.
-if (strlen(bed->chrom) >= BB_MAX_CHROM_STRING)  // must leave room for 0 terminator
-    lineFileAbort(lf, "chrom [%s] is too long (must not exceed %d characters)", bed->chrom, BB_MAX_CHROM_STRING - 1);
-if (strlen(bed->chrom) < 1)
-    lineFileAbort(lf, "chrom cannot be blank or empty");
-
-lineFileAllInts(lf, row, 1, &bed->chromStart, FALSE, 4, "integer", FALSE);
-
-lineFileAllInts(lf, row, 2, &bed->chromEnd, FALSE, 4, "integer", FALSE);
-
-if (bed->chromEnd < bed->chromStart)
-    lineFileAbort(lf, "chromStart after chromEnd (%u > %u)",
-    	bed->chromStart, bed->chromEnd);
-if (bedFieldCount > 3)
-    {
-    bed->name = row[3];
-    if (strlen(bed->name) > 255)
-	lineFileAbort(lf, "name [%s] is too long (must not exceed 255 characters)", bed->name);
-    if (isCt)
-	bed->name = cloneString(bed->name);
-    }
-if (bedFieldCount > 4)
-    {
-    lineFileAllInts(lf, row, 4, &bed->score, TRUE, 4, "integer", FALSE);
-    if (!isCt && (bed->score < 0 || bed->score > 1000))
-	    lineFileAbort(lf, "score (%d) must be between 0 and 1000", bed->score);
-    }
-
-if (bedFieldCount > 5)
-    {
-    if (!isCt && strlen(row[5]) > 1)
-      lineFileAbort(lf, "Expecting + or - or . in strand, found [%s]",row[5]);
-    bed->strand[0] = row[5][0];
-    bed->strand[1] = 0;
-    if (bed->strand[0] != '+' && bed->strand[0] != '-' && bed->strand[0] != '.')
-      lineFileAbort(lf, "Expecting + or - or . in strand, found [%s]",row[5]);
-    }
-if (bedFieldCount > 6)
-    lineFileAllInts(lf, row, 6, &bed->thickStart, FALSE, 4, "integer", FALSE);
-else
-    bed->thickStart = bed->chromStart;
-if (bedFieldCount > 7)
-    {
-    lineFileAllInts(lf, row, 7, &bed->thickEnd, FALSE, 4, "integer", FALSE);
-    if (bed->thickEnd < bed->thickStart)
-     lineFileAbort(lf, "thickStart after thickEnd");
-    if ((bed->thickStart != 0) &&
-     ((bed->thickStart < bed->chromStart) ||
-      (bed->thickStart > bed->chromEnd)))
-     lineFileAbort(lf,
-	 "thickStart out of range (chromStart to chromEnd, or 0 if no CDS)");
-    if ((bed->thickEnd != 0) &&
-     ((bed->thickEnd < bed->chromStart) ||
-      (bed->thickEnd > bed->chromEnd)))
-     lineFileAbort(lf,
-	 "thickEnd out of range for %s:%u-%u, thick:%u-%u (chromStart to chromEnd, or 0 if no CDS)",
-		   bed->name, bed->chromStart, bed->chromEnd,
-		   bed->thickStart, bed->thickEnd);
-    }
-else
-     bed->thickEnd = bed->chromEnd;
-
-if (bedFieldCount > 8)
-    {
-    if (strchr(row[8],','))
-	{
-	unsigned char colors[4];
-	char *saveColorString = cloneString(row[8]);
-	int numColors = lineFileAllIntsArray(lf, row, 8, colors, sizeof colors, FALSE, 1, "integer", FALSE);
-	if (numColors == 3)
-	    {
-	    bed->itemRgb = (((unsigned)colors[0]) << 2*8) | (((unsigned)colors[1]) << 1*8) | (unsigned)colors[2];
-	    }
-	else
-	    lineFileAbort(lf, "Expecting color to consist of r,g,b values from 0 to 255. Got [%s]", saveColorString);
-	freeMem(saveColorString);
-	}
-    else 
-	{
-	lineFileAllInts(lf, row, 8, &bed->itemRgb, FALSE, 4, "integer", FALSE);
-	}
-    }
-
-int tempArraySize = 1;	// How big arrays are below
-if (bedFieldCount > 9)
-    {
-    lineFileAllInts(lf, row, 9, &bed->blockCount, FALSE, 4, "integer", FALSE);
-    if (!(bed->blockCount >= 1))
-	lineFileAbort(lf, "Expecting blockCount (%d) to be 1 or more.", bed->blockCount);
-    tempArraySize = bed->blockCount;
-    }
-int tempBlockSizes[tempArraySize];
-int tempChromStarts[tempArraySize];
-int tempExpIds[tempArraySize];
-float tempExpScores[tempArraySize];
-if (bedFieldCount > 10)
-    {
-    if (isCt)
-	{
-	AllocArray(bed->blockSizes,bed->blockCount+1); // having +1 allows us to detect incorrect size
-        count = lineFileAllIntsArray(lf, row, 10, bed->blockSizes, bed->blockCount+1, TRUE, 4, "integer", TRUE);
-	blockSizes = bed->blockSizes;
-	}
-    else
-	{
-        count = lineFileAllIntsArray(lf, row, 10, tempBlockSizes, tempArraySize, TRUE, 4, "integer", TRUE);
-	blockSizes = tempBlockSizes;
-	}
-    if (count != bed->blockCount)
-	lineFileAbort(lf, "Expecting %d elements in blockSizes list, found at least %d", bed->blockCount, count);
-    int i;
-    for (i=0; i < bed->blockCount;  i++)
-	{
-        if (!(blockSizes[i] > 0))
-		lineFileAbort(lf, "BED blockSizes must be greater than 0, blockSize[%d] = %d", i, blockSizes[i]);
-	}
-    }
-if (bedFieldCount > 11)
-    {
-    int i;
-    if (isCt)
-	{
-	AllocArray(bed->chromStarts,bed->blockCount+1); // having +1 allows us to detect incorrect size
-        count = lineFileAllIntsArray(lf, row, 11, bed->chromStarts, bed->blockCount+1, TRUE, 4, "integer", TRUE);
-	chromStarts = bed->chromStarts;
-	}
-    else
-	{
-        count = lineFileAllIntsArray(lf, row, 11, tempChromStarts, tempArraySize, TRUE, 4, "integer", TRUE);
-	chromStarts = tempChromStarts;
-	}
-    if (count != bed->blockCount)
-	lineFileAbort(lf, "Expecting %d elements in chromStarts list, found at least %d", bed->blockCount, count);
-    // tell the user if they appear to be using absolute starts rather than
-    // relative... easy to forget!  Also check block order, coord ranges...
-    if (chromStarts[0] != 0)
-	lineFileAbort(lf,
-	    "BED blocks must span chromStart to chromEnd.  "
-	    "BED chromStarts[0] = %d, must be 0 so that (chromStart + "
-	    "chromStarts[0]) equals chromStart.", chromStarts[0]);
-
-    for (i=1; i < bed->blockCount;  i++)
-	{
-
-/*
-printf("%d:%d %s %s s:%d c:%u cs:%u ce:%u csI:%d bsI:%d ls:%d le:%d<BR>\n", lineIx, i, bed->chrom, bed->name, bed->score, bed->blockCount, bed->chromStart, bed->chromEnd, bed->chromStarts[i], bed->blockSizes[i], lastStart, lastEnd);
-*/
-	// extra check to give user help for a common problem
-	if (chromStarts[i]+bed->chromStart >= bed->chromEnd)
-	    {
-	    if (chromStarts[i] >= bed->chromStart)
-		lineFileAbort(lf, "BED chromStarts offsets must be relative to chromStart, "
-				  "not absolute.  Try subtracting chromStart from each offset "
-				  "in chromStarts.");
-	    else
-		lineFileAbort(lf, "BED chromStarts[i]+chromStart must be less than chromEnd.");
-	    }
-	// chrom blocks must ascend without overlap
-        if (!(chromStarts[i] >= chromStarts[i-1] + blockSizes[i-1]))
-		lineFileAbort(lf, "BED blocks must be in ascending order without overlap. Blocks %d and %d overlap.", i-1, i);
-	}
-
-    // last block-end must match chromEnd
-    i = bed->blockCount-1;
-    if ((bed->chromStart + chromStarts[i] + blockSizes[i]) != bed->chromEnd)
-	{
-	lineFileAbort(lf, "BED blocks must span chromStart to chromEnd.  (chromStart + "
-			  "chromStarts[last] + blockSizes[last]) must equal chromEnd.");
-	}
-    }
-
-if (bedFieldCount > 12)
-    // get the microarray/colored-exon fields
-    {
-    lineFileAllInts(lf, row, 12, &bed->expCount, TRUE, 4, "integer", TRUE);
-    if (!(bed->expCount >= 1))
-	lineFileAbort(lf, "Expecting expCount (%d) to be 1 or more.", bed->expCount);
-    if (isCt)
-	{
-	AllocArray(bed->expIds,bed->expCount+1); // having +1 allows us to detect incorrect size
-        count = lineFileAllIntsArray(lf, row, 13, bed->expIds, bed->expCount+1, TRUE, 4, "integer", TRUE);
-	expIds = bed->expIds;
-	}
-    else
-	{
-        count = lineFileAllIntsArray(lf, row, 13, tempExpIds, tempArraySize, TRUE, 4, "integer", TRUE);
-	expIds = tempExpIds;
-	}
-    if (count != bed->expCount)
-	lineFileAbort(lf, "expecting %d elements in expIds list (bed field 14)", bed->expCount);
-    if (bedFieldCount == 15)
-	{
-	if (isCt)
-	    {
-	    sqlFloatDynamicArray(row[14], &bed->expScores, &count);
-	    expScores = bed->expScores;
-	    }
-	else
-	    {
-	    count = sqlFloatArray(row[14], tempExpScores, tempArraySize);
-	    expScores = tempExpScores;
-	    }
-	if (count != bed->expCount)
-	    lineFileAbort(lf, "expecting %d elements in expScores list (bed field 15)", bed->expCount);
-	}
-    }
-
-/* Check bedPlus fields are formatted right. */
-/* This could form the basis of an .as-validator independent of BED. I suppose it could go in asParse.c */
-if (as)
-    {
-    struct hash* linkHash = NULL;
-    /* Validate as-fields */
-    struct asColumn *asCol = NULL;
-    asCol = as->columnList;
-    int i;
-    // Pre-scan ALL fields for linked fields
-    for (i=0; i<fieldCount; ++i)
-	{
-	enum asTypes type = asCol->lowType->type;
-	if (! (asCol->isList || asCol->isArray))
-	    {
-	    if (asTypesIsInt(type))
-		{
-		if (asCol->isSizeLink) // save the field value and index for later use in validating a list size.
-		    {
-		    int listSize = 0;  // big enough to hold the list count
-		    lineFileAllInts(lf, row, i, &listSize, TRUE, 4, "integer", TRUE);
-		    if (!linkHash)
-			linkHash = newHash(4);
-		    hashAddInt(linkHash, asCol->name, listSize);
-		    }
-		}
-	    }
-	asCol = asCol->next;
-	}    
-    /* Validate bed-plus fields */
-    asCol = slElementFromIx(as->columnList, bedFieldCount);
-    for (i=bedFieldCount; i<fieldCount; ++i)
-	{
-	enum asTypes type = asCol->lowType->type;
-	if (! (asCol->isList || asCol->isArray))
-	    {
-	    if (asTypesIsInt(type))
-		lineFileAllInts(lf, row, i, NULL, !asTypesIsUnsigned(type), asTypesIntSize(type), asTypesIntSizeDescription(type), FALSE);
-	    else if (asTypesIsFloating(type))
-		lineFileNeedDouble(lf, row, i);
-	    else if (type == t_string)
-		{
-		if (strlen(row[i]) > 255)
-		    lineFileAbort(lf, "expecting length (%llu) of string (%s) not to exceed 255 in field %s", (unsigned long long)strlen(row[i]), row[i], asCol->name);
-		}
-	    }
-	else if (asCol->isList)
-	    {
-	    if (asTypesIsInt(type))
-		{
-		count = lineFileAllIntsArray(lf, row, i, NULL, 1024,
-		    !asTypesIsUnsigned(type), asTypesIntSize(type), asTypesIntSizeDescription(type), FALSE);
-		if (asCol->fixedSize > 0)
-		    {
-		    if (asCol->fixedSize != count)
-			lineFileAbort(lf, "expecting %d elements in %s list, found %d", asCol->fixedSize, asCol->name, count);
-		    }
-		else
-		    {
-		    if (!linkHash)
-			lineFileAbort(lf, "linked field %s was not found; it is required for determining listSize of %s"
-			    , asCol->linkedSizeName, asCol->name);
-		    int listSize = hashIntValDefault(linkHash, asCol->linkedSizeName, -1);
-		    if (listSize == -1)
-			lineFileAbort(lf, "linked field %s was not found; it is required for determining listSize of %s"
-			    , asCol->linkedSizeName, asCol->name);
-		    if (!(listSize >= 1))
-			lineFileAbort(lf, "invalid list size %d for list %s must be 1 or greater, empty lists are not allowed", listSize, asCol->name);
-		    if (!(listSize == count))
-			lineFileAbort(lf, "expecting %d elements in %s list, found %d", listSize, asCol->name, count);
-		    }
-		}
-	    }
-	asCol = asCol->next;
-	}
-    hashFree(&linkHash);
-    }
-
-}
-
-struct bed3 *bed3LoadAll(char *fileName)
-/* Load three columns from file as bed3. */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *row[3];
-struct bed3 *list = NULL, *el;
-while (lineFileRow(lf, row))
-    {
-    AllocVar(el);
-    el->chrom = cloneString(row[0]);
-    el->chromStart = sqlUnsigned(row[1]);
-    el->chromEnd = sqlUnsigned(row[2]);
-    slAddHead(&list, el);
-    }
-lineFileClose(&lf);
-slReverse(&list);
-return list;
-}
-
-void bed3Free(struct bed3 **pBed)
-/* Free up bed3 */
-{
-struct bed3 *bed = *pBed;
-if (bed != NULL)
-    {
-    freeMem(bed->chrom);
-    freez(pBed);
-    }
-}
-
-void bed3FreeList(struct bed3 **pList)
-/* Free a list of dynamically allocated bed3's */
-{
-struct bed3 *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    bed3Free(&el);
-    }
-*pList = NULL;
-}
-
-long long bed3TotalSize(struct bed3 *bedList)
-/* Return sum of chromEnd-chromStart. */
-{
-long long sum = 0;
-struct bed3 *bed;
-for (bed = bedList; bed != NULL; bed = bed->next)
-    sum += bed->chromEnd - bed->chromStart;
-return sum;
-}
-
-struct bed4 *bed4New(char *chrom, int start, int end, char *name)
-/* Make new bed4. */
-{
-struct bed4 *bed;
-AllocVar(bed);
-bed->chrom = cloneString(chrom);
-bed->chromStart = start;
-bed->chromEnd = end;
-bed->name = cloneString(name);
-return bed;
-}
-
-void bed4Free(struct bed4 **pBed)
-/* Free up bed4 */
-{
-struct bed4 *bed = *pBed;
-if (bed != NULL)
-    {
-    freeMem(bed->chrom);
-    freeMem(bed->name);
-    freez(pBed);
-    }
-}
-
-void bed4FreeList(struct bed4 **pList)
-/* Free a list of dynamically allocated bed4's */
-{
-struct bed4 *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    bed4Free(&el);
-    }
-*pList = NULL;
-}
-
diff --git a/gbtools/src/blatSrc/lib/bbiRead.c b/gbtools/src/blatSrc/lib/bbiRead.c
deleted file mode 100644
index 2e7188a..0000000
--- a/gbtools/src/blatSrc/lib/bbiRead.c
+++ /dev/null
@@ -1,797 +0,0 @@
-/* bbiRead - Big Binary Indexed file.  Stuff that's common between bigWig and bigBed on the 
- * read side. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "obscure.h"
-#include "zlibFace.h"
-#include "bPlusTree.h"
-#include "hmmstats.h"
-#include "cirTree.h"
-#include "udc.h"
-#include "bbiFile.h"
-
-struct bbiZoomLevel *bbiBestZoom(struct bbiZoomLevel *levelList, int desiredReduction)
-/* Return zoom level that is the closest one that is less than or equal to 
- * desiredReduction. */
-{
-if (desiredReduction < 0)
-   errAbort("bad value %d for desiredReduction in bbiBestZoom", desiredReduction);
-if (desiredReduction <= 1)
-    return NULL;
-int closestDiff = BIGNUM;
-struct bbiZoomLevel *closestLevel = NULL;
-struct bbiZoomLevel *level;
-
-for (level = levelList; level != NULL; level = level->next)
-    {
-    int diff = desiredReduction - level->reductionLevel;
-    if (diff >= 0 && diff < closestDiff)
-        {
-	closestDiff = diff;
-	closestLevel = level;
-	}
-    }
-return closestLevel;
-}
-
-boolean bbiFileCheckSigs(char *fileName, bits32 sig, char *typeName)
-/* check file signatures at beginning and end of file */
-{
-int fd = mustOpenFd(fileName, O_RDONLY);
-bits32 magic;
-boolean isSwapped = FALSE;
-
-// look for signature at the beginning of the file
-mustReadFd(fd, &magic, sizeof(magic));
-
-if (magic != sig)
-    {
-    magic = byteSwap32(magic);
-    isSwapped = TRUE;
-    if (magic != sig)
-        return FALSE;
-    }
-
-// look for signature at the end of the file
-mustLseek(fd, -sizeof(magic), SEEK_END);
-mustReadFd(fd, &magic, sizeof(magic));
-mustCloseFd(&fd);
-
-if (isSwapped)
-    {
-    magic = byteSwap32(magic);
-    if (magic != sig)
-        return FALSE;
-    }
-else
-    {
-    if (magic != sig)
-        return FALSE;
-    }
-
-return TRUE;
-}
-
-struct bbiFile *bbiFileOpen(char *fileName, bits32 sig, char *typeName)
-/* Open up big wig or big bed file. */
-{
-/* This code needs to agree with code in two other places currently - bigBedFileCreate,
- * and bigWigFileCreate.  I'm thinking of refactoring to share at least between
- * bigBedFileCreate and bigWigFileCreate.  It'd be great so it could be structured
- * so that it could send the input in one chromosome at a time, and send in the zoom
- * stuff only after all the chromosomes are done.  This'd potentially reduce the memory
- * footprint by a factor of 2 or 4.  Still, for now it works. -JK */
-struct bbiFile *bbi;
-AllocVar(bbi);
-bbi->fileName = cloneString(fileName);
-struct udcFile *udc = bbi->udc = udcFileOpen(fileName, udcDefaultDir());
-
-/* Read magic number at head of file and use it to see if we are proper file type, and
- * see if we are byte-swapped. */
-bits32 magic;
-boolean isSwapped = FALSE;
-udcMustRead(udc, &magic, sizeof(magic));
-if (magic != sig)
-    {
-    magic = byteSwap32(magic);
-    isSwapped = TRUE;
-    if (magic != sig)
-       errAbort("%s is not a %s file", fileName, typeName);
-    }
-bbi->typeSig = sig;
-bbi->isSwapped = isSwapped;
-
-/* Read rest of defined bits of header, byte swapping as needed. */
-bbi->version = udcReadBits16(udc, isSwapped);
-bbi->zoomLevels = udcReadBits16(udc, isSwapped);
-bbi->chromTreeOffset = udcReadBits64(udc, isSwapped);
-bbi->unzoomedDataOffset = udcReadBits64(udc, isSwapped);
-bbi->unzoomedIndexOffset = udcReadBits64(udc, isSwapped);
-bbi->fieldCount = udcReadBits16(udc, isSwapped);
-bbi->definedFieldCount = udcReadBits16(udc, isSwapped);
-bbi->asOffset = udcReadBits64(udc, isSwapped);
-bbi->totalSummaryOffset = udcReadBits64(udc, isSwapped);
-bbi->uncompressBufSize = udcReadBits32(udc, isSwapped);
-bbi->extensionOffset = udcReadBits64(udc, isSwapped);
-
-/* Read zoom headers. */
-int i;
-struct bbiZoomLevel *level, *levelList = NULL;
-for (i=0; i<bbi->zoomLevels; ++i)
-    {
-    AllocVar(level);
-    level->reductionLevel = udcReadBits32(udc, isSwapped);
-    level->reserved = udcReadBits32(udc, isSwapped);
-    level->dataOffset = udcReadBits64(udc, isSwapped);
-    level->indexOffset = udcReadBits64(udc, isSwapped);
-    slAddHead(&levelList, level);
-    }
-slReverse(&levelList);
-bbi->levelList = levelList;
-
-/* Deal with header extension if any. */
-if (bbi->extensionOffset != 0)
-    {
-    udcSeek(udc, bbi->extensionOffset);
-    bbi->extensionSize = udcReadBits16(udc, isSwapped);
-    bbi->extraIndexCount = udcReadBits16(udc, isSwapped);
-    bbi->extraIndexListOffset = udcReadBits64(udc, isSwapped);
-    }
-
-/* Attach B+ tree of chromosome names and ids. */
-udcSeek(udc, bbi->chromTreeOffset);
-bbi->chromBpt =  bptFileAttach(fileName, udc);
-
-return bbi;
-}
-
-void bbiFileClose(struct bbiFile **pBwf)
-/* Close down a big wig/big bed file. */
-{
-struct bbiFile *bwf = *pBwf;
-if (bwf != NULL)
-    {
-    cirTreeFileDetach(&bwf->unzoomedCir);
-    slFreeList(&bwf->levelList);
-    slFreeList(&bwf->levelList);
-    bptFileDetach(&bwf->chromBpt);
-    udcFileClose(&bwf->udc);
-    freeMem(bwf->fileName);
-    freez(pBwf);
-    }
-}
-
-static void chromIdSizeHandleSwapped(boolean isSwapped, struct bbiChromIdSize *idSize)
-/* Swap bytes in chromosome Id and Size as needed. */
-{
-if (isSwapped)
-    {
-    idSize->chromId = byteSwap32(idSize->chromId);
-    idSize->chromSize = byteSwap32(idSize->chromSize);
-    }
-}
-
-
-struct fileOffsetSize *bbiOverlappingBlocks(struct bbiFile *bbi, struct cirTreeFile *ctf,
-	char *chrom, bits32 start, bits32 end, bits32 *retChromId)
-/* Fetch list of file blocks that contain items overlapping chromosome range. */
-{
-struct bbiChromIdSize idSize;
-if (!bptFileFind(bbi->chromBpt, chrom, strlen(chrom), &idSize, sizeof(idSize)))
-    return NULL;
-chromIdSizeHandleSwapped(bbi->isSwapped, &idSize);
-if (retChromId != NULL)
-    *retChromId = idSize.chromId;
-return cirTreeFindOverlappingBlocks(ctf, idSize.chromId, start, end);
-}
-
-struct chromNameCallbackContext
-/* Some stuff that the bPlusTree traverser needs for context. */
-    {
-    struct bbiChromInfo *list;		/* The list we are building. */
-    boolean isSwapped;			/* Need to byte-swap things? */
-    };
-
-static void chromNameCallback(void *context, void *key, int keySize, void *val, int valSize)
-/* Callback that captures chromInfo from bPlusTree. */
-{
-struct chromNameCallbackContext *c = context;
-struct bbiChromInfo *info;
-struct bbiChromIdSize *idSize = val;
-assert(valSize == sizeof(*idSize));
-chromIdSizeHandleSwapped(c->isSwapped, idSize);
-AllocVar(info);
-info->name = cloneStringZ(key, keySize);
-info->id = idSize->chromId;
-info->size = idSize->chromSize;
-slAddHead(&c->list, info);
-}
-
-struct bbiChromInfo *bbiChromList(struct bbiFile *bbi)
-/* Return list of chromosomes. */
-{
-struct chromNameCallbackContext context;
-context.list = NULL;
-context.isSwapped = bbi->isSwapped;
-bptFileTraverse(bbi->chromBpt, &context, chromNameCallback);
-slReverse(&context.list);
-return context.list;
-}
-
-bits32 bbiChromSize(struct bbiFile *bbi, char *chrom)
-/* Return chromosome size, or 0 if no such chromosome in file. */
-{
-struct bbiChromIdSize idSize;
-if (!bptFileFind(bbi->chromBpt, chrom, strlen(chrom), &idSize, sizeof(idSize)))
-    return 0;
-chromIdSizeHandleSwapped(bbi->isSwapped, &idSize);
-return idSize.chromSize;
-}
-
-void bbiChromInfoFree(struct bbiChromInfo **pInfo)
-/* Free up one chromInfo */
-{
-struct bbiChromInfo *info = *pInfo;
-if (info != NULL)
-    {
-    freeMem(info->name);
-    freez(pInfo);
-    }
-}
-
-void bbiChromInfoFreeList(struct bbiChromInfo **pList)
-/* Free a list of dynamically allocated bbiChromInfo's */
-{
-struct bbiChromInfo *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    bbiChromInfoFree(&el);
-    }
-*pList = NULL;
-}
-
-void bbiAttachUnzoomedCir(struct bbiFile *bbi)
-/* Make sure unzoomed cir is attached. */
-{
-if (bbi->unzoomedCir == NULL)
-    {
-    udcSeek(bbi->udc, bbi->unzoomedIndexOffset);
-    bbi->unzoomedCir = cirTreeFileAttach(bbi->fileName, bbi->udc);
-    }
-}
-
-enum bbiSummaryType bbiSummaryTypeFromString(char *string)
-/* Return summary type given a descriptive string. */
-{
-if (sameWord(string, "mean") || sameWord(string, "average"))
-    return bbiSumMean;
-else if (sameWord(string, "max") || sameWord(string, "maximum"))
-    return bbiSumMax;
-else if (sameWord(string, "min") || sameWord(string, "minimum"))
-    return bbiSumMin;
-else if (sameWord(string, "coverage") || sameWord(string, "dataCoverage"))
-    return bbiSumCoverage;
-else if (sameWord(string, "std"))
-    return bbiSumStandardDeviation;
-else
-    {
-    errAbort("Unknown bbiSummaryType %s", string);
-    return bbiSumMean;	/* Keep compiler quiet. */
-    }
-}
-
-char *bbiSummaryTypeToString(enum bbiSummaryType type)
-/* Convert summary type from enum to string representation. */
-{
-switch (type)
-    {
-    case bbiSumMean:
-        return "mean";
-    case bbiSumMax:
-        return "max";
-    case bbiSumMin:
-        return "min";
-    case bbiSumCoverage:
-        return "coverage";
-    case bbiSumStandardDeviation:
-        return "std";
-    default:
-	errAbort("Unknown bbiSummaryType %d", (int)type);
-	return NULL;
-    }
-}
-
-#ifdef UNUSED
-static void bbiSummaryOnDiskRead(struct bbiFile *bbi, struct bbiSummaryOnDisk *sum)
-/* Read in summary from file. */
-{
-struct udcFile *udc = bbi->udc;
-boolean isSwapped = bbi->isSwapped;
-sum->chromId = udcReadBits32(udc, isSwapped);
-sum->start = udcReadBits32(udc, isSwapped);
-sum->end = udcReadBits32(udc, isSwapped);
-sum->validCount = udcReadBits32(udc, isSwapped);
-// looks like a bug to me, these should call udcReadFloat() 
-udcMustReadOne(udc, sum->minVal);
-udcMustReadOne(udc, sum->maxVal);
-udcMustReadOne(udc, sum->sumData);
-udcMustReadOne(udc, sum->sumSquares);
-}
-#endif /* UNUSED */
-
-static void bbiSummaryHandleSwapped(struct bbiFile *bbi, struct bbiSummaryOnDisk *in)
-/* Swap integer fields in summary as needed. */
-{
-if (bbi->isSwapped)
-    {
-    in->chromId = byteSwap32(in->chromId);
-    in->start = byteSwap32(in->start);
-    in->end = byteSwap32(in->end);
-    in->validCount = byteSwap32(in->validCount);
-    in->minVal = byteSwapFloat(in->minVal);
-    in->maxVal = byteSwapFloat(in->maxVal);
-    in->sumData = byteSwapFloat(in->sumData);
-    in->sumSquares = byteSwapFloat(in->sumSquares);
-    }
-}
-
-static struct bbiSummary *bbiSummaryFromOnDisk(struct bbiSummaryOnDisk *in)
-/* Create a bbiSummary unlinked to anything from input in onDisk format. */
-{
-struct bbiSummary *out;
-AllocVar(out);
-out->chromId = in->chromId;
-out->start = in->start;
-out->end = in->end;
-out->validCount = in->validCount;
-out->minVal = in->minVal;
-out->maxVal = in->maxVal;
-out->sumData = in->sumData;
-out->sumSquares = in->sumSquares;
-return out;
-}
-
-struct bbiSummary *bbiSummariesInRegion(struct bbiZoomLevel *zoom, struct bbiFile *bbi, 
-	int chromId, bits32 start, bits32 end)
-/* Return list of all summaries in region at given zoom level of bbiFile. */
-{
-struct bbiSummary *sumList = NULL, *sum;
-struct udcFile *udc = bbi->udc;
-udcSeek(udc, zoom->indexOffset);
-struct cirTreeFile *ctf = cirTreeFileAttach(bbi->fileName, bbi->udc);
-struct fileOffsetSize *blockList = cirTreeFindOverlappingBlocks(ctf, chromId, start, end);
-struct fileOffsetSize *block, *beforeGap, *afterGap;
-
-/* Set up for uncompression optionally. */
-char *uncompressBuf = NULL;
-if (bbi->uncompressBufSize > 0)
-    uncompressBuf = needLargeMem(bbi->uncompressBufSize);
-
-
-/* This loop is a little complicated because we merge the read requests for efficiency, but we 
- * have to then go back through the data one unmerged block at a time. */
-for (block = blockList; block != NULL; )
-    {
-    /* Find contigious blocks and read them into mergedBuf. */
-    fileOffsetSizeFindGap(block, &beforeGap, &afterGap);
-    bits64 mergedOffset = block->offset;
-    bits64 mergedSize = beforeGap->offset + beforeGap->size - mergedOffset;
-    udcSeek(udc, mergedOffset);
-    char *mergedBuf = needLargeMem(mergedSize);
-    udcMustRead(udc, mergedBuf, mergedSize);
-    char *blockBuf = mergedBuf;
-
-    /* Loop through individual blocks within merged section. */
-    for (;block != afterGap; block = block->next)
-        {
-	/* Uncompress if necessary. */
-	char *blockPt, *blockEnd;
-	if (uncompressBuf)
-	    {
-	    blockPt = uncompressBuf;
-	    int uncSize = zUncompress(blockBuf, block->size, uncompressBuf, bbi->uncompressBufSize);
-	    blockEnd = blockPt + uncSize;
-	    }
-	else
-	    {
-	    blockPt = blockBuf;
-	    blockEnd = blockPt + block->size;
-	    }
-
-	/* Figure out bounds and number of items in block. */
-	int blockSize = blockEnd - blockPt;
-	struct bbiSummaryOnDisk *dSum;
-	int itemSize = sizeof(*dSum);
-	assert(blockSize % itemSize == 0);
-	int itemCount = blockSize / itemSize;
-
-	/* Read in items and convert to memory list format. */
-	int i;
-	for (i=0; i<itemCount; ++i)
-	    {
-	    dSum = (void *)blockPt;
-	    blockPt += sizeof(*dSum);
-	    bbiSummaryHandleSwapped(bbi, dSum);
-	    if (dSum->chromId == chromId)
-		{
-		int s = max(dSum->start, start);
-		int e = min(dSum->end, end);
-		if (s < e)
-		    {
-		    sum = bbiSummaryFromOnDisk(dSum);
-		    slAddHead(&sumList, sum);
-		    }
-		}
-	    }
-	assert(blockPt == blockEnd);
-	blockBuf += block->size;
-        }
-    freeMem(mergedBuf);
-    }
-freeMem(uncompressBuf);
-slFreeList(&blockList);
-cirTreeFileDetach(&ctf);
-slReverse(&sumList);
-return sumList;
-}
-
-static int normalizeCount(struct bbiSummaryElement *el, double countFactor, 
-    double minVal, double maxVal, double sumData, double sumSquares)
-/* normalize statistics to be based on an integer number of valid bases 
- * Integer value is the smallest integer not less than countFactor */
-{
-bits32 validCount = ceil(countFactor);
-double normFactor = (double)validCount/countFactor;
-
-el->validCount = validCount;
-el->minVal = minVal;
-el->maxVal = maxVal;
-el->sumData = sumData * normFactor;
-el->sumSquares = sumSquares * normFactor;
-
-return validCount;
-}
-
-static bits32 bbiSummarySlice(struct bbiFile *bbi, bits32 baseStart, bits32 baseEnd, 
-	struct bbiSummary *sumList, struct bbiSummaryElement *el)
-/* Update retVal with the average value if there is any data in interval.  Return number
- * of valid data bases in interval. */
-{
-bits32 validCount = 0;
-
-if (sumList != NULL)
-    {
-    double minVal = sumList->minVal;
-    double maxVal = sumList->maxVal;
-    double sumData = 0, sumSquares = 0;
-    double countFactor = 0.0;
-
-    struct bbiSummary *sum;
-    for (sum = sumList; sum != NULL && sum->start < baseEnd; sum = sum->next)
-	{
-	int overlap = rangeIntersection(baseStart, baseEnd, sum->start, sum->end);
-	if (overlap > 0)
-	    {
-	    double overlapFactor = (double)overlap / (sum->end - sum->start);
-	    countFactor += sum->validCount * overlapFactor;
-	    sumData += sum->sumData * overlapFactor;
-	    sumSquares += sum->sumSquares * overlapFactor;
-	    if (maxVal < sum->maxVal)
-		maxVal = sum->maxVal;
-	    if (minVal > sum->minVal)
-		minVal = sum->minVal;
-	    }
-	}
-
-    if (countFactor > 0)
-	validCount = normalizeCount(el, countFactor, minVal, maxVal, sumData, sumSquares);
-    }
-return validCount;
-}
-
-static int bbiChromId(struct bbiFile *bbi, char *chrom)
-/* Return chromosome Id */
-{
-struct bbiChromIdSize idSize;
-if (!bptFileFind(bbi->chromBpt, chrom, strlen(chrom), &idSize, sizeof(idSize)))
-    return -1;
-chromIdSizeHandleSwapped(bbi->isSwapped, &idSize);
-return idSize.chromId;
-}
-
-static boolean bbiSummaryArrayFromZoom(struct bbiZoomLevel *zoom, struct bbiFile *bbi, 
-	char *chrom, bits32 start, bits32 end,
-	int summarySize, struct bbiSummaryElement *summary)
-/* Look up region in index and get data at given zoom level.  Summarize this data
- * in the summary array. */
-{
-boolean result = FALSE;
-int chromId = bbiChromId(bbi, chrom);
-if (chromId < 0)
-    return FALSE;
-struct bbiSummary *sum, *sumList = bbiSummariesInRegion(zoom, bbi, chromId, start, end);
-if (sumList != NULL)
-    {
-    int i;
-    bits32 baseStart = start, baseEnd;
-    bits32 baseCount = end - start;
-    sum = sumList;
-    for (i=0; i<summarySize; ++i)
-        {
-	/* Calculate end of this part of summary */
-	baseEnd = start + (bits64)baseCount*(i+1)/summarySize;
-
-        /* Advance sum to skip over parts we are no longer interested in. */
-	while (sum != NULL && sum->end <= baseStart)
-	    sum = sum->next;
-
-	if (bbiSummarySlice(bbi, baseStart, baseEnd, sum, &summary[i]))
-	    result = TRUE;
-
-	/* Next time round start where we left off. */
-	baseStart = baseEnd;
-	}
-    slFreeList(&sumList);
-    }
-return result;
-}
-
-static bits32 bbiIntervalSlice(struct bbiFile *bbi, bits32 baseStart, bits32 baseEnd, 
-	struct bbiInterval *intervalList, struct bbiSummaryElement *el)
-/* Update retVal with the average value if there is any data in interval.  Return number
- * of valid data bases in interval. */
-{
-bits32 validCount = 0;
-
-if (intervalList != NULL)
-    {
-    double countFactor = 0;
-    struct bbiInterval *interval;
-    double sumData = 0, sumSquares = 0;
-    double minVal = intervalList->val;
-    double maxVal = intervalList->val;
-
-    for (interval = intervalList; interval != NULL && interval->start < baseEnd; 
-	    interval = interval->next)
-	{
-	int overlap = rangeIntersection(baseStart, baseEnd, interval->start, interval->end);
-	if (overlap > 0)
-	    {
-	    int intervalSize = interval->end - interval->start;
-	    double overlapFactor = (double)overlap / intervalSize;
-	    double intervalWeight = intervalSize * overlapFactor;
-	    countFactor += intervalWeight;
-	    sumData += interval->val * intervalWeight;
-	    sumSquares += interval->val * interval->val * intervalWeight;
-	    if (maxVal < interval->val)
-		maxVal = interval->val;
-	    if (minVal > interval->val)
-		minVal = interval->val;
-	    }
-	}
-
-    validCount = normalizeCount(el, countFactor, minVal, maxVal, sumData, sumSquares);
-    }
-return validCount;
-}
-
-
-static boolean bbiSummaryArrayFromFull(struct bbiFile *bbi, 
-	char *chrom, bits32 start, bits32 end, BbiFetchIntervals fetchIntervals,
-	int summarySize, struct bbiSummaryElement *summary)
-/* Summarize data, not using zoom. */
-{
-struct bbiInterval *intervalList = NULL, *interval;
-struct lm *lm = lmInit(0);
-intervalList = (*fetchIntervals)(bbi, chrom, start, end, lm);
-boolean result = FALSE;
-if (intervalList != NULL)
-    {
-    int i;
-    bits32 baseStart = start, baseEnd;
-    bits32 baseCount = end - start;
-    interval = intervalList;
-    for (i=0; i<summarySize; ++i)
-        {
-	/* Calculate end of this part of summary */
-	baseEnd = start + (bits64)baseCount*(i+1)/summarySize;
-	int end1 = baseEnd;
-	if (end1 == baseStart)
-	    end1 = baseStart+1;
-
-        /* Advance interval to skip over parts we are no longer interested in. */
-	while (interval != NULL && interval->end <= baseStart)
-	    interval = interval->next;
-
-	if (bbiIntervalSlice(bbi, baseStart, end1, interval, &summary[i]))
-	    result = TRUE;
-
-	/* Next time round start where we left off. */
-	baseStart = baseEnd;
-	}
-    }
-lmCleanup(&lm);
-return result;
-}
-
-boolean bbiSummaryArrayExtended(struct bbiFile *bbi, char *chrom, bits32 start, bits32 end,
-	BbiFetchIntervals fetchIntervals,
-	int summarySize, struct bbiSummaryElement *summary)
-/* Fill in summary with  data from indicated chromosome range in bigWig file. 
- * Returns FALSE if no data at that position. */
-{
-boolean result = FALSE;
-
-/* Protect from bad input. */
-if (start >= end)
-    return result;
-bzero(summary, summarySize * sizeof(summary[0]));
-
-/* Figure out what size of data we want.  We actually want to get 2 data points per summary
- * value if possible to minimize the effect of a data point being split between summary pixels. */
-bits32 baseSize = end - start; 
-int fullReduction = (baseSize/summarySize);
-int zoomLevel = fullReduction/2;
-if (zoomLevel < 0)
-    zoomLevel = 0;
-
-/* Get the closest zoom level less than what we're looking for. */
-struct bbiZoomLevel *zoom = bbiBestZoom(bbi->levelList, zoomLevel);
-if (zoom != NULL)
-    result = bbiSummaryArrayFromZoom(zoom, bbi, chrom, start, end, summarySize, summary);
-else
-    result = bbiSummaryArrayFromFull(bbi, chrom, start, end, fetchIntervals, summarySize, summary);
-return result;
-}
-
-boolean bbiSummaryArray(struct bbiFile *bbi, char *chrom, bits32 start, bits32 end,
-	BbiFetchIntervals fetchIntervals,
-	enum bbiSummaryType summaryType, int summarySize, double *summaryValues)
-/* Fill in summaryValues with  data from indicated chromosome range in bigWig file.
- * Be sure to initialize summaryValues to a default value, which will not be touched
- * for regions without data in file.  (Generally you want the default value to either
- * be 0.0 or nan("") depending on the application.)  Returns FALSE if no data
- * at that position. */
-{
-struct bbiSummaryElement *elements;
-AllocArray(elements, summarySize);
-boolean ret = bbiSummaryArrayExtended(bbi, chrom, start, end, 
-	fetchIntervals, summarySize, elements);
-if (ret)
-    {
-    int i;
-    double covFactor = (double)summarySize/(end - start);
-    for (i=0; i<summarySize; ++i)
-        {
-	struct bbiSummaryElement *el = &elements[i];
-	if (el->validCount > 0)
-	    {
-	    double val;
-	    switch (summaryType)
-		{
-		case bbiSumMean:
-		    val = el->sumData/el->validCount;
-		    break;
-		case bbiSumMax:
-		    val = el->maxVal;
-		    break;
-		case bbiSumMin:
-		    val = el->minVal;
-		    break;
-		case bbiSumCoverage:
-		    val = covFactor*el->validCount;
-		    break;
-		case bbiSumStandardDeviation:
-		    val = calcStdFromSums(el->sumData, el->sumSquares, el->validCount);
-		    break;
-		default:
-		    internalErr();
-		    val = 0.0;
-		    break;
-		}
-	    summaryValues[i] = val;
-	    }
-	}
-    }
-freeMem(elements);
-return ret;
-}
-
-struct bbiSummaryElement bbiTotalSummary(struct bbiFile *bbi)
-/* Return summary of entire file! */
-{
-struct udcFile *udc = bbi->udc;
-boolean isSwapped = bbi->isSwapped;
-struct bbiSummaryElement res;
-ZeroVar(&res);
-
-if (bbi->totalSummaryOffset != 0)
-    {
-    udcSeek(udc, bbi->totalSummaryOffset);
-    res.validCount = udcReadBits64(udc, isSwapped);
-    res.minVal = udcReadDouble(udc, isSwapped);
-    res.maxVal = udcReadDouble(udc, isSwapped);
-    res.sumData = udcReadDouble(udc, isSwapped);
-    res.sumSquares = udcReadDouble(udc, isSwapped);
-    }
-else if (bbi->version == 1)
-    /* Require version 1 so as not to have to deal with compression.  Should not happen
-     * to have NULL totalSummaryOffset for non-empty version 2+ file anyway. */
-    {
-    /* Find most extreme zoom. */
-    struct bbiZoomLevel *bestZoom = NULL, *zoom;
-    bits32 bestReduction = 0;
-    for (zoom = bbi->levelList; zoom != NULL; zoom = zoom->next)
-	{
-	if (zoom->reductionLevel > bestReduction)
-	    {
-	    bestReduction = zoom->reductionLevel;
-	    bestZoom = zoom;
-	    }
-	}
-
-    if (bestZoom != NULL)
-	{
-	udcSeek(udc, bestZoom->dataOffset);
-	bits32 zoomSectionCount = udcReadBits32(udc, isSwapped);
-	bits32 i;
-	for (i=0; i<zoomSectionCount; ++i)
-	    {
-	    /* Read, but ignore, position. */
-	    bits32 chromId, chromStart, chromEnd;
-	    chromId = udcReadBits32(udc, isSwapped);
-	    chromStart = udcReadBits32(udc, isSwapped);
-	    chromEnd = udcReadBits32(udc, isSwapped);
-
-	    /* First time through set values, rest of time add to them. */
-	    if (i == 0)
-		{
-		res.validCount = udcReadBits32(udc, isSwapped);
-		res.minVal = udcReadFloat(udc, isSwapped);
-		res.maxVal = udcReadFloat(udc, isSwapped);
-		res.sumData = udcReadFloat(udc, isSwapped);
-		res.sumSquares = udcReadFloat(udc, isSwapped);
-		}
-	    else
-		{
-		res.validCount += udcReadBits32(udc, isSwapped);
-		float minVal = udcReadFloat(udc, isSwapped);
-		if (minVal < res.minVal) res.minVal = minVal;
-		float maxVal = udcReadFloat(udc, isSwapped);
-		if (maxVal > res.maxVal) res.maxVal = maxVal;
-		res.sumData += udcReadFloat(udc, isSwapped);
-		res.sumSquares += udcReadFloat(udc, isSwapped);
-		}
-	    }
-	}
-    }
-return res;
-}
-
-time_t bbiUpdateTime(struct bbiFile *bbi)
-/* return bbi->udc->updateTime */
-{
-struct udcFile *udc = bbi->udc;
-return udcUpdateTime(udc);
-}
-
-char *bbiCachedChromLookup(struct bbiFile *bbi, int chromId, int lastChromId,
-    char *chromBuf, int chromBufSize)
-/* Return chromosome name corresponding to chromId.  Because this is a bit expensive,
- * if you are doing this repeatedly pass in the chromId used in the previous call to
- * this in lastChromId,  which will save it from doing the lookup again on the same
- * chromosome.  Pass in -1 to lastChromId if this is the first time or if you can't be
- * bothered.  The chromBufSize should be at greater or equal to bbi->keySize+1.  */
-{
-if (chromId != lastChromId)
-    bptStringKeyAtPos(bbi->chromBpt, chromId, chromBuf, chromBufSize);
-return chromBuf;
-}
-
diff --git a/gbtools/src/blatSrc/lib/bbiWrite.c b/gbtools/src/blatSrc/lib/bbiWrite.c
deleted file mode 100644
index 709f771..0000000
--- a/gbtools/src/blatSrc/lib/bbiWrite.c
+++ /dev/null
@@ -1,736 +0,0 @@
-/* bbiWrite.c - Routines to help write bigWig and bigBed files. See also bbiFile.h */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "linefile.h"
-#include "sqlNum.h"
-#include "zlibFace.h"
-#include "cirTree.h"
-#include "bPlusTree.h"
-#include "bbiFile.h"
-#include "obscure.h"
-
-void bbiWriteDummyHeader(FILE *f)
-/* Write out all-zero header, just to reserve space for it. */
-{
-repeatCharOut(f, 0, 64);
-}
-
-void bbiWriteDummyZooms(FILE *f)
-/* Write out zeroes to reserve space for ten zoom levels. */
-{
-repeatCharOut(f, 0, bbiMaxZoomLevels * 24);
-}
-
-void bbiSummaryElementWrite(FILE *f, struct bbiSummaryElement *sum)
-/* Write out summary element to file. */
-{
-writeOne(f, sum->validCount);
-writeOne(f, sum->minVal);
-writeOne(f, sum->maxVal);
-writeOne(f, sum->sumData);
-writeOne(f, sum->sumSquares);
-}
-
-static int bbiChromInfoCmp(const void *va, const void *vb)
-/* Sort bbiChromInfo.  Unlike most of our sorts this is single rather
- * than double indirect. */
-{
-const struct bbiChromInfo *a = (const struct bbiChromInfo *)va;
-const struct bbiChromInfo *b = (const struct bbiChromInfo *)vb;
-return strcmp(a->name, b->name);
-}
-
-
-void bbiWriteChromInfo(struct bbiChromUsage *usageList, int blockSize, FILE *f)
-/* Write out information on chromosomes to file. */
-{
-int chromCount = slCount(usageList);
-struct bbiChromUsage *usage;
-
-/* Allocate and fill in array from list. */
-struct bbiChromInfo *chromInfoArray = NULL;
-int maxChromNameSize = 0;
-if (chromCount > 0)
-    {
-    AllocArray(chromInfoArray, chromCount);
-    int i;
-    for (i=0, usage = usageList; i<chromCount; ++i, usage = usage->next)
-	{
-	char *chromName = usage->name;
-	int len = strlen(chromName);
-	if (len > maxChromNameSize)
-	    maxChromNameSize = len;
-	chromInfoArray[i].name = chromName;
-	chromInfoArray[i].id = usage->id;
-	chromInfoArray[i].size = usage->size;
-	}
-
-    /* Sort so the b-Tree actually works. */
-    qsort(chromInfoArray, chromCount, sizeof(chromInfoArray[0]), bbiChromInfoCmp);
-    }
-
-/* Write chromosome bPlusTree */
-int chromBlockSize = min(blockSize, chromCount);
-bptFileBulkIndexToOpenFile(chromInfoArray, sizeof(chromInfoArray[0]), chromCount, chromBlockSize,
-    bbiChromInfoKey, maxChromNameSize, bbiChromInfoVal, 
-    sizeof(chromInfoArray[0].id) + sizeof(chromInfoArray[0].size), 
-    f);
-
-freeMem(chromInfoArray);
-}
-
-void bbiWriteFloat(FILE *f, float val)
-/* Write out floating point val to file.  Mostly to convert from double... */
-{
-writeOne(f, val);
-}
-
-struct hash *bbiChromSizesFromFile(char *fileName)
-/* Read two column file into hash keyed by chrom. */
-{
-struct hash *hash = hashNew(0);
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *row[2];
-while (lineFileRow(lf, row))
-    hashAddInt(hash, row[0], sqlUnsigned(row[1]));
-
-lineFileClose(&lf);
-return hash;
-}
-
-void bbiChromInfoKey(const void *va, char *keyBuf)
-/* Get key field out of bbiChromInfo. */
-{
-const struct bbiChromInfo *a = ((struct bbiChromInfo *)va);
-strcpy(keyBuf, a->name);
-}
-
-void *bbiChromInfoVal(const void *va)
-/* Get val field out of bbiChromInfo. */
-{
-const struct bbiChromInfo *a = ((struct bbiChromInfo *)va);
-return (void*)(&a->id);
-}
-
-void bbiChromUsageFree(struct bbiChromUsage **pUsage)
-/* free a single bbiChromUsage structure */
-{
-struct bbiChromUsage *usage = *pUsage;
-if (usage != NULL)
-    {
-    freeMem(usage->name);
-    freez(pUsage);
-    }
-}
-
-void bbiChromUsageFreeList(struct bbiChromUsage **pList)
-/* free a list of bbiChromUsage structures */
-{
-struct bbiChromUsage *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    bbiChromUsageFree(&el);
-    }
-*pList = NULL;
-}
-
-int bbExIndexMakerMaxIndexField(struct bbExIndexMaker *eim)
-/* Return the maximum field we have to index. */
-{
-int maxIx = 0;
-int i;
-for (i=0; i<eim->indexCount; ++i)
-    {
-    int ix = eim->indexFields[i];
-    if (ix > maxIx)
-        maxIx = ix;
-    }
-return maxIx;
-}
-
-void bbExIndexMakerUpdateMaxFieldSize(struct bbExIndexMaker *eim, char **row)
-/* Fold in information about row into bbExIndexMaker into eim->maxFieldSize */
-{
-int i;
-for (i=0; i<eim->indexCount; ++i)
-    {
-    int rowIx = eim->indexFields[i];
-    int size = strlen(row[rowIx]);
-    if (size > eim->maxFieldSize[i])
-        eim->maxFieldSize[i] = size;
-    }
-}
-
-struct bbiChromUsage *bbiChromUsageFromBedFile(struct lineFile *lf, struct hash *chromSizesHash, 
-	struct bbExIndexMaker *eim, int *retMinDiff, double *retAveSize, bits64 *retBedCount)
-/* Go through bed file and collect chromosomes and statistics.  If eim parameter is non-NULL
- * collect max field sizes there too. */
-{
-int maxRowSize = (eim == NULL ? 3 : bbExIndexMakerMaxIndexField(eim) + 1);
-char *row[maxRowSize];
-struct hash *uniqHash = hashNew(0);
-struct bbiChromUsage *usage = NULL, *usageList = NULL;
-int lastStart = -1;
-bits32 id = 0;
-bits64 totalBases = 0, bedCount = 0;
-int minDiff = BIGNUM;
-
-lineFileRemoveInitialCustomTrackLines(lf);
-
-for (;;)
-    {
-    int rowSize = lineFileChopNext(lf, row, maxRowSize);
-    if (rowSize == 0)
-        break;
-    lineFileExpectAtLeast(lf, maxRowSize, rowSize);
-    char *chrom = row[0];
-    int start = lineFileNeedNum(lf, row, 1);
-    int end = lineFileNeedNum(lf, row, 2);
-    if (eim != NULL)
-	bbExIndexMakerUpdateMaxFieldSize(eim, row);
-    if (start > end)
-        {
-	    errAbort("end (%d) before start (%d) line %d of %s",
-	    	end, start, lf->lineIx, lf->fileName);
-	}
-    ++bedCount;
-    totalBases += (end - start);
-    if (usage == NULL || differentString(usage->name, chrom))
-        {
-	if (hashLookup(uniqHash, chrom))
-	    {
-	    errAbort("%s is not sorted at line %d.  Please use \"sort -k1,1 -k2,2n\" or bedSort and try again.",
-	    	lf->fileName, lf->lineIx);
-	    }
-	hashAdd(uniqHash, chrom, NULL);
-	struct hashEl *chromHashEl = hashLookup(chromSizesHash, chrom);
-	if (chromHashEl == NULL)
-	    errAbort("%s is not found in chromosome sizes file", chrom);
-	int chromSize = ptToInt(chromHashEl->val);
-	AllocVar(usage);
-	usage->name = cloneString(chrom);
-	usage->id = id++;
-	usage->size = chromSize;
-	slAddHead(&usageList, usage);
-	lastStart = -1;
-	}
-    if (end > usage->size)
-        errAbort("End coordinate %d bigger than %s size of %d line %d of %s", end, usage->name, usage->size, lf->lineIx, lf->fileName);
-    usage->itemCount += 1;
-    if (lastStart >= 0)
-        {
-	int diff = start - lastStart;
-	if (diff < minDiff)
-	    {
-	    if (diff < 0)
-		errAbort("%s is not sorted at line %d.  Please use \"sort -k1,1 -k2,2n\" or bedSort and try again.",
-		    lf->fileName, lf->lineIx);
-	    minDiff = diff;
-	    }
-	}
-    lastStart = start;
-    }
-slReverse(&usageList);
-double aveSize = 0;
-if (bedCount > 0)
-    aveSize = (double)totalBases/bedCount;
-*retMinDiff = minDiff;
-*retAveSize = aveSize;
-*retBedCount = bedCount;
-freeHash(&uniqHash);
-return usageList;
-}
-
-int bbiCalcResScalesAndSizes(int aveSize, 
-    int resScales[bbiMaxZoomLevels], int resSizes[bbiMaxZoomLevels])
-/* Fill in resScales with amount to zoom at each level, and zero out resSizes based
- * on average span. Returns the number of zoom levels we actually will use. */
-{
-int resTryCount = bbiMaxZoomLevels, resTry;
-int resIncrement = bbiResIncrement;
-int minZoom = 10;
-int res = aveSize;
-if (res < minZoom)
-    res = minZoom;
-for (resTry = 0; resTry < resTryCount; ++resTry)
-    {
-    resSizes[resTry] = 0;
-    resScales[resTry] = res;
-    // if aveSize is large, then the initial value of res is large, and we
-    // and we cannot do all 10 levels without overflowing res* integers and other related variables.
-    if (res > 1000000000) 
-	{
-	resTryCount = resTry + 1;  
-	verbose(2, "resTryCount reduced from 10 to %d\n", resTryCount);
-	break;
-	}
-    res *= resIncrement;
-    }
-return resTryCount;
-}
-
-int bbiWriteZoomLevels(
-    struct lineFile *lf,    /* Input file. */
-    FILE *f,		    /* Output. */
-    int blockSize,	    /* Size of index block */
-    int itemsPerSlot,	    /* Number of data points bundled at lowest level. */
-    bbiWriteReducedOnceReturnReducedTwice writeReducedOnceReturnReducedTwice,   /* callback */
-    int fieldCount,	    /* Number of fields in bed (4 for bedGraph) */
-    boolean doCompress,	    /* Do we compress.  Answer really should be yes! */
-    bits64 dataSize,	    /* Size of data on disk (after compression if any). */
-    struct bbiChromUsage *usageList, /* Result from bbiChromUsageFromBedFile */
-    int resTryCount, int resScales[], int resSizes[],   /* How much to zoom at each level */
-    bits32 zoomAmounts[bbiMaxZoomLevels],      /* Fills in amount zoomed at each level. */
-    bits64 zoomDataOffsets[bbiMaxZoomLevels],  /* Fills in where data starts for each zoom level. */
-    bits64 zoomIndexOffsets[bbiMaxZoomLevels], /* Fills in where index starts for each level. */
-    struct bbiSummaryElement *totalSum)
-/* Write out all the zoom levels and return the number of levels written.  Writes 
- * actual zoom amount and the offsets of the zoomed data and index in the last three
- * parameters.  Sorry for all the parameters - it was this or duplicate a big chunk of
- * code between bedToBigBed and bedGraphToBigWig. */
-{
-/* Write out first zoomed section while storing in memory next zoom level. */
-assert(resTryCount > 0);
-int maxReducedSize = dataSize/2;
-int initialReduction = 0, initialReducedCount = 0;
-
-/* Figure out initialReduction for zoom - one that is maxReducedSize or less. */
-int resTry;
-for (resTry = 0; resTry < resTryCount; ++resTry)
-    {
-    bits64 reducedSize = resSizes[resTry] * sizeof(struct bbiSummaryOnDisk);
-    if (doCompress)
-	reducedSize /= 2;	// Estimate!
-    if (reducedSize <= maxReducedSize)
-	{
-	initialReduction = resScales[resTry];
-	initialReducedCount = resSizes[resTry];
-	break;
-	}
-    }
-verbose(2, "initialReduction %d, initialReducedCount = %d\n", 
-    initialReduction, initialReducedCount);
-
-/* Force there to always be at least one zoom.  It may waste a little space on small
- * files, but it makes files more uniform, and avoids special case code for calculating
- * overall file summary. */
-if (initialReduction == 0)
-    {
-    initialReduction = resScales[0];
-    initialReducedCount = resSizes[0];
-    }
-
-/* Call routine to make the initial zoom level and also a bit of work towards further levels. */
-struct lm *lm = lmInit(0);
-int zoomIncrement = bbiResIncrement;
-lineFileRewind(lf);
-struct bbiSummary *rezoomedList = writeReducedOnceReturnReducedTwice(usageList, fieldCount,
-	lf, initialReduction, initialReducedCount,
-	zoomIncrement, blockSize, itemsPerSlot, doCompress, lm, 
-	f, &zoomDataOffsets[0], &zoomIndexOffsets[0], totalSum);
-verboseTime(2, "writeReducedOnceReturnReducedTwice");
-zoomAmounts[0] = initialReduction;
-int zoomLevels = 1;
-
-/* Loop around to do any additional levels of zoom. */
-int zoomCount = initialReducedCount;
-int reduction = initialReduction * zoomIncrement;
-while (zoomLevels < bbiMaxZoomLevels)
-    {
-    int rezoomCount = slCount(rezoomedList);
-    if (rezoomCount >= zoomCount)
-	break;
-    zoomCount = rezoomCount;
-    zoomDataOffsets[zoomLevels] = ftell(f);
-    zoomIndexOffsets[zoomLevels] = bbiWriteSummaryAndIndex(rezoomedList, 
-	blockSize, itemsPerSlot, doCompress, f);
-    zoomAmounts[zoomLevels] = reduction;
-    ++zoomLevels;
-    reduction *= zoomIncrement;
-    rezoomedList = bbiSummarySimpleReduce(rezoomedList, reduction, lm);
-    }
-lmCleanup(&lm);
-verboseTime(2, "further reductions");
-return zoomLevels;
-}
-
-
-int bbiCountSectionsNeeded(struct bbiChromUsage *usageList, int itemsPerSlot)
-/* Count up number of sections needed for data. */
-{
-struct bbiChromUsage *usage;
-int count = 0;
-for (usage = usageList; usage != NULL; usage = usage->next)
-    {
-    int countOne = (usage->itemCount + itemsPerSlot - 1)/itemsPerSlot;
-    count += countOne;
-    verbose(2, "%s %d, %d blocks of %d\n", usage->name, usage->itemCount, countOne, itemsPerSlot);
-    }
-return count;
-}
-
-
-void bbiAddToSummary(bits32 chromId, bits32 chromSize, bits32 start, bits32 end, 
-	bits32 validCount, double minVal, double maxVal, double sumData, double sumSquares,  
-	int reduction, struct bbiSummary **pOutList)
-/* Add data range to summary - putting it onto top of list if possible, otherwise
- * expanding list. */
-{
-struct bbiSummary *sum = *pOutList;
-if (end > chromSize)	// Avoid pathological clipping situation on bad input
-    end = chromSize;
-while (start < end)
-    {
-    /* See if need to allocate a new summary. */
-    if (sum == NULL || sum->chromId != chromId || sum->end <= start)
-        {
-	struct bbiSummary *newSum;
-	AllocVar(newSum);
-	newSum->chromId = chromId;
-	if (sum == NULL || sum->chromId != chromId || sum->end + reduction <= start)
-	    newSum->start = start;
-	else
-	    newSum->start = sum->end;
-	newSum->end = newSum->start + reduction;
-	if (newSum->end > chromSize)
-	    newSum->end = chromSize;
-	newSum->minVal = minVal;
-	newSum->maxVal = maxVal;
-	sum = newSum;
-	slAddHead(pOutList, sum);
-	}
-
-    /* Figure out amount of overlap between current summary and item */
-    int overlap = rangeIntersection(start, end, sum->start, sum->end);
-    if (overlap <= 0) 
-	{
-        warn("%u %u doesn't intersect %u %u, chromId %u chromSize %u", start, end, sum->start, sum->end, chromId, chromSize);
-	internalErr();
-	}
-    int itemSize = end - start;
-    double overlapFactor = (double)overlap/itemSize;
-
-    /* Fold overlapping bits into output. */
-    sum->validCount += overlapFactor * validCount;
-    if (sum->minVal > minVal)
-        sum->minVal = minVal;
-    if (sum->maxVal < maxVal)
-        sum->maxVal = maxVal;
-    sum->sumData += overlapFactor * sumData;
-    sum->sumSquares += overlapFactor * sumSquares;
-
-    /* Advance over overlapping bits. */
-    start += overlap;
-    }
-}
-
-void bbiAddRangeToSummary(bits32 chromId, bits32 chromSize, bits32 start, bits32 end, 
-	double val, int reduction, struct bbiSummary **pOutList)
-/* Add chromosome range to summary - putting it onto top of list if possible, otherwise
- * expanding list. */
-{
-int size = end-start;
-double sum = size*val;
-double sumSquares = sum*val;
-bbiAddToSummary(chromId, chromSize, start, end, size, val, val, sum, sumSquares, reduction, pOutList);
-}
-
-struct bbiSummary *bbiReduceSummaryList(struct bbiSummary *inList, 
-	struct bbiChromInfo *chromInfoArray, int reduction)
-/* Reduce summary list to another summary list. */
-{
-struct bbiSummary *outList = NULL;
-struct bbiSummary *sum;
-for (sum = inList; sum != NULL; sum = sum->next)
-    bbiAddToSummary(sum->chromId, chromInfoArray[sum->chromId].size, sum->start, sum->end, sum->validCount, sum->minVal,
-    	sum->maxVal, sum->sumData, sum->sumSquares, reduction, &outList);
-slReverse(&outList);
-return outList;
-}
-
-bits64 bbiTotalSummarySize(struct bbiSummary *list)
-/* Return size on disk of all summaries. */
-{
-struct bbiSummary *el;
-bits64 total = 0;
-for (el = list; el != NULL; el = el->next)
-    total += sizeof(struct bbiSummaryOnDisk);
-return total;
-}
-
-
-static bits64 bbiSummaryFetchOffset(const void *va, void *context)
-/* Fetch bbiSummary file offset for r-tree */
-{
-const struct bbiSummary *a = *((struct bbiSummary **)va);
-return a->fileOffset;
-}
-
-static struct cirTreeRange bbiSummaryFetchKey(const void *va, void *context)
-/* Fetch bbiSummary key for r-tree */
-{
-struct cirTreeRange res;
-const struct bbiSummary *a = *((struct bbiSummary **)va);
-res.chromIx = a->chromId;
-res.start = a->start;
-res.end = a->end;
-return res;
-}
-
-
-static bits64 bbiWriteSummaryAndIndexComp(struct bbiSummary *summaryList, 
-	int blockSize, int itemsPerSlot, FILE *f)
-/* Write out summary and index to summary uncompressed, returning start position of
- * summary index. */
-{
-bits32 i, count = slCount(summaryList);
-struct bbiSummary **summaryArray;
-AllocArray(summaryArray, count);
-writeOne(f, count);
-struct bbiSummary *summary = summaryList;
-
-/* Figure out max size of uncompressed and compressed blocks. */
-bits32 itemSize = sizeof(summary->chromId) + sizeof(summary->start) + sizeof(summary->end) + sizeof(summary->validCount) + 4*sizeof(float);
-int uncBufSize = itemSize * itemsPerSlot;
-char uncBuf[uncBufSize];
-int compBufSize = zCompBufSize(uncBufSize);
-char compBuf[compBufSize];
-
-/* Loop through compressing and writing one slot at a time. */
-bits32 itemsLeft = count;
-int sumIx = 0;
-while (itemsLeft > 0)
-    {
-    bits32 itemsInSlot = itemsLeft;
-    if (itemsInSlot > itemsPerSlot)
-         itemsInSlot = itemsPerSlot;
-    char *writePt = uncBuf;
-
-    bits64 filePos = ftell(f);
-    for (i=0; i<itemsInSlot; ++i)
-        {
-	summaryArray[sumIx++] = summary;
-	memWriteOne(&writePt, summary->chromId);
-	memWriteOne(&writePt, summary->start);
-	memWriteOne(&writePt, summary->end);
-	memWriteOne(&writePt, summary->validCount);
-	memWriteFloat(&writePt, summary->minVal);
-	memWriteFloat(&writePt, summary->maxVal);
-	memWriteFloat(&writePt, summary->sumData);
-	memWriteFloat(&writePt, summary->sumSquares);
-	summary->fileOffset = filePos;
-	summary = summary->next;
-	if (summary == NULL)
-	    break;
-	}
-
-    bits32 uncSize = writePt - uncBuf;
-    int compSize = zCompress(uncBuf, uncSize, compBuf, compBufSize);
-    mustWrite(f, compBuf, compSize);
-
-    itemsLeft -= itemsInSlot;
-    }
-bits64 indexOffset = ftell(f);
-cirTreeFileBulkIndexToOpenFile(summaryArray, sizeof(summaryArray[0]), count,
-    blockSize, itemsPerSlot, NULL, bbiSummaryFetchKey, bbiSummaryFetchOffset, 
-    indexOffset, f);
-freez(&summaryArray);
-return indexOffset;
-}
-
-static bits64 bbiWriteSummaryAndIndexUnc(struct bbiSummary *summaryList, 
-	int blockSize, int itemsPerSlot, FILE *f)
-/* Write out summary and index to summary compressed, returning start position of
- * summary index. */
-{
-bits32 i, count = slCount(summaryList);
-struct bbiSummary **summaryArray;
-AllocArray(summaryArray, count);
-writeOne(f, count);
-struct bbiSummary *summary;
-for (summary = summaryList, i=0; summary != NULL; summary = summary->next, ++i)
-    {
-    summaryArray[i] = summary;
-    summary->fileOffset = ftell(f);
-    writeOne(f, summary->chromId);
-    writeOne(f, summary->start);
-    writeOne(f, summary->end);
-    writeOne(f, summary->validCount);
-    bbiWriteFloat(f, summary->minVal);
-    bbiWriteFloat(f, summary->maxVal);
-    bbiWriteFloat(f, summary->sumData);
-    bbiWriteFloat(f, summary->sumSquares);
-    }
-bits64 indexOffset = ftell(f);
-cirTreeFileBulkIndexToOpenFile(summaryArray, sizeof(summaryArray[0]), count,
-    blockSize, itemsPerSlot, NULL, bbiSummaryFetchKey, bbiSummaryFetchOffset, 
-    indexOffset, f);
-freez(&summaryArray);
-return indexOffset;
-}
-
-bits64 bbiWriteSummaryAndIndex(struct bbiSummary *summaryList, 
-	int blockSize, int itemsPerSlot, boolean doCompress, FILE *f)
-/* Write out summary and index to summary, returning start position of
- * summary index. */
-{
-if (doCompress)
-    return bbiWriteSummaryAndIndexComp(summaryList, blockSize, itemsPerSlot, f);
-else
-    return bbiWriteSummaryAndIndexUnc(summaryList, blockSize, itemsPerSlot, f);
-}
-
-struct cirTreeRange bbiBoundsArrayFetchKey(const void *va, void *context)
-/* Fetch bbiBoundsArray key for r-tree */
-{
-const struct bbiBoundsArray *a = ((struct bbiBoundsArray *)va);
-return a->range;
-}
-
-bits64 bbiBoundsArrayFetchOffset(const void *va, void *context)
-/* Fetch bbiBoundsArray file offset for r-tree */
-{
-const struct bbiBoundsArray *a = ((struct bbiBoundsArray *)va);
-return a->offset;
-}
-
-struct bbiSumOutStream *bbiSumOutStreamOpen(int allocCount, FILE *f, boolean doCompress)
-/* Allocate new bbiSumOutStream. */
-{
-struct bbiSumOutStream *stream;
-AllocVar(stream);
-AllocArray(stream->array, allocCount);
-stream->allocCount = allocCount;
-stream->f = f;
-stream->doCompress = doCompress;
-return stream;
-}
-
-void bbiSumOutStreamFlush(struct bbiSumOutStream *stream)
-/* Flush out any pending input. */
-{
-if (stream->elCount != 0)
-    {
-    int uncSize = stream->elCount * sizeof(stream->array[0]);
-    if (stream->doCompress)
-        {
-	int compBufSize = zCompBufSize(uncSize);
-	char compBuf[compBufSize];
-	int compSize = zCompress(stream->array, uncSize, compBuf, compBufSize);
-	mustWrite(stream->f, compBuf, compSize);
-	}
-    else
-        {
-	mustWrite(stream->f, stream->array, uncSize);
-	}
-    stream->elCount = 0;
-    }
-}
-
-void bbiSumOutStreamClose(struct bbiSumOutStream **pStream)
-/* Free up bbiSumOutStream */
-{
-struct bbiSumOutStream *stream = *pStream;
-if (stream != NULL)
-    {
-    bbiSumOutStreamFlush(stream);
-    freeMem(stream->array);
-    freez(pStream);
-    }
-}
-
-void bbiSumOutStreamWrite(struct bbiSumOutStream *stream, struct bbiSummary *sum)
-/* Write out next one to stream. */
-{
-int elCount = stream->elCount;
-struct bbiSummaryOnDisk *a = &stream->array[elCount];
-a->chromId = sum->chromId;
-a->start = sum->start;
-a->end = sum->end;
-a->validCount = sum->validCount;
-a->minVal = sum->minVal;
-a->maxVal = sum->maxVal;
-a->sumData = sum->sumData;
-a->sumSquares = sum->sumSquares;
-elCount += 1;
-stream->elCount = elCount;
-if (elCount >= stream->allocCount)
-    bbiSumOutStreamFlush(stream);    
-}
-
-void bbiOutputOneSummaryFurtherReduce(struct bbiSummary *sum, 
-	struct bbiSummary **pTwiceReducedList, 
-	int doubleReductionSize, struct bbiBoundsArray **pBoundsPt, 
-	struct bbiBoundsArray *boundsEnd, struct lm *lm, 
-	struct bbiSumOutStream *stream)
-/* Write out sum to file, keeping track of minimal info on it in *pBoundsPt, and also adding
- * it to second level summary. */
-{
-/* Get place to store file offset etc and make sure we have not gone off end. */
-struct bbiBoundsArray *bounds = *pBoundsPt;
-assert(bounds < boundsEnd);
-*pBoundsPt += 1;
-
-/* Fill in bounds info. */
-bounds->offset = ftell(stream->f);
-bounds->range.chromIx = sum->chromId;
-bounds->range.start = sum->start;
-bounds->range.end = sum->end;
-
-/* Write out summary info. */
-bbiSumOutStreamWrite(stream, sum);
-
-/* Fold summary info into pTwiceReducedList. */
-struct bbiSummary *twiceReduced = *pTwiceReducedList;
-if (twiceReduced == NULL || twiceReduced->chromId != sum->chromId 
-	|| twiceReduced->start + doubleReductionSize < sum->end)
-    {
-    lmAllocVar(lm, twiceReduced);
-    *twiceReduced = *sum;
-    slAddHead(pTwiceReducedList, twiceReduced);
-    }
-else
-    {
-    twiceReduced->end = sum->end;
-    twiceReduced->validCount += sum->validCount;
-    if (sum->minVal < twiceReduced->minVal) twiceReduced->minVal = sum->minVal;
-    if (sum->maxVal > twiceReduced->maxVal) twiceReduced->maxVal = sum->maxVal;
-    twiceReduced->sumData += sum->sumData;
-    twiceReduced->sumSquares += sum->sumSquares;
-    }
-}
-
-struct bbiSummary *bbiSummarySimpleReduce(struct bbiSummary *list, int reduction, struct lm *lm)
-/* Do a simple reduction - where among other things the reduction level is an integral
- * multiple of the previous reduction level, and the list is sorted. Allocate result out of lm. */
-{
-struct bbiSummary *newList = NULL, *sum, *newSum = NULL;
-for (sum = list; sum != NULL; sum = sum->next)
-    {
-    if (newSum == NULL || newSum->chromId != sum->chromId || sum->end > newSum->start + reduction)
-        {
-	lmAllocVar(lm, newSum);
-	*newSum = *sum;
-	slAddHead(&newList, newSum);
-	}
-    else
-        {
-	assert(newSum->end < sum->end);	// check sorted input assumption
-	newSum->end = sum->end;
-	newSum->validCount += sum->validCount;
-	if (newSum->minVal > sum->minVal) newSum->minVal = sum->minVal;
-	if (newSum->maxVal < sum->maxVal) newSum->maxVal = sum->maxVal;
-	newSum->sumData += sum->sumData;
-	newSum->sumSquares += sum->sumSquares;
-	}
-    }
-slReverse(&newList);
-return newList;
-}
-
diff --git a/gbtools/src/blatSrc/lib/bigBed.c b/gbtools/src/blatSrc/lib/bigBed.c
deleted file mode 100644
index 8548f2d..0000000
--- a/gbtools/src/blatSrc/lib/bigBed.c
+++ /dev/null
@@ -1,651 +0,0 @@
-/* bigBed - interface to binary file with bed-style values (that is a bunch of
- * possibly overlapping regions. */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "linefile.h"
-#include "obscure.h"
-#include "dystring.h"
-#include "rangeTree.h"
-#include "cirTree.h"
-#include "bPlusTree.h"
-#include "basicBed.h"
-#include "asParse.h"
-#include "zlibFace.h"
-#include "sig.h"
-#include "udc.h"
-#include "bbiFile.h"
-#include "bigBed.h"
-
-struct bbiFile *bigBedFileOpen(char *fileName)
-/* Open up big bed file. */
-{
-return bbiFileOpen(fileName, bigBedSig, "big bed");
-}
-
-boolean bigBedFileCheckSigs(char *fileName)
-/* check file signatures at beginning and end of file */
-{
-return bbiFileCheckSigs(fileName, bigBedSig, "big bed");
-}
-
-struct bigBedInterval *bigBedIntervalQuery(struct bbiFile *bbi, char *chrom,
-	bits32 start, bits32 end, int maxItems, struct lm *lm)
-/* Get data for interval.  Return list allocated out of lm.  Set maxItems to maximum
- * number of items to return, or to 0 for all items. */
-{
-struct bigBedInterval *el, *list = NULL;
-int itemCount = 0;
-bbiAttachUnzoomedCir(bbi);
-bits32 chromId;
-struct fileOffsetSize *blockList = bbiOverlappingBlocks(bbi, bbi->unzoomedCir,
-	chrom, start, end, &chromId);
-struct fileOffsetSize *block, *beforeGap, *afterGap;
-struct udcFile *udc = bbi->udc;
-boolean isSwapped = bbi->isSwapped;
-
-/* Set up for uncompression optionally. */
-char *uncompressBuf = NULL;
-if (bbi->uncompressBufSize > 0)
-    uncompressBuf = needLargeMem(bbi->uncompressBufSize);
-
-char *mergedBuf = NULL;
-for (block = blockList; block != NULL; )
-    {
-    /* Find contigious blocks and read them into mergedBuf. */
-    fileOffsetSizeFindGap(block, &beforeGap, &afterGap);
-    bits64 mergedOffset = block->offset;
-    bits64 mergedSize = beforeGap->offset + beforeGap->size - mergedOffset;
-    udcSeek(udc, mergedOffset);
-    mergedBuf = needLargeMem(mergedSize);
-    udcMustRead(udc, mergedBuf, mergedSize);
-    char *blockBuf = mergedBuf;
-
-    /* Loop through individual blocks within merged section. */
-    for (;block != afterGap; block = block->next)
-        {
-	/* Uncompress if necessary. */
-	char *blockPt, *blockEnd;
-	if (uncompressBuf)
-	    {
-	    blockPt = uncompressBuf;
-	    int uncSize = zUncompress(blockBuf, block->size, uncompressBuf, bbi->uncompressBufSize);
-	    blockEnd = blockPt + uncSize;
-	    }
-	else
-	    {
-	    blockPt = blockBuf;
-	    blockEnd = blockPt + block->size;
-	    }
-
-	while (blockPt < blockEnd)
-	    {
-	    /* Read next record into local variables. */
-	    bits32 chr = memReadBits32(&blockPt, isSwapped);	// Read and discard chromId
-	    bits32 s = memReadBits32(&blockPt, isSwapped);
-	    bits32 e = memReadBits32(&blockPt, isSwapped);
-
-	    /* calculate length of rest of bed fields */
-	    int restLen = strlen(blockPt);
-
-	    /* If we're actually in range then copy it into a new  element and add to list. */
-	    if (chr == chromId && s < end && e > start)
-		{
-		++itemCount;
-		if (maxItems > 0 && itemCount > maxItems)
-		    break;
-
-		lmAllocVar(lm, el);
-		el->start = s;
-		el->end = e;
-		if (restLen > 0)
-		    el->rest = lmCloneStringZ(lm, blockPt, restLen);
-		el->chromId = chromId;
-		slAddHead(&list, el);
-		}
-
-	    // move blockPt pointer to end of previous bed
-	    blockPt += restLen + 1;
-	    }
-	if (maxItems > 0 && itemCount > maxItems)
-	    break;
-	blockBuf += block->size;
-        }
-    if (maxItems > 0 && itemCount > maxItems)
-        break;
-    freez(&mergedBuf);
-    }
-freez(&mergedBuf);
-freeMem(uncompressBuf);
-slFreeList(&blockList);
-slReverse(&list);
-return list;
-}
-
-int bigBedIntervalToRow(struct bigBedInterval *interval, char *chrom, char *startBuf, char *endBuf,
-	char **row, int rowSize)
-/* Convert bigBedInterval into an array of chars equivalent to what you'd get by
- * parsing the bed file. The startBuf and endBuf are used to hold the ascii representation of
- * start and end.  Note that the interval->rest string will have zeroes inserted as a side effect.
- */
-{
-int fieldCount = 3;
-sprintf(startBuf, "%u", interval->start);
-sprintf(endBuf, "%u", interval->end);
-row[0] = chrom;
-row[1] = startBuf;
-row[2] = endBuf;
-if (!isEmpty(interval->rest))
-    {
-    int wordCount = chopByChar(cloneString(interval->rest), '\t', row+3, rowSize-3);
-    fieldCount += wordCount;
-    }
-return fieldCount;
-}
-
-static struct bbiInterval *bigBedCoverageIntervals(struct bbiFile *bbi,
-	char *chrom, bits32 start, bits32 end, struct lm *lm)
-/* Return intervals where the val is the depth of coverage. */
-{
-/* Get list of overlapping intervals */
-struct bigBedInterval *bi, *biList = bigBedIntervalQuery(bbi, chrom, start, end, 0, lm);
-if (biList == NULL)
-    return NULL;
-
-/* Make a range tree that collects coverage. */
-struct rbTree *rangeTree = rangeTreeNew();
-for (bi = biList; bi != NULL; bi = bi->next)
-    rangeTreeAddToCoverageDepth(rangeTree, bi->start, bi->end);
-struct range *range, *rangeList = rangeTreeList(rangeTree);
-
-/* Convert rangeList to bbiInterval list. */
-struct bbiInterval *bwi, *bwiList = NULL;
-for (range = rangeList; range != NULL; range = range->next)
-    {
-    lmAllocVar(lm, bwi);
-    bwi->start = range->start;
-    if (bwi->start < start)
-       bwi->start = start;
-    bwi->end = range->end;
-    if (bwi->end > end)
-       bwi->end = end;
-    bwi->val = ptToInt(range->val);
-    slAddHead(&bwiList, bwi);
-    }
-slReverse(&bwiList);
-
-/* Clean up and go home. */
-rangeTreeFree(&rangeTree);
-return bwiList;
-}
-
-boolean bigBedSummaryArrayExtended(struct bbiFile *bbi, char *chrom, bits32 start, bits32 end,
-	int summarySize, struct bbiSummaryElement *summary)
-/* Get extended summary information for summarySize evenly spaced elements into
- * the summary array. */
-{
-return bbiSummaryArrayExtended(bbi, chrom, start, end, bigBedCoverageIntervals,
-	summarySize, summary);
-}
-
-boolean bigBedSummaryArray(struct bbiFile *bbi, char *chrom, bits32 start, bits32 end,
-	enum bbiSummaryType summaryType, int summarySize, double *summaryValues)
-/* Fill in summaryValues with  data from indicated chromosome range in bigBed file.
- * Be sure to initialize summaryValues to a default value, which will not be touched
- * for regions without data in file.  (Generally you want the default value to either
- * be 0.0 or nan("") depending on the application.)  Returns FALSE if no data
- * at that position. */
-{
-return bbiSummaryArray(bbi, chrom, start, end, bigBedCoverageIntervals,
-	summaryType, summarySize, summaryValues);
-}
-
-struct offsetSize 
-/* Simple file offset and file size. */
-    {
-    bits64 offset; 
-    bits64 size;
-    };
-
-static int cmpOffsetSizeRef(const void *va, const void *vb)
-/* Compare to sort slRef pointing to offsetSize.  Sort is kind of hokey,
- * but guarantees all items that are the same will be next to each other
- * at least, which is all we care about. */
-{
-const struct slRef *a = *((struct slRef **)va);
-const struct slRef *b = *((struct slRef **)vb);
-return memcmp(a->val, b->val, sizeof(struct offsetSize));
-}
-
-static struct fileOffsetSize *fosFromRedundantBlockList(struct slRef **pBlockList, 
-    boolean isSwapped)
-/* Convert from list of references to offsetSize format to list of fileOffsetSize
- * format, while removing redundancy.   Sorts *pBlockList as a side effect. */
-{
-/* Sort input so it it easy to uniquify. */
-slSort(pBlockList, cmpOffsetSizeRef);
-struct slRef *blockList = *pBlockList;
-
-/* Make new fileOffsetSize for each unique offsetSize. */
-struct fileOffsetSize *fosList = NULL, *fos;
-struct offsetSize lastOffsetSize = {0,0};
-struct slRef *blockRef;
-for (blockRef = blockList; blockRef != NULL; blockRef = blockRef->next)
-    {
-    if (memcmp(&lastOffsetSize, blockRef->val, sizeof(lastOffsetSize)) != 0)
-        {
-	memcpy(&lastOffsetSize, blockRef->val, sizeof(lastOffsetSize));
-	AllocVar(fos);
-	if (isSwapped)
-	    {
-	    fos->offset = byteSwap64(lastOffsetSize.offset);
-	    fos->size = byteSwap64(lastOffsetSize.size);
-	    }
-	else
-	    {
-	    fos->offset = lastOffsetSize.offset;
-	    fos->size = lastOffsetSize.size;
-	    }
-	slAddHead(&fosList, fos);
-	}
-    }
-slReverse(&fosList);
-return fosList;
-}
-
-
-static struct fileOffsetSize *bigBedChunksMatchingName(struct bbiFile *bbi, 
-    struct bptFile *index, char *name)
-/* Get list of file chunks that match name.  Can slFreeList this when done. */
-{
-struct slRef *blockList = bptFileFindMultiple(index, 
-	name, strlen(name), sizeof(struct offsetSize));
-struct fileOffsetSize *fosList = fosFromRedundantBlockList(&blockList, bbi->isSwapped);
-slRefFreeListAndVals(&blockList);
-return fosList;
-}
-
-static struct fileOffsetSize *bigBedChunksMatchingNames(struct bbiFile *bbi, 
-	struct bptFile *index, char **names, int nameCount)
-/* Get list of file chunks that match any of the names.  Can slFreeList this when done. */
-{
-/* Go through all names and make a blockList that includes all blocks with any hit to any name.  
- * Many of these blocks will occur multiple times. */
-struct slRef *blockList = NULL;
-int nameIx;
-for (nameIx = 0; nameIx < nameCount; ++nameIx)
-    {
-    char *name = names[nameIx];
-    struct slRef *oneList = bptFileFindMultiple(index, 
-	    name, strlen(name), sizeof(struct offsetSize));
-    blockList = slCat(oneList, blockList);
-    }
-
-/* Create nonredundant list of blocks. */
-struct fileOffsetSize *fosList = fosFromRedundantBlockList(&blockList, bbi->isSwapped);
-
-/* Clean up and resturn result. */
-slRefFreeListAndVals(&blockList);
-return fosList;
-}
-
-typedef boolean (*BbFirstWordMatch)(char *line, int fieldIx, void *target);
-/* A function that returns TRUE if first word in tab-separated line matches target. */
-
-static void extractField(char *line, int fieldIx, char **retField, int *retFieldSize)
-/* Go through tab separated line and figure out start and size of given field. */
-{
-int i;
-fieldIx -= 3;	/* Skip over chrom/start/end, which are not in line. */
-for (i=0; i<fieldIx; ++i)
-    {
-    line = strchr(line, '\t');
-    if (line == NULL)
-        {
-	warn("Not enough fields in extractField of %s", line);
-	internalErr();
-	}
-    line += 1;
-    }
-char *end = strchr(line, '\t');
-if (end == NULL)
-    end = line + strlen(line);
-*retField = line;
-*retFieldSize = end - line;
-}
-
-static boolean bbWordMatchesName(char *line, int fieldIx, void *target)
-/* Return true if first word of line is same as target, which is just a string. */
-{
-char *name = target;
-int fieldSize;
-char *field;
-extractField(line, fieldIx, &field, &fieldSize);
-return strlen(name) == fieldSize && memcmp(name, field, fieldSize) == 0;
-}
-
-static boolean bbWordIsInHash(char *line, int fieldIx, void *target)
-/* Return true if first word of line is same as target, which is just a string. */
-{
-int fieldSize;
-char *field;
-extractField(line, fieldIx, &field, &fieldSize);
-char fieldString[fieldSize+1];
-memcpy(fieldString, field, fieldSize);
-fieldString[fieldSize] = 0;
-
-/* Return boolean value that reflects whether we found it in hash */
-struct hash *hash = target;
-return hashLookup(hash, fieldString) != NULL;
-}
-
-static struct bigBedInterval *bigBedIntervalsMatchingName(struct bbiFile *bbi, 
-    struct fileOffsetSize *fosList, BbFirstWordMatch matcher, int fieldIx, 
-    void *target, struct lm *lm)
-/* Return list of intervals inside of sectors of bbiFile defined by fosList where the name 
- * matches target somehow. */
-{
-struct bigBedInterval *interval, *intervalList = NULL;
-struct fileOffsetSize *fos;
-boolean isSwapped = bbi->isSwapped;
-for (fos = fosList; fos != NULL; fos = fos->next)
-    {
-    /* Read in raw data */
-    udcSeek(bbi->udc, fos->offset);
-    char *rawData = needLargeMem(fos->size);
-    udcRead(bbi->udc, rawData, fos->size);
-
-    /* Optionally uncompress data, and set data pointer to uncompressed version. */
-    char *uncompressedData = NULL;
-    char *data = NULL;
-    int dataSize = 0;
-    if (bbi->uncompressBufSize > 0)
-	{
-	data = uncompressedData = needLargeMem(bbi->uncompressBufSize);
-	dataSize = zUncompress(rawData, fos->size, uncompressedData, bbi->uncompressBufSize);
-	}
-    else
-	{
-        data = rawData;
-	dataSize = fos->size;
-	}
-
-    /* Set up for "memRead" routines to more or less treat memory block like file */
-    char *blockPt = data, *blockEnd = data + dataSize;
-    struct dyString *dy = dyStringNew(32); // Keep bits outside of chrom/start/end here
-
-
-    /* Read next record into local variables. */
-    while (blockPt < blockEnd)
-	{
-	bits32 chromIx = memReadBits32(&blockPt, isSwapped);
-	bits32 s = memReadBits32(&blockPt, isSwapped);
-	bits32 e = memReadBits32(&blockPt, isSwapped);
-	int c;
-	dyStringClear(dy);
-	// TODO - can simplify this probably just to for (;;) {if ((c = *blockPt++) == 0) ...
-	while ((c = *blockPt++) >= 0)
-	    {
-	    if (c == 0)
-		break;
-	    dyStringAppendC(dy, c);
-	    }
-	if ((*matcher)(dy->string, fieldIx, target))
-	    {
-	    lmAllocVar(lm, interval);
-	    interval->start = s;
-	    interval->end = e;
-	    interval->rest = cloneString(dy->string);
-	    interval->chromId = chromIx;
-	    slAddHead(&intervalList, interval);
-	    }
-	}
-
-    /* Clean up temporary buffers. */
-    dyStringFree(&dy);
-    freez(&uncompressedData);
-    freez(&rawData);
-    }
-slReverse(&intervalList);
-return intervalList;
-}
-
-
-
-struct bigBedInterval *bigBedNameQuery(struct bbiFile *bbi, struct bptFile *index,
-    int fieldIx, char *name, struct lm *lm)
-/* Return list of intervals matching file. These intervals will be allocated out of lm. */
-{
-struct fileOffsetSize *fosList = bigBedChunksMatchingName(bbi, index, name);
-struct bigBedInterval *intervalList = bigBedIntervalsMatchingName(bbi, fosList, 
-    bbWordMatchesName, fieldIx, name, lm);
-slFreeList(&fosList);
-return intervalList;
-}
-
-struct bigBedInterval *bigBedMultiNameQuery(struct bbiFile *bbi, struct bptFile *index,
-    int fieldIx, char **names, int nameCount, struct lm *lm)
-/* Fetch all records matching any of the names. Using given index on given field.
- * Return list is allocated out of lm. */
-{
-/* Set up name index and get list of chunks that match any of our names. */
-struct fileOffsetSize *fosList = bigBedChunksMatchingNames(bbi, index, names, nameCount);
-
-/* Create hash of all names. */
-struct hash *hash = newHash(0);
-int nameIx;
-for (nameIx=0; nameIx < nameCount; ++nameIx)
-    hashAdd(hash, names[nameIx], NULL);
-
-
-/* Get intervals where name matches hash target. */
-struct bigBedInterval *intervalList = bigBedIntervalsMatchingName(bbi, fosList, 
-    bbWordIsInHash, fieldIx, hash, lm);
-
-/* Clean up and return results. */
-slFreeList(&fosList);
-hashFree(&hash);
-return intervalList;
-}
-
-void bigBedIntervalListToBedFile(struct bbiFile *bbi, struct bigBedInterval *intervalList, FILE *f)
-/* Write out big bed interval list to bed file, looking up chromosome. */
-{
-char chromName[bbi->chromBpt->keySize+1];
-int lastChromId = -1;
-struct bigBedInterval *interval;
-for (interval = intervalList; interval != NULL; interval = interval->next)
-    {
-    bbiCachedChromLookup(bbi, interval->chromId, lastChromId, chromName, sizeof(chromName));
-    lastChromId = interval->chromId;
-    fprintf(f, "%s\t%u\t%u\t%s\n", chromName, interval->start, interval->end, interval->rest);
-    }
-}
-
-int bigBedIntervalToRowLookupChrom(struct bigBedInterval *interval, 
-    struct bigBedInterval *prevInterval, struct bbiFile *bbi,
-    char *chromBuf, int chromBufSize, char *startBuf, char *endBuf, char **row, int rowSize)
-/* Convert bigBedInterval to array of chars equivalend to what you'd get by parsing the
- * bed file.  If you already know what chromosome the interval is on use the simpler
- * bigBedIntervalToRow.  This one will look up the chromosome based on the chromId field
- * of the interval,  which is relatively time consuming.  To avoid doing this unnecessarily
- * pass in a non-NULL prevInterval,  and if the chromId is the same on prevInterval as this,
- * it will avoid the lookup.  The chromBufSize should be at greater or equal to 
- * bbi->chromBpt->keySize+1. The startBuf and endBuf are used to hold the ascii representation of
- * start and end, and should be 16 bytes.  Note that the interval->rest string will have zeroes 
- * inserted as a side effect.  Returns number of fields in row.  */
-{
-int lastChromId = (prevInterval == NULL ? -1 : prevInterval->chromId);
-bbiCachedChromLookup(bbi, interval->chromId, lastChromId, chromBuf, chromBufSize);
-return bigBedIntervalToRow(interval, chromBuf, startBuf, endBuf, row, rowSize);
-}
-
-char *bigBedAutoSqlText(struct bbiFile *bbi)
-/* Get autoSql text if any associated with file.  Do a freeMem of this when done. */
-{
-if (bbi->asOffset == 0)
-    return NULL;
-struct udcFile *f = bbi->udc;
-udcSeek(f, bbi->asOffset);
-return udcReadStringAndZero(f);
-}
-
-struct asObject *bigBedAs(struct bbiFile *bbi)
-/* Get autoSql object definition if any associated with file. */
-{
-if (bbi->asOffset == 0)
-    return NULL;
-char *asText = bigBedAutoSqlText(bbi);
-struct asObject *as = asParseText(asText);
-freeMem(asText);
-return as;
-}
-
-struct asObject *bigBedAsOrDefault(struct bbiFile *bbi)
-// Get asObject associated with bigBed - if none exists in file make it up from field counts.
-{
-struct asObject *as = bigBedAs(bbi);
-if (as == NULL)
-    as = asParseText(bedAsDef(bbi->definedFieldCount, bbi->fieldCount));
-return as;
-}
-
-struct asObject *bigBedFileAsObjOrDefault(char *fileName)
-// Get asObject associated with bigBed file, or the default.
-{
-struct bbiFile *bbi = bigBedFileOpen(fileName);
-if (bbi)
-    {
-    struct asObject *as = bigBedAsOrDefault(bbi);
-    bbiFileClose(&bbi);
-    return as;
-    }
-return NULL;
-}
-
-bits64 bigBedItemCount(struct bbiFile *bbi)
-/* Return total items in file. */
-{
-udcSeek(bbi->udc, bbi->unzoomedDataOffset);
-return udcReadBits64(bbi->udc, bbi->isSwapped);
-}
-
-struct slName *bigBedListExtraIndexes(struct bbiFile *bbi)
-/* Return list of names of extra indexes beyond primary chrom:start-end one" */
-{
-struct udcFile *udc = bbi->udc;
-boolean isSwapped = bbi->isSwapped;
-
-/* See if we have any extra indexes, and if so seek to there. */
-bits64 offset = bbi->extraIndexListOffset;
-if (offset == 0)
-   return NULL;
-udcSeek(udc, offset);
-
-/* Construct list of field that are being indexed.  List is list of 
- * field numbers within asObj. */
-int i;
-struct slInt *intList = NULL, *intEl;
-for (i=0; i<bbi->extraIndexCount; ++i)
-    {
-    bits16 type,fieldCount;
-    type = udcReadBits16(udc, isSwapped);
-    fieldCount = udcReadBits16(udc, isSwapped);
-    udcSeekCur(udc, sizeof(bits64));  // skip over fileOffset
-    udcSeekCur(udc, 4);    // skip over reserved bits
-    if (fieldCount == 1)
-        {
-	bits16 fieldId = udcReadBits16(udc, isSwapped);
-	udcSeekCur(udc, 2);    // skip over reserved bits
-	intEl = slIntNew(fieldId);
-	slAddHead(&intList, intEl);
-	}
-    else
-        {
-	warn("Not yet understanding indexes on multiple fields at once.");
-	internalErr();
-	}
-    }
-
-/* Now have to make an asObject to find out name that corresponds to this field. */
-struct asObject *as = bigBedAsOrDefault(bbi);
-
-/* Make list of field names out of list of field numbers */
-struct slName *nameList = NULL;
-for (intEl = intList; intEl != NULL; intEl = intEl->next)
-    {
-    struct asColumn *col = slElementFromIx(as->columnList, intEl->val);
-    if (col == NULL)
-	{
-        warn("Inconsistent bigBed file %s", bbi->fileName);
-	internalErr();
-	}
-    slNameAddHead(&nameList, col->name);
-    }
-
-asObjectFree(&as);
-return nameList;
-}
-
-struct bptFile *bigBedOpenExtraIndex(struct bbiFile *bbi, char *fieldName, int *retFieldIx)
-/* Return index associated with fieldName.  Aborts if no such index.  Optionally return
- * index in a row of this field. */
-{
-struct udcFile *udc = bbi->udc;
-boolean isSwapped = bbi->isSwapped;
-struct asObject *as = bigBedAsOrDefault(bbi);
-struct asColumn *col = asColumnFind(as, fieldName);
-if (col == NULL)
-    errAbort("No field %s in %s", fieldName, bbi->fileName);
-int colIx = slIxFromElement(as->columnList, col);
-if (retFieldIx != NULL)
-   *retFieldIx = colIx;
-asObjectFree(&as);
-
-/* See if we have any extra indexes, and if so seek to there. */
-bits64 offset = bbi->extraIndexListOffset;
-if (offset == 0)
-   errAbort("%s has no indexes", bbi->fileName);
-udcSeek(udc, offset);
-
-/* Go through each extra index and see if it's a match */
-int i;
-for (i=0; i<bbi->extraIndexCount; ++i)
-    {
-    bits16 type = udcReadBits16(udc, isSwapped);
-    bits16 fieldCount = udcReadBits16(udc, isSwapped);
-    bits64 fileOffset = udcReadBits64(udc, isSwapped);
-    udcSeekCur(udc, 4);    // skip over reserved bits
-
-    if (type != 0)
-        {
-	warn("Don't understand type %d", type);
-	internalErr();
-	}
-    if (fieldCount == 1)
-        {
-	bits16 fieldId = udcReadBits16(udc, isSwapped);
-	udcSeekCur(udc, 2);    // skip over reserved bits
-	if (fieldId == colIx)
-	    {
-	    udcSeek(udc, fileOffset);
-	    struct bptFile *bpt = bptFileAttach(bbi->fileName, udc);
-	    return bpt;
-	    }
-	}
-    else
-        {
-	warn("Not yet understanding indexes on multiple fields at once.");
-	internalErr();
-	}
-    }
-
-errAbort("%s is not indexed in %s", fieldName, bbi->fileName);
-return NULL;
-}
-
-
-
diff --git a/gbtools/src/blatSrc/lib/binRange.c b/gbtools/src/blatSrc/lib/binRange.c
deleted file mode 100644
index ab7ca60..0000000
--- a/gbtools/src/blatSrc/lib/binRange.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/* binRange Stuff to handle binning - which helps us restrict 
- * our attention to the parts of database that contain info
- * about a particular window on a chromosome. This scheme
- * will work without modification for chromosome sizes up
- * to half a gigaBase.  The finest sized bin is 128k (1<<17).
- * The next coarsest is 8x as big (1<<13).  There's a hierarchy
- * of bins with the chromosome itself being the final bin.
- * Features are put in the finest bin they'll fit in. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "binRange.h"
-
-
-/* add one new level to get coverage past chrom sizes of 512 Mb
- *	effective limit is now the size of an integer since chrom start
- *	and end coordinates are always being used in int's == 2Gb-1 */
-static int binOffsetsExtended[] =
-	{4096+512+64+8+1, 512+64+8+1, 64+8+1, 8+1, 1, 0};
-
-static int binOffsets[] = {512+64+8+1, 64+8+1, 8+1, 1, 0};
-#define _binFirstShift 17	/* How much to shift to get to finest bin. */
-#define _binNextShift 3		/* How much to shift to get to next larger bin. */
-
-int binLevelsExtended()
-/* Return number of levels to bins. */
-{
-return ArraySize(binOffsetsExtended);
-}
-
-int binLevels()
-/* Return number of levels to bins. */
-{
-return ArraySize(binOffsets);
-}
-
-int binFirstShift()
-/* Return amount to shift a number to get to finest bin. */
-{
-return _binFirstShift;
-}
-
-int binNextShift()
-/* Return amount to shift a number to get to next coarser bin. */
-{
-return _binNextShift;
-}
-
-int binOffsetExtended(int level)
-/* Return offset for bins of a given level. */
-{
-assert(level >= 0 && level < ArraySize(binOffsetsExtended));
-return binOffsetsExtended[level] + _binOffsetOldToExtended;
-}
-
-int binOffset(int level)
-/* Return offset for bins of a given level. */
-{
-assert(level >= 0 && level < ArraySize(binOffsets));
-return binOffsets[level];
-}
-
-static int binFromRangeStandard(int start, int end)
-/* Given start,end in chromosome coordinates assign it
- * a bin.   There's a bin for each 128k segment, for each
- * 1M segment, for each 8M segment, for each 64M segment,
- * and for each chromosome (which is assumed to be less than
- * 512M.)  A range goes into the smallest bin it will fit in. */
-{
-int startBin = start, endBin = end-1, i;
-startBin >>= _binFirstShift;
-endBin >>= _binFirstShift;
-for (i=0; i<ArraySize(binOffsets); ++i)
-    {
-    if (startBin == endBin)
-        return binOffsets[i] + startBin;
-    startBin >>= _binNextShift;
-    endBin >>= _binNextShift;
-    }
-errAbort("start %d, end %d out of range in findBin (max is 512M)", start, end);
-return 0;
-}
-
-static int binFromRangeExtended(int start, int end)
-/* Given start,end in chromosome coordinates assign it
- * a bin.   There's a bin for each 128k segment, for each
- * 1M segment, for each 8M segment, for each 64M segment,
- * for each 512M segment, and one top level bin for 4Gb.
- *	Note, since start and end are int's, the practical limit
- *	is up to 2Gb-1, and thus, only four result bins on the second
- *	level.
- * A range goes into the smallest bin it will fit in. */
-{
-int startBin = start, endBin = end-1, i;
-startBin >>= _binFirstShift;
-endBin >>= _binFirstShift;
-for (i=0; i<ArraySize(binOffsetsExtended); ++i)
-    {
-    if (startBin == endBin)
-	return _binOffsetOldToExtended + binOffsetsExtended[i] + startBin;
-    startBin >>= _binNextShift;
-    endBin >>= _binNextShift;
-    }
-errAbort("start %d, end %d out of range in findBin (max is 2Gb)", start, end);
-return 0;
-}
-
-int binFromRange(int start, int end)
-/* return bin that this start-end segment is in */
-{
-if (end <= BINRANGE_MAXEND_512M)
-    return binFromRangeStandard(start, end);
-else
-    return binFromRangeExtended(start, end);
-}
-
-static int binFromRangeBinKeeperExtended(int start, int end)
-/* This is just like binFromRangeExtended() above, but it doesn't limit
- * the answers to the range from _binOffsetOldToExtended and up.
- *	It simply uses the whole new bin scheme as if it was the only
- *	one.
- */
-{
-int startBin = start, endBin = end-1, i;
-startBin >>= _binFirstShift;
-endBin >>= _binFirstShift;
-for (i=0; i<ArraySize(binOffsetsExtended); ++i)
-    {
-    if (startBin == endBin)
-	return binOffsetsExtended[i] + startBin;
-    startBin >>= _binNextShift;
-    endBin >>= _binNextShift;
-    }
-errAbort("start %d, end %d out of range in findBin (max is 2Gb)", start, end);
-return 0;
-}
-
-struct binKeeper *binKeeperNew(int minPos, int maxPos)
-/* Create new binKeeper that can cover range. */
-{
-int binCount;
-struct binKeeper *bk;
-if (minPos < 0 || maxPos < 0 || minPos > maxPos)
-    errAbort("bad range %d,%d in binKeeperNew", minPos, maxPos);
-
-binCount = binFromRangeBinKeeperExtended(maxPos-1, maxPos) + 1;
-AllocVar(bk);
-bk->minPos = minPos;
-bk->maxPos = maxPos;
-bk->binCount = binCount;
-AllocArray(bk->binLists, binCount);
-return bk;
-}
-
-void binKeeperFree(struct binKeeper **pBk)
-/* Free up a bin keeper. */
-{
-struct binKeeper *bk = *pBk;
-if (bk != NULL)
-    {
-    int i;
-    for (i=0; i<bk->binCount; ++i)
-	slFreeList(&bk->binLists[i]);
-    freeMem(bk->binLists);
-    freez(pBk);
-    }
-}
-
-void binKeeperAdd(struct binKeeper *bk, int start, int end, void *val)
-/* Add item to binKeeper. */ 
-{
-int bin;
-struct binElement *el;
-if (start < bk->minPos || end > bk->maxPos || start > end)
-    errAbort("(%d %d) out of range (%d %d) in binKeeperAdd", 
-    	start, end, bk->minPos, bk->maxPos);
-bin = binFromRangeBinKeeperExtended(start, end);
-assert(bin < bk->binCount);
-AllocVar(el);
-el->start = start;
-el->end = end;
-el->val = val;
-slAddHead(&bk->binLists[bin], el);
-}
-
-int binElementCmpStart(const void *va, const void *vb)
-/* Compare to sort based on start. */
-{
-const struct binElement *a = *((struct binElement **)va);
-const struct binElement *b = *((struct binElement **)vb);
-return a->start - b->start;
-}
-
-struct binElement *binKeeperFind(struct binKeeper *bk, int start, int end)
-/* Return a list of all items in binKeeper that intersect range.
- * Free this list with slFreeList. */
-{
-struct binElement *list = NULL, *newEl, *el;
-int startBin, endBin;
-int i,j;
-
-if (start < bk->minPos) start = bk->minPos;
-if (end > bk->maxPos) end = bk->maxPos;
-if (start >= end) return NULL;
-startBin = (start>>_binFirstShift);
-endBin = ((end-1)>>_binFirstShift);
-for (i=0; i<ArraySize(binOffsetsExtended); ++i)
-    {
-    int offset = binOffsetsExtended[i];
-    for (j=startBin+offset; j<=endBin+offset; ++j)
-        {
-	for (el=bk->binLists[j]; el != NULL; el = el->next)
-	    {
-	    if (rangeIntersection(el->start, el->end, start, end) > 0)
-	        {
-		newEl = CloneVar(el);
-		slAddHead(&list, newEl);
-		}
-	    }
-	}
-    startBin >>= _binNextShift;
-    endBin >>= _binNextShift;
-    }
-return list;
-}
-
-boolean binKeeperAnyOverlap(struct binKeeper *bk, int start, int end)
-/* Return TRUE if start/end overlaps with any items in binKeeper. */
-{
-struct binElement *el;
-int startBin, endBin;
-int i,j;
-
-if (start < bk->minPos) start = bk->minPos;
-if (end > bk->maxPos) end = bk->maxPos;
-if (start >= end) return FALSE;
-startBin = (start>>_binFirstShift);
-endBin = ((end-1)>>_binFirstShift);
-for (i=0; i<ArraySize(binOffsetsExtended); ++i)
-    {
-    int offset = binOffsetsExtended[i];
-    for (j=startBin+offset; j<=endBin+offset; ++j)
-        {
-	for (el=bk->binLists[j]; el != NULL; el = el->next)
-	    {
-	    if (rangeIntersection(el->start, el->end, start, end) > 0)
-	        {
-		return TRUE;
-		}
-	    }
-	}
-    startBin >>= _binNextShift;
-    endBin >>= _binNextShift;
-    }
-return FALSE;
-}
-
-void binKeeperReplaceVal(struct binKeeper *bk, int start, int end,
-	void *oldVal, void *newVal)
-/* Replace occurences of old val in range from start->end with newVal */
-{
-struct binElement *el;
-int startBin, endBin;
-int i,j;
-
-if (start < bk->minPos) start = bk->minPos;
-if (end > bk->maxPos) end = bk->maxPos;
-if (start >= end) return;
-startBin = (start>>_binFirstShift);
-endBin = ((end-1)>>_binFirstShift);
-for (i=0; i<ArraySize(binOffsetsExtended); ++i)
-    {
-    int offset = binOffsetsExtended[i];
-    for (j=startBin+offset; j<=endBin+offset; ++j)
-        {
-	for (el=bk->binLists[j]; el != NULL; el = el->next)
-	    {
-	    if (rangeIntersection(el->start, el->end, start, end) > 0)
-	        {
-		if (el->val == oldVal)
-		    {
-		    el->val = newVal;
-		    }
-		}
-	    }
-	}
-    startBin >>= _binNextShift;
-    endBin >>= _binNextShift;
-    }
-}
-
-
-struct binElement *binKeeperFindSorted(struct binKeeper *bk, int start, int end)
-/* Like binKeeperFind, but sort list on start coordinates. */
-{
-struct binElement *list = binKeeperFind(bk, start, end);
-slSort(&list, binElementCmpStart);
-return list;
-}
-
-struct binElement *binKeeperFindAll(struct binKeeper *bk)
-/* Get all elements sorted. */
-{
-return binKeeperFindSorted(bk, bk->minPos, bk->maxPos);
-}
-
-struct binElement *binKeeperFindLowest(struct binKeeper *bk, int start, int end)
-/* Find the lowest overlapping range. Quick even if search range large */
-{
-struct binElement *first = NULL, *el;
-int startBin = (start>>_binFirstShift), endBin = ((end-1)>>_binFirstShift);
-int i,j;
-
-/* Search the possible range of bins at each level, looking for lowest.  Once
- * an overlaping range is found at a level, continue with next level, however
- * must search an entire bin as they are not ordered. */
-for (i=0; i<ArraySize(binOffsetsExtended); ++i)
-    {
-    int offset = binOffsetsExtended[i];
-    boolean foundOne = FALSE;
-    for (j=startBin+offset; (j<=endBin+offset) && (!foundOne); ++j)
-        {
-	for (el=bk->binLists[j]; el != NULL; el = el->next)
-	    {
-            if ((rangeIntersection(el->start, el->end, start, end) > 0)
-                && ((first == NULL) || (el->start < first->start)
-                    || ((el->start == first->start)
-                        && (el->end < first->end))))
-                {
-                first = el;
-                foundOne = TRUE;
-		}
-	    }
-	}
-    startBin >>= _binNextShift;
-    endBin >>= _binNextShift;
-    }
-return first;
-}
-
-
-void binKeeperRemove(struct binKeeper *bk, int start, int end, void *val)
-/* Remove item from binKeeper. */ 
-{
-int bin = binFromRangeBinKeeperExtended(start, end);
-struct binElement **pList = &bk->binLists[bin], *newList = NULL, *el, *next;
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    if (el->val == val && el->start == start && el->end == end)
-        {
-	freeMem(el);
-	}
-    else
-        {
-	slAddHead(&newList, el);
-	}
-    }
-slReverse(&newList);
-*pList = newList;
-}
-
-struct binKeeperCookie binKeeperFirst(struct binKeeper *bk)
-/* Return an object to use by binKeeperNext() to traverse the binElements.
- * The first call to binKeeperNext() will return the first entry in the
- * table. */
-{
-struct binKeeperCookie cookie;
-cookie.bk = bk;
-cookie.blIdx = 0;
-cookie.nextBel = bk->binLists[0];
-return cookie;
-}
-
-struct binElement* binKeeperNext(struct binKeeperCookie *cookie)
-/* Return the next entry in the binKeeper table.  */
-{
-/* if we don't have a next, move down bin list until we find one */
-while ((cookie->nextBel == NULL)
-       && (++cookie->blIdx < cookie->bk->binCount))
-    cookie->nextBel = cookie->bk->binLists[cookie->blIdx];
-if (cookie->blIdx >= cookie->bk->binCount)
-    return NULL;  /* no more */
-else
-    {
-    struct binElement* bel = cookie->nextBel;
-    cookie->nextBel = cookie->nextBel->next;
-    return bel;
-    }
-}
diff --git a/gbtools/src/blatSrc/lib/bits.c b/gbtools/src/blatSrc/lib/bits.c
deleted file mode 100644
index 1cca72c..0000000
--- a/gbtools/src/blatSrc/lib/bits.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/* bits - handle operations on arrays of bits. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "bits.h"
-
-
-
-static Bits oneBit[8] = { 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1};
-static Bits leftMask[8] = {0xFF, 0x7F, 0x3F, 0x1F,  0xF,  0x7,  0x3,  0x1,};
-static Bits rightMask[8] = {0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF,};
-int bitsInByte[256];
-
-static boolean inittedBitsInByte = FALSE;
-
-void bitsInByteInit()
-/* Initialize bitsInByte array. */
-{
-int i;
-
-if (!inittedBitsInByte)
-    {
-    inittedBitsInByte = TRUE;
-    for (i=0; i<256; ++i)
-        {
-	int count = 0;
-	if (i&1)
-	    count = 1;
-	if (i&2)
-	    ++count;
-	if (i&4)
-	    ++count;
-	if (i&8)
-	    ++count;
-	if (i&0x10)
-	    ++count;
-	if (i&0x20)
-	    ++count;
-	if (i&0x40)
-	    ++count;
-	if (i&0x80)
-	    ++count;
-	bitsInByte[i] = count;
-	}
-    }
-}
-
-Bits *bitAlloc(int bitCount)
-/* Allocate bits. */
-{
-int byteCount = ((bitCount+7)>>3);
-return needLargeZeroedMem(byteCount);
-}
-
-Bits *bitRealloc(Bits *b, int bitCount, int newBitCount)
-/* Resize a bit array.  If b is null, allocate a new array */
-{
-int byteCount = ((bitCount+7)>>3);
-int newByteCount = ((newBitCount+7)>>3);
-return needLargeZeroedMemResize(b, byteCount, newByteCount);
-}
-
-Bits *bitClone(Bits* orig, int bitCount)
-/* Clone bits. */
-{
-int byteCount = ((bitCount+7)>>3);
-Bits* bits = needLargeZeroedMem(byteCount);
-memcpy(bits, orig, byteCount);
-return bits;
-}
-
-void bitFree(Bits **pB)
-/* Free bits. */
-{
-freez(pB);
-}
-
-Bits *lmBitAlloc(struct lm *lm,int bitCount)
-// Allocate bits.  Must supply local memory.
-{
-assert(lm != NULL);
-int byteCount = ((bitCount+7)>>3);
-return lmAlloc(lm,byteCount);
-}
-
-Bits *lmBitRealloc(struct lm *lm,Bits *b, int bitCount, int newBitCount)
-// Resize a bit array.  If b is null, allocate a new array.  Must supply local memory.
-{
-assert(lm != NULL);
-int byteCount = ((bitCount+7)>>3);
-int newByteCount = ((newBitCount+7)>>3);
-return lmAllocMoreMem(lm, b ,byteCount, newByteCount);
-}
-
-Bits *lmBitClone(struct lm *lm,Bits* orig, int bitCount)
-// Clone bits.  Must supply local memory.
-{
-assert(lm != NULL);
-int byteCount = ((bitCount+7)>>3);
-Bits* bits = lmAlloc(lm,byteCount);
-memcpy(bits, orig, byteCount);
-return bits;
-}
-
-void bitSetOne(Bits *b, int bitIx)
-/* Set a single bit. */
-{
-b[bitIx>>3] |= oneBit[bitIx&7];
-}
-
-void bitClearOne(Bits *b, int bitIx)
-/* Clear a single bit. */
-{
-b[bitIx>>3] &= ~oneBit[bitIx&7];
-}
-
-void bitSetRange(Bits *b, int startIx, int bitCount)
-/* Set a range of bits. */
-{
-if (bitCount <= 0)
-    return;
-int endIx = (startIx + bitCount - 1);
-int startByte = (startIx>>3);
-int endByte = (endIx>>3);
-int startBits = (startIx&7);
-int endBits = (endIx&7);
-int i;
-
-if (startByte == endByte)
-    {
-    b[startByte] |= (leftMask[startBits] & rightMask[endBits]);
-    return;
-    }
-b[startByte] |= leftMask[startBits];
-for (i = startByte+1; i<endByte; ++i)
-    b[i] = 0xff;
-b[endByte] |= rightMask[endBits];
-}
-
-
-boolean bitReadOne(Bits *b, int bitIx)
-/* Read a single bit. */
-{
-return (b[bitIx>>3] & oneBit[bitIx&7]) != 0;
-}
-
-int bitCountRange(Bits *b, int startIx, int bitCount)
-/* Count number of bits set in range. */
-{
-if (bitCount <= 0)
-    return 0;
-int endIx = (startIx + bitCount - 1);
-int startByte = (startIx>>3);
-int endByte = (endIx>>3);
-int startBits = (startIx&7);
-int endBits = (endIx&7);
-int i;
-int count = 0;
-
-if (!inittedBitsInByte)
-    bitsInByteInit();
-if (startByte == endByte)
-    return bitsInByte[b[startByte] & leftMask[startBits] & rightMask[endBits]];
-count = bitsInByte[b[startByte] & leftMask[startBits]];
-for (i = startByte+1; i<endByte; ++i)
-    count += bitsInByte[b[i]];
-count += bitsInByte[b[endByte] & rightMask[endBits]];
-return count;
-}
-
-int bitFind(Bits *b, int startIx, boolean val, int bitCount)
-/* Find the index of the the next set bit. */
-{
-unsigned char notByteVal = val ? 0 : 0xff;
-int iBit = startIx;
-int endByte = ((bitCount-1)>>3);
-int iByte;
-
-/* scan initial byte */
-while (((iBit & 7) != 0) && (iBit < bitCount))
-    {
-    if (bitReadOne(b, iBit) == val)
-        return iBit;
-    iBit++;
-    }
-
-/* scan byte at a time, if not already in last byte */
-iByte = (iBit >> 3);
-if (iByte < endByte)
-    {
-    while ((iByte < endByte) && (b[iByte] == notByteVal))
-        iByte++;
-    iBit = iByte << 3;
-    }
-
-/* scan last byte */
-while (iBit < bitCount)
-    {
-    if (bitReadOne(b, iBit) == val)
-        return iBit;
-    iBit++;
-    }
- return bitCount;  /* not found */
-}
-
-int bitFindSet(Bits *b, int startIx, int bitCount)
-/* Find the index of the the next set bit. */
-{
-return bitFind(b, startIx, TRUE, bitCount);
-}
-
-int bitFindClear(Bits *b, int startIx, int bitCount)
-/* Find the index of the the next clear bit. */
-{
-return bitFind(b, startIx, FALSE, bitCount);
-}
-
-void bitClear(Bits *b, int bitCount)
-/* Clear many bits (possibly up to 7 beyond bitCount). */
-{
-int byteCount = ((bitCount+7)>>3);
-zeroBytes(b, byteCount);
-}
-
-void bitClearRange(Bits *b, int startIx, int bitCount)
-/* Clear a range of bits. */
-{
-if (bitCount <= 0)
-    return;
-int endIx = (startIx + bitCount - 1);
-int startByte = (startIx>>3);
-int endByte = (endIx>>3);
-int startBits = (startIx&7);
-int endBits = (endIx&7);
-int i;
-
-if (startByte == endByte)
-    {
-    b[startByte] &= ~(leftMask[startBits] & rightMask[endBits]);
-    return;
-    }
-b[startByte] &= ~leftMask[startBits];
-for (i = startByte+1; i<endByte; ++i)
-    b[i] = 0x00;
-b[endByte] &= ~rightMask[endBits];
-}
-
-void bitAnd(Bits *a, Bits *b, int bitCount)
-/* And two bitmaps.  Put result in a. */
-{
-int byteCount = ((bitCount+7)>>3);
-while (--byteCount >= 0)
-    {
-    *a = (*a & *b++);
-    a++;
-    }
-}
-
-int bitAndCount(Bits *a, Bits *b, int bitCount)
-// Without altering 2 bitmaps, count the AND bits.
-{
-int byteCount = ((bitCount+7)>>3);
-int count = 0;
-if (!inittedBitsInByte)
-    bitsInByteInit();
-while (--byteCount >= 0)
-    count += bitsInByte[(*a++ & *b++)];
-
-return count;
-}
-
-void bitOr(Bits *a, Bits *b, int bitCount)
-/* Or two bitmaps.  Put result in a. */
-{
-int byteCount = ((bitCount+7)>>3);
-while (--byteCount >= 0)
-    {
-    *a = (*a | *b++);
-    a++;
-    }
-}
-
-int bitOrCount(Bits *a, Bits *b, int bitCount)
-// Without altering 2 bitmaps, count the OR'd bits.
-{
-int byteCount = ((bitCount+7)>>3);
-int count = 0;
-if (!inittedBitsInByte)
-    bitsInByteInit();
-while (--byteCount >= 0)
-    count += bitsInByte[(*a++ | *b++)];
-
-return count;
-}
-
-void bitXor(Bits *a, Bits *b, int bitCount)
-{
-int byteCount = ((bitCount+7)>>3);
-while (--byteCount >= 0)
-    {
-    *a = (*a ^ *b++);
-    a++;
-    }
-}
-
-int bitXorCount(Bits *a, Bits *b, int bitCount)
-// Without altering 2 bitmaps, count the XOR'd bits.
-{
-int byteCount = ((bitCount+7)>>3);
-int count = 0;
-if (!inittedBitsInByte)
-    bitsInByteInit();
-while (--byteCount >= 0)
-    count += bitsInByte[(*a++ ^ *b++)];
-
-return count;
-}
-
-void bitNot(Bits *a, int bitCount)
-/* Flip all bits in a. */
-{
-int byteCount = ((bitCount+7)>>3);
-while (--byteCount >= 0)
-    {
-    *a = ~*a;
-    a++;
-    }
-}
-
-void bitReverseRange(Bits *bits, int startIx, int bitCount)
-// Reverses bits in range (e.g. 110010 becomes 010011)
-{
-if (bitCount <= 0)
-    return;
-int ixA = startIx;
-int ixB = (startIx + bitCount - 1);
-for ( ;ixA < ixB; ixA++, ixB--)
-    {
-    boolean bitA = bitReadOne(bits, ixA);
-    boolean bitB = bitReadOne(bits, ixB);
-    if (!bitA && bitB)
-        {
-        bitSetOne(  bits, ixA);
-        bitClearOne(bits, ixB);
-        }
-    else if (bitA && !bitB)
-        {
-        bitClearOne(bits, ixA);
-        bitSetOne(  bits, ixB);
-        }
-    }
-}
-
-
-void bitPrint(Bits *a, int startIx, int bitCount, FILE* out)
-/* Print part or all of bit map as a string of 0s and 1s.  Mostly useful for
- * debugging */
-{
-int i;
-for (i = startIx; i < bitCount; i++)
-    {
-    if (bitReadOne(a, i))
-        fputc('1', out);
-    else
-        fputc('0', out);
-    }
-fputc('\n', out);
-}
-
-void bitsOut(FILE* out, Bits *bits, int startIx, int bitCount, boolean onlyOnes)
-// Print part or all of bit map as a string of 0s and 1s.
-// If onlyOnes, enclose result in [] and use ' ' instead of '0'.
-{
-if (onlyOnes)
-    fputc('[', out);
-
-int ix = startIx;
-for ( ; ix < bitCount; ix++)
-    {
-    if (bitReadOne(bits, ix))
-        fputc('1', out);
-    else
-        {
-        if (onlyOnes)
-            fputc(' ', out);
-        else
-            fputc('0', out);
-        }
-    }
-if (onlyOnes)
-    fputc(']', out);
-}
-
-Bits *bitsIn(struct lm *lm,char *bitString, int len)
-// Returns a bitmap from a string of 1s and 0s.  Any non-zero, non-blank char sets a bit.
-// Returned bitmap is the size of len even if that is longer than the string.
-// Optionally supply local memory.  Note does NOT handle enclosing []s printed with bitsOut().
-{
-if (bitString == NULL || len == 0)
-    return NULL;
-
-Bits *bits = NULL;
-if (lm != NULL)
-    bits = lmBitAlloc(lm,len);
-else
-    bits = bitAlloc(len);
-
-int ix = 0;
-for ( ;ix < len && bitString[ix] != '\0'; ix++)
-    {
-    if (bitString[ix] != '0' && bitString[ix] != ' ')
-        bitSetOne(bits, ix);
-    }
-return bits;
-}
-
diff --git a/gbtools/src/blatSrc/lib/blastOut.c b/gbtools/src/blatSrc/lib/blastOut.c
deleted file mode 100644
index ea36c2c..0000000
--- a/gbtools/src/blatSrc/lib/blastOut.c
+++ /dev/null
@@ -1,833 +0,0 @@
-/* blastOut.c - stuff to output an alignment in blast format. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "axt.h"
-#include "obscure.h"
-#include "genoFind.h"
-
-
-struct axtRef
-/* A reference to an axt. */
-    {
-    struct axtRef *next;
-    struct axt *axt;
-    };
-
-static int axtRefCmpScore(const void *va, const void *vb)
-/* Compare to sort based on score. */
-{
-const struct axtRef *a = *((struct axtRef **)va);
-const struct axtRef *b = *((struct axtRef **)vb);
-return b->axt->score - a->axt->score;
-}
-
-struct targetHits
-/* Collection of hits to a single target. */
-    {
-    struct targetHits *next;
-    char *name;	    	    /* Target name */
-    int size;		    /* Target size */
-    struct axtRef *axtList; /* List of axts, sorted by score. */
-    int score;		    /* Score of best element */
-    };
-
-static void targetHitsFree(struct targetHits **pObj)
-/* Free one target hits structure. */
-{
-struct targetHits *obj = *pObj;
-if (obj != NULL)
-    {
-    freeMem(obj->name);
-    slFreeList(&obj->axtList);
-    freez(pObj);
-    }
-}
-
-static void targetHitsFreeList(struct targetHits **pList)
-/* Free a list of dynamically allocated targetHits's */
-{
-struct targetHits *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    targetHitsFree(&el);
-    }
-*pList = NULL;
-}
-
-
-static int targetHitsCmpScore(const void *va, const void *vb)
-/* Compare to sort based on score. */
-{
-const struct targetHits *a = *((struct targetHits **)va);
-const struct targetHits *b = *((struct targetHits **)vb);
-
-return b->score - a->score;
-}
-
-static int blastzToWublastScore(int bzScore)
-/* Convert from 100 points/match blastz score to 5 points/match
- * wu-blast score. */
-{
-return bzScore/19;
-}
-
-static double blastzScoreToWuBits(int bzScore, boolean isProt)
-/* Convert from blastz score to bit score.  The magic number's
- * here are taken from comparing wu-blast scores to axtScores on
- * a couple of sequences.  This doesn't really seem to be a bit
- * score.  It's not very close to 2 bits per base. */
-{
-int wuScore = blastzToWublastScore(bzScore);
-if (isProt)
-    return wuScore * 0.3545;
-else
-    return wuScore * 0.1553;
-}
-
-static double blastzScoreToWuExpectation(int bzScore, double databaseSize)
-/* I'm puzzled by the wu-blast expectation score.  I would
- * think it would be  databaseSize / (2^bitScore)  but
- * it's not.   I think the best I can do is approximate
- * it with something scaled to be close to this expectation. */
-{
-double logProbOne = -log(2) * bzScore / 32.1948;
-return databaseSize * exp(logProbOne);
-}
-
-static int blastzScoreToNcbiBits(int bzScore)
-/* Convert blastz score to bit score in NCBI sense. */
-{
-return round(bzScore * 0.0205);
-}
-
-static int blastzScoreToNcbiScore(int bzScore)
-/* Conver blastz score to NCBI matrix score. */
-{
-return round(bzScore * 0.0529);
-}
-
-static double blastzScoreToNcbiExpectation(int bzScore)
-/* Convert blastz score to expectation in NCBI sense. */
-{
-double bits = bzScore * 0.0205;
-double logProb = -bits*log(2);
-return 3.0e9 * exp(logProb);
-}
-
-static double expectationToProbability(double e)
-/* Convert expected number of hits to probability of at least
- * one hit.  This is a crude approximation, but actually pretty precise
- * for e < 0.1, which is all that really matters.... */
-{
-if (e < 0.999)
-    return e;
-else
-    return 0.999;
-}
-
-static int countMatches(char *a, char *b, int size)
-/* Count number of characters that match between a and b. */
-{
-int count = 0;
-int i;
-for (i=0; i<size; ++i)
-    if (toupper(a[i]) == toupper(b[i]))
-        ++count;
-return count;
-}
-
-static int countGaps(char *a, char *b, int size)
-/* Count number of inserts in either strand. */
-{
-int count = 0;
-int i;
-for (i=0; i<size; ++i)
-   {
-   if (a[i] == '-')
-       ++count;
-   if (b[i] == '-')
-       ++count;
-   }
-return count;
-}
-
-static int countGapOpens(char *a, char *b, int size)
-/* Count number of inserts in either strand. */
-{
-int i, count = 0;
-boolean inGap = FALSE;
-for (i=0; i<size; ++i)
-    {
-    if (a[i] == '-' || b[i] == '-')
-        {
-	if (!inGap)
-	    {
-	    ++count;
-	    inGap = TRUE;
-	    }
-	}
-    else
-        {
-	inGap = FALSE;
-	}
-    }
-return count;
-}
-
-
-static int countPositives(char *a, char *b, int size)
-/* Count positive (not necessarily identical) protein matches. */
-{
-int count = 0;
-int i;
-struct axtScoreScheme *ss = axtScoreSchemeProteinDefault();
-for (i=0; i<size; ++i)
-    {
-    if (ss->matrix[(int)a[i]][(int)b[i]] > 0)
-        ++count;
-    }
-return count;
-}
-
-static int plusStrandPos(int pos, int size, char strand, boolean isEnd)
-/* Return position on plus strand, one based. */
-{
-if (strand == '-')
-    {
-    pos = size - pos;
-    if (isEnd)
-       ++pos;
-    }
-else
-    {
-    if (!isEnd)
-        ++pos;
-    }
-return pos;
-}
-
-static int calcDigitCount(struct axt *axt, int tSize, int qSize)
-/* Figure out how many digits needed for blast position display. */
-{
-int tDig, qDig;
-if (axt->qStrand == '-')
-    qDig = digitsBaseTen(qSize - axt->qStart + 1);
-else
-    qDig = digitsBaseTen(axt->qEnd);
-if (axt->tStrand == '-')
-    tDig = digitsBaseTen(tSize - axt->tStart + 1);
-else
-    tDig = digitsBaseTen(axt->tEnd);
-return max(tDig, qDig);
-}
-
-static void blastiodAxtOutput(FILE *f, struct axt *axt, int tSize, int qSize, 
-	int lineSize, boolean isProt, boolean isTranslated)
-/* Output base-by-base part of alignment in blast-like fashion. */
-{
-int tOff = axt->tStart;
-int dt = (isTranslated ? 3 : 1);
-int qOff = axt->qStart;
-int lineStart, lineEnd, i;
-int digits = calcDigitCount(axt, tSize, qSize);
-struct axtScoreScheme *ss = NULL;
-
-if (isProt)
-    ss = axtScoreSchemeProteinDefault();
-for (lineStart = 0; lineStart < axt->symCount; lineStart = lineEnd)
-    {
-    lineEnd = lineStart + lineSize;
-    if (lineEnd > axt->symCount) lineEnd = axt->symCount;
-    fprintf(f, "Query: %-*d ", digits, plusStrandPos(qOff, qSize, axt->qStrand, FALSE));
-    for (i=lineStart; i<lineEnd; ++i)
-	{
-	char c = axt->qSym[i];
-	fputc(c, f);
-	if (c != '-')
-	    ++qOff;
-	}
-    fprintf(f, " %-d\n", plusStrandPos(qOff, qSize, axt->qStrand, TRUE));
-    fprintf(f, "       %*s ", digits, " ");
-    for (i=lineStart; i<lineEnd; ++i)
-        {
-	char q, t, c;
-	q = axt->qSym[i];
-	t = axt->tSym[i];
-	if (isProt)
-	    {
-	    if (q == t)
-	        c = q;
-	    else if (ss->matrix[(int)q][(int)t] > 0)
-	        c = '+';
-	    else
-	        c = ' ';
-	    }
-	else
-	    c = ((toupper(q) == toupper(t)) ? '|' : ' ');
-
-	fputc(c, f);
-	}
-    fprintf(f, "\n");
-    fprintf(f, "Sbjct: %-*d ", digits, plusStrandPos(tOff, tSize, axt->tStrand, FALSE));
-    for (i=lineStart; i<lineEnd; ++i)
-	{
-	char c = axt->tSym[i];
-	fputc(c, f);
-	if (c != '-')
-	    tOff += dt;
-	}
-    fprintf(f, " %-d\n", plusStrandPos(tOff, tSize, axt->tStrand, TRUE));
-    fprintf(f, "\n");
-    }
-}
-
-static struct targetHits *bundleIntoTargets(struct axtBundle *abList)
-/* BLAST typically outputs everything on the same query and target
- * in one clump.  This routine rearranges axts in abList to do this. */
-{
-struct targetHits *targetList = NULL, *target;
-struct hash *targetHash = newHash(10);
-struct axtBundle *ab;
-struct axtRef *ref;
-
-/* Build up a list of targets in database hit by query sorted by
- * score of hits. */
-for (ab = abList; ab != NULL; ab = ab->next)
-    {
-    struct axt *axt;
-    for (axt = ab->axtList; axt != NULL; axt = axt->next)
-	{
-	target = hashFindVal(targetHash, axt->tName);
-	if (target == NULL)
-	    {
-	    AllocVar(target);
-	    slAddHead(&targetList, target);
-	    hashAdd(targetHash, axt->tName, target);
-	    target->name = cloneString(axt->tName);
-	    target->size = ab->tSize;
-	    }
-	if (axt->score > target->score)
-	    target->score = axt->score;
-	AllocVar(ref);
-	ref->axt = axt;
-	slAddHead(&target->axtList, ref);
-	}
-    }
-slSort(&targetList, targetHitsCmpScore);
-for (target = targetList; target != NULL; target = target->next)
-    slSort(&target->axtList, axtRefCmpScore);
-
-hashFree(&targetHash);
-return targetList;
-}
-
-static char *nameForStrand(char strand)
-/* Return Plus/Minus for +/- */
-{
-if (strand == '-')
-    return "Minus";
-else
-    return "Plus";
-}
-
-static char *progType(boolean isProt, struct axtBundle *ab, boolean isUpper)
-/* Return blast 'program' */
-{
-if (!isProt)
-    return isUpper ? "BLASTN" : "blastn";
-else
-    {
-    if (ab->axtList->frame != 0)
-        return isUpper ? "TBLASTN" : "tblastn";
-    else
-        return isUpper ? "BLASTP" : "blastp";
-    }
-}
-
-static void wuBlastOut(struct axtBundle *abList, int queryIx, boolean isProt, 
-	FILE *f, 
-	char *databaseName, int databaseSeqCount, double databaseLetterCount, 
-	char *ourId)
-/* Do wublast-like output at end of processing query. */
-{
-char asciiNum[32];
-struct targetHits *targetList = NULL, *target;
-char *queryName;
-int isRc;
-int querySize = abList->qSize;
-boolean isTranslated = (abList->axtList->frame != 0);
-
-/* Print out stuff that doesn't depend on query or database. */
-if (ourId == NULL)
-    ourId = "axtBlastOut";
-fprintf(f, "%s 2.0MP-WashU [%s]\n", progType(isProt, abList, TRUE), ourId);
-fprintf(f, "\n");
-fprintf(f, "Copyright (C) 2000-2002 Jim Kent\n");
-fprintf(f, "All Rights Reserved\n");
-fprintf(f, "\n");
-fprintf(f, "Reference:  Kent, WJ. (2002) BLAT - The BLAST-like alignment tool\n");
-fprintf(f, "\n");
-if (!isProt)
-    {
-    fprintf(f, "Notice:  this program and its default parameter settings are optimized to find\n");
-    fprintf(f, "nearly identical sequences very rapidly.  For slower but more sensitive\n");
-    fprintf(f, "alignments please use other methods.\n");
-    fprintf(f, "\n");
-    }
-
-/* Print query and database info. */
-queryName = abList->axtList->qName;
-fprintf(f, "Query=  %s\n", queryName);
-fprintf(f, "        (%d letters; record %d)\n", abList->qSize, queryIx);
-fprintf(f, "\n");
-fprintf(f, "Database:  %s\n",  databaseName);
-sprintLongWithCommas(asciiNum, databaseLetterCount);
-fprintf(f, "           %d sequences; %s total letters\n",  databaseSeqCount, asciiNum);
-fprintf(f, "Searching....10....20....30....40....50....60....70....80....90....100%% done\n");
-fprintf(f, "\n");
-
-targetList = bundleIntoTargets(abList);
-
-/* Print out summary of hits. */
-fprintf(f, "                                                                     Smallest\n");
-fprintf(f, "                                                                       Sum\n");
-fprintf(f, "                                                              High  Probability\n");
-fprintf(f, "Sequences producing High-scoring Segment Pairs:              Score  P(N)      N\n");
-fprintf(f, "\n");
-for (target = targetList; target != NULL; target = target->next)
-    {
-    double expectation = blastzScoreToWuExpectation(target->score, databaseLetterCount);
-    double p = expectationToProbability(expectation);
-    fprintf(f, "%-61s %4d  %8.1e %2d\n", target->name, 
-    	blastzToWublastScore(target->score), p, slCount(target->axtList));
-    }
-
-/* Print out details on each target. */
-for (target = targetList; target != NULL; target = target->next)
-    {
-    fprintf(f, "\n\n>%s\n", target->name);
-    fprintf(f, "        Length = %d\n", target->size);
-    fprintf(f, "\n");
-    for (isRc=0; isRc <= 1; ++isRc)
-	{
-	boolean saidStrand = FALSE;
-	char strand = (isRc ? '-' : '+');
-	char *strandName = nameForStrand(strand);
-	struct axtRef *ref;
-	struct axt *axt;
-	for (ref = target->axtList; ref != NULL; ref = ref->next)
-	    {
-	    axt = ref->axt;
-	    if (axt->qStrand == strand)
-		{
-		int matches = countMatches(axt->qSym, axt->tSym, axt->symCount);
-		int positives = countPositives(axt->qSym, axt->tSym, axt->symCount);
-		if (!saidStrand)
-		    {
-		    saidStrand = TRUE;
-		    if (!isProt)
-			fprintf(f, "  %s Strand HSPs:\n\n", strandName);
-		    }
-		fprintf(f, " Score = %d (%2.1f bits), Expect = %5.1e, P = %5.1e\n",
-		     blastzToWublastScore(axt->score), 
-		     blastzScoreToWuBits(axt->score, isProt),
-		     blastzScoreToWuExpectation(axt->score, databaseLetterCount),
-		     blastzScoreToWuExpectation(axt->score, databaseLetterCount));
-		fprintf(f, " Identities = %d/%d (%d%%), Positives = %d/%d (%d%%)",
-		     matches, axt->symCount, round(100.0 * matches / axt->symCount),
-		     positives, axt->symCount, round(100.0 * positives / axt->symCount));
-		if (isProt)
-		    {
-		    if (axt->frame != 0)
-		        fprintf(f, ", Frame = %c%d", axt->tStrand, axt->frame);
-		    fprintf(f, "\n");
-		    }
-		else
-		    fprintf(f, ", Strand = %s / Plus\n", strandName);
-		fprintf(f, "\n");
-		blastiodAxtOutput(f, axt, target->size, querySize, 60, isProt, isTranslated);
-		}
-	    }
-	}
-    }
-
-/* Cleanup time. */
-targetHitsFreeList(&targetList);
-}
-
-static void ncbiPrintE(FILE *f, double e)
-/* Print a small number NCBI style. */
-{
-if (e <= 0.0)
-    fprintf(f, "0.0");
-else if (e <= 1.0e-100)
-    {
-    char buf[256], *s;
-    safef(buf, sizeof(buf), "%e", e);
-    s = strchr(buf, 'e');
-    if (s == NULL)
-	fprintf(f, "0.0");
-    else
-        fprintf(f, "%s", s);
-    }
-else
-    fprintf(f, "%1.0e", e);
-}
-
-/* special global variable needed for Known Genes track building.  Fan 1/21/03 */
-int answer_for_kg;
-static void ncbiBlastOut(struct axtBundle *abList, int queryIx, boolean isProt, 
-	FILE *f, char *databaseName, int databaseSeqCount, 
-	double databaseLetterCount, char *ourId, double minIdentity)
-/* Do ncbiblast-like output at end of processing query. */
-{
-char asciiNum[32];
-struct targetHits *targetList = NULL, *target;
-char *queryName;
-int querySize = abList->qSize;
-boolean isTranslated = (abList->axtList->frame != 0);
-
-/* Print out stuff that doesn't depend on query or database. */
-if (ourId == NULL)
-    ourId = "axtBlastOut";
-fprintf(f, "%s 2.2.11 [%s]\n", progType(isProt, abList, TRUE), ourId);
-fprintf(f, "\n");
-fprintf(f, "Reference:  Kent, WJ. (2002) BLAT - The BLAST-like alignment tool\n");
-fprintf(f, "\n");
-
-/* Print query and database info. */
-queryName = abList->axtList->qName;
-fprintf(f, "Query= %s\n", queryName);
-fprintf(f, "         (%d letters)\n", abList->qSize);
-fprintf(f, "\n");
-fprintf(f, "Database: %s \n",  databaseName);
-sprintLongWithCommas(asciiNum, databaseLetterCount);
-fprintf(f, "           %d sequences; %s total letters\n",  databaseSeqCount, asciiNum);
-fprintf(f, "\n");
-fprintf(f, "Searching.done\n");
-
-targetList = bundleIntoTargets(abList);
-
-/* Print out summary of hits. */
-fprintf(f, "                                                                 Score    E\n");
-fprintf(f, "Sequences producing significant alignments:                      (bits) Value\n");
-fprintf(f, "\n");
-for (target = targetList; target != NULL; target = target->next)
-    {
-    struct axtRef *ref;
-    struct axt *axt;
-    int matches;
-    double identity, expectation;
-    int bit;
-    
-    for (ref = target->axtList; ref != NULL; ref = ref->next)
-	{
-	axt = ref->axt;
-	
-	matches = countMatches(axt->qSym, axt->tSym, axt->symCount);
-	identity = round(100.0 * matches / axt->symCount);
-	/* skip output if minIdentity not reached */
-	if (identity < minIdentity) continue;
-    
-    	bit = blastzScoreToNcbiBits(axt->score);
-        expectation = blastzScoreToNcbiExpectation(axt->score);
-    	fprintf(f, "%-67s  %4d   ", target->name, bit);
-    	ncbiPrintE(f, expectation);
-    	fprintf(f, "\n");
-    	}
-    }
-fprintf(f, "\n");
-
-/* Print out details on each target. */
-for (target = targetList; target != NULL; target = target->next)
-    {
-    struct axtRef *ref;
-    struct axt *axt;
-    int matches, gaps;
-    char *oldName;
-    
-    int ii = 0;
-    double identity;
-    oldName = strdup("");
-
-    for (ref = target->axtList; ref != NULL; ref = ref->next)
-	{
-	ii++;
-	axt = ref->axt;
-	
-	matches = countMatches(axt->qSym, axt->tSym, axt->symCount);
-	identity = round(100.0 * matches / axt->symCount);
-	
-	/* skip output if minIdentity not reached */
-	if (identity < minIdentity) continue;
-        
-	/* print target sequence name and length only once */ 
-	if (!sameWord(oldName, target->name))
-	    {
-	    fprintf(f, "\n\n>%s \n", target->name);
-	    fprintf(f, "          Length = %d\n", target->size);
-	    oldName = strdup(target->name);
-	    }
-
-	fprintf(f, "\n");
-	fprintf(f, " Score = %d bits (%d), Expect = ",
-	     blastzScoreToNcbiBits(axt->score),
-	     blastzScoreToNcbiScore(axt->score));
-	ncbiPrintE(f, blastzScoreToNcbiExpectation(axt->score));
-	fprintf(f, "\n");
-	
-	if (isProt)
-	    {
-	    int positives = countPositives(axt->qSym, axt->tSym, axt->symCount);
-	    gaps = countGaps(axt->qSym, axt->tSym, axt->symCount);
-	    fprintf(f, " Identities = %d/%d (%d%%),",
-		 matches, axt->symCount, round(100.0 * matches / axt->symCount));
-	    fprintf(f, " Positives = %d/%d (%d%%),",
-		 positives, axt->symCount, round(100.0 * positives / axt->symCount));
-	    fprintf(f, " Gaps = %d/%d (%d%%)\n",
-		 gaps, axt->symCount, round(100.0 * gaps / axt->symCount));
-	    if (axt->frame != 0) 
-		fprintf(f, " Frame = %c%d\n", axt->tStrand, axt->frame);
-	    /* set the special global variable, answer_for_kg.  
-   	       This is needed for Known Genes track building.  Fan 1/21/03 */
-            answer_for_kg=axt->symCount - matches;
-	    }
-	else
-	    {
-	    fprintf(f, " Identities = %d/%d (%d%%)\n",
-		 matches, axt->symCount, round(100.0 * matches / axt->symCount));
-	    /* blast displays dna searches as +- instead of blat's default -+ */
-	    if (!isTranslated)
-		if ((axt->qStrand == '-') && (axt->tStrand == '+'))
-		    {
-		    reverseIntRange(&axt->qStart, &axt->qEnd, querySize);
-		    reverseIntRange(&axt->tStart, &axt->tEnd, target->size);
-		    reverseComplement(axt->qSym, axt->symCount);
-		    reverseComplement(axt->tSym, axt->symCount);
-		    axt->qStrand = '+';
-		    axt->tStrand = '-';
-		    }
-	    fprintf(f, " Strand = %s / %s\n", nameForStrand(axt->qStrand),
-		nameForStrand(axt->tStrand));
-	    }
-	fprintf(f, "\n");
-	blastiodAxtOutput(f, axt, target->size, querySize, 60, isProt, isTranslated);
-	}
-    }
-
-fprintf(f, "  Database: %s\n", databaseName);
-
-/* Cleanup time. */
-targetHitsFreeList(&targetList);
-}
-
-static void xmlBlastOut(struct axtBundle *abList, int queryIx, boolean isProt, 
-	FILE *f, char *databaseName, int databaseSeqCount, 
-	double databaseLetterCount, char *ourId)
-/* Do ncbi blast xml-like output at end of processing query. 
- * WARNING - still not completely baked.  Format at NCBI seems
- * to be missing some end tags actually when I checked. -jk */
-{
-char *queryName = abList->axtList->qName;
-int querySize = abList->qSize;
-int hitNum = 0;
-struct targetHits *targetList = NULL, *target;
-
-if (ourId == NULL)
-    ourId = "axtBlastOut";
-fprintf(f, "<?xml version=\"1.0\"?>\n");
-fprintf(f, "<!DOCTYPE BlastOutput PUBLIC \"-//NCBI//NCBI BlastOutput/EN\" \"NCBI_BlastOutput.dtd\">\n");
-fprintf(f, "<BlastOutput>\n");
-fprintf(f, "  <BlastOutput_program>%s</BlastOutput_program>\n", 
-	progType(isProt, abList, FALSE));
-fprintf(f, "  <BlastOutput_version>%s 2.2.4 [%s]</BlastOutput_version>\n",
-	progType(isProt, abList, FALSE), ourId);
-fprintf(f, "  <BlastOutput_reference>~Reference: Kent, WJ. (2002) BLAT - The BLAST-like alignment tool</BlastOutput_reference>\n");
-fprintf(f, "  <BlastOutput_db>%s</BlastOutput_db>\n", databaseName);
-fprintf(f, "  <BlastOutput_query-ID>%d</BlastOutput_query-ID>\n", queryIx);
-fprintf(f, "  <BlastOutput_query-def>%s</BlastOutput_query-def>\n", queryName);
-fprintf(f, "  <BlastOutput_query-len>%d</BlastOutput_query-len>\n", querySize);
-
-if (isProt)
-    {
-    fprintf(f, "  <BlastOutput_param>\n");
-    fprintf(f, "    <Parameters_matrix>BLOSUM62</Parameters_matrix>\n");
-    fprintf(f, "    <Parameters_expect>0.001</Parameters_expect>\n");
-    fprintf(f, "    <Parameters_expect>10</Parameters_expect>\n");
-    fprintf(f, "    <Parameters_gap-extend>1</Parameters_gap-extend>\n");
-    fprintf(f, "  </BlastOutput_param>\n");
-    }
-
-fprintf(f, "  <BlastOutput_iterations>\n");
-fprintf(f, "    <Iteration>\n");
-fprintf(f, "      <Iteration_iter-num>1</Iteration_iter-num>\n");
-fprintf(f, "      <Iteration_hits>\n");
-
-/* Print out details on each target. */
-targetList = bundleIntoTargets(abList);
-for (target = targetList; target != NULL; target = target->next)
-    {
-    struct axtRef *ref;
-    fprintf(f, "      <hit>\n");
-    fprintf(f, "        <Hit_num>%d</Hit_num>\n", hitNum);
-    fprintf(f, "        <Hit_id>%s</Hit_id>\n", target->name);
-    fprintf(f, "        <Hit_accession>%s</Hit_accession>\n", target->name);
-    fprintf(f, "        <Hit_len>%d</Hit_len>\n", target->size);
-    fprintf(f, "        <Hit_hsps>\n");
-    for (ref = target->axtList; ref != NULL; ref = ref->next)
-        {
-	struct axt *axt = ref->axt;
-	int hspIx = 0;
-	fprintf(f, "        <Hsp>\n");
-	fprintf(f, "          <Hsp_num>%d</Hsp_num>\n", ++hspIx);
-	fprintf(f, "          <Hsp_bit-score>%d</Hsp_bit-score>\n", 
-		blastzScoreToNcbiBits(axt->score));
-	fprintf(f, "          <Hsp_score>%d</Hsp_score>\n",
-		blastzScoreToNcbiScore(axt->score));
-	fprintf(f, "          <Hsp_evalue>%f</Hsp_evalue>\n",
-	        blastzScoreToNcbiExpectation(axt->score));
-	fprintf(f, "          <Hsp_query-from>%d</Hsp_query-from>\n", 
-		axt->qStart+1);
-	fprintf(f, "          <Hsp_query-to>%d</Hsp_query-to>\n", axt->qEnd);
-	fprintf(f, "          <Hsp_hit-from>%d</Hsp_hit-from>\n", 
-		axt->tStart+1);
-	fprintf(f, "          <Hsp_hit-to>%d</Hsp_hit-to>\n", axt->tEnd);
-	fprintf(f, "        </Hsp>\n");
-	}
-
-    fprintf(f, "        </Hit_hsps>\n");
-    }
-
-fprintf(f, "      </Iteration_hits>\n");
-fprintf(f, "    </Iteration>\n");
-fprintf(f, "  </BlastOutput_iterations>\n");
-fprintf(f, "</BlastOutput>\n");
-}
-
-static void printAxtTargetBlastTab(FILE *f, struct axt *axt, int targetSize)
-/* Print out target in tabular blast-oriented format. */
-{
-int s = axt->tStart, e = axt->tEnd;
-if (axt->tStrand == '-')
-    reverseIntRange(&s, &e, targetSize);
-if (axt->tStrand == axt->qStrand)
-    {
-    fprintf(f, "%d\t", s+1);
-    fprintf(f, "%d\t", e);
-    }
-else
-    {
-    fprintf(f, "%d\t", e);
-    fprintf(f, "%d\t", s+1);
-    }
-}
-
-static void tabBlastOut(struct axtBundle *abList, int queryIx, boolean isProt, 
-	FILE *f, char *databaseName, int databaseSeqCount, 
-	double databaseLetterCount, char *ourId, boolean withComment)
-/* Do NCBI tabular blast output. */
-{
-char *queryName = abList->axtList->qName;
-int querySize = abList->qSize;
-struct targetHits *targetList = NULL, *target;
-
-if (withComment)
-    {
-    // use date from CVS, unless checked out with -kk, then ignore.
-    char * rcsDate = "$Date: 2009/02/26 00:05:49 $";
-    char dateStamp[11];
-    if (strlen(rcsDate) > 17)
-        safencpy(dateStamp, sizeof(dateStamp), rcsDate+7, 10);
-    else
-        safecpy(dateStamp, sizeof(dateStamp), "");
-    dateStamp[10] = 0;
-    fprintf(f, "# BLAT %s [%s]\n", gfVersion, dateStamp);
-    fprintf(f, "# Query: %s\n", queryName);
-    fprintf(f, "# Database: %s\n", databaseName);
-    fprintf(f, "%s\n", 
-    	"# Fields: Query id, Subject id, % identity, alignment length, "
-	"mismatches, gap openings, q. start, q. end, s. start, s. end, "
-	"e-value, bit score");
-    }
-
-/* Print out details on each target. */
-targetList = bundleIntoTargets(abList);
-for (target = targetList; target != NULL; target = target->next)
-    {
-    struct axtRef *ref;
-    for (ref = target->axtList; ref != NULL; ref = ref->next)
-        {
-	struct axt *axt = ref->axt;
-	int matches = countMatches(axt->qSym, axt->tSym, axt->symCount);
-	int gaps = countGaps(axt->qSym, axt->tSym, axt->symCount);
-	int gapOpens = countGapOpens(axt->qSym, axt->tSym, axt->symCount);
-	fprintf(f, "%s\t", axt->qName);
-	fprintf(f, "%s\t", axt->tName);
-	fprintf(f, "%.2f\t", 100.0 * matches/axt->symCount);
-	fprintf(f, "%d\t", axt->symCount);
-	fprintf(f, "%d\t", axt->symCount - matches - gaps);
-	fprintf(f, "%d\t", gapOpens);
-	if (axt->qStrand == '-')
-	    {
-	    int s = axt->qStart, e = axt->qEnd;
-	    reverseIntRange(&s, &e, querySize);
-	    fprintf(f, "%d\t", s+1);
-	    fprintf(f, "%d\t", e);
-	    printAxtTargetBlastTab(f, axt, target->size);
-	    }
-	else
-	    {
-	    fprintf(f, "%d\t", axt->qStart + 1);
-	    fprintf(f, "%d\t", axt->qEnd);
-	    printAxtTargetBlastTab(f, axt, target->size);
-	    }
-	fprintf(f, "%3.1e\t", blastzScoreToNcbiExpectation(axt->score));
-	fprintf(f, "%d.0\n", blastzScoreToNcbiBits(axt->score));
-	}
-    }
-
-/* Cleanup time. */
-targetHitsFreeList(&targetList);
-}
-
-void axtBlastOut(struct axtBundle *abList, 
-	int queryIx, boolean isProt, FILE *f, 
-	char *databaseName, int databaseSeqCount, double databaseLetterCount, 
-	char *blastType, char *ourId, double minIdentity)
-/* Output a bundle of axt's on the same query sequence in blast format.
- * The parameters in detail are:
- *   ab - the list of bundles of axt's. 
- *   f  - output file handle
- *   databaseSeqCount - number of sequences in database
- *   databaseLetterCount - number of bases or aa's in database
- *   blastType - blast/wublast/blast8/blast9/xml
- *   ourId - optional (may be NULL) thing to put in header
- */
-{
-if (abList == NULL)
-    return;
-if (sameWord(blastType, "wublast"))
-    wuBlastOut(abList, queryIx, isProt, f, databaseName,
-   	databaseSeqCount, databaseLetterCount, ourId);
-else if (sameWord(blastType, "xml"))
-    xmlBlastOut(abList, queryIx, isProt, f, databaseName,
-        databaseSeqCount, databaseLetterCount, ourId);
-else if (sameWord(blastType, "blast"))
-    ncbiBlastOut(abList, queryIx, isProt, f, databaseName,
-        databaseSeqCount, databaseLetterCount, ourId, minIdentity);
-else if (sameWord(blastType, "blast8"))
-    tabBlastOut(abList, queryIx, isProt, f, databaseName,
-    	databaseSeqCount, databaseLetterCount, ourId, FALSE);
-else if (sameWord(blastType, "blast9"))
-    tabBlastOut(abList, queryIx, isProt, f, databaseName,
-    	databaseSeqCount, databaseLetterCount, ourId, TRUE);
-else
-    errAbort("Unrecognized blastType %s in axtBlastOut", blastType);
-}
-
diff --git a/gbtools/src/blatSrc/lib/blastParse.c b/gbtools/src/blatSrc/lib/blastParse.c
deleted file mode 100644
index 49026d6..0000000
--- a/gbtools/src/blatSrc/lib/blastParse.c
+++ /dev/null
@@ -1,900 +0,0 @@
-/* blastParse - read in blast output into C data structure. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "dystring.h"
-#include "linefile.h"
-#include "dnautil.h"
-#include "sqlNum.h"
-#include "blastParse.h"
-#include "verbose.h"
-
-
-#define WARN_LEVEL 1   /* verbose level to enable warnings */
-#define TRACE_LEVEL 3  /* verbose level to enable tracing of files */
-#define DUMP_LEVEL 4   /* verbose level to enable dumping of parsed */
-
-struct blastFile *blastFileReadAll(char *fileName)
-/* Read all blast alignment in file. */
-{
-struct blastFile *bf;
-struct blastQuery *bq;
-
-bf = blastFileOpenVerify(fileName);
-while ((bq = blastFileNextQuery(bf)) != NULL)
-    {
-    slAddHead(&bf->queries, bq);
-    }
-slReverse(&bf->queries);
-lineFileClose(&bf->lf);
-return bf;
-}
-
-static void bfError(struct blastFile *bf, char *message)
-/* Print blast file error message. */
-{
-errAbort("%s:%d: %s", bf->fileName, bf->lf->lineIx, message);
-}
-
-static void bfWarn(struct blastFile *bf, char *message)
-/* Print blast file warning message. */
-{
-verbose(WARN_LEVEL, "Warning: %s:%d: %s\n", bf->fileName, bf->lf->lineIx, message);
-}
-
-static void bfUnexpectedEof(struct blastFile *bf)
-/* generate error on unexpected EOF */
-{
-errAbort("Unexpected end of file in %s\n", bf->fileName);
-}
-
-static void bfSyntax(struct blastFile *bf)
-/* General error message. */
-{
-bfError(bf, "Can't cope with BLAST output syntax");
-}
-
-static boolean isAllDigits(char *s)
-/* test if a string is all digits */
-{
-for (; *s != '\0'; s++)
-    {
-    if (!isdigit(*s))
-        return FALSE;
-    }
-return TRUE;
-}
-
-static boolean isAllDashes(char *s)
-/* test if a string is all dashes */
-{
-for (; *s != '\0'; s++)
-    {
-    if (*s != '-')
-        return FALSE;
-    }
-return TRUE;
-}
-
-static char *bfNextLine(struct blastFile *bf)
-/* Fetch next line of input trying, or NULL if not found */
-{
-char *line = NULL;
-if (lineFileNext(bf->lf, &line, NULL))
-    {
-    verbose(TRACE_LEVEL, "    => %s\n", line);
-    return line;
-    }
-else
-    {
-    verbose(TRACE_LEVEL, "    => EOF\n");
-    return NULL;
-    }
-}
-
-static boolean bfSkipBlankLines(struct blastFile *bf)
-/* skip blank lines, return FALSE on EOF */
-{
-char *line = NULL;
-while ((line = bfNextLine(bf)) != NULL)
-    {
-    if (skipLeadingSpaces(line)[0] != '\0')
-        {
-	lineFileReuse(bf->lf);
-        return TRUE;
-        }
-    }
-return FALSE; /* EOF */
-}
-
-static char *bfNeedNextLine(struct blastFile *bf)
-/* Fetch next line of input or die trying. */
-{
-char *line = bfNextLine(bf);
-if (line == NULL)
-    bfUnexpectedEof(bf);
-return line;
-}
-
-static char *bfSearchForLine(struct blastFile *bf, char *start)
-/* scan for a line starting with the specified string */
-{
-for (;;)
-    {
-    char *line = bfNextLine(bf);
-    if (line == NULL)
-	return NULL;
-    if (startsWith(start, line))
-        return line;
-    }
-}
-
-static void bfBadHeader(struct blastFile *bf)
-/* Report bad header. */
-{
-bfError(bf, "Bad first line\nShould be something like:\n"
-            "BLASTN 2.0.11 [Jan-20-2000]");
-}
-
-struct blastFile *blastFileOpenVerify(char *fileName)
-/* Open file, read and verify header. */
-{
-struct blastFile *bf;
-char *line;
-char *words[16];
-int wordCount;
-struct lineFile *lf;
-
-AllocVar(bf);
-bf->lf = lf = lineFileOpen(fileName, TRUE);
-bf->fileName = cloneString(fileName);
-
-/* Parse first line - something like: */
-line = bfNeedNextLine(bf);
-wordCount = chopLine(line, words);
-if (wordCount < 3)
-    bfBadHeader(bf);
-bf->program = cloneString(words[0]);
-bf->version = cloneString(words[1]);
-bf->buildDate = cloneString(words[2]);
-if (!wildMatch("*BLAST*", bf->program))
-    bfBadHeader(bf);
-if (!isdigit(bf->version[0]))
-    bfBadHeader(bf);
-if (bf->buildDate[0] != '[')
-    bfBadHeader(bf);
-return bf;
-}
-
-void decomma(char *s)
-/* Remove commas from string. */
-{
-char *d = s;
-char c;
-
-for (;;)
-    {
-    c = *s++;
-    if (c != ',')
-	*d++ = c;
-    if (c == 0)
-	break;
-    }
-}
-
-static void parseQueryLines(struct blastFile *bf, char *line, struct blastQuery *bq)
-/* Parse the Query= lines */
-{
-char *s, *e;
-char *words[16];
-int wordCount;
-if (bq->query != NULL)
-    bfError(bf, "already parse Query=");
-
-/* Process something like:
- *    Query= MM39H11    00630     
- */
-wordCount = chopLine(line, words);
-if (wordCount < 2)
-    bfError(bf, "No sequence name in query line");
-bq->query = cloneString(words[1]);
-
-for (;;)
-    {
-    line = bfNeedNextLine(bf);
-    s = skipLeadingSpaces(line);
-    if (s[0] == '(')
-        break;
-    }
-if (!isdigit(s[1]))
-    {
-    bfError(bf, "expecting something like:\n"
-                "   (45,693 letters)");
-    }
-s += 1;
-if ((e = strchr(s, ' ')) == NULL)
-    {
-    bfError(bf, "expecting something like:\n"
-                "   (45,693 letters)");
-    }
-*e = 0;
-decomma(s);
-bq->queryBaseCount = atoi(s);
-}
-
-static void parseDatabaseLines(struct blastFile *bf, char *line, struct blastQuery *bq)
-/* Process something like:
- * Database: chr22.fa 
- *        977 sequences; 95,550,797 total letters
- */
-{
-static struct dyString *tmpBuf = NULL;
-char *words[16];
-int wordCount;
-if (bq->database != NULL)
-    bfError(bf, "already parse Database:");
-
-if (tmpBuf == NULL)
-    tmpBuf = dyStringNew(512);
-
-/* parse something like
- * Database: celegans98
- * some versions of blastp include the absolute path, but
- * then split it across lines.
- */
-wordCount = chopLine(line, words);
-if (wordCount < 2)
-    bfError(bf, "Expecting database name");
-dyStringClear(tmpBuf);
-dyStringAppend(tmpBuf, words[1]);
-while (line = bfNeedNextLine(bf), !isspace(line[0]))
-    {
-    dyStringAppend(tmpBuf, line);
-    }
-bq->database = cloneString(tmpBuf->string);
-
-/* Process something like:
- *        977 sequences; 95,550,797 total letters
- */
-wordCount = chopLine(line, words);
-if (wordCount < 3 || !isdigit(words[0][0]) || !isdigit(words[2][0]))
-    bfError(bf, "Expecting database info");
-decomma(words[0]);
-decomma(words[2]);
-bq->dbSeqCount = atoi(words[0]);
-bq->dbBaseCount = atoi(words[2]);
-}
-
-static char *roundLinePrefix = "Results from round "; // start of a round line
-
-static boolean isRoundLine(char *line)
-/* check if a line is a PSI round number line */
-{
-return startsWith(roundLinePrefix, line);
-}
-
-static void parseRoundLine(char *line, struct blastQuery *bq)
-/* round line and save current round in query
- *   Results from round 1
- */
-{
-char *p = skipLeadingSpaces(line + strlen(roundLinePrefix));
-bq->psiRounds = atoi(p);
-}
-
-struct blastQuery *blastFileNextQuery(struct blastFile *bf)
-/* Read all alignments associated with next query.  Return NULL at EOF. */
-{
-char *line;
-struct blastQuery *bq;
-struct blastGappedAli *bga;
-AllocVar(bq);
-
-verbose(TRACE_LEVEL, "blastFileNextQuery\n");
-
-/* find and parse Query= */
-line = bfSearchForLine(bf, "Query=");
-if (line == NULL)
-    return NULL;
-parseQueryLines(bf, line, bq);
-
-/* find and parse Database: */
-line = bfSearchForLine(bf, "Database:");
-if (line == NULL)
-    bfUnexpectedEof(bf);
-parseDatabaseLines(bf, line, bq);
-
-/* Seek to beginning of first gapped alignment. */
-for (;;)
-    {
-    line = bfNeedNextLine(bf);
-    if (line[0] == '>')
-	{
-	lineFileReuse(bf->lf);
-	break;
-	}
-    else if (isRoundLine(line))
-        parseRoundLine(line, bq);
-    else if (stringIn("No hits found", line) != NULL)
-        break;
-    }
-
-/* Read in gapped alignments. */
-while ((bga = blastFileNextGapped(bf, bq)) != NULL)
-    {
-    slAddHead(&bq->gapped, bga);
-    }
-slReverse(&bq->gapped);
-if (verboseLevel() >= DUMP_LEVEL)
-    {
-    verbose(DUMP_LEVEL, "blastFileNextQuery result:\n");
-    blastQueryPrint(bq, stderr);
-    }
-return bq;
-}
-
-static char *findNextGapped(struct blastFile *bf, struct blastQuery *bq)
-/* scan for next gapped alignment, return line or NULL if not hit */
-{
-while (TRUE)
-    {
-    if (!bfSkipBlankLines(bf))
-        return NULL;
-    char *line = bfNextLine(bf);
-    /*
-     * the last condition was added to deal with the new blast output format and is meant to find lines such as this one:
-     * TBLASTN 2.2.15 [Oct-15-2006]
-     * I am hoping that by looking for only "BLAST" this will work with things like blastp, blastn, psi-blast, etc
-     */
-    if (startsWith("  Database:", line) || (stringIn("BLAST", line) != NULL))
-        {
-	lineFileReuse(bf->lf);
-        return NULL;
-        }
-    if (line[0] == '>')
-        return line;
-    if (isRoundLine(line))
-        parseRoundLine(line, bq);
-    }
-}
-
-struct blastGappedAli *blastFileNextGapped(struct blastFile *bf, struct blastQuery *bq)
-/* Read in next gapped alignment.   Does *not* put it on bf->gapped list. 
- * Return NULL at EOF or end of query. */
-{
-char *words[16];
-int wordCount;
-struct blastGappedAli *bga;
-struct blastBlock *bb;
-int lenSearch;
-
-verbose(TRACE_LEVEL, "blastFileNextGapped\n");
-
-char *line = findNextGapped(bf, bq);
-if (line == NULL)
-    return NULL;
-
-AllocVar(bga);
-bga->query = bq;
-bga->targetName = cloneString(line+1); 
-bga->psiRound = bq->psiRounds;
-
-/* Process something like:
- *      Length = 100000
- * however this follows a possible multi-line description, so be specified
- * and limit how far we can scan
- */
-for (lenSearch=0; lenSearch<25; lenSearch++)
-	{
-	line = bfNeedNextLine(bf);
-        if (isRoundLine(line))
-            parseRoundLine(line, bq);
-	wordCount = chopLine(line, words);
-	if (wordCount == 3 && sameString(words[0], "Length") &&  sameString(words[1], "=")
-            && isdigit(words[2][0]))
-		break;
-	}
-if (lenSearch>=25)
-    bfError(bf, "Expecting Length =");
-decomma(words[2]);
-bga->targetSize = atoi(words[2]);
-
-/* Get all the blocks. */
-while ((bb = blastFileNextBlock(bf, bq, bga)) != NULL)
-    {
-    slAddHead(&bga->blocks, bb);
-    }
-slReverse(&bga->blocks);
-return bga;
-}
-
-static int getStrand(struct blastFile *bf, char *strand)
-/* Translate "Plus" or "Minus" to +1 or -1. */
-{
-if (sameWord("Plus", strand))
-    return 1;
-else if (sameWord("Minus", strand))
-    return -1;
-else
-    {
-    bfError(bf, "Expecting Plus or Minus after Strand");
-    return 0;
-    }
-}
-
-static boolean nextBlockLine(struct blastFile *bf, struct blastQuery *bq, char **retLine)
-/* Get next block line.  Return FALSE and reuse line if it's
- * an end of block type line. */
-{
-struct lineFile *lf = bf->lf;
-char *line;
-
-*retLine = line = bfNextLine(bf);
-if (line == NULL)
-    return FALSE;
-if (isRoundLine(line))
-    parseRoundLine(line, bq);
-
-/*
-the last condition was added to deal with the new blast output format and is meant to find lines such as this one:
-TBLASTN 2.2.15 [Oct-15-2006]
-I am hoping that by looking for only "BLAST" this will work with things like blastp, blastn, psi-blast, etc
-*/
-if (line[0] == '>' || startsWith("Query=", line) || startsWith("  Database:", line) || (stringIn("BLAST", line) != NULL))
-    {
-    lineFileReuse(lf);
-    return FALSE;
-    }
-return TRUE;
-}
-
-static double evalToDouble(char *s)
-/* Convert string from e-val to floating point rep.
- * e-val is basically ascii floating point, but
- * small ones may be 'e-100' instead of 1.0e-100
- */
-{
-if (isdigit(s[0]))
-    return atof(s);
-else
-    {
-    char buf[64];
-    safef(buf, sizeof(buf), "1.0%s", s);
-    return atof(buf);
-    }
-}
-
-static boolean parseBlockLine(struct blastFile *bf, int *startRet, int *endRet,
-                           struct dyString *seq)
-/* read and parse the next target or query line, like:
- *   Query: 26429 taccttgacattcctcagtgtgtcatcatcgttctctcctccaaacggcgagagtccgga 26488
- *
- * also handle broken NCBI tblastn output like:
- *   Sbjct: 1181YYGEQRSTNGQTIQLKTQVFRRFPDDDDESEDHDDPDNAHESPEQEGAEGHFDLHYYENQ 1360
- *
- * Ignores and returns FALSE on bogus records generated by PSI BLAST, such as
- *   Query: 0   --------------------------                                  
- *   Sbjct: 38  PPGPPGVAGGNQTTVVVIYGPPGPPG                                   63
- *   Query: 0                                                               
- *   Sbjct: 63                                                               63
- * If FALSE is returned, the output parameters will be unchanged.
- */
-{
-char* line = bfNeedNextLine(bf);
-int a, b, s, e;
-char *words[16];
-int wordCount = chopLine(line, words);
-if ((wordCount < 2) || (wordCount > 4) || !(sameString("Query:", words[0]) || sameString("Sbjct:", words[0])))
-    bfSyntax(bf);
-
-/* look for one of the bad formats to ignore, as described above */
-if (((wordCount == 2) && isAllDigits(words[1]))
-    || ((wordCount == 3) && isAllDigits(words[1]) && isAllDigits(words[2]))
-    || ((wordCount == 3) && isAllDigits(words[1]) && isAllDashes(words[2])))
-    {
-    bfWarn(bf, "Ignored invalid alignment format for aligned sequence pair");
-    return FALSE;
-    }
-
-/* special handling for broken output with no space between start and
- * sequence */
-if (wordCount == 3)
-    {
-    char *p;
-    if (!isdigit(words[1][0]) || !isdigit(words[2][0]))
-        bfSyntax(bf);
-    a = atoi(words[1]);
-    b = atoi(words[2]);
-    p = words[1];
-    while ((*p != '\0') && (isdigit(*p)))
-        p++;
-    dyStringAppend(seq, p);
-    }
-else
-    {
-    if (!isdigit(words[1][0]) || !isdigit(words[3][0]))
-        bfSyntax(bf);
-    a = atoi(words[1]);
-    b = atoi(words[3]);
-    dyStringAppend(seq, words[2]);
-    }
-s = min(a,b);
-e = max(a,b);
-*startRet = min(s, *startRet);
-*endRet = max(e, *endRet);
-return TRUE;
-}
-
-static boolean findBlockSeqPair(struct blastFile *bf, struct blastQuery *bq)
-/* scan forward for the next pair of Query:/Sbjct: sequences */
-{
-char *line;
-for (;;)
-    {
-    if (!nextBlockLine(bf, bq, &line))
-        return FALSE;
-    if (startsWith(" Score", line))
-        {
-        lineFileReuse(bf->lf);
-        return FALSE;
-        }
-    if (startsWith("Query:", line))
-        {
-        lineFileReuse(bf->lf);
-        return TRUE;
-        }
-    }
-}
-
-static void clearBlastBlock(struct blastBlock *bb, struct dyString *qString, struct dyString *tString)
-/* reset the contents of a blast block being accummulated */
-{
-bb->qStart = bb->tStart = 0x3fffffff;
-bb->qEnd = bb->tEnd = -bb->qStart;
-dyStringClear(qString);
-dyStringClear(tString);
-}
-
-static void parseBlockSeqPair(struct blastFile *bf, struct blastBlock *bb,
-                              struct dyString *qString, struct dyString *tString)
-/* parse the current pair Query:/Sbjct: sequences */
-{
-boolean isOk = TRUE;
-
-/* Query line */
-if (!parseBlockLine(bf, &bb->qStart, &bb->qEnd, qString))
-    isOk = FALSE;
-
-/* Skip next line. */
-bfNeedNextLine(bf);
-
-/* Fetch target sequence line. */
-if (!parseBlockLine(bf, &bb->tStart, &bb->tEnd, tString))
-    isOk = FALSE;
-if (!isOk)
-    {
-    // reset accumulated data so we discard everything before bogus pair
-    clearBlastBlock(bb, qString, tString);
-    }
-}
-
-
-static struct blastBlock *nextBlock(struct blastFile *bf, struct blastQuery *bq,
-                                    struct blastGappedAli *bga, boolean *skipRet)
-/* Read in next blast block.  Return NULL at EOF or end of gapped
- * alignment. If an unparsable block is found, set skipRet to TRUE and return
- * NULL. */
-{
-struct blastBlock *bb;
-char *line;
-char *words[16];
-int wordCount;
-char *parts[3];
-int partCount;
-static struct dyString *qString = NULL, *tString = NULL;
-
-verbose(TRACE_LEVEL,  "blastFileNextBlock\n");
-*skipRet = FALSE;
-
-/* Seek until get something like:
- *   Score = 8770 bits (4424), Expect = 0.0
- * or something that looks like we're done with this gapped
- * alignment. */
-for (;;)
-    {
-    if (!nextBlockLine(bf, bq, &line))
-	return NULL;
-    if (startsWith(" Score", line))
-	break;
-    }
-AllocVar(bb);
-bb->gappedAli = bga;
-wordCount = chopLine(line, words);
-if (wordCount < 8 || !sameWord("Score", words[0]) 
-    || !isdigit(words[2][0]) || !(isdigit(words[7][0]) || words[7][0] == 'e')
-    || !startsWith("Expect", words[5]))
-    {
-    bfError(bf, "Expecting something like:\n"
-             "Score = 8770 bits (4424), Expect = 0.0");
-    }
-bb->bitScore = atof(words[2]);
-bb->eVal = evalToDouble(words[7]);
-
-/* Process something like:
- *   Identities = 8320/9618 (86%), Gaps = 3/9618 (0%)
- *             or
- *   Identities = 8320/9618 (86%)
- *             or
- *   Identities = 10/19 (52%), Positives = 15/19 (78%), Frame = +2
- *     (wu-tblastn)
- *             or
- *   Identities = 256/400 (64%), Positives = 306/400 (76%)
- *   Frame = +1 / -2
- *     (tblastn)
- *
- *   Identities = 1317/10108 (13%), Positives = 2779/10108 (27%), Gaps = 1040/10108
- *   (10%)
- *      - wrap on long lines
- *
- * Handle weird cases where the is only a `Score' line, with no `Identities'
- * lines by skipping the alignment; they seem line small, junky alignments.
- */
-line = bfNeedNextLine(bf);
-wordCount = chopLine(line, words);
-if (wordCount < 3 || !sameWord("Identities", words[0]))
-    {
-    if (wordCount > 1 || sameWord("Score", words[0]))
-        {
-        /* ugly hack to skip block with no identities */
-        *skipRet = TRUE;
-        blastBlockFree(&bb);
-        return NULL;
-        }
-    bfError(bf, "Expecting identity count");
-    }
-partCount = chopByChar(words[2], '/', parts, ArraySize(parts));
-if (partCount != 2 || !isdigit(parts[0][0]) || !isdigit(parts[1][0]))
-    bfSyntax(bf);
-bb->matchCount = atoi(parts[0]);
-bb->totalCount = atoi(parts[1]);
-if (wordCount >= 7 && sameWord("Gaps", words[4]))
-    {
-    if (!isdigit(words[6][0]))
-	bfSyntax(bf);
-    bb->insertCount = atoi(words[6]);
-    }
-if ((wordCount >= 11) && sameWord("Frame", words[8]))
-    {
-    bb->qStrand = '+';
-    bb->tStrand = words[10][0];
-    bb->tFrame = atoi(words[10]);
-    }
-
-line = bfNeedNextLine(bf);
-boolean wrapped = (startsWith("(", line));
-
-/* Process something like:
- *     Strand = Plus / Plus (blastn)
- *     Frame = +1           (tblastn)
- *     Frame = +1 / -2      (tblastx)
- *     <blank line>         (blastp)
- * note that wu-tblastn puts frame on Identities line
- */
-if (wrapped)
-    line = bfNeedNextLine(bf);
-wordCount = chopLine(line, words);
-if ((wordCount >= 5) && sameWord("Strand", words[0]))
-    {
-    bb->qStrand = getStrand(bf, words[2]);
-    bb->tStrand = getStrand(bf, words[4]);
-    }
-else if ((wordCount >= 5) && sameWord("Frame", words[0]) && (words[3][0] == '/'))
-    {
-    // Frame = +1 / -2      (tblastx)
-    bb->qStrand = (words[2][0] == '-') ? -1 : 1;
-    bb->tStrand = (words[4][0] == '-') ? -1 : 1;
-    bb->qFrame = atoi(words[2]);
-    bb->tFrame = atoi(words[4]);
-    }
-else if ((wordCount >= 3) && sameWord("Frame", words[0]))
-    {
-    // Frame = +1           (tblastn)
-    bb->qStrand = 1;
-    bb->tStrand = (words[2][0] == '-') ? -1 : 1;
-    bb->qFrame = atoi(words[2]);
-    bb->tFrame = 1;
-    }
-else if (wordCount == 0)
-    {
-    /* if we didn't parse frame, default it */
-    if (bb->qStrand == 0)
-        {
-        bb->qStrand = '+';
-        bb->tStrand = '+';
-        }
-    }
-else
-    bfError(bf, "Expecting Strand, Frame or blank line");
-
-
-/* Process alignment lines.  They come in groups of three
- * separated by a blank line - something like:
- * Query: 26429 taccttgacattcctcagtgtgtcatcatcgttctctcctccaaacggcgagagtccgga 26488
- *              |||||| |||||||||| ||| ||||||||||||||||||||||| || || ||||||||
- * Sbjct: 62966 taccttaacattcctcaatgtttcatcatcgttctctcctccaaatggtgaaagtccgga 63025
- */
-if (qString == NULL)
-    {
-    qString = newDyString(50000);
-    tString = newDyString(50000);
-    }
-clearBlastBlock(bb, qString, tString);
-for (;;)
-    {
-    if (!findBlockSeqPair(bf, bq))
-        break;
-    parseBlockSeqPair(bf, bb, qString, tString);
-    }
-
-/* convert to [0..n) and move to strand coords if necessary */
-bb->qStart--;
-if (bb->qStrand < 0)
-    reverseIntRange(&bb->qStart, &bb->qEnd, bq->queryBaseCount);
-bb->tStart--;
-if (bb->tStrand < 0)
-    reverseIntRange(&bb->tStart, &bb->tEnd, bga->targetSize);
-bb->qSym = cloneMem(qString->string, qString->stringSize+1);
-bb->tSym = cloneMem(tString->string, tString->stringSize+1);
-return bb;
-}
-
-struct blastBlock *blastFileNextBlock(struct blastFile *bf, 
-	struct blastQuery *bq, struct blastGappedAli *bga)
-/* Read in next blast block.  Return NULL at EOF or end of
- * gapped alignment. */
-{
-struct blastBlock *bb = NULL;
-boolean skip = FALSE;
-
-while (((bb = nextBlock(bf, bq, bga, &skip)) == NULL) && skip)
-    continue; /* skip to next one */
-
-return bb;
-}
-
-void blastFileFree(struct blastFile **pBf)
-/* Free blast file. */
-{
-struct blastFile *bf = *pBf;
-if (bf != NULL)
-    {
-    lineFileClose(&bf->lf);
-    freeMem(bf->fileName);
-    freeMem(bf->program);
-    freeMem(bf->version);
-    freeMem(bf->buildDate);
-    blastQueryFreeList(&bf->queries);
-    freez(pBf);
-    }
-}
-
-void blastFileFreeList(struct blastFile **pList)
-/* Free list of blast files. */
-{
-struct blastFile *el, *next;
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    blastFileFree(&el);
-    }
-*pList = NULL;
-}
-
-void blastQueryFree(struct blastQuery **pBq)
-/* Free single blastQuery. */
-{
-struct blastQuery *bq;
-if ((bq = *pBq) != NULL)
-    {
-    freeMem(bq->query);
-    freeMem(bq->database);
-    blastGappedAliFreeList(&bq->gapped);
-    freez(pBq);
-    }
-}
-
-void blastQueryFreeList(struct blastQuery **pList)
-/* Free list of blastQuery's. */
-{
-struct blastQuery *el, *next;
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    blastQueryFree(&el);
-    }
-*pList = NULL;
-}
-
-
-void blastGappedAliFree(struct blastGappedAli **pBga)
-/* Free blastGappedAli. */
-{
-struct blastGappedAli *bga = *pBga;
-if (bga != NULL)
-    {
-    freeMem(bga->targetName);
-    blastBlockFreeList(&bga->blocks);
-    freez(pBga);
-    }
-}
-
-void blastGappedAliFreeList(struct blastGappedAli **pList)
-/* Free blastGappedAli list. */
-{
-struct blastGappedAli *el, *next;
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    blastGappedAliFree(&el);
-    }
-*pList = NULL;
-}
-
-
-void blastBlockFree(struct blastBlock **pBb)
-/* Free a single blastBlock. */
-{
-struct blastBlock *bb = *pBb;
-if (bb != NULL)
-    {
-    freeMem(bb->qSym);
-    freeMem(bb->tSym);
-    freez(pBb);
-    }
-}
-
-void blastBlockFreeList(struct blastBlock **pList)
-/* Free a list of blastBlocks. */
-{
-struct blastBlock *el, *next;
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    blastBlockFree(&el);
-    }
-*pList = NULL;
-}
-
-void blastBlockPrint(struct blastBlock* bb, FILE* out)
-/* print a BLAST block for debugging purposes  */
-{
-fprintf(out, "    blk: %d-%d <=> %d-%d tcnt=%d mcnt=%d icnt=%d\n",
-        bb->qStart, bb->qEnd,  bb->tStart, bb->tEnd,
-        bb->totalCount, bb->matchCount, bb->insertCount);
-fprintf(out, "        Q: %s\n", bb->qSym);
-fprintf(out, "        T: %s\n", bb->tSym);
-}
-
-void blastGappedAliPrint(struct blastGappedAli* ba, FILE* out)
-/* print a BLAST gapped alignment for debugging purposes  */
-{
-struct blastBlock *bb;
-fprintf(out, "%s <=> %s", ba->query->query, ba->targetName);
-if (ba->psiRound > 0)
-    fprintf(out, " round: %d", ba->psiRound);
-fputc('\n', out);
-for (bb = ba->blocks; bb != NULL; bb = bb->next)
-    {
-    blastBlockPrint(bb, out);
-    }
-}
-
-void blastQueryPrint(struct blastQuery *bq, FILE* out)
-/* print a BLAST query for debugging purposes  */
-{
-struct blastGappedAli *ba;
-for (ba = bq->gapped; ba != NULL; ba = ba->next)
-    blastGappedAliPrint(ba, out);
-}
diff --git a/gbtools/src/blatSrc/lib/boxClump.c b/gbtools/src/blatSrc/lib/boxClump.c
deleted file mode 100644
index 5d8ca2e..0000000
--- a/gbtools/src/blatSrc/lib/boxClump.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/* boxClump - put together 2 dimensional boxes that
- * overlap with each other into clumps. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "dlist.h"
-#include "localmem.h"
-#include "boxClump.h"
-
-
-/** Some simple utility function on globally declared 
- ** data structures. **/
-
-
-void boxClumpFree(struct boxClump **pClump)
-/* Free boxClump. */
-{
-struct boxClump *clump = *pClump;
-if (clump != NULL)
-    {
-    slFreeList(&clump->boxList);
-    freez(pClump);
-    }
-}
-
-void boxClumpFreeList(struct boxClump **pList)
-/* Free list of boxClumps. */
-{
-struct boxClump *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    boxClumpFree(&el);
-    }
-*pList = NULL;
-}
-
-int boxClumpCmpCount(const void *va, const void *vb)
-/* Compare to sort based on count of boxes. */
-{
-const struct boxClump *a = *((struct boxClump **)va);
-const struct boxClump *b = *((struct boxClump **)vb);
-return b->boxCount - a->boxCount;
-}
-
-/** Local data structures. */
-
-struct cluster
-/* A cluster of boxes. */
-    {
-    struct box *boxList;	/* List of boxes. */
-    struct dlNode *node;	/* Position in doubly-linked list. */
-    };
-
-struct box
-/* A box in an alignment. */
-    {
-    struct box *next;		 /* Next in list (usually on cluster). */
-    struct boxIn *in;		 /* Input box position. */
-    struct cluster *cluster;     /* Cluster this is part of. */
-    };
-
-struct boxRef
-/* Reference to a box. */
-    {
-    struct boxRef *next;
-    struct box *box;
-    };
-
-
-/** Routines that cluster using mostly the local data
- ** structures. **/
-
-
-static void mergeClusters(struct cluster *a, struct cluster *b)
-/* Merge cluster b into cluster a, and free remnants of b. */
-{
-struct box *box;
-
-/* Merging with yourself is always problematic. */
-if (a == b)
-    return;
-
-/* Point all boxes in b to a. */
-for (box = b->boxList; box != NULL; box = box->next)
-    box->cluster = a;
-
-/* Add b's boxList to end of a's. */
-a->boxList = slCat(a->boxList, b->boxList);
-
-/* Remove b from master cluster list. */
-dlRemove(b->node);
-}
-
-static boolean allStartBy(struct boxRef *refList, int qStart, int tStart)
-/* Return TRUE if qStart/qEnd of all boxes less than or equal to qStart/tStart 
- * This is an end condition for recursion along with only having two or
- * less boxes in the refList.  It handles the case where you have many
- * boxes stacked on top of each other. */
-{
-struct boxRef *ref;
-for (ref = refList; ref != NULL; ref = ref->next)
-    {
-    struct boxIn *box = ref->box->in;
-    if (box->qStart > qStart || box->tStart > tStart)
-        return FALSE;
-    }
-return TRUE;
-}
-
-static boolean allSameCluster(struct boxRef *refList)
-/* Return TRUE if qStart/qEnd of all boxes is the same */
-{
-struct boxRef *ref;
-struct cluster *cluster = refList->box->cluster;
-for (ref = refList->next; ref != NULL; ref = ref->next)
-    {
-    if (ref->box->cluster != cluster)
-        return FALSE;
-    }
-return TRUE;
-}
-
-static struct lm *lm;
-/* Local memory manager used for boxRefs and other stuff. */
-
-static void rBoxJoin(struct boxRef *refList, 
-	int qStart, int qEnd, int tStart, int tEnd)
-/* Recursively cluster boxes. */
-{
-int boxCount = slCount(refList);
-
-if (boxCount <= 1)
-    {
-    /* Easy: no merging required. */
-    }
-else if (boxCount == 2)
-    {
-    /* Decide if pair overlaps and if so merge. */
-    struct box *a = refList->box;
-    struct box *b = refList->next->box;
-    if (rangeIntersection(a->in->qStart, a->in->qEnd, b->in->qStart, b->in->qEnd) > 0 &&
-        rangeIntersection(a->in->tStart, a->in->tEnd, b->in->tStart, b->in->tEnd) > 0 )
-	{
-	mergeClusters(a->cluster, b->cluster);
-	}
-    else
-        {
-	/* Two non-overlapping boxes, we don't have to do anything. */
-	}
-    }
-else if (allStartBy(refList, qStart, tStart))
-    {
-    /* If everybody contains the upper left corner, then they all can 
-     * be merged.   This is the route taken often by clumps with lots
-     * of overlap. */
-    struct cluster *aCluster = refList->box->cluster;
-    struct boxRef *ref;
-    for (ref = refList->next; ref != NULL; ref = ref->next)
-        {
-	struct cluster *bCluster = ref->box->cluster;
-	mergeClusters(aCluster, bCluster);
-	}
-    }
-else if (allSameCluster(refList))
-    {
-    /* Everything is in the same cluster, no action required. */
-    }
-else
-    {
-    /* We can't yet figure out clumping, so break
-     * up our window in two along larger dimension and
-     * recurse on both subwindows. */
-    struct boxRef *list1 = NULL, *list2 = NULL, *ref, *next;
-    if (qEnd - qStart > tEnd - tStart)
-        {
-	int mid = (qStart + qEnd)>>1;
-	for (ref = refList; ref != NULL; ref = next)
-	    {
-	    struct box *box = ref->box;
-	    next = ref->next;
-	    if (box->in->qEnd <= mid)
-	        {
-		slAddHead(&list1, ref);
-		}
-	    else if (box->in->qStart >= mid)
-	        {
-		slAddHead(&list2, ref);
-		}
-	    else
-	        {
-		/* Box crosses boundary, have to put it on both lists. */
-		slAddHead(&list1, ref);
-		lmAllocVar(lm, ref);
-		ref->box = box;
-		slAddHead(&list2, ref);
-		}
-	    }
-	rBoxJoin(list1, qStart, mid, tStart, tEnd);
-	rBoxJoin(list2, mid, qEnd, tStart, tEnd);
-	}
-    else
-        {
-	int mid = (tStart + tEnd)>>1;
-	for (ref = refList; ref != NULL; ref = next)
-	    {
-	    struct box *box = ref->box;
-	    next = ref->next;
-	    if (box->in->tEnd <= mid)
-	        {
-		slAddHead(&list1, ref);
-		}
-	    else if (box->in->tStart >= mid)
-	        {
-		slAddHead(&list2, ref);
-		}
-	    else
-	        {
-		/* Box crosses boundary, have to put it on both lists. */
-		slAddHead(&list1, ref);
-		lmAllocVar(lm, ref);
-		ref->box = box;
-		slAddHead(&list2, ref);
-		}
-	    }
-	rBoxJoin(list1, qStart, qEnd, tStart, mid);
-	rBoxJoin(list2, qStart, qEnd, mid, tEnd);
-	}
-    }
-}
-
-
-struct boxClump *boxFindClumps(struct boxIn **pBoxList)
-/* Convert list of boxes to a list of clumps.  Clumps
- * are collections of boxes that overlap.  Note that
- * the original boxList is overwritten as the boxes
- * are moved from it to the clumps. */
-{
-struct boxIn *in;
-struct boxClump *clumpList = NULL, *clump;
-struct boxRef *refList = NULL, *ref;
-struct box *box;
-struct cluster *cluster;
-struct dlNode *node;
-struct dlList clusterList;
-int qStart = BIGNUM, qEnd = -BIGNUM;
-int tStart = BIGNUM, tEnd = -BIGNUM;
-
-
-dlListInit(&clusterList);
-lm = lmInit(0);
-
-/* Make local box structure, cluster, and reference
- * for each input box.  Calculate overall bounds. */
-for (in = *pBoxList; in != NULL; in = in->next)
-    {
-    lmAllocVar(lm, box);
-    box->in = in;
-    if (in->qStart < qStart) qStart = in->qStart;
-    if (in->qEnd > qEnd) qEnd = in->qEnd;
-    if (in->tStart < tStart) tStart = in->tStart;
-    if (in->tEnd > tEnd) tEnd = in->tEnd;
-    lmAllocVar(lm,cluster);
-    lmAllocVar(lm, cluster->node);
-    cluster->node->val = cluster;
-    dlAddTail(&clusterList, cluster->node);
-    cluster->boxList = box;
-    box->cluster = cluster;
-    lmAllocVar(lm, ref);
-    ref->box = box;
-    slAddHead(&refList, ref);
-    }
-
-/* Call to recursive joiner. */
-rBoxJoin(refList, qStart, qEnd, tStart, tEnd);
-
-/* Copy from local memory and local data structures
- * to global memory and global data structures. */
-for (node = clusterList.head; !dlEnd(node); node = node->next)
-    {
-    int boxCount = 0;
-    int qStart = BIGNUM, qEnd = -BIGNUM;
-    int tStart = BIGNUM, tEnd = -BIGNUM;
-    struct boxIn *boxList = NULL;
-    cluster = node->val;
-    for (box = cluster->boxList; box != NULL; box = box->next)
-	{
-	in = box->in;
-	slAddHead(&boxList, in);
-	if (in->qStart < qStart) qStart = in->qStart;
-	if (in->qEnd > qEnd) qEnd = in->qEnd;
-	if (in->tStart < tStart) tStart = in->tStart;
-	if (in->tEnd > tEnd) tEnd = in->tEnd;
-	++boxCount;
-	}
-    if (boxCount > 0)
-        {
-	AllocVar(clump);
-	slAddHead(&clumpList, clump);
-	clump->boxList = boxList;
-	clump->boxCount = boxCount;
-	clump->qStart = qStart;
-	clump->qEnd = qEnd;
-	clump->tStart = tStart;
-	clump->tEnd = tEnd;
-	}
-    }
-*pBoxList = NULL;
-lmCleanup(&lm);
-return clumpList;
-}
-
diff --git a/gbtools/src/blatSrc/lib/boxLump.c b/gbtools/src/blatSrc/lib/boxLump.c
deleted file mode 100644
index 0fdc67c..0000000
--- a/gbtools/src/blatSrc/lib/boxLump.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* boxLump - This will lump together boxes that overlap into the smallest
- * box that encompasses the overlap.  It will put other boxes that 
- * fit in the encompassing box in there too. 
- *   It works by projecting the box list along one dimension at a
- * time looking for gaps between boxes. This is similar in function
- * to boxFindClumps, but a bit less precise, and quite a bit faster.
- * in some important cases. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "boxClump.h"
-#include "boxLump.h"
-
-
-int boxInCmpQuery(const void *va, const void *vb)
-/* Compare to sort based on query start. */
-{
-const struct boxIn *a = *((struct boxIn **)va);
-const struct boxIn *b = *((struct boxIn **)vb);
-return a->qStart - b->qStart;
-}
-
-int boxInCmpTarget(const void *va, const void *vb)
-/* Compare to sort based on query start. */
-{
-const struct boxIn *a = *((struct boxIn **)va);
-const struct boxIn *b = *((struct boxIn **)vb);
-return a->tStart - b->tStart;
-}
-
-struct boxClump *lumpOneDimension(struct boxIn *boxList, boolean onQuery)
-/* Build box clump list on one dimension. */
-{
-struct boxClump *clump = NULL, *clumpList = NULL;
-struct boxIn *box, *nextBox;
-if (onQuery)
-    slSort(&boxList, boxInCmpQuery);
-else
-    slSort(&boxList, boxInCmpTarget);
-for (box = boxList; box != NULL; box = nextBox)
-    {
-    nextBox = box->next;
-    /* Make new clump containing current box. */
-    if (clump == NULL || 
-        (onQuery && clump->qEnd < box->qStart) ||
-	(!onQuery && clump->tEnd < box->tStart) )
-        {
-	AllocVar(clump);
-	slAddHead(&clumpList, clump);
-	clump->qStart = box->qStart;
-	clump->qEnd = box->qEnd;
-	clump->tStart = box->tStart;
-	clump->tEnd = box->tEnd;
-	clump->boxCount = 1;
-	clump->boxList = box;
-	box->next = NULL;
-	}
-    else
-        {
-	if (clump->tStart > box->tStart)
-	     clump->tStart = box->tStart;
-	if (clump->tEnd < box->tEnd)
-	     clump->tEnd = box->tEnd;
-	if (clump->qEnd < box->qEnd)
-	     clump->qEnd = box->qEnd;
-	if (clump->qStart > box->qStart)
-	     clump->qStart = box->qStart;
-	clump->boxCount += 1;
-	slAddHead(&clump->boxList, box);
-	}
-    }
-return clumpList;
-}
-
-struct boxClump *boxLump(struct boxIn **pBoxList)
-/* Convert list of boxes to a list of lumps.  The lumps
- * are a smaller number of boxes that between them contain
- * all of the input boxes.  Note that
- * the original boxList is overwritten as the boxes
- * are moved from it to the lumps. */
-{
-struct boxClump *qClumpList = NULL, *tClumpList = NULL, 
-	*tClump;
-
-if (*pBoxList == NULL)
-    return NULL;
-tClumpList = lumpOneDimension(*pBoxList, FALSE);
-
-for (tClump = tClumpList; tClump != NULL; tClump = tClump->next)
-    {
-    struct boxClump *oneList = lumpOneDimension(tClump->boxList, TRUE);
-    if (slCount(oneList) > 1)
-        {
-	struct boxClump *clump;
-	for (clump = oneList; clump != NULL; clump = clump->next)
-	    {
-	    struct boxClump *subList = boxLump(&clump->boxList);
-	    qClumpList = slCat(subList, qClumpList);
-	    }
-	boxClumpFreeList(&oneList);
-	}
-    else
-	{
-	qClumpList = slCat(oneList, qClumpList);
-	}
-    tClump->boxList = NULL;
-    }
-
-boxClumpFreeList(&tClumpList);
-*pBoxList = NULL;
-return qClumpList;
-}
-
-#ifdef DEBUG
-
-int testData[][4] = 
-    {
-	/* qStart, qEnd, tStart, tEnd */
-	{0, 100,     0, 100},
-	{50, 150,    50, 150},
-	{200, 300,   200, 300},
-	{250, 350,   250, 350},
-	{0, 100,     200, 300},
-	{50, 150,    250, 350},
-	{200,300,    0, 100},
-	{250,350,    50, 150},
-	{500,600,    100,300},
-	{500,600,    500, 600},
-	{500,700,    500, 700},
-	{1000,1100,  1000,1100},
-	{1000,1100,  2000,2100},
-    };
-
-
-void testBoxLump()
-/* Test boxLump routine. */
-{
-struct boxIn *boxList = NULL, *box;
-struct boxClump *clumpList, *clump;
-int i;
-
-for (i=0; i<ArraySize(testData); ++i)
-    {
-    AllocVar(box);
-    box->qStart = testData[i][0];
-    box->qEnd = testData[i][1];
-    box->tStart = testData[i][2];
-    box->tEnd = testData[i][3];
-    slAddHead(&boxList, box);
-    }
-clumpList = boxLump(&boxList);
-for (clump = clumpList; clump != NULL; clump = clump->next)
-    {
-    printf("%d,%d,\t%d,%d\n", clump->qStart, clump->qEnd, clump->tStart, clump->tEnd);
-    for (box = clump->boxList; box != NULL; box = box->next)
-	printf("\t%d,%d\t%d,%d\n", box->qStart, box->qEnd, box->tStart, box->tEnd);
-    }
-}
-#endif /* DEBUG */
diff --git a/gbtools/src/blatSrc/lib/bwgCreate.c b/gbtools/src/blatSrc/lib/bwgCreate.c
deleted file mode 100644
index 01fe4a7..0000000
--- a/gbtools/src/blatSrc/lib/bwgCreate.c
+++ /dev/null
@@ -1,1238 +0,0 @@
-/* bwgCreate - create big wig files.  Implements write side of bwgInternal.h module. 
- * See the comment in bwgInternal.h for a description of the file format. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "errAbort.h"
-#include "sqlNum.h"
-#include "sig.h"
-#include "zlibFace.h"
-#include "bPlusTree.h"
-#include "cirTree.h"
-#include "bbiFile.h"
-#include "bwgInternal.h"
-#include "bigWig.h"
-
-
-static int bwgBedGraphItemCmp(const void *va, const void *vb)
-/* Compare to sort based on query start. */
-{
-const struct bwgBedGraphItem *a = *((struct bwgBedGraphItem **)va);
-const struct bwgBedGraphItem *b = *((struct bwgBedGraphItem **)vb);
-int dif = (int)a->start - (int)b->start;
-if (dif == 0)
-    dif = (int)a->end - (int)b->end;
-return dif;
-}
-
-static int bwgVariableStepItemCmp(const void *va, const void *vb)
-/* Compare to sort based on query start. */
-{
-const struct bwgVariableStepItem *a = *((struct bwgVariableStepItem **)va);
-const struct bwgVariableStepItem *b = *((struct bwgVariableStepItem **)vb);
-return (int)a->start - (int)b->start;
-}
-
-void bwgDumpSummary(struct bbiSummary *sum, FILE *f)
-/* Write out summary info to file. */
-{
-fprintf(f, "summary %d:%d-%d min=%f, max=%f, sum=%f, sumSquares=%f, validCount=%d, mean=%f\n",
-     sum->chromId, sum->start, sum->end, sum->minVal, sum->maxVal, sum->sumData,
-     sum->sumSquares, sum->validCount, sum->sumData/sum->validCount);
-}
-
-static int bwgSectionWrite(struct bwgSection *section, boolean doCompress, FILE *f)
-/* Write out section to file, filling in section->fileOffset. */
-{
-UBYTE type = section->type;
-UBYTE reserved8 = 0;
-int itemSize;
-switch (section->type)
-    {
-    case bwgTypeBedGraph:
-        itemSize = 12;
-	break;
-    case bwgTypeVariableStep:
-        itemSize = 8;
-	break;
-    case bwgTypeFixedStep:
-        itemSize = 4;
-	break;
-    default:
-        itemSize = 0;  // Suppress compiler warning
-	internalErr();
-	break;
-    }
-int fixedSize = sizeof(section->chromId) + sizeof(section->start) + sizeof(section->end) + 
-     sizeof(section->itemStep) + sizeof(section->itemSpan) + sizeof(type) + sizeof(reserved8) +
-     sizeof(section->itemCount);
-int bufSize = section->itemCount * itemSize + fixedSize;
-char buf[bufSize];
-char *bufPt = buf;
-
-section->fileOffset = ftell(f);
-memWriteOne(&bufPt, section->chromId);
-memWriteOne(&bufPt, section->start);
-memWriteOne(&bufPt, section->end);
-memWriteOne(&bufPt, section->itemStep);
-memWriteOne(&bufPt, section->itemSpan);
-memWriteOne(&bufPt, type);
-memWriteOne(&bufPt, reserved8);
-memWriteOne(&bufPt, section->itemCount);
-
-int i;
-switch (section->type)
-    {
-    case bwgTypeBedGraph:
-	{
-	struct bwgBedGraphItem *item = section->items.bedGraphList;
-	for (item = section->items.bedGraphList; item != NULL; item = item->next)
-	    {
-	    memWriteOne(&bufPt, item->start);
-	    memWriteOne(&bufPt, item->end);
-	    memWriteOne(&bufPt, item->val);
-	    }
-	break;
-	}
-    case bwgTypeVariableStep:
-	{
-	struct bwgVariableStepPacked *items = section->items.variableStepPacked;
-	for (i=0; i<section->itemCount; ++i)
-	    {
-	    memWriteOne(&bufPt, items->start);
-	    memWriteOne(&bufPt, items->val);
-	    items += 1;
-	    }
-	break;
-	}
-    case bwgTypeFixedStep:
-	{
-	struct bwgFixedStepPacked *items = section->items.fixedStepPacked;
-	for (i=0; i<section->itemCount; ++i)
-	    {
-	    memWriteOne(&bufPt, items->val);
-	    items += 1;
-	    }
-	break;
-	}
-    default:
-        internalErr();
-	break;
-    }
-assert(bufSize == (bufPt - buf) );
-
-if (doCompress)
-    {
-    size_t maxCompSize = zCompBufSize(bufSize);
-    char compBuf[maxCompSize];
-    int compSize = zCompress(buf, bufSize, compBuf, maxCompSize);
-    mustWrite(f, compBuf, compSize);
-    }
-else
-    mustWrite(f, buf, bufSize);
-return bufSize;
-}
-
-
-int bwgSectionCmp(const void *va, const void *vb)
-/* Compare to sort based on chrom,start,end.  */
-{
-const struct bwgSection *a = *((struct bwgSection **)va);
-const struct bwgSection *b = *((struct bwgSection **)vb);
-int dif = strcmp(a->chrom, b->chrom);
-if (dif == 0)
-    {
-    dif = (int)a->start - (int)b->start;
-    if (dif == 0)
-	dif = (int)a->end - (int)b->end;
-    }
-return dif;
-}
-
-static struct cirTreeRange bwgSectionFetchKey(const void *va, void *context)
-/* Fetch bwgSection key for r-tree */
-{
-struct cirTreeRange res;
-const struct bwgSection *a = *((struct bwgSection **)va);
-res.chromIx = a->chromId;
-res.start = a->start;
-res.end = a->end;
-return res;
-}
-
-static bits64 bwgSectionFetchOffset(const void *va, void *context)
-/* Fetch bwgSection file offset for r-tree */
-{
-const struct bwgSection *a = *((struct bwgSection **)va);
-return a->fileOffset;
-}
-
-static boolean stepTypeLine(char *line)
-/* Return TRUE if it's a variableStep or fixedStep line. */
-{
-return (startsWithWord("variableStep", line) || startsWithWord("fixedStep", line));
-}
-
-static boolean steppedSectionEnd(char *line, int maxWords)
-/* Return TRUE if line indicates the start of another section. */
-{
-int wordCount = chopByWhite(line, NULL, 5);
-if (wordCount > maxWords)
-    return TRUE;
-return stepTypeLine(line);
-}
-
-static void parseFixedStepSection(struct lineFile *lf, boolean clipDontDie, struct lm *lm,
-	int itemsPerSlot, char *chrom, bits32 chromSize, bits32 span, bits32 sectionStart, 
-	bits32 step, struct bwgSection **pSectionList)
-/* Read the single column data in section until get to end. */
-{
-struct lm *lmLocal = lmInit(0);
-
-/* Stream through section until get to end of file or next section,
- * adding values from single column to list. */
-char *words[1];
-char *line;
-struct bwgFixedStepItem *item, *itemList = NULL;
-int originalSectionSize = 0;
-bits32 sectionEnd = sectionStart;
-while (lineFileNextReal(lf, &line))
-    {
-    if (steppedSectionEnd(line, 1))
-	{
-        lineFileReuse(lf);
-	break;
-	}
-    chopLine(line, words);
-    lmAllocVar(lmLocal, item);
-    item->val = lineFileNeedDouble(lf, words, 0);
-    if (sectionEnd + span > chromSize)
-	{
-	warn("line %d of %s: chromosome %s has %u bases, but item ends at %u",
-	    lf->lineIx, lf->fileName, chrom, chromSize, sectionEnd + span);
-	if (!clipDontDie)
-	    noWarnAbort();
-	}
-    else
-	{
-	slAddHead(&itemList, item);
-	++originalSectionSize;
-	}
-    sectionEnd += step;
-    }
-slReverse(&itemList);
-
-/* Break up into sections of no more than items-per-slot size, and convert to packed format. */
-int sizeLeft = originalSectionSize;
-for (item = itemList; item != NULL; )
-    {
-    /* Figure out size of this section  */
-    int sectionSize = sizeLeft;
-    if (sectionSize > itemsPerSlot)
-        sectionSize = itemsPerSlot;
-    sizeLeft -= sectionSize;
-
-
-    /* Allocate and fill in section. */
-    struct bwgSection *section;
-    lmAllocVar(lm, section);
-    section->chrom = chrom;
-    section->start = sectionStart;
-    sectionStart += sectionSize * step;
-    section->end = sectionStart - step + span;
-    section->type = bwgTypeFixedStep;
-    section->itemStep = step;
-    section->itemSpan = span;
-    section->itemCount = sectionSize;
-
-    /* Allocate array for data, and copy from list to array representation */
-    struct bwgFixedStepPacked *packed;		/* An array */
-    section->items.fixedStepPacked = lmAllocArray(lm, packed, sectionSize);
-    int i;
-    for (i=0; i<sectionSize; ++i)
-        {
-	packed->val = item->val;
-	item = item->next;
-	++packed;
-	}
-
-    /* Add section to list. */
-    slAddHead(pSectionList, section);
-    }
-lmCleanup(&lmLocal);
-}
-
-static void parseVariableStepSection(struct lineFile *lf, boolean clipDontDie, struct lm *lm,
-	int itemsPerSlot, char *chrom, int chromSize, bits32 span, struct bwgSection **pSectionList)
-/* Read the single column data in section until get to end. */
-{
-struct lm *lmLocal = lmInit(0);
-
-/* Stream through section until get to end of file or next section,
- * adding values from single column to list. */
-char *words[2];
-char *line;
-struct bwgVariableStepItem *item, *nextItem, *itemList = NULL;
-int originalSectionSize = 0;
-while (lineFileNextReal(lf, &line))
-    {
-    if (steppedSectionEnd(line, 2))
-	{
-        lineFileReuse(lf);
-	break;
-	}
-    chopLine(line, words);
-    lmAllocVar(lmLocal, item);
-    int start = lineFileNeedNum(lf, words, 0);
-    if (start <= 0)
-	{
-	errAbort("line %d of %s: zero or negative chromosome coordinate not allowed",
-	    lf->lineIx, lf->fileName);
-	}
-    item->start = start - 1;
-    item->val = lineFileNeedDouble(lf, words, 1);
-    if (item->start + span > chromSize)
-        {
-	warn("line %d of %s: chromosome %s has %u bases, but item ends at %u",
-	    lf->lineIx, lf->fileName, chrom, chromSize, item->start + span);
-	if (!clipDontDie)
-	    noWarnAbort();
-	}
-    else
-        {
-	slAddHead(&itemList, item);
-	++originalSectionSize;
-	}
-    }
-slSort(&itemList, bwgVariableStepItemCmp);
-
-/* Make sure no overlap between items. */
-if (itemList != NULL)
-    {
-    item = itemList;
-    for (nextItem = item->next; nextItem != NULL; nextItem = nextItem->next)
-        {
-	if (item->start + span > nextItem->start)
-	    errAbort("Overlap on %s between items starting at %d and %d.\n"
-	             "Please remove overlaps and try again",
-		    chrom, item->start, nextItem->start);
-	item = nextItem;
-	}
-    }
-
-/* Break up into sections of no more than items-per-slot size. */
-int sizeLeft = originalSectionSize;
-for (item = itemList; item != NULL; )
-    {
-    /* Figure out size of this section  */
-    int sectionSize = sizeLeft;
-    if (sectionSize > itemsPerSlot)
-        sectionSize = itemsPerSlot;
-    sizeLeft -= sectionSize;
-
-    /* Convert from list to array representation. */
-    struct bwgVariableStepPacked *packed, *p;		
-    p = lmAllocArray(lm, packed, sectionSize);
-    int i;
-    for (i=0; i<sectionSize; ++i)
-        {
-	p->start = item->start;
-	p->val = item->val;
-	item = item->next;
-	++p;
-	}
-
-    /* Fill in section and add it to list. */
-    struct bwgSection *section;
-    lmAllocVar(lm, section);
-    section->chrom = chrom;
-    section->start = packed[0].start;
-    section->end = packed[sectionSize-1].start + span;
-    section->type = bwgTypeVariableStep;
-    section->items.variableStepPacked = packed;
-    section->itemSpan = span;
-    section->itemCount = sectionSize;
-    slAddHead(pSectionList, section);
-    }
-lmCleanup(&lmLocal);
-}
-
-static unsigned parseUnsignedVal(struct lineFile *lf, char *var, char *val)
-/* Return val as an integer, printing error message if it's not. */
-{
-char c = val[0];
-if (!isdigit(c))
-    errAbort("Expecting numerical value for %s, got %s, line %d of %s", 
-    	var, val, lf->lineIx, lf->fileName);
-return sqlUnsigned(val);
-}
-
-static void parseSteppedSection(struct lineFile *lf, boolean clipDontDie, 
-	struct hash *chromSizeHash, char *initialLine, 
-	struct lm *lm, int itemsPerSlot, struct bwgSection **pSectionList)
-/* Parse out a variableStep or fixedStep section and add it to list, breaking it up as need be. */
-{
-/* Parse out first word of initial line and make sure it is something we recognize. */
-char *typeWord = nextWord(&initialLine);
-enum bwgSectionType type = bwgTypeFixedStep;
-if (sameString(typeWord, "variableStep"))
-    type = bwgTypeVariableStep;
-else if (sameString(typeWord, "fixedStep"))
-    type = bwgTypeFixedStep;
-else
-    errAbort("Unknown type %s\n", typeWord);
-
-/* Set up defaults for values we hope to parse out of rest of line. */
-int span = 0;
-bits32 step = 0;
-bits32 start = 0;
-char *chrom = NULL;
-
-/* Parse out var=val pairs. */
-char *varEqVal;
-while ((varEqVal = nextWord(&initialLine)) != NULL)
-    {
-    char *wordPairs[2];
-    int wc = chopByChar(varEqVal, '=', wordPairs, 2);
-    if (wc != 2)
-        errAbort("strange var=val pair line %d of %s", lf->lineIx, lf->fileName);
-    char *var = wordPairs[0];
-    char *val = wordPairs[1];
-    if (sameString(var, "chrom"))
-        chrom = cloneString(val);
-    else if (sameString(var, "span"))
-	span = parseUnsignedVal(lf, var, val);
-    else if (sameString(var, "step"))
-	step = parseUnsignedVal(lf, var, val);
-    else if (sameString(var, "start"))
-	{
-        start = parseUnsignedVal(lf, var, val);
-	}
-    else
-	errAbort("Unknown setting %s=%s line %d of %s", var, val, lf->lineIx, lf->fileName);
-    }
-
-/* Check that we have all that are required and no more, and call type-specific routine to parse
- * rest of section. */
-if (chrom == NULL)
-    errAbort("Missing chrom= setting line %d of %s\n", lf->lineIx, lf->fileName);
-bits32 chromSize = (chromSizeHash ? hashIntVal(chromSizeHash, chrom) : BIGNUM);
-if (start > chromSize)
-    {
-    warn("line %d of %s: chromosome %s has %u bases, but item starts at %u",
-    	lf->lineIx, lf->fileName, chrom, chromSize, start);
-    if (!clipDontDie)
-        noWarnAbort();
-    }
-if (type == bwgTypeFixedStep)
-    {
-    if (start == 0)
-	errAbort("Missing start= setting line %d of %s\n", lf->lineIx, lf->fileName);
-    if (step == 0)
-	errAbort("Missing step= setting line %d of %s\n", lf->lineIx, lf->fileName);
-    if (span == 0)
-	span = step;
-    parseFixedStepSection(lf, clipDontDie, lm, itemsPerSlot, 
-    	chrom, chromSize, span, start-1, step, pSectionList);
-    }
-else
-    {
-    if (start != 0)
-	errAbort("Extra start= setting line %d of %s\n", lf->lineIx, lf->fileName);
-    if (step != 0)
-	errAbort("Extra step= setting line %d of %s\n", lf->lineIx, lf->fileName);
-    if (span == 0)
-	span = 1;
-    parseVariableStepSection(lf, clipDontDie, lm, itemsPerSlot, 
-    	chrom, chromSize, span, pSectionList);
-    }
-}
-
-struct bedGraphChrom
-/* A chromosome in bed graph format. */
-    {
-    struct bedGraphChrom *next;		/* Next in list. */
-    char *name;			/* Chromosome name - not allocated here. */
-    bits32 size;		/* Chromosome size. */
-    struct bwgBedGraphItem *itemList;	/* List of items. */
-    };
-
-static int bedGraphChromCmpName(const void *va, const void *vb)
-/* Compare to sort based on query start. */
-{
-const struct bedGraphChrom *a = *((struct bedGraphChrom **)va);
-const struct bedGraphChrom *b = *((struct bedGraphChrom **)vb);
-return strcmp(a->name, b->name);
-}
-
-static void parseBedGraphSection(struct lineFile *lf, boolean clipDontDie, 
-	struct hash *chromSizeHash, struct lm *lm, 
-	int itemsPerSlot, struct bwgSection **pSectionList)
-/* Parse out bedGraph section until we get to something that is not in bedGraph format. */
-{
-/* Set up hash and list to store chromosomes. */
-struct hash *chromHash = hashNew(0);
-struct bedGraphChrom *chrom, *chromList = NULL;
-
-/* Collect lines in items on appropriate chromosomes. */
-struct bwgBedGraphItem *item;
-char *line;
-while (lineFileNextReal(lf, &line))
-    {
-    /* Check for end of section. */
-    if (stepTypeLine(line))
-        {
-	lineFileReuse(lf);
-	break;
-	}
-
-    /* Parse out our line and make sure it has exactly 4 columns. */
-    char *words[5];
-    int wordCount = chopLine(line, words);
-    lineFileExpectWords(lf, 4, wordCount);
-
-    /* Get chromosome. */
-    char *chromName = words[0];
-    chrom = hashFindVal(chromHash, chromName);
-    if (chrom == NULL)
-        {
-	lmAllocVar(chromHash->lm, chrom);
-	hashAddSaveName(chromHash, chromName, chrom, &chrom->name);
-	chrom->size = (chromSizeHash ? hashIntVal(chromSizeHash, chromName) : BIGNUM);
-	slAddHead(&chromList, chrom);
-	}
-
-    /* Convert to item and add to chromosome list. */
-    lmAllocVar(lm, item);
-    item->start = lineFileNeedNum(lf, words, 1);
-    item->end = lineFileNeedNum(lf, words, 2);
-    item->val = lineFileNeedDouble(lf, words, 3);
-
-    /* Do sanity checking on coordinates. */
-    if (item->start > item->end)
-        errAbort("bedGraph error: start (%u) after end line (%u) %d of %s.", 
-		item->start, item->end, lf->lineIx, lf->fileName);
-    if (item->end > chrom->size)
-	{
-        warn("bedGraph error line %d of %s: chromosome %s has size %u but item ends at %u",
-	        lf->lineIx, lf->fileName, chrom->name, chrom->size, item->end);
-	if (!clipDontDie)
-	    noWarnAbort();
-	}
-    else
-	{
-	slAddHead(&chrom->itemList, item);
-	}
-    }
-slSort(&chromList, bedGraphChromCmpName);
-
-/* Loop through each chromosome and output the item list, broken into sections
- * for that chrom. */
-for (chrom = chromList; chrom != NULL; chrom = chrom->next)
-    {
-    slSort(&chrom->itemList, bwgBedGraphItemCmp);
-
-    /* Check to make sure no overlap between items. */
-    struct bwgBedGraphItem *item = chrom->itemList, *nextItem;
-    for (nextItem = item->next; nextItem != NULL; nextItem = nextItem->next)
-        {
-	if (item->end > nextItem->start)
-	    errAbort("Overlap between %s %d %d and %s %d %d.\nPlease remove overlaps and try again",
-	        chrom->name, item->start, item->end, chrom->name, nextItem->start, nextItem->end);
-	item = nextItem;
-	}
-
-    /* Break up into sections of no more than items-per-slot size. */
-    struct bwgBedGraphItem *startItem, *endItem, *nextStartItem = chrom->itemList;
-    for (startItem = chrom->itemList; startItem != NULL; startItem = nextStartItem)
-	{
-	/* Find end item of this section, and start item for next section.
-	 * Terminate list at end item. */
-	int sectionSize = 0;
-	int i;
-	endItem = startItem;
-	for (i=0; i<itemsPerSlot; ++i)
-	    {
-	    if (nextStartItem == NULL)
-		break;
-	    endItem = nextStartItem;
-	    nextStartItem = nextStartItem->next;
-	    ++sectionSize;
-	    }
-	endItem->next = NULL;
-
-	/* Fill in section and add it to section list. */
-	struct bwgSection *section;
-	lmAllocVar(lm, section);
-	section->chrom = cloneString(chrom->name);
-	section->start = startItem->start;
-	section->end = endItem->end;
-	section->type = bwgTypeBedGraph;
-	section->items.bedGraphList = startItem;
-	section->itemCount = sectionSize;
-	slAddHead(pSectionList, section);
-	}
-    }
-
-/* Free up hash, no longer needed. Free's chromList as a side effect since chromList is in 
- * hash's memory. */
-hashFree(&chromHash);
-chromList = NULL;
-}
-
-void bwgMakeChromInfo(struct bwgSection *sectionList, struct hash *chromSizeHash,
-	int *retChromCount, struct bbiChromInfo **retChromArray,
-	int *retMaxChromNameSize)
-/* Fill in chromId field in sectionList.  Return array of chromosome name/ids. 
- * The chromSizeHash is keyed by name, and has int values. */
-{
-/* Build up list of unique chromosome names. */
-struct bwgSection *section;
-char *chromName = "";
-int chromCount = 0;
-int maxChromNameSize = 0;
-struct slRef *uniq, *uniqList = NULL;
-for (section = sectionList; section != NULL; section = section->next)
-    {
-    if (!sameString(section->chrom, chromName))
-        {
-	chromName = section->chrom;
-	refAdd(&uniqList, chromName);
-	++chromCount;
-	int len = strlen(chromName);
-	if (len > maxChromNameSize)
-	    maxChromNameSize = len;
-	}
-    section->chromId = chromCount-1;
-    }
-slReverse(&uniqList);
-
-/* Allocate and fill in results array. */
-struct bbiChromInfo *chromArray;
-AllocArray(chromArray, chromCount);
-int i;
-for (i = 0, uniq = uniqList; i < chromCount; ++i, uniq = uniq->next)
-    {
-    chromArray[i].name = uniq->val;
-    chromArray[i].id = i;
-    chromArray[i].size = hashIntVal(chromSizeHash, uniq->val);
-    }
-
-/* Clean up, set return values and go home. */
-slFreeList(&uniqList);
-*retChromCount = chromCount;
-*retChromArray = chromArray;
-*retMaxChromNameSize = maxChromNameSize;
-}
-
-static int bwgStrcmp (const void * A, const void * B) {
-	char * stringA = *((char **) A);
-	char * stringB = *((char **) B);
-	return strcmp(stringA, stringB);
-}
-
-void bwgMakeAllChromInfo(struct bwgSection *sectionList, struct hash *chromSizeHash,
-	int *retChromCount, struct bbiChromInfo **retChromArray,
-	int *retMaxChromNameSize)
-/* Fill in chromId field in sectionList.  Return array of chromosome name/ids. 
- * The chromSizeHash is keyed by name, and has int values. */
-{
-/* Build up list of unique chromosome names. */
-int maxChromNameSize = 0;
-
-/* Get list of values */
-int chromCount = chromSizeHash->elCount;
-char ** chromName, ** chromNames;
-AllocArray(chromNames, chromCount);
-chromName = chromNames;
-struct hashEl* el;
-struct hashCookie cookie = hashFirst(chromSizeHash);
-for (el = hashNext(&cookie); el; el = hashNext(&cookie)) {
-	*chromName = el->name;
-	if (strlen(el->name) > maxChromNameSize)
-		maxChromNameSize = strlen(el->name);
-	chromName++;
-}
-qsort(chromNames, chromCount, sizeof(char *), bwgStrcmp);
-
-/* Allocate and fill in results array. */
-struct bbiChromInfo *chromArray;
-AllocArray(chromArray, chromCount);
-int i;
-for (i = 0; i < chromCount; ++i)
-    {
-    chromArray[i].name = chromNames[i];
-    chromArray[i].id = i;
-    chromArray[i].size = hashIntVal(chromSizeHash, chromNames[i]);
-    }
-
-// Assign IDs to sections:
-struct bwgSection *section;
-char *name = "";
-bits32 chromId = 0;
-for (section = sectionList; section != NULL; section = section->next)
-    {
-    if (!sameString(section->chrom, name))
-        {
-        for (i = 0; i < chromCount; ++i)
-            {
-	    if (sameString(section->chrom, chromArray[i].name)) 
-	        {
-		    section->chromId = i;
-	    	    break;
-	        }
-	    }
-	if (i == chromCount)
-		errAbort("Could not find %s in list of chromosomes\n", section->chrom);
-	chromId = section->chromId;
-	name = section->chrom;
-	}
-    else 
-	section->chromId = chromId;
-    }
-
-/* Clean up, set return values and go home. */
-*retChromCount = chromCount;
-*retChromArray = chromArray;
-*retMaxChromNameSize = maxChromNameSize;
-}
-
-int bwgAverageResolution(struct bwgSection *sectionList)
-/* Return the average resolution seen in sectionList. */
-{
-if (sectionList == NULL)
-    return 1;
-bits64 totalRes = 0;
-bits32 sectionCount = 0;
-struct bwgSection *section;
-int i;
-for (section = sectionList; section != NULL; section = section->next)
-    {
-    int sectionRes = 0;
-    switch (section->type)
-        {
-	case bwgTypeBedGraph:
-	    {
-	    struct bwgBedGraphItem *item;
-	    sectionRes = BIGNUM;
-	    for (item = section->items.bedGraphList; item != NULL; item = item->next)
-		{
-		int size = item->end - item->start;
-		if (sectionRes > size)
-		    sectionRes = size;
-		}
-	    break;
-	    }
-	case bwgTypeVariableStep:
-	    {
-	    struct bwgVariableStepPacked *items = section->items.variableStepPacked, *prev;
-	    bits32 smallestGap = BIGNUM;
-	    for (i=1; i<section->itemCount; ++i)
-	        {
-		prev = items;
-		items += 1;
-		bits32 gap = items->start - prev->start;
-		if (smallestGap > gap)
-		    smallestGap = gap;
-		}
-	    if (smallestGap != BIGNUM)
-	        sectionRes = smallestGap;
-	    else
-	        sectionRes = section->itemSpan;
-	    break;
-	    }
-	case bwgTypeFixedStep:
-	    {
-	    sectionRes = section->itemStep;
-	    break;
-	    }
-	default:
-	    internalErr();
-	    break;
-	}
-    totalRes += sectionRes;
-    ++sectionCount;
-    }
-return (totalRes + sectionCount/2)/sectionCount;
-}
-
-#define bwgSectionHeaderSize 24	/* Size of section header in file. */
-
-static int bwgItemSize(enum bwgSectionType type)
-/* Return size of an item inside a particular section. */
-{
-switch (type)
-    {
-    case bwgTypeBedGraph:
-	return 2*sizeof(bits32) + sizeof(float);
-	break;
-    case bwgTypeVariableStep:
-	return sizeof(bits32) + sizeof(float);
-	break;
-    case bwgTypeFixedStep:
-	return sizeof(float);
-	break;
-    default:
-        internalErr();
-	return 0;
-    }
-}
-
-static int bwgSectionSize(struct bwgSection *section)
-/* Return size (on disk) of section. */
-{
-return bwgSectionHeaderSize + bwgItemSize(section->type) * section->itemCount;
-}
-
-static bits64 bwgTotalSectionSize(struct bwgSection *sectionList)
-/* Return total size of all sections. */
-{
-bits64 total = 0;
-struct bwgSection *section;
-for (section = sectionList; section != NULL; section = section->next)
-    total += bwgSectionSize(section);
-return total;
-}
-
-static void bwgReduceBedGraph(struct bwgSection *section, bits32 chromSize, int reduction, 
-	struct bbiSummary **pOutList)
-/*Reduce a bedGraph section onto outList. */
-{
-struct bwgBedGraphItem *item = section->items.bedGraphList;
-for (item = section->items.bedGraphList; item != NULL; item = item->next)
-    {
-    bbiAddRangeToSummary(section->chromId, chromSize, item->start, item->end, 
-    	item->val, reduction, pOutList);
-    }
-}
-
-static void bwgReduceVariableStep(struct bwgSection *section, bits32 chromSize, int reduction, 
-	struct bbiSummary **pOutList)
-/*Reduce a variableStep section onto outList. */
-{
-struct bwgVariableStepPacked *items = section->items.variableStepPacked;
-int i;
-for (i=0; i<section->itemCount; ++i)
-    {
-    bbiAddRangeToSummary(section->chromId, chromSize, 
-    	items->start, items->start + section->itemSpan, items->val, reduction, pOutList);
-    items += 1;
-    }
-}
-
-static void bwgReduceFixedStep(struct bwgSection *section, bits32 chromSize, int reduction, 
-	struct bbiSummary **pOutList)
-/*Reduce a fixedStep section onto outList. */
-{
-struct bwgFixedStepPacked *items = section->items.fixedStepPacked;
-int start = section->start;
-int i;
-for (i=0; i<section->itemCount; ++i)
-    {
-    bbiAddRangeToSummary(section->chromId, chromSize, start, start + section->itemSpan, items->val, 
-    	reduction, pOutList);
-    start += section->itemStep;
-    items += 1;
-    }
-}
-
-struct bbiSummary *bwgReduceSectionList(struct bwgSection *sectionList, 
-	struct bbiChromInfo *chromInfoArray, int reduction)
-/* Return summary of section list reduced by given amount. */
-{
-struct bbiSummary *outList = NULL;
-struct bwgSection *section = NULL;
-
-/* Loop through input section list reducing into outList. */
-for (section = sectionList; section != NULL; section = section->next)
-    {
-    bits32 chromSize = chromInfoArray[section->chromId].size;
-    switch (section->type)
-        {
-	case bwgTypeBedGraph:
-	    bwgReduceBedGraph(section, chromSize, reduction, &outList);
-	    break;
-	case bwgTypeVariableStep:
-	    bwgReduceVariableStep(section, chromSize, reduction, &outList);
-	    break;
-	case bwgTypeFixedStep:
-	    bwgReduceFixedStep(section, chromSize, reduction, &outList);
-	    break;
-	default:
-	    internalErr();
-	    return 0;
-	}
-    }
-slReverse(&outList);
-return outList;
-}
-
-static void bwgComputeDynamicSummaries(struct bwgSection *sectionList, struct bbiSummary ** reduceSummaries, bits16 * summaryCount, struct bbiChromInfo *chromInfoArray, int chromCount, bits32 * reductionAmounts, boolean doCompress) {
-/* Figure out initial summary level - starting with a summary 10 times the amount
- * of the smallest item.  See if summarized data is smaller than half input data, if
- * not bump up reduction by a factor of 2 until it is, or until further summarying
- * yeilds no size reduction. */
-int i;
-int  minRes = bwgAverageResolution(sectionList);
-int initialReduction = minRes*10;
-bits64 fullSize = bwgTotalSectionSize(sectionList);
-bits64 lastSummarySize = 0, summarySize;
-bits64 maxReducedSize = fullSize/2;
-struct bbiSummary *summaryList = NULL;
-for (;;)
-    {
-    summaryList = bwgReduceSectionList(sectionList, chromInfoArray, initialReduction);
-    bits64 summarySize = bbiTotalSummarySize(summaryList);
-    if (doCompress)
-	{
-        summarySize *= 2;	// Compensate for summary not compressing as well as primary data
-	}
-    if (summarySize >= maxReducedSize && summarySize != lastSummarySize)
-        {
-	/* Need to do more reduction.  First scale reduction by amount that it missed
-	 * being small enough last time, with an extra 10% for good measure.  Then
-	 * just to keep from spinning through loop two many times, make sure this is
-	 * at least 2x the previous reduction. */
-	int nextReduction = 1.1 * initialReduction * summarySize / maxReducedSize;
-	if (nextReduction < initialReduction*2)
-	    nextReduction = initialReduction*2;
-	initialReduction = nextReduction;
-	bbiSummaryFreeList(&summaryList);
-	lastSummarySize = summarySize;
-	}
-    else
-        break;
-    }
-*summaryCount = 1;
-reduceSummaries[0] = summaryList;
-reductionAmounts[0] = initialReduction;
-
-/* Now calculate up to 10 levels of further summary. */
-bits64 reduction = initialReduction;
-for (i=0; i<9; i++)
-    {
-    reduction *= 4;
-    if (reduction > 1000000000)
-        break;
-    summaryList = bbiReduceSummaryList(reduceSummaries[*summaryCount-1], chromInfoArray, 
-    	reduction);
-    summarySize = bbiTotalSummarySize(summaryList);
-    if (summarySize != lastSummarySize)
-        {
- 	reduceSummaries[*summaryCount] = summaryList;
-	reductionAmounts[*summaryCount] = reduction;
-	++(*summaryCount);
-	}
-    int summaryItemCount = slCount(summaryList);
-    if (summaryItemCount <= chromCount)
-        break;
-    }
-
-}
-
-static void bwgComputeFixedSummaries(struct bwgSection * sectionList, struct bbiSummary ** reduceSummaries, bits16 * summaryCount, struct bbiChromInfo *chromInfoArray, bits32 * reductionAmounts) {
-// Hack: pre-defining summary levels, set off Ensembl default zoom levels
-// The last two values of this array were extrapolated following Jim's formula
-int i;
-#define REDUCTION_COUNT 10
-bits32 presetReductions[REDUCTION_COUNT] = {30, 65, 130, 260, 450, 648, 950, 1296, 4800, 19200}; 
-
-bits64 reduction = reductionAmounts[0] = presetReductions[0];
-reduceSummaries[0] = bwgReduceSectionList(sectionList, chromInfoArray, presetReductions[0]);
-
-for (i=1; i<REDUCTION_COUNT; i++)
-    {
-    reduction = reductionAmounts[i] = presetReductions[i];
-    reduceSummaries[i] = bbiReduceSummaryList(reduceSummaries[i-1], chromInfoArray, 
-    	reduction);
-    }
-
-*summaryCount = REDUCTION_COUNT;
-}
-
-void bwgCreate(struct bwgSection *sectionList, struct hash *chromSizeHash, 
-	int blockSize, int itemsPerSlot, boolean doCompress, boolean keepAllChromosomes,
-        boolean fixedSummaries, char *fileName)
-/* Create a bigWig file out of a sorted sectionList. */
-{
-bits64 sectionCount = slCount(sectionList);
-FILE *f = mustOpen(fileName, "wb");
-bits32 sig = bigWigSig;
-bits16 version = bbiCurrentVersion;
-bits16 summaryCount = 0;
-bits16 reserved16 = 0;
-bits32 reserved32 = 0;
-bits64 reserved64 = 0;
-bits64 dataOffset = 0, dataOffsetPos;
-bits64 indexOffset = 0, indexOffsetPos;
-bits64 chromTreeOffset = 0, chromTreeOffsetPos;
-bits64 totalSummaryOffset = 0, totalSummaryOffsetPos;
-bits32 uncompressBufSize = 0;
-bits64 uncompressBufSizePos;
-struct bbiSummary *reduceSummaries[10];
-bits32 reductionAmounts[10];
-bits64 reductionDataOffsetPos[10];
-bits64 reductionDataOffsets[10];
-bits64 reductionIndexOffsets[10];
-int i;
-
-/* Figure out chromosome ID's. */
-struct bbiChromInfo *chromInfoArray;
-int chromCount, maxChromNameSize;
-if (keepAllChromosomes)
-    bwgMakeAllChromInfo(sectionList, chromSizeHash, &chromCount, &chromInfoArray, &maxChromNameSize);
-else
-    bwgMakeChromInfo(sectionList, chromSizeHash, &chromCount, &chromInfoArray, &maxChromNameSize);
-
-if (fixedSummaries) 
-    bwgComputeFixedSummaries(sectionList, reduceSummaries, &summaryCount, chromInfoArray, reductionAmounts);
-else 
-    bwgComputeDynamicSummaries(sectionList, reduceSummaries, &summaryCount, chromInfoArray, chromCount, reductionAmounts, doCompress);
-
-/* Write fixed header. */
-writeOne(f, sig);
-writeOne(f, version);
-writeOne(f, summaryCount);
-chromTreeOffsetPos = ftell(f);
-writeOne(f, chromTreeOffset);
-dataOffsetPos = ftell(f);
-writeOne(f, dataOffset);
-indexOffsetPos = ftell(f);
-writeOne(f, indexOffset);
-writeOne(f, reserved16);  /* fieldCount */
-writeOne(f, reserved16);  /* definedFieldCount */
-writeOne(f, reserved64);  /* autoSqlOffset. */
-totalSummaryOffsetPos = ftell(f);
-writeOne(f, totalSummaryOffset);
-uncompressBufSizePos = ftell(f);
-writeOne(f, uncompressBufSize);
-writeOne(f, reserved64);  /* nameIndexOffset */
-assert(ftell(f) == 64);
-
-/* Write summary headers */
-for (i=0; i<summaryCount; ++i)
-    {
-    writeOne(f, reductionAmounts[i]);
-    writeOne(f, reserved32);
-    reductionDataOffsetPos[i] = ftell(f);
-    writeOne(f, reserved64);	// Fill in with data offset later
-    writeOne(f, reserved64);	// Fill in with index offset later
-    }
-
-/* Write dummy summary */
-struct bbiSummaryElement totalSum;
-ZeroVar(&totalSum);
-totalSummaryOffset = ftell(f);
-bbiSummaryElementWrite(f, &totalSum);
-
-/* Write chromosome bPlusTree */
-chromTreeOffset = ftell(f);
-int chromBlockSize = min(blockSize, chromCount);
-bptFileBulkIndexToOpenFile(chromInfoArray, sizeof(chromInfoArray[0]), chromCount, chromBlockSize,
-    bbiChromInfoKey, maxChromNameSize, bbiChromInfoVal, 
-    sizeof(chromInfoArray[0].id) + sizeof(chromInfoArray[0].size), 
-    f);
-
-/* Write out data section count and sections themselves. */
-dataOffset = ftell(f);
-writeOne(f, sectionCount);
-struct bwgSection *section;
-for (section = sectionList; section != NULL; section = section->next)
-    {
-    bits32 uncSizeOne = bwgSectionWrite(section, doCompress, f);
-    if (uncSizeOne > uncompressBufSize)
-         uncompressBufSize = uncSizeOne;
-    }
-
-/* Write out index - creating a temporary array rather than list representation of
- * sections in the process. */
-indexOffset = ftell(f);
-struct bwgSection **sectionArray;
-AllocArray(sectionArray, sectionCount);
-for (section = sectionList, i=0; section != NULL; section = section->next, ++i)
-    sectionArray[i] = section;
-cirTreeFileBulkIndexToOpenFile(sectionArray, sizeof(sectionArray[0]), sectionCount,
-    blockSize, 1, NULL, bwgSectionFetchKey, bwgSectionFetchOffset, 
-    indexOffset, f);
-freez(&sectionArray);
-
-/* Write out summary sections. */
-verbose(2, "bwgCreate writing %d summaries\n", summaryCount);
-for (i=0; i<summaryCount; ++i)
-    {
-    reductionDataOffsets[i] = ftell(f);
-    reductionIndexOffsets[i] = bbiWriteSummaryAndIndex(reduceSummaries[i], blockSize, itemsPerSlot, doCompress, f);
-    verbose(3, "wrote %d of data, %d of index on level %d\n", (int)(reductionIndexOffsets[i] - reductionDataOffsets[i]), (int)(ftell(f) - reductionIndexOffsets[i]), i);
-    }
-
-/* Calculate summary */
-struct bbiSummary *sum = reduceSummaries[0];
-if (sum != NULL)
-    {
-    totalSum.validCount = sum->validCount;
-    totalSum.minVal = sum->minVal;
-    totalSum.maxVal = sum->maxVal;
-    totalSum.sumData = sum->sumData;
-    totalSum.sumSquares = sum->sumSquares;
-    for (sum = sum->next; sum != NULL; sum = sum->next)
-	{
-	totalSum.validCount += sum->validCount;
-	if (sum->minVal < totalSum.minVal) totalSum.minVal = sum->minVal;
-	if (sum->maxVal > totalSum.maxVal) totalSum.maxVal = sum->maxVal;
-	totalSum.sumData += sum->sumData;
-	totalSum.sumSquares += sum->sumSquares;
-	}
-    /* Write real summary */
-    fseek(f, totalSummaryOffset, SEEK_SET);
-    bbiSummaryElementWrite(f, &totalSum);
-    }
-else
-    totalSummaryOffset = 0;	/* Edge case, no summary. */
-
-/* Go back and fill in offsets properly in header. */
-fseek(f, dataOffsetPos, SEEK_SET);
-writeOne(f, dataOffset);
-fseek(f, indexOffsetPos, SEEK_SET);
-writeOne(f, indexOffset);
-fseek(f, chromTreeOffsetPos, SEEK_SET);
-writeOne(f, chromTreeOffset);
-fseek(f, totalSummaryOffsetPos, SEEK_SET);
-writeOne(f, totalSummaryOffset);
-
-if (doCompress)
-    {
-    int maxZoomUncompSize = itemsPerSlot * sizeof(struct bbiSummaryOnDisk);
-    if (maxZoomUncompSize > uncompressBufSize)
-	uncompressBufSize = maxZoomUncompSize;
-    fseek(f, uncompressBufSizePos, SEEK_SET);
-    writeOne(f, uncompressBufSize);
-    }
-
-/* Also fill in offsets in zoom headers. */
-for (i=0; i<summaryCount; ++i)
-    {
-    fseek(f, reductionDataOffsetPos[i], SEEK_SET);
-    writeOne(f, reductionDataOffsets[i]);
-    writeOne(f, reductionIndexOffsets[i]);
-    }
-
-/* Write end signature. */
-fseek(f, 0L, SEEK_END);
-writeOne(f, sig);
-
-/* Clean up */
-freez(&chromInfoArray);
-carefulClose(&f);
-}
-
-struct bwgSection *bwgParseWig(
-	char *fileName,       /* Name of ascii wig file. */
-	boolean clipDontDie,  /* Skip items outside chromosome rather than aborting. */
-	struct hash *chromSizeHash,  /* If non-NULL items checked to be inside chromosome. */
-	int maxSectionSize,   /* Biggest size of a section.  100 - 100,000 is usual range. */
-	struct lm *lm)	      /* Memory pool to allocate from. */
-/* Parse out ascii wig file - allocating memory in lm. */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *line;
-struct bwgSection *sectionList = NULL;
-
-/* remove initial browser and track lines */
-lineFileRemoveInitialCustomTrackLines(lf);
-
-while (lineFileNextReal(lf, &line))
-    {
-    verbose(2, "processing %s\n", line);
-    if (stringIn("chrom=", line))
-	parseSteppedSection(lf, clipDontDie, chromSizeHash, line, lm, maxSectionSize, &sectionList);
-    else
-        {
-	/* Check for bed... */
-	char *dupe = cloneString(line);
-	char *words[5];
-	int wordCount = chopLine(dupe, words);
-	if (wordCount != 4)
-	    errAbort("Unrecognized line %d of %s:\n%s\n", lf->lineIx, lf->fileName, line);
-
-	/* Parse out a bed graph line just to check numerical format. */
-	char *chrom = words[0];
-	int start = lineFileNeedNum(lf, words, 1);
-	int end = lineFileNeedNum(lf, words, 2);
-	double val = lineFileNeedDouble(lf, words, 3);
-	verbose(2, "bedGraph %s:%d-%d@%g\n", chrom, start, end, val);
-
-	/* Push back line and call bed parser. */
-	lineFileReuse(lf);
-	parseBedGraphSection(lf, clipDontDie, chromSizeHash, lm, maxSectionSize, &sectionList);
-	}
-    }
-slSort(&sectionList, bwgSectionCmp);
-
-/* Check for overlap at section level. */
-struct bwgSection *section, *nextSection;
-for (section = sectionList; section != NULL; section = nextSection)
-    {
-    nextSection = section->next;
-    if (nextSection != NULL)
-        {
-	if (sameString(section->chrom, nextSection->chrom))
-	    {
-	    if (section->end > nextSection->start)
-	        {
-		errAbort("There's more than one value for %s base %d (in coordinates that start with 1).\n",
-		    section->chrom, nextSection->start+1);
-		}
-	    }
-	}
-    }
-
-return sectionList;
-}
-
-void bigWigFileCreateEx(
-	char *inName, 		/* Input file in ascii wiggle format. */
-	char *chromSizes, 	/* Two column tab-separated file: <chromosome> <size>. */
-	int blockSize,		/* Number of items to bundle in r-tree.  1024 is good. */
-	int itemsPerSlot,	/* Number of items in lowest level of tree.  512 is good. */
-	boolean clipDontDie,	/* If TRUE then clip items off end of chrom rather than dying. */
-	boolean compress,	/* If TRUE then compress data. */
-	boolean keepAllChromosomes,	/* If TRUE then store all chromosomes in chromosomal b-tree. */
-	boolean fixedSummaries,	/* If TRUE then impose fixed summary levels. */
-	char *outName)
-/* Convert ascii format wig file (in fixedStep, variableStep or bedGraph format) 
- * to binary big wig format. */
-{
-/* This code needs to agree with code in two other places currently - bigBedFileCreate,
- * and bbiFileOpen.  I'm thinking of refactoring to share at least between
- * bigBedFileCreate and bigWigFileCreate.  It'd be great so it could be structured
- * so that it could send the input in one chromosome at a time, and send in the zoom
- * stuff only after all the chromosomes are done.  This'd potentially reduce the memory
- * footprint by a factor of 2 or 4.  Still, for now it works. -JK */
-struct hash *chromSizeHash = bbiChromSizesFromFile(chromSizes);
-struct lm *lm = lmInit(0);
-struct bwgSection *sectionList = bwgParseWig(inName, clipDontDie, chromSizeHash, itemsPerSlot, lm);
-if (sectionList == NULL)
-    errAbort("%s is empty of data", inName);
-bwgCreate(sectionList, chromSizeHash, blockSize, itemsPerSlot, compress, keepAllChromosomes, fixedSummaries, outName);
-lmCleanup(&lm);
-}
-
-void bigWigFileCreate(
-	char *inName, 		/* Input file in ascii wiggle format. */
-	char *chromSizes, 	/* Two column tab-separated file: <chromosome> <size>. */
-	int blockSize,		/* Number of items to bundle in r-tree.  1024 is good. */
-	int itemsPerSlot,	/* Number of items in lowest level of tree.  512 is good. */
-	boolean clipDontDie,	/* If TRUE then clip items off end of chrom rather than dying. */
-	boolean compress,	/* If TRUE then compress data. */
-	char *outName)
-/* Convert ascii format wig file (in fixedStep, variableStep or bedGraph format) 
- * to binary big wig format. */
-{
-bigWigFileCreateEx( inName, chromSizes, blockSize, itemsPerSlot, clipDontDie,
-	compress, FALSE, FALSE, outName);
-}
-
diff --git a/gbtools/src/blatSrc/lib/bwgQuery.c b/gbtools/src/blatSrc/lib/bwgQuery.c
deleted file mode 100644
index 838f24e..0000000
--- a/gbtools/src/blatSrc/lib/bwgQuery.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/* bwgQuery - implements the query side of bigWig.  See bwgInternal.h for definition of file
- * format. */
-
-/* Copyright (C) 2012 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "options.h"
-#include "sig.h"
-#include "sqlNum.h"
-#include "obscure.h"
-#include "dystring.h"
-#include "bPlusTree.h"
-#include "cirTree.h"
-#include "rangeTree.h"
-#include "udc.h"
-#include "zlibFace.h"
-#include "bbiFile.h"
-#include "bwgInternal.h"
-#include "bigWig.h"
-#include "bigBed.h"
-
-
-struct bbiFile *bigWigFileOpen(char *fileName)
-/* Open up big wig file. */
-{
-return bbiFileOpen(fileName, bigWigSig, "big wig");
-}
-
-boolean bigWigFileCheckSigs(char *fileName)
-/* check file signatures at beginning and end of file */
-{
-return bbiFileCheckSigs(fileName, bigWigSig, "big wig");
-}
-
-#ifdef OLD
-static void bwgSectionHeadRead(struct bbiFile *bwf, struct bwgSectionHead *head)
-/* Read section header. */
-{
-struct udcFile *udc = bwf->udc;
-boolean isSwapped = bwf->isSwapped;
-head->chromId = udcReadBits32(udc, isSwapped);
-head->start = udcReadBits32(udc, isSwapped);
-head->end = udcReadBits32(udc, isSwapped);
-head->itemStep = udcReadBits32(udc, isSwapped);
-head->itemSpan = udcReadBits32(udc, isSwapped);
-head->type = udcGetChar(udc);
-head->reserved = udcGetChar(udc);
-head->itemCount = udcReadBits16(udc, isSwapped);
-}
-#endif /* OLD */
-
-void bwgSectionHeadFromMem(char **pPt, struct bwgSectionHead *head, boolean isSwapped)
-/* Read section header. */
-{
-char *pt = *pPt;
-head->chromId = memReadBits32(&pt, isSwapped);
-head->start = memReadBits32(&pt, isSwapped);
-head->end = memReadBits32(&pt, isSwapped);
-head->itemStep = memReadBits32(&pt, isSwapped);
-head->itemSpan = memReadBits32(&pt, isSwapped);
-head->type = *pt++;
-head->reserved = *pt++;
-head->itemCount = memReadBits16(&pt, isSwapped);
-*pPt = pt;
-}
-
-static int bigWigBlockDumpIntersectingRange(boolean isSwapped, char *blockPt, char *blockEnd, 
-	char *chrom, bits32 rangeStart, bits32 rangeEnd, int maxCount, FILE *out)
-/* Print out info on parts of block that intersect start-end, block starting at current position. */
-{
-struct bwgSectionHead head;
-bwgSectionHeadFromMem(&blockPt, &head, isSwapped);
-bits16 i;
-float val;
-int outCount = 0;
-
-switch (head.type)
-    {
-    case bwgTypeBedGraph:
-	{
-	fprintf(out, "#bedGraph section %s:%u-%u\n",  chrom, head.start, head.end);
-	for (i=0; i<head.itemCount; ++i)
-	    {
-	    bits32 start = memReadBits32(&blockPt, isSwapped);
-	    bits32 end = memReadBits32(&blockPt, isSwapped);
-	    val = memReadFloat(&blockPt, isSwapped);
-	    if (rangeIntersection(rangeStart, rangeEnd, start, end) > 0)
-		{
-		fprintf(out, "%s\t%u\t%u\t%g\n", chrom, start, end, val);
-		++outCount;
-		if (maxCount != 0 && outCount >= maxCount)
-		    break;
-		}
-	    }
-	break;
-	}
-    case bwgTypeVariableStep:
-	{
-	fprintf(out, "variableStep chrom=%s span=%u\n", chrom, head.itemSpan);
-	for (i=0; i<head.itemCount; ++i)
-	    {
-	    bits32 start = memReadBits32(&blockPt, isSwapped);
-	    val = memReadFloat(&blockPt, isSwapped);
-	    if (rangeIntersection(rangeStart, rangeEnd, start, start+head.itemSpan) > 0)
-		{
-		fprintf(out, "%u\t%g\n", start+1, val);
-		++outCount;
-		if (maxCount != 0 && outCount >= maxCount)
-		    break;
-		}
-	    }
-	break;
-	}
-    case bwgTypeFixedStep:
-	{
-	boolean gotStart = FALSE;
-	bits32 start = head.start;
-	for (i=0; i<head.itemCount; ++i)
-	    {
-	    val = memReadFloat(&blockPt, isSwapped);
-	    if (rangeIntersection(rangeStart, rangeEnd, start, start+head.itemSpan) > 0)
-	        {
-		if (!gotStart)
-		    {
-		    fprintf(out, "fixedStep chrom=%s start=%u step=%u span=%u\n", 
-			    chrom, start+1, head.itemStep, head.itemSpan);
-		    gotStart = TRUE;
-		    }
-		fprintf(out, "%g\n", val);
-		++outCount;
-		if (maxCount != 0 && outCount >= maxCount)
-		    break;
-		}
-	    start += head.itemStep;
-	    }
-	break;
-	}
-    default:
-        internalErr();
-	break;
-    }
-assert( (maxCount != 0 && outCount >= maxCount) || (blockPt == blockEnd));
-return outCount;
-}
-
-struct bbiInterval *bigWigIntervalQuery(struct bbiFile *bwf, char *chrom, bits32 start, bits32 end,
-	struct lm *lm)
-/* Get data for interval.  Return list allocated out of lm. */
-{
-if (bwf->typeSig != bigWigSig)
-   errAbort("Trying to do bigWigIntervalQuery on a non big-wig file.");
-bbiAttachUnzoomedCir(bwf);
-struct bbiInterval *el, *list = NULL;
-struct fileOffsetSize *blockList = bbiOverlappingBlocks(bwf, bwf->unzoomedCir, 
-	chrom, start, end, NULL);
-struct fileOffsetSize *block, *beforeGap, *afterGap;
-struct udcFile *udc = bwf->udc;
-boolean isSwapped = bwf->isSwapped;
-float val;
-int i;
-
-/* Set up for uncompression optionally. */
-char *uncompressBuf = NULL;
-if (bwf->uncompressBufSize > 0)
-    uncompressBuf = needLargeMem(bwf->uncompressBufSize);
-
-/* This loop is a little complicated because we merge the read requests for efficiency, but we 
- * have to then go back through the data one unmerged block at a time. */
-for (block = blockList; block != NULL; )
-    {
-    /* Find contigious blocks and read them into mergedBuf. */
-    fileOffsetSizeFindGap(block, &beforeGap, &afterGap);
-    bits64 mergedOffset = block->offset;
-    bits64 mergedSize = beforeGap->offset + beforeGap->size - mergedOffset;
-    udcSeek(udc, mergedOffset);
-    char *mergedBuf = needLargeMem(mergedSize);
-    udcMustRead(udc, mergedBuf, mergedSize);
-    char *blockBuf = mergedBuf;
-
-    /* Loop through individual blocks within merged section. */
-    for (;block != afterGap; block = block->next)
-        {
-	/* Uncompress if necessary. */
-	char *blockPt, *blockEnd;
-	if (uncompressBuf)
-	    {
-	    blockPt = uncompressBuf;
-	    int uncSize = zUncompress(blockBuf, block->size, uncompressBuf, bwf->uncompressBufSize);
-	    blockEnd = blockPt + uncSize;
-	    }
-	else
-	    {
-	    blockPt = blockBuf;
-	    blockEnd = blockPt + block->size;
-	    }
-
-	/* Deal with insides of block. */
-	struct bwgSectionHead head;
-	bwgSectionHeadFromMem(&blockPt, &head, isSwapped);
-	switch (head.type)
-	    {
-	    case bwgTypeBedGraph:
-		{
-		for (i=0; i<head.itemCount; ++i)
-		    {
-		    bits32 s = memReadBits32(&blockPt, isSwapped);
-		    bits32 e = memReadBits32(&blockPt, isSwapped);
-		    val = memReadFloat(&blockPt, isSwapped);
-		    if (s < start) s = start;
-		    if (e > end) e = end;
-		    if (s < e)
-			{
-			lmAllocVar(lm, el);
-			el->start = s;
-			el->end = e;
-			el->val = val;
-			slAddHead(&list, el);
-			}
-		    }
-		break;
-		}
-	    case bwgTypeVariableStep:
-		{
-		for (i=0; i<head.itemCount; ++i)
-		    {
-		    bits32 s = memReadBits32(&blockPt, isSwapped);
-		    bits32 e = s + head.itemSpan;
-		    val = memReadFloat(&blockPt, isSwapped);
-		    if (s < start) s = start;
-		    if (e > end) e = end;
-		    if (s < e)
-			{
-			lmAllocVar(lm, el);
-			el->start = s;
-			el->end = e;
-			el->val = val;
-			slAddHead(&list, el);
-			}
-		    }
-		break;
-		}
-	    case bwgTypeFixedStep:
-		{
-		bits32 s = head.start;
-		bits32 e = s + head.itemSpan;
-		for (i=0; i<head.itemCount; ++i)
-		    {
-		    val = memReadFloat(&blockPt, isSwapped);
-		    bits32 clippedS = s, clippedE = e;
-		    if (clippedS < start) clippedS = start;
-		    if (clippedE > end) clippedE = end;
-		    if (clippedS < clippedE)
-			{
-			lmAllocVar(lm, el);
-			el->start = clippedS;
-			el->end = clippedE;
-			el->val = val;
-			slAddHead(&list, el);
-			}
-		    s += head.itemStep;
-		    e += head.itemStep;
-		    }
-		break;
-		}
-	    default:
-		internalErr();
-		break;
-	    }
-	assert(blockPt == blockEnd);
-	blockBuf += block->size;
-	}
-    freeMem(mergedBuf);
-    }
-freeMem(uncompressBuf);
-slFreeList(&blockList);
-slReverse(&list);
-return list;
-}
-
-int bigWigIntervalDump(struct bbiFile *bwf, char *chrom, bits32 start, bits32 end, int maxCount,
-	FILE *out)
-/* Print out info on bigWig parts that intersect chrom:start-end.   Set maxCount to 0 if you 
- * don't care how many are printed.  Returns number printed. */
-{
-if (bwf->typeSig != bigWigSig)
-   errAbort("Trying to do bigWigIntervalDump on a non big-wig file.");
-bbiAttachUnzoomedCir(bwf);
-struct fileOffsetSize *blockList = bbiOverlappingBlocks(bwf, bwf->unzoomedCir, 
-	chrom, start, end, NULL);
-struct fileOffsetSize *block, *beforeGap, *afterGap;
-struct udcFile *udc = bwf->udc;
-int printCount = 0;
-
-/* Set up for uncompression optionally. */
-char *uncompressBuf = NULL;
-if (bwf->uncompressBufSize > 0)
-    uncompressBuf = needLargeMem(bwf->uncompressBufSize);
-
-/* This loop is a little complicated because we merge the read requests for efficiency, but we 
- * have to then go back through the data one unmerged block at a time. */
-for (block = blockList; block != NULL; )
-    {
-    /* Find contigious blocks and read them into mergedBuf. */
-    fileOffsetSizeFindGap(block, &beforeGap, &afterGap);
-    bits64 mergedOffset = block->offset;
-    bits64 mergedSize = beforeGap->offset + beforeGap->size - mergedOffset;
-    udcSeek(udc, mergedOffset);
-    char *mergedBuf = needLargeMem(mergedSize);
-    udcMustRead(udc, mergedBuf, mergedSize);
-    char *blockBuf = mergedBuf;
-
-    /* Loop through individual blocks within merged section. */
-    for (;block != afterGap; block = block->next)
-        {
-	/* Uncompress if necessary. */
-	char *blockPt, *blockEnd;
-	if (uncompressBuf)
-	    {
-	    blockPt = uncompressBuf;
-	    int uncSize = zUncompress(blockBuf, block->size, uncompressBuf, bwf->uncompressBufSize);
-	    blockEnd = blockPt + uncSize;
-	    }
-	else
-	    {
-	    blockPt = blockBuf;
-	    blockEnd = blockPt + block->size;
-	    }
-
-	/* Do the actual dump. */
-	int oneCount = bigWigBlockDumpIntersectingRange(bwf->isSwapped, blockPt, blockEnd, 
-		chrom, start, end, maxCount, out);
-
-	/* Keep track of how many dumped, not exceeding maximum. */
-	printCount += oneCount;
-	if (maxCount != 0)
-	    {
-	    if (oneCount >= maxCount)
-		{
-		block = NULL;	 // we want to drop out of the outer loop too
-		break;
-		}
-
-	    maxCount -= oneCount;
-	    }
-	blockBuf += block->size;
-	}
-    freeMem(mergedBuf);
-    }
-freeMem(uncompressBuf);
-
-slFreeList(&blockList);
-return printCount;
-}
-
-boolean bigWigSummaryArray(struct bbiFile *bwf, char *chrom, bits32 start, bits32 end,
-	enum bbiSummaryType summaryType, int summarySize, double *summaryValues)
-/* Fill in summaryValues with  data from indicated chromosome range in bigWig file.
- * Be sure to initialize summaryValues to a default value, which will not be touched
- * for regions without data in file.  (Generally you want the default value to either
- * be 0.0 or nan("") depending on the application.)  Returns FALSE if no data
- * at that position. */
-{
-boolean ret = bbiSummaryArray(bwf, chrom, start, end, bigWigIntervalQuery,
-	summaryType, summarySize, summaryValues);
-return ret;
-}
-
-boolean bigWigSummaryArrayExtended(struct bbiFile *bwf, char *chrom, bits32 start, bits32 end,
-	int summarySize, struct bbiSummaryElement *summary)
-/* Get extended summary information for summarySize evenely spaced elements into
- * the summary array. */
-{
-boolean ret = bbiSummaryArrayExtended(bwf, chrom, start, end, bigWigIntervalQuery,
-	summarySize, summary);
-return ret;
-}
-
-double bigWigSingleSummary(struct bbiFile *bwf, char *chrom, int start, int end,
-    enum bbiSummaryType summaryType, double defaultVal)
-/* Return the summarized single value for a range. */
-{
-double arrayOfOne = defaultVal;
-bigWigSummaryArray(bwf, chrom, start, end, summaryType, 1, &arrayOfOne);
-return arrayOfOne;
-}
-
-boolean isBigWig(char *fileName)
-/* Peak at a file to see if it's bigWig */
-{
-FILE *f = mustOpen(fileName, "rb");
-bits32 sig;
-mustReadOne(f, sig);
-fclose(f);
-if (sig == bigWigSig)
-    return TRUE;
-sig = byteSwap32(sig);
-return sig == bigWigSig;
-}
-
diff --git a/gbtools/src/blatSrc/lib/bwgValsOnChrom.c b/gbtools/src/blatSrc/lib/bwgValsOnChrom.c
deleted file mode 100644
index bab80b6..0000000
--- a/gbtools/src/blatSrc/lib/bwgValsOnChrom.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/* bwgValsOnChrom - implements the bigWigValsOnChrom access to bigWig. */
-
-/* Copyright (C) 2012 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "bits.h"
-#include "sig.h"
-#include "udc.h"
-#include "zlibFace.h"
-#include "bbiFile.h"
-#include "bwgInternal.h"
-#include "bigWig.h"
-
-struct bigWigValsOnChrom *bigWigValsOnChromNew()
-/* Allocate new empty bigWigValsOnChromStructure. */
-{
-return needMem(sizeof(struct bigWigValsOnChrom));
-}
-
-void bigWigValsOnChromFree(struct bigWigValsOnChrom **pChromVals)
-/* Free up bigWigValsOnChrom */
-{
-struct bigWigValsOnChrom *chromVals = *pChromVals;
-if (chromVals != NULL)
-    {
-    freeMem(chromVals->chrom);
-    freeMem(chromVals->valBuf);
-    freeMem(chromVals->covBuf);
-    freez(pChromVals);
-    }
-}
-
-static void fetchIntoBuf(struct bbiFile *bwf, char *chrom, bits32 start, bits32 end,
-	struct bigWigValsOnChrom *chromVals)
-/* Get data for interval.  Return list allocated out of lm. */
-{
-/* A lot of code duplicated with bigWigIntervalQuery, but here the clipping
- * is simplified since always working across full chromosome, and the output is
- * different.  Since both of these are in inner loops and speed critical, it's hard
- * to factor out without perhaps making it worse than the bit of duplication. */
-if (bwf->typeSig != bigWigSig)
-   errAbort("Trying to do fetchIntoBuf on a non big-wig file.");
-bbiAttachUnzoomedCir(bwf);
-struct fileOffsetSize *blockList = bbiOverlappingBlocks(bwf, bwf->unzoomedCir, 
-	chrom, start, end, NULL);
-struct fileOffsetSize *block, *beforeGap, *afterGap;
-struct udcFile *udc = bwf->udc;
-boolean isSwapped = bwf->isSwapped;
-float val;
-int i;
-Bits *covBuf = chromVals->covBuf;
-double *valBuf = chromVals->valBuf;
-
-/* Set up for uncompression optionally. */
-char *uncompressBuf = NULL;
-if (bwf->uncompressBufSize > 0)
-    uncompressBuf = needLargeMem(bwf->uncompressBufSize);
-
-/* This loop is a little complicated because we merge the read requests for efficiency, but we 
- * have to then go back through the data one unmerged block at a time. */
-for (block = blockList; block != NULL; )
-    {
-    /* Find contigious blocks and read them into mergedBuf. */
-    fileOffsetSizeFindGap(block, &beforeGap, &afterGap);
-    bits64 mergedOffset = block->offset;
-    bits64 mergedSize = beforeGap->offset + beforeGap->size - mergedOffset;
-    udcSeek(udc, mergedOffset);
-    char *mergedBuf = needLargeMem(mergedSize);
-    udcMustRead(udc, mergedBuf, mergedSize);
-    char *blockBuf = mergedBuf;
-
-    /* Loop through individual blocks within merged section. */
-    for (;block != afterGap; block = block->next)
-        {
-	/* Uncompress if necessary. */
-	char *blockPt, *blockEnd;
-	if (uncompressBuf)
-	    {
-	    blockPt = uncompressBuf;
-	    int uncSize = zUncompress(blockBuf, block->size, uncompressBuf, bwf->uncompressBufSize);
-	    blockEnd = blockPt + uncSize;
-	    }
-	else
-	    {
-	    blockPt = blockBuf;
-	    blockEnd = blockPt + block->size;
-	    }
-
-	/* Deal with insides of block. */
-	struct bwgSectionHead head;
-	bwgSectionHeadFromMem(&blockPt, &head, isSwapped);
-	switch (head.type)
-	    {
-	    case bwgTypeBedGraph:
-		{
-		for (i=0; i<head.itemCount; ++i)
-		    {
-		    bits32 s = memReadBits32(&blockPt, isSwapped);
-		    bits32 e = memReadBits32(&blockPt, isSwapped);
-		    bitSetRange(covBuf, s, e-s);
-		    val = memReadFloat(&blockPt, isSwapped);
-		    bits32 j;
-		    for (j=s; j<e; ++j)
-		        valBuf[j] = val;
-		    }
-		break;
-		}
-	    case bwgTypeVariableStep:
-		{
-		for (i=0; i<head.itemCount; ++i)
-		    {
-		    bits32 s = memReadBits32(&blockPt, isSwapped);
-		    val = memReadFloat(&blockPt, isSwapped);
-		    bitSetRange(covBuf, s, head.itemSpan);
-		    bits32 e = s + head.itemSpan;
-		    bits32 j;
-		    for (j=s; j<e; ++j)
-		        valBuf[j] = val;
-		    }
-		break;
-		}
-	    case bwgTypeFixedStep:
-		{
-		/* Do a little optimization for the most common and worst case - step1/span1 */
-		if (head.itemStep == 1 && head.itemSpan == 1)
-		    {
-		    bits32 s = head.start;
-		    bits32 e = head.end;
-		    bitSetRange(covBuf, s, e-s);
-		    bits32 j;
-		    for (j=s; j<e; ++j)
-		        valBuf[j] = memReadFloat(&blockPt, isSwapped);
-		    }
-		else
-		    {
-		    bits32 s = head.start;
-		    bits32 e = s + head.itemSpan;
-		    for (i=0; i<head.itemCount; ++i)
-			{
-			bitSetRange(covBuf, s, head.itemSpan);
-			val = memReadFloat(&blockPt, isSwapped);
-			bits32 j;
-			for (j=s; j<e; ++j)
-			    valBuf[j] = val;
-			s += head.itemStep;
-			e += head.itemStep;
-			}
-		    }
-		break;
-		}
-	    default:
-		internalErr();
-		break;
-	    }
-	assert(blockPt == blockEnd);
-	blockBuf += block->size;
-	}
-    freeMem(mergedBuf);
-    }
-freeMem(uncompressBuf);
-slFreeList(&blockList);
-}
-
-
-boolean bigWigValsOnChromFetchData(struct bigWigValsOnChrom *chromVals, char *chrom, 
-	struct bbiFile *bigWig)
-/* Fetch data for chromosome from bigWig. Returns FALSE if not data on that chrom. */
-{
-/* Fetch chromosome and size into self. */
-freeMem(chromVals->chrom);
-chromVals->chrom = cloneString(chrom);
-long chromSize = chromVals->chromSize = bbiChromSize(bigWig, chrom);
-
-if (chromSize <= 0)
-    return FALSE;
-
-/* Make sure buffers are big enough. */
-if (chromSize > chromVals->bufSize)
-    {
-    freeMem(chromVals->valBuf);
-    freeMem(chromVals->covBuf);
-    chromVals->valBuf = needHugeMem((sizeof(double))*chromSize);
-    chromVals->covBuf = bitAlloc(chromSize);
-    chromVals->bufSize = chromSize;
-    }
-
-/* Zero out buffers */
-bitClear(chromVals->covBuf, chromSize);
-double *valBuf = chromVals->valBuf;
-int i;
-for (i=0; i<chromSize; ++i)
-    valBuf[i] = 0.0;
-
-fetchIntoBuf(bigWig, chrom, 0, chromSize, chromVals);
-
-#ifdef OLD
-/* Fetch intervals for this chromosome and fold into buffers. */
-struct lm *lm = lmInit(0);
-struct bbiInterval *iv, *ivList = bigWigIntervalQuery(bigWig, chrom, 0, chromSize, lm);
-for (iv = ivList; iv != NULL; iv = iv->next)
-    {
-    double val = iv->val;
-    int end = iv->end;
-    for (i=iv->start; i<end; ++i)
-	valBuf[i] = val;
-    bitSetRange(chromVals->covBuf, iv->start, iv->end - iv->start);
-    }
-lmCleanup(&lm);
-#endif /* OLD */
-return TRUE;
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/cda.c b/gbtools/src/blatSrc/lib/cda.c
deleted file mode 100644
index 88a0a82..0000000
--- a/gbtools/src/blatSrc/lib/cda.c
+++ /dev/null
@@ -1,477 +0,0 @@
-/* cda.c - cDNA Alignment structure.  This stores all the info except
- * the bases themselves on an cDNA alignment. 
- * 
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "memgfx.h"
-#include "sig.h"
-#include "fuzzyFind.h"
-#include "cda.h"
-
-
-char *cdaLoadString(FILE *f)
-/* Load in a string from CDA file. */
-{
-UBYTE size;
-char *s;
-if (!readOne(f, size))
-    return NULL;
-s = needMem(size+1);
-mustRead(f, s, size);
-return s;
-}
-
-static void cdaWriteString(FILE *f, char *s)
-/* Write string out to CDA file. */
-{
-int size;
-UBYTE usize;
-if (s == NULL)
-    s = "";
-size = strlen(s);
-usize = (UBYTE)size;
-assert(size < 256);
-writeOne(f, usize);
-mustWrite(f, s, size);
-}
-
-void cdaReadBlock(FILE *f, struct cdaBlock *block)
-/* Read one block from cda file. */
-{
-mustReadOne(f, block->nStart);
-mustReadOne(f, block->nEnd);
-mustReadOne(f, block->hStart);
-block->hEnd = block->hStart + (block->nEnd - block->nStart);
-mustReadOne(f, block->startGood);
-mustReadOne(f, block->endGood);
-mustReadOne(f, block->midScore);
-}
-
-static void cdaWriteBlock(FILE *f, struct cdaBlock *block)
-/* Write one block to cda file. */
-{
-writeOne(f, block->nStart);
-writeOne(f, block->nEnd);
-writeOne(f, block->hStart);
-writeOne(f, block->startGood);
-writeOne(f, block->endGood);
-writeOne(f, block->midScore);
-}
-
-void cdaFixChromStartEnd(struct cdaAli *cda)
-/* Loop through blocks and figure out and fill in chromStart
- * and chromEnd. */
-{
-int start = 0x7fffffff;
-int end = -start;
-int count = cda->blockCount;
-struct cdaBlock *block = cda->blocks;
-
-while (--count >= 0)
-    {
-    if (start > block->hStart)
-        start = block->hStart;
-    if (end < block->hEnd)
-        end = block->hEnd;
-    ++block;
-    }
-cda->chromStart = start;
-cda->chromEnd = end;
-}
-
-FILE *cdaOpenVerify(char *fileName)
-/* Call this to open file and verify signature, then call cdaLoadOne
- * which returns NULL at EOF. */
-{
-FILE *aliFile;
-bits32 sig;
-
-aliFile = mustOpen(fileName, "rb");
-mustReadOne(aliFile, sig);
-if (sig != aliSig)
-    errAbort("Bad signature %x on %s", sig, fileName);
-return aliFile;
-}
-
-static FILE *cdaCreate(char *fileName)
-/* Open file to write and put out signature. */
-{
-bits32 sig = aliSig;
-FILE *f = mustOpen(fileName, "wb");
-writeOne(f, sig);
-return f;
-}
-
-struct cdaAli *cdaLoadOne(FILE *f)
-/* Load one cdaAli from file.  Assumes file pointer is correctly positioned. */
-{
-struct cdaAli *ca;
-struct cdaBlock *blocks;
-int count;
-int i;
-char *name;
-UBYTE chromIx;
-
-if ((name = cdaLoadString(f)) == NULL)
-    return NULL;
-AllocVar(ca);
-ca->name = name;
-mustReadOne(f, ca->isEmbryonic);
-mustReadOne(f, ca->baseCount);
-mustReadOne(f, ca->milliScore);
-mustReadOne(f, chromIx);
-ca->chromIx = chromIx;
-mustReadOne(f, ca->strand);
-mustReadOne(f, ca->direction);
-mustReadOne(f, ca->blockCount);
-count = ca->blockCount;
-ca->blocks = blocks = needMem(count * sizeof(blocks[0]));
-for (i=0; i<count; ++i)
-    cdaReadBlock(f, &blocks[i]);
-cdaFixChromStartEnd(ca);
-return ca;
-}
-
-static void cdaWriteOne(FILE *f, struct cdaAli *ca)
-/* Write one cdaAli to file. */
-{
-int count;
-int i;
-struct cdaBlock *blocks;
-UBYTE chromIx;
-
-cdaWriteString(f, ca->name);
-writeOne(f, ca->isEmbryonic);
-writeOne(f, ca->baseCount);
-writeOne(f, ca->milliScore);
-if (ca->chromIx > 255)
-    errAbort("chromIx too big in cdaWriteOne.");
-chromIx = (UBYTE)ca->chromIx;
-writeOne(f, chromIx);
-writeOne(f, ca->strand);
-writeOne(f, ca->direction);
-writeOne(f, ca->blockCount);
-count = ca->blockCount;
-blocks = ca->blocks;
-for (i=0; i<count; ++i)
-    cdaWriteBlock(f, &blocks[i]);
-}
-
-void cdaWrite(char *fileName, struct cdaAli *cdaList)
-/* Write out a cdaList to a cda file. */
-{
-FILE *f = cdaCreate(fileName);
-struct cdaAli *ca;
-for (ca = cdaList; ca != NULL; ca = ca->next)
-    cdaWriteOne(f, ca);
-fclose(f);
-}
-
-boolean cdaCloneIsReverse(struct cdaAli *cda)
-/* Returns TRUE if clone (.3/.5 pair) aligns on reverse strand. */
-{
-boolean isReverse = (cda->direction == '-');
-if (cda->strand == '-')
-    isReverse = !isReverse;
-return isReverse;
-}
-
-char cdaCloneStrand(struct cdaAli *cda)
-/* Return '+' or '-' depending on the strand that clone (.3/.5 pair) aligns on. */
-{
-return cdaCloneIsReverse(cda) ? '-' : '+';
-}
-
-char cdaDirChar(struct cdaAli *cda, char chromStrand)
-/* Return '>' or '<' or ' ' depending whether cDNA is going same, opposite, or
- * unknown alignment as the chromosome strand. */
-{
-boolean isReverse = cdaCloneIsReverse(cda);
-if (chromStrand == '-')
-    isReverse = !isReverse;
-return (isReverse ? '<' : '>');    
-}
-
-void cdaRcOne(struct cdaAli *cda, int dnaStart, int baseCount)
-/* Reverse complement one cda. DnaStart is typically display window start. */
-{
-struct cdaBlock *block, *endBlock;
-
-for (block = cda->blocks, endBlock = block+cda->blockCount; block < endBlock; ++block)
-    {
-    int temp;
-    UBYTE uc;
-    temp = reverseOffset(block->hStart-dnaStart, baseCount) + dnaStart + 1;
-    block->hStart = reverseOffset(block->hEnd-dnaStart, baseCount) + dnaStart + 1;
-    block->hEnd = temp;
-    temp = reverseOffset(block->nStart, cda->baseCount);
-    block->nStart = reverseOffset(block->nEnd, cda->baseCount);
-    block->nEnd = temp;
-    uc = block->startGood;
-    block->startGood = block->endGood;
-    block->endGood = uc;
-    }
-block = cda->blocks;
-endBlock -= 1;
-for (;block < endBlock; ++block, --endBlock)
-    {
-    struct cdaBlock temp;
-    temp = *block;
-    *block = *endBlock;
-    *endBlock = temp;
-    }
-}
-
-void cdaRcList(struct cdaAli *cdaList, int dnaStart, int baseCount)
-/* Reverse complement cda list. */
-{
-struct cdaAli *cda;
-for (cda = cdaList; cda != NULL; cda = cda->next)
-    cdaRcOne(cda, dnaStart, baseCount);
-}
-
-
-void cdaFreeAli(struct cdaAli *ca)
-/* Free a single cdaAli. */
-{
-freeMem(ca->blocks);
-freeMem(ca->name);
-freeMem(ca);
-}
-
-void cdaFreeAliList(struct cdaAli **pList)
-/* Free list of cdaAli. */
-{
-struct cdaAli *ca, *next;
-next = *pList;
-while ((ca = next) != NULL)
-    {
-    next = ca->next;
-    cdaFreeAli(ca);
-    }
-*pList = NULL;
-}
-
-
-static void cdaCoalesceOne(struct cdaAli *ca, boolean updateScore)
-/* Coalesce blocks separated by small amounts of noise. */
-{
-struct cdaBlock *left = ca->blocks;
-struct cdaBlock *block = left+1;
-struct cdaBlock *writeBlock = block;
-int readCount = ca->blockCount;
-int i;
-
-/* Implicitly have read and written first one. */
-for (i=1; i<readCount; ++i)
-    {
-    int hGap = intAbs(block->hStart - left->hEnd);
-    int nGap = intAbs(block->nStart - left->nEnd);
-    if (hGap > 2 || nGap > 2)
-        {
-        left = writeBlock;
-        *writeBlock++ = *block;
-        }
-    else
-        {
-        int leftMatch, blockMatch;
-        int totalMatch;
-
-        /* Update score. */
-        if (updateScore)
-            {
-            leftMatch = roundingScale(left->midScore, left->nEnd-left->nStart, 255);
-            blockMatch = roundingScale(block->midScore, block->nEnd-block->nStart, 255);
-            totalMatch = leftMatch + blockMatch - nGap - hGap;
-            left->midScore = roundingScale(totalMatch, 255, block->nEnd-left->nStart);
-            }
-
-        /* Update ends. */
-        left->hEnd = block->hEnd;
-        left->nEnd = block->nEnd;
-        left->endGood = block->endGood;  
-        }
-    ++block;
-    }
-ca->blockCount = writeBlock - ca->blocks;
-}
-
-void cdaCoalesceAll(struct cdaAli *ca, boolean updateScore)
-/* Coalesce blocks separated by small amounts of noise. */
-{
-for (;ca != NULL; ca = ca->next)
-    cdaCoalesceOne(ca, updateScore);
-}
-
-void cdaCoalesceBlocks(struct cdaAli *ca)
-/* Coalesce blocks separated by small amounts of noise. */
-{
-cdaCoalesceAll(ca, TRUE);
-}
-
-void cdaCoalesceFast(struct cdaAli *ca)
-/* Coalesce blocks as above, but don't update the score. */
-{
-cdaCoalesceAll(ca, FALSE);
-}
-
-
-void cdaShowAlignmentTrack(struct memGfx *mg, 
-    int xOff, int yOff, int width, int height,  Color goodColor, Color badColor,
-    int dnaSize, int dnaOffset, struct cdaAli *cda, char repeatChar)
-/* Draw alignment on a horizontal track of picture. */
-{
-struct cdaBlock *block = cda->blocks;
-int count = cda->blockCount;
-int blockIx;
-int scaledHeight = roundingScale(height, dnaSize, width);
-MgFont *font = NULL;
-int repeatCharWidth = 0;
-
-if (repeatChar)
-    {
-    font = mgSmallFont();
-    repeatCharWidth = mgFontCharWidth(font, repeatChar);
-    }
-
-for (blockIx = 0; blockIx < count; ++blockIx)
-    {
-    int x[4];
-    int b[4];
-    Color c[3];
-    int quarterWid;
-    int i;
-    int w;
-
-    b[0] = block->hStart;
-    b[3] = block->hEnd;
-    quarterWid = (b[3]-b[0]+2)>>2;
-    if (quarterWid > scaledHeight)
-        quarterWid = scaledHeight;
-    b[1] = b[0] + quarterWid;
-    b[2] = b[3] - quarterWid;
-
-    c[0] = ((block->startGood >= 4 && (blockIx == 0 || block[-1].nEnd == block[0].nStart)) 
-        ? goodColor : badColor);
-    c[1] = ((block->midScore > 229) ? goodColor : badColor);
-    c[2] = ((block->endGood >= 4 && (blockIx == count-1 || block[0].nEnd == block[1].nStart))
-        ? goodColor : badColor);
-
-    for (i=0; i<4; ++i)
-        x[i] = roundingScale(b[i]-dnaOffset, width, dnaSize) + xOff;
-    for (i=0; i<3; ++i)
-        {
-        if ((w = x[i+1] - x[i]) > 0)
-            mgDrawBox(mg, x[i], yOff, w, height, c[i]);
-        }
-    
-    if (repeatChar)
-        {
-        char buf[256];
-        int charCount;
-        w = x[3] - x[0];
-        charCount = w/repeatCharWidth;
-        if (charCount >= sizeof(buf))
-            charCount = sizeof(buf)-1;
-        memset(buf, repeatChar, charCount);
-        buf[charCount] = 0;
-        mgTextCentered(mg, x[0], yOff, w, height, MG_WHITE, font, buf);
-        }
-    ++block;
-    }
-}
-
-
-static UBYTE leftGood(struct ffAli *ali)
-{
-DNA *n = ali->nStart;
-DNA *h = ali->hStart;
-int size = ali->nEnd - ali->nStart;
-int matchSize = 0;
-
-while (--size >= 0)
-    {
-    if (*n++ != *h++)
-        break;
-    ++matchSize;
-    }
-if (matchSize > 255)
-    matchSize = 255;
-return (UBYTE)matchSize;
-}
-
-static UBYTE rightGood(struct ffAli *ali)
-{
-DNA *n = ali->nEnd;
-DNA *h = ali->hEnd;
-int size = ali->nEnd - ali->nStart;
-int matchSize = 0;
-
-while (--size >= 0)
-    {
-    if (*--n != *--h)
-        break;
-    ++matchSize;
-    }
-if (matchSize > 255)
-    matchSize = 255;
-return (UBYTE)matchSize;
-}
-
-
-static int countAlis(struct ffAli *ali)
-{
-int count = 0;
-while (ali != NULL)
-    {
-    ++count;
-    ali = ali->right;
-    }
-return count;
-}
-
-struct cdaAli *cdaAliFromFfAli(struct ffAli *aliList, 
-    DNA *needle, int needleSize, DNA *hay, int haySize, boolean isRc)
-/* Convert from ffAli to cdaAli format. */
-{
-int count = countAlis(aliList);
-struct cdaAli *cda;
-struct cdaBlock *blocks;
-struct ffAli *fa;
-int score;
-int bases;
-
-if (isRc)
-    reverseComplement(needle, needleSize);
-AllocVar(cda);
-cda->baseCount = needleSize;
-cda->strand = (isRc ? '-' : '+');
-cda->direction = '+';   /* Actually we don't know. */
-cda->orientation = (isRc ? -1 : 1);
-cda->blockCount = count;
-cda->blocks = blocks = needMem(count * sizeof(blocks[0]));
-
-for (fa = aliList; fa != NULL; fa = fa->right)
-    {
-    blocks->nStart = fa->nStart - needle;
-    blocks->nEnd = fa->nEnd - needle;
-    blocks->hStart = fa->hStart - hay;
-    blocks->hEnd  = fa->hEnd - hay;
-    blocks->startGood = leftGood(fa);
-    blocks->endGood = rightGood(fa);
-    bases = fa->nEnd - fa->nStart;
-    score = dnaScoreMatch(fa->nStart, fa->hStart, bases);
-    blocks->midScore = roundingScale(255, score, bases);
-    ++blocks;
-    }
-cdaFixChromStartEnd(cda);
-if (isRc)
-    {
-    reverseComplement(needle, needleSize);
-    }
-return cda;
-}
-
diff --git a/gbtools/src/blatSrc/lib/chain.c b/gbtools/src/blatSrc/lib/chain.c
deleted file mode 100644
index 66d5a48..0000000
--- a/gbtools/src/blatSrc/lib/chain.c
+++ /dev/null
@@ -1,647 +0,0 @@
-/* chain - pairwise alignments that can include gaps in both
- * sequences at once.  This is similar in many ways to psl,
- * but more suitable to cross species genomic comparisons. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "dnaseq.h"
-#include "dnautil.h"
-#include "chain.h"
-
-
-void chainFree(struct chain **pChain)
-/* Free up a chain. */
-{
-struct chain *chain = *pChain;
-if (chain != NULL)
-    {
-    slFreeList(&chain->blockList);
-    freeMem(chain->qName);
-    freeMem(chain->tName);
-    freez(pChain);
-    }
-}
-
-void chainFreeList(struct chain **pList)
-/* Free a list of dynamically allocated chain's */
-{
-struct chain *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    chainFree(&el);
-    }
-*pList = NULL;
-}
-
-int cBlockCmpQuery(const void *va, const void *vb)
-/* Compare to sort based on query start. */
-{
-const struct cBlock *a = *((struct cBlock **)va);
-const struct cBlock *b = *((struct cBlock **)vb);
-return a->qStart - b->qStart;
-}
-
-int cBlockCmpTarget(const void *va, const void *vb)
-/* Compare to sort based on target start. */
-{
-const struct cBlock *a = *((struct cBlock **)va);
-const struct cBlock *b = *((struct cBlock **)vb);
-return a->tStart - b->tStart;
-}
-
-int cBlockCmpBoth(const void *va, const void *vb)
-/* Compare to sort based on query, then target. */
-{
-const struct cBlock *a = *((struct cBlock **)va);
-const struct cBlock *b = *((struct cBlock **)vb);
-int dif;
-dif = a->qStart - b->qStart;
-if (dif == 0)
-    dif = a->tStart - b->tStart;
-return dif;
-}
-
-int cBlockCmpDiagQuery(const void *va, const void *vb)
-/* Compare to sort based on diagonal, then query. */
-{
-const struct cBlock *a = *((struct cBlock **)va);
-const struct cBlock *b = *((struct cBlock **)vb);
-int dif;
-dif = (a->tStart - a->qStart) - (b->tStart - b->qStart);
-if (dif == 0)
-    dif = a->qStart - b->qStart;
-return dif;
-}
-
-void cBlocksAddOffset(struct cBlock *blockList, int qOff, int tOff)
-/* Add offsets to block list. */
-{
-struct cBlock *block;
-for (block = blockList; block != NULL; block = block->next)
-    {
-    block->tStart += tOff;
-    block->tEnd += tOff;
-    block->qStart += qOff;
-    block->qEnd += qOff;
-    }
-}
-
-struct cBlock *cBlocksFromAliSym(int symCount, char *qSym, char *tSym, 
-        int qPos, int tPos)
-/* Convert alignment from alignment symbol (bases and dashes) format 
- * to a list of chain blocks.  The qPos and tPos correspond to the start
- * in the query and target sequences of the first letter in  qSym and tSym. */
-{
-struct cBlock *blockList = NULL, *block = NULL;
-int i;
-for (i=0; i<symCount; ++i)
-    {
-    if (qSym[i] == '-')
-        {
-        block = NULL;
-        ++tPos;
-        }
-    else if (tSym[i] == '-')
-        {
-        block = NULL;
-        ++qPos;
-        }
-    else
-        {
-        if (block == NULL)
-            {
-            AllocVar(block);
-            slAddHead(&blockList, block);
-            block->qStart = qPos;
-            block->tStart = tPos;
-            }
-        block->qEnd = ++qPos;
-        block->tEnd = ++tPos;
-        }
-    }
-slReverse(&blockList);
-return blockList;
-}
-        
-
-int chainCmpScore(const void *va, const void *vb)
-/* Compare to sort based on total score. */
-{
-const struct chain *a = *((struct chain **)va);
-const struct chain *b = *((struct chain **)vb);
-double diff = b->score - a->score;
-if (diff < 0.0) return -1;
-else if (diff > 0.0) return 1;
-else return 0;
-}
-
-int chainCmpScoreDesc(const void *va, const void *vb)
-/* Compare to sort based on total score descending. */
-{
-const struct chain *a = *((struct chain **)va);
-const struct chain *b = *((struct chain **)vb);
-double diff = a->score - b->score;
-if (diff < 0.0) return -1;
-else if (diff > 0.0) return 1;
-else return 0;
-}
-
-int chainCmpTarget(const void *va, const void *vb)
-/* Compare to sort based on target position. */
-{
-const struct chain *a = *((struct chain **)va);
-const struct chain *b = *((struct chain **)vb);
-int dif = strcmp(a->tName, b->tName);
-if (dif == 0)
-    dif = a->tStart - b->tStart;
-return dif;
-}
-
-#define FACTOR 300000000
-
-int chainCmpQuery(const void *va, const void *vb)
-/* Compare to sort based on query chrom and target position. */
-{
-const struct chain *a = *((struct chain **)va);
-const struct chain *b = *((struct chain **)vb);
-int dif;                                                                        
-
-dif = strcmp(a->qName, b->qName);                                               
-if (dif == 0)                                                                   
-    dif = a->qStart - b->qStart;                                                
-return dif;                       
-}
-
-static int nextId = 1;
-
-void chainIdSet(int id)
-/* Set next chain id. */
-{
-nextId = id;
-}
-
-void chainIdReset()
-/* Reset chain id. */
-{
-chainIdSet(1);
-}
-
-void chainIdNext(struct chain *chain)
-/* Add an id to a chain if it doesn't have one already */
-{
-chain->id = nextId++;
-}
-
-void chainWriteHead(struct chain *chain, FILE *f)
-/* Write chain before block/insert list. */
-{
-if (chain->id == 0)
-    chainIdNext(chain);
-fprintf(f, "chain %1.0f %s %d + %d %d %s %d %c %d %d %d\n", chain->score,
-    chain->tName, chain->tSize, chain->tStart, chain->tEnd,
-    chain->qName, chain->qSize, chain->qStrand, chain->qStart, chain->qEnd,
-    chain->id);
-}
-
-void chainWrite(struct chain *chain, FILE *f)
-/* Write out chain to file in usual format*/
-{
-struct cBlock *b, *nextB;
-
-chainWriteHead(chain, f);
-for (b = chain->blockList; b != NULL; b = nextB)
-    {
-    nextB = b->next;
-    fprintf(f, "%d", b->qEnd - b->qStart);
-    if (nextB != NULL)
-	fprintf(f, "\t%d\t%d", 
-		nextB->tStart - b->tEnd, nextB->qStart - b->qEnd);
-    fputc('\n', f);
-    }
-fputc('\n', f);
-}
-
-void chainWriteAll(struct chain *chainList, FILE *f)
-/* Write all chains to file. */
-{
-struct chain *chain;
-for (chain = chainList; chain != NULL; chain = chain->next)
-    chainWrite(chain, f);
-}
-
-void chainWriteLong(struct chain *chain, FILE *f)
-/* Write out chain to file in longer format*/
-{
-struct cBlock *b, *nextB;
-
-chainWriteHead(chain, f);
-for (b = chain->blockList; b != NULL; b = nextB)
-    {
-    nextB = b->next;
-    fprintf(f, "%d\t%d\t", b->tStart, b->qStart);
-    fprintf(f, "%d", b->qEnd - b->qStart);
-    if (nextB != NULL)
-	fprintf(f, "\t%d\t%d", 
-		nextB->tStart - b->tEnd, nextB->qStart - b->qEnd);
-    fputc('\n', f);
-    }
-fputc('\n', f);
-}
-
-struct chain *chainReadChainLine(struct lineFile *lf)
-/* Read line that starts with chain.  Allocate memory
- * and fill in values.  However don't read link lines. */
-{
-char *row[13];
-int wordCount;
-struct chain *chain;
-
-wordCount = lineFileChop(lf, row);
-if (wordCount == 0)
-    return NULL;
-if (wordCount < 12)
-    errAbort("Expecting at least 12 words line %d of %s", 
-    	lf->lineIx, lf->fileName);
-if (!sameString(row[0], "chain"))
-    errAbort("Expecting 'chain' line %d of %s", lf->lineIx, lf->fileName);
-AllocVar(chain);
-chain->score = atof(row[1]);
-chain->tName = cloneString(row[2]);
-chain->tSize = lineFileNeedNum(lf, row, 3);
-if (wordCount >= 13)
-    chain->id = lineFileNeedNum(lf, row, 12);
-else
-    chainIdNext(chain);
-
-/* skip tStrand for now, always implicitly + */
-chain->tStart = lineFileNeedNum(lf, row, 5);
-chain->tEnd = lineFileNeedNum(lf, row, 6);
-chain->qName = cloneString(row[7]);
-chain->qSize = lineFileNeedNum(lf, row, 8);
-chain->qStrand = row[9][0];
-chain->qStart = lineFileNeedNum(lf, row, 10);
-chain->qEnd = lineFileNeedNum(lf, row, 11);
-if (chain->qStart >= chain->qEnd || chain->tStart >= chain->tEnd)
-    errAbort("End before start line %d of %s", lf->lineIx, lf->fileName);
-if (chain->qStart < 0 || chain->tStart < 0)
-    errAbort("Start before zero line %d of %s", lf->lineIx, lf->fileName);
-if (chain->qEnd > chain->qSize || chain->tEnd > chain->tSize)
-    errAbort("Past end of sequence line %d of %s", lf->lineIx, lf->fileName);
-return chain;
-}
-
-void chainReadBlocks(struct lineFile *lf, struct chain *chain)
-/* Read in chain blocks from file. */
-{
-char *row[3];
-int q,t;
-
-/* Now read in block list. */
-q = chain->qStart;
-t = chain->tStart;
-for (;;)
-    {
-    int wordCount = lineFileChop(lf, row);
-    int size = lineFileNeedNum(lf, row, 0);
-    struct cBlock *b;
-    AllocVar(b);
-    slAddHead(&chain->blockList, b);
-    b->qStart = q;
-    b->tStart = t;
-    q += size;
-    t += size;
-    b->qEnd = q;
-    b->tEnd = t;
-    if (wordCount == 1)
-        break;
-    else if (wordCount < 3)
-        errAbort("Expecting 1 or 3 words line %d of %s\n", 
-		lf->lineIx, lf->fileName);
-    t += lineFileNeedNum(lf, row, 1);
-    q += lineFileNeedNum(lf, row, 2);
-    }
-if (q != chain->qEnd)
-    errAbort("q end mismatch %d vs %d line %d of %s\n", 
-    	q, chain->qEnd, lf->lineIx, lf->fileName);
-if (t != chain->tEnd)
-    errAbort("t end mismatch %d vs %d line %d of %s\n", 
-    	t, chain->tEnd, lf->lineIx, lf->fileName);
-slReverse(&chain->blockList);
-}
-
-struct chain *chainRead(struct lineFile *lf)
-/* Read next chain from file.  Return NULL at EOF. 
- * Note that chain block scores are not filled in by
- * this. */
-{
-struct chain *chain = chainReadChainLine(lf);
-if (chain != NULL)
-    chainReadBlocks(lf, chain);
-return chain;
-}
-
-void chainSwap(struct chain *chain)
-/* Swap target and query side of chain. */
-{
-struct chain old = *chain;
-struct cBlock *b;
-
-/* Copy basic stuff swapping t and q. */
-chain->qName = old.tName;
-chain->tName = old.qName;
-chain->qStart = old.tStart;
-chain->qEnd = old.tEnd;
-chain->tStart = old.qStart;
-chain->tEnd = old.qEnd;
-chain->qSize = old.tSize;
-chain->tSize = old.qSize;
-
-/* Swap t and q in blocks. */
-for (b = chain->blockList; b != NULL; b = b->next)
-    {
-    struct cBlock old = *b;
-    b->qStart = old.tStart;
-    b->qEnd = old.tEnd;
-    b->tStart = old.qStart;
-    b->tEnd = old.qEnd;
-    }
-
-/* Cope with the minus strand. */
-if (chain->qStrand == '-')
-    {
-    /* chain's are really set up so that the target is on the
-     * + strand and the query is on the minus strand.
-     * Therefore we need to reverse complement both 
-     * strands while swapping to preserve this. */
-    for (b = chain->blockList; b != NULL; b = b->next)
-        {
-	reverseIntRange(&b->tStart, &b->tEnd, chain->tSize);
-	reverseIntRange(&b->qStart, &b->qEnd, chain->qSize);
-	}
-    reverseIntRange(&chain->tStart, &chain->tEnd, chain->tSize);
-    reverseIntRange(&chain->qStart, &chain->qEnd, chain->qSize);
-    slReverse(&chain->blockList);
-    }
-}
-
-struct hash *chainReadUsedSwapLf(char *fileName, boolean swapQ, Bits *bits, struct lineFile *lf)
-/* Read chains that are marked as used in the 
- * bits array (which may be NULL) into a hash keyed by id. */
-{
-char nameBuf[16];
-struct hash *hash = hashNew(18);
-struct chain *chain;
-int usedCount = 0, count = 0;
-
-while ((chain = chainRead(lf)) != NULL)
-    {
-    ++count;
-    if (bits != NULL && !bitReadOne(bits, chain->id))
-	{
-	chainFree(&chain);
-        continue;
-	}
-    safef(nameBuf, sizeof(nameBuf), "%x", chain->id);
-    if (hashLookup(hash, nameBuf))
-        errAbort("Duplicate chain %d ending line %d of %s", 
-		chain->id, lf->lineIx, lf->fileName);
-    if (swapQ)
-        chainSwap(chain);
-    hashAdd(hash, nameBuf, chain);
-    ++usedCount;
-    }
-return hash;
-}
-
-struct hash *chainReadUsedSwap(char *fileName, boolean swapQ, Bits *bits)
-/* Read chains that are marked as used in the 
- * bits array (which may be NULL) into a hash keyed by id. */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct hash *hash = chainReadUsedSwapLf(fileName, swapQ, NULL, lf);
-lineFileClose(&lf);
-return hash;
-}
-
-struct hash *chainReadAllSwap(char *fileName, boolean swapQ)
-/* Read chains into a hash keyed by id. */
-{
-return chainReadUsedSwap(fileName, swapQ, NULL);
-}
-
-struct hash *chainReadAll(char *fileName)
-/* Read chains into a hash keyed by id. */
-{
-return chainReadAllSwap(fileName, FALSE);
-}
-
-struct hash *chainReadAllWithMeta(char *fileName, FILE *f)
-/* Read chains into a hash keyed by id. */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct hash *hash = NULL;
-lineFileSetMetaDataOutput(lf, f);
-hash = chainReadUsedSwapLf(fileName, FALSE, NULL, lf);
-lineFileClose(&lf);
-return hash;
-}
-
-
-struct chain *chainFind(struct hash *hash, int id)
-/* Find chain in hash, return NULL if not found */
-{
-char nameBuf[16];
-safef(nameBuf, sizeof(nameBuf), "%x", id);
-return hashFindVal(hash, nameBuf);
-}
-
-struct chain *chainLookup(struct hash *hash, int id)
-/* Find chain in hash. */
-{
-char nameBuf[16];
-safef(nameBuf, sizeof(nameBuf), "%x", id);
-return hashMustFindVal(hash, nameBuf);
-}
-
-void chainSubsetOnT(struct chain *chain, int subStart, int subEnd, 
-    struct chain **retSubChain,  struct chain **retChainToFree)
-/* Get subchain of chain bounded by subStart-subEnd on 
- * target side.  Return result in *retSubChain.  In some
- * cases this may be the original chain, in which case
- * *retChainToFree is NULL.  When done call chainFree on
- * *retChainToFree.  The score and id fields are not really
- * properly filled in. */
-{
-/* Find first relevant block. */
-struct cBlock *firstBlock;
-for (firstBlock = chain->blockList; firstBlock != NULL; firstBlock = firstBlock->next)
-    {
-    if (firstBlock->tEnd > subStart)
-	break;
-    }
-chainFastSubsetOnT(chain, firstBlock, subStart, subEnd, retSubChain, retChainToFree);
-}
-
-void chainFastSubsetOnT(struct chain *chain, struct cBlock *firstBlock,
-	int subStart, int subEnd, struct chain **retSubChain,  struct chain **retChainToFree)
-/* Get subchain as in chainSubsetOnT. Pass in initial block that may
- * be known from some index to speed things up. */
-{
-struct chain *sub = NULL;
-struct cBlock *oldB, *b, *bList = NULL;
-int qStart = BIGNUM, qEnd = -BIGNUM;
-int tStart = BIGNUM, tEnd = -BIGNUM;
-
-/* Check for easy case. */
-if (subStart <= chain->tStart && subEnd >= chain->tEnd)
-    {
-    *retSubChain = chain;
-    *retChainToFree = NULL;
-    return;
-    }
-/* Build new block list and calculate bounds. */
-for (oldB = firstBlock; oldB != NULL; oldB = oldB->next)
-    {
-    if (oldB->tStart >= subEnd)
-        break;
-    b = CloneVar(oldB);
-    if (b->tStart < subStart)
-        {
-	b->qStart += subStart - b->tStart;
-	b->tStart = subStart;
-	}
-    if (b->tEnd > subEnd)
-        {
-	b->qEnd -= b->tEnd - subEnd;
-	b->tEnd = subEnd;
-	}
-    slAddHead(&bList, b);
-    if (qStart > b->qStart)
-        qStart = b->qStart;
-    if (qEnd < b->qEnd)
-        qEnd = b->qEnd;
-    if (tStart > b->tStart)
-        tStart = b->tStart;
-    if (tEnd < b->tEnd)
-        tEnd = b->tEnd;
-    }
-slReverse(&bList);
-
-/* Make new chain based on old. */
-if (bList != NULL)
-    {
-    double sizeRatio;
-    AllocVar(sub);
-    sub->blockList = bList;
-    sub->qName = cloneString(chain->qName);
-    sub->qSize = chain->qSize;
-    sub->qStrand = chain->qStrand;
-    sub->qStart = qStart;
-    sub->qEnd = qEnd;
-    sub->tName = cloneString(chain->tName);
-    sub->tSize = chain->tSize;
-    sub->tStart = tStart;
-    sub->tEnd = tEnd;
-    sub->id = chain->id;
-
-    /* Fake new score. */
-    sizeRatio = (sub->tEnd - sub->tStart);
-    sizeRatio /= (chain->tEnd - chain->tStart);
-    sub->score = sizeRatio * chain->score;
-    }
-*retSubChain = *retChainToFree = sub;
-}
-
-void chainSubsetOnQ(struct chain *chain, int subStart, int subEnd, 
-    struct chain **retSubChain,  struct chain **retChainToFree)
-/* Get subchain of chain bounded by subStart-subEnd on 
- * query side.  Return result in *retSubChain.  In some
- * cases this may be the original chain, in which case
- * *retChainToFree is NULL.  When done call chainFree on
- * *retChainToFree.  The score and id fields are not really
- * properly filled in. */
-{
-struct chain *sub = NULL;
-struct cBlock *oldB, *b, *bList = NULL;
-int qStart = BIGNUM, qEnd = -BIGNUM;
-int tStart = BIGNUM, tEnd = -BIGNUM;
-
-/* Check for easy case. */
-if (subStart <= chain->qStart && subEnd >= chain->qEnd)
-    {
-    *retSubChain = chain;
-    *retChainToFree = NULL;
-    return;
-    }
-/* Build new block list and calculate bounds. */
-for (oldB = chain->blockList; oldB != NULL; oldB = oldB->next)
-    {
-    if (oldB->qEnd <= subStart)
-        continue;
-    if (oldB->qStart >= subEnd)
-        break;
-    b = CloneVar(oldB);
-    if (b->qStart < subStart)
-        {
-	b->tStart += subStart - b->qStart;
-	b->qStart = subStart;
-	}
-    if (b->qEnd > subEnd)
-        {
-	b->tEnd -= b->qEnd - subEnd;
-	b->qEnd = subEnd;
-	}
-    slAddHead(&bList, b);
-    if (tStart > b->tStart)
-        tStart = b->tStart;
-    if (tEnd < b->tEnd)
-        tEnd = b->tEnd;
-    if (qStart > b->qStart)
-        qStart = b->qStart;
-    if (qEnd < b->qEnd)
-        qEnd = b->qEnd;
-    }
-slReverse(&bList);
-
-/* Make new chain based on old. */
-if (bList != NULL)
-    {
-    AllocVar(sub);
-    sub->blockList = bList;
-    sub->qName = cloneString(chain->qName);
-    sub->qSize = chain->qSize;
-    sub->qStrand = chain->qStrand;
-    sub->qStart = qStart;
-    sub->qEnd = qEnd;
-    sub->tName = cloneString(chain->tName);
-    sub->tSize = chain->tSize;
-    sub->tStart = tStart;
-    sub->tEnd = tEnd;
-    sub->id = chain->id;
-    }
-*retSubChain = *retChainToFree = sub;
-}
-
-void chainRangeQPlusStrand(struct chain *chain, int *retQs, int *retQe)
-/* Return range of bases covered by chain on q side on the plus
- * strand. */
-{
-if (chain == NULL)
-    errAbort("chain::chainRangeQPlusStrand() - Can't find range in null query chain.");
-if (chain->qStrand == '-')
-    {
-    *retQs = chain->qSize - chain->qEnd;
-    *retQe = chain->qSize - chain->qStart;
-    }
-else
-    {
-    *retQs = chain->qStart;
-    *retQe = chain->qEnd;
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/chainBlock.c b/gbtools/src/blatSrc/lib/chainBlock.c
deleted file mode 100644
index 5c5ed8b..0000000
--- a/gbtools/src/blatSrc/lib/chainBlock.c
+++ /dev/null
@@ -1,453 +0,0 @@
-/* chainBlock - Chain together scored blocks from an alignment
- * into scored chains.  Internally this uses a kd-tree and a
- * varient of an algorithm suggested by Webb Miller and further
- * developed by Jim Kent. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "localmem.h"
-#include "linefile.h"
-#include "dlist.h"
-#include "chainBlock.h"
-
-
-struct kdBranch
-/* A kd-tree. That is a binary tree which partitions the children
- * into higher and lower one dimension at a time.  We're just doing
- * one in two dimensions, so it alternates between q and t dimensions. */
-    {
-    struct kdBranch *lo;      /* Pointer to children with lower coordinates. */
-    struct kdBranch *hi;      /* Pointer to children with higher coordinates. */
-    struct kdLeaf *leaf;      /* Extra info for leaves on tree. */
-    int cutCoord;	      /* Coordinate (in some dimension) to cut on */
-    double maxScore;	      /* Max score of any leaf below us. */
-    int maxQ;		      /* Maximum qEnd of any leaf below us. */
-    int maxT;		      /* Maximum tEnd of any leaf below us. */
-    };
-
-struct kdLeaf
-/* A leaf in our kdTree. */
-    {
-    struct kdLeaf *next;	/* Next in list. */
-    struct cBlock *cb;	        /* Start position and score from user. */
-    struct kdBranch *bestPred;	/* Best predecessor. */
-    double totalScore;		/* Total score of chain up to here. */
-    bool hit;			/* This hit? Used by system internally. */
-    };
-
-struct kdTree
-/* The whole tree.  */
-    {
-    struct kdBranch *root;	/* Pointer to root of kd-tree. */
-    };
-
-
-static int kdLeafCmpQ(const void *va, const void *vb)
-/* Compare to sort based on query start. */
-{
-const struct kdLeaf *a = *((struct kdLeaf **)va);
-const struct kdLeaf *b = *((struct kdLeaf **)vb);
-return a->cb->qStart - b->cb->qStart;
-}
-
-static int kdLeafCmpT(const void *va, const void *vb)
-/* Compare to sort based on target start. */
-{
-const struct kdLeaf *a = *((struct kdLeaf **)va);
-const struct kdLeaf *b = *((struct kdLeaf **)vb);
-return a->cb->tStart - b->cb->tStart;
-}
-
-static int kdLeafCmpTotal(const void *va, const void *vb)
-/* Compare to sort based on total score. */
-{
-const struct kdLeaf *a = *((struct kdLeaf **)va);
-const struct kdLeaf *b = *((struct kdLeaf **)vb);
-double diff = b->totalScore - a->totalScore;
-if (diff < 0) return -1;
-else if (diff > 0) return 1;
-else return 0;
-}
-
-static int medianVal(struct dlList *list, int medianIx, int dim)
-/* Return value of median block in list on given dimension 
- * Mark blocks up to median as hit. */
-{
-struct dlNode *node = list->head;
-struct kdLeaf *leaf = NULL;
-int i;
-
-for (i=0; i<medianIx; ++i)
-    {
-    leaf = node->val;
-    leaf->hit = TRUE;  
-    node = node->next;
-    }
-return (dim == 0 ? leaf->cb->qStart : leaf->cb->tStart);
-}
-
-static int splitList(struct dlList *oldList, struct dlList *newList)
-/* Peel off members of oldList that are not hit onto new list. */
-{
-struct dlNode *node, *next;
-struct kdLeaf *leaf;
-int newCount = 0;
-dlListInit(newList);
-for (node = oldList->head; !dlEnd(node); node = next)
-    {
-    next = node->next;
-    leaf = node->val;
-    if (!leaf->hit)
-	{
-	dlRemove(node);
-	dlAddTail(newList, node);
-	++newCount;
-	}
-    }
-return newCount;
-}
-
-static void clearHits(struct dlList *list)
-/* Clear hit flags of all blocks on list. */
-{
-struct dlNode *node;
-for (node = list->head; !dlEnd(node); node = node->next)
-    {
-    struct kdLeaf *leaf = node->val;
-    leaf->hit = FALSE;
-    }
-}
-
-
-static struct kdBranch *kdBuild(int nodeCount, struct dlList *lists[2], int dim,
-	struct lm *lm)
-/* Build up kd-tree recursively. */
-{
-struct kdBranch *branch;
-lmAllocVar(lm, branch);
-if (nodeCount == 1)
-    {
-    struct kdLeaf *leaf = lists[0]->head->val;
-    branch->leaf = leaf;
-    branch->maxQ = leaf->cb->qEnd;
-    branch->maxT = leaf->cb->tEnd;
-    }
-else
-    {
-    int newCount;
-    struct dlList *newLists[2];
-    struct dlList newQ, newT;
-    int nextDim = 1-dim;
-
-    /* Subdivide lists along median.  */
-    newLists[0] = &newQ;
-    newLists[1] = &newT;
-    clearHits(lists[0]);
-    branch->cutCoord = medianVal(lists[dim], nodeCount/2, dim);
-    newCount = splitList(lists[0], newLists[0]);
-    splitList(lists[1], newLists[1]);
-
-    /* Recurse on each side. */
-    branch->lo = kdBuild(nodeCount - newCount, lists, nextDim, lm);
-    branch->hi = kdBuild(newCount, newLists, nextDim, lm);
-    branch->maxQ = max(branch->lo->maxQ, branch->hi->maxQ);
-    branch->maxT = max(branch->lo->maxT, branch->hi->maxT);
-    }
-return branch;
-}
-
-static struct kdTree *kdTreeMake(struct kdLeaf *leafList, struct lm *lm)
-/* Make a kd-tree containing leafList. */
-{
-struct kdLeaf *leaf;
-int nodeCount = slCount(leafList);
-struct kdTree *tree;
-struct dlList qList, tList,*lists[2];
-struct dlNode *qNodes, *tNodes;
-int i;
-
-/* Build lists sorted in each dimension. This
- * will let us quickly find medians while constructing
- * the kd-tree. */
-dlListInit(&qList);
-dlListInit(&tList);
-AllocArray(qNodes, nodeCount);
-AllocArray(tNodes, nodeCount);
-for (i=0 , leaf=leafList; leaf != NULL; leaf = leaf->next, ++i)
-    {
-    qNodes[i].val = tNodes[i].val = leaf;
-    dlAddTail(&qList, &qNodes[i]);
-    dlAddTail(&tList, &tNodes[i]);
-    }
-/* Just sort qList since tList is sorted because it was
- * constructed from sorted leafList. */
-dlSort(&qList, kdLeafCmpQ); 
-lists[0] = &qList;
-lists[1] = &tList;
-
-/* Allocate master data structure and call recursive builder. */
-lmAllocVar(lm, tree);
-tree->root = kdBuild(nodeCount, lists, 0, lm);
-
-/* Clean up and go home. */
-freeMem(qNodes);
-freeMem(tNodes);
-return tree;
-}
-
-struct predScore
-/* Predecessor and score we get merging with it. */
-    {
-    struct kdBranch *pred;	/* Predecessor. */
-    double score;		/* Score of us plus predecessor. */
-    };
-
-static struct predScore bestPredecessor(
-	struct kdLeaf *lonely,	    /* We're finding this leaf's predecessor */
-	ConnectCost connectCost,    /* Cost to connect two leafs. */
-	GapCost gapCost,	    /* Lower bound on gap cost. */
-	void *gapData,		    /* Data to pass to Gap/Connect cost */
-	int dim,		    /* Dimension level of tree splits on. */
-	struct kdBranch *branch,    /* Subtree to explore */
-	struct predScore bestSoFar) /* Best predecessor so far. */
-/* Find the highest scoring predecessor to this leaf, and
- * thus iteratively the highest scoring subchain that ends
- * in this leaf. */
-{
-struct kdLeaf *leaf;
-double maxScore = branch->maxScore + lonely->cb->score;
-
-/* If best score in this branch of tree wouldn't be enough
- * don't bother exploring it. First try without calculating
- * gap score in case gap score is a little expensive to calculate. */
-if (maxScore < bestSoFar.score)
-    return bestSoFar;
-maxScore -= gapCost(lonely->cb->qStart - branch->maxQ, 
-	lonely->cb->tStart - branch->maxT, gapData);
-if (maxScore < bestSoFar.score)
-    return bestSoFar;
-
-
-/* If it's a terminal branch, then calculate score to connect
- * with it. */
-else if ((leaf = branch->leaf) != NULL)
-    {
-    if (leaf->cb->qStart < lonely->cb->qStart 
-     && leaf->cb->tStart < lonely->cb->tStart)
-	{
-	double score = leaf->totalScore + lonely->cb->score - 
-		connectCost(leaf->cb, lonely->cb, gapData);
-	if (score > bestSoFar.score)
-	   {
-	   bestSoFar.score = score;
-	   bestSoFar.pred = branch;
-	   }
-	}
-    return bestSoFar;
-    }
-
-/* Otherwise explore sub-trees that could harbor predecessors. */
-else
-    {
-    int newDim = 1-dim;
-    int dimCoord = (dim == 0 ? lonely->cb->qStart : lonely->cb->tStart);
-    
-    /* Explore hi branch first as it is more likely to have high
-     * scores.  However only explore it if it can have things starting
-     * before us. */
-    if (dimCoord > branch->cutCoord)
-         bestSoFar = bestPredecessor(lonely, connectCost, gapCost, gapData,
-	 	newDim, branch->hi, bestSoFar);
-    bestSoFar = bestPredecessor(lonely, connectCost, gapCost, gapData,
-    	newDim, branch->lo, bestSoFar);
-    return bestSoFar;
-    }
-}
-
-static void updateScoresOnWay(struct kdBranch *branch, 
-	int dim, struct kdLeaf *leaf)
-/* Traverse kd-tree to find leaf.  Update all maxScores on the way
- * to reflect leaf->totalScore. */
-{
-int newDim = 1-dim;
-int dimCoord = (dim == 0 ? leaf->cb->qStart : leaf->cb->tStart);
-if (branch->maxScore < leaf->totalScore) branch->maxScore = leaf->totalScore;
-if (branch->leaf == NULL)
-    {
-    if (dimCoord <= branch->cutCoord)
-	updateScoresOnWay(branch->lo, newDim, leaf);
-    if (dimCoord >= branch->cutCoord)
-	updateScoresOnWay(branch->hi, newDim, leaf);
-    }
-}
-
-static void findBestPredecessors(struct kdTree *tree, struct kdLeaf *leafList, 
-	ConnectCost connectCost, GapCost gapCost, void *gapData)
-/* Find best predecessor for each leaf. */
-{
-static struct predScore noBest;
-struct kdLeaf *leaf;
-double bestScore = 0;
-
-for (leaf = leafList; leaf != NULL; leaf = leaf->next)
-    {
-    struct predScore best;
-    best = bestPredecessor(leaf, connectCost, gapCost, gapData, 0, tree->root, noBest);
-    if (best.score > leaf->totalScore)
-        {
-	leaf->totalScore = best.score;
-	leaf->bestPred = best.pred;
-	}
-    updateScoresOnWay(tree->root, 0, leaf);
-    if (bestScore < leaf->totalScore)
-        {
-	bestScore = leaf->totalScore;
-	}
-    }
-}
-
-static double scoreBlocks(struct cBlock *blockList, ConnectCost connectCost,
-	void *gapData)
-/* Score list of blocks including gaps between blocks. */
-{
-struct cBlock *block, *lastBlock = NULL;
-double score = 0;
-for (block = blockList; block != NULL; block = block->next)
-    {
-    score += block->score;
-    if (lastBlock != NULL)
-	score -= connectCost(lastBlock, block, gapData);
-    lastBlock = block;
-    }
-return score;
-}
-
-static struct chain *peelChains(char *qName, int qSize, char qStrand,
-	char *tName, int tSize, struct kdLeaf *leafList, FILE *details)
-/* Peel off all chains from tree implied by
- * best predecessors. */
-{
-struct kdLeaf *leaf;
-struct chain *chainList = NULL, *chain;
-for (leaf = leafList; leaf != NULL; leaf = leaf->next)
-    leaf->hit = FALSE;
-for (leaf = leafList; leaf != NULL; leaf = leaf->next)
-    {
-    if (!leaf->hit)
-        {
-	struct kdLeaf *lf;
-	AllocVar(chain);
-	chain->qName = cloneString(qName);
-	chain->qSize = qSize;
-	chain->qStrand = qStrand;
-	chain->tName = cloneString(tName);
-	chain->tSize = tSize;
-	chain->qEnd = leaf->cb->qEnd;
-	chain->tEnd = leaf->cb->tEnd;
-	if (details)
-	    {
-	    chain->score = leaf->totalScore;
-	    chain->id = -1;
-	    chainWriteHead(chain, details);
-	    chain->score = 0;
-	    chain->id = 0;
-	    }
-	slAddHead(&chainList, chain);
-	for (lf = leaf; ; )
-	    {
-	    lf->hit = TRUE;
-	    slAddHead(&chain->blockList, lf->cb);
-	    chain->qStart = lf->cb->qStart;
-	    chain->tStart = lf->cb->tStart;
-	    if (details)
-	        {
-		struct cBlock *b = lf->cb;
-		fprintf(details, "%d\t%f\t%d\t%d\t%d\n", b->score, lf->totalScore,
-			b->tStart, b->qStart, b->qEnd - b->qStart);
-		}
-	    if (lf->bestPred == NULL)
-	         break;
-	    else
-	        {
-		if (details)
-		    {
-		    struct cBlock *b = lf->cb;
-		    struct cBlock *a = lf->bestPred->leaf->cb;
-		    fprintf(details, " gap %d\t%d\n", 
-			b->tStart - a->tEnd, b->qStart - a->qEnd);
-		    }
-		}
-	    lf = lf->bestPred->leaf;
-	    if (lf->hit)
-	        break;
-	    }
-	}
-    }
-slReverse(&chainList);
-return chainList;
-}
-
-struct chain *chainBlocks(
-	char *qName, int qSize, char qStrand,	/* Info on query sequence */
-	char *tName, int tSize, 		/* Info on target. */
-	struct cBlock **pBlockList, 		/* Unordered ungapped alignments. */
-	ConnectCost connectCost, 		/* Calculate cost to connect nodes. */
-	GapCost gapCost, 			/* Cost for non-overlapping nodes. */
-	void *gapData, 				/* Passed through to connect/gapCosts */
-	FILE *details)				/* NULL except for debugging */
-/* Create list of chains from list of blocks.  The blockList will get
- * eaten up as the blocks are moved from the list to the chain. 
- * The list of chains returned is sorted by score. 
- *
- * The details FILE may be NULL, and is where additional information
- * about the chaining is put.
- *
- * Note that the connectCost needs to adjust for possibly partially 
- * overlapping blocks, and that these need to be taken out of the
- * resulting chains in general.  This can get fairly complex.  Also
- * the chains will need some cleanup at the end.  Use the chainConnect
- * module to help with this.  See hg/mouseStuff/axtChain for example usage. */
-{
-struct kdTree *tree;
-struct kdLeaf *leafList = NULL, *leaf;
-struct cBlock *block;
-struct chain *chainList = NULL, *chain;
-struct lm *lm;
-
-/* Empty lists will be problematic later, so deal with them here. */
-if (*pBlockList == NULL)
-   return NULL;
-
-/* Make a leaf for each block. */
-lm = lmInit(0);  /* Memory for tree, branches and leaves. */
-for (block = *pBlockList; block != NULL; block = block->next)
-    {
-    /* Watch out for 0-length blocks in input: */
-    if (block->tStart == block->tEnd)
-	continue;
-    lmAllocVar(lm, leaf);
-    leaf->cb = block;
-    leaf->totalScore = block->score;
-    slAddHead(&leafList, leaf);
-    }
-
-/* Figure out chains. */
-slSort(&leafList, kdLeafCmpT);
-tree = kdTreeMake(leafList, lm);
-findBestPredecessors(tree, leafList, connectCost, gapCost, gapData);
-slSort(&leafList, kdLeafCmpTotal);
-chainList = peelChains(qName, qSize, qStrand, tName, tSize, leafList, details);
-
-/* Rescore chains (since some truncated) */
-for (chain = chainList; chain != NULL; chain = chain->next)
-    chain->score = scoreBlocks(chain->blockList, connectCost, gapData);
-slSort(&chainList,  chainCmpScore);
-
-/* Clean up and go home. */
-lmCleanup(&lm);
-*pBlockList = NULL;
-return chainList;
-}
-
diff --git a/gbtools/src/blatSrc/lib/chainConnect.c b/gbtools/src/blatSrc/lib/chainConnect.c
deleted file mode 100644
index 6d4c0d9..0000000
--- a/gbtools/src/blatSrc/lib/chainConnect.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/* chainConnect - Stuff to cope with connect costs and overlaps when 
- * making chains. This works closely with the chainBlock module. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "chain.h"
-#include "axt.h"
-#include "gapCalc.h"
-#include "chainConnect.h"
-
-
-double chainScoreBlock(char *q, char *t, int size, int matrix[256][256])
-/* Score block through matrix. */
-{
-double score = 0;
-int i;
-for (i=0; i<size; ++i)
-    score += matrix[(int)q[i]][(int)t[i]];
-return score;
-}
-
-double chainCalcScore(struct chain *chain, struct axtScoreScheme *ss, 
-	struct gapCalc *gapCalc, struct dnaSeq *query, struct dnaSeq *target)
-/* Calculate chain score freshly. */
-{
-struct cBlock *b1, *b2;
-double score = 0;
-for (b1 = chain->blockList; b1 != NULL; b1 = b2)
-    {
-    score += chainScoreBlock(query->dna + b1->qStart, 
-    	target->dna + b1->tStart, b1->tEnd - b1->tStart, ss->matrix);
-    b2 = b1->next;
-    if (b2 != NULL)
-        score -=  gapCalcCost(gapCalc, b2->qStart - b1->qEnd, 
-		              b2->tStart - b1->tEnd);
-    }
-return score;
-}
-
-double chainCalcScoreSubChain(struct chain *chain, struct axtScoreScheme *ss, 
-	struct gapCalc *gapCalc, struct dnaSeq *query, struct dnaSeq *target)
-/* Calculate chain score assuming query and target 
-   span the chained region rather than entire chrom. */
-{
-struct cBlock *b1, *b2;
-double score = 0;
-for (b1 = chain->blockList; b1 != NULL; b1 = b2)
-    {
-    score += chainScoreBlock(query->dna + (b1->qStart) - chain->qStart, 
-    	target->dna + (b1->tStart) - chain->tStart, b1->tEnd - b1->tStart, ss->matrix);
-    b2 = b1->next;
-    if (b2 != NULL)
-        score -=  gapCalcCost(gapCalc, b2->qStart - b1->qEnd, 
-		              b2->tStart - b1->tEnd);
-    }
-return score;
-}
-
-void cBlockFindCrossover(struct cBlock *left, struct cBlock *right,
-	struct dnaSeq *qSeq, struct dnaSeq *tSeq,  
-	int overlap, int matrix[256][256], int *retPos, int *retScoreAdjustment)
-/* Find ideal crossover point of overlapping blocks.  That is
- * the point where we should start using the right block rather
- * than the left block.  This point is an offset from the start
- * of the overlapping region (which is the same as the start of the
- * right block). */
-{
-int bestPos = 0;
-char *rqStart = qSeq->dna + right->qStart;
-char *lqStart = qSeq->dna + left->qEnd - overlap;
-char *rtStart = tSeq->dna + right->tStart;
-char *ltStart = tSeq->dna + left->tEnd - overlap;
-int i;
-double score, bestScore, rScore, lScore;
-
-/* Make sure overlap is not larger than either block size: */
-if (overlap > (left->tEnd - left->tStart) ||
-    overlap > (right->tEnd - right->tStart))
-    errAbort("overlap is %d -- too large for one of these:\n"
-	     "qSize=%d  tSize=%d\n"
-	     "left: qStart=%d qEnd=%d (%d) tStart=%d tEnd=%d (%d)\n"
-	     "right: qStart=%d qEnd=%d (%d) tStart=%d tEnd=%d (%d)\n",
-	     overlap, qSeq->size, tSeq->size,
-	     left->qStart, left->qEnd, left->qEnd - left->qStart,
-	     left->tStart, left->tEnd, left->tEnd - left->tStart,
-	     right->qStart, right->qEnd, right->qEnd - right->qStart, 
-	     right->tStart, right->tEnd, right->tEnd - right->tStart);
-
-score = bestScore = rScore = chainScoreBlock(rqStart, rtStart, overlap, matrix);
-lScore = chainScoreBlock(lqStart, ltStart, overlap, matrix);
-for (i=0; i<overlap; ++i)
-    {
-    score += matrix[(int)lqStart[i]][(int)ltStart[i]];
-    score -= matrix[(int)rqStart[i]][(int)rtStart[i]];
-    if (score > bestScore)
-	{
-	bestScore = score;
-	bestPos = i+1;
-	}
-    }
-*retPos = bestPos;
-*retScoreAdjustment = rScore + lScore - bestScore;
-}
-
-
-int chainConnectGapCost(int dq, int dt, struct chainConnect *cc)
-/* Calculate cost of non-overlapping gap. */
-{
-return gapCalcCost(cc->gapCalc, dq, dt);
-}
-
-int chainConnectCost(struct cBlock *a, struct cBlock *b, 
-	struct chainConnect *cc)
-/* Calculate connection cost - including gap score
- * and overlap adjustments if any. */
-{
-int dq = b->qStart - a->qEnd;
-int dt = b->tStart - a->tEnd;
-int overlapAdjustment = 0;
-
-if (a->qStart >= b->qStart || a->tStart >= b->tStart)
-    {
-    errAbort("a (%d %d) not strictly before b (%d %d)",
-    	a->qStart, a->tStart, b->qStart, b->tStart);
-    }
-if (dq < 0 || dt < 0)
-   {
-   int bSize = b->qEnd - b->qStart;
-   int aSize = a->qEnd - a->qStart;
-   int overlap = -min(dq, dt);
-   int crossover;
-   if (overlap >= bSize || overlap >= aSize) 
-       {
-       /* One of the blocks is enclosed completely on one dimension
-        * or other by the other.  Discourage this overlap. */
-       overlapAdjustment = 100000000;
-       }
-   else
-       {
-       cBlockFindCrossover(a, b, cc->query, cc->target, overlap, 
-       		cc->ss->matrix, &crossover, &overlapAdjustment);
-       dq += overlap;
-       dt += overlap;
-       }
-   }
-return overlapAdjustment + gapCalcCost(cc->gapCalc, dq, dt);
-}
-
-static void checkStartBeforeEnd(struct chain *chain, char *message)
-/* Check qStart < qEnd, tStart < tEnd for each block. */
-{
-struct cBlock *b;
-for (b = chain->blockList; b != NULL; b = b->next)
-    {
-    if (b->qStart >= b->qEnd || b->tStart >= b->tEnd)
-	errAbort("Start after end in (%d %d) to (%d %d) %s",
-	    b->qStart, b->tStart, b->qEnd, b->tEnd, message);
-    }
-}
-
-static void checkChainGaps(struct chain *chain, char *message)
-/* Check that gaps between blocks are non-negative. */
-{
-struct cBlock *a, *b;
-a = chain->blockList;
-if (a == NULL)
-    return;
-for (b = a->next; b != NULL; b = b->next)
-    {
-    if (a->qEnd > b->qStart || a->tEnd > b->tStart)
-	{
-	errAbort("Negative gap between (%d %d - %d %d) and (%d %d - %d %d) %s",
-	    a->qStart, a->tStart, a->qEnd, a->tEnd, 
-	    b->qStart, b->tStart, b->qEnd, b->tEnd, message);
-	}
-    a = b;
-    }
-}
-
-static void checkChainIncreases(struct chain *chain, char *message)
-/* Check that qStart and tStart both strictly increase
- * in chain->blockList. */
-{
-struct cBlock *a, *b;
-a = chain->blockList;
-if (a == NULL)
-    return;
-for (b = a->next; b != NULL; b = b->next)
-    {
-    if (a->qStart >= b->qStart || a->tStart >= b->tStart)
-	{
-	errAbort("a (%d %d) not before b (%d %d) %s",
-	    a->qStart, a->tStart, b->qStart, b->tStart, message);
-	}
-    a = b;
-    }
-}
-
-void chainCalcBounds(struct chain *chain)
-/* Recalculate chain boundaries - setting qStart/qEnd/tStart/tEnd from
- * a scan of blockList. */
-{
-struct cBlock *b = chain->blockList;
-if (chain->blockList == NULL)
-    return;
-chain->qStart = b->qStart;
-chain->tStart = b->tStart;
-b = slLastEl(chain->blockList);
-chain->qEnd = b->qEnd;
-chain->tEnd = b->tEnd;
-}
-
-static boolean removeNegativeBlocks(struct chain *chain)
-/* Removing the partial overlaps occassional results
- * in all of a block being removed.  This routine
- * removes the dried up husks of these blocks 
- * and returns TRUE if it finds any. */
-{
-struct cBlock *newList = NULL, *b, *next;
-boolean gotNeg = FALSE;
-for (b = chain->blockList; b != NULL; b = next)
-    {
-    next = b->next;
-    if (b->qStart >= b->qEnd || b->tStart >= b->tEnd)
-	{
-        gotNeg = TRUE;
-	freeMem(b);
-	}
-    else
-        {
-	slAddHead(&newList, b);
-	}
-    }
-slReverse(&newList);
-chain->blockList = newList;
-if (gotNeg)
-    chainCalcBounds(chain);
-return gotNeg;
-}
-
-void setChainBounds(struct chain *chain)
-/* Set chain overall bounds to fit blocks. */
-{
-struct cBlock *b = chain->blockList;
-chain->qStart = b->qStart;
-chain->tStart = b->tStart;
-while (b->next != NULL)
-     b = b->next;
-chain->qEnd = b->qEnd;
-chain->tEnd = b->tEnd;
-}
-
-void chainRemovePartialOverlaps(struct chain *chain, 
-	struct dnaSeq *qSeq, struct dnaSeq *tSeq, int matrix[256][256])
-/* If adjacent blocks overlap then find crossover points between them. */
-{
-struct cBlock *a, *b;
-boolean totalTrimA, totalTrimB;
-
-assert(chain->blockList != NULL);
-
-/* Do an internal sanity check to make sure that things
- * really are sorted by both qStart and tStart. */
-checkChainIncreases(chain, "before removePartialOverlaps");
-
-/* Remove overlapping portion of blocks.  In some
- * tricky repeating regions this can result in 
- * complete blocks being removed.  This complicates
- * the loop below in some cases, forcing us to essentially
- * start over when the first of the two blocks we
- * are examining gets trimmed out completely. */
-for (;;)
-    {
-    totalTrimA = totalTrimB = FALSE;
-    a = chain->blockList;
-    b = a->next;
-    for (;;)
-        {
-	int dq, dt;
-	if (b == NULL)
-	    break;
-	dq = b->qStart - a->qEnd;
-	dt = b->tStart - a->tEnd;
-	if (dq < 0 || dt < 0)
-	   {
-	   int overlap = -min(dq, dt);
-	   int aSize = a->qEnd - a->qStart;
-	   int bSize = b->qEnd - b->qStart;
-	   int crossover, invCross, overlapAdjustment;
-	   if (overlap >= aSize || overlap >= bSize)
-	       {
-	       totalTrimB = TRUE;
-	       }
-	   else
-	       {
-	       cBlockFindCrossover(a, b, qSeq, tSeq, overlap, matrix, 
-	                     &crossover, &overlapAdjustment);
-	       b->qStart += crossover;
-	       b->tStart += crossover;
-	       invCross = overlap - crossover;
-	       a->qEnd -= invCross;
-	       a->tEnd -= invCross;
-	       if (b->qEnd <= b->qStart)
-		   {
-		   totalTrimB = TRUE;
-		   }
-	       else if (a->qEnd <= a->qStart)
-		   {
-		   totalTrimA = TRUE;
-		   }
-	       }
-	   }
-	if (totalTrimA == TRUE)
-	    {
-	    removeNegativeBlocks(chain);
-	    break;
-	    }
-	else if (totalTrimB == TRUE)
-	    {
-	    b = b->next;
-	    freez(&a->next);
-	    a->next = b;
-	    totalTrimB = FALSE;
-	    }
-	else
-	    {
-	    a = b;
-	    b = b->next;
-	    }
-	}
-    if (!totalTrimA)
-        break;
-    }
-
-/* Reset chain bounds - may have clipped them in this
- * process. */
-setChainBounds(chain);
-
-/* Do internal sanity checks. */
-checkChainGaps(chain, "after removePartialOverlaps");
-checkStartBeforeEnd(chain, "after removePartialOverlaps");
-}
-
-void chainMergeAbutting(struct chain *chain)
-/* Merge together blocks in a chain that abut each
- * other exactly. */
-{
-struct cBlock *newList = NULL, *b, *last = NULL, *next;
-for (b = chain->blockList; b != NULL; b = next)
-    {
-    next = b->next;
-    if (last == NULL || last->qEnd != b->qStart || last->tEnd != b->tStart)
-	{
-	slAddHead(&newList, b);
-	last = b;
-	}
-    else
-        {
-	last->qEnd = b->qEnd;
-	last->tEnd = b->tEnd;
-	freeMem(b);
-	}
-    }
-slReverse(&newList);
-chain->blockList = newList;
-}
-
diff --git a/gbtools/src/blatSrc/lib/chainToAxt.c b/gbtools/src/blatSrc/lib/chainToAxt.c
deleted file mode 100644
index cf1aff2..0000000
--- a/gbtools/src/blatSrc/lib/chainToAxt.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* chainToAxt - convert from chain to axt format. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "chain.h"
-#include "dnautil.h"
-#include "dnaseq.h"
-#include "axt.h"
-#include "chainToAxt.h"
-
-
-static struct axt *axtFromBlocks(
-	struct chain *chain,
-	struct cBlock *startB, struct cBlock *endB,
-	struct dnaSeq *qSeq, int qOffset,
-	struct dnaSeq *tSeq, int tOffset)
-/* Convert a list of blocks (guaranteed not to have inserts in both
- * strands between them) to an axt. */
-{
-int symCount = 0;
-int dq, dt, blockSize = 0, symIx = 0;
-struct cBlock *b, *a = NULL;
-struct axt *axt;
-char *qSym, *tSym;
-
-/* Make a pass through figuring out how big output will be. */
-for (b = startB; b != endB; b = b->next)
-    {
-    if (a != NULL)
-        {
-	dq = b->qStart - a->qEnd;
-	dt = b->tStart - a->tEnd;
-	symCount += dq + dt;
-	}
-    blockSize = b->qEnd - b->qStart;
-    symCount += blockSize;
-    a = b;
-    }
-
-/* Allocate axt and fill in most fields. */
-AllocVar(axt);
-axt->qName = cloneString(chain->qName);
-axt->qStart = startB->qStart;
-axt->qEnd = a->qEnd;
-axt->qStrand = chain->qStrand;
-axt->tName = cloneString(chain->tName);
-axt->tStart = startB->tStart;
-axt->tEnd = a->tEnd;
-axt->tStrand = '+';
-axt->symCount = symCount;
-axt->qSym = qSym = needLargeMem(symCount+1);
-qSym[symCount] = 0;
-axt->tSym = tSym = needLargeMem(symCount+1);
-tSym[symCount] = 0;
-
-/* Fill in symbols. */
-a = NULL;
-for (b = startB; b != endB; b = b->next)
-    {
-    if (a != NULL)
-        {
-	dq = b->qStart - a->qEnd;
-	dt = b->tStart - a->tEnd;
-	if (dq == 0)
-	    {
-	    memset(qSym+symIx, '-', dt);
-	    memcpy(tSym+symIx, tSeq->dna + a->tEnd - tOffset, dt);
-	    symIx += dt;
-	    }
-	else
-	    {
-	    assert(dt == 0);
-	    memset(tSym+symIx, '-', dq);
-	    memcpy(qSym+symIx, qSeq->dna + a->qEnd - qOffset, dq);
-	    symIx += dq;
-	    }
-	}
-    blockSize = b->qEnd - b->qStart;
-    memcpy(qSym+symIx, qSeq->dna + b->qStart - qOffset, blockSize);
-    memcpy(tSym+symIx, tSeq->dna + b->tStart - tOffset, blockSize);
-    symIx += blockSize;
-    a = b;
-    }
-assert(symIx == symCount);
-
-/* Fill in score and return. */
-axt->score = axtScoreDnaDefault(axt);
-return axt;
-}
-
-struct axt *chainToAxt(struct chain *chain, 
-	struct dnaSeq *qSeq, int qOffset,
-	struct dnaSeq *tSeq, int tOffset, int maxGap, int maxChain)
-/* Convert a chain to a list of axt's.  This will break
- * where there is a double-sided gap in chain, or 
- * where there is a single-sided gap greater than maxGap, or 
- * where there is a chain longer than maxChain.
- */
-{
-struct cBlock *startB = chain->blockList, *a = NULL, *b;
-struct axt *axtList = NULL, *axt;
-
-for (b = chain->blockList; b != NULL; b = b->next)
-    {
-    if (a != NULL)
-        {
-	int dq = b->qStart - a->qEnd;
-	int dt = b->tStart - a->tEnd;
-	if ((dq > 0 && dt > 0) || dt > maxGap || dq > maxGap || (b->tEnd - startB->tStart) > maxChain)
-	    {
-	    axt = axtFromBlocks(chain, startB, b, qSeq, qOffset, tSeq, tOffset);
-	    slAddHead(&axtList, axt);
-	    startB = b;
-	    }
-	}
-    a = b;
-    }
-axt = axtFromBlocks(chain, startB, NULL, qSeq, qOffset, tSeq, tOffset);
-slAddHead(&axtList, axt);
-slReverse(&axtList);
-return axtList;
-}
diff --git a/gbtools/src/blatSrc/lib/chainToPsl.c b/gbtools/src/blatSrc/lib/chainToPsl.c
deleted file mode 100644
index f37cf20..0000000
--- a/gbtools/src/blatSrc/lib/chainToPsl.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* chainToPsl - convert between chains and psl.  Both of these
- * are alignment formats that can handle gaps in both strands
- * and do not include the sequence itself. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "psl.h"
-#include "chain.h"
-
-
-
-struct psl *chainToPsl(struct chain *chain)
-/* chainToPsl - convert chain to psl.  This does not fill in
- * the match, repMatch, mismatch, and N fields since it needs
- * the sequence for that.  It does fill in the rest though. */
-{
-struct psl *psl;
-int blockCount, i;
-struct cBlock *b, *nextB;
-
-blockCount = slCount(chain->blockList);
-AllocVar(psl);
-AllocArray(psl->blockSizes, blockCount);
-AllocArray(psl->qStarts, blockCount);
-AllocArray(psl->tStarts, blockCount);
-psl->strand[0] = chain->qStrand;
-psl->qName = cloneString(chain->qName);
-psl->qSize = chain->qSize;
-if (chain->qStrand == '-')
-    {
-    psl->qStart = chain->qSize - chain->qEnd;
-    psl->qEnd = chain->qSize - chain->qStart;
-    }
-else
-    {
-    psl->qStart = chain->qStart;
-    psl->qEnd = chain->qEnd;
-    }
-psl->tName = cloneString(chain->tName);
-psl->tSize = chain->tSize;
-psl->tStart = chain->tStart;
-psl->tEnd = chain->tEnd;
-psl->blockCount = blockCount;
-for (i=0, b=chain->blockList; i < blockCount; ++i, b = nextB)
-    {
-    nextB = b->next;
-    psl->tStarts[i] = b->tStart;
-    psl->qStarts[i] = b->qStart;
-    psl->blockSizes[i] = b->qEnd - b->qStart;
-    if (nextB != NULL)
-        {
-	int qGap = nextB->qStart - b->qEnd;
-	int tGap = nextB->tStart - b->tEnd;
-	if (qGap != 0)
-	    {
-	    psl->qBaseInsert += qGap;
-	    psl->qNumInsert += 1;
-	    }
-	if (tGap != 0)
-	    {
-	    psl->tBaseInsert += tGap;
-	    psl->tNumInsert += 1;
-	    }
-	}
-    }
-return psl;
-}
-
-static void fillInMatchEtc(struct chain *chain, 
-	struct dnaSeq *query, struct dnaSeq *target, struct psl *psl)
-/* Fill in psl->match,mismatch,repMatch, and nCount fields.
- * Assumes that query and target are on correct strands already. */
-{
-struct cBlock *block;
-unsigned match = 0, misMatch=0, repMatch=0, nCount=0;
-for (block = chain->blockList; block != NULL; block = block->next)
-    {
-    DNA *qDna = query->dna + block->qStart;
-    DNA *tDna = target->dna + block->tStart;
-    int i, size = block->qEnd - block->qStart;
-    for (i=0; i<size; ++i)
-        {
-	DNA q,t;
-	int qv, tv;
-	q = qDna[i];
-	t = tDna[i];
-	qv = ntVal[(int)q];
-	tv = ntVal[(int)t];
-	if (qv < 0 || tv < 0)
-	    ++nCount;
-	else if (qv == tv)
-	    {
-	    if (isupper(q) && isupper(t))
-	        ++match;
-	    else
-	        ++repMatch;
-	    }
-	else 
-	    ++misMatch;
-        }
-    }
-psl->match = match;
-psl->misMatch = misMatch;
-psl->repMatch = repMatch;
-psl->nCount = nCount;
-}
-
-struct psl *chainToFullPsl(struct chain *chain, 
-	struct dnaSeq *query,   /* Forward query sequence. */
-	struct dnaSeq *rQuery,	/* Reverse complemented query sequence. */
-	struct dnaSeq *target)
-/* Convert chainList to pslList, filling in matches, N's etc. */
-{
-struct psl *psl = chainToPsl(chain);
-struct dnaSeq *qSeq = (chain->qStrand == '-' ? rQuery : query);
-fillInMatchEtc(chain, qSeq, target, psl);
-return psl;
-}
-
-
-
diff --git a/gbtools/src/blatSrc/lib/cheapcgi.c b/gbtools/src/blatSrc/lib/cheapcgi.c
deleted file mode 100644
index af0730f..0000000
--- a/gbtools/src/blatSrc/lib/cheapcgi.c
+++ /dev/null
@@ -1,2306 +0,0 @@
-/* Routines for getting variables passed in from web page
- * forms via CGI.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "hash.h"
-#include "cheapcgi.h"
-#include "portable.h"
-#include "linefile.h"
-#include "errAbort.h"
-#ifndef GBROWSE
-#include "mime.h"
-#endif /* GBROWSE */
-#include <signal.h>
-
-
-/* These three variables hold the parsed version of cgi variables. */
-static char *inputString = NULL;
-static unsigned long inputSize;
-static struct hash *inputHash = NULL;
-static struct cgiVar *inputList = NULL;
-
-static boolean haveCookiesHash = FALSE;
-static struct hash *cookieHash = NULL;
-static struct cgiVar *cookieList = NULL;
-
-/* should cheapcgi use temp files to store uploaded files */
-static boolean doUseTempFile = FALSE;
-
-void dumpCookieList()
-/* Print out the cookie list. */
-{
-struct cgiVar *v;
-for (v=cookieList; v != NULL; v = v->next)
-    printf("%s=%s (%d)\n", v->name, v->val, v->saved);
-}
-
-void useTempFile()
-/* tell cheapcgi to use temp files */
-{
-doUseTempFile = TRUE;
-}
-
-boolean cgiIsOnWeb()
-/* Return TRUE if looks like we're being run as a CGI. */
-{
-return getenv("REQUEST_METHOD") != NULL;
-}
-
-char *cgiRequestMethod()
-/* Return CGI REQUEST_METHOD (such as 'GET/POST/PUT/DELETE/HEAD') */
-{
-return getenv("REQUEST_METHOD");
-}
-
-char *cgiRequestUri()
-/* Return CGI REQUEST_URI */
-{
-return getenv("REQUEST_URI");
-}
-
-char *cgiRequestContentLength()
-/* Return HTTP REQUEST CONTENT_LENGTH if available*/
-{
-return getenv("CONTENT_LENGTH");
-}
-
-char *cgiScriptName()
-/* Return name of script so libs can do context-sensitive stuff. */
-{
-char *scriptName = getenv("SCRIPT_NAME");
-if (scriptName == NULL)
-    scriptName = "cgiSpoofedScript";
-return scriptName;
-}
-
-char *cgiServerName()
-/* Return name of server, better to use cgiServerNamePort() for
-   actual URL construction */
-{
-return getenv("SERVER_NAME");
-}
-
-char *cgiServerPort()
-/* Return port number of server, default 80 if not found */
-{
-char *port = getenv("SERVER_PORT");
-if (port)
-    return port;
-else
-    return "80";
-}
-
-boolean cgiServerHttpsIsOn()
-/* Return true if HTTPS is on */
-{
-char *httpsIsOn = getenv("HTTPS");
-if (httpsIsOn)
-    return sameString(httpsIsOn, "on");
-else
-    return FALSE;
-}
-
-char *cgiAppendSForHttps()
-/* if running on https, add the letter s to the url protocol */
-{
-if (cgiServerHttpsIsOn())
-    return "s";
-return "";
-}
-
-
-char *cgiServerNamePort()
-/* Return name of server with port if different than 80 */
-{
-char *port = cgiServerPort();
-char *name = cgiServerName();
-struct dyString *result = newDyString(256);
-char *defaultPort = "80";
-if (cgiServerHttpsIsOn())
-    defaultPort = "443";
-
-if (name)
-    {
-    dyStringPrintf(result,"%s",name);
-    if (differentString(port, defaultPort))
-	dyStringPrintf(result,":%s",port);
-    return dyStringCannibalize(&result);
-    }
-else
-    return NULL;
-}
-
-char *cgiRemoteAddr()
-/* Return IP address of client (or "unknown"). */
-{
-static char *dunno = "unknown";
-char *remoteAddr = getenv("REMOTE_ADDR");
-if (remoteAddr == NULL)
-    remoteAddr = dunno;
-return remoteAddr;
-}
-
-char *cgiUserAgent()
-/* Return remote user agent (HTTP_USER_AGENT) or NULL if remote user agent is not known */
-{
-return getenv("HTTP_USER_AGENT");
-}
-
-enum browserType cgiClientBrowser(char **browserQualifier, enum osType *clientOs,
-                                  char **clientOsQualifier)
-/* Return client browser type determined from (HTTP_USER_AGENT)
-   Optionally requuest the additional info about the client */
-{
-// WARNING: The specifics of the HTTP_USER_AGENT vary widely.
-//          This has only been tested on a few cases.
-static enum browserType clientBrowser = btUnknown;
-static enum browserType clientOsType  = (enum browserType)osUnknown;
-static char *clientBrowserExtra       = NULL;
-static char *clientOsExtra            = NULL;
-
-if (clientBrowser == btUnknown)
-    {
-    char *userAgent = cgiUserAgent();
-    if (userAgent != NULL)
-        {
-        //warn(userAgent);  // Use this to investigate other cases
-        char *ptr=NULL;
-
-        // Determine the browser
-        if ((ptr = stringIn("Opera",userAgent)) != NULL) // Must be before IE
-            {
-            clientBrowser = btOpera;
-            }
-        else if ((ptr = stringIn("MSIE ",userAgent)) != NULL)
-            {
-            clientBrowser = btIE;
-            ptr += strlen("MSIE ");
-            clientBrowserExtra = cloneFirstWordByDelimiter(ptr,';');
-            }
-        else if ((ptr = stringIn("Firefox",userAgent)) != NULL)
-            {
-            clientBrowser = btFF;
-            ptr += strlen("(Firefox/");
-            clientBrowserExtra = cloneFirstWordByDelimiter(ptr,' ');
-            }
-        else if ((ptr = stringIn("Chrome",userAgent)) != NULL)  // Must be before Safari
-            {
-            clientBrowser = btChrome;
-            ptr += strlen("Chrome/");
-            clientBrowserExtra = cloneFirstWordByDelimiter(ptr,' ');
-            }
-        else if ((ptr = stringIn("Safari",userAgent)) != NULL)
-            {
-            clientBrowser = btSafari;
-            ptr += strlen("Safari/");
-            clientBrowserExtra = cloneFirstWordByDelimiter(ptr,' ');
-            }
-        else
-            {
-            clientBrowser = btOther;
-            }
-
-        // Determine the OS
-        if ((ptr = stringIn("Windows",userAgent)) != NULL)
-            {
-            clientOsType = (enum browserType)osWindows;
-            ptr += strlen("Windows ");
-            clientOsExtra = cloneFirstWordByDelimiter(ptr,';');
-            }
-        else if ((ptr = stringIn("Linux",userAgent)) != NULL)
-            {
-            clientOsType = (enum browserType)osLinux;
-            ptr += strlen("Linux ");
-            clientOsExtra = cloneFirstWordByDelimiter(ptr,';');
-            }
-        else if ((ptr = stringIn("Mac ",userAgent)) != NULL)
-            {
-            clientOsType = (enum browserType)osMac;
-            ptr += strlen("Mac ");
-            clientOsExtra = cloneFirstWordByDelimiter(ptr,';');
-            }
-        else
-            {
-            clientOsType = (enum browserType)osOther;
-            }
-        }
-    }
-if (browserQualifier != NULL)
-    {
-    if (clientBrowserExtra != NULL)
-        *browserQualifier = cloneString(clientBrowserExtra);
-    else
-        *browserQualifier = NULL;
-    }
-if (clientOs != NULL)
-    *clientOs = (enum osType)clientOsType;
-if (clientOsQualifier != NULL)
-    {
-    if (clientOsExtra != NULL)
-        *clientOsQualifier = cloneString(clientOsExtra);
-    else
-        *clientOsQualifier = NULL;
-    }
-
-return clientBrowser;
-}
-
-char *_cgiRawInput()
-/* For debugging get the unprocessed input. */
-{
-return inputString;
-}
-
-static void getQueryInputExt(boolean abortOnErr)
-/* Get query string from environment if they've used GET method. */
-{
-inputString = getenv("QUERY_STRING");
-if (inputString == NULL)
-    {
-    if (abortOnErr)
-	errAbort("No QUERY_STRING in environment.");
-    inputString = cloneString("");
-    return;
-    }
-inputString = cloneString(inputString);
-}
-
-static void getQueryInput()
-/* Get query string from environment if they've used GET method. */
-{
-getQueryInputExt(TRUE);
-}
-
-static void getPostInput()
-/* Get input from file if they've used POST method.
- * Grab any GET QUERY_STRING input first. */
-{
-char *s;
-long i;
-int r;
-
-getQueryInputExt(FALSE);
-int getSize = strlen(inputString);
-
-s = getenv("CONTENT_LENGTH");
-if (s == NULL)
-    errAbort("No CONTENT_LENGTH in environment.");
-if (sscanf(s, "%lu", &inputSize) != 1)
-    errAbort("CONTENT_LENGTH isn't a number.");
-s = getenv("CONTENT_TYPE");
-if (s != NULL && startsWith("multipart/form-data", s))
-    {
-    /* use MIME parse on input stream instead, can handle large uploads */
-    /* inputString must not be NULL so it knows it was set */
-    return;
-    }
-int len = getSize + inputSize;
-if (getSize > 0)
-    ++len;
-char *temp = needMem((size_t)len+1);
-for (i=0; i<inputSize; ++i)
-    {
-    r = getc(stdin);
-    if (r == EOF)
-	errAbort("Short POST input.");
-    temp[i] = r;
-    }
-if (getSize > 0)
-  temp[i++] = '&';
-strncpy(temp+i, inputString, getSize);
-temp[len] = 0;
-freeMem(inputString);
-inputString = temp;
-}
-
-#define memmem(hay, haySize, needle, needleSize) \
-    memMatch(needle, needleSize, hay, haySize)
-
-#ifndef GBROWSE
-static void cgiParseMultipart(struct hash **retHash, struct cgiVar **retList)
-/* process a multipart form */
-{
-char h[1024];  /* hold mime header line */
-char *s = NULL, *ct = NULL;
-struct dyString *dy = newDyString(256);
-struct mimeBuf *mb = NULL;
-struct mimePart *mp = NULL;
-char **env = NULL;
-struct hash *hash = newHash(6);
-struct cgiVar *list = NULL, *el;
-extern char **environ;
-
-
-//debug
-//fprintf(stderr,"GALT: top of cgiParseMultipart()\n");
-//fflush(stderr);
-
-/* find the CONTENT_ environment strings, use to make Alternate Header string for MIME */
-for(env=environ; *env; env++)
-    if (startsWith("CONTENT_",*env))
-	{
-	//debug
-        //fprintf(stderr,"%s\n",*env);  //debug
-	safef(h,sizeof(h),"%s",*env);
-	s = strchr(h,'_');    /* change env syntax to MIME style header, from _= to -: */
-	if (!s)
-	    errAbort("expecting '_' parsing env var %s for MIME alt header", *env);
-	*s = '-';
-	s = strchr(h,'=');
-	if (!s)
-	    errAbort("expecting '=' parsing env var %s for MIME alt header", *env);
-	*s = ':';
-	dyStringPrintf(dy,"%s\r\n",h);
-	}
-dyStringAppend(dy,"\r\n");  /* blank line at end means end of headers */
-
-//debug
-//fprintf(stderr,"Alternate Header Text:\n%s",dy->string);
-//fflush(stderr);
-mb = initMimeBuf(STDIN_FILENO);
-//debug
-//fprintf(stderr,"got past initMimeBuf(STDIN_FILENO)\n");
-//fflush(stderr);
-mp = parseMultiParts(mb, cloneString(dy->string)); /* The Alternate Header will get freed */
-freeDyString(&dy);
-if(!mp->multi) /* expecting multipart child parts */
-    errAbort("Malformatted multipart-form.");
-
-//debug
-//fprintf(stderr,"GALT: Wow got past parse of MIME!\n");
-//fflush(stderr);
-
-ct = hashFindVal(mp->hdr,"content-type");
-//debug
-//fprintf(stderr,"GALT: main content-type: %s\n",ct);
-//fflush(stderr);
-if (!startsWith("multipart/form-data",ct))
-    errAbort("main content-type expected starts with [multipart/form-data], found [%s]",ct);
-
-for(mp=mp->multi;mp;mp=mp->next)
-    {
-    char *cd = NULL, *cdMain = NULL, *cdName = NULL, *cdFileName = NULL, *ct = NULL;
-    cd = hashFindVal(mp->hdr,"content-disposition");
-    ct = hashFindVal(mp->hdr,"content-type");
-    //debug
-    //fprintf(stderr,"GALT: content-disposition: %s\n",cd);
-    //fprintf(stderr,"GALT: content-type: %s\n",ct);
-    //fflush(stderr);
-    cdMain=getMimeHeaderMainVal(cd);
-    cdName=getMimeHeaderFieldVal(cd,"name");
-    cdFileName=getMimeHeaderFieldVal(cd,"filename");
-    //debug
-    //fprintf(stderr,"cgiParseMultipart: main:[%s], name:[%s], filename:[%s]\n",cdMain,cdName,cdFileName);
-    //fflush(stderr);
-    if (!sameString(cdMain,"form-data"))
-	errAbort("main content-type expected [form-data], found [%s]",cdMain);
-
-    //debug
-    //fprintf(stderr,"GALT: mp->size[%llu], mp->binary=[%d], mp->fileName=[%s], mp=>data:[%s]\n",
-        //(unsigned long long) mp->size, mp->binary, mp->fileName,
-        //mp->binary && mp->data ? "<binary data not safe to print>" : mp->data);
-    //fflush(stderr);
-
-    /* filename if there is one */
-    /* Internet Explorer on Windows is sending full path names, strip
-     * directory name from those.  Using \ and / and : as potential
-     * path separator characters, e.g.:
-     *	 C:\Documents and Settings\tmp\file.txt.gz
-     */
-    if (cdFileName)
-	{
-	char *lastPathSep = strrchr(cdFileName, (int) '\\');
-	if (!lastPathSep)
-		lastPathSep = strrchr(cdFileName, (int) '/');
-	if (!lastPathSep)
-		lastPathSep = strrchr(cdFileName, (int) ':');
-	char varNameFilename[256];
-	safef(varNameFilename, sizeof(varNameFilename), "%s__filename", cdName);
-	AllocVar(el);
-	if (lastPathSep)
-	    el->val = cloneString(lastPathSep+1);
-	else
-	    el->val = cloneString(cdFileName);
-        slAddHead(&list, el);
-        hashAddSaveName(hash, varNameFilename, el, &el->name);
-        }
-
-    if (mp->data)
-        {
-        if (mp->binary)
-	    {
-	    char varNameBinary[256];
-	    char addrSizeBuf[40];
-	    safef(varNameBinary,sizeof(varNameBinary),"%s__binary",cdName);
-            safef(addrSizeBuf,sizeof(addrSizeBuf),"%lu %llu",
-		(unsigned long)mp->data,
-		(unsigned long long)mp->size);
-	    AllocVar(el);
-	    el->val = cloneString(addrSizeBuf);
-	    slAddHead(&list, el);
-	    hashAddSaveName(hash, varNameBinary, el, &el->name);
-	    }
-	else  /* normal variable, not too big, does not contain zeros */
-	    {
-	    AllocVar(el);
-	    el->val = mp->data;
-	    slAddHead(&list, el);
-	    hashAddSaveName(hash, cdName, el, &el->name);
-	    }
-        }
-    else if (mp->fileName)
-	{
-	char varNameData[256];
-	safef(varNameData, sizeof(varNameData), "%s__data", cdName);
-	AllocVar(el);
-        el->val = mp->fileName;
-        slAddHead(&list, el);
-        hashAddSaveName(hash, varNameData, el, &el->name);
-        //debug
-        //fprintf(stderr,"GALT special: saved varNameData:[%s], mp=>fileName:[%s]\n",el->name,el->val);
-        //fflush(stderr);
-        }
-    else if (mp->multi)
-	{
-	warn("unexpected nested MIME structures");
-	}
-    else
-	{
-	errAbort("mp-> type not data,fileName, or multi - unexpected MIME structure");
-	}
-
-    freez(&cdMain);
-    freez(&cdName);
-    freez(&cdFileName);
-    }
-
-slReverse(&list);
-*retList = list;
-*retHash = hash;
-}
-#endif /* GBROWSE */
-
-
-
-static void parseCookies(struct hash **retHash, struct cgiVar **retList)
-/* parses any cookies and puts them into the given hash and list */
-{
-char* str;
-char *namePt, *dataPt, *nextNamePt;
-struct hash *hash;
-struct cgiVar *list = NULL, *el;
-
-/* don't build the hash table again */
-if(haveCookiesHash == TRUE)
-	return;
-
-str = cloneString(getenv("HTTP_COOKIE"));
-if(str == NULL) /* don't have a cookie */
-	return;
-
-hash = newHash(6);
-
-namePt = str;
-while (isNotEmpty(namePt))
-    {
-    dataPt = strchr(namePt, '=');
-    if (dataPt == NULL)
-	errAbort("Mangled Cookie input string: no = in '%s' (offset %d in complete cookie string: '%s')",
-		 namePt, (int)(namePt - str), getenv("HTTP_COOKIE"));
-    *dataPt++ = 0;
-    nextNamePt = strchr(dataPt, ';');
-    if (nextNamePt != NULL)
-	{
-         *nextNamePt++ = 0;
-	 if (*nextNamePt == ' ')
-	     nextNamePt++;
-	}
-    cgiDecode(dataPt,dataPt,strlen(dataPt));
-    AllocVar(el);
-    el->val = dataPt;
-    slAddHead(&list, el);
-    hashAddSaveName(hash, namePt, el, &el->name);
-    namePt = nextNamePt;
-    }
-
-haveCookiesHash = TRUE;
-
-slReverse(&list);
-*retList = list;
-*retHash = hash;
-}
-
-char *findCookieData(char *varName)
-/* Get the string associated with varName from the cookie string. */
-{
-struct hashEl *hel;
-char *firstResult;
-
-/* make sure that the cookie hash table has been created */
-parseCookies(&cookieHash, &cookieList);
-if (cookieHash == NULL)
-    return NULL;
-/* Watch out for multiple cookies with the same name (hel is a list) --
- * warn if we find them. */
-hel = hashLookup(cookieHash, varName);
-if (hel == NULL)
-    return NULL;
-else
-    firstResult = ((struct cgiVar *)hel->val)->val;
-hel = hel->next;
-while (hel != NULL)
-    {
-    char *val = ((struct cgiVar *)(hel->val))->val;
-    if (sameString(varName, hel->name) && !sameString(firstResult, val))
-	{
-	/* This is too early to call warn -- it will mess up html output. */
-	fprintf(stderr,
-		"findCookieData: Duplicate cookie value from IP=%s: "
-		"%s has both %s and %s\n",
-		cgiRemoteAddr(),
-		varName, firstResult, val);
-	}
-    hel = hel->next;
-    }
-return firstResult;
-}
-
-static char *cgiInputSource(char *s)
-/* For NULL sources make a guess as to real source. */
-{
-char *qs;
-if (s != NULL)
-    return s;
-qs = getenv("QUERY_STRING");
-if (qs == NULL)
-    return "POST";
-char *cl = getenv("CONTENT_LENGTH");
-if (cl != NULL && atoi(cl) > 0)
-    return "POST";
-return "QUERY";
-}
-
-static void _cgiFindInput(char *method)
-/* Get raw CGI input into inputString.  Method can be "POST", "QUERY", "GET" or NULL
- * for unknown. */
-{
-if (inputString == NULL)
-    {
-    method = cgiInputSource(method);
-    if (sameWord(method, "POST"))
-        getPostInput();
-    else if (sameWord(method, "QUERY") || sameWord(method, "GET"))
-        getQueryInput();
-    else
-        errAbort("Unknown form method");
-    }
-}
-
-struct cgiDictionary *cgiDictionaryFromEncodedString(char *encodedString)
-/* Giving a this=that&this=that string,  return cgiDictionary parsed out from it. 
- * This does *not* destroy input like the lower level cgiParse functions do. */
-{
-struct cgiDictionary *d;
-AllocVar(d);
-d->stringData = cloneString(encodedString);
-cgiParseInputAbort(d->stringData, &d->hash, &d->list);
-return d;
-}
-
-void cgiDictionaryFree(struct cgiDictionary **pD)
-/* Free up resources associated with dictionary. */
-{
-struct cgiDictionary *d = *pD;
-if (d != NULL)
-    {
-    slFreeList(&d->list);
-    hashFree(&d->hash);
-    freez(&d->stringData);
-    freez(pD);
-    }
-}
-
-void cgiDictionaryFreeList(struct cgiDictionary **pList)
-/* Free up a whole list of cgiDictionaries */
-{
-struct cgiDictionary *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    cgiDictionaryFree(&el);
-    }
-*pList = NULL;
-}
-
-
-void cgiParseInputAbort(char *input, struct hash **retHash,
-        struct cgiVar **retList)
-/* Parse cgi-style input into a hash table and list.  This will alter
- * the input data.  The hash table will contain references back
- * into input, so please don't free input until you're done with
- * the hash. Prints message aborts if there's an error.
- * To clean up - slFreeList, hashFree, and only then free input. */
-{
-char *namePt, *dataPt, *nextNamePt;
-struct hash *hash = *retHash;
-struct cgiVar *list = *retList, *el;
-
-if (!hash)
-  hash = newHash(6);
-slReverse(&list);
-
-namePt = input;
-while (namePt != NULL && namePt[0] != 0)
-    {
-    dataPt = strchr(namePt, '=');
-    if (dataPt == NULL)
-	{
-	errAbort("Mangled CGI input string %s", namePt);
-	}
-    *dataPt++ = 0;
-    nextNamePt = strchr(dataPt, '&');
-    if (nextNamePt == NULL)
-	nextNamePt = strchr(dataPt, ';');	/* Accomodate DAS. */
-    if (nextNamePt != NULL)
-         *nextNamePt++ = 0;
-    cgiDecode(namePt,namePt,strlen(namePt));	/* for unusual ct names */
-    cgiDecode(dataPt,dataPt,strlen(dataPt));
-    AllocVar(el);
-    el->val = dataPt;
-    slAddHead(&list, el);
-    hashAddSaveName(hash, namePt, el, &el->name);
-    namePt = nextNamePt;
-    }
-slReverse(&list);
-*retList = list;
-*retHash = hash;
-}
-
-static jmp_buf cgiParseRecover;
-
-static void cgiParseAbort()
-/* Abort cgi parsing. */
-{
-longjmp(cgiParseRecover, -1);
-}
-
-boolean cgiParseInput(char *input, struct hash **retHash,
-        struct cgiVar **retList)
-/* Parse cgi-style input into a hash table and list.  This will alter
- * the input data.  The hash table will contain references back
- * into input, so please don't free input until you're done with
- * the hash. Prints message and returns FALSE if there's an error.
- * To clean up - slFreeList, hashFree, and only then free input. */
-{
-boolean ok = TRUE;
-int status = setjmp(cgiParseRecover);
-if (status == 0)    /* Always true except after long jump. */
-    {
-    pushAbortHandler(cgiParseAbort);
-    cgiParseInputAbort(input, retHash, retList);
-    }
-else    /* They long jumped here because of an error. */
-    {
-    ok = FALSE;
-    }
-popAbortHandler();
-return ok;
-}
-
-char *cgiStringNewValForVar(char *cgiIn, char *varName, char *newVal)
-/* Return a cgi-encoded string with newVal in place of what was oldVal.
- * It is an error for var not to exist.   Do a freeMem of this string
- * when you are through. */
-{
-struct dyString *dy = dyStringNew(strlen(cgiIn) + strlen(newVal));
-struct cgiParsedVars *cpv = cgiParsedVarsNew(cgiIn);
-struct cgiVar *var;
-boolean doneSub = FALSE;
-for (var = cpv->list; var != NULL; var = var->next)
-    {
-    char *val = var->val;
-    if (sameString(var->name, varName))
-	{
-        val = newVal;
-	doneSub = TRUE;
-	}
-    cgiEncodeIntoDy(var->name, val, dy);
-    }
-if (!doneSub)
-    errAbort("Couldn't find %s in %s", varName, cgiIn);
-cgiParsedVarsFree(&cpv);
-return dyStringCannibalize(&dy);
-}
-
-
-static boolean dumpStackOnSignal = FALSE;  // should a stack dump be generated?
-
-static void catchSignal(int sigNum)
-/* handler for various terminal signals for logging purposes */
-{
-char *sig = NULL;
-switch (sigNum)
-    {
-    case SIGTERM:  // after timing out for not producing any stdout or stderr output for too long,
-		   //  apache gives you 3 seconds to clean up and exit or it then sends SIGKILL.
-      sig = "SIGTERM";
-      break;
-    case SIGHUP:   // apache sends this when it is doing a graceful restart or a log rotate.
-      sig = "SIGHUP";
-      break;
-    case SIGABRT:
-      sig = "SIGABRT";
-      break;
-    case SIGSEGV:
-      sig = "SIGSEGV";
-      break;
-    case SIGFPE:
-      sig = "SIGFPE";
-      break;
-    case SIGBUS:
-      sig = "SIGBUS";
-      break;
-    }
-    logCgiToStderr();
-
-    // apache closes STDERR on the CGI before it sends the SIGTERM and SIGKILL signals
-    //  which means that stderr output after that point will not be visible in error_log.
-    fprintf(stderr, "Received signal %s\n", sig);
-    if (dumpStackOnSignal)
-        dumpStack("Stack for signal %s\n", sig);
-
-if (sigNum == SIGTERM || sigNum == SIGHUP) 
-    exit(1);   // so that atexit cleanup get called
-
-raise(SIGKILL);
-}
-
-void initSigHandlers(boolean dumpStack)
-/* set handler for various terminal signals for logging purposes.
- * if dumpStack is TRUE, attempt to dump the stack. */
-{
-if (cgiIsOnWeb())
-    {
-    // SIGKILL is not trappable or ignorable
-    signal(SIGTERM, catchSignal);
-    signal(SIGHUP, catchSignal);
-    signal(SIGABRT, catchSignal);
-    signal(SIGSEGV, catchSignal);
-    signal(SIGFPE, catchSignal);
-    signal(SIGBUS, catchSignal);
-    dumpStackOnSignal = dumpStack;
-    }
-}
-
-
-static void initCgiInput()
-/* Initialize CGI input stuff.  After this CGI vars are
- * stored in an internal hash/list regardless of how they
- * were passed to the program. */
-{
-char* s;
-
-if (inputString != NULL)
-    return;
-
-_cgiFindInput(NULL);
-
-#ifndef GBROWSE
-/* check to see if the input is a multipart form */
-s = getenv("CONTENT_TYPE");
-if (s != NULL && startsWith("multipart/form-data", s))
-    {
-    cgiParseMultipart(&inputHash, &inputList);
-    }
-#endif /* GBROWSE */
-
-cgiParseInputAbort(inputString, &inputHash, &inputList);
-
-/* now parse the cookies */
-parseCookies(&cookieHash, &cookieList);
-
-/* Set enviroment variables CGIs to enable sql tracing and/or profiling */
-s = cgiOptionalString("JKSQL_TRACE");
-if (s != NULL)
-    envUpdate("JKSQL_TRACE", s);
-s = cgiOptionalString("JKSQL_PROF");
-if (s != NULL)
-    envUpdate("JKSQL_PROF", s);
-
-}
-
-struct cgiVar *cgiVarList()
-/* return the list of cgiVar's */
-{
-initCgiInput();
-return inputList;
-}
-
-static char *findVarData(char *varName)
-/* Get the string associated with varName from the query string. */
-{
-struct cgiVar *var;
-
-initCgiInput();
-if ((var = hashFindVal(inputHash, varName)) == NULL)
-    return NULL;
-return var->val;
-}
-
-void cgiBadVar(char *varName)
-/* Complain about a variable that's not there. */
-{
-if (varName == NULL) varName = "";
-errAbort("Sorry, didn't find CGI input variable '%s'", varName);
-}
-
-static char *mustFindVarData(char *varName)
-/* Find variable and associated data or die trying. */
-{
-char *res = findVarData(varName);
-if (res == NULL)
-    cgiBadVar(varName);
-return res;
-}
-
-char *javaScriptLiteralEncode(char *inString)
-/* Use backslash escaping on newline
- * and quote chars, backslash and others.
- * Intended that the encoded string will be
- * put between quotes at a higher level and
- * then interpreted by Javascript. */
-{
-char c;
-int outSize = 0;
-char *outString, *out, *in;
-
-if (inString == NULL)
-    return(cloneString(""));
-
-/* Count up how long it will be */
-in = inString;
-while ((c = *in++) != 0)
-    {
-    if (c == '\''
-     || c == '\"'
-     || c == '&'
-     || c == '\\'
-     || c == '\n'
-     || c == '\r'
-     || c == '\t'
-     || c == '\b'
-     || c == '\f'
-	)
-        outSize += 2;
-    else
-        outSize += 1;
-    }
-outString = needMem(outSize+1);
-
-/* Encode string */
-in = inString;
-out = outString;
-while ((c = *in++) != 0)
-    {
-    if (c == '\''
-     || c == '\"'
-     || c == '&'
-     || c == '\\'
-     || c == '\n'
-     || c == '\r'
-     || c == '\t'
-     || c == '\b'
-     || c == '\f'
-	)
-        *out++ = '\\';
-    *out++ = c;
-    }
-*out++ = 0;
-return outString;
-
-}
-
-
-/* NOTE: Where in the URL to use which of these functions:
- *
- * Parts of a URL:
- *   protocol://user:password@server.com:port/path/filename?var1=val1&var2=val2
- *
- * Note that a space should only be encoded to a plus and decoded from a plus
- * when dealing with http URLs in the query part of the string,
- * which is the part after the ? above.
- * It should not be used in the rest of the URL.  
- * So in the query string part of a URL, do use cgiEncode/cgiDecode. 
- * And in the rest of the URL, use cgiEncodeFUll/cgiDecodeFull 
- * which do not code space as plus.
- * Since FTP does not use URLs with query parameters, use the Full version.
- */
-
-void cgiDecode(char *in, char *out, int inLength)
-/* Decode from cgi pluses-for-spaces format to normal.
- * Out will be a little shorter than in typically, and
- * can be the same buffer. */
-{
-char c;
-int i;
-for (i=0; i<inLength;++i)
-    {
-    c = *in++;
-    if (c == '+')
-	*out++ = ' ';
-    else if (c == '%')
-	{
-	int code;
-        if (sscanf(in, "%2x", &code) != 1)
-	    code = '?';
-	in += 2;
-	i += 2;
-	*out++ = code;
-	}
-    else
-	*out++ = c;
-    }
-*out++ = 0;
-}
-
-void cgiDecodeFull(char *in, char *out, int inLength)
-/* Out will be a cgi-decoded version of in (no space from plus!).
- * Out will be a little shorter than in typically, and
- * can be the same buffer. */
-{
-char c;
-int i;
-for (i=0; i<inLength;++i)
-    {
-    c = *in++;
-    if (c == '%')
-	{
-	int code;
-        if (sscanf(in, "%2x", &code) != 1)
-	    code = '?';
-	in += 2;
-	i += 2;
-	*out++ = code;
-	}
-    else
-	*out++ = c;
-    }
-*out++ = 0;
-}
-
-char *cgiEncode(char *inString)
-/* Return a cgi-encoded version of inString.
- * Alphanumerics kept as is, space translated to plus,
- * and all other characters translated to %hexVal. */
-{
-char c;
-int outSize = 0;
-char *outString, *out, *in;
-
-if (inString == NULL)
-    return(cloneString(""));
-
-/* Count up how long it will be */
-in = inString;
-while ((c = *in++) != 0)
-    {
-    if (isalnum(c) || c == ' ' || c == '.' || c == '_')
-        outSize += 1;
-    else
-        outSize += 3;
-    }
-outString = needMem(outSize+1);
-
-/* Encode string */
-in = inString;
-out = outString;
-while ((c = *in++) != 0)
-    {
-    if (isalnum(c) || c == '.' || c == '_')
-        *out++ = c;
-    else if (c == ' ')
-        *out++ = '+';
-    else
-        {
-        unsigned char uc = c;
-        char buf[4];
-        *out++ = '%';
-        safef(buf, sizeof(buf), "%02X", uc);
-        *out++ = buf[0];
-        *out++ = buf[1];
-        }
-    }
-*out++ = 0;
-return outString;
-}
-
-char *cgiEncodeFull(char *inString)
-/* Return a cgi-encoded version of inString (no + for space!).
- * Alphanumerics/./_ kept as is and all other characters translated to
- * %hexVal. */
-{
-char c;
-int outSize = 0;
-char *outString, *out, *in;
-
-if (inString == NULL)
-    return(cloneString(""));
-
-/* Count up how long it will be */
-in = inString;
-while ((c = *in++) != 0)
-    {
-    if (isalnum(c) || c == '.' || c == '_')
-        outSize += 1;
-    else
-        outSize += 3;
-    }
-outString = needMem(outSize+1);
-
-/* Encode string */
-in = inString;
-out = outString;
-while ((c = *in++) != 0)
-    {
-    if (isalnum(c) || c == '.' || c == '_')
-        *out++ = c;
-    else
-        {
-        unsigned char uc = c;
-        char buf[4];
-        *out++ = '%';
-        safef(buf, sizeof(buf), "%02X", uc);
-        *out++ = buf[0];
-        *out++ = buf[1];
-        }
-    }
-*out++ = 0;
-return outString;
-}
-
-char *cgiOptionalString(char *varName)
-/* Return value of string if it exists in cgi environment, else NULL */
-{
-return findVarData(varName);
-}
-
-
-char *cgiString(char *varName)
-/* Return string value of cgi variable. */
-{
-return mustFindVarData(varName);
-}
-
-char *cgiUsualString(char *varName, char *usual)
-/* Return value of string if it exists in cgi environment.
- * Otherwise return 'usual' */
-{
-char *pt;
-pt = findVarData(varName);
-if (pt == NULL)
-    pt = usual;
-return pt;
-}
-
-struct slName *cgiStringList(char *varName)
-/* Find list of cgi variables with given name.  This
- * may be empty.  Free result with slFreeList(). */
-{
-struct hashEl *hel;
-struct slName *stringList = NULL, *string;
-
-initCgiInput();
-for (hel = hashLookup(inputHash, varName); hel != NULL; hel = hel->next)
-    {
-    if (sameString(hel->name, varName))
-        {
-	struct cgiVar *var = hel->val;
-	string = newSlName(var->val);
-	slAddHead(&stringList, string);
-	}
-    }
-return stringList;
-}
-
-
-int cgiInt(char *varName)
-/* Return int value of cgi variable. */
-{
-char *data;
-char c;
-
-data = mustFindVarData(varName);
-data = skipLeadingSpaces(data);
-c = data[0];
-if (!(isdigit(c) || (c == '-' && isdigit(data[1]))))
-     errAbort("Expecting number in %s, got \"%s\"\n", varName, data);
-return atoi(data);
-}
-
-int cgiIntExp(char *varName)
-/* Evaluate an integer expression in varName and
- * return value. */
-{
-return intExp(cgiString(varName));
-}
-
-int cgiOptionalInt(char *varName, int defaultVal)
-/* This returns integer value of varName if it exists in cgi environment
- * and it's not just the empty string otherwise it returns defaultVal. */
-{
-char *s = cgiOptionalString(varName);
-s = skipLeadingSpaces(s);
-if (isEmpty(s))
-    return defaultVal;
-return cgiInt(varName);
-}
-
-double cgiDouble(char *varName)
-/* Returns double value. */
-{
-char *data;
-double x;
-
-data = mustFindVarData(varName);
-if (sscanf(data, "%lf", &x)<1)
-     errAbort("Expecting real number in %s, got \"%s\"\n", varName, data);
-return x;
-}
-
-double cgiOptionalDouble(char *varName, double defaultVal)
-/* Returns double value. */
-{
-if (!cgiVarExists(varName))
-    return defaultVal;
-return cgiDouble(varName);
-}
-
-boolean cgiVarExists(char *varName)
-/* Returns TRUE if the variable was passed in. */
-{
-initCgiInput();
-return hashLookup(inputHash, varName) != NULL;
-}
-
-boolean cgiBoolean(char *varName)
-{
-return cgiVarExists(varName);
-}
-
-int cgiOneChoice(char *varName, struct cgiChoice *choices, int choiceSize)
-/* Returns value associated with string variable in choice table. */
-{
-char *key = cgiString(varName);
-int i;
-int val = -1;
-
-for (i=0; i<choiceSize; ++i)
-    {
-    if (sameWord(choices[i].name, key))
-        {
-        val =  choices[i].value;
-        return val;
-        }
-    }
-errAbort("Unknown key %s for variable %s\n", key, varName);
-return val;
-}
-
-void cgiMakeSubmitButton()
-/* Make 'submit' type button. */
-{
-cgiMakeButton("Submit", "Submit");
-}
-
-void cgiMakeResetButton()
-/* Make 'reset' type button. */
-{
-printf("<INPUT TYPE=RESET NAME=\"Reset\" VALUE=\" Reset \">");
-}
-
-void cgiMakeClearButton(char *form, char *field)
-/* Make button to clear a text field. */
-{
-char javascript[1024];
-
-safef(javascript, sizeof(javascript),
-    "document.%s.%s.value = ''; document.%s.submit();", form, field, form);
-cgiMakeOnClickButton(javascript, " Clear  ");
-}
-
-void cgiMakeButtonWithMsg(char *name, char *value, char *msg)
-/* Make 'submit' type button. Display msg on mouseover, if present*/
-{
-printf("<INPUT TYPE=SUBMIT NAME=\"%s\" VALUE=\"%s\" %s%s%s>",
-        name, value,
-        (msg ? " TITLE=\"" : ""), (msg ? msg : ""), (msg ? "\"" : "" ));
-}
-
-void cgiMakeButtonWithOnClick(char *name, char *value, char *msg, char *onClick)
-/* Make 'submit' type button, with onclick javascript */
-{
-printf("<input type=\"submit\" name=\"%s\" value=\"%s\" onclick=\"%s\" %s%s%s>",
-        name, value, onClick,
-        (msg ? " TITLE=\"" : ""), (msg ? msg : ""), (msg ? "\"" : "" ));
-}
-
-void cgiMakeButton(char *name, char *value)
-/* Make 'submit' type button */
-{
-cgiMakeButtonWithMsg(name, value, NULL);
-}
-
-void cgiMakeOnClickButton(char *command, char *value)
-/* Make 'push' type button with client side onClick (java)script. */
-{
-printf("<INPUT TYPE=\"button\" VALUE=\"%s\" onClick=\"%s\">", value, command);
-}
-
-void cgiMakeOnClickSubmitButton(char *command, char *name, char *value)
-/* Make submit button with both variable name and value with client side
- * onClick (java)script. */
-{
-printf("<INPUT TYPE=SUBMIT NAME=\"%s\" VALUE=\"%s\" onClick=\"%s\">",
-       name, value, command);
-}
-
-void cgiMakeOptionalButton(char *name, char *value, boolean disabled)
-/* Make 'submit' type button that can be disabled. */
-{
-printf("<INPUT TYPE=SUBMIT NAME=\"%s\" VALUE=\"%s\"", name, value);
-if (disabled)
-    printf(" DISABLED");
-printf(">");
-}
-
-void cgiMakeFileEntry(char *name)
-/* Make file entry box/browser */
-{
-    printf("<INPUT TYPE=FILE NAME=\"%s\">", name);
-}
-
-void cgiSimpleTableStart()
-/* start HTML table  -- no customization. Leaves room
- * for a fancier implementation */
-{
-printf("<TABLE>\n");
-}
-
-void cgiTableEnd()
-/* end HTML table */
-{
-printf("</TABLE>\n");
-}
-
-void cgiSimpleTableRowStart()
-/* Start table row */
-{
-printf("<TR>\n");
-}
-
-void cgiTableRowEnd()
-/* End table row */
-{
-printf("</TR>\n");
-}
-
-void cgiSimpleTableFieldStart()
-/* Start table field */
-{
-printf("<TD>");
-}
-
-void cgiTableFieldStartAlignRight()
-/* Start table field and align right*/
-{
-printf("<TD ALIGN = RIGHT>");
-}
-
-void cgiTableFieldEnd()
-/* End table field */
-{
-printf("</TD>\n");
-}
-
-void cgiTableField(char *text)
-/* Make table field entry */
-{
-printf("<TD> %s </TD>\n", text);
-}
-
-void cgiTableFieldWithMsg(char *text, char *msg)
-/* Make table field entry with mouseover */
-{
-printf("<TD %s%s%s> %s </TD>\n",
-        (msg ? " TITLE=\"" : ""), (msg ? msg : ""), (msg ? "\"" : "" ),
-        text);
-}
-
-void cgiParagraph(char *text)
-/* Make text paragraph */
-{
-printf("<P> %s\n", text);
-}
-
-void cgiMakeRadioButton(char *name, char *value, boolean checked)
-/* Make radio type button.  A group of radio buttons should have the
- * same name but different values.   The default selection should be
- * sent with checked on. */
-{
-printf("<INPUT TYPE=RADIO NAME=\"%s\" VALUE=\"%s\" %s>", name, value,
-   (checked ? "CHECKED" : ""));
-}
-
-void cgiMakeOnClickRadioButton(char *name, char *value, boolean checked,
-                                        char *command)
-/* Make radio type button with onClick command.
- *  A group of radio buttons should have the
- * same name but different values.   The default selection should be
- * sent with checked on. */
-{
-printf("<INPUT TYPE=RADIO NAME=\"%s\" VALUE=\"%s\" %s %s>",
-        name, value, command, (checked ? "CHECKED" : ""));
-}
-
-char *cgiBooleanShadowPrefix()
-/* Prefix for shadow variable set with boolean variables. */
-{
-return "boolshad.";
-}
-#define BOOLSHAD_EXTRA "class='cbShadow'"
-
-boolean cgiBooleanDefined(char *name)
-/* Return TRUE if boolean variable is defined (by
- * checking for shadow. */
-{
-char buf[256];
-safef(buf, sizeof(buf), "%s%s", cgiBooleanShadowPrefix(), name);
-return cgiVarExists(buf);
-}
-
-static void cgiMakeCheckBox2Bool(char *name, boolean checked, boolean enabled,
-                                 char *id, char *moreHtml)
-/* Make check box - designed to be called by the variously overloaded
- * cgiMakeCheckBox functions, and should NOT be called directly.
- * moreHtml: optional additional html like javascript call or mouseover msg (may be NULL)
- * id: button id (may be NULL)
- * Also make a shadow hidden variable and support 2 boolean states:
- *    checked/unchecked and enabled/disabled. */
-{
-char buf[256], idBuf[256];
-
-if(id)
-    safef(idBuf, sizeof(idBuf), " id=\"%s\"", id);
-else
-    idBuf[0] = 0;
-
-printf("<INPUT TYPE=CHECKBOX NAME=\"%s\"%s VALUE=on %s%s%s>", name, idBuf,
-        (moreHtml ? moreHtml : ""),
-        (checked ? " CHECKED" : ""),
-        (enabled ? "" : " DISABLED"));
-safef(buf, sizeof(buf), "%s%s", cgiBooleanShadowPrefix(), name);
-cgiMakeHiddenVarWithExtra(buf, ( enabled ? "0" : (checked ? "-1" : "-2")),BOOLSHAD_EXTRA);
-}
-
-void cgiMakeCheckBoxUtil(char *name, boolean checked, char *msg, char *id)
-/* Make check box - can be called directly, though it was originally meant
- * as the common code for all lower level checkbox routines.
- * However, it's util functionality has been taken over by
- * cgiMakeCheckBoxWithIdAndOptionalHtml() */
-{
-char buf[256];
-
-if (msg)
-    safef(buf, sizeof(buf), "TITLE=\"%s\"", msg);
-else
-    buf[0] = 0;
-
-cgiMakeCheckBox2Bool(name, checked, TRUE, id, buf);
-}
-
-void cgiMakeCheckBoxWithMsg(char *name, boolean checked, char *msg)
-{
-char buf[512];
-safef(buf, sizeof(buf), "title='%s'", msg);
-cgiMakeCheckBox2Bool(name, checked, TRUE, NULL, buf);
-}
-
-void cgiMakeCheckBoxWithId(char *name, boolean checked, char *id)
-/* Make check box, which includes an ID. */
-{
-cgiMakeCheckBox2Bool(name, checked, TRUE, id, NULL);
-}
-
-void cgiMakeCheckBox(char *name, boolean checked)
-/* Make check box. */
-{
-cgiMakeCheckBox2Bool(name, checked, TRUE, NULL, NULL);
-}
-
-void cgiMakeCheckBoxJS(char *name, boolean checked, char *javascript)
-/* Make check box with javascript. */
-{
-cgiMakeCheckBox2Bool(name,checked,TRUE,NULL,javascript);
-}
-
-void cgiMakeCheckBoxIdAndJS(char *name, boolean checked, char *id, char *javascript)
-/* Make check box with ID and javascript. */
-{
-cgiMakeCheckBox2Bool(name,checked,TRUE,id,javascript);
-}
-
-void cgiMakeCheckBoxFourWay(char *name, boolean checked, boolean enabled, char *id,
-                            char *classes, char *moreHtml)
-/* Make check box - with fourWay functionality (checked/unchecked by enabled/disabled)
- * Also makes a shadow hidden variable that supports the 2 boolean states. */
-{
-char shadName[256];
-
-printf("<INPUT TYPE=CHECKBOX NAME='%s'", name);
-if (id)
-    printf(" id='%s'", id);
-if (checked)
-    printf(" CHECKED");
-if (!enabled)
-    {
-    if (findWordByDelimiter("disabled",' ', classes) == NULL) // fauxDisabled ?
-        printf(" DISABLED");
-    }
-if (classes)
-    printf(" class='%s'",classes);
-if (moreHtml)
-    printf(" %s",moreHtml);
-printf(">");
-
-// The hidden var needs to hold the 4way state
-safef(shadName, sizeof(shadName), "%s%s", cgiBooleanShadowPrefix(), name);
-cgiMakeHiddenVarWithExtra(shadName, ( enabled ? "0" : (checked ? "-1" : "-2")),BOOLSHAD_EXTRA);
-}
-
-
-void cgiMakeHiddenBoolean(char *name, boolean on)
-/* Make hidden boolean variable. Also make a shadow hidden variable so we
- * can distinguish between variable not present and
- * variable set to false. */
-{
-char buf[256];
-cgiMakeHiddenVar(name, on ? "on" : "off");
-safef(buf, sizeof(buf), "%s%s", cgiBooleanShadowPrefix(), name);
-cgiMakeHiddenVarWithExtra(buf, "1",BOOLSHAD_EXTRA);
-}
-
-void cgiMakeTextArea(char *varName, char *initialVal, int rowCount, int columnCount)
-/* Make a text area with area rowCount X columnCount and with text: intialVal */
-{
-cgiMakeTextAreaDisableable(varName, initialVal, rowCount, columnCount, FALSE);
-}
-
-void cgiMakeTextAreaDisableable(char *varName, char *initialVal, int rowCount, int columnCount, boolean disabled)
-/* Make a text area that can be disabled. The rea has rowCount X
- * columnCount and with text: intialVal */
-{
-printf("<TEXTAREA NAME=\"%s\" ROWS=%d COLS=%d %s>%s</TEXTAREA>", varName,
-       rowCount, columnCount, disabled ? "DISABLED" : "",
-       (initialVal != NULL ? initialVal : ""));
-}
-
-void cgiMakeOnKeypressTextVar(char *varName, char *initialVal, int charSize,
-			      char *script)
-/* Make a text control filled with initial value, with a (java)script
- * to execute every time a key is pressed.  If charSize is zero it's
- * calculated from initialVal size. */
-{
-if (initialVal == NULL)
-    initialVal = "";
-if (charSize == 0) charSize = strlen(initialVal);
-if (charSize == 0) charSize = 8;
-
-printf("<INPUT TYPE=TEXT NAME=\"%s\" SIZE=%d VALUE=\"%s\"", varName,
-        charSize, initialVal);
-if (isNotEmpty(script))
-    printf(" onkeypress=\"%s\"", script);
-printf(">\n");
-}
-
-void cgiMakeTextVar(char *varName, char *initialVal, int charSize)
-/* Make a text control filled with initial value.  If charSize
- * is zero it's calculated from initialVal size. */
-{
-cgiMakeOnKeypressTextVar(varName, initialVal, charSize, NULL);
-}
-
-void cgiMakeTextVarWithExtraHtml(char *varName, char *initialVal, int width, char *extra)
-/* Make a text control filled with initial value. */
-{
-if (initialVal == NULL)
-    initialVal = "";
-if (width==0)
-    width=strlen(initialVal)*10;
-if (width==0)
-    width = 100;
-
-printf("<INPUT TYPE=TEXT class='inputBox' NAME=\"%s\" style='width: %dpx' VALUE=\"%s\"",
-       varName,width, initialVal);
-if (isNotEmpty(extra))
-    printf(" %s",extra);
-printf(">\n");
-}
-
-void cgiMakeIntVar(char *varName, int initialVal, int maxDigits)
-/* Make a text control filled with initial value.  */
-{
-if (maxDigits == 0) maxDigits = 4;
-
-printf("<INPUT TYPE=TEXT NAME=\"%s\" SIZE=%d VALUE=%d>", varName,
-        maxDigits, initialVal);
-}
-
-void cgiMakeIntVarInRange(char *varName, int initialVal, char *title, int width,
-                          char *min, char *max)
-/* Make a integer control filled with initial value.
-   If min and/or max are non-NULL will enforce range
-   Requires utils.js jQuery.js and inputBox class */
-{
-if (width==0)
-    {
-    if (max)
-        width=strlen(max)*10;
-    else
-        {
-        int sz=initialVal+1000;
-        if (min)
-            sz=atoi(min) + 1000;
-        width = 10;
-        while (sz/=10)
-            width+=10;
-        }
-    }
-if (width < 65)
-    width = 65;
-
-printf("<INPUT TYPE=TEXT class='inputBox' name=\"%s\" style='width: %dpx' value=%d",
-       varName,width,initialVal);
-printf(" onChange='return validateInt(this,%s,%s);'",
-       (min ? min : "\"null\""),(max ? max : "\"null\""));
-if (title)
-    printf(" title='%s'",title);
-printf(">\n");
-}
-
-void cgiMakeIntVarWithLimits(char *varName, int initialVal, char *title, int width,
-                             int min, int max)
-{
-char minLimit[20];
-char maxLimit[20];
-char *minStr=NULL;
-char *maxStr=NULL;
-if (min != NO_VALUE)
-    {
-    safef(minLimit,sizeof(minLimit),"%d",min);
-    minStr = minLimit;
-    }
-if (max != NO_VALUE)
-    {
-    safef(maxLimit,sizeof(maxLimit),"%d",max);
-    maxStr = maxLimit;
-    }
-cgiMakeIntVarInRange(varName,initialVal,title,width,minStr,maxStr);
-}
-
-void cgiMakeIntVarWithMin(char *varName, int initialVal, char *title, int width, int min)
-{
-char minLimit[20];
-char *minStr=NULL;
-if (min != NO_VALUE)
-    {
-    safef(minLimit,sizeof(minLimit),"%d",min);
-    minStr = minLimit;
-    }
-cgiMakeIntVarInRange(varName,initialVal,title,width,minStr,NULL);
-}
-
-void cgiMakeIntVarWithMax(char *varName, int initialVal, char *title, int width, int max)
-{
-char maxLimit[20];
-char *maxStr=NULL;
-if (max != NO_VALUE)
-    {
-    safef(maxLimit,sizeof(maxLimit),"%d",max);
-    maxStr = maxLimit;
-    }
-cgiMakeIntVarInRange(varName,initialVal,title,width,NULL,maxStr);
-}
-
-void cgiMakeDoubleVar(char *varName, double initialVal, int maxDigits)
-/* Make a text control filled with initial floating-point value.  */
-{
-if (maxDigits == 0) maxDigits = 4;
-
-printf("<INPUT TYPE=TEXT NAME=\"%s\" SIZE=%d VALUE=%g>", varName,
-        maxDigits, initialVal);
-}
-
-void cgiMakeDoubleVarInRange(char *varName, double initialVal, char *title, int width,
-                             char *min, char *max)
-/* Make a floating point control filled with initial value.
-   If min and/or max are non-NULL will enforce range
-   Requires utils.js jQuery.js and inputBox class */
-{
-if (width==0)
-    {
-    if (max)
-        width=strlen(max)*10;
-    }
-if (width < 65)
-    width = 65;
-
-printf("<INPUT TYPE=TEXT class='inputBox' name=\"%s\" style='width: %dpx' value=%g",
-       varName,width,initialVal);
-printf(" onChange='return validateFloat(this,%s,%s);'",
-       (min ? min : "\"null\""),(max ? max : "\"null\""));
-if (title)
-    printf(" title='%s'",title);
-printf(">\n");
-}
-
-void cgiMakeDoubleVarWithLimits(char *varName, double initialVal, char *title, int width,
-                                double min, double max)
-{
-char minLimit[20];
-char maxLimit[20];
-char *minStr=NULL;
-char *maxStr=NULL;
-if ((int)min != NO_VALUE)
-    {
-    safef(minLimit,sizeof(minLimit),"%g",min);
-    minStr = minLimit;
-    }
-if ((int)max != NO_VALUE)
-    {
-    safef(maxLimit,sizeof(maxLimit),"%g",max);
-    maxStr = maxLimit;
-    }
-cgiMakeDoubleVarInRange(varName,initialVal,title,width,minStr,maxStr);
-}
-
-void cgiMakeDoubleVarWithMin(char *varName, double initialVal, char *title, int width, double min)
-{
-char minLimit[20];
-char *minStr=NULL;
-if ((int)min != NO_VALUE)
-    {
-    safef(minLimit,sizeof(minLimit),"%g",min);
-    minStr = minLimit;
-    }
-cgiMakeDoubleVarInRange(varName,initialVal,title,width,minStr,NULL);
-}
-
-void cgiMakeDoubleVarWithMax(char *varName, double initialVal, char *title, int width, double max)
-{
-char maxLimit[20];
-char *maxStr=NULL;
-if ((int)max != NO_VALUE)
-    {
-    safef(maxLimit,sizeof(maxLimit),"%g",max);
-    maxStr = maxLimit;
-    }
-cgiMakeDoubleVarInRange(varName,initialVal,title,width,NULL,maxStr);
-}
-
-void cgiMakeDropListClassWithStyleAndJavascript(char *name, char *menu[],
-        int menuSize, char *checked, char *class, char *style,char *javascript)
-/* Make a drop-down list with names, text class, style and javascript. */
-{
-int i;
-char *selString;
-if (checked == NULL) checked = menu[0];
-printf("<SELECT");
-if (name)
-    printf(" NAME='%s'", name);
-if (class)
-    printf(" class='%s'", class);
-if (style)
-    printf(" style='%s'", style);
-if (javascript)
-    printf(" %s", javascript);
-printf(">\n");
-for (i=0; i<menuSize; ++i)
-    {
-    if (sameWord(menu[i], checked))
-        selString = " SELECTED";
-    else
-        selString = "";
-    printf("<OPTION%s>%s</OPTION>\n", selString, menu[i]);
-    }
-printf("</SELECT>\n");
-}
-
-void cgiMakeDropListClassWithStyle(char *name, char *menu[],
-                                   int menuSize, char *checked, char *class, char *style)
-/* Make a drop-down list with names, text class and style. */
-{
-cgiMakeDropListClassWithStyleAndJavascript(name,menu,menuSize,checked,class,style,"");
-}
-
-void cgiMakeDropListClass(char *name, char *menu[],
-                          int menuSize, char *checked, char *class)
-/* Make a drop-down list with names. */
-{
-cgiMakeDropListClassWithStyle(name, menu, menuSize, checked, class, NULL);
-}
-
-void cgiMakeDropList(char *name, char *menu[], int menuSize, char *checked)
-/* Make a drop-down list with names.
- * uses style "normalText" */
-{
-    cgiMakeDropListClass(name, menu, menuSize, checked, "normalText");
-}
-
-char *cgiMultListShadowPrefix()
-/* Prefix for shadow variable set with multi-select inputs. */
-{
-return "multishad.";
-}
-
-void cgiMakeMultList(char *name, char *menu[], int menuSize, struct slName *checked, int length)
-/* Make a list of names with window height equalt to length,
- * which can have multiple selections. Same as drop-down list
- * except "multiple" is added to select tag. */
-{
-int i;
-char *selString;
-if (checked == NULL) checked = slNameNew(menu[0]);
-printf("<SELECT MULTIPLE SIZE=%d ALIGN=CENTER NAME=\"%s\">\n", length, name);
-for (i=0; i<menuSize; ++i)
-    {
-    if (slNameInList(checked, menu[i]))
-        selString = " SELECTED";
-    else
-        selString = "";
-    printf("<OPTION%s>%s</OPTION>\n", selString, menu[i]);
-    }
-printf("</SELECT>\n");
-char buf[512];
-safef(buf, sizeof(buf), "%s%s", cgiMultListShadowPrefix(), name);
-cgiMakeHiddenVar(buf, "1");
-}
-
-void cgiMakeCheckboxGroupWithVals(char *name, char *menu[], char *values[], int menuSize,
-				  struct slName *checked, int tableColumns)
-/* Make a table of checkboxes that have the same variable name but different
- * values (same behavior as a multi-select input), with nice labels in menu[]. */
-{
-int i;
-if (values == NULL) values = menu;
-if (menu == NULL) menu = values;
-puts("<TABLE BORDERWIDTH=0><TR>");
-for (i = 0;  i < menuSize;  i++)
-    {
-    if (i > 0 && (i % tableColumns) == 0)
-	printf("</TR><TR>");
-    printf("<TD><INPUT TYPE=CHECKBOX NAME=\"%s\" VALUE=\"%s\" %s></TD>"
-	   "<TD>%s</TD>\n",
-	   name, values[i], (slNameInList(checked, values[i]) ? "CHECKED" : ""),
-	   menu[i]);
-    }
-if ((i % tableColumns) != 0)
-    while ((i++ % tableColumns) != 0)
-	printf("<TD></TD>");
-puts("</TR></TABLE>");
-char buf[512];
-safef(buf, sizeof(buf), "%s%s", cgiMultListShadowPrefix(), name);
-cgiMakeHiddenVar(buf, "0");
-}
-
-void cgiMakeCheckboxGroup(char *name, char *menu[], int menuSize, struct slName *checked,
-			  int tableColumns)
-/* Make a table of checkboxes that have the same variable name but different
- * values (same behavior as a multi-select input). */
-{
-cgiMakeCheckboxGroupWithVals(name, menu, NULL, menuSize, checked, tableColumns);
-}
-
-void cgiMakeDropListFull(char *name, char *menu[], char *values[],
-                         int menuSize, char *checked, char *extraAttribs)
-/* Make a drop-down list with names and values. */
-{
-int i;
-char *selString;
-if (checked == NULL) checked = menu[0];
-
-if (NULL != extraAttribs)
-    {
-    printf("<SELECT NAME=\"%s\" %s>\n", name, extraAttribs);
-    }
-else
-    {
-    printf("<SELECT NAME=\"%s\">\n", name);
-    }
-
-for (i=0; i<menuSize; ++i)
-    {
-    if (sameWord(values[i], checked))
-        selString = " SELECTED";
-    else
-        selString = "";
-    printf("<OPTION%s VALUE=\"%s\">%s</OPTION>\n", selString, values[i], menu[i]);
-    }
-printf("</SELECT>\n");
-}
-
-char *cgiMakeSelectDropList(boolean multiple, char *name, struct slPair *valsAndLabels,
-                            char *selected, char *anyAll,char *extraClasses, char *extraHtml)
-// Returns allocated string of HTML defining a drop-down select
-// (if multiple, REQUIRES ui-dropdownchecklist.js)
-// valsAndLabels: val (pair->name) must be filled in but label (pair->val) may be NULL.
-// selected: if not NULL is a val found in the valsAndLabels (multiple then comma delimited list).
-//           If null and anyAll not NULL, that will be selected
-// anyAll: if not NULL is the string for an initial option. It can contain val and label,
-//         delimited by a comma
-// extraHtml: if not NULL contains id, javascript calls and style.
-//            It does NOT contain class definitions
-{
-struct dyString *output = dyStringNew(1024);
-boolean checked = FALSE;
-
-dyStringPrintf(output,"<SELECT name='%s'",name);
-if (multiple)
-    dyStringAppend(output," MULTIPLE");
-if (extraClasses != NULL)
-    dyStringPrintf(output," class='%s%s'",extraClasses,(multiple ? " filterBy" : ""));
-else if (multiple)
-    dyStringAppend(output," class='filterBy'");
-
-if (extraHtml != NULL)
-    dyStringPrintf(output," %s",extraHtml);
-dyStringAppend(output,">\n");
-
-// Handle initial option "Any" or "All"
-if (anyAll != NULL)
-    {
-    char *val = anyAll;  // Could contain a label after the value
-    char *label = strchr(val,',');  // Could contain a label after the value
-    if (label != NULL)
-        {
-        val = cloneString(anyAll);
-        label = strchr(val,',');  // again because this is new mem
-        *label = '\0';
-        label = label+1;
-        }
-    else
-        label = val;
-    checked = TRUE; // The default case
-    if (selected != NULL)
-        {
-        if (multiple)
-            checked = (findWordByDelimiter(val,',', selected) != NULL);
-        else
-            checked = sameString(val,selected);
-        }
-    dyStringPrintf(output, "<OPTION%s VALUE='%s'>%s</OPTION>\n",(checked ? " SELECTED" : ""),
-                   val, javaScriptLiteralEncode(label));
-    if (label != val)
-        freeMem(val);
-    }
-
-// All other options
-struct slPair *valPair = valsAndLabels;
-for (; valPair != NULL; valPair = valPair->next)
-    {
-    checked = FALSE;
-    if (selected != NULL)
-        {
-        if (multiple)
-            checked = (findWordByDelimiter(valPair->name,',', selected) != NULL);
-        else
-            checked = sameString(valPair->name,selected);
-        }
-    char *label = valPair->name;
-    if (valPair->val != NULL)
-        label = valPair->val;
-    dyStringPrintf(output, "<OPTION%s VALUE='%s'>%s</OPTION>\n",(checked ? " SELECTED" : ""),
-                   (char *)valPair->name, javaScriptLiteralEncode(label));
-    }
-
-dyStringPrintf(output,"</SELECT>\n");
-
-return dyStringCannibalize(&output);
-}
-
-void cgiMakeDropListWithVals(char *name, char *menu[], char *values[],
-                         int menuSize, char *checked)
-/* Make a drop-down list with names and values. In this case checked
- * corresponds to a value, not a menu. */
-{
-int i;
-char *selString;
-if (checked == NULL) checked = values[0];
-
-printf("<SELECT NAME=\"%s\">\n", name);
-for (i=0; i<menuSize; ++i)
-    {
-    if (sameWord(values[i], checked))
-        selString = " SELECTED";
-    else
-        selString = "";
-    printf("<OPTION%s VALUE=\"%s\">%s</OPTION>\n", selString, values[i], menu[i]);
-    }
-printf("</SELECT>\n");
-}
-
-void cgiDropDownWithTextValsAndExtra(char *name, char *text[], char *values[],
-                                     int count, char *selected, char *extra)
-/* Make a drop-down list with both text and values. */
-{
-int i;
-char *selString;
-assert(values != NULL && text != NULL);
-if (selected == NULL)
-    selected = values[0];
-printf("<SELECT");
-if (name)
-    printf(" NAME='%s'", name);
-if (extra)
-    printf("%s", extra);
-printf(">\n");
-for (i=0; i<count; ++i)
-    {
-    if (sameWord(values[i], selected))
-        selString = " SELECTED";
-    else
-        selString = "";
-    printf("<OPTION%s value='%s'>%s</OPTION>\n", selString, values[i], text[i]);
-    }
-printf("</SELECT>\n");
-}
-
-void cgiMakeHiddenVarWithExtra(char *varName, char *string,char *extra)
-/* Store string in hidden input for next time around. */
-{
-printf("<INPUT TYPE=HIDDEN NAME='%s' VALUE='%s'", varName, string);
-if (extra)
-    printf(" %s>\n",extra);
-else
-    puts(">");
-}
-
-void cgiContinueHiddenVar(char *varName)
-/* Write CGI var back to hidden input for next time around. */
-{
-if (cgiVarExists(varName))
-    cgiMakeHiddenVar(varName, cgiString(varName));
-}
-
-void cgiVarExclude(char *varName)
-/* If varName exists, remove it. */
-{
-if (cgiVarExists(varName))
-    {
-    struct cgiVar *cv = hashRemove(inputHash, varName);
-    slRemoveEl(&inputList, cv);
-    }
-}
-
-void cgiVarExcludeExcept(char **varNames)
-/* Exclude all variables except for those in NULL
- * terminated array varNames.  varNames may be NULL
- * in which case nothing is excluded. */
-{
-struct hashEl *list, *el;
-struct hash *exclude = newHash(8);
-char *s;
-
-/* Build up hash of things to exclude */
-if (varNames != NULL)
-   {
-   while ((s = *varNames++) != NULL)
-       hashAdd(exclude, s, NULL);
-   }
-
-/* Step through variable list and remove them if not
- * excluded. */
-initCgiInput();
-list = hashElListHash(inputHash);
-for (el = list; el != NULL; el = el->next)
-    {
-    if (!hashLookup(exclude, el->name))
-        cgiVarExclude(el->name);
-    }
-hashElFreeList(&list);
-freeHash(&exclude);
-}
-
-void cgiVarSet(char *varName, char *val)
-/* Set a cgi variable to a particular value. */
-{
-struct cgiVar *var;
-initCgiInput();
-AllocVar(var);
-var->val = cloneString(val);
-hashAddSaveName(inputHash, varName, var, &var->name);
-}
-
-struct dyString *cgiUrlString()
-/* Get URL-formatted that expresses current CGI variable state. */
-{
-struct dyString *dy = newDyString(0);
-struct cgiVar *cv;
-char *e;
-
-
-for (cv = inputList; cv != NULL; cv = cv->next)
-    {
-    if (cv != inputList)
-       dyStringAppend(dy, "&");
-    e = cgiEncode(cv->val);
-    dyStringPrintf(dy, "%s=", cv->name);
-    dyStringAppend(dy, e);
-    freez(&e);
-    }
-return dy;
-}
-
-void cgiEncodeIntoDy(char *var, char *val, struct dyString *dy)
-/* Add a CGI-encoded &var=val string to dy. */
-{
-if (dy->stringSize != 0)
-    dyStringAppendC(dy, '&');
-dyStringAppend(dy, var);
-dyStringAppendC(dy, '=');
-char *s = cgiEncode(val);
-dyStringAppend(dy, s);
-freez(&s);
-}
-
-void cgiContinueAllVars()
-/* Write back all CGI vars as hidden input for next time around. */
-{
-struct cgiVar *cv;
-for (cv = inputList; cv != NULL; cv = cv->next)
-    cgiMakeHiddenVar(cv->name, cv->val);
-}
-
-
-boolean cgiFromCommandLine(int *pArgc, char *argv[], boolean preferWeb)
-/* Use the command line to set up things as if we were a CGI program.
- * User types in command line (assuming your program called cgiScript)
- * like:
- *        cgiScript nonCgiArg1 var1=value1 var2=value2 var3=value3 nonCgiArg2
- * or like
- *        cgiScript nonCgiArg1 var1=value1&var2=value2&var3=value3 nonCgiArg2
- * or even like
- *        cgiScript nonCgiArg1 -x -y=bogus z=really
- * (The non-cgi arguments can occur anywhere.  The cgi arguments (all containing
- * the character '=' or starting with '-') are erased from argc/argv.  Normally
- * you call this cgiSpoof(&argc, argv);
- */
-{
-int argc = *pArgc;
-int i;
-int argcLeft = argc;
-char *name;
-static char queryString[65536];
-char *q = queryString;
-boolean needAnd = TRUE;
-boolean gotAny = FALSE;
-boolean startDash;
-boolean gotEq;
-static char hostLine[512];
-
-if (preferWeb && cgiIsOnWeb())
-    return TRUE;	/* No spoofing required! */
-q += safef(q, queryString + sizeof(queryString) - q,
-	   "%s", "QUERY_STRING=cgiSpoof=on");
-for (i=0; i<argcLeft; )
-    {
-    name = argv[i];
-    if ((startDash = (name[0] == '-')))
-       ++name;
-    gotEq = (strchr(name, '=') != NULL);
-    if (gotEq || startDash)
-        {
-        if (needAnd)
-            *q++ = '&';
-        q += safef(q, queryString + sizeof(queryString) - q, "%s", name);
-        if (!gotEq || strchr(name, '&') == NULL)
-            needAnd = TRUE;
-	if (!gotEq)
-	    q += safef(q, queryString + sizeof(queryString) - q, "=on");
-        memcpy(&argv[i], &argv[i+1], sizeof(argv[i]) * (argcLeft-i-1));
-        argcLeft -= 1;
-        gotAny = TRUE;
-        }
-    else
-        i++;
-    }
-if (gotAny)
-    {
-    *pArgc = argcLeft;
-    }
-putenv("REQUEST_METHOD=GET");
-putenv(queryString);
-char *host = getenv("HOST");
-if (host == NULL)
-    host = "unknown";
-safef(hostLine, sizeof(hostLine), "SERVER_NAME=%s", host);
-putenv(hostLine);
-initCgiInput();
-return gotAny;
-}
-
-boolean cgiSpoof(int *pArgc, char *argv[])
-/* If run from web line set up input
- * variables from web line, otherwise
- * set up from command line. */
-{
-return cgiFromCommandLine(pArgc, argv, TRUE);
-}
-
-boolean cgiFromFile(char *fileName)
-/* Set up a cgi environment using parameters stored in a file.
- * Takes file with arguments in the form:
- *       argument1=someVal
- *       # This is a comment
- *       argument2=someOtherVal
- *       ...
- * and puts them into the cgi environment so that the usual
- * cgiGetVar() commands can be used. Useful when a program
- * has a lot of possible parameters.
- */
-{
-char **argv = NULL;
-int argc = 0;
-int maxArgc = 10;
-int i;
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *line;
-boolean spoof= FALSE;
-AllocArray(argv, maxArgc);
-/* Remember that first arg is program name.
-   Put filename there instead. */
-argc = 1;
-argv[0] = cloneString(fileName);
-for(;;)
-    {
-    /* If we are at the end we're done. */
-    if(!lineFileNext(lf, &line, NULL))
-	break;
-    /* If it is a comment or blank line skip it. */
-    if (line[0] == '#' || sameString(line, ""))
-        continue;
-    /* If our argv array is full expand it. */
-    if((argc+1) >= maxArgc)
-	{
-	ExpandArray(argv, maxArgc, 2*maxArgc);
-	maxArgc *= 2;
-	}
-    /* Fill in another argument to our psuedo arguments. */
-    argv[argc++] = cloneString(line);
-    }
-spoof = cgiSpoof(&argc, argv);
-/* Cleanup. */
-lineFileClose(&lf);
-for(i=0; i<argc; i++)
-    freez(&argv[i]);
-freez(&argv);
-return spoof;
-}
-
-void logCgiToStderr()
-/* Log useful CGI info to stderr */
-{
-char *ip = getenv("REMOTE_ADDR");
-char *cgiBinary = getenv("SCRIPT_FILENAME");
-char *requestUri = getenv("REQUEST_URI");
-char *hgsid = cgiOptionalString("hgsid");
-char *cgiFileName = NULL;
-time_t nowTime = time(NULL);
-struct tm *tm;
-tm = localtime(&nowTime);
-char *ascTime = asctime(tm);
-size_t len = strlen(ascTime);
-if (cgiBinary)
-    cgiFileName = basename(cgiBinary);
-else
-    cgiFileName = "cgi-bin";
-if (len > 3) ascTime[len-2] = '\0';
-if (!ip)
-    ip = "unknown";
-if (!hgsid)
-    hgsid = "unknown";
-if (!requestUri)
-    requestUri = "unknown";
-fprintf(stderr, "[%s] [%s] [client %s] [hgsid=%.24s] [%.1024s] ", ascTime, cgiFileName, ip,
-	hgsid, requestUri);
-}
-
-void cgiResetState()
-/* This is for reloading CGI settings multiple times in the same program
- * execution.  No effect if state has not yet been initialized. */
-{
-freez(&inputString);
-inputString = NULL;
-if (inputHash != NULL)
-    hashFree(&inputHash);
-inputHash = NULL;
-inputList = NULL;
-
-haveCookiesHash = FALSE;
-if (cookieHash != NULL)
-    hashFree(&cookieHash);
-cookieHash = NULL;
-cookieList = NULL;
-}
-
-void cgiDown(float lines)
-// Drop down a certain number of lines (may be fractional)
-{
-printf("<div style='height:%fem;'></div>\n",lines);
-}
-
-char *commonCssStyles()
-/* Returns a string of common CSS styles */
-{
-// Contents currently is OBSOLETE as these have been moved to HGStyle.css
-// TODO: remove all traces (from web.c, hgTracks, hgTables) as this funtion does nothing.
-return "";
-}
-
-static void turnCgiVarsToVals(struct hashEl *hel)
-/* To save cgiParseVars clients from doing an extra lookup, replace
- * hash filled with cgiVars as values with one filled with cgiVar->val
- * instead.  Since cgiVar->name is same as hashEl->name,  no info is really
- * lost, and it simplifies the code that uses us. */
-{
-struct cgiVar *var = hel->val;
-hel->val = var->val;
-}
-
-struct cgiParsedVars *cgiParsedVarsNew(char *cgiString)
-/* Build structure containing parsed out cgiString */
-{
-struct cgiParsedVars *tags;
-AllocVar(tags);
-tags->stringBuf = cloneString(cgiString);
-cgiParseInputAbort(tags->stringBuf, &tags->hash, &tags->list);
-hashTraverseEls(tags->hash, turnCgiVarsToVals);
-return tags;
-}
-
-void cgiParsedVarsFree(struct cgiParsedVars **pTags)
-/* Free up memory associated with cgiParsedVars */
-{
-struct cgiParsedVars *tags = *pTags;
-if (tags != NULL)
-    {
-    slFreeList(&tags->list);
-    hashFree(&tags->hash);
-    freeMem(tags->stringBuf);
-    freez(pTags);
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/cirTree.c b/gbtools/src/blatSrc/lib/cirTree.c
deleted file mode 100644
index 48020ee..0000000
--- a/gbtools/src/blatSrc/lib/cirTree.c
+++ /dev/null
@@ -1,635 +0,0 @@
-/* cirTree chromosome id r tree.  Part of a system to index chromosome ranges - things of
- * form chrN:start-end.  Generally you'll be using the crTree module - which
- * makes use of this module and the bPlusTree module - rather than this module directly.
- * This module works with chromosomes mapped to small integers rather than chromosomes
- * as strings, saving space and speeding things up in the process, but requiring the
- * separate bPlusTree to map the names to IDs. 
- *   This module implements a one dimensional R-tree index treating the chromosome ID
- * as the most significant part of a two-part key, and the base position as the least 
- * significant part of the key. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "localmem.h"
-#include "sig.h"
-#include "udc.h"
-#include "cirTree.h"
-
-struct rTree
-/* Recursive range structure. */
-    {
-    struct rTree *next;	/* Next on same level. */
-    struct rTree *children;	/* Child list. */
-    struct rTree *parent;	/* Our parent if any. */
-    bits32 startChromIx;	/* Starting chromosome. */
-    bits32 startBase;		/* Starting base position. */
-    bits32 endChromIx;		/* Ending chromosome. */
-    bits32 endBase;		/* Ending base. */
-    bits64 startFileOffset;	/* Start offset in file for leaves. */
-    bits64 endFileOffset;	/* End file offset for leaves. */
-    };
-
-#define fileHeaderSize (48)	/* Size of file header. */
-#define indexSlotSize (24)	/* Size of startChrom,startBase,endChrom,endBase,offset */
-#define leafSlotSize (32)       /* Size of startChrom,startBase,endChrom,endBase,offset,size */
-#define nodeHeaderSize (4)	/* Size of rTree node header. isLeaf,reserved,childCount. */
-
-int indexNodeSize(int blockSize)
-/* Return size of an index node. */
-{
-return nodeHeaderSize + indexSlotSize * blockSize;
-}
-
-int leafNodeSize(int blockSize)
-/* Return size of a leaf node. */
-{
-return nodeHeaderSize + leafSlotSize * blockSize;
-}
-
-
-static bits64 rWriteIndexLevel(bits16 blockSize, int childNodeSize,
-	struct rTree *tree, int curLevel, int destLevel,
-	bits64 offsetOfFirstChild, FILE *f)
-/* Recursively write an index level, skipping levels below destLevel,
- * writing out destLevel. */
-{
-struct rTree *el;
-bits64 offset = offsetOfFirstChild;
-if (curLevel == destLevel)
-    {
-    /* We've reached the right level, write out a node header */
-    UBYTE reserved = 0;
-    UBYTE isLeaf = FALSE;
-    bits16 countOne = slCount(tree->children);
-    writeOne(f, isLeaf);
-    writeOne(f, reserved);
-    writeOne(f, countOne);
-
-    /* Write out elements of this node. */
-    for (el = tree->children; el != NULL; el = el->next)
-	{
-	writeOne(f, el->startChromIx);
-	writeOne(f, el->startBase);
-	writeOne(f, el->endChromIx);
-	writeOne(f, el->endBase);
-	writeOne(f, offset);
-	offset += childNodeSize;
-	}
-
-    /* Write out zeroes for empty slots in node. */
-    int i;
-    for (i=countOne; i<blockSize; ++i)
-	repeatCharOut(f, 0, indexSlotSize);
-    }
-else 
-    {
-    /* Otherwise recurse on children. */
-    for (el = tree->children; el != NULL; el = el->next)
-	offset = rWriteIndexLevel(blockSize, childNodeSize, el, curLevel+1, destLevel,
-		offset, f);
-    }
-return offset;
-}
-
-static void writeIndexLevel(int blockSize, int childNodeSize, 
-	struct rTree *tree, bits64 offsetOfFirstChild, int level, FILE *f)
-/* Write out a non-leaf level nodes at given level. */
-{
-rWriteIndexLevel(blockSize, childNodeSize, tree, 0, level, offsetOfFirstChild, f);
-}
-
-static void rWriteLeaves(int itemsPerSlot, int lNodeSize, struct rTree *tree, int curLevel,
-	int leafLevel, FILE *f)
-/* Write out leaf-level nodes. */
-{
-if (curLevel == leafLevel)
-    {
-    /* We've reached the right level, write out a node header. */
-    UBYTE reserved = 0;
-    UBYTE isLeaf = TRUE;
-    bits16 countOne = slCount(tree->children);
-    writeOne(f, isLeaf);
-    writeOne(f, reserved);
-    writeOne(f, countOne);
-
-    /* Write out elements of this node. */
-    struct rTree *el;
-    for (el = tree->children; el != NULL; el = el->next)
-	{
-	writeOne(f, el->startChromIx);
-	writeOne(f, el->startBase);
-	writeOne(f, el->endChromIx);
-	writeOne(f, el->endBase);
-	writeOne(f, el->startFileOffset);
-	bits64 size = el->endFileOffset - el->startFileOffset;
-	writeOne(f, size);
-	}
-
-    /* Write out zeroes for empty slots in node. */
-    int i;
-    for (i=countOne; i<itemsPerSlot; ++i)
-	repeatCharOut(f, 0, indexSlotSize);
-    }
-else
-    {
-    /* Otherwise recurse on children. */
-    struct rTree *el;
-    for (el = tree->children; el != NULL; el = el->next)
-	rWriteLeaves(itemsPerSlot, lNodeSize, el, curLevel+1, leafLevel, f);
-    }
-}
-
-static void writeLeaves(int itemsPerSlot, int lNodeSize, struct rTree *tree, int leafLevel, FILE *f)
-/* Write out leaf-level nodes. */
-{
-rWriteLeaves(itemsPerSlot, lNodeSize, tree, 0, leafLevel, f);
-}
-
-void calcLevelSizes(struct rTree *tree, int *levelSizes, int level, int maxLevel)
-/* Recursively count sizes of levels and add to appropriate slots of levelSizes */
-{
-struct rTree *el;
-for (el = tree; el != NULL; el = el->next)
-    {
-    levelSizes[level] += 1;
-    if (level < maxLevel)
-        calcLevelSizes(el->children, levelSizes, level+1, maxLevel);
-    }
-}
-
-static struct rTree *rTreeFromChromRangeArray( struct lm *lm, int blockSize, int itemsPerSlot,
-	void *itemArray, int itemSize, bits64 itemCount,  void *context,
-	struct cirTreeRange (*fetchKey)(const void *va, void *context),
-	bits64 (*fetchOffset)(const void *va, void *context), bits64 endFileOffset,
-	int *retLevelCount)
-{
-if (itemCount == 0)
-    return NULL;
-char *items = itemArray;
-struct rTree *el, *list=NULL, *tree = NULL;
-
-/* Make first level above leaf. */
-bits64 i;
-bits64 nextOffset = (*fetchOffset)(items, context);
-int oneSize = 0;
-for (i=0; i<itemCount; i += oneSize)
-    {
-
-    /* Allocate element and put on list. */
-    lmAllocVar(lm, el);
-    slAddHead(&list, el);
-
-    /* Fill out most of element from first item in element. */
-    char *startItem = items + itemSize * i;
-    struct cirTreeRange key = (*fetchKey)(startItem, context);
-    el->startChromIx = el->endChromIx = key.chromIx;
-    el->startBase = key.start;
-    el->endBase = key.end;
-    el->startFileOffset = nextOffset;
-
-    oneSize = 1;
-
-    char *endItem = startItem;
-    int j;
-    for (j=i+1; j<itemCount; ++j) {
-	endItem += itemSize;
-	nextOffset = (*fetchOffset)(endItem, context);
-	if (nextOffset != el->startFileOffset)
-		break;
-	else 
-		oneSize++;
-    }
-    if (j == itemCount) {
-	nextOffset = endFileOffset;
-    }
-
-    el->endFileOffset = nextOffset;
-
-    /* Expand area spanned to include all items in block. */
-    for (j=1; j<oneSize; ++j)
-        {
-	void *item = items + itemSize*(i+j);
-	key = (*fetchKey)(item, context);
-	if (key.chromIx < el->startChromIx)
-	    {
-	    el->startChromIx = key.chromIx;
-	    el->startBase = key.start;
-	    }
-	else if (key.chromIx == el->startChromIx)
-	    {
-	    if (key.start < el->startBase)
-	        el->startBase = key.start;
-	    }
-	if (key.chromIx > el->endChromIx)
-	    {
-	    el->endChromIx = key.chromIx;
-	    el->endBase = key.end;
-	    }
-	else if (key.chromIx == el->endChromIx)
-	    {
-	    if (key.end > el->endBase)
-	        el->endBase = key.end;
-	    }
-	}
-    }
-slReverse(&list);
-verbose(2, "Made %d primary index nodes out of %llu items\n", slCount(list), itemCount);
-
-/* Now iterate through making more and more condensed versions until have just one. */
-int levelCount = 1;
-tree = list;
-while (tree->next != NULL || levelCount < 2)
-    {
-    list = NULL;
-    int slotsUsed = blockSize;
-    struct rTree *parent = NULL, *next;
-    for (el = tree; el != NULL; el = next)
-        {
-	next = el->next;
-	if (slotsUsed >= blockSize)
-	    {
-	    slotsUsed = 1;
-	    lmAllocVar(lm, parent);
-	    parent = lmCloneMem(lm, el, sizeof(*el));
-	    parent->children = el;
-	    el->parent = parent;
-	    el->next = NULL;
-	    slAddHead(&list, parent);
-	    }
-	else
-	    {
-	    ++slotsUsed;
-	    slAddHead(&parent->children, el);
-	    el->parent = parent;
-	    if (el->startChromIx < parent->startChromIx)
-		{
-	        parent->startChromIx = el->startChromIx;
-		parent->startBase = el->startBase;
-		}
-	    else if (el->startChromIx == parent->startChromIx)
-	        {
-		if (el->startBase < parent->startBase)
-		    parent->startBase = el->startBase;
-		}
-	    if (el->endChromIx > parent->endChromIx)
-		{
-	        parent->endChromIx = el->endChromIx;
-		parent->endBase = el->endBase;
-		}
-	    else if (el->endChromIx == parent->endChromIx)
-	        {
-		if (el->endBase > parent->endBase)
-		    parent->endBase = el->endBase;
-		}
-	    }
-	}
-
-    slReverse(&list);
-    for (el = list; el != NULL; el = el->next)
-        slReverse(&el->children);
-    tree = list;
-    levelCount += 1;
-    }
-*retLevelCount = levelCount;
-return tree;
-}
-
-static void writeTreeToOpenFile(struct rTree *tree, int blockSize, int levelCount, FILE *f)
-/* Write out tree to a file that is open already - writing out index nodes from 
- * highest to lowest level, and then leaf nodes. */
-{
-/* Calculate sizes of each level. */
-int i;
-int levelSizes[levelCount];
-for (i=0; i<levelCount; ++i)
-    levelSizes[i] = 0;
-calcLevelSizes(tree, levelSizes, 0, levelCount-1);
-
-/* Calc offsets of each level. */
-bits64 levelOffsets[levelCount];
-bits64 offset = ftell(f);
-bits64 iNodeSize = indexNodeSize(blockSize);
-bits64 lNodeSize = leafNodeSize(blockSize);
-for (i=0; i<levelCount; ++i)
-    {
-    levelOffsets[i] = offset;
-    offset += levelSizes[i] * iNodeSize;
-    verbose(2, "level %d: size %d, offset %llu\n", i, levelSizes[i], levelOffsets[i]);
-    }
-
-verbose(2, "%d levels.  Level sizes are", levelCount);
-for (i=0; i<levelCount; ++i) verbose(2, " %d", levelSizes[i]);
-verbose(2, "\n");
-
-/* Write out index levels. */
-int finalLevel = levelCount-3;
-for (i=0; i<=finalLevel; ++i)
-    {
-    bits64 childNodeSize = (i==finalLevel ? lNodeSize : iNodeSize);
-    writeIndexLevel(blockSize, childNodeSize, tree,
-    	levelOffsets[i+1], i, f);
-    if (ftell(f) != levelOffsets[i+1])
-        errAbort("Internal error: offset mismatch (%llu vs %llu) line %d of %s\n", (bits64)ftell(f), levelOffsets[i+1], __LINE__, __FILE__);
-    }
-
-/* Write out leaf level. */
-int leafLevel = levelCount - 2;
-writeLeaves(blockSize, leafNodeSize(blockSize), tree, leafLevel, f);
-}
-
-void cirTreeFileBulkIndexToOpenFile(
-	void *itemArray, int itemSize, bits64 itemCount, 
-	bits32 blockSize, bits32 itemsPerSlot,
-	void *context,
-	struct cirTreeRange (*fetchKey)(const void *va, void *context),
-	bits64 (*fetchOffset)(const void *va, void *context), 
-	bits64 endFileOffset, FILE *f)
-/* Create a r tree index from a sorted array, writing output starting at current position
- * of an already open file.  See rTreeFileCreate for explanation of parameters. */
-{
-int levelCount = 0;
-struct lm *lm = lmInit(0);
-struct rTree *tree = rTreeFromChromRangeArray(lm, blockSize, itemsPerSlot,
-	itemArray, itemSize, itemCount, context, fetchKey, fetchOffset, endFileOffset,
-	&levelCount);
-struct rTree dummyTree = {.startBase=0};
-if (tree == NULL) 
-    tree = &dummyTree;	// Work for empty files....
-bits32 magic = cirTreeSig;
-bits32 reserved = 0;
-writeOne(f, magic);
-writeOne(f, blockSize);
-writeOne(f, itemCount);
-writeOne(f, tree->startChromIx);
-writeOne(f, tree->startBase);
-writeOne(f, tree->endChromIx);
-writeOne(f, tree->endBase);
-writeOne(f, endFileOffset);
-writeOne(f, itemsPerSlot);
-writeOne(f, reserved);
-if (tree != &dummyTree)
-    writeTreeToOpenFile(tree, blockSize, levelCount, f);
-lmCleanup(&lm);
-}
-
-void cirTreeFileCreate(
-	void *itemArray, 	/* Sorted array of things to index. */
-	int itemSize, 		/* Size of each element in array. */
-	bits64 itemCount, 	/* Number of elements in array. */
-	bits32 blockSize,	/* R tree block size - # of children for each node. */
-	bits32 itemsPerSlot,	/* Number of items to put in each index slot at lowest level. */
-	void *context,		/* Context pointer for use by fetch call-back functions. */
-	struct cirTreeRange (*fetchKey)(const void *va, void *context),/* Given item, return key. */
-	bits64 (*fetchOffset)(const void *va, void *context), /* Given item, return file offset */
-	bits64 endFileOffset,				 /* Last position in file we index. */
-	char *fileName)                                  /* Name of output file. */
-/* Create a r tree index file from a sorted array. */
-{
-FILE *f = mustOpen(fileName, "wb");
-cirTreeFileBulkIndexToOpenFile(itemArray, itemSize, itemCount, blockSize, itemsPerSlot,
-	context, fetchKey, fetchOffset, endFileOffset, f);
-carefulClose(&f);
-}
-
-struct cirTreeFile *cirTreeFileAttach(char *fileName, struct udcFile *udc)
-/* Open up r-tree index file on previously open file, with cirTree
- * header at current file position. */
-{
-/* Open file and allocate structure to hold info from header etc. */
-struct cirTreeFile *crt = needMem(sizeof(*crt));
-crt->fileName = fileName;
-crt->udc = udc;
-
-/* Read magic number at head of file and use it to see if we are proper file type, and
- * see if we are byte-swapped. */
-bits32 magic;
-boolean isSwapped = FALSE;
-udcMustReadOne(udc, magic);
-if (magic != cirTreeSig)
-    {
-    magic = byteSwap32(magic);
-    isSwapped = crt->isSwapped = TRUE;
-    if (magic != cirTreeSig)
-       errAbort("%s is not a chromosome id r-tree index file", fileName);
-    }
-
-/* Read rest of defined bits of header, byte swapping as needed. */
-crt->blockSize = udcReadBits32(udc, isSwapped);
-crt->itemCount = udcReadBits64(udc, isSwapped);
-crt->startChromIx = udcReadBits32(udc, isSwapped);
-crt->startBase = udcReadBits32(udc, isSwapped);
-crt->endChromIx = udcReadBits32(udc, isSwapped);
-crt->endBase = udcReadBits32(udc, isSwapped);
-crt->fileSize = udcReadBits64(udc, isSwapped);
-crt->itemsPerSlot = udcReadBits32(udc, isSwapped);
-
-/* Skip over reserved bits of header. */
-bits32 reserved32;
-udcMustReadOne(udc, reserved32);
-
-/* Save position of root block of r tree. */
-crt->rootOffset = udcTell(udc);
-
-return crt;
-}
-
-struct cirTreeFile *cirTreeFileOpen(char *fileName)
-/* Open up r-tree index file - reading header and verifying things. */
-{
-return cirTreeFileAttach(cloneString(fileName), udcFileOpen(fileName, udcDefaultDir()));
-}
-
-void cirTreeFileDetach(struct cirTreeFile **pCrt)
-/* Detatch and free up cirTree file opened with cirTreeFileAttach. */
-{
-freez(pCrt);
-}
-
-void cirTreeFileClose(struct cirTreeFile **pCrt)
-/* Close and free up cirTree file opened with cirTreeFileAttach. */
-{
-struct cirTreeFile *crt = *pCrt;
-if (crt != NULL)
-    {
-    freez(&crt->fileName);
-    udcFileClose(&crt->udc);
-    cirTreeFileDetach(pCrt);
-    }
-}
-
-INLINE int cmpTwoBits32(bits32 aHi, bits32 aLo, bits32 bHi, bits32 bLo)
-/* Return - if b is less than a , 0 if equal, else +*/
-{
-if (aHi < bHi)
-    return 1;
-else if (aHi > bHi)
-    return -1;
-else
-    {
-    if (aLo < bLo)
-       return 1;
-    else if (aLo > bLo)
-       return -1;
-    else
-       return 0;
-    }
-}
-
-INLINE boolean cirTreeOverlaps(int qChrom, int qStart, int qEnd, 
-	int rStartChrom, int rStartBase, int rEndChrom, int rEndBase)
-{
-return cmpTwoBits32(qChrom, qStart, rEndChrom, rEndBase) > 0 &&
-       cmpTwoBits32(qChrom, qEnd, rStartChrom, rStartBase) < 0;
-}
-
-static void rFindOverlappingBlocks(struct cirTreeFile *crt, int level, bits64 indexFileOffset,
-	bits32 chromIx, bits32 start, bits32 end, struct fileOffsetSize **retList)
-/* Recursively find blocks with data. */
-{
-struct udcFile *udc = crt->udc;
-
-/* Seek to start of block. */
-udcSeek(udc, indexFileOffset);
-
-/* Read block header. */
-UBYTE isLeaf;
-UBYTE reserved;
-bits16 i, childCount;
-udcMustReadOne(udc, isLeaf);
-udcMustReadOne(udc, reserved);
-boolean isSwapped = crt->isSwapped;
-childCount = udcReadBits16(udc, isSwapped);
-
-verbose(3, "rFindOverlappingBlocks %llu %u:%u-%u.  childCount %d. isLeaf %d\n", indexFileOffset, chromIx, start, end, (int)childCount, (int)isLeaf);
-
-if (isLeaf)
-    {
-    /* Loop through node adding overlapping leaves to block list. */
-    for (i=0; i<childCount; ++i)
-        {
-	bits32 startChromIx = udcReadBits32(udc, isSwapped);
-	bits32 startBase = udcReadBits32(udc, isSwapped);
-	bits32 endChromIx = udcReadBits32(udc, isSwapped);
-	bits32 endBase = udcReadBits32(udc, isSwapped);
-	bits64 offset = udcReadBits64(udc, isSwapped);
-	bits64 size = udcReadBits64(udc, isSwapped);
-	if (cirTreeOverlaps(chromIx, start, end, startChromIx, startBase, endChromIx, endBase))
-	    {
-	    struct fileOffsetSize *block;
-	    AllocVar(block);
-	    block->offset = offset;
-	    block->size = size;
-	    slAddHead(retList, block);
-	    }
-	}
-    }
-else
-    {
-    /* Read node into arrays. */
-    bits32 startChromIx[childCount], startBase[childCount];
-    bits32 endChromIx[childCount], endBase[childCount];
-    bits64 offset[childCount];
-    for (i=0; i<childCount; ++i)
-        {
-	startChromIx[i] = udcReadBits32(udc, isSwapped);
-	startBase[i] = udcReadBits32(udc, isSwapped);
-	endChromIx[i] = udcReadBits32(udc, isSwapped);
-	endBase[i] = udcReadBits32(udc, isSwapped);
-	offset[i] = udcReadBits64(udc, isSwapped);
-	}
-
-    /* Recurse into child nodes that we overlap. */
-    for (i=0; i<childCount; ++i)
-	{
-	if (cirTreeOverlaps(chromIx, start, end, startChromIx[i], startBase[i], 
-		endChromIx[i], endBase[i]))
-	    {
-	    rFindOverlappingBlocks(crt, level+1, offset[i], chromIx, start, end, retList);
-	    }
-	}
-    }
-}
-
-struct fileOffsetSize *cirTreeFindOverlappingBlocks(struct cirTreeFile *crt, 
-	bits32 chromIx, bits32 start, bits32 end)
-/* Return list of file blocks that between them contain all items that overlap
- * start/end on chromIx.  Also there will be likely some non-overlapping items
- * in these blocks too. When done, use slListFree to dispose of the result. */
-{
-struct fileOffsetSize *blockList = NULL;
-rFindOverlappingBlocks(crt, 0, crt->rootOffset, chromIx, start, end, &blockList);
-slReverse(&blockList);
-return blockList;
-}
-
-static void rEnumerateBlocks(struct cirTreeFile *crt, int level, bits64 indexFileOffset,
-	struct fileOffsetSize **retList)
-/* Recursively find blocks with data. */
-{
-struct udcFile *udc = crt->udc;
-
-/* Seek to start of block. */
-udcSeek(udc, indexFileOffset);
-
-/* Read block header. */
-UBYTE isLeaf;
-UBYTE reserved;
-bits16 i, childCount;
-udcMustReadOne(udc, isLeaf);
-udcMustReadOne(udc, reserved);
-boolean isSwapped = crt->isSwapped;
-childCount = udcReadBits16(udc, isSwapped);
-
-verbose(3, "rEnumerateBlocks %llu childCount %d. isLeaf %d\n", indexFileOffset, (int)childCount, (int)isLeaf);
-
-if (isLeaf)
-    {
-    /* Loop through node adding overlapping leaves to block list. */
-    for (i=0; i<childCount; ++i)
-        {
-	udcReadBits32(udc, isSwapped);
-	udcReadBits32(udc, isSwapped);
-	udcReadBits32(udc, isSwapped);
-	udcReadBits32(udc, isSwapped);
-	bits64 offset = udcReadBits64(udc, isSwapped);
-	bits64 size = udcReadBits64(udc, isSwapped);
-        struct fileOffsetSize *block;
-        AllocVar(block);
-        block->offset = offset;
-        block->size = size;
-        slAddHead(retList, block);
-	}
-    }
-else
-    {
-    /* Read node into arrays. */
-    bits64 offset[childCount];
-    for (i=0; i<childCount; ++i)
-        { 
-	udcReadBits32(udc, isSwapped);
-	udcReadBits32(udc, isSwapped);
-	udcReadBits32(udc, isSwapped);
-	udcReadBits32(udc, isSwapped);
-	offset[i] = udcReadBits64(udc, isSwapped);
-	}
-
-    /* Recurse into child nodes that we overlap. */
-    for (i=0; i<childCount; ++i)
-	{
-	rEnumerateBlocks(crt, level+1, offset[i], retList);
-	}
-    }
-}
-
-struct fileOffsetSize *cirTreeEnumerateBlocks(struct cirTreeFile *crt)
-/* Return list of file blocks that between them contain all items that overlap
- * start/end on chromIx.  Also there will be likely some non-overlapping items
- * in these blocks too. When done, use slListFree to dispose of the result. */
-{
-struct fileOffsetSize *blockList = NULL;
-rEnumerateBlocks(crt, 0, crt->rootOffset, &blockList);
-slReverse(&blockList);
-return blockList;
-}
diff --git a/gbtools/src/blatSrc/lib/codebias.c b/gbtools/src/blatSrc/lib/codebias.c
deleted file mode 100644
index 9de37b4..0000000
--- a/gbtools/src/blatSrc/lib/codebias.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* codebias.c - stuff for managing codons and codon bias. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "hmmstats.h"
-#include "codebias.h"
-
-
-
-struct codonBias *codonLoadBias(char *fileName)
-/* Create scaled log codon bias tables based on .cod file.  
- * You can freeMem it when you're done. */
-{
-struct codonBias *cb;
-char line[1024];
-int lineCount = 0;
-char *words[128];
-int wordCount;
-int i = 0, j = 0;
-int skip = 0;
-boolean getMark0 = FALSE;
-boolean getMark1 = FALSE;
-FILE *f = mustOpen(fileName, "r");
-int val;
-
-AllocVar(cb);
-while (fgets(line, sizeof(line), f) )
-    {
-    ++lineCount;
-    if (skip)
-        {
-        skip -= 1;
-        continue;
-        }
-    if (getMark1)
-        {
-        wordCount = chopLine(line, words);
-        if (wordCount != 65)
-            errAbort("Bad line %d of %s\n", lineCount, fileName);
-        for (j=0; j<64; ++j)
-            {
-            val = atoi(words[j+1]);
-            if (val == 0)
-                cb->mark1[i][j] = scaledLog(1.0E-20);
-            else
-                cb->mark1[i][j] = scaledLog(0.001*val);
-            }
-        if ((i += 1) == 64)
-            getMark1 = FALSE;
-        }
-    else if (getMark0)
-        {
-        wordCount = chopLine(line, words);
-        if (wordCount != 64)
-            errAbort("Bad line %d of %s\n", lineCount, fileName);
-        for (j=0; j<64; ++j)
-            {
-            val = atoi(words[j]);
-            if (val == 0)
-                cb->mark0[j] = scaledLog(1.0E-20);
-            else
-                cb->mark0[j] = scaledLog(0.001*val);
-            }
-        getMark0 = FALSE;
-        }
-    else if (startsWith("Markov", line))
-        {
-        wordCount = chopLine(line, words);
-        if (wordCount != 2)
-            errAbort("Bad line %d of %s\n", lineCount, fileName);
-        if (sameString(words[1], "0"))
-            getMark0 = TRUE;
-        else if (sameString(words[1], "1"))
-            getMark1 = TRUE;
-        else
-            errAbort("Bad line %d of %s\n", lineCount, fileName);
-        skip = 3;
-        }
-    }
-fclose(f);
-return cb;
-}
-   
-static void unN(DNA *dna, int dnaSize)
-/* Turn N's into T's. */
-{
-int i;
-int val;
-for (i=0; i<dnaSize; ++i)
-    {
-    if ((val = ntVal[(int)dna[i]]) < 0)
-        dna[i] = 't';
-    }
-}
-
-int codonFindFrame(DNA *dna, int dnaSize, struct codonBias *forBias)
-/* Assuming a stretch of DNA is an exon, find most likely frame that it's in. 
- * Beware this routine will replace N's with T's in the input dna.*/
-{
-double logOneFourth = log(0.25);
-double logProbs[3];
-int frame;
-int dnaIx;
-double logP;
-double bestLogP = -0x6fffffff;
-int bestFrame = -1;
-int lastDnaStart = dnaSize-3;
-DNA *d;
-int codon = 0, lastCodon; 
-
-unN(dna, dnaSize);
-for (frame=0; frame<3; ++frame)
-    {
-    /* Partial first codon just gets even background score. */
-    logP = frame*logOneFourth;
-    /* 1st order model on first full codon. */
-    if (frame <= lastDnaStart)
-        {
-        d = dna+frame;
-        codon = (ntVal[(int)d[0]]<<4) + (ntVal[(int)d[1]]<<2) + ntVal[(int)d[2]];
-        logP += forBias->mark0[codon];
-        }
-    /* 2nd order model on subsequent full codons. */
-    for (dnaIx = frame+3; dnaIx <= lastDnaStart; dnaIx += 3)
-        {
-        lastCodon = codon;
-        d = dna+dnaIx;
-        codon = (ntVal[(int)d[0]]<<4) + (ntVal[(int)d[1]]<<2) + ntVal[(int)d[2]];
-        logP += forBias->mark1[lastCodon][codon];
-        }
-    /* Partial last codon gets even background score. */
-    logP += (dnaSize-dnaIx)*logOneFourth;
-    logProbs[frame] = logP;
-    if (logP > bestLogP)
-        {
-        bestLogP = logP;
-        bestFrame = frame;
-        }
-    }
-return bestFrame;
-}
-
-
-
diff --git a/gbtools/src/blatSrc/lib/colHash.c b/gbtools/src/blatSrc/lib/colHash.c
deleted file mode 100644
index 4d085ed..0000000
--- a/gbtools/src/blatSrc/lib/colHash.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* colHash - stuff for fast lookup of index given an
- * rgb value. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "memgfx.h"
-#include "colHash.h"
-
-
-struct colHash *colHashNew()
-/* Get a new color hash. */
-{
-struct colHash *cHash;
-AllocVar(cHash);
-cHash->freeEl = cHash->elBuf;
-return cHash;
-}
-
-void colHashFree(struct colHash **pEl)
-/* Free up color hash. */
-{
-freez(pEl);
-}
-
-struct colHashEl *colHashAdd(struct colHash *cHash, 
-	unsigned r, unsigned g, unsigned b, int ix)
-/* Add new element to color hash. */
-{
-struct colHashEl *che = cHash->freeEl++, **pCel;
-che->col.r = r;
-che->col.g = g;
-che->col.b = b;
-che->ix = ix;
-pCel = &cHash->lists[colHashFunc(r,g,b)];
-slAddHead(pCel, che);
-return che;
-}
-
-struct colHashEl *colHashLookup(struct colHash *cHash, 
-	unsigned r, unsigned g, unsigned b)
-/* Lookup value in hash. */
-{
-struct colHashEl *che;
-for (che = cHash->lists[colHashFunc(r,g,b)]; che != NULL; che = che->next)
-    if (che->col.r == r && che->col.g == g && che->col.b == b)
-	return che;
-return NULL;
-}
-
diff --git a/gbtools/src/blatSrc/lib/colHash.h b/gbtools/src/blatSrc/lib/colHash.h
deleted file mode 100644
index 85d81e8..0000000
--- a/gbtools/src/blatSrc/lib/colHash.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* colHash - stuff for fast lookup of index given an
- * rgb value. */
-
-/* Copyright (C) 2002 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-#ifndef COLHASH_H
-#define COLHASH_H
-
-#define colHashFunc(r,g,b) (r+g+g+b)
-
-struct colHashEl
-/* An element in a color hash. */
-    {
-    struct colHashEl *next;	/* Next in list. */
-    struct rgbColor col;	/* Color RGB. */
-    int ix;			/* Color Index. */
-    };
-
-struct colHash
-/* A hash on RGB colors. */
-    {
-    struct colHashEl *lists[4*256];	/* Hash chains. */
-    struct colHashEl elBuf[256];	/* Buffer of elements. */
-    struct colHashEl *freeEl;		/* Pointer to next free element. */
-    };
-
-struct colHash *colHashNew();
-/* Get a new color hash. */
-
-void colHashFree(struct colHash **pEl);
-/* Free up color hash. */
-
-struct colHashEl *colHashAdd(struct colHash *cHash, 
-	unsigned r, unsigned g, unsigned b, int ix);
-/* Add new element to color hash. */
-
-struct colHashEl *colHashLookup(struct colHash *cHash, 
-	unsigned r, unsigned g, unsigned b);
-/* Lookup value in hash. */
-
-#endif /* COLHASH_H */
diff --git a/gbtools/src/blatSrc/lib/common.c b/gbtools/src/blatSrc/lib/common.c
deleted file mode 100644
index 95b281d..0000000
--- a/gbtools/src/blatSrc/lib/common.c
+++ /dev/null
@@ -1,3537 +0,0 @@
-/* Commonly used routines in a wide range of applications.
- * Strings, singly-linked lists, and a little file i/o.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "errAbort.h"
-#include "portable.h"
-#include "linefile.h"
-#include "hash.h"
-
-
-void *cloneMem(void *pt, size_t size)
-/* Allocate a new buffer of given size, and copy pt to it. */
-{
-void *newPt = needLargeMem(size);
-memcpy(newPt, pt, size);
-return newPt;
-}
-
-static char *cloneStringZExt(const char *s, int size, int copySize)
-/* Make a zero terminated copy of string in memory */
-{
-char *d = needMem(copySize+1);
-copySize = min(size,copySize);
-memcpy(d, s, copySize);
-d[copySize] = 0;
-return d;
-}
-
-char *cloneStringZ(const char *s, int size)
-/* Make a zero terminated copy of string in memory */
-{
-return cloneStringZExt(s, strlen(s), size);
-}
-
-char *cloneString(const char *s)
-/* Make copy of string in dynamic memory */
-{
-int size = 0;
-if (s == NULL)
-    return NULL;
-size = strlen(s);
-return cloneStringZExt(s, size, size);
-}
-
-char *cloneLongString(char *s)
-/* Make clone of long string. */
-{
-size_t size = strlen(s);
-return cloneMem(s, size+1);
-}
-
-char *catTwoStrings(char *a, char *b)
-/* Allocate new string that is a concatenation of two strings. */
-{
-int aLen = strlen(a), bLen = strlen(b);
-int len = aLen + bLen;
-char *newBuf = needLargeMem(len+1);
-memcpy(newBuf, a, aLen);
-memcpy(newBuf+aLen, b, bLen);
-newBuf[len] = 0;
-return newBuf;
-}
-
-/* Reverse the order of the bytes. */
-void reverseBytes(char *bytes, long length)
-{
-long halfLen = (length>>1);
-char *end = bytes+length;
-char c;
-while (--halfLen >= 0)
-    {
-    c = *bytes;
-    *bytes++ = *--end;
-    *end = c;
-    }
-}
-
-void reverseInts(int *a, int length)
-/* Reverse the order of the integer array. */
-{
-int halfLen = (length>>1);
-int *end = a+length;
-int c;
-while (--halfLen >= 0)
-    {
-    c = *a;
-    *a++ = *--end;
-    *end = c;
-    }
-}
-
-void reverseUnsigned(unsigned *a, int length)
-/* Reverse the order of the unsigned array. */
-{
-int halfLen = (length>>1);
-unsigned *end = a+length;
-unsigned c;
-while (--halfLen >= 0)
-    {
-    c = *a;
-    *a++ = *--end;
-    *end = c;
-    }
-}
-
-void reverseDoubles(double *a, int length)
-/* Reverse the order of the double array. */
-{
-int halfLen = (length>>1);
-double *end = a+length;
-double c;
-while (--halfLen >= 0)
-    {
-    c = *a;
-    *a++ = *--end;
-    *end = c;
-    }
-}
-
-void reverseStrings(char **a, int length)
-/* Reverse the order of the char* array. */
-{
-int halfLen = (length>>1);
-char **end = a+length;
-char *c;
-while (--halfLen >= 0)
-    {
-    c = *a;
-    *a++ = *--end;
-    *end = c;
-    }
-}
-
-/* Swap buffers a and b. */
-void swapBytes(char *a, char *b, int length)
-{
-char c;
-int i;
-
-for (i=0; i<length; ++i)
-    {
-    c = a[i];
-    a[i] = b[i];
-    b[i] = c;
-    }
-}
-
-
-/** List managing routines. */
-
-/* Count up elements in list. */
-int slCount(const void *list)
-{
-struct slList *pt = (struct slList *)list;
-int len = 0;
-
-while (pt != NULL)
-    {
-    len += 1;
-    pt = pt->next;
-    }
-return len;
-}
-
-void *slElementFromIx(void *list, int ix)
-/* Return the ix'th element in list.  Returns NULL
- * if no such element. */
-{
-struct slList *pt = (struct slList *)list;
-int i;
-for (i=0;i<ix;i++)
-    {
-    if (pt == NULL) return NULL;
-    pt = pt->next;
-    }
-return pt;
-}
-
-int slIxFromElement(void *list, void *el)
-/* Return index of el in list.  Returns -1 if not on list. */
-{
-struct slList *pt;
-int ix = 0;
-
-for (pt = list, ix=0; pt != NULL; pt = pt->next, ++ix)
-    if (el == (void*)pt)
-	return ix;
-return -1;
-}
-
-void *slLastEl(void *list)
-/* Returns last element in list or NULL if none. */
-{
-struct slList *next, *el;
-if ((el = list) == NULL)
-    return NULL;
-while ((next = el->next) != NULL)
-    el = next;
-return el;
-}
-
-/* Add new node to tail of list.
- * Usage:
- *    slAddTail(&list, node);
- * where list and nodes are both pointers to structure
- * that begin with a next pointer.
- */
-void slAddTail(void *listPt, void *node)
-{
-struct slList **ppt = (struct slList **)listPt;
-struct slList *n = (struct slList *)node;
-
-while (*ppt != NULL)
-    {
-    ppt = &((*ppt)->next);
-    }
-n->next = NULL;
-*ppt = n;
-}
-
-void *slPopHead(void *vListPt)
-/* Return head of list and remove it from list. (Fast) */
-{
-struct slList **listPt = (struct slList **)vListPt;
-struct slList *el = *listPt;
-if (el != NULL)
-    {
-    *listPt = el->next;
-    el->next = NULL;
-    }
-return el;
-}
-
-void *slPopTail(void *vListPt)
-/* Return tail of list and remove it from list. (Not so fast) */
-{
-struct slList **listPt = (struct slList **)vListPt;
-struct slList *el = *listPt;
-if (el != NULL)
-    {
-    for (;;)
-        {
-        if (el->next == NULL)
-            {
-            *listPt = NULL;
-            break;
-            }
-        listPt = &el->next;
-        el = el->next;
-        }
-    }
-return el;
-}
-
-
-
-void *slCat(void *va, void *vb)
-/* Return concatenation of lists a and b.
- * Example Usage:
- *   struct slName *a = getNames("a");
- *   struct slName *b = getNames("b");
- *   struct slName *ab = slCat(a,b)
- */
-{
-struct slList *a = va;
-struct slList *b = vb;
-struct slList *end;
-if (a == NULL)
-    return b;
-for (end = a; end->next != NULL; end = end->next)
-    ;
-end->next = b;
-return a;
-}
-
-void slReverse(void *listPt)
-/* Reverse order of a list.
- * Usage:
- *    slReverse(&list);
- */
-{
-struct slList **ppt = (struct slList **)listPt;
-struct slList *newList = NULL;
-struct slList *el, *next;
-
-next = *ppt;
-while (next != NULL)
-    {
-    el = next;
-    next = el->next;
-    el->next = newList;
-    newList = el;
-    }
-*ppt = newList;
-}
-
-void slFreeList(void *listPt)
-/* Free list */
-{
-struct slList **ppt = (struct slList**)listPt;
-struct slList *next = *ppt;
-struct slList *el;
-
-while (next != NULL)
-    {
-    el = next;
-    next = el->next;
-    freeMem((char*)el);
-    }
-*ppt = NULL;
-}
-
-void slSort(void *pList, int (*compare )(const void *elem1,  const void *elem2))
-/* Sort a singly linked list with Qsort and a temporary array. */
-{
-struct slList **pL = (struct slList **)pList;
-struct slList *list = *pL;
-int count;
-count = slCount(list);
-if (count > 1)
-    {
-    struct slList *el;
-    struct slList **array;
-    int i;
-    array = needLargeMem(count * sizeof(*array));
-    for (el = list, i=0; el != NULL; el = el->next, i++)
-        array[i] = el;
-    qsort(array, count, sizeof(array[0]), compare);
-    list = NULL;
-    for (i=0; i<count; ++i)
-        {
-        array[i]->next = list;
-        list = array[i];
-        }
-    freeMem(array);
-    slReverse(&list);
-    *pL = list;
-    }
-}
-
-void slUniqify(void *pList, int (*compare )(const void *elem1,  const void *elem2), void (*free)())
-/* Return sorted list with duplicates removed.
- * Compare should be same type of function as slSort's compare (taking
- * pointers to pointers to elements.  Free should take a simple
- * pointer to dispose of duplicate element, and can be NULL. */
-{
-struct slList **pSlList = (struct slList **)pList;
-struct slList *oldList = *pSlList;
-struct slList *newList = NULL, *el;
-
-slSort(&oldList, compare);
-while ((el = slPopHead(&oldList)) != NULL)
-    {
-    if ((newList == NULL) || (compare(&newList, &el) != 0))
-        slAddHead(&newList, el);
-    else if (free != NULL)
-        free(el);
-    }
-slReverse(&newList);
-*pSlList = newList;
-}
-
-void slSortMerge(void *pA, void *b, CmpFunction *compare)
-// Merges and sorts a pair of singly linked lists using slSort.
-{
-struct slList **pList = (struct slList **)pA;
-slCat(*pList, b);
-slSort(pList,compare);
-}
-
-void slSortMergeUniq(void *pA, void *b, CmpFunction *compare, void (*free)())
-// Merges and sorts a pair of singly linked lists leaving only unique
-// items via slUniqufy.  duplicate itens are defined by the compare routine
-// returning 0. If free is provided, items dropped from list can disposed of.
-{
-struct slList **pList = (struct slList **)pA;
-*pList = slCat(*pList, b);
-slUniqify(pList,compare,free);
-}
-
-boolean slRemoveEl(void *vpList, void *vToRemove)
-/* Remove element from singly linked list.  Usage:
- *    slRemove(&list, el);
- * Returns TRUE if element in list.  */
-{
-struct slList **pList = vpList;
-struct slList *toRemove = vToRemove;
-struct slList *el, *next, *newList = NULL;
-boolean didRemove = FALSE;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    if (el != toRemove)
-	{
-	slAddHead(&newList, el);
-	}
-    else
-        didRemove = TRUE;
-    }
-slReverse(&newList);
-*pList = newList;
-return didRemove;
-}
-
-struct slInt *slIntNew(int x)
-/* Return a new int. */
-{
-struct slInt *a;
-AllocVar(a);
-a->val = x;
-return a;
-}
-
-int slIntCmp(const void *va, const void *vb)
-/* Compare two slInts. */
-{
-const struct slInt *a = *((struct slInt **)va);
-const struct slInt *b = *((struct slInt **)vb);
-return a->val - b->val;
-}
-
-int slIntCmpRev(const void *va, const void *vb)
-/* Compare two slInts in reverse direction. */
-{
-const struct slInt *a = *((struct slInt **)va);
-const struct slInt *b = *((struct slInt **)vb);
-return b->val - a->val;
-}
-
-struct slInt * slIntFind(struct slInt *list, int target)
-/* Find target in slInt list or return NULL */
-{
-struct slInt *i;
-for (i=list;i;i=i->next)
-    if (i->val == target)
-	return i;
-return NULL;
-}
-
-struct slUnsigned *slUnsignedNew(unsigned x)
-/* Return a new int. */
-{
-struct slUnsigned *a;
-AllocVar(a);
-a->val = x;
-return a;
-}
-
-static int doubleCmp(const void *va, const void *vb)
-/* Compare function to sort array of doubles. */
-{
-const double *a = va;
-const double *b = vb;
-double diff = *a - *b;
-if (diff < 0)
-    return -1;
-else if (diff > 0)
-    return 1;
-else
-    return 0;
-}
-
-void doubleSort(int count, double *array)
-/* Sort an array of doubles. */
-{
-if (count > 1)
-qsort(array, count, sizeof(array[0]), doubleCmp);
-}
-
-double doubleMedian(int count, double *array)
-/* Return median value in array.  This will sort
- * the array as a side effect. */
-{
-double median;
-doubleSort(count, array);
-if ((count&1) == 1)
-    median = array[count>>1];
-else
-    {
-    count >>= 1;
-    median = (array[count] + array[count-1]) * 0.5;
-    }
-return median;
-}
-
-void doubleBoxWhiskerCalc(int count, double *array, double *retMin,
-                          double *retQ1, double *retMedian, double *retQ3, double *retMax)
-/* Calculate what you need to draw a box and whiskers plot from an array of doubles. */
-{
-if (count <= 0)
-    errAbort("doubleBoxWhiskerCalc needs a positive number, not %d for count", count);
-if (count == 1)
-    {
-    *retMin = *retQ1 = *retMedian = *retQ3 = *retMax = array[0];
-    return;
-    }
-doubleSort(count, array);
-double min = array[0];
-double max = array[count-1];
-double median;
-int halfCount = count>>1;
-if ((count&1) == 1)
-    median = array[halfCount];
-else
-    {
-    median = (array[halfCount] + array[halfCount-1]) * 0.5;
-    }
-double q1, q3;
-if (count <= 3)
-    {
-    q1 = 0.5 * (median + min);
-    q3 = 0.5 * (median + max);
-    }
-else
-    {
-    int q1Ix = count/4;
-    int q3Ix = count - 1 - q1Ix;
-    uglyf("count %d, q1Ix %d, q3Ix %d\n", count, q1Ix, q3Ix);
-    q1 = array[q1Ix];
-    q3 = array[q3Ix];
-    }
-*retMin = min;
-*retQ1 = q1;
-*retMedian = median;
-*retQ3 = q3;
-*retMax = max;
-}
-
-struct slDouble *slDoubleNew(double x)
-/* Return a new double. */
-{
-struct slDouble *a;
-AllocVar(a);
-a->val = x;
-return a;
-}
-
-int slDoubleCmp(const void *va, const void *vb)
-/* Compare two slDoubles. */
-{
-const struct slDouble *a = *((struct slDouble **)va);
-const struct slDouble *b = *((struct slDouble **)vb);
-double diff = a->val - b->val;
-if (diff < 0)
-    return -1;
-else if (diff > 0)
-    return 1;
-else
-    return 0;
-}
-
-double slDoubleMedian(struct slDouble *list)
-/* Return median value on list. */
-{
-int i,count = slCount(list);
-struct slDouble *el;
-double *array, median;
-if (count == 0)
-    errAbort("Can't take median of empty list");
-AllocArray(array,count);
-for (i=0, el=list; i<count; ++i, el=el->next)
-    array[i] = el->val;
-median = doubleMedian(count, array);
-freeMem(array);
-return median;
-}
-
-void slDoubleBoxWhiskerCalc(struct slDouble *list, double *retMin,
-                            double *retQ1, double *retMedian, double *retQ3, double *retMax)
-/* Calculate what you need to draw a box and whiskers plot from a list of slDoubles. */
-{
-int i,count = slCount(list);
-struct slDouble *el;
-double *array;
-if (count == 0)
-    errAbort("Can't take do slDoubleBoxWhiskerCalc of empty list");
-AllocArray(array,count);
-for (i=0, el=list; i<count; ++i, el=el->next)
-    array[i] = el->val;
-doubleBoxWhiskerCalc(count, array, retMin, retQ1, retMedian, retQ3, retMax);
-freeMem(array);
-}
-
-static int intCmp(const void *va, const void *vb)
-/* Compare function to sort array of ints. */
-{
-const int *a = va;
-const int *b = vb;
-int diff = *a - *b;
-if (diff < 0)
-    return -1;
-else if (diff > 0)
-    return 1;
-else
-    return 0;
-}
-
-void intSort(int count, int *array)
-/* Sort an array of ints. */
-{
-if (count > 1)
-qsort(array, count, sizeof(array[0]), intCmp);
-}
-
-int intMedian(int count, int *array)
-/* Return median value in array.  This will sort
- * the array as a side effect. */
-{
-int median;
-intSort(count, array);
-if ((count&1) == 1)
-    median = array[count>>1];
-else
-    {
-    count >>= 1;
-    median = (array[count] + array[count-1]) * 0.5;
-    }
-return median;
-}
-
-
-struct slName *newSlName(char *name)
-/* Return a new name. */
-{
-struct slName *sn;
-if (name != NULL)
-    {
-    int len = strlen(name);
-    sn = needMem(sizeof(*sn)+len);
-    strcpy(sn->name, name);
-    return sn;
-    }
-else
-    {
-    AllocVar(sn);
-    }
-return sn;
-}
-
-struct slName *slNameNewN(char *name, int size)
-/* Return new slName of given size. */
-{
-struct slName *sn = needMem(sizeof(*sn) + size);
-memcpy(sn->name, name, size);
-return sn;
-}
-
-int slNameCmpCase(const void *va, const void *vb)
-/* Compare two slNames, ignore case. */
-{
-const struct slName *a = *((struct slName **)va);
-const struct slName *b = *((struct slName **)vb);
-return strcasecmp(a->name, b->name);
-}
-
-void slNameSortCase(struct slName **pList)
-/* Sort slName list, ignore case. */
-{
-slSort(pList, slNameCmpCase);
-}
-
-int slNameCmp(const void *va, const void *vb)
-/* Compare two slNames. */
-{
-const struct slName *a = *((struct slName **)va);
-const struct slName *b = *((struct slName **)vb);
-return strcmp(a->name, b->name);
-}
-
-int slNameCmpStringsWithEmbeddedNumbers(const void *va, const void *vb)
-/* Compare strings such as gene names that may have embedded numbers,
- * so that bmp4a comes before bmp14a */
-{
-const struct slName *a = *((struct slName **)va);
-const struct slName *b = *((struct slName **)vb);
-return cmpStringsWithEmbeddedNumbers(a->name, b->name);
-}
-
-
-
-void slNameSort(struct slName **pList)
-/* Sort slName list. */
-{
-slSort(pList, slNameCmp);
-}
-
-boolean slNameInList(struct slName *list, char *string)
-/* Return true if string is in name list -- case insensitive. */
-{
-struct slName *el;
-for (el = list; el != NULL; el = el->next)
-    if (sameWord(string, el->name))
-        return TRUE;
-return FALSE;
-}
-
-boolean slNameInListUseCase(struct slName *list, char *string)
-/* Return true if string is in name list -- case sensitive. */
-{
-struct slName *el;
-for (el = list; el != NULL; el = el->next)
-    if (string != NULL && !strcmp(string, el->name))
-        return TRUE;
-return FALSE;
-}
-
-void *slNameFind(void *list, char *string)
-/* Return first element of slName list (or any other list starting
- * with next/name fields) that matches string. */
-{
-struct slName *el;
-for (el = list; el != NULL; el = el->next)
-    if (sameWord(string, el->name))
-        return el;
-return NULL;
-}
-
-int slNameFindIx(struct slName *list, char *string)
-/* Return index of first element of slName list (or any other
- * list starting with next/name fields) that matches string.
- * Return -1 if not found. */
-{
-struct slName *el;
-int ix = 0;
-for (el = list; el != NULL; el = el->next, ix++)
-    if (sameString(string, el->name))
-        return ix;
-return -1;
-}
-
-char *slNameStore(struct slName **pList, char *string)
-/* Put string into list if it's not there already.
- * Return the version of string stored in list. */
-{
-struct slName *el;
-for (el = *pList; el != NULL; el = el->next)
-    {
-    if (sameString(string, el->name))
-	return el->name;
-    }
-el = newSlName(string);
-slAddHead(pList, el);
-return el->name;
-}
-
-struct slName *slNameAddHead(struct slName **pList, char *name)
-/* Add name to start of list and return it. */
-{
-struct slName *el = slNameNew(name);
-slAddHead(pList, el);
-return el;
-}
-
-struct slName *slNameAddTail(struct slName **pList, char *name)
-/* Add name to end of list (not efficient for long lists),
- * and return it. */
-{
-struct slName *el = slNameNew(name);
-slAddTail(pList, el);
-return el;
-}
-
-struct slName *slNameCloneList(struct slName *list)
-/* Return clone of list. */
-{
-struct slName *el, *newEl, *newList = NULL;
-for (el = list; el != NULL; el = el->next)
-    {
-    newEl = slNameNew(el->name);
-    slAddHead(&newList, newEl);
-    }
-slReverse(&newList);
-return newList;
-}
-
-
-struct slName *slNameListFromString(char *s, char delimiter)
-/* Return list of slNames gotten from parsing delimited string.
- * The final delimiter is optional. a,b,c  and a,b,c, are equivalent
- * for comma-delimited lists. */
-{
-char *e;
-struct slName *list = NULL, *el;
-while (s != NULL && s[0] != 0)
-    {
-    e = strchr(s, delimiter);
-    if (e == NULL)
-	el = slNameNew(s);
-    else
-	{
-        el = slNameNewN(s, e-s);
-	e += 1;
-	}
-    slAddHead(&list, el);
-    s = e;
-    }
-slReverse(&list);
-return list;
-}
-
-struct slName *slNameListOfUniqueWords(char *text,boolean respectQuotes)
-// Return list of unique words found by parsing string delimited by whitespace.
-// If respectQuotes then ["Lucy and Ricky" 'Fred and Ethyl'] will yield 2 slNames no quotes
-{
-struct slName *list = NULL;
-char *word = NULL;
-while (text != NULL)
-    {
-    if (respectQuotes)
-        {
-        word = nextWordRespectingQuotes(&text);
-        if (word != NULL)
-            {
-            if (word[0] == '"')
-                stripChar(word, '"');
-            else if (word[0] == '\'')
-                stripChar(word, '\'');
-            }
-        }
-    else
-        word = nextWord(&text);
-    if (word)
-        slNameStore(&list, word);
-    else
-        break;
-    }
-
-slReverse(&list);
-return list;
-}
-
-struct slName *slNameListFromStringArray(char *stringArray[], int arraySize)
-/* Return list of slNames from an array of strings of length arraySize.
- * If a string in the array is NULL, the array will be treated as
- * NULL-terminated (shorter than arraySize). */
-{
-char *s;
-struct slName *list = NULL, *el;
-int i;
-if (stringArray == NULL)
-    return NULL;
-for (i = 0;  i < arraySize;  i++)
-    {
-    s = stringArray[i];
-    if (s == NULL)
-	break;
-    el = slNameNew(s);
-    slAddHead(&list, el);
-    }
-slReverse(&list);
-return list;
-}
-
-char *slNameListToString(struct slName *list, char delimiter)
-/* Return string created by joining all names with the delimiter. */
-{
-struct slName *el;
-int elCount = 0;
-int len = 0;
-char del[2];
-char *s;
-
-del[0] = delimiter;
-del[1] = '\0';
-
-for (el = list; el != NULL; el = el->next, elCount++)
-	len += strlen(el->name);
-len += elCount;
-
-AllocArray(s, len);
-
-for (el = list; el != NULL; el = el->next)
-	{
-	strcat(s, el->name);
-	if (el->next != NULL)
-		strcat(s, del);
-	}
-return s;
-}
-
-struct slName *slNameLoadReal(char *fileName)
-/* load file lines that are not blank or start with a '#' into a slName
- * list */
-{
-struct slName *lines = NULL;
-char *line;
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-while (lineFileNextReal(lf, &line))
-    slSafeAddHead(&lines, slNameNew(line));
-lineFileClose(&lf);
-slReverse(&lines);
-return lines;
-}
-
-struct slName *slNameIntersection(struct slName *a, struct slName *b)
-/* return intersection of two slName lists.  */
-{
-struct hash *hashA = newHash(0);
-struct slName *el, *retval = NULL;
-
-for (el = a; el != NULL; el = el->next)
-    hashAddInt(hashA, el->name, 1);
-for (el = b; el != NULL; el = el->next)
-    if(hashLookup(hashA, el->name) != NULL)
-        slNameAddHead(&retval, el->name);
-hashFree(&hashA);
-return retval;
-}
-
-struct slRef *refOnList(struct slRef *refList, void *val)
-/* Return ref if val is already on list, otherwise NULL. */
-{
-struct slRef *ref;
-for (ref = refList; ref != NULL; ref = ref->next)
-    if (ref->val == val)
-        return ref;
-return NULL;
-}
-
-struct slRef *slRefNew(void *val)
-/* Create new slRef element. */
-{
-struct slRef *ref;
-AllocVar(ref);
-ref->val = val;
-return ref;
-}
-
-void refAdd(struct slRef **pRefList, void *val)
-/* Add reference to list. */
-{
-struct slRef *ref;
-AllocVar(ref);
-ref->val = val;
-slAddHead(pRefList, ref);
-}
-
-void refAddUnique(struct slRef **pRefList, void *val)
-/* Add reference to list if not already on list. */
-{
-if (refOnList(*pRefList, val) == NULL)
-    {
-    refAdd(pRefList, val);
-    }
-}
-
-void slRefFreeListAndVals(struct slRef **pList)
-/* Free up (with simple freeMem()) each val on list, and the list itself as well. */
-{
-struct slRef *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    freeMem(el->val);
-    freeMem(el);
-    }
-*pList = NULL;
-}
-
-struct slRef *refListFromSlList(void *list)
-/* Make a reference list that mirrors a singly-linked list. */
-{
-struct slList *el;
-struct slRef *refList = NULL, *ref;
-for (el= list; el != NULL; el = el->next)
-    {
-    ref = slRefNew(el);
-    slAddHead(&refList, ref);
-    }
-slReverse(&refList);
-return refList;
-}
-
-
-struct slPair *slPairNew(char *name, void *val)
-/* Allocate new name/value pair. */
-{
-struct slPair *el;
-AllocVar(el);
-el->name = cloneString(name);
-el->val = val;
-return el;
-}
-
-void slPairAdd(struct slPair **pList, char *name, void *val)
-/* Add new slPair to head of list. */
-{
-struct slPair *el = slPairNew(name, val);
-slAddHead(pList, el);
-}
-
-void slPairFree(struct slPair **pEl)
-/* Free up struct and name.  (Don't free up values.) */
-{
-struct slPair *el = *pEl;
-if (el != NULL)
-    {
-    freeMem(el->name);
-    freez(pEl);
-    }
-}
-
-void slPairFreeList(struct slPair **pList)
-/* Free up list.  (Don't free up values.) */
-{
-struct slPair *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    slPairFree(&el);
-    }
-*pList = NULL;
-}
-
-void slPairFreeVals(struct slPair *list)
-/* Free up all values on list. */
-{
-struct slPair *el;
-for (el = list; el != NULL; el = el->next)
-    freez(&el->val);
-}
-
-void slPairFreeValsAndList(struct slPair **pList)
-/* Free up all values on list and list itself */
-{
-slPairFreeVals(*pList);
-slPairFreeList(pList);
-}
-
-struct slPair *slPairFind(struct slPair *list, char *name)
-/* Return list element of given name, or NULL if not found. */
-{
-struct slPair *el;
-for (el = list; el != NULL; el = el->next)
-    if (sameString(name, el->name))
-        break;
-return el;
-}
-
-void *slPairFindVal(struct slPair *list, char *name)
-/* Return value associated with name in list, or NULL if not found. */
-{
-struct slPair *el = slPairFind(list, name);
-if (el == NULL)
-    return NULL;
-return el->val;
-}
-
-struct slPair *slPairListFromString(char *str,boolean respectQuotes)
-// Return slPair list parsed from list in string like:  [name1=val1 name2=val2 ...]
-// if respectQuotes then string can have double quotes: [name1="val 1" "name 2"=val2 ...]
-//    resulting pair strips quotes: {name1}={val 1},{name 2}={val2}
-// Returns NULL if parse error.  Free this up with slPairFreeValsAndList.
-{
-char *s = skipLeadingSpaces(str);  // Would like to remove this and tighten up the standard someday.
-if (isEmpty(s))
-    return NULL;
-
-struct slPair *list = NULL;
-char name[1024];
-char val[1024];
-char buf[1024];
-bool inQuote = FALSE;
-char *b = buf;
-char sep = '=';
-char c = ' ';
-int mode = 0;
-while(1)
-    {
-    c = *s++;
-    if (mode == 0 || mode == 2) // reading name or val
-	{
-	boolean term = FALSE;
-	if (respectQuotes && b == buf && !inQuote && c == '"')
-	    inQuote = TRUE;
-	else if (inQuote && c == '"')
-	    term = TRUE;
-	else if ((c == sep || c == 0) && !inQuote)
-	    {
-	    term = TRUE;
-	    --s;  // rewind
-	    }
-	else if (c == ' ' && !inQuote)
-	    {
-	    warn("slPairListFromString: Unexpected whitespace in %s", str);
-	    return NULL;
-	    }
-	else if (c == 0 && inQuote)
-	    {
-	    warn("slPairListFromString: Unterminated quote in %s", str);
-	    return NULL;
-	    }
-	else
-	    {
-	    *b++ = c;
-	    if ((b - buf) > sizeof buf)
-		{
-		warn("slPairListFromString: pair name or value too long in %s", str);
-		return NULL;
-		}
-	    }
-	if (term)
-	    {
-	    inQuote = FALSE;
-	    *b = 0;
-	    if (mode == 0)
-		{
-		safecpy(name, sizeof name, buf);
-		if (strlen(name)<1)
-		    {
-		    warn("slPairListFromString: Pair name cannot be empty in %s", str);
-		    return NULL;
-		    }
-		// Shall we check for name being alphanumeric, at least for the respectQuotes=FALSE case?
-		}
-	    else // mode == 2
-                {
-		safecpy(val, sizeof val, buf);
-		if (!respectQuotes && (hasWhiteSpace(name) || hasWhiteSpace(val))) // should never happen
-		    {
-		    warn("slPairListFromString() Unexpected white space in name=value pair: [%s]=[%s] in string=[%s]\n", name, val, str);
-		    break;
-		    }
-		slPairAdd(&list, name, cloneString(val));
-		}
-	    ++mode;
-	    }
-	}
-    else if (mode == 1) // read required "=" sign
-	{
-	if (c != '=')
-	    {
-	    warn("slPairListFromString: Expected character = after name in %s", str);
-	    return NULL;
-            }
-	++mode;
-	sep = ' ';
-	b = buf;
-	}
-    else // (mode == 3) reading optional separating space
-	{
-	if (c == 0)
-	    break;
-	if (c != ' ')
-	    {
-	    mode = 0;
-	    --s;
-	    b = buf;
-	    sep = '=';
-	    }
-	}
-    }
-slReverse(&list);
-return list;
-}
-
-char *slPairListToString(struct slPair *list,boolean quoteIfSpaces)
-// Returns an allocated string of pairs in form of [name1=val1 name2=val2 ...]
-// If requested, will wrap name or val in quotes if contain spaces: [name1="val 1" "name 2"=val2]
-{
-// Don't rely on dyString.  We should do the accounting ourselves and not create extra dependencies.
-int count = 0;
-struct slPair *pair = list;
-for (;pair != NULL; pair = pair->next)
-    {
-    assert(pair->name != NULL && pair->val != NULL); // Better assert and get this over with,
-                                                     // complete with stack
-    count += strlen(pair->name);
-    count += strlen((char *)(pair->val));
-    count += 2; // = and ' ' delimit
-    if (quoteIfSpaces)
-        {
-        if (hasWhiteSpace(pair->name))
-            count += 2; // " and "
-        if (hasWhiteSpace((char *)(pair->val)))
-            count += 2; // " and "
-        }
-    }
-if (count == 0)
-    return NULL;
-
-char *str = needMem(count+5); // A bit of slop
-
-char *strPtr = str;
-for (pair = list; pair != NULL; pair = pair->next, strPtr += strlen(strPtr))
-    {
-    if (pair != list) // Not first cycle
-        *strPtr++ = ' ';
-    if (hasWhiteSpace(pair->name))
-        {
-        if (quoteIfSpaces)
-            sprintf(strPtr,"\"%s\"=",pair->name);
-        else
-            {
-            warn("slPairListToString() Unexpected white space in name: [%s]\n", pair->name);
-            sprintf(strPtr,"%s=",pair->name); // warn but still make string
-            }
-        }
-    else
-        sprintf(strPtr,"%s=",pair->name);
-    strPtr += strlen(strPtr);
-    if (hasWhiteSpace((char *)(pair->val)))
-        {
-        if (quoteIfSpaces)
-            sprintf(strPtr,"\"%s\"",(char *)(pair->val));
-        else
-            {
-            warn("slPairListToString() Unexpected white space in val: [%s]\n", (char *)(pair->val));
-            sprintf(strPtr,"%s",(char *)(pair->val)); // warn but still make string
-            }
-        }
-    else
-        sprintf(strPtr,"%s",(char *)(pair->val));
-    }
-return str;
-}
-
-char *slPairNameToString(struct slPair *list, char delimiter,boolean quoteIfSpaces)
-// Return string created by joining all names (ignoring vals) with the delimiter.
-// If requested, will wrap name in quotes if contain spaces: [name1,"name 2" ...]
-{
-int elCount = 0;
-int count = 0;
-struct slPair *pair = list;
-for (; pair != NULL; pair = pair->next, elCount++)
-    {
-    assert(pair->name != NULL);
-    count += strlen(pair->name);
-    if (quoteIfSpaces && hasWhiteSpace(pair->name))
-        count += 2;
-    }
-count += elCount;
-if (count == 0)
-    return NULL;
-
-char *str = needMem(count+5); // A bit of slop
-
-char *strPtr = str;
-for (pair = list; pair != NULL; pair = pair->next, strPtr += strlen(strPtr))
-    {
-    if (pair != list)
-        *strPtr++ = delimiter;
-    if (hasWhiteSpace(pair->name))
-        {
-        if (quoteIfSpaces)
-            sprintf(strPtr,"\"%s\"",pair->name);
-        else
-            {
-            if (delimiter == ' ')  // if delimied by commas, this is entirely okay!
-                warn("slPairListToString() Unexpected white space in name delimied by space: "
-                     "[%s]\n", pair->name);
-            sprintf(strPtr,"%s",pair->name); // warn but still make string
-            }
-        }
-    else
-        sprintf(strPtr,"%s",pair->name);
-    }
-return str;
-}
-
-int slPairCmpCase(const void *va, const void *vb)
-/* Compare two slPairs, ignore case. */
-{
-const struct slPair *a = *((struct slPair **)va);
-const struct slPair *b = *((struct slPair **)vb);
-return strcasecmp(a->name, b->name);
-}
-
-void slPairSortCase(struct slPair **pList)
-/* Sort slPair list, ignore case. */
-{
-slSort(pList, slPairCmpCase);
-}
-
-int slPairCmp(const void *va, const void *vb)
-/* Compare two slPairs. */
-{
-const struct slPair *a = *((struct slPair **)va);
-const struct slPair *b = *((struct slPair **)vb);
-return strcmp(a->name, b->name);
-}
-
-int slPairValCmpCase(const void *va, const void *vb)
-/* Case insensitive compare two slPairs on their values (must be string). */
-{
-const struct slPair *a = *((struct slPair **)va);
-const struct slPair *b = *((struct slPair **)vb);
-return strcasecmp((char *)(a->val), (char *)(b->val));
-}
-
-int slPairValCmp(const void *va, const void *vb)
-/* Compare two slPairs on their values (must be string). */
-{
-const struct slPair *a = *((struct slPair **)va);
-const struct slPair *b = *((struct slPair **)vb);
-return strcmp((char *)(a->val), (char *)(b->val));
-}
-
-void slPairValSortCase(struct slPair **pList)
-/* Sort slPair list on values (must be string), ignore case. */
-{
-slSort(pList, slPairValCmpCase);
-}
-
-void slPairValSort(struct slPair **pList)
-/* Sort slPair list on values (must be string). */
-{
-slSort(pList, slPairValCmp);
-}
-
-int slPairIntCmp(const void *va, const void *vb)
-// Compare two slPairs on their integer values.
-{
-const struct slPair *a = *((struct slPair **)va);
-const struct slPair *b = *((struct slPair **)vb);
-return ((char *)(a->val) - (char *)(b->val)); // cast works and val is 0 vased integer
-}
-
-void slPairIntSort(struct slPair **pList)
-// Sort slPair list on integer values.
-{
-slSort(pList, slPairIntCmp);
-}
-
-int slPairAtoiCmp(const void *va, const void *vb)
-// Compare two slPairs on their strings interpreted as integer values.
-{
-const struct slPair *a = *((struct slPair **)va);
-const struct slPair *b = *((struct slPair **)vb);
-return (atoi((char *)(a->val)) - atoi((char *)(b->val)));
-}
-
-void slPairValAtoiSort(struct slPair **pList)
-// Sort slPair list on string values interpreted as integers.
-{
-slSort(pList, slPairAtoiCmp);
-}
-
-void gentleFree(void *pt)
-{
-if (pt != NULL) freeMem((char*)pt);
-}
-
-int differentWord(char *s1, char *s2)
-/* strcmp ignoring case - returns zero if strings are
- * the same (ignoring case) otherwise returns difference
- * between first non-matching characters. */
-{
-char c1, c2;
-for (;;)
-    {
-    c1 = toupper(*s1++);
-    c2 = toupper(*s2++);
-    if (c1 != c2) /* Takes care of end of string in one but not the other too */
-	return c2-c1;
-    if (c1 == 0)  /* Take care of end of string in both. */
-	return 0;
-    }
-}
-
-int differentStringNullOk(char *a, char *b)
-/* Returns 0 if two strings (either of which may be NULL)
- * are the same.  Otherwise it returns a positive or negative
- * number depending on the alphabetical order of the two
- * strings.
- * This is basically a strcmp that can handle NULLs in
- * the input.  If used in a sort the NULLs will end
- * up before any of the cases with data.   */
-{
-if (a == b)
-    return FALSE;
-else if (a == NULL)
-    return -1;
-else if (b == NULL)
-    return 1;
-else
-    return strcmp(a,b) != 0;
-}
-
-boolean startsWith(const char *start, const char *string)
-/* Returns TRUE if string begins with start. */
-{
-char c;
-int i;
-
-for (i=0; ;i += 1)
-    {
-    if ((c = start[i]) == 0)
-        return TRUE;
-    if (string[i] != c)
-        return FALSE;
-    }
-}
-
-boolean startsWithWord(char *firstWord, char *line)
-/* Return TRUE if first white-space-delimited word in line
- * is same as firstWord.  Comparison is case sensitive. */
-{
-int len = strlen(firstWord);
-int i;
-for (i=0; i<len; ++i)
-   if (firstWord[i] != line[i])
-       return FALSE;
-char c = line[len];
-return c == 0 || isspace(c);
-}
-
-boolean startsWithWordByDelimiter(char *firstWord,char delimit, char *line)
-/* Return TRUE if first word in line is same as firstWord as delimited by delimit.
-   Comparison is case sensitive. Delimit of ' ' uses isspace() */
-{
-if (delimit == ' ')
-    return startsWithWord(firstWord,line);
-if (!startsWith(firstWord,line))
-    return FALSE;
-char c = line[strlen(firstWord)];
-return (c == '\0' || c == delimit);
-}
-
-char * findWordByDelimiter(char *word,char delimit, char *line)
-/* Return pointer to first occurance of word in line broken by 'delimit' char
-   Comparison is case sensitive. Delimit of ' ' uses isspace() */
-{
-int ix;
-char *p=line;
-while (p!=NULL && *p!='\0')
-    {
-    for (ix = 0;
-         word[ix] != '\0' && word[ix] == *p;
-         ix++,p++) ; // advance as long as they match
-    if (ix == strlen(word))
-        {
-        if (*p=='\0'
-        || *p==delimit
-        || (delimit == ' ' && isspace(*p)))
-            return p - ix; // matched and delimited
-        }
-    for (;   *p!='\0' && *p!=delimit && (delimit != ' ' || !isspace(*p)); p++)
-        ;  // advance to next delimit
-    if (*p!='\0')
-        {
-        p++;
-        continue;  // delimited so start again after delimit
-        }
-    }
-return NULL;
-}
-
-char *rStringIn(char *needle, char *haystack)
-/* Return last position of needle in haystack, or NULL if it's not there. */
-{
-int nSize = strlen(needle);
-char *pos;
-for (pos = haystack + strlen(haystack) - nSize; pos >= haystack; pos -= 1)
-    {
-    if (memcmp(needle, pos, nSize) == 0)
-        return pos;
-    }
-return NULL;
-}
-
-char *stringBetween(char *start, char *end, char *haystack)
-/* Return string between start and end strings, or NULL if
- * none found.  The first such instance is returned.
- * String must be freed by caller. */
-{
-char *pos, *p;
-int len;
-if ((p = stringIn(start, haystack)) != NULL)
-    {
-    pos = p + strlen(start);
-    if ((p = stringIn(end, pos)) != NULL)
-        {
-        len = p - pos;
-        pos = cloneMem(pos, len + 1);
-        pos[len] = 0;
-        return pos;
-        }
-    }
-return NULL;
-}
-
-boolean endsWith(char *string, char *end)
-/* Returns TRUE if string ends with end. */
-{
-int sLen, eLen, offset;
-sLen = strlen(string);
-eLen = strlen(end);
-offset = sLen - eLen;
-if (offset < 0)
-    return FALSE;
-return sameString(string+offset, end);
-}
-
-char lastChar(char *s)
-/* Return last character in string. */
-{
-if (s == NULL || s[0] == 0)
-    return 0;
-return s[strlen(s)-1];
-}
-
-void trimLastChar(char *s)
-/* Erase last character in string. */
-{
-int len = strlen(s);
-if (len > 0)
-   s[len-1] = 0;
-}
-
-char *lastNonwhitespaceChar(char *s)
-// Return pointer to last character in string that is not whitespace.
-{
-if (s == NULL || s[0] == 0)
-    return NULL;
-
-char *sPos = s + (strlen(s) - 1);
-for (;sPos >= s;sPos--)
-    {
-    if (!isspace(*sPos))
-        return sPos;
-    }
-return NULL;
-}
-
-char *matchingCharBeforeInLimits(char *limit, char *s, char c)
-/* Look for character c sometime before s, but going no further than limit.
- * Return NULL if not found. */
-{
-while (--s >= limit)
-    if (*s == c)
-        return s;
-return NULL;
-}
-
-char *memMatch(char *needle, int nLen, char *haystack, int hLen)
-/* Returns first place where needle (of nLen chars) matches
- * haystack (of hLen chars) */
-{
-char c = *needle++;
-nLen -= 1;
-hLen -= nLen;
-while (--hLen >= 0)
-    {
-    if (*haystack++ == c && memcmp(needle, haystack, nLen) == 0)
-        {
-        return haystack-1;
-        }
-    }
-return NULL;
-}
-
-void toUpperN(char *s, int n)
-/* Convert a section of memory to upper case. */
-{
-int i;
-for (i=0; i<n; ++i)
-    s[i] = toupper(s[i]);
-}
-
-void toLowerN(char *s, int n)
-/* Convert a section of memory to lower case. */
-{
-int i;
-for (i=0; i<n; ++i)
-    s[i] = tolower(s[i]);
-}
-
-void toggleCase(char *s, int size)
-/* toggle upper and lower case chars in string. */
-{
-char c;
-int i;
-for (i=0; i<size; ++i)
-    {
-    c = s[i];
-    if (isupper(c))
-        c = tolower(c);
-    else if (islower(c))
-        c = toupper(c);
-    s[i] = c;
-    }
-}
-
-
-char *strUpper(char *s)
-/* Convert entire string to upper case. */
-{
-char c;
-char *ss=s;
-for (;;)
-    {
-    if ((c = *ss) == 0) break;
-    *ss++ = toupper(c);
-    }
-return s;
-}
-
-char *replaceChars(char *string, char *old, char *new)
-/*
-  Replaces the old with the new. The old and new string need not be of equal size
- Can take any length string.
- Return value needs to be freeMem'd.
-*/
-{
-int numTimes = 0;
-int oldLen = strlen(old);
-int newLen = strlen(new);
-int strLen = 0;
-char *result = NULL;
-char *ptr = strstr(string, old);
-char *resultPtr = NULL;
-
-while(NULL != ptr)
-    {
-    numTimes++;
-    ptr += oldLen;
-    ptr = strstr(ptr, old);
-    }
-strLen = max(strlen(string) + (numTimes * (newLen - oldLen)), strlen(string));
-result = needMem(strLen + 1);
-
-ptr = strstr(string, old);
-resultPtr = result;
-while(NULL != ptr)
-    {
-    strLen = ptr - string;
-    strcpy(resultPtr, string);
-    string = ptr + oldLen;
-
-    resultPtr += strLen;
-    strcpy(resultPtr, new);
-    resultPtr += newLen;
-    ptr = strstr(string, old);
-    }
-
-strcpy(resultPtr, string);
-return result;
-}
-
-int strSwapStrs(char *string, int sz,char *oldStr, char *newStr)
-/* Swaps all occurrences of the old with the new in string. Need not be same size
-   Swaps in place but restricted by sz.  Returns count of swaps or -1 for sz failure. */
-{
-// WARNING: called at low level, so no errors allowed.
-int count = 0;
-char *p=NULL;
-for(p=strstr(string,oldStr);p!=NULL;p=strstr(p+strlen(oldStr),oldStr))
-    count++;
-if (count == 0)
-    return 0;
-if((strlen(string)+(count*(strlen(newStr) - strlen(oldStr))))>=sz)
-    return -1;
-for(p=strstr(string,oldStr);p!=NULL;p=strstr(p+strlen(newStr),oldStr))
-    {
-    memmove(p+strlen(newStr),p+strlen(oldStr),strlen(p+strlen(oldStr))+1); // NULL at end is also moved!
-    memcpy(p,newStr,strlen(newStr));
-    }
-return count;
-}
-
-char *strLower(char *s)
-/* Convert entire string to lower case */
-{
-char c;
-char *ss=s;
-for (;;)
-    {
-    if ((c = *ss) == 0) break;
-    *ss++ = tolower(c);
-    }
-return s;
-}
-
-char * memSwapChar(char *s, int len, char oldChar, char newChar)
-/* Substitute newChar for oldChar throughout memory of given length. */
-{
-int ix=0;
-for (;ix<len;ix++)
-    {
-    if (s[ix] == oldChar)
-        s[ix] =  newChar;
-    }
-return s;
-}
-
-void stripChar(char *s, char c)
-/* Remove all occurences of c from s. */
-{
-char *in = s, *out = s;
-char b;
-
-for (;;)
-    {
-    b = *out = *in++;
-    if (b == 0)
-       break;
-    if (b != c)
-       ++out;
-    }
-}
-
-char *stripEnclosingChar(char *inout,char encloser)
-// Removes enclosing char if found at both beg and end, preserving pointer
-// Note: handles brackets '(','{' and '[' by complement at end
-{
-if (inout == NULL || strlen(inout) < 2 || *inout != encloser)
-    return inout;
-
-char *end = inout + (strlen(inout) - 1);
-char closer = encloser;
-switch (closer)
-    {
-    case '(': closer = ')'; break;
-    case '{': closer = '}'; break;
-    case '[': closer = ']'; break;
-    default: break;
-    }
-if (*end  != closer)
-    return inout;
-*end = '\0';
-return memmove(inout,inout+1,strlen(inout));  // use memmove to safely copy in place
-}
-
-void stripString(char *s, char *strip)
-/* Remove all occurences of strip from s. */
-{
-char c, *in = s, *out = s;
-int stripSize = strlen(strip);
-char stripFirst = strip[0];
-
-while ((c = *in) != 0)
-    {
-    c = *in;
-    if (c == stripFirst)
-        {
-	if (startsWith(strip, in))
-	    {
-	    in += stripSize;
-	    continue;
-	    }
-	}
-    *out = c;
-    ++out;
-    ++in;
-    }
-*out = 0;
-}
-
-int countCase(char *s,boolean upper)
-// Count letters with case (upper or lower)
-{
-char a;
-int count = 0;
-while ((a = *s++) != 0)
-    if (( upper && isupper(a))
-    ||  (!upper && islower(a)))
-        ++count;
-return count;
-}
-
-int countChars(char *s, char c)
-/* Return number of characters c in string s. */
-{
-char a;
-int count = 0;
-while ((a = *s++) != 0)
-    if (a == c)
-        ++count;
-return count;
-}
-
-int countCharsN(char *s, char c, int size)
-/* Return number of characters c in string s of given size. */
-{
-int i;
-int count = 0;
-for (i=0; i<size; ++i)
-    if (s[i] == c)
-        ++count;
-return count;
-}
-
-int countLeadingChars(char *s, char c)
-/* Count number of characters c at start of string. */
-{
-int count = 0;
-while (*s++ == c)
-   ++count;
-return count;
-}
-
-int countLeadingDigits(const char *s)
-/* Return number of leading digits in s */
-{
-int count = 0;
-while (isdigit(*s))
-   {
-   ++count;
-   ++s;
-   }
-return count;
-}
-
-int countLeadingNondigits(const char *s)
-/* Count number of leading non-digit characters in s. */
-{
-int count = 0;
-char c;
-while ((c = *s++) != 0)
-   {
-   if (isdigit(c))
-       break;
-   ++count;
-   }
-return count;
-}
-
-int countSeparatedItems(char *string, char separator)
-/* Count number of items in string you would parse out with given
- * separator,  assuming final separator is optional. */
-{
-int count = 0;
-char c, lastC = 0;
-while ((c = *string++) != 0)
-    {   
-    if (c == separator)
-       ++count;
-    lastC = c;
-    }
-if (lastC != separator && lastC != 0)
-    ++count;
-return count;
-}
-
-int cmpStringsWithEmbeddedNumbers(const char *a, const char *b)
-/* Compare strings such as gene names that may have embedded numbers,
- * so that bmp4a comes before bmp14a */
-{
-for (;;)
-   {
-   /* Figure out number of digits at start, and do numerical comparison if there
-    * are any.  If numbers agree step over numerical part, otherwise return difference. */
-   int aNum = countLeadingDigits(a);
-   int bNum = countLeadingDigits(b);
-   if (aNum >= 0 && bNum >= 0)
-       {
-       int diff = atoi(a) - atoi(b);
-       if (diff != 0)
-           return diff;
-       a += aNum;
-       b += bNum;
-       }
-
-   /* Count number of non-digits at start. */
-   int aNonNum = countLeadingNondigits(a);
-   int bNonNum = countLeadingNondigits(b);
-
-   // If different sizes of non-numerical part, then don't match, let strcmp sort out how
-   if (aNonNum != bNonNum)
-        return strcmp(a,b);
-   // If no characters left then they are the same!
-   else if (aNonNum == 0)
-       return 0;
-   // Non-numerical part is the same length and non-zero.  See if it is identical.  Return if not.
-   else
-       {
-        int diff = memcmp(a,b,aNonNum);
-       if (diff != 0)
-            return diff;
-       a += aNonNum;
-       b += bNonNum;
-       }
-   }
-}
-
-int cmpWordsWithEmbeddedNumbers(const char *a, const char *b)
-/* Case insensitive version of cmpStringsWithEmbeddedNumbers. */
-{
-char *A = cloneString(a);
-char *B = cloneString(b);
-int diff = cmpStringsWithEmbeddedNumbers(strUpper(A), strUpper(B));
-freeMem(A);
-freeMem(B);
-return diff;
-}
-
-int countSame(char *a, char *b)
-/* Count number of characters that from start in a,b that are same. */
-{
-char c;
-int i;
-int count = 0;
-for (i=0; ; ++i)
-   {
-   c = a[i];
-   if (b[i] != c)
-       break;
-   if (c == 0)
-       break;
-   ++count;
-   }
-return count;
-}
-
-
-/* int chopString(in, sep, outArray, outSize); */
-/* This chops up the input string (cannabilizing it)
- * into an array of zero terminated strings in
- * outArray.  It returns the number of strings.
- * If you pass in NULL for outArray, it will just
- * return the number of strings that it *would*
- * chop. 
- * GOTCHA: since multiple separators are skipped
- * and treated as one, it is impossible to parse 
- * a list with an empty string. 
- * e.g. cat\t\tdog returns only cat and dog but no empty string */
-int chopString(char *in, char *sep, char *outArray[], int outSize)
-{
-int recordCount = 0;
-
-for (;;)
-    {
-    if (outArray != NULL && recordCount >= outSize)
-	break;
-    /* Skip initial separators. */
-    in += strspn(in, sep);
-    if (*in == 0)
-	break;
-    if (outArray != NULL)
-	outArray[recordCount] = in;
-    recordCount += 1;
-    in += strcspn(in, sep);
-    if (*in == 0)
-	break;
-    if (outArray != NULL)
-	*in = 0;
-    in += 1;
-    }
-return recordCount;
-}
-
-int chopByWhite(char *in, char *outArray[], int outSize)
-/* Like chopString, but specialized for white space separators. 
- * See the GOTCHA in chopString */
-{
-int recordCount = 0;
-char c;
-for (;;)
-    {
-    if (outArray != NULL && recordCount >= outSize)
-	break;
-
-    /* Skip initial separators. */
-    while (isspace(*in)) ++in;
-    if (*in == 0)
-        break;
-
-    /* Store start of word and look for end of word. */
-    if (outArray != NULL)
-        outArray[recordCount] = in;
-    recordCount += 1;
-    for (;;)
-        {
-        if ((c = *in) == 0)
-            break;
-        if (isspace(c))
-            break;
-        ++in;
-        }
-    if (*in == 0)
-	break;
-
-    /* Tag end of word with zero. */
-    if (outArray != NULL)
-	*in = 0;
-    /* And skip over the zero. */
-    in += 1;
-    }
-return recordCount;
-}
-
-int chopByWhiteRespectDoubleQuotes(char *in, char *outArray[], int outSize)
-/* Like chopString, but specialized for white space separators.
- * Further, any doubleQuotes (") are respected.
- * If doubleQuote is encloses whole string, then they are removed:
- *   "Fred and Ethyl" results in word [Fred and Ethyl]
- * If doubleQuotes exist inside string they are retained:
- *   Fred" and Ethyl" results in word [Fred" and Ethyl"]
- * Special note "" is a valid, though empty word. */
-{
-int recordCount = 0;
-char c;
-char *quoteBegins = NULL;
-boolean quoting = FALSE;
-for (;;)
-    {
-    if (outArray != NULL && recordCount >= outSize)
-        break;
-
-    /* Skip initial separators. */
-    while (isspace(*in)) ++in;
-    if (*in == 0)
-        break;
-
-    /* Store start of word and look for end of word. */
-    if (outArray != NULL)
-        {
-        outArray[recordCount] = in;
-        if (*in == '"')
-            quoteBegins = (in+1);
-        else
-            quoteBegins = NULL;
-        }
-    recordCount += 1;
-    quoting = FALSE;
-    for (;;)
-        {
-        if ((c = *in) == 0)
-            break;
-        if (quoting)
-            {
-            if (c == '"')
-                {
-                quoting = FALSE;
-                if (quoteBegins != NULL) // implies out array
-                    {
-                    if ((c = *(in+1) == 0 )|| isspace(c)) // whole word is quoted.
-                        {
-                        outArray[recordCount-1] = quoteBegins; // Fix beginning of word
-                        quoteBegins = NULL;
-                        break;
-                        }
-                    }
-                }
-            }
-        else
-            {
-            quoting = (c == '"');
-            if (isspace(c))
-                break;
-            }
-        ++in;
-        }
-    if (*in == 0)
-        break;
-
-    /* Tag end of word with zero. */
-    if (outArray != NULL)
-        *in = 0;
-    /* And skip over the zero. */
-    in += 1;
-    }
-return recordCount;
-}
-
-int chopByChar(char *in, char chopper, char *outArray[], int outSize)
-/* Chop based on a single character. */
-{
-int i;
-char c;
-if (*in == 0)
-    return 0;
-for (i=0; (i<outSize) || (outArray==NULL); ++i)
-    {
-    if (outArray != NULL)
-        outArray[i] = in;
-    for (;;)
-	{
-	if ((c = *in++) == 0)
-	    return i+1;
-	else if (c == chopper)
-	    {
-            if (outArray != NULL)
-                in[-1] = 0;
-	    break;
-	    }
-	}
-    }
-return i;
-}
-
-char crLfChopper[] = "\n\r";
-char whiteSpaceChopper[] = " \t\n\r";
-
-
-char *skipBeyondDelimit(char *s,char delimit)
-/* Returns NULL or pointer to first char beyond one (or more contiguous) delimit char.
-   If delimit is ' ' then skips beyond first patch of whitespace. */
-{
-if (s != NULL)
-    {
-    char *beyond = NULL;
-    if (delimit == ' ')
-        return skipLeadingSpaces(skipToSpaces(s));
-    else
-        beyond = strchr(s,delimit);
-    if (beyond != NULL)
-        {
-        for (beyond++;*beyond == delimit;beyond++) ;
-        if (*beyond != '\0')
-            return beyond;
-        }
-    }
-return NULL;
-}
-
-char *skipLeadingSpaces(char *s)
-/* Return first non-white space. */
-{
-char c;
-if (s == NULL) return NULL;
-for (;;)
-    {
-    c = *s;
-    if (!isspace(c))
-	return s;
-    ++s;
-    }
-}
-
-char *skipToSpaces(char *s)
-/* Return first white space or NULL if none.. */
-{
-char c;
-if (s == NULL)
-    return NULL;
-for (;;)
-    {
-    c = *s;
-    if (c == 0)
-        return NULL;
-    if (isspace(c))
-	return s;
-    ++s;
-    }
-}
-
-
-
-void eraseTrailingSpaces(char *s)
-/* Replace trailing white space with zeroes. */
-{
-int len = strlen(s);
-int i;
-char c;
-
-for (i=len-1; i>=0; --i)
-    {
-    c = s[i];
-    if (isspace(c))
-	s[i] = 0;
-    else
-	break;
-    }
-}
-
-/* Remove white space from a string */
-void eraseWhiteSpace(char *s)
-{
-char *in, *out;
-char c;
-
-in = out = s;
-for (;;)
-    {
-    c = *in++;
-    if (c == 0)
-	break;
-    if (!isspace(c))
-	*out++ = c;
-    }
-*out++ = 0;
-}
-
-/* Remove non-alphanumeric chars from string */
-void eraseNonAlphaNum(char *s)
-{
-char *in, *out;
-char c;
-
-in = out = s;
-for (;;)
-    {
-    c = *in++;
-    if (c == 0)
-        break;
-    if (isalnum(c))
-        *out++ = c;
-    }
-*out = 0;
-}
-
-char *trimSpaces(char *s)
-/* Remove leading and trailing white space. */
-{
-if (s != NULL)
-    {
-    s = skipLeadingSpaces(s);
-    eraseTrailingSpaces(s);
-    }
-return s;
-}
-
-void repeatCharOut(FILE *f, char c, int count)
-/* Write character to file repeatedly. */
-{
-while (--count >= 0)
-    fputc(c, f);
-}
-
-void spaceOut(FILE *f, int count)
-/* Put out some spaces to file. */
-{
-repeatCharOut(f, ' ', count);
-}
-
-void starOut(FILE *f, int count)
-/* Put out some asterisks to file. */
-{
-repeatCharOut(f, '*', count);
-}
-
-boolean hasWhiteSpace(char *s)
-/* Return TRUE if there is white space in string. */
-{
-char c;
-while ((c = *s++) != 0)
-    if (isspace(c))
-        return TRUE;
-return FALSE;
-}
-
-char *firstWordInLine(char *line)
-/* Returns first word in line if any (white space separated).
- * Puts 0 in place of white space after word. */
-{
-char *e;
-line = skipLeadingSpaces(line);
-if ((e = skipToSpaces(line)) != NULL)
-    *e = 0;
-return line;
-}
-
-char *cloneFirstWord(char *line)
-/* Clone first word in line */
-{
-char *startFirstWord = skipLeadingSpaces(line);
-if (startFirstWord == NULL)
-    return NULL;
-char *endFirstWord = skipToSpaces(startFirstWord);
-if (endFirstWord == NULL)
-    return cloneString(startFirstWord);
-else
-    return cloneStringZ(startFirstWord, endFirstWord - startFirstWord);
-}
-
-char *lastWordInLine(char *line)
-/* Returns last word in line if any (white space separated).
- * Returns NULL if string is empty.  Removes any terminating white space
- * from line. */
-{
-char *s = line;
-char *word = NULL, *wordEnd = NULL;
-for (;;)
-    {
-    s = skipLeadingSpaces(s);
-    if (s == NULL || s[0] == 0)
-	break;
-    word = s;
-    s = wordEnd = skipToSpaces(s);
-    if (s == NULL)
-        break;
-    }
-if (wordEnd != NULL)
-    *wordEnd = 0;
-return word;
-}
-
-char *nextWord(char **pLine)
-/* Return next word in *pLine and advance *pLine to next
- * word. */
-{
-char *s = *pLine, *e;
-if (s == NULL || s[0] == 0)
-    return NULL;
-s = skipLeadingSpaces(s);
-if (s[0] == 0)
-    return NULL;
-e = skipToSpaces(s);
-if (e != NULL)
-    *e++ = 0;
-*pLine = e;
-return s;
-}
-
-char *nextWordRespectingQuotes(char **pLine)
-// return next word but respects single or double quotes surrounding sets of words.
-{
-char *s = *pLine, *e;
-if (s == NULL || s[0] == 0)
-    return NULL;
-s = skipLeadingSpaces(s);
-if (s[0] == 0)
-    return NULL;
-if (s[0] == '"')
-    {
-    e = skipBeyondDelimit(s+1,'"');
-    if (e != NULL && !isspace(e[0]))
-        e = skipToSpaces(s);
-    }
-else if (s[0] == '\'')
-    {
-    e = skipBeyondDelimit(s+1,'\'');
-    if (e != NULL && !isspace(e[0]))
-        e = skipToSpaces(s);
-    }
-else
-    e = skipToSpaces(s);
-if (e != NULL)
-    *e++ = 0;
-*pLine = e;
-return s;
-}
-
-char *nextTabWord(char **pLine)
-/* Return next tab-separated word. */
-{
-char *s = *pLine;
-char *e;
-if (s == NULL || *s == '\n' || *s == 0)
-    {
-    *pLine = NULL;
-    return NULL;
-    }
-e = strchr(s, '\t');
-if (e == NULL)
-    {
-    e = strchr(s, '\n');
-    if (e != NULL)
-        *e = 0;
-    *pLine = NULL;
-    }
-else
-    {
-    *e++ = 0;
-    *pLine = e;
-    }
-return s;
-}
-
-char *cloneFirstWordByDelimiter(char *line,char delimit)
-/* Returns a cloned first word, not harming the memory passed in */
-{
-if (line == NULL || *line == 0)
-    return NULL;
-line = skipLeadingSpaces(line);
-if (*line == 0)
-    return NULL;
-int size=0;
-char *e;
-for (e=line;*e!=0;e++)
-    {
-    if (*e==delimit)
-        break;
-    else if (delimit == ' ' && isspace(*e))
-        break;
-    size++;
-    }
-if (size == 0)
-    return NULL;
-char *new = needMem(size + 2); // Null terminated by 2
-memcpy(new, line, size);
-return new;
-}
-
-char *cloneNextWordByDelimiter(char **line,char delimit)
-/* Returns a cloned first word, advancing the line pointer but not harming memory passed in */
-{
-char *new = cloneFirstWordByDelimiter(*line,delimit);
-if (new != NULL)
-    {
-    *line = skipLeadingSpaces(*line);
-    *line += strlen(new);
-    if ( **line != 0)
-        (*line)++;
-    }
-return new;
-}
-
-char *nextStringInList(char **pStrings)
-/* returns pointer to the first string and advances pointer to next in
-   list of strings dilimited by 1 null and terminated by 2 nulls. */
-{
-if (pStrings == NULL || *pStrings == NULL || **pStrings == 0)
-    return NULL;
-char *p=*pStrings;
-*pStrings += strlen(p)+1;
-return p;
-}
-
-int cntStringsInList(char *pStrings)
-/* returns count of strings in a
-   list of strings dilimited by 1 null and terminated by 2 nulls. */
-{
-int cnt=0;
-char *p = pStrings;
-while (nextStringInList(&p) != NULL)
-    cnt++;
-return cnt;
-}
-
-int stringArrayIx(char *string, char *array[], int arraySize)
-
-/* Return index of string in array or -1 if not there. */
-{
-int i;
-for (i=0; i<arraySize; ++i)
-    if (!differentWord(array[i], string))
-        return i;
-return -1;
-}
-
-int ptArrayIx(void *pt, void *array, int arraySize)
-/* Return index of pt in array or -1 if not there. */
-{
-int i;
-void **a = array;
-for (i=0; i<arraySize; ++i)
-    {
-    if (pt == a[i])
-        return i;
-    }
-return -1;
-}
-
-
-
-FILE *mustOpen(char *fileName, char *mode)
-/* Open a file - or squawk and die. */
-{
-FILE *f;
-
-if (sameString(fileName, "stdin"))
-    return stdin;
-if (sameString(fileName, "stdout"))
-    return stdout;
-if ((f = fopen(fileName, mode)) == NULL)
-    {
-    char *modeName = "";
-    if (mode)
-        {
-        if (mode[0] == 'r')
-            modeName = " to read";
-        else if (mode[0] == 'w')
-            modeName = " to write";
-        else if (mode[0] == 'a')
-            modeName = " to append";
-        }
-    errAbort("mustOpen: Can't open %s%s: %s", fileName, modeName, strerror(errno));
-    }
-return f;
-}
-
-void mustWrite(FILE *file, void *buf, size_t size)
-/* Write to a file or squawk and die. */
-{
-if (size != 0 && fwrite(buf, size, 1, file) != 1)
-    {
-    errAbort("Error writing %lld bytes: %s\n", (long long)size, strerror(ferror(file)));
-    }
-}
-
-
-void mustRead(FILE *file, void *buf, size_t size)
-/* Read size bytes from a file or squawk and die. */
-{
-if (size != 0 && fread(buf, size, 1, file) != 1)
-    {
-    if (ferror(file))
-	errAbort("Error reading %lld bytes: %s", (long long)size, strerror(ferror(file)));
-    else
-	errAbort("End of file reading %lld bytes", (long long)size);
-    }
-}
-
-void writeString(FILE *f, char *s)
-/* Write a 255 or less character string to a file.
- * This will write the length of the string in the first
- * byte then the string itself. */
-{
-UBYTE bLen;
-int len = strlen(s);
-
-if (len > 255)
-    {
-    warn("String too long in writeString (%d chars):\n%s", len, s);
-    len = 255;
-    }
-bLen = len;
-writeOne(f, bLen);
-mustWrite(f, s, len);
-}
-
-char *readString(FILE *f)
-/* Read a string (written with writeString) into
- * memory.  freeMem the result when done. */
-{
-UBYTE bLen;
-int len;
-char *s;
-
-if (!readOne(f, bLen))
-    return NULL;
-len = bLen;
-s = needMem(len+1);
-if (len > 0)
-    mustRead(f, s, len);
-return s;
-}
-
-char *mustReadString(FILE *f)
-/* Read a string.  Squawk and die at EOF or if any problem. */
-{
-char *s = readString(f);
-if (s == NULL)
-    errAbort("Couldn't read string");
-return s;
-}
-
-
-boolean fastReadString(FILE *f, char buf[256])
-/* Read a string into buffer, which must be long enough
- * to hold it.  String is in 'writeString' format. */
-{
-UBYTE bLen;
-int len;
-if (!readOne(f, bLen))
-    return FALSE;
-if ((len = bLen)> 0)
-    mustRead(f, buf, len);
-buf[len] = 0;
-return TRUE;
-}
-
-void msbFirstWriteBits64(FILE *f, bits64 x)
-/* Write out 64 bit number in manner that is portable across architectures */
-{
-int i;
-UBYTE buf[8];
-for (i=7; i>=0; --i)
-    {
-    buf[i] = (UBYTE)(x&0xff);
-    x >>= 8;
-    }
-mustWrite(f, buf, 8);
-}
-
-bits64 msbFirstReadBits64(FILE *f)
-/* Write out 64 bit number in manner that is portable across architectures */
-{
-int i;
-UBYTE buf[8];
-bits64 x = 0;
-mustRead(f, buf, 8);
-for (i=0; i<8; ++i)
-    {
-    x <<= 8;
-    x |= buf[i];
-    }
-return x;
-}
-
-void mustGetLine(FILE *file, char *buf, int charCount)
-/* Read at most charCount-1 bytes from file, but stop after newline if one is
- * encountered.  The string in buf is '\0'-terminated.  (See man 3 fgets.)
- * Die if there is an error. */
-{
-char *success = fgets(buf, charCount, file);
-if (success == NULL && charCount > 0)
-    buf[0] = '\0';
-if (ferror(file))
-    errAbort("mustGetLine: fgets failed: %s", strerror(ferror(file)));
-}
-
-int mustOpenFd(char *fileName, int flags)
-/* Open a file descriptor (see man 2 open) or squawk and die. */
-{
-if (sameString(fileName, "stdin"))
-    return STDIN_FILENO;
-if (sameString(fileName, "stdout"))
-    return STDOUT_FILENO;
-// mode is necessary when O_CREAT is given, ignored otherwise
-int mode = 00664;
-int fd = open(fileName, flags, mode);
-if (fd < 0)
-    {
-    char *modeName = "";
-    if ((flags & (O_WRONLY | O_CREAT | O_TRUNC)) == (O_WRONLY | O_CREAT | O_TRUNC))
-	modeName = " to create and truncate";
-    else if ((flags & (O_WRONLY | O_CREAT)) == (O_WRONLY | O_CREAT))
-	modeName = " to create";
-    else if ((flags & O_WRONLY) == O_WRONLY)
-	modeName = " to write";
-    else if ((flags & O_RDWR) == O_RDWR)
-	modeName = " to append";
-    else
-	modeName = " to read";
-    errnoAbort("mustOpenFd: Can't open %s%s", fileName, modeName);
-    }
-return fd;
-}
-
-void mustReadFd(int fd, void *buf, size_t size)
-/* Read size bytes from a file or squawk and die. */
-{
-ssize_t actualSize;
-char *cbuf = buf;
-// using a loop because linux was not returning all data in a single request when request size exceeded 2GB.
-while (size > 0)
-    {
-    actualSize = read(fd, cbuf, size);
-    if (actualSize < 0)
-	errnoAbort("Error reading %lld bytes", (long long)size);
-    if (actualSize == 0)
-	errAbort("End of file reading %llu bytes (got %lld)", (unsigned long long)size, (long long)actualSize);
-    cbuf += actualSize;
-    size -= actualSize;
-    }
-}
-
-void mustWriteFd(int fd, void *buf, size_t size)
-/* Write size bytes to file descriptor fd or die.  (See man 2 write.) */
-{
-ssize_t result = write(fd, buf, size);
-if (result < size)
-    {
-    if (result < 0)
-	errnoAbort("mustWriteFd: write failed");
-    else 
-        errAbort("mustWriteFd only wrote %lld of %lld bytes. Likely the disk is full.",
-	    (long long)result, (long long)size);
-    }
-}
-
-off_t mustLseek(int fd, off_t offset, int whence)
-/* Seek to given offset, relative to whence (see man lseek) in file descriptor fd or errAbort.
- * Return final offset (e.g. if this is just an (fd, 0, SEEK_CUR) query for current position). */
-{
-off_t ret = lseek(fd, offset, whence);
-if (ret < 0)
-    errnoAbort("lseek(%d, %lld, %s (%d)) failed", fd, (long long)offset,
-	       ((whence == SEEK_SET) ? "SEEK_SET" : (whence == SEEK_CUR) ? "SEEK_CUR" :
-		(whence == SEEK_END) ? "SEEK_END" : "invalid 'whence' value"), whence);
-return ret;
-}
-
-void mustCloseFd(int *pFd)
-/* Close file descriptor *pFd if >= 0, abort if there's an error, set *pFd = -1. */
-{
-if (pFd != NULL && *pFd >= 0)
-    {
-    if (close(*pFd) < 0)
-	errnoAbort("close failed");
-    *pFd = -1;
-    }
-}
-
-char *addSuffix(char *head, char *suffix)
-/* Return a needMem'd string containing "headsuffix". Should be free'd
- when finished. */
-{
-char *ret = NULL;
-int size = strlen(head) + strlen(suffix) +1;
-ret = needMem(sizeof(char)*size);
-snprintf(ret, size, "%s%s", head, suffix);
-return ret;
-}
-
-void chopSuffix(char *s)
-/* Remove suffix (last . in string and beyond) if any. */
-{
-char *e = strrchr(s, '.');
-if (e != NULL)
-    *e = 0;
-}
-
-void chopSuffixAt(char *s, char c)
-/* Remove end of string from first occurrence of char c.
- * chopSuffixAt(s, '.') is equivalent to regular chopSuffix. */
-{
-char *e = strrchr(s, c);
-if (e != NULL)
-    *e = 0;
-}
-
-char *chopPrefixAt(char *s, char c)
-/* Like chopPrefix, but can chop on any character, not just '.' */
-{
-char *e = strchr(s, c);
-if (e == NULL) return s;
-*e++ = 0;
-return e;
-}
-
-char *chopPrefix(char *s)
-/* This will replace the first '.' in a string with
- * 0, and return the character after this.  If there
- * is no '.' in the string this will just return the
- * unchanged s passed in. */
-{
-return chopPrefixAt(s, '.');
-}
-
-
-
-boolean carefulCloseWarn(FILE **pFile)
-/* Close file if open and null out handle to it.
- * Return FALSE and print a warning message if there
- * is a problem.*/
-{
-FILE *f;
-boolean ok = TRUE;
-if ((pFile != NULL) && ((f = *pFile) != NULL))
-    {
-    if (f != stdin && f != stdout)
-        {
-        if (fclose(f) != 0)
-	    {
-            errnoWarn("fclose failed");
-	    ok = FALSE;
-	    }
-        }
-    *pFile = NULL;
-    }
-return ok;
-}
-
-void carefulClose(FILE **pFile)
-/* Close file if open and null out handle to it.
- * Warn and abort if there's a problem. */
-{
-if (!carefulCloseWarn(pFile))
-    noWarnAbort();
-}
-
-char *firstWordInFile(char *fileName, char *wordBuf, int wordBufSize)
-/* Read the first word in file into wordBuf. */
-{
-FILE *f = mustOpen(fileName, "r");
-mustGetLine(f, wordBuf, wordBufSize);
-fclose(f);
-return trimSpaces(wordBuf);
-}
-
-int fileOffsetSizeCmp(const void *va, const void *vb)
-/* Help sort fileOffsetSize by offset. */
-{
-const struct fileOffsetSize *a = *((struct fileOffsetSize **)va);
-const struct fileOffsetSize *b = *((struct fileOffsetSize **)vb);
-if (a->offset > b->offset)
-    return 1;
-else if (a->offset == b->offset)
-    return 0;
-else
-    return -1;
-}
-
-struct fileOffsetSize *fileOffsetSizeMerge(struct fileOffsetSize *inList)
-/* Returns a new list which is inList transformed to have adjacent blocks
- * merged.  Best to use this with a sorted list. */
-{
-struct fileOffsetSize *newList = NULL, *newEl = NULL, *oldEl, *nextOld;
-
-for (oldEl = inList; oldEl != NULL; oldEl = nextOld)
-    {
-    nextOld = oldEl->next;
-    if (nextOld != NULL && nextOld->offset < oldEl->offset)
-        errAbort("Unsorted inList in fileOffsetSizeMerge %llu %llu", oldEl->offset, nextOld->offset);
-    if (newEl == NULL || newEl->offset + newEl->size < oldEl->offset)
-        {
-	newEl = CloneVar(oldEl);
-	slAddHead(&newList, newEl);
-	}
-    else
-        {
-	newEl->size = oldEl->offset + oldEl->size - newEl->offset;
-	}
-    }
-slReverse(&newList);
-return newList;
-}
-
-void fileOffsetSizeFindGap(struct fileOffsetSize *list,
-                           struct fileOffsetSize **pBeforeGap, struct fileOffsetSize **pAfterGap)
-/* Starting at list, find all items that don't have a gap between them and the previous item.
- * Return at gap, or at end of list, returning pointers to the items before and after the gap. */
-{
-struct fileOffsetSize *pt, *next;
-for (pt = list; ; pt = next)
-    {
-    next = pt->next;
-    if (next == NULL || next->offset != pt->offset + pt->size)
-	{
-	*pBeforeGap = pt;
-	*pAfterGap = next;
-	return;
-	}
-    }
-}
-
-
-void mustSystem(char *cmd)
-/* Execute cmd using "sh -c" or die.  (See man 3 system.) fail on errors */
-{
-if (cmd == NULL) // don't allow (system() supports testing for shell this way)
-    errAbort("mustSystem: called with NULL command.");
-int status = system(cmd);
-if (status == -1)
-    errnoAbort("error starting command: %s", cmd);
-else if (WIFSIGNALED(status))
-    errAbort("command terminated by signal %d: %s", WTERMSIG(status), cmd);
-else if (WIFEXITED(status))
-    {
-    if (WEXITSTATUS(status) != 0)
-        errAbort("command exited with %d: %s", WEXITSTATUS(status), cmd);
-    }
-else
-    errAbort("bug: invalid exit status for command: %s", cmd);
-}
-
-int roundingScale(int a, int p, int q)
-/* returns rounded a*p/q */
-{
-if (a > 100000 || p > 100000)
-    {
-    double x = a;
-    x *= p;
-    x /= q;
-    return round(x);
-    }
-else
-    return (a*p + q/2)/q;
-}
-
-int intAbs(int a)
-/* Return integer absolute value */
-{
-return (a >= 0 ? a : -a);
-}
-
-int  rangeIntersection(int start1, int end1, int start2, int end2)
-/* Return amount of bases two ranges intersect over, 0 or negative if no
- * intersection. */
-{
-int s = max(start1,start2);
-int e = min(end1,end2);
-return e-s;
-}
-
-int positiveRangeIntersection(int start1, int end1, int start2, int end2)
-/* Return number of bases in intersection of two ranges, or
- * zero if they don't intersect. */
-{
-int ret = rangeIntersection(start1,end1,start2,end2);
-if (ret < 0)
-    ret = 0;
-return ret;
-}
-
-bits64 byteSwap64(bits64 a)
-/* Return byte-swapped version of a */
-{
-union {bits64 whole; UBYTE bytes[8];} u,v;
-u.whole = a;
-v.bytes[0] = u.bytes[7];
-v.bytes[1] = u.bytes[6];
-v.bytes[2] = u.bytes[5];
-v.bytes[3] = u.bytes[4];
-v.bytes[4] = u.bytes[3];
-v.bytes[5] = u.bytes[2];
-v.bytes[6] = u.bytes[1];
-v.bytes[7] = u.bytes[0];
-return v.whole;
-}
-
-bits64 readBits64(FILE *f, boolean isSwapped)
-/* Read and optionally byte-swap 64 bit entity. */
-{
-bits64 val;
-mustReadOne(f, val);
-if (isSwapped)
-    val = byteSwap64(val);
-return val;
-}
-
-bits64 fdReadBits64(int fd, boolean isSwapped)
-/* Read and optionally byte-swap 64 bit entity. */
-{
-bits64 val;
-mustReadOneFd(fd, val);
-if (isSwapped)
-    val = byteSwap64(val);
-return val;
-}
-
-bits64 memReadBits64(char **pPt, boolean isSwapped)
-/* Read and optionally byte-swap 64 bit entity from memory buffer pointed to by
- * *pPt, and advance *pPt past read area. */
-{
-bits64 val;
-memcpy(&val, *pPt, sizeof(val));
-if (isSwapped)
-    val = byteSwap64(val);
-*pPt += sizeof(val);
-return val;
-}
-
-bits32 byteSwap32(bits32 a)
-/* Return byte-swapped version of a */
-{
-union {bits32 whole; UBYTE bytes[4];} u,v;
-u.whole = a;
-v.bytes[0] = u.bytes[3];
-v.bytes[1] = u.bytes[2];
-v.bytes[2] = u.bytes[1];
-v.bytes[3] = u.bytes[0];
-return v.whole;
-}
-
-bits32 readBits32(FILE *f, boolean isSwapped)
-/* Read and optionally byte-swap 32 bit entity. */
-{
-bits32 val;
-mustReadOne(f, val);
-if (isSwapped)
-    val = byteSwap32(val);
-return val;
-}
-
-bits32 fdReadBits32(int fd, boolean isSwapped)
-/* Read and optionally byte-swap 32 bit entity. */
-{
-bits32 val;
-mustReadOneFd(fd, val);
-if (isSwapped)
-    val = byteSwap32(val);
-return val;
-}
-
-bits32 memReadBits32(char **pPt, boolean isSwapped)
-/* Read and optionally byte-swap 32 bit entity from memory buffer pointed to by
- * *pPt, and advance *pPt past read area. */
-{
-bits32 val;
-memcpy(&val, *pPt, sizeof(val));
-if (isSwapped)
-    val = byteSwap32(val);
-*pPt += sizeof(val);
-return val;
-}
-
-bits16 byteSwap16(bits16 a)
-/* Return byte-swapped version of a */
-{
-union {bits16 whole; UBYTE bytes[2];} u,v;
-u.whole = a;
-v.bytes[0] = u.bytes[1];
-v.bytes[1] = u.bytes[0];
-return v.whole;
-}
-
-bits16 readBits16(FILE *f, boolean isSwapped)
-/* Read and optionally byte-swap 16 bit entity. */
-{
-bits16 val;
-mustReadOne(f, val);
-if (isSwapped)
-    val = byteSwap16(val);
-return val;
-}
-
-bits16 fdReadBits16(int fd, boolean isSwapped)
-/* Read and optionally byte-swap 16 bit entity. */
-{
-bits16 val;
-mustReadOneFd(fd, val);
-if (isSwapped)
-    val = byteSwap16(val);
-return val;
-}
-
-bits16 memReadBits16(char **pPt, boolean isSwapped)
-/* Read and optionally byte-swap 16 bit entity from memory buffer pointed to by
- * *pPt, and advance *pPt past read area. */
-{
-bits16 val;
-memcpy(&val, *pPt, sizeof(val));
-if (isSwapped)
-    val = byteSwap16(val);
-*pPt += sizeof(val);
-return val;
-}
-
-double byteSwapDouble(double a)
-/* Return byte-swapped version of a */
-{
-union {double whole; UBYTE bytes[8];} u,v;
-u.whole = a;
-v.bytes[0] = u.bytes[7];
-v.bytes[1] = u.bytes[6];
-v.bytes[2] = u.bytes[5];
-v.bytes[3] = u.bytes[4];
-v.bytes[4] = u.bytes[3];
-v.bytes[5] = u.bytes[2];
-v.bytes[6] = u.bytes[1];
-v.bytes[7] = u.bytes[0];
-return v.whole;
-}
-
-
-double readDouble(FILE *f, boolean isSwapped)
-/* Read and optionally byte-swap double-precision floating point entity. */
-{
-double val;
-mustReadOne(f, val);
-if (isSwapped)
-    val = byteSwapDouble(val);
-return val;
-}
-
-double memReadDouble(char **pPt, boolean isSwapped)
-/* Read and optionally byte-swap double-precision floating point entity
- * from memory buffer pointed to by *pPt, and advance *pPt past read area. */
-{
-double val;
-memcpy(&val, *pPt, sizeof(val));
-if (isSwapped)
-    val = byteSwapDouble(val);
-*pPt += sizeof(val);
-return val;
-}
-
-float byteSwapFloat(float a)
-/* Return byte-swapped version of a */
-{
-union {float whole; UBYTE bytes[4];} u,v;
-u.whole = a;
-v.bytes[0] = u.bytes[3];
-v.bytes[1] = u.bytes[2];
-v.bytes[2] = u.bytes[1];
-v.bytes[3] = u.bytes[0];
-return v.whole;
-}
-
-
-float readFloat(FILE *f, boolean isSwapped)
-/* Read and optionally byte-swap single-precision floating point entity. */
-{
-float val;
-mustReadOne(f, val);
-if (isSwapped)
-    val = byteSwapFloat(val);
-return val;
-}
-
-float memReadFloat(char **pPt, boolean isSwapped)
-/* Read and optionally byte-swap single-precision floating point entity
- * from memory buffer pointed to by *pPt, and advance *pPt past read area. */
-{
-float val;
-memcpy(&val, *pPt, sizeof(val));
-if (isSwapped)
-    val = byteSwapFloat(val);
-*pPt += sizeof(val);
-return val;
-}
-
-
-void removeReturns(char *dest, char *src)
-/* Removes the '\r' character from a string.
- * The source and destination strings can be the same, if there are
- * no other threads */
-{
-int i = 0;
-int j = 0;
-
-/* until the end of the string */
-for (;;)
-    {
-    /* skip the returns */
-    while(src[j] == '\r')
-	j++;
-
-    /* copy the characters */
-    dest[i] = src[j];
-
-    /* check to see if done */
-    if(src[j] == '\0')
-	break;
-
-    /* advance the counters */
-    i++;
-    j++;
-    }
-}
-
-char* readLine(FILE* fh)
-/* Read a line of any size into dynamic memory, return null on EOF */
-{
-int bufCapacity = 256;
-int bufSize = 0;
-char* buf = needMem(bufCapacity);
-int ch;
-
-/* loop until EOF of EOLN */
-while (((ch = getc(fh)) != EOF) && (ch != '\n'))
-    {
-    /* expand if almost full, always keep one extra char for
-     * zero termination */
-    if (bufSize >= bufCapacity-2)
-        {
-        bufCapacity *= 2;
-        buf = realloc(buf, bufCapacity);
-        if (buf == NULL)
-            {
-            errAbort("Out of memory in readline - request size %d bytes", bufCapacity);
-            }
-        }
-    buf[bufSize++] = ch;
-    }
-
-/* only return EOF if no data was read */
-if ((ch == EOF) && (bufSize == 0))
-    {
-    freeMem(buf);
-    return NULL;
-    }
-buf[bufSize] = '\0';
-return buf;
-}
-
-boolean fileExists(char *fileName)
-/* Return TRUE if file exists (may replace this with non-
- * portable faster way some day). */
-{
-/* To make piping easier stdin and stdout always exist. */
-if (sameString(fileName, "stdin")) return TRUE;
-if (sameString(fileName, "stdout")) return TRUE;
-
-return fileSize(fileName) != -1;
-}
-
-/*
- Friendly name for strstrNoCase
-*/
-char *containsStringNoCase(char *haystack, char *needle)
-{
-return strstrNoCase(haystack, needle);
-}
-
-char *strstrNoCase(char *haystack, char *needle)
-/*
-  A case-insensitive strstr function
-Will also robustly handle null strings
-param haystack - The string to be searched
-param needle - The string to look for in the haystack string
-
-return - The position of the first occurence of the desired substring
-or -1 if it is not found
- */
-{
-char *haystackCopy = NULL;
-char *needleCopy = NULL;
-int index = 0;
-int haystackLen = 0;
-int needleLen = 0;
-char *p, *q;
-
-if (NULL == haystack || NULL == needle)
-    {
-    return NULL;
-    }
-
-haystackLen = strlen(haystack);
-needleLen = strlen(needle);
-
-haystackCopy = (char*) needMem(haystackLen + 1);
-needleCopy = (char*) needMem(needleLen + 1);
-
-for(index = 0; index < haystackLen;  index++)
-    {
-    haystackCopy[index] = tolower(haystack[index]);
-    }
-haystackCopy[haystackLen] = 0; /* Null terminate */
-
-for(index = 0; index < needleLen;  index++)
-    {
-    needleCopy[index] = tolower(needle[index]);
-    }
-needleCopy[needleLen] = 0; /* Null terminate */
-
-p=strstr(haystackCopy, needleCopy);
-q=haystackCopy;
-
-freeMem(haystackCopy);
-freeMem(needleCopy);
-
-if(p==NULL) return NULL;
-
-return p-q+haystack;
-}
-
-int vasafef(char* buffer, int bufSize, char *format, va_list args)
-/* Format string to buffer, vsprintf style, only with buffer overflow
- * checking.  The resulting string is always terminated with zero byte. */
-{
-int sz = vsnprintf(buffer, bufSize, format, args);
-/* note that some version return -1 if too small */
-if ((sz < 0) || (sz >= bufSize))
-    {
-    buffer[bufSize-1] = (char) 0;
-    errAbort("buffer overflow, size %d, format: %s, buffer: '%s'", bufSize, format, buffer);
-    }
-return sz;
-}
-
-int safef(char* buffer, int bufSize, char *format, ...)
-/* Format string to buffer, vsprintf style, only with buffer overflow
- * checking.  The resulting string is always terminated with zero byte. */
-{
-int sz;
-va_list args;
-va_start(args, format);
-sz = vasafef(buffer, bufSize, format, args);
-va_end(args);
-return sz;
-}
-
-void safecpy(char *buf, size_t bufSize, const char *src)
-/* copy a string to a buffer, with bounds checking.*/
-{
-size_t slen = strlen(src);
-if (slen > bufSize-1)
-    errAbort("buffer overflow, size %lld, string size: %lld", (long long)bufSize, (long long)slen);
-strcpy(buf, src);
-}
-
-void safencpy(char *buf, size_t bufSize, const char *src, size_t n)
-/* copy n characters from a string to a buffer, with bounds checking.
- * Unlike strncpy, always null terminates the result */
-{
-if (n > bufSize-1)
-    errAbort("buffer overflow, size %lld, substring size: %lld", (long long)bufSize, (long long)n);
-// strlen(src) can take a long time when src is for example a pointer into a chromosome sequence.
-// Instead of setting slen to max(strlen(src), n), just stop counting length at n.
-size_t slen = 0;
-while (src[slen] != '\0' && slen < n)
-    slen++;
-strncpy(buf, src, n);
-buf[slen] = '\0';
-}
-
-void safecat(char *buf, size_t bufSize, const char *src)
-/* Append  a string to a buffer, with bounds checking.*/
-{
-size_t blen = strlen(buf);
-size_t slen = strlen(src);
-if (blen+slen > bufSize-1)
-    errAbort("buffer overflow, size %lld, new string size: %lld", (long long)bufSize, (long long)(blen+slen));
-strcat(buf, src);
-}
-
-void safencat(char *buf, size_t bufSize, const char *src, size_t n)
-/* append n characters from a string to a buffer, with bounds checking. */
-{
-size_t blen = strlen(buf);
-if (blen+n > bufSize-1)
-    errAbort("buffer overflow, size %lld, new string size: %lld", (long long)bufSize, (long long)(blen+n));
-size_t slen = strlen(src);
-if (slen > n)
-    slen = n;
-strncat(buf, src, n);
-buf[blen+slen] = '\0';
-}
-
-
-static char *naStr = "n/a";
-static char *emptyStr = "";
-
-char *naForNull(char *s)
-/* Return 'n/a' if s is NULL, otherwise s. */
-{
-if (s == NULL)
-   s = naStr;
-return s;
-}
-
-char *naForEmpty(char *s)
-/* Return n/a if s is "" or NULL, otherwise s. */
-{
-if (s == NULL || s[0] == 0)
-    s = naStr;
-return s;
-}
-
-char *emptyForNull(char *s)
-/* Return "" if s is NULL, otherwise s. */
-{
-if (s == NULL)
-   s = emptyStr;
-return s;
-}
-
-char *nullIfAllSpace(char *s)
-/* Return NULL if s is all spaces, otherwise s. */
-{
-s = skipLeadingSpaces(s);
-if (s != NULL)
-    if (s[0] == 0)
-        s = NULL;
-return s;
-}
-
-char *trueFalseString(boolean b)
-/* Return "true" or "false" */
-{
-return (b ? "true" : "false");
-}
-
-void uglyTime(char *label, ...)
-/* Print label and how long it's been since last call.  Call with
- * a NULL label to initialize. */
-{
-static long lastTime = 0;
-long time = clock1000();
-va_list args;
-va_start(args, label);
-if (label != NULL)
-    {
-    fprintf(stdout, "<span class='timing'>");
-    vfprintf(stdout, label, args);
-    fprintf(stdout, ": %ld millis<BR></span>\n", time - lastTime);
-    }
-lastTime = time;
-va_end(args);
-}
-
-void makeDirs(char* path)
-/* make a directory, including parent directories */
-{
-char pathBuf[PATH_LEN];
-char* next = pathBuf;
-
-strcpy(pathBuf, path);
-if (*next == '/')
-    next++;
-
-while((*next != '\0')
-      && (next = strchr(next, '/')) != NULL)
-    {
-    *next = '\0';
-    makeDir(pathBuf);
-    *next = '/';
-    next++;
-    }
-makeDir(pathBuf);
-}
-
-char *skipNumeric(char *s)
-/* Return first char of s that's not a digit */
-{
-while (isdigit(*s))
-   ++s;
-return s;
-}
-
-char *skipToNumeric(char *s)
-/* skip up to where numeric digits appear */
-{
-while (*s != 0 && !isdigit(*s))
-    ++s;
-return s;
-}
-
-char *splitOffNonNumeric(char *s)
-/* Split off non-numeric part, e.g. mm of mm8. Result should be freed when done */
-{
-return cloneStringZ(s,skipToNumeric(s)-s);
-}
-
-char *splitOffNumber(char *db)
-/* Split off number part, e.g. 8 of mm8. Result should be freed when done */
-{
-return cloneString(skipToNumeric(db));
-}
-
-time_t mktimeFromUtc (struct tm *t)
-/* Return time_t for tm in UTC (GMT)
- * Useful for stuff like converting to time_t the
- * last-modified HTTP response header
- * which is always GMT. Returns -1 on failure of mktime */
-{
-    time_t time;
-    char *tz;
-    char save_tz[100];
-    tz=getenv("TZ");
-    if (tz)
-        safecpy(save_tz, sizeof(save_tz), tz);
-    setenv("TZ", "GMT0", 1);
-    tzset();
-    t->tm_isdst = 0;
-    time=mktime(t);
-    if (tz)
-        setenv("TZ", save_tz, 1);
-    else
-        unsetenv("TZ");
-    tzset();
-    return (time);
-}
-
-
-time_t dateToSeconds(const char *date,const char*format)
-// Convert a string date to time_t
-{
-struct tm storage={0,0,0,0,0,0,0,0,0};
-if (strptime(date,format,&storage)==NULL)
-    return 0;
-else
-    return mktime(&storage);
-}
-
-boolean dateIsOld(const char *date,const char*format)
-// Is this string date older than now?
-{
-time_t test = dateToSeconds(date,format);
-time_t now = clock1();
-return (test < now);
-}
-
-boolean dateIsOlderBy(const char *date,const char*format, time_t seconds)
-// Is this string date older than now by this many seconds?
-{
-time_t test = dateToSeconds(date,format);
-time_t now = clock1();
-return (test + seconds < now);
-}
-
-static int daysOfMonth(struct tm *tp)
-/* Returns the days of the month given the year */
-{
-int days=0;
-switch(tp->tm_mon)
-    {
-    case 3:
-    case 5:
-    case 8:
-    case 10:    days = 30;
-                break;
-    case 1:     days = 28;
-                if ( (tp->tm_year % 4) == 0
-                &&  ((tp->tm_year % 20) != 0 || (tp->tm_year % 100) == 0) )
-                    days = 29;
-                break;
-    default:    days = 31;
-                break;
-    }
-return days;
-}
-
-static void dateAdd(struct tm *tp,int addYears,int addMonths,int addDays)
-/* Add years,months,days to a date */
-{
-tp->tm_mday  += addDays;
-tp->tm_mon   += addMonths;
-tp->tm_year  += addYears;
-int dom=28;
-while ( (tp->tm_mon >11  || tp->tm_mon <0)
-    || (tp->tm_mday>dom || tp->tm_mday<1) )
-    {
-    if (tp->tm_mon>11)   // First month: tm.tm_mon is 0-11 range
-        {
-        tp->tm_year += (tp->tm_mon / 12);
-        tp->tm_mon  = (tp->tm_mon % 12);
-        }
-    else if (tp->tm_mon<0)
-        {
-        tp->tm_year += (tp->tm_mon / 12) - 1;
-        tp->tm_mon  =  (tp->tm_mon % 12) + 12;
-        }
-    else
-        {
-        dom = daysOfMonth(tp);
-        if (tp->tm_mday>dom)
-            {
-            tp->tm_mday -= dom;
-            tp->tm_mon  += 1;
-            dom = daysOfMonth(tp);
-            }
-        else if (tp->tm_mday < 1)
-            {
-            tp->tm_mon  -= 1;
-            dom = daysOfMonth(tp);
-            tp->tm_mday += dom;
-            }
-        }
-    }
-}
-
-char *dateAddTo(char *date,char *format,int addYears,int addMonths,int addDays)
-/* Add years,months,days to a formatted date and returns the new date as a cloned string
-*  format is a strptime/strftime format: %F = yyyy-mm-dd */
-{
-char *newDate = needMem(12);
-struct tm tp;
-if (strptime(date,format, &tp))
-    {
-    dateAdd(&tp,addYears,addMonths,addDays); // tp.tm_year only contains years since 1900
-    strftime(newDate,12,format,&tp);
-    }
-return cloneString(newDate);  // newDate is never freed!
-}
-
-boolean haplotype(const char *name)
-/* Is this name a haplotype name ?  _hap or _alt in the name */
-{
-if (stringIn("_hap", name) || stringIn("_alt", name))
-   return TRUE;
-else
-   return FALSE;
-}
diff --git a/gbtools/src/blatSrc/lib/common.ps b/gbtools/src/blatSrc/lib/common.ps
deleted file mode 100644
index b4a65c6..0000000
--- a/gbtools/src/blatSrc/lib/common.ps
+++ /dev/null
@@ -1,97 +0,0 @@
-%% Common postScript header.
-
-/boxHere {
-% Draw a box at current position.
-% Usage width height boxAt
-dup 0 exch   %stack width height 0 height
-rlineto      %stack width height
-exch dup 0   %stack height width width 0
-rlineto      %stack height width
-exch         %stack width height
-0 exch       %stack width 0 height
-neg          %stack width 0 -height
-rlineto      %stack width
-neg 0        %stack -width 0
-rlineto
-} def
-
-/boxAt {
-% Draw a box at a position.  Usage:
-% width height x y boxAt
-moveto
-boxHere
-} def
-
-/fillBox {
-% Draw filled box at a position. Usage:
-% width height x y fillBox
-newpath
-boxAt
-fill
-} def
-
-/strokeBox {
-% Draw stroked box at a position. Usage:
-% width height x y strokeBox
-newpath
-boxAt
-stroke
-} def
-
-/smallFont {
-/Times-Roman findfont
-10 scalefont
-setfont
-} def
-
-/showBefore {
-% Draw text immediately before rather
-% than immediately after current position.
-% Usage (some text) showBefore
-dup
-stringwidth
-neg
-exch
-neg
-exch
-rmoveto
-show
-} def
-
-/showMiddle {
-% Draw text centered at current position.
-% Usage (some text) showMiddle
-dup stringwidth
-2 div neg
-exch
-2 div neg
-exch
-rmoveto
-show
-} def
-
-/ellipse {
-/endangle exch def
-/startangle exch def
-/yrad exch def
-/xrad exch def
-/y exch def
-/x exch def
-/savematrix matrix currentmatrix def
-x y translate
-xrad yrad scale
-0 0 1 startangle endangle arc
-savematrix setmatrix
-} def
-
-/fillTextBox {
-true charpath pathbbox
-/y2 exch def /x2 exch def
-/y1 exch def /x1 exch def
-/w x2 x1 sub def
-/h y2 y1 sub def
-w h x1 y1 fillBox
-} def
-
-smallFont
-
diff --git a/gbtools/src/blatSrc/lib/common.pss b/gbtools/src/blatSrc/lib/common.pss
deleted file mode 100644
index 955f63a..0000000
--- a/gbtools/src/blatSrc/lib/common.pss
+++ /dev/null
@@ -1,96 +0,0 @@
-"%% Common postScript header.\n"
-"\n"
-"/boxHere {\n"
-"% Draw a box at current position.\n"
-"% Usage width height boxAt\n"
-"dup 0 exch   %stack width height 0 height\n"
-"rlineto      %stack width height\n"
-"exch dup 0   %stack height width width 0\n"
-"rlineto      %stack height width\n"
-"exch         %stack width height\n"
-"0 exch       %stack width 0 height\n"
-"neg          %stack width 0 -height\n"
-"rlineto      %stack width\n"
-"neg 0        %stack -width 0\n"
-"rlineto\n"
-"} def\n"
-"\n"
-"/boxAt {\n"
-"% Draw a box at a position.  Usage:\n"
-"% width height x y boxAt\n"
-"moveto\n"
-"boxHere\n"
-"} def\n"
-"\n"
-"/fillBox {\n"
-"% Draw filled box at a position. Usage:\n"
-"% width height x y fillBox\n"
-"newpath\n"
-"boxAt\n"
-"fill\n"
-"} def\n"
-"\n"
-"/strokeBox {\n"
-"% Draw stroked box at a position. Usage:\n"
-"% width height x y strokeBox\n"
-"newpath\n"
-"boxAt\n"
-"stroke\n"
-"} def\n"
-"\n"
-"/smallFont {\n"
-"/Times-Roman findfont\n"
-"10 scalefont\n"
-"setfont\n"
-"} def\n"
-"\n"
-"/showBefore {\n"
-"% Draw text immediately before rather\n"
-"% than immediately after current position.\n"
-"% Usage (some text) showBefore\n"
-"dup\n"
-"stringwidth\n"
-"neg\n"
-"exch\n"
-"neg\n"
-"exch\n"
-"rmoveto\n"
-"show\n"
-"} def\n"
-"\n"
-"/showMiddle {\n"
-"% Draw text centered at current position.\n"
-"% Usage (some text) showMiddle\n"
-"dup stringwidth\n"
-"2 div neg\n"
-"exch\n"
-"2 div neg\n"
-"exch\n"
-"rmoveto\n"
-"show\n"
-"} def\n"
-"\n"
-"/ellipse {\n"
-"/endangle exch def\n"
-"/startangle exch def\n"
-"/yrad exch def\n"
-"/xrad exch def\n"
-"/y exch def\n"
-"/x exch def\n"
-"/savematrix matrix currentmatrix def\n"
-"x y translate\n"
-"xrad yrad scale\n"
-"0 0 1 startangle endangle arc\n"
-"savematrix setmatrix\n"
-"} def\n"
-"/fillTextBox {\n"
-"true charpath pathbbox\n"
-"/y2 exch def /x2 exch def\n"
-"/y1 exch def /x1 exch def\n"
-"/w x2 x1 sub def\n"
-"/h y2 y1 sub def\n"
-"w h x1 y1 fillBox\n"
-"} def\n"
-"\n"
-"smallFont\n"
-"\n"
diff --git a/gbtools/src/blatSrc/lib/correlate.c b/gbtools/src/blatSrc/lib/correlate.c
deleted file mode 100644
index 34fa127..0000000
--- a/gbtools/src/blatSrc/lib/correlate.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* correlate - calculate r, also known as Pearson's correlation
- * coefficient.  r*r has the nice property that it explains
- * how much of one variable's variation can be explained as
- * a linear function of the other variable's variation.  Beware
- * the weight of extreme outliers though! */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "correlate.h"
-
-
-struct correlate *correlateNew()
-/* Return new correlation handler. */
-{
-struct correlate *c;
-return AllocVar(c);
-}
-
-void correlateFree(struct correlate **pC)
-/* Free up correlator. */
-{
-freez(pC);
-}
-
-void correlateNext(struct correlate *c, double x, double y)
-/* Add next sample to correlation. */
-{
-c->sumX += x;
-c->sumXX += x*x;
-c->sumXY += x*y;
-c->sumY += y;
-c->sumYY += y*y;
-c->n += 1; 
-}
-
-void correlateNextMulti(struct correlate *c, double x, double y, int count)
-/* Do same thing as calling correlateNext with x and y count times. */
-{
-double ct = count;	/* Do type conversion once. */
-double cx = ct*x;
-double cy = ct*y;
-c->sumX += cx;
-c->sumXX += cx*x;
-c->sumXY += cx*y;
-c->sumY += cy;
-c->sumYY += cy*y;
-c->n += count;
-}
-
-double correlateResult(struct correlate *c)
-/* Returns correlation (aka R) */
-{
-double r = 0;
-if (c->n > 0)
-    {
-    double sp = c->sumXY - c->sumX*c->sumY/c->n;
-    double ssx = c->sumXX - c->sumX*c->sumX/c->n;
-    double ssy = c->sumYY - c->sumY*c->sumY/c->n;
-    double q = ssx*ssy;
-    if (q != 0)
-        r = sp/sqrt(q);
-    }
-return r;
-}
-
-double correlateArrays(double *x, double *y, int size)
-/* Return correlation of two arrays of doubles. */
-{
-struct correlate *c = correlateNew();
-double r;
-int i;
-for (i=0; i<size; ++i)
-     correlateNext(c, x[i], y[i]);
-r = correlateResult(c);
-correlateFree(&c);
-return r;
-}
-
diff --git a/gbtools/src/blatSrc/lib/crTree.c b/gbtools/src/blatSrc/lib/crTree.c
deleted file mode 100644
index 4936dea..0000000
--- a/gbtools/src/blatSrc/lib/crTree.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/* Copyright (C) 2009 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-/* crTree chromosome r tree. This module creates and uses a disk-based index that can find items
- * that overlap with a chromosome range - something of the form chrN:start-end - with a
- * minimum of disk access.  It is implemented with a combination of bPlusTrees and r-trees. 
- * The items being indexed can overlap with each other.  
- * 
- * There's two main sides to using this module - creating an index, and using it.
- *
- * The first step of index creation is actually to insure that the file being indexed
- * is ordered by chromosome,start,end.  For a .bed file you can insure this
- * with the command:
- *     sort -k1,1 -k2,2n -k3,3n unsorted.bed > sorted.bed
- * Note that the the chromosome field is sorted alphabetically and the start and end
- * fields are sorted numerically.
- *
- * Once this is done then the index creation program scans the input file, and
- * makes a list of crTreeItems, one for each item in the file, and passed this
- * to the function crTreeFileCreate. A crTreeItem just contains the chromosome
- * range and file offset for an item.
- *
- * Using an index is done in two steps.  First you open the index with crTreeFileOpen,
- * and then you use crTreeFindOverlappingBlocks to find parts of the file the overlap
- * with your query range.  The result of a crTreeFindOverlappingBlocks call is a list
- * of regions in the file.  These regions typically include some non-overlapping items
- * as well.  It is up to the caller to parse through the resulting region list to
- * convert it from just bytes on disk into the memory data structure.  During this
- * parsing you should ignore items that don't overlap your range of interest.
- *
- * The programs crTreeIndexBed and crTreeSearchBed create and search a crTree index
- * for a bed file, and are useful examples to view for other programs that want to
- * use the crTree system. */
-
-
-#include "common.h"
-#include "hash.h"
-#include "udc.h"
-#include "sig.h"
-#include "bPlusTree.h"
-#include "cirTree.h"
-#include "crTree.h"
-
-#define chromOffsetPos 8	// Where in file chromosome b-tree lives
-#define cirOffsetPos 16		// Where in file interval r-tree lives
-#define crHeaderSize 64		// Size of file header 
-
-struct name32
-/* Pair of a name and a 32-bit integer. Used to assign IDs to chromosomes. */
-    {
-    struct name32 *next;
-    char *name;
-    bits32 val;
-    };
-
-static int name32Cmp(const void *va, const void *vb)
-/* Compare to sort on name. */
-{
-const struct name32 *a = ((struct name32 *)va);
-const struct name32 *b = ((struct name32 *)vb);
-return strcmp(a->name, b->name);
-}
-
-static void name32Key(const void *va, char *keyBuf)
-/* Get key field. */
-{
-const struct name32 *a = ((struct name32 *)va);
-strcpy(keyBuf, a->name);
-}
-
-static void *name32Val(const void *va)
-/* Get key field. */
-{
-const struct name32 *a = ((struct name32 *)va);
-return (void*)(&a->val);
-}
-
-struct crTreeRange
-/* A chromosome id and an interval inside it. */
-    {
-    char *chrom;	/* Chromosome id. String memory owned in hash. */
-    bits32 start;	/* Start position in chromosome. */
-    bits32 end;		/* One past last base in interval in chromosome. */
-    };
-
-struct ciContext 
-/* A structure that carries around context for the fetchKey and fetchOffset callbacks. */
-    {
-    struct crTreeRange (*fetchKey)(const void *va);   /* Given item, return key. */
-    bits64 (*fetchOffset)(const void *va); 		 /* Given item, return file offset */
-    };
-
-struct ciItem
-/* Small wrapper around crItem. Contains the key values precomputed, and the chromosome index
- * for each key. */
-     {
-     void *item;			/* Underlying cr item. */
-     struct crTreeRange key;		/* The key for this item. */
-     bits32 chromIx;			/* Associated chromosome index. */
-     };
-
-static struct cirTreeRange ciItemFetchKey(const void *va, void *context)
-/* Given item, return key. */
-{
-const struct ciItem *a = ((struct ciItem *)va);
-struct cirTreeRange ret;
-ret.chromIx = a->chromIx;
-ret.start = a->key.start;
-ret.end = a->key.end;
-return ret;
-}
-
-static bits64 ciItemFetchOffset(const void *va, void *context)
-/* Given item, return file offset */
-{
-const struct ciItem *a = ((struct ciItem *)va);
-const struct ciContext *c = context;
-return (c->fetchOffset)(a->item);
-}
-
-static bits32 mustFindChromIx(char *chrom, struct name32 *array, bits32 chromCount)
-/* Do a binary search on array to find the index associated with chrom.  Print
- * error message and abort if not found. */
-{
-struct name32 key;
-key.name = chrom;
-struct name32 *el = bsearch(&key, array, chromCount, sizeof(array[0]), name32Cmp);
-if (el == NULL)
-    errAbort("%s not found in mustFindChromIx\n", chrom);
-return el->val;
-}
-
-static void crTreeFileCreateLow(
-	char **chromNames,	/* All chromosome (or contig) names */
-	int chromCount,		/* Number of chromosomes. */
-	void *itemArray, 	/* Sorted array of things to index. */
-	int itemSize, 		/* Size of each element in array. */
-	bits64 itemCount, 	/* Number of elements in array. */
-	bits32 blockSize,	/* R tree block size - # of children for each node. */
-	bits32 itemsPerSlot,	/* Number of items to put in each index slot at lowest level. */
-	struct crTreeRange (*fetchKey)(const void *va),   /* Given item, return key. */
-	bits64 (*fetchOffset)(const void *va), 		 /* Given item, return file offset */
-	bits64 initialDataOffset,			 /* Offset of 1st piece of data in file. */
-	bits64 totalDataSize,				 /* Total size of data we are indexing. */
-	char *fileName)                                 /* Name of output file. */
-/* Create a r tree index file from an array of chromosomes and an array of items with
- * basic bed (chromosome,start,end) and file offset information. */
-{
-// uglyf("crTreeFileCreate %s itemCount=%llu, chromCount=%d\n", fileName, itemCount, chromCount);
-/* Open file and write header. */
-FILE *f = mustOpen(fileName, "wb");
-bits32 magic = crTreeSig;
-bits32 reserved32 = 0;
-bits64 chromOffset = crHeaderSize;
-bits64 cirOffset = 0;
-bits64 reserved64 = 0;
-writeOne(f, magic);
-writeOne(f, reserved32);
-writeOne(f, chromOffset);
-writeOne(f, cirOffset);	       /* Will fill this back in later */
-writeOne(f, reserved64);
-writeOne(f, reserved64);
-writeOne(f, reserved64);
-writeOne(f, reserved64);
-writeOne(f, reserved64);
-
-/* Convert array of chromosomes to a sorted array of name32s.  Also
- * figure out maximum chromosome name size. */
-struct name32 *name32Array;
-AllocArray(name32Array, chromCount);
-bits32 chromIx;
-int maxChromNameSize = 0;
-for (chromIx=0; chromIx<chromCount; ++chromIx)
-    {
-    struct name32 *name32 = &name32Array[chromIx];
-    char *name = chromNames[chromIx];
-    name32->name = name;
-    int nameSize = strlen(name);
-    if (nameSize > maxChromNameSize)
-        maxChromNameSize = nameSize;
-    }
-qsort(name32Array, chromCount, sizeof(name32Array[0]), name32Cmp);
-for (chromIx=0; chromIx<chromCount; ++chromIx)
-    {
-    struct name32 *name32 = &name32Array[chromIx];
-    name32->val = chromIx;
-    }
-
-/* Write out bPlusTree index of chromosome IDs. */
-int chromBlockSize = min(blockSize, chromCount);
-bptFileBulkIndexToOpenFile(name32Array, sizeof(name32Array[0]), chromCount, chromBlockSize,
-    name32Key, maxChromNameSize, name32Val, sizeof(name32Array[0].val), f);
-	
-/* Convert itemArray to ciItemArray.  This is mainly to avoid having to do the chromosome to
- * chromosome index conversion for each item.  The cost is some memory though.... */
-struct ciItem *ciItemArray;
-AllocArray(ciItemArray, itemCount);
-bits64 itemIx;
-char *itemPos = itemArray;
-char *lastChrom = "";
-bits32 lastChromIx = 0;
-for (itemIx=0; itemIx < itemCount; ++itemIx)
-    {
-    struct ciItem *ciItem = &ciItemArray[itemIx];
-    ciItem->item = itemPos;
-    ciItem->key = (*fetchKey)(itemPos);
-    if (!sameString(lastChrom, ciItem->key.chrom))
-        {
-	lastChrom = ciItem->key.chrom;
-	lastChromIx = mustFindChromIx(lastChrom, name32Array, chromCount);
-	}
-    ciItem->chromIx = lastChromIx;
-    itemPos += itemSize;
-    }
-
-/* Record starting position of r tree and write it out. */
-cirOffset = ftell(f);
-struct ciContext context;
-ZeroVar(&context);
-context.fetchKey = fetchKey;
-context.fetchOffset = fetchOffset;
-cirTreeFileBulkIndexToOpenFile(ciItemArray, sizeof(ciItemArray[0]), itemCount, blockSize, 
-	itemsPerSlot, &context, ciItemFetchKey, ciItemFetchOffset, totalDataSize, f);
-
-/* Seek back and write offset to r tree. */
-fseek(f, cirOffsetPos, SEEK_SET);
-writeOne(f, cirOffset);
-
-
-/* Clean up */
-freez(&name32Array);
-carefulClose(&f);
-}
-
-int crTreeItemCmp(const void *va, const void *vb)
-/* Compare to sort based on chrom,start,end. */
-{
-const struct crTreeItem *a = ((struct crTreeItem *)va);
-const struct crTreeItem *b = ((struct crTreeItem *)vb);
-int dif;
-dif = strcmp(a->chrom, b->chrom);
-if (dif == 0)
-    dif = a->start - b->start;
-if (dif == 0)
-    dif = a->end - b->end;
-return dif;
-}
-
-struct crTreeRange crTreeItemKey(const void *va)
-/* Get key fields. */
-{
-const struct crTreeItem *a = *((struct crTreeItem **)va);
-struct crTreeRange ret;
-ret.chrom = a->chrom;
-ret.start = a->start;
-ret.end = a->end;
-return ret;
-}
-
-bits64 crTreeItemOffset(const void *va)
-/* Get offset of item in file. */
-{
-const struct crTreeItem *a = *((struct crTreeItem **)va);
-return a->fileOffset;
-}
-
-void crTreeFileCreateInputCheck(struct crTreeItem *itemList, struct hash *chromHash, 
-	bits32 blockSize, bits32 itemsPerSlot, bits64 endPosition, char *fileName)
-/* Do sanity checking on itemList and chromHash and endPosition.  Make sure that itemList is
- * sorted properly mostly. */
-{
-struct crTreeItem *item, *next;
-for (item = itemList; item != NULL; item = next)
-    {
-    next = item->next;
-    if (next != NULL)
-	{
-        if (crTreeItemCmp(item, next) > 0)
-	    errAbort("Out of order itemList in crTreeFileCreateInputCheck");
-	if (item->fileOffset > next->fileOffset)
-	    errAbort("Out of sequence itemList in crTreeFileCreateInputCheck");
-	}
-    }
-}
-
-
-void crTreeFileCreate(
-	struct crTreeItem *itemList,  /* List of all items - sorted here and in underlying file. */
-	struct hash *chromHash,	      /* Hash of all chromosome names. */
-	bits32 blockSize,	/* R tree block size - # of children for each node. 1024 is good. */
-	bits32 itemsPerSlot,	/* Number of items to put in each index slot at lowest level.
-				 * Typically either blockSize/2 or 1. */
-	bits64 endPosition,	/* File offset after have read all items in file. */
-	char *fileName)        /* Name of output file. */
-/* Create a cr tree index of file. The itemList contains the position of each item in the
- * chromosome and in the file being indexed.  Both the file and the itemList must be sorted
- * by chromosome (alphabetic), start (numerical), end (numerical). 
- *    We recommend you run crTreeFileCreateInputCheck on the input parameters right before
- * calling this if you have problems. */
-{
-/* We can't handle empty input... */
-if (itemList == NULL)
-    errAbort("crTreeFileCreate can't handle empty itemList.");
-
-/* Make array of pointers out of linked list. */
-struct crTreeItem **itemArray;
-bits32 itemCount = slCount(itemList);
-AllocArray(itemArray, itemCount);
-struct crTreeItem *item;
-int itemIx;
-for (itemIx=0, item=itemList; itemIx<itemCount; ++itemIx, item=item->next)
-    itemArray[itemIx] = item;
-
-/* Make up chromosome array. */
-int chromCount = chromHash->elCount;
-char **chromArray;
-AllocArray(chromArray, chromCount);
-struct hashEl *el, *list = hashElListHash(chromHash);
-bits32 chromIx;
-for (el = list, chromIx=0; el != NULL; el = el->next, ++chromIx)
-    chromArray[chromIx] = el->name;
-slFreeList(&list);
-
-/* Call function to make index file. */
-crTreeFileCreateLow(chromArray, chromCount, itemArray, sizeof(itemArray[0]), itemCount,
-	blockSize, itemsPerSlot, crTreeItemKey, crTreeItemOffset, itemList->fileOffset, 
-	endPosition, fileName);
-}
-
-/****** Start of reading and searching (as opposed to file creation) code *******/
-
-struct crTreeFile *crTreeFileOpen(char *fileName)
-/* Open up r-tree index file - reading headers and verifying things. */
-{
-/* Open file and allocate structure to hold info from header etc. */
-struct udcFile *udc = udcFileOpen(fileName, udcDefaultDir());
-struct crTreeFile *crt = needMem(sizeof(*crt));
-fileName = crt->fileName = cloneString(fileName);
-crt->udc = udc;
-
-/* Read magic number at head of file and use it to see if we are proper file type, and
- * see if we are byte-swapped. */
-bits32 magic;
-boolean isSwapped = FALSE;
-udcMustReadOne(udc, magic);
-if (magic != crTreeSig)
-    {
-    magic = byteSwap32(magic);
-    isSwapped = crt->isSwapped = TRUE;
-    if (magic != crTreeSig)
-       errAbort("%s is not a chromosome r-tree index file", fileName);
-    }
-
-/* Read rest of high level header including notably the offsets to the
- * chromosome and range indexes. */
-bits32 reserved32;
-udcMustReadOne(udc, reserved32);
-crt->chromOffset = udcReadBits64(udc, isSwapped);
-crt->cirOffset = udcReadBits64(udc, isSwapped);
-
-/* Read in the chromosome index header. */
-udcSeek(udc, crt->chromOffset);
-crt->chromBpt = bptFileAttach(fileName, udc);
-
-/* Read in range index header. */
-udcSeek(udc, crt->cirOffset);
-crt->cir = cirTreeFileAttach(fileName, udc);
-
-return crt;
-}
-
-void crTreeFileClose(struct crTreeFile **pCrt)
-/* Close and free up crTree file opened with crTreeFileAttach. */
-{
-struct crTreeFile *crt = *pCrt;
-if (crt != NULL)
-    {
-    cirTreeFileDetach(&crt->cir);
-    bptFileDetach(&crt->chromBpt);
-    udcFileClose(&crt->udc);
-    freez(&crt->fileName);
-    freez(pCrt);
-    }
-}
-
-
-struct fileOffsetSize *crTreeFindOverlappingBlocks(struct crTreeFile *crt, 
-	char *chrom, bits32 start, bits32 end)
-/* Return list of file blocks that between them contain all items that overlap
- * start/end on chromIx.  Also there will be likely some non-overlapping items
- * in these blocks too. When done, use slListFree to dispose of the result. */
-{
-/* Find chromosome index.  Return NULL if no such chromosome*/
-bits32 chromIx;
-if (!bptFileFind(crt->chromBpt, chrom, strlen(chrom), &chromIx, sizeof(chromIx)))
-    return NULL;
-
-return cirTreeFindOverlappingBlocks(crt->cir, chromIx, start, end);
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/dgRange.c b/gbtools/src/blatSrc/lib/dgRange.c
deleted file mode 100644
index ed2e33a..0000000
--- a/gbtools/src/blatSrc/lib/dgRange.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/* dgRange - stuff to tell if a graph which has a range
- * of values associated with each edge is internally consistent.  
- * See comment under bfGraphFromRangeGraph for details. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "diGraph.h"
-
-
-struct bfEdge
-/* An edge in a (lightweight) Belman Ford graph. */
-   {
-   struct bfEdge *next;    /* Pointer to next element. */
-   int distance;           /* Distance - may be negative. */
-   struct bfVertex *in;    /* Connecting node. */
-   struct bfVertex *out;   /* Connecting node. */
-   };
-
-struct bfVertex
-/* A node in a (lightweight) Belman Ford graph. */
-   {
-   int position;               /* Currently assigned position. */
-   struct bfEdge *waysOut;     /* Ways out. */
-   };
-
-struct bfGraph
-/* A lightweight, but fixed sized graph for Belman Ford algorithm. */
-    {
-    int vertexCount;	         /* Number of vertices */
-    struct bfVertex *vertices;   /* Array of vertices. */
-    int edgeCount;               /* Number of edges. */
-    struct bfEdge *edges;        /* Array of edges. */
-    };
-
-struct bfRange 
-/* Min and max distances allowed for an edge. */
-   {
-   int minDist, maxDist;
-   };
-
-static void bfGraphFree(struct bfGraph **pGraph)
-/* Free up Belman-Ford graph. */
-{
-struct bfGraph *graph = *pGraph;
-if (graph != NULL)
-    {
-    freeMem(graph->vertices);
-    freeMem(graph->edges);
-    freez(pGraph);
-    }
-}
-
-static struct bfGraph *bfGraphFromRangeGraph(struct diGraph *rangeGraph, 
-   boolean (*findEdgeRange)(struct dgEdge *edge, int *retMin, int *retMax),
-   struct dgNode *a, struct dgNode *b, int abMin, int abMax)
-/* Construct a directed graph with two edges for each
- * edge of the range graph.  Where the range graph
- * has the following info:
- *     sourceNode destNode minDistance maxDistance
- *    -------------------------------------------
- *         A         B         2          5
- * The bfGraph would have:
- *     sourceNode destNode   edgeVal  meaning
- *    --------------------------------------------
- *         A         B         5     D(A) - D(B) <= 5 
- *         B         A        -2     D(B) - D(A) <= -2
- * Furthermore the bfGraph introduces a new node,
- * "zero", which has a zero-valued connection to
- * all other nodes.
- *
- * This graph can then be processed via the Bellman-
- * Ford algorithm (see p. 532 of Cormen,Leiserson and
- * Rivest's Introduction to Algorithms, MIT Press 1990)
- * to see if the bfGraph, and by extension the range
- * graph, is consistent.
- */
-{
-struct bfGraph *bfGraph;
-struct bfVertex *vertices, *freeVertex, *newSource, *newDest, *zeroVertex;
-struct bfEdge *edges, *newEdge, *freeEdge;
-struct dgNode *oldSource, *oldDest, *oldNode;
-int oldEdgeCount = dlCount(rangeGraph->edgeList);
-int oldVertexCount = 0;
-
-/* Coopt topoOrder field to store unique ID for each
- * node, starting at 1.  (We'll reserve 0 for the
- * node we insert - the Belman Ford "zero" node.)*/
-for (oldNode = rangeGraph->nodeList; oldNode != NULL; oldNode = oldNode->next)
-    oldNode->topoOrder = ++oldVertexCount;
-
-/* Allocate space for new graph. */
-AllocVar(bfGraph);
-bfGraph->vertexCount = oldVertexCount + 1;
-bfGraph->vertices = freeVertex = AllocArray(vertices, bfGraph->vertexCount);
-bfGraph->edgeCount = 2*oldEdgeCount + oldVertexCount;
-if (a != NULL)
-  bfGraph->edgeCount += 2;
-bfGraph->edges = freeEdge = AllocArray(edges, bfGraph->edgeCount);
-
-/* Get zero vertex. */
-zeroVertex = freeVertex++;
-
-/* Scan through old graph and add vertices to new graph. */
-for (oldSource = rangeGraph->nodeList; oldSource != NULL; 
-    oldSource = oldSource->next)
-    {
-    struct dgConnection *dgConn;
-    int rangeMin, rangeMax;
-
-    /* Allocate new source vertex. */
-    newSource = freeVertex++;
-
-    /* Make connection from zero vertex to this one. */
-    newEdge = freeEdge++;
-    newEdge->distance = 0;
-    newEdge->in = zeroVertex;
-    newEdge->out = newSource;
-    slAddHead(&zeroVertex->waysOut, newEdge);
-
-    /* Loop through all ways out of source. */
-    for (dgConn = oldSource->nextList; dgConn != NULL; dgConn = dgConn->next)
-        {
-	/* Find destination vertex and size range of edge. */
-	if ((*findEdgeRange)(dgConn->edgeOnList->val, &rangeMin, &rangeMax))
-	    {
-	    oldDest = dgConn->node;
-	    newDest = &vertices[oldDest->topoOrder];
-
-	    /* Make two new edges corresponding to old edge. */
-	    newEdge = freeEdge++;
-	    newEdge->distance = rangeMax;
-	    newEdge->in = newSource;
-	    newEdge->out = newDest;
-	    slAddHead(&newSource->waysOut, newEdge);
-	    newEdge = freeEdge++;
-	    newEdge->distance = -rangeMin;
-	    newEdge->in = newDest;
-	    newEdge->out = newSource;
-	    slAddHead(&newDest->waysOut, newEdge);
-	    }
-	}
-    }
-/* Add additional pair of edges for extra range if applicable. */
-if (a != NULL)
-    {
-    newSource = &vertices[a->topoOrder];
-    newDest = &vertices[b->topoOrder];
-    newEdge = freeEdge++;
-    newEdge->distance = abMax;
-    newEdge->in = newSource;
-    newEdge->out = newDest;
-    slAddHead(&newSource->waysOut, newEdge);
-    newEdge = freeEdge++;
-    newEdge->distance = -abMin;
-    newEdge->in = newDest;
-    newEdge->out = newSource;
-    slAddHead(&newDest->waysOut, newEdge);
-    }
-bfGraph->edgeCount = freeEdge - bfGraph->edges;
-return bfGraph;
-}
-
-static boolean bfCheckGraph(struct bfGraph *graph)
-/* Run Belman-Ford algorithm to check graph for consistency. */
-{
-struct bfVertex *vertices = graph->vertices, *in, *out;
-int vertexCount = graph->vertexCount;
-int edgeCount = graph->edgeCount;
-struct bfEdge *edges = graph->edges, *edge;
-int i, edgeIx;
-int maxIterations = vertexCount - 1;
-boolean anyChange = FALSE;
-int newPos;
-
-for (i=0; i<vertexCount; ++i)
-    vertices[i].position = 0x3fffffff;    /* Mighty big number. */
-for (i=0; i<maxIterations; ++i)
-    {
-    anyChange = FALSE;
-    for (edgeIx = 0, edge = edges; edgeIx < edgeCount; ++edgeIx, ++edge)
-        {
-	in = edge->in;
-	out = edge->out;
-	newPos = in->position + edge->distance;
-	if (newPos < out->position)
-	    {
-	    out->position = newPos;
-	    anyChange = TRUE;
-	    }
-	}
-    if (!anyChange)
-        break;
-    }
-return !anyChange;
-}
-
-boolean dgAddedRangeConsistent(struct diGraph *rangeGraph,
-   struct dgNode *a, struct dgNode *b, int abMin, int abMax,
-   boolean (*findEdgeRange)(struct dgEdge *edge, int *retMin, int *retMax) )
-/* Return TRUE if graph with a range of allowable distances associated
- * with each edge would be internally consistent if add edge from a to b
- * with given min/max values. */
-{
-struct bfGraph *bfGraph;
-boolean ok; 
-
-bfGraph = bfGraphFromRangeGraph(rangeGraph, findEdgeRange, a, b, abMin, abMax);
-ok = bfCheckGraph(bfGraph);
-bfGraphFree(&bfGraph);
-return ok;
-}
-
-boolean dgRangesConsistent(struct diGraph *rangeGraph,
-   boolean (*findEdgeRange)(struct dgEdge *edge, int *retMin, int *retMax) )
-/* Return TRUE if graph with a range of allowable distances associated
- * with each edge is internally consistent. */
-{
-return dgAddedRangeConsistent(rangeGraph, NULL, NULL, 0, 0, findEdgeRange);
-}
-
diff --git a/gbtools/src/blatSrc/lib/diGraph.c b/gbtools/src/blatSrc/lib/diGraph.c
deleted file mode 100644
index a76204e..0000000
--- a/gbtools/src/blatSrc/lib/diGraph.c
+++ /dev/null
@@ -1,741 +0,0 @@
-/* diGraph - Directed graph routines. 
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "hash.h"
-#include "dlist.h"
-#include "diGraph.h"
-
-
-struct diGraph *dgNew()
-/* Return a new directed graph object. */
-{
-struct diGraph *dg;
-AllocVar(dg);
-dg->nodeHash = newHash(0);
-dg->edgeList = newDlList();
-return dg;
-}
-
-static void dgNodeFree(struct dgNode **pNode)
-/* Free a diGraph node. */
-{
-struct dgNode *node = *pNode;
-if (node == NULL)
-    return;
-slFreeList(&node->nextList);
-slFreeList(&node->prevList);
-freez(pNode);
-}
-
-static void dgNodeFreeList(struct dgNode **pList)
-/* Free list of diGraph nodes. */
-{
-struct dgNode *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    dgNodeFree(&el);
-    }
-*pList = NULL;
-}
-
-void dgFree(struct diGraph **pGraph)
-/* Free a directed graph. */
-{
-struct diGraph *dg = *pGraph;
-if (dg == NULL)
-    return;
-freeHash(&dg->nodeHash);
-dgNodeFreeList(&dg->nodeList);
-freeDlListAndVals(&dg->edgeList);
-freez(pGraph);
-}
-
-
-struct dgNode *dgAddNode(struct diGraph *dg, char *name, void *val)
-/* Create new node in graph. It's legal (but not efficient) to add
- * a node with the same name and value twice.  It's not legal to
- * add a node with the same name and a different value.  
- * You can pass in NULL for the name in which case the 
- * hexadecimal representation of val will become the name. */
-{
-struct dgNode *node;
-struct hashEl *hel;
-struct hash *hash = dg->nodeHash;
-char nbuf[17];
-
-if (name == NULL)
-    {
-    sprintf(nbuf, "%p", val);
-    name = nbuf;
-    }
-hel = hashLookup(hash, name);
-if (hel != NULL)
-    {
-    node = hel->val;
-    if (node->val != val)
-	{
-	errAbort("Trying to add node %s with a new value (old 0x%llx new 0x%llx)",
-	    name, ptrToLL(node->val), ptrToLL(val));
-	}
-    return node;
-    }
-AllocVar(node);
-hel = hashAdd(hash, name, node);
-node->name = hel->name;
-node->val = val;
-slAddHead(&dg->nodeList, node);
-return node;
-}
-
-struct dgNode *dgAddNumberedNode(struct diGraph *dg, int id, void *val)
-/* Create new node with a number instead of a name. */
-{
-char buf[16];
-sprintf(buf, "%d", id);
-return dgAddNode(dg, buf, val);
-}
-
-struct dgNode *dgFindNode(struct diGraph *dg, char *name)
-/* Find existing node in graph. Return NULL if not in graph. */
-{
-struct hashEl *hel;
-if ((hel = hashLookup(dg->nodeHash, name)) == NULL)
-    return NULL;
-return hel->val;
-}
-
-struct dgNode *dgFindNumberedNode(struct diGraph *dg, int id)
-/* Find node given number. */
-{
-char buf[16];
-sprintf(buf, "%d", id);
-return dgFindNode(dg, buf);
-}
-
-
-void *dgNodeVal(struct dgNode *node)
-/* Return value associated with node. */
-{
-return node->val;
-}
-
-void *dgNodeName(struct dgNode *node)
-/* Return name associated with node. */
-{
-return node->name;
-}
-
-int dgNodeNumber(struct dgNode *node)
-/* Return number of node.  (Will likely return 0 if node
- * was added with a name rather than a number). */
-{
-return atoi(node->name);
-}
-
-struct dgNodeRef *dgFindNodeInRefList(struct dgNodeRef *refList, struct dgNode *node)
-/* Return reference to node if in list, or NULL if not. */
-{
-struct dgNodeRef *ref;
-for (ref = refList; ref != NULL; ref = ref->next)
-    if (ref->node == node)
-	return ref;
-return NULL;
-}
-
-struct dgConnection *dgFindNodeInConList(struct dgConnection *conList, struct dgNode *node)
-/* Return connection to node if in list, or NULL if not. */
-{
-struct dgConnection *con;
-for (con = conList; con != NULL; con = con->next)
-    if (con->node == node)
-	return con;
-return NULL;
-}
-
-
-struct dgEdge *dgConnect(struct diGraph *dg, struct dgNode *a, struct dgNode *b)
-/* Connect node a to node b.  Returns connecting edge. 
- * Not an error to reconnect.  However all connects can 
- * be broken with a single disconnect. */
-{
-return dgConnectWithVal(dg, a, b, NULL);
-}
-
-struct dgEdge *dgConnectWithVal(struct diGraph *dg, struct dgNode *a, 
-     struct dgNode *b, void *val)
-/* Connect node a to node b and put val on edge.  An error to
- * reconnect with a different val. */
-{
-struct dgConnection *con;
-struct dgEdge *edge;
-struct dlNode *edgeOnList;
-
-/* Check to see if it's already there. */
-if ((con = dgFindNodeInConList(a->nextList, b)) != NULL)
-    {
-    edge =  con->edgeOnList->val;
-    if (val != edge->val)
-        warn("Trying to add new value to edge between %s and %s, ignoring",
-	   a->name, b->name);
-    return edge;
-    }
-/* Allocate edge and put on list. */
-AllocVar(edge);
-edge->a = a;
-edge->b = b;
-edge->val = val;
-edgeOnList = dlAddValTail(dg->edgeList, edge);
-
-/* Connect nodes to each other. */
-AllocVar(con);
-con->node = b;
-con->edgeOnList = edgeOnList;
-slAddHead(&a->nextList, con);
-AllocVar(con);
-con->node = a;
-con->edgeOnList = edgeOnList;
-slAddHead(&b->prevList, con);
-
-return edge;
-}
-
-static struct dlNode *dgRemoveFromConList(struct dgConnection **pConList, 
-	struct dgNode *node, struct dgConnection **retCon)
-/* Remove reference to node from list. */
-{
-struct dgConnection *newList = NULL;
-struct dgConnection *con, *next;
-struct dlNode *edgeOnList = NULL;
-
-for (con = *pConList; con != NULL; con = next)
-    {
-    next = con->next;
-    if (con->node == node)
-	{
-	edgeOnList = con->edgeOnList;
-	if (retCon != NULL)
-	    *retCon = con;
-	else
-	    freeMem(con);
-	}
-    else
-	{
-	slAddHead(&newList, con);
-	}
-    }
-slReverse(&newList);
-*pConList = newList;
-return edgeOnList;
-}
-
-void dgDisconnect(struct diGraph *dg, struct dgNode *a, struct dgNode *b)
-/* Disconnect nodes a and b. */
-{
-struct dlNode *edgeInList;
-struct dgEdge *edge;
-
-dgRemoveFromConList(&a->nextList, b, NULL);
-edgeInList = dgRemoveFromConList(&b->prevList, a, NULL);
-if (edgeInList != NULL)
-    {
-    edge = edgeInList->val;
-    dlRemove(edgeInList);
-    freeMem(edgeInList);
-    freeMem(edge);
-    }
-}
-
-
-void dgClearVisitFlags(struct diGraph *dg)
-/* Clear out visit flags. */
-{
-struct dgNode *node;
-for (node = dg->nodeList; node != NULL; node = node->next)
-    node->visited = FALSE;
-}
-
-void dgClearConnFlags(struct diGraph *dg)
-/* Clear out connect flags. */
-{
-struct dgNode *node;
-for (node = dg->nodeList; node != NULL; node = node->next)
-    node->conn = FALSE;
-}
-
-static struct dgNode *rTarget;
-
-static boolean rPathExists(struct dgNode *a)
-/* Recursively find if path from a to b exists. */
-{
-struct dgConnection *ref;
-if (a == rTarget)
-    return TRUE;
-a->visited = TRUE;
-
-for (ref = a->nextList; ref != NULL; ref = ref->next)
-    {
-    if (!ref->node->visited && rPathExists(ref->node))
-	return TRUE;
-    }
-return FALSE;
-}
-
-boolean dgPathExists(struct diGraph *dg, struct dgNode *a, struct dgNode *b)
-/* Return TRUE if there's a path from a to b. */
-{
-rTarget = b;
-dgClearVisitFlags(dg);
-return rPathExists(a);
-}
-
-static int topoIx;
-
-static void rTopoSort(struct dgNode *node)
-{
-struct dgConnection *ref;
-node->visited = TRUE;
-for (ref = node->nextList; ref != NULL; ref = ref->next)
-    {
-    if (!ref->node->visited)
-	rTopoSort(ref->node);
-    }
-node->topoOrder = ++topoIx;
-}
-
-void dgTopoSort(struct diGraph *dg)
-/* Fill in topological order of nodes. */
-{
-struct dgNode *node;
-
-topoIx = 0;
-dgClearVisitFlags(dg);
-for (node = dg->nodeList; node != NULL; node = node->next)
-    {
-    if (!node->visited)
-	rTopoSort(node);
-    }
-}
-
-static boolean  rHasCycles(struct dgNode *node)
-/* Recursively see if has cycles by looking for
- * backwards topoOrder. */
-{
-struct dgConnection *ref;
-struct dgNode *child;
-
-node->visited = TRUE;
-for (ref = node->nextList; ref != NULL; ref = ref->next)
-    {
-    child = ref->node;
-    if (child->topoOrder > node->topoOrder)
-	return TRUE;
-    if (!child->visited)
-	if (rHasCycles(child))
-	    return TRUE;
-    }
-return FALSE;
-}
-
-boolean dgHasCycles(struct diGraph *dg)
-/* Return TRUE if directed graph has cycles. */
-{
-struct dgNode *node;
-
-dgTopoSort(dg);
-dgClearVisitFlags(dg);
-for (node = dg->nodeList; node != NULL; node = node->next)
-    {
-    if (!node->visited)
-	if (rHasCycles(node))
-	    return TRUE;
-    }
-return FALSE;
-}
-
-struct dgNodeRef *rRefList;
-bool rMustHaveVal;			/* Set to TRUE if rFindConnected only to
-                                         * consider nodes with values in connections. */
-
-static void rFindConnected(struct dgNode *a)
-/* Find all things connected to a directly or not that haven't
- * already been visited and put them on rRefList. */
-{
-if (!a->conn && (!rMustHaveVal || a->val))
-    {
-    struct dgNodeRef *ref;
-    struct dgConnection *con;
-    AllocVar(ref);
-    ref->node = a;
-    slAddHead(&rRefList, ref);
-    a->conn = TRUE;
-    for (con = a->nextList; con != NULL; con = con->next)
-	rFindConnected(con->node);
-    for (con = a->prevList; con != NULL; con = con->next)
-	rFindConnected(con->node);
-    }
-}
-
-struct dgNodeRef *dgFindNextConnected(struct diGraph *dg)
-/* Return list of nodes that make up next connected component,
- * or NULL if no more components.  slFreeList this when
- * done.  Call "dgClearConnFlags" before first call to this.
- * Do not call dgFindConnectedToNode between dgFindFirstConnected 
- * and this as they use the same flag variables to keep track of
- * what vertices are used. */
-{
-struct dgNode *a;
-
-for (a=dg->nodeList; a != NULL; a = a->next)
-    {
-    if (!a->conn)
-	break;
-    }
-if (a == NULL)
-    return NULL;
-rRefList = NULL;
-rMustHaveVal = FALSE;
-rFindConnected(a);
-return rRefList;
-}
-
-struct dgNodeRef *dgFindNextConnectedWithVals(struct diGraph *dg)
-/* Like dgFindConnected, but only considers graph nodes that
- * have a val attached. */
-{
-struct dgNode *a;
-
-for (a=dg->nodeList; a != NULL; a = a->next)
-    {
-    if (!a->conn && a->val != NULL)
-	break;
-    }
-if (a == NULL)
-    return NULL;
-rRefList = NULL;
-rMustHaveVal = TRUE;
-rFindConnected(a);
-return rRefList;
-}
-
-
-static int connectedComponents(struct diGraph *dg)
-/* Count number of connected components and set component field
- * of each node to reflect which component it is in. */
-{
-struct dgNodeRef *ref;
-int conCount = 0;
-struct dgNode *a = dg->nodeList;
-
-dgClearConnFlags(dg);
-for (;;)
-    {
-    for (; a != NULL; a = a->next)
-	{
-	if (!a->conn && (!rMustHaveVal || a->val))
-	    break;
-	}
-    if (a == NULL)
-	break;
-    rRefList = NULL;
-    rFindConnected(a);
-    ++conCount;
-    for (ref = rRefList; ref != NULL; ref = ref->next)
-	{
-	ref->node->component = conCount;
-	}
-    slFreeList(&rRefList);
-    }
-return conCount;
-}
-
-int dgConnectedComponents(struct diGraph *dg)
-/* Count number of connected components and set component field
- * of each node to reflect which component it is in. */
-{
-rMustHaveVal = FALSE;
-return connectedComponents(dg);
-}
-
-int dgConnectedComponentsWithVals(struct diGraph *dg)
-/* Count number of connected components and set component field
- * of each node to reflect which component it is in. Only
- * consider components with values. */
-{
-rMustHaveVal = TRUE;
-return connectedComponents(dg);
-}
-
-struct dgNodeRef *dgFindNewConnected(struct diGraph *dg, struct dgNode *a)
-/* Find a connected component guaranteed not to be covered before 
- * including a. */
-{
-rRefList = NULL;
-rMustHaveVal = FALSE;
-rFindConnected(a);
-return rRefList;
-}
-
-struct dgNodeRef *dgFindNewConnectedWithVals(struct diGraph *dg, struct dgNode *a)
-/* Find a connected component guaranteed not to be covered before 
- * that includes a.  Connected components must have values*/
-{
-rRefList = NULL;
-rMustHaveVal = TRUE;
-rFindConnected(a);
-return rRefList;
-}
-
-
-struct dgNodeRef *dgFindConnectedToNode(struct diGraph *dg, struct dgNode *a)
-/* Return reference list of all nodes connected to a, including a.
- * slFreeList this list when done. */
-{
-dgClearConnFlags(dg);
-return dgFindNewConnected(dg, a);
-}
-
-struct dgEdge *dgDirectlyFollows(struct diGraph *dg, struct dgNode *a, struct dgNode *b)
-/* Return TRUE if b directly follows a. */
-{
-struct dgConnection *con = dgFindNodeInConList(a->nextList, b);
-if (con == NULL)
-    return NULL;
-return con->edgeOnList->val;
-}
-
-struct dgNodeRef *dgFindPath(struct diGraph *dg, struct dgNode *a, struct dgNode *b)
-/* Find shortest path from a to b.  Return NULL if can't be found. */
-{
-struct dgNodeRef *refList  = NULL, *ref;
-struct dgConnection *con;
-struct dgNode *node, *nNode;
-struct dlList *fifo;
-struct dlNode *ffNode;
-struct dgNode endNode;
-int fifoSize = 1;
-
-/* Do some quick and easy tests first to return if have no way out
- * of node A, or if B directly follows A. */
-if (a->nextList == NULL)
-    return NULL;
-if (a == b)
-    {
-    AllocVar(ref);
-    ref->node = a;
-    return ref;
-    }
-if ((con = dgFindNodeInConList(a->nextList, b)) != NULL)
-    {
-    AllocVar(refList);
-    refList->node = a;
-    node = con->node;
-    AllocVar(ref);
-    ref->node = node;
-    slAddTail(&refList, ref);
-    return refList;
-    }
-
-/* Set up for breadth first traversal.  Will use a doubly linked
- * list as a fifo. */
-for (node = dg->nodeList; node != NULL; node = node->next)
-    node->tempEntry = NULL;
-fifo = newDlList();
-dlAddValTail(fifo, a);
-a->tempEntry = &endNode;
-
-while ((ffNode = dlPopHead(fifo)) != NULL)
-    {
-    --fifoSize;
-    node = ffNode->val;
-    freeMem(ffNode);
-    for (con = node->nextList; con != NULL; con = con->next)
-	{
-	nNode = con->node;
-	if (nNode->tempEntry == NULL)
-	    {
-	    nNode->tempEntry = node;
-	    if (nNode == b)
-		{
-		while (nNode != &endNode && nNode != NULL)
-		    {
-		    AllocVar(ref);
-		    ref->node = nNode;
-		    slAddHead(&refList, ref);
-		    nNode = nNode->tempEntry;
-		    }
-		break;
-		}
-	    else
-		{
-		dlAddValTail(fifo, nNode);
-		++fifoSize;
-		if (fifoSize > 100000)
-		    errAbort("Internal error in dgFindPath");
-		}
-	    }
-	}
-    }
-freeDlList(&fifo);
-return refList;
-}
-
-static int cmpPriority(const void *va, const void *vb)
-/* Sort smallest offset into needle first. */
-{
-const struct dgNode *a = *((struct dgNode **)va);
-const struct dgNode *b = *((struct dgNode **)vb);
-return (a->priority - b->priority);
-}
-
-boolean dgParentsAllVisited(struct dgNode *node)
-/* Return TRUE if all parents of node have  been visited. */
-{
-struct dgConnection *con;
-for (con = node->prevList; con != NULL; con = con->next)
-    {
-    if (con->node->visited == FALSE)
-	return FALSE;
-    }
-return TRUE;
-}
-
-struct dgNodeRef *dgConstrainedPriorityOrder(struct diGraph *dg)
-/* Return traversal of graph in priority order subject to
- * constraint that all parents must be output before
- * their children regardless of node priority. 
- * Graph must be cycle free. */
-{
-struct dlList *sortedList = newDlList();
-struct dgNode *graphNode;
-struct dlNode *listNode;
-struct dgNodeRef *refList = NULL, *ref;
-
-if (dgHasCycles(dg))
-    errAbort("Call to dgConstrainedPriorityOrder on graph with cycles.");
-
-/* Make up list sorted by priority. */
-for (graphNode = dg->nodeList; graphNode != NULL; graphNode = graphNode->next)
-    {
-    dlAddValTail(sortedList, graphNode);
-    graphNode->visited = FALSE;
-    }
-dlSort(sortedList, cmpPriority);
-
-/* Loop taking first member of list with no untraversed parents. */
-while (!dlEmpty(sortedList))
-    {
-    for (listNode = sortedList->head; listNode->next != NULL; listNode = listNode->next)
-	{
-	graphNode = listNode->val;
-	if (dgParentsAllVisited(graphNode))
-	    {
-	    dlRemove(listNode);
-	    freeMem(listNode);
-	    AllocVar(ref);
-	    ref->node = graphNode;
-	    slAddHead(&refList, ref);
-	    graphNode->visited = TRUE;
-	    break;
-	    }
-	}
-    }
-freeDlList(&sortedList);
-slReverse(&refList);
-return refList;
-}
-
-struct dgEdgeRef *dgFindSubEdges(struct diGraph *dg, struct dgNodeRef *subGraph)
-/* Return list of edges in graph that connected together nodes in subGraph. */
-{
-struct hash *hash = newHash(0);
-struct dgNodeRef *nr;
-struct dgConnection *con;
-struct dgEdgeRef *erList = NULL, *er;
-struct dgNode *node;
-
-/* Build up hash of nodes in subGraph. */
-for (nr = subGraph; nr != NULL; nr = nr->next)
-    {
-    node = nr->node;
-    hashAdd(hash, node->name, node);
-    }
-
-for (nr = subGraph; nr != NULL; nr = nr->next)
-    {
-    node = nr->node;
-    for (con = node->nextList; con != NULL; con = con->next)
-	{
-	if (hashLookup(hash, con->node->name))
-	    {
-	    AllocVar(er);
-	    er->edge = con->edgeOnList->val;
-	    slAddHead(&erList, er);
-	    }
-	}
-    }
-freeHash(&hash);
-return erList;
-}
-
-void dgSwapEdges(struct diGraph *dg, struct dgEdgeRef *erList)
-/* Swap polarity of all edges in erList.  (Assumes you don't have
- * edges going both directions in graph.) */
-{
-struct dgEdgeRef *er;
-struct dgEdge *edge;
-struct dgNode *a, *b;
-struct dgConnection *con1, *con2;
-
-/* Remove edges from next and previous list of all
- * involved nodes and swap nodes in edge itself. */
-for (er = erList; er != NULL; er = er->next)
-    {
-    edge = er->edge;
-    a = edge->a;
-    b = edge->b;
-    dgRemoveFromConList(&a->nextList, b, &con1);
-    dgRemoveFromConList(&b->prevList, a, &con2);
-    edge->a = b;
-    edge->b = a;
-    con1->node = a;
-    slAddHead(&b->nextList, con1);
-    con2->node = b;
-    slAddHead(&a->prevList, con2);
-    }
-}
-
-
-struct dgConnection *dgNextList(struct dgNode *node)
-/* Return list of nodes that follow node. */
-{
-return node->nextList;
-}
-
-struct dgConnection *dgPrevList(struct dgNode *node)
-/* Return list of nodes that precede node. */
-{
-return node->prevList;
-}
-
-void dgDumpGraph(struct diGraph *dg, FILE *out, boolean hideIsolated)
-/* Dump info on graph to output. */
-{
-struct dgNode *node;
-struct dgConnection *con;
-
-for (node = dg->nodeList; node != NULL; node = node->next)
-    {
-    if (hideIsolated  && node->nextList == NULL)
-	continue;
-    fprintf(out, "%s:", node->name);
-    for (con = node->nextList; con != NULL; con = con->next)
-	fprintf(out, " %s", con->node->name);
-    fprintf(out, "\n");
-    }
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/diGraph.c.97 b/gbtools/src/blatSrc/lib/diGraph.c.97
deleted file mode 100644
index d0bd076..0000000
--- a/gbtools/src/blatSrc/lib/diGraph.c.97
+++ /dev/null
@@ -1,764 +0,0 @@
-/* diGraph - Directed graph routines. */
-#include "common.h"
-#include "hash.h"
-#include "dlist.h"
-#include "diGraph.h"
-
-struct diGraph *dgNew()
-/* Return a new directed graph object. */
-{
-struct diGraph *dg;
-AllocVar(dg);
-dg->nodeHash = newHash(0);
-dg->edgeList = newDlList();
-return dg;
-}
-
-static void dgNodeFree(struct dgNode **pNode)
-/* Free a diGraph node. */
-{
-struct dgNode *node = *pNode;
-if (node == NULL)
-    return;
-slFreeList(&node->nextList);
-slFreeList(&node->prevList);
-freez(pNode);
-}
-
-static void dgNodeFreeList(struct dgNode **pList)
-/* Free list of diGraph nodes. */
-{
-struct dgNode *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    dgNodeFree(&el);
-    }
-*pList = NULL;
-}
-
-void dgFree(struct diGraph **pGraph)
-/* Free a directed graph. */
-{
-struct diGraph *dg = *pGraph;
-if (dg == NULL)
-    return;
-freeHash(&dg->nodeHash);
-dgNodeFreeList(&dg->nodeList);
-freeDlListAndVals(&dg->edgeList);
-freez(pGraph);
-}
-
-
-struct dgNode *dgAddNode(struct diGraph *dg, char *name, void *val)
-/* Create new node in graph. It's legal (but not efficient) to add
- * a node with the same name and value twice.  It's not legal to
- * add a node with the same name and a different value.  
- * You can pass in NULL for the name in which case the 
- * hexadecimal representation of val will become the name. */
-{
-struct dgNode *node;
-struct hashEl *hel;
-struct hash *hash = dg->nodeHash;
-char nbuf[17];
-static int nameIx = 0;
-
-if (name == NULL)
-    {
-    sprintf(nbuf, "%p", val);
-    name = nbuf;
-    }
-hel = hashLookup(hash, name);
-if (hel != NULL)
-    {
-    node = hel->val;
-    if (node->val != val)
-	{
-	errAbort("Trying to add node %s with a new value (old %x new %x)",
-	    name, node->val, val);
-	}
-    return node;
-    }
-AllocVar(node);
-hel = hashAdd(hash, name, node);
-node->name = hel->name;
-node->val = val;
-slAddHead(&dg->nodeList, node);
-return node;
-}
-
-struct dgNode *dgAddNumberedNode(struct diGraph *dg, int id, void *val)
-/* Create new node with a number instead of a name. */
-{
-char buf[16];
-sprintf(buf, "%d", id);
-return dgAddNode(dg, buf, val);
-}
-
-struct dgNode *dgFindNode(struct diGraph *dg, char *name)
-/* Find existing node in graph. Return NULL if not in graph. */
-{
-struct hashEl *hel;
-if ((hel = hashLookup(dg->nodeHash, name)) == NULL)
-    return NULL;
-return hel->val;
-}
-
-struct dgNode *dgFindNumberedNode(struct diGraph *dg, int id)
-/* Find node given number. */
-{
-char buf[16];
-sprintf(buf, "%d", id);
-return dgFindNode(dg, buf);
-}
-
-
-void *dgNodeVal(struct dgNode *node)
-/* Return value associated with node. */
-{
-return node->val;
-}
-
-void *dgNodeName(struct dgNode *node)
-/* Return name associated with node. */
-{
-return node->name;
-}
-
-int dgNodeNumber(struct dgNode *node)
-/* Return number of node.  (Will likely return 0 if node
- * was added with a name rather than a number). */
-{
-return atoi(node->name);
-}
-
-struct dgNodeRef *dgFindNodeInRefList(struct dgNodeRef *refList, struct dgNode *node)
-/* Return reference to node if in list, or NULL if not. */
-{
-struct dgNodeRef *ref;
-for (ref = refList; ref != NULL; ref = ref->next)
-    if (ref->node == node)
-	return ref;
-return NULL;
-}
-
-struct dgConnection *dgFindNodeInConList(struct dgConnection *conList, struct dgNode *node)
-/* Return connection to node if in list, or NULL if not. */
-{
-struct dgConnection *con;
-for (con = conList; con != NULL; con = con->next)
-    if (con->node == node)
-	return con;
-return NULL;
-}
-
-struct dgEdge *dgConnect(struct diGraph *dg, struct dgNode *a, struct dgNode *b)
-/* Connect node a to node b.  Returns connecting edge. 
- * Not an error to reconnect.  However all connects can 
- * be broken with a single disconnect. */
-{
-dgConnectWithVal(dg, a, b, NULL);
-}
-
-struct dgEdge *dgConnectWithVal(struct diGraph *dg, struct dgNode *a, 
-     struct dgNode *b, void *val)
-/* Connect node a to node b and put val on edge.  An error to
- * reconnect with a different val. */
-{
-struct dgConnection *con;
-struct dgEdge *edge;
-struct dlNode *edgeOnList;
-
-/* Check to see if it's already there. */
-if ((con = dgFindNodeInConList(a->nextList, b)) != NULL)
-    {
-    edge =  con->edgeOnList->val;
-    if (val != edge->val)
-        warn("Trying to add new value to edge between %s and %s, ignoring",
-	   a->name, b->name);
-    return edge;
-    }
-/* Allocate edge and put on list. */
-AllocVar(edge);
-edge->a = a;
-edge->b = b;
-edge->val = val;
-edgeOnList = dlAddValTail(dg->edgeList, edge);
-
-/* Connect nodes to each other. */
-AllocVar(con);
-con->node = b;
-con->edgeOnList = edgeOnList;
-slAddHead(&a->nextList, con);
-AllocVar(con);
-con->node = a;
-con->edgeOnList = edgeOnList;
-slAddHead(&b->prevList, con);
-
-return edge;
-}
-
-struct dgEdge *dgConnectUnflippable(struct diGraph *dg, struct dgNode *a, struct dgNode *b,
-    void *val)
-/* Connect a to b with an edge than can't be flipped. */
-{
-struct dgEdge *edge = dgConnectWithVal(dg, a, b, val);
-edge->unflippable = TRUE;
-return edge;
-}
-
-static struct dlNode *dgRemoveFromConList(struct dgConnection **pConList, 
-	struct dgNode *node, struct dgConnection **retCon)
-/* Remove reference to node from list. */
-{
-struct dgConnection *newList = NULL;
-struct dgConnection *con, *next;
-struct dlNode *edgeOnList = NULL;
-
-for (con = *pConList; con != NULL; con = next)
-    {
-    next = con->next;
-    if (con->node == node)
-	{
-	edgeOnList = con->edgeOnList;
-	if (retCon != NULL)
-	    *retCon = con;
-	else
-	    freeMem(con);
-	}
-    else
-	{
-	slAddHead(&newList, con);
-	}
-    }
-slReverse(&newList);
-*pConList = newList;
-return edgeOnList;
-}
-
-void dgDisconnect(struct diGraph *dg, struct dgNode *a, struct dgNode *b)
-/* Disconnect nodes a and b. */
-{
-struct dlNode *edgeInList;
-struct dgEdge *edge;
-
-dgRemoveFromConList(&a->nextList, b, NULL);
-edgeInList = dgRemoveFromConList(&b->prevList, a, NULL);
-if (edgeInList != NULL)
-    {
-    edge = edgeInList->val;
-    dlRemove(edgeInList);
-    freeMem(edgeInList);
-    freeMem(edge);
-    }
-}
-
-
-void dgClearVisitFlags(struct diGraph *dg)
-/* Clear out visit flags. */
-{
-struct dgNode *node;
-for (node = dg->nodeList; node != NULL; node = node->next)
-    node->visited = FALSE;
-}
-
-void dgClearConnFlags(struct diGraph *dg)
-/* Clear out connect flags. */
-{
-struct dgNode *node;
-for (node = dg->nodeList; node != NULL; node = node->next)
-    node->conn = FALSE;
-}
-
-static struct dgNode *rTarget;
-
-static boolean rPathExists(struct dgNode *a)
-/* Recursively find if path from a to b exists. */
-{
-struct dgConnection *ref;
-if (a == rTarget)
-    return TRUE;
-a->visited = TRUE;
-
-for (ref = a->nextList; ref != NULL; ref = ref->next)
-    {
-    if (!ref->node->visited && rPathExists(ref->node))
-	return TRUE;
-    }
-return FALSE;
-}
-
-boolean dgPathExists(struct diGraph *dg, struct dgNode *a, struct dgNode *b)
-/* Return TRUE if there's a path from a to b. */
-{
-rTarget = b;
-dgClearVisitFlags(dg);
-return rPathExists(a);
-}
-
-static int topoIx;
-
-static void rTopoSort(struct dgNode *node)
-{
-struct dgConnection *ref;
-node->visited = TRUE;
-for (ref = node->nextList; ref != NULL; ref = ref->next)
-    {
-    if (!ref->node->visited)
-	rTopoSort(ref->node);
-    }
-node->topoOrder = ++topoIx;
-}
-
-void dgTopoSort(struct diGraph *dg)
-/* Fill in topological order of nodes. */
-{
-struct dgNode *node;
-
-topoIx = 0;
-dgClearVisitFlags(dg);
-for (node = dg->nodeList; node != NULL; node = node->next)
-    {
-    if (!node->visited)
-	rTopoSort(node);
-    }
-}
-
-static boolean  rHasCycles(struct dgNode *node)
-/* Recursively see if has cycles by looking for
- * backwards topoOrder. */
-{
-struct dgConnection *ref;
-struct dgNode *child;
-
-node->visited = TRUE;
-for (ref = node->nextList; ref != NULL; ref = ref->next)
-    {
-    child = ref->node;
-    if (child->topoOrder > node->topoOrder)
-	return TRUE;
-    if (!child->visited)
-	if (rHasCycles(child))
-	    return TRUE;
-    }
-return FALSE;
-}
-
-boolean dgHasCycles(struct diGraph *dg)
-/* Return TRUE if directed graph has cycles. */
-{
-struct dgNode *node;
-
-dgTopoSort(dg);
-dgClearVisitFlags(dg);
-for (node = dg->nodeList; node != NULL; node = node->next)
-    {
-    if (!node->visited)
-	if (rHasCycles(node))
-	    return TRUE;
-    }
-return FALSE;
-}
-
-struct dgNodeRef *rRefList;
-bool rRespectFlipper;			/* Set to TRUE if rFindConnected only to
-                                         * consider nodes with values in connections. */
-
-static void rFindConnected(struct dgNode *a)
-/* Find all things connected to a directly or not that haven't
- * already been visited and put them on rRefList. */
-{
-if (!a->conn)
-    {
-    struct dgNodeRef *ref;
-    struct dgConnection *con;
-    struct dgEdge *edge;
-
-    AllocVar(ref);
-    ref->node = a;
-    slAddHead(&rRefList, ref);
-    a->conn = TRUE;
-    for (con = a->nextList; con != NULL; con = con->next)
-	{
-	edge = con->edgeOnList->val;
-	if (!rRespectFlipper || !edge->unflippable)
-	    rFindConnected(con->node);
-	}
-    for (con = a->prevList; con != NULL; con = con->next)
-	{
-	edge = con->edgeOnList->val;
-	if (!rRespectFlipper || !edge->unflippable)
-	    rFindConnected(con->node);
-	}
-    }
-}
-
-struct dgNodeRef *dgFindNextConnected(struct diGraph *dg)
-/* Return list of nodes that make up next connected component,
- * or NULL if no more components.  slFreeList this when
- * done.  Call "dgClearConnFlags" before first call to this.
- * Do not call dgFindConnectedToNode between dgFindFirstConnected 
- * and this as they use the same flag variables to keep track of
- * what vertices are used. */
-{
-struct dgNode *a;
-
-for (a=dg->nodeList; a != NULL; a = a->next)
-    {
-    if (!a->conn)
-	break;
-    }
-if (a == NULL)
-    return NULL;
-rRefList = NULL;
-rRespectFlipper = FALSE;
-rFindConnected(a);
-return rRefList;
-}
-
-struct dgNodeRef *dgFindNextFlippableConnected(struct diGraph *dg)
-/* Like dgFindConnected, but only considers graph nodes that
- * are conencted by a flippable edge. */
-{
-struct dgNode *a;
-
-for (a=dg->nodeList; a != NULL; a = a->next)
-    {
-    if (!a->conn)
-	break;
-    }
-if (a == NULL)
-    return NULL;
-rRefList = NULL;
-rRespectFlipper = TRUE;
-rFindConnected(a);
-return rRefList;
-}
-
-
-static int connectedComponents(struct diGraph *dg)
-/* Count number of connected components and set component field
- * of each node to reflect which component it is in. */
-{
-struct dgNodeRef *ref;
-int conCount = 0;
-struct dgNode *a = dg->nodeList;
-
-dgClearConnFlags(dg);
-for (;;)
-    {
-    for (; a != NULL; a = a->next)
-	{
-	if (!a->conn)
-	    break;
-	}
-    if (a == NULL)
-	break;
-    rRefList = NULL;
-    rFindConnected(a);
-    ++conCount;
-    for (ref = rRefList; ref != NULL; ref = ref->next)
-	{
-	ref->node->component = conCount;
-	}
-    slFreeList(&rRefList);
-    }
-return conCount;
-}
-
-int dgConnectedComponents(struct diGraph *dg)
-/* Count number of connected components and set component field
- * of each node to reflect which component it is in. */
-{
-rRespectFlipper = FALSE;
-connectedComponents(dg);
-}
-
-int dgConnectedFlippableComponents(struct diGraph *dg)
-/* Count number of connected components and set component field
- * of each node to reflect which component it is in. Only
- * consider components connected by flippable edges. */
-{
-rRespectFlipper = TRUE;
-connectedComponents(dg);
-}
-
-struct dgNodeRef *dgFindNewConnected(struct diGraph *dg, struct dgNode *a)
-/* Find a connected component guaranteed not to be covered before 
- * including a. */
-{
-rRefList = NULL;
-rRespectFlipper = FALSE;
-rFindConnected(a);
-return rRefList;
-}
-
-struct dgNodeRef *dgFindNewFlippableConnected(struct diGraph *dg, struct dgNode *a)
-/* Find a connected component guaranteed not to be covered before 
- * that includes a.  Connected components must be connected by flippable
- * edges. */
-{
-rRefList = NULL;
-rRespectFlipper = TRUE;
-rFindConnected(a);
-return rRefList;
-}
-
-
-struct dgNodeRef *dgFindConnectedToNode(struct diGraph *dg, struct dgNode *a)
-/* Return reference list of all nodes connected to a, including a.
- * slFreeList this list when done. */
-{
-dgClearConnFlags(dg);
-return dgFindNewConnected(dg, a);
-}
-
-struct dgEdge *dgDirectlyFollows(struct diGraph *dg, struct dgNode *a, struct dgNode *b)
-/* Return TRUE if b directly follows a. */
-{
-struct dgConnection *con = dgFindNodeInConList(a->nextList, b);
-if (con == NULL)
-    return NULL;
-return con->edgeOnList->val;
-}
-
-struct dgNodeRef *dgFindPath(struct diGraph *dg, struct dgNode *a, struct dgNode *b)
-/* Find shortest path from a to b.  Return NULL if can't be found. */
-{
-struct dgNodeRef *refList  = NULL, *ref;
-struct dgConnection *con;
-struct dgNode *node, *nNode;
-struct dlList *fifo;
-struct dlNode *ffNode;
-struct dgNode endNode;
-int fifoSize = 1;
-
-/* Do some quick and easy tests first to return if have no way out
- * of node A, or if B directly follows A. */
-if (a->nextList == NULL)
-    return NULL;
-if (a == b)
-    {
-    AllocVar(ref);
-    ref->node = a;
-    return ref;
-    }
-if ((con = dgFindNodeInConList(a->nextList, b)) != NULL)
-    {
-    AllocVar(refList);
-    refList->node = a;
-    node = con->node;
-    AllocVar(ref);
-    ref->node = node;
-    slAddTail(&refList, ref);
-    return refList;
-    }
-
-/* Set up for breadth first traversal.  Will use a doubly linked
- * list as a fifo. */
-for (node = dg->nodeList; node != NULL; node = node->next)
-    node->tempEntry = NULL;
-fifo = newDlList();
-dlAddValTail(fifo, a);
-a->tempEntry = &endNode;
-
-while ((ffNode = dlPopHead(fifo)) != NULL)
-    {
-    --fifoSize;
-    node = ffNode->val;
-    freeMem(ffNode);
-    for (con = node->nextList; con != NULL; con = con->next)
-	{
-	nNode = con->node;
-	if (nNode->tempEntry == NULL)
-	    {
-	    nNode->tempEntry = node;
-	    if (nNode == b)
-		{
-		while (nNode != &endNode && nNode != NULL)
-		    {
-		    AllocVar(ref);
-		    ref->node = nNode;
-		    slAddHead(&refList, ref);
-		    nNode = nNode->tempEntry;
-		    }
-		break;
-		}
-	    else
-		{
-		dlAddValTail(fifo, nNode);
-		++fifoSize;
-		if (fifoSize > 100000)
-		    errAbort("Internal error in dgFindPath");
-		}
-	    }
-	}
-    }
-freeDlList(&fifo);
-return refList;
-}
-
-static int cmpPriority(const void *va, const void *vb)
-/* Sort smallest offset into needle first. */
-{
-const struct dgNode *a = *((struct dgNode **)va);
-const struct dgNode *b = *((struct dgNode **)vb);
-return (a->priority - b->priority);
-}
-
-boolean dgParentsAllVisited(struct dgNode *node)
-/* Return TRUE if all parents of node have  been visited. */
-{
-struct dgConnection *con;
-for (con = node->prevList; con != NULL; con = con->next)
-    {
-    if (con->node->visited == FALSE)
-	return FALSE;
-    }
-return TRUE;
-}
-
-struct dgNodeRef *dgConstrainedPriorityOrder(struct diGraph *dg)
-/* Return traversal of graph in priority order subject to
- * constraint that all parents must be output before
- * their children regardless of node priority. 
- * Graph must be cycle free. */
-{
-struct dlList *sortedList = newDlList();
-struct dgNode *graphNode;
-struct dlNode *listNode;
-struct dgNodeRef *refList = NULL, *ref;
-
-if (dgHasCycles(dg))
-    errAbort("Call to dgConstrainedPriorityOrder on graph with cycles.");
-
-/* Make up list sorted by priority. */
-for (graphNode = dg->nodeList; graphNode != NULL; graphNode = graphNode->next)
-    {
-    dlAddValTail(sortedList, graphNode);
-    graphNode->visited = FALSE;
-    }
-dlSort(sortedList, cmpPriority);
-
-/* Loop taking first member of list with no untraversed parents. */
-while (!dlEmpty(sortedList))
-    {
-    for (listNode = sortedList->head; listNode->next != NULL; listNode = listNode->next)
-	{
-	graphNode = listNode->val;
-	if (dgParentsAllVisited(graphNode))
-	    {
-	    dlRemove(listNode);
-	    freeMem(listNode);
-	    AllocVar(ref);
-	    ref->node = graphNode;
-	    slAddHead(&refList, ref);
-	    graphNode->visited = TRUE;
-	    break;
-	    }
-	}
-    }
-freeDlList(&sortedList);
-slReverse(&refList);
-return refList;
-}
-
-struct dgEdgeRef *dgFindSubEdges(struct diGraph *dg, struct dgNodeRef *subGraph,
-	boolean onlyFlippable)
-/* Return list of edges in graph that connected together nodes in subGraph. 
- * Optionally return only flippable edges. */
-{
-struct hash *hash = newHash(0);
-struct dgNodeRef *nr;
-struct dgConnection *con;
-struct dgEdgeRef *erList = NULL, *er;
-struct dgEdge *edge;
-struct dgNode *node;
-
-/* Build up hash of nodes in subGraph. */
-for (nr = subGraph; nr != NULL; nr = nr->next)
-    {
-    node = nr->node;
-    hashAdd(hash, node->name, node);
-    }
-
-for (nr = subGraph; nr != NULL; nr = nr->next)
-    {
-    node = nr->node;
-    for (con = node->nextList; con != NULL; con = con->next)
-	{
-	if (hashLookup(hash, con->node->name))
-	    {
-	    edge = con->edgeOnList->val;
-	    if (!onlyFlippable || !edge->unflippable)
-		{
-		AllocVar(er);
-		er->edge = con->edgeOnList->val;
-		slAddHead(&erList, er);
-		}
-	    }
-	}
-    }
-freeHash(&hash);
-return erList;
-}
-
-void dgSwapEdges(struct diGraph *dg, struct dgEdgeRef *erList)
-/* Swap polarity of all edges in erList.  (Assumes you don't have
- * edges going both directions in graph.) */
-{
-struct dgEdgeRef *er;
-struct dgEdge *edge;
-struct dgNode *a, *b;
-struct dgConnection *con1, *con2;
-
-/* Remove edges from next and previous list of all
- * involved nodes and swap nodes in edge itself. */
-for (er = erList; er != NULL; er = er->next)
-    {
-    edge = er->edge;
-    a = edge->a;
-    b = edge->b;
-    dgRemoveFromConList(&a->nextList, b, &con1);
-    dgRemoveFromConList(&b->prevList, a, &con2);
-    edge->a = b;
-    edge->b = a;
-    con1->node = a;
-    slAddHead(&b->nextList, con1);
-    con2->node = b;
-    slAddHead(&a->prevList, con2);
-    }
-}
-
-
-struct dgConnection *dgNextList(struct dgNode *node)
-/* Return list of nodes that follow node. */
-{
-return node->nextList;
-}
-
-struct dgConnection *dgPrevList(struct dgNode *node)
-/* Return list of nodes that precede node. */
-{
-return node->prevList;
-}
-
-void dgDumpGraph(struct diGraph *dg, FILE *out, boolean hideIsolated)
-/* Dump info on graph to output. */
-{
-struct dgNode *node;
-struct dgConnection *con;
-
-for (node = dg->nodeList; node != NULL; node = node->next)
-    {
-    if (hideIsolated  && node->nextList == NULL)
-	continue;
-    fprintf(out, "%s:", node->name);
-    for (con = node->nextList; con != NULL; con = con->next)
-	fprintf(out, " %s", con->node->name);
-    fprintf(out, "\n");
-    }
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/diff b/gbtools/src/blatSrc/lib/diff
deleted file mode 100644
index e69de29..0000000
diff --git a/gbtools/src/blatSrc/lib/diffs b/gbtools/src/blatSrc/lib/diffs
deleted file mode 100644
index 5b8bb76..0000000
--- a/gbtools/src/blatSrc/lib/diffs
+++ /dev/null
@@ -1,599 +0,0 @@
-diff --git a/src/hg/encode/encodeMergeReplicates/encodeMergeReplicates.c b/src/hg/encode/encodeMergeReplicates/encodeMergeReplicates.c
-index b68a4ef..14333df 100644
---- a/src/hg/encode/encodeMergeReplicates/encodeMergeReplicates.c
-+++ b/src/hg/encode/encodeMergeReplicates/encodeMergeReplicates.c
-@@ -3,6 +3,7 @@
- #include "linefile.h"
- #include "hash.h"
- #include "options.h"
-+#include "narrowPeak.h"
- 
- static char const rcsid[] = "$Id: newProg.c,v 1.30 2010/03/24 21:18:33 hiram Exp $";
- 
-@@ -10,9 +11,10 @@ void usage()
- /* Explain usage and exit. */
- {
- errAbort(
--  "encodeMergeReplicates - Merge together replicates for a pooled output.  Only works on narrowPeak files currently.\n"
-+  "encodeMergeReplicates - Merge together replicates for a pooled output.  \n"
-+  "Only works on narrowPeak files currently.\n"
-   "usage:\n"
--  "   encodeMergeReplicates XXX\n"
-+  "   encodeMergeReplicates in1 in2 in3 ... output\n"
-   "options:\n"
-   "   -xxx=XXX\n"
-   );
-@@ -22,8 +24,9 @@ static struct optionSpec options[] = {
-    {NULL, 0},
- };
- 
--void encodeMergeReplicates(char *XXX)
--/* encodeMergeReplicates - Merge together replicates for a pooled output.  Only works on narrowPeak files currently.. */
-+void encodeMergeReplicates(int inCount, char *inNames[], char *outName)
-+/* encodeMergeReplicates - Merge together replicates for a pooled output.  
-+ * Only works on narrowPeak files currently. */
- {
- }
- 
-@@ -31,8 +34,8 @@ int main(int argc, char *argv[])
- /* Process command line. */
- {
- optionInit(&argc, argv, options);
--if (argc != 2)
-+if (argc < 4)
-     usage();
--encodeMergeReplicates(argv[1]);
-+encodeMergeReplicates(argv+1, argc-2, argv[argc-1]);
- return 0;
- }
-diff --git a/src/hg/makeDb/trackDb/human/hg18/trackDb.wgEncode.ra b/src/hg/makeDb/trackDb/human/hg18/trackDb.wgEncode.ra
-index cdcd9c0..04342b6 100644
---- a/src/hg/makeDb/trackDb/human/hg18/trackDb.wgEncode.ra
-+++ b/src/hg/makeDb/trackDb/human/hg18/trackDb.wgEncode.ra
-@@ -1683,14 +1683,14 @@ group regulation
- 	type wig 0.00 4417.02
- 	color 191,128,255
- 
--    track wgEncodeRegMarkEnhancer
-+    track wgEncodeRegMarkEnhH3k4me1
-     # compositeTrack on
-     container multiWig
-     noInherit on
-     type wig 0 10000
-     superTrack wgEncodeReg full
-     shortLabel Enhancer H3K4Me1
--    longLabel Enhancer histone mark (H3K4Me1) on 8 cell lines from ENCODE
-+    longLabel H3K4Me1 - an Enhancer and Promoter Histone Mark on 8 Cell Lines from ENCODE
-     release alpha
-     configurable on
-     visibility full
-@@ -1700,74 +1700,74 @@ group regulation
-     showSubtrackColorOnUi on
-     priority 2
- 
--	track wgEncodeRegMarkEnhancerGm12878
-+	track wgEncodeRegMarkEnhH3k4me1Gm12878
- 	shortLabel	Gm12878
--	longLabel Enhancer mark (H3K4Me1) on Gm12878 cells from ENCODE
-+	longLabel H3K4Me1 - an Enhancer and Promoter Histone Mark on Gm12878 cells from ENCODE
-         release alpha
--	parent wgEncodeRegMarkEnhancer
-+	parent wgEncodeRegMarkEnhH3k4me1
- 	type wig 0.00 9323.50
- 	color 255,128,128
- 	table wgEncodeBroadChipSeqSignalGm12878H3k4me1
- 
--	track wgEncodeRegMarkEnhancerH1hesc
-+	track wgEncodeRegMarkEnhH3k4me1H1hesc
- 	shortLabel	H1 ES
--	longLabel Enhancer mark (H3K4Me1) on H1 ES cells from ENCODE
-+	longLabel H3K4Me1 - an Enhancer and Promoter Histone Mark on H1 ES cells from ENCODE
-         release alpha
--	parent wgEncodeRegMarkEnhancer
-+	parent wgEncodeRegMarkEnhH3k4me1
- 	color 255,223,128
- 	table wgEncodeBroadChipSeqSignalH1hescH3k4me1
- 	type wig 0.00 12286.00
- 
--	track wgEncodeRegMarkEnhancerHmec
-+	track wgEncodeRegMarkEnhH3k4me1Hmec
- 	shortLabel	HMEC
--	longLabel Enhancer mark (H3K4Me1) on HMEC cells from ENCODE 
-+	longLabel H3K4Me1 - an Enhancer and Promoter Histone Mark on HMEC cells from ENCODE 
-         release alpha
--	parent wgEncodeRegMarkEnhancer
-+	parent wgEncodeRegMarkEnhH3k4me1
- 	color 191,255,128
- 	table wgEncodeBroadChipSeqSignalHmecH3k4me1
- 	type wig 0.00 13574.00
- 
--	track wgEncodeRegMarkEnhancerHsmm
-+	track wgEncodeRegMarkEnhH3k4me1Hsmm
- 	shortLabel	HSMM
--	longLabel Enhancer mark (H3K4Me1) on HSMM cells from ENCODE 
-+	longLabel H3K4Me1 - an Enhancer and Promoter Histone Mark on HSMM cells from ENCODE 
-         release alpha
--	parent wgEncodeRegMarkEnhancer
-+	parent wgEncodeRegMarkEnhH3k4me1
- 	color 128,255,159
- 	table wgEncodeBroadChipSeqSignalHsmmH3k4me1
- 	type wig 0.00 10412.00
- 
--	track wgEncodeRegMarkEnhancerHuvec
-+	track wgEncodeRegMarkEnhH3k4me1Huvec
- 	shortLabel	HUVEC
--	longLabel Enhancer mark (H3K4Me1) on HUVEC cells from ENCODE 
-+	longLabel H3K4Me1 - an Enhancer and Promoter Histone Mark on HUVEC cells from ENCODE 
-         release alpha
--	parent wgEncodeRegMarkEnhancer
-+	parent wgEncodeRegMarkEnhH3k4me1
- 	color 128,255,255
- 	table wgEncodeBroadChipSeqSignalHuvecH3k4me1
- 	type wig 0.00 5259.25
- 
--	track wgEncodeRegMarkEnhancerK562
-+	track wgEncodeRegMarkEnhH3k4me1K562
- 	shortLabel	K562
--	longLabel Enhancer mark (H3K4Me1) on K562 cells from ENCODE 
-+	longLabel H3K4Me1 - an Enhancer and Promoter Histone Mark on K562 cells from ENCODE 
-         release alpha
--	parent wgEncodeRegMarkEnhancer
-+	parent wgEncodeRegMarkEnhH3k4me1
- 	color 128,159,255
- 	table wgEncodeBroadChipSeqSignalK562H3k4me1
- 	type wig 0.00 8682.25
- 
--	track wgEncodeRegMarkEnhancerNhek
-+	track wgEncodeRegMarkEnhH3k4me1Nhek
- 	shortLabel	NHEK
--	longLabel Enhancer mark (H3K4Me1) on NHEK cells from ENCODE 
-+	longLabel H3K4Me1 - an Enhancer and Promoter Histone Mark on NHEK cells from ENCODE 
-         release alpha
--	parent wgEncodeRegMarkEnhancer
-+	parent wgEncodeRegMarkEnhH3k4me1
- 	color 191,128,255
- 	table wgEncodeBroadChipSeqSignalNhekH3k4me1
- 	type wig 0.00 4240.50
- 
--	track wgEncodeRegMarkEnhancerNhlf
-+	track wgEncodeRegMarkEnhH3k4me1Nhlf
- 	shortLabel	NHLF
--	longLabel Enhancer mark (H3K4Me1) on NHLF cells from ENCODE 
-+	longLabel H3K4Me1 - an Enhancer and Promoter Histone Mark on NHLF cells from ENCODE 
-         release alpha
--	parent wgEncodeRegMarkEnhancer
-+	parent wgEncodeRegMarkEnhH3k4me1
- 	color 255,128,223
- 	table wgEncodeBroadChipSeqSignalNhlfH3k4me1
- 	type wig 0.00 14639.00
-@@ -1779,7 +1779,7 @@ group regulation
-     type wig 0 10000
-     superTrack wgEncodeReg full
-     shortLabel Enhancer H3K27Ac
--    longLabel Enhancer histone mark (H3K27Ac) on 8 cell lines from ENCODE
-+    longLabel H3K27Ac - An Enhancer and Promoter Histone Mark on 8 Cell Lines from ENCODE
-     release alpha
-     configurable on
-     visibility full
-@@ -1791,7 +1791,7 @@ group regulation
- 
- 	track wgEncodeRegMarkEnhH3k27acGm12878
- 	shortLabel	Gm12878
--	longLabel Enhancer mark (H3K27Ac) on Gm12878 cells from ENCODE
-+	longLabel H3K27Ac - An enhancer and promoter mark on Gm12878 cells from ENCODE
-         release alpha
- 	parent wgEncodeRegMarkEnhH3k27ac
- 	type wig 0.00 9323.50
-@@ -1800,7 +1800,7 @@ group regulation
- 
- 	track wgEncodeRegMarkEnhH3k27acH1hesc
- 	shortLabel	H1 ES
--	longLabel Enhancer mark (H3K27Ac) on H1 ES cells from ENCODE
-+	longLabel H3K27Ac - An enhancer and promoter mark on H1 ES cells from ENCODE
-         release alpha
- 	parent wgEncodeRegMarkEnhH3k27ac
- 	color 255,223,128
-@@ -1809,7 +1809,7 @@ group regulation
- 
- 	track wgEncodeRegMarkEnhH3k27acHmec
- 	shortLabel	HMEC
--	longLabel Enhancer mark (H3K27Ac) on HMEC cells from ENCODE 
-+	longLabel H3K27Ac - An enhancer and promoter mark on HMEC cells from ENCODE 
-         release alpha
- 	parent wgEncodeRegMarkEnhH3k27ac
- 	color 191,255,128
-@@ -1818,7 +1818,7 @@ group regulation
- 
- 	track wgEncodeRegMarkEnhH3k27acHsmm
- 	shortLabel	HSMM
--	longLabel Enhancer mark (H3K27Ac) on HSMM cells from ENCODE 
-+	longLabel H3K27Ac - An enhancer and promoter mark on HSMM cells from ENCODE 
-         release alpha
- 	parent wgEncodeRegMarkEnhH3k27ac
- 	color 128,255,159
-@@ -1827,7 +1827,7 @@ group regulation
- 
- 	track wgEncodeRegMarkEnhH3k27acHuvec
- 	shortLabel	HUVEC
--	longLabel Enhancer mark (H3K27Ac) on HUVEC cells from ENCODE 
-+	longLabel H3K27Ac - An enhancer and promoter mark on HUVEC cells from ENCODE 
-         release alpha
- 	parent wgEncodeRegMarkEnhH3k27ac
- 	color 128,255,255
-@@ -1836,7 +1836,7 @@ group regulation
- 
- 	track wgEncodeRegMarkEnhH3k27acK562
- 	shortLabel	K562
--	longLabel Enhancer mark (H3K27Ac) on K562 cells from ENCODE 
-+	longLabel H3K27Ac - An enhancer and promoter mark on K562 cells from ENCODE 
-         release alpha
- 	parent wgEncodeRegMarkEnhH3k27ac
- 	color 128,159,255
-@@ -1845,7 +1845,7 @@ group regulation
- 
- 	track wgEncodeRegMarkEnhH3k27acNhek
- 	shortLabel	NHEK
--	longLabel Enhancer mark (H3K27Ac) on NHEK cells from ENCODE 
-+	longLabel H3K27Ac - An enhancer and promoter mark on NHEK cells from ENCODE 
-         release alpha
- 	parent wgEncodeRegMarkEnhH3k27ac
- 	color 191,128,255
-@@ -1854,7 +1854,7 @@ group regulation
- 
- 	track wgEncodeRegMarkEnhH3k27acNhlf
- 	shortLabel	NHLF
--	longLabel Enhancer mark (H3K27Ac) on NHLF cells from ENCODE 
-+	longLabel H3K27Ac - An enhancer and promoter mark on NHLF cells from ENCODE 
-         release alpha
- 	parent wgEncodeRegMarkEnhH3k27ac
- 	color 255,128,223
-@@ -1971,7 +1971,7 @@ group regulation
-     type factorSource
-     superTrack wgEncodeReg dense
-     sourceTable wgEncodeRegTfbsCells
--    inputTracks wgEncodeYaleChIPseq
-+    inputTracks wgEncodeYaleChIPseq wgEncodeHudsonalphaChipSeq
-     inputTracksSubgroupSelect view=Peaks
-     inputTracksSubgroupDisplay cellType factor
-     visibility dense
-diff --git a/src/hg/regulate/regCluster/makefile b/src/hg/regulate/regCluster/makefile
-index b4de7cb..d1c0e73 100644
---- a/src/hg/regulate/regCluster/makefile
-+++ b/src/hg/regulate/regCluster/makefile
-@@ -5,7 +5,7 @@ MYLIBDIR = ../../../lib/${MACHTYPE}
- MYLIBS =  ${MYLIBDIR}/jkweb.a
- 
- A = regCluster
--O = regCluster.o
-+O = regCluster.o 
- 
- regCluster: ${O} ${MYLIBS}
- 	${CC} ${COPT} -o ${DESTDIR}${BINDIR}/${A}${EXE} $O ${MYLIBS} $L
-diff --git a/src/hg/regulate/regCluster/regCluster.c b/src/hg/regulate/regCluster/regCluster.c
-index 7d8245c..0c3691c 100644
---- a/src/hg/regulate/regCluster/regCluster.c
-+++ b/src/hg/regulate/regCluster/regCluster.c
-@@ -3,10 +3,9 @@
- #include "linefile.h"
- #include "hash.h"
- #include "options.h"
--#include "sqlNum.h"
--#include "obscure.h"
- #include "localmem.h"
- #include "rangeTree.h"
-+#include "peakCluster.h"
- 
- static char const rcsid[] = "$Id: regCluster.c,v 1.4 2010/05/16 21:41:42 kent Exp $";
- 
-@@ -51,247 +50,6 @@ static struct optionSpec options[] = {
-    {NULL, 0},
- };
- 
--struct regDim
--/* A regulatory dimension */
--    {
--    int colIx;		/* Column index in table. */
--    char *label;	/* Label */
--    };
--
--struct regSource 
--/* A source of regulatory information */
--    {
--    struct regSource *next;
--    char *dataSource;		/* File (or table) */
--    int chromColIx;		/* Chromosome column index. */
--    int startColIx;		/* Start coordinate column index. */
--    int endColIx;		/* End ccoordinate column ix. */
--    int scoreColIx;		/* Index for score column. */
--    double normFactor;		/* Multiply this to get browser score. */
--    char **labels;		/* Label for each dimension */
--    int minColCount;		/* Minimum number of columns. */
--    };
--
--struct regItem
--/* An item in a regulatory track */
--    {
--    struct regItem *next;
--    char *chrom;		/* Chromosome. Not allocated here. */
--    int chromStart,chromEnd;	/* Half open coordinates. */
--    double score;		/* Ideally something like -log(p). */
--    struct regSource *source;   /* Source track/file for item. */
--    };
--
--struct regCluster
--/* A cluster of items. */
--    {
--    struct regCluster *next;
--    char *chrom;		/* Chromosome.  Not allocated here. */
--    int chromStart, chromEnd;	/* Half open coordinates. */
--    double score;		/* Sum of component scores. */
--    double maxSubScore;		/* Max of component scores. */
--    struct slRef *itemRefList;	/* List of references to component items. */
--    };
--
--struct regSource *regSourceLoadAll(char *fileName, int dimCount)
--/* Read file, parse it line by line and return list of regSources. */
--{
--struct lineFile *lf = lineFileOpen(fileName, TRUE);
--int rowSize = dimCount + 6;
--char *row[rowSize];
--struct regSource *sourceList = NULL, *source;
--while (lineFileNextRow(lf, row, rowSize))
--    {
--    /* Allocate struct and read in fixed fields. */
--    AllocVar(source);
--    source->dataSource = cloneString(row[0]);
--    source->chromColIx = sqlUnsigned(row[1]);
--    source->startColIx = sqlUnsigned(row[2]);
--    source->endColIx = sqlUnsigned(row[3]);
--    source->scoreColIx = sqlUnsigned(row[4]);
--    source->normFactor = sqlDouble(row[5]);
--
--    /* Read in dimension labels. */
--    AllocArray(source->labels, dimCount);
--    int i;
--    for (i=0; i<dimCount; ++i)
--        source->labels[i] = cloneString(row[i+6]);
--
--    /* Calculate required columns. */
--    int minColCount = max(source->chromColIx, source->startColIx);
--    minColCount = max(minColCount, source->endColIx);
--    minColCount = max(minColCount, source->scoreColIx);
--    source->minColCount = minColCount + 1;
--    slAddHead(&sourceList, source);
--    }
--lineFileClose(&lf);
--slReverse(&sourceList);
--return sourceList;
--}
--
--void clusterSource(struct regSource *source, struct hash *chromHash, 
--	struct rbTreeNode *stack[128])
--/* Read through data source and add items to it to rangeTrees in hash */
--{
--struct lineFile *lf = lineFileOpen(source->dataSource, TRUE);
--struct lm *lm = chromHash->lm;	/* Local memory pool - share with hash */
--char *row[source->minColCount];
--struct regItem *item;
--while (lineFileNextRow(lf, row, source->minColCount))
--    {
--    char *chrom = row[source->chromColIx];
--    struct hashEl *hel = hashLookup(chromHash, chrom);
--    if (hel == NULL)
--        {
--	struct rbTree *tree = rangeTreeNewDetailed(lm, stack);
--	hel = hashAdd(chromHash, chrom, tree);
--	}
--    struct rbTree *tree = hel->val;
--    lmAllocVar(lm, item);
--    item->chrom = hel->name;
--    item->chromStart = sqlUnsigned(row[source->startColIx]);
--    item->chromEnd = sqlUnsigned(row[source->endColIx]);
--    item->score = sqlDouble(row[source->scoreColIx]) * source->normFactor;
--    if (item->score > 1000) item->score = 1000;
--    item->source = source;
--    rangeTreeAddValList(tree, item->chromStart, item->chromEnd, item);
--    }
--
--lineFileClose(&lf);
--}
--
--int cmpChromEls(const void *va, const void *vb)
--/* Compare to sort based on query start. */
--{
--const struct hashEl *a = *((struct hashEl **)va);
--const struct hashEl *b = *((struct hashEl **)vb);
--return cmpWordsWithEmbeddedNumbers(a->name, b->name);
--}
--
--void addCluster(struct lm *lm, struct regItem *itemList, int start, int end,
--	struct regCluster **pList)
--/* Make cluster of all items that overlap start/end, and put it on list. */
--{
--struct regCluster *cluster;
--lmAllocVar(lm, cluster);
--double score = 0.0;
--double maxSubScore = 0.0;
--struct slRef  *refList = NULL, *ref;
--struct regItem *item;
--for (item = itemList; item != NULL; item = item->next)
--    {
--    if (rangeIntersection(start, end, item->chromStart, item->chromEnd) > 0)
--	{
--	lmAllocVar(lm, ref);
--	ref->val = item;
--	slAddHead(&refList, ref);
--	score += item->score;
--	if (item->score > maxSubScore) maxSubScore = item->score;
--	}
--    }
--slReverse(&refList);
--cluster->chrom = itemList->chrom;
--cluster->chromStart = start;
--cluster->chromEnd = end;
--cluster->itemRefList = refList;
--cluster->score = score;
--cluster->maxSubScore = maxSubScore;
--slAddHead(pList, cluster);
--}
--
--struct regCluster *clusterItems(struct lm *lm, struct regItem *itemList, 
--	double forceJoinScore, double weakLevel)
--/* Convert a list of items to a list of clusters of items.  This may break up clusters that
-- * have weakly linked parts. 
--      [                ]
--      AAAAAAAAAAAAAAAAAA 
--       BBBBBB   DDDDDD
--        CCCC     EEEE
--   gets tranformed into
--       [    ]   [    ]
--      AAAAAAAAAAAAAAAAAA 
--       BBBBBB   DDDDDD
--        CCCC     EEEE
--   The strategy is to build a rangeTree of coverage, which might look something like so:
--      123333211123333211 
--   then define cluster ends that exceed the minimum limit, which is either 10% of the highest
--   or forceJoinScore if 10% of the highest is more than forceJoinScore.  This will go to
--   something like so:
--        [---]   [----]   
--   Finally the items that are overlapping a cluster are assigned to it.  Note that this
--   may mean that an item may be in multiple clusters.
--        [ABC]   [ ADE]
-- */
--{
--int easyMax = round(1.0/weakLevel);
--int itemCount = slCount(itemList);
--struct regCluster *clusterList = NULL;
--if (itemCount < easyMax)
--    {
--    struct regItem *item = itemList;
--    int chromStart = item->chromStart;
--    int chromEnd = item->chromEnd;
--    for (item = item->next; item != NULL; item = item->next)
--        {
--	if (item->chromStart < chromStart) chromStart = item->chromStart;
--	if (item->chromEnd > chromEnd) chromEnd = item->chromEnd;
--	}
--    addCluster(lm, itemList, chromStart, chromEnd, &clusterList);
--    }
--else
--    {
--    /* Make up coverage tree. */
--    struct rbTree *covTree = rangeTreeNew();
--    struct regItem *item;
--    for (item = itemList; item != NULL; item = item->next)
--	rangeTreeAddToCoverageDepth(covTree, item->chromStart, item->chromEnd);
--    struct range *range, *rangeList = rangeTreeList(covTree);
--
--    /* Figure out maximum coverage. */
--    int maxCov = 0;
--    for (range = rangeList; range != NULL; range = range->next)
--        {
--	int cov = ptToInt(range->val);
--	if (cov > maxCov) maxCov = cov;
--	}
--
--    /* Figure coverage threshold. */
--    int threshold = round(maxCov * weakLevel);
--    if (threshold > forceJoinScore-1) threshold = forceJoinScore-1;
--
--    /* Loop through emitting sections over threshold as clusters */
--    boolean inRange = FALSE;
--    boolean start = 0, end = 0;
--    for (range = rangeList; range != NULL; range = range->next)
--        {
--	int cov = ptToInt(range->val);
--	if (cov > threshold)
--	    {
--	    if (inRange)
--	       end = range->end;
--	    else
--	       {
--	       inRange = TRUE;
--	       start = range->start;
--	       end = range->end;
--	       }
--	    }
--	else
--	    {
--	    if (inRange)
--		{
--		addCluster(lm, itemList, start, end, &clusterList);
--		inRange = FALSE;
--		}
--	    }
--	}
--    if (inRange)
--        addCluster(lm, itemList, start, end, &clusterList);
--    }
--slReverse(&clusterList);
--return clusterList;
--}
--
- static int clusterIx = 0;
- 
- void outputClustersForChrom(char *chrom, struct rbTree *tree, FILE *fCluster, FILE *fBed)
-@@ -302,13 +60,13 @@ verbose(2, "Got %d ranges on %s\n", slCount(rangeList), chrom);
- struct lm *lm = lmInit(0);
- for (range = rangeList; range != NULL; range = range->next)
-     {
--    struct regCluster *cluster, *clusterList = clusterItems(lm, range->val, 
-+    struct peakCluster *cluster, *clusterList = peakClusterItems(lm, range->val, 
-     	clForceJoinScore, clWeakLevel);
-     for (cluster = clusterList; cluster != NULL; cluster = cluster->next)
-         {
- 	struct slRef *ref, *refList=cluster->itemRefList;
- 	++clusterIx;
--	struct regItem *item = refList->val;
-+	struct peakItem *item = refList->val;
- 	struct hash *uniqHash = hashNew(0);
- 	for (ref = refList; ref != NULL; ref = ref->next)
- 	    {
-@@ -335,20 +93,17 @@ lmCleanup(&lm);
- void regCluster(char *tableOfTables, char *outCluster, char *outBed)
- /* regCluster - Cluster regulator regions. */
- {
--struct regSource *source, *sourceList = regSourceLoadAll(tableOfTables, clDims);
-+struct peakSource *source, *sourceList = peakSourceLoadAll(tableOfTables, clDims);
- verbose(1, "Read %d sources from %s\n", slCount(sourceList), tableOfTables);
--struct hash *chromHash = hashNew(0);
--struct rbTreeNode *stack[128];
-+struct peakClusterMaker *maker = peakClusterMakerNew();
- for (source = sourceList; source != NULL; source = source->next)
--    {
--    clusterSource(source, chromHash, stack);
--    }
-+    peakClusterMakerAddFromSource(maker, source);
- 
- /* Get out list of chromosomes and process one at a time. */
- FILE *fCluster = mustOpen(outCluster, "w");
- FILE *fBed = mustOpen(outBed, "w");
--struct hashEl *chrom, *chromList = hashElListHash(chromHash);
--slSort(&chromList, cmpChromEls);
-+struct hashEl *chrom;
-+struct hashEl *chromList = peakClusterMakerChromList(maker);
- int totalClusters = 0;
- for (chrom = chromList; chrom != NULL; chrom = chrom->next)
-     {
-@@ -357,10 +112,10 @@ for (chrom = chromList; chrom != NULL; chrom = chrom->next)
-     outputClustersForChrom(chrom->name, tree, fCluster, fBed);
-     }
- verbose(1, "%d singly-linked clusters, %d clusters in %d chromosomes\n", 
--	totalClusters, clusterIx, chromHash->elCount);
-+	totalClusters, clusterIx, maker->chromHash->elCount);
- carefulClose(&fCluster);
- carefulClose(&fBed);
--
-+peakClusterMakerFree(&maker);
- }
- 
- int main(int argc, char *argv[])
-diff --git a/src/hg/utils/automation/Encode.pm b/src/hg/utils/automation/Encode.pm
-old mode 100644
-new mode 100755
-diff --git a/src/hg/utils/automation/EnsGeneAutomate.pm b/src/hg/utils/automation/EnsGeneAutomate.pm
-old mode 100644
-new mode 100755
-diff --git a/src/hg/utils/automation/HgDb.pm b/src/hg/utils/automation/HgDb.pm
-old mode 100644
-new mode 100755
diff --git a/gbtools/src/blatSrc/lib/dlist.c b/gbtools/src/blatSrc/lib/dlist.c
deleted file mode 100644
index 3d1f22d..0000000
--- a/gbtools/src/blatSrc/lib/dlist.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/* dlist.c - Doubly-linked list routines. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-#include "common.h"
-#include "dlist.h"
-
-
-void dlListInit(struct dlList *dl)
-/* Initialize list to be empty */
-{
-dl->head = (struct dlNode *)(&dl->nullMiddle);
-dl->nullMiddle = NULL;
-dl->tail = (struct dlNode *)(&dl->head);
-}
-
-struct dlList *newDlList()
-/* Return a new doubly linked list. */
-{
-struct dlList *dl;
-AllocVar(dl);
-dl->head = (struct dlNode *)(&dl->nullMiddle);
-dl->tail = (struct dlNode *)(&dl->head);
-return dl;
-}
-
-void dlListReset(struct dlList *dl)
-/* Reset a list to the empty state (does not free values)  */
-{
-struct dlNode *node, *next;
-for (node = dl->head; node->next != NULL; node = next)
-    {
-    next = node->next;
-    freeMem(node);
-    }
-dl->head = (struct dlNode *)(&dl->nullMiddle);
-dl->nullMiddle = NULL;
-dl->tail = (struct dlNode *)(&dl->head);
-}
-
-void freeDlList(struct dlList **pList)
-/* Free up a doubly linked list and it's nodes (but not the node values). */
-{
-struct dlList *list = *pList;
-if (list != NULL)
-    {
-    dlListReset(list);
-    freez(pList);
-    }
-}
-
-void freeDlListAndVals(struct dlList **pList)
-/* Free all values in doubly linked list and the list itself.  (Just calls
- * freeMem on all values. */
-{
-struct dlList *list = *pList;
-if (list != NULL)
-    {
-    struct dlNode *node;
-    for (node = list->head; node->next != NULL; node = node->next)
-        freeMem(node->val);
-    freeDlList(pList);
-    }
-}
-
-
-void dlInsertBetween(struct dlNode *before, struct dlNode *after, struct dlNode *newNode)
-{
-before->next = newNode; 
-newNode->prev = before; 
-newNode->next = after;  
-after->prev = newNode; 
-}
-
-void dlAddBefore(struct dlNode *anchor, struct dlNode *newNode)
-/* Add a node to list before anchor member. */
-{
-dlInsertBetween(anchor->prev, anchor, newNode);
-}
-
-void dlAddAfter(struct dlNode *anchor, struct dlNode *newNode)
-/* Add a node to list after anchor member. */
-{
-dlInsertBetween(anchor, anchor->next, newNode);
-}
-
-void dlAddHead(struct dlList *list, struct dlNode *newNode)
-/* Add a node to head of list. */
-{
-struct dlNode *head = list->head;
-dlInsertBetween(head->prev, head, newNode);
-}
-
-void dlAddTail(struct dlList *list, struct dlNode *newNode)
-/* Add a node to tail of list. */
-{
-struct dlNode *tail = list->tail;
-dlInsertBetween(tail, tail->next, newNode);
-}
-
-struct dlNode *dlAddValBefore(struct dlNode *anchor, void *val)
-/* Create a node containing val and add to list before anchor member. */
-{
-struct dlNode *node = AllocA(struct dlNode);
-node->val = val;
-dlAddBefore(anchor, node);
-return node;
-}
-
-struct dlNode *dlAddValAfter(struct dlNode *anchor, void *val)
-/* Create a node containing val and add to list after anchor member. */
-{
-struct dlNode *node = AllocA(struct dlNode);
-node->val = val;
-dlAddAfter(anchor, node);
-return node;
-}
-
-struct dlNode *dlAddValHead(struct dlList *list, void *val)
-/* Create a node containing val and add to head of list. */
-{
-struct dlNode *node = AllocA(struct dlNode);
-node->val = val;
-dlAddHead(list, node);
-return node;
-}
-
-struct dlNode *dlAddValTail(struct dlList *list, void *val)
-/* Create a node containing val and add to tail of list. */
-{
-struct dlNode *node = AllocA(struct dlNode);
-node->val = val;
-dlAddTail(list, node);
-return node;
-}
-
-void dlRemove(struct dlNode *node)
-/* Removes a node from list. Node is not freed. */
-{
-struct dlNode *before = node->prev;
-struct dlNode *after = node->next;
-before->next = after;
-after->prev = before;
-node->prev = NULL;
-node->next = NULL;
-}
-
-void dlRemoveHead(struct dlList *list)
-/* Removes head from list. Node is not freed. */
-{
-dlRemove(list->head);
-}
-
-void dlRemoveTail(struct dlList *list)
-/* Remove tail from list. Node is not freed. */
-{
-dlRemove(list->tail);
-}
-
-struct dlNode *dlPopHead(struct dlList *list)
-/* Remove first node from list and return it. */
-{
-struct dlNode *node = list->head;
-if (node->next == NULL)
-    return NULL;
-dlRemove(node);
-return node;
-}
-
-struct dlNode *dlPopTail(struct dlList *list)
-/* Remove last node from list and return it. */
-{
-struct dlNode *node = list->tail;
-if (node->prev == NULL)
-    return NULL;
-dlRemove(node);
-return node;
-}
-
-void dlDelete(struct dlNode **nodePtr)
-/* Removes a node from list and frees it. */
-{
-struct dlNode *node = *nodePtr;
-if (node != NULL)
-    {
-    dlRemove(node);
-    freeMem(node);
-    }
-}
-
-int dlCount(struct dlList *list)
-/* Return length of list. */
-{
-return slCount(list->head) - 1;
-}
-
-
-struct dlSorter 
-/* Helper structure for sorting dlNodes preserving order */
-    {
-    struct dlNode *node;
-    };
-
-static int (*compareFunc)(const void *elem1, const void *elem2);
-/* Node comparison pointer, just used by dlSortNodes and helpers. */
-
-static int dlNodeCmp(const void *elem1, const void *elem2)
-/* Compare two dlSorters indirectly, by calling compareFunc. */
-{
-struct dlSorter *a = (struct dlSorter *)elem1;
-struct dlSorter *b = (struct dlSorter *)elem2;
-return compareFunc(&a->node->val, &b->node->val);
-}
-    
-void dlSort(struct dlList *list, 
-	int (*compare )(const void *elem1,  const void *elem2))
-/* Sort a singly linked list with Qsort and a temporary array. 
- * The arguments to the compare function in real, non-void, life
- * are pointers to pointers of the type that is in the val field of 
- * the nodes of the list. */
-{
-int len = dlCount(list);
-
-if (len > 1)
-    {
-    /* Move val's onto an array, sort, and then put back into list. */
-    struct dlSorter *sorter = needLargeMem(len * sizeof(sorter[0])), *s;
-    struct dlNode *node;
-    int i;
-
-    for (i=0, node = list->head; i<len; ++i, node = node->next)
-	{
-	s = &sorter[i];
-	s->node = node;
-	}
-    compareFunc = compare;
-    qsort(sorter, len, sizeof(sorter[0]), dlNodeCmp);
-    dlListInit(list);
-    for (i=0; i<len; ++i)
-	dlAddTail(list, sorter[i].node);
-    freeMem(sorter);
-    }
-}
-
-
-boolean dlEmpty(struct dlList *list)
-/* Return TRUE if list is empty. */
-{
-return dlIsEmpty(list);
-}
-
-struct dlNode *dlGetBeforeHead(struct dlList *list)
-/* Get the node before the head of the list */
-{
-if (dlEmpty(list))
-    return list->head;
-else
-    return list->head->prev;
-}
-
-struct dlNode *dlGetAfterTail(struct dlList *list)
-/* Get the node after the tail of the list */
-{
-if (dlEmpty(list))
-    return list->tail;
-else
-    return list->tail->next;
-}
-
-void *dlListToSlList(struct dlList *dList)
-/* Return slList from dlList. */
-{
-struct slList *list = NULL, *el;
-struct dlNode *node;
-
-for (node = dList->tail; node->prev != NULL; node = node->prev)
-    {
-    el = node->val;
-    slAddHead(&list, el);
-    }
-return list;
-}
-
-void dlCat(struct dlList *a, struct dlList *b)
-/* Move items from b to end of a. */
-{
-struct dlNode *node;
-while ((node = dlPopHead(b)) != NULL)
-    dlAddTail(a, node);
-}
-
-struct dlNode *dlValInList(struct dlList *list, void *val)
-/* Return node on list if any that has associated val. */
-{
-struct dlNode *node;
-for (node = list->head; !dlEnd(node); node = node->next)
-    if (node->val == val)
-        return node;
-return NULL;
-}
diff --git a/gbtools/src/blatSrc/lib/dnaLoad.c b/gbtools/src/blatSrc/lib/dnaLoad.c
deleted file mode 100644
index f498e23..0000000
--- a/gbtools/src/blatSrc/lib/dnaLoad.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/* dnaLoad - Load dna from a variaty of file formats. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "dnaseq.h"
-#include "fa.h"
-#include "twoBit.h"
-#include "nib.h"
-#include "dnaLoad.h"
-
-
-struct dnaLoadStack
-/* Keep track of a single DNA containing file. */
-    {
-    struct dnaLoadStack *next;	/* Next in list. */
-    struct twoBitFile *twoBit; /* Two bit file if any. */
-    struct twoBitIndex *tbi;	 /* Next twoBit sequence. */
-    struct lineFile *textFile;	/* Text file if any. */
-    boolean textIsFa;		/* True if text is in fasta format. */
-    };
-
-struct dnaLoad
-/* A structure to help us load DNA from files - mixed case
- * from either .fa, .nib, or .2bit files */
-    {
-    struct dnaLoad *next;	/* Next loader in list. */
-    char *topFileName;		/* Highest level file name. */
-    boolean finished;		/* Set to TRUE at end. */
-    struct dnaLoadStack *stack;	/* Stack of files we're working on. */
-    int curStart;		/* Start offset within current parent sequence. */
-    int curEnd;			/* End offset  within current parent sequence. */
-    int curSize;		/* Size of current parent sequence. */
-    };
-
-struct dnaLoadStack *dnaLoadStackNew(char *fileName)
-/* Create new dnaLoadStack on composite file. */
-{
-struct dnaLoadStack *dls;
-AllocVar(dls);
-if (twoBitIsFile(fileName))
-    {
-    dls->twoBit = twoBitOpen(fileName);
-    dls->tbi = dls->twoBit->indexList;
-    }
-else
-    {
-    char *line;
-    dls->textFile = lineFileOpen(fileName, TRUE);
-    if (lineFileNextReal(dls->textFile, &line))
-        {
-	line = trimSpaces(line);
-	if (line[0] == '>')
-	    dls->textIsFa = TRUE;
-	lineFileReuse(dls->textFile);
-	}
-    }
-return dls;
-}
-
-void dnaLoadStackFree(struct dnaLoadStack **pDls)
-/* free up resources associated with dnaLoadStack. */
-{
-struct dnaLoadStack *dls = *pDls;
-if (dls != NULL)
-    {
-    lineFileClose(&dls->textFile);
-    twoBitClose(&dls->twoBit);
-    freez(pDls);
-    }
-}
-
-void dnaLoadStackFreeList(struct dnaLoadStack **pList)
-/* Free a list of dynamically allocated dnaLoadStack's */
-{
-struct dnaLoadStack *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    dnaLoadStackFree(&el);
-    }
-*pList = NULL;
-}
-
-void dnaLoadClose(struct dnaLoad **pDl)
-/* Free up resources associated with dnaLoad. */
-{
-struct dnaLoad *dl = *pDl;
-if (dl != NULL)
-    {
-    dnaLoadStackFreeList(&dl->stack);
-    freeMem(dl->topFileName);
-    freez(pDl);
-    }
-}
-
-struct dnaLoad *dnaLoadOpen(char *fileName)
-/* Return new DNA loader.  Call dnaLoadNext() on this until
- * you get a NULL return, then dnaLoadClose(). */
-{
-struct dnaLoad *dl;
-AllocVar(dl);
-dl->topFileName = cloneString(fileName);
-return dl;
-}
-
-struct dnaSeq *dnaLoadSingle(char *fileName, int *retStart, int *retEnd, int *retParentSize)
-/* Return sequence if it's a nib file or 2bit part, NULL otherwise. */
-{
-struct dnaSeq *seq = NULL;
-unsigned start = 0, end = 0;
-int parentSize = 0;
-if (nibIsFile(fileName))
-    {
-    /* Save offset out of fileName for auto-lifting */
-    char filePath[PATH_LEN];
-    char name[PATH_LEN];
-    nibParseName(0, fileName, filePath, name, &start, &end);
-
-    if (end != 0)	/* It's just a range. */
-        {
-	FILE *f;
-	int size;
-	nibOpenVerify(filePath, &f, &size);
-	parentSize = size;
-	}
-    seq =  nibLoadAllMasked(NIB_MASK_MIXED, fileName);
-    if (end == 0)
-         parentSize = end = seq->size;
-    freez(&seq->name);
-    seq->name = cloneString(name);
-    }
-else if (twoBitIsRange(fileName))
-    {
-    /* Save offset out of fileName for auto-lifting */
-    char *rangeSpec = cloneString(fileName);
-    int start, end;
-    char *file, *seqName;
-    twoBitParseRange(rangeSpec, &file, &seqName, &start, &end);
-
-    /* Load sequence. */
-        {
-	struct twoBitFile *tbf = twoBitOpen(file);
-	parentSize = twoBitSeqSize(tbf, seqName);
-	seq = twoBitReadSeqFrag(tbf, seqName, start, end);
-	twoBitClose(&tbf);
-	}
-    if (end == 0)
-        end = seq->size;
-    freez(&rangeSpec);
-    }
-if (retStart != NULL)
-    *retStart = start;
-if (retEnd != NULL)
-    *retEnd = end;
-if (retParentSize != NULL)
-    *retParentSize = parentSize;
-return seq;
-}
-
-static struct dnaSeq *dnaLoadNextFromStack(struct dnaLoad *dl)
-/* Load next piece of DNA from stack of files.  Return NULL
- * when stack is empty. */
-{
-struct dnaLoadStack *dls;
-struct dnaSeq *seq = NULL;
-while ((dls = dl->stack) != NULL)
-    {
-    if (dls->twoBit)
-        {
-	if (dls->tbi != NULL)
-	    {
-	    seq = twoBitReadSeqFrag(dls->twoBit, dls->tbi->name, 0, 0);
-	    dls->tbi = dls->tbi->next;
-	    return seq;
-	    }
-	else
-	    {
-	    dl->stack = dls->next;
-	    dnaLoadStackFree(&dls);
-	    }
-	}
-    else if (dls->textIsFa)
-        {
-	DNA *dna;
-	char *name;
-	int size;
-	if (faMixedSpeedReadNext(dls->textFile, &dna, &size, &name))
-	    {
-	    AllocVar(seq);
-	    seq->dna = needLargeMem(size+1);
-	    memcpy((void *)seq->dna, (void *)dna, size);
-	    seq->dna[size] = 0;
-	    seq->size = size;
-	    seq->name = cloneString(name);
-	    dl->curStart = 0;
-	    dl->curEnd = size;
-	    dl->curSize = size;
-	    return seq;
-	    }
-	else
-	    {
-	    dl->stack = dls->next;
-	    dnaLoadStackFree(&dls);
-	    }
-	}
-    else	/* It's a file full of file names. */
-        {
-	char *line;
-	if (lineFileNextReal(dls->textFile, &line))
-	    {
-	    line  = trimSpaces(line);
-	    if ((seq = dnaLoadSingle(line, &dl->curStart, &dl->curEnd, &dl->curSize)) != NULL)
-	         return seq;
-	    else
-	         {
-		 struct dnaLoadStack *newDls;
-		 newDls = dnaLoadStackNew(line);
-		 slAddHead(&dl->stack, newDls);
-		 }
-	    }
-	else
-	    {
-	    dl->stack = dls->next;
-	    dnaLoadStackFree(&dls);
-	    }
-	}
-    }
-dl->finished = TRUE;
-return NULL;
-}
-
-static struct dnaSeq *dnaLoadStackOrSingle(struct dnaLoad *dl)
-/* Return next dna sequence. */
-{
-struct dnaSeq *seq = NULL;
-if (dl->finished)
-    return NULL;
-if (dl->stack == NULL)
-    {
-    if ((seq = dnaLoadSingle(dl->topFileName, &dl->curStart, &dl->curEnd, &dl->curSize)) != NULL)
-	{
-	dl->finished = TRUE;
-	return seq;
-	}
-    dl->stack = dnaLoadStackNew(dl->topFileName);
-    }
-return dnaLoadNextFromStack(dl);
-}
-
-struct dnaSeq *dnaLoadNext(struct dnaLoad *dl)
-/* Return next dna sequence. */
-{
-struct dnaSeq *seq;
-dl->curSize = dl->curStart = dl->curEnd = 0;
-seq = dnaLoadStackOrSingle(dl);
-return seq;
-}
-
-struct dnaSeq *dnaLoadAll(char *fileName)
-/* Return list of all DNA referenced in file.  File
- * can be either a single fasta file, a single .2bit
- * file, a .nib file, or a text file containing
- * a list of the above files. DNA is mixed case. */
-{
-struct dnaLoad *dl = dnaLoadOpen(fileName);
-struct dnaSeq *seqList = NULL, *seq;
-while ((seq = dnaLoadNext(dl)) != NULL)
-    {
-    slAddHead(&seqList, seq);
-    }
-dnaLoadClose(&dl);
-slReverse(&seqList);
-return seqList;
-}
-
-int dnaLoadCurStart(struct dnaLoad *dl)
-/* Returns the start offset of current sequence within a larger
- * sequence.  Useful for programs that want to auto-lift
- * nib and 2bit fragments.  Please call only after a
- * sucessful dnaLoadNext. */
-{
-return dl->curStart;
-}
-
-int dnaLoadCurEnd(struct dnaLoad *dl)
-/* Returns the end offset of current sequence within a larger
- * sequence.  Useful for programs that want to auto-lift
- * nib and 2bit fragments.  Please call only after a
- * sucessful dnaLoadNext. */
-{
-return dl->curEnd;
-}
-
-int dnaLoadCurSize(struct dnaLoad *dl)
-/* Returns the size of the parent sequence.  Useful for
- * auto-lift programs.  Please call only after dnaLoadNext. */
-{
-return dl->curSize;
-}
-
diff --git a/gbtools/src/blatSrc/lib/dnaMarkov.c b/gbtools/src/blatSrc/lib/dnaMarkov.c
deleted file mode 100644
index 91c153d..0000000
--- a/gbtools/src/blatSrc/lib/dnaMarkov.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/* dnaMarkov - stuff to build 1st, 2nd, 3rd, and coding
- * 3rd degree Markov models for DNA. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "dnaseq.h"
-#include "slog.h"
-#include "dnaMarkov.h"
-
-
-void dnaMark0(struct dnaSeq *seqList, double mark0[5], int slogMark0[5])
-/* Figure out frequency of bases in input.  Results go into
- * mark0 and optionally in scaled log form into slogMark0.
- * Order is N, T, C, A, G.  (TCAG is our normal order) */
-{
-struct dnaSeq *seq;
-int histo[4];
-int oneHisto[4];
-double total;
-int i;
-double *freq = mark0+1;
-
-zeroBytes(histo, sizeof(histo));
-for (seq = seqList; seq != NULL; seq = seq->next)
-    {
-    dnaBaseHistogram(seq->dna, seq->size, oneHisto);
-    for (i=0; i<4; ++i)
-        histo[i] += oneHisto[i];
-    }
-total = histo[0] + histo[1] + histo[2] + histo[3];
-freq[-1] = 1.0;
-for (i=0; i<4; ++i)
-    freq[i] = (double)histo[i] / total;
-if (slogMark0 != NULL)
-    {
-    int *slogFreq = slogMark0 + 1;
-    slogFreq[-1] = 0;
-    for (i=0; i<4; ++i)
-	slogFreq[i] = slog(freq[i]);
-    }
-}
-
-
-void dnaMark1(struct dnaSeq *seqList, double mark0[5], int slogMark0[5], 
-	double mark1[5][5], int slogMark1[5][5])
-/* Make up 1st order Markov model - probability that one nucleotide
- * will follow another. Input is sequence and 0th order Markov models.
- * Output is first order Markov model. slogMark1 can be NULL. */
-{
-struct dnaSeq *seq;
-DNA *dna, *endDna;
-int i,j;
-int histo[5][5];
-int hist1[5];
-
-zeroBytes(histo, sizeof(histo));
-zeroBytes(hist1, sizeof(hist1));
-for (seq = seqList; seq != NULL; seq = seq->next)
-    {
-    dna = seq->dna;
-    endDna = dna + seq->size-1;
-    for (;dna < endDna; ++dna)
-        {
-        i = ntVal[(int)dna[0]];
-        j = ntVal[(int)dna[1]];
-        hist1[i+1] += 1;
-        histo[i+1][j+1] += 1;
-        }
-    }
-for (i=0; i<5; ++i)
-    {
-    for (j=0; j<5; ++j)
-        {
-        double mark1Val;
-        int matVal = histo[i][j] + 1;
-        mark1Val = ((double)matVal)/(hist1[i]+5);
-        mark1[i][j] = mark1Val;
-	if (slogMark1 != NULL)
-	    slogMark1[i][j] = slog(mark1Val);
-        }
-    }
-for (i=0; i<5; ++i)
-    {
-    mark1[i][0] = 1;
-    mark1[0][i] = mark0[i];
-    if (slogMark1 != NULL)
-	{
-	slogMark1[i][0] = 0;
-	slogMark1[0][i] = slogMark0[i];
-	}
-    }
-}
-
-void dnaMarkTriple(struct dnaSeq *seqList, 
-    double mark0[5], int slogMark0[5],
-    double mark1[5][5], int slogMark1[5][5],
-    double mark2[5][5][5], int slogMark2[5][5][5],
-    int offset, int advance, int earlyEnd)
-/* Make up a table of how the probability of a nucleotide depends on the previous two.
- * Depending on offset and advance parameters this could either be a straight 2nd order
- * Markov model, or a model for a particular coding frame. */
-{
-struct dnaSeq *seq;
-DNA *dna, *endDna;
-int i,j,k;
-int histo[5][5][5];
-int hist2[5][5];
-int total = 0;
-zeroBytes(histo, sizeof(histo));
-zeroBytes(hist2, sizeof(hist2));
-for (seq = seqList; seq != NULL; seq = seq->next)
-    {
-    dna = seq->dna;
-    endDna = dna + seq->size - earlyEnd - 2;
-    dna += offset;
-    for (;dna < endDna; dna += advance)
-        {
-        i = ntVal[(int)dna[0]];
-        j = ntVal[(int)dna[1]];
-        k = ntVal[(int)dna[2]];
-        hist2[i+1][j+1] += 1;
-        histo[i+1][j+1][k+1] += 1;
-        total += 1;
-        }
-    }
-for (i=0; i<5; ++i)
-    {
-    for (j=0; j<5; ++j)
-        {
-        for (k=0; k<5; ++k)
-            {
-            double markVal;
-            int matVal = histo[i][j][k]+1;
-            if (i == 0 || j == 0 || k == 0)
-                {
-                if (k == 0)
-                    {
-                    mark2[i][j][k] = 1;
-		    if (slogMark2 != NULL)
-			slogMark2[i][j][k] = 0;
-                    }
-                else if (j == 0)
-                    {
-                    mark2[i][j][k] = mark0[k];
-		    if (slogMark2 != NULL)
-			slogMark2[i][j][k] = slogMark0[k];
-                    }
-                else if (i == 0)
-                    {
-                    mark2[i][j][k] = mark1[j][k];
-		    if (slogMark2 != NULL)
-			slogMark2[i][j][k] = slogMark1[j][k];
-                    }
-                }
-            else
-                {
-                markVal = ((double)matVal)/(hist2[i][j]+5);
-                mark2[i][j][k] = markVal;
-		if (slogMark2 != NULL)
-		    slogMark2[i][j][k] = slog(markVal);
-                }
-            }
-        }
-    }
-}
-
-void dnaMark2(struct dnaSeq *seqList, double mark0[5], int slogMark0[5],
-	double mark1[5][5], int slogMark1[5][5],
-	double mark2[5][5][5], int slogMark2[5][5][5])
-/* Make up 1st order Markov model - probability that one nucleotide
- * will follow the previous two. */
-{
-dnaMarkTriple(seqList, mark0, slogMark0, mark1, slogMark1, 
-	mark2, slogMark2, 0, 1, 0);
-}
-
-#define SIG 10
-
-char *dnaMark2Serialize(double mark2[5][5][5])
-// serialize a 2nd order markov model
-{
-int i, j, k;
-int offset = 0;
-char *buf = NULL;
-int bufLen = 5*5*5 * (SIG + 3) + 1;
-buf = needMem(bufLen);
-for(i = 0; i < 5; i++)
-    for(j = 0; j < 5; j++)
-        for(k = 0; k < 5; k++)
-            {
-            if(offset)
-                {
-                sprintf(buf + offset, ";%1.*f", SIG, mark2[i][j][k]);
-                offset += (SIG + 3);
-                }
-            else
-                {
-                sprintf(buf + offset, "%1.*f", SIG, mark2[i][j][k]);
-                offset += (SIG + 2);
-                }
-            }
-buf[offset] = 0;
-return buf;
-}
-
-void dnaMark2Deserialize(char *buf, double mark2[5][5][5])
-// deserialize a 2nd order markov model
-{
-int i, j, k;
-int offset = 0;
-for(i = 0; i < 5; i++)
-    for(j = 0; j < 5; j++)
-        for(k = 0; k < 5; k++)
-            {
-            float f;
-            if(offset)
-                {
-                sscanf(buf + offset, ";%f", &f);
-                mark2[i][j][k] = f;
-                offset += (SIG + 3);
-                }
-            else
-                {
-                sscanf(buf + offset, "%f", &f);
-                mark2[i][j][k] = f;
-                offset += (SIG + 2);
-                }
-            }
-}
-
-void dnaMarkMakeLog2(double mark2[5][5][5])
-// convert a 2nd-order markov array to log2
-{
-int i, j, k;
-for(i = 0; i < 5; i++)
-    for(j = 0; j < 5; j++)
-        for(k = 0; k < 5; k++)
-            mark2[i][j][k] = logBase2(mark2[i][j][k]);
-}
diff --git a/gbtools/src/blatSrc/lib/dnaMotif.c b/gbtools/src/blatSrc/lib/dnaMotif.c
deleted file mode 100644
index 0e2f3f7..0000000
--- a/gbtools/src/blatSrc/lib/dnaMotif.c
+++ /dev/null
@@ -1,631 +0,0 @@
-/* dnaMotif.c was originally generated by the autoSql program, which also 
- * generated dnaMotif.h and dnaMotif.sql.  This module links the database and
- * the RAM representation of objects. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "sqlList.h"
-#include "dystring.h"
-#include "dnaMotif.h"
-#include "portable.h"
-
-
-struct dnaMotif *dnaMotifCommaIn(char **pS, struct dnaMotif *ret)
-/* Create a dnaMotif out of a comma separated string. 
- * This will fill in ret if non-null, otherwise will
- * return a new dnaMotif */
-{
-char *s = *pS;
-int i;
-
-if (ret == NULL)
-    AllocVar(ret);
-ret->name = sqlStringComma(&s);
-ret->columnCount = sqlSignedComma(&s);
-s = sqlEatChar(s, '{');
-AllocArray(ret->aProb, ret->columnCount);
-for (i=0; i<ret->columnCount; ++i)
-    {
-    ret->aProb[i] = sqlSignedComma(&s);
-    }
-s = sqlEatChar(s, '}');
-s = sqlEatChar(s, ',');
-s = sqlEatChar(s, '{');
-AllocArray(ret->cProb, ret->columnCount);
-for (i=0; i<ret->columnCount; ++i)
-    {
-    ret->cProb[i] = sqlSignedComma(&s);
-    }
-s = sqlEatChar(s, '}');
-s = sqlEatChar(s, ',');
-s = sqlEatChar(s, '{');
-AllocArray(ret->gProb, ret->columnCount);
-for (i=0; i<ret->columnCount; ++i)
-    {
-    ret->gProb[i] = sqlSignedComma(&s);
-    }
-s = sqlEatChar(s, '}');
-s = sqlEatChar(s, ',');
-s = sqlEatChar(s, '{');
-AllocArray(ret->tProb, ret->columnCount);
-for (i=0; i<ret->columnCount; ++i)
-    {
-    ret->tProb[i] = sqlSignedComma(&s);
-    }
-s = sqlEatChar(s, '}');
-s = sqlEatChar(s, ',');
-*pS = s;
-return ret;
-}
-
-void dnaMotifFree(struct dnaMotif **pEl)
-/* Free a single dynamically allocated dnaMotif such as created
- * with dnaMotifLoad(). */
-{
-struct dnaMotif *el;
-
-if ((el = *pEl) == NULL) return;
-freeMem(el->name);
-freeMem(el->aProb);
-freeMem(el->cProb);
-freeMem(el->gProb);
-freeMem(el->tProb);
-freez(pEl);
-}
-
-void dnaMotifFreeList(struct dnaMotif **pList)
-/* Free a list of dynamically allocated dnaMotif's */
-{
-struct dnaMotif *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    dnaMotifFree(&el);
-    }
-*pList = NULL;
-}
-
-void dnaMotifOutput(struct dnaMotif *el, FILE *f, char sep, char lastSep) 
-/* Print out dnaMotif.  Separate fields with sep. Follow last field with lastSep. */
-{
-int i;
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->name);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%d", el->columnCount);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->columnCount; ++i)
-    {
-    fprintf(f, "%f", el->aProb[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->columnCount; ++i)
-    {
-    fprintf(f, "%f", el->cProb[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->columnCount; ++i)
-    {
-    fprintf(f, "%f", el->gProb[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->columnCount; ++i)
-    {
-    fprintf(f, "%f", el->tProb[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-fputc(lastSep,f);
-}
-
-float dnaMotifSequenceProb(struct dnaMotif *motif, DNA *dna)
-/* Return probability of dna according to motif.  Make sure
- * motif is probabalistic (with call to dnaMotifMakeProbabalistic
- * if you're not sure) before calling this. */
-{
-float p = 1.0;
-int i;
-for (i=0; i<motif->columnCount; ++i)
-    {
-    switch (dna[i])
-        {
-	case 'a':
-	case 'A':
-	    p *= motif->aProb[i];
-	    break;
-	case 'c':
-	case 'C':
-	    p *= motif->cProb[i];
-	    break;
-	case 'g':
-	case 'G':
-	    p *= motif->gProb[i];
-	    break;
-	case 't':
-	case 'T':
-	    p *= motif->tProb[i];
-	    break;
-	case 0:
-	    warn("dna shorter than motif");
-	    internalErr();
-	    break;
-	default:
-	    p *= 0.25;
-	    break;
-	}
-    }
-return p;
-}
-
-static float dnaMotifSequenceProbWithMark0(struct dnaMotif *motif, DNA *dna, double mark0[5])
-{
-float p = 1.0;
-int i;
-for (i=0; i<motif->columnCount; ++i)
-    {
-    int val = ntVal[(int) dna[i]] + 1;
-    p *= (mark0[val]/mark0[0]);
-    }
-return p;
-}
-
-static float dnaMotifSequenceProbLog(struct dnaMotif *motif, DNA *dna)
-{
-float p = 0;
-int i;
-for (i=0; i<motif->columnCount; ++i)
-    {
-    switch (dna[i])
-        {
-	case 'a':
-	case 'A':
-	    p += motif->aProb[i];
-	    break;
-	case 'c':
-	case 'C':
-	    p += motif->cProb[i];
-	    break;
-	case 'g':
-	case 'G':
-	    p += motif->gProb[i];
-	    break;
-	case 't':
-	case 'T':
-	    p += motif->tProb[i];
-	    break;
-	case 0:
-	    warn("dna shorter than motif");
-	    internalErr();
-	    break;
-	default:
-	    p += logBase2(0.25);
-	    break;
-	}
-    }
-return p;
-}
-
-char dnaMotifBestStrand(struct dnaMotif *motif, DNA *dna)
-/* Figure out which strand of DNA is better for probabalistic motif. */
-{
-float fScore, rScore;
-fScore = dnaMotifSequenceProb(motif, dna);
-reverseComplement(dna, motif->columnCount);
-rScore = dnaMotifSequenceProb(motif, dna);
-reverseComplement(dna, motif->columnCount);
-if (fScore >= rScore)
-    return '+';
-else
-    return '-';
-}
-
-double dnaMotifBitScore(struct dnaMotif *motif, DNA *dna)
-/* Return logBase2-odds score of dna given a probabalistic motif. */
-{
-double p = dnaMotifSequenceProb(motif, dna);
-double q = pow(0.25, motif->columnCount);
-double odds = p/q;
-return logBase2(odds);
-}
-
-double dnaMotifBitScoreWithMark0Bg(struct dnaMotif *motif, DNA *dna, double mark0[5])
-/* Return logBase2-odds score of dna given a probabalistic motif and using a 0-order markov model for the background. */
-{
-double p = dnaMotifSequenceProb(motif, dna);
-double q = dnaMotifSequenceProbWithMark0(motif, dna, mark0);
-double odds = p/q;
-return logBase2(odds);
-}
-
-double dnaMotifBitScoreWithMarkovBg(struct dnaMotif *motif, DNA *dna, double mark2[5][5][5])
-/* Return logBase2-odds score of dna given a probabalistic motif using a 2nd-order markov model for the background.
-   motif and markd2 must be in log2 format.
-   Seq must contain an extra two bases at the front (i.e. we start scoring from dna + 2). */
-{
-double p = dnaMotifSequenceProbLog(motif, dna + 2);
-double q = 0;
-int i, index;
-// XXXX assert somehow that length(dna) == motif->columnCount + 2?
-dnaUtilOpen();
-for(i = 0, index = 2; i < motif->columnCount; i++, index++)
-    {
-    double tmp = mark2[ntVal5[(int) dna[index - 2]] + 1][ntVal5[(int) dna[index - 1]] + 1][ntVal5[(int) dna[index]] + 1];
-#if 0
-    char buf[4];
-    safencpy(buf, sizeof(buf), dna + index - 2, 3);
-    fprintf(stderr, "%s: tmp: %.6f\n", buf, tmp);
-#endif
-    q += tmp;
-    }
-return p - q;
-}
-
-
-void dnaMotifMakeLog2(struct dnaMotif *motif)
-{
-int i;
-for (i = 0; i < motif->columnCount; i++)
-    {
-    motif->aProb[i] = logBase2(motif->aProb[i]);
-    motif->cProb[i] = logBase2(motif->cProb[i]);
-    motif->gProb[i] = logBase2(motif->gProb[i]);
-    motif->tProb[i] = logBase2(motif->tProb[i]);
-    }
-}
-
-void dnaMotifNormalize(struct dnaMotif *motif)
-/* Make all columns of motif sum to one. */
-{
-int i;
-for (i=0; i<motif->columnCount; ++i)
-    {
-    float sum = motif->aProb[i] + motif->cProb[i] + motif->gProb[i] + motif->tProb[i];
-    if (sum < 0)
-        errAbort("%s has negative numbers, perhaps it's score not probability based", 
-		motif->name);
-    if (sum == 0)
-         motif->aProb[i] = motif->cProb[i] = motif->gProb[i] = motif->tProb[i] = 0.25;
-    motif->aProb[i] /= sum;
-    motif->cProb[i] /= sum;
-    motif->gProb[i] /= sum;
-    motif->tProb[i] /= sum;
-    }
-}
-
-boolean dnaMotifIsScoreBased(struct dnaMotif *motif)
-/* Return TRUE if dnaMotif is score-based (which we decide by
- * the presense of negative values. */
-{
-int i;
-for (i=0; i<motif->columnCount; ++i)
-    {
-    if (motif->aProb[i] < 0) return TRUE;
-    if (motif->cProb[i] < 0) return TRUE;
-    if (motif->gProb[i] < 0) return TRUE;
-    if (motif->tProb[i] < 0) return TRUE;
-    }
-return FALSE;
-}
-
-void dnaMotifScoreToProb(struct dnaMotif *motif)
-/* Convert motif that is log-odds score based to motif
- * that is probability based.  This assumes that the
- * background distribution is simple: 25% for each base */
-{
-int i;
-for (i=0; i<motif->columnCount; ++i)
-    {
-    motif->aProb[i] = exp(motif->aProb[i]);
-    motif->cProb[i] = exp(motif->cProb[i]);
-    motif->gProb[i] = exp(motif->gProb[i]);
-    motif->tProb[i] = exp(motif->tProb[i]);
-    }
-dnaMotifNormalize(motif);
-}
-
-void dnaMotifMakeProbabalistic(struct dnaMotif *motif)
-/* Change motif, which may be score or count based, to 
- * probabalistic one, where each column adds to 1.0 */
-{
-if (dnaMotifIsScoreBased(motif))
-    dnaMotifScoreToProb(motif);
-else
-    dnaMotifNormalize(motif);
-}
-
-static void printProbRow(FILE *f, char *label, float *p, int pCount)
-/* Print one row of a probability profile. */
-{
-int i;
-fprintf(f, "%s ", label);
-for (i=0; i < pCount; ++i)
-    fprintf(f, "%5.2f ", p[i]);
-printf("\n");
-}
-
-void dnaMotifPrintProb(struct dnaMotif *motif, FILE *f)
-/* Print DNA motif probabilities. */
-{
-printProbRow(f, "A", motif->aProb, motif->columnCount);
-printProbRow(f, "C", motif->cProb, motif->columnCount);
-printProbRow(f, "G", motif->gProb, motif->columnCount);
-printProbRow(f, "T", motif->tProb, motif->columnCount);
-}
-
-
-static double u1(double prob)
-/* Calculate partial uncertainty for one base. */
-{
-if (prob == 0)
-    return 0;
-return prob * logBase2(prob);
-}
-
-static double uncertainty(struct dnaMotif *motif, int pos)
-/* Return the uncertainty at pos of motif.  This corresponds
- * to the H function in logo.pm */
-{
-return -( u1(motif->aProb[pos]) + u1(motif->cProb[pos])
-	+ u1(motif->gProb[pos]) +u1(motif->tProb[pos]) );
-}
-
-double dnaMotifBitsOfInfo(struct dnaMotif *motif, int pos)
-/* Return bits of information at position. */
-{
-if (pos > motif->columnCount || pos < 0)
-    internalErr();
-return 2 - uncertainty(motif, pos);
-}
-
-struct letterProb
-/* A letter tied to a probability. */
-    {
-    struct letterProb *next;
-    double prob;	/* Probability for this letter. */
-    char letter;	/* The letter (upper case) */
-    };
-
-static struct letterProb *letterProbNew(char letter, double prob)
-/* Make a new letterProb. */
-{
-struct letterProb *lp;
-AllocVar(lp);
-lp->letter = letter;
-lp->prob = prob;
-return lp;
-}
-
-static int letterProbCmp(const void *va, const void *vb)
-/* Compare to sort highest probability first. */
-{
-const struct letterProb *a = *((struct letterProb **)va);
-const struct letterProb *b = *((struct letterProb **)vb);
-double dif = a->prob - b->prob;
-if (dif < 0)
-   return -1;
-else if (dif > 0)
-   return 1;
-else
-   return 0;
-}
-
-static void addBaseProb(struct letterProb **pList, char letter, double prob)
-/* If prob > 0 add letterProb to list. */
-{
-if (prob > 0)
-    {
-    struct letterProb *lp = letterProbNew(letter, prob);
-    slAddHead(pList, lp);
-    }
-}
-
-static struct letterProb *letterProbFromMotifColumn(struct dnaMotif *motif, int pos)
-/* Return letterProb list corresponding to column of motif. */
-{
-struct letterProb *lpList = NULL;
-addBaseProb(&lpList, 'A', motif->aProb[pos]);
-addBaseProb(&lpList, 'C', motif->cProb[pos]);
-addBaseProb(&lpList, 'G', motif->gProb[pos]);
-addBaseProb(&lpList, 'T', motif->tProb[pos]);
-slSort(&lpList, letterProbCmp);
-return lpList;
-}
-
-static void psOneColumn(struct dnaMotif *motif, int pos,
-    double xStart, double yStart, double width, double totalHeight,
-    FILE *f)
-/* Write one column of logo to postScript. */
-{
-struct letterProb *lp, *lpList = letterProbFromMotifColumn(motif, pos);
-double x = xStart, y = yStart, w = width, h;
-for (lp = lpList; lp != NULL; lp = lp->next)
-    {
-    h = totalHeight * lp->prob;
-    if (h >= 1.0)
-	{
-	fprintf(f, "%cColor ", tolower(lp->letter));
-	fprintf(f, "%3.2f ", x);
-	fprintf(f, "%3.2f ", y);
-	fprintf(f, "%3.2f ", x + w);
-	fprintf(f, "%3.2f ", y + h);
-	fprintf(f, "(%c) textInBox\n", lp->letter);
-	}
-    y += h;
-    }
-fprintf(f, "\n");
-slFreeList(&lpList);
-}
-
-static void dnaMotifDims(struct dnaMotif *motif, double widthPerBase, double height, 
-	int *retWidth, int *retHeight)
-/* Calculate dimensions of motif when rendered. */
-{
-static int widthFudgeFactor = 2, heightFudgeFactor = 2;
-*retWidth = ceil(widthPerBase * motif->columnCount) + widthFudgeFactor;
-*retHeight = ceil(height) + heightFudgeFactor;
-}
-
-void dnaMotifToLogoPs2(struct dnaMotif *motif, double widthPerBase, double height, 
-                       double minHeight, char *fileName)
-/* Write logo corresponding to motif to postScript file, with extended options. minHeight
- * is the minimum height that is excluded from information content scaling.  This allows
- * something to show up in columns with very little information content.  Setting this
- * to be the same as height creates an frequency-based logo.
- */
-{
-FILE *f = mustOpen(fileName, "w");
-int i;
-int xStart = 0;
-int w, h;
-char *s = 
-#include "dnaMotif.pss"
-;
-
-dnaMotifDims(motif, widthPerBase, height, &w, &h);
-fprintf(f, "%%!PS-Adobe-3.1 EPSF-3.0\n");
-fprintf(f, "%%%%BoundingBox: 0 0 %d %d\n\n", w, h);
-fprintf(f, "%s", s);
-
-fprintf(f, "%s", "% Start of code for this specific logo\n");
-
-for (i=0; i<motif->columnCount; ++i)
-    {
-    double infoScale = dnaMotifBitsOfInfo(motif, i)/2.0;
-    // only scale part beyond minHeight
-    double useHeight = minHeight + (infoScale * (height - minHeight));
-    if (useHeight > height)
-        useHeight = height;
-    psOneColumn(motif, i, xStart, 0, widthPerBase, useHeight, f);
-    xStart += widthPerBase;
-    }
-fprintf(f, "showpage\n");
-carefulClose(&f);
-}
-
-void dnaMotifToLogoPs(struct dnaMotif *motif, double widthPerBase, double height, char *fileName)
-/* Write logo corresponding to motif to postScript file. */
-{
-dnaMotifToLogoPs2(motif, widthPerBase, height, 0.0, fileName);
-}
-
-void dnaMotifToLogoPng(
-	struct dnaMotif *motif,	/* Motif to draw. */
-	double widthPerBase, 	/* Width of each base. */
-	double height, 		/* Max height. */
-	char *gsExe, 		/* ghostscript executable, NULL for default */
-	char *tempDir,          /* temp dir , NULL for default */
-	char *fileName)		/* output png file name. */
-/* Write logo corresponding to motif to png file. */
-{
-char *psName = rTempName(tempDir, "dnaMotif", ".ps");
-struct dyString *dy = dyStringNew(0);
-int w, h;
-int sysRet;
-
-if (gsExe == NULL) gsExe = "gs";
-if (tempDir == NULL) tempDir = "/tmp";
-dnaMotifToLogoPs(motif, widthPerBase, height, psName);
-dnaMotifDims(motif, widthPerBase, height, &w, &h);
-dyStringAppend(dy, gsExe);
-dyStringAppend(dy, " -sDEVICE=png16m -sOutputFile=");
-dyStringAppend(dy, fileName);
-dyStringAppend(dy, " -dBATCH -dNOPAUSE -q ");
-dyStringPrintf(dy, "-g%dx%d ", w, h);
-dyStringAppend(dy, psName);
-sysRet = system(dy->string);
-if (sysRet != 0)
-    errAbort("System call returned %d for:\n  %s", sysRet, dy->string);
-
-/* Clean up. */
-dyStringFree(&dy);
-
-/* change permisssions so the webserver can access the file */
-dy = newDyString(0);
-dyStringPrintf(dy, "chmod 666 %s ", fileName);
-sysRet = system(dy->string);
-
-remove(psName);
-}
-
-void dnaMotifToLogoPsW(struct dnaMotif *motif, double widthPerBase, double width, double height, char *fileName)
-/* Write logo corresponding to motif to postScript file. */
-{
-FILE *f = mustOpen(fileName, "w");
-int i;
-int xStart = 0;
-int w, h;
-char *s = 
-#include "dnaMotif.pss"
-;
-
-dnaMotifDims(motif, widthPerBase, height, &w, &h);
-fprintf(f, "%%!PS-Adobe-3.1 EPSF-3.0\n");
-fprintf(f, "%%%%BoundingBox: 0 0 %d %d\n\n", w, h);
-fprintf(f, "%s", s);
-
-fprintf(f, "%s", "% Start of code for this specific logo\n");
-
-for (i=0; i<motif->columnCount; ++i)
-    {
-    double infoScale = 0.9 ; 
-    xStart = i * width / motif->columnCount;
-    psOneColumn(motif, i, xStart, 0, widthPerBase, infoScale * height, f);
-    }
-fprintf(f, "showpage\n");
-carefulClose(&f);
-}
-
-void dnaMotifToLogoPGM(
-	struct dnaMotif *motif,	/* Motif to draw. */
-	double widthPerBase, 	/* Width of each base. */
-	double width, 		/* Max width. */
-	double height, 		/* Max height. */
-	char *gsExe, 		/* ghostscript executable, NULL for default */
-	char *tempDir,          /* temp dir , NULL for default */
-	char *fileName)		/* output png file name. */
-/* Write logo corresponding to motif to pgm file. */
-{
-char *psName = rTempName(tempDir, "dnaMotif", ".ps");
-struct dyString *dy = dyStringNew(0);
-int w, h;
-int sysRet;
-
-if (gsExe == NULL) gsExe = "gs";
-if (tempDir == NULL) tempDir = "/tmp";
-dnaMotifToLogoPsW(motif, widthPerBase, width, height, psName);
-dnaMotifDims(motif, widthPerBase, height, &w, &h);
-dyStringAppend(dy, gsExe);
-dyStringAppend(dy, " -sDEVICE=pgmraw -sOutputFile=");
-dyStringAppend(dy, fileName);
-dyStringAppend(dy, " -dBATCH -dNOPAUSE -q ");
-dyStringPrintf(dy, "-g%dx%d ", (int) ceil(width), h);
-dyStringAppend(dy, psName);
-sysRet = system(dy->string);
-if (sysRet != 0)
-    errAbort("System call returned %d for:\n  %s", sysRet, dy->string);
-
-/* Clean up. */
-dyStringFree(&dy);
-
-/* change permisssions so the webserver can access the file */
-dy = newDyString(0);
-dyStringPrintf(dy, "chmod 666 %s ", fileName);
-sysRet = system(dy->string);
-
-remove(psName);
-}
diff --git a/gbtools/src/blatSrc/lib/dnaMotif.pss b/gbtools/src/blatSrc/lib/dnaMotif.pss
deleted file mode 100644
index b2b5fb6..0000000
--- a/gbtools/src/blatSrc/lib/dnaMotif.pss
+++ /dev/null
@@ -1,61 +0,0 @@
-"/logoFont {\n"
-"/Helvetica findfont\n"
-"10 scalefont\n"
-"setfont\n"
-"} def\n"
-"\n"
-"\n"
-"/textBounds {\n"
-"% Figure out bounding box of string in current font.  Usage:\n"
-"% call: text letterSize \n"
-"% sets: tbX1 tbY1 tbX2 tbY2 tbW tbH\n"
-"% The bounds are relative to the current position\n"
-"gsave\n"
-"newpath\n"
-"0 0 moveto\n"
-"true charpath\n"
-"flattenpath\n"
-"pathbbox\n"
-"grestore\n"
-"/tbY2 exch def\n"
-"/tbX2 exch def\n"
-"/tbY1 exch def\n"
-"/tbX1 exch def\n"
-"/tbW tbX2 tbX1 sub def\n"
-"/tbH tbY2 tbY1 sub def\n"
-"} def\n"
-"\n"
-"/textInBox {\n"
-"% Draw text so that it fits inside of box.  Usage:\n"
-"%   x1 y1 x2 y2 text textInBox\n"
-"\n"
-"% Copy parameters from variables to stack and save context\n"
-"/tibText exch def\n"
-"/tibY2 exch def\n"
-"/tibX2 exch def\n"
-"/tibY1 exch def\n"
-"/tibX1 exch def\n"
-"gsave\n"
-"\n"
-"% move to x1/y1 adjusted for text offset\n"
-"tibText textBounds\n"
-"tibX1 tbX1 sub tibY1 tbY1 sub moveto\n"
-"\n"
-"% Set scaling\n"
-"/tibW tibX2 tibX1 sub def\n"
-"/tibH tibY2 tibY1 sub def\n"
-"tibW tbW div tibH tbH div scale\n"
-"\n"
-"% draw and return\n"
-"tibText show\n"
-"grestore\n"
-"} def\n"
-"\n"
-"/aColor { 0 0.7 0 setrgbcolor } def\n"
-"/cColor { 0 0.5 0.7 setrgbcolor } def\n"
-"/gColor { 0.8 0.5 0 setrgbcolor } def\n"
-"/tColor { 0.9 0 0 setrgbcolor } def\n"
-"\n"
-"logoFont\n"
-"\n"
-"\n"
diff --git a/gbtools/src/blatSrc/lib/dnaseq.c b/gbtools/src/blatSrc/lib/dnaseq.c
deleted file mode 100644
index 11a007c..0000000
--- a/gbtools/src/blatSrc/lib/dnaseq.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* dnaSeq.c - stuff to manage DNA sequences. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "dnaseq.h"
-#include "bits.h"
-#include "hash.h"
-#include "obscure.h"
-
-
-
-struct dnaSeq *newDnaSeq(DNA *dna, int size, char *name)
-/* Create a new DNA seq. */
-{
-struct dnaSeq *seq;
-
-seq = needMem(sizeof(*seq));
-if (name != NULL)
-    seq->name = cloneString(name);
-seq->dna = dna;
-seq->size = size;
-seq->mask = NULL;
-return seq;
-}
-
-struct dnaSeq *cloneDnaSeq(struct dnaSeq *orig)
-/* Duplicate dna sequence in RAM. */
-{
-struct dnaSeq *seq = CloneVar(orig);
-seq->name = cloneString(seq->name);
-seq->dna = needHugeMem(seq->size+1);
-memcpy(seq->dna, orig->dna, seq->size+1);
-seq->mask = NULL;
-if (orig->mask != NULL)
-    {
-    seq->mask = bitClone(orig->mask, seq->size);
-    }
-return seq;
-}
-
-void freeDnaSeq(struct dnaSeq **pSeq)
-/* Free up DNA seq. (And unlink underlying resource node.) */
-{
-struct dnaSeq *seq = *pSeq;
-if (seq == NULL)
-    return;
-freeMem(seq->name);
-freeMem(seq->dna);
-bitFree(&seq->mask);
-freez(pSeq);
-}
-
-void freeDnaSeqList(struct dnaSeq **pSeqList)
-/* Free up list of DNA sequences. */
-{
-struct dnaSeq *seq, *next;
-
-for (seq = *pSeqList; seq != NULL; seq = next)
-    {
-    next = seq->next;
-    freeDnaSeq(&seq);
-    }
-*pSeqList = NULL;
-}
-
-boolean seqIsLower(bioSeq *seq)
-/* Return TRUE if sequence is all lower case. */
-{
-int size = seq->size, i;
-char *poly = seq->dna;
-for (i=0; i<size; ++i)
-    if (!islower(poly[i]))
-        return FALSE;
-return TRUE;
-}
-
-boolean seqIsDna(bioSeq *seq)
-/* Make educated guess whether sequence is DNA or protein. */
-{
-return isDna(seq->dna, seq->size);
-}
-
-
-aaSeq *translateSeqN(struct dnaSeq *inSeq, unsigned offset, unsigned inSize, boolean stop)
-/* Return a translated sequence.  Offset is position of first base to
- * translate. If size is 0 then use length of inSeq. */
-{
-aaSeq *seq;
-DNA *dna = inSeq->dna;
-AA *pep, aa;
-int i, lastCodon;
-int actualSize = 0;
-
-assert(offset <= inSeq->size);
-if ((inSize == 0) || (inSize > (inSeq->size - offset)))
-    inSize = inSeq->size - offset;
-lastCodon = offset + inSize - 3;
-
-AllocVar(seq);
-seq->dna = pep = needLargeMem(inSize/3+1);
-for (i=offset; i <= lastCodon; i += 3)
-    {
-    aa = lookupCodon(dna+i);
-    if (aa == 0)
-	{
-        if (stop)
-	    break;
-	else
-	    aa = 'Z';
-	}
-    *pep++ = aa;
-    ++actualSize;
-    }
-*pep = 0;
-assert(actualSize <= inSize/3+1);
-seq->size = actualSize;
-seq->name = cloneString(inSeq->name);
-return seq;
-}
-
-aaSeq *translateSeq(struct dnaSeq *inSeq, unsigned offset, boolean stop)
-/* Return a translated sequence.  Offset is position of first base to
- * translate. If stop is TRUE then stop at first stop codon.  (Otherwise 
- * represent stop codons as 'Z'). */
-{
-return translateSeqN(inSeq, offset, 0, stop);
-}
-
-bioSeq *whichSeqIn(bioSeq **seqs, int seqCount, char *letters)
-/* Figure out which if any sequence letters is in. */
-{
-aaSeq *seq;
-int i;
-
-for (i=0; i<seqCount; ++i)
-    {
-    seq = seqs[i];
-    if (seq->dna <= letters && letters < seq->dna + seq->size)
-        return seq;
-    }
-internalErr();
-return NULL;
-}
-
-Bits *maskFromUpperCaseSeq(bioSeq *seq)
-/* Allocate a mask for sequence and fill it in based on
- * sequence case. */
-{
-int size = seq->size, i;
-char *poly = seq->dna;
-Bits *b = bitAlloc(size);
-for (i=0; i<size; ++i)
-    {
-    if (isupper(poly[i]))
-        bitSetOne(b, i);
-    }
-return b;
-}
-
-struct hash *dnaSeqHash(struct dnaSeq *seqList)
-/* Return hash of sequences keyed by name. */
-{
-int size = slCount(seqList)+1;
-int sizeLog2 = digitsBaseTwo(size);
-struct hash *hash = hashNew(sizeLog2);
-struct dnaSeq *seq;
-for (seq = seqList; seq != NULL; seq = seq->next)
-    hashAddUnique(hash, seq->name, seq);
-return hash;
-}
-
-int dnaSeqCmpName(const void *va, const void *vb)
-/* Compare to sort based on sequence name. */
-{
-const struct dnaSeq *a = *((struct dnaSeq **)va);
-const struct dnaSeq *b = *((struct dnaSeq **)vb);
-return strcmp(a->name, b->name);
-}
-
diff --git a/gbtools/src/blatSrc/lib/dnautil.c b/gbtools/src/blatSrc/lib/dnautil.c
deleted file mode 100644
index 6b08ccd..0000000
--- a/gbtools/src/blatSrc/lib/dnautil.c
+++ /dev/null
@@ -1,1186 +0,0 @@
-/* Some stuff that you'll likely need in any program that works with
- * DNA.  Includes stuff for amino acids as well. 
- *
- * Assumes that DNA is stored as a character.
- * The DNA it generates will include the bases 
- * as lowercase tcag.  It will generally accept
- * uppercase as well, and also 'n' or 'N' or '-'
- * for unknown bases. 
- *
- * Amino acids are stored as single character upper case. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "dnautil.h"
-
-
-struct codonTable
-/* The dread codon table. */
-    {
-    DNA *codon;		/* Lower case. */
-    AA protCode;	/* Upper case. The "Standard" code */
-    AA mitoCode;	/* Upper case. Vertebrate Mitochondrial translations */
-    AA uniqCode;	/* unique code for each codon */
-    };
-
-struct codonTable codonTable[] = 
-/* The master codon/protein table. */
-{
-    {"ttt", 'F', 'F', 'a'},
-    {"ttc", 'F', 'F', 'b'},
-    {"tta", 'L', 'L', 'c'},
-    {"ttg", 'L', 'L', 'd'},
-
-    {"tct", 'S', 'S', 'e'},
-    {"tcc", 'S', 'S', 'f'},
-    {"tca", 'S', 'S', 'g'},
-    {"tcg", 'S', 'S', 'h'},
-
-    {"tat", 'Y', 'Y', 'i'},
-    {"tac", 'Y', 'Y', 'j'},
-    {"taa", 0, 0, 'k'},
-    {"tag", 0, 0, 'l'},
-
-    {"tgt", 'C', 'C', 'm'},
-    {"tgc", 'C', 'C', 'n'},
-    {"tga", 0, 'W', 'o'},
-    {"tgg", 'W', 'W', 'p'},
-
-
-    {"ctt", 'L', 'L', 'q'},
-    {"ctc", 'L', 'L', 'r'},
-    {"cta", 'L', 'L', 's'},
-    {"ctg", 'L', 'L', 't'},
-
-    {"cct", 'P', 'P', 'u'},
-    {"ccc", 'P', 'P', 'v'},
-    {"cca", 'P', 'P', 'w'},
-    {"ccg", 'P', 'P', 'x'},
-
-    {"cat", 'H', 'H', 'y'},
-    {"cac", 'H', 'H', 'z'},
-    {"caa", 'Q', 'Q', 'A'},
-    {"cag", 'Q', 'Q', 'B'},
-
-    {"cgt", 'R', 'R', 'C'},
-    {"cgc", 'R', 'R', 'D'},
-    {"cga", 'R', 'R', 'E'},
-    {"cgg", 'R', 'R', 'F'},
-
-
-    {"att", 'I', 'I', 'G'},
-    {"atc", 'I', 'I', 'H'},
-    {"ata", 'I', 'M', 'I'},
-    {"atg", 'M', 'M', 'J'},
-
-    {"act", 'T', 'T', 'K'},
-    {"acc", 'T', 'T', 'L'},
-    {"aca", 'T', 'T', 'M'},
-    {"acg", 'T', 'T', 'N'},
-
-    {"aat", 'N', 'N', 'O'},
-    {"aac", 'N', 'N', 'P'},
-    {"aaa", 'K', 'K', 'Q'},
-    {"aag", 'K', 'K', 'R'},
-
-    {"agt", 'S', 'S', 'S'},
-    {"agc", 'S', 'S', 'T'},
-    {"aga", 'R', 0, 'U'},
-    {"agg", 'R', 0, 'V'},
-
-
-    {"gtt", 'V', 'V', 'W'},
-    {"gtc", 'V', 'V', 'X'},
-    {"gta", 'V', 'V', 'Y'},
-    {"gtg", 'V', 'V', 'Z'},
-
-    {"gct", 'A', 'A', '1'},
-    {"gcc", 'A', 'A', '2'},
-    {"gca", 'A', 'A', '3'},
-    {"gcg", 'A', 'A', '4'},
-
-    {"gat", 'D', 'D', '5'},
-    {"gac", 'D', 'D', '6'},
-    {"gaa", 'E', 'E', '7'},
-    {"gag", 'E', 'E', '8'},
-
-    {"ggt", 'G', 'G', '9'},
-    {"ggc", 'G', 'G', '0'},
-    {"gga", 'G', 'G', '@'},
-    {"ggg", 'G', 'G', '$'},
-};
-
-/* A table that gives values 0 for t
-			     1 for c
-			     2 for a
-			     3 for g
- * (which is order aa's are in biochemistry codon tables)
- * and gives -1 for all others. */
-int ntVal[256];
-int ntValLower[256];	/* NT values only for lower case. */
-int ntValUpper[256];	/* NT values only for upper case. */
-int ntVal5[256];
-int ntValNoN[256]; /* Like ntVal, but with T_BASE_VAL in place of -1 for nonexistent ones. */
-DNA valToNt[(N_BASE_VAL|MASKED_BASE_BIT)+1];
-
-/* convert tables for bit-4 indicating masked */
-int ntValMasked[256];
-DNA valToNtMasked[256];
-
-static boolean inittedNtVal = FALSE;
-
-static void initNtVal()
-{
-if (!inittedNtVal)
-    {
-    int i;
-    for (i=0; i<ArraySize(ntVal); i++)
-        {
-	ntValUpper[i] = ntValLower[i] = ntVal[i] = -1;
-        ntValNoN[i] = T_BASE_VAL;
-	if (isspace(i) || isdigit(i))
-	    ntVal5[i] = ntValMasked[i] = -1;
-	else
-            {
-	    ntVal5[i] = N_BASE_VAL;
-	    ntValMasked[i] = (islower(i) ? (N_BASE_VAL|MASKED_BASE_BIT) : N_BASE_VAL);
-            }
-        }
-    ntVal5['t'] = ntVal5['T'] = ntValNoN['t'] = ntValNoN['T'] = ntVal['t'] = ntVal['T'] = 
-    	ntValLower['t'] = ntValUpper['T'] = T_BASE_VAL;
-    ntVal5['u'] = ntVal5['U'] = ntValNoN['u'] = ntValNoN['U'] = ntVal['u'] = ntVal['U'] = 
-    	ntValLower['u'] = ntValUpper['U'] = U_BASE_VAL;
-    ntVal5['c'] = ntVal5['C'] = ntValNoN['c'] = ntValNoN['C'] = ntVal['c'] = ntVal['C'] = 
-    	ntValLower['c'] = ntValUpper['C'] = C_BASE_VAL;
-    ntVal5['a'] = ntVal5['A'] = ntValNoN['a'] = ntValNoN['A'] = ntVal['a'] = ntVal['A'] = 
-    	ntValLower['a'] = ntValUpper['A'] = A_BASE_VAL;
-    ntVal5['g'] = ntVal5['G'] = ntValNoN['g'] = ntValNoN['G'] = ntVal['g'] = ntVal['G'] = 
-    	ntValLower['g'] = ntValUpper['G'] = G_BASE_VAL;
-
-    valToNt[T_BASE_VAL] = valToNt[T_BASE_VAL|MASKED_BASE_BIT] = 't';
-    valToNt[C_BASE_VAL] = valToNt[C_BASE_VAL|MASKED_BASE_BIT] = 'c';
-    valToNt[A_BASE_VAL] = valToNt[A_BASE_VAL|MASKED_BASE_BIT] = 'a';
-    valToNt[G_BASE_VAL] = valToNt[G_BASE_VAL|MASKED_BASE_BIT] = 'g';
-    valToNt[N_BASE_VAL] = valToNt[N_BASE_VAL|MASKED_BASE_BIT] = 'n';
-
-    /* masked values */
-    ntValMasked['T'] = T_BASE_VAL;
-    ntValMasked['U'] = U_BASE_VAL;
-    ntValMasked['C'] = C_BASE_VAL;
-    ntValMasked['A'] = A_BASE_VAL;
-    ntValMasked['G'] = G_BASE_VAL;
-
-    ntValMasked['t'] = T_BASE_VAL|MASKED_BASE_BIT;
-    ntValMasked['u'] = U_BASE_VAL|MASKED_BASE_BIT;
-    ntValMasked['c'] = C_BASE_VAL|MASKED_BASE_BIT;
-    ntValMasked['a'] = A_BASE_VAL|MASKED_BASE_BIT;
-    ntValMasked['g'] = G_BASE_VAL|MASKED_BASE_BIT;
-
-    valToNtMasked[T_BASE_VAL] = 'T';
-    valToNtMasked[C_BASE_VAL] = 'C';
-    valToNtMasked[A_BASE_VAL] = 'A';
-    valToNtMasked[G_BASE_VAL] = 'G';
-    valToNtMasked[N_BASE_VAL] = 'N';
-
-    valToNtMasked[T_BASE_VAL|MASKED_BASE_BIT] = 't';
-    valToNtMasked[C_BASE_VAL|MASKED_BASE_BIT] = 'c';
-    valToNtMasked[A_BASE_VAL|MASKED_BASE_BIT] = 'a';
-    valToNtMasked[G_BASE_VAL|MASKED_BASE_BIT] = 'g';
-    valToNtMasked[N_BASE_VAL|MASKED_BASE_BIT] = 'n';
-
-    inittedNtVal = TRUE;
-    }
-}
-
-/* Returns one letter code for protein, 
- * 0 for stop codon or X for bad input,
- * The "Standard" Code */
-AA lookupCodon(DNA *dna)
-{
-int ix;
-int i;
-char c;
-
-if (!inittedNtVal)
-    initNtVal();
-ix = 0;
-for (i=0; i<3; ++i)
-    {
-    int bv = ntVal[(int)dna[i]];
-    if (bv<0)
-	return 'X';
-    ix = (ix<<2) + bv;
-    }
-c = codonTable[ix].protCode;
-return c;
-}
-
-boolean isStopCodon(DNA *dna)
-/* Return TRUE if it's a stop codon. */
-{
-return lookupCodon(dna) == 0;
-}
-
-boolean isKozak(char *dna, int dnaSize, int pos)
-/* Return TRUE if it's a Kozak compatible start. */
-{
-if (lookupCodon(dna+pos) != 'M')
-   {
-   return FALSE;
-   }
-if (pos + 3 < dnaSize)
-    {
-    if (ntVal[(int)dna[pos+3]] == G_BASE_VAL)
-        return TRUE;
-    }
-if (pos >= 3)
-    {
-    int c = ntVal[(int)dna[pos-3]];
-    if (c == A_BASE_VAL || c == G_BASE_VAL)
-        return TRUE;
-    }
-return FALSE;
-}
-
-
-boolean isReallyStopCodon(char *dna, boolean selenocysteine)
-/* Return TRUE if it's really a stop codon, even considering
- * possibilility of selenocysteine. */
-{
-if (selenocysteine)
-    {
-    /* Luckily the mitochondria *also* replaces TGA with 
-     * something else, even though it isn't selenocysteine */
-    return lookupMitoCodon(dna) == 0;
-    }
-else
-    {
-    return lookupCodon(dna) == 0;
-    }
-}
-
-
-/* Returns one letter code for protein, 
- * 0 for stop codon or X for bad input,
- * Vertebrate Mitochondrial Code */
-AA lookupMitoCodon(DNA *dna)
-{
-int ix;
-int i;
-char c;
-
-if (!inittedNtVal)
-    initNtVal();
-ix = 0;
-for (i=0; i<3; ++i)
-    {
-    int bv = ntVal[(int)dna[i]];
-    if (bv<0)
-	return 'X';
-    ix = (ix<<2) + bv;
-    }
-c = codonTable[ix].mitoCode;
-c = toupper(c);
-return c;
-}
-
-AA lookupUniqCodon(DNA *dna)
-{
-int ix;
-int i;
-char c;
-
-if (!inittedNtVal)
-    initNtVal();
-ix = 0;
-for (i=0; i<3; ++i)
-    {
-    int bv = ntVal[(int)dna[i]];
-    if (bv<0)
-	return 'X';
-    ix = (ix<<2) + bv;
-    }
-c = codonTable[ix].uniqCode;
-c = toupper(c);
-return c;
-}
-
-Codon codonVal(DNA *start)
-/* Return value from 0-63 of codon starting at start. 
- * Returns -1 if not a codon. */
-{
-int v1,v2,v3;
-
-if ((v1 = ntVal[(int)start[0]]) < 0)
-    return -1;
-if ((v2 = ntVal[(int)start[1]]) < 0)
-    return -1;
-if ((v3 = ntVal[(int)start[2]]) < 0)
-    return -1;
-return ((v1<<4) + (v2<<2) + v3);
-}
-
-DNA *valToCodon(int val)
-/* Return  codon corresponding to val (0-63) */
-{
-assert(val >= 0 && val < 64);
-return codonTable[val].codon;
-}
-
-void dnaTranslateSome(DNA *dna, char *out, int outSize)
-/* Translate DNA upto a stop codon or until outSize-1 amino acids, 
- * whichever comes first. Output will be zero terminated. */
-{
-int i;
-int dnaSize;
-int protSize = 0;
-
-outSize -= 1;  /* Room for terminal zero */
-dnaSize = strlen(dna);
-for (i=0; i<dnaSize-2; i+=3)
-    {
-    if (protSize >= outSize)
-        break;
-    if ((out[protSize++] = lookupCodon(dna+i)) == 0)
-        break;
-    }
-out[protSize] = 0;
-}
-
-/* A little array to help us decide if a character is a 
- * nucleotide, and if so convert it to lower case. */
-char ntChars[256];
-
-static void initNtChars()
-{
-static boolean initted = FALSE;
-
-if (!initted)
-    {
-    zeroBytes(ntChars, sizeof(ntChars));
-    ntChars['a'] = ntChars['A'] = 'a';
-    ntChars['c'] = ntChars['C'] = 'c';
-    ntChars['g'] = ntChars['G'] = 'g';
-    ntChars['t'] = ntChars['T'] = 't';
-    ntChars['n'] = ntChars['N'] = 'n';
-    ntChars['u'] = ntChars['U'] = 'u';
-    ntChars['-'] = 'n';
-    initted = TRUE;
-    }
-}
-
-char ntMixedCaseChars[256];
-
-static void initNtMixedCaseChars()
-{
-static boolean initted = FALSE;
-
-if (!initted)
-    {
-    zeroBytes(ntMixedCaseChars, sizeof(ntMixedCaseChars));
-    ntMixedCaseChars['a'] = 'a';
-    ntMixedCaseChars['A'] = 'A';
-    ntMixedCaseChars['c'] = 'c';
-    ntMixedCaseChars['C'] = 'C';
-    ntMixedCaseChars['g'] = 'g';
-    ntMixedCaseChars['G'] = 'G';
-    ntMixedCaseChars['t'] = 't';
-    ntMixedCaseChars['T'] = 'T';
-    ntMixedCaseChars['n'] = 'n';
-    ntMixedCaseChars['N'] = 'N';
-    ntMixedCaseChars['u'] = 'u';
-    ntMixedCaseChars['U'] = 'U';
-    ntMixedCaseChars['-'] = 'n';
-    initted = TRUE;
-    }
-}
-
-/* Another array to help us do complement of DNA */
-DNA ntCompTable[256];
-static boolean inittedCompTable = FALSE;
-
-static void initNtCompTable()
-{
-zeroBytes(ntCompTable, sizeof(ntCompTable));
-ntCompTable[' '] = ' ';
-ntCompTable['-'] = '-';
-ntCompTable['='] = '=';
-ntCompTable['a'] = 't';
-ntCompTable['c'] = 'g';
-ntCompTable['g'] = 'c';
-ntCompTable['t'] = 'a';
-ntCompTable['u'] = 'a';
-ntCompTable['n'] = 'n';
-ntCompTable['-'] = '-';
-ntCompTable['.'] = '.';
-ntCompTable['A'] = 'T';
-ntCompTable['C'] = 'G';
-ntCompTable['G'] = 'C';
-ntCompTable['T'] = 'A';
-ntCompTable['U'] = 'A';
-ntCompTable['N'] = 'N';
-ntCompTable['R'] = 'Y';
-ntCompTable['Y'] = 'R';
-ntCompTable['M'] = 'K';
-ntCompTable['K'] = 'M';
-ntCompTable['S'] = 'S';
-ntCompTable['W'] = 'W';
-ntCompTable['V'] = 'B';
-ntCompTable['H'] = 'D';
-ntCompTable['D'] = 'H';
-ntCompTable['B'] = 'V';
-ntCompTable['X'] = 'N';
-ntCompTable['r'] = 'y';
-ntCompTable['y'] = 'r';
-ntCompTable['s'] = 's';
-ntCompTable['w'] = 'w';
-ntCompTable['m'] = 'k';
-ntCompTable['k'] = 'm';
-ntCompTable['v'] = 'b';
-ntCompTable['h'] = 'd';
-ntCompTable['d'] = 'h';
-ntCompTable['b'] = 'v';
-ntCompTable['x'] = 'n';
-ntCompTable['('] = ')';
-ntCompTable[')'] = '(';
-inittedCompTable = TRUE;
-}
-
-/* Complement DNA (not reverse). */
-void complement(DNA *dna, long length)
-{
-int i;
-
-if (!inittedCompTable) initNtCompTable();
-for (i=0; i<length; ++i)
-    {
-    *dna = ntCompTable[(int)*dna];
-    ++dna;
-    }
-}
-
-
-/* Reverse complement DNA. */
-void reverseComplement(DNA *dna, long length)
-{
-reverseBytes(dna, length);
-complement(dna, length);
-}
-
-/* Reverse offset - return what will be offset (0 based) to
- * same member of array after array is reversed. */
-long reverseOffset(long offset, long arraySize)
-{
-return arraySize-1 - offset;
-}
-
-/* Switch start/end (zero based half open) coordinates
- * to opposite strand. */
-void reverseIntRange(int *pStart, int *pEnd, int size)
-{
-int temp;
-temp = *pStart;
-*pStart = size - *pEnd;
-*pEnd = size - temp;
-}
-
-/* Switch start/end (zero based half open) coordinates
- * to opposite strand. */
-void reverseUnsignedRange(unsigned *pStart, unsigned *pEnd, int size)
-{
-unsigned temp;
-temp = *pStart;
-*pStart = size - *pEnd;
-*pEnd = size - temp;
-}
-
-char *reverseComplementSlashSeparated(char *alleleStr)
-/* Given a slash-separated series of sequences (a common representation of variant alleles),
- * returns a slash-sep series with the reverse complement of each sequence (if it is a
- * nucleotide sequence).
- * Special behavior to support dbSNP's variant allele conventions:
- * 1. Reverse the order of sequences (to maintain alphabetical ordering).
- * 2. If alleleStr begins with "-/", then after reversing, move "-/" back to the beginning. */
-{
-int len = strlen(alleleStr);
-char choppyCopy[len+1];
-safecpy(choppyCopy, sizeof(choppyCopy), alleleStr);
-char *alleles[len];
-int alCount = chopByChar(choppyCopy, '/', alleles, ArraySize(alleles));
-char *outStr = needMem(len+1);
-int i;
-for (i = alCount-1;  i >= 0;  i--)
-    {
-    char *allele = alleles[i];
-    int alLen = strlen(allele);
-    if (isAllNt(allele, alLen))
-        reverseComplement(allele, alLen);
-    if (i != alCount-1)
-        safecat(outStr, len+1, "/");
-    safecat(outStr, len+1, allele);
-    }
-if (startsWith("-/", alleleStr))
-    {
-    // Keep "-/" at the beginning:
-    memmove(outStr+2, outStr, len-2);
-    outStr[0] = '-';
-    outStr[1] = '/';
-    }
-return outStr;
-}
-
-int cmpDnaStrings(DNA *a, DNA *b)
-/* Compare using screwy non-alphabetical DNA order TCGA */
-{
-for (;;)
-    {
-    DNA aa = *a++;
-    DNA bb = *b++;
-    if (aa != bb)
-        return ntVal[(int)aa] - ntVal[(int)bb];
-    if (aa == 0)
-	break;
-    }
-return 0;
-}
-
-
-/* Convert T's to U's */
-void toRna(DNA *dna)
-{
-DNA c;
-for (;;)
-    {
-    c = *dna;
-    if (c == 't')
-	*dna = 'u';
-    else if (c == 'T')
-	*dna = 'U';
-    else if (c == 0)
-	break;
-    ++dna;
-    }
-}
-
-char *skipIgnoringDash(char *a, int size, bool skipTrailingDash)
-/* Count size number of characters, and any 
- * dash characters. */
-{
-while (size > 0)
-    {
-    if (*a++ != '-')
-        --size;
-    }
-if (skipTrailingDash)
-    while (*a == '-')
-       ++a;
-return a;
-}
-
-int countNonDash(char *a, int size)
-/* Count number of non-dash characters. */
-{
-int count = 0;
-int i;
-for (i=0; i<size; ++i)
-    if (a[i] != '-') 
-        ++count;
-return count;
-}
-
-int nextPowerOfFour(long x)
-/* Return next power of four that would be greater or equal to x.
- * For instance if x < 4, return 1, if x < 16 return 2.... 
- * (From biological point of view how many bases are needed to
- * code this number.) */
-{
-int count = 1;
-while (x > 4)
-    {
-    count += 1;
-    x >>= 2;
-    }
-return count;
-}
-
-long dnaOrAaFilteredSize(char *raw, char filter[256])
-/* Return how long DNA will be after non-DNA is filtered out. */
-{
-char c;
-long count = 0;
-dnaUtilOpen();
-while ((c = *raw++) != 0)
-    {
-    if (filter[(int)c]) ++count;
-    }
-return count;
-}
-
-void dnaOrAaFilter(char *in, char *out, char filter[256])
-/* Run chars through filter. */
-{
-char c;
-dnaUtilOpen();
-while ((c = *in++) != 0)
-    {
-    if ((c = filter[(int)c]) != 0) *out++ = c;
-    }
-*out++ = 0;
-}
-
-long dnaFilteredSize(char *rawDna)
-/* Return how long DNA will be after non-DNA is filtered out. */
-{
-return dnaOrAaFilteredSize(rawDna, ntChars);
-}
-
-void dnaFilter(char *in, DNA *out)
-/* Filter out non-DNA characters and change to lower case. */
-{
-dnaOrAaFilter(in, out, ntChars);
-}
-
-void dnaFilterToN(char *in, DNA *out)
-/* Change all non-DNA characters to N. */
-{
-DNA c;
-initNtChars();
-while ((c = *in++) != 0)
-    {
-    if ((c = ntChars[(int)c]) != 0) *out++ = c;
-    else *out++ = 'n';
-    }
-*out++ = 0;
-}
-
-void dnaMixedCaseFilter(char *in, DNA *out)
-/* Filter out non-DNA characters but leave case intact. */
-{
-dnaOrAaFilter(in, out, ntMixedCaseChars);
-}
-
-long aaFilteredSize(char *raw)
-/* Return how long aa will be after non-aa chars is filtered out. */
-{
-return dnaOrAaFilteredSize(raw, aaChars);
-}
-
-void aaFilter(char *in, DNA *out)
-/* Filter out non-aa characters and change to upper case. */
-{
-dnaOrAaFilter(in, out, aaChars);
-}
-
-void upperToN(char *s, int size)
-/* Turn upper case letters to N's. */
-{
-char c;
-int i;
-for (i=0; i<size; ++i)
-    {
-    c = s[i];
-    if (isupper(c))
-        s[i] = 'n';
-    }
-}
-
-void lowerToN(char *s, int size)
-/* Turn lower case letters to N's. */
-{
-char c;
-int i;
-for (i=0; i<size; ++i)
-    {
-    c = s[i];
-    if (islower(c))
-        s[i] = 'N';
-    }
-}
-
-
-void dnaBaseHistogram(DNA *dna, int dnaSize, int histogram[4])
-/* Count up frequency of occurance of each base and store 
- * results in histogram. */
-{
-int val;
-zeroBytes(histogram, 4*sizeof(int));
-while (--dnaSize >= 0)
-    {
-    if ((val = ntVal[(int)*dna++]) >= 0)
-        ++histogram[val];
-    }
-}
-
-bits64 basesToBits64(char *dna, int size)
-/* Convert dna of given size (up to 32) to binary representation */
-{
-if (size > 32)
-    errAbort("basesToBits64 called on %d bases, can only go up to 32", size);
-bits64 result = 0;
-int i;
-for (i=0; i<size; ++i)
-    {
-    result <<= 2;
-    result += ntValNoN[(int)dna[i]];
-    }
-return result;
-}
-
-bits32 packDna16(DNA *in)
-/* pack 16 bases into a word */
-{
-bits32 out = 0;
-int count = 16;
-int bVal;
-while (--count >= 0)
-    {
-    bVal = ntValNoN[(int)*in++];
-    out <<= 2;
-    out += bVal;
-    }
-return out;
-}
-
-bits16 packDna8(DNA *in)
-/* Pack 8 bases into a short word */
-{
-bits16 out = 0;
-int count = 8;
-int bVal;
-while (--count >= 0)
-    {
-    bVal = ntValNoN[(int)*in++];
-    out <<= 2;
-    out += bVal;
-    }
-return out;
-}
-
-UBYTE packDna4(DNA *in)
-/* Pack 4 bases into a UBYTE */
-{
-UBYTE out = 0;
-int count = 4;
-int bVal;
-while (--count >= 0)
-    {
-    bVal = ntValNoN[(int)*in++];
-    out <<= 2;
-    out += bVal;
-    }
-return out;
-}
-
-void unpackDna(bits32 *tiles, int tileCount, DNA *out)
-/* Unpack DNA. Expands to 16x tileCount in output. */
-{
-int i, j;
-bits32 tile;
-
-for (i=0; i<tileCount; ++i)
-    {
-    tile = tiles[i];
-    for (j=15; j>=0; --j)
-        {
-        out[j] = valToNt[tile & 0x3];
-        tile >>= 2;
-        }
-    out += 16;
-    }
-}
-
-void unpackDna4(UBYTE *tiles, int byteCount, DNA *out)
-/* Unpack DNA. Expands to 4x byteCount in output. */
-{
-int i, j;
-UBYTE tile;
-
-for (i=0; i<byteCount; ++i)
-    {
-    tile = tiles[i];
-    for (j=3; j>=0; --j)
-        {
-        out[j] = valToNt[tile & 0x3];
-        tile >>= 2;
-        }
-    out += 4;
-    }
-}
-
-
-
-
-static void checkSizeTypes()
-/* Make sure that some of our predefined types are the right size. */
-{
-assert(sizeof(UBYTE) == 1);
-assert(sizeof(WORD) == 2);
-assert(sizeof(bits32) == 4);
-assert(sizeof(bits16) == 2);
-}
-
-int intronOrientationMinSize(DNA *iStart, DNA *iEnd, int minIntronSize)
-/* Given a gap in genome from iStart to iEnd, return 
- * Return 1 for GT/AG intron between left and right, -1 for CT/AC, 0 for no
- * intron.  Assumes DNA is lower cased. */
-{
-if (iEnd - iStart < minIntronSize)
-    return 0;
-if (iStart[0] == 'g' && iStart[1] == 't' && iEnd[-2] == 'a' && iEnd[-1] == 'g')
-    {
-    return 1;
-    }
-else if (iStart[0] == 'c' && iStart[1] == 't' && iEnd[-2] == 'a' && iEnd[-1] == 'c')
-    {
-    return -1;
-    }
-else
-    return 0;
-}
-
-int intronOrientation(DNA *iStart, DNA *iEnd)
-/* Given a gap in genome from iStart to iEnd, return 
- * Return 1 for GT/AG intron between left and right, -1 for CT/AC, 0 for no
- * intron.  Assumes DNA is lower cased. */
-{
-return intronOrientationMinSize(iStart, iEnd, 32);
-}
-
-int dnaScore2(DNA a, DNA b)
-/* Score match between two bases (relatively crudely). */
-{
-if (a == 'n' || b == 'n') return 0;
-if (a == b) return 1;
-else return -1;
-}
-
-int  dnaOrAaScoreMatch(char *a, char *b, int size, int matchScore, int mismatchScore, 
-	char ignore)
-/* Compare two sequences (without inserts or deletions) and score. */
-{
-int i;
-int score = 0;
-for (i=0; i<size; ++i)
-    {
-    char aa = a[i];
-    char bb = b[i];
-    if (aa == ignore || bb == ignore)
-        continue;
-    if (aa == bb)
-        score += matchScore;
-    else
-        score += mismatchScore;
-    }
-return score;
-}
-
-int dnaScoreMatch(DNA *a, DNA *b, int size)
-/* Compare two pieces of DNA base by base. Total mismatches are
- * subtracted from total matches and returned as score. 'N's 
- * neither hurt nor help score. */
-{
-return dnaOrAaScoreMatch(a, b, size, 1, -1, 'n');
-}
-
-int aaScore2(AA a, AA b)
-/* Score match between two amino acids (relatively crudely). */
-{
-if (a == 'X' || b == 'X') return 0;
-if (a == b) return 2;
-else return -1;
-}
-
-int aaScoreMatch(AA *a, AA *b, int size)
-/* Compare two peptides aa by aa. */
-{
-return dnaOrAaScoreMatch(a, b, size, 2, -1, 'X');
-}
-
-void writeSeqWithBreaks(FILE *f, char *letters, int letterCount, int maxPerLine)
-/* Write out letters with newlines every maxLine. */
-{
-int lettersLeft = letterCount;
-int lineSize;
-while (lettersLeft > 0)
-    {
-    lineSize = lettersLeft;
-    if (lineSize > maxPerLine)
-        lineSize = maxPerLine;
-    mustWrite(f, letters, lineSize);
-    fputc('\n', f);
-    letters += lineSize;
-    lettersLeft -= lineSize;
-    }
-}
-
-static int findTailPolyAMaybeMask(DNA *dna, int size, boolean doMask,
-				  boolean loose)
-/* Identify PolyA at end; mask to 'n' if specified.  This allows a few 
- * non-A's as noise to be trimmed too.  Returns number of bases trimmed.  
- * Leaves first two bases of PolyA in case there's a taa stop codon. */
-{
-int i;
-int score = 10;
-int bestScore = 10;
-int bestPos = -1;
-int trimSize = 0;
-
-for (i=size-1; i>=0; --i)
-    {
-    DNA b = dna[i];
-    if (b == 'n' || b == 'N')
-        continue;
-    if (score > 20) score = 20;
-    if (b == 'a' || b == 'A')
-	{
-        score += 1;
-	if (score >= bestScore)
-	    {
-	    bestScore = score;
-	    bestPos = i;
-	    }
-	else if (loose && score >= (bestScore - 8))
-	    {
-	    /* If loose, keep extending even if score isn't back up to best. */
-	    bestPos = i;
-	    }
-	}
-    else
-	{
-        score -= 10;
-	}
-    if (score < 0)
-	{
-        break;
-	}
-    }
-if (bestPos >= 0)
-    {
-    trimSize = size - bestPos - 2;	// Leave two for aa in taa stop codon
-    if (trimSize > 0)
-        {
-	if (doMask)
-	    for (i=size - trimSize; i<size; ++i)
-		dna[i] = 'n';
-	}
-    else
-        trimSize = 0;
-    }
-return trimSize;
-}
-
-int tailPolyASizeLoose(DNA *dna, int size)
-/* Return size of PolyA at end (if present).  This allows a few non-A's as 
- * noise to be trimmed too, but skips first two aa for taa stop codon.  
- * It is less conservative in extending the polyA region than maskTailPolyA. */
-{
-return findTailPolyAMaybeMask(dna, size, FALSE, TRUE);
-}
-
-int maskTailPolyA(DNA *dna, int size)
-/* Convert PolyA at end to n.  This allows a few non-A's as noise to be 
- * trimmed too.  Returns number of bases trimmed.  Leaves very last a. */
-{
-return findTailPolyAMaybeMask(dna, size, TRUE, FALSE);
-}
-
-static int findHeadPolyTMaybeMask(DNA *dna, int size, boolean doMask,
-				  boolean loose)
-/* Return size of PolyT at start (if present); mask to 'n' if specified.  
- * This allows a few non-T's as noise to be trimmed too, but skips last
- * two tt for revcomp'd taa stop codon. */
-{
-int i;
-int score = 10;
-int bestScore = 10;
-int bestPos = -1;
-int pastPoly = 0;
-int trimSize = 0;
-
-for (i=0; i<size; ++i)
-    {
-    DNA b = dna[i];
-    if (b == 'n' || b == 'N')
-        continue;
-    if (score > 20) score = 20;
-    if (b == 't' || b == 'T')
-	{
-        score += 1;
-	if (score >= bestScore)
-	    {
-	    bestScore = score;
-	    bestPos = i;
-	    }
-	else if (loose && score >= (bestScore - 8))
-	    {
-	    /* If loose, keep extending even if score isn't back up to best. */
-	    bestPos = i;
-	    }
-	}
-    else
-	{
-        score -= 10;
-	}
-    if (score < 0)
-	{
-	pastPoly = i;
-        break;
-	}
-    }
-if (bestPos >= 0)
-    {
-    trimSize = bestPos+1 - 2;	// Leave two for aa in taa stop codon
-    if (trimSize > 0)
-	{
-	if (doMask)
-	    memset(dna, 'n', trimSize);
-	}
-    else
-        trimSize = 0;
-    }
-return trimSize;
-}
-
-int headPolyTSizeLoose(DNA *dna, int size)
-/* Return size of PolyT at start (if present).  This allows a few non-T's as 
- * noise to be trimmed too, but skips last two tt for revcomp'd taa stop 
- * codon.  
- * It is less conservative in extending the polyA region than maskHeadPolyT. */
-{
-return findHeadPolyTMaybeMask(dna, size, FALSE, TRUE);
-}
-
-int maskHeadPolyT(DNA *dna, int size)
-/* Convert PolyT at start.  This allows a few non-T's as noise to be 
- * trimmed too.  Returns number of bases trimmed.  */
-{
-return findHeadPolyTMaybeMask(dna, size, TRUE, FALSE);
-}
-
-boolean isDna(char *poly, int size)
-/* Return TRUE if letters in poly are at least 90% ACGTNU- */
-{
-int i;
-int dnaCount = 0;
-
-dnaUtilOpen();
-for (i=0; i<size; ++i)
-    {
-    if (ntChars[(int)poly[i]])
-	dnaCount += 1;
-    }
-return (dnaCount >= round(0.9 * size));
-}
-
-boolean isAllNt(char *seq, int size)
-/* Return TRUE if all letters in seq are ACGTNU-. */
-{
-int i;
-dnaUtilOpen();
-for (i=0; i<size-1; ++i)
-    {
-    if (ntChars[(int)seq[i]] == 0)
-	return FALSE;
-    }
-return TRUE;
-}
-
-boolean isAllDna(char *poly, int size)
-/* Return TRUE if size is great than 1 and letters in poly are 100% ACGTNU- */
-{
-if (size <= 1)
-    return FALSE;
-return isAllNt(poly, size);
-}
-
-
-
-/* Tables to convert from 0-20 to ascii single letter representation
- * of proteins. */
-int aaVal[256];
-AA valToAa[21];
-
-AA aaChars[256];	/* 0 except for value aa characters.  Converts to upper case rest. */
-
-struct aminoAcidTable
-/* A little info about each amino acid. */
-    {
-    int ix;
-    char letter;
-    char abbreviation[3];
-    char *name;
-    };
-
-struct aminoAcidTable aminoAcidTable[] = 
-{
-    {0, 'A', "ala", "alanine"},
-    {1, 'C', "cys", "cysteine"},
-    {2, 'D', "asp",  "aspartic acid"},
-    {3, 'E', "glu",  "glutamic acid"},
-    {4, 'F', "phe",  "phenylalanine"},
-    {5, 'G', "gly",  "glycine"},
-    {6, 'H', "his",  "histidine"},
-    {7, 'I', "ile",  "isoleucine"},
-    {8, 'K', "lys",  "lysine"},
-    {9, 'L', "leu",  "leucine"},
-    {10, 'M',  "met", "methionine"},
-    {11, 'N',  "asn", "asparagine"},
-    {12, 'P',  "pro", "proline"},
-    {13, 'Q',  "gln", "glutamine"},
-    {14, 'R',  "arg", "arginine"},
-    {15, 'S',  "ser", "serine"},
-    {16, 'T',  "thr", "threonine"},
-    {17, 'V',  "val", "valine"},
-    {18, 'W',  "trp", "tryptophan"},
-    {19, 'Y',  "tyr", "tyrosine"},
-    {20, 'X',  "ter", "termination"},
-};
-
-char *aaAbbr(int i)
-/* return pointer to AA abbrevation */
-{
-return(aminoAcidTable[i].abbreviation);
-}
-
-char aaLetter(int i)
-/* return AA letter */
-{
-return(aminoAcidTable[i].letter);
-}
-
-static void initAaVal()
-/* Initialize aaVal and valToAa tables. */
-{
-int i;
-char c, lowc;
-
-for (i=0; i<ArraySize(aaVal); ++i)
-    aaVal[i] = -1;
-for (i=0; i<ArraySize(aminoAcidTable); ++i)
-    {
-    c = aminoAcidTable[i].letter;
-    lowc = tolower(c);
-    aaVal[(int)c] = aaVal[(int)lowc] = i;
-    aaChars[(int)c] = aaChars[(int)lowc] = c;
-    valToAa[i] = c;
-    }
-aaChars['x'] = aaChars['X'] = 'X';
-}
-
-void dnaUtilOpen()
-/* Initialize stuff herein. */
-{
-static boolean opened = FALSE;
-if (!opened)
-    {
-    checkSizeTypes();
-    initNtVal();
-    initAaVal();
-    initNtChars();
-    initNtMixedCaseChars();
-    initNtCompTable();
-    opened = TRUE;
-    }
-}
diff --git a/gbtools/src/blatSrc/lib/dtdParse.c b/gbtools/src/blatSrc/lib/dtdParse.c
deleted file mode 100644
index f3745ef..0000000
--- a/gbtools/src/blatSrc/lib/dtdParse.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/* dtdParse - parse an XML DTD file.  Actually this only
- * parses a relatively simple subset of DTD's.  It's still
- * useful for autoXml and xmlToSql. */
-
-/* Copyright (C) 2012 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "linefile.h"
-#include "dystring.h"
-#include "obscure.h"
-#include "dtdParse.h"
-
-
-static void syntaxError(struct lineFile *lf)
-/* Report syntax error and exit. */
-{
-errAbort("Syntax error line %d of %s", lf->lineIx, lf->fileName);
-}
-
-static char *needNextWord(char **pLine, struct lineFile *lf)
-/* Get next word in line.  Squawk and die if can't find it. */
-{
-char *word = nextWord(pLine);
-if (word == NULL)
-    errAbort("Missing data line %d of %s", lf->lineIx, lf->fileName);
-return word;
-}
-
-void needQuotedString( char *in, char *out, struct lineFile *lf, char **retNext)
-/* Grab quoted string starting at in and put it into out.  Advance retNext
- * to just past quoted string.  In and out may point to same buffer. */
-{
-if (!parseQuotedString(in, out, retNext))
-    errAbort("Missing closing quote line %d of %s", lf->lineIx, lf->fileName);
-}
-
-static boolean isAllUpper(char *s)
-/* Return true if all alphabetical letters in string
- * are upper case. */
-{
-char c;
-while ((c = *s++) != 0)
-    {
-    if (isalpha(c) && !isupper(c))
-        return FALSE;
-    }
-return TRUE;
-}
-
-static boolean isAllLower(char *s)
-/* Return true if all alphabetical letters in string
- * are upper case. */
-{
-char c;
-while ((c = *s++) != 0)
-    {
-    if (isalpha(c) && !islower(c))
-        return FALSE;
-    }
-return TRUE;
-}
-
-
-static char *mixedCaseName(char *prefix, char *orig)
-/* Convert var_like_this or VAR_LIKE_THIS or even
- * var-like-this or var:likeThis to varLikeThis. */
-{
-char *mixed;
-char *d, *s = orig;
-char c;
-int prefixLen = strlen(prefix), len;
-boolean nextUpper;
-boolean allUpper = isAllUpper(orig); 
-boolean allLower = isAllLower(orig);
-boolean initiallyMixed = (!allUpper && !allLower);
-
-/* Allocate string big enough for prefix and all. */
-len = strlen(orig) + prefixLen;
-mixed = d = needMem(len+1);
-strcpy(d, prefix);
-d += prefixLen;
-nextUpper = (prefixLen > 0);
-
-for (;;)
-   {
-   c = *s++;
-   if (c == '_' || c == '-' || c == ':')
-       nextUpper = TRUE;
-   else
-       {
-       if (nextUpper)
-           c = toupper(c);
-       else if (!initiallyMixed)
-           c = tolower(c);
-       nextUpper = FALSE;
-       *d++ = c;
-       if (c == 0)
-	   break;
-       }
-   }
-return mixed;
-}
-
-static struct hash *initialEntityHash()
-/* Make an initial entity hash - one that is just made up
- * of our built-ins. */
-{
-struct hash *hash = hashNew(0);
-hashAdd(hash, "INTEGER", cloneString("#INT"));
-hashAdd(hash, "REAL", cloneString("#FLOAT"));
-hashAdd(hash, "INT", cloneString("INT"));
-hashAdd(hash, "FLOAT", cloneString("FLOAT"));
-return hash;
-}
-
-static struct dtdElement *parseElement(
-	char *prefix, char *textField, char *line, 
-	struct hash *elHash, struct lineFile *lf)
-/* Parse out <!ELEMENT line after <!ELEMENT. */
-{
-char *word, *s, *e;
-char *words[256];
-int wordCount, i;
-struct dtdElChild *ec;
-struct dtdElement *el;
-boolean isOr;
-char orCopyCode = '?';
-
-word = needNextWord(&line, lf);
-s = word + strlen(word)-1;
-if (s[0] == '>')
-   *s = 0;
-if ((el = hashFindVal(elHash, word)) != NULL)
-    errAbort("Duplicate element %s line %d and %d of %s", word, el->lineIx, lf->lineIx, lf->fileName);
-AllocVar(el);
-el->lineIx = lf->lineIx;
-hashAddSaveName(elHash, word, el, &el->name);
-el->mixedCaseName = mixedCaseName(prefix, el->name);
-if (line != NULL && (s = strchr(line, '(')) != NULL)
-    {
-    s += 1;
-    if ((e = strchr(line, ')')) == NULL)
-        errAbort("Missing ')' line %d of %s", lf->lineIx, lf->fileName);
-    *e = 0;
-    isOr = (strchr(s, '|') != NULL);
-    if (isOr)
-      {
-	orCopyCode = *(e+1);
-	if ((orCopyCode != '+') && (orCopyCode != '*'))
-	  orCopyCode = '?';
-      }
-    wordCount = chopString(s, "| ,\t", words, ArraySize(words));
-    if (wordCount == ArraySize(words))
-	errAbort("Too many children in list line %d of %s", lf->lineIx, lf->fileName);
-    for (i=0; i<wordCount; ++i)
-	{
-	char *name = words[i];
-	int len = strlen(name);
-	char lastC = name[len-1];
-	if (name[0] == '#')
-	    {
-	    if (isOr)
-	        errAbort("# character in enumeration not allowed line %d of %s",
-		   lf->lineIx, lf->fileName);
-	    if (el->textType != NULL)
-		errAbort("Multiple types for text between tags line %d of %s", 
-			lf->lineIx, lf->fileName);
-	    el->textType = cloneString(name);
-	    }
-	else
-	    {
-	    AllocVar(ec);
-	    slAddHead(&el->children, ec);
-	    ec->isOr = isOr;
-	    if (isOr)
-	       ec->copyCode = orCopyCode;
-	    else
-		{
-		if (lastC == '+' || lastC == '?' || lastC == '*')
-		    {
-		    ec->copyCode = lastC;
-		    name[len-1] = 0;
-		    }
-		else
-		    ec->copyCode = '1';
-		}
-	    if (sameString(name, textField))
-		errAbort("Name conflict with default text field name line %d of %s", lf->lineIx, lf->fileName);
-	    ec->name = cloneString(name);
-	    }
-	}
-    slReverse(&el->children);
-    }
-return el;
-}
-
-static void parseAttribute(char *line, char *textField,
-	struct hash *elHash, struct lineFile *lf)
-/* Parse out <!ATTLIST line after <!ATTLIST. */
-{
-char *word;
-struct dtdAttribute *att;
-struct dtdElement *el;
-char *e;
-
-/* Get rid of trailing '>' */
-e = strrchr(line, '>');
-if (e == NULL)
-    errAbort("Missing '>' line %d of %s", lf->lineIx, lf->fileName);
-*e = 0;
-
-word = needNextWord(&line, lf);
-if ((el = hashFindVal(elHash, word)) == NULL)
-    errAbort("Undefined %s line %d of %s", word, lf->lineIx, lf->fileName);
-word = needNextWord(&line, lf);
-if (sameString(word, textField))
-    errAbort("Name conflict with text field name line %d of %s", lf->lineIx, lf->fileName);
-AllocVar(att);
-att->name = cloneString(word);
-att->mixedCaseName = mixedCaseName("", att->name);
-word = needNextWord(&line, lf);
-att->type = cloneString(word);
-line = skipLeadingSpaces(line);
-if (line[0] == '#')
-    {
-    word = needNextWord(&line, lf);
-    if (sameWord("#REQUIRED", word))
-        att->required = TRUE;
-    else if (sameWord("#IMPLIED", word))
-        att->usual = NULL;
-    else
-        errAbort("Unknown directive %s line %d of %s", word, lf->lineIx, lf->fileName);
-    }
-else if (line[0] == '\'' || line[0] == '"')
-    {
-    word = line;
-    needQuotedString(word, word, lf, &line);
-    att->usual = cloneString(word);
-    }
-else
-    {
-    word = needNextWord(&line, lf);
-    att->usual = cloneString(word);
-    }
-slAddTail(&el->attributes, att);
-}
-
-
-void parseEntity(struct hash *entityHash, struct hash *predefEntityHash,
-	char *line, struct lineFile *lf)
-/* Parse out an entity and add it to hash.  We'll dodge our predefined entities. */
-{
-char *percent = needNextWord(&line, lf);
-char *name = needNextWord(&line, lf);
-char *value = skipLeadingSpaces(line);
-if (value[0] != '"')
-    errAbort("Expecting quoted string at end of ENTITY tag line %d of %s",
-    	lf->lineIx, lf->fileName);
-needQuotedString(value, value, lf, &line);
-if (!sameString(percent, "%"))
-    errAbort("Expecting %% after ENTITY tag line %d of %s", lf->lineIx, lf->fileName);
-if (hashLookup(predefEntityHash, name) == NULL)
-/* We don't want to overwrite the predefined entities.  These are all
- * defined to be #PCDATA or CDATA for the benefit of non-UCSC XML tools.
- * Internally we map them to #INT/#FLOAT etc. so we can have numbers
- * as well as strings in our C structures and relational database tables. */
-    {
-    char *oldVal = hashFindVal(entityHash, name);
-    if (oldVal != NULL)
-        {
-	if (!sameString(oldVal, value))
-	    errAbort("Entity %s redefined line %d of %s", name, lf->lineIx, lf->fileName);
-	}
-    else
-        {
-	hashAdd(entityHash, name, cloneString(value));
-	}
-    }
-}
-
-
-static void fixupChildRefs(struct dtdElement *elList, struct hash *elHash, char *fileName)
-/* Go through all of elements children and make sure that the corresponding
- * elements are defined. */
-{
-struct dtdElement *el, *child;
-struct dtdElChild *ec;
-for (el = elList; el != NULL; el = el->next)
-    {
-    for (ec = el->children; ec != NULL; ec = ec->next)
-        {
-	if ((child = hashFindVal(elHash, ec->name)) == NULL)
-	    errAbort("%s's child %s undefined line %d of %s", el->name, ec->name, el->lineIx, fileName);
-	ec->el = child;
-	}
-    }
-}
-
-static char *eatComment(struct lineFile *lf, char *line)
-/* Eat possibly multi-line comment.  Return line past end of comment */
-{
-char *s;
-for (;;)
-    {
-    if ((s = stringIn("-->", line)) != NULL)
-        {
-	line = skipLeadingSpaces(s+3);
-	if (line[0] == 0)
-	    line = NULL;
-	return line;
-	}
-    if (!lineFileNext(lf, &line, NULL))
-        return NULL;
-    }
-}
-
-static void expandEntities(char *s, struct hash *entityHash, struct lineFile *lf,
-	struct dyString *dest)
-/* Copy s into dest, expanding any entity (something in format %name;) 
- * by looking it up in entity hash. */
-{
-char c;
-while ((c = *s++) != 0)
-    {
-    if (c == '%' && !isspace(s[0]))
-        {
-	char *name = s;
-	char *end = strchr(s, ';');
-	char *value;
-	if (end == NULL)
-	    errAbort("Can't find ; after %% to close entity line %d of %s",
-	    	lf->lineIx, lf->fileName);
-	*end++ = 0;
-	s = end;
-	value = hashFindVal(entityHash, name);
-	if (value == NULL)
-	    errAbort("Entity %%%s; is not defined line %d of %s",
-	    	name, lf->lineIx, lf->fileName);
-	dyStringAppend(dest, value);
-	}
-    else
-        dyStringAppendC(dest, c);
-    }
-}
-
-static char *dtdxTag(struct lineFile *lf, struct hash *entityHash,
-	struct dyString *buf)
-/* Return next tag. */
-{
-char *line;
-
-/* Skip until get a line that starts with '<' */
-if (!lineFileNextReal(lf,  &line))
-    return NULL;
-line = trimSpaces(line);
-if (line[0] != '<')
-    errAbort("Text outside of a tag line %d of %s", lf->lineIx, lf->fileName);
-dyStringClear(buf);
-for (;;)
-    {
-    expandEntities(line, entityHash, lf, buf);
-    if (buf->string[buf->stringSize-1] == '>')
-         break;
-    dyStringAppendC(buf, ' ');
-    if (!lineFileNext(lf, &line, NULL))
-        errAbort("End of file %s inside of a tag.", lf->fileName);
-    line = trimSpaces(line);
-    }
-return buf->string;
-}
-
-void dtdParse(char *fileName, char *prefix, char *textField,
-	struct dtdElement **retList, struct hash **retHash)
-/* Parse out a dtd file into elements that are returned in retList,
- * and for your convenience also in retHash (which is keyed by the
- * name of the element.  Note that XML element names can include the '-'
- * character.  For this and other reasons in addition to the element
- * name as it appears in the XML tag, the element has a mixedCaseName
- * that strips '-' and '_' chars, and tries to convert the name to
- * a mixed-case convention style name.  The prefix if any will be
- * prepended to mixed-case names.  The textField is what to name
- * the field that contains the letters between tags.  By default
- * (if NULL) it is "text." */
-{
-struct hash *elHash = newHash(8);
-struct hash *entityHash = initialEntityHash();
-struct hash *predefEntityHash = initialEntityHash();
-struct dtdElement *elList = NULL, *el;
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *line, *word;
-struct dyString *buf = dyStringNew(0);
-
-if (prefix == NULL)
-    prefix = "";
-if (textField == NULL)
-    textField = "text";
-while ((line = dtdxTag(lf, entityHash, buf)) != NULL)
-    {
-    line = trimSpaces(line);
-    if (line == NULL || line[0] == 0 || line[0] == '#')
-        continue;
-    if (startsWith("<!--", line))
-	{
-        line = eatComment(lf, line);
-	if (line == NULL)
-	    continue;
-	}
-    if (!startsWith("<!", line))
-        syntaxError(lf);
-    line += 2;
-    word = needNextWord(&line, lf);
-    if (sameWord("ELEMENT", word))
-        {
-	el = parseElement(prefix, textField, line, elHash, lf);
-	slAddHead(&elList, el);
-	}
-    else if (sameWord("ATTLIST", word))
-        {
-	parseAttribute(line, textField, elHash, lf);
-	}
-    else if (sameWord("ENTITY", word))
-        {
-	parseEntity(entityHash, predefEntityHash, line, lf);
-	}
-    else
-        {
-	errAbort("Don't understand %s line %d of %s", word, lf->lineIx, lf->fileName);
-	}
-    }
-lineFileClose(&lf);
-dyStringFree(&buf);
-slReverse(&elList);
-fixupChildRefs(elList, elHash, fileName);
-freeHashAndVals(&entityHash);
-freeHashAndVals(&predefEntityHash);
-*retHash = elHash;
-*retList = elList;
-}
-
-void dtdElementDump(struct dtdElement *el, FILE *f)
-/* Dump info on element. */
-{
-struct dtdElChild *ec;
-struct dtdAttribute *att;
-fprintf(f, "%s %s (", el->name, el->mixedCaseName);
-for (ec = el->children; ec != NULL; ec = ec->next)
-    {
-    fprintf(f, "%s", ec->name);
-    if (ec->copyCode != '1')
-        fprintf(f, "%c", ec->copyCode);
-    if (ec->isOr)
-        fprintf(f, " (isOr)");
-    if (ec->next != NULL)
-        fprintf(f, ", ");
-    }
-fprintf(f, ")");
-if (el->textType != NULL)
-    fprintf(f, " (%s)", el->textType);
-fprintf(f, "\n");
-for (att = el->attributes; att != NULL; att = att->next)
-    {
-    fprintf(f, "  %s %s %s %s\n",
-        att->name, att->type, (att->usual ? att->usual : "n/a"),  
-	(att->required ? "required" : "optional"));
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/dyOut.c b/gbtools/src/blatSrc/lib/dyOut.c
deleted file mode 100644
index e623172..0000000
--- a/gbtools/src/blatSrc/lib/dyOut.c
+++ /dev/null
@@ -1,379 +0,0 @@
-// dyOut - DYnamic string stack based OUTput
-//
-// This module relies upon a dyString based stack of buffers which accumulate output
-// for later printing.  As a stack, only the top buffer can be filled and flushed out
-// (duOutFlush).  When flushing, the top buffer's content is appended to the next
-// lower buffer, unless explicitly requested otherwise (dyOutDirectly).
-// If the stack is empty, dyOutPrintf will be equivalent to printf.
-//
-// Output goes to STDOUT unless a single alternative out file is registered.
-
-/* Copyright (C) 2012 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "dyOut.h"
-
-// The stack of dyString buffers is only accessible locally
-static struct dyString *dyOutStack = NULL;
-#define dyOutAssertToken(token) assert(dyOutPointerToToken(dyOutStack) == token)
-
-// This module defaults to STDOUT but an alternative can be registered
-static FILE *dyOutStream = NULL;
-#define dyOutStreamAssertUnregistered() assert(dyOutStream == stdout || dyOutStream == NULL)
-#define dyOutStreamAssertRegistered(out) assert(dyOutStream == out)
-
-
-INLINE void dyOutStreamInitialize(void)
-// Must initialize the static dyOutStream before use.
-{
-if (dyOutStream == NULL) 
-    dyOutStream = stdout;
-}
-
-
-INLINE int dyOutPointerToToken(struct dyString *pointer)
-// It is desirable to return a unique token but NOT give access to the dyString it is based on
-{
-return (int)((size_t)(pointer) & 0xffffffff);
-}
-
-
-static struct dyString *dyOutPointerFromToken(int token)
-// Return the stack member corresponding to the token.
-// This ix can be used to walk up the stack from a given point
-{
-struct dyString *ds = dyOutStack;
-int ix = 0;
-
-for (; ds != NULL; ds = ds->next, ++ix)
-    {
-    if (dyOutPointerToToken(ds) == token)
-        return ds;
-    }
-return NULL;
-}
-
-
-int dyOutOpen(int initialBufSize)
-// Allocate dynamic string and puts at top of stack
-// returns token to be used for later stack accounting asserts
-{
-if (initialBufSize <= 0)
-    initialBufSize = 2048; // presume large
-struct dyString *ds = dyStringNew(initialBufSize);
-slAddHead(&dyOutStack,ds);
-return dyOutPointerToToken(ds);
-}
-
-
-int dyOutPrintf(char *format, ...)
-// Prints into end of the top ds buffer, and return resulting string length
-// If there is no current buffer, this acts like a simple printf and returns -1
-{
-int len = -1; // caller could assert returned length > 0 to ensure dyOut is open!
-va_list args;
-va_start(args, format);
-if (dyOutStack != NULL)
-    {
-    dyStringVaPrintf(dyOutStack, format, args);
-    len = dyStringLen(dyOutStack);
-    }
-else
-    {
-    dyOutStreamInitialize();
-    vfprintf(dyOutStream,format, args);
-    }
-va_end(args);
-return len;
-}
-
-
-int dyOutPrintDirectly(int token,FILE *file)
-// Prints the contents of the top buffer directly to a file.
-// Will leave the filled buffer at top of stack
-// Returns the length printed.
-{
-dyOutAssertToken(token);
-
-int len = dyStringLen(dyOutStack);
-if (len != 0)
-    fprintf(file,"%s",dyStringContents(dyOutStack));
-    fflush(file);
-return len;
-}
-
-
-int dyOutFlush(int token)
-// Flushes the top buffer to the next lower one and empties top buffer.
-// If there is no lower buffer then the content is printed to STDOUT (or registered out).
-// Returns the length flushed.
-{
-dyOutAssertToken(token);
-
-int len = dyStringLen(dyOutStack);
-if (len != 0)
-    {
-    if (dyOutStack->next == NULL)
-        {
-        dyOutStreamInitialize();
-        fprintf(dyOutStream,"%s",dyStringContents(dyOutStack));
-        fflush(dyOutStream);
-        }
-    else
-        dyStringAppend(dyOutStack->next,dyStringContents(dyOutStack));
-    dyStringClear(dyOutStack);
-    }
-return len;
-}
-
-
-int dyOutClose(int token)
-// Abandons the top buffer and its content, freeing memory.
-// Returns the length abandoned.
-{
-dyOutAssertToken(token);
-int len = dyStringLen(dyOutStack);
-struct dyString *ds = slPopHead(&dyOutStack);
-dyStringFree(&ds);
-return len;
-}
-
-int dyOutFlushAndClose(int token)
-// Flushes the top buffer to the next lower one and frees the top buffer.
-// If there is no lower buffer then the content is printed to STDOUT (or registered out).
-// Returns the length flushed.
-{
-int len = dyOutFlush(token);
-dyOutClose(token);
-return len;
-}
-
-
-int dyOutFlushAndCloseAll()
-// CAUTION: Bad practice to not Open/Close levels in turn!
-// flushes, frees and closes all stacked buffers
-// returns length flushed
-{
-int len = 0;
-
-// more efficient method than repeated dyOutFlushAndClose calls
-if (dyOutStack != NULL)
-    {
-    dyOutStreamInitialize();
-    slReverse(&dyOutStack);  // Oldest prints first.
-    while (dyOutStack != NULL)
-        {
-        struct dyString *ds = slPopHead(&dyOutStack);
-        char *content = dyStringCannibalize(&ds);
-        len += strlen(content);
-        fprintf(dyOutStream,"%s",content);
-        freeMem(content);
-        }
-    fflush(dyOutStream);
-    }
-return len;
-}
-
-
-char * dyOutContent(int token)
-// returns the content of the current buffer as a string, but does not flush or free it
-// NOTE: returned pointer is not cloned memory and will be changed by successive dyOut calls
-{
-dyOutAssertToken(token);
-return dyStringContents(dyOutStack);
-}
-
-
-int dyOutEmpty(int token)
-// Empties the top buffer in stack (abandoning content), but leave buffer in place
-// Returns the length abandoned.
-{
-dyOutAssertToken(token);
-int len = dyStringLen(dyOutStack);
-dyStringClear(dyOutStack);
-return len;
-}
-
-
-int dyOutSize(int token)
-// Returns the current length of the buffer starting at the level corresponding to token.
-// Unlike other cases, the token does not have to correspond to the top of the stack!
-{
-struct dyString *dsTarget = dyOutPointerFromToken(token);
-assert(dsTarget != NULL);
-
-int len = dyStringLen(dsTarget);
-struct dyString *ds = dyOutStack;
-for (; ds != dsTarget && ds != NULL; ds = ds->next) // assertable != NULL, but still
-    len += dyStringLen(ds);
-return len;
-}
-
-
-int dyOutSizeAll()
-// returns combined current size of all buffers
-{
-int len = 0;
-if (dyOutStack != NULL)
-    {
-    struct dyString *ds = dyOutStack;
-    for (;ds != NULL; ds = ds->next)
-        len += dyStringLen(ds);
-    }
-return len;
-}
-
-
-int dyOutStackDepth()
-// Returns the current dyOut buffer stack depth
-{
-return slCount(dyOutStack);
-}
-
-
-void dyOutRegisterAltStream(FILE *out)
-// Registers an alternative to STDOUT.  After registering, all dyOut out goes to this file.
-// NOTE: There is no stack. Register/Unregister serially.
-{
-dyOutStreamAssertUnregistered();
-dyOutStream = out;
-}
-
-
-void dyOutUnregisterAltStream(FILE *out)
-// Unregisters the alternative to STDOUT.  After unregistering all dyOut out goes to STDOUT.
-// NOTE: There is no stack. Register/Unregister serially.
-{
-dyOutStreamAssertRegistered(out);
-dyOutStream = stdout;
-}
-
-
-char *dyOutCannibalizeAndClose(int token)
-// Closes the top stack buffer returning content.  Returned string should be freed.
-{
-dyOutAssertToken(token);
-struct dyString *ds = slPopHead(&dyOutStack);
-return dyStringCannibalize(&ds);
-}
-
-
-char *dyOutCannibalizeAndCloseAll()
-// CAUTION: Bad practice to not Open/Close levels in turn!
-// Closes all stack buffers and returns a single string that is the full content.  
-// Returned string should be freed.
-{
-// Using repeated dyOutFlushAndClose calls will build the contents into a single string.
-while (dyOutStack != NULL && dyOutStack->next != NULL) // Leaves only one on the stack
-    {
-    int token = dyOutPointerToToken(dyOutStack);
-    dyOutFlushAndClose(token); // Flushes each to the next lower buffer
-    }
-if (dyOutStack == NULL)
-    return NULL;
-else
-    return dyStringCannibalize(&dyOutStack);
-}
-
-
-void *dyOutStackPop(int token)
-// CAUTION: Not for the faint of heart: print buffer surgery is no substitute for proper coding.
-// Returns a pointer which can be dyOutStackPush'd back into place.
-// Pop/Push is useful for inserting print immediately before a dyOutOpen'd print buffer
-{
-// Note: while this returns a struct dyString *, the caller is kept in the dark.
-//       This is because only this module should manipulate these buffers directly.
-dyOutAssertToken(token);
-return slPopHead(&dyOutStack);
-}
-
-
-void dyOutStackPush(int token,void *dyOutPointer)
-// CAUTION: Not for the faint of heart: print buffer surgery is no substitute for proper coding.
-// Push a previously dyOutStackPop'd print buffer back onto the stack
-// Pop/Push is useful for inserting print immediately before a dyOutOpen'd print buffer
-{
-assert(dyOutPointerToToken(dyOutPointer) == token);
-slAddHead(&dyOutStack,dyOutPointer);
-}
-
-
-#ifdef NOT_NOW
-// Requires regex function added to dystring.c which has been successfully tested.
-boolean dyOutRegexReplace(int token, char *regExpression, char *replaceWith)
-// CAUTION: Not for the faint of heart: print buffer surgery is no substitute for proper coding.
-// Looks for and replaces a single instance of a wildcard match in the current dyOut print buffer
-// regex follows normal EXTENDED (egrep) rules except:
-// ^ - at beginning of the regExpression only and matches beginning of buffer (not of line)
-// $ - at end of regExpression only and matches end of buffer (not end of line)
-// \n - newlines in the body of the regExpression will match newlines in the current print buffer
-// Returns TRUE on success
-// CAUTION: Wildcards match largest sub-string [w.*d] matches all of "wild wild world"
-{
-dyOutAssertToken(token);
-return dyStringRegexReplace(dyOutStack,regExpression,replaceWith);
-}
-
-
-void dyOutTest()
-// Tests of dyOut functions
-{
-printf("Plain printf\n");
-dyOutPrintf("1 dyOutPrintf unopened\n");
-
-int token1 = dyOutOpen(0);
-dyOutPrintf("2 dyOutOpen:1\n");
-dyOutFlush(token1);
-dyOutPrintf("3^10   1:%d after flush\n",dyOutStackDepth());
-int token2 = dyOutOpen(256);
-dyOutPrintf("4 dsOpen:2 len1:%d  len2:%d  lenAll:%d\n",
-         dyOutSize(token1),dyOutSize(token2),dyOutSizeAll());
-dyOutRegisterAltStream(stderr);
-dyOutFlush(token2);
-dyOutUnregisterAltStream(stderr);
-dyOutPrintf("5      2:%d After flush  len1:%d  len2:%d  lenAll:%d\n",
-         dyOutStackDepth(),dyOutSize(token1),dyOutSize(token2),dyOutSizeAll());
-dyOutFlushAndClose(token2);
-dyOutPrintf("6      1:%d After flushAndClose:2  len1:%d\n",dyOutStackDepth(),dyOutSize(token1));
-token2 = dyOutOpen(256);
-dyOutPrintf("7 dyOutOpen:2 reopen:2  WILL ABANDON CONTENT\n");
-char *content = cloneString(dyOutContent(token2));
-dyOutAbandonContent(token2);
-dyOutPrintf("8x7    2:%d len1:%d len2:%d lenAll:%d isEmpty2:%s\n",
-         dyOutStackDepth(),dyOutSize(token1),dyOutSize(token2),dyOutSizeAll(),
-         (dyOutIsEmpty(token2) ? "EMPTY":"NOT_EMPTY"));
-strSwapChar(content,'\n','~');  // Replace newline before printing.
-dyOutPrintf("9      2:%d No flush yet   len1:%d  len2:%d  lenAll:%d  prev7:[%s]\n",
-         dyOutStackDepth(),dyOutSize(token1),dyOutSize(token2),dyOutSizeAll(),content);
-freez(&content);
-int token3 = dyOutOpen(256);
-dyOutPuts("10  Open:3 Line doubled and out of turn due to dyOutPrintDirectly()");
-dyOutPrintDirectly(token3,stdout);
-dyOutPrintf("11     3:%d Just prior to closing all.  len1:%d  len2:%d  len3:%d  lenAll:%d",
-         dyOutStackDepth(),
-         dyOutSize(token1),dyOutSize(token2),dyOutSize(token3),dyOutSizeAll());
-int token4 = dyOutOpen(256);
-dyOutPrintf("12  Open:4 Opened  stack:%d  WILL ABANDON\n",dyOutStackDepth());
-dyOutAbandon(token4);
-dyOutPutc('\n');
-dyOutPuts("13  Puts:  Added last '\\n' with dsPutc(), this with dsPuts().");
-dyOutPrintf("14     3:%d Last line!  Expect 7 & 12 missing, 10 dupped.  lenAll:%d  Bye.\n",
-         dyOutStackDepth(),dyOutSizeAll());
-dyOutFlushAndCloseAll();
-assert(dyOutStack == NULL);
-int ix = 0;
-for (;ix<20;ix++) // tested to 1000
-    {
-    dyOutOpen(32); // Don't even care about tokens!
-    if (ix == 0)
-        dyOutPrintf("CannibalizeAndCloseAll():");
-    dyOutPrintf(" %d",dyOutStackDepth());
-    }
-content = dyOutCannibalizeAndCloseAll();
-printf("\n[%s]\n",content);
-freez(&content);
-}
-#endif///def NOT_NOW
-
-
diff --git a/gbtools/src/blatSrc/lib/dystring.c b/gbtools/src/blatSrc/lib/dystring.c
deleted file mode 100644
index 1fa6c22..0000000
--- a/gbtools/src/blatSrc/lib/dystring.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/* dystring - dynamically resizing string.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "dystring.h"
-
-
-struct dyString *newDyString(int initialBufSize)
-/* Allocate dynamic string with initial buffer size.  (Pass zero for default) */
-{
-struct dyString *ds;
-AllocVar(ds);
-if (initialBufSize == 0)
-    initialBufSize = 512;
-ds->string = needMem(initialBufSize+1);
-ds->bufSize = initialBufSize;
-return ds;
-}
-
-void freeDyString(struct dyString **pDs)
-/* Free up dynamic string. */
-{
-struct dyString *ds;
-if ((ds = *pDs) != NULL)
-    {
-    freeMem(ds->string);
-    freez(pDs);
-    }
-}
-
-char *dyStringCannibalize(struct dyString **pDy)
-/* Kill dyString, but return the string it is wrapping
- * (formerly dy->string).  This should be free'd at your
- * convenience. */
-{
-char *s;
-struct dyString *ds = *pDy;
-assert(ds != NULL);
-s = ds->string;
-freez(pDy);
-return s;
-}
-
-void freeDyStringList(struct dyString **pDs)
-/* free up a list of dyStrings */
-{
-struct dyString *ds, *next;
-for(ds = *pDs; ds != NULL; ds = next)
-    {
-    next = ds->next;
-    freeDyString(&ds);
-    }
-*pDs = NULL;
-}
-
-static void dyStringExpandBuf(struct dyString *ds, int newSize)
-/* Expand buffer to new size. */
-{
-ds->string = needMoreMem(ds->string, ds->stringSize+1, newSize+1);
-ds->bufSize = newSize;
-}
-
-void dyStringBumpBufSize(struct dyString *ds, int size)
-/* Force dyString buffer to be at least given size. */
-{
-if (ds->bufSize < size)
-    dyStringExpandBuf(ds, size);
-}
-
-void dyStringAppendN(struct dyString *ds, char *string, int stringSize)
-/* Append string of given size to end of string. */
-{
-int oldSize = ds->stringSize;
-int newSize = oldSize + stringSize;
-char *buf;
-if (newSize > ds->bufSize)
-    {
-    int newAllocSize = newSize + oldSize;
-    int oldSizeTimesOneAndAHalf = oldSize * 1.5;
-    if (newAllocSize < oldSizeTimesOneAndAHalf)
-        newAllocSize = oldSizeTimesOneAndAHalf;
-    dyStringExpandBuf(ds,newAllocSize);
-    }
-buf = ds->string;
-memcpy(buf+oldSize, string, stringSize);
-ds->stringSize = newSize;
-buf[newSize] = 0;
-}
-
-char dyStringAppendC(struct dyString *ds, char c)
-/* Append char to end of string. */
-{
-char *s;
-if (ds->stringSize >= ds->bufSize)
-     dyStringExpandBuf(ds, ds->bufSize+256);
-s = ds->string + ds->stringSize++;
-*s++ = c;
-*s = 0;
-return c;
-}
-
-void dyStringAppendMultiC(struct dyString *ds, char c, int n)
-/* Append N copies of char to end of string. */
-{
-int oldSize = ds->stringSize;
-int newSize = oldSize + n;
-int newAllocSize = newSize + oldSize;
-char *buf;
-if (newSize > ds->bufSize)
-    dyStringExpandBuf(ds,newAllocSize);
-buf = ds->string;
-memset(buf+oldSize, c, n);
-ds->stringSize = newSize;
-buf[newSize] = 0;
-}
-
-void dyStringAppend(struct dyString *ds, char *string)
-/* Append zero terminated string to end of dyString. */
-{
-dyStringAppendN(ds, string, strlen(string));
-}
-
-void dyStringAppendEscapeQuotes(struct dyString *dy, char *string,
-	char quot, char esc)
-/* Append escaped-for-quotation version of string to dy. */
-{
-char c;
-char *s = string;
-while ((c = *s++) != 0)
-     {
-     if (c == quot)
-         dyStringAppendC(dy, esc);
-     dyStringAppendC(dy, c);
-     }
-}
-
-void dyStringVaPrintf(struct dyString *ds, char *format, va_list args)
-/* VarArgs Printf to end of dyString. */
-{
-/* attempt to format the string in the current space.  If there
- * is not enough room, increase the buffer size and try again */
-int avail, sz;
-while (TRUE)
-    {
-    va_list argscp;
-    va_copy(argscp, args);
-    avail = ds->bufSize - ds->stringSize;
-    if (avail <= 0)
-        {
-	/* Don't pass zero sized buffers to vsnprintf, because who knows
-	 * if the library function will handle it. */
-        dyStringExpandBuf(ds, ds->bufSize+ds->bufSize);
-	avail = ds->bufSize - ds->stringSize;
-	}
-    sz = vsnprintf(ds->string + ds->stringSize, avail, format, argscp);
-    va_end(argscp);
-
-    /* note that some version return -1 if too small */
-    if ((sz < 0) || (sz >= avail))
-        dyStringExpandBuf(ds, ds->bufSize+ds->bufSize);
-    else
-        {
-        ds->stringSize += sz;
-        break;
-        }
-    }
-}
-
-void dyStringPrintf(struct dyString *ds, char *format, ...)
-/*  Printf to end of dyString. */
-{
-va_list args;
-va_start(args, format);
-dyStringVaPrintf(ds, format, args);
-va_end(args);
-}
-
-struct dyString *dyStringCreate(char *format, ...)
-/*  Create a dyString with a printf style initial content */
-{
-int len = strlen(format) * 3;
-struct dyString *ds = newDyString(len);
-va_list args;
-va_start(args, format);
-dyStringVaPrintf(ds, format, args);
-va_end(args);
-return ds;
-}
-
-struct dyString * dyStringSub(char *orig, char *in, char *out)
-/* Make up a duplicate of orig with all occurences of in substituted
- * with out. */
-{
-int inLen = strlen(in), outLen = strlen(out), origLen = strlen(orig);
-struct dyString *dy = newDyString(origLen + 2*outLen);
-char *s, *e;
-
-if (orig == NULL) return NULL;
-for (s = orig; ;)
-    {
-    e = stringIn(in, s);
-    if (e == NULL)
-	{
-        e = orig + origLen;
-	dyStringAppendN(dy, s, e - s);
-	break;
-	}
-    else
-        {
-	dyStringAppendN(dy, s, e - s);
-	dyStringAppendN(dy, out, outLen);
-	s = e + inLen;
-	}
-    }
-return dy;
-}
-
-void dyStringResize(struct dyString *ds, int newSize)
-/* resize a string, if the string expands, blanks are appended */
-{
-int oldSize = ds->stringSize;
-if (newSize > oldSize)
-    {
-    /* grow */
-    if (newSize > ds->bufSize)
-        dyStringExpandBuf(ds, newSize + ds->stringSize);
-    memset(ds->string+newSize, ' ', newSize);
-    }
-ds->string[newSize] = '\0';
-ds->stringSize = newSize;
-}
-
-void dyStringQuoteString(struct dyString *dy, char quotChar, char *text)
-/* Append quotChar-quoted text (with any internal occurrences of quotChar
- * \-escaped) onto end of dy. */
-{
-char c;
-
-dyStringAppendC(dy, quotChar);
-while ((c = *text++) != 0)
-    {
-    if (c == quotChar)
-        dyStringAppendC(dy, '\\');
-    dyStringAppendC(dy, c);
-    }
-dyStringAppendC(dy, quotChar);
-}
-
diff --git a/gbtools/src/blatSrc/lib/elmTree.c b/gbtools/src/blatSrc/lib/elmTree.c
deleted file mode 100644
index 122c25c..0000000
--- a/gbtools/src/blatSrc/lib/elmTree.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-// elmTree.c/.h - Extensible local memory tree grown from an slList of objects, via
-// NEIGHBOR JOINING and a supplied compare routine.  Unlike hacTree, this is not a binary tree
-// and any node can have original content, a single parent and N children.  Superficially similar
-// to running slSort(), running elmTreeGrow() creates a tree from a single "root".  All branches
-// and leaves are represented as "tree nodes" which contain pointers to a user defined object,
-// a single parent, a first child (if the node is not a leaf) and a next sibling.  All nodes are
-// additionally joined together as an slList with the single "root" as the first member.  Thus
-// the tree can be traversed linerarly through node->next or hierarchically through recursive
-// node->firstChild,child->sibling access.
-// The tree is grown through neighbor joins and involves figuring out whether each successive 
-// content should be attached as a branch node or leaf node to the existing tree.  To facilitate
-// neighbor joining, each node has cumulative content from the single root node (whcih has NULL
-// content).  An example might be a tree of bitmaps where each node contains all the bits of its
-// parent plus additional bits.
-// Since an elmTree is build with local memory, free the tree by lmCleanup().
-
-#include "common.h"
-#include "elmTree.h"
-
-struct elmNode *treeNewNode(struct lm *lm,struct elmNode **tree,struct slList *content)
-// Returns a new node to attach to a tree.
-{
-assert((*tree != NULL && content != NULL) || (*tree == NULL && content == NULL));
-
-struct elmNode *node;
-lmAllocVar(lm,node);
-if (tree != NULL) // Keep all nodes in a simple slList
-    slAddHead(tree,node);
-node->selfAndDescendants = 1;
-node->content = content;
-return node;
-}
-// NOTE the root of the tree always has NULL content.
-#define treePlant(lm,tree) treeNewNode(lm,tree,NULL)
-
-INLINE void treeSprout(struct elmNode *parent,struct elmNode *node)
-// Adds a leaf or branch node to an existing tree node.
-{
-node->parent = parent;
-node->sibling = parent->firstChild;
-parent->firstChild = node;
-parent->selfAndDescendants += node->selfAndDescendants;
-}
-
-struct elmNode *treeClip(struct elmNode *node)
-// Clips leaf or branch node from a tree returning the node's former parent
-{
-assert(node->parent != NULL);
-struct elmNode *parent = node->parent;
-node->parent = NULL;
-
-// node may not be first child, so find node in children 
-struct elmNode *child = parent->firstChild; 
-struct elmNode *prevChild = NULL;
-struct elmNode *nextChild = NULL;
-for (; child != NULL; prevChild = child, child = nextChild)
-    {
-    nextChild = child->sibling;
-    if (child == node)
-        {
-        child->sibling = NULL;
-        if (prevChild != NULL)
-            prevChild->sibling = nextChild;
-        else
-            parent->firstChild = nextChild;
-        break;
-        }
-    }
-parent->selfAndDescendants -= node->selfAndDescendants;
-return parent;
-}
-
-
-INLINE void treeBranchBefore(struct elmNode *branch,struct elmNode *node)
-// Adds a new 'branch' node just before the current 'node'
-{
-struct elmNode *parent = treeClip(node);
-treeSprout(parent,branch);
-treeSprout(branch,node);
-}
-
-enum elmNodeOverlap rTreeBranchFindMaxWeight(struct elmNode *branch, struct slList *element, 
-                                                    elmNodeCompareFunction *neighborCmp, 
-                                                    int *pWeight, void *extra)
-// Using the compare routine, the max weight is found an element and a candidate branch
-{
-int bestWeight = 0;
-int topNodeResult = neighborCmp(branch->content,element,&bestWeight,extra);
-if (topNodeResult != enoEqual && topNodeResult != enoSuperset // could do better
-&&  bestWeight > 0 && bestWeight >= *pWeight)           // reason to look for more
-    {
-    struct elmNode *child = branch->firstChild;
-    for ( ;child != NULL; child = child->sibling)
-        {
-        int weight = bestWeight;  // will not recurse if new weight is less than best
-        int result = rTreeBranchFindMaxWeight(child,element,neighborCmp,&weight,extra);
-        if (bestWeight < weight)
-            bestWeight = weight;
-        if (result == enoEqual
-        ||  result == enoSuperset)
-            break;  // don't return result of compare to child, but do select this best weight
-        }
-    }
-*pWeight = bestWeight;
-return topNodeResult;
-}
-
-static enum elmNodeOverlap treeChooseBranch(struct elmNode **pBranch, struct slList *element,
-                                            elmNodeCompareFunction *neighborCmp, void *extra)
-// Using the compare routine, a branch is chosen that most closely matches the element being tested
-// Simple case: one of two branches has best weight so follow that branch.  More subtle case:
-// both branches have equal weight.  In this case using recursive routine will look deeper into 
-// each branch to find the best weight before choosing a branch.
-{
-struct elmNode *branch = *pBranch;
-assert(branch->content != NULL);
-
-struct elmNode *bestBranch = branch;
-int bestWeight = 0;
-// NOTE: using recursive routine will look deeper into a branch to find the best weight
-//int bestResult = neighborCmp(bestBranch->content,element,&bestWeight,extra);
-int bestResult = rTreeBranchFindMaxWeight(bestBranch,element,neighborCmp,&bestWeight,extra);
-
-// Is there need to compare further?
-if (bestResult != enoEqual && bestResult != enoSuperset)  // Could do better
-    {
-    for (branch = branch->sibling;branch != NULL; branch = branch->sibling)
-        {
-        int weight = bestWeight;  // will not recurse if new weight is less than best
-        //int result = neighborCmp(branch->content,element,&weight,extra);
-        int result = rTreeBranchFindMaxWeight(branch,element,neighborCmp,&weight,extra);
-        if (bestWeight <  weight)                         // better than last branch
-        // NOTE: preferring larger of 2 equal branches does not help.
-        //|| (bestWeight == weight                         // prefer largest branch
-        //   &&  branch->selfAndDescendants > bestBranch->selfAndDescendants))
-            {
-            bestBranch = branch;
-            bestWeight = weight;
-            bestResult = result;
-            if (bestResult == enoEqual
-            ||  bestResult == enoSuperset) // doesn't get any better
-                break;
-            }
-        }
-    }
-*pBranch   = bestBranch;
-return bestResult;
-}
-
-
-struct elmNode *elmTreeGrow(struct lm *lm,struct slList *collection, void *extra,
-                            elmNodeCompareFunction *neighborCmp,
-                            elmNodeJoiningFunction *neighborJoin)
-// Given a collection of content and a function to compare elements of the content,
-// returns a tree based on neighbor joining.  The nodes of the tree will have content
-// which is cumulative out to the leaves: the root node has null content, while any child
-// has content that is the superset of all it's parents.  Fill 'extra' with anything (like lm)
-// that you want passed into your compare and joining functions.
-{
-if (collection == NULL)
-    return NULL;
-
-// Begin tree
-struct elmNode *treeNodeList = NULL;
-struct elmNode *root = treePlant(lm,&treeNodeList);
-
-// Add first element:
-struct slList *element = collection;
-struct elmNode *newNode = treeNewNode(lm,&treeNodeList,element);
-treeSprout(root,newNode);
-element = element->next;
-
-// for each additional element, walks current tree level by level, choosing the best branch and
-// ultimately adding the element as a leaf.  Current leaves can become branches and
-// current branches may get split to add a new leaf sprout in the middle.
-struct elmNode *curNode = NULL;
-struct elmNode *newBranch = NULL;
-for ( ;element != NULL; element = element->next)
-    {
-    for (curNode = root->firstChild;  // For each element, start at just off root
-         curNode != NULL; 
-         curNode = curNode->firstChild) // walks down
-        {
-        int result = treeChooseBranch(&curNode,element,neighborCmp,extra); // chooses across
-        if (result == enoEqual)                       // Replaces current
-            {
-            // Should only get here if a previous node has the same content as this new element
-            struct slList *replacement = neighborJoin(curNode->content,element,extra);
-            curNode->content = replacement;
-            }
-        else if (result == enoExcluding)              // New leaf
-            {
-            newNode = treeNewNode(lm,&treeNodeList,element);
-            treeSprout(curNode->parent,newNode);  // shares nothing
-            }
-        else if (result == enoSubset)                 // on to children or new leaf
-            {
-            if (curNode->firstChild != NULL) 
-                continue;                             // Only case where we continue!
-            newNode = treeNewNode(lm,&treeNodeList,element);
-            treeSprout(curNode,newNode);          // shares all of curNode
-            }
-        else if (result == enoSuperset)               // New branch with old node as child
-            {
-            newBranch = treeNewNode(lm,&treeNodeList,element);
-            treeBranchBefore(newBranch,curNode);
-            }
-        else if (result == enoMixed)                  // New branch with both nodes as children
-            {
-            struct slList *matching = neighborJoin(curNode->content,element,extra);
-            newBranch = treeNewNode(lm,&treeNodeList,matching);
-            treeBranchBefore(newBranch,curNode);
-            newNode   = treeNewNode(lm,&treeNodeList,element);
-            treeSprout(newBranch,newNode);
-            }
-        break; // done, move on to next element
-        }
-    }
-slReverse(&treeNodeList);
-assert(elmNodeIsRoot(treeNodeList) && root == treeNodeList);
-return root;
-}
-
-boolean rElmTreeClimb(const struct elmNode *node, struct slList *parent, void *extra,
-                      elmNodePickFunction *elmPick, struct slList **results)
-// Recursively climbs tree and examines every node using the supplied function.
-// Each call on a node iterates through its siblings, recursively calling itself on any children.
-// This function might be used to build a list of objects from each or a subset of nodes.
-// If all examinations resulted in a structure, then the list will be in REVERSE traversal order.
-// If you immediately slReverse(results) then the list will ascend to the furthest leaf before
-// moving on to sibling leaves, twigs and branches.
-// Note: if results are returned, then "parent" is filled with nearest parent's result.
-// Return FALSE from the elmPick function to stop the traversal.  Thus, a complete traversal
-// returns TRUE, but one that has been stopped (after finding one node?) returns FALSE.
-{
-const struct elmNode *sibling = elmNodeIsRoot(node) ? node->firstChild: node;
-for (;sibling!=NULL;sibling = sibling->sibling)
-    {
-    // Some nodes are subsets rather than alleles
-    struct slList *localParent = NULL;
-    struct slList *result = NULL;
-    boolean ret = elmPick(sibling->content,parent,extra,&result);
-    if (result)
-        {
-        //assert(results != NULL);
-        slAddHead(results,result);
-        localParent = result;
-        result = NULL;
-        }
-    else
-        localParent = parent;
-
-    if (!ret)
-        return FALSE; // Stop traversing
-
-    // a node points to only one child, but that child may have siblings
-    struct elmNode *child = sibling->firstChild; // additional children are siblings
-    if (child)
-        {
-        assert(child->content != NULL);
-        ret = rElmTreeClimb(child, localParent, extra, elmPick, &result);
-        if (result != NULL)
-            {
-            //assert(results != NULL);
-            *results = slCat(result,*results); // newer results go to front!
-            }
-        if (!ret)
-            return FALSE; // Stop traversing
-        }
-    }
-return TRUE; // continue traversing
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/emblParse.c b/gbtools/src/blatSrc/lib/emblParse.c
deleted file mode 100644
index f0b6213..0000000
--- a/gbtools/src/blatSrc/lib/emblParse.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-/* Parse EMBL formatted files. EMBL files are basically line
- * oriented.  Each line begins with a short (usually two letter)
- * type word.  Adjacent lines with the same type are generally
- * considered logical extensions of each other.  In many cases
- * lines can be considered fields in an EMBL database.  Records
- * are separated by lines starting with '//'  Generally lines
- * starting with XX are empty and used to make the records more
- * human readable.   Here is an example record:
- 
- C  M00001
- XX
- ID  V$MYOD_01
- XX
- NA  MyoD
- XX
- DT  EWI (created); 19.10.92.
- DT  ewi (updated); 22.06.95.
- XX
- PO     A     C     G     T
- 01     0     0     0     0
- 02     0     0     0     0
- 03     1     2     2     0
- 04     2     1     2     0
- 05     3     0     1     1
- 06     0     5     0     0
- 07     5     0     0     0
- 08     0     0     4     1
- 09     0     1     4     0
- 10     0     0     0     5
- 11     0     0     5     0
- 12     0     1     2     2
- 13     0     2     0     3
- 14     1     0     3     1
- 15     0     0     0     0
- 16     0     0     0     0
- 17     0     0     0     0
- XX
- BF  T00526; MyoD                         ; mouse
- XX
- BA  5 functional elements in 3 genes
- XX
- XX
- //
- 
- */
-
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "emblParse.h"
-
-
-boolean emblLineGroup(struct lineFile *lf, char type[16], struct dyString *val)
-/* Read next line of embl file.  Read line after that too if it
- * starts with the same type field. Return FALSE at EOF. */
-{
-char *line, *word;
-int typeLen = 0;
-
-dyStringClear(val);
-while (lineFileNext(lf, &line, NULL))
-    {
-    line = skipLeadingSpaces(line);
-
-    /* Parse out first word into type. */
-    if (isspace(line[0]))
-        errAbort("embl line that doesn't start with type line %d of %s", 
-		lf->lineIx, lf->fileName);
-    if (typeLen == 0)
-        {
-	word = nextWord(&line);
-	typeLen = strlen(word);
-	if (typeLen >= 16)
-	    errAbort("Type word at start of line too long for embl file line %d of %s",
-	    	lf->lineIx, lf->fileName);
-	strcpy(type, word);
-	}
-    else if (!startsWith(type, line) || !isspace(line[typeLen]))
-        {
-	lineFileReuse(lf);
-	break;
-	}
-    else
-        {
-	dyStringAppendC(val, '\n');
-	word = nextWord(&line);
-	}
-
-    if (line != NULL)
-	{
-	/* Usually have two spaces after type. */
-	if (isspace(line[0]))
-	   ++line;
-	if (isspace(line[0]))
-	   ++line;
-
-	/* Append what's rest of line to return value. */
-	dyStringAppend(val, line);
-	}
-    }
-return typeLen > 0;
-}
-
-struct hash *emblRecord(struct lineFile *lf)
-/* Read next record and return it in hash.   (Free this
- * hash with freeHashAndVals.)   Hash is keyed by type
- * and has string values. */
-{
-struct hash *hash = NULL;
-char type[16];
-struct dyString *val = newDyString(256);
-boolean gotEnd = FALSE;
-
-while (emblLineGroup(lf, type, val))
-    {
-    if (hash == NULL)
-        hash = newHash(7);
-    if (sameString(type, "//"))
-        {
-	gotEnd = TRUE;
-	break;
-	}
-    hashAdd(hash, type, cloneString(val->string));
-    }
-if (hash != NULL && !gotEnd)
-    warn("Incomplete last record of embl file %s\n", lf->fileName);
-return hash;
-}
-
-static void notEmbl(char *fileName)
-/* Complain it's not really an EMBL file. */
-{
-errAbort("%s is not an emblFile", fileName);
-}
-
-struct lineFile *emblOpen(char *fileName, char type[256])
-/* Open up embl file, verify format and optionally  return 
- * type (VV line).  Close this with lineFileClose(). */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct hash *hash = emblRecord(lf);
-char *vv;
-
-if (hash == NULL)
-    notEmbl(fileName);
-if ((vv = hashFindVal(hash, "VV")) == NULL)
-    notEmbl(fileName);
-if (type != NULL)
-    {
-    if (strlen(vv) >= 256)
-	notEmbl(fileName);
-    strcpy(type, vv);
-    }
-freeHashAndVals(&hash);
-return lf;
-}
diff --git a/gbtools/src/blatSrc/lib/errAbort.c b/gbtools/src/blatSrc/lib/errAbort.c
deleted file mode 100644
index 961fe56..0000000
--- a/gbtools/src/blatSrc/lib/errAbort.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/* errAbort.c - our error handler.
- *
- * This maintains two stacks - a warning message printer
- * stack, and a "abort handler" stack.
- *
- * Note that the abort function always calls the warn handler first.
- * This is so that the message gets sent.
- *
- * By default the warnings will go to stderr, and
- * aborts will exit the program.  You can push a
- * function on to the appropriate stack to change
- * this behavior.  The top function on the stack
- * gets called.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-// developer: this include is for an occasionally useful means of getting stack info without
-// crashing
-// however, it is not supported on cygwin.  Conditionally compile this in when desired.
-//#define BACKTRACE_EXISTS
-#ifdef BACKTRACE_EXISTS
-#include <execinfo.h>
-#endif///def BACKTRACE_EXISTS
-#include <pthread.h>
-#include "common.h"
-#include "hash.h"
-#include "dystring.h"
-#include "errAbort.h"
-
-
-
-#define maxWarnHandlers 20
-#define maxAbortHandlers 12
-struct perThreadAbortVars
-/* per thread variables for abort and warn */
-    {
-    boolean debugPushPopErr;        // generate stack dump on push/pop error
-    boolean errAbortInProgress;     /* Flag to indicate that an error abort is in progress.
-                                      * Needed so that a warn handler can tell if it's really
-                                      * being called because of a warning or an error. */
-    WarnHandler warnArray[maxWarnHandlers];
-    int warnIx;
-    AbortHandler abortArray[maxAbortHandlers];
-    int abortIx;
-    };
-
-static struct perThreadAbortVars *getThreadVars();  // forward declaration
-
-static void defaultVaWarn(char *format, va_list args)
-/* Default error message handler. */
-{
-if (format != NULL) {
-    fflush(stdout);
-    vfprintf(stderr, format, args);
-    fprintf(stderr, "\n");
-    fflush(stderr);
-    }
-}
-
-static void silentVaWarn(char *format, va_list args)
-/* Warning handler that just hides it.  Useful sometimes when high level code
- * expects low level code may fail (as in finding a file on the net) but doesn't
- * want user to be bothered about it. */
-{
-}
-
-
-void vaWarn(char *format, va_list args)
-/* Call top of warning stack to issue warning. */
-{
-struct perThreadAbortVars *ptav = getThreadVars();
-ptav->warnArray[ptav->warnIx](format, args);
-}
-
-void warn(char *format, ...)
-/* Issue a warning message. */
-{
-va_list args;
-va_start(args, format);
-vaWarn(format, args);
-va_end(args);
-}
-
-void warnWithBackTrace(char *format, ...)
-/* Issue a warning message and append backtrace. */
-{
-va_list args;
-va_start(args, format);
-struct dyString *dy = newDyString(255);
-dyStringAppend(dy, format);
-
-#define STACK_LIMIT 20
-char **strings = NULL;
-int count = 0;
-
-// developer: this is an occasionally useful means of getting stack info without crashing
-// however, it is not supported on cygwin.  Conditionally compile this in when desired.
-// The define is at top to include execinfo.h
-#ifdef BACKTRACE_EXISTS
-void *buffer[STACK_LIMIT];
-count = backtrace(buffer, STACK_LIMIT);
-strings = backtrace_symbols(buffer, count);
-#endif///def BACKTRACE_EXISTS
-
-if (strings == NULL)
-    dyStringAppend(dy,"\nno backtrace_symbols available in errabort::warnWithBackTrace().");
-else
-    {
-    int ix = 1;
-    dyStringAppend(dy,"\nBACKTRACE (use on cmdLine):");
-    if (strings[1] != NULL)
-        {
-        strSwapChar(strings[1],' ','\0');
-        dyStringPrintf(dy,"\naddr2line -Cfise %s",strings[1]);
-        strings[1] += strlen(strings[1]) + 1;
-        }
-    for (; ix < count && strings[ix] != NULL; ix++)
-        {
-        strings[ix] = skipBeyondDelimit(strings[ix],'[');
-        strSwapChar(strings[ix],']','\0');
-        dyStringPrintf(dy," %s",strings[ix]);
-        }
-
-    free(strings);
-    }
-vaWarn(dyStringCannibalize(&dy), args);
-va_end(args);
-}
-
-
-void errnoWarn(char *format, ...)
-/* Prints error message from UNIX errno first, then does rest of warning. */
-{
-char fbuf[512];
-va_list args;
-va_start(args, format);
-sprintf(fbuf, "%s\n%s", strerror(errno), format);
-vaWarn(fbuf, args);
-va_end(args);
-}
-
-
-void pushWarnHandler(WarnHandler handler)
-/* Set abort handler */
-{
-struct perThreadAbortVars *ptav = getThreadVars();
-if (ptav->warnIx >= maxWarnHandlers-1)
-    {
-    if (ptav->debugPushPopErr)
-        dumpStack("pushWarnHandler overflow");
-    errAbort("Too many pushWarnHandlers, can only handle %d\n", maxWarnHandlers-1);
-    }
-ptav->warnArray[++ptav->warnIx] = handler;
-}
-
-void popWarnHandler()
-/* Revert to old warn handler. */
-{
-struct perThreadAbortVars *ptav = getThreadVars();
-if (ptav->warnIx <= 0)
-    {
-    if (ptav->debugPushPopErr)
-        dumpStack("popWarnHandler underflow");
-    errAbort("Too few popWarnHandlers");
-    }
---ptav->warnIx;
-}
-
-static void defaultAbort()
-/* Default error handler exits program. */
-{
-if ((getenv("ERRASSERT") != NULL) || (getenv("ERRABORT") != NULL))
-    abort();
-else
-    exit(-1);
-}
-
-
-void noWarnAbort()
-/* Abort without message. */
-{
-struct perThreadAbortVars *ptav = getThreadVars();
-ptav->abortArray[ptav->abortIx]();
-exit(-1);               /* This is just to make compiler happy.
-                         * We have already exited or longjmped by now. */
-}
-
-void vaErrAbort(char *format, va_list args)
-/* Abort function, with optional (vprintf formatted) error message. */
-{
-/* flag is needed because both errAbort and warn generate message
- * using the warn handler, however sometimes one needed to know
- * (like when logging), if it's an error or a warning.  This is far from
- * perfect, as this isn't cleared if the error handler continues,
- * as with an exception mechanism. */
-struct perThreadAbortVars *ptav = getThreadVars();
-ptav->errAbortInProgress = TRUE;
-vaWarn(format, args);
-noWarnAbort();
-}
-
-void errAbort(char *format, ...)
-/* Abort function, with optional (printf formatted) error message. */
-{
-#ifdef COREDUMP
-    abort();
-#endif
-va_list args;
-va_start(args, format);
-vaErrAbort(format, args);
-va_end(args);
-}
-
-void errnoAbort(char *format, ...)
-/* Prints error message from UNIX errno first, then does errAbort. */
-{
-char fbuf[512];
-va_list args;
-va_start(args, format);
-sprintf(fbuf, "%s\n%s", strerror(errno), format);
-vaErrAbort(fbuf, args);
-va_end(args);
-}
-
-void pushAbortHandler(AbortHandler handler)
-/* Set abort handler */
-{
-struct perThreadAbortVars *ptav = getThreadVars();
-if (ptav->abortIx >= maxAbortHandlers-1)
-    {
-    if (ptav->debugPushPopErr)
-        dumpStack("pushAbortHandler overflow");
-    errAbort("Too many pushAbortHandlers, can only handle %d", maxAbortHandlers-1);
-    }
-ptav->abortArray[++ptav->abortIx] = handler;
-}
-
-void popAbortHandler()
-/* Revert to old abort handler. */
-{
-struct perThreadAbortVars *ptav = getThreadVars();
-if (ptav->abortIx <= 0)
-    {
-    if (ptav->debugPushPopErr)
-        dumpStack("popAbortHandler underflow");
-    errAbort("Too many popAbortHandlers\n");
-    }
---ptav->abortIx;
-}
-
-static void debugAbort()
-/* Call the debugger. */
-{
-fflush(stdout);
-assert(FALSE);
-defaultAbort();
-}
-
-void pushDebugAbort()
-/* Push abort handler that will invoke debugger. */
-{
-pushAbortHandler(debugAbort);
-}
-
-static void warnAbortHandler(char *format, va_list args)
-/* warn handler that also aborts. */
-{
-defaultVaWarn(format, args);
-noWarnAbort();
-}
-
-void pushWarnAbort()
-/* Push handler that will abort on warnings. */
-{
-pushWarnHandler(warnAbortHandler);
-}
-
-void pushSilentWarnHandler()
-/* Set warning handler to be quiet.  Do a popWarnHandler to restore. */
-{
-pushWarnHandler(silentVaWarn);
-}
-
-void errAbortDebugnPushPopErr()
-/*  generate stack dump if there is a error in the push/pop functions */
-{
-struct perThreadAbortVars *ptav = getThreadVars();
-ptav->debugPushPopErr = TRUE;
-}
-
-boolean isErrAbortInProgress() 
-/* Flag to indicate that an error abort is in progress.
- * Needed so that a warn handler can tell if it's really
- * being called because of a warning or an error. */
-{
-struct perThreadAbortVars *ptav = getThreadVars();
-return ptav->errAbortInProgress;
-}
-
-
-static struct perThreadAbortVars *getThreadVars()
-/* Return a pointer to the perThreadAbortVars for the current pthread. */
-{
-pthread_t pid = pthread_self(); //  pthread_t can be a pointer or a number, implementation-dependent.
-
-// Test for out-of-memory condition causing re-entrancy into this function that would block
-// on its own main mutex ptavMutex.  Do this by looking for its own pid.
-// Some care must be exercised in testing and comparing the threads pid against one in-use.
-// We need yet another mutex and a boolean to tell us when the pidInUse value may be safely compared to pid.
-
-// Use a boolean since there is no known unused value for pthread_t variable. NULL and -1 are not portable.
-static boolean pidInUseValid = FALSE;  // tells when pidInUse contains a valid pid that can be compared.
-static pthread_t pidInUse; // there is no "unused" value to which we can initialize this.
-static pthread_mutex_t pidInUseMutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_lock( &pidInUseMutex );
-// If this pid equals pidInUse, then this function has been re-entered due to severe out-of-memory error.
-// But we only compare them when pidInUseValid is TRUE.
-if (pidInUseValid && pthread_equal(pid, pidInUse)) 
-    {
-    // Avoid deadlock on self by exiting immediately.
-    // Use pthread_equal because directly comparing two pthread_t vars is not allowed.
-    // This re-entrancy only happens when it has aborted already due to out of memory
-    // which should be a rare occurrence.
-    char *errMsg = "errAbort re-entered due to out-of-memory condition. Exiting.\n";
-    write(STDERR_FILENO, errMsg, strlen(errMsg)); 
-    exit(1);   // out of memory is a serious problem, exit immediately, but allow atexit cleanup.
-    }
-pthread_mutex_unlock( &pidInUseMutex );
-
-// This is the main mutex we really care about.
-// It controls access to the hash where thread-specific data is stored.
-static pthread_mutex_t ptavMutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_lock( &ptavMutex );
-
-// safely tell threads that pidInUse
-// is valid and correctly set and may be compared to pid
-pthread_mutex_lock( &pidInUseMutex );
-pidInUse = pthread_self();  // setting it directly to pid is not allowed.
-pidInUseValid = TRUE;
-pthread_mutex_unlock( &pidInUseMutex );
-
-// This means that if we crash due to out-of-memory below,
-// it will be able to detect the re-entrancy and handle it above.
-
-static struct hash *perThreadVars = NULL;
-if (perThreadVars == NULL)
-    perThreadVars = hashNew(0);
-// convert the pid into a string for the hash key
-char pidStr[64];
-safef(pidStr, sizeof(pidStr), "%lld",  ptrToLL(pid));
-struct hashEl *hel = hashLookup(perThreadVars, pidStr);
-if (hel == NULL)
-    {
-    // if it is the first time, initialization the perThreadAbortVars
-    struct perThreadAbortVars *ptav;
-    AllocVar(ptav);
-    ptav->debugPushPopErr = FALSE;
-    ptav->errAbortInProgress = FALSE;
-    ptav->warnIx = 0;
-    ptav->warnArray[0] = defaultVaWarn;
-    ptav->abortIx = 0;
-    ptav->abortArray[0] = defaultAbort;
-    hel = hashAdd(perThreadVars, pidStr, ptav);
-    }
-
-// safely tell other threads that pidInUse
-// is no longer valid and may not be compared to pid
-pthread_mutex_lock( &pidInUseMutex );
-pidInUseValid = FALSE;
-pthread_mutex_unlock( &pidInUseMutex );
-
-// unlock our mutex controlling the hash of thread-specific data
-pthread_mutex_unlock( &ptavMutex );
-return (struct perThreadAbortVars *)(hel->val);
-}
-
diff --git a/gbtools/src/blatSrc/lib/errCatch.c b/gbtools/src/blatSrc/lib/errCatch.c
deleted file mode 100644
index 30be9b5..0000000
--- a/gbtools/src/blatSrc/lib/errCatch.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-/* errCatch - help catch errors so that errAborts aren't
- * fatal, and warn's don't necessarily get printed immediately. 
- * Note that error conditions caught this way will tend to
- * leak resources unless there are additional wrappers. 
- *
- * Typical usage is
- * errCatch = errCatchNew();
- * if (errCatchStart(errCatch))
- *     doFlakyStuff();
- * errCatchEnd(errCatch);
- * if (errCatch->gotError)
- *     warn("%s", errCatch->message->string);
- * errCatchFree(&errCatch); 
- * cleanupFlakyStuff();
- */
-
-#include "common.h"
-#include "errAbort.h"
-#include "dystring.h"
-#include "hash.h"
-#include <pthread.h>
-#include "errCatch.h"
-
-
-
-struct errCatch *errCatchNew()
-/* Return new error catching structure. */
-{
-struct errCatch *errCatch;
-AllocVar(errCatch);
-errCatch->message = dyStringNew(0);
-return errCatch;
-}
-
-void errCatchFree(struct errCatch **pErrCatch)
-/* Free up resources associated with errCatch */
-{
-struct errCatch *errCatch = *pErrCatch;
-if (errCatch != NULL)
-    {
-    dyStringFree(&errCatch->message);
-    freez(pErrCatch);
-    }
-}
-
-static struct errCatch **getStack()
-/* Return a pointer to the errCatch object stack for the current pthread. */
-{
-static pthread_mutex_t getStackMutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_lock( &getStackMutex );
-static struct hash *perThreadStacks = NULL;
-pthread_t pid = pthread_self(); //  can be a pointer or a number
-// A true integer has function would be nicer, but this will do.  
-// Don't safef, theoretically that could abort.
-char key[64];
-snprintf(key, sizeof(key), "%lld",  ptrToLL(pid));
-key[ArraySize(key)-1] = '\0';
-if (perThreadStacks == NULL)
-    perThreadStacks = hashNew(0);
-struct hashEl *hel = hashLookup(perThreadStacks, key);
-if (hel == NULL)
-    hel = hashAdd(perThreadStacks, key, NULL);
-pthread_mutex_unlock( &getStackMutex );
-return (struct errCatch **)(&hel->val);
-}
-
-static void errCatchAbortHandler()
-/* semiAbort */
-{
-struct errCatch **pErrCatchStack = getStack(), *errCatchStack = *pErrCatchStack;
-errCatchStack->gotError = TRUE;
-longjmp(errCatchStack->jmpBuf, -1);
-}
-
-static void errCatchWarnHandler(char *format, va_list args)
-/* Write an error to top of errCatchStack. */
-{
-struct errCatch **pErrCatchStack = getStack(), *errCatchStack = *pErrCatchStack;
-errCatchStack->gotWarning = TRUE;
-dyStringVaPrintf(errCatchStack->message, format, args);
-dyStringAppendC(errCatchStack->message, '\n');
-}
-
-boolean errCatchPushHandlers(struct errCatch *errCatch)
-/* Push error handlers.  Not usually called directly. */
-{
-pushAbortHandler(errCatchAbortHandler);
-pushWarnHandler(errCatchWarnHandler);
-struct errCatch **pErrCatchStack = getStack();
-slAddHead(pErrCatchStack, errCatch);
-return TRUE;
-}
-
-void errCatchEnd(struct errCatch *errCatch)
-/* Restore error handlers and pop self off of catching stack. */
-{
-popWarnHandler();
-popAbortHandler();
-struct errCatch **pErrCatchStack = getStack(), *errCatchStack = *pErrCatchStack;
-if (errCatch != errCatchStack)
-   errAbort("Mismatch between errCatch and errCatchStack");
-*pErrCatchStack = errCatch->next;
-}
-
-void errCatchReWarn(struct errCatch *errCatch)
-/* Re-warn any warnings that happened even though no abort happened 
- * to make them visible. */
-{
-if (errCatch->gotWarning && !errCatch->gotError)
-    {
-    warn("%s", errCatch->message->string);
-    }
-}
-
-boolean errCatchFinish(struct errCatch **pErrCatch)
-/* Finish up error catching.  Report error if there is a
- * problem and return FALSE.  If no problem return TRUE.
- * This handles errCatchEnd and errCatchFree. */
-{
-struct errCatch *errCatch = *pErrCatch;
-boolean ok = TRUE;
-if (errCatch != NULL)
-    {
-    errCatchEnd(errCatch);
-    if (errCatch->gotError)
-	{
-	ok = FALSE;
-	warn("%s", errCatch->message->string);
-	}
-    else
-	errCatchReWarn(errCatch);
-    errCatchFree(pErrCatch);
-    }
-return ok;
-}
-
diff --git a/gbtools/src/blatSrc/lib/fa.c b/gbtools/src/blatSrc/lib/fa.c
deleted file mode 100644
index 61f448b..0000000
--- a/gbtools/src/blatSrc/lib/fa.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/* Routines for reading and writing fasta format sequence files.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "errAbort.h"
-#include "hash.h"
-#include "portable.h"
-#include "dnautil.h"
-#include "dnaseq.h"
-#include "fa.h"
-#include "linefile.h"
-
-
-boolean faReadNext(FILE *f, char *defaultName, boolean mustStartWithComment,
-                         char **retCommentLine, struct dnaSeq **retSeq) 
-/* Read next sequence from .fa file. Return sequence in retSeq.  
- * If retCommentLine is non-null
- * return the '>' line in retCommentLine.   
- * The whole thing returns FALSE at end of file.  
- * DNA chars are mapped to lower case.*/
-{
-    return faReadMixedNext(f, 0, defaultName, mustStartWithComment,
-                                        retCommentLine, retSeq);
-}
-
-boolean faReadMixedNext(FILE *f, boolean preserveCase, char *defaultName, 
-    boolean mustStartWithComment, char **retCommentLine, struct dnaSeq **retSeq)
-/* Read next sequence from .fa file. Return sequence in retSeq.  
- * If retCommentLine is non-null return the '>' line in retCommentLine.
- * The whole thing returns FALSE at end of file. 
- * Contains parameter to preserve mixed case. */
-{
-char lineBuf[1024];
-int lineSize;
-char *words[1];
-int c;
-off_t offset = ftello(f);
-size_t dnaSize = 0;
-DNA *dna, *sequence;
-char *name = defaultName;
-
-if (name == NULL)
-    name = "";
-dnaUtilOpen();
-if (retCommentLine != NULL)
-    *retCommentLine = NULL;
-*retSeq = NULL;
-
-/* Skip first lines until it starts with '>' */
-for (;;)
-    {
-    if(fgets(lineBuf, sizeof(lineBuf), f) == NULL)
-        {
-        if (ferror(f))
-            errnoAbort("read of fasta file failed");
-        return FALSE;
-        }
-    lineSize = strlen(lineBuf);
-    if (lineBuf[0] == '>')
-        {
-	if (retCommentLine != NULL)
-            *retCommentLine = cloneString(lineBuf);
-        offset = ftello(f);
-        chopByWhite(lineBuf, words, ArraySize(words));
-        name = words[0]+1;
-        break;
-        }
-    else if (!mustStartWithComment)
-        {
-        if (fseeko(f, offset, SEEK_SET) < 0)
-            errnoAbort("fseek on fasta file failed");
-        break;
-        }
-    else
-        offset += lineSize;
-    }
-/* Count up DNA. */
-for (;;)
-    {
-    c = fgetc(f);
-    if (c == EOF || c == '>')
-        break;
-    if (isalpha(c))
-        {
-        ++dnaSize;
-        }
-    }
-
-if (dnaSize == 0)
-    {
-    warn("Invalid fasta format: sequence size == 0 for element %s",name);
-    }
-
-/* Allocate DNA and fill it up from file. */
-dna = sequence = needHugeMem(dnaSize+1);
-if (fseeko(f, offset, SEEK_SET) < 0)
-    errnoAbort("fseek on fasta file failed");
-for (;;)
-    {
-    c = fgetc(f);
-    if (c == EOF || c == '>')
-        break;
-    if (isalpha(c))
-        {
-        /* check for non-DNA char */
-        if (ntChars[c] == 0)
-            {
-            *dna++ = preserveCase ? 'N' : 'n';
-            }
-        else
-            {
-            *dna++ = preserveCase ? c : ntChars[c];
-            }
-        }
-    }
-if (c == '>')
-    ungetc(c, f);
-*dna = 0;
-
-*retSeq = newDnaSeq(sequence, dnaSize, name);
-if (ferror(f))
-    errnoAbort("read of fasta file failed");    
-return TRUE;
-}
-
-
-struct dnaSeq *faReadOneDnaSeq(FILE *f, char *defaultName, boolean mustStartWithComment)
-/* Read sequence from FA file. Assumes positioned at or before
- * the '>' at start of sequence. */  
-{
-struct dnaSeq *seq;
-if (!faReadNext(f, defaultName, mustStartWithComment, NULL, &seq))
-    return NULL;
-else
-    return seq;
-}
-
-static bioSeq *nextSeqFromMem(char **pText, boolean isDna, boolean doFilter)
-/* Convert fa in memory to bioSeq.  Update *pText to point to next
- * record.  Returns NULL when no more sequences left. */
-{
-char *name = "";
-char *s, *d;
-struct dnaSeq *seq;
-int size = 0;
-char c;
-char *filter = (isDna ? ntChars : aaChars);
-char *text = *pText;
-char *p = skipLeadingSpaces(text);
-if (p == NULL)
-    return NULL;
-dnaUtilOpen();
-if (*p == '>')
-    {
-    char *end;
-    s = strchr(p, '\n');
-    if (s != NULL) ++s;
-    name = skipLeadingSpaces(p+1);
-    end = skipToSpaces(name);
-    if (end >= s || name >= s)
-        errAbort("No name in line starting with '>'");
-    if (end != NULL)
-        *end = 0;
-    }
-else
-    {
-    s = p; 
-    if (s == NULL || s[0] == 0)
-        return NULL;
-    }
-name = cloneString(name);
-    
-d = text;
-if (s != NULL)
-    {
-    for (;;)
-	{
-	c = *s;
-	if (c == 0 || c == '>')
-	    break;
-	++s;
-	if (!isalpha(c))
-	    continue;
-	if (doFilter)
-	    {
-	    if ((c = filter[(int)c]) == 0) 
-		{
-		if (isDna)
-		    c = 'n';
-		else
-		    c = 'X';
-		}
-	    }
-	d[size++] = c;
-	}
-    }
-d[size] = 0;
-
-/* Put sequence into our little sequence structure. */
-AllocVar(seq);
-seq->name = name;
-seq->dna = text;
-seq->size = size;
-*pText = s;
-return seq;
-}
-
-bioSeq *faNextSeqFromMemText(char **pText, boolean isDna)
-/* Convert fa in memory to bioSeq.  Update *pText to point to next
- * record.  Returns NULL when no more sequences left. */
-{
-return nextSeqFromMem(pText, isDna, TRUE);
-}
-
-bioSeq *faNextSeqFromMemTextRaw(char **pText)
-/* Same as faNextSeqFromMemText, but will leave in 
- * letters even if they aren't in DNA or protein alphabed. */
-{
-return nextSeqFromMem(pText, TRUE, FALSE);
-}
-
-bioSeq *faSeqListFromMemText(char *text, boolean isDna)
-/* Convert fa's in memory into list of dnaSeqs. */
-{
-bioSeq *seqList = NULL, *seq;
-while ((seq = faNextSeqFromMemText(&text, isDna)) != NULL)
-    {
-    slAddHead(&seqList, seq);
-    }
-slReverse(&seqList);
-return seqList;
-}
-
-bioSeq *faSeqListFromMemTextRaw(char *text)
-/* Convert fa's in memory into list of dnaSeqs without
- * converting chars to N's. */
-{
-bioSeq *seqList = NULL, *seq;
-while ((seq = faNextSeqFromMemTextRaw(&text)) != NULL)
-    {
-    slAddHead(&seqList, seq);
-    }
-slReverse(&seqList);
-return seqList;
-}
-
-
-bioSeq *faSeqFromMemText(char *text, boolean isDna)
-/* Convert fa in memory to bioSeq. */
-{
-return faNextSeqFromMemText(&text, isDna);
-}
-
-struct dnaSeq *faFromMemText(char *text)
-/* Return a sequence from a .fa file that's been read into
- * a string in memory. This cannabalizes text, which should
- * be allocated with needMem.  This buffer becomes part of
- * the returned dnaSeq, which may be freed normally with
- * freeDnaSeq. */
-{
-return faNextSeqFromMemText(&text, TRUE);
-}
-
-struct dnaSeq *faReadSeq(char *fileName, boolean isDna)
-/* Open fa file and read a single sequence from it. */
-{
-int maxSize = fileSize(fileName);
-int fd;
-DNA *s;
-
-if (maxSize < 0)
-    errAbort("can't open %s", fileName);
-s = needHugeMem(maxSize+1);
-fd = open(fileName, O_RDONLY);
-if (read(fd, s, maxSize) < 0)
-    errAbort("faReadSeq: read failed: %s", strerror(errno));
-close(fd);
-s[maxSize] = 0;
-return faSeqFromMemText(s, isDna);
-}
-
-struct dnaSeq *faReadDna(char *fileName)
-/* Open fa file and read a single nucleotide sequence from it. */
-{
-return faReadSeq(fileName, TRUE);
-}
-
-struct dnaSeq *faReadAa(char *fileName)
-/* Open fa file and read a peptide single sequence from it. */
-{
-return faReadSeq(fileName, FALSE);
-}
-
-static unsigned faFastBufSize = 0;
-static DNA *faFastBuf;
-
-static void expandFaFastBuf(int bufPos, int minExp)
-/* Make faFastBuf bigger. */
-{
-if (faFastBufSize == 0)
-    {
-    faFastBufSize = 64 * 1024;
-    while (minExp > faFastBufSize)
-        faFastBufSize <<= 1;
-    faFastBuf = needHugeMem(faFastBufSize);
-    }
-else
-    {
-    DNA *newBuf;
-    unsigned newBufSize = faFastBufSize + faFastBufSize;
-    while (newBufSize < minExp)
-	{
-        newBufSize <<= 1;
-	if (newBufSize <= 0)
-	    errAbort("expandFaFastBuf: integer overflow when trying to "
-		     "increase buffer size from %u to a min of %u.",
-		     faFastBufSize, minExp);
-	}
-    newBuf = needHugeMem(newBufSize);
-    memcpy(newBuf, faFastBuf, bufPos);
-    freeMem(faFastBuf);
-    faFastBuf = newBuf;
-    faFastBufSize = newBufSize;
-    }
-}
-
-void faFreeFastBuf()
-/* Free up buffers used in fa fast and speedreading. */
-{
-freez(&faFastBuf);
-faFastBufSize = 0;
-}
-
-boolean faFastReadNext(FILE *f, DNA **retDna, int *retSize, char **retName)
-/* Read in next FA entry as fast as we can. Return FALSE at EOF. 
- * The returned DNA and name will be overwritten by the next call
- * to this function. */
-{
-int c;
-int bufIx = 0;
-static char name[256];
-int nameIx = 0;
-boolean gotSpace = FALSE;
-
-/* Seek to next '\n' and save first word as name. */
-dnaUtilOpen();
-name[0] = 0;
-for (;;)
-    {
-    if ((c = fgetc(f)) == EOF)
-        {
-        *retDna = NULL;
-        *retSize = 0;
-        *retName = NULL;
-        return FALSE;
-        }
-    if (!gotSpace && nameIx < ArraySize(name)-1)
-        {
-        if (isspace(c))
-            gotSpace = TRUE;
-        else if (c != '>')
-            {
-            name[nameIx++] = c;
-            }
-        }
-    if (c == '\n')
-        break;
-    }
-name[nameIx] = 0;
-/* Read until next '>' */
-for (;;)
-    {
-    c = fgetc(f);
-    if (c == EOF || c == '>')
-        c = 0;
-    else if (!isalpha(c))
-        continue;
-    else
-	{
-	c = ntChars[c];
-	if (c == 0) c = 'n';
-	}
-    if (bufIx >= faFastBufSize)
-	expandFaFastBuf(bufIx, 0);
-    faFastBuf[bufIx++] = c;
-    if (c == 0)
-        {
-        *retDna = faFastBuf;
-        *retSize = bufIx-1;
-        *retName = name;
-        return TRUE;
-        }
-    }
-}
-
-
-void faWriteNext(FILE *f, char *startLine, DNA *dna, int dnaSize)
-/* Write next sequence to fa file. */
-{
-if (dnaSize == 0)
-    return;
-if (startLine != NULL)
-    fprintf(f, ">%s\n", startLine);
-writeSeqWithBreaks(f, dna, dnaSize, 50);
-}
-
-void faWrite(char *fileName, char *startLine, DNA *dna, int dnaSize)
-/* Write out FA file or die trying. */
-{
-FILE *f = mustOpen(fileName, "w");
-faWriteNext(f, startLine, dna, dnaSize);
-if (fclose(f) != 0)
-    errnoAbort("fclose failed");
-}
-
-void faWriteAll(char *fileName, bioSeq *seqList)
-/* Write out all sequences in list to file. */
-{
-FILE *f = mustOpen(fileName, "w");
-bioSeq *seq;
-
-for (seq=seqList; seq != NULL; seq = seq->next)
-    faWriteNext(f, seq->name, seq->dna, seq->size);
-if (fclose(f) != 0)
-    errnoAbort("fclose failed");
-}
-
-boolean faMixedSpeedReadNext(struct lineFile *lf, DNA **retDna, int *retSize, char **retName)
-/* Read in DNA or Peptide FA record in mixed case.   Allow any upper or lower case
- * letter, or the dash character in. */
-{
-char c;
-int bufIx = 0;
-static char name[512];
-int lineSize, i;
-char *line;
-
-dnaUtilOpen();
-
-/* Read first line, make sure it starts with '>', and read first word
- * as name of sequence. */
-name[0] = 0;
-if (!lineFileNext(lf, &line, &lineSize))
-    {
-    *retDna = NULL;
-    *retSize = 0;
-    return FALSE;
-    }
-if (line[0] == '>')
-    {
-    line = firstWordInLine(skipLeadingSpaces(line+1));
-    if (line == NULL)
-        errAbort("Expecting sequence name after '>' line %d of %s", lf->lineIx, lf->fileName);
-    strncpy(name, line, sizeof(name));
-    name[sizeof(name)-1] = '\0'; /* Just to make sure name is NULL terminated. */
-    }
-else
-    {
-    errAbort("Expecting '>' line %d of %s", lf->lineIx, lf->fileName);
-    }
-/* Read until next '>' */
-for (;;)
-    {
-    if (!lineFileNext(lf, &line, &lineSize))
-        break;
-    if (line[0] == '>')
-        {
-	lineFileReuse(lf);
-	break;
-	}
-    if (bufIx + lineSize >= faFastBufSize)
-	expandFaFastBuf(bufIx, lineSize);
-    for (i=0; i<lineSize; ++i)
-        {
-	c = line[i];
-	if (isalpha(c) || c == '-')
-	    faFastBuf[bufIx++] = c;
-	}
-    }
-if (bufIx >= faFastBufSize)
-    expandFaFastBuf(bufIx, 0);
-faFastBuf[bufIx] = 0;
-*retDna = faFastBuf;
-*retSize = bufIx;
-*retName = name;
-if (bufIx == 0)
-    {
-    warn("Invalid fasta format: sequence size == 0 for element %s",name);
-    }
-
-return TRUE;
-}
-
-void faToProtein(char *poly, int size)
-/* Convert possibly mixed-case protein to upper case.  Also
- * convert any strange characters to 'X'.  Does not change size.
- * of sequence. */
-{
-int i;
-char c;
-dnaUtilOpen();
-for (i=0; i<size; ++i)
-    {
-    if ((c = aaChars[(int)poly[i]]) == 0)
-	c = 'X';
-    poly[i] = c;
-    }
-}
-
-void faToDna(char *poly, int size)
-/* Convert possibly mixed-case DNA to lower case.  Also turn
- * any strange characters to 'n'.  Does not change size.
- * of sequence. */
-{
-int i;
-char c;
-dnaUtilOpen();
-for (i=0; i<size; ++i)
-    {
-    if ((c = ntChars[(int)poly[i]]) == 0)
-	c = 'n';
-    poly[i] = c;
-    }
-}
-
-boolean faSomeSpeedReadNext(struct lineFile *lf, DNA **retDna, int *retSize, char **retName, boolean isDna)
-/* Read in DNA or Peptide FA record. */
-{
-char *poly;
-int size;
-
-if (!faMixedSpeedReadNext(lf, retDna, retSize, retName))
-    return FALSE;
-size = *retSize;
-poly = *retDna;
-if (isDna)
-    faToDna(poly, size);
-else
-    faToProtein(poly, size);
-return TRUE;
-}
-
-boolean faPepSpeedReadNext(struct lineFile *lf, DNA **retDna, int *retSize, char **retName)
-/* Read in next peptide FA entry as fast as we can.  */
-{
-return faSomeSpeedReadNext(lf, retDna, retSize, retName, FALSE);
-}
-
-boolean faSpeedReadNext(struct lineFile *lf, DNA **retDna, int *retSize, char **retName)
-/* Read in next FA entry as fast as we can. Faster than that old,
- * pokey faFastReadNext. Return FALSE at EOF. 
- * The returned DNA and name will be overwritten by the next call
- * to this function. */
-{
-return faSomeSpeedReadNext(lf, retDna, retSize, retName, TRUE);
-}
-
-static struct dnaSeq *faReadAllMixableInLf(struct lineFile *lf, 
-	boolean isDna, boolean mixed)
-/* Return list of all sequences from open fa file. 
- * Mixed case parameter overrides isDna.  If mixed is false then
- * will return DNA in lower case and non-DNA in upper case. */
-{
-struct dnaSeq *seqList = NULL, *seq;
-DNA *dna;
-char *name;
-int size;
-boolean ok;
-
-for (;;)
-    {
-    if (mixed)
-        ok = faMixedSpeedReadNext(lf, &dna, &size, &name);
-    else
-        ok = faSomeSpeedReadNext(lf, &dna, &size, &name, isDna);
-    if (!ok)
-        break;
-    AllocVar(seq);
-    seq->name = cloneString(name);
-    seq->size = size;
-    seq->dna = cloneMem(dna, size+1);
-    slAddHead(&seqList, seq);
-    }
-slReverse(&seqList);
-faFreeFastBuf();
-return seqList;
-}
-
-static struct dnaSeq *faReadAllSeqMixable(char *fileName, boolean isDna, boolean mixed)
-/* Return list of all sequences in FA file. 
- * Mixed case parameter overrides isDna.  If mixed is false then
- * will return DNA in lower case and non-DNA in upper case. */
-{
-struct lineFile *lf = lineFileOpen(fileName, FALSE);
-struct dnaSeq *seqList = faReadAllMixableInLf(lf, isDna, mixed);
-lineFileClose(&lf);
-return seqList;
-}
-
-struct hash *faReadAllIntoHash(char *fileName, enum dnaCase dnaCase)
-/* Return hash of all sequences in FA file.  */
-{
-boolean isDna = (dnaCase == dnaLower);
-boolean isMixed = (dnaCase == dnaMixed);
-struct dnaSeq *seqList = faReadAllSeqMixable(fileName, isDna, isMixed);
-struct hash *hash = hashNew(18);
-struct dnaSeq *seq;
-for (seq = seqList; seq != NULL; seq = seq->next)
-    {
-    if (hashLookup(hash, seq->name))
-        errAbort("%s duplicated in %s", seq->name, fileName);
-    hashAdd(hash, seq->name, seq);
-    }
-return hash;
-}
-
-
-struct dnaSeq *faReadAllSeq(char *fileName, boolean isDna)
-/* Return list of all sequences in FA file. */
-{
-return faReadAllSeqMixable(fileName, isDna, FALSE);
-}
-
-struct dnaSeq *faReadAllDna(char *fileName)
-/* Return list of all DNA sequences in FA file. */
-{
-return faReadAllSeq(fileName, TRUE);
-}
-
-struct dnaSeq *faReadAllPep(char *fileName)
-/* Return list of all peptide sequences in FA file. */
-{
-return faReadAllSeq(fileName, FALSE);
-}
-
-struct dnaSeq *faReadAllMixed(char *fileName)
-/* Read in mixed case fasta file, preserving case. */
-{
-return faReadAllSeqMixable(fileName, FALSE, TRUE);
-}
-
-struct dnaSeq *faReadAllMixedInLf(struct lineFile *lf)
-/* Read in mixed case sequence from open fasta file. */
-{
-return faReadAllMixableInLf(lf, FALSE, TRUE);
-}
diff --git a/gbtools/src/blatSrc/lib/ffAli.c b/gbtools/src/blatSrc/lib/ffAli.c
deleted file mode 100644
index 122e1d6..0000000
--- a/gbtools/src/blatSrc/lib/ffAli.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* Some relatively small utility functions that act on ffAlis.
- * (Separated from fuzzyFinder.c so people can do light ffAli 
- * work without including 100k of fuzzyFinder object code.) 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "fuzzyFind.h"
-
-
-void ffFreeAli(struct ffAli **pAli)
-/* Dispose of memory gotten from fuzzyFind(). */
-{
-struct ffAli *ali = *pAli;
-if (ali != NULL)
-    {
-    while (ali->right)
-        ali = ali->right;
-    slFreeList(&ali);
-    }
-*pAli = NULL;
-}
-
-int ffOneIntronOrientation(struct ffAli *left, struct ffAli *right)
-/* Return 1 for GT/AG intron between left and right, -1 for CT/AC, 0 for no
- * intron. */
-{
-if (left->nEnd != right->nStart)
-    return 0;
-return intronOrientation(left->hEnd, right->hStart);
-}
-
-int ffIntronOrientation(struct ffAli *ali)
-/* Return + for positive orientation overall, - for negative,
- * 0 if can't tell. */
-{
-struct ffAli *left = ali, *right;
-int orient = 0;
-
-if (left != NULL)
-    {
-    while((right = left->right) != NULL)
-	{
-	orient += intronOrientation(left->hEnd, right->hStart);
-	left = right;
-	}
-    }
-return orient;
-}
-
-struct ffAli *ffRightmost(struct ffAli *ff)
-/* Return rightmost block of alignment. */
-{
-while (ff->right != NULL)
-    ff = ff->right;
-return ff;
-}
-
-struct ffAli *ffMakeRightLinks(struct ffAli *rightMost)
-/* Given a pointer to the rightmost block in an alignment
- * which has all of the left pointers filled in, fill in
- * the right pointers and return the leftmost block. */
-{
-struct ffAli *ff, *last = NULL;
-
-for (ff = rightMost; ff != NULL; ff = ff->left)
-    {
-    ff->right = last;
-    last = ff;
-    }
-return last;
-}
-
-
-static int countGoodStart(struct ffAli *ali)
-/* Return number of perfect matchers at start. */
-{
-DNA *n = ali->nStart;
-DNA *h = ali->hStart;
-int count = ali->nEnd - ali->nStart;
-int i;
-for (i=0; i<count; ++i)
-    {
-    if (*n++ != *h++)
-        break;
-    }
-return i;
-}
-
-static int countGoodEnd(struct ffAli *ali)
-/* Return number of perfect matchers at start. */
-{
-DNA *n = ali->nEnd;
-DNA *h = ali->hEnd;
-int count = ali->nEnd - ali->nStart;
-int i;
-for (i=0; i<count; ++i)
-    {
-    if (*--n != *--h)
-        break;
-    }
-return i;
-}
-
-void ffCountGoodEnds(struct ffAli *aliList)
-/* Fill in the goodEnd and badEnd scores. */
-{
-struct ffAli *ali;
-for (ali = aliList; ali != NULL; ali = ali->right)
-    {
-    ali->startGood = countGoodStart(ali);
-    ali->endGood = countGoodEnd(ali);
-    }
-}
-
-int ffAliCount(struct ffAli *d)
-/* How many blocks in alignment? */
-{
-int acc = 0;
-while (d != NULL)
-    {
-    ++acc;
-    d = d->right;
-    }
-return acc;
-}
-
-struct ffAli *ffAliFromSym(int symCount, char *nSym, char *hSym,
-	struct lm *lm, char *nStart, char *hStart)
-/* Convert symbol representation of alignments (letters plus '-')
- * to ffAli representation.  If lm is nonNULL, ffAli result 
- * will be lmAlloced, else it will be needMemed. This routine
- * depends on nSym/hSym being zero terminated. */
-{
-struct ffAli *ffList = NULL, *ff = NULL;
-char n, h;
-int i;
-
-for (i=0; i<=symCount; ++i)
-    {
-    boolean isGap;
-    n = nSym[i];
-    h = hSym[i];
-    isGap = (n == '-' || n == 0 || h == '-' || h == 0);
-    if (isGap)
-	{
-	if (ff != NULL)
-	    {
-	    ff->nEnd = nStart;
-	    ff->hEnd = hStart;
-	    ff->left = ffList;
-	    ffList = ff;
-	    ff = NULL;
-	    }
-	}
-    else
-	{
-	if (ff == NULL)
-	    {
-	    if (lm != NULL)
-		{
-		lmAllocVar(lm, ff);
-		}
-	    else
-		{
-		AllocVar(ff);
-		}
-	    ff->nStart = nStart;
-	    ff->hStart = hStart;
-	    }
-	}
-    if (n != '-')
-	{
-	++nStart;
-	}
-    if (h != '-')
-	{
-	++hStart;
-	}
-    }
-ffList = ffMakeRightLinks(ffList);
-return ffList;
-}
diff --git a/gbtools/src/blatSrc/lib/ffScore.c b/gbtools/src/blatSrc/lib/ffScore.c
deleted file mode 100644
index a4801ee..0000000
--- a/gbtools/src/blatSrc/lib/ffScore.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/* ffScore - stuff to score ffAli alignments. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "obscure.h"
-#include "fuzzyFind.h"
-
-
-int ffIntronMax = ffIntronMaxDefault;
-
-void setFfIntronMax(int value)
-{
-ffIntronMax = value;
-}
-
-int ffScoreMatch(DNA *a, DNA *b, int size)
-/* Compare two pieces of DNA base by base. Total mismatches are
- * subtracted from total matches and returned as score. 'N's 
- * neither hurt nor help score. */
-{
-int i;
-int score = 0;
-for (i=0; i<size; ++i)
-    {
-    DNA aa = a[i];
-    DNA bb = b[i];
-    if (aa == 'n' || bb == 'n')
-        continue;
-    if (aa == bb)
-        ++score;
-    else
-        score -= 1;
-    }
-return score;
-}
-
-int ffCalcCdnaGapPenalty(int hGap, int nGap)
-/* Return gap penalty for given h and n gaps. */
-{
-int acc = 2;
-if (hGap > 400000)	/* Discourage really long introns. */
-    {
-    acc += (hGap - 400000)/3000;
-    if (hGap > ffIntronMax)
-        acc += (hGap - ffIntronMax)/2000;
-    }
-if (hGap < 0)   /* Discourage jumping back in haystack. */
-    {
-    hGap = -8*hGap;
-    if (hGap > 48)
-        hGap = (hGap*hGap);
-    }
-if (nGap < 0)   /* Jumping back in needle gets rid of previous alignment. */
-    {
-    acc += -nGap;
-    nGap = 0;
-    }
-acc += digitsBaseTwo(hGap)/2;
-if (nGap != 0)
-    {
-    acc += digitsBaseTwo(nGap);
-    }
-else
-    {
-    if (hGap > 30)
-	acc -= 1;
-    }
-return acc;
-}
-
-static int calcTightGap(int hGap, int nGap)
-/* Figure out gap penalty using tight model (gaps bad!) */
-{
-if (hGap == 0 && nGap == 0)
-    return 0;
-else
-    {
-    int overlap = min(hGap, nGap);
-    int penalty = 8;
-    if (overlap < 0)
-	overlap = 0;
-
-    if (hGap < 0)
-	hGap = -8*hGap;
-    if (nGap < 0)
-	nGap = -2*nGap;
-    penalty += (hGap-overlap + nGap-overlap) + overlap;
-    return penalty;
-    }
-}
-
-static int calcLooseGap(int hGap, int nGap)
-/* Figure out gap penalty using loose model (gaps not so bad) */
-{
-if (hGap == 0 && nGap == 0)
-    return 0;
-else
-    {
-    int overlap = min(hGap, nGap);
-    int penalty = 8;
-    if (overlap < 0)
-	overlap = 0;
-
-    if (hGap < 0)
-	hGap = -8*hGap;
-    if (nGap < 0)
-	nGap = -2*nGap;
-    penalty += log(hGap-overlap+1) + log(nGap-overlap+1);
-    return penalty;
-    }
-}
-
-
-int ffCalcGapPenalty(int hGap, int nGap, enum ffStringency stringency)
-/* Return gap penalty for given h and n gaps. */
-{
-switch (stringency)
-    {
-    case ffCdna:
-	return ffCalcCdnaGapPenalty(hGap, nGap);
-    case ffTight:
-	return calcTightGap(hGap,nGap);
-    case ffLoose:
-	return calcLooseGap(hGap,nGap);
-    default:
-        errAbort("Unknown stringency type %d", stringency);
-	return 0;
-    }
-}
-
-
-int ffCdnaGapPenalty(struct ffAli *left, struct ffAli *right)
-/* What is penalty for gap between two. */
-{
-int hGap = right->hStart - left->hEnd;
-int nGap = right->nStart - left->nEnd;
-return ffCalcCdnaGapPenalty(hGap, nGap);
-}
-
-int ffGapPenalty(struct ffAli *left, struct ffAli *right, enum ffStringency stringency)
-/* What is penalty for gap between two given stringency? */
-{
-int hGap = right->hStart - left->hEnd;
-int nGap = right->nStart - left->nEnd;
-return ffCalcGapPenalty(hGap, nGap, stringency);
-}
-
-int ffScoreSomeAlis(struct ffAli *ali, int count, enum ffStringency stringency)
-/* Figure out score of count alis. */
-{
-int score = 0;
-int oneScore;
-
-while (--count >= 0)
-    {
-    int len = ali->hEnd - ali->hStart;
-    struct ffAli *right = ali->right;
-    oneScore = dnaScoreMatch(ali->hStart, ali->nStart, len);
-    score += oneScore;
-    if (count > 0)  /* Calculate gap penalty */
-        score -= ffGapPenalty(ali, right,stringency);
-    ali = right;
-    }
-return score;
-}
-
-int ffScoreSomething(struct ffAli *ali, enum ffStringency stringency,
-   boolean isProt)
-/* Score alignment. */
-{
-int score = 0;
-int oneScore;
-int (*scoreMatch)(char *a, char *b, int size);
-
-if (ali == NULL)
-    return -0x7FFFFFFF;
-scoreMatch = (isProt ? aaScoreMatch : dnaScoreMatch );
-while (ali->left != NULL) ali = ali->left;
-while (ali != NULL)
-    {
-    int len = ali->hEnd - ali->hStart;
-    struct ffAli *right = ali->right;
-    oneScore = scoreMatch(ali->hStart, ali->nStart, len);
-    score += oneScore;
-    if (right)  /* Calculate gap penalty */
-        {
-        score -= ffGapPenalty(ali, right, stringency);
-        }
-    ali = right;
-    }
-return score;
-}
-
-int ffScore(struct ffAli *ali, enum ffStringency stringency)
-/* Score alignment. */
-{
-return ffScoreSomething(ali, stringency, FALSE);
-}
-
-int ffScoreCdna(struct ffAli *ali)
-/* Figure out overall score of this alignment. 
- * Perfect match is number of bases in needle. */
-{
-return ffScore(ali, ffCdna);
-}
-
-int ffScoreProtein(struct ffAli *ali, enum ffStringency stringency)
-/* Figure out overall score of protein alignment. */
-{
-return ffScoreSomething(ali, stringency, TRUE);
-}
-
diff --git a/gbtools/src/blatSrc/lib/fieldedTable.c b/gbtools/src/blatSrc/lib/fieldedTable.c
deleted file mode 100644
index 2c9fb17..0000000
--- a/gbtools/src/blatSrc/lib/fieldedTable.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* fieldedTable - a table composed of untyped strings in memory.  Includes names for each
- * field. This is a handy way of storing small-to-medium tab-separated files that begin
- * with a "#list of fields" line among other things. */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "localmem.h"
-#include "linefile.h"
-#include "fieldedTable.h"
-
-struct fieldedTable *fieldedTableNew(char *name, char **fields, int fieldCount)
-/* Create a new empty fieldedTable with given name, often a file name. */
-{
-struct fieldedTable *table;
-AllocVar(table);
-struct lm *lm = table->lm = lmInit(0);
-table->name = lmCloneString(lm, name);
-table->cursor = &table->rowList;
-table->fieldCount = fieldCount;
-int i;
-char **row = lmAllocArray(lm, table->fields, fieldCount);
-for (i=0; i<fieldCount; ++i)
-    {
-    row[i] = lmCloneString(lm, fields[i]);
-    }
-return table;
-}
-
-void fieldedTableFree(struct fieldedTable **pTable)
-/* Free up memory resources associated with table. */
-{
-struct fieldedTable *table = *pTable;
-if (table != NULL)
-    {
-    lmCleanup(&table->lm);
-    freez(pTable);
-    }
-}
-
-struct fieldedRow *fieldedTableAdd(struct fieldedTable *table,  char **row, int rowSize, int id)
-/* Create a new row and add it to table.  Return row. */
-{
-/* Make sure we got right number of fields. */
-if (table->fieldCount != rowSize)
-    errAbort("%s starts with %d fields, but at line %d has %d fields instead",
-	    table->name, table->fieldCount, id, rowSize);
-
-/* Allocate field from local memory and start filling it in. */
-struct lm *lm = table->lm;
-struct fieldedRow *fr;
-lmAllocVar(lm, fr);
-lmAllocArray(lm, fr->row, rowSize);
-fr->id = id;
-int i;
-for (i=0; i<rowSize; ++i)
-    fr->row[i] = lmCloneString(lm, row[i]);
-
-/* Add it to end of list using cursor to avoid slReverse hassles. */
-*(table->cursor) = fr;
-table->cursor = &fr->next;
-
-return fr;
-}
-
-struct fieldedTable *fieldedTableFromTabFile(char *fileName, char *reportFileName, 
-    char *requiredFields[], int requiredCount)
-/* Read table from tab-separated file with a #header line that defines the fields.  Ensures
- * all requiredFields (if any) are present.  The reportFileName is just used for error reporting and 
- * should be NULL for most purposes.  This is used by edwSubmit though which
- * first copies to a local file, and we want to report errors from the remote file. 
- * We do know the remote file exists at least, because we just copied it. */
-{
-/* Open file with fileName */
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-
-/* Substitute in reportFileName for error reporting */
-if (reportFileName != NULL)
-    {
-    if (differentString(reportFileName, fileName))
-        {
-	freeMem(lf->fileName);
-	lf->fileName = cloneString(reportFileName);
-	}
-    }
-else
-    {
-    reportFileName = fileName;
-    }
-
-/* Get first line and turn it into field list. */
-char *line;
-if (!lineFileNext(lf, &line, NULL))
-   errAbort("%s is empty", reportFileName);
-if (line[0] != '#')
-   errAbort("%s must start with '#' and field names on first line", reportFileName);
-line = skipLeadingSpaces(line+1);
-int fieldCount = chopByChar(line, '\t', NULL, 0);
-char *fields[fieldCount];
-chopTabs(line, fields);
-
-/* Make sure that all required fields are present. */
-int i;
-for (i = 0; i < requiredCount; ++i)
-    {
-    char *required = requiredFields[i];
-    int ix = stringArrayIx(required, fields, fieldCount);
-    if (ix < 0)
-        errAbort("%s is missing required field '%s'", reportFileName, required);
-    }
-
-/* Create fieldedTable . */
-struct fieldedTable *table = fieldedTableNew(reportFileName, fields, fieldCount);
-while (lineFileRowTab(lf, fields))
-    {
-    fieldedTableAdd(table, fields, fieldCount, lf->lineIx);
-    }
-
-/* Clean up and go home. */
-lineFileClose(&lf);
-return table;
-}
-
diff --git a/gbtools/src/blatSrc/lib/filePath.c b/gbtools/src/blatSrc/lib/filePath.c
deleted file mode 100644
index 68bf0f1..0000000
--- a/gbtools/src/blatSrc/lib/filePath.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* filePath - stuff to handle file name parsing. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "filePath.h"
-
-
-void undosPath(char *path)
-/* Convert '\' to '/' in path. */
-{
-subChar(path, '\\', '/');
-}
-
-void splitPath(char *path, char dir[PATH_LEN], char name[FILENAME_LEN],
-	       char extension[FILEEXT_LEN])
-/* Split a full path into components.  The dir component will include the
- * trailing / if any.  The extension component will include the starting
- * . if any.   Pass in NULL for dir, name, or extension if you don't care about
- * that part. */
-{
-char *dirStart, *nameStart, *extStart, *extEnd;
-int dirSize, nameSize, extSize;
-
-undosPath(path);
-dirStart = path;
-nameStart = strrchr(path,'/');
-if (nameStart == NULL)
-    nameStart = path;
-else
-    nameStart += 1;
-extStart = strrchr(nameStart, '.');
-if (extStart == NULL)
-    extStart = nameStart + strlen(nameStart);
-extEnd = extStart + strlen(extStart);
-if ((dirSize = (nameStart - dirStart)) >= PATH_LEN)
-    errAbort("Directory too long in %s", path);
-if ((nameSize = (extStart - nameStart)) >= FILENAME_LEN)
-    errAbort("Name too long in %s", path);
-if ((extSize = (extEnd - extStart)) >= FILEEXT_LEN)
-    errAbort("Extension too long in %s", path);
-if (dir != NULL)
-    {
-    memcpy(dir, dirStart, dirSize);
-    dir[dirSize] = 0;
-    }
-if (name != NULL)
-    {
-    memcpy(name, nameStart, nameSize);
-    name[nameSize] = 0;
-    }
-if (extension != NULL)
-    {
-    memcpy(extension, extStart, extSize);
-    extension[extSize] = 0;
-    }
-}
-
-static char *findSlashBefore(char *start, char *e)
-/* Return first slash before s (but not before start) */
-{
-while (--e >= start)
-    {
-    if (*e == '/')
-         return e;
-    }
-return start;
-}
-
-char *expandRelativePath(char *baseDir, char *relPath)
-/* Expand relative path to more absolute one. */
-{
-if (relPath[0] == '/')
-   // hey, it's absolute actually... 
-   return cloneString(relPath);
-
-char *e = baseDir + strlen(baseDir);
-int slashCount;
-char *rel = relPath;
-char *result;
-int size, baseSize;
-undosPath(baseDir);
-undosPath(relPath);
-slashCount = countChars(baseDir, '/');
-if (baseDir[0] == 0)
-    slashCount = -1;
-while (startsWith("../", rel))
-    {
-    if (slashCount < 0)
-        {
-	warn("More ..'s in \"%s\" than directories in \"%s\"", relPath, baseDir);
-	return NULL;
-	}
-    else if (slashCount == 0)
-        e = baseDir;
-    else
-        e = findSlashBefore(baseDir, e);
-    slashCount -= 1;
-    rel += 3;
-    }
-baseSize = e - baseDir;
-size = strlen(rel) + 1;
-if (baseSize > 0)
-    size += baseSize + 1;
-if (baseSize > 0)
-    {
-    result = needMem(size);
-    memcpy(result, baseDir, baseSize);
-    result[baseSize] = '/';
-    strcpy(result + baseSize + 1, rel);
-    }
-else
-    result = cloneString(rel);
-return result;
-}
-
-char *pathRelativeToFile(char *baseFile, char *relPath)
-/* Given a base file name and a path relative to that, return
- * relative path interpreted as if it were seen from the
- * same directory holding the baseFile.  
- *   An example of using this would be in processing include
- * files.  In this case the baseFile would be the current
- * source file, and the relPath would be from the include
- * statement.  The returned result could then be used to
- * open the include file. */
-{
-char dir[PATH_LEN];
-splitPath(baseFile, dir, NULL, NULL);
-int dirLen = strlen(dir);
-if (dirLen > 0 && dir[dirLen-1] == '/')
-     dir[dirLen-1] = 0;
-return expandRelativePath(dir, relPath);
-}
diff --git a/gbtools/src/blatSrc/lib/fixColor.c b/gbtools/src/blatSrc/lib/fixColor.c
deleted file mode 100644
index 4d40720..0000000
--- a/gbtools/src/blatSrc/lib/fixColor.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Fixed colors - always in color map. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-#include "common.h"
-#include "memgfx.h"
-
-
-struct rgbColor mgFixedColors[9] = {
-/* These correspond to MG_WHITE, MG_BLACK, etc. */
-    { 255, 255, 255},
-    { 0, 0, 0},
-    { 255, 0, 0},
-    { 0, 255, 0},
-    { 0, 0, 255},
-    { 0, 255, 255},
-    { 255, 0, 255},
-    { 255, 255, 0},
-    { 140, 140, 140},
-};
-
-
-
diff --git a/gbtools/src/blatSrc/lib/flydna.c b/gbtools/src/blatSrc/lib/flydna.c
deleted file mode 100644
index f2416d1..0000000
--- a/gbtools/src/blatSrc/lib/flydna.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* flydna.c - routines for accessing fly genome and cDNA sequences. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "snof.h"
-#include "dnautil.h"
-#include "dnaseq.h"
-#include "fa.h"
-#include "nt4.h"
-#include "cda.h"
-#include "wormdna.h"
-#include "flydna.h"
-
-
-static char *chromNames[] = {"adh"};
-static char *ntFileNames[] = {"c:/biodata/fly/chrom/adh.nt"};
-
-void flyLoadNt4Genome(struct nt4Seq ***retNt4Seq, int *retNt4Count)
-/* Load up entire packed fly genome into memory. */
-{
-struct nt4Seq **pSeq;
-int i;
-
-pSeq = needMem(ArraySize(ntFileNames) * sizeof(pSeq[0]) );
-for (i=0; i<ArraySize(ntFileNames); ++i)
-	{
-	pSeq[i] = loadNt4(ntFileNames[i], chromNames[i]);
-	}
-*retNt4Seq = pSeq;
-*retNt4Count = ArraySize(ntFileNames);
-}
-
-void flyFreeNt4Genome(struct nt4Seq ***pNt4Seq)
-/* Free up packed fly genome. */
-{
-struct nt4Seq **pSeq;
-int i;
-
-if ((pSeq = *pNt4Seq) == NULL)
-	return;
-for (i=0; i<ArraySize(ntFileNames); ++i)
-	freeNt4(&pSeq[i]);
-freez(pNt4Seq);
-}
-
-void flyChromNames(char ***retNames, int *retNameCount)
-/* Get list of fly chromosome names. */
-{
-*retNames = chromNames;
-*retNameCount = ArraySize(chromNames);
-}
-
-void flyFaCommentIntoInfo(char *faComment, struct wormCdnaInfo *retInfo)
-/* Process line from .fa file containing information about cDNA into binary
- * structure. */
-{
-if (retInfo)
-    {
-    char *s;
-    zeroBytes(retInfo, sizeof(*retInfo));
-    /* Separate out first word and use it as name. */
-    s = strchr(faComment, ' ');
-    if (s != NULL)
-	    *s++ = 0;
-    retInfo->name = faComment+1;
-    retInfo->motherString = faComment;
-	s = strrchr(retInfo->name, '.');
-	retInfo->orientation = '+';
-	if (s != NULL)
-		retInfo->orientation = (s[1] == '3' ? '-' : '+');
-    }
-}
-
-
-boolean flyCdnaSeq(char *name, struct dnaSeq **retDna, struct wormCdnaInfo *retInfo)
-/* Get a single fly cDNA sequence. Optionally (if retInfo is non-null) get additional
- * info about the sequence. */
-{
-long offset;
-char *faComment;
-char **pFaComment = (retInfo == NULL ? NULL : &faComment);
-static struct snof *cdnaSnof = NULL;
-static FILE *cdnaFa;
-
-if (cdnaSnof == NULL)
-	cdnaSnof = snofMustOpen("c:/biodata/fly/cDna/allcdna");
-if (cdnaFa == NULL)
-	cdnaFa = mustOpen("c:/biodata/fly/cDna/allcdna.fa", "rb");
-if (!snofFindOffset(cdnaSnof, name, &offset))
-    return FALSE;
-fseek(cdnaFa, offset, SEEK_SET);
-if (!faReadNext(cdnaFa, name, TRUE, pFaComment, retDna))
-    return FALSE;
-flyFaCommentIntoInfo(faComment, retInfo);
-return TRUE;
-}
-
-
-char *flyFeaturesDir()
-/* Return the features directory. (Includes trailing slash.) */
-{
-return "C:/biodata/fly/features/";
-}
-
-FILE *flyOpenGoodAli()
-/* Opens good alignment file and reads signature. 
- * (You can then cdaLoadOne() it.) */
-{
-return cdaOpenVerify("C:/biodata/fly/cDNA/good.ali");
-}
diff --git a/gbtools/src/blatSrc/lib/fof.c b/gbtools/src/blatSrc/lib/fof.c
deleted file mode 100644
index b0c8700..0000000
--- a/gbtools/src/blatSrc/lib/fof.c
+++ /dev/null
@@ -1,581 +0,0 @@
-/* fofFa - create a fof index for a list of FA files. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "localmem.h"
-#include "sig.h"
-#include "fof.h"
-
-
-struct fofRecord
-/* This holds a record of an index file. */
-    {
-    bits32 offset;  /* Start offset within file. Must be first element.*/
-    bits32 size;    /* Sizer within file. */
-    UBYTE fileIx;   /* Which file it's in. */
-    char name[1];   /* Dynamically allocated to fit actual size. */
-    };
-
-struct fof
-/* Manage a file offset file - an index which includes the file,
- * the offset, and the size of each item. */
-    {
-    char *name;                  /* Name of fof given to fofOpen. */
-    char *relDir;                /* Directory to apply to index files. */
-    char **fileNames;            /* Names of files being indexed. */
-    FILE **files;                /* Possibly null file handles of files being indexed. */
-    FILE *f;                     /* Index file handle. */
-    int fileCount;               /* The number of files being indexed. */
-    int endIx;                   /* Last index. */
-    int maxNameSize;             /* Size allocated for index field in index. */
-    int itemSize;                /* Size of index record. */
-    long headSize;               /* Offset to first index record. */
-    struct fofRecord *rec;       /* Buffer space for one index record. */
-    struct fofRecord *first;     /* First record. */
-    struct fofRecord *last;      /* Last record. */
-    };
-
-
-static void readStringZ(FILE *f, char *s, int maxLen)
-/* Read in a zero terminated string from file. */
-{
-int c;
-int ix;
-maxLen -= 1;    /* room for zero tag. */
-
-for (ix = 0; ix <maxLen; ++ix)
-    {
-    if ((c = fgetc(f)) == EOF)
-        errAbort("Unexpected EOF in readStringZ");
-    if (c == 0)
-        break;
-    s[ix] = c;
-    }
-if (ix == maxLen)
-    errAbort("String too long in readStringZ");
-s[ix] = 0;
-}
-
-
-struct fof *fofOpen(char *fofName, char *fofDir)
-/* Open up the named fof. fofDir may be NULL.  It should include 
- * trailing '/' if non-null. */
-{
-bits32 sig, elCount;
-bits16 fileCount, maxNameSize;
-FILE *f;
-char nameBuf[512];
-char pathBuf[512];
-struct fof *fof;
-int i;
-
-/* Handle directory either being something or NULL, and
- * either ending with a slash or not. */
-if (fofDir == NULL)
-    {
-    fofDir = "";
-    }
-
-/* Open file, verify signature. */
-safef(pathBuf, sizeof(pathBuf), "%s%s", fofDir, fofName);
-f = mustOpen(pathBuf, "rb");
-mustReadOne(f, sig);
-if (sig != fofSig)
-    errAbort("Bad signature on %s", pathBuf);
-mustReadOne(f, elCount);
-
-/* Read size info and allocate basic fof structure. */
-mustReadOne(f, fileCount);
-if (fileCount > 12)
-    warn("%d files indexed in fof %s!?", fileCount, fofName);
-mustReadOne(f, maxNameSize);
-if (maxNameSize > 40)
-    warn("%d maxName size in fof %s!?", maxNameSize, fofName);
-AllocVar(fof);
-fof->name = cloneString(fofName);
-fof->relDir = cloneString(fofDir);
-fof->fileNames = needMem(fileCount * sizeof(fof->fileNames[0]));
-fof->files = needMem(fileCount * sizeof(fof->files[0]));
-fof->f = f;
-fof->fileCount = fileCount;
-fof->endIx = elCount-1;
-fof->maxNameSize = maxNameSize;
-fof->itemSize = sizeof(bits32) +sizeof(bits32) + sizeof(UBYTE) + maxNameSize;
-fof->rec = needMem(sizeof(*fof->rec) + maxNameSize);
-fof->first = needMem(sizeof(*fof->rec) + maxNameSize);
-fof->last = needMem(sizeof(*fof->rec) + maxNameSize);
-
-/* Read in names of files being indexed and figure header size. */
-for (i=0; i<fileCount; ++i)
-    {
-    readStringZ(f, nameBuf, sizeof(nameBuf));
-    safef(pathBuf, sizeof(pathBuf), "%s%s", fofDir, nameBuf);
-    fof->fileNames[i] = cloneString(pathBuf);
-    }
-fof->headSize = ftell(f);
-
-/* Read in first and last records. */
-mustRead(f, fof->first, fof->itemSize);
-fseek(f, fof->headSize + fof->endIx*fof->itemSize, SEEK_SET);
-mustRead(f, fof->last, fof->itemSize);
-
-/* All done (files will be opened as needed, not here). */
-return fof;
-}
-
-
-void fofClose(struct fof **pFof)
-/* Close down the named fof. */
-{
-struct fof *fof = *pFof;
-if (fof != NULL)
-    {
-    int fileCount = fof->fileCount;
-    int i;
-
-    for (i=0; i<fileCount; ++i)
-        {
-        freeMem(fof->fileNames[i]);
-        carefulClose(&fof->files[i]);
-        }
-    freeMem(fof->name);
-    freeMem(fof->fileNames);
-    freeMem(fof->files);
-    freeMem(fof->rec);
-    freeMem(fof->first);
-    freeMem(fof->last);
-    carefulClose(&fof->f);
-    freez(pFof);
-    }
-}
-
-int fofElementCount(struct fof *fof)
-/* How many names are in fof file? */
-{
-return fof->endIx + 1;
-}
-
-static void fofRecToPos(struct fof *fof, int ix, struct fofRecord *rec, struct fofPos *pos)
-/* Convert from record to position, opening file for entry if necessary. */
-{
-int fileIx = rec->fileIx;
-FILE *f;
-
-pos->indexIx = ix;
-pos->offset = rec->offset;
-pos->size = rec->size;
-pos->fileName = fof->fileNames[fileIx];
-if ((f = fof->files[fileIx]) != NULL)
-    {
-    pos->f = f;
-    }
-else
-    {
-    pos->f = fof->files[fileIx] = mustOpen(fof->fileNames[fileIx], "rb");
-    }
-return;
-}
-
-
-static int fofCmp(char *prefix, char *name, int maxSize, boolean isPrefix)
-/* Compare either prefix of whole string to name. */
-{
-if (isPrefix)
-    return memcmp(prefix, name, maxSize);
-else
-    return strcmp(prefix, name);
-}
-
-static boolean fofSearch(struct fof *fof, char *name, int nameSize, 
-    boolean isPrefix, struct fofPos *retPos)
-/* Find index of name by binary search.
- * Returns FALSE if no such name in the index file. */
- {
-struct fofRecord *rec = fof->rec;
-int startIx, endIx, midIx;
-int cmp;
-int itemSize = fof->itemSize;
-FILE *f = fof->f;
-int headSize = fof->headSize;
-
-/* Truncate name size if necessary. */
-if (nameSize > fof->maxNameSize)
-    nameSize = fof->maxNameSize;
-
-/* Set up endpoints of binary search */
-startIx = 0;
-endIx = fof->endIx;
-
-/* Check for degenerate initial case */
-if (fofCmp(name, fof->first->name, nameSize, isPrefix) == 0)
-    {
-    fofRecToPos(fof, startIx, fof->first, retPos);
-    return TRUE;
-    }
-if (fofCmp(name, fof->last->name, nameSize, isPrefix) == 0)
-    {
-    fofRecToPos(fof, endIx, fof->last, retPos);
-    return TRUE;
-    }
-
-/* Do binary search. */
-for (;;)
-    {
-    midIx = (startIx + endIx ) / 2;
-    if (midIx == startIx || midIx == endIx)
-        return FALSE;
-    fseek(f, headSize + midIx*itemSize, SEEK_SET);
-    mustRead(f, rec, itemSize);
-    cmp = fofCmp(name, rec->name, nameSize, isPrefix);
-    if (cmp == 0)
-        {
-        fofRecToPos(fof, midIx, rec, retPos);
-        return TRUE;
-        }
-    else if (cmp > 0)
-	{
-	startIx = midIx;
-	}
-    else
-	{
-	endIx = midIx;
-	}
-    }
-}
-
-boolean fofFindFirst(struct fof *fof, char *prefix, 
-    int prefixSize, struct fofPos *retPos)
-/* Find first element with key starting with prefix. */
-{
-int ix;
-struct fofRecord *rec = fof->rec;
-FILE *f = fof->f;
-int itemSize = fof->itemSize;
-int headSize = fof->headSize;
-
-/* Find some record that starts with prefix. */
-if (!fofSearch(fof, prefix, prefixSize, TRUE, retPos))
-    return FALSE;
-
-/* Backtrack until find one that doesn't start with prefix. */
-ix = retPos->indexIx;
-while (--ix >= 0)
-    {
-    fseek(f, headSize + ix*itemSize, SEEK_SET);
-    mustRead(f, rec, itemSize);
-    if (memcmp(prefix, rec->name, prefixSize) != 0)
-        break;
-    }
-
-/* Return the first record that does start with prefix. */
-++ix;
-fseek(f, headSize + ix*itemSize, SEEK_SET);
-mustRead(f, rec, itemSize);
-fofRecToPos(fof, ix, rec, retPos);
-return TRUE;
-}
-
-
-boolean fofFind(struct fof *fof, char *name, struct fofPos *retPos)
-/* Find element corresponding with name.  Returns FALSE if no such name
- * in the index file. */
-{
-return fofSearch(fof, name, strlen(name), FALSE, retPos);
-}
-
-void *fofFetch(struct fof *fof, char *name, int *retSize)
-/* Lookup element in index, allocate memory for it, and read
- * it.  Returns buffer with element in it, which should be
- * freeMem'd when done. Aborts if element isn't there. */
-{
-struct fofPos pos;
-void *s;
-
-if (!fofFind(fof, name, &pos))
-    errAbort("Couldn't find %s in %s", name, fof->name);
-s = needLargeMem(pos.size);
-fseek(pos.f, pos.offset, SEEK_SET);
-mustRead(pos.f, s, pos.size);
-*retSize = pos.size;
-return s;
-}
-
-char *fofFetchString(struct fof *fof, char *name, int *retSize)
-/* Lookup element in index, allocate memory for it, read it.
- * Returns zero terminated string with element in it, which 
- * should be freeMem'd when done. Aborts if element isn't there. */
-{
-struct fofPos pos;
-char *s;
-
-if (!fofFind(fof, name, &pos))
-    errAbort("Couldn't find %s in %s", name, fof->name);
-s = needLargeMem(pos.size+1);
-fseek(pos.f, pos.offset, SEEK_SET);
-mustRead(pos.f, s, pos.size);
-s[pos.size] = 0;
-*retSize = pos.size;
-return s;
-}
-
-/* ------------------- Batch read ------------------------*/
-static int cmpOnKey(const void *va, const void *vb)
-/* Comparison function for qsort on an array of offset pointers.
- * Sorts on key. */
-{
-const struct fofBatch *a = *((struct fofBatch **)va);
-const struct fofBatch *b = *((struct fofBatch **)vb);
-return strcmp(a->key, b->key);
-}
-
-static int cmpOnFilePos(const void *va, const void *vb)
-/* Comparison function for qsort on an array of offset pointers.
- * Sorts on file then file offset. */
-{
-const struct fofBatch *a = *((struct fofBatch **)va);
-const struct fofBatch *b = *((struct fofBatch **)vb);
-int dif = a->f - b->f;
-if (dif == 0)
-    dif = a->offset - b->offset;
-return dif;
-}
-
-static void elFromRec(struct fof *fof, struct fofRecord *rec, struct fofBatch *el)
-/* Fill in a batch element from record. */
-{
-FILE *ff;
-int fileIx = rec->fileIx;
-if ((ff = fof->files[fileIx]) != NULL)
-    {
-    el->f = ff;
-    }
-else
-    {
-    el->f = fof->files[fileIx] = mustOpen(fof->fileNames[fileIx], "rb");
-    }
-el->offset = rec->offset;
-el->size = rec->size;
-}
-
-struct fofBatch *fofBatchFind(struct fof *fof, struct fofBatch *list)
-/* Look up all of members on list. */
-{
-struct fofBatch *el;
-FILE *f = fof->f;
-struct fofRecord *rec = fof->rec;
-int itemSize = fof->itemSize;
-char *lastKey = "";
-
-slSort(&list, cmpOnKey);
-fseek(f, fof->headSize, SEEK_SET);
-for (el = list; el != NULL; el = el->next)
-    {
-    char *key = el->key;
-    if (sameString(key, lastKey))
-        {
-        elFromRec(fof, rec, el);
-        }
-    else
-        {
-        for (;;)
-            {
-            mustRead(f, rec, itemSize);
-            if (sameString(key, rec->name))
-                {
-                elFromRec(fof, rec, el);
-                lastKey = key;
-                break;
-                }
-            }
-        }
-    }
-slSort(&list, cmpOnFilePos);
-return list;
-}
-
-
-/* ------------------- Write Side ------------------------*/
-
-struct lm *localMem;    /* Local (fast) memory pool. */
-
-struct fofRecList
-/* This holds a list of records for an index file. */
-    {
-    struct fofRecList *next;
-    struct fofRecord rec;
-    };
-
-static int cmpRecList(const void *va, const void *vb)
-/* Comparison function for qsort on an array of offset pointers.
- * Sorts first on name, then on fileIx, then on offset. */
-{
-const struct fofRecList *a = *((struct fofRecList **)va);
-const struct fofRecList *b = *((struct fofRecList **)vb);
-int dif;
-dif = strcmp(a->rec.name, b->rec.name);
-if (dif == 0)
-    {
-    UBYTE ao = a->rec.fileIx;
-    UBYTE bo = b->rec.fileIx;
-    if (ao < bo)
-        dif =  -1;
-    else if (ao > bo)
-        dif = 1;
-    else
-        {
-        bits32 ao = a->rec.offset;
-        bits32 bo = b->rec.offset;
-        if (ao < bo)
-            dif =  -1;
-        else if (ao == bo)
-            dif = 0;
-        else
-            dif = 1;
-        }
-    }
-return dif;
-}
-
-static bits16 maxNameSize;      /* Maximum size we've seen. */
-
-struct fofRecList *newFofRecEl(int fileIx, long offset, long size, char *name, int nameLen)
-/* Create a new offset list element. */
-{
-struct fofRecList *fr;
-
-if (maxNameSize < nameLen)
-    maxNameSize = nameLen;
-fr = lmAlloc(localMem, sizeof(*fr) + nameLen);
-fr->rec.offset = offset;
-fr->rec.size = size;
-fr->rec.fileIx = fileIx;
-memcpy(fr->rec.name, name, nameLen);
-return fr;
-}
-
-void fofMake(char *inFiles[], int inCount, char *outName, 
-    boolean (*readHeader)(FILE *inFile, void *data),
-    boolean (*nextRecord)(FILE *inFile, void *data, char **rName, int *rNameLen), 
-    void *data, boolean dupeOk)
-/* Make an index file
- * Inputs:
- *     inFiles - List of files that you're indexing with header read and verified.
- *     inCount - Size of file list.
- *     outName - name of index file to create
- *     readHeader - function that sets up file to read first record.  May be NULL.
- *     nextRecord - function that reads next record in file you're indexing
- *                  and returns the name of that record.  Returns FALSE at
- *                  end of file.  Can set *rNameLen to zero you want indexer
- *                  to ignore the record. 
- *     data - void pointer passed through to nextRecord.
- *     dupeOk - set to TRUE if you want dupes to not cause squawking
- */
-{
-FILE *out;
-bits32 sig = fofSig;
-bits32 elCount = 0;
-bits16 fileCount = inCount;
-struct fofRecList *recList = NULL, *rl;
-int i, fileIx, itemSize;
-char *lastName = "";
-int maxMod = 10000;
-
-/* Initialize. */
-localMem = lmInit(0);
-maxNameSize = 0;
-
-/* Read in all records and sort by name. */
-for (fileIx = 0; fileIx<inCount; ++fileIx)
-    {
-    char *inName = inFiles[fileIx];
-    FILE *in = mustOpen(inName, "rb");
-    bits32 start, end;
-    char *name;
-    int nameLen;
-    int mod = maxMod;
-
-    printf("Processing %s\n", inName);
-    if (readHeader)
-        readHeader(in, data);
-    start = ftell(in);
-    while (nextRecord(in, data, &name, &nameLen))
-        {
-	if (--mod == 0)
-	    {
-	    putc('.', stdout);
-	    fflush(stdout);
-	    mod = maxMod;
-	    }
-        end = ftell(in);
-        if (nameLen > 0)
-            {
-            rl = newFofRecEl(fileIx, start, end-start, name, nameLen);
-            slAddHead(&recList, rl);
-            }
-        start = end;
-        }
-    fclose(in);
-    printf("\n");
-    }
-
-printf("sorting\n");
-slSort(&recList, cmpRecList);
-
-/* Count up names. */
-if (dupeOk)
-    elCount = slCount(recList);
-else
-    {
-    lastName = "";
-    for (rl = recList; rl != NULL; rl = rl->next)
-        {
-        char *name = rl->rec.name;
-        if (!sameString(name, lastName))
-            {
-            ++elCount;
-            lastName = name;
-            }
-        }
-    }
-
-/* Write out index file. */
-printf("Writing %s\n", outName);
-out = mustOpen(outName, "wb");
-writeOne(out, sig);
-writeOne(out, elCount);
-writeOne(out, fileCount);
-writeOne(out, maxNameSize);
-itemSize = sizeof(bits32) +sizeof(bits32) + sizeof(UBYTE) + maxNameSize;
-for (i=0; i<inCount; ++i)
-    {
-    char *name = inFiles[i];
-    int len = strlen(name)+1;
-    mustWrite(out, name, len);
-    }
-lastName = "";
-for (rl = recList; rl != NULL; rl = rl->next)
-    {
-    if (!dupeOk)
-        {
-        char *name = rl->rec.name;
-        if (sameString(name, lastName))
-            {
-            warn("Duplicate %s only saving first.", name);
-            continue;
-            }
-        else
-            lastName = name;
-        }
-    writeOne(out, rl->rec.offset);
-    writeOne(out, rl->rec.size);
-    writeOne(out, rl->rec.fileIx);
-    mustWrite(out, rl->rec.name, maxNameSize);
-    }
-if (fclose(out) != 0)
-    errnoAbort("fclose failed");
-/* Clean up. */
-lmCleanup(&localMem);
-}
-
diff --git a/gbtools/src/blatSrc/lib/foo b/gbtools/src/blatSrc/lib/foo
deleted file mode 100644
index 09d2ac0..0000000
--- a/gbtools/src/blatSrc/lib/foo
+++ /dev/null
@@ -1,781 +0,0 @@
-6819f30a (kent     2004-07-02 06:23:19 +0000   1) /* axtAffine - do alignment of two (shortish) sequences with
-6819f30a (kent     2004-07-02 06:23:19 +0000   2)  * affine gap scoring, and return the result as an axt. 
-6819f30a (kent     2004-07-02 06:23:19 +0000   3)  * This file is copyright 2000-2004 Jim Kent, but license is hereby
-6819f30a (kent     2004-07-02 06:23:19 +0000   4)  * granted for all use - public, private or commercial. */
-6819f30a (kent     2004-07-02 06:23:19 +0000   5) 
-6819f30a (kent     2004-07-02 06:23:19 +0000   6) #include "common.h"
-6819f30a (kent     2004-07-02 06:23:19 +0000   7) #include "pairHmm.h"
-6819f30a (kent     2004-07-02 06:23:19 +0000   8) #include "axt.h"
-6819f30a (kent     2004-07-02 06:23:19 +0000   9) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  10) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  11) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  12) boolean axtAffineSmallEnough(double querySize, double targetSize)
-6819f30a (kent     2004-07-02 06:23:19 +0000  13) /* Return TRUE if it is reasonable to align sequences of given sizes
-6819f30a (kent     2004-07-02 06:23:19 +0000  14)  * with axtAffine. */
-6819f30a (kent     2004-07-02 06:23:19 +0000  15) {
-bdaa14f5 (Jim Kent 2014-07-17 15:16:25 -0700  16) return targetSize * querySize <= 1.0E9;
-6819f30a (kent     2004-07-02 06:23:19 +0000  17) }
-6819f30a (kent     2004-07-02 06:23:19 +0000  18) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  19) static void affineAlign(char *query, int querySize, 
-6819f30a (kent     2004-07-02 06:23:19 +0000  20) 	char *target, int targetSize, struct axtScoreScheme *ss,
-6819f30a (kent     2004-07-02 06:23:19 +0000  21) 	struct phmmMatrix **retMatrix, struct phmmAliPair **retPairList,
-6819f30a (kent     2004-07-02 06:23:19 +0000  22) 	int *retScore)
-6819f30a (kent     2004-07-02 06:23:19 +0000  23) /* Use dynamic programming to do alignment including affine gap
-6819f30a (kent     2004-07-02 06:23:19 +0000  24)  * scores. */
-6819f30a (kent     2004-07-02 06:23:19 +0000  25) {
-6819f30a (kent     2004-07-02 06:23:19 +0000  26) struct phmmMatrix *a;
-6819f30a (kent     2004-07-02 06:23:19 +0000  27) struct phmmState *hf, *iq, *it;
-6819f30a (kent     2004-07-02 06:23:19 +0000  28) int qIx, tIx, sIx;  /* Query, target, and state indices */
-6819f30a (kent     2004-07-02 06:23:19 +0000  29) int rowOffset, newCellOffset;
-6819f30a (kent     2004-07-02 06:23:19 +0000  30) int bestScore = -0x4fffffff;
-6819f30a (kent     2004-07-02 06:23:19 +0000  31) struct phmmMommy *bestCell = NULL;
-6819f30a (kent     2004-07-02 06:23:19 +0000  32) int matchPair;
-6819f30a (kent     2004-07-02 06:23:19 +0000  33) int gapStart, gapExt;
-6819f30a (kent     2004-07-02 06:23:19 +0000  34) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  35) /* Check that it's not too big. */
-6819f30a (kent     2004-07-02 06:23:19 +0000  36) if (!axtAffineSmallEnough(querySize, targetSize))
-6819f30a (kent     2004-07-02 06:23:19 +0000  37)     errAbort("Can't align %d x %d, too big\n", querySize, targetSize);
-6819f30a (kent     2004-07-02 06:23:19 +0000  38) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  39) gapStart = -ss->gapOpen;
-6819f30a (kent     2004-07-02 06:23:19 +0000  40) gapExt = -ss->gapExtend;
-6819f30a (kent     2004-07-02 06:23:19 +0000  41) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  42) /* Initialize 3 state matrix (match, query insert, target insert). */
-6819f30a (kent     2004-07-02 06:23:19 +0000  43) a = phmmMatrixNew(3, query, querySize, target, targetSize);
-6819f30a (kent     2004-07-02 06:23:19 +0000  44) hf = phmmNameState(a, 0, "match", 'M');
-6819f30a (kent     2004-07-02 06:23:19 +0000  45) iq = phmmNameState(a, 1, "qSlip", 'Q');
-6819f30a (kent     2004-07-02 06:23:19 +0000  46) it = phmmNameState(a, 2, "tSlip", 'T');
-6819f30a (kent     2004-07-02 06:23:19 +0000  47) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  48) for (tIx = 1; tIx < a->tDim; tIx += 1)
-6819f30a (kent     2004-07-02 06:23:19 +0000  49)     {
-6819f30a (kent     2004-07-02 06:23:19 +0000  50)     UBYTE mommy = 0;
-6819f30a (kent     2004-07-02 06:23:19 +0000  51)     int score, tempScore;
-6819f30a (kent     2004-07-02 06:23:19 +0000  52) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  53) /* Macros to make me less mixed up when accessing scores from row arrays.*/
-6819f30a (kent     2004-07-02 06:23:19 +0000  54) #define matchScore lastScores[qIx-1]
-6819f30a (kent     2004-07-02 06:23:19 +0000  55) #define qSlipScore lastScores[qIx]
-6819f30a (kent     2004-07-02 06:23:19 +0000  56) #define tSlipScore scores[qIx-1]
-6819f30a (kent     2004-07-02 06:23:19 +0000  57) #define newScore scores[qIx]
-6819f30a (kent     2004-07-02 06:23:19 +0000  58) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  59) /* Start up state block (with all ways to enter state) */
-6819f30a (kent     2004-07-02 06:23:19 +0000  60) #define startState(state) \
-6819f30a (kent     2004-07-02 06:23:19 +0000  61)    score = 0;
-6819f30a (kent     2004-07-02 06:23:19 +0000  62) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  63) /* Define a transition from state while advancing over both
-6819f30a (kent     2004-07-02 06:23:19 +0000  64)  * target and query. */
-6819f30a (kent     2004-07-02 06:23:19 +0000  65) #define matchState(state, addScore) \
-6819f30a (kent     2004-07-02 06:23:19 +0000  66)    { \
-6819f30a (kent     2004-07-02 06:23:19 +0000  67)    if ((tempScore = state->matchScore + addScore) > score) \
-6819f30a (kent     2004-07-02 06:23:19 +0000  68)         { \
-6819f30a (kent     2004-07-02 06:23:19 +0000  69)         mommy = phmmPackMommy(state->stateIx, -1, -1); \
-6819f30a (kent     2004-07-02 06:23:19 +0000  70)         score = tempScore; \
-6819f30a (kent     2004-07-02 06:23:19 +0000  71)         } \
-6819f30a (kent     2004-07-02 06:23:19 +0000  72)    } 
-6819f30a (kent     2004-07-02 06:23:19 +0000  73) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  74) /* Define a transition from state while slipping query
-6819f30a (kent     2004-07-02 06:23:19 +0000  75)  * and advancing target. */
-6819f30a (kent     2004-07-02 06:23:19 +0000  76) #define qSlipState(state, addScore) \
-6819f30a (kent     2004-07-02 06:23:19 +0000  77)    { \
-6819f30a (kent     2004-07-02 06:23:19 +0000  78)    if ((tempScore = state->qSlipScore + addScore) > score) \
-6819f30a (kent     2004-07-02 06:23:19 +0000  79)         { \
-6819f30a (kent     2004-07-02 06:23:19 +0000  80)         mommy = phmmPackMommy(state->stateIx, 0, -1); \
-6819f30a (kent     2004-07-02 06:23:19 +0000  81)         score = tempScore; \
-6819f30a (kent     2004-07-02 06:23:19 +0000  82)         } \
-6819f30a (kent     2004-07-02 06:23:19 +0000  83)    }
-6819f30a (kent     2004-07-02 06:23:19 +0000  84) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  85) /* Define a transition from state while slipping target
-6819f30a (kent     2004-07-02 06:23:19 +0000  86)  * and advancing query. */
-6819f30a (kent     2004-07-02 06:23:19 +0000  87) #define tSlipState(state, addScore) \
-6819f30a (kent     2004-07-02 06:23:19 +0000  88)    { \
-6819f30a (kent     2004-07-02 06:23:19 +0000  89)    if ((tempScore = state->tSlipScore + addScore) > score) \
-6819f30a (kent     2004-07-02 06:23:19 +0000  90)         { \
-6819f30a (kent     2004-07-02 06:23:19 +0000  91)         mommy = phmmPackMommy(state->stateIx, -1, 0); \
-6819f30a (kent     2004-07-02 06:23:19 +0000  92)         score = tempScore; \
-6819f30a (kent     2004-07-02 06:23:19 +0000  93)         } \
-6819f30a (kent     2004-07-02 06:23:19 +0000  94)    }
-6819f30a (kent     2004-07-02 06:23:19 +0000  95) 
-6819f30a (kent     2004-07-02 06:23:19 +0000  96) /* End a block of transitions into state. */
-6819f30a (kent     2004-07-02 06:23:19 +0000  97) #define endState(state) \
-6819f30a (kent     2004-07-02 06:23:19 +0000  98)     { \
-6819f30a (kent     2004-07-02 06:23:19 +0000  99)     struct phmmMommy *newCell = state->cells + newCellOffset; \
-6819f30a (kent     2004-07-02 06:23:19 +0000 100)     if (score <= 0) \
-6819f30a (kent     2004-07-02 06:23:19 +0000 101)         { \
-6819f30a (kent     2004-07-02 06:23:19 +0000 102)         mommy = phmmNullMommy; \
-6819f30a (kent     2004-07-02 06:23:19 +0000 103)         score = 0; \
-6819f30a (kent     2004-07-02 06:23:19 +0000 104)         } \
-6819f30a (kent     2004-07-02 06:23:19 +0000 105)     newCell->mommy = mommy; \
-6819f30a (kent     2004-07-02 06:23:19 +0000 106)     state->newScore = score; \
-6819f30a (kent     2004-07-02 06:23:19 +0000 107)     if (score > bestScore) \
-6819f30a (kent     2004-07-02 06:23:19 +0000 108)         { \
-6819f30a (kent     2004-07-02 06:23:19 +0000 109)         bestScore = score; \
-6819f30a (kent     2004-07-02 06:23:19 +0000 110)         bestCell = newCell; \
-6819f30a (kent     2004-07-02 06:23:19 +0000 111)         } \
-6819f30a (kent     2004-07-02 06:23:19 +0000 112)     } 
-6819f30a (kent     2004-07-02 06:23:19 +0000 113) 
-6819f30a (kent     2004-07-02 06:23:19 +0000 114) /* End a state that you know won't produce an optimal
-6819f30a (kent     2004-07-02 06:23:19 +0000 115)  * final score. */
-6819f30a (kent     2004-07-02 06:23:19 +0000 116) #define shortEndState(state) \
-6819f30a (kent     2004-07-02 06:23:19 +0000 117)     { \
-6819f30a (kent     2004-07-02 06:23:19 +0000 118)     struct phmmMommy *newCell = state->cells + newCellOffset; \
-6819f30a (kent     2004-07-02 06:23:19 +0000 119)     if (score <= 0) \
-6819f30a (kent     2004-07-02 06:23:19 +0000 120)         { \
-6819f30a (kent     2004-07-02 06:23:19 +0000 121)         mommy = phmmNullMommy; \
-6819f30a (kent     2004-07-02 06:23:19 +0000 122)         score = 0; \
-6819f30a (kent     2004-07-02 06:23:19 +0000 123)         } \
-6819f30a (kent     2004-07-02 06:23:19 +0000 124)     newCell->mommy = mommy; \
-6819f30a (kent     2004-07-02 06:23:19 +0000 125)     state->newScore = score; \
-6819f30a (kent     2004-07-02 06:23:19 +0000 126)     }
-6819f30a (kent     2004-07-02 06:23:19 +0000 127) 
-6819f30a (kent     2004-07-02 06:23:19 +0000 128) 
-6819f30a (kent     2004-07-02 06:23:19 +0000 129)     rowOffset = tIx*a->qDim;
-6819f30a (kent     2004-07-02 06:23:19 +0000 130)     for (qIx = 1; qIx < a->qDim; qIx += 1)
-6819f30a (kent     2004-07-02 06:23:19 +0000 131)         {
-6819f30a (kent     2004-07-02 06:23:19 +0000 132)         newCellOffset = rowOffset + qIx;
-6819f30a (kent     2004-07-02 06:23:19 +0000 133)         
-6819f30a (kent     2004-07-02 06:23:19 +0000 134)         /* Figure the cost or bonus for pairing target and query residue here. */
-051436e7 (markd    2005-04-10 14:41:26 +0000 135)         matchPair = ss->matrix[(int)a->query[qIx-1]][(int)a->target[tIx-1]];
-6819f30a (kent     2004-07-02 06:23:19 +0000 136) 
-6819f30a (kent     2004-07-02 06:23:19 +0000 137)         /* Update hiFi space. */
-6819f30a (kent     2004-07-02 06:23:19 +0000 138)             {
-6819f30a (kent     2004-07-02 06:23:19 +0000 139)             startState(hf);
-6819f30a (kent     2004-07-02 06:23:19 +0000 140)             matchState(hf, matchPair);
-6819f30a (kent     2004-07-02 06:23:19 +0000 141)             matchState(iq, matchPair);
-6819f30a (kent     2004-07-02 06:23:19 +0000 142)             matchState(it, matchPair);
-6819f30a (kent     2004-07-02 06:23:19 +0000 143)             endState(hf);
-6819f30a (kent     2004-07-02 06:23:19 +0000 144)             }
-6819f30a (kent     2004-07-02 06:23:19 +0000 145) 
-6819f30a (kent     2004-07-02 06:23:19 +0000 146)         /* Update query slip space. */
-6819f30a (kent     2004-07-02 06:23:19 +0000 147)             {
-6819f30a (kent     2004-07-02 06:23:19 +0000 148)             startState(iq);
-6819f30a (kent     2004-07-02 06:23:19 +0000 149)             qSlipState(iq, gapExt);
-6819f30a (kent     2004-07-02 06:23:19 +0000 150)             qSlipState(hf, gapStart);            
-6819f30a (kent     2004-07-02 06:23:19 +0000 151) 	    qSlipState(it, gapStart);	/* Allow double gaps, T first always. */
-6819f30a (kent     2004-07-02 06:23:19 +0000 152)             shortEndState(iq);
-6819f30a (kent     2004-07-02 06:23:19 +0000 153)             }
-6819f30a (kent     2004-07-02 06:23:19 +0000 154)         
-6819f30a (kent     2004-07-02 06:23:19 +0000 155)         /* Update target slip space. */
-6819f30a (kent     2004-07-02 06:23:19 +0000 156)             {
-6819f30a (kent     2004-07-02 06:23:19 +0000 157)             startState(it);
-6819f30a (kent     2004-07-02 06:23:19 +0000 158)             tSlipState(it, gapExt);
-6819f30a (kent     2004-07-02 06:23:19 +0000 159)             tSlipState(hf, gapStart);            
-6819f30a (kent     2004-07-02 06:23:19 +0000 160)             shortEndState(it);
-6819f30a (kent     2004-07-02 06:23:19 +0000 161)             }
-6819f30a (kent     2004-07-02 06:23:19 +0000 162) 
-6819f30a (kent     2004-07-02 06:23:19 +0000 163)         }
-6819f30a (kent     2004-07-02 06:23:19 +0000 164)     /* Swap score columns so current becomes last, and last gets
-6819f30a (kent     2004-07-02 06:23:19 +0000 165)      * reused. */
-6819f30a (kent     2004-07-02 06:23:19 +0000 166)     for (sIx = 0; sIx < a->stateCount; ++sIx)
-6819f30a (kent     2004-07-02 06:23:19 +0000 167)         {
-6819f30a (kent     2004-07-02 06:23:19 +0000 168)         struct phmmState *as = &a->states[sIx];
-6819f30a (kent     2004-07-02 06:23:19 +0000 169)         int *swapTemp = as->lastScores;
-6819f30a (kent     2004-07-02 06:23:19 +0000 170)         as->lastScores = as->scores;
-6819f30a (kent     2004-07-02 06:23:19 +0000 171)         as->scores = swapTemp;
-6819f30a (kent     2004-07-02 06:23:19 +0000 172)         }
-6819f30a (kent     2004-07-02 06:23:19 +0000 173)     }
-6819f30a (kent     2004-07-02 06:23:19 +0000 174) 
-6819f30a (kent     2004-07-02 06:23:19 +0000 175) /* Trace back from best scoring cell. */
-6819f30a (kent     2004-07-02 06:23:19 +0000 176) *retPairList = phmmTraceBack(a, bestCell);
-6819f30a (kent     2004-07-02 06:23:19 +0000 177) *retMatrix = a;
-6819f30a (kent     2004-07-02 06:23:19 +0000 178) *retScore = bestScore;
-6819f30a (kent     2004-07-02 06:23:19 +0000 179) 
-6819f30a (kent     2004-07-02 06:23:19 +0000 180) #undef matchScore
-6819f30a (kent     2004-07-02 06:23:19 +0000 181) #undef qSlipScore
-6819f30a (kent     2004-07-02 06:23:19 +0000 182) #undef tSlipScore
-6819f30a (kent     2004-07-02 06:23:19 +0000 183) #undef newScore
-6819f30a (kent     2004-07-02 06:23:19 +0000 184) #undef startState
-6819f30a (kent     2004-07-02 06:23:19 +0000 185) #undef matchState
-6819f30a (kent     2004-07-02 06:23:19 +0000 186) #undef qSlipState
-6819f30a (kent     2004-07-02 06:23:19 +0000 187) #undef tSlipState
-6819f30a (kent     2004-07-02 06:23:19 +0000 188) #undef shortEndState
-6819f30a (kent     2004-07-02 06:23:19 +0000 189) #undef endState
-6819f30a (kent     2004-07-02 06:23:19 +0000 190) }
-6819f30a (kent     2004-07-02 06:23:19 +0000 191) 
-6819f30a (kent     2004-07-02 06:23:19 +0000 192) struct axt *axtAffine(bioSeq *query, bioSeq *target, struct axtScoreScheme *ss)
-6819f30a (kent     2004-07-02 06:23:19 +0000 193) /* Return alignment if any of query and target using scoring scheme. */
-6819f30a (kent     2004-07-02 06:23:19 +0000 194) {
-6819f30a (kent     2004-07-02 06:23:19 +0000 195) struct axt *axt;
-6819f30a (kent     2004-07-02 06:23:19 +0000 196) int score;
-6819f30a (kent     2004-07-02 06:23:19 +0000 197) struct phmmMatrix *matrix;
-6819f30a (kent     2004-07-02 06:23:19 +0000 198) struct phmmAliPair *pairList;
-6819f30a (kent     2004-07-02 06:23:19 +0000 199) 
-6819f30a (kent     2004-07-02 06:23:19 +0000 200) affineAlign(query->dna, query->size, target->dna, target->size, ss,
-6819f30a (kent     2004-07-02 06:23:19 +0000 201) 	&matrix, &pairList, &score);
-6819f30a (kent     2004-07-02 06:23:19 +0000 202) axt = phhmTraceToAxt(matrix, pairList, score, query->name, target->name);
-6819f30a (kent     2004-07-02 06:23:19 +0000 203) phmmMatrixFree(&matrix);
-6819f30a (kent     2004-07-02 06:23:19 +0000 204) slFreeList(&pairList);
-6819f30a (kent     2004-07-02 06:23:19 +0000 205) return axt;
-6819f30a (kent     2004-07-02 06:23:19 +0000 206) }
-6819f30a (kent     2004-07-02 06:23:19 +0000 207) 
-810304ec (galt     2004-12-08 20:53:07 +0000 208) 
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 209) /* ----- axtAffine2Level begins ----- 
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 210) 
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 211)  Written by Galt Barber, December 2004
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 212)  I wrote this on my own time and am donating this
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 213)  to the public domain.  The original concept 
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 214)  was Don Speck's, as described by Kevin Karplus.
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 215) 
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 216)  @article{Grice97,
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 217)      author = "J. A. Grice and R. Hughey and D. Speck",
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 218)      title = "Reduced space sequence alignment",
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 219)      journal = cabios,
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 220)      volume=13,
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 221)      number=1,
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 222)      year=1997,
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 223)      month=feb,
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 224)      pages="45-53"
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 225)      }
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 226) 								 
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 227) 
-b6f18c16 (galt     2005-01-06 20:12:26 +0000 228) */
-810304ec (galt     2004-12-08 20:53:07 +0000 229) 
-810304ec (galt     2004-12-08 20:53:07 +0000 230) #define WORST 0xC0000000 /* WORST Score approx neg. inf. 0x80000000 overflowed, reduced by half */
-810304ec (galt     2004-12-08 20:53:07 +0000 231) 
-810304ec (galt     2004-12-08 20:53:07 +0000 232) 
-810304ec (galt     2004-12-08 20:53:07 +0000 233) /* m d i notation: match, delete, insert in query */
-810304ec (galt     2004-12-08 20:53:07 +0000 234) 
-810304ec (galt     2004-12-08 20:53:07 +0000 235) struct cell2L 
-810304ec (galt     2004-12-08 20:53:07 +0000 236) {
-810304ec (galt     2004-12-08 20:53:07 +0000 237) int  bestm;   /* best score array */
-810304ec (galt     2004-12-08 20:53:07 +0000 238) int  bestd;                         
-810304ec (galt     2004-12-08 20:53:07 +0000 239) int  besti;                          
-810304ec (galt     2004-12-08 20:53:07 +0000 240) char backm;   /* back trace array */
-810304ec (galt     2004-12-08 20:53:07 +0000 241) char backd;                         
-810304ec (galt     2004-12-08 20:53:07 +0000 242) char backi;                          
-810304ec (galt     2004-12-08 20:53:07 +0000 243) };
-810304ec (galt     2004-12-08 20:53:07 +0000 244) 
-810304ec (galt     2004-12-08 20:53:07 +0000 245) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 246) void dump2L(struct cell2L* c)
-810304ec (galt     2004-12-08 20:53:07 +0000 247) /* print matrix cell for debugging 
-810304ec (galt     2004-12-08 20:53:07 +0000 248)    I redirect output to a file 
-810304ec (galt     2004-12-08 20:53:07 +0000 249)    and look at it with a web browser
-810304ec (galt     2004-12-08 20:53:07 +0000 250)    to see the long lines
-810304ec (galt     2004-12-08 20:53:07 +0000 251) */
-810304ec (galt     2004-12-08 20:53:07 +0000 252) {
-810304ec (galt     2004-12-08 20:53:07 +0000 253)     printf("%04d%c %04d%c %04d%c   ",
-810304ec (galt     2004-12-08 20:53:07 +0000 254)      c->bestd, c->backd,
-810304ec (galt     2004-12-08 20:53:07 +0000 255)      c->bestm, c->backm,
-810304ec (galt     2004-12-08 20:53:07 +0000 256)      c->besti, c->backi
-810304ec (galt     2004-12-08 20:53:07 +0000 257)      );
-810304ec (galt     2004-12-08 20:53:07 +0000 258) }     
-810304ec (galt     2004-12-08 20:53:07 +0000 259) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 260) 
-810304ec (galt     2004-12-08 20:53:07 +0000 261) void kForwardAffine(
-810304ec (galt     2004-12-08 20:53:07 +0000 262) struct cell2L *cells,  /* dyn prg arr cells */
-810304ec (galt     2004-12-08 20:53:07 +0000 263) int row,      /* starting row base */
-810304ec (galt     2004-12-08 20:53:07 +0000 264) int rowmax,   /* ending row */
-810304ec (galt     2004-12-08 20:53:07 +0000 265) int rdelta,   /* convert between real targ seq row and logical row */                             
-810304ec (galt     2004-12-08 20:53:07 +0000 266) int cmost,    /* track right edge, shrink as traces back */
-810304ec (galt     2004-12-08 20:53:07 +0000 267) int lv,       /* width of array including sentinel col 0 */ 
-810304ec (galt     2004-12-08 20:53:07 +0000 268) char *q,      /* query and target seqs */
-810304ec (galt     2004-12-08 20:53:07 +0000 269) char *t,
-810304ec (galt     2004-12-08 20:53:07 +0000 270) struct axtScoreScheme *ss,  /* score scheme passed in */
-810304ec (galt     2004-12-08 20:53:07 +0000 271) int *bestbestOut,  /* return best overall found, and it's row and col */
-810304ec (galt     2004-12-08 20:53:07 +0000 272) int *bestrOut,
-810304ec (galt     2004-12-08 20:53:07 +0000 273) int *bestcOut,
-810304ec (galt     2004-12-08 20:53:07 +0000 274) char *bestdirOut
-810304ec (galt     2004-12-08 20:53:07 +0000 275) )
-810304ec (galt     2004-12-08 20:53:07 +0000 276) /*
-810304ec (galt     2004-12-08 20:53:07 +0000 277) Calculates filling dynprg mtx forward.
-810304ec (galt     2004-12-08 20:53:07 +0000 278)  Called 3 times from affine2Level.
-810304ec (galt     2004-12-08 20:53:07 +0000 279) 
-810304ec (galt     2004-12-08 20:53:07 +0000 280) row is offset into the actual best and back arrays,
-810304ec (galt     2004-12-08 20:53:07 +0000 281)  so rdelta serves as a conversion between
-810304ec (galt     2004-12-08 20:53:07 +0000 282)  the real target seq row and the logical row
-810304ec (galt     2004-12-08 20:53:07 +0000 283)  used in best and back arrays.
-810304ec (galt     2004-12-08 20:53:07 +0000 284) 
-810304ec (galt     2004-12-08 20:53:07 +0000 285) cmost is a column limiter that lets us avoid
-810304ec (galt     2004-12-08 20:53:07 +0000 286)  unused areas of the array when doing the
-810304ec (galt     2004-12-08 20:53:07 +0000 287)  backtrace 2nd pass. This can be an average
-810304ec (galt     2004-12-08 20:53:07 +0000 288)  of half of the total array saved.
-810304ec (galt     2004-12-08 20:53:07 +0000 289) 
-810304ec (galt     2004-12-08 20:53:07 +0000 290) */
-810304ec (galt     2004-12-08 20:53:07 +0000 291) {
-810304ec (galt     2004-12-08 20:53:07 +0000 292) int r=0, rr=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 293) int gapOpen  =ss->gapOpen;    
-810304ec (galt     2004-12-08 20:53:07 +0000 294) int gapExtend=ss->gapExtend;  
-810304ec (galt     2004-12-08 20:53:07 +0000 295) int doubleGap=ss->gapExtend;  // this can be gapOpen or gapExtend, or custom ?
-810304ec (galt     2004-12-08 20:53:07 +0000 296) struct cell2L *cellp,*cellc;  /* current and previous row base */
-810304ec (galt     2004-12-08 20:53:07 +0000 297) struct cell2L *u,*d,*l,*s;    /* up,diag,left,self pointers to hopefully speed things up */
-810304ec (galt     2004-12-08 20:53:07 +0000 298) int c=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 299) int bestbest = *bestbestOut; /* make local copy of best best */
-810304ec (galt     2004-12-08 20:53:07 +0000 300) cellc = cells+(row-1)*lv;     /* start it off one row back coming into loop */
-810304ec (galt     2004-12-08 20:53:07 +0000 301) 
-810304ec (galt     2004-12-08 20:53:07 +0000 302) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 303) for(c=0;c<=cmost;c++) /* show prev row */
-810304ec (galt     2004-12-08 20:53:07 +0000 304)     { dump2L(cellc+c); }
-810304ec (galt     2004-12-08 20:53:07 +0000 305) printf("\n");
-810304ec (galt     2004-12-08 20:53:07 +0000 306) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 307) 
-810304ec (galt     2004-12-08 20:53:07 +0000 308) for(r=row; r<=rowmax; r++)
-810304ec (galt     2004-12-08 20:53:07 +0000 309)     {
-810304ec (galt     2004-12-08 20:53:07 +0000 310)     cellp = cellc;
-810304ec (galt     2004-12-08 20:53:07 +0000 311)     cellc += lv;    /* initialize pointers to curr and prev rows */
-810304ec (galt     2004-12-08 20:53:07 +0000 312)     
-810304ec (galt     2004-12-08 20:53:07 +0000 313)     rr = r+rdelta;
-810304ec (galt     2004-12-08 20:53:07 +0000 314) 
-810304ec (galt     2004-12-08 20:53:07 +0000 315)     d = cellp;   /* diag is prev row, prev col */
-810304ec (galt     2004-12-08 20:53:07 +0000 316)     l = cellc;   /* left is curr row, prev col */
-810304ec (galt     2004-12-08 20:53:07 +0000 317)     u = d+1;     /*   up is prev row, curr col */
-810304ec (galt     2004-12-08 20:53:07 +0000 318)     s = l+1;     /* self is curr row, curr col */
-810304ec (galt     2004-12-08 20:53:07 +0000 319)     
-810304ec (galt     2004-12-08 20:53:07 +0000 320)     /* handle col 0 sentinel as a delete */
-810304ec (galt     2004-12-08 20:53:07 +0000 321)     l->bestm=WORST; 
-810304ec (galt     2004-12-08 20:53:07 +0000 322)     l->bestd=d->bestd-gapExtend;
-810304ec (galt     2004-12-08 20:53:07 +0000 323)     l->besti=WORST;                 
-810304ec (galt     2004-12-08 20:53:07 +0000 324)     l->backm='x';
-810304ec (galt     2004-12-08 20:53:07 +0000 325)     l->backd='d';
-810304ec (galt     2004-12-08 20:53:07 +0000 326)     l->backi='x';
-810304ec (galt     2004-12-08 20:53:07 +0000 327)     if (rr==1)    /* special case row 1 col 0 */
-810304ec (galt     2004-12-08 20:53:07 +0000 328) 	{
-810304ec (galt     2004-12-08 20:53:07 +0000 329) 	l->bestd=-gapOpen;
-810304ec (galt     2004-12-08 20:53:07 +0000 330) 	l->backd='m';
-810304ec (galt     2004-12-08 20:53:07 +0000 331) 	}
-810304ec (galt     2004-12-08 20:53:07 +0000 332) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 333)     dump2L(cellc); 
-810304ec (galt     2004-12-08 20:53:07 +0000 334) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 335)     
-810304ec (galt     2004-12-08 20:53:07 +0000 336)     for(c=1; c<=cmost; c++)
-810304ec (galt     2004-12-08 20:53:07 +0000 337) 	{
-810304ec (galt     2004-12-08 20:53:07 +0000 338) 
-810304ec (galt     2004-12-08 20:53:07 +0000 339) 	int best=WORST;
-810304ec (galt     2004-12-08 20:53:07 +0000 340) 	int try  =WORST;
-810304ec (galt     2004-12-08 20:53:07 +0000 341) 	char dir=' ';
-810304ec (galt     2004-12-08 20:53:07 +0000 342) 	/* note: is matrix symmetrical? if not we could have dim 1 and 2 backwards */
-810304ec (galt     2004-12-08 20:53:07 +0000 343) 	int subst = ss->matrix[(int)q[c-1]][(int)t[rr-1]];  /* score for pairing target and query. */
-810304ec (galt     2004-12-08 20:53:07 +0000 344) 
-810304ec (galt     2004-12-08 20:53:07 +0000 345) 	/* find best M match query and target */
-810304ec (galt     2004-12-08 20:53:07 +0000 346) 	best=WORST;
-810304ec (galt     2004-12-08 20:53:07 +0000 347) 	try=d->bestd;    
-810304ec (galt     2004-12-08 20:53:07 +0000 348) 	if (try > best)
-810304ec (galt     2004-12-08 20:53:07 +0000 349) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 350) 	    best=try;
-810304ec (galt     2004-12-08 20:53:07 +0000 351) 	    dir='d';
-810304ec (galt     2004-12-08 20:53:07 +0000 352) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 353) 	try=d->bestm;   
-810304ec (galt     2004-12-08 20:53:07 +0000 354) 	if (try > best)
-810304ec (galt     2004-12-08 20:53:07 +0000 355) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 356) 	    best=try;
-810304ec (galt     2004-12-08 20:53:07 +0000 357) 	    dir='m';
-810304ec (galt     2004-12-08 20:53:07 +0000 358) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 359) 	try=d->besti;   
-810304ec (galt     2004-12-08 20:53:07 +0000 360) 	if (try > best)
-810304ec (galt     2004-12-08 20:53:07 +0000 361) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 362) 	    best=try;
-810304ec (galt     2004-12-08 20:53:07 +0000 363) 	    dir='i';
-810304ec (galt     2004-12-08 20:53:07 +0000 364) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 365) 	try=0;                   /* local ali can start anywhere */
-810304ec (galt     2004-12-08 20:53:07 +0000 366) 	if (try > best)
-810304ec (galt     2004-12-08 20:53:07 +0000 367) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 368) 	    best=try;
-810304ec (galt     2004-12-08 20:53:07 +0000 369) 	    dir='s';         
-810304ec (galt     2004-12-08 20:53:07 +0000 370) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 371) 	best += subst;
-810304ec (galt     2004-12-08 20:53:07 +0000 372) 	s->bestm = best;
-810304ec (galt     2004-12-08 20:53:07 +0000 373) 	s->backm = dir;
-810304ec (galt     2004-12-08 20:53:07 +0000 374) 	if (best > bestbest)
-810304ec (galt     2004-12-08 20:53:07 +0000 375) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 376) 	    bestbest=best;
-810304ec (galt     2004-12-08 20:53:07 +0000 377) 	    *bestbestOut=best;
-810304ec (galt     2004-12-08 20:53:07 +0000 378) 	    *bestrOut=rr;
-810304ec (galt     2004-12-08 20:53:07 +0000 379) 	    *bestcOut=c;
-810304ec (galt     2004-12-08 20:53:07 +0000 380) 	    *bestdirOut=dir;
-810304ec (galt     2004-12-08 20:53:07 +0000 381) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 382) 
-810304ec (galt     2004-12-08 20:53:07 +0000 383) 	/* find best D delete in query */
-810304ec (galt     2004-12-08 20:53:07 +0000 384) 	best=WORST;
-810304ec (galt     2004-12-08 20:53:07 +0000 385) 	try=u->bestd - gapExtend;
-810304ec (galt     2004-12-08 20:53:07 +0000 386) 	if (try > best)
-810304ec (galt     2004-12-08 20:53:07 +0000 387) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 388) 	    best=try;
-810304ec (galt     2004-12-08 20:53:07 +0000 389) 	    dir='d';
-810304ec (galt     2004-12-08 20:53:07 +0000 390) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 391) 	try=u->bestm - gapOpen;    
-810304ec (galt     2004-12-08 20:53:07 +0000 392) 	if (try > best)
-810304ec (galt     2004-12-08 20:53:07 +0000 393) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 394) 	    best=try;
-810304ec (galt     2004-12-08 20:53:07 +0000 395) 	    dir='m';
-810304ec (galt     2004-12-08 20:53:07 +0000 396) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 397) 	try=u->besti - doubleGap;    
-810304ec (galt     2004-12-08 20:53:07 +0000 398) 	if (try > best)
-810304ec (galt     2004-12-08 20:53:07 +0000 399) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 400) 	    best=try;
-810304ec (galt     2004-12-08 20:53:07 +0000 401) 	    dir='i';
-810304ec (galt     2004-12-08 20:53:07 +0000 402) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 403) 	s->bestd = best;
-810304ec (galt     2004-12-08 20:53:07 +0000 404) 	s->backd = dir;
-810304ec (galt     2004-12-08 20:53:07 +0000 405) 	if (best > bestbest)
-810304ec (galt     2004-12-08 20:53:07 +0000 406) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 407) 	    bestbest=best;
-810304ec (galt     2004-12-08 20:53:07 +0000 408) 	    *bestbestOut=best;
-810304ec (galt     2004-12-08 20:53:07 +0000 409) 	    *bestrOut=rr;
-810304ec (galt     2004-12-08 20:53:07 +0000 410) 	    *bestcOut=c;
-810304ec (galt     2004-12-08 20:53:07 +0000 411) 	    *bestdirOut=dir;
-810304ec (galt     2004-12-08 20:53:07 +0000 412) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 413) 
-810304ec (galt     2004-12-08 20:53:07 +0000 414) 	/* find best I insert in query */
-810304ec (galt     2004-12-08 20:53:07 +0000 415) 	best=WORST;
-810304ec (galt     2004-12-08 20:53:07 +0000 416) 	try=l->bestd - doubleGap;
-810304ec (galt     2004-12-08 20:53:07 +0000 417) 	if (try > best)
-810304ec (galt     2004-12-08 20:53:07 +0000 418) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 419) 	    best=try;
-810304ec (galt     2004-12-08 20:53:07 +0000 420) 	    dir='d';
-810304ec (galt     2004-12-08 20:53:07 +0000 421) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 422) 	try=l->bestm - gapOpen;    
-810304ec (galt     2004-12-08 20:53:07 +0000 423) 	if (try > best)
-810304ec (galt     2004-12-08 20:53:07 +0000 424) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 425) 	    best=try;
-810304ec (galt     2004-12-08 20:53:07 +0000 426) 	    dir='m';
-810304ec (galt     2004-12-08 20:53:07 +0000 427) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 428) 	try=l->besti - gapExtend;    
-810304ec (galt     2004-12-08 20:53:07 +0000 429) 	if (try > best)
-810304ec (galt     2004-12-08 20:53:07 +0000 430) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 431) 	    best=try;
-810304ec (galt     2004-12-08 20:53:07 +0000 432) 	    dir='i';
-810304ec (galt     2004-12-08 20:53:07 +0000 433) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 434) 	s->besti = best;
-810304ec (galt     2004-12-08 20:53:07 +0000 435) 	s->backi = dir;
-810304ec (galt     2004-12-08 20:53:07 +0000 436) 	if (best > bestbest)
-810304ec (galt     2004-12-08 20:53:07 +0000 437) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 438) 	    bestbest=best;
-810304ec (galt     2004-12-08 20:53:07 +0000 439) 	    *bestbestOut=best;
-810304ec (galt     2004-12-08 20:53:07 +0000 440) 	    *bestrOut=rr;
-810304ec (galt     2004-12-08 20:53:07 +0000 441) 	    *bestcOut=c;
-810304ec (galt     2004-12-08 20:53:07 +0000 442) 	    *bestdirOut=dir;
-810304ec (galt     2004-12-08 20:53:07 +0000 443) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 444) 
-810304ec (galt     2004-12-08 20:53:07 +0000 445) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 446)     dump2L(cellc+c); 
-810304ec (galt     2004-12-08 20:53:07 +0000 447) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 448) 
-810304ec (galt     2004-12-08 20:53:07 +0000 449) 	d++;l++;u++;s++;
-810304ec (galt     2004-12-08 20:53:07 +0000 450) 
-810304ec (galt     2004-12-08 20:53:07 +0000 451) 	}
-810304ec (galt     2004-12-08 20:53:07 +0000 452) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 453) printf("\n");
-810304ec (galt     2004-12-08 20:53:07 +0000 454) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 455)   
-810304ec (galt     2004-12-08 20:53:07 +0000 456)     }
-810304ec (galt     2004-12-08 20:53:07 +0000 457) } 
-810304ec (galt     2004-12-08 20:53:07 +0000 458) 
-810304ec (galt     2004-12-08 20:53:07 +0000 459) 
-810304ec (galt     2004-12-08 20:53:07 +0000 460) 
-810304ec (galt     2004-12-08 20:53:07 +0000 461) struct axt *axtAffine2Level(bioSeq *query, bioSeq *target, struct axtScoreScheme *ss)
-810304ec (galt     2004-12-08 20:53:07 +0000 462) /* 
-810304ec (galt     2004-12-08 20:53:07 +0000 463) 
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 464)    (Moving boundary version, allows target T size twice as large in same ram)
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 465) 
-810304ec (galt     2004-12-08 20:53:07 +0000 466)    Return alignment if any of query and target using scoring scheme. 
-810304ec (galt     2004-12-08 20:53:07 +0000 467)    
-810304ec (galt     2004-12-08 20:53:07 +0000 468)    2Level uses an economical amount of ram and should work for large target sequences.
-810304ec (galt     2004-12-08 20:53:07 +0000 469)    
-810304ec (galt     2004-12-08 20:53:07 +0000 470)    If Q is query size and T is target size and M is memory size, then
-810304ec (galt     2004-12-08 20:53:07 +0000 471)    Total memory used M = 30*Q*sqrt(T).  When the target is much larger than the query
-810304ec (galt     2004-12-08 20:53:07 +0000 472)    this method saves ram, and average runtime is only 50% greater, or 1.5 QT.  
-810304ec (galt     2004-12-08 20:53:07 +0000 473)    If Q=5000 and T=245,522,847 for hg17 chr1, then M = 2.2 GB ram.  
-810304ec (galt     2004-12-08 20:53:07 +0000 474)    axtAffine would need M=3QT = 3.4 TB.
-810304ec (galt     2004-12-08 20:53:07 +0000 475)    Of course massive alignments will be painfully slow anyway.
-810304ec (galt     2004-12-08 20:53:07 +0000 476) 
-810304ec (galt     2004-12-08 20:53:07 +0000 477)    Works for protein as well as DNA given the correct scoreScheme.
-810304ec (galt     2004-12-08 20:53:07 +0000 478)   
-810304ec (galt     2004-12-08 20:53:07 +0000 479)    NOTES:
-810304ec (galt     2004-12-08 20:53:07 +0000 480)    Double-gap cost is equal to gap-extend cost, but gap-open would also work.
-810304ec (galt     2004-12-08 20:53:07 +0000 481)    On very large target, score integer may overflow.
-810304ec (galt     2004-12-08 20:53:07 +0000 482)    Input sequences not checked for invalid chars.
-810304ec (galt     2004-12-08 20:53:07 +0000 483)    Input not checked but query should be shorter than target.
-810304ec (galt     2004-12-08 20:53:07 +0000 484)    
-810304ec (galt     2004-12-08 20:53:07 +0000 485) */
-810304ec (galt     2004-12-08 20:53:07 +0000 486) {
-810304ec (galt     2004-12-08 20:53:07 +0000 487) struct axt *axt=needMem(sizeof(struct axt));
-810304ec (galt     2004-12-08 20:53:07 +0000 488) 
-810304ec (galt     2004-12-08 20:53:07 +0000 489) char *q = query->dna;
-810304ec (galt     2004-12-08 20:53:07 +0000 490) char *t = target->dna;
-810304ec (galt     2004-12-08 20:53:07 +0000 491) 
-810304ec (galt     2004-12-08 20:53:07 +0000 492) int Q= query->size;
-810304ec (galt     2004-12-08 20:53:07 +0000 493) int T=target->size;
-810304ec (galt     2004-12-08 20:53:07 +0000 494) int lv=Q+1;                    /* Q+1 is used so often let's call it lv for q-width */
-810304ec (galt     2004-12-08 20:53:07 +0000 495) int lw=T+1;                    /* T+1 is used so often let's call it lw for t-height */
-810304ec (galt     2004-12-08 20:53:07 +0000 496) 
-810304ec (galt     2004-12-08 20:53:07 +0000 497) 
-810304ec (galt     2004-12-08 20:53:07 +0000 498) int r = 0;                                 /* row matrix index */
-810304ec (galt     2004-12-08 20:53:07 +0000 499) int c = 0;                                 /* col matrix index */
-810304ec (galt     2004-12-08 20:53:07 +0000 500) char dir=' ';                              /* dir for bt */
-810304ec (galt     2004-12-08 20:53:07 +0000 501) int bestbest = WORST;                      /* best score in entire mtx */
-810304ec (galt     2004-12-08 20:53:07 +0000 502) 
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 503) int k=0;                                   /* save every kth row (k decreasing) */
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 504) int ksize = 0;                             /* T+1 saved rows as ksize, ksize-1,...,1*/
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 505) int arrsize = 0;                           /* dynprg array size, +1 for 0 sentinel col. */
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 506) struct cell2L *cells = NULL;               /* best score dyn prog array */
-810304ec (galt     2004-12-08 20:53:07 +0000 507) int ki = 0;                                /* base offset into array */
-810304ec (galt     2004-12-08 20:53:07 +0000 508) int cmost = Q;                             /* track right edge shrinkage during backtrace */
-810304ec (galt     2004-12-08 20:53:07 +0000 509) int kmax = 0;                              /* rows range from ki to kmax */
-810304ec (galt     2004-12-08 20:53:07 +0000 510) int rr = 0;                                /* maps ki base to actual target seq */
-810304ec (galt     2004-12-08 20:53:07 +0000 511) int nrows = 0;                             /* num rows to do, usually k or less */
-810304ec (galt     2004-12-08 20:53:07 +0000 512) int bestr = 0;                             /* remember best r,c,dir for local ali */
-810304ec (galt     2004-12-08 20:53:07 +0000 513) int bestc = 0;           
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 514) char bestdir = 0;
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 515) int temp = 0;
-810304ec (galt     2004-12-08 20:53:07 +0000 516) 
-810304ec (galt     2004-12-08 20:53:07 +0000 517) 
-810304ec (galt     2004-12-08 20:53:07 +0000 518) char *btq=NULL;      /* temp pointers to track ends of string while accumulating */
-810304ec (galt     2004-12-08 20:53:07 +0000 519) char *btt=NULL;
-810304ec (galt     2004-12-08 20:53:07 +0000 520) 
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 521) ksize = (int) (-1 + sqrt(8*lw+1))/2;    
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 522) if (((ksize*(ksize+1))/2) < lw) 
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 523)     {ksize++;}
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 524) arrsize = (ksize+1) * lv;                 /* dynprg array size, +1 for lastrow that moves back up. */
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 525) cells = needLargeMem(arrsize * sizeof(struct cell2L));   /* best score dyn prog array */
-810304ec (galt     2004-12-08 20:53:07 +0000 526) 
-810304ec (galt     2004-12-08 20:53:07 +0000 527) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 528) printf("\n k=%d \n ksize=%d \n arrsize=%d \n Q,lv=%d,%d T=%d \n \n",k,ksize,arrsize,Q,lv,T);
-810304ec (galt     2004-12-08 20:53:07 +0000 529) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 530) 
-810304ec (galt     2004-12-08 20:53:07 +0000 531) axt->next = NULL;
-810304ec (galt     2004-12-08 20:53:07 +0000 532) axt->qName = cloneString(query->name);
-810304ec (galt     2004-12-08 20:53:07 +0000 533) axt->tName = cloneString(target->name);
-810304ec (galt     2004-12-08 20:53:07 +0000 534) axt->qStrand ='+';
-810304ec (galt     2004-12-08 20:53:07 +0000 535) axt->tStrand ='+';
-810304ec (galt     2004-12-08 20:53:07 +0000 536) axt->frame = 0;
-810304ec (galt     2004-12-08 20:53:07 +0000 537) axt->score=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 538) axt->qStart=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 539) axt->tStart=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 540) axt->qEnd=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 541) axt->tEnd=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 542) axt->symCount=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 543) axt->qSym=NULL;
-810304ec (galt     2004-12-08 20:53:07 +0000 544) axt->tSym=NULL;
-810304ec (galt     2004-12-08 20:53:07 +0000 545) 
-810304ec (galt     2004-12-08 20:53:07 +0000 546) if ((Q==0) || (T==0))
-810304ec (galt     2004-12-08 20:53:07 +0000 547)     {
-810304ec (galt     2004-12-08 20:53:07 +0000 548)     axt->qSym=cloneString("");
-810304ec (galt     2004-12-08 20:53:07 +0000 549)     axt->tSym=cloneString("");
-810304ec (galt     2004-12-08 20:53:07 +0000 550)     freez(&cells);
-810304ec (galt     2004-12-08 20:53:07 +0000 551)     return axt; 
-810304ec (galt     2004-12-08 20:53:07 +0000 552)     }
-810304ec (galt     2004-12-08 20:53:07 +0000 553) 
-810304ec (galt     2004-12-08 20:53:07 +0000 554) 
-810304ec (galt     2004-12-08 20:53:07 +0000 555) 
-810304ec (galt     2004-12-08 20:53:07 +0000 556) /* initialize origin corner */
-810304ec (galt     2004-12-08 20:53:07 +0000 557)     cells[0].bestm=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 558)     cells[0].bestd=WORST;
-810304ec (galt     2004-12-08 20:53:07 +0000 559)     cells[0].besti=WORST;                 
-810304ec (galt     2004-12-08 20:53:07 +0000 560)     cells[0].backm='x';
-810304ec (galt     2004-12-08 20:53:07 +0000 561)     cells[0].backd='x';
-810304ec (galt     2004-12-08 20:53:07 +0000 562)     cells[0].backi='x';
-810304ec (galt     2004-12-08 20:53:07 +0000 563) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 564)     dump2L(cells); 
-810304ec (galt     2004-12-08 20:53:07 +0000 565) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 566) 
-810304ec (galt     2004-12-08 20:53:07 +0000 567) /* initialize row 0 col 1 */
-810304ec (galt     2004-12-08 20:53:07 +0000 568)     cells[1].bestm=WORST;
-810304ec (galt     2004-12-08 20:53:07 +0000 569)     cells[1].bestd=WORST;
-810304ec (galt     2004-12-08 20:53:07 +0000 570)     cells[1].besti=-ss->gapOpen;
-810304ec (galt     2004-12-08 20:53:07 +0000 571)     cells[1].backm='x';
-810304ec (galt     2004-12-08 20:53:07 +0000 572)     cells[1].backd='x';
-810304ec (galt     2004-12-08 20:53:07 +0000 573)     cells[1].backi='m';
-810304ec (galt     2004-12-08 20:53:07 +0000 574) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 575)     dump2L(cells+1); 
-810304ec (galt     2004-12-08 20:53:07 +0000 576) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 577) 
-810304ec (galt     2004-12-08 20:53:07 +0000 578) /* initialize first row of sentinels */
-810304ec (galt     2004-12-08 20:53:07 +0000 579) for (c=2;c<lv;c++)
-810304ec (galt     2004-12-08 20:53:07 +0000 580)     {
-810304ec (galt     2004-12-08 20:53:07 +0000 581)     cells[c].bestm=WORST;
-810304ec (galt     2004-12-08 20:53:07 +0000 582)     cells[c].bestd=WORST;
-810304ec (galt     2004-12-08 20:53:07 +0000 583)     cells[c].besti=cells[c-1].besti-ss->gapExtend;
-810304ec (galt     2004-12-08 20:53:07 +0000 584)     cells[c].backm='x';
-810304ec (galt     2004-12-08 20:53:07 +0000 585)     cells[c].backd='x';
-810304ec (galt     2004-12-08 20:53:07 +0000 586)     cells[c].backi='i';
-810304ec (galt     2004-12-08 20:53:07 +0000 587) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 588)     dump2L(cells+c); 
-810304ec (galt     2004-12-08 20:53:07 +0000 589) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 590)     }
-810304ec (galt     2004-12-08 20:53:07 +0000 591) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 592) printf("\n");
-810304ec (galt     2004-12-08 20:53:07 +0000 593) printf("\n");
-810304ec (galt     2004-12-08 20:53:07 +0000 594) #endif
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 595) 
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 596) k=ksize;
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 597) 
-810304ec (galt     2004-12-08 20:53:07 +0000 598) ki++;  /* advance to next row */
-810304ec (galt     2004-12-08 20:53:07 +0000 599) 
-810304ec (galt     2004-12-08 20:53:07 +0000 600) r=1;   /* r is really the rows all done */
-810304ec (galt     2004-12-08 20:53:07 +0000 601) while(1)
-810304ec (galt     2004-12-08 20:53:07 +0000 602)     {
-810304ec (galt     2004-12-08 20:53:07 +0000 603)     nrows = k;  /* do k rows at a time, save every kth row on 1st pass */
-810304ec (galt     2004-12-08 20:53:07 +0000 604)     if (nrows > (lw-r)) {nrows=lw-r;}  /* may get less than k on last set */
-810304ec (galt     2004-12-08 20:53:07 +0000 605)     kmax = ki+nrows-1;
-810304ec (galt     2004-12-08 20:53:07 +0000 606) 
-810304ec (galt     2004-12-08 20:53:07 +0000 607)     kForwardAffine(cells, ki, kmax, r-ki, cmost, lv, q, t, ss, &bestbest, &bestr, &bestc, &bestdir);
-810304ec (galt     2004-12-08 20:53:07 +0000 608) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 609) printf("\n");
-810304ec (galt     2004-12-08 20:53:07 +0000 610) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 611) 
-810304ec (galt     2004-12-08 20:53:07 +0000 612)     r += nrows;
-810304ec (galt     2004-12-08 20:53:07 +0000 613) 
-810304ec (galt     2004-12-08 20:53:07 +0000 614)     if (nrows == k)   /* got full set of k rows */
-810304ec (galt     2004-12-08 20:53:07 +0000 615) 	{
-810304ec (galt     2004-12-08 20:53:07 +0000 616) 	/* compress, save every kth row */     
-810304ec (galt     2004-12-08 20:53:07 +0000 617) 	/* optimize as a mem-copy */
-810304ec (galt     2004-12-08 20:53:07 +0000 618) 	memcpy(cells+ki*lv,cells+kmax*lv,sizeof(struct cell2L) *lv);    
-810304ec (galt     2004-12-08 20:53:07 +0000 619) 	}
-810304ec (galt     2004-12-08 20:53:07 +0000 620) 
-810304ec (galt     2004-12-08 20:53:07 +0000 621)     if (r >= lw){break;} /* we are done */
-810304ec (galt     2004-12-08 20:53:07 +0000 622)     
-810304ec (galt     2004-12-08 20:53:07 +0000 623)     ki++;
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 624)     k--;        /* decreasing k is "moving boundary" */
-810304ec (galt     2004-12-08 20:53:07 +0000 625) }
-810304ec (galt     2004-12-08 20:53:07 +0000 626) 
-810304ec (galt     2004-12-08 20:53:07 +0000 627) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 628) printf("\nFWD PASS DONE. bestbest=%d bestr=%d bestc=%d bestdir=%c \n\n",bestbest,bestr,bestc,bestdir);
-810304ec (galt     2004-12-08 20:53:07 +0000 629) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 630) 
-810304ec (galt     2004-12-08 20:53:07 +0000 631) /* start doing backtrace */
-810304ec (galt     2004-12-08 20:53:07 +0000 632)     
-810304ec (galt     2004-12-08 20:53:07 +0000 633) /* adjust for reverse pass */
-810304ec (galt     2004-12-08 20:53:07 +0000 634) 
-810304ec (galt     2004-12-08 20:53:07 +0000 635) /* for local we automatically skip to bestr, bestc to begin tb */
-810304ec (galt     2004-12-08 20:53:07 +0000 636) 
-810304ec (galt     2004-12-08 20:53:07 +0000 637) if (bestbest <= 0)  /* null alignment */
-810304ec (galt     2004-12-08 20:53:07 +0000 638)     {
-810304ec (galt     2004-12-08 20:53:07 +0000 639)     bestr=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 640)     bestc=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 641)     /* bestdir won't matter */
-810304ec (galt     2004-12-08 20:53:07 +0000 642)     }
-810304ec (galt     2004-12-08 20:53:07 +0000 643) 
-810304ec (galt     2004-12-08 20:53:07 +0000 644) r = bestr;
-810304ec (galt     2004-12-08 20:53:07 +0000 645) c = bestc;
-810304ec (galt     2004-12-08 20:53:07 +0000 646) dir = bestdir;
-810304ec (galt     2004-12-08 20:53:07 +0000 647) cmost = c;
-810304ec (galt     2004-12-08 20:53:07 +0000 648) 
-810304ec (galt     2004-12-08 20:53:07 +0000 649) axt->qEnd=bestc;
-810304ec (galt     2004-12-08 20:53:07 +0000 650) axt->tEnd=bestr;
-810304ec (galt     2004-12-08 20:53:07 +0000 651) 
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 652) temp = (2*ksize)+1;
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 653) ki = (int)(temp-sqrt((temp*temp)-(8*r)))/2;
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 654) rr = ((2*ksize*ki)+ki-(ki*ki))/2;
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 655) kmax = ki+(r-rr);
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 656) k = ksize - ki;
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 657) 
-810304ec (galt     2004-12-08 20:53:07 +0000 658) 
-810304ec (galt     2004-12-08 20:53:07 +0000 659) /* now that we jumped back into saved start-points,
-810304ec (galt     2004-12-08 20:53:07 +0000 660)    let's fill the array forward and start backtrace from there.
-810304ec (galt     2004-12-08 20:53:07 +0000 661) */
-810304ec (galt     2004-12-08 20:53:07 +0000 662) 
-810304ec (galt     2004-12-08 20:53:07 +0000 663) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 664) printf("bestr=%d, bestc=%d, bestdir=%c k=%d, ki=%d, kmax=%d\n",bestr,bestc,bestdir,k,ki,kmax);
-810304ec (galt     2004-12-08 20:53:07 +0000 665) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 666) 
-810304ec (galt     2004-12-08 20:53:07 +0000 667) kForwardAffine(cells, ki+1, kmax, rr-ki, cmost, lv, q, t, ss, &bestbest, &bestr, &bestc, &bestdir);
-810304ec (galt     2004-12-08 20:53:07 +0000 668)    
-810304ec (galt     2004-12-08 20:53:07 +0000 669) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 670) printf("\n(initial)BKWD PASS DONE. cmost=%d r=%d c=%d dir=%c \n\n",cmost,r,c,dir);
-810304ec (galt     2004-12-08 20:53:07 +0000 671) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 672) 
-810304ec (galt     2004-12-08 20:53:07 +0000 673) 
-810304ec (galt     2004-12-08 20:53:07 +0000 674) /* backtrace */   
-810304ec (galt     2004-12-08 20:53:07 +0000 675) 
-810304ec (galt     2004-12-08 20:53:07 +0000 676) /* handling for resulting ali'd strings when very long */
-810304ec (galt     2004-12-08 20:53:07 +0000 677) 
-810304ec (galt     2004-12-08 20:53:07 +0000 678) axt->symCount=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 679) axt->qSym = needLargeMem((Q+T+1)*sizeof(char));
-810304ec (galt     2004-12-08 20:53:07 +0000 680) axt->tSym = needLargeMem((Q+T+1)*sizeof(char));
-810304ec (galt     2004-12-08 20:53:07 +0000 681) btq=axt->qSym;
-810304ec (galt     2004-12-08 20:53:07 +0000 682) btt=axt->tSym;
-810304ec (galt     2004-12-08 20:53:07 +0000 683) while(1)
-810304ec (galt     2004-12-08 20:53:07 +0000 684)     {
-810304ec (galt     2004-12-08 20:53:07 +0000 685)     while(1)
-810304ec (galt     2004-12-08 20:53:07 +0000 686) 	{
-810304ec (galt     2004-12-08 20:53:07 +0000 687) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 688) 	printf("bt: r=%d, c=%d, dir=%c \n",r,c,dir);
-810304ec (galt     2004-12-08 20:53:07 +0000 689) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 690) 
-810304ec (galt     2004-12-08 20:53:07 +0000 691) 	
-810304ec (galt     2004-12-08 20:53:07 +0000 692)     	if ((r==0) && (c==0)){break;} /* hit origin, done */
-810304ec (galt     2004-12-08 20:53:07 +0000 693) 	if (r<rr){break;} /* ran out of targ seq, backup and reload */
-810304ec (galt     2004-12-08 20:53:07 +0000 694) 	if (dir=='x'){errAbort("unexpected error backtracing");} /* x only at origin */
-810304ec (galt     2004-12-08 20:53:07 +0000 695) 	if (dir=='s'){break;}   /* hit start, local ali */
-810304ec (galt     2004-12-08 20:53:07 +0000 696) 	if (dir=='m') /* match */
-810304ec (galt     2004-12-08 20:53:07 +0000 697) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 698) 	    *btq++=q[c-1];  /* accumulate alignment output strings */
-810304ec (galt     2004-12-08 20:53:07 +0000 699) 	    *btt++=t[r-1];  /* accumulate alignment output strings */
-810304ec (galt     2004-12-08 20:53:07 +0000 700) 	    axt->symCount++; 
-810304ec (galt     2004-12-08 20:53:07 +0000 701) 	    dir = cells[lv*(ki+r-rr)+c].backm;  /* follow backtrace */
-810304ec (galt     2004-12-08 20:53:07 +0000 702) 	    r--;            /* adjust coords to move in dir spec'd by back ptr */
-810304ec (galt     2004-12-08 20:53:07 +0000 703) 	    c--;
-810304ec (galt     2004-12-08 20:53:07 +0000 704) 	    cmost--;        /* decreases as query seq is aligned, so saves on unused areas */
-810304ec (galt     2004-12-08 20:53:07 +0000 705) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 706) 	else
-810304ec (galt     2004-12-08 20:53:07 +0000 707) 	    {
-810304ec (galt     2004-12-08 20:53:07 +0000 708) 	    if (dir=='d')  /* delete in query (gap) */
-810304ec (galt     2004-12-08 20:53:07 +0000 709) 		{
-810304ec (galt     2004-12-08 20:53:07 +0000 710) 		*btq++='-';     /* accumulate alignment output strings */
-810304ec (galt     2004-12-08 20:53:07 +0000 711)     		*btt++=t[r-1];  /* accumulate alignment output strings */
-810304ec (galt     2004-12-08 20:53:07 +0000 712)     		axt->symCount++; 
-810304ec (galt     2004-12-08 20:53:07 +0000 713) 		dir = cells[lv*(ki+r-rr)+c].backd;  /* follow backtrace */
-810304ec (galt     2004-12-08 20:53:07 +0000 714)     		r--;            /* adjust coords to move in dir spec'd by back ptr */
-810304ec (galt     2004-12-08 20:53:07 +0000 715) 		}
-810304ec (galt     2004-12-08 20:53:07 +0000 716) 	    else    /* insert in query (gap) */
-810304ec (galt     2004-12-08 20:53:07 +0000 717) 		{
-810304ec (galt     2004-12-08 20:53:07 +0000 718) 		*btq++=q[c-1];  /* accumulate alignment output strings */
-810304ec (galt     2004-12-08 20:53:07 +0000 719)     		*btt++='-';     /* accumulate alignment output strings */
-810304ec (galt     2004-12-08 20:53:07 +0000 720)     		axt->symCount++; 
-810304ec (galt     2004-12-08 20:53:07 +0000 721) 		dir = cells[lv*(ki+r-rr)+c].backi;  /* follow backtrace */
-810304ec (galt     2004-12-08 20:53:07 +0000 722)     		c--;
-810304ec (galt     2004-12-08 20:53:07 +0000 723)     		cmost--;        /* decreases as query seq is aligned, so saves on unused areas */
-810304ec (galt     2004-12-08 20:53:07 +0000 724) 		}
-810304ec (galt     2004-12-08 20:53:07 +0000 725) 	    }
-810304ec (galt     2004-12-08 20:53:07 +0000 726) 	
-810304ec (galt     2004-12-08 20:53:07 +0000 727) 	}
-810304ec (galt     2004-12-08 20:53:07 +0000 728) 
-810304ec (galt     2004-12-08 20:53:07 +0000 729)     /* back up and do it again */
-810304ec (galt     2004-12-08 20:53:07 +0000 730)     ki--;
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 731)     k++;   /* k grows as we move back up */ 
-810304ec (galt     2004-12-08 20:53:07 +0000 732)     rr-=k;
-810304ec (galt     2004-12-08 20:53:07 +0000 733)     kmax = ki+k-1;
-810304ec (galt     2004-12-08 20:53:07 +0000 734) 
-810304ec (galt     2004-12-08 20:53:07 +0000 735)     /* check for various termination conditions to stop main loop */
-810304ec (galt     2004-12-08 20:53:07 +0000 736)     if (ki < 0) {break;}
-810304ec (galt     2004-12-08 20:53:07 +0000 737)     if ((r==0)&&(c==0)) {break;}
-810304ec (galt     2004-12-08 20:53:07 +0000 738)     if (dir=='s') {break;}
-810304ec (galt     2004-12-08 20:53:07 +0000 739) 
-810304ec (galt     2004-12-08 20:53:07 +0000 740)     /* re-calculate array from previous saved kth row going back
-810304ec (galt     2004-12-08 20:53:07 +0000 741)        this is how we save memory, but have to regenerate half on average
-810304ec (galt     2004-12-08 20:53:07 +0000 742)        we are re-using the same call 
-810304ec (galt     2004-12-08 20:53:07 +0000 743)      */
-810304ec (galt     2004-12-08 20:53:07 +0000 744) 
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 745) #ifdef DEBUG
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 746) printf("bestr=%d, bestc=%d, bestdir=%c k=%d, ki=%d, kmax=%d\n",bestr,bestc,bestdir,k,ki,kmax);
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 747) #endif
-1d57cbc5 (galt     2004-12-13 19:56:31 +0000 748) 
-810304ec (galt     2004-12-08 20:53:07 +0000 749) 
-810304ec (galt     2004-12-08 20:53:07 +0000 750)     kForwardAffine(cells, ki+1, kmax, rr-ki, cmost, lv, q, t, ss, &bestbest, &bestr, &bestc, &bestdir);
-810304ec (galt     2004-12-08 20:53:07 +0000 751) 
-810304ec (galt     2004-12-08 20:53:07 +0000 752) #ifdef DEBUG
-810304ec (galt     2004-12-08 20:53:07 +0000 753)     printf("\nBKWD PASS DONE. cmost=%d r=%d c=%d\n\n",cmost,r,c);
-810304ec (galt     2004-12-08 20:53:07 +0000 754) #endif
-810304ec (galt     2004-12-08 20:53:07 +0000 755) 
-810304ec (galt     2004-12-08 20:53:07 +0000 756)     }
-810304ec (galt     2004-12-08 20:53:07 +0000 757) 
-810304ec (galt     2004-12-08 20:53:07 +0000 758) axt->qStart=c;
-810304ec (galt     2004-12-08 20:53:07 +0000 759) axt->tStart=r;
-810304ec (galt     2004-12-08 20:53:07 +0000 760) 
-810304ec (galt     2004-12-08 20:53:07 +0000 761) /* reverse backwards trace and zero-terminate strings */
-810304ec (galt     2004-12-08 20:53:07 +0000 762) 
-810304ec (galt     2004-12-08 20:53:07 +0000 763) reverseBytes(axt->qSym,axt->symCount);
-810304ec (galt     2004-12-08 20:53:07 +0000 764) reverseBytes(axt->tSym,axt->symCount);
-810304ec (galt     2004-12-08 20:53:07 +0000 765) axt->qSym[axt->symCount]=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 766) axt->tSym[axt->symCount]=0;
-810304ec (galt     2004-12-08 20:53:07 +0000 767) 
-810304ec (galt     2004-12-08 20:53:07 +0000 768) axt->score=bestbest;
-810304ec (galt     2004-12-08 20:53:07 +0000 769) 
-810304ec (galt     2004-12-08 20:53:07 +0000 770) 
-810304ec (galt     2004-12-08 20:53:07 +0000 771) /* 
-810304ec (galt     2004-12-08 20:53:07 +0000 772) should I test stringsize and if massively smaller, realloc string to save ram? 
-810304ec (galt     2004-12-08 20:53:07 +0000 773) */
-810304ec (galt     2004-12-08 20:53:07 +0000 774) 
-810304ec (galt     2004-12-08 20:53:07 +0000 775) freez(&cells);
-810304ec (galt     2004-12-08 20:53:07 +0000 776) 
-810304ec (galt     2004-12-08 20:53:07 +0000 777) return axt;
-810304ec (galt     2004-12-08 20:53:07 +0000 778) }
-810304ec (galt     2004-12-08 20:53:07 +0000 779) 
-810304ec (galt     2004-12-08 20:53:07 +0000 780) 
-810304ec (galt     2004-12-08 20:53:07 +0000 781) 
diff --git a/gbtools/src/blatSrc/lib/fq.c b/gbtools/src/blatSrc/lib/fq.c
deleted file mode 100644
index 56ca99e..0000000
--- a/gbtools/src/blatSrc/lib/fq.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* fq - stuff for doing i/o on fastq files. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "fq.h"
-
-struct fq *fqReadNext(struct lineFile *lf)
-/* Read next record, return it as fq. */
-{
-struct fq *fq;
-AllocVar(fq);
-char *line;
-
-/* Deal with initial line starting with '@' */
-if (!lineFileNextReal(lf, &line))
-    return FALSE;
-if (line[0] != '@')
-    {
-    errAbort("Expecting line starting with '@' got %s line %d of %s", 
-	line, lf->lineIx, lf->fileName);
-    }
-fq->header = cloneString(line);
-
-/* Deal with line containing sequence. */
-if (!lineFileNext(lf, &line,  NULL))
-    errAbort("%s truncated in middle of record", lf->fileName);
-fq->dna = cloneString(line);
-
-/* Check for + line */
-if (!lineFileNext(lf, &line,  NULL))
-    errAbort("%s truncated in middle of record", lf->fileName);
-if (line[0] != '+')
-    errAbort("Expecting + line %d of %s", lf->lineIx, lf->fileName);
-
-/* Get quality line */
-if (!lineFileNext(lf, &line,  NULL))
-    errAbort("%s truncated in middle of record", lf->fileName);
-fq->quality = (unsigned char *)cloneString(line);
-return fq;
-}
-
-void fqFree(struct fq **pFq)
-/* Free up *pFq and set it to NULL */
-{
-struct fq *fq = *pFq;
-if (fq != NULL)
-    {
-    freeMem(fq->header);
-    freeMem(fq->dna);
-    freeMem(fq->quality);
-    freez(pFq);
-    }
-}
-
-void fqWriteNext(struct fq *input, FILE *f)
-/*  Writes a single fastq structure to the file provided. */
-{
-fprintf(f,"%s\n",input->header);
-fprintf(f,"%s\n",input->dna);
-fprintf(f,"%s\n","+");
-fprintf(f,"%s\n",input->quality);
-}
diff --git a/gbtools/src/blatSrc/lib/fuzzyShow.c b/gbtools/src/blatSrc/lib/fuzzyShow.c
deleted file mode 100644
index 59e3851..0000000
--- a/gbtools/src/blatSrc/lib/fuzzyShow.c
+++ /dev/null
@@ -1,406 +0,0 @@
-/* fuzzyShow - routines to show ffAli alignments in text
- * or html. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "memgfx.h"
-#include "fuzzyFind.h"
-#include "htmshell.h"
-#include "cda.h"
-#include "seqOut.h"
-
-
-static void ffShNeedle(FILE *f, DNA *needle, int needleSize,
-		       int needleNumOffset, char *colorFlags,
-		       struct ffAli *aliList, boolean upcMatch,
-		       int cdsS, int cdsE,
-		       boolean accentRange, int accentStart, int accentEnd)
-/* Display the needle sequence with HTML highlighting. */
-{
-struct cfm *cfm = cfmNew(10, 50, TRUE, FALSE, f, needleNumOffset);
-char *n = cloneMem(needle, needleSize);
-char *accentFlags = needMem(needleSize);
-struct ffAli *leftAli = aliList;
-struct ffAli *ali;
-long i;
-
-zeroBytes(colorFlags, needleSize);
-zeroBytes(accentFlags, needleSize);
-fprintf(f, "<PRE><TT>\n");
-if (aliList != NULL)
-    {
-    for (leftAli = aliList; leftAli->left != NULL; leftAli = leftAli->left)
-	;
-    }
-for (ali = leftAli; ali != NULL; ali = ali->right)
-    {
-    boolean utr = FALSE;
-    int off = ali->nStart-needle;
-    int count = ali->nEnd - ali->nStart;
-    if ((cdsE > 0) && ((cdsS-off-1) > 0)) 
-	utr = TRUE;
-    for (i=0; i<count; ++i)
-	{
-	if (!utr && (i > (cdsE-off-1)) && (cdsE > 0))
-	    utr = TRUE;
-	if (utr && (i == (cdsS-off)))
-	    utr = FALSE;
-	if (toupper(ali->hStart[i]) == toupper(ali->nStart[i]))
-	    {
-	    if (utr)
-		colorFlags[off+i] = ((i == 0 || i == count-1) ? socOrange : socRed);
-	    else
-		colorFlags[off+i] = ((i == 0 || i == count-1) ? socBrightBlue : socBlue);
-	    if (upcMatch)
-		n[off+i] = toupper(n[off+i]);
-	    }
-	if (accentRange)
-	    {
-	    if (off+i >= accentStart && off+i < accentEnd)
-		accentFlags[off+i] = TRUE;
-	    }
-	}
-    }
-for (i=0; i<needleSize; ++i)
-    {
-    if (accentRange && i == accentStart)
-	fprintf(f, "<A NAME=cDNAStart></A>");
-    cfmOutExt(cfm, n[i], seqOutColorLookup[(int)colorFlags[i]],
-	      accentFlags[i], accentFlags[i], FALSE);
-    }
-cfmFree(&cfm);
-freeMem(n);
-freeMem(accentFlags);
-fprintf(f, "</TT></PRE>\n");
-htmHorizontalLine(f);
-}
-
-void ffShowSideBySide(FILE *f, struct ffAli *leftAli, DNA *needle, int needleNumOffset,
-		      DNA *haystack, int hayNumOffset, int haySize, int hayOffStart, int hayOffEnd,
-		      int blockMaxGap, boolean rcHaystack, boolean initialNewline)
-/* Print HTML side-by-side alignment of needle and haystack (no title or labels) to f.
- * {hay,needle}NumOffset are the coords at which the DNA sequence begins.
- * hayOff{Start,End} are the range of coords *relative to hayNumOffset* to which the 
- * alignment display will be clipped -- pass in {0,haySize} for no clipping. */
-{
-fprintf(f, "<PRE><TT>%s", initialNewline ? "\n" : "");
-struct ffAli *ali, *lastAli = NULL;
-struct baf baf;
-/* NOTE: if rcHaystack, hayNumOffset changes here into the end, not start! */
-if (rcHaystack) 
-    hayNumOffset += haySize;
-bafInit(&baf, needle, needleNumOffset, FALSE, 
-    	haystack, hayNumOffset, rcHaystack, f, 50, FALSE);
-for (ali=leftAli; ali!=NULL; ali = ali->right)
-    {
-    int i;
-    boolean doBreak = TRUE;
-    if ((ali->hEnd - haystack) <= hayOffStart ||
-	(ali->hStart - haystack) >= hayOffEnd)
-	continue;
-
-    /* Decide whether to put in a line break and/or blank characters */
-    if (lastAli != NULL)
-	{
-	int nSkip = ali->nStart - lastAli->nEnd;
-	int hSkip = ali->hStart - lastAli->hEnd;
-	if (nSkip > 0 && nSkip <= blockMaxGap && hSkip == 0)
-	    {
-	    for (i=0; i<nSkip; ++i)
-		bafOut(&baf, lastAli->nEnd[i],'.');
-	    doBreak = FALSE; 
-	    }
-	else if (hSkip > 0 && hSkip <= blockMaxGap && nSkip == 0)
-	    {
-	    for (i=0; i<hSkip; ++i)
-		bafOut(&baf, '.', lastAli->hEnd[i]);
-	    doBreak = FALSE;
-	    }
-	else if (hSkip == nSkip && hSkip <= blockMaxGap)
-	    {
-	    for (i=0; i<hSkip; ++i)
-		bafOut(&baf, lastAli->nEnd[i], lastAli->hEnd[i]);
-	    doBreak = FALSE;
-	    }
-	}
-    else
-	{
-	doBreak = FALSE;
-	}
-    if (doBreak)
-	bafFlushLine(&baf);
-    int offset = max(0, (hayOffStart - (ali->hStart - haystack)));
-    int nStart = offset + ali->nStart - needle;
-    int hStart = offset + ali->hStart - haystack;
-    bafSetPos(&baf, nStart, hStart);
-    if (doBreak || lastAli == NULL)
-	bafStartLine(&baf);
-    int aliLen = ali->nEnd - ali->nStart;
-    for (i=0; i<aliLen; ++i)
-	{
-	int hayOff = i + (ali->hStart - haystack);
-	if (hayOff < hayOffStart)
-	    continue;
-	if (hayOff >= hayOffEnd)
-	    break;
-	bafOut(&baf, ali->nStart[i], ali->hStart[i]);
-	}
-    lastAli = ali;
-    }
-if (leftAli != NULL)
-    bafFlushLineNoHr(&baf);
-fprintf(f, "</TT></PRE>\n");
-}
-
-
-int ffShAliPart(FILE *f, struct ffAli *aliList, 
-    char *needleName, DNA *needle, int needleSize, int needleNumOffset,
-    char *haystackName, DNA *haystack, int haySize, int hayNumOffset,
-    int blockMaxGap, boolean rcNeedle, boolean rcHaystack,
-    boolean showJumpTable, 
-    boolean showNeedle, boolean showHaystack,
-    boolean showSideBySide, boolean upcMatch,
-    int cdsS, int cdsE, int hayPartS, int hayPartE)
-/* Display parts of alignment on html page.  If hayPartS..hayPartE is a 
- * smaller subrange of the alignment, highlight that part of the alignment 
- * in both needle and haystack with underline & bold, and show only that 
- * part of the haystack (plus padding).  Returns number of blocks (after
- * merging blocks separated by blockMaxGap or less). */
-{
-long i;
-struct ffAli *ali;
-struct ffAli *lastAli;
-struct ffAli *leftAli = aliList;
-struct ffAli *rightAli = aliList;
-int maxSize = (needleSize > haySize ? needleSize : haySize);
-char *colorFlags = needMem(maxSize);
-int anchorCount = 0;
-boolean restrictToWindow = FALSE;
-int hayOffStart = 0, hayOffEnd = haySize;
-int hayPaddedOffStart = 0, hayPaddedOffEnd = haySize;
-int hayExtremity = rcHaystack ? (hayNumOffset + haySize) : hayNumOffset;
-int nPartS=0, nPartE=0;
-
-if (aliList != NULL)
-    {
-    while (leftAli->left != NULL) leftAli = leftAli->left;
-    while (rightAli->right != NULL) rightAli = rightAli->right;
-    }
-
-/* If we are only showing part of the alignment, translate haystack window
- * coords to needle window coords and haystack-offset window coords: */
-if (hayPartS > (hayNumOffset + (leftAli->hStart - haystack)) ||
-    (hayPartE > 0 && hayPartE < (hayNumOffset + (rightAli->hEnd - haystack))))
-    {
-    DNA *haystackPartS;
-    DNA *haystackPartE;
-    restrictToWindow = TRUE;
-    if (rcHaystack)
-	{
-	haystackPartS = haystack + (haySize - (hayPartE - hayNumOffset));
-	haystackPartE = haystack + (haySize - (hayPartS - hayNumOffset));
-	}
-    else
-	{
-	haystackPartS = haystack + hayPartS - hayNumOffset;
-	haystackPartE = haystack + hayPartE - hayNumOffset;
-	}
-    boolean foundStart = FALSE;
-    hayOffStart = haystackPartS - haystack;
-    hayOffEnd = haystackPartE - haystack;
-    for (ali = leftAli;  ali != NULL;  ali = ali->right)
-	{
-	if (haystackPartS < ali->hEnd && !foundStart)
-	    {
-	    int offset = haystackPartS - ali->hStart;
-	    if (offset < 0)
-		offset = 0;
-	    nPartS = offset + ali->nStart - needle;
-	    hayOffStart = offset + ali->hStart - haystack;
-	    foundStart = TRUE;
-	    }
-	if (haystackPartE > ali->hStart)
-	    {
-	    if (haystackPartE > ali->hEnd)
-		{
-		nPartE = ali->nEnd - needle;
-		hayOffEnd = ali->hEnd - haystack;
-		}
-	    else
-		{
-		nPartE = haystackPartE - ali->hStart + ali->nStart - needle;
-		hayOffEnd = haystackPartE - haystack;
-		}
-	    }
-	}
-    hayPaddedOffStart = max(0, (hayOffStart - 100));
-    hayPaddedOffEnd = min(haySize, (hayOffEnd + 100));
-    if (rcHaystack)
-	hayExtremity = hayNumOffset + haySize - hayPaddedOffStart;
-    else
-	hayExtremity = hayNumOffset + hayPaddedOffStart;
-    }
-
-if (showJumpTable)
-    {
-    fputs("<CENTER><P><TABLE BORDER=1 WIDTH=\"97%\"><TR>", f);
-    fputs("<TD WIDTH=\"23%\"><P ALIGN=CENTER><A HREF=\"#cDNA\">cDNA Sequence</A></TD>", f);
-    if (restrictToWindow)
-	fputs("<TD WIDTH=\"23%\"><P ALIGN=CENTER><A HREF=\"#cDNAStart\">cDNA Sequence in window</A></TD>", f);
-    fputs("<TD WIDTH=\"27%\"><P ALIGN=\"CENTER\"><A HREF=\"#genomic\">Genomic Sequence</A></TD>", f);
-    fputs("<TD WIDTH=\"29%\"><P ALIGN=\"CENTER\"><A HREF=\"#1\">cDNA in Genomic</A></TD>", f);
-    fputs("<TD WIDTH=\"21%\"><P ALIGN=\"CENTER\"><A HREF=\"#ali\">Side by Side</A></TD>", f);
-    fputs("</TR></TABLE>\n", f);
-    }
-if (cdsE > 0) 
-    {
-    fprintf(f, "Matching bases in coding regions of cDNA and genomic sequences are colored blue%s. ", 
-	    (upcMatch ? " and capitalized" : ""));
-    fprintf(f, "Matching bases in UTR regions of cDNA and genomic sequences are colored red%s. ", 
-	    (upcMatch ? " and capitalized" : ""));
-    fputs("Light blue (coding) or orange (UTR) bases mark the boundaries of gaps in either sequence "
-	  "(often splice sites).\n", f);
-    } 
-else 
-    {
-    fprintf(f, "Matching bases in cDNA and genomic sequences are colored blue%s. ", 
-	    (upcMatch ? " and capitalized" : ""));
-    fputs("Light blue bases mark the boundaries of gaps in either sequence "
-	  "(often splice sites).\n", f);
-    } 
-if (showNeedle && restrictToWindow)
-    fputs("Bases that were in the selected browser region are shown in bold "
-	  "and underlined, "
-	  "and only the alignment for these bases is displayed in the "
-	  "Genomic and Side by Side sections.\n", f);
-
-if (showJumpTable)
-    fputs("</P></CENTER>\n", f);
-htmHorizontalLine(f);
-
-fprintf(f, "<H4><A NAME=cDNA></A>cDNA %s%s</H4>\n", needleName, (rcNeedle ? " (reverse complemented)" : ""));
-
-if (rcNeedle)
-    reverseComplement(needle, needleSize);
-
-if (showNeedle)
-    {
-    ffShNeedle(f, needle, needleSize, needleNumOffset, colorFlags,
-	       aliList, upcMatch, cdsS, cdsE,
-	       restrictToWindow, nPartS, nPartE);
-    }
-
-if (showHaystack)
-    {
-    struct cfm *cfm = cfmNew(10, 50, TRUE, rcHaystack, f, hayExtremity);
-    char *h = cloneMem(haystack, haySize);
-    char *accentFlags = needMem(haySize);
-    zeroBytes(accentFlags, haySize);
-    fprintf(f, "<H4><A NAME=genomic></A>Genomic %s %s:</H4>\n", 
-    	haystackName,
-	(rcHaystack ? "(reverse strand)" : ""));
-    fprintf(f, "<PRE><TT>\n");
-    zeroBytes(colorFlags, haySize);
-    for (ali = leftAli; ali != NULL; ali = ali->right)
-	{
-	boolean utr = FALSE;
-	int i;
-	int off = ali->hStart-haystack;
-	int count = ali->hEnd - ali->hStart;
-	int offn = ali->nStart-needle;
-	if ((cdsE > 0) && ((cdsS-offn-1) > 0)) 
-	    utr = TRUE;
-	for (i=0; i<count; ++i)
-	    {
-	    if (!utr && (i > (cdsE-offn-1)) && (cdsE > 0))
-		utr = TRUE;
-	    if (utr && (i == (cdsS-offn)))
-		utr = FALSE;
-	    if (toupper(ali->hStart[i]) == toupper(ali->nStart[i]))
-		{
-		if (utr)
-		    colorFlags[off+i] = ((i == 0 || i == count-1) ? socOrange : socRed);
-		else
-		    colorFlags[off+i] = ((i == 0 || i == count-1) ? socBrightBlue : socBlue);
-		if (upcMatch)
-		    h[off+i] = toupper(h[off+i]);
-		}
-	    if (restrictToWindow && off+i >= hayOffStart && off+i < hayOffEnd)
-		accentFlags[off+i] = TRUE;
-	    }
-	}
-    ali = leftAli;
-    lastAli = NULL;
-    while (ali && (ali->hEnd - haystack) <= hayPaddedOffStart)
-	ali = ali->right;
-    for (i = hayPaddedOffStart; i < hayPaddedOffEnd; ++i)
-	{
-	/* Put down "anchor" on first match position in haystack
-	 * so user can hop here with a click on the needle. */
-	if (ali != NULL &&  i == ali->hStart - haystack)
-	    {
-	    if (lastAli == NULL || ali->hStart - lastAli->hEnd > blockMaxGap)
-		{
-		fprintf(f, "<A NAME=%d></A>", ++anchorCount);
-		}
-	    lastAli = ali;
-	    ali = ali->right;
-	    }
-	cfmOutExt(cfm, h[i], seqOutColorLookup[(int)colorFlags[i]],
-		  accentFlags[i], accentFlags[i], FALSE);
-	}
-    cfmFree(&cfm);
-    freeMem(h);
-    fprintf(f, "</TT></PRE>\n");
-    htmHorizontalLine(f);
-    }
-
-if (showSideBySide)
-    {
-    fprintf(f, "<H4><A NAME=ali></A>Side by Side Alignment</H4>\n");
-    ffShowSideBySide(f, leftAli, needle, needleNumOffset, haystack, hayNumOffset, haySize,
-		     hayOffStart, hayOffEnd, blockMaxGap, rcHaystack, TRUE);
-    fprintf(f, "<HR ALIGN=\"CENTER\">");
-    fprintf(f, "<EM>*Aligned Blocks with gaps <= %d bases are merged for "
-	    "this display when only one sequence has a gap, or when gaps in "
-	    "both sequences are of the same size.</EM>\n", blockMaxGap);
-    }
-if (rcNeedle)
-    reverseComplement(needle, needleSize);
-return anchorCount;
-}
-
-int ffShAli(FILE *f, struct ffAli *aliList, 
-    char *needleName, DNA *needle, int needleSize, int needleNumOffset,
-    char *haystackName, DNA *haystack, int haySize, int hayNumOffset,
-    int blockMaxGap, boolean rcNeedle)
-/* Display allignment on html page.  Returns number of blocks (after
- * merging blocks separated by blockMaxGap or less). */
-{
-return ffShAliPart(f, aliList, needleName, needle, needleSize, needleNumOffset,
-    haystackName, haystack, haySize, hayNumOffset, blockMaxGap, rcNeedle, FALSE,
-    TRUE, TRUE, TRUE, TRUE, FALSE, 0, 0, 0, 0);
-}
-
-void ffShowAli(struct ffAli *aliList, char *needleName, DNA *needle, int needleNumOffset,
-    char *haystackName, DNA *haystack, int hayNumOffset, boolean rcNeedle)
-/* Display allignment on html page. */
-{
-ffShAli(stdout, aliList, needleName, needle, strlen(needle), needleNumOffset,
-    haystackName, haystack, strlen(haystack), hayNumOffset, 8, rcNeedle);
-}
-#if 0 /* not used */
-static struct cdaAli *makeBlocks(struct ffAli *aliList, 
-    DNA *needle, int needleSize, DNA *hay, int haySize, boolean isRc)
-/* Merge together blocks separated only by noise, and evaluate
- * left, right, and middle of block for alignment strength. */
-{
-struct cdaAli *ca = cdaAliFromFfAli(aliList, 
-    needle, needleSize, hay, haySize, isRc);
-cdaCoalesceBlocks(ca);
-return ca;
-}
-#endif
diff --git a/gbtools/src/blatSrc/lib/gapCalc.c b/gbtools/src/blatSrc/lib/gapCalc.c
deleted file mode 100644
index d811c1b..0000000
--- a/gbtools/src/blatSrc/lib/gapCalc.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/* gapCalc - Stuff to calculate complex (but linear) gap costs quickly,
- * and read specifications from a file. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "gapCalc.h"
-
-
-struct gapCalc
-/* A structure that bundles together stuff to help us
- * calculate gap costs quickly. */
-    {
-    int smallSize; /* Size of tables for doing quick lookup of small gaps. */
-    int *qSmall;   /* Table for small gaps in q; */
-    int *tSmall;   /* Table for small gaps in t. */
-    int *bSmall;   /* Table for small gaps in either. */
-    int *longPos;/* Table of positions to interpolate between for larger gaps. */
-    double *qLong; /* Values to interpolate between for larger gaps in q. */
-    double *tLong; /* Values to interpolate between for larger gaps in t. */
-    double *bLong; /* Values to interpolate between for larger gaps in both. */
-    int longCount;	/* Number of long positions overall in longPos. */
-    int qPosCount;	/* Number of long positions in q. */
-    int tPosCount;	/* Number of long positions in t. */
-    int bPosCount;	/* Number of long positions in b. */
-    int qLastPos;	/* Maximum position we have data on in q. */
-    int tLastPos;	/* Maximum position we have data on in t. */
-    int bLastPos;	/* Maximum position we have data on in b. */
-    double qLastPosVal;	/* Value at max pos. */
-    double tLastPosVal;	/* Value at max pos. */
-    double bLastPosVal;	/* Value at max pos. */
-    double qLastSlope;	/* What to add for each base after last. */
-    double tLastSlope;	/* What to add for each base after last. */
-    double bLastSlope;	/* What to add for each base after last. */
-    };
-
-/* These are the gap costs used in the Evolution's Cauldron paper. */
-static char *originalGapCosts = 
-    "tableSize 11\n"
-    "smallSize 111\n"
-    "position 1 2 3 11 111 2111 12111 32111 72111 152111 252111\n"
-    "qGap 350 425 450 600 900 2900 22900 57900 117900 217900 317900\n"
-    "tGap 350 425 450 600 900 2900 22900 57900 117900 217900 317900\n"
-    "bothGap 750 825 850 1000 1300 3300 23300 58300 118300 218300 318300\n";
-
-/* These gap costs work well at chicken/human distances, and seem
- * to do ok closer as well, so they are now the default. */
-static char *defaultGapCosts =
-"tablesize       11\n"
-"smallSize       111\n"
-"position        1       2       3       11      111     2111    12111   32111   72111   152111  252111\n"
-"qGap    325     360     400     450     600     1100    3600    7600    15600   31600   56600\n"
-"tGap    325     360     400     450     600     1100    3600    7600    15600   31600   56600\n"
-"bothGap 625     660     700     750     900     1400    4000    8000    16000   32000   57000\n";
-
-/* These gap costs are for query=mRNA, target=DNA. */
-static char *rnaDnaGapCosts = 
-"tablesize       12\n"
-"smallSize       111\n"
-"position        1       2       3       11     31   111   2111    12111   32111   72111   152111  252111\n"
-       "qGap    325     360     400     450     600  800   1100    3600    7600    15600   31600   56600\n"
-       "tGap    200     210     220     250     300  400   500      600     800    1200     2000   4000\n"
-"       bothGap 625     660     700     750     900  1100  1400    4000    8000    16000   32000   57000\n";
-
-static char *cheapGapCosts = 
-    "tableSize 3\n"
-    "smallSize 100\n"
-    "position 1 100 1000\n"
-    "qGap 0 30 300\n"
-    "tGap 0 30 300\n"
-    "bothGap 0 30 300\n";
-
-
-char *gapCalcSampleFileContents()
-/* Return contents of a sample linear gap file. */
-{
-return defaultGapCosts;
-}
-
-static int interpolate(int x, int *s, double *v, int sCount)
-/* Find closest value to x in s, and then lookup corresponding
- * value in v.  Interpolate where necessary. */
-{
-int i, ds, ss;
-double dv;
-for (i=0; i<sCount; ++i)
-    {
-    ss = s[i];
-    if (x == ss)
-        return v[i];
-    else if (x < ss)
-        {
-	ds = ss - s[i-1];
-	dv = v[i] - v[i-1];
-	return v[i-1] + dv * (x - s[i-1]) / ds;
-	}
-    }
-/* If get to here extrapolate from last two values */
-ds = s[sCount-1] - s[sCount-2];
-dv = v[sCount-1] - v[sCount-2];
-return v[sCount-2] + dv * (x - s[sCount-2]) / ds;
-}
-
-static double calcSlope(double y2, double y1, double x2, double x1)
-/* Calculate slope of line from x1/y1 to x2/y2 */
-{
-return (y2-y1)/(x2-x1);
-}
-
-static void readTaggedNumLine(struct lineFile *lf, char *tag, 
-	int count, int *intOut,  double *floatOut)
-/* Read in a line that starts with tag and then has count numbers.
- * Complain and die if tag is unexpected or other problem occurs. 
- * Put output as integers and/or floating point into intOut and 
- * floatOut. */
-{
-char *line;
-int i = 0;
-char *word;
-if (!lineFileNextReal(lf, &line))
-   lineFileUnexpectedEnd(lf);
-word = nextWord(&line);
-if (!sameWord(tag, word))
-    errAbort("Expecting %s got %s line %d of %s",
-             tag, word, lf->lineIx, lf->fileName);
-for (i = 0; i < count; ++i)
-    {
-    word = nextWord(&line);
-    if (word == NULL)
-        errAbort("Not enough numbers line %d of %s", lf->lineIx, lf->fileName);
-    if (!isdigit(word[0]))
-        errAbort("Expecting number got %s line %d of %s",
-	         word, lf->lineIx, lf->fileName);
-    if (intOut)
-	intOut[i] = atoi(word);
-    if (floatOut)
-        floatOut[i] = atof(word);
-    }
-word = nextWord(&line);
-if (word != NULL)
-        errAbort("Too many numbers line %d of %s", lf->lineIx, lf->fileName);
-}
-
-struct gapCalc *gapCalcRead(struct lineFile *lf)
-/* Create gapCalc from open file. */
-{
-int i, tableSize, startLong = -1;
-struct gapCalc *gapCalc;
-int *gapInitPos;  
-double *gapInitQGap;  
-double *gapInitTGap;  
-double *gapInitBothGap;
-
-AllocVar(gapCalc);
-
-/* Parse file. */
-readTaggedNumLine(lf, "tableSize", 1, &tableSize, NULL);
-readTaggedNumLine(lf, "smallSize", 1, &gapCalc->smallSize, NULL);
-AllocArray(gapInitPos,tableSize);
-AllocArray(gapInitQGap,tableSize);
-AllocArray(gapInitTGap,tableSize);
-AllocArray(gapInitBothGap,tableSize);
-readTaggedNumLine(lf, "position", tableSize, gapInitPos, NULL);
-readTaggedNumLine(lf, "qGap", tableSize, NULL, gapInitQGap);
-readTaggedNumLine(lf, "tGap", tableSize, NULL, gapInitTGap);
-readTaggedNumLine(lf, "bothGap", tableSize, NULL, gapInitBothGap);
-
-/* Set up precomputed interpolations for small gaps. */
-AllocArray(gapCalc->qSmall, gapCalc->smallSize);
-AllocArray(gapCalc->tSmall, gapCalc->smallSize);
-AllocArray(gapCalc->bSmall, gapCalc->smallSize);
-for (i=1; i<gapCalc->smallSize; ++i)
-    {
-    gapCalc->qSmall[i] = 
-	interpolate(i, gapInitPos, gapInitQGap, tableSize);
-    gapCalc->tSmall[i] = 
-	interpolate(i, gapInitPos, gapInitTGap, tableSize);
-    gapCalc->bSmall[i] = interpolate(i, gapInitPos, 
-	gapInitBothGap, tableSize);
-    }
-
-/* Set up to handle intermediate values. */
-for (i=0; i<tableSize; ++i)
-    {
-    if (gapCalc->smallSize == gapInitPos[i])
-	{
-	startLong = i;
-	break;
-	}
-    }
-if (startLong < 0)
-    errAbort("No position %d in gapCalcRead()\n", gapCalc->smallSize);
-gapCalc->longCount = tableSize - startLong;
-gapCalc->qPosCount = tableSize - startLong;
-gapCalc->tPosCount = tableSize - startLong;
-gapCalc->bPosCount = tableSize - startLong;
-gapCalc->longPos = cloneMem(gapInitPos + startLong, gapCalc->longCount * sizeof(int));
-gapCalc->qLong = cloneMem(gapInitQGap + startLong, gapCalc->qPosCount * sizeof(double));
-gapCalc->tLong = cloneMem(gapInitTGap + startLong, gapCalc->tPosCount * sizeof(double));
-gapCalc->bLong = cloneMem(gapInitBothGap + startLong, gapCalc->bPosCount * sizeof(double));
-
-/* Set up to handle huge values. */
-gapCalc->qLastPos = gapCalc->longPos[gapCalc->qPosCount-1];
-gapCalc->tLastPos = gapCalc->longPos[gapCalc->tPosCount-1];
-gapCalc->bLastPos = gapCalc->longPos[gapCalc->bPosCount-1];
-gapCalc->qLastPosVal = gapCalc->qLong[gapCalc->qPosCount-1];
-gapCalc->tLastPosVal = gapCalc->tLong[gapCalc->tPosCount-1];
-gapCalc->bLastPosVal = gapCalc->bLong[gapCalc->bPosCount-1];
-gapCalc->qLastSlope = calcSlope(gapCalc->qLastPosVal, gapCalc->qLong[gapCalc->qPosCount-2],
-			   gapCalc->qLastPos, gapCalc->longPos[gapCalc->qPosCount-2]);
-gapCalc->tLastSlope = calcSlope(gapCalc->tLastPosVal, gapCalc->tLong[gapCalc->tPosCount-2],
-			   gapCalc->tLastPos, gapCalc->longPos[gapCalc->tPosCount-2]);
-gapCalc->bLastSlope = calcSlope(gapCalc->bLastPosVal, gapCalc->bLong[gapCalc->bPosCount-2],
-			   gapCalc->bLastPos, gapCalc->longPos[gapCalc->bPosCount-2]);
-freez(&gapInitPos);
-freez(&gapInitQGap);
-freez(&gapInitTGap);
-freez(&gapInitBothGap);
-return gapCalc;
-}
-
-struct gapCalc *gapCalcFromString(char *s)
-/* Return gapCalc from description string. */
-{
-struct lineFile *lf = lineFileOnString("string", TRUE, cloneString(s));
-struct gapCalc *gapCalc = gapCalcRead(lf);
-lineFileClose(&lf);
-return gapCalc;
-}
-
-struct gapCalc *gapCalcFromFile(char *fileName)
-/* Return gapCalc from file. */
-{
-struct gapCalc *gapCalc = NULL;
-
-if (sameString(fileName, "loose"))
-    {
-    verbose(2, "using loose linear gap costs (chicken/human)\n");
-    gapCalc = gapCalcFromString(defaultGapCosts);
-    }
-else if (sameString(fileName, "medium"))
-    {
-    verbose(2, "using medium (original) linear gap costs (mouse/human)\n");
-    gapCalc = gapCalcFromString(originalGapCosts);
-    }
-else
-    {
-    struct lineFile *lf = lineFileOpen(fileName, TRUE);
-    gapCalc = gapCalcRead(lf);
-    lineFileClose(&lf);
-    }
-return gapCalc;
-}
-
-struct gapCalc *gapCalcDefault()
-/* Return default gapCalc. */
-{
-return gapCalcFromString(defaultGapCosts);
-}
-
-struct gapCalc *gapCalcRnaDna()
-/* Return gaps suitable for RNA queries vs. DNA targets */
-{
-return gapCalcFromString(rnaDnaGapCosts);
-}
-
-struct gapCalc *gapCalcCheap()
-/* Return cheap gap costs. */
-{
-return gapCalcFromString(cheapGapCosts);
-}
-
-struct gapCalc *gapCalcOriginal()
-/* Return gap costs from original paper. */
-{
-return gapCalcFromString(originalGapCosts);
-}
-
-void gapCalcFree(struct gapCalc **pGapCalc)
-/* Free up resources associated with gapCalc. */
-{
-struct gapCalc *gapCalc = *pGapCalc;
-if (gapCalc != NULL)
-    {
-    freeMem(gapCalc->qSmall);
-    freeMem(gapCalc->tSmall);
-    freeMem(gapCalc->bSmall);
-    freeMem(gapCalc->longPos);
-    freeMem(gapCalc->qLong);
-    freeMem(gapCalc->tLong);
-    freeMem(gapCalc->bLong);
-    freez(pGapCalc);
-    }
-}
-
-int gapCalcCost(struct gapCalc *gapCalc, int dq, int dt)
-/* Figure out gap costs. */
-{
-if (dt < 0) dt = 0;
-if (dq < 0) dq = 0;
-if (dt == 0)
-    { 
-    if (dq < gapCalc->smallSize)
-        return gapCalc->qSmall[dq];
-    else if (dq >= gapCalc->qLastPos)
-        return gapCalc->qLastPosVal + gapCalc->qLastSlope * (dq-gapCalc->qLastPos);
-    else
-        return interpolate(dq, gapCalc->longPos, gapCalc->qLong, gapCalc->qPosCount);
-    }
-else if (dq == 0)
-    {
-    if (dt < gapCalc->smallSize)
-        return gapCalc->tSmall[dt];
-    else if (dt >= gapCalc->tLastPos)
-        return gapCalc->tLastPosVal + gapCalc->tLastSlope * (dt-gapCalc->tLastPos);
-    else
-        return interpolate(dt, gapCalc->longPos, gapCalc->tLong, gapCalc->tPosCount);
-    }
-else
-    {
-    int both = dq + dt;
-    if (both < gapCalc->smallSize)
-        return gapCalc->bSmall[both];
-    else if (both >= gapCalc->bLastPos)
-        return gapCalc->bLastPosVal + gapCalc->bLastSlope * (both-gapCalc->bLastPos);
-    else
-        return interpolate(both, gapCalc->longPos, gapCalc->bLong, gapCalc->bPosCount);
-    }
-}
-
-void gapCalcTest(struct gapCalc *gapCalc)
-/* Print out gap cost info. */
-{
-int i;
-for (i=1; i<=10; i++)
-   {
-   verbose(1, "%d: %d %d %d\n", i, gapCalcCost(gapCalc, i, 0), 
-           gapCalcCost(gapCalc, 0, i), gapCalcCost(gapCalc, i/2, i-i/2));
-   }
-for (i=1; ; i *= 10)
-   {
-   verbose(1, "%d: %d %d %d\n", i, gapCalcCost(gapCalc, i, 0), gapCalcCost(gapCalc, 0, i), 
-           gapCalcCost(gapCalc, i/2, i-i/2));
-   if (i == 1000000000)
-       break;
-   }
-verbose(1, "%d %d cost %d\n", 6489540, 84240, gapCalcCost(gapCalc, 84240, 6489540));
-verbose(1, "%d %d cost %d\n", 2746361, 1075188, gapCalcCost(gapCalc, 1075188, 2746361));
-verbose(1, "%d %d cost %d\n", 6489540 + 2746361 + 72, 84240 + 1075188 + 72, gapCalcCost(gapCalc, 84240 + 1075188 + 72, 6489540 + 2746361 + 72));
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/gdf.c b/gbtools/src/blatSrc/lib/gdf.c
deleted file mode 100644
index df8e767..0000000
--- a/gbtools/src/blatSrc/lib/gdf.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* gdf - Intronerator Gene Description File. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "gdf.h"
-
-
-struct gdfGene *newGdfGene(char *name, int nameSize, int exonCount, char strand, UBYTE chromIx)
-/* Return a new gene. */
-{
-struct gdfGene *gene = needMem(sizeof *gene);
-gene->name = cloneStringZ(name, nameSize);
-gene->dataCount = exonCount*2;
-if (exonCount > 0)
-    {
-    gene->dataPoints = 
-	    needMem(gene->dataCount * sizeof(gene->dataPoints[0]));
-    }
-gene->strand = strand;
-gene->chromIx = chromIx;
-return gene;
-}
-
-void gdfFreeGene(struct gdfGene *gene)
-/* Free a gene. */
-{
-if (gene != NULL)
-    {
-    freeMem(gene->name);
-    freeMem(gene->dataPoints);
-    freeMem(gene);
-    }
-}
-
-void gdfFreeGeneList(struct gdfGene **pList)
-/* Free a whole list of genes. */
-{
-struct gdfGene *gene, *next;
-gene = *pList;
-while (gene != NULL)
-    {
-    next = gene->next;
-    gdfFreeGene(gene);
-    gene = next;
-    }
-*pList = NULL;
-}
-
-struct gdfGene *gdfReadOneGene(FILE *f)
-/* Read one entry from a Gdf file.  Assumes that the file pointer
- * is in the right place. */
-{
-short pointCount;
-char strand;
-UBYTE geneNameSize, chromIx;
-char geneNameBuf[128];
-struct gdfGene *gene;
-
-mustReadOne(f, geneNameSize);
-mustRead(f, geneNameBuf, geneNameSize);
-geneNameBuf[geneNameSize] = 0;
-mustReadOne(f, chromIx);
-mustReadOne(f, strand);
-mustReadOne(f, pointCount);
-gene = newGdfGene(geneNameBuf, geneNameSize, pointCount>>1, strand, chromIx);
-mustRead(f, gene->dataPoints, sizeof(gene->dataPoints[0]) * pointCount);
-return gene;
-}
-
-void gdfGeneExtents(struct gdfGene *gene, long *pMin, long *pMax)
-/* Figure out first and last base in gene. */
-{
-int i;
-long x;
-long min=0x7000000;
-long max = -min;
-
-for (i=0; i<gene->dataCount; i+=1)
-    {
-    x = gene->dataPoints[i].start;
-    if (x < min)
-	min = x;
-    if (x > max)
-	max = x;
-    }
-*pMin = min;
-*pMax = max;
-}
-
-void gdfOffsetGene(struct gdfGene *gene, int offset)
-/* Add offset to each point in gene */
-{
-struct gdfDataPoint *dp = gene->dataPoints;
-int count = gene->dataCount;
-int i;
-for (i=0; i<count; ++i)
-    dp[i].start += offset;
-}
-
-void gdfRcGene(struct gdfGene *gene, int size)
-/* Flip gene to other strand. Assumes dataPoints are already
- * moved into range from 0-size */
-{
-struct gdfDataPoint *s = gene->dataPoints, *e, temp;
-int count = gene->dataCount;
-int i;
-int halfCount = count/2;
-
-
-for (i=0; i<count; ++i)
-    {
-    s->start = reverseOffset(s->start, size) + 1;
-    ++s;
-    }
-s = gene->dataPoints;
-e = s + gene->dataCount-1;
-for (i=0; i<halfCount; i += 1)
-    {
-    memcpy(&temp, s, sizeof(temp));
-    memcpy(s, e, sizeof(temp));
-    memcpy(e, &temp, sizeof(temp));
-    s += 1;
-    e -= 1;
-    }
-}
-
-
-void gdfUpcExons(struct gdfGene *gene, int geneOffset, DNA *dna, int dnaSize, int dnaOffset)
-/* Uppercase exons in DNA. */
-{
-struct gdfDataPoint *dp = gene->dataPoints;
-int count = gene->dataCount;
-int start, end;
-long gffStart, gffEnd;
-int combinedOffset;
-int i;
-
-gdfGeneExtents(gene, &gffStart, &gffEnd);
-combinedOffset = -gffStart + geneOffset - dnaOffset;
-for (i=0; i<count; i += 2)
-    {
-    start = dp[i].start + combinedOffset;
-    end = dp[i+1].start + combinedOffset;
-    if (end <= 0 || start >= dnaSize)
-        continue;
-    if (start < 0) start = 0;
-    if (end > dnaSize) end = dnaSize;
-    toUpperN(dna+start, end-start);
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/gemfont.c b/gbtools/src/blatSrc/lib/gemfont.c
deleted file mode 100644
index 941b447..0000000
--- a/gbtools/src/blatSrc/lib/gemfont.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/* gemfont.c - Raster Font stuff, draws text based on a blit and a font
-   in a format that some day may approach Ventura Publisher, but currently
-   looks much more like GEM on the ST with some Mac-like mutations. */
-
-#include "common.h"
-#include "memgfx.h"
-#include "gemfont.h"
-
-
-typedef union
-    {
-    int  theInt;
-    char bytes[2];
-    } myInt;
-
-void gfText(struct memGfx *screen, struct font_hdr *f, char *text, 
-       int x, int y, Color color, TextBlit tblit, Color bcolor)
-{
-UBYTE *s = (UBYTE*)text;
-UBYTE *ss;
-int c, lo, hi;
-int sx, imageWid;
-WORD *off, wd, ht;
-UBYTE *data;
-myInt *OWtab, *iPtr;
-int missChar;
-int font_type;
-int extraWidth = f->lft_ofst + f->rgt_ofst;
-
-x += f->xOff;
-y += f->yOff;
-x += f->lft_ofst;
-lo = f->ADE_lo;
-hi = f->ADE_hi;
-off = f->ch_ofst;
-wd = f->frm_wdt;
-ht = f->frm_hgt,
-data = f->fnt_dta;
-OWtab= (myInt *)(f->hz_ofst);
-font_type = f->id;
-
-while ((c = *s++)!=0)
-    {
-    /* If we don't have the character, just turn it into a space. */
-    if (c > hi)
-	{
-	c = ' ';
-	}
-    c -= lo;
-    if (c < 0)
-	{
-	c = ' ' - lo;
-	}
-
-    /* Mac prop font && its a missing char */
-    if (font_type == MPROP && (*(OWtab+c)).theInt == -1) 
-	{            
-	c=hi-lo;                      /* last char is set */
-	missChar=1;
-	sx = off[c+1];
-	imageWid= f->frm_wdt*8 - sx;  /* sort of a kludge */
-	}
-    else 
-	{
-	missChar=0;
-	sx = off[c];
-	imageWid = off[c+1]-sx;
-	}
-    (*tblit)(imageWid, ht, sx, 0, data, wd, screen, x, y, color, bcolor);
-    switch (font_type)
-	{
-	case STPROP:
-	    x += imageWid + extraWidth;
-	    break;
-	case MFIXED:
-	    x += f->wchr_wdt + extraWidth;          
-	    break;
-	case MPROP:
-	    iPtr=OWtab+c;  
-	    if (!missChar)
-		    /* -1 means its a missing character */
-		{
-		x += (int)((*iPtr).bytes[1]);
-		ss=s;
-		if ((c=*(ss++)) != 0)
-			/* look to next char to determine amt to change x */
-		    {
-		    c-= lo;
-		    iPtr=OWtab+c;
-		    /* subtract kern Of Next char */
-		    /* f->rgt_ofst is neg of Mac maxKern value */
-		    if ((*iPtr).theInt!=-1)
-		       x += (int)((*iPtr).bytes[0])+ f->rgt_ofst;  
-		    }           
-		}
-	    else /* display the non print char */
-		x+=imageWid + extraWidth;
-	    break;
-	}
-    }
-}
-
-static int fchar_width(struct font_hdr *f,unsigned char *s)
-/* How wide is this character? */
-{
-int c;
-signed char *offsets;
-int width;
-int t;
-
-c = *s++;
-if (c > f->ADE_hi)
-    c = ' ';
-c -= f->ADE_lo;
-if (c < 0)
-    {
-    c = ' ' - f->ADE_lo;
-    }
-switch (f->id)
-    {
-    case MFIXED:
-	    return(f->wchr_wdt + f->lft_ofst + f->rgt_ofst);
-    case STPROP:
-	    return(f->ch_ofst[c+1] - f->ch_ofst[c] + f->lft_ofst + f->rgt_ofst);
-    case MPROP:
-	    offsets = f->hz_ofst+c*2;
-	    if (offsets[0] == -1 && offsets[1] == -1)	/* missing char */
-		{
-		t = f->ADE_hi - f->ADE_lo;
-		return( f->frm_wdt*8 - f->ch_ofst[t+1]);
-		}
-	    else
-		{
-		width = offsets[1];
-		if ((c = *s++) != 0)
-			{
-			c -= f->ADE_lo;
-			offsets = f->hz_ofst+c*2;
-			width += offsets[0] + f->rgt_ofst;
-			}
-		return(width);
-		}
-    default:
-         internalErr();
-	 return 0;
-    }
-}
-
-long fnstring_width(struct font_hdr *f, unsigned char *s, int n)
-{
-long acc = 0;
-
-while (--n >= 0)
-    {
-    acc += fchar_width(f, s);
-    s++;
-    }
-return(acc);
-}
-
-#if 0 /* unused */
-static long fstring_width(struct font_hdr *f, unsigned char *s)
-{
-return(fnstring_width(f, s, strlen((char *)s)));
-}
-#endif
-
-
-int fwidest_char(struct font_hdr *f)
-{
-unsigned char buf[2];
-int i;
-int c;
-int widest = 1;
-int w;
-
-c = f->ADE_lo;
-i = f->ADE_hi - c;
-buf[1] = 0;
-while (--i >= 0)
-	{
-	buf[0] = c++;
-	w = fchar_width(f, buf);
-	if (w > widest)
-		widest = w;
-	}
-return(widest);
-}
-
-int font_cel_height(struct font_hdr *f)
-/* How tall is font? */
-{
-return f->frm_hgt;
-}
-
-int font_line_height(struct font_hdr *f)
-/* How far to next line. */
-{
-return f->lineHeight;
-}
diff --git a/gbtools/src/blatSrc/lib/gemfont.h b/gbtools/src/blatSrc/lib/gemfont.h
deleted file mode 100644
index ad67a04..0000000
--- a/gbtools/src/blatSrc/lib/gemfont.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-#ifndef GEMFONT_H
-#define GEMFONT_H
-
-/* This file supports GEM style fonts.  They live on disk in three parts.
-   1st there's the header structure below, then a list of 'x' offsets into
-   the data - one 16-bit word for each offset, and 1 offset for each letter
-   in the font plus an extra offset at the end.
-
-   This is followed by the data which is a single bitmap.
-   */
-
-struct	font_hdr {
-WORD	id;			/* some random number, doesnt matter */
-WORD	size;		/* Size in points.  Somehow related to pixel height. */
-char	facename[32];	/* Give it a name, don't really matter. */
-WORD	ADE_lo;		/* Lowest ascii character in font */
-WORD	ADE_hi;		/* Highest ascii character in font */
-WORD	top_dist;
-WORD	asc_dist;	/* Ascender to baseline?? */
-WORD	hlf_dist;
-WORD	des_dist;	/* des for descender. */
-WORD	bot_dist;
-WORD	wchr_wdt;	/* Widest character width. */
-WORD	wcel_wdt;	/* Widest 'cell' width (includes distance to next character) */
-WORD	lft_ofst;
-WORD	rgt_ofst;
-WORD	thckning;
-WORD	undrline;
-WORD	lghtng_m;	/* Lightening mask.  Just use 0x55aa. */
-WORD	skewng_m;	/* Skewing mask for italics. If 1 bit rotate this line. 0xaaaa*/
-WORD	flags;		/* Just set to zero.  Half-assed intel swap if otherwise. */
-signed char *hz_ofst;  /* On disk byte offset from beginning of file to hor. offsets */
-WORD	*ch_ofst;	/* On disk byte offset to beginning of ?? kerning ?? data. */
-UBYTE	*fnt_dta;	/* On disk byte offset to beginning of bitmap. */
-WORD	frm_wdt;	/* Byte width of bitmap. */
-WORD	frm_hgt;	/* Pixel height of bitmap. */
-struct font_hdr	*nxt_fnt; /* Set to 0 */
-WORD    xOff;		/* X offset to add. */
-WORD    yOff;		/* Y offset to add. */
-WORD    lineHeight;     /* Distance to next line. */
-WORD	psHeight;	/* Height to set for equivalent postscript. */
-}; 
-
-#define STPROP 0
-#define MFIXED 1
-#define MPROP 2
-
-/* Write a line of graphics text. */
-void gfText(struct memGfx *screen, struct font_hdr *f, char *text, 
-       int x, int y, Color color, TextBlit tblit, Color bcolor);
-
-/* How tall is font? */
-int font_cel_height(struct font_hdr *f);
-
-/* How far to next line. */
-int font_line_height(struct font_hdr *f);
-
-/* How wide would this bunch of characters be? */
-long fnstring_width(struct font_hdr *f, unsigned char *s, int n);
-
-/* How wide is widest char in font? */
-int fwidest_char(struct font_hdr *f);
-
-#endif 
diff --git a/gbtools/src/blatSrc/lib/genomeRangeTree.c b/gbtools/src/blatSrc/lib/genomeRangeTree.c
deleted file mode 100644
index bbcf26b..0000000
--- a/gbtools/src/blatSrc/lib/genomeRangeTree.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* genomeRangeTree - This module is a way of keeping track of
- * non-overlapping ranges (half-open intervals) across a whole
- * genome (multiple chromosomes or scaffolds). 
- * It is a hash table container mapping chrom to rangeTree.
- * Most of the work is performed by rangeTree, this container
- * enables local memory and stack to be shared by many rangeTrees
- * so it should be able to handle genomes with a very large 
- * number of scaffolds. See rangeTree for more information. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "sig.h"
-#include "localmem.h"
-#include "rbTree.h"
-#include "hash.h"
-#include "rangeTree.h"
-#include "genomeRangeTree.h"
-#include "dystring.h"
-#include <limits.h>
-
-
-struct genomeRangeTree *genomeRangeTreeNewSize(int hashPowerOfTwoSize)
-/* Create a new, empty, genomeRangeTree. 
- * Free with genomeRangeTreeFree. */
-{
-struct genomeRangeTree *t;
-AllocVar(t); 
-t->hash = newHash(hashPowerOfTwoSize);
-t->lm = lmInit(0);
-return t;
-}
-
-struct genomeRangeTree *genomeRangeTreeNew()
-/* Create a new, empty, genomeRangeTree. Uses the default hash size.
- * Free with genomeRangeTreeFree. */
-{
-return genomeRangeTreeNewSize(0);
-}
-
-void genomeRangeTreeFree(struct genomeRangeTree **pTree)
-/* Free up genomeRangeTree.  */
-{
-struct genomeRangeTree *grt = *pTree;
-if (grt != NULL)
-    {
-    /* need to manually free object due to thee way rbTreeNewDetailed is done */
-    struct hashCookie hc = hashFirst(grt->hash);
-    struct hashEl *hel;
-    while ((hel = hashNext(&hc)) != NULL)
-	freeMem(hel->val);
-
-    lmCleanup(&(grt->lm));  /* clean up all the memory for all nodes for all trees */
-    freeHash(&(grt->hash)); /* free the hash table including names (trees are freed by lmCleanup) */
-    freez(pTree);                /* free this */
-    }
-}
-
-struct rbTree *genomeRangeTreeFindRangeTree(struct genomeRangeTree *tree, char *chrom)
-/* Find the rangeTree for this chromosome, if any. Returns NULL if chrom not found. */
-{
-return hashFindVal(tree->hash, chrom);
-}
-
-struct rbTree *genomeRangeTreeFindOrAddRangeTree(struct genomeRangeTree *tree, char *chrom)
-/* Find the rangeTree for this chromosome, or add new chrom and empty rangeTree if not found. */
-{
-struct hashEl *hel;
-hel = hashStore(tree->hash, chrom);
-if (hel->val == NULL) /* need to add a new rangeTree */
-    hel->val = rangeTreeNewDetailed(tree->lm, tree->stack);
-return hel->val;
-}
-
-struct range *genomeRangeTreeAdd(struct genomeRangeTree *tree, char *chrom, int start, int end)
-/* Add range to tree, merging with existing ranges if need be. 
- * Adds new rangeTree if chrom not found. */
-{
-return rangeTreeAdd(genomeRangeTreeFindOrAddRangeTree(tree,chrom), start, end);
-}
-
-struct range *genomeRangeTreeAddVal(struct genomeRangeTree *tree, char *chrom, int start, int end, void *val, void *(*mergeVals)(void *existing, void*new))
-/* Add range to tree, merging with existing ranges if need be. 
- * Adds new rangeTree if chrom not found. 
- * If this is a new range, set the value to this val.
- * If there are existing items for this range, and if mergeVals function is not null, 
- * apply mergeVals to the existing values and this new val, storing the result as the val
- * for this range (see rangeTreeAddValCount() and rangeTreeAddValList() below for examples). */
-{
-return rangeTreeAddVal(genomeRangeTreeFindOrAddRangeTree(tree,chrom), start, end, val, mergeVals);
-}
-
-struct range *genomeRangeTreeAddValCount(struct genomeRangeTree *tree, char *chrom, int start, int end)
-/* Add range to tree, merging with existing ranges if need be. 
- * Adds new rangeTree if chrom not found. 
- * Set range val to count of elements in the range. Counts are pointers to 
- * ints allocated in tree localmem */
-{
-return rangeTreeAddValCount(genomeRangeTreeFindOrAddRangeTree(tree,chrom), start, end);
-}
-
-struct range *genomeRangeTreeAddValList(struct genomeRangeTree *tree, char *chrom, int start, int end, void *val)
-/* Add range to tree, merging with existing ranges if need be. 
- * Adds new rangeTree if chrom not found. 
- * Add val to the list of values (if any) in each range.
- * val must be valid argument to slCat (ie, be a struct with a 'next' pointer as its first member) */
-{
-return rangeTreeAddValList(genomeRangeTreeFindOrAddRangeTree(tree,chrom), start, end, val);
-}
-
-boolean genomeRangeTreeOverlaps(struct genomeRangeTree *tree, char *chrom, int start, int end)
-/* Return TRUE if start-end overlaps anything in tree */
-{
-struct rbTree *t;
-return (t=genomeRangeTreeFindRangeTree(tree,chrom)) ? rangeTreeOverlaps(t, start, end) : FALSE;
-}
-
-int genomeRangeTreeOverlapSize(struct genomeRangeTree *tree, char *chrom, int start, int end)
-/* Return the total size of intersection between interval
- * from start to end, and items in range tree. Sadly not
- * thread-safe. */
-{
-struct rbTree *t;
-return (t=genomeRangeTreeFindRangeTree(tree,chrom)) ? rangeTreeOverlapSize(t, start, end) : 0;
-}
-
-struct range *genomeRangeTreeFindEnclosing(struct genomeRangeTree *tree, char *chrom, int start, int end)
-/* Find item in range tree that encloses range between start and end 
- * if there is any such item. */
-{
-struct rbTree *t;
-return (t=genomeRangeTreeFindRangeTree(tree,chrom)) ? rangeTreeFindEnclosing(t, start, end) : NULL;
-}
-
-struct range *genomeRangeTreeAllOverlapping(struct genomeRangeTree *tree, char *chrom, int start, int end)
-/* Return list of all items in range tree that overlap interval start-end.
- * Do not free this list, it is owned by tree.  However it is only good until
- * next call to rangeTreeFindInRange or rangeTreeList. Not thread safe. */
-{
-struct rbTree *t;
-return (t=genomeRangeTreeFindRangeTree(tree,chrom)) ? rangeTreeAllOverlapping(t, start, end) : NULL;
-}
-
-struct range *genomeRangeTreeMaxOverlapping(struct genomeRangeTree *tree, char *chrom, int start, int end)
-/* Return item that overlaps most with start-end. Not thread safe.  Trashes list used
- * by rangeTreeAllOverlapping. */
-{
-struct rbTree *t;
-return (t=genomeRangeTreeFindRangeTree(tree,chrom)) ? rangeTreeMaxOverlapping(t, start, end) : NULL;
-}
-
-struct range *genomeRangeTreeList(struct genomeRangeTree *tree, char *chrom)
-/* Return list of all ranges in single rangeTree in order.  Not thread safe. 
- * No need to free this when done, memory is local to tree. */
-{
-struct rbTree *t;
-return (t=genomeRangeTreeFindRangeTree(tree,chrom)) ? rangeTreeList(t) : NULL;
-}
-
-/* globals used for genomeRangeTreeToString */
-struct dyString *tmpTreeToString = NULL;
-char *tmpTreeToStringCurChrom = NULL;
-void tmpNodeToString(void *item)
-{
-struct range *r = item;
-dyStringPrintf(tmpTreeToString, " (%d,%d)", r->start, r->end);
-}
-
-struct dyString *genomeRangeTreeToString(struct genomeRangeTree *tree)
-/* Return a string representation of the genomeRangeTree.
- * Useful for testing.
- * Not thread-safe; uses globals */
-{
-struct hashEl *chrom, *chromList = hashElListHash(tree->hash);
-slSort(&chromList, hashElCmp); /* alpha sort on chrom */
-dyStringFree(&tmpTreeToString);
-tmpTreeToString = newDyString(0);
-dyStringAppend(tmpTreeToString, "[tree");
-for (chrom = chromList ; chrom ; chrom = chrom->next)
-    {
-    dyStringPrintf(tmpTreeToString, " [%s:", chrom->name);
-    rbTreeTraverse(genomeRangeTreeFindRangeTree(tree, chrom->name), tmpNodeToString);
-    dyStringAppend(tmpTreeToString, "]");
-    }
-dyStringAppend(tmpTreeToString, "]");
-hashElFreeList(&chromList);
-return tmpTreeToString;
-}
-
-long long genomeRangeTreeSumRanges(struct genomeRangeTree *grt)
-/* Sum up all ranges in tree. */
-{
-long long sum = 0;
-struct hashEl *chrom, *chromList = hashElListHash(grt->hash);
-for (chrom = chromList; chrom != NULL; chrom = chrom->next)
-    rbTreeTraverseWithContext(chrom->val, rangeTreeSumRangeCallback, &sum);
-hashElFreeList(&chromList);
-return sum;
-}
-
diff --git a/gbtools/src/blatSrc/lib/gfNet.c b/gbtools/src/blatSrc/lib/gfNet.c
deleted file mode 100644
index 609698d..0000000
--- a/gbtools/src/blatSrc/lib/gfNet.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* gfNet.c - Network dependent stuff for blat server. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "errAbort.h"
-#include "genoFind.h"
-#include "net.h"
-
-
-int gfConnect(char *hostName, char *portName)
-/* Start connection with server. */
-{
-/* Connect to server. */
-int sd = netConnect(hostName, atoi(portName));
-if (sd < 0)
-    {
-    errnoAbort("Sorry, the BLAT/iPCR server seems to be down.  Please try "
-               "again later.");
-    }
-return sd;
-}
-
diff --git a/gbtools/src/blatSrc/lib/gff.c b/gbtools/src/blatSrc/lib/gff.c
deleted file mode 100644
index 6058e01..0000000
--- a/gbtools/src/blatSrc/lib/gff.c
+++ /dev/null
@@ -1,474 +0,0 @@
-/* gff - routines to read many types of gff and gtf files
- * and turn them into a relatively easy to deal with form
- * in memory.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "hash.h"
-#include "linefile.h"
-#include "gff.h"
-#include "obscure.h"
-#include "dystring.h"
-
-
-void gffGroupFree(struct gffGroup **pGroup)
-/* Free up a gffGroup including lineList. */
-{
-struct gffGroup *group;
-if ((group = *pGroup) != NULL)
-    {
-    slFreeList(&group->lineList);
-    freez(pGroup);
-    }
-}
-
-void gffGroupFreeList(struct gffGroup **pList)
-/* Free up a list of gffGroups. */
-{
-struct gffGroup *el, *next;
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    gffGroupFree(&el);
-    }
-*pList = NULL;
-}
-
-
-void gffFileFree(struct gffFile **pGff)
-/* Free up a gff file. */
-{
-struct gffFile *gff;
-if ((gff = *pGff) != NULL)
-    {
-    freeMem(gff->fileName);
-    freeHash(&gff->seqHash);
-    freeHash(&gff->sourceHash);
-    freeHash(&gff->featureHash);
-    freeHash(&gff->groupHash);
-    freeHash(&gff->geneIdHash);
-    freeHash(&gff->strPool);
-    slFreeList(&gff->lineList);
-    slFreeList(&gff->seqList);
-    slFreeList(&gff->sourceList);
-    slFreeList(&gff->featureList);
-    slFreeList(&gff->geneIdList);
-    gffGroupFreeList(&gff->groupList);
-    freez(pGff);
-    }
-}
-
-static char *gffFileGetStr(struct gffFile *gff, char *str)
-/* get a string from the string pool */
-{
-return hashStore(gff->strPool,  str)->name;
-}
-
-int gffLineCmp(const void *va, const void *vb)
-/* Compare two gffLines. */
-{
-const struct gffLine *a = *((struct gffLine **)va);
-const struct gffLine *b = *((struct gffLine **)vb);
-int diff;
-
-/* for overlaping starts, sort by end, genePredFromGroupedGtf() depends on
- * this */
-diff = strcmp(a->seq, b->seq);
-if (diff == 0)
-    diff = a->start - b->start;
-if (diff == 0)
-    diff = a->end - b->end;
-return diff;
-}
-
-
-static void gffSyntaxError(char *fileName, int line, char *msg)
-/* Complain about syntax error in GFF file. */
-{
-errAbort("%s Bad line %d of %s:\n", msg, line, fileName);
-}
-
-static char *gffTnName(char *seqName, char *groupName)
-/* Make name that encorperates seq and group names.... */
-{
-static struct dyString *nameBuf = NULL;
-if (nameBuf == NULL)
-    nameBuf = dyStringNew(0);
-dyStringClear(nameBuf);
-if (startsWith("gene-", groupName))
-    groupName += 5;
-if (startsWith("cc_", groupName))
-    groupName += 3;
-dyStringAppend(nameBuf, groupName);
-
-return nameBuf->string;
-}
-
-static boolean isGtfGroup(char *group)
-/* Return TRUE if group field looks like GTF */
-{
-if (strstr(group, "gene_id") == NULL)
-    return FALSE;
-if (countChars(group, '"') >= 2)
-    return TRUE;
-if (strstr(group, "transcript_id") != NULL)
-    return TRUE;
-return FALSE;
-}
-
-boolean gffHasGtfGroup(char *line)
-/* Return TRUE if line has a GTF group field */
-{
-char *words[10];
-char *dupe = cloneString(line);
-int wordCt = chopTabs(dupe, words);
-boolean isGtf = FALSE;
-if (wordCt >= 9) 
-    if (isGtfGroup(words[8]))
-        isGtf = TRUE;
-freeMem(dupe);
-return isGtf;
-}
-
-static void readQuotedString(char *fileName, int lineIx, char *in, char *out, char **retNext)
-/* Parse quoted string and abort on error. */
-{
-if (!parseQuotedString(in, out, retNext))
-    errAbort("Line %d of %s\n", lineIx, fileName);
-}
-
-static void parseGtfEnd(char *s, struct gffFile *gff, struct gffLine *gl, 
-    char *fileName, int lineIx)
-/* Read the semi-colon separated end bits of a GTF line into gl and
- * hashes. */
-{
-char *type, *val;
-struct hashEl *hel;
-bool gotSemi;
-
-for (;;)
-   {
-   gotSemi = FALSE;
-   if ((type = nextWord(&s)) == NULL)
-       break;
-   s = skipLeadingSpaces(s);
-   if (NULL == s || s[0] == 0)
-       errAbort("Unpaired type(%s)/val on end of gtf line %d of %s", type, lineIx, fileName);
-   if (s[0] == '"' || s[0] == '\'')
-       {
-       val = s;
-       readQuotedString(fileName, lineIx, s, val, &s);
-       }
-   else
-       {
-       int len;
-       val = nextWord(&s);
-       len = strlen(val) - 1;
-       if (val[len] == ';')
-	   {
-	   val[len] = 0;
-	   len -= 1;
-           gotSemi = TRUE;
-	   }
-       if (len < 0)
-           errAbort("Empty value for %s line %d of %s", type, lineIx, fileName);
-       }
-   if (s != NULL && !gotSemi)
-      {
-      s = strchr(s, ';');
-      if (s != NULL)
-         ++s;
-      }
-   /* only use the first occurance of gene_id and transcript_id */
-   if (sameString("gene_id", type) && (gl->geneId == NULL))
-       {
-       struct gffGeneId *gg;
-       if ((hel = hashLookup(gff->geneIdHash, val)) == NULL)
-	   {
-	   AllocVar(gg);
-           hel = hashAdd(gff->geneIdHash, val, gg);
-	   gg->name = hel->name;
-	   slAddHead(&gff->geneIdList, gg);
-	   }
-	else
-	   {
-	   gg = hel->val;
-	   }
-       gl->geneId = gg->name;
-       }
-   else if (sameString("transcript_id", type) && (gl->group == NULL))
-       {
-       struct gffGroup *gg;
-       if ((hel = hashLookup(gff->groupHash, val)) == NULL)
-	   {
-	   AllocVar(gg);
-           hel = hashAdd(gff->groupHash, val, gg);
-	   gg->name = hel->name;
-	   gg->seq = gl->seq;
-	   gg->source = gl->source;
-	   slAddHead(&gff->groupList, gg);
-	   }
-	else
-	   {
-	   gg = hel->val;
-	   }
-       gl->group = gg->name;
-       }
-   else if (sameString("exon_id", type))
-       gl->exonId = gffFileGetStr(gff, val);
-   else if (sameString("exon_number", type))
-       {
-       if (!isdigit(val[0]))
-           errAbort("Expecting number after exon_number, got %s line %d of %s", val, lineIx, fileName);
-       gl->exonNumber = atoi(val);
-       }
-   else if (sameString("intron_id", type))
-       gl->intronId = gffFileGetStr(gff, val);
-   else if (sameString("intron_status", type))
-       gl->intronStatus = gffFileGetStr(gff, val);
-   else if (sameString("protein_id", type))
-       gl->proteinId = gffFileGetStr(gff, val);
-   else if (sameString("gene_name", type))
-       gl->geneName = gffFileGetStr(gff, val);
-   else if (sameString("transcript_name", type))
-       gl->transcriptName = gffFileGetStr(gff, val);
-   }
-}
-
-void gffFileAddRow(struct gffFile *gff, int baseOffset, char *words[], int wordCount, 
-    char *fileName, int lineIx)
-/* Process one row of GFF file (a non-comment line parsed by tabs normally). */
-{
-struct hashEl *hel;
-struct gffLine *gl;
-
-if (wordCount < 8)
-    gffSyntaxError(fileName, lineIx, "Word count less than 8 ");
-AllocVar(gl);
-
-if ((hel = hashLookup(gff->seqHash, words[0])) == NULL)
-    {
-    struct gffSeqName *el;
-    AllocVar(el);
-    hel = hashAdd(gff->seqHash, words[0], el);
-    el->name = hel->name;
-    slAddHead(&gff->seqList, el);
-    }
-gl->seq = hel->name;
-
-if ((hel = hashLookup(gff->sourceHash, words[1])) == NULL)
-    {
-    struct gffSource *el;
-    AllocVar(el);
-    hel = hashAdd(gff->sourceHash, words[1], el);
-    el->name = hel->name;
-    slAddHead(&gff->sourceList, el);
-    }
-gl->source = hel->name;
-
-if ((hel = hashLookup(gff->featureHash, words[2])) == NULL)
-    {
-    struct gffFeature *el;
-    AllocVar(el);
-    hel = hashAdd(gff->featureHash, words[2], el);
-    el->name = hel->name;
-    slAddHead(&gff->featureList, el);
-    }
-struct gffFeature *feature = hel->val;
-feature->count += 1;
-gl->feature = hel->name;
-
-if (!isdigit(words[3][0]) || !isdigit(words[4][0]))
-   gffSyntaxError(fileName, lineIx, "col 3 or 4 not a number ");	
-gl->start = atoi(words[3])-1 + baseOffset;
-gl->end = atoi(words[4]) + baseOffset;
-gl->score = atof(words[5]);
-gl->strand = words[6][0];
-gl->frame = words[7][0];
-
-if (wordCount >= 9)
-    {
-    if (!gff->typeKnown)
-	{
-	gff->typeKnown = TRUE;
-	gff->isGtf = isGtfGroup(words[8]);
-	}
-    if (gff->isGtf)
-	{
-	parseGtfEnd(words[8], gff, gl, fileName, lineIx);
-	}
-    else
-	{
-	char *tnName = gffTnName(gl->seq, trimSpaces(words[8]));
-	if ((hel = hashLookup(gff->groupHash, tnName)) == NULL)
-	    {
-	    struct gffGroup *group;
-	    AllocVar(group);
-	    hel = hashAdd(gff->groupHash, tnName, group);
-	    group->name = hel->name;
-	    group->seq = gl->seq;
-	    group->source = gl->source;
-	    slAddHead(&gff->groupList, group);
-	    }
-	gl->group = hel->name;
-	}
-    }
-slAddHead(&gff->lineList, gl);
-}
-
-
-void gffFileAdd(struct gffFile *gff, char *fileName, int baseOffset)
-/* Create a gffFile structure from a GFF file. */
-{
-/* Open file and do basic allocations. */
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *line, *words[9];
-int lineSize, wordCount;
-
-while (lineFileNext(lf, &line, &lineSize))
-    {
-    if (line[0] != '#')
-	{
-	wordCount = chopTabs(line, words);
-        if (wordCount > 0)
-            gffFileAddRow(gff, baseOffset, words, wordCount, lf->fileName, lf->lineIx);
-	}
-    }
-slReverse(&gff->lineList);
-slReverse(&gff->seqList);
-slReverse(&gff->sourceList);
-slReverse(&gff->featureList);
-slReverse(&gff->groupList);
-slReverse(&gff->geneIdList);
-lineFileClose(&lf);
-}
-
-struct gffFile *gffFileNew(char *fileName)
-/* Create a new gffFile structure. */
-{
-struct gffFile *gff;
-AllocVar(gff);
-gff->fileName = cloneString(fileName);
-gff->seqHash = newHash(18);
-gff->sourceHash = newHash(6);
-gff->featureHash = newHash(6);
-gff->groupHash = newHash(16);
-gff->geneIdHash = newHash(16);
-gff->strPool = newHash(20);
-return gff;
-}
-
-struct gffFile *gffRead(char *fileName)
-/* Create a gffFile structure from a GFF file. */
-{
-struct gffFile *gff = gffFileNew(fileName);
-gffFileAdd(gff, fileName, 0);
-return gff;
-}
-
-static void getGroupBoundaries(struct gffGroup *group)
-/* Fill in start, end, strand of group from lines. */
-{
-struct gffLine *line;
-int start = 0x3fffffff;
-int end = -start;
-line = group->lineList;
-group->strand = line->strand;
-for (; line != NULL; line = line->next)
-    {
-    if (start > line->start)
-	start = line->start;
-    if (end < line->end)
-	end = line->end;
-    }
-group->start = start;
-group->end = end;
-}
-
-void gffGroupLines(struct gffFile *gff)
-/* Group lines of gff file together, in process moving
- * gff->lineList to gffGroup->lineList. */
-{
-struct gffLine *line, *nextLine;
-struct hash *groupHash = gff->groupHash;
-char *groupName;
-struct gffGroup *group;
-struct gffLine *ungroupedLines = NULL;
-
-for (line = gff->lineList; line != NULL; line = nextLine)
-    {
-    nextLine = line->next;
-    if ((groupName = line->group) != NULL)
-	{
-	struct hashEl *hel = hashLookup(groupHash, groupName);
-	group = hel->val;
-	slAddHead(&group->lineList, line);
-	}
-    else
-	{
-	slAddHead(&ungroupedLines, line);
-	}
-    }
-
-/* Restore ungrouped lines to gff->lineList. */
-slReverse(&ungroupedLines);
-gff->lineList = ungroupedLines;
-
-/* Restore order of grouped lines and fill in start and end. */
-for (group = gff->groupList; group != NULL; group = group->next)
-    {
-    slSort(&group->lineList, gffLineCmp);
-    getGroupBoundaries(group);
-    }
-}
-
-void gffOutput(struct gffLine *el, FILE *f, char sep, char lastSep) 
-/* Print out GTF.  Separate fields with sep. Follow last field with lastSep. */
-{
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->seq);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->source);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->feature);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%u", el->start+1);
-fputc(sep,f);
-fprintf(f, "%u", el->end);
-fputc(sep,f);
-fprintf(f, "%f", el->score);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%c", el->strand);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%c", el->frame);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-if (el->geneId != NULL)
-    fprintf(f, "gene_id %s\"%s%s\"; ",
-	    (sep == ',') ? "\\" : "",
-	    el->geneId,
-	    (sep == ',') ? "\\" : "");
-fprintf(f, "transcript_id %s\"%s%s\"; ",
-	(sep == ',') ? "\\" : "",
-	el->group,
-	(sep == ',') ? "\\" : "");
-if (el->exonId != NULL)
-    fprintf(f, "exon_id %s\"%s%s\"; ",
-	    (sep == ',') ? "\\" : "",
-	    el->exonId,
-	    (sep == ',') ? "\\" : "");
-if (sep == ',') fputc('"',f);
-fputc(lastSep,f);
-}
-
diff --git a/gbtools/src/blatSrc/lib/gff3.c b/gbtools/src/blatSrc/lib/gff3.c
deleted file mode 100644
index c2cc424..0000000
--- a/gbtools/src/blatSrc/lib/gff3.c
+++ /dev/null
@@ -1,1109 +0,0 @@
-/*
- * Object for accessing GFF3 files
- * See GFF3 specification for details of file format:
- *   http://www.sequenceontology.org/gff3.shtml
- */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-#include "common.h"
-#include "gff3.h"
-#include <limits.h>
-#include "errAbort.h"
-#include "localmem.h"
-#include "hash.h"
-#include "linefile.h"
-#include "dystring.h"
-#include "fa.h"
-
-// FIXME: spec unclear if attributes can be specified multiple times
-// FIXME: spec unclear on attribute of discontinuous features.
-// FIXME: should spaces be striped from attributes?
-
-/*
- * Notes:
- *   - a separate feature object that linked discontinuous feature annotations
- *     was not used because it create more complexity with the linking of parents
- *     and the fact that the restriction on discontinguous features attributes is
- *     not clearly defined.
- */
-
-static const int gffNumCols = 9;
-
-/* standard attribute names */
-char *gff3AttrID = "ID";
-char *gff3AttrName = "Name";
-char *gff3AttrAlias = "Alias";
-char *gff3AttrParent = "Parent";
-char *gff3AttrTarget = "Target";
-char *gff3AttrGap = "Gap";
-char *gff3AttrDerivesFrom = "Derives_from";
-char *gff3AttrNote = "Note";
-char *gff3AttrDbxref = "Dbxref";
-char *gff3AttrOntologyTerm = "Ontology_term";
-char *gff3AttrIsCircular = "Is_circular";
-
-/* commonly used features names */
-char *gff3FeatGene = "gene";
-char *gff3FeatMRna = "mRNA";
-char *gff3FeatExon = "exon";
-char *gff3FeatCDS = "CDS";
-char *gff3FeatThreePrimeUTR = "three_prime_UTR";
-char *gff3FeatFivePrimeUTR = "five_prime_UTR";
-char *gff3FeatStartCodon = "start_codon";
-char *gff3FeatStopCodon = "stop_codon";
-char *gff3FeatTranscript = "transcript";
-
-static bool gff3FileStopDueToErrors(struct gff3File *g3f)
-/* determine if we should stop due to the number of errors */
-{
-return g3f->errCnt > g3f->maxErr;
-}
-
-static void gff3FileErr(struct gff3File *g3f, char *format, ...)
-#if defined(__GNUC__)
-__attribute__((format(printf, 2, 3)))
-#endif
-;
-
-static void gff3AnnErr(struct gff3Ann *g3a, char *format, ...)
-#if defined(__GNUC__)
-__attribute__((format(printf, 2, 3)))
-#endif
-;
-
-static void vaGff3FileErr(struct gff3File *g3f, char *format, va_list args)
-/* Print error message to error file, abort if max errors have been reached */
-{
-if (g3f->lf != NULL)
-    fprintf(g3f->errFh, "%s:%d: ", g3f->lf->fileName, g3f->lf->lineIx);
-vfprintf(g3f->errFh, format, args);
-fprintf(g3f->errFh, "\n");
-g3f->errCnt++;
-if (gff3FileStopDueToErrors(g3f))
-    errAbort("GFF3: %d parser errors", g3f->errCnt);
-}
-
-static void gff3FileErr(struct gff3File *g3f, char *format, ...)
-/* Print error message and abort */
-{
-va_list args;
-va_start(args, format);
-vaGff3FileErr(g3f, format, args);
-va_end(args);
-}
-
-static void gff3AnnErr(struct gff3Ann *g3a, char *format, ...)
-/* Print error message abort */
-{
-va_list args;
-va_start(args, format);
-vaGff3FileErr(g3a->file, format, args);
-va_end(args);
-}
-
-static int gff3FileStrToInt(struct gff3File *g3f, char *str)
-/* convert a string to an integer */
-{
-char *end;
-long val = strtol(str, &end, 0);
-if ((end == str) || (*end != '\0'))
-    gff3FileErr(g3f, "invalid integer: %s", str);
-return (int)val;
-}
-
-static float gff3FileStrToFloat(struct gff3File *g3f, char *str)
-/* convert a string to a float  */
-{
-char *end;
-double val = strtod(str, &end);
-if ((end == str) || (*end != '\0'))
-    gff3FileErr(g3f, "invalid float: %s", str);
-return (float)val;
-}
-
-static void *gff3FileAlloc(struct gff3File *g3f, size_t size)
-/* allocate memory from the memory pool */
-{
-return lmAlloc(g3f->pool->lm, size);
-}
-
-static char *gff3FileCloneStr(struct gff3File *g3f, char *str)
-/* allocate memory for a string and copy if */
-{
-return lmCloneString(g3f->pool->lm, str);
-}
-
-static char *gff3FilePooledStr(struct gff3File *g3f, char *str)
-/* allocate memory for a string from the shared string pool */
-{
-return hashStore(g3f->pool, str)->name;
-}
-
-static struct slName *gff3FileSlNameNew(struct gff3File *g3f, char *name)
-/* allocate slName from the memory pool */
-{
-return lmSlName(g3f->pool->lm, name);
-}
-
-
-static char **dynChopStringWhite(struct gff3File *g3f, char *str, int minWords, int maxWords, int *numWordsRet, char *desc)
-/* dynamic chop string without corrupting it, generate error if expected
- * number of words not found. Free return when done. Returns NULL on
- * error. */
-{
-int numWords = chopByWhite(str, NULL, 0);
-if ((numWords < minWords) || (numWords > maxWords))
-    {
-    gff3FileErr(g3f, "expected %s, got \"%s\"", desc, str);
-    return NULL;
-    }
-// allocate buffer for both array and string
-int wordsBytes = ((numWords+1)*sizeof(char**));
-char **words = needMem(wordsBytes+strlen(str)+1);
-char *strcp = ((char*)words)+wordsBytes;
-strcpy(strcp, str);
-chopByWhite(strcp, words, numWords);
-words[numWords] = NULL;
-if (numWordsRet != NULL)
-    *numWordsRet = numWords;
-return words;
-}
-
-struct gff3Attr *gff3AnnFindAttr(struct gff3Ann *g3a, char *tag)
-/* find a user attribute, or NULL */
-{
-struct gff3Attr *attr;
-for (attr = g3a->attrs; attr != NULL; attr = attr->next)
-    {
-    if (sameString(attr->tag, tag))
-        return attr;
-    }
-return NULL;
-}
-
-static struct gff3AnnRef *gff3AnnRefAlloc(struct gff3Ann *g3a)
-/* construct an annotation reference, allocated in the memory pool*/
-{
-struct gff3AnnRef *ref = gff3FileAlloc(g3a->file, sizeof(struct gff3AnnRef));
-ref->ann = g3a;
-return ref;
-}
-
-static void raiseInvalidEscape(struct gff3Ann *g3a, char *str)
-/* raise an error about an invalid escape in a string */
-{
-gff3AnnErr(g3a, "invalid GFF escape sequence in string: %s", str);
-}
-
-static char convertEscape(struct gff3Ann *g3a, char *esc, char *src)
-/* convert character at esc, which should start with a `%' and be a string
- * in the form `%09' */
-{
-if (!(isxdigit(esc[1]) && isxdigit(esc[2])))
-    raiseInvalidEscape(g3a, src);
-char num[3], *end;
-strncpy(num, esc+1, 2);
-num[2] = '\0';
-long val = strtol(num, &end, 16);
-if ((end == num) || (*end != '\0'))
-    raiseInvalidEscape(g3a, src);
-return (char)val;
-}
-
-static void unescapeStr(struct gff3Ann *g3a, char *dest, char *src)
-/* remove URL-style escapes from a string. dest need only have enough
- * memory to hold src, as unescaping will not grow the string */
-{
-char *s = src, *d = dest;
-while (*s != '\0')
-    {
-    if (*s == '%')
-        {
-        *d++ = convertEscape(g3a, s, src);
-        s += 3;
-        }
-    else
-        *d++ = *s++;
-    }
-*d = '\0';
-}
-
-static struct slName *unescapeSlName(struct gff3Ann *g3a, char *src)
-/* unescape the string and put in an slName object, storing it in memory
- * allocated from localmem  */
-{
-struct slName *dest = gff3FileAlloc(g3a->file, sizeof(struct slName)+strlen(src));
-unescapeStr(g3a, dest->name, src);
-return dest;
-}
-
-static char *unescapeStrTmp(struct gff3Ann *g3a, char *src)
-/* unescape the string into a tmp buffer. WARNING: return is a static and
- * maybe invalidated by calling another unescape function */
-{
-static struct dyString *buf = NULL;  // buffer for tmp copy of unescaped string
-if (buf == NULL)
-    buf = dyStringNew(256);
-dyStringBumpBufSize(buf, strlen(src)+1);
-unescapeStr(g3a, buf->string, src);
-return buf->string;
-}
-
-static char *unescapeStrPooled(struct gff3Ann *g3a, char *src)
-/* unescape the string and obtain it from localmem  */
-{
-return gff3FilePooledStr(g3a->file, unescapeStrTmp(g3a, src));
-}
-
-static char *escapeChar(char c)
-/* escape a character.  Warning: static return */
-{
-static char ec[4];
-safef(ec, sizeof(ec), "%%%02X", c);
-return ec;
-}
-
-static boolean isMetaChar(char c)
-/* determine if a character is a GFF3 meta character */
-{
-return ((c == '\t') || (c == '\n') || (c == '\r') || !isprint(c) || (c == ';') || (c == '=') || (c == '&') || (c == ','));
-}
-
-static void writeEscaped(char *str, FILE *fh)
-/* write a data string to a file, escaping as needed */
-{
-char *c;
-for (c = str; *c != '\0'; c++)
-    {
-    if (isMetaChar(*c))
-        fputs(escapeChar(*c), fh);
-    else
-        fputc(*c, fh);
-    }
-}
-
-static char *parseStrand(struct gff3Ann *g3a, char *strand)
-/* parse strand into static string, validating it */
-{
-if (sameString(strand, "."))
-    return NULL;
-else if (sameString(strand, "+"))
-    return "+";
-else if (sameString(strand, "-"))
-    return "-";
-else if (sameString(strand, "?"))
-    return "?";
-else
-    gff3AnnErr(g3a, "invalid strand: '%s'", strand);
-return NULL;
-}
-
-static int parsePhase(struct gff3Ann *g3a, char *str)
-/* parse phase into a number, validating it */
-{
-if (sameString(str, "."))
-    return -1;
-int phase = gff3FileStrToInt(g3a->file, str);
-if ((phase < 0) || (phase  > 2))
-    gff3AnnErr(g3a, "invalid phase: %d", phase);
-return phase;
-}
-
-static void parseFields(struct gff3Ann *g3a, char **words)
-/* parse the field in an annotation record */
-{
-g3a->seqid = unescapeStrPooled(g3a, words[0]);
-g3a->source = unescapeStrPooled(g3a, words[1]);
-g3a->type = unescapeStrPooled(g3a, words[2]);
-g3a->start = gff3FileStrToInt(g3a->file, words[3])-1;
-g3a->end = gff3FileStrToInt(g3a->file, words[4]);
-if (!sameString(words[5], "."))
-    {
-    g3a->score = gff3FileStrToFloat(g3a->file, words[5]);
-    g3a->haveScore = TRUE;
-    }
-g3a->strand = parseStrand(g3a, words[6]);
-g3a->phase = parsePhase(g3a, words[7]);
-if (sameString(g3a->type, "CDS"))
-    {
-    if (g3a->phase < 0)
-	g3a->phase = 0;  // assume the phase is 0
-    }
-else
-    {
-#if 0 // spec unclear; bug report filed
-    // spec currently doesn't restrict phase, unclear if it's allowed on start/stop codon features
-    if (g3a->phase >= 0)
-        gff3AnnErr(g3a, "phase only allowed on CDS features");
-#endif
-    }
-}
-
-/* check that an attribute tag name is valid. */
-static boolean checkAttrTag(struct gff3Ann *g3a, char *tag)
-{
-// FIXME: spec is not clear on what is a valid tag.
-char *tc = tag;
-boolean isOk = isalpha(*tc);
-for (tc++; isOk && (*tc != '\0'); tc++)
-    {
-    if (!((*tc == '-') || (*tc == '_') || isalnum(*tc)))
-        isOk = FALSE;
-    }
-if (!isOk)
-    gff3AnnErr(g3a, "invalid attribute tag, must start with an alphabetic character and be composed of alphanumeric, dash, or underscore characters: %s", tag);
-return isOk;
-}
-
-static struct slName *parseAttrVals(struct gff3Ann *g3a, char *tag, char *valsStr)
-/* parse an attribute into its values */
-{
-int i, numVals = chopString(valsStr, ",", NULL, 0);
-char **vals = needMem((numVals+1)*sizeof(char**)); // +1 allows for no values
-chopString(valsStr, ",", vals, numVals);
-struct slName *unescVals = NULL;
-for (i = 0; i < numVals; i++)
-    slAddHead(&unescVals, unescapeSlName(g3a, vals[i]));
-if (unescVals == NULL)
-    slAddHead(&unescVals, slNameNew(""));  // empty value
-freeMem(vals);
-slReverse(&unescVals);
-return unescVals;
-}
-
-static void addAttr(struct gff3Ann *g3a, char *tag, char *valStr)
-/* Add an attribute to the list of attributes.  If attribute has already been
- * specified, values are merged.  Attribute name must already be unescaped,
- * attribute values will be split and then unescaped. */
-{
-struct gff3Attr *attr = gff3AnnFindAttr(g3a, tag);
-if (attr == NULL)
-    {
-    attr = gff3FileAlloc(g3a->file, sizeof(struct gff3Attr));
-    attr->tag = gff3FileCloneStr(g3a->file, tag);
-    slAddHead(&g3a->attrs, attr);
-    }
-attr->vals = slCat(attr->vals, parseAttrVals(g3a, tag, valStr));
-}
-
-static void parseAttr(struct gff3Ann *g3a, char *attrStr)
-/* parse one attribute from an annotation record */
-{
-char *eq = strchr(attrStr, '=');
-if ((eq == NULL) || (eq == attrStr))
-    gff3AnnErr(g3a, "expected name=value: %s", attrStr);
-else
-    {
-    char *tag = attrStr;
-    char *vals = eq+1;
-    *eq = '\0';
-    unescapeStr(g3a, tag, tag);
-    if (checkAttrTag(g3a, tag))
-        addAttr(g3a, tag, vals);
-    }
-}
-
-static void parseAttrs(struct gff3Ann *g3a, char *attrsCol)
-/* parse the attribute column in an annotation record */
-{
-int i, numAttrs = chopString(attrsCol, ";", NULL, 0);
-char **attrStrs = needMem(numAttrs*sizeof(char**));
-chopString(attrsCol, ";", attrStrs, numAttrs);
-for (i = 0; i < numAttrs; i++)
-    {
-    char *attrStr = trimSpaces(attrStrs[i]);
-    if (strlen(attrStr) > 0)
-        parseAttr(g3a, attrStr);
-    }
-freeMem(attrStrs);
-slReverse(&g3a->attrs);
-}
-
-static void checkSingleValAttr(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* validate that an attribute has only one value */
-{
-if (attr->vals->next != NULL)
-    gff3AnnErr(g3a, "attribute %s must have a single value, found multiple comma-separated values", attr->tag);
-}
-
-static void parseIDAttr(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* parse the ID attribute */
-{
-checkSingleValAttr(g3a, attr);
-g3a->id = attr->vals->name;
-// link into other parts of feature if discontinuous
-struct hashEl *hel = hashStore(g3a->file->byId, g3a->id);
-struct gff3Ann *head = hel->val;
-if (head != NULL)
-    head->prevPart = g3a;
-g3a->nextPart = head;
-hel->val = g3a;
-}
-
-static void parseNameAttr(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* parse the Name attribute */
-{
-checkSingleValAttr(g3a, attr);
-g3a->name = attr->vals->name;
-}
-
-static void parseAliasAttr(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* parse the Alias attribute */
-{
-g3a->aliases = attr->vals;
-}
-
-static void parseParentAttr(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* parse the Parent attribute */
-{
-g3a->parentIds = attr->vals;
-}
-
-static void parseTargetAttr(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* parse the Target attribute */
-{
-checkSingleValAttr(g3a, attr);
-
-// target_id start end [strand]
-int numWords;
-char **words = dynChopStringWhite(g3a->file, attr->vals->name, 3, 4, &numWords,
-                                  "Target attribute in the form \"target_id start end [strand]\"");
-if (words == NULL)
-    return;  // got an error
-g3a->targetId = gff3FileCloneStr(g3a->file, words[0]);
-g3a->targetStart = gff3FileStrToInt(g3a->file, words[1])-1;
-g3a->targetEnd = gff3FileStrToInt(g3a->file, words[2]);
-if (numWords > 3)
-    g3a->targetStrand = parseStrand(g3a, words[3]);
-freeMem(words);
-}
-
-static void parseGapAttr(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* parse the Gap attribute */
-{
-checkSingleValAttr(g3a, attr);
-g3a->gap = attr->vals->name;
-}
-
-static void parseDerivesFromAttr(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* parse the Derives_from attribute */
-{
-checkSingleValAttr(g3a, attr);
-g3a->derivesFromId = attr->vals->name;
-}
-
-static void parseIsCircular(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* parse the Note attribute */
-{
-g3a->isCircular = TRUE;
-}
-
-static void parseNoteAttr(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* parse the Note attribute */
-{
-g3a->notes = attr->vals;
-}
-
-static void parseDbxrefAttr(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* parse the Dbxref attribute */
-{
-g3a->dbxrefs = attr->vals;
-}
-
-static void parseOntologyTermAttr(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* parse the Ontology_term attribute */
-{
-g3a->ontologyTerms = attr->vals;
-}
-
-static void parseStdAttr(struct gff3Ann *g3a, struct gff3Attr *attr)
-/* Parse one of the standard specified attributes (those starting with upper
- * case) into fields. Multiple specifications of an attribute should have been
- * merged before calling this function. */
-{
-if (sameString(attr->tag, gff3AttrID))
-    parseIDAttr(g3a, attr);
-else if (sameString(attr->tag, gff3AttrName))
-    parseNameAttr(g3a, attr);
-else if (sameString(attr->tag, gff3AttrAlias))
-    parseAliasAttr(g3a, attr);
-else if (sameString(attr->tag, gff3AttrParent))
-    parseParentAttr(g3a, attr);
-else if (sameString(attr->tag, gff3AttrTarget))
-    parseTargetAttr(g3a, attr);
-else if (sameString(attr->tag, gff3AttrGap))
-    parseGapAttr(g3a, attr);
-else if (sameString(attr->tag, gff3AttrDerivesFrom))
-    parseDerivesFromAttr(g3a, attr);
-else if (sameString(attr->tag, gff3AttrIsCircular))
-    parseIsCircular(g3a, attr);
-else if (sameString(attr->tag, gff3AttrNote))
-    parseNoteAttr(g3a, attr);
-else if (sameString(attr->tag, gff3AttrDbxref))
-    parseDbxrefAttr(g3a, attr);
-else if (sameString(attr->tag, gff3AttrOntologyTerm))
-    parseOntologyTermAttr(g3a, attr);
-else
-    gff3AnnErr(g3a, "unknown standard attribute, user defined attributes must start with a lower-case letter: %s", attr->tag);
-}
-
-static void parseStdAttrs(struct gff3Ann *g3a)
-/* parse standard attributes (starting with upper case) into attributes
- * have been parsed into attribute list, which would have  merged multiply
- * specified attributes. */
-{
-struct gff3Attr *attr;
-for (attr = g3a->attrs; attr != NULL; attr = attr->next)
-    {
-    if (isupper(attr->tag[0]))
-        parseStdAttr(g3a, attr);
-    }
-}
-
-static void parseAnn(struct gff3File *g3f, char *line)
-/* parse an annotation line */
-{
-// extra column to check for too many
-char *words[gffNumCols+1];
-int numWords = chopString(line, "\t", words, gffNumCols+1);
-if (numWords != gffNumCols)
-    gff3FileErr(g3f, "expected %d tab-separated columns: %s", gffNumCols, line);
-
-struct gff3Ann *g3a = gff3FileAlloc(g3f, sizeof(struct gff3Ann));
-g3a->file = g3f;
-g3a->lineNum = g3f->lf->lineIx;
-parseFields(g3a, words);
-parseAttrs(g3a, words[8]);
-parseStdAttrs(g3a);
-slAddHead(&g3f->anns, gff3AnnRefNew(g3a));
-}
-
-static void writeAttr(struct gff3Attr *attr, FILE *fh)
-/* write one attribute and it's values */
-{
-writeEscaped(attr->tag, fh);
-fputc('=', fh);
-struct slName *val;
-for (val = attr->vals; val != NULL; val = val->next)
-    {
-    if (val != attr->vals)
-        fputc(',', fh);
-    writeEscaped(val->name, fh);
-    }
-}
-
-static void writeAttrs(struct gff3Ann *g3a, FILE *fh)
-/* write annotation record attributes */
-{
-struct gff3Attr *attr;
-for (attr = g3a->attrs; attr != NULL; attr = attr->next)
-    {
-    if (attr != g3a->attrs)
-        fputc(';', fh);
-    writeAttr(attr, fh);
-    }
-}
-
-static void writeFields(struct gff3Ann *g3a, FILE *fh)
-/* write an annotation record fields */
-{
-writeEscaped(g3a->seqid, fh);
-fputc('\t', fh);
-writeEscaped(g3a->source, fh);
-fputc('\t', fh);
-writeEscaped(g3a->type, fh);
-fprintf(fh, "\t%d\t%d", g3a->start+1, g3a->end);
-fputc('\t', fh);
-if (g3a->haveScore)
-    fprintf(fh, "%g", g3a->score);
-else
-    fputc('.', fh);
-fprintf(fh, "\t%c", (g3a->strand != NULL) ? g3a->strand[0] : '.');
-fputc('\t', fh);
-if (g3a->phase < 0)
-    fputc('.', fh);
-else
-    fprintf(fh, "%d", g3a->phase);
-}
-
-static void writeAnn(struct gff3Ann *g3a, FILE *fh)
-/* write an annotation record to the specified file */
-{
-writeFields(g3a, fh);
-fputc('\t', fh);
-writeAttrs(g3a, fh);
-fputc('\n', fh);
-}
-
-static void addFasta(struct gff3File *g3f, char *dna, int size, char *name)
-/* add one fasta record */
-{
-struct dnaSeq *dnaSeq = gff3FileAlloc(g3f, sizeof(struct dnaSeq));
-slAddHead(&g3f->seqs, dnaSeq);
-struct hashEl *hel = hashAdd(g3f->seqMap, name, dnaSeq);
-dnaSeq->name = hel->name;
-dnaSeq->dna = gff3FileCloneStr(g3f, dna);
-dnaSeq->size = size;
-}
-
-static void parseFasta(struct gff3File *g3f)
-/* parse fasta records in the file, consumes remainder of file */
-{
-char *dna, *name;
-int size;
-g3f->seqMap = hashNew(0);
-while (faMixedSpeedReadNext(g3f->lf, &dna, &size, &name))
-    addFasta(g3f, dna, size, name);
-}
-
-static void writeFastas(struct gff3File *g3f, FILE *fh)
-/* write fasta records fo the file */
-{
-if (g3f->seqs != NULL)
-    {
-    fputs("##FASTA\n", fh);
-    struct dnaSeq *seq;
-    for (seq = g3f->seqs; seq != NULL; seq = seq->next)
-        faWriteNext(fh, seq->name, seq->dna, seq->size);
-    }
-}
-
-static void parseSequenceRegion(struct gff3File *g3f, char *line)
-/* parse ##sequence-region seqid start end */
-{
-char **words = dynChopStringWhite(g3f, line, 4, 4, NULL,
-                                  "\"##sequence-region seqid start end\"");
-if (words == NULL)
-    return;  // got an error
-struct gff3SeqRegion *sr = gff3FileAlloc(g3f, sizeof(struct gff3SeqRegion));
-sr->seqid = gff3FileCloneStr(g3f, words[1]);
-sr->start = gff3FileStrToInt(g3f, words[2])-1;
-sr->end = gff3FileStrToInt(g3f, words[3]);
-if (g3f->seqRegionMap == NULL)
-    g3f->seqRegionMap = hashNew(0);
-struct hashEl *hel = hashStore(g3f->seqRegionMap, sr->seqid);
-if (hel->val != NULL)
-    gff3FileErr(g3f, "duplicate ##sequence-region for %s", sr->seqid);
-else
-    {
-    hel->val = sr;
-    slAddHead(&g3f->seqRegions, sr);
-    }
-freeMem(words);
-}
-
-static void writeSequenceRegions(struct gff3File *g3f, FILE *fh)
-/* parse ##sequence-region metadata */
-{
-struct gff3SeqRegion *sr;
-for (sr = g3f->seqRegions; sr != NULL; sr = sr->next)
-    fprintf(fh, "##sequence-region %s %d %d\n", sr->seqid, sr->start, sr->end);
-}
-
-static void writeSlNameMetas(char *metaName, struct slName *metas, FILE *fh)
-/* write meta records stores as slNames */
-{
-struct slName  *m;
-for (m = metas; m != NULL; m = m->next)
-    fprintf(fh, "%s %s\n", metaName, m->name);
-}
-
-static void parseFeatureOntology(struct gff3File *g3f, char *line)
-/* parse ##feature-ontology URI  */
-{
-char **words = dynChopStringWhite(g3f, line, 2, 2, NULL,
-                                  "\"##feature-ontology URI\"");
-if (words == NULL)
-    return;  // got an error
-slSafeAddHead(&g3f->featureOntologies, gff3FileSlNameNew(g3f, words[1]));
-freeMem(words);
-}
-
-static void writeFeatureOntologies(struct gff3File *g3f, FILE *fh)
-/* parse ##feature-ontology metas */
-{
-writeSlNameMetas("##feature-ontology", g3f->featureOntologies, fh);
-}
-
-static void parseAttributeOntology(struct gff3File *g3f, char *line)
-/* parse ##attribute-ontology URI */
-{
-char **words = dynChopStringWhite(g3f, line, 2, 2, NULL,
-                                  "\"##attribute-ontology URI\"");
-if (words == NULL)
-    return;  // got an error
-slSafeAddHead(&g3f->attributeOntologies, gff3FileSlNameNew(g3f, words[1]));
-freeMem(words);
-}
-
-static void writeAttributeOntologies(struct gff3File *g3f, FILE *fh)
-/* write ##attribute-ontology metas */
-{
-writeSlNameMetas("##attribute-ontology", g3f->attributeOntologies, fh);
-}
-
-static void parseSourceOntology(struct gff3File *g3f, char *line)
-/* parse ##source-ontology URI */
-{
-char **words = dynChopStringWhite(g3f, line, 2, 2, NULL,
-                                  "\"##source-ontology URI\"");
-if (words == NULL)
-    return;  // got an error
-slSafeAddHead(&g3f->sourceOntologies, gff3FileSlNameNew(g3f, words[1]));
-freeMem(words);
-}
-
-static void writeSourceOntologies(struct gff3File *g3f, FILE *fh)
-/* write ##source-ontology metas */
-{
-writeSlNameMetas("##source-ontology", g3f->sourceOntologies, fh);
-}
-
-static void parseSpecies(struct gff3File *g3f, char *line)
-/* parse ##species NCBI_Taxonomy_URI */
-{
-char **words = dynChopStringWhite(g3f, line, 2, 2, NULL,
-                                  "\"##species NCBI_Taxonomy_URI\"");
-if (words == NULL)
-    return;  // got an error
-slSafeAddHead(&g3f->species, gff3FileSlNameNew(g3f, words[1]));
-freeMem(words);
-}
-
-static void writeSpecies(struct gff3File *g3f, FILE *fh)
-/* write ##species NCBI_Taxonomy_URI */
-{
-writeSlNameMetas("##species", g3f->species, fh);
-}
-
-static void parseGenomeBuild(struct gff3File *g3f, char *line)
-/* parse ##genome-build source buildName */
-{
-if (g3f->genomeBuildSource != NULL)
-    gff3FileErr(g3f, "multiple ##genome-build records");
-char **words = dynChopStringWhite(g3f, line, 3, 3, NULL,
-                                  "\"##genome-build source buildName\"");
-if (words == NULL)
-    return;  // got an error
-g3f->genomeBuildSource = gff3FileCloneStr(g3f, words[1]);
-g3f->genomeBuildName = gff3FileCloneStr(g3f, words[2]);
-freeMem(words);
-}
-
-static void writeGenomeBuild(struct gff3File *g3f, FILE *fh)
-/* parse ##genome-build source buildName */
-{
-if (g3f->genomeBuildSource != NULL)
-    fprintf(fh, "##genome-build %s %s\n", g3f->genomeBuildSource, g3f->genomeBuildName);
-}
-
-static void parseMeta(struct gff3File *g3f, char *line)
-/* parse a meta line of a gff3 file */
-{
-eraseTrailingSpaces(line);
-if (sameString("###", line))
-    ; // ignore
-else if (sameString("##FASTA", line))
-    parseFasta(g3f);
-else if (startsWithWord("##sequence-region", line))
-    parseSequenceRegion(g3f, line);
-else if (startsWithWord("##feature-ontology", line))
-    parseFeatureOntology(g3f, line);
-else if (startsWithWord("##attribute-ontology", line))
-    parseAttributeOntology(g3f, line);
-else if (startsWithWord("##source-ontology", line))
-    parseSourceOntology(g3f, line);
-else if (startsWithWord("##species", line))
-    parseSpecies(g3f, line);
-else if (startsWithWord("##genome-build", line))
-    parseGenomeBuild(g3f, line);
-else if (startsWithWord("##gff-spec-version", line) ||
-         startsWithWord("##source-version", line) ||
-         startsWithWord("##source", line) ||
-         startsWithWord("##date", line) ||
-         startsWithWord("##Type", line))
-    ;  /* FIXME: silently ignore these.  Mark says. */
-else
-    gff3FileErr(g3f, "invalid meta line: %s", line);
-}
-
-static void parseLine(struct gff3File *g3f, char *line)
-/* parse one line of a gff3 file */
-{
-if (startsWith("##", line))
-    parseMeta(g3f, line);
-else if (!startsWith("#", line) && (strlen(line) > 0))
-    parseAnn(g3f, line);
-}
-
-static void parseHeader(struct gff3File *g3f)
-/* parse and validate a GFF3 header */
-{
-char *line;
-if (!lineFileNext(g3f->lf, &line, NULL))
-    gff3FileErr(g3f, "empty GFF file, must have header");
-char *ver = skipToSpaces(line);
-if (*ver != '\0')
-    {
-    *ver++ = '\0';
-    ver = trimSpaces(ver);
-    }
-if (!(sameString(line, "##gff-version") && sameString(ver, "3")))
-    gff3FileErr(g3f, "invalid GFF3 header");
-}
-
-static void parseFile(struct gff3File *g3f)
-/* do parsing phase of reading a GFF3 file */
-{
-g3f->lf = lineFileOpen(g3f->fileName, TRUE);
-parseHeader(g3f);
-char *line;
-while (lineFileNext(g3f->lf, &line, NULL))
-    {
-    parseLine(g3f, line);
-    if (gff3FileStopDueToErrors(g3f))
-        break;
-    }
-lineFileClose(&g3f->lf);
-slReverse(&g3f->anns);
-}
-
-static int gff3AnnCount(struct gff3Ann *g3a)
-/* count the number of gff3Ann objects linked together in a feature */
-{
-int cnt = 0;
-for (; g3a != NULL; g3a = g3a->nextPart)
-    cnt++;
-return cnt;
-}
-
-static void discontinFeatureCheck(struct gff3Ann *g3a)
-/* sanity check linked gff3Ann discontinuous features */
-{
-struct gff3Ann *g3a2;
-for (g3a2 = g3a->nextPart; (g3a2 != NULL) && !gff3FileStopDueToErrors(g3a->file); g3a2 = g3a2->nextPart)
-    {
-    if (!sameString(g3a->type, g3a2->type))
-        gff3AnnErr(g3a, "Annotation records for discontinuous features with ID=\"%s\" do not have the same type, found \"%s\" and \"%s\"", g3a->id, g3a->type, g3a2->type);
-    }
-}
-
-static void discontinFeatureFillArray(struct gff3Ann *g3a, int numAnns, struct gff3Ann *featAnns[])
-/* convert list to array for sorting */
-{
-int i = 0;
-for (; g3a != NULL; g3a = g3a->nextPart)
-    featAnns[i++] = g3a;
-}
-
-static struct gff3Ann *discontinFeatureArrayLink(int numAnns, struct gff3Ann *featAnns[])
-/* convert sorted array to a list */
-{
-struct gff3Ann *g3aHead = NULL, *g3aPrev = NULL;
-int i;
-for (i = 0; i < numAnns; i++)
-    {
-    if (g3aHead == NULL)
-        g3aHead = featAnns[i];
-    if (g3aPrev != NULL)
-        g3aPrev->nextPart = featAnns[i];
-    featAnns[i]->prevPart = g3aPrev;
-    }
-return g3aHead;
-}
-
-static int discontigFeatureSortCmp(const void *p1, const void *p2)
-/* compare function for discontigFeatureSort */
-{
-struct gff3Ann *g3a1 = *((struct gff3Ann **)p1);
-struct gff3Ann *g3a2 = *((struct gff3Ann **)p2);
-int diff = g3a1->start - g3a2->start;
-if (diff == 0)
-    diff = g3a1->end - g3a2->end;
-return diff;
-}
-
-static struct gff3Ann *discontigFeatureSort(struct gff3Ann *g3a)
-/* sort a list of gff3Ann object representing discontinuous */
-{
-int numAnns = gff3AnnCount(g3a);
-struct gff3Ann *featAnns[numAnns];
-discontinFeatureFillArray(g3a, numAnns, featAnns);
-qsort(featAnns, numAnns, sizeof(struct gff3Ann*), discontigFeatureSortCmp);
-return discontinFeatureArrayLink(numAnns, featAnns);
-}
-
-static void discontigFeatureFinish(struct gff3File *g3f)
-/* finish up discontinuous features, sorting them into ascending order */
-{
-// only both sorting if more than one annotation
-struct hashCookie cookie = hashFirst(g3f->byId);
-struct hashEl *hel;
-while (((hel = hashNext(&cookie)) != NULL) && !gff3FileStopDueToErrors(g3f))
-    {
-    struct gff3Ann *g3a = hel->val;
-    if (g3a->nextPart != NULL)
-        {
-        discontinFeatureCheck(g3a);
-        hel->val = discontigFeatureSort(g3a);
-        }
-    }
-}
-
-static struct gff3Ann *resolveRef(struct gff3Ann *g3a, char *id, char *attr)
-/* resolve a link for an attribute */
-{
-struct gff3Ann *ann = gff3FileFindAnn(g3a->file, id);
-if (ann == NULL)
-    gff3AnnErr(g3a, "Can't find annotation record \"%s\" referenced by \"%s\" %s attribute", id, g3a->id, attr);
-return ann;
-}
-
-static struct gff3AnnRef *resolveRefs(struct gff3Ann *g3a, struct slName *ids, char *attr)
-/* resolve links for an attribute */
-{
-struct gff3AnnRef *refs = NULL;
-struct slName *id;
-for (id = ids; id != NULL; id = id->next)
-    {
-    struct gff3Ann *ann = resolveRef(g3a, id->name, attr);
-    if (ann != NULL)
-        slSafeAddHead(&refs, gff3AnnRefAlloc(ann));
-    }
-return refs;
-}
-
-static void resolveAnn(struct gff3Ann *g3a)
-/* resolve links for an gff3Ann */
-{
-g3a->parents = resolveRefs(g3a, g3a->parentIds, gff3AttrParent);
-if (g3a->parents == NULL)
-    slSafeAddHead(&g3a->file->roots, gff3AnnRefAlloc(g3a));
-else
-    {
-    struct gff3AnnRef *par;
-    for (par = g3a->parents; par != NULL; par = par->next)
-        slSafeAddHead(&par->ann->children, gff3AnnRefAlloc(g3a));
-    }
-if (g3a->derivesFromId != NULL)
-    g3a->derivesFrom = resolveRef(g3a, g3a->derivesFromId, gff3AttrDerivesFrom);
-}
-
-static void resolveAnns(struct gff3File *g3f)
-/* resolve links */
-{
-struct gff3AnnRef *g3aRef;
-for (g3aRef = g3f->anns; (g3aRef != NULL) && !gff3FileStopDueToErrors(g3f); g3aRef = g3aRef->next)
-    resolveAnn(g3aRef->ann);
-}
-
-static void resolveFile(struct gff3File *g3f)
-/* do resolution phase of reading a GFF3 file */
-{
-// must sort first, as links point to the first feature
-discontigFeatureFinish(g3f);
-resolveAnns(g3f);
-// reorder just for test reproducibility
-slReverse(&g3f->seqRegions);
-slReverse(&g3f->featureOntologies);
-slReverse(&g3f->attributeOntologies);
-slReverse(&g3f->sourceOntologies);
-slReverse(&g3f->species);
-slReverse(&g3f->seqs);
-}
-
-static struct gff3File *gff3FileNew()
-/* construct a new, empty gff3File object */
-{
-struct gff3File *g3f;
-AllocVar(g3f);
-g3f->byId = hashNew(0);
-g3f->pool = hashNew(0);
-return g3f;
-}
-
-struct gff3File *gff3FileOpen(char *fileName, int maxErr, FILE *errFh)
-/* Parse a GFF3 file into a gff3File object.  If maxErr not zero, then
- * continue to parse until this number of error have been reached.  A maxErr
- * less than zero does not stop reports all errors. Write errors to errFh,
- * if NULL, use stderr. */
-{
-struct gff3File *g3f = gff3FileNew();
-g3f->fileName = gff3FileCloneStr(g3f, fileName);
-g3f->errFh = (errFh != NULL) ? errFh : stderr;
-g3f->maxErr = (maxErr < 0) ? INT_MAX : maxErr;
-parseFile(g3f);
-if (!gff3FileStopDueToErrors(g3f))
-    resolveFile(g3f);
-if (g3f->errCnt > 0)
-    errAbort("GFF3: %d parser errors", g3f->errCnt);
-return g3f;
-}
-
-void gff3FileFree(struct gff3File **g3fPtr)
-/* Free a gff3File object */
-{
-struct gff3File *g3f = *g3fPtr;
-if (g3f != NULL)
-    {
-    hashFree(&g3f->byId);
-    hashFree(&g3f->pool);
-    hashFree(&g3f->seqRegionMap);
-    freeMem(g3f);
-    *g3fPtr = NULL;
-    }
-}
-
-struct gff3Ann *gff3FileFindAnn(struct gff3File *g3f, char *id)
-/* find an annotation record by id, or NULL if not found. */
-{
-return hashFindVal(g3f->byId, id);
-}
-
-static void writeMeta(struct gff3File *g3f, FILE *fh)
-/* write meta data */
-{
-fputs("##gff-version 3\n", fh);
-writeSequenceRegions(g3f, fh);
-writeFeatureOntologies(g3f, fh);
-writeAttributeOntologies(g3f, fh);
-writeSourceOntologies(g3f, fh);
-writeSpecies(g3f, fh);
-writeGenomeBuild(g3f, fh);
-}
-
-void gff3FileWrite(struct gff3File *g3f, char *fileName)
-/* write contents of an GFF3File object to a file */
-{
-FILE *fh = mustOpen(fileName, "w");
-writeMeta(g3f, fh);
-struct gff3AnnRef *g3aRef;
-for (g3aRef = g3f->anns; g3aRef != NULL; g3aRef = g3aRef->next)
-    writeAnn(g3aRef->ann, fh);
-writeFastas(g3f, fh);
-carefulClose(&fh);
-}
-
-int gff3AnnRefLocCmp(const void *va, const void *vb)
-/* sort compare function for two gff3AnnRef objects */
-{
-const struct gff3Ann *a = (*((struct gff3AnnRef **)va))->ann;
-const struct gff3Ann *b = (*((struct gff3AnnRef **)vb))->ann;
-int diff = strcmp(a->seqid, b->seqid);
-if ((diff == 0) && (a->strand != b->strand))
-    {
-    // allow for various types of strand fields. above tests handles both null
-    if (a->strand == NULL)
-        diff = 1;
-    else if (b->strand == NULL)
-        diff = -1;
-    else
-        diff = strcmp(a->strand, b->strand);
-    }
-if (diff == 0)
-    diff = a->start - b->start;
-if (diff == 0)
-    diff = a->end - b->end;
-return diff;
-}
diff --git a/gbtools/src/blatSrc/lib/gfxPoly.c b/gbtools/src/blatSrc/lib/gfxPoly.c
deleted file mode 100644
index d28ef09..0000000
--- a/gbtools/src/blatSrc/lib/gfxPoly.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* gfxPoly - two dimensional polygon. */
-
-#include "common.h"
-#include "gfxPoly.h"
-
-
-struct gfxPoly *gfxPolyNew()
-/* Create new (empty) polygon */
-{
-struct gfxPoly *poly;
-AllocVar(poly);
-return poly;
-}
-
-void gfxPolyFree(struct gfxPoly **pPoly)
-/* Free up resources associated with polygon */
-{
-struct gfxPoly *poly = *pPoly;
-if (poly != NULL)
-    {
-    if (poly->lastPoint != NULL)
-	{
-	poly->lastPoint->next = NULL;
-	slFreeList(&poly->ptList);
-	}
-    freez(pPoly);
-    }
-}
-
-void gfxPolyAddPoint(struct gfxPoly *poly, int x, int y)
-/* Add point to polygon. */
-{
-struct gfxPoint *pt;
-poly->ptCount += 1;
-AllocVar(pt);
-pt->x = x;
-pt->y = y;
-if (poly->ptList == NULL)
-    {
-    poly->ptList = poly->lastPoint = pt;
-    pt->next = pt;
-    }
-else
-    {
-    poly->lastPoint->next = pt;
-    pt->next = poly->ptList;
-    poly->lastPoint = pt;
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/gifLabel.c b/gbtools/src/blatSrc/lib/gifLabel.c
deleted file mode 100644
index 63c8ea3..0000000
--- a/gbtools/src/blatSrc/lib/gifLabel.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* gifLabel - create labels as GIF files. */
-
-#include "common.h"
-#include "memgfx.h"
-#include "portable.h"
-#include "gifLabel.h"
-
-
-int gifLabelMaxWidth(char **labels, int labelCount)
-/* Return maximum pixel width of labels.  It's ok to have
- * NULLs in labels array. */
-{
-int width = 0, w, i;
-MgFont *font = mgMediumFont();
-for (i=0; i<labelCount; ++i)
-    {
-    char *label = labels[i];
-    if (label != NULL)
-	{
-	w = mgFontStringWidth(font, labels[i]);
-	if (w > width)
-	    width = w;
-	}
-    }
-width += 2;
-return width;
-}
-
-static struct memGfx *altColorLabels(char **labels, int labelCount, int width)
-/* Return a memory image with alternating colors. */
-{
-struct memGfx *mg = NULL;
-Color c1,c2;
-MgFont *font = mgMediumFont();
-int lineHeight = mgFontLineHeight(font)-1;
-int height = lineHeight * labelCount, i;
-int y = 0;
-
-/* Allocate picture and set up colors. */
-mg = mgNew(width, height);
-c1 = mgFindColor(mg, 0xE0, 0xE0, 0xFF);
-c2 = mgFindColor(mg, 0xFF, 0xC8, 0xC8);
-
-/* Draw text. */
-for (i=labelCount-1; i >= 0; --i)
-    {
-    Color c = ((i&1) ? c2 : c1);
-    mgDrawBox(mg, 0, y, width, lineHeight, c);
-    mgTextRight(mg, 0+1, y+1, width-1, lineHeight, MG_BLACK, font, labels[i]);
-    y += lineHeight;
-    }
-
-return mg;
-}
-
-
-boolean sameGifContents(struct memGfx *n1, struct memGfx *n2)
-/* compare two files and return true if their contents are identical using binary compare */
-{
-if (n1 == NULL) {  return FALSE; }
-if (n2 == NULL) { return FALSE; }
-if (n1->width != n2->width) { return FALSE; }
-if (n1->height != n2->height) { return FALSE; }
-if (n1->colorsUsed != n2->colorsUsed) { return FALSE; }
-if (memcmp(n1->colorMap, n2->colorMap, 256 * 3)!=0) { return FALSE; } /* gif colormaps differ */
-long bytes = (long)n1->width * n1->height;
-if (memcmp(n1->pixels, n2->pixels, bytes)!=0) { return FALSE; } /* gif contents differ */
-return TRUE;
-}
-
-void gifLabelVerticalText(char *fileName, char **labels, int labelCount, 
-	int height)
-/* Make a gif file with given labels.  This will check to see if fileName
- * exists already and has not changed, and if so do nothing. */
-{
-struct memGfx *straight = altColorLabels(labels, labelCount, height);
-struct memGfx *rotated = mgRotate90(straight);
-struct memGfx *existing = NULL;
-struct tempName tn;
-makeTempName(&tn, "gifLabelVertTemp", ".png");
-mgSavePng(rotated, tn.forCgi, FALSE); 
-rename(tn.forCgi, fileName);
-mgFree(&straight);
-mgFree(&rotated);
-if (existing)
-    mgFree(&existing);
-}
-
-
-#ifdef DEBUG
-void gifTest()
-{
-static char *labels[] = {"cerebellum", "thymus", "breast", "heart",
-			 "stomach", "cartilage", "kidney", "liver",
-			 "lung", "testis", "black hole" };
-int size = gifLabelMaxWidth(labels, ArraySize(labels));
-int gifLabelMaxWidth(char **labels, int labelCount)
-gifLabelVerticalText("../trash/foo.gif", labels, ArraySize(labels), size);
-printf("<IMG SRC=\"../trash/foo.gif\">");
-}
-#endif /* DEBUG */
diff --git a/gbtools/src/blatSrc/lib/gifcodes.h b/gbtools/src/blatSrc/lib/gifcodes.h
deleted file mode 100644
index 480ab0d..0000000
--- a/gbtools/src/blatSrc/lib/gifcodes.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-struct gif_header
-	{
-	char giftype[6];
-	unsigned char wlo,whi;
-	unsigned char hlo,hhi;
-	unsigned char colpix;	/* flags */
-	unsigned char bgcolor;
-	unsigned char reserved;
-	};
-
-#define COLTAB	0x80
-#define COLMASK 0x70
-#define COLSHIFT 4
-#define PIXMASK 7
-#define COLPIXVGA13 (COLTAB | (5<<COLSHIFT) | 7)
-
-struct gif_image
-	{
-	unsigned char xlo,xhi;
-	unsigned char ylo,yhi;
-	unsigned char wlo,whi;
-	unsigned char hlo,hhi;
-	unsigned char flags;
-	};
-#define ITLV_BIT 0x40
-
-/* Various error codes used by decoder
- * and my own routines...   It's okay
- * for you to define whatever you want,
- * as long as it's negative...  It will be
- * returned intact up the various subroutine
- * levels...
- */
-#define OUT_OF_MEMORY -10
-#define BAD_CODE_SIZE -20
-#define READ_ERROR -1
-#define WRITE_ERROR -2
-#define OPEN_ERROR -3
-#define CREATE_ERROR -4
-#define TOO_HIGH	-5
-
-short gif_compress_data(int min_code_size, unsigned char *pt, long size, FILE *out);
-int gif_decoder(int linewidth);
diff --git a/gbtools/src/blatSrc/lib/gifcomp.c b/gbtools/src/blatSrc/lib/gifcomp.c
deleted file mode 100644
index 7aa88f3..0000000
--- a/gbtools/src/blatSrc/lib/gifcomp.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* comprs.c - LZW compression code for GIF */
-
-/*
- * ABSTRACT:
- *	The compression algorithm builds a string translation table that maps
- *	substrings from the input string into fixed-length codes.  These codes
- *	are used by the expansion algorithm to rebuild the compressor's table
- *	and reconstruct the original data stream.  In it's simplest form, the
- *	algorithm can be stated as:
- *
- *		"if <w>k is in the table, then <w> is in the table"
- *
- *	<w> is a code which represents a string in the table.  When a new
- *	character k is read in, the table is searched for <w>k.  If this
- *	combination is found, <w> is set to the code for that combination
- *	and the next character is read in.  Otherwise, this combination is
- *	added to the table, the code <w> is written to the output stream and
- *	<w> is set to k.
- *
- *	The expansion algorithm builds an identical table by parsing each
- *	received code into a prefix string and suffix character.  The suffix
- *	character is pushed onto the stack and the prefix string translated
- *	again until it is a single character.  This completes the expansion.
- *	The expanded code is then output by popping the stack and a new entry
- *	is made in the table.
- *
- *	The algorithm used here has one additional feature.  The output codes
- *	are variable length.  They start at a specified number of bits.  Once
- *	the number of codes exceeds the current code size, the number of bits
- *	in the code is incremented.  When the table is completely full, a
- *	clear code is transmitted for the expander and the table is reset.
- *	This program uses a maximum code size of 12 bits for a total of 4096
- *	codes.
- *
- *	The expander realizes that the code size is changing when it's table
- *	size reaches the maximum for the current code size.  At this point,
- *	the code size in increased.  Remember that the expander's table is
- *	identical to the compressor's table at any point in the original data
- *	stream.
- *
- *	The compressed data stream is structured as follows:
- *		first byte denoting the minimum code size
- *		one or more counted byte strings. The first byte contains the
- *		length of the string. A null string denotes "end of data"
- *
- *	This format permits a compressed data stream to be embedded within a
- *	non-compressed context.
- *
- * AUTHOR: Steve Wilhite
- *
- * REVISION HISTORY:
- *   Speed tweaked a bit by Jim Kent 8/29/88
- *
- */
-
-#include "common.h"
-#include <setjmp.h>
-
-
-#define UBYTE unsigned char
-
-
-#define LARGEST_CODE	4095
-#define TABLE_SIZE	(8*1024)
-
-static UBYTE gif_byte_buff[256+3];               /* Current block */
-static FILE *gif_file;
-
-static unsigned char *gif_wpt;
-static long gif_wcount;
-
-static jmp_buf recover;
-
-static short *prior_codes;
-static short *code_ids;
-static unsigned char *added_chars;
-
-static short code_size;
-static short clear_code;
-static short eof_code;
-static short bit_offset;
-static short max_code;
-static short free_code;
-
-
-static void init_table(short min_code_size)
-{
-code_size = min_code_size + 1;
-clear_code = 1 << min_code_size;
-eof_code = clear_code + 1;
-free_code = clear_code + 2;
-max_code = 1 << code_size;
-
-zeroBytes(code_ids, TABLE_SIZE*sizeof(code_ids[0]));
-}
-
-
-static void flush(size_t n)
-{
-if (fputc(n,gif_file) < 0)
-    {
-    longjmp(recover, -3);
-    }
-if (fwrite(gif_byte_buff, 1, n, gif_file) < n)
-    {
-    longjmp(recover, -3);
-    }
-}
-
-
-static void write_code(short code)
-{
-long temp;
-register short byte_offset; 
-register short bits_left;
-
-byte_offset = bit_offset >> 3;
-bits_left = bit_offset & 7;
-
-if (byte_offset >= 254)
-	{
-	flush(byte_offset);
-	gif_byte_buff[0] = gif_byte_buff[byte_offset];
-	bit_offset = bits_left;
-	byte_offset = 0;
-	}
-
-if (bits_left > 0)
-	{
-	temp = ((long) code << bits_left) | gif_byte_buff[byte_offset];
-	gif_byte_buff[byte_offset] = (UBYTE)temp;
-	gif_byte_buff[byte_offset + 1] = (UBYTE)(temp >> 8);
-	gif_byte_buff[byte_offset + 2] = (UBYTE)(temp >> 16);
-	}
-else
-	{
-	gif_byte_buff[byte_offset] = (UBYTE)code;
-	gif_byte_buff[byte_offset + 1] = (UBYTE)(code >> 8);
-	}
-bit_offset += code_size;
-}
-
-
-/*
- * Function:
- *	Compress a stream of data bytes using the LZW algorithm.
- *
- * Inputs:
- *	min_code_size
- *		the field size of an input value.  Should be in the range from
- *		1 to 9.
- *
- * Returns:
- *	 0	normal completion
- *	-1	(not used)
- *	-2	insufficient dynamic memory
- *	-3	bad "min_code_size"
- *	< -3	error status from either the get_byte or put_byte routine
- */
-static short compress_data(int min_code_size)
-{
-short status;
-short prefix_code;
-short d;
-register int hx;
-register short suffix_char;
-
-status = setjmp(recover);
-
-if (status != 0)
-    {
-    return status;
-    }
-
-bit_offset = 0;
-init_table(min_code_size);
-write_code(clear_code);
-suffix_char = *gif_wpt++;
-gif_wcount -= 1;
-
-prefix_code = suffix_char;
-
-while (--gif_wcount >= 0)
-    {
-    suffix_char = *gif_wpt++;
-    hx = prefix_code ^ suffix_char << 5;
-    d = 1;
-
-    for (;;)
-	{
-	if (code_ids[hx] == 0)
-	    {
-	    write_code(prefix_code);
-
-	    d = free_code;
-
-	    if (free_code <= LARGEST_CODE)
-		{
-		prior_codes[hx] = prefix_code;
-		added_chars[hx] = (UBYTE)suffix_char;
-		code_ids[hx] = free_code;
-		free_code++;
-		}
-
-	    if (d == max_code)
-		{
-		if (code_size < 12)
-		    {
-		    code_size++;
-		    max_code <<= 1;
-		    }
-		else
-		    {
-		    write_code(clear_code);
-		    init_table(min_code_size);
-		    }
-	        }
-
-	    prefix_code = suffix_char;
-	    break;
-	    }
-
-	if (prior_codes[hx] == prefix_code &&
-		added_chars[hx] == suffix_char)
-	    {
-	    prefix_code = code_ids[hx];
-	    break;
-	    }
-
-	hx += d;
-	d += 2;
-	if (hx >= TABLE_SIZE)
-	    hx -= TABLE_SIZE;
-	}
-    }
-
-write_code(prefix_code);
-
-write_code(eof_code);
-
-
-/* Make sure the code buffer is flushed */
-
-if (bit_offset > 0)
-    {
-    int byte_offset = (bit_offset >> 3);
-    if (byte_offset == 255)	/* Make sure we don't write a zero by mistake. */
-        {
-	int bits_left = bit_offset & 7;
-	flush(255);
-	if (bits_left)
-	    {
-	    gif_byte_buff[0] = gif_byte_buff[byte_offset];
-	    flush(1);
-	    }
-	}
-    else
-	{
-	flush((bit_offset + 7)/8);
-	}
-    }
-
-flush(0);				/* end-of-data */
-return 0;
-}
-
-short gif_compress_data(int min_code_size, unsigned char *pt, long size, FILE *out)
-{
-int ret;
-
-/* Make sure min_code_size is reasonable. */
-if (min_code_size < 2 || min_code_size > 9)
-    {
-    if (min_code_size == 1)
-	min_code_size = 2;
-    else
-	return -3;
-    }
-
-/* Store input parameters where rest of routines can use. */
-gif_file = out;
-gif_wpt = pt;
-gif_wcount = size;
-
-ret = -2;	/* out of memory default */
-prior_codes = NULL;
-code_ids = NULL;
-added_chars = NULL;
-if ((prior_codes = (short*)needMem(TABLE_SIZE*sizeof(short))) == NULL)
-	goto OUT;
-if ((code_ids = (short*)needMem(TABLE_SIZE*sizeof(short))) == NULL)
-	goto OUT;
-if ((added_chars = (unsigned char*)needMem(TABLE_SIZE)) == NULL)
-	goto OUT;
-
-ret = compress_data(min_code_size);
-
-OUT:
-gentleFree(prior_codes);
-gentleFree(code_ids);
-gentleFree(added_chars);
-return(ret);
-}
-
diff --git a/gbtools/src/blatSrc/lib/gifdecomp.c b/gbtools/src/blatSrc/lib/gifdecomp.c
deleted file mode 100644
index 06c50f7..0000000
--- a/gbtools/src/blatSrc/lib/gifdecomp.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/* decode.c - An LZW decoder for GIF
- * Copyright (C) 1987, by Steven A. Bennett
- *
- * Permission is given by the author to freely redistribute and include
- * this code in any program as long as this credit is given where due.
- *
- * In accordance with the above, I want to credit Steve Wilhite who wrote
- * the code which this is heavily inspired by...
- *
- * GIF and 'Graphics Interchange Format' are trademarks (tm) of
- * Compuserve, Incorporated, an H&R Block Company.
- *
- * Release Notes: This file contains a decoder routine for GIF images
- * which is similar, structurally, to the original routine by Steve Wilhite.
- * It is, however, somewhat noticably faster in most cases.
- *
- */
-
-#include "common.h"
-#include "gifcodes.h"
-
-
-
-/* extern int gif_get_byte()
- *
- *   - This external (machine specific) function is expected to return
- * either the next byte from the GIF file, or a negative number, as
- * defined in gifcodes.h.
- */
-extern int gif_get_byte();
-
-/* extern int gif_out_line(pixels, linelen)
- *     UBYTE pixels[];
- *     int linelen;
- *
- *   - This function takes a full line of pixels (one byte per pixel) and
- * displays them (or does whatever your program wants with them...).  It
- * should return zero, or negative if an error or some other event occurs
- * which would require aborting the decode process...  Note that the length
- * passed will almost always be equal to the line length passed to the
- * decoder function, with the sole exception occurring when an ending code
- * occurs in an odd place in the GIF file...  In any case, linelen will be
- * equal to the number of pixels passed...
- */
-extern int gif_out_line();
-
-/* extern int bad_code_count;
- *
- * This value is the only other global required by the using program, and
- * is incremented each time an out of range code is read by the decoder.
- * When this value is non-zero after a decode, your GIF file is probably
- * corrupt in some way...
- */
-int bad_code_count;
-
-#define MAX_CODES   4095
-
-/* Static variables */
-static WORD curr_size;                     /* The current code size */
-static WORD clear;                         /* Value for a clear code */
-static WORD ending;                        /* Value for a ending code */
-static WORD newcodes;                      /* First available code */
-static WORD top_slot;                      /* Highest code for current size */
-static WORD slot;                          /* Last read code */
-
-/* The following static variables are used
- * for seperating out codes
- */
-static WORD navail_bytes = 0;              /* # bytes left in block */
-static WORD nbits_left = 0;                /* # bits left in current byte */
-static UBYTE b1;                           /* Current byte */
-static UBYTE gif_byte_buff[256+3];               /* Current block */
-static UBYTE *pbytes;                      /* Pointer to next byte in block */
-
-static long code_mask[13] = {
-     0,
-     0x0001, 0x0003,
-     0x0007, 0x000F,
-     0x001F, 0x003F,
-     0x007F, 0x00FF,
-     0x01FF, 0x03FF,
-     0x07FF, 0x0FFF
-     };
-
-
-/* This function initializes the decoder for reading a new image.
- */
-static WORD init_exp(size)
-   WORD size;
-   {
-   curr_size = size + 1;
-   top_slot = 1 << curr_size;
-   clear = 1 << size;
-   ending = clear + 1;
-   slot = newcodes = ending + 1;
-   navail_bytes = nbits_left = 0;
-   return(0);
-   }
-
-/* get_next_code()
- * - gets the next code from the GIF file.  Returns the code, or else
- * a negative number in case of file errors...
- */
-static WORD get_next_code()
-   {
-   WORD i, x;
-   unsigned long ret;
-
-   if (nbits_left == 0)
-      {
-      if (navail_bytes <= 0)
-         {
-
-         /* Out of bytes in current block, so read next block
-          */
-         pbytes = gif_byte_buff;
-         if ((navail_bytes = gif_get_byte()) < 0)
-            return(navail_bytes);
-         else if (navail_bytes)
-            {
-            for (i = 0; i < navail_bytes; ++i)
-               {
-               if ((x = gif_get_byte()) < 0)
-                  return(x);
-               gif_byte_buff[i] = x;
-               }
-            }
-         }
-      b1 = *pbytes++;
-      nbits_left = 8;
-      --navail_bytes;
-      }
-
-   ret = b1 >> (8 - nbits_left);
-   while (curr_size > nbits_left)
-      {
-      if (navail_bytes <= 0)
-         {
-
-         /* Out of bytes in current block, so read next block
-          */
-         pbytes = gif_byte_buff;
-         if ((navail_bytes = gif_get_byte()) < 0)
-            return(navail_bytes);
-         else if (navail_bytes)
-            {
-            for (i = 0; i < navail_bytes; ++i)
-               {
-               if ((x = gif_get_byte()) < 0)
-                  return(x);
-               gif_byte_buff[i] = x;
-               }
-            }
-         }
-      b1 = *pbytes++;
-      ret |= b1 << nbits_left;
-      nbits_left += 8;
-      --navail_bytes;
-      }
-   nbits_left -= curr_size;
-   ret &= code_mask[curr_size];
-   return((WORD)(ret));
-   }
-
-
-
-/* WORD decoder(linewidth)
- *    WORD linewidth;               * Pixels per line of image *
- *
- * - This function decodes an LZW image, according to the method used
- * in the GIF spec.  Every *linewidth* 'characters' (ie. pixels) decoded
- * will generate a call to gif_out_line(), which is a user specific function
- * to display a line of pixels.  The function gets it's codes from
- * get_next_code() which is responsible for reading blocks of data and
- * seperating them into the proper size codes.  Finally, gif_get_byte() is
- * the global routine to read the next byte from the GIF file.
- *
- * It is generally a good idea to have linewidth correspond to the actual
- * width of a line (as specified in the Image header) to make your own
- * code a bit simpler, but it isn't absolutely necessary.
- *
- * Returns: 0 if successful, else negative.  (See ERRS.H)
- *
- */
-
-static WORD decoder(linewidth,buf,stack,suffix,prefix)
-   WORD linewidth;
-   UBYTE *buf;		/* food for gif_line_out, where the pixels go */
-   UBYTE *stack;	/* Stack for storing pixels backwards */
-   UBYTE *suffix;	/* Suffix table */
-   UWORD *prefix;	/* Prefix linked list */
-   {
-   register UBYTE *sp, *bufptr;
-   register WORD code, fc, oc, bufcnt;
-   WORD c, size, ret;
-
-   /* Initialize for decoding a new image...
-    */
-   if ((size = gif_get_byte()) < 0)
-      return(size);
-   if (size < 2 || 9 < size)
-      return(BAD_CODE_SIZE);
-   init_exp(size);
-
-   /* Initialize in case they forgot to put in a clear code.
-    * (This shouldn't happen, but we'll try and decode it anyway...)
-    */
-   oc = fc = 0;
-
-
-   /* Set up the stack pointer and decode buffer pointer
-    */
-   sp = stack;
-   bufptr = buf;
-   bufcnt = linewidth;
-
-   /* This is the main loop.  For each code we get we pass through the
-    * linked list of prefix codes, pushing the corresponding 'character' for
-    * each code onto the stack.  When the list reaches a single 'character'
-    * we push that on the stack too, and then start unstacking each
-    * character for output in the correct order.  Special handling is
-    * included for the clear code, and the whole thing ends when we get
-    * an ending code.
-    */
-   while ((c = get_next_code()) != ending)
-      {
-
-      /* If we had a file error, return without completing the decode
-       */
-      if (c < 0)
-         {
-         return(c);
-         }
-
-      /* If the code is a clear code, reinitialize all necessary items.
-       */
-      if (c == clear)
-         {
-         curr_size = size + 1;
-         slot = newcodes;
-         top_slot = 1 << curr_size;
-
-         /* Continue reading codes until we get a non-clear code
-          * (Another unlikely, but possible case...)
-          */
-         while ((c = get_next_code()) == clear)
-            ;
-
-         /* If we get an ending code immediately after a clear code
-          * (Yet another unlikely case), then break out of the loop.
-          */
-         if (c == ending)
-            break;
-
-         /* Finally, if the code is beyond the range of already set codes,
-          * (This one had better NOT happen...  I have no idea what will
-          * result from this, but I doubt it will look good...) then set it
-          * to color zero.
-          */
-         if (c >= slot)
-            c = 0;
-
-         oc = fc = c;
-
-         /* And let us not forget to put the char into the buffer... And
-          * if, on the off chance, we were exactly one pixel from the end
-          * of the line, we have to send the buffer to the gif_out_line()
-          * routine...
-          */
-         *bufptr++ = c;
-         if (--bufcnt == 0)
-            {
-            if ((ret = gif_out_line(buf, linewidth)) < 0)
-               {
-               return(ret);
-               }
-            bufptr = buf;
-            bufcnt = linewidth;
-            }
-         }
-      else
-         {
-
-         /* In this case, it's not a clear code or an ending code, so
-          * it must be a code code...  So we can now decode the code into
-          * a stack of character codes. (Clear as mud, right?)
-          */
-         code = c;
-
-         /* Here we go again with one of those off chances...  If, on the
-          * off chance, the code we got is beyond the range of those already
-          * set up (Another thing which had better NOT happen...) we trick
-          * the decoder into thinking it actually got the last code read.
-          * (Hmmn... I'm not sure why this works...  But it does...)
-          */
-         if (code >= slot)
-            {
-            if (code > slot)
-               ++bad_code_count;
-            code = oc;
-            *sp++ = fc;
-            }
-
-         /* Here we scan back along the linked list of prefixes, pushing
-          * helpless characters (ie. suffixes) onto the stack as we do so.
-          */
-         while (code >= newcodes)
-            {
-            *sp++ = suffix[code];
-            code = prefix[code];
-            }
-
-         /* Push the last character on the stack, and set up the new
-          * prefix and suffix, and if the required slot number is greater
-          * than that allowed by the current bit size, increase the bit
-          * size.  (NOTE - If we are all full, we *don't* save the new
-          * suffix and prefix...  I'm not certain if this is correct...
-          * it might be more proper to overwrite the last code...
-          */
-         *sp++ = code;
-         if (slot < top_slot)
-            {
-            suffix[slot] = fc = code;
-            prefix[slot++] = oc;
-            oc = c;
-            }
-         if (slot >= top_slot)
-            if (curr_size < 12)
-               {
-               top_slot <<= 1;
-               ++curr_size;
-               } 
-
-         /* Now that we've pushed the decoded string (in reverse order)
-          * onto the stack, lets pop it off and put it into our decode
-          * buffer...  And when the decode buffer is full, write another
-          * line...
-          */
-         while (sp > stack)
-            {
-            *bufptr++ = *(--sp);
-            if (--bufcnt == 0)
-               {
-               if ((ret = gif_out_line(buf, linewidth)) < 0)
-                  {
-                  return(ret);
-                  }
-               bufptr = buf;
-               bufcnt = linewidth;
-               }
-            }
-         }
-      }
-   ret = 0;
-   if (bufcnt != linewidth)
-      ret = gif_out_line(buf, (linewidth - bufcnt));
-   return(ret);
-   }
-
-/* basically just allocate memory for buffers and tables, and then
-   call Steve B.'s decoder */
-int gif_decoder(int linewidth)
-{
-UBYTE *buf, *stack, *suffix;
-UWORD *prefix;
-int ret;
-
-ret = OUT_OF_MEMORY;
-stack = NULL;
-suffix = NULL;
-prefix = NULL;
-/* stack = suffix = (UBYTE *)prefix = NULL; */
-if ((buf = (UBYTE *)needMem(linewidth + 1)) == NULL)
-	goto OUT;
-if ((stack = (UBYTE *)needMem(MAX_CODES+1)) == NULL)
-	goto OUT;
-if ((suffix = (UBYTE *)needMem(MAX_CODES+1)) == NULL)
-	goto OUT;
-if ((prefix = (UWORD *)needMem((MAX_CODES+1)*sizeof(UWORD) )) == NULL)
-	goto OUT;
-ret = decoder(linewidth,buf,stack,suffix,prefix);
-OUT:
-freeMem(buf);
-freeMem(stack);
-freeMem(prefix);
-freeMem(suffix);
-return(ret);
-}
-
-
-
diff --git a/gbtools/src/blatSrc/lib/gifread.c b/gbtools/src/blatSrc/lib/gifread.c
deleted file mode 100644
index bfa0803..0000000
--- a/gbtools/src/blatSrc/lib/gifread.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* gifread.c - The high level GIF reading routines.  See writegif for the
-   write side.  Also gifdecode.c for lower level GIF reading code. */
-
-#include "common.h"
-#include "gifcodes.h"
-#include "memgfx.h"
-
-
-static struct gif_header gif;
-static struct gif_image gim;
-static int gif_line;
-static char iphase;
-static WORD iy;
-static UBYTE gif_cmap[256*3];
-static FILE *gif_file;
-static struct memGfx *gif_mg;
-static int gif_width, gif_height;
-
-int gif_get_byte()
-/* Get next byte from file for decoder.
- * return -1 at end of file. */
-{
-return(fgetc(gif_file));
-}
-
-
-int gif_out_line(UBYTE *pixels, int linelen)
-/* Output a line of gif. */
-{
-int y;
-
-y = gif_line;
-if (gim.flags&ITLV_BIT)
-    {
-    y = iy;
-    switch (iphase)
-        {
-        case 0:
-        case 1:
-            iy+=8;
-            break;
-        case 2:
-            iy += 4;
-            break;
-        case 3:
-            iy += 2;
-            break;
-        }
-    if (iy >= gif_height)
-        {
-        switch (iphase)
-            {
-            case 0:
-                iy = 4;
-                break;
-            case 1:
-                iy = 2;
-                break;
-            case 2:
-                iy = 1;
-                break;
-            }
-        iphase++;
-        }
-    }
-gif_line++;
-memcpy(gif_mg->pixels + y*gif_mg->width, pixels, linelen);
-return(0);
-}
-
-
-
-struct memGfx *mgLoadGif(char *name)
-/* Create memory image based on gif file. 
- * Note this is based on a very old gif reader
- * that only handles the GIF87a version. 
- * This is the same that mgSaveGif creates at
- * least.  This version of gif was always
- * color mapped. */
-{
-int c;
-char type[7];
-int gif_colors = 0;
-
-gif_line = 0;
-iphase = 0;
-iy = 0;
-gif_mg = NULL;
-gif_file = mustOpen(name, "rb");
-if (fread(&gif, 1, sizeof(gif), gif_file) < sizeof(gif))
-    {
-    goto TRUNCOUT;
-    }
-memcpy(type, gif.giftype, 6);
-type[6] = 0;
-if (!startsWith("GIF", type))
-    {
-    errAbort("Not a good GIF file");
-    goto BADOUT;
-    }
-if (!sameString("GIF87a", type))
-    {
-    errAbort("Gif is version %s, sadly load_gif only speaks version GIF87a", type);
-    goto BADOUT;
-    }
-gif_colors = (1<<((gif.colpix&PIXMASK)+1));
-if (gif.colpix&COLTAB)
-    {
-    int size = gif_colors*3;
-    if (fread(gif_cmap, 1, size, gif_file) < size)
-        goto TRUNCOUT;
-    }
-for (;;)    /* skip over extension blocks and other junk til get ',' */
-    {
-    if ((c = fgetc(gif_file)) == READ_ERROR)
-        goto TRUNCOUT;
-    if (c == ',')
-        break;
-    if (c == ';')    /* semi-colon is end of piccie */
-        goto TRUNCOUT;
-    if (c == '!')    /* extension block */
-        {
-        if ((c = fgetc(gif_file)) == READ_ERROR)    /* skip extension type */
-            goto TRUNCOUT;
-        for (;;)
-            {
-            if ((c = fgetc(gif_file)) == READ_ERROR)
-                goto TRUNCOUT;
-            if (c == 0)    /* zero 'count' means end of extension */
-                break;
-            while (--c >= 0)
-                {
-                if (fgetc(gif_file) == READ_ERROR)
-                    goto TRUNCOUT;
-                }
-            }
-        }
-    }
-if (fread(&gim, 1, sizeof(gim), gif_file) < sizeof(gim))
-    goto TRUNCOUT;
-gif_width = (gim.whi<<8) + gim.wlo;
-gif_height = (gim.hhi<<8) + gim.hlo;
-
-gif_mg = mgNew(gif_width, gif_height);
-
-/* Gif files can have color maps in two places.  Let
- * the gim color map overwrite the one in the gif header
- * here. */
-if (gim.flags&COLTAB)
-    {
-    int size;
-    gif_colors = (1<<((gim.flags&PIXMASK)+1));
-    size = gif_colors*3;
-    if (fread(gif_cmap, 1, size, gif_file) < size)
-        goto TRUNCOUT;
-    }
-if (gif_colors > 0)
-    {
-    if (gif_colors > 256)
-       errAbort("Too many colors in %s", name);
-    memcpy(gif_mg->colorMap, gif_cmap, 3*gif_colors);
-    }
-
-switch (gif_decoder(gif_width))
-    {
-    case READ_ERROR:
-    case BAD_CODE_SIZE:
-        goto TRUNCOUT;
-    case OUT_OF_MEMORY:
-	errAbort("out of memory");
-        goto BADOUT;
-    default:
-        break;
-    }
-carefulClose(&gif_file);
-return(gif_mg);
-
-TRUNCOUT:
-errAbort("%s is truncated", name);
-BADOUT:
-carefulClose(&gif_file);
-mgFree(&gif_mg);
-return(NULL);
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/gifwrite.c b/gbtools/src/blatSrc/lib/gifwrite.c
deleted file mode 100644
index 76149a1..0000000
--- a/gbtools/src/blatSrc/lib/gifwrite.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* writegif.c - stuff to write out a GIF file.  See also comprs.c */
-
-#ifndef USE_PNG
-#include "common.h"
-#include "memgfx.h"
-#include "gifcodes.h"
-
-
-static char gifsig[] = "GIF87a";
-
-// GIF Graphic Control Extension, for making the background color transparent:
-static struct gif_gce
-    {
-    unsigned char extensionIntroducer, graphicControlLabel, blockSize;
-    unsigned char flags;
-    unsigned char delayTimeLo,delayTimeHi;
-    unsigned char transparentColorIndex;
-    unsigned char blockTerminator;
-    } gce = {0x21, 0xF9, 0x04, // fixed bytes from spec
-	     0x01,             // transparency on (no user input or disposal options)
-	     0x00, 0x00,       // no animation delay time
-	     0x00,             // color index 0 (white) is transparent
-	     0x00};
-
-boolean mgSaveToGif(FILE *gif_file, struct memGfx *screen, boolean useTransparency)
-/* Save GIF to an already open file.
- * If useTransparency, then the first color in memgfx's colormap/palette is
- * assumed to be the image background color, and pixels of that color
- * are made transparent. */
-{
-int i;
-struct gif_header gif;
-struct gif_image gim;
-long gif_wcount;
-
-gif_wcount = (long)screen->width * screen->height;
-zeroBytes(&gif, sizeof(gif));
-strncpy(gif.giftype, gifsig, sizeof(gif.giftype));
-gif.wlo = gim.wlo = ((screen->width)&0xff);
-gif.whi = gim.whi = ((screen->width>>8)&0xff);
-gif.hlo = gim.hlo = ((screen->height)&0xff);
-gif.hhi = gim.hhi = ((screen->height>>8)&0xff);
-gim.xlo = gim.xhi = gim.ylo = gim.yhi = gim.flags = 0;
-gif.colpix = COLPIXVGA13;
-if (fwrite(&gif, sizeof(gif), 1, gif_file ) < 1)
-    goto TRUNCOUT;
-/* write global color map */
-if (fwrite(screen->colorMap, 3, 256, gif_file) < 256)
-    goto TRUNCOUT;
-
-if (useTransparency)
-    if (fwrite(&gce, sizeof(gce), 1, gif_file ) < 1)
-	goto TRUNCOUT;
-
-if (fputc(',', gif_file) < 0) /* comma to start image */
-    goto TRUNCOUT;
-if (fwrite(&gim, sizeof(gim), 1, gif_file) < 1)
-    goto TRUNCOUT;
-fputc(8,gif_file);
-fflush(gif_file);
-i = gif_compress_data(8, (unsigned char*)screen->pixels, gif_wcount, gif_file);
-switch (i)
-    {
-    case 0:
-        break;
-    case -2:
-	warn("Out of memory writing GIF");
-	goto BADOUT;
-    case -3:
-	goto TRUNCOUT;
-    default:
-	warn("Error code %d writing gif", i);
-	goto BADOUT;
-    }
-fputc(';', gif_file); /* end of file for gif */
-return(TRUE);
-TRUNCOUT:
-warn("Disk full writing GIF");
-BADOUT:
-return(FALSE);
-}
-
-void mgSaveGif(struct memGfx *screen, char *name, boolean useTransparency)
-/* Save memory bitmap as a gif.
- * If useTransparency, then the first color in memgfx's colormap/palette is
- * assumed to be the image background color, and pixels of that color
- * are made transparent. */
-{
-FILE *gifFile = mustOpen(name, "wb");
-if (!mgSaveToGif(gifFile, screen, useTransparency))
-    {
-    remove(name);
-    errAbort("Couldn't save %s", name);
-    }
-if (fclose(gifFile) != 0)
-    errnoAbort("fclose failed");
-}
-#endif
diff --git a/gbtools/src/blatSrc/lib/hacTree.c b/gbtools/src/blatSrc/lib/hacTree.c
deleted file mode 100644
index c303cca..0000000
--- a/gbtools/src/blatSrc/lib/hacTree.c
+++ /dev/null
@@ -1,510 +0,0 @@
-/* hacTree - Hierarchical Agglomerative Clustering a list of inputs into a binary tree */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "dlist.h"
-#include "hash.h"
-#include "hacTree.h"
-#include "synQueue.h"
-#include "pthreadDoList.h"
-
-static struct hacTree *leafNodesFromItems(const struct slList *itemList, int itemCount,
-					  struct lm *localMem)
-/* Allocate & initialize leaf nodes that contain only items. */
-{
-struct hacTree *leafNodes = lmAlloc(localMem, itemCount * sizeof(struct hacTree));
-int i = 0;
-const struct slList *item = itemList;
-while (item != NULL && i < itemCount)
-    {
-    // needMem zeroes the memory, so initialize only non-NULL stuff.
-    struct hacTree *node = &(leafNodes[i]);
-    if (i < itemCount-1)
-	node->next = &(leafNodes[i+1]);
-    node->itemOrCluster = (struct slList *)item;
-    i++;
-    item = item->next;
-    }
-return leafNodes;
-}
-
-struct sortWrapper
-/* We need to compare nodes' itemOrClusters using cmpF and extraData;
- * qsort's comparison function doesn't have a way to pass in extraData,
- * so we need to point to it from each qsort element. */
-{
-    struct hacTree *node;  // contains itemOrCluster to be compared
-    hacCmpFunction *cmpF;  // user-provided itemOrCluster comparison function
-    void *extraData;       // user-provided aux data for cmpF
-};
-
-static int sortWrapCmp(const void *v1, const void *v2)
-/* Unpack sortWrappers and run cmpF on nodes' itemOrClusters with extraData. */
-{
-const struct sortWrapper *w1 = v1, *w2 = v2;
-return w1->cmpF(w1->node->itemOrCluster, w2->node->itemOrCluster, w1->extraData);
-}
-
-static struct sortWrapper *makeSortedWraps(struct hacTree *leafNodes, int itemCount,
-					   struct lm *localMem, hacCmpFunction cmpF,
-					   void *extraData)
-/* Use cmpF and extraData to sort wrapped leaves so that identical leaves will be adjacent. */
-{
-struct sortWrapper *leafWraps = lmAlloc(localMem, itemCount * sizeof(struct sortWrapper));
-int i;
-for (i=0;  i < itemCount;  i++)
-    {
-    leafWraps[i].node = &(leafNodes[i]);
-    leafWraps[i].cmpF = cmpF;
-    leafWraps[i].extraData = extraData;
-    }
-qsort(leafWraps, itemCount, sizeof(struct sortWrapper), sortWrapCmp);
-return leafWraps;
-}
-
-INLINE void initNode(struct hacTree *node, const struct hacTree *left, const struct hacTree *right,
-		     hacDistanceFunction *distF, hacMergeFunction *mergeF, void *extraData, bool distOnly)
-/* Initialize node to have left and right as its children.  Leave parent pointers
- * alone -- they would be unstable during tree construction. */
-{
-node->left = (struct hacTree *)left;
-node->right = (struct hacTree *)right;
-if (left != NULL && right != NULL)
-    {
-    if (distOnly)
-        {
-	struct slList * el;
-	AllocVar(el);
-        node->childDistance = distF(left->itemOrCluster, right->itemOrCluster, extraData);
-        node->itemOrCluster = el;
-        }
-    else {
-        node->childDistance = distF(left->itemOrCluster, right->itemOrCluster, extraData);
-        node->itemOrCluster = mergeF(left->itemOrCluster, right->itemOrCluster, extraData);
-        }
-    }
-}
-
-INLINE struct hacTree preClusterNodes(const struct sortWrapper *leafWraps, int i, int runLength,
-				      hacDistanceFunction *distF, hacMergeFunction *mergeF,
-				      void *extraData, struct lm *localMem)
-/* Caller has allocated a node, and this returns what to store there:
- * a recursively constructed cluster of nodes extracted from wrapped
- * leafNodes (leafWraps) starting at i, for runLength items. */
-{
-struct hacTree ret = {NULL, NULL, NULL, NULL, 0, NULL};
-if (runLength > 2)
-    {
-    struct hacTree *newClusters = lmAlloc(localMem, 2 * sizeof(struct hacTree));
-    int halfLength = runLength/2;
-    newClusters[0] = preClusterNodes(leafWraps, i, halfLength,
-				     distF, mergeF, extraData, localMem);
-    newClusters[1] = preClusterNodes(leafWraps, i+halfLength, runLength-halfLength,
-				     distF, mergeF, extraData, localMem);
-    initNode(&ret, &(newClusters[0]), &(newClusters[1]), distF, mergeF, extraData, FALSE);
-    }
-else if (runLength == 2)
-    {
-    initNode(&ret, leafWraps[i].node, leafWraps[i+1].node, distF, mergeF, extraData, FALSE);
-    }
-else
-    ret = *(leafWraps[i].node);
-return ret;
-}
-
-static struct hacTree *sortAndPreCluster(struct hacTree *leafNodes, int *retItemCount,
-					 struct lm *localMem, hacDistanceFunction *distF,
-					 hacMergeFunction *mergeF, hacCmpFunction *cmpF,
-					 void *extraData)
-/* Use cmpF and extraData to sort wrapped leaf nodes so that identical leaves will be adjacent,
- * then replace leaves with clusters of identical leaves where possible.  Place new
- * (hopefully smaller) item count in retItemCount. */
-{
-int itemCount = *retItemCount;
-struct sortWrapper *leafWraps = makeSortedWraps(leafNodes, itemCount, localMem, cmpF, extraData);
-struct hacTree *newLeaves = lmAlloc(localMem, itemCount * sizeof(struct hacTree));
-int i=0, newI=0;
-while (i < itemCount)
-    {
-    int nextRunStart;
-    for (nextRunStart = i+1;  nextRunStart < itemCount; nextRunStart++)
-	if (distF(leafWraps[i].node->itemOrCluster, leafWraps[nextRunStart].node->itemOrCluster,
-		  extraData) != 0)
-	    break;
-    int runLength = nextRunStart - i;
-    newLeaves[newI] = preClusterNodes(leafWraps, i, runLength, distF, mergeF, extraData, localMem);
-    i = nextRunStart;
-    newI++;
-    }
-*retItemCount = newI;
-return newLeaves;
-}
-
-static struct hacTree *pairUpItems(const struct slList *itemList, int itemCount,
-				   int *retPairCount, struct lm *localMem,
-				   hacDistanceFunction *distF, hacMergeFunction *mergeF,
-				   hacCmpFunction *cmpF, void *extraData)
-/* Allocate & initialize leaf nodes and all possible pairings of leaf nodes
- * which will be our seed clusters.  If cmpF is given, pre-sort the leaf nodes
- * and pre-cluster identical leaves before generating seed clusters. */
-{
-struct hacTree *leafNodes = leafNodesFromItems(itemList, itemCount, localMem);
-if (cmpF != NULL)
-    leafNodes = sortAndPreCluster(leafNodes, &itemCount, localMem,
-				  distF, mergeF, cmpF, extraData);
-int pairCount = (itemCount == 1) ? 1 : (itemCount * (itemCount-1) / 2);
-struct hacTree *pairPool = lmAlloc(localMem, pairCount * sizeof(struct hacTree));
-if (itemCount == 1)
-    initNode(pairPool, leafNodes, NULL, distF, mergeF, extraData, FALSE);
-else
-    {
-    int i, j, pairIx;
-    for (i=0, pairIx=0;  i < itemCount-1;  i++)
-	for (j=i+1;  j < itemCount;  j++, pairIx++)
-	    initNode(&(pairPool[pairIx]), &(leafNodes[i]), &(leafNodes[j]), distF, mergeF,
-		     extraData, TRUE);
-    }
-*retPairCount = pairCount;
-return pairPool;
-}
-
-struct hacTree *hacTreeFromItems(const struct slList *itemList, struct lm *localMem,
-				 hacDistanceFunction *distF, hacMergeFunction *mergeF,
-				 hacCmpFunction *cmpF, void *extraData)
-/* Using distF, mergeF, optionally cmpF and binary tree operations,
- * perform a hierarchical agglomerative (bottom-up) clustering of
- * items.  To free the resulting tree, lmCleanup(&localMem). */
-//
-// Implementation:
-//
-// Create a pool containing all pairs of items (N*(N-1)/2), and build
-// a hierarchical binary tree of items from the bottom up.  In each
-// iteration, first we find the closest pair and swap it into the head
-// of the pool; then we advance the head pointer, so the closest pair
-// now has a stable location in memory.  Next, for all pairs still in
-// the pool, we replace references to the elements of the closest pair
-// with the closest pair itself, but delete half of such pairs because
-// they would be duplicates.  Specifically, we keep pairs that had the
-// left element of the closest pair, and delete pairs that had the
-// right element of the closest pair.  We rescore the pairs that have
-// the closest pair swapped in for an element.  The code to do all
-// this is surprisingly simple -- in the second for loop below.  Note
-// that with each iteration, the pool will reduce in size, by N-2 the
-// first iteration, N-3 the second, and so forth.
-//
-// An example may help: say we start with items A, B, C and D.  Initially
-// the pool contains all pairs:
-//    (A, B)   (A, C)   (A, D)   (B, C)   (B, D)   (C, D)
-//
-// If (A, B) is the closest pair, we pop it from the pool and the pool
-// becomes
-//    (A, C)   (A, D)   (B, C)   (B, D)   (C, D)
-//
-// Now we substitute (A, B) for pool pairs containing A, and delete pool
-// pairs contining B because they would be duplicates of those containing
-// A.  [X] shows where a pair was deleted:
-//
-//    ((A, B), C)  ((A, B), D)  [X]   [X]  (C, D)
-//
-// Now say ((A, B), D) is the closest remaining pair, and is popped from
-// the head of the pool.  We substitute into pairs containing (A, B) and
-// delete pairs containing D.  After the replacement step, the pool is
-// down to a single element:
-//
-//    (((A, B), D), C)   [X]
-{
-if (itemList == NULL)
-    return NULL;
-struct hacTree *root = NULL;
-int itemCount = slCount(itemList);
-int pairCount = 0;
-struct hacTree *leafPairs = pairUpItems(itemList, itemCount, &pairCount, localMem,
-					distF, mergeF, cmpF, extraData);
-int *nodesToDelete = needMem(pairCount * sizeof(int));
-struct hacTree *poolHead = leafPairs;
-int poolLength = pairCount;
-while (poolLength > 0)
-    {
-    // Scan pool for node with lowest childDistance; swap that node w/head
-    int bestIx = 0;
-    double minScore = poolHead[0].childDistance;
-    int i;
-    for (i=1;  i < poolLength;  i++)
-	if (poolHead[i].childDistance < minScore)
-	    {
-	    minScore = poolHead[i].childDistance;
-	    bestIx = i;
-	    }
-    if (bestIx != 0)
-	swapBytes((char *)&(poolHead[0]), (char *)&(poolHead[bestIx]), sizeof(struct hacTree));
-    // Pop the best (lowest-distance) node from poolHead, make it root (for now).
-    root = poolHead;
-    if (root->left && root->right)
-        root->itemOrCluster = mergeF(root->left->itemOrCluster, root->right->itemOrCluster,
-                                     extraData);
-    else if (root->left)
-        root->itemOrCluster = root->left->itemOrCluster;
-    else if (root->right)
-        root->itemOrCluster = root->right->itemOrCluster;
-    poolHead = &(poolHead[1]);
-    poolLength--;
-    // Where root->left is found in the pool, replace it with root.
-    // Where root->right is found, drop that node so it doesn't become
-    // a duplicate of the replacement cases.
-    int numNodesToDelete = 0;
-    for (i=0;  i < poolLength;  i++)
-	{
-	struct hacTree *node = &(poolHead[i]);
-	if (node->left == root->left)
-	    // found root->left; replace node->left with root (merge root with node->right):
-	    initNode(node, root, node->right, distF, mergeF, extraData, FALSE);
-	else if (node->right == root->left)
-	    // found root->left; replace node->right with root (merge root with node->left):
-	    initNode(node, node->left, root, distF, mergeF, extraData, FALSE);
-	else if (node->left == root->right || node->right == root->right)
-	    // found root->right; mark this node for deletion:
-	    nodesToDelete[numNodesToDelete++] = i;
-	}
-    if (numNodesToDelete > 0)
-	{
-	int newPoolLen = nodesToDelete[0];
-	// This will be "next node to delete" for the last marked node:
-	nodesToDelete[numNodesToDelete] = poolLength;
-	for (i = 0;  i < numNodesToDelete;  i++)
-	    {
-	    int nodeToDel = nodesToDelete[i];
-	    int nextNodeToDel = nodesToDelete[i+1];
-	    int blkSize = nextNodeToDel - (nodeToDel+1);
-	    if (blkSize == 0)
-		continue;
-	    struct hacTree *fromNode = &(poolHead[nodeToDel+1]);
-	    struct hacTree *toNode = &(poolHead[newPoolLen]);
-	    memmove(toNode, fromNode, blkSize * sizeof(struct hacTree));
-	    newPoolLen += blkSize;
-	    }
-	poolLength = newPoolLen;
-	}
-    // root now has a stable address, unlike nodes still in the pool, so set parents here:
-    if (root->left != NULL)
-	root->left->parent = root;
-    if (root->right != NULL)
-	root->right->parent = root;
-    }
-// This shouldn't be necessary as long as initNode leaves parent pointers alone,
-// but just in case that changes:
-root->parent = NULL;
-return root;
-}
-
-/** The code from here on down is an alternative implementation that calls the merge
- ** function and for that matter the distance function much less than the function
- ** above, and also is multithreaded.  It does seem to produce the same output
- ** but the algorithm is sufficiently different, at least for now, I'm keeping
- ** both. */
-
-
-#define distKeySize 64  
-
-static void calcDistKey(void *a, void *b, char key[distKeySize])
-/* Put key for distance in key */
-{
-safef(key, distKeySize, "%p %p", a, b);
-}
-
-void hacTreeDistanceHashAdd(struct hash *hash, void *itemA, void *itemB, double distance)
-/* Add an item to distance hash */
-{
-char key[distKeySize];
-calcDistKey(itemA, itemB, key);
-hashAdd(hash, key, CloneVar(&distance));
-}
-
-double *hacTreeDistanceHashLookup(struct hash *hash, void *itemA, void *itemB)
-/* Look up pair in distance hash.  Returns NULL if not found, otherwise pointer to
- * distance */
-{
-char key[distKeySize];
-calcDistKey(itemA, itemB, key);
-return hashFindVal(hash, key);
-}
-
-struct hctPair
-/* A pair of hacTree nodes and the distance between them */
-    {
-    struct hctPair *next;  /* Next in list */
-    struct hacTree *a, *b;	   /* The pair of nodes */
-    double distance;	   /* Distance between pair */
-    };
-
-struct distanceWorkerContext
-/* Context for a distance worker */
-    {
-    hacDistanceFunction *distF;	/* Function to call to calc distance */
-    void *extraData;		/* Extra data for that function */
-    };
-
-static void distanceWorker(void *item, void *context)
-/* fill in distance for pair */
-{
-struct hctPair *pair = item;
-struct distanceWorkerContext *dc = context;
-struct hacTree *aHt = pair->a, *bHt = pair->b;
-pair->distance = (dc->distF)((struct slList *)(aHt->itemOrCluster), 
-    (struct slList *)(bHt->itemOrCluster), dc->extraData);
-}
-
-static void precacheMissingDistances(struct dlList *list, struct hash *distanceHash,
-    hacDistanceFunction *distF, void *extraData, int threadCount)
-/* Force computation of all distances not already in hash */
-{
-/* Make up list of all missing distances in pairList */
-struct synQueue *sq = synQueueNew();
-struct hctPair *pairList = NULL, *pair;
-struct dlNode *aNode;
-for (aNode = list->head; !dlEnd(aNode); aNode = aNode->next)
-    {
-    struct hacTree *aHt = aNode->val;
-    struct dlNode *bNode;
-    for (bNode = aNode->next; !dlEnd(bNode); bNode = bNode->next)
-        {
-	struct hacTree *bHt = bNode->val;
-	char key[64];
-	calcDistKey(aHt->itemOrCluster, bHt->itemOrCluster, key);
-	double *pd = hashFindVal(distanceHash, key);
-	if (pd == NULL)
-	     {
-	     AllocVar(pair);
-	     pair->a = aHt;
-	     pair->b = bHt;
-	     slAddHead(&pairList, pair);
-	     synQueuePut(sq, pair);
-	     }
-	}
-    }
-
-/* Parallelize distance calculations */
-struct distanceWorkerContext context = {.distF=distF, .extraData=extraData};
-pthreadDoList(threadCount, pairList, distanceWorker, &context);
-
-for (pair = pairList; pair != NULL; pair = pair->next)
-    {
-    hacTreeDistanceHashAdd(distanceHash, 
-	pair->a->itemOrCluster, pair->b->itemOrCluster, pair->distance);
-    }
-slFreeList(&pairList);
-}
-
-static double pairParallel(struct dlList *list, struct hash *distanceHash, 
-    hacDistanceFunction *distF, void *extraData, int threadCount,
-    struct dlNode **retNodeA, struct dlNode **retNodeB)
-/* Loop through list returning closest two nodes */
-{
-precacheMissingDistances(list, distanceHash, distF, extraData, threadCount);
-struct dlNode *aNode;
-double closestDistance = BIGDOUBLE;
-struct dlNode *closestA = NULL, *closestB = NULL;
-for (aNode = list->head; !dlEnd(aNode); aNode = aNode->next)
-    {
-    struct hacTree *aHt = aNode->val;
-    struct dlNode *bNode;
-    for (bNode = aNode->next; !dlEnd(bNode); bNode = bNode->next)
-        {
-	struct hacTree *bHt = bNode->val;
-	char key[64];
-	safef(key, sizeof(key), "%p %p", aHt->itemOrCluster, bHt->itemOrCluster);
-	double *pd = hashMustFindVal(distanceHash, key);
-	double d = *pd;
-	if (d < closestDistance)
-	    {
-	    closestDistance = d;
-	    closestA = aNode;
-	    closestB = bNode;
-	    }
-	}
-    }
-*retNodeA = closestA;
-*retNodeB = closestB;
-return closestDistance;
-}
-
-static void lmDlAddValTail(struct lm *lm, struct dlList *list, void *val)
-/* Allocate new dlNode out of lm, initialize it with val, and add it to end of list */
-{
-struct dlNode *node;
-lmAllocVar(lm, node);
-node->val = val;
-dlAddTail(list, node);
-}
-
-struct hacTree *hacTreeMultiThread(int threadCount, struct slList *itemList, 
-		    struct lm *localMem, hacDistanceFunction *distF, hacMergeFunction *mergeF,
-		    void *extraData, struct hash *precalcDistanceHash)
-/* Construct hacTree minimizing number of merges called, and doing distance calls
- * in parallel when possible.   Do a lmCleanup(localMem) to free returned tree. 
- * The inputs are
- *	threadCount - number of threads - at least one, recommended no more than 15
- *	itemList - list of items to tree up.  Format can vary, but must start with a
- *	           pointer to next item in list.
- *	localMem - memory pool where hacTree and a few other things are allocated from
- *	distF - function that calculates distance between two items, passed items and extraData
- *	mergeF - function that creates a new item in same format as itemList from two passed
- *	         in items and the extraData.  Typically does average of two input items
- *	extraData - parameter passed through to distF and mergeF, otherwise unused, may be NULL
- *	precalcDistanceHash - a hash containing at least some of the pairwise distances
- *	            between items on itemList, set with hacTreeDistanceHashAdd. 
- *	            As a side effect this hash will be expanded to include all distances 
- *	            including those between intermediate nodes. */
-{
-/* Make up a doubly-linked list in 'remaining' with all items in it */
-struct dlList remaining;
-dlListInit(&remaining);
-struct slList *item;
-int count = 0;
-struct hash *distanceHash = (precalcDistanceHash ? precalcDistanceHash : hashNew(0));
-for (item = itemList; item != NULL; item = item->next)
-    {
-    struct hacTree *ht;
-    lmAllocVar(localMem, ht);
-    ht->itemOrCluster = item;
-    lmDlAddValTail(localMem, &remaining, ht);
-    count += 1;
-    }
-
-/* Loop through finding closest and merging until only one node left on remaining. */
-int i;
-for (i=1; i<count; ++i)
-    {
-    /* Find closest pair */
-    struct dlNode *aNode, *bNode;
-    double distance = pairParallel(&remaining, distanceHash, distF, extraData, threadCount,
-	&aNode, &bNode);
-
-    /* Allocated new hacTree item for them and fill it in with a merged value. */
-    struct hacTree *ht;
-    lmAllocVar(localMem, ht);
-    struct hacTree *left = ht->left = aNode->val;
-    struct hacTree *right = ht->right = bNode->val;
-    left->parent = right->parent = ht;
-    ht->itemOrCluster = mergeF(left->itemOrCluster, right->itemOrCluster, extraData);
-    ht->childDistance = distance;
-
-    /* Put merged item onto remaining list before first matching node in pair. */
-    struct dlNode *mergedNode;
-    lmAllocVar(localMem, mergedNode);
-    mergedNode->val = ht;
-    dlAddBefore(aNode, mergedNode);
-
-    /* Remove nodes we merged out */
-    dlRemove(aNode);
-    dlRemove(bNode);
-    }
-
-/* Clean up and go home. */
-if (distanceHash != precalcDistanceHash)
-    hashFree(&distanceHash);
-struct dlNode *lastNode = dlPopHead(&remaining);
-return lastNode->val;
-}
-
diff --git a/gbtools/src/blatSrc/lib/hash.c b/gbtools/src/blatSrc/lib/hash.c
deleted file mode 100644
index 770647f..0000000
--- a/gbtools/src/blatSrc/lib/hash.c
+++ /dev/null
@@ -1,749 +0,0 @@
-/* Hash.c - implements hashing.  See hash.h for usage comments.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "localmem.h"
-#include "hash.h"
-#include "obscure.h"
-#include "dystring.h"
-
-
-/*
- * Hash a string key.  This code is taken from Tcl interpreter. I was borrowed
- * after discovering a lot of collisions and poor utilization of the table
- * when hashing accessions.
- *
- * This function was compared to Bob Jenkins' lookup2 hash function and
- * (http://burtleburtle.net/bob/hash/) and Paul Hsieh's SuperFast
- * hash function (http://www.azillionmonkeys.com/qed/hash.html).
- * Both of those functions provided better utilization of the table,
- * but were also more expensive, so the Tcl function was used.
- * If hashing of binary keys is implemented, SuperFast hash should
- * be considered.
- *
- * for an explanation of this function, see HashStringKey() in the
- * Tcl source file, generic/tclHash.c, available from
- * http://tcl.sourceforge.net/.
- *
- * The Tcl code is:
- * Copyright (c) 1991-1993 The Regents of the University of California.
- * Copyright (c) 1994 Sun Microsystems, Inc.
- *
- * See the file "license.terms" (in the Tcl distribution) for complete
- * license (which is a BSD-style license).
- *
- * Since hashCrc() is in use elsewhere, 
- * a new function hashString() was created for use in hash table.
- * -- markd
- */
-bits32 hashString(char *string)
-/* Compute a hash value of a string. */
-{
-char *keyStr = string;
-unsigned int result = 0;
-int c;
-
-while ((c = *keyStr++) != '\0')
-    {
-    result += (result<<3) + c;
-    }
-return result;
-}
-
-bits32 hashCrc(char *string)
-/* Returns a CRC value on string. */
-{
-unsigned char *us = (unsigned char *)string;
-unsigned char c;
-bits32 shiftAcc = 0;
-bits32 addAcc = 0;
-
-while ((c = *us++) != 0)
-    {
-    shiftAcc <<= 2;
-    shiftAcc += c;
-    addAcc += c;
-    }
-return shiftAcc + addAcc;
-}
-
-struct hashEl *hashLookup(struct hash *hash, char *name)
-/* Looks for name in hash table. Returns associated element,
- * if found, or NULL if not.  If there are multiple entries
- * for name, the last one added is returned (LIFO behavior).
- */
-{
-struct hashEl *el = hash->table[hashString(name)&hash->mask];
-while (el != NULL)
-    {
-    if (strcmp(el->name, name) == 0)
-        break;
-    el = el->next;
-    }
-return el;
-}
-
-struct hashEl *hashLookupUpperCase(struct hash *hash, char *name)
-/* Lookup upper cased name in hash. (Assumes all elements of hash
- * are themselves already in upper case.) */
-{
-char s[256];
-safef(s, sizeof(s), "%s", name);
-touppers(s);
-return hashLookup(hash, s);
-}
-
-
-struct hashEl *hashLookupNext(struct hashEl *hashEl)
-/* Find the next occurance of name that may occur in the table multiple times,
- * or NULL if not found.  Use hashLookup to find the first occurrence.  Elements
- * are returned in LIFO order.
- */
-{
-struct hashEl *el = hashEl->next;
-while (el != NULL)
-    {
-    if (strcmp(el->name, hashEl->name) == 0)
-        break;
-    el = el->next;
-    }
-return el;
-}
-
-struct hashEl *hashAddN(struct hash *hash, char *name, int nameSize, void *val)
-/* Add name of given size to hash (no need to be zero terminated) */
-{
-struct hashEl *el;
-if (hash->lm) 
-    el = lmAlloc(hash->lm, sizeof(*el));
-else
-    AllocVar(el);
-el->hashVal = hashString(name);
-int hashVal = el->hashVal & hash->mask;
-if (hash->lm)
-    {
-    el->name = lmAlloc(hash->lm, nameSize+1);
-    memcpy(el->name, name, nameSize);
-    }
-else
-    el->name = cloneStringZ(name, nameSize);
-el->val = val;
-el->next = hash->table[hashVal];
-hash->table[hashVal] = el;
-hash->elCount += 1;
-if (hash->autoExpand && hash->elCount > (int)(hash->size * hash->expansionFactor))
-    {
-    /* double the size */
-    hashResize(hash, digitsBaseTwo(hash->size));
-    }
-return el;
-}
-
-struct hashEl *hashAdd(struct hash *hash, char *name, void *val)
-/* Add new element to hash table.  If an item with name, already exists, a new
- * item is added in a LIFO manner.  The last item added for a given name is
- * the one returned by the hashLookup functions.  hashLookupNext must be used
- * to find the preceding entries for a name.
- */
-{
-return hashAddN(hash, name, strlen(name), val);
-}
-
-boolean hashMayRemove(struct hash *hash, char *name)
-/* Remove item of the given name from hash table, if present.
- * Return true if it was present */
-{
-return (hashRemove(hash, name) != NULL);
-}
-
-void hashMustRemove(struct hash *hash, char *name)
-/* Remove item of the given name from hash table, or error
- * if not present */
-{
-if (hashRemove(hash, name) == NULL)
-    errAbort("attempt to remove non-existant %s from hash", name);
-}
-
-void freeHashEl(struct hashEl *hel)
-/* Free hash element. Use only on non-local memory version. */
-{
-freeMem(hel->name);
-freeMem(hel);
-}
-
-void *hashRemove(struct hash *hash, char *name)
-/* Remove item of the given name from hash table. 
- * Returns value of removed item, or NULL if not in the table.
- * If their are multiple entries for name, the last one added
- * is removed (LIFO behavior).
- */
-{
-struct hashEl *hel;
-void *ret;
-struct hashEl **pBucket = &hash->table[hashString(name)&hash->mask];
-for (hel = *pBucket; hel != NULL; hel = hel->next)
-    if (sameString(hel->name, name))
-        break;
-if (hel == NULL)
-    return NULL;
-ret = hel->val;
-if (slRemoveEl(pBucket, hel))
-    {
-    hash->elCount -= 1;
-    if (!hash->lm)
-	freeHashEl(hel);
-    }
-return ret;
-}
-
-struct hashEl *hashAddUnique(struct hash *hash, char *name, void *val)
-/* Add new element to hash table. Squawk and die if not unique */
-{
-if (hashLookup(hash, name) != NULL)
-    errAbort("%s duplicated, aborting", name);
-return hashAdd(hash, name, val);
-}
-
-struct hashEl *hashAddSaveName(struct hash *hash, char *name, void *val, char **saveName)
-/* Add new element to hash table.  Save the name of the element, which is now
- * allocated in the hash table, to *saveName.  A typical usage would be:
- *    AllocVar(el);
- *    hashAddSaveName(hash, name, el, &el->name);
- */
-{
-struct hashEl *hel = hashAdd(hash, name, val);
-*saveName = hel->name;
-return hel;
-}
-
-struct hashEl *hashStore(struct hash *hash, char *name)
-/* If element in hash already return it, otherwise add it
- * and return it. */
-{
-struct hashEl *hel;
-if ((hel = hashLookup(hash, name)) != NULL)
-    return hel;
-return hashAdd(hash, name, NULL);
-}
-
-char  *hashStoreName(struct hash *hash, char *name)
-/* If element in hash already return it, otherwise add it
- * and return it. */
-{
-struct hashEl *hel;
-if (name == NULL)
-    return NULL;
-if ((hel = hashLookup(hash, name)) != NULL)
-    return hel->name;
-return hashAdd(hash, name, NULL)->name;
-}
-
-int hashIntVal(struct hash *hash, char *name)
-/* Return integer value associated with name in a simple 
- * hash of ints. */
-{
-void *val = hashMustFindVal(hash, name);
-return ptToInt(val);
-}
-
-int hashIntValDefault(struct hash *hash, char *name, int defaultInt)
-/* Return integer value associated with name in a simple 
- * hash of ints or defaultInt if not found. */
-{
-struct hashEl *hel = hashLookup(hash, name);
-if(hel == NULL)
-    return defaultInt;
-return ptToInt(hel->val);
-}
-
-void *hashMustFindVal(struct hash *hash, char *name)
-/* Lookup name in hash and return val.  Abort if not found. */
-{
-struct hashEl *hel = hashLookup(hash, name);
-if (hel == NULL)
-    errAbort("hashMustFindVal: '%s' not found", name);
-return hel->val;
-}
-
-void *hashFindVal(struct hash *hash, char *name)
-/* Look up name in hash and return val or NULL if not found. */
-{
-struct hashEl *hel = hashLookup(hash, name);
-if (hel == NULL)
-    return NULL;
-return hel->val;
-}
-
-void *hashOptionalVal(struct hash *hash, char *name, void *usual)
-/* Look up name in hash and return val, or usual if not found. */
-{
-struct hashEl *hel = hashLookup(hash, name);
-if (hel == NULL)
-    return usual;
-else
-    return hel->val;
-}
-
-void *hashFindValUpperCase(struct hash *hash, char *name)
-/* Lookup upper cased name in hash and return val or return NULL if not found.
- * (Assumes all elements of hash are themselves already in upper case.) */
-{
-struct hashEl *hel = hashLookupUpperCase(hash, name);
-if (hel == NULL)
-    return NULL;
-return hel->val;
-}
-
-char *hashMustFindName(struct hash *hash, char *name)
-/* Return name as stored in hash table (in hel->name). 
- * Abort if not found. */
-{
-struct hashEl *hel = hashLookup(hash, name);
-if (hel == NULL)
-    errAbort("hashMustFindName: '%s' not found", name);
-return hel->name;
-}
-
-struct hashEl *hashAddInt(struct hash *hash, char *name, int val)
-/* Store integer value in hash */
-{
-char *pt = NULL;
-return hashAdd(hash, name, pt + val);
-}
-
-
-void hashIncInt(struct hash *hash, char *name)
-/* Increment integer value in hash */
-{
-struct hashEl *hel = hashLookup(hash, name);
-if (hel == NULL)
-  {
-  hashAddInt(hash, name, 1);
-  }
-else
-  {
-  hel->val = ((char *)hel->val)+1;
-  /* The much simpler ++hel->val works for gnu C, but really adding one to a void pointer
-   * I think is not well defined. */
-  }
-}
-
-long long hashIntSum(struct hash *hash)
-/* Return sum of all the ints in a hash of ints. */
-{
-long long sum = 0;
-int i;
-struct hashEl *hel;
-for (i=0; i<hash->size; ++i)
-    {
-    for (hel = hash->table[i]; hel != NULL; hel = hel->next)
-	{
-	int num = ptToInt(hel->val);
-	sum += (long long)num;
-	}
-    }
-return sum;
-}
-
-struct hash *newHashExt(int powerOfTwoSize, boolean useLocalMem)
-/* Returns new hash table. Uses local memory optionally. */
-{
-struct hash *hash = needMem(sizeof(*hash));
-int memBlockPower = 16;
-if (powerOfTwoSize == 0)
-    powerOfTwoSize = 12;
-assert(powerOfTwoSize <= hashMaxSize && powerOfTwoSize > 0);
-hash->powerOfTwoSize = powerOfTwoSize;
-hash->size = (1<<powerOfTwoSize);
-/* Make size of memory block for allocator vary between
- * 256 bytes and 64k depending on size of table. */
-if (powerOfTwoSize < 8)
-    memBlockPower = 8;
-else if (powerOfTwoSize < 16)
-    memBlockPower = powerOfTwoSize;
-if (useLocalMem) 
-    hash->lm = lmInit(1<<memBlockPower);
-hash->mask = hash->size-1;
-AllocArray(hash->table, hash->size);
-hash->autoExpand = TRUE;
-hash->expansionFactor = defaultExpansionFactor;   /* Expand when elCount > size*expansionFactor */
-return hash;
-}
-
-void hashResize(struct hash *hash, int powerOfTwoSize)
-/* Resize the hash to a new size */
-{
-int oldHashSize = hash->size;
-struct hashEl **oldTable = hash->table;
-
-if (powerOfTwoSize == 0)
-    powerOfTwoSize = 12;
-assert(powerOfTwoSize <= hashMaxSize && powerOfTwoSize > 0);
-hash->powerOfTwoSize = powerOfTwoSize;
-hash->size = (1<<powerOfTwoSize);
-hash->mask = hash->size-1;
-
-AllocArray(hash->table, hash->size);
-
-int i;
-struct hashEl *hel, *next;
-for (i=0; i<oldHashSize; ++i)
-    {
-    for (hel = oldTable[i]; hel != NULL; hel = next)
-	{
-	next = hel->next;
-	int hashVal = hel->hashVal & hash->mask;
-	hel->next = hash->table[hashVal];
-	hash->table[hashVal] = hel;
-	}
-    }
-/* restore original list order */
-for (i=0; i<hash->size; ++i)
-    {
-    struct hashEl *hel = hash->table[i];
-    if (hel != NULL && hel->next != NULL)	    
-	slReverse(&hash->table[i]);
-    }
-freeMem(oldTable);
-hash->numResizes++;
-}
-
-
-struct hash *hashFromSlNameList(void *list)
-/* Create a hash out of a list of slNames. */
-{
-struct hash *hash = NULL;
-struct slName *namedList = list, *item;
-if (!list)
-    return NULL;
-hash = newHash(0);
-for (item = namedList; item != NULL; item = item->next)
-    hashAdd(hash, item->name, item);
-return hash;
-}
-
-struct hash *hashSetFromSlNameList(void *list)
-/* Create a hashSet (hash with only keys) out of a list of slNames. */
-{
-struct hash *hash = NULL;
-struct slName *namedList = list, *item;
-if (!list)
-    return NULL;
-hash = newHash(0);
-for (item = namedList; item != NULL; item = item->next)
-    hashAdd(hash, item->name, NULL);
-return hash;
-}
-
-void hashTraverseEls(struct hash *hash, void (*func)(struct hashEl *hel))
-/* Apply func to every element of hash with hashEl as parameter. */
-{
-int i;
-struct hashEl *hel;
-for (i=0; i<hash->size; ++i)
-    {
-    for (hel = hash->table[i]; hel != NULL; hel = hel->next)
-	func(hel);
-    }
-}
-
-void hashTraverseVals(struct hash *hash, void (*func)(void *val))
-/* Apply func to every element of hash with hashEl->val as parameter. */
-{
-int i;
-struct hashEl *hel;
-for (i=0; i<hash->size; ++i)
-    {
-    for (hel = hash->table[i]; hel != NULL; hel = hel->next)
-	func(hel->val);
-    }
-}
-
-int hashElCmp(const void *va, const void *vb)
-/* Compare two hashEl by name. */
-{
-const struct hashEl *a = *((struct hashEl **)va);
-const struct hashEl *b = *((struct hashEl **)vb);
-return strcmp(a->name, b->name);
-}
-
-int hashElCmpWithEmbeddedNumbers(const void *va, const void *vb)
-/* Compare two hashEl by name sorting including numbers within name,
- * suitable for chromosomes, genes, etc. */
-{
-const struct hashEl *a = *((struct hashEl **)va);
-const struct hashEl *b = *((struct hashEl **)vb);
-return cmpStringsWithEmbeddedNumbers(a->name, b->name);
-}
-
-void *hashElFindVal(struct hashEl *list, char *name)
-/* Look up name in hashEl list and return val or NULL if not found. */
-{
-struct hashEl *el;
-for (el = list; el != NULL; el = el->next)
-    {
-    if (strcmp(el->name, name) == 0)
-        return el->val;
-    }
-return NULL;
-}
-
-struct hashEl *hashElListHash(struct hash *hash)
-/* Return a list of all elements of hash.   Free return with hashElFreeList. */
-{
-int i;
-struct hashEl *hel, *dupe, *list = NULL;
-for (i=0; i<hash->size; ++i)
-    {
-    for (hel = hash->table[i]; hel != NULL; hel = hel->next)
-	{
-	dupe = CloneVar(hel);
-	slAddHead(&list, dupe);
-	}
-    }
-return list;
-}
-
-
-void hashElFree(struct hashEl **pEl)
-/* Free hash el list returned from hashListAll.  (Don't use
- * this internally.) */
-{
-freez(pEl);
-}
-
-void hashElFreeList(struct hashEl **pList)
-/* Free hash el list returned from hashListAll.  (Don't use
- * this internally. */
-{
-slFreeList(pList);
-}
-
-struct hashCookie hashFirst(struct hash *hash)
-/* Return an object to use by hashNext() to traverse the hash table.
- * The first call to hashNext will return the first entry in the table. */
-{
-struct hashCookie cookie;
-cookie.hash = hash;
-cookie.idx = 0;
-cookie.nextEl = NULL;
-
-/* find first entry */
-for (cookie.idx = 0;
-     (cookie.idx < hash->size) && (hash->table[cookie.idx] == NULL);
-     cookie.idx++)
-    continue;  /* empty body */
-if (cookie.idx < hash->size)
-    cookie.nextEl = hash->table[cookie.idx];
-return cookie;
-}
-
-struct hashEl* hashNext(struct hashCookie *cookie)
-/* Return the next entry in the hash table, or NULL if no more. Do not modify
- * hash table while this is being used. */
-{
-/* NOTE: if hashRemove were coded to track the previous entry during the
- * search and then use it to do the remove, it would be possible to
- * remove the entry returned by this method */
-struct hashEl *retEl = cookie->nextEl;
-if (retEl == NULL)
-    return NULL;  /* no more */
-
-/* find next entry */
-cookie->nextEl = retEl->next;
-if (cookie->nextEl == NULL)
-    {
-    for (cookie->idx++; (cookie->idx < cookie->hash->size)
-             && (cookie->hash->table[cookie->idx] == NULL); cookie->idx++)
-        continue;  /* empty body */
-    if (cookie->idx < cookie->hash->size)
-        cookie->nextEl = cookie->hash->table[cookie->idx];
-    }
-return retEl;
-}
-
-void* hashNextVal(struct hashCookie *cookie)
-/* Return the next value in the hash table, or NULL if no more. Do not modify
- * hash table while this is being used. */
-{
-struct hashEl *hel = hashNext(cookie);
-if (hel == NULL)
-    return NULL;
-else
-    return hel->val;
-}
-
-char *hashNextName(struct hashCookie *cookie)
-/* Return the next name in the hash table, or NULL if no more. Do not modify
- * hash table while this is being used. */
-{
-struct hashEl *hel = hashNext(cookie);
-if (hel == NULL)
-    return NULL;
-else
-    return hel->name;
-}
-
-void freeHash(struct hash **pHash)
-/* Free up hash table. */
-{
-struct hash *hash = *pHash;
-if (hash == NULL)
-    return;
-if (hash->lm)
-    lmCleanup(&hash->lm);
-else
-    {
-    int i;
-    struct hashEl *hel, *next;
-    for (i=0; i<hash->size; ++i)
-	{
-	for (hel = hash->table[i]; hel != NULL; hel = next)
-	    {
-	    next = hel->next;
-	    freeHashEl(hel);
-	    }
-	}
-    }
-freeMem(hash->table);
-freez(pHash);
-}
-
-
-void freeHashAndVals(struct hash **pHash)
-/* Free up hash table and all values associated with it.
- * (Just calls freeMem on each hel->val) */
-{
-struct hash *hash;
-if ((hash = *pHash) != NULL)
-    {
-    hashTraverseVals(hash, freeMem);
-    freeHash(pHash);
-    }
-}
-
-void hashFreeWithVals(struct hash **pHash, void (freeFunc)())
-/* Free up hash table and all values associated with it. freeFunc is a
- * function to free an entry, should take a pointer to a pointer to an
- * entry. */
-{
-struct hash *hash = *pHash;
-if (hash != NULL)
-    {
-    struct hashCookie cookie = hashFirst(hash);
-    struct hashEl *hel;
-    while ((hel = hashNext(&cookie)) != NULL)
-        freeFunc(&hel->val);
-    hashFree(pHash);
-    }
-}
-
-void hashFreeList(struct hash **pList)
-/* Free up a list of hashes. */
-{
-struct hash *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    hashFree(&el);
-    }
-*pList = NULL;
-}
-
-static int bucketLen(struct hashEl *hel)
-/* determine how many elements are in a hash bucket */
-{
-int nel = 0;
-for (; hel != NULL; hel = hel->next)
-    nel++;
-return nel;
-}
-
-void hashHisto(struct hash *hash, char *fname)
-/* Output bucket usage counts to a file for producing a histogram  */
-{
-FILE* fh = mustOpen(fname, "w");
-int i;
-
-for (i=0; i<hash->size; ++i)
-    fprintf(fh, "%d\n", bucketLen(hash->table[i]));
-carefulClose(&fh);
-}
-
-void hashPrintStats(struct hash *hash, char *label, FILE *fh)
-/* print statistic about a hash table */
-{
-// count up usage
-int i, occupiedCnt = 0, maxBucket = 0;
-for (i=0; i<hash->size; ++i)
-    {
-    if (hash->table[i] != NULL)
-        occupiedCnt++;
-    int sz = bucketLen(hash->table[i]);
-    maxBucket = max(maxBucket, sz);
-    }
-
-fprintf(fh, "hashTable\t%s\n", label);
-fprintf(fh, "tableSize\t%d\t%d\n", hash->size, hash->powerOfTwoSize);
-fprintf(fh, "numElements\t%d\n", hash->elCount);
-fprintf(fh, "occupied\t%d\t%0.4f\n", occupiedCnt, ((hash->size == 0) ? 0.0 : ((float)occupiedCnt)/hash->size));
-fprintf(fh, "maxBucket\t%d\n", maxBucket);
-fprintf(fh, "numResizes\t%d\n", hash->numResizes);
-fprintf(fh, "\n");
-}
-
-struct hashEl *hashReplace(struct hash *hash, char *name, void *val)
-/* Replace an existing element in hash table, or add it if not present. */
-{
-if (hashLookup(hash, name))
-    hashRemove(hash, name);
-return hashAdd(hash, name, val);
-}
-
-char *hashToRaString(struct hash *hash)
-/* Convert hash to string in ra format. */
-{
-struct hashEl *el, *list = hashElListHash(hash);
-struct dyString *dy = dyStringNew(0);
-slSort(&list, hashElCmp);
-for (el = list; el != NULL; el = el->next)
-   {
-   dyStringAppend(dy, el->name);
-   dyStringAppendC(dy, ' ');
-   dyStringAppend(dy, el->val);
-   dyStringAppendC(dy, '\n');
-   }
-hashElFreeList(&list);
-return dyStringCannibalize(&dy);
-}
-
-int hashNumEntries(struct hash *hash)
-/* count the number of entries in a hash */
-{
-int n = 0, i;
-for (i=0; i<hash->size; ++i)
-    n += bucketLen(hash->table[i]);
-return n;
-}
-
-struct hash *hashFromString(char *string)
-/* parse a whitespace-separated string with tuples in the format name=val or
- * name="val" to a hash name->val */
-{
-if (string==NULL)
-    return NULL;
-
-struct slPair *keyVals = slPairListFromString(string, TRUE);
-if (keyVals==NULL)
-    return NULL;
-
-struct hash *nameToVal = newHash(0);
-struct slPair *kv;
-for (kv = keyVals; kv != NULL; kv = kv->next)
-    hashAdd(nameToVal, kv->name, kv->val);
-return nameToVal;
-}
-
diff --git a/gbtools/src/blatSrc/lib/hex.c b/gbtools/src/blatSrc/lib/hex.c
deleted file mode 100644
index e5f8aa7..0000000
--- a/gbtools/src/blatSrc/lib/hex.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Handy hexidecimal functions
- *   If you don't want to use printf
- */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-
-char hexTab[16] = {'0', '1', '2', '3', '4', '5', '6', '7', 
-	'8', '9', 'a', 'b', 'c', 'd', 'e', 'f', };
-/* Convert 0-15 to a hex char */
-
-
-char nibbleToHex(unsigned char n)
-/* convert nibble to hexidecimal character. 0 <= n <= 15. */
-{
-return hexTab[n];
-}
-
-void byteToHex(unsigned char n, char *hex)
-/* convert byte to hexidecimal characters. 0 <= n <= 255. */
-{
-*hex++ = hexTab[n >> 4];
-*hex++ = hexTab[n & 0xf];
-}
-
-char *byteToHexString(unsigned char n)
-/* convert byte to hexidecimal string. 0 <= n <= 255. */
-{
-char hex[3];
-byteToHex(n, hex);
-hex[2] = 0;
-return cloneString(hex);
-}
-
-/* And the reverse functions: */
-
-char hexToNibble(char n)
-/* convert hexidecimal character to nibble. 0-9a-f. */
-{
-return n - ( n <= '9' ? '0' : ('a'-10) );
-}
-
-
-unsigned char hexToByte(char *hex)
-/* convert byte to hexidecimal characters. 0 <= n <= 255. */
-{
-unsigned char n = hexToNibble(*hex++);
-n <<= 4;
-n += hexToNibble(*hex++);
-return n;
-}
-
-
-void hexBinaryString(unsigned char *in, int inSize, char *out, int outSize)
-/* Convert possibly long binary string to hex string.
- * Out size needs to be at least 2x inSize+1 */
-{
-assert(inSize * 2 +1 <= outSize);
-while (--inSize >= 0)
-    {
-    unsigned char c = *in++;
-    *out++ = hexTab[c>>4];
-    *out++ = hexTab[c&0xf];
-    }
-*out = 0;
-}
-
diff --git a/gbtools/src/blatSrc/lib/histogram.c b/gbtools/src/blatSrc/lib/histogram.c
deleted file mode 100644
index 7da7679..0000000
--- a/gbtools/src/blatSrc/lib/histogram.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/* histogram function for data array in memory	*/
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "histogram.h"
-
-
-static unsigned autoScale(float *values, size_t N, float *binSize,
-	unsigned *binCount, float *minValue, float *min, float *max)
-/*	determine binSize, binCount, minValue for values[N]
- *	If any of those are given, use them instead of calculating.
- *	A given minValue means ignore data below that.
- *	NAN's for binSize or minValue are the signals to not use them.
- *	non-zero for binCount to use it.  NOTE: binCount is actually one
- *	too high to get the minimum and maximum values in the first and
- *	last (binCount-1) bins correctly.
- */
-{
-float minFound = INFINITY;
-float maxFound = -1.0 * INFINITY;
-float range = 0.0;
-unsigned count = 0;
-unsigned bins = DEFAULT_BIN_COUNT;
-size_t i;
-boolean findMinMax = FALSE;
-
-if ( (*min == 0.0) && (*max == 0.0) )
-    findMinMax = TRUE;
-else
-    {
-    minFound = *min;
-    maxFound = *max;
-    }
-
-if (isnan(*minValue))
-    {				/*	minValue is not specified	*/
-    for (i = 0; i < N; ++i)
-	{
-	if (!isnan(values[i]))
-	    {
-	    if (findMinMax)
-		{
-		++count;
-		if (values[i] < minFound) minFound = values[i];
-		if (values[i] > maxFound) maxFound = values[i];
-		}
-	    else
-		{
-		if ( (values[i] < *max) && (values[i] > *min) ) ++count;
-		}
-	    }
-	}
-    }
-else
-    {
-    minFound = *minValue;		/*	use given minValue	*/
-    for (i = 0; i < N; ++i)
-	{
-	if ((!isnan(values[i])) && (values[i] >= minFound))
-	    {
-	    if (findMinMax)
-		{
-		++count;
-		if (values[i] > maxFound) maxFound = values[i];
-		}
-	    else
-		{
-		if ( (values[i] < *max) && (values[i] > *min) ) ++count;
-		}
-	    }
-
-	}
-    }
-
-if (count > 0)
-    {
-    /*	if the caller asked us to find min,max, return them	*/
-    if (findMinMax)
-	{
-	*min = minFound;
-	*max = maxFound;
-	}
-
-    /*	If the caller did not specify a minValue, return it	*/
-    if (isnan(*minValue))
-	*minValue = minFound;
-
-    range = maxFound - minFound;
-
-    /*	if they gave us a binCount, use it	*/
-    if (*binCount > 0)
-	bins = *binCount;
-    else
-	*binCount = bins;
-
-    if ( (range > 0.0) && (bins > 1))
-	{
-	/*  binSize is calculated on (bins - 1) to allow the minimum value
-	 *  to be in the middle of the first bin, and the highest value to be
-	 *	in the middle of the last bin
-	 */
-	if (isnan(*binSize))
-	    *binSize = range / (bins - 1);
-
-	if (*binSize > 0.0)
-	    return count;
-	else
-	    return 0;	/*	did not work	*/
-	}
-    }
-return 0;	/*	did not work	*/
-}	/*	static unsigned autoScale()	*/
-
-void freeHistoGram(struct histoResult **histoResults)
-/*      free the histoResults list	*/
-{
-if (histoResults && *histoResults)
-    {
-    struct histoResult *hr, *next;
-
-    for (hr = *histoResults; hr; hr = next)
-        {
-        next = hr->next;
-        freeMem(hr->binCounts);
-        freeMem(hr->pValues);
-        freeMem(hr);
-        }
-    *histoResults = NULL;
-    }
-}
-
-struct histoResult *histoGram(float *values, size_t N, float binSize,
-	unsigned binCount, float minValue, float min, float max,
-	struct histoResult *accumHisto)
-/*	construct histogram of data in values[N] array.  The extra
- *	options of binSize, binCount, minValue, min, max are optional.
- *	Run autoScaling when min == max == 0.0
- *	Defaults for binSize, binCount and minValue can be given even
- *	when auto-scaling, or NAN's for the floats, or 0 for the
- *	binCount to determine them too.
- *	When they are specified they will be used in place of auto
- *	scaled determined values.  If the min and max of the data is
- *	known, pass those in on min,max to aid the calculation of auto
- *	scaled values.  NAN's can be in the values[N] array and will be
- *	ignored.
- *	NOTE: when giving a binCount, it is actually one
- *	higher to get the minimum and maximum values in the first and
- *	last (binCount-1) bins correctly.  The resulting histogram will
- *	appear to be (binCount-1) number of bins.
- *	When given a pointer to accumHisto, use that existing histo gram
- *	and continue accumulations in it.
- */
-{
-float autoBinSize = NAN;	/*	pass NAN's to cause auto scaling */
-float autoMinValue = NAN;
-float range = 0.0;
-unsigned autoBinCount = 0;
-unsigned autoValueCount = 0;
-boolean autoScaling = FALSE;
-unsigned valueCount = 0;
-unsigned i;			/*	array index	*/
-struct histoResult *hr;
-unsigned missed = 0;
-
-if (N == 0)
-    return NULL;	/*	we don't work on zero number of values	*/
-
-if (accumHisto)		/*	if accumulating in existing histogram	*/
-    {			/*	use its parameters as the scaling values */
-    autoBinCount = accumHisto->binCount;
-    autoBinSize = accumHisto->binSize;
-    autoMinValue = accumHisto->binZero;
-    autoScaling = FALSE;
-    range = autoBinSize * (autoBinCount - 1);
-    valueCount = accumHisto->count;
-    }
-else
-    {
-/*	Caller may give us a range to work within	*/
-if ( (0.0 == min) && (0.0 == max) )
-    autoScaling = TRUE;
-else
-    {
-    range = max - min;
-    if (range == 0.0)
-	return NULL;	/*	caller gave us equal min, max !	*/
-    }
-
-/*	Caller may give us any of the binCount, binSize, minValue */
-if (binCount > 1)
-    autoBinCount = binCount;
-else if (!autoScaling)
-    autoBinCount = DEFAULT_BIN_COUNT;
-
-if (!isnan(binSize))
-    autoBinSize = binSize;
-else if (!autoScaling)
-    autoBinSize = range / (autoBinCount - 1);
-
-if (!isnan(minValue))
-    autoMinValue = minValue;
-else if (!autoScaling)
-    autoMinValue = min;
-
-if (autoScaling)
-    {
-    autoValueCount = autoScale(values, N, &autoBinSize,
-			&autoBinCount, &autoMinValue, &min, &max);
-    if (autoValueCount == 0)
-	return NULL;	/*	no result !	*/
-    }
-else
-    autoValueCount = N;
-    }
-
-if (accumHisto)		/*	if accumulating in existing histogram	*/
-    hr = accumHisto;
-else
-    {
-    AllocVar(hr);
-    AllocArray(hr->binCounts,autoBinCount);
-    AllocArray(hr->pValues,autoBinCount);
-    }
-
-for (i = 0; i < N; ++i)
-    {
-    if (!isnan(values[i]) && (values[i] >= autoMinValue))
-	{
-	if ( (values[i] <= max) && (values[i] >= min) )
-	    {
-	    float f = values[i] - autoMinValue;
-	    int inx = (int) floor(f / autoBinSize);
-
-	    if ( (inx >= 0) && (inx < autoBinCount))
-		{
-		++valueCount;
-		++hr->binCounts[inx];
-		}
-	    else
-		++missed;
-	    }
-	    else
-		++missed;
-	}
-	else
-	    ++missed;
-    }	/*	for (i = 0; i < N; ++i)	*/
-
-if (accumHisto)		/*	if accumulating in existing histogram	*/
-    hr->count = valueCount;	/*	only this is new	*/
-else
-    {
-    hr->binSize = autoBinSize;
-    hr->binCount = autoBinCount;
-    hr->count = valueCount;
-    hr->binZero = autoMinValue;
-    }
-
-for (i = 0; i < autoBinCount; ++i)
-    {
-    if (hr->binCounts[i] > 0)
-	hr->pValues[i] = (float) hr->binCounts[i] / (float) valueCount;
-    else
-	hr->pValues[i] = 0.0;
-    }
-
-return hr;
-}
diff --git a/gbtools/src/blatSrc/lib/hmac.c b/gbtools/src/blatSrc/lib/hmac.c
deleted file mode 100644
index 7eb15a1..0000000
--- a/gbtools/src/blatSrc/lib/hmac.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Calculate an openssl keyed-hash message authentication code (HMAC) */
-// You may use other openssl hash engines. e.g EVP_md5(), EVP_sha224,
-// EVP_sha512, etc
-// Be careful of the length of string with the choosen hash engine.
-// SHA1 needed 20 characters, MD5 needed 16 characters.
-// Change the length accordingly with your choosen hash engine
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "config.h"
-
-#ifdef USE_SSL 
-#include "openssl/hmac.h"
-#include "openssl/evp.h"
-#include "common.h"
-
-char *hmacSha1(char *key, char *data)
-/* Calculate a openssl SHA1 keyed-hash message authentication code (HMAC) */
-{
-unsigned char* digest;
-digest=HMAC(EVP_sha1(), key, strlen(key), (unsigned char*)data, strlen(data), NULL, NULL);
-char hmacStr[40];
-int i;
-for(i = 0; i < 20; i++)
-    sprintf(&hmacStr[i*2], "%02x", (unsigned int)digest[i]);
-return cloneStringZ(hmacStr, sizeof(hmacStr));
-}
-
-char *hmacMd5(char *key, char *data)
-/* Calculate a openssl MD5 keyed-hash message authentication code (HMAC) */
-{
-unsigned char* digest;
-digest=HMAC(EVP_md5(), key, strlen(key), (unsigned char*)data, strlen(data), NULL, NULL);
-//printf("Raw mdr digest: %s\n", digest);
-char hmacStr[32];
-int i;
-for(i = 0; i < 16; i++)
-    sprintf(&hmacStr[i*2], "%02x", (unsigned int)digest[i]);
-return cloneStringZ(hmacStr, sizeof(hmacStr));
-}
-
-#else // --------- no USE_SSL ==> errAbort with message that openssl is required --------------
-
-#include "common.h"
-#include "errAbort.h"
-#define NEED_OPENSSL "kent/src must be recompiled with openssl libs and USE_SSL=1 in order for this to work."
-
-char *hmacSha1(char *key, char *data)
-/* This is just a warning that appears in the absence of USE_SSL. Real
- * implementation is above! */
-{
-errAbort(NEED_OPENSSL);
-return NULL;
-}
-
-char *hmacMd5(char *key, char *data)
-/* This is just a warning that appears in the absence of USE_SSL. Real
- * implementation is above! */
-{
-errAbort(NEED_OPENSSL);
-return NULL;
-}
-
-#endif
diff --git a/gbtools/src/blatSrc/lib/hmmPfamParse.c b/gbtools/src/blatSrc/lib/hmmPfamParse.c
deleted file mode 100644
index 3b38974..0000000
--- a/gbtools/src/blatSrc/lib/hmmPfamParse.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* hmmpfamParse - Parse hmmpfam files.. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "errAbort.h"
-#include "spacedColumn.h"
-#include "hmmPfamParse.h"
-
-
-void hpfModelFree(struct hpfModel **pMod)
-/* Free memory associated with hpfModel */
-{
-struct hpfModel *mod = *pMod;
-if (mod != NULL)
-    {
-    freeMem(mod->name);
-    freeMem(mod->description);
-    slFreeList(&mod->domainList);
-    freez(pMod);
-    }
-}
-
-void hpfModelFreeList(struct hpfModel **pList)
-/* Free a list of dynamically allocated hpfModel's */
-{
-struct hpfModel *el, *next;
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    hpfModelFree(&el);
-    }
-*pList = NULL;
-}
-
-
-void hpfResultFree(struct hpfResult **pHr)
-/* Free memory associated with hpfResult */
-{
-struct hpfResult *hr = *pHr;
-if (hr != NULL)
-    {
-    freeMem(hr->name);
-    hpfModelFreeList(&hr->modelList);
-    freez(pHr);
-    }
-}
-
-void hpfResultFreeList(struct hpfResult **pList)
-/* Free a list of dynamically allocated hpfResult's */
-{
-struct hpfResult *el, *next;
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    hpfResultFree(&el);
-    }
-*pList = NULL;
-}
-
-void parseErr(struct lineFile *lf, char *format, ...)
-/* Print out a parse error message. */
-{
-va_list args;
-va_start(args, format);
-vaWarn(format, args);
-va_end(args);
-errAbort("line %d of %s", lf->lineIx, lf->fileName);
-}
-
-char *needLineStartingWith(struct lineFile *lf, char *start, int maxCount)
-/* Get next line that starts as so */
-{
-char *line = lineFileSkipToLineStartingWith(lf, start, maxCount);
-if (line == NULL)
-     parseErr(lf, "Missing line starting with \"%s\"", start);
-return line;
-}
-
-void spacedColumnFatten(struct spacedColumn *colList)
-/* Make columns extend all the way to the next column. */
-{
-struct spacedColumn *col, *nextCol;
-for (col = colList; col != NULL; col = nextCol)
-    {
-    nextCol = col->next;
-    if (nextCol == NULL)
-        break;
-    col->size = nextCol->start - col->start - 1;
-    }
-}
-
-struct hpfModel *hpfFindResultInModel(struct hpfResult *hr, char *modName)
-/* Look for named result in model. */
-{
-struct hpfModel *mod;
-for (mod = hr->modelList; mod != NULL; mod = mod->next)
-    if (sameString(mod->name, modName))
-	break;
-return mod;
-}
-
-struct hpfResult *hpfNext(struct lineFile *lf)
-/* Parse out next record in hmmpfam result file. */
-{
-/* Seek to first line that starts with "Query sequence:" and parse name out of it. */
-char *queryPat = "Query sequence: ";
-char *line = lineFileSkipToLineStartingWith(lf, queryPat, 100);
-if (line == NULL)
-    return NULL;
-line += strlen(queryPat);
-char *query = cloneString(nextWord(&line));
-if (query == NULL)
-    parseErr(lf, "Missing sequence name");
-
-/* Seek to start of model list, figuring out width of fields we need in the process. */
-needLineStartingWith(lf, "Scores for sequence family", 10);
-needLineStartingWith(lf, "Model ", 2);
-char *template = needLineStartingWith(lf, "----", 1);
-struct spacedColumn *colList = spacedColumnFromSample(template);
-spacedColumnFatten(colList);
-int colCount = slCount(colList);
-if (colCount < 5)
-    parseErr(lf, "Expecting at least 5 columns");
-
-/* Parse out all the models. */
-struct hpfResult *hr;
-AllocVar(hr);
-hr->name = query;
-for (;;)
-    {
-    lineFileNeedNext(lf, &line, NULL);
-    line = skipLeadingSpaces(line);
-    if (line[0] == 0)
-        break;
-    if (startsWith("[no hits above thresholds]", line))
-        break;
-    char *row[colCount];
-    if (!spacedColumnParseLine(colList, line, row))
-        parseErr(lf, "short line");
-    struct hpfModel *mod;
-    AllocVar(mod);
-    mod->name = cloneString(row[0]);
-    mod->description = cloneString(row[1]);
-    mod->score = lineFileNeedDouble(lf, row, 2);
-    mod->eVal = lineFileNeedDouble(lf, row, 3);
-    slAddTail(&hr->modelList, mod);
-    }
-slFreeList(&colList);
-
-/* Skip over to the section on domains, figuriong out column widths while we're at it. */
-needLineStartingWith(lf, "Parsed for domains:", 10);
-needLineStartingWith(lf, "Model ", 2);
-template = needLineStartingWith(lf, "----", 1);
-colList = spacedColumnFromSample(template);
-colCount = slCount(colList);
-if (colCount < 8)
-    parseErr(lf, "Expecting at least 8 columns.");
-struct spacedColumn *col2 = colList->next;
-colList->size = col2->start - 1;
-
-/* Parse out all the domains. */
-for (;;)
-    {
-    lineFileNeedNext(lf, &line, NULL);
-    line = skipLeadingSpaces(line);
-    if (line[0] == 0)
-        break;
-    if (startsWith("[no hits above thresholds]", line))
-        break;
-    char *row[colCount];
-    if (!spacedColumnParseLine(colList, line, row))
-        parseErr(lf, "short line");
-    struct hpfModel *mod = hpfFindResultInModel(hr, row[0]);
-    if (mod == NULL)
-        parseErr(lf, "Model %s in domain section but not model section", row[0]);
-    struct hpfDomain *dom;
-    AllocVar(dom);
-    dom->qStart = lineFileNeedNum(lf, row, 2) - 1;
-    dom->qEnd = lineFileNeedNum(lf, row, 3);
-    dom->hmmStart = lineFileNeedNum(lf, row, 4) - 1;
-    dom->hmmEnd = lineFileNeedNum(lf, row, 5);
-    dom->score = lineFileNeedDouble(lf, row, 6);
-    dom->eVal = lineFileNeedDouble(lf, row, 7);
-    slAddTail(&mod->domainList, dom);
-    }
-slFreeList(&colList);
-if (!lineFileSkipToLineStartingWith(lf, "//", 10000000))
-    parseErr(lf, "Expecting //");
-return hr;
-}
-
diff --git a/gbtools/src/blatSrc/lib/hmmstats.c b/gbtools/src/blatSrc/lib/hmmstats.c
deleted file mode 100644
index 412ebc9..0000000
--- a/gbtools/src/blatSrc/lib/hmmstats.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* hmmstats.c - Stuff for doing statistical analysis in general and 
- * hidden Markov models in particular. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "hmmstats.h"
-
-
-int scaledLog(double val)
-/* Return scaled log of val. */
-{
-return round(logScaleFactor * log(val));
-}
-
-double oneOverSqrtTwoPi = 0.39894228;
-
-double simpleGaussean(double x)
-/* Gaussean distribution with standard deviation 1 and mean 0. */
-{
-return oneOverSqrtTwoPi * exp(-0.5*x*x );
-}
-
-double gaussean(double x, double mean, double sd)
-/* Gaussean distribution with mean and standard deviation at point x  */
-{
-x -= mean;
-x /= sd;
-return oneOverSqrtTwoPi * exp(-0.5*x*x) / sd;
-}
-
-double calcVarianceFromSums(double sum, double sumSquares, bits64 n)
-/* Calculate variance. */
-{
-double var = sumSquares - sum*sum/n;
-if (n > 1)
-    var /= n-1;
-return var;
-}
-
-double calcStdFromSums(double sum, double sumSquares, bits64 n)
-/* Calculate standard deviation. */
-{
-return sqrt(calcVarianceFromSums(sum, sumSquares, n));
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/htmlPage.c b/gbtools/src/blatSrc/lib/htmlPage.c
deleted file mode 100644
index 9d13c95..0000000
--- a/gbtools/src/blatSrc/lib/htmlPage.c
+++ /dev/null
@@ -1,1851 +0,0 @@
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-/* htmlPage - stuff to read, parse, and submit  htmlPages and forms. 
- *
- * typical usage is:
- *   struct htmlPage *page = htmlPageGet(url);
- *   htmlPageValidateOrAbort(page);
- *   var = htmlPageGetVar(page, page->forms, "org");
- *   if (var != NULL)
- *      printf("Organism = var->org);
- *   htmlPageSetVar(page, page->forms, "org", "Human");
- *   newPage = htmlPageFromForm(page, page->forms, "submit", "Go");
- */
-
-#include "common.h"
-#include "errAbort.h"
-#include "errCatch.h"
-#include "memalloc.h"
-#include "linefile.h"
-#include "hash.h"
-#include "dystring.h"
-#include "cheapcgi.h"
-#include "obscure.h"
-#include "filePath.h"
-#include "net.h"
-#include "htmlPage.h"
-
-
-void htmlStatusFree(struct htmlStatus **pStatus)
-/* Free up resources associated with status */
-{
-struct htmlStatus *status = *pStatus;
-if (status != NULL)
-    {
-    freeMem(status->version);
-    freez(pStatus);
-    }
-}
-
-void htmlStatusFreeList(struct htmlStatus **pList)
-/* Free a list of dynamically allocated htmlStatus's */
-{
-struct htmlStatus *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    htmlStatusFree(&el);
-    }
-*pList = NULL;
-}
-
-void htmlCookieFree(struct htmlCookie **pCookie)
-/* Free memory associated with cookie. */
-{
-struct htmlCookie *cookie = *pCookie;
-if (cookie != NULL)
-    {
-    freeMem(cookie->name);
-    freeMem(cookie->value);
-    freeMem(cookie->domain);
-    freeMem(cookie->path);
-    freeMem(cookie->expires);
-    freez(pCookie);
-    }
-}
-
-void htmlCookieFreeList(struct htmlCookie **pList)
-/* Free a list of dynamically allocated htmlCookie's */
-{
-struct htmlCookie *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    htmlCookieFree(&el);
-    }
-*pList = NULL;
-}
-
-struct htmlCookie *htmlCookieFileRead(char *fileName)
-/* Read cookies from a line oriented file.  First word in line
- * is the cookie name, the rest of the line the cookie value. */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct htmlCookie *list = NULL, *cookie;
-char *line, *word;
-while (lineFileNextReal(lf, &line))
-    {
-    word = nextWord(&line);
-    line = skipLeadingSpaces(line);
-    if (line == NULL)
-        errAbort("Missing cookie value line %d of %s", lf->lineIx, lf->fileName);
-    AllocVar(cookie);
-    cookie->name = cloneString(word);
-    cookie->value = cloneString(line);
-    slAddHead(&list, cookie);
-    }
-lineFileClose(&lf);
-slReverse(&list);
-return list;
-}
-
-static void cookieOutput(struct dyString *dy, struct htmlCookie *cookieList)
-/* Write cookies to dy. */
-{
-struct htmlCookie *cookie;
-if (cookieList != NULL)
-    {
-    dyStringAppend(dy, "Cookie:");
-    for (cookie = cookieList; cookie != NULL; cookie = cookie->next)
-	{
-	if (cookie != cookieList)
-	    dyStringAppendC(dy, ';');
-	dyStringAppendC(dy, ' ');
-	dyStringAppend(dy, cookie->name);
-	dyStringAppendC(dy, '=');
-	dyStringAppend(dy, cookie->value);
-	}
-    dyStringAppend(dy, "\r\n");
-    }
-}
-
-
-void htmlAttributeFree(struct htmlAttribute **pAttribute)
-/* Free up resources associated with attribute. */
-{
-struct htmlAttribute *att = *pAttribute;
-if (att != NULL)
-    {
-    freeMem(att->name);
-    freeMem(att->val);
-    freez(pAttribute);
-    }
-}
-
-void htmlAttributeFreeList(struct htmlAttribute **pList)
-/* Free a list of dynamically allocated htmlAttribute's */
-{
-struct htmlAttribute *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    htmlAttributeFree(&el);
-    }
-*pList = NULL;
-}
-
-void htmlTagFree(struct htmlTag **pTag)
-/* Free up resources associated with tag. */
-{
-struct htmlTag *tag = *pTag;
-if (tag != NULL)
-    {
-    htmlAttributeFreeList(&tag->attributes);
-    freeMem(tag->name);
-    freez(pTag);
-    }
-}
-
-void htmlTagFreeList(struct htmlTag **pList)
-/* Free a list of dynamically allocated htmlTag's */
-{
-struct htmlTag *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    htmlTagFree(&el);
-    }
-*pList = NULL;
-}
-
-void htmlFormVarFree(struct htmlFormVar **pVar)
-/* Free up resources associated with form variable. */
-{
-struct htmlFormVar *var = *pVar;
-if (var != NULL)
-    {
-    freeMem(var->curVal);
-    slFreeList(&var->values);
-    slFreeList(&var->tags);
-    freez(pVar);
-    }
-}
-
-void htmlFormVarFreeList(struct htmlFormVar **pList)
-/* Free a list of dynamically allocated htmlFormVar's */
-{
-struct htmlFormVar *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    htmlFormVarFree(&el);
-    }
-*pList = NULL;
-}
-
-
-void htmlFormFree(struct htmlForm **pForm)
-/* Free up resources associated with form variable. */
-{
-struct htmlForm *form = *pForm;
-if (form != NULL)
-    {
-    htmlFormVarFreeList(&form->vars);
-    freez(pForm);
-    }
-}
-
-void htmlFormFreeList(struct htmlForm **pList)
-/* Free a list of dynamically allocated htmlForm's */
-{
-struct htmlForm *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    htmlFormFree(&el);
-    }
-*pList = NULL;
-}
-
-void htmlPageFree(struct htmlPage **pPage)
-/* Free up resources associated with htmlPage. */
-{
-struct htmlPage *page = *pPage;
-if (page != NULL)
-    {
-    freez(&page->url);
-    htmlStatusFree(&page->status);
-    freeHashAndVals(&page->header);
-    htmlCookieFreeList(&page->cookies);
-    freez(&page->fullText);
-    htmlTagFreeList(&page->tags);
-    htmlFormFreeList(&page->forms);
-    freez(pPage);
-    }
-}
-
-void htmlPageFreeList(struct htmlPage **pList)
-/* Free a list of dynamically allocated htmlPage's */
-{
-struct htmlPage *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    htmlPageFree(&el);
-    }
-*pList = NULL;
-}
-
-static int findLineNumber(char *start, char *pos)
-/* Figure out line number of given position relative to start. */
-{
-char *s;
-int line = 1;
-for (s = start; s <= pos; ++s)
-    {
-    if (s[0] == '\n')
-       ++line;
-    }
-return line;
-}
-
-struct htmlTag *findNextMatchingTag(struct htmlTag *list, char *name)
-/* Return first tag in list that is of type name or NULL if not found*/
-{
-struct htmlTag *tag;
-for (tag = list; tag != NULL; tag = tag->next)
-    {
-    if (sameWord(name, tag->name))
-	return tag;
-    }
-return NULL;
-}
-
-static void tagVaWarn(struct htmlPage *page, struct htmlTag *tag, char *format, 
-	va_list args)
-/* Print warning message and some context of tag. */
-{
-char context[80];
-strncpy(context, tag->start, sizeof(context));
-context[sizeof(context)-1] = 0;
-warn("Error near line %d of %s:\n %s", findLineNumber(page->htmlText, tag->start), 
-	page->url, context);
-vaWarn(format, args);
-}
-
-static void tagWarn(struct htmlPage *page, struct htmlTag *tag, char *format, ...)
-/* Print warning message and some context of tag. */
-{
-va_list args;
-va_start(args, format);
-tagVaWarn(page, tag, format, args);
-va_end(args);
-}
-
-static void tagAbort(struct htmlPage *page, struct htmlTag *tag, char *format, ...)
-/* Print abort message and some context of tag. */
-{
-va_list args;
-va_start(args, format);
-tagVaWarn(page, tag, format, args);
-va_end(args);
-noWarnAbort();
-}
-
-struct htmlStatus *htmlStatusParse(char **pText)
-/* Read in status from first line.  Update pText to point to next line. 
- * Note unlike many routines here, this does not insert zeros into text. */
-{
-char *text = *pText;
-char *end = strchr(text, '\n');
-struct htmlStatus *status;
-if (end != NULL)
-   *pText = end+1;
-else
-   *pText = text + strlen(text);
-end = skipToSpaces(text);
-if (end == NULL)
-    {
-    warn("Short status line.");
-    return NULL;
-    }
-AllocVar(status);
-status->version = cloneStringZ(text, end-text);
-end = skipLeadingSpaces(end);
-if (!isdigit(end[0]))
-    {
-    warn("Not a number in status field");
-    return NULL;
-    }
-status->status = atoi(end);
-return status;
-}
-
-char *htmlNextCrLfLine(char **pS)
-/* Return zero-terminated line and advance *pS to start of
- * next line.  Return NULL at end of file.  Warn if there is
- * no <CR>. */
-{
-char *s = *pS, *e;
-if (s == NULL || s[0] == 0)
-    return NULL;
-e = strchr(s, '\n');
-if (e == NULL)
-    verbose(1, "End of file in header\n");
-else 
-    {
-    *e = 0;
-    if (e == s || e[-1] != '\r')
-	verbose(1, "Missing <CR> in header line\n");
-    else
-       e[-1] = 0;
-    e += 1;
-    }
-*pS = e;
-return s;
-}
-
-static void cookieParseNameValuePair(char *s, char **retName, char **retVal)
-/* Parse out name/value pair. Warn and return FALSE if there's a problem. */
-{
-char *val = strchr(s, '=');
-if (val == NULL)
-    {
-    val = s + strlen(s);
-    }
-*val++ = 0;
-*retName = s;
-*retVal = val;
-}
-
-static struct htmlCookie *parseCookie(char *s)
-/* Parse out cookie line to the right of Set-Cookie. */
-{
-char *e, *name, *val;
-struct htmlCookie *cookie;
-
-/* Grab up to semicolon, which is the cookie name/value pair. */
-e = strchr(s, ';');
-if (e == NULL)
-    {
-    warn("Missing ';' in cookie");
-    return NULL;
-    }
-*e++ = 0;
-
-/* Allocate cookie and fill out name/value pair. */
-AllocVar(cookie);
-cookieParseNameValuePair(s, &name, &val);
-cookie->name = cloneString(name);
-cookie->value = cloneString(val);
-
-/* Loop through to grab the other info - domain and so forth. */
-s = e;
-for (;;)
-    {
-    /* Find next semicolon and zero-terminate it. */
-    s = skipLeadingSpaces(s);
-    e = strchr(s, ';');
-    if (e == NULL)
-        break;
-    *e++ = 0;
-
-    /* Parse out name/value pairs and save it away if it's one we know about. */
-    cookieParseNameValuePair(s, &name, &val);
-    if (sameString(name, "domain"))
-        cookie->domain = cloneString(val);
-    else if (sameString(name, "path"))
-        cookie->path = cloneString(val);
-    else if (sameString(name, "expires"))
-        cookie->expires = cloneString(val);
-    else if (sameString(name, "secure"))
-        cookie->secure = TRUE;
-
-    s = e;
-    }
-return cookie;
-}
-
-static struct hash *htmlHeaderRead(char **pHtml, struct htmlCookie **pCookies)
-/* Read in from second line through first blank line and
- * save in hash.  These lines are in the form name: value. */
-{
-struct hash *hash = hashNew(6);
-for (;;)
-    {
-    char *line = htmlNextCrLfLine(pHtml);
-    char *word;
-    if (line == NULL)
-	{
-        warn("End of file in header");
-	break;
-	}
-    word = nextWord(&line);
-    if (word == NULL)
-        break;
-    line = skipLeadingSpaces(line);
-    hashAdd(hash, word, cloneString(line));
-    if (sameString(word, "Set-Cookie:"))
-	{
-	struct htmlCookie *cookie = parseCookie(line);
-	if (cookie != NULL)
-	    slAddTail(pCookies, cookie);
-	}
-    }
-return hash;
-}
-
-static char *htmlAttributeFindVal(struct htmlAttribute *list, char *name)
-/* Find named attribute or return NULL. */
-{
-struct htmlAttribute *att;
-for (att = list; att != NULL; att = att->next)
-    {
-    if (sameWord(att->name, name))
-        return att->val;
-    }
-return NULL;
-}
-
-
-char *htmlTagAttributeVal(struct htmlPage *page, struct htmlTag *tag, 
-	char *name, char *defaultVal)
-/* Return value of named attribute, or defaultVal if attribute doesn't exist. */
-{
-char *val = htmlAttributeFindVal(tag->attributes, name);
-if (val == NULL)
-    val = defaultVal;
-return val;
-}
-
-char *htmlTagAttributeNeeded(struct htmlPage *page, struct htmlTag *tag, char *name)
-/* Return named tag attribute.  Complain and return "n/a" if it
- * doesn't exist. */
-{
-char *val = htmlTagAttributeVal(page, tag, name, NULL);
-if (val == NULL)
-    {
-    tagWarn(page, tag, "Missing %s attribute", name);
-    val = "n/a";
-    }
-return val;
-}
-
-static struct htmlTag *htmlTagScan(char *html, char *dupe)
-/* Scan HTML for tags and return a list of them. 
- * Html is the text to scan, and dupe is a copy of it
- * which this routine will insert 0's in in the course of
- * parsing.*/
-{
-char *s = dupe, c, *e, *tagName;
-struct htmlTag *tagList = NULL, *tag;
-struct htmlAttribute *att;
-int pos;
-
-for (;;)
-    {
-    c = *s++;
-    if (c == 0)
-        break;
-    if (c == '<')
-        {
-	if (*s == '!')	/* HTML comment. */
-	    {
-	    s += 1;
-	    if (s[0] == '-' && s[1] == '-')
-	        s = stringIn("-->", s);
-	    else
-		s = strchr(s, '>');
-	    if (s == NULL)
-		{
-	        warn("End of file in comment");
-		break;
-		}
-	    }
-	else
-	    {
-	    /* Grab first word into tagName. */
-	    e = s;
-	    for (;;)
-	        {
-		c = *e;
-		if (c == '>' || c == 0 || isspace(c))
-		    break;
-		e += 1;
-		}
-	    if (c != 0)
-	       *e++ = 0;
-	    tagName = s;
-	    s = e;
-	    
-	    /* Allocate tag, fill in name, and stick it on list. */
-	    AllocVar(tag);
-	    tag->name = cloneString(tagName);
-	    slAddHead(&tagList, tag);
-	    pos = tagName - dupe - 1;
-	    tag->start = html+pos;
-
-	    /* If already got end tag (or EOF) stop processing tag. */
-	    if (c == '>' || c == 0)
-		{
-		tag->end = html + (e - dupe);
-	        continue;
-		}
-
-	    /* Process name/value pairs until get end tag. */
-	    for (;;)
-		{
-		char *name, *val;
-		boolean gotEnd = FALSE;
-
-		/* Check for end tag. */
-		s = skipLeadingSpaces(s);
-		if (s[0] == '>' || s[0] == 0)
-		    {
-		    tag->end = html + (s - dupe);
-		    if (s[0] == '>')
-			tag->end += 1;
-		    break;
-		    }
-
-		/* Get name - everything up to equals. */
-		e = s;
-		for (;;)
-		    {
-		    c = *e;
-		    if (c == '=')
-		        break;
-		    else if (c == '>')
-		        break;
-		    else if (c == 0)
-		        break;
-		    else if (isspace(c))
-		        break;
-		    e += 1;
-		    }
-		if (c == 0)
-		    {
-		    warn("End of file in tag");
-		    break;
-		    }
-		name = s;
-		*e++ = 0;
-		eraseTrailingSpaces(name);
-		if (c == '>')
-		    {
-		    val = "";
-		    gotEnd = TRUE;
-		    tag->end = html + (e - dupe);
-		    }
-		else if (isspace(c))
-		    {
-		    val = "";
-		    }
-		else
-		    {
-		    val = e = skipLeadingSpaces(e);
-		    if (e[0] == '"' || e[0] == '\'')
-			{
-			if (!parseQuotedStringNoEscapes(val, val, &e))
-			    break;
-			}
-		    else
-			{
-			for (;;)
-			    {
-			    c = *e;
-			    if (c == '>')
-				{
-				gotEnd = TRUE;
-				*e++ = 0;
-				tag->end = html + (e - dupe);
-				break;
-				}
-			    else if (isspace(c))
-				{
-				*e++ = 0;
-				break;
-				}
-			    else if (c == 0)
-				break;
-			    ++e;
-			    }
-			}
-		    }
-		AllocVar(att);
-		att->name = cloneString(name);
-		att->val = cloneString(val);
-		slAddTail(&tag->attributes, att);
-		s = e;
-		if (gotEnd)
-		    break;
-		}
-	    }
-	}
-    }
-slReverse(&tagList);
-return tagList;
-}
-
-static struct htmlFormVar *findOrMakeVar(struct htmlPage *page, char *name, 
-	struct hash *hash, struct htmlTag *tag, struct htmlFormVar **pVarList)
-/* Find variable of existing name if it exists,  otherwise
- * make a new one and add to hash and list.  Add reference
- * to this tag to var. */
-{
-struct htmlFormVar *var = hashFindVal(hash, name);
-if (var == NULL)
-    {
-    AllocVar(var);
-    var->name = name;
-    var->tagName = tag->name;
-    hashAdd(hash, name, var);
-    slAddHead(pVarList, var);
-    }
-else
-    {
-    if (!sameWord(var->tagName, tag->name))
-        {
-	tagWarn(page, tag, "Mixing FORM variable tag types %s and %s", 
-		var->tagName, tag->name);
-	var->tagName = tag->name;
-	}
-    }
-refAdd(&var->tags, tag);
-return var;
-}
-
-static boolean isMixableInputType(char *type)
-/* Return TRUE if it's a type you can mix with others ok, like
- * button, submit, and image. */
-{
-return sameWord(type, "BUTTON") || sameWord(type, "SUBMIT") 
-	|| sameWord(type, "IMAGE");
-}
-
-static boolean areMixableInputTypes(char *type1, char *type2)
-/* Return TRUE if type1 and type 2 can be safely mixed, i.e.
- * if type1 and type2 both pass isMixableInputType, OR
- * if type1 or type2 is HIDDEN. */
-{
-return sameWord(type1, "HIDDEN") || sameWord(type2, "HIDDEN")
-    || (isMixableInputType(type1) && isMixableInputType(type2));
-}
-
-static void htmlFormVarAddValue(struct htmlFormVar *var, char *value)
-/* Add value to list of predefined values for var. */
-{
-struct slName *name = slNameNew(value);
-slAddTail(&var->values, name);
-}
-
-
-static struct htmlFormVar *formParseVars(struct htmlPage *page, struct htmlForm *form)
-/* Return a list of variables parsed out of form.  
- * A form variable is something that may appear in the name
- * side of the name=value pairs that serves as input to a CGI
- * script.  The variables may be constructed from buttons, 
- * INPUT tags, OPTION lists, or TEXTAREAs. */
-{
-struct htmlTag *tag;
-struct htmlFormVar *varList = NULL, *var;
-struct hash *hash = newHash(0);
-for (tag = form->startTag->next; tag != form->endTag; tag = tag->next)
-    {
-    if (sameWord(tag->name, "INPUT"))
-        {
-	char *type = htmlTagAttributeVal(page, tag, "TYPE", NULL);
-	char *varName = htmlTagAttributeVal(page, tag, "NAME", NULL);
-	char *value = htmlTagAttributeVal(page, tag, "VALUE", NULL);
-
-	if (type == NULL)
-	    type = "TEXT";
-	if (varName == NULL)
-	    {
-	    if (!htmlTagAttributeVal(page, tag, "ONCHANGE", NULL)
-	        && !sameWord(type, "SUBMIT") && !sameWord(type, "CLEAR")
-	    	&& !sameWord(type, "BUTTON") && !sameWord(type, "RESET")
-		&& !sameWord(type, "IMAGE"))
-		tagWarn(page, tag, "Missing NAME attribute");
-	    varName = "n/a";
-	    }
-	var = findOrMakeVar(page, varName, hash, tag, &varList); 
-	if (var->type != NULL && !sameWord(var->type, type))
-	    {
-	    if (!areMixableInputTypes(var->type, type))
-		tagWarn(page, tag, "Mixing input types %s and %s", var->type, type);
-	    }
-	var->type = type;
-	if (sameWord(type, "TEXT") || sameWord(type, "PASSWORD") 
-		|| sameWord(type, "FILE") || sameWord(type, "HIDDEN")
-		|| sameWord(type, "IMAGE"))
-	    {
-	    var->curVal = cloneString(value);
-	    }
-	else if (sameWord(type, "CHECKBOX"))
-	    {
-	    if (htmlTagAttributeVal(page, tag, "CHECKED", NULL) != NULL)
-	        var->curVal = cloneString("on");
-	    }
-	else if (sameWord(type, "RADIO"))
-	    {
-	    if (htmlTagAttributeVal(page, tag, "CHECKED", NULL) != NULL)
-	        var->curVal = cloneString(value);
-	    htmlFormVarAddValue(var, value);
-	    }
-	else if ( sameWord(type, "RESET") || sameWord(type, "BUTTON") ||
-		sameWord(type, "SUBMIT") || sameWord(type, "IMAGE") ||
-		sameWord(type, "n/a"))
-	    {
-	    /* Do nothing. */
-	    }
-	else
-	    {
-	    tagWarn(page, tag, "Unrecognized INPUT TYPE %s", type);
-	    }
-	}
-    else if (sameWord(tag->name, "SELECT"))
-        {
-	char *varName = htmlTagAttributeNeeded(page, tag, "NAME");
-	struct htmlTag *subTag;
-	var = findOrMakeVar(page, varName, hash, tag, &varList); 
-	for (subTag = tag->next; subTag != form->endTag; subTag = subTag->next)
-	    {
-	    if (sameWord(subTag->name, "/SELECT"))
-		{
-		if (var->curVal == NULL && var->values != NULL)
-		    {
-		    var->curVal = cloneString(var->values->name);
-		    }
-		break;
-		}
-	    else if (sameWord(subTag->name, "OPTION"))
-	        {
-		char *val = cloneString(htmlTagAttributeVal(page, subTag, "VALUE", NULL));
-		if (val == NULL)
-		    {
-		    char *e = strchr(subTag->end, '<');
-		    if (e != NULL)
-			val = cloneStringZ(subTag->end, e - subTag->end);
-		    }
-		if (val != NULL)
-		    htmlFormVarAddValue(var, val);
-		if (htmlTagAttributeVal(page, subTag, "SELECTED", NULL) != NULL)
-		    {
-		    if (val != NULL)
-			var->curVal = cloneString(val);
-		    }
-		freez(&val);
-		}
-	    }
-	}
-    else if (sameWord(tag->name, "TEXTAREA"))
-        {
-	char *varName = htmlTagAttributeNeeded(page, tag, "NAME");
-	char *e = strchr(tag->end, '<');
-	var = findOrMakeVar(page, varName, hash, tag, &varList); 
-	if (e != NULL)
-	    var->curVal = cloneStringZ(tag->end, e - tag->end);
-	}
-    }
-freeHash(&hash);    
-slReverse(&varList);
-for (var = varList; var != NULL; var = var->next)
-    {
-    slReverse(&var->tags);
-    }
-return varList;
-}
-
-static struct htmlForm *htmlParseForms(struct htmlPage *page,
-	struct htmlTag *startTag, struct htmlTag *endTag)
-/* Parse out list of forms from tag stream. */
-{
-struct htmlForm *formList = NULL, *form = NULL;
-struct htmlTag *tag;
-for (tag = startTag; tag != endTag; tag = tag->next)
-    {
-    if (sameWord(tag->name, "FORM"))
-        {
-	if (form != NULL)
-	    tagWarn(page, tag, "FORM inside of FORM");
-	AllocVar(form);
-	form->startTag = tag;
-	slAddHead(&formList, form);
-	form->name = htmlTagAttributeVal(page, tag, "name", "n/a");
-	form->action = htmlTagAttributeNeeded(page, tag, "action");
-	form->method = htmlTagAttributeVal(page, tag, "method", "GET");
-	}
-    else if (sameWord(tag->name, "/FORM"))
-        {
-	if (form == NULL)
-	    tagWarn(page, tag, "/FORM outside of FORM");
-	else
-	    {
-	    form->endTag = tag->next;
-	    form = NULL;
-	    }
-	}
-    }
-slReverse(&formList);
-for (form = formList; form != NULL; form = form->next)
-    {
-    form->vars = formParseVars(page, form);
-    }
-return formList;
-}
-
-struct htmlPage *htmlPageParse(char *url, char *fullText)
-/* Parse out page and return. */
-{
-struct htmlPage *page;
-char *dupe = cloneLongString(fullText);
-char *s = dupe;
-struct htmlStatus *status = htmlStatusParse(&s);
-char *contentType;
-
-if (status == NULL)
-    return NULL;
-
-AllocVar(page);
-page->url = cloneString(url);
-page->fullText = fullText;
-page->status = status;
-page->header = htmlHeaderRead(&s, &page->cookies);
-contentType = hashFindVal(page->header, "Content-Type:");
-if (contentType == NULL)	
-    {
-    warn("No contentType, assuming text/html");
-    contentType = cloneString("text/html");
-    hashAdd(page->header, "Content-Type:", contentType);
-    }
-page->htmlText = fullText + (s - dupe);
-if (startsWith("text/html", contentType))
-    {
-    page->tags = htmlTagScan(page->htmlText, s);
-    page->forms = htmlParseForms(page, page->tags, NULL);
-    }
-freez(&dupe);
-return page;
-}
-
-struct htmlPage *htmlPageParseNoHead(char *url, char *htmlText)
-/* Parse out page in memory (past http header if any) and return. */
-{
-char *dupe = cloneString(htmlText);
-struct htmlPage *page;
-AllocVar(page);
-page->url = cloneString(url);
-page->fullText = page->htmlText = htmlText;
-page->tags = htmlTagScan(page->htmlText, dupe);
-page->forms = htmlParseForms(page, page->tags, NULL);
-freez(&dupe);
-return page;
-}
-
-struct htmlPage *htmlPageParseOk(char *url, char *fullText)
-/* Parse out page and return only if status ok. */
-{
-struct htmlPage *page = htmlPageParse(url, fullText);
-if (page == NULL)
-   noWarnAbort();
-if (page->status->status != 200)
-   errAbort("%s returned with status code %d", url, page->status->status);
-return page;
-}
-
-char *htmlSlurpWithCookies(char *url, struct htmlCookie *cookies)
-/* Send get message to url with cookies, and return full response as
- * a dyString.  This is not parsed or validated, and includes http
- * header lines.  Typically you'd pass this to htmlPageParse() to
- * get an actual page. */
-{
-struct dyString *dyHeader = dyStringNew(0);
-struct dyString *dyText;
-int sd;
-
-cookieOutput(dyHeader, cookies);
-sd = netOpenHttpExt(url, "GET", dyHeader->string);
-dyText = netSlurpFile(sd);
-close(sd);
-dyStringFree(&dyHeader);
-return dyStringCannibalize(&dyText);
-}
-
-struct htmlPage *htmlPageGetWithCookies(char *url, struct htmlCookie *cookies)
-/* Get page from URL giving server the given cookies.   Note only the
- * name and value parts of the cookies need to be filled in. */
-{
-char *buf = htmlSlurpWithCookies(url, cookies);
-return htmlPageParse(url, buf);
-}
-
-struct htmlPage *htmlPageForwarded(char *url, struct htmlCookie *cookies)
-/* Get html page.  If it's just a forwarding link then get do the
- * forwarding.  Cookies is a possibly empty list of cookies with
- * name and value parts filled in. */
-{
-struct htmlPage *page = htmlPageGetWithCookies(url, cookies);
-int level, maxLevels = 7;
-for (level = 0; level < maxLevels; ++level)
-    {
-    struct htmlPage *newPage;
-    char *newUrl = hashFindVal(page->header, "Location:");
-    if (newUrl == NULL)
-        break;
-    newPage = htmlPageGetWithCookies(newUrl, cookies);
-    htmlPageFree(&page);
-    page = newPage;
-    }
-return page;
-}
-
-struct htmlPage *htmlPageForwardedNoAbort(char *url, struct htmlCookie *cookies)
-/* Try and get an HTML page.  Print warning and return NULL if there's a problem. */
-{
-struct errCatch *errCatch = errCatchNew();
-struct htmlPage *page = NULL;
-if (errCatchStart(errCatch))
-    page = htmlPageForwarded(url, cookies);
-errCatchEnd(errCatch);
-if (errCatch->gotError)
-    warn("%s", errCatch->message->string);
-errCatchFree(&errCatch);
-return page;
-}
-
-
-struct htmlPage *htmlPageGet(char *url)
-/* Get page from URL (may be a file). */
-{
-if (fileExists(url))
-    {
-    char *buf;
-    readInGulp(url, &buf, NULL);
-    return htmlPageParseNoHead(url, buf);
-    }
-else
-    return htmlPageGetWithCookies(url, NULL);
-}
-
-void htmlFormVarPrint(struct htmlFormVar *var, FILE *f, char *prefix)
-/* Print out variable to file, prepending prefix. */
-{
-struct slName *val;
-fprintf(f, "%s%s\t%s\t%s\t%s\n", prefix, var->name, var->tagName, 
-	naForNull(var->type), 
-	naForNull(var->curVal));
-for (val = var->values; val != NULL; val = val->next)
-     fprintf(f, "%s\t%s\n", prefix, val->name);
-}
-
-void htmlFormPrint(struct htmlForm *form, FILE *f)
-/* Print out form structure. */
-{
-struct htmlFormVar *var;
-fprintf(f, "%s\t%s\t%s\n", form->name, form->method, form->action);
-for (var = form->vars; var != NULL; var = var->next)
-    htmlFormVarPrint(var, f, "\t");
-}
-
-struct htmlForm *htmlFormGet(struct htmlPage *page, char *name)
-/* Get named form. */
-{
-struct htmlForm *form;
-for (form = page->forms; form != NULL; form = form->next)
-    if (sameWord(form->name, name))
-        break;
-return form;
-}
-
-struct htmlFormVar *htmlFormVarGet(struct htmlForm *form, char *name)
-/* Get named variable. */
-{
-struct htmlFormVar *var;
-if (form == NULL)
-    errAbort("Null form passed to htmlFormVarGet");
-for (var = form->vars; var != NULL; var = var->next)
-    if (sameWord(var->name, name))
-	break;
-return var;
-}
-
-void htmlFormVarSet(struct htmlForm *form, char *name, char *val)
-/* Set variable to given value. Create it if it doesn't exist*/
-{
-struct htmlFormVar *var;
-if (form == NULL)
-    errAbort("Null form passed to htmlFormVarSet");
-var = htmlFormVarGet(form, name);
-if (var == NULL)
-    {
-    AllocVar(var);
-    var->type = "TEXT";
-    var->tagName = "INPUT";
-    var->name = name;
-    slAddHead(&form->vars, var);
-    }
-freez(&var->curVal);
-var->curVal = cloneString(val);
-}
-
-
-struct htmlFormVar *htmlPageGetVar(struct htmlPage *page, struct htmlForm *form, char *name)
-/* Get named variable.  If form is NULL, first form in page is used. */
-{
-if (form == NULL)
-    form = page->forms;
-return htmlFormVarGet(form, name);
-}
-
-void htmlPageSetVar(struct htmlPage *page, struct htmlForm *form, char *name, char *val)
-/* Set variable to given value.  If form is NULL, first form in page is used. */
-{
-if (page == NULL)
-    errAbort("Null page passed to htmlPageSetVar");
-if (form == NULL)
-    form = page->forms;
-if (form == NULL)
-    errAbort("Null form in htmlPageSetVar");
-htmlFormVarSet(form, name, val);
-}
-
-static void asciiEntityDecode(char *in, char *out, int inLength)
-/* Decode from SGML Character Entity &# format to normal. 
- * Out will be a little shorter than in typically, and
- * can be the same buffer. Only supports ASCII charset. */
-{
-char c;
-int i;
-char *e;
-for (i=0; i<inLength;++i)
-    {
-    c = *in++;
-    if ((c == '&') && (*in == '#'))
-	{
-	in++;
-	if ((e = strchr(in,';')) == NULL  || (e - in) > 5)
-	    { /* probably a badly formatted string, just recover and continue */
-	    *out++ = '&';
-	    *out++ = '#';
-	    }
-	else
-	    {
-	    int code;
-	    if (sscanf(in, "%d", &code) != 1)
-		{
-		code = '?';
-		}
-	    if (code > 255) 
-		{
-		code = '?';
-		}
-	    in = e;
-	    in++;
-	    *out++ = code;
-	    }
-	}
-    else
-	*out++ = c;
-    }
-*out++ = 0;
-}
-
-
-char *expandUrlOnBase(char *base, char *url)
-/* Figure out first character past host name. Load up
- * return string with protocol (if any) and host name. 
- * It is assumed that url is relative to base and does not contain a protocol.*/
-{
-struct dyString *dy = NULL;
-char *hostName, *pastHostName;
-dy = dyStringNew(256);
-if (startsWith("http:", base) || startsWith("https:", base) || startsWith("ftp:", base))
-    hostName = (strchr(base, ':') + 3);
-else
-    hostName = base;
-pastHostName = strchr(hostName, '/');
-if (pastHostName == NULL)
-    pastHostName = hostName + strlen(hostName);
-dyStringAppendN(dy, base, pastHostName - base);
-
-/* Add url to return string after host name. */
-if (startsWith("/", url))	/* New URL is absolute, just append to hostName */
-    {
-    dyStringAppend(dy, url);
-    }
-else
-    {
-    char *curDir = pastHostName;
-    char *endDir;
-    if (curDir[0] == '/')
-        curDir += 1;
-    dyStringAppendC(dy, '/');
-    endDir = strrchr(curDir, '/');
-    if (endDir == NULL)
-	endDir = curDir;
-    if (startsWith("../", url))
-	{
-	char *dir = cloneStringZ(curDir, endDir-curDir);
-	char *path = expandRelativePath(dir, url);
-	if (path != NULL)
-	     {
-	     dyStringAppend(dy, path);
-	     }
-	freez(&dir);
-	freez(&path);
-	}
-    else
-	{
-	dyStringAppendN(dy, curDir, endDir-curDir);
-	if (lastChar(dy->string) != '/')
-	    dyStringAppendC(dy, '/');
-	dyStringAppend(dy, url);
-	}
-    }
-return dyStringCannibalize(&dy);
-}
-
-char *htmlExpandUrl(char *base, char *url)
-/* Expand URL that is relative to base to stand on its own. 
- * Return NULL if it's not http or https. */
-{
-
-/* some mailto: have SGML char encoding, e.g a to hide from spambots */
-url = cloneString(url);	/* Clone because asciiEntityDecode may modify it. */
-asciiEntityDecode(url, url, strlen(url));
-
-/* In easiest case URL is actually absolute and begins with
- * protocol.  Just return clone of url. */
-if (startsWith("http:", url) || startsWith("https:", url))
-    return url;
-
-/* If it's got a colon, but no http or https, then it's some
- * protocol we don't understand, like a mailto.  Just return NULL. */
-if (strchr(url, ':') != NULL)
-    {
-    freez(&url);
-    return NULL;
-    }
-char *result = expandUrlOnBase(base, url);
-freez(&url);
-return result;
-}
-
-static void appendCgiVar(struct dyString *dy, char *name, char *value)
-/* Append cgiVar with cgi-encoded value to dy. */
-{
-char *enc = NULL;
-if (value == NULL)
-    value = "";
-enc = cgiEncode(value);
-if (dy->stringSize != 0)
-    dyStringAppendC(dy, '&');
-dyStringAppend(dy, name);
-dyStringAppendC(dy, '=');
-dyStringAppend(dy, enc);
-freez(&enc);
-}
-
-#define MIMEBUFSIZE 4096
-
-static void appendMimeVar(struct dyString *dy, char *name, char *value, char *varType, char *boundary)
-/* Append cgiVar with cgi-encoded value to dy. */
-{
-char *fileName = NULL;
-
-if (value == NULL)
-    value = "";
-dyStringAppend(dy, "\r\n--");
-dyStringAppend(dy, boundary);
-dyStringAppend(dy, "\r\n");
-dyStringAppend(dy, "content-disposition: form-data; name=\"");
-dyStringAppend(dy, name);
-dyStringAppend(dy, "\"");
-
-if (varType && sameWord(varType, "FILE"))
-    {
-    fileName = strrchr(value,'/'); 
-    if (fileName)
-	++fileName;
-    else
-	fileName = value;
-    dyStringAppend(dy, "; filename=\"");
-    dyStringAppend(dy, fileName);
-    dyStringAppend(dy, "\"");
-    }
-dyStringAppend(dy, "\r\n");
-dyStringAppend(dy, "\r\n");
-if (varType && sameWord(varType, "FILE") && !sameWord(value,""))
-    {
-    FILE *f = mustOpen(value, "r");
-    char buf[MIMEBUFSIZE];
-    int bytesRead = 0;
-    do
-	{
-	bytesRead = fread(buf,1,MIMEBUFSIZE,f);
-	if (bytesRead < 0)
-	    errnoAbort("error reading file to upload %s",value);
-    	dyStringAppendN(dy, buf, bytesRead);
-	}
-    while(bytesRead > 0);
-    carefulClose(&f);
-    }
-else    
-    dyStringAppend(dy, value);
-}
-
-static void appendMimeTerminus(struct dyString *dy, char *boundary)
-/* Append MIME boundary terminator to dy. */
-{
-dyStringAppend(dy, "\r\n--");
-dyStringAppend(dy, boundary);
-dyStringAppend(dy, "--\r\n");
-}
-
-
-static int countOccurrences(char *needle, int nLen, char *haystack, int hLen)
-/* count # of occurrences of needle in haystack */
-{
-int count = 0;
-char *match=NULL;
-while((match=memMatch(needle, nLen, haystack, hLen)) != NULL)
-    {
-    ++count;
-    hLen -= (match - haystack) + nLen;
-    if (hLen < 1)
-	break;
-    haystack=match+nLen;
-    }
-return count;
-}
-
-static boolean isMimeEncoded(struct htmlForm *form)
-/* determine if the form is using MIME encoding */
-{
-struct htmlAttribute *a;
-for(a = form->startTag->attributes;a;a = a->next)
-    if (sameWord(a->name,"ENCTYPE") && sameWord(a->val,"multipart/form-data"))
-	return TRUE;
-return FALSE;
-}
-
-char *htmlFormCgiVars(struct htmlPage *page, struct htmlForm *form, 
-	char *buttonName, char *buttonVal, struct dyString *dyHeader)
-/* Return cgi vars in name=val format from use having pressed
- * submit button of given name and value. */
-{
-struct dyString *dy = newDyString(0);
-struct htmlFormVar *var;
-boolean isMime = isMimeEncoded(form);
-int mimeParts = 0;
-char boundary[256];
-
-while(TRUE)
-    {
-    if (isMime)
-	{
-	/* choose a new string for the boundary */
-	/* Set initial seed */
-	int i = 0;
-    	safef(boundary,sizeof(boundary),"%s", "---------");
-	srand( (unsigned)time( NULL ) );
-	for(i=strlen(boundary);i<41;++i)
-	    {
-    	    int r = (int) 26 * (rand() / (RAND_MAX + 1.0));
-	    boundary[i] = r+'A';
-	    }
-	boundary[i] = 0;
-	}
-
-    if (form == NULL)
-	form = page->forms;
-    if (buttonName != NULL && !isMime)
-	appendCgiVar(dy, buttonName, buttonVal);
-    for (var = form->vars; var != NULL; var = var->next)
-	{
-	if (sameWord(var->tagName, "SELECT") || 
-	    sameWord(var->tagName, "TEXTAREA") || 
-	    (var->type != NULL &&
-	    ((sameWord(var->type, "RADIO") || sameWord(var->type, "TEXTBOX")
-	    || sameWord(var->type, "PASSWORD") || sameWord(var->type, "HIDDEN")
-	    || sameWord(var->type, "TEXT") || sameWord(var->type, "FILE")))))
-	    {
-	    char *val = var->curVal;
-	    if (val == NULL)
-		val = "";
-	    if (isMime)
-		{
-		++mimeParts;
-		appendMimeVar(dy, var->name, val, var->type, boundary);
-		}
-	    else	    
-		appendCgiVar(dy, var->name, val);
-	    }
-	else if (var->type != NULL && sameWord(var->type, "CHECKBOX"))
-	    {
-	    if (var->curVal != NULL)
-		{
-		if (isMime)	    
-		    {
-		    ++mimeParts;
-		    appendMimeVar(dy, var->name, var->curVal, var->type, boundary);
-		    }
-		else	    
-		    appendCgiVar(dy, var->name, var->curVal);
-		}
-	    }
-	else if (isMime && buttonName && sameWord(buttonName,var->name))
-	    {
-	    ++mimeParts;
-	    appendMimeVar(dy, buttonName, buttonVal, NULL, boundary);
-	    }
-	}
-    if (isMime) 
-	{
-	++mimeParts;
-	appendMimeTerminus(dy,boundary);
-	if (countOccurrences(boundary,strlen(boundary),dy->string,dy->stringSize) != mimeParts)
-	    { /* boundary was found in input! # occurrences not as expected */
-	    dyStringClear(dy);
-    	    continue;  /* if at first you don't succeed, try another boundary string */
-	    }
-    	dyStringPrintf(dyHeader, "Content-type: multipart/form-data, boundary=%s\r\n",boundary);
-	if (isMime && verboseLevel() == 2)
-	    {
-    	    mustWrite(stderr, dyHeader->string, dyHeader->stringSize);
-	    mustWrite(stderr, dy->string, dy->stringSize);
-	    }
-	}
-    break;
-    }   
-    
-return dyStringCannibalize(&dy);
-
-}
-
-struct htmlPage *htmlPageFromForm(struct htmlPage *origPage, struct htmlForm *form, 
-	char *buttonName, char *buttonVal)
-/* Return a new htmlPage based on response to pressing indicated button
- * on indicated form in origPage. */
-{
-struct htmlPage *newPage = NULL;
-struct dyString *dyUrl = dyStringNew(0);
-struct dyString *dyHeader = dyStringNew(0);
-struct dyString *dyText = NULL;
-char *url = htmlExpandUrl(origPage->url, form->action);
-char *cgiVars = NULL;
-int contentLength = 0;
-int sd = -1;
-
-dyStringAppend(dyUrl, url);
-cookieOutput(dyHeader, origPage->cookies);
-if (sameWord(form->method, "GET"))
-    {
-    cgiVars = htmlFormCgiVars(origPage, form, buttonName, buttonVal, dyHeader);
-    dyStringAppend(dyUrl, "?");
-    dyStringAppend(dyUrl, cgiVars);
-    verbose(3, "GET %s\n", dyUrl->string);
-    sd = netOpenHttpExt(dyUrl->string, form->method, dyHeader->string);
-    }
-else if (sameWord(form->method, "POST"))
-    {
-    cgiVars = htmlFormCgiVars(origPage, form, buttonName, buttonVal, dyHeader);
-    contentLength = strlen(cgiVars);
-    verbose(3, "POST %s\n", dyUrl->string);
-    dyStringPrintf(dyHeader, "Content-Length: %d\r\n", contentLength);
-    sd = netOpenHttpExt(dyUrl->string, form->method, dyHeader->string);
-    mustWriteFd(sd, cgiVars, contentLength);
-    }
-dyText = netSlurpFile(sd);
-close(sd);
-newPage = htmlPageParse(url, dyStringCannibalize(&dyText));
-freez(&url);
-dyStringFree(&dyUrl);
-dyStringFree(&dyHeader);
-freez(&cgiVars);
-return newPage;
-}
-
-struct slName *htmlPageScanAttribute(struct htmlPage *page, 
-	char *tagName, char *attribute)
-/* Scan page for values of particular attribute in particular tag.
- * if tag is NULL then scans in all tags. */
-{
-struct htmlTag *tag;
-struct htmlAttribute *att;
-struct slName *list = NULL, *el;
-
-for (tag = page->tags; tag != NULL; tag = tag->next)
-    {
-    if (tagName == NULL || sameWord(tagName, tag->name))
-        {
-	for (att = tag->attributes; att != NULL; att = att->next)
-	    {
-	    if (sameWord(attribute, att->name))
-	        {
-		el = slNameNew(att->val);
-		slAddHead(&list, el);
-		}
-	    }
-	}
-    }
-slReverse(&list);
-return list;
-}
-
-struct slName *htmlPageLinks(struct htmlPage *page)
-/* Scan through tags list and pull out HREF attributes. */
-{
-return htmlPageScanAttribute(page, NULL, "HREF");
-}
-
-struct htmlTableRow
-/* Data on a row */
-    {
-    struct htmlTableRow *next;
-    int tdCount;
-    int inTd;
-    };
-
-struct htmlTable 
-/* Data on a table. */
-    {
-    struct htmlTable *next;
-    struct htmlTableRow *row;
-    int rowCount;
-    };
-
-static void validateTables(struct htmlPage *page, 
-	struct htmlTag *startTag, struct htmlTag *endTag)
-/* Validate <TABLE><TR><TD> are all properly nested, and that there
- * are no empty rows. */
-{
-struct htmlTable *tableStack = NULL, *table;
-struct htmlTableRow *row;
-struct htmlTag *tag;
-
-for (tag = startTag; tag != endTag; tag = tag->next)
-    {
-    if (sameWord(tag->name, "TABLE"))
-        {
-	if (tableStack != NULL)
-	    {
-	    if (tableStack->row == NULL || !tableStack->row->inTd)
-	    tagAbort(page, tag, "TABLE inside of another table, but not inside of <TR><TD>\n");
-	    }
-	AllocVar(table);
-	slAddHead(&tableStack, table);
-	}
-    else if (sameWord(tag->name, "/TABLE"))
-        {
-	if ((table = tableStack) == NULL)
-	    tagAbort(page, tag, "Extra </TABLE> tag");
-	if (table->rowCount == 0)
-	    tagAbort(page, tag, "<TABLE> with no <TR>'s");
-	if (table->row != NULL)
-	    tagAbort(page, tag, "</TABLE> inside of a row");
-	tableStack = table->next;
-	freez(&table);
-	}
-    else if (sameWord(tag->name, "TR"))
-        {
-	if ((table = tableStack) == NULL)
-	    tagAbort(page, tag, "<TR> outside of TABLE");
-	if (table->row != NULL)
-	    tagAbort(page, tag, "<TR>...<TR> with no </TR> in between");
-	AllocVar(table->row);
-	table->rowCount += 1;
-	}
-    else if (sameWord(tag->name, "/TR"))
-        {
-	if ((table = tableStack) == NULL)
-	    tagAbort(page, tag, "</TR> outside of TABLE");
-	if (table->row == NULL)
-	    tagAbort(page, tag, "</TR> with no <TR>");
-#ifdef LEGAL_ACTUALLY
-	if (table->row->inTd)
-	    {
-	    tagAbort(page, tag, "</TR> while <TD> is open");
-	    }
-#endif /* LEGAL_ACTUALLY */
-	if (table->row->tdCount == 0)
-	    tagAbort(page, tag, "Empty row in <TABLE>");
-	freez(&table->row);
-	}
-    else if (sameWord(tag->name, "TD") || sameWord(tag->name, "TH"))
-        {
-	if ((table = tableStack) == NULL)
-	    tagAbort(page, tag, "<%s> outside of <TABLE>", tag->name);
-	if ((row = table->row) == NULL)
-	    tagAbort(page, tag, "<%s> outside of <TR>", tag->name);
-#ifdef LEGAL_ACTUALLY
-	if (row->inTd)
-	    {
-	    tagAbort(page, tag, "<%s>...<%s> with no </%s> in between", 
-	    	tag->name, tag->name, tag->name);
-	    }
-#endif /* LEGAL_ACTUALLY */
-	row->inTd = TRUE;
-	row->tdCount += 1;
-	}
-    else if (sameWord(tag->name, "/TD") || sameWord(tag->name, "/TH"))
-        {
-	if ((table = tableStack) == NULL)
-	    tagAbort(page, tag, "<%s> outside of <TABLE>", tag->name);
-	if ((row = table->row) == NULL)
-	    tagAbort(page, tag, "<%s> outside of <TR>", tag->name);
-	if (!row->inTd)
-	    tagAbort(page, tag, "<%s> with no <%s>", tag->name, tag->name+1);
-	row->inTd = FALSE;
-	}
-    }
-if (tableStack != NULL)
-    tagAbort(page, tag, "Missing </TABLE>");
-}
-
-static void checkTagIsInside(struct htmlPage *page, char *outsiders, char *insiders,  
-	struct htmlTag *startTag, struct htmlTag *endTag)
-/* Check that insiders are all bracketed by outsiders. */
-{
-char *outDupe = cloneString(outsiders);
-char *inDupe = cloneString(insiders);
-char *line, *word;
-int depth = 0;
-struct htmlTag *tag;
-struct hash *outOpen = newHash(8);
-struct hash *outClose = newHash(8);
-struct hash *inHash = newHash(8);
-char buf[256];
-
-/* Create hashes of all insiders */
-line = inDupe;
-while ((word = nextWord(&line)) != NULL)
-    {
-    touppers(word);
-    hashAdd(inHash, word, NULL);
-    }
-
-/* Create hash of open and close outsiders. */
-line = outDupe;
-while ((word = nextWord(&line)) != NULL)
-    {
-    touppers(word);
-    hashAdd(outOpen, word, NULL);
-    safef(buf, sizeof(buf), "/%s", word);
-    hashAdd(outClose, buf, NULL);
-    }
-
-/* Stream through tags making sure that insiders are
- * at least one deep inside of outsiders. */
-for (tag = startTag; tag != NULL; tag = tag->next)
-    {
-    char *type = tag->name;
-    if (hashLookup(outOpen, type ))
-        ++depth;
-    else if (hashLookup(outClose, type))
-        --depth;
-    else if (hashLookup(inHash, type))
-        {
-	if (depth <= 0)
-	    {
-	    if (!startsWith("<INPUT TYPE=HIDDEN NAME=", tag->start))  // one exception hardwired
-		tagAbort(page, tag, "%s outside of any of %s", type, outsiders);
-	    }
-	}
-    }
-freeHash(&inHash);
-freeHash(&outOpen);
-freeHash(&outClose);
-freeMem(outDupe);
-freeMem(inDupe);
-}
-
-static void checkNest(struct htmlPage *page,
-	char *type, struct htmlTag *startTag, struct htmlTag *endTag)
-/* Check that <type> and </type> tags are properly nested. */
-{
-struct htmlTag *tag;
-int depth = 0;
-char endType[256];
-safef(endType, sizeof(endType), "/%s", type);
-for (tag = startTag; tag != endTag; tag = tag->next)
-    {
-    if (sameWord(tag->name, type))
-	++depth;
-    else if (sameWord(tag->name, endType))
-        {
-	--depth;
-	if (depth < 0)
-	   tagAbort(page, tag, "<%s> without preceding <%s>", endType, type);
-	}
-    }
-if (depth != 0)
-    errAbort("Missing <%s> tag", endType);
-}
-
-static void validateNestingTags(struct htmlPage *page,
-	struct htmlTag *startTag, struct htmlTag *endTag,
-	char *nesters[], int nesterCount)
-/* Validate many tags that do need to nest. */
-{
-int i;
-for (i=0; i<nesterCount; ++i)
-    checkNest(page, nesters[i], startTag, endTag);
-}
-
-static char *bodyNesters[] = 
-/* Nesting tags that appear in body. */
-{
-    "ADDRESS", "DIV", "H1", "H2", "H3", "H4", "H5", "H6",
-    "ACRONYM", "BLOCKQUOTE", "CITE", "CODE", "DEL", "DFN"
-    "DIR", "DL", "MENU", "OL", "UL", "CAPTION", "TABLE", 
-    "A", "MAP", "OBJECT", "FORM"
-};
-
-static char *headNesters[] =
-/* Nesting tags that appear in header. */
-{
-    "TITLE",
-};
-
-static struct htmlTag *validateBody(struct htmlPage *page, struct htmlTag *startTag)
-/* Go through tags from current position (just past <BODY>)
- * up to and including </BODY> and check some things. */
-{
-struct htmlTag *tag, *endTag = NULL;
-
-/* First search for end tag. */
-for (tag = startTag; tag != NULL; tag = tag->next)
-    {
-    if (sameWord(tag->name, "/BODY"))
-        {
-	endTag = tag;
-	break;
-	}
-    }
-if (endTag == NULL)
-    errAbort("Missing </BODY>");
-validateTables(page, startTag, endTag);
-checkTagIsInside(page, "DIR MENU OL UL", "LI", startTag, endTag);
-checkTagIsInside(page, "DL", "DD DT", startTag, endTag);
-checkTagIsInside(page, "COLGROUP TABLE", "COL", startTag, endTag);
-checkTagIsInside(page, "MAP", "AREA", startTag, endTag);
-checkTagIsInside(page, "FORM SCRIPT", 
-	"INPUT BUTTON /BUTTON OPTION SELECT /SELECT TEXTAREA /TEXTAREA"
-	"FIELDSET /FIELDSET"
-	, 
-	startTag, endTag);
-validateNestingTags(page, startTag, endTag, bodyNesters, ArraySize(bodyNesters));
-return endTag->next;
-}
-
-static char *urlOkChars()
-/* Return array character indexed array that has
- * 1 for characters that are ok in URLs and 0
- * elsewhere. */
-{
-char *okChars;
-int c;
-AllocArray(okChars, 256);
-for (c=0; c<256; ++c)
-    if (isalnum(c))
-        okChars[c] = 1;
-/* This list is a little more inclusive than W3's. */
-okChars['='] = 1;
-okChars['-'] = 1;
-okChars['/'] = 1;
-okChars['%'] = 1;
-okChars['.'] = 1;
-okChars[';'] = 1;
-okChars[':'] = 1;
-okChars['_'] = 1;
-okChars['&'] = 1;
-okChars['+'] = 1;
-okChars['('] = 1;
-okChars[')'] = 1;
-okChars['$'] = 1;
-okChars['!'] = 1;
-okChars['*'] = 1;
-okChars['@'] = 1;
-okChars['\''] = 1;  // apparently the apostrophe itself is ok
-return okChars;
-}
-
-static void validateCgiUrl(char *url)
-/* Make sure URL follows basic CGI encoding rules. */
-{
-if (startsWith("http:", url) || startsWith("https:", url))
-    {
-    static char *okChars = NULL;
-    UBYTE c, *s;
-    if (okChars == NULL)
-	okChars = urlOkChars();
-    url = strchr(url, '?');
-    if (url != NULL)
-	{
-	s = (UBYTE*)url+1;
-	while ((c = *s++) != 0)
-	    {
-	    if (!okChars[c])
-		{
-		errAbort("Character %c not allowed in URL %s", c, url);
-		}
-	    }
-	}
-    }
-}
-
-static void validateCgiUrls(struct htmlPage *page)
-/* Make sure URLs in page follow basic CGI encoding rules. */
-{
-struct htmlForm *form;
-struct slName *linkList = htmlPageLinks(page), *link;
-
-for (form = page->forms; form != NULL; form = form->next)
-    validateCgiUrl(form->action);
-for (link = linkList; link != NULL; link = link->next)
-    validateCgiUrl(link->name);
-slFreeList(&linkList);
-}
-
-static int countTagsOfType(struct htmlTag *tagList, char *type)
-/* Count number of tags of given type. */
-{
-struct htmlTag *tag;
-int count = 0;
-for (tag = tagList; tag != NULL; tag = tag->next)
-    if (sameString(tag->name, type))
-        ++count;
-return count;
-}
-
-static void checkExactlyOne(struct htmlTag *tagList, char *type)
-/* Check there is exactly one of tag in list. */
-{
-int count = countTagsOfType(tagList, type);
-if (count != 1)
-    errAbort("Expecting exactly 1 <%s>, got %d", type, count);
-}
-
-
-void htmlPageFormOrAbort(struct htmlPage *page)
-/* Aborts if no FORM found */
-{
-if (page == NULL)
-    errAbort("Can't validate NULL page");
-if (page->forms == NULL)
-    errAbort("No form found");
-}
-
-void htmlPageValidateOrAbort(struct htmlPage *page)
-/* Do some basic validations.  Aborts if there is a problem. */
-{
-struct htmlTag *tag;
-boolean gotTitle = FALSE;
-char *contentType = NULL;
-
-if (page == NULL)
-    errAbort("Can't validate NULL page");
-if (page->header != NULL)
-    contentType = hashFindVal(page->header, "Content-Type:");
-if (contentType == NULL || startsWith("text/html", contentType))
-    {
-    /* To simplify things upper case all tag names. */
-    for (tag = page->tags; tag != NULL; tag = tag->next)
-	touppers(tag->name);
-
-    checkExactlyOne(page->tags, "BODY");
-
-    /* Validate header, and make a suggestion or two */
-    if ((tag = page->tags) == NULL)
-	errAbort("No tags");
-    if (!sameWord(tag->name, "HTML"))
-	errAbort("Doesn't start with <HTML> tag");
-    tag = tag->next;
-    if (tag == NULL || !sameWord(tag->name, "HEAD"))
-	warn("<HEAD> tag does not follow <HTML> tag");
-    else
-	{
-	for (;;)
-	    {
-	    tag = tag->next;
-	    if (tag == NULL)
-		errAbort("Missing </HEAD>");
-	    if (sameWord(tag->name, "TITLE"))
-		gotTitle = TRUE;
-	    if (sameWord(tag->name, "/HEAD"))
-		break;
-	    }
-	if (!gotTitle)
-	    warn("No title in <HEAD>");
-	validateNestingTags(page, page->tags, tag, headNesters, ArraySize(headNesters));
-	tag = tag->next;
-	}
-    if (tag == NULL || !sameWord(tag->name, "BODY"))
-	errAbort("<BODY> tag does not follow <HTML> tag");
-    tag = validateBody(page, tag->next);
-    if (tag == NULL || !sameWord(tag->name, "/HTML"))
-	errAbort("Missing </HTML>");
-    validateCgiUrls(page);
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/htmshell.c b/gbtools/src/blatSrc/lib/htmshell.c
deleted file mode 100644
index 5786bad..0000000
--- a/gbtools/src/blatSrc/lib/htmshell.c
+++ /dev/null
@@ -1,670 +0,0 @@
-/* htmshell - a shell to wrap around programs that generate
- * html files.  Write the html initial stuff (<head>, <body>, etc.)
- * and the final stuff too.  Also catch errors here so that
- * the html final stuff is written even if the program has
- * to abort.
- *
- * This also includes a few routines to write commonly used
- * html constructs such as images, horizontal lines. etc.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "obscure.h"
-#include "cheapcgi.h"
-#include "htmshell.h"
-#include "errAbort.h"
-#include "dnautil.h"
-
-
-jmp_buf htmlRecover;
-
-boolean htmlWarnBoxSetUpAlready=FALSE;
-
-static bool NoEscape = FALSE;
-
-void htmlNoEscape()
-{
-NoEscape = TRUE;
-}
-
-void htmlDoEscape()
-{
-NoEscape = FALSE;
-}
-
-void htmlVaParagraph(char *line, va_list args)
-/* Print a line in it's own paragraph. */
-{
-fputs("<P>", stdout);
-vfprintf(stdout, line, args);
-fputs("</P>\n", stdout);
-}
-
-void htmlParagraph(char *line, ...)
-{
-va_list args;
-va_start(args, line);
-htmlVaParagraph(line, args);
-va_end(args);
-}
-
-void htmlVaCenterParagraph(char *line, va_list args)
-/* Center a line in it's own paragraph. */
-{
-fputs("<P ALIGN=\"CENTER\">", stdout);
-vfprintf(stdout, line, args);
-fputs("</P>\n", stdout);
-}
-
-void htmlCenterParagraph(char *line, ...)
-{
-va_list args;
-va_start(args, line);
-htmlVaCenterParagraph(line, args);
-va_end(args);
-}
-
-void htmlHorizontalLine()
-/* Print a horizontal line. */
-{
-printf("<HR ALIGN=\"CENTER\">");
-}
-
-void htmHorizontalLine(FILE *f)
-/* Print a horizontal line. */
-{
-fprintf(f, "<HR ALIGN=\"CENTER\">");
-}
-
-void htmlNbSpaces(int count)
-/* Print a number of non-breaking spaces. */
-{
-int i;
-for (i=0; i<count; ++i)
-    printf(" ");
-}
-
-void htmTextOut(FILE *f, char *s)
-/* Print out string to file, if necessary replacing > with > and the like */
-{
-char c;
-if (NoEscape)
-    {
-    fputs(s, f);
-    return;
-    }
-
-while ((c = *s++) != 0)
-    {
-    switch (c)
-        {
-	case '>':
-	    fputs(">", f);
-	    break;
-	case '<':
-	    fputs("<", f);
-	    break;
-	case '&':
-	    fputs("&", f);
-	    break;
-	case '"':
-	    fputs(""", f);
-	    break;
-	default:
-	    fputc(c, f);
-	    break;
-	}
-    }
-}
-
-void htmlTextOut(char *s)
-/* Print out string, if necessary replacing > with > and the like */
-{
-htmTextOut(stdout, s);
-}
-
-char *htmlTextStripTags(char *s)
-/* Returns a cloned string with all html tags stripped out */
-{
-if (s == NULL)
-    return NULL;
-char *scrubbed = needMem(strlen(s));
-char *from=s;
-char *to=scrubbed;
-while (*from!='\0')
-    {
-    if (*from == '<')
-        {
-        from++;
-        while (*from!='\0' && *from != '>')
-            from++;
-        if (*from == '\0')  // The last open tag was never closed!
-            break;
-        from++;
-        }
-    else
-        *to++ = *from++;
-    }
-return scrubbed;
-}
-
-char *htmlTextReplaceTagsWithChar(char *s, char ch)
-/* Returns a cloned string with all html tags replaced with given char (useful for tokenizing) */
-{
-if (s == NULL)
-    return NULL;
-char *scrubbed = needMem(strlen(s) + 1);
-char *from=s;
-char *to=scrubbed;
-while(*from!='\0')
-    {
-    if (*from == '<')
-        {
-        from++;
-        *to++ = ch;
-        while (*from!='\0' && *from != '>')
-            from++;
-        if (*from == '\0')  // The last open tag was never closed!
-            break;
-        from++;
-        }
-    else
-        *to++ = *from++;
-    }
-*to = '\0';
-return scrubbed;
-}
-
-char *htmlEncodeText(char *s,boolean tagsOkay)
-/* Returns a cloned string with quotes replaced by html codes.
-   Changes ',",\n and if not tagsOkay >,<,& to code equivalents.
-   This differs from cgiEncode as it handles text that will
-   be displayed in an html page or tooltip style title.  */
-{
-int size = strlen(s) + 3; // Add some slop
-if (tagsOkay)
-    size += countChars(s,'\n') * 4;
-else
-    {
-    size += countChars(s,'>' ) * 4;
-    size += countChars(s,'<' ) * 4;
-    size += countChars(s,'&' ) * 5;
-    size += countChars(s,'\n') * 6;
-    }
-size += countChars(s,'"' ) * 6;
-size += countChars(s,'\'') * 5;
-char *cleanQuote = needMem(size);
-safecpy(cleanQuote,size,s);
-
-// NOTE: While some internal HTML should work, a single quote (') will will screw it up!
-if (tagsOkay)
-    strSwapStrs(cleanQuote, size,"\n","<BR>" ); // new lines also break the html
-else
-    {
-    strSwapStrs(cleanQuote, size,"&","&" );  // '&' is not the start of a control char
-    strSwapStrs(cleanQuote, size,">",">"  );  // '>' is not the close of a tag
-    strSwapStrs(cleanQuote, size,"<","<"  );  // '<' is not the open of a tag
-    if (cgiClientBrowser(NULL,NULL,NULL) == btFF)
-        strSwapStrs(cleanQuote, size,"\n","|"); // FF does not support!  Use "|" for '|'
-                                                     // instead
-    else
-        strSwapStrs(cleanQuote, size,"\n","&#x0A;"); // '\n' is supported on some browsers
-    }
-strSwapStrs(cleanQuote, size,"\"","""); // Shield double quotes
-strSwapStrs(cleanQuote, size,"'" ,"'" ); // Shield single quotes
-
-return cleanQuote;
-}
-
-char *attributeEncode(char *str)
-{
-return htmlEncodeText(str, FALSE);
-}
-
-char *htmlWarnStartPattern()
-/* Return starting pattern for warning message. */
-{
-return "<!-- HGERROR-START -->\n";
-}
-
-char *htmlWarnEndPattern()
-/* Return ending pattern for warning message. */
-{
-return "<!-- HGERROR-END -->\n";
-}
-
-void htmlWarnBoxSetup(FILE *f)
-/* Creates an invisible, empty warning box than can be filled with errors
- * and then made visible. */
-{
-// Only set this up once per page
-if (htmlWarnBoxSetUpAlready)
-    return;
-htmlWarnBoxSetUpAlready=TRUE;
-
-// NOTE: Making both IE and FF work is almost impossible.  Currently, in IE, if the message
-// is forced to the top (calling this routine after <BODY> then the box is not resizable
-// (dynamically adjusting to its contents). But if this setup is done later in the page
-// (at first warning), then IE does resize it.  Why?
-// FF3.0 (but not FF2.0) was resizable with the following, but it took some experimentation.
-// Remember what worked nicely on FF3.0:
-//      "var app=navigator.appName.substr(0,9); "
-//      "if(app == 'Microsoft') {warnBox.style.display='';} 
-//       else {warnBox.style.display=''; warnBox.style.width='auto';}"
-fprintf(f, "<script type='text/javascript'>\n");
-fprintf(f, "document.write(\"<center>"
-            "<div id='warnBox' style='display:none;'>"
-            "<CENTER><B id='warnHead'></B></CENTER>"
-            "<UL id='warnList'></UL>"
-            "<CENTER><button id='warnOK' onclick='hideWarnBox();return false;'></button></CENTER>"
-            "</div></center>\");\n");
-fprintf(f,"function showWarnBox() {"
-            "document.getElementById('warnOK').innerHTML=' OK ';"
-            "var warnBox=document.getElementById('warnBox');"
-            "warnBox.style.display=''; warnBox.style.width='65%%';"
-            "document.getElementById('warnHead').innerHTML='Warning/Error(s):';"
-            "window.scrollTo(0, 0);"
-          "}\n");
-fprintf(f,"function hideWarnBox() {"
-            "var warnBox=document.getElementById('warnBox');"
-            "warnBox.style.display='none';warnBox.innerHTML='';"
-            "var endOfPage = document.body.innerHTML.substr(document.body.innerHTML.length-20);"
-            "if(endOfPage.lastIndexOf('-- ERROR --') > 0) { history.back(); }"
-          "}\n"); // Note OK button goes to prev page when this page is interrupted by the error.
-fprintf(f,"window.onunload = function(){}; // Trick to avoid FF back button issue.\n");
-fprintf(f,"</script>\n");
-}
-
-void htmlVaWarn(char *format, va_list args)
-/* Write an error message. */
-{
-va_list argscp;
-va_copy(argscp, args);
-htmlWarnBoxSetup(stdout); // sets up the warnBox if it hasn't already been done.
-char warning[1024];
-vsnprintf(warning,sizeof(warning),format, args);
-char *encodedMessage = htmlEncodeText(warning,TRUE); // NOTE: While some internal HTML should work,
-                                                     // a single quote (') will will screw it up!
-printf("<script type='text/javascript'>{showWarnBox();"
-        "var warnList=document.getElementById('warnList');"
-        "warnList.innerHTML += '<li>%s</li>';}</script><!-- ERROR -->\n",encodedMessage); 
-                                     // NOTE that "--ERROR --" is needed at the end of this print!!
-freeMem(encodedMessage);
-
-/* Log useful CGI info to stderr */
-logCgiToStderr();
-
-/* write warning/error message to stderr so they get logged. */
-vfprintf(stderr, format, argscp);
-va_end(argscp);
-fflush(stderr);
-}
-
-void htmlAbort()
-/* Terminate HTML file. */
-{
-longjmp(htmlRecover, -1);
-}
-
-void htmlMemDeath()
-{
-errAbort("Out of memory.");
-}
-
-static void earlyWarningHandler(char *format, va_list args)
-/* Write an error message so user can see it before page is really started. */
-{
-static boolean initted = FALSE;
-if (!initted)
-    {
-    htmlStart("Very Early Error");
-    initted = TRUE;
-    }
-printf("%s", htmlWarnStartPattern());
-htmlVaParagraph(format,args);
-printf("%s", htmlWarnEndPattern());
-}
-
-static void earlyAbortHandler()
-/* Exit close web page during early abort. */
-{
-printf("</BODY></HTML>");
-exit(0);
-}
-
-void htmlPushEarlyHandlers()
-/* Push stuff to close out web page to make sensible error
- * message during initialization. */
-{
-pushWarnHandler(earlyWarningHandler);
-pushAbortHandler(earlyAbortHandler);
-}
-
-
-static char *htmlStyle =
-    "<STYLE TYPE=\"text/css\">"
-    ".hiddenText {background-color: silver}"
-    ".normalText {background-color: white}"
-    "</STYLE>\n";
-
-char *htmlStyleUndecoratedLink =
-/* Style that gets rid of underline of links. */
-   "<STYLE TYPE=\"text/css\"> "
-   "<!-- "
-   "A {text-decoration: none} "
-   "-->"
-   "</STYLE>\n";
-
-// optional style set by theme, added after main style and thus
-// can overwrite main style settings
-static char *htmlStyleTheme = NULL;
-
-void htmlSetStyle(char *style)
-/* Set document wide style. A favorite style to
- * use for many purposes is htmlStyleUndecoratedLink
- * which will remove underlines from links.
- * Needs to be called before htmlStart or htmShell. */
-{
-htmlStyle = style;
-}
-
-static char *htmlStyleSheet = NULL;
-void htmlSetStyleSheet(char *styleSheet)
-/* Set document wide style sheet by adding css name to HEAD part.
- * Needs to be called before htmlStart or htmShell. */
-{
-htmlStyleSheet = styleSheet;
-}
-
-static char *htmlFormClass = NULL;
-void htmlSetFormClass(char *formClass)
-/* Set class in the BODY part. */
-{
-htmlFormClass = formClass;
-}
-
-void htmlSetStyleTheme(char *style)
-/* Set theme style. Needs to be called before htmlStart or htmShell. */
-{
-htmlStyleTheme = style;
-}
-
-static char *htmlBackground = NULL;
-
-void htmlSetBackground(char *imageFile)
-/* Set background - needs to be called before htmlStart
- * or htmShell. */
-{
-htmlBackground = imageFile;
-}
-
-static int htmlBgColor = 0xFFFFFF;
-boolean gotBgColor = FALSE;
-
-void htmlSetBgColor(int color)
-/* Set background color - needs to be called before htmlStart
- * or htmShell. */
-{
-htmlBgColor = color;
-gotBgColor = TRUE;
-}
-
-void htmlSetCookie(char* name, char* value, char* expires, char* path, char* domain, boolean isSecure)
-/* create a cookie with the given stats */
-{
-char* encoded_name;
-char* encoded_value;
-char* encoded_path = NULL;
-
-encoded_name = cgiEncode(name);
-encoded_value = cgiEncode(value);
-if(path != NULL)
-	encoded_path = cgiEncode(path);
-
-printf("Set-Cookie: %s=%s; ", encoded_name, encoded_value);
-
-if(expires != NULL)
-    printf("expires=%s; ", expires);
-
-if(path != NULL)
-    printf("path=%s; ", encoded_path);
-
-if(domain != NULL)
-    printf("domain=%s; ", domain);
-
-if(isSecure == TRUE)
-    printf("secure");
-
-printf("\n");
-}
-
-void printBodyTag(FILE *f)
-{
-// print starting BODY tag, including any appropriate attributes (class, background and bgcolor). 
-fprintf(f, "<BODY");
-struct slName *classes = NULL;
-
-slNameAddHead(&classes, "cgi");
-char *scriptName = cgiScriptName();
-if(isNotEmpty(scriptName))
-    {
-    char buf[FILENAME_LEN];
-    splitPath(scriptName, NULL, buf, NULL);
-    slNameAddHead(&classes, cloneString(buf));
-}
-if (htmlFormClass != NULL )
-    slNameAddHead(&classes, htmlFormClass);
-fprintf(f, " CLASS=\"%s\"", slNameListToString(classes, ' '));
-
-if (htmlBackground != NULL )
-    fprintf(f, " BACKGROUND=\"%s\"", htmlBackground);
-if (gotBgColor)
-    fprintf(f, " BGCOLOR=\"#%X\"", htmlBgColor);
-fputs(">\n",f);
-}
-
-void _htmStartWithHead(FILE *f, char *head, char *title, boolean printDocType, int dirDepth)
-/* Write out bits of header that both stand-alone .htmls
- * and CGI returned .htmls need, including optional head info */
-{
-if (printDocType)
-    {
-//#define TOO_TIMID_FOR_CURRENT_HTML_STANDARDS
-#ifdef TOO_TIMID_FOR_CURRENT_HTML_STANDARDS
-    fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n", f);
-#else///ifndef TOO_TIMID_FOR_CURRENT_HTML_STANDARDS
-    char *browserVersion;
-    if (btIE == cgiClientBrowser(&browserVersion, NULL, NULL) && *browserVersion < '8')
-        fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n", f);
-    else
-        fputs("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" "
-              "\"http://www.w3.org/TR/html4/loose.dtd\">\n",f);
-    // Strict would be nice since it fixes atleast one IE problem (use of :hover CSS pseudoclass)
-#endif///ndef TOO_TIMID_FOR_CURRENT_HTML_STANDARDS
-    }
-fputs("<HTML>", f);
-fprintf(f,"<HEAD>\n%s<TITLE>%s</TITLE>\n", head, title);
-if (endsWith(title,"Login - UCSC Genome Browser")) 
-    fprintf(f,"\t<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;CHARSET=iso-8859-1\">\n");
-fprintf(f, "\t<META http-equiv=\"Content-Script-Type\" content=\"text/javascript\">\n");
-if (htmlStyle != NULL)
-    fputs(htmlStyle, f);
-if (htmlStyleSheet != NULL)
-    fprintf(f,"<link href=\"%s\" rel=\"stylesheet\" type=\"text/css\">\n", htmlStyleSheet);
-if (htmlStyleTheme != NULL)
-    fputs(htmlStyleTheme, f);
-
-fputs("</HEAD>\n\n",f);
-printBodyTag(f);
-htmlWarnBoxSetup(f);
-}
-
-
-void htmlStart(char *title)
-/* Write the start of an html from CGI */
-{
-puts("Content-Type:text/html");
-puts("\n");
-_htmStartWithHead(stdout, "", title, TRUE, 1);
-}
-
-void htmStartWithHead(FILE *f, char *head, char *title)
-/* Write the start of a stand alone .html file, plus head info */
-{
-_htmStartWithHead(f, head, title, TRUE, 1);
-}
-
-void htmStart(FILE *f, char *title)
-/* Write the start of a stand alone .html file. */
-{
-htmStartWithHead(f, "", title);
-}
-
-void htmStartDirDepth(FILE *f, char *title, int dirDepth)
-/* Write the start of a stand alone .html file.  dirDepth is the number of levels
- * beneath apache root that caller's HTML will appear to the web client.
- * E.g. if writing HTML from cgi-bin, dirDepth is 1; if trash/body/, 2. */
-{
-_htmStartWithHead(f, "", title, TRUE, dirDepth);
-}
-
-/* Write the end of an html file */
-void htmEnd(FILE *f)
-{
-fputs("\n</BODY>\n</HTML>\n", f);
-}
-
-/* Write the end of a stand-alone html file */
-void htmlEnd()
-{
-htmEnd(stdout);
-}
-
-void htmlBadVar(char *varName)
-{
-cgiBadVar(varName);
-}
-
-/* Display centered image file. */
-void htmlImage(char *fileName, int width, int height)
-{
-printf("<P ALIGN=\"CENTER\"><IMG SRC=\"%s\" WIDTH=\"%d\" HEIGHT=\"%d\" ALIGN=\"BOTTOM\" BORDER=\"0\"></P>", fileName, width, height);
-}
-
-
-void htmErrOnlyShell(void (*doMiddle)())
-/* Wrap error recovery around call to doMiddle. */
-{
-int status;
-
-/* Set up error recovery. */
-status = setjmp(htmlRecover);
-
-/* Do your main thing. */
-if (status == 0)
-    {
-    doMiddle();
-    }
-}
-
-void htmEmptyShell(void (*doMiddle)(), char *method)
-/* Wrap error recovery and and input processing around call to doMiddle. */
-{
-int status;
-
-/* Set up error recovery (for out of memory and the like)
- * so that we finish web page regardless of problems. */
-pushAbortHandler(htmlAbort);
-pushWarnHandler(htmlVaWarn);
-status = setjmp(htmlRecover);
-
-/* Do your main thing. */
-if (status == 0)
-    {
-    doMiddle();
-    }
-
-popWarnHandler();
-popAbortHandler();
-}
-
-
-/* Wrap an html file around the passed in function.
- * The passed in function is already in the body. It
- * should just make paragraphs and return.
- */
-void htmShell(char *title, void (*doMiddle)(), char *method)
-{
-/* Preamble. */
-dnaUtilOpen();
-htmlStart(title);
-
-/* Call wrapper for error handling. */
-htmEmptyShell(doMiddle, method);
-
-/* Post-script. */
-htmlEnd();
-}
-
-/* Wrap an html file around the passed in function.
- * The passed in function is already in the body. It
- * should just make paragraphs and return.
- * Method should be "query" or "get" or "post".
-param title - The HTML page title
-param head - The head text: can be a refresh directive or javascript
-param method - The function pointer to execute in the middle
-param method - The browser request method to use
- */
-void htmShellWithHead( char *title, char *head, void (*doMiddle)(), char *method)
-{
-/* Preamble. */
-dnaUtilOpen();
-
-puts("Content-Type:text/html");
-puts("\n");
-
-puts("<HTML>");
-printf("<HEAD>%s<TITLE>%s</TITLE>\n</HEAD>\n\n", head, title);
-printBodyTag(stdout);
-
-htmlWarnBoxSetup(stdout);// Sets up a warning box which can be filled with errors as they occur
-
-/* Call wrapper for error handling. */
-htmEmptyShell(doMiddle, method);
-
-/* Post-script. */
-htmlEnd();
-}
-
-/* Include an HTML file in a CGI */
-void htmlIncludeFile(char *path)
-{
-char *str = NULL;
-size_t len = 0;
-
-if (path == NULL)
-    errAbort("Program error: including null file");
-if (!fileExists(path))
-    errAbort("Missing file %s", path);
-readInGulp(path, &str, &len);
-
-if (len <= 0)
-    errAbort("Error reading included file: %s", path);
-
-puts(str);
-freeMem(str);
-}
-
-/* Include an HTML file in a CGI.
- *   The file path is relative to the web server document root */
-void htmlIncludeWebFile(char *file)
-{
-char path[256];
-char *docRoot = "/usr/local/apache/htdocs";
-
-safef(path, sizeof path, "%s/%s", docRoot, file);
-htmlIncludeFile(path);
-}
-
diff --git a/gbtools/src/blatSrc/lib/https.c b/gbtools/src/blatSrc/lib/https.c
deleted file mode 100644
index e26f1ee..0000000
--- a/gbtools/src/blatSrc/lib/https.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/* Connect via https. */
-
-/* Copyright (C) 2012 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "config.h"
-
-#ifdef USE_SSL
-
-#include "openssl/ssl.h"
-#include "openssl/err.h"
-
-#include <sys/socket.h>
-#include <unistd.h>
-#include <pthread.h>
-
-#include "common.h"
-#include "errAbort.h"
-#include "net.h"
-
-
-static pthread_mutex_t *mutexes = NULL;
- 
-static unsigned long openssl_id_callback(void)
-{
-return ((unsigned long)pthread_self());
-}
- 
-static void openssl_locking_callback(int mode, int n, const char * file, int line)
-{
-if (mode & CRYPTO_LOCK)
-    pthread_mutex_lock(&mutexes[n]);
-else
-    pthread_mutex_unlock(&mutexes[n]);
-}
- 
-void openssl_pthread_setup(void)
-{
-int i;
-int numLocks = CRYPTO_num_locks();
-AllocArray(mutexes, numLocks);
-for (i = 0;  i < numLocks;  i++)
-    pthread_mutex_init(&mutexes[i], NULL);
-CRYPTO_set_id_callback(openssl_id_callback);
-CRYPTO_set_locking_callback(openssl_locking_callback);
-}
- 
-
-struct netConnectHttpsParams
-/* params to pass to thread */
-{
-pthread_t thread;
-char *hostName;
-int port;
-int sv[2]; /* the pair of socket descriptors */
-};
-
-static void xerrno(char *msg)
-{
-fprintf(stderr, "%s : %s\n", strerror(errno), msg); fflush(stderr);
-}
-
-static void xerr(char *msg)
-{
-fprintf(stderr, "%s\n", msg); fflush(stderr);
-}
-
-void openSslInit()
-/* do only once */
-{
-static boolean done = FALSE;
-static pthread_mutex_t osiMutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_lock( &osiMutex );
-if (!done)
-    {
-    SSL_library_init();
-    ERR_load_crypto_strings();
-    ERR_load_SSL_strings();
-    OpenSSL_add_all_algorithms();
-    openssl_pthread_setup();
-    done = TRUE;
-    }
-pthread_mutex_unlock( &osiMutex );
-}
-
-
-void *netConnectHttpsThread(void *threadParam)
-/* use a thread to run socket back to user */
-{
-/* child */
-
-struct netConnectHttpsParams *params = threadParam;
-
-pthread_detach(params->thread);  // this thread will never join back with it's progenitor
-
-int fd=0;
-
-char hostnameProto[256];
-
-BIO *sbio;
-SSL_CTX *ctx;
-SSL *ssl;
-
-openSslInit();
-
-ctx = SSL_CTX_new(SSLv23_client_method());
-
-fd_set readfds;
-fd_set writefds;
-int err;
-struct timeval tv;
-
-
-/* TODO checking certificates 
-
-char *certFile = NULL;
-char *certPath = NULL;
-if (certFile || certPath)
-    {
-    SSL_CTX_load_verify_locations(ctx,certFile,certPath);
-#if (OPENSSL_VERSION_NUMBER < 0x0090600fL)
-    SSL_CTX_set_verify_depth(ctx,1);
-#endif
-    }
-
-// verify paths and mode.
-
-*/
-
-
-sbio = BIO_new_ssl_connect(ctx);
-
-BIO_get_ssl(sbio, &ssl);
-if(!ssl) 
-    {
-    xerr("Can't locate SSL pointer");
-    goto cleanup;
-    }
-
-/* Don't want any retries since we are non-blocking bio now */
-//SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
-
-
-safef(hostnameProto,sizeof(hostnameProto),"%s:%d",params->hostName,params->port);
-BIO_set_conn_hostname(sbio, hostnameProto);
-
-BIO_set_nbio(sbio, 1);     /* non-blocking mode */
-
-while (1) 
-    {
-    if (BIO_do_connect(sbio) == 1) 
-	{
-	break;  /* Connected */
-	}
-    if (! BIO_should_retry(sbio)) 
-	{
-	xerr("BIO_do_connect() failed");
-	char s[256];	
-	safef(s, sizeof s, "SSL error: %s", ERR_reason_error_string(ERR_get_error()));
-	xerr(s);
-	goto cleanup;
-	}
-
-    fd = BIO_get_fd(sbio, NULL);
-    if (fd == -1) 
-	{
-	xerr("unable to get BIO descriptor");
-	goto cleanup;
-	}
-    FD_ZERO(&readfds);
-    FD_ZERO(&writefds);
-    if (BIO_should_read(sbio)) 
-	{
-	FD_SET(fd, &readfds);
-	}
-    else if (BIO_should_write(sbio)) 
-	{
-	FD_SET(fd, &writefds);
-	}
-    else 
-	{  /* BIO_should_io_special() */
-	FD_SET(fd, &readfds);
-	FD_SET(fd, &writefds);
-	}
-    tv.tv_sec = (long) (DEFAULTCONNECTTIMEOUTMSEC/1000);  // timeout default 10 seconds
-    tv.tv_usec = (long) (((DEFAULTCONNECTTIMEOUTMSEC/1000)-tv.tv_sec)*1000000);
-
-    err = select(fd + 1, &readfds, &writefds, NULL, &tv);
-    if (err < 0) 
-	{
-	xerr("select() error");
-	goto cleanup;
-	}
-
-    if (err == 0) 
-	{
-	char s[256];	
-	safef(s, sizeof s, "connection timeout to %s", params->hostName);
-	xerr(s);
-	goto cleanup;
-	}
-    }
-
-
-/* TODO checking certificates 
-
-if (certFile || certPath)
-    if (!check_cert(ssl, host))
-	return -1;
-
-*/
-
-/* we need to wait on both the user's socket and the BIO SSL socket 
- * to see if we need to ferry data from one to the other */
-
-
-char sbuf[32768];  // socket buffer sv[1] to user
-char bbuf[32768];  // bio buffer
-int srd = 0;
-int swt = 0;
-int brd = 0;
-int bwt = 0;
-while (1) 
-    {
-
-    // Do NOT move this outside the while loop. 
-    /* Get underlying file descriptor, needed for select call */
-    fd = BIO_get_fd(sbio, NULL);
-    if (fd == -1) 
-	{
-	xerr("BIO doesn't seem to be initialized in https, unable to get descriptor.");
-	goto cleanup;
-	}
-
-
-    FD_ZERO(&readfds);
-    FD_ZERO(&writefds);
-
-    if (brd == 0)
-	FD_SET(fd, &readfds);
-    if (swt < srd)
-	FD_SET(fd, &writefds);
-    if (srd == 0)
-	FD_SET(params->sv[1], &readfds);
-
-    tv.tv_sec = (long) (DEFAULTCONNECTTIMEOUTMSEC/1000);  // timeout default 10 seconds
-    tv.tv_usec = (long) (((DEFAULTCONNECTTIMEOUTMSEC/1000)-tv.tv_sec)*1000000);
-
-    err = select(max(fd,params->sv[1]) + 1, &readfds, &writefds, NULL, &tv);
-
-    /* Evaluate select() return code */
-    if (err < 0) 
-	{
-	xerr("error during select()");
-	goto cleanup;
-	}
-    else if (err == 0) 
-	{
-	/* Timed out - just quit */
-	xerr("https timeout expired");
-	goto cleanup;
-	}
-
-    else 
-	{
-	if (FD_ISSET(params->sv[1], &readfds))
-	    {
-	    swt = 0;
-	    srd = read(params->sv[1], sbuf, 32768);
-	    if (srd == -1)
-		{
-		if (errno != 104) // udcCache often closes causing "Connection reset by peer"
-		    xerrno("error reading https socket");
-		goto cleanup;
-		}
-	    if (srd == 0) 
-		break;  // user closed socket, we are done
-	    }
-
-	if (FD_ISSET(fd, &writefds))
-	    {
-	    int swtx = BIO_write(sbio, sbuf+swt, srd-swt);
-	    if (swtx <= 0)
-		{
-		if (!BIO_should_write(sbio))
-		    {
-		    ERR_print_errors_fp(stderr);
-		    xerr("Error writing SSL connection");
-		    goto cleanup;
-		    }
-		}
-	    else
-		{
-		swt += swtx;
-		if (swt >= srd)
-		    {
-		    swt = 0;
-		    srd = 0;
-		    }
-		}
-	    }
-
-	if (FD_ISSET(fd, &readfds))
-	    {
-	    bwt = 0;
-	    brd = BIO_read(sbio, bbuf, 32768);
-
-	    if (brd <= 0)
-		{
-		if (BIO_should_read(sbio))
-		    {
-		    brd = 0;
-		    continue;
-		    }
-		else
-		    {
-		    if (brd == 0) break;
-		    ERR_print_errors_fp(stderr);
-		    xerr("Error reading SSL connection");
-		    goto cleanup;
-		    }
-		}
-	    // write the https data received immediately back on socket to user, and it's ok if it blocks.
-	    while(bwt < brd)
-		{
-		int bwtx = write(params->sv[1], bbuf+bwt, brd-bwt);
-		if (bwtx == -1)
-		    {
-		    if ((errno != 104)  // udcCache often closes causing "Connection reset by peer"
-		     && (errno !=  32)) // udcCache often closes causing "Broken pipe"
-			xerrno("error writing https data back to user socket");
-		    goto cleanup;
-		    }
-		bwt += bwtx;
-		}
-	    brd = 0;
-	    bwt = 0;
-	    }
-	}
-    }
-
-cleanup:
-
-BIO_free_all(sbio);
-close(params->sv[1]);  /* we are done with it */
-
-return NULL;
-}
-
-int netConnectHttps(char *hostName, int port)
-/* Return socket for https connection with server or -1 if error. */
-{
-
-fflush(stdin);
-fflush(stdout);
-fflush(stderr);
-
-struct netConnectHttpsParams *params;
-AllocVar(params);
-params->hostName = cloneString(hostName);
-params->port = port;
-
-socketpair(AF_UNIX, SOCK_STREAM, 0, params->sv);
-
-int rc;
-rc = pthread_create(&params->thread, NULL, netConnectHttpsThread, (void *)params);
-if (rc)
-    {
-    errAbort("Unexpected error %d from pthread_create(): %s",rc,strerror(rc));
-    }
-
-/* parent */
-
-return params->sv[0];
-
-}
-
-#else
-
-#include <stdarg.h>
-#include "common.h"
-#include "errAbort.h"
-
-int netConnectHttps(char *hostName, int port)
-/* Start https connection with server or die. */
-{
-errAbort("No openssl available in netConnectHttps for %s : %d", hostName, port);
-return -1;   /* will never get to here, make compiler happy */
-}
-
-#endif
diff --git a/gbtools/src/blatSrc/lib/intExp.c b/gbtools/src/blatSrc/lib/intExp.c
deleted file mode 100644
index 67c3d2c..0000000
--- a/gbtools/src/blatSrc/lib/intExp.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Below is the worlds sleaziest little numerical expression
- * evaluator. Used to do only ints, now does doubles as well. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "kxTok.h"
-
-
-static struct kxTok *tok;
-
-#define nextTok() (tok = tok->next) 
-
-#ifdef DEBUG
-static void nextTok()
-/* Advance to next token. */
-{
-if (tok == NULL)
-    printf("(null)");
-else
-    {
-    printf("'%s' -> ", tok->string);
-    if (tok->next == NULL)
-        printf("(null)\n");
-    else
-        printf("'%s'\n", tok->next->string);
-    }
-tok = tok->next;
-}
-#endif /* DEBUG */
-
-
-static double expression();
-/* Forward declaration of main expression handler. */
-
-static double number()
-/* Return number. */
-{
-double val;
-if (tok == NULL)
-    errAbort("Parse error in numerical expression");
-if (!isdigit(tok->string[0]))
-    errAbort("Expecting number, got %s", tok->string);
-val = atof(tok->string);
-nextTok();
-return val;
-}
-
-static double atom()
-/* Return parenthetical expression or number. */
-{
-double val;
-if (tok->type == kxtOpenParen)
-    {
-    nextTok();
-    val = expression();
-    if (tok->type == kxtCloseParen)
-	{
-        nextTok();
-	return val;
-	}
-    else
-	{
-        errAbort("Unmatched parenthesis");
-	return 0;
-	}
-    }
-else
-    return number();
-}
-
-
-static double uMinus()
-/* Unary minus. */
-{
-double val;
-if (tok->type == kxtSub)
-    {
-    nextTok();
-    val = -atom();
-    return val;
-    }
-else
-    return atom();
-}
-
-static double mulDiv()
-/* Multiplication or division. */
-{
-double val = uMinus();
-for (;;)
-    {
-    if (tok->type == kxtMul)
-	{
-	nextTok();
-	val *= uMinus();
-	}
-    else if (tok->type == kxtDiv)
-	{
-	nextTok();
-	val /= uMinus();
-	}
-    else
-        break;
-    }
-return val;
-}
-
-static double addSub()
-/* Addition or subtraction. */
-{
-double val;
-val = mulDiv();
-for (;;)
-    {
-    if (tok->type == kxtAdd)
-	{
-	nextTok();
-	val += mulDiv();
-	}
-    else if (tok->type == kxtSub)
-	{
-	nextTok();
-	val -= mulDiv();
-	}
-    else
-        break;
-    }
-return val;
-}
-
-static double expression()
-/* Wraps around lowest level of expression. */
-{
-return addSub();
-}
-
-double doubleExp(char *text)
-/* Convert text to double expression and evaluate. */
-{
-double val;
-struct kxTok *tokList = tok = kxTokenize(text, FALSE);
-val = expression();
-slFreeList(&tokList);
-return val;
-}
-
-int intExp(char *text)
-/* Convert text to int expression and evaluate. */
-{
-return round(doubleExp(text));
-}
diff --git a/gbtools/src/blatSrc/lib/intValTree.c b/gbtools/src/blatSrc/lib/intValTree.c
deleted file mode 100644
index bc205c3..0000000
--- a/gbtools/src/blatSrc/lib/intValTree.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* intValTree - a binary tree with integer keys and void values.  This is based on the 
- * red/black self-balancing binary tree algorithm in the rbTree module. */
-
-/* Copyright (C) 2008 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "localmem.h"
-#include "rbTree.h"
-#include "intValTree.h"
-
-int intValCmp(void *va, void *vb)
-/* Return -1 if a before b,  0 if a and b overlap,
- * and 1 if a after b. */
-{
-struct intVal *a = va;
-struct intVal *b = vb;
-return a->key - b->key;
-}
-
-struct rbTree *intValTreeNew()
-/* Create a new, empty, tree with integer keys and void values. */
-{
-return rbTreeNew(intValCmp);
-}
-
-struct intVal *intValTreeAdd(struct rbTree *tree, int key, void *val)
-/* Add to binary tree.  Will abort if key is already in tree. */
-{
-struct intVal *iv;
-lmAllocVar(tree->lm, iv);
-iv->key = key;
-iv->val = val;
-if (rbTreeAdd(tree, iv) != NULL)
-    errAbort("Key %d already exists in tree", key);
-return iv;
-}
-
-struct intVal *intValTreeUpdate(struct rbTree *tree, int key, void *val)
-/* Add to binary tree. If key is already in tree just updates it with val. */
-{
-struct intVal *iv = intValTreeLookup(tree, key);
-if (iv != NULL)
-    iv->val = val;
-else
-    iv = intValTreeAdd(tree, key, val);
-return iv;
-}
-
-struct intVal *intValTreeRemove(struct rbTree *tree, int key)
-/* Removes given tree from key. */
-{
-struct intVal fullKey;
-fullKey.key = key;
-return rbTreeRemove(tree, &fullKey);
-}
-
-struct intVal *intValTreeLookup(struct rbTree *tree, int key)
-/* Returns intVal associated with given key, or NULL if none exists. */
-{
-struct intVal fullKey;
-fullKey.key = key;
-return rbTreeFind(tree, &fullKey);
-}
-
-
-void *intValTreeFind(struct rbTree *tree, int key)
-/* Returns value associated with given key, or NULL if none exists. */
-{
-struct intVal fullKey;
-fullKey.key = key;
-struct intVal *iv = rbTreeFind(tree, &fullKey);
-if (iv == NULL)
-    return NULL;
-return iv->val;
-}
-
-void *intValTreeMustFind(struct rbTree *tree, int key)
-/* Return value associated with given key. Aborts if none exists. */
-{
-struct intVal fullKey;
-fullKey.key = key;
-struct intVal *iv = rbTreeFind(tree, &fullKey);
-if (iv == NULL)
-    errAbort("%d is not in tree", key);
-return iv->val;
-}
-
-void doAllKeys(void *item, void *context)
-/* Callback function for tree traversal. */
-{
-int **pPt = context;
-struct intVal *iv = item;
-**pPt = iv->key;
-*pPt += 1;
-}
-
-int *intValTreeKeys(struct rbTree *tree)
-/* Returns array of keys (size is tree->n).  You freeMem this when done. */
-{
-int *results, *pt;
-pt = AllocArray(results, tree->n);
-rbTreeTraverseWithContext(tree, doAllKeys, &pt);
-return results;
-}
diff --git a/gbtools/src/blatSrc/lib/internet.c b/gbtools/src/blatSrc/lib/internet.c
deleted file mode 100644
index 6a4c673..0000000
--- a/gbtools/src/blatSrc/lib/internet.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* internet - some stuff to make it easier to use
- * internet sockets and the like. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-#include "common.h"
-#include "internet.h"
-
-
-boolean internetIsDottedQuad(char *s)
-/* Returns TRUE if it looks like s is a dotted quad. */
-{
-int i;
-if (!isdigit(s[0]))
-    return FALSE;
-for (i=0; i<3; ++i)
-    {
-    s = strchr(s, '.');
-    if (s == NULL)
-        return FALSE;
-    s += 1;
-    if (!isdigit(s[0]))
-        return FALSE;
-    }
-return TRUE;
-}
-
-bits32 internetHostIp(char *hostName)
-/* Get IP v4 address (in host byte order) for hostName.
- * Warn and return 0 if there's a problem. */
-{
-bits32 ret;
-if (internetIsDottedQuad(hostName))
-    {
-    internetDottedQuadToIp(hostName, &ret);
-    }
-else
-    {
-    /* getaddrinfo is thread-safe and widely supported */
-    struct addrinfo hints, *res;
-    struct in_addr addr;
-    int err;
-
-    zeroBytes(&hints, sizeof(hints));
-    hints.ai_family = AF_INET;
-
-    if ((err = getaddrinfo(hostName, NULL, &hints, &res)) != 0) 
-	{
-	warn("getaddrinfo() error on hostName=%s: %s\n", hostName, gai_strerror(err));
-	return 0;
-	}
-
-    addr = ((struct sockaddr_in *)(res->ai_addr))->sin_addr;
-
-    ret = ntohl((uint32_t)addr.s_addr);
-
-    freeaddrinfo(res);
-
-    }
-return ret;
-}
-
-boolean internetFillInAddress(char *hostName, int port, struct sockaddr_in *address)
-/* Fill in address. Return FALSE if can't.  */
-{
-ZeroVar(address);
-address->sin_family = AF_INET;
-address->sin_port = htons(port);
-if (hostName == NULL)
-    address->sin_addr.s_addr = INADDR_ANY;
-else
-    {
-    if ((address->sin_addr.s_addr = htonl(internetHostIp(hostName))) == 0)
-	return FALSE;
-    }
-return TRUE;
-}
-
-boolean internetIpToDottedQuad(bits32 ip, char dottedQuad[17])
-/* Convert IP4 address in host byte order to dotted quad 
- * notation.  Warn and return FALSE if there's a 
- * problem. */
-{
-#ifndef __CYGWIN32__
-struct in_addr ia;
-zeroBytes(dottedQuad, 17);
-ZeroVar(&ia);
-ia.s_addr = htonl(ip);
-if (inet_ntop(AF_INET, &ia, dottedQuad, 16) == NULL)
-    {
-    warn("conversion problem on 0x%x in internetIpToDottedQuad: %s", 
-    	ip, strerror(errno));
-    return FALSE;
-    }
-return TRUE;
-#else
-warn("Sorry, internetIpToDottedQuad not supported in Windows.");
-return FALSE;
-#endif
-}
-
-boolean internetDottedQuadToIp(char *dottedQuad, bits32 *retIp)
-/* Convert dotted quad format address to IP4 address in
- * host byte order.  Warn and return FALSE if there's a 
- * problem. */
-{
-#ifndef __CYGWIN32__
-struct in_addr ia;
-if (inet_pton(AF_INET, dottedQuad, &ia) < 0)
-    {
-    warn("internetDottedQuadToIp problem on %s: %s", dottedQuad, strerror(errno));
-    return FALSE;
-    }
-*retIp = ntohl(ia.s_addr);
-return TRUE;
-#else
-warn("Sorry, internetDottedQuadToIp not supported in Windows.");
-return FALSE;
-#endif
-}
-
-void internetParseDottedQuad(char *dottedQuad, unsigned char quad[4])
-/* Parse dotted quads into quad */
-{
-char *s = dottedQuad;
-int i;
-if (!internetIsDottedQuad(s))
-    errAbort("%s is not a dotted quad", s);
-for (i=0; i<4; ++i)
-    {
-    quad[i] = atoi(s);
-    s = strchr(s, '.') + 1;
-    }
-}
-
-void internetUnpackIp(bits32 packed, unsigned char unpacked[4])
-/* Convert from 32 bit to 4-byte format with most significant
- * byte first. */
-{
-int i;
-for (i=3; i>=0; --i)
-    {
-    unpacked[i] = (packed&0xff);
-    packed >>= 8;
-    }
-}
-
-boolean internetIpInSubnet(unsigned char unpackedIp[4], unsigned char subnet[4])
-/* Return true if unpacked IP address is in subnet. */
-{
-int i;
-for (i=0; i<4; ++i)
-    {
-    unsigned char c = subnet[i];
-    if (c == 255)
-        return TRUE;
-    if (c != unpackedIp[i])
-        return FALSE;
-    }
-return TRUE;
-}
-
diff --git a/gbtools/src/blatSrc/lib/itsa.c b/gbtools/src/blatSrc/lib/itsa.c
deleted file mode 100644
index 083ab5e..0000000
--- a/gbtools/src/blatSrc/lib/itsa.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/* itsa - indexed traversable suffix array.  Used for doing quick genomic searches.
- * Use itsaMake utility to create one of these files , and the routines here to access it.  
- * See comment by itsaFileHeader for file format. See src/shortReads/itsaMake/itsa.doc as well 
- * for an explanation of the data structures, particularly the traverse array. */
-/* This file is copyright 2008 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include <sys/mman.h>
-#include "net.h"
-#include "itsa.h"
-
-/* Hex conversions to assist debugging:
- * 0=AA 1=AC 2=AG 3=AT 4=CA 5=CC 6=CG 7=CT
- * 8=GA 9=GC A=GG B=GT C=TA D=TC E=TG F=TT
- */
-
-/* Table to convert letters to one of the above values. */
-int itsaBaseToVal[256];
-
-void itsaBaseToValInit()
-/* Initialize itsaBaseToVal array */
-{
-/* Fill out itsaBaseToVal array - A is already done. */
-itsaBaseToVal[(int)'C'] = itsaBaseToVal[(int)'c'] = ITSA_C;
-itsaBaseToVal[(int)'G'] = itsaBaseToVal[(int)'g'] = ITSA_G;
-itsaBaseToVal[(int)'T'] = itsaBaseToVal[(int)'t'] = ITSA_T;
-}
-
-int itsaDnaToBinary(char *dna, int size)
-/* Convert dna to binary representation. */
-{
-int i;
-int val = 0;
-for (i=0; i<size; ++i)
-    {
-    val <<= 2;
-    val += itsaBaseToVal[(int)dna[i]];
-    }
-return val;
-}
-
-
-static void *pointerOffset(void *pt, bits64 offset)
-/* A little wrapper around pointer arithmetic in terms of bytes. */
-{
-char *s = pt;
-return s + offset;
-}
-
-struct itsa *itsaRead(char *fileName, boolean memoryMap)
-/* Read in a itsa from a file.  Does this via memory mapping if you like,
- * which will be faster typically for about 100 reads, and slower for more
- * than that (_much_ slower for thousands of reads and more). */
-{
-/* Open file (low level), read in header, and check it. */
-int fd = open(fileName, O_RDONLY);
-if (fd < 0)
-    errnoAbort("Can't open %s", fileName);
-struct itsaFileHeader h;
-if (netReadAll(fd, &h, sizeof(h)) < sizeof(h))
-    errnoAbort("Couldn't read header of file %s", fileName);
-if (h.magic != ITSA_MAGIC)
-    errAbort("%s does not seem to be a itsa file.", fileName);
-if (h.majorVersion > ITSA_MAJOR_VERSION)
-    errAbort("%s is a newer, incompatible version of itsa format. "
-             "This program works on version %d and below. "
-	     "%s is version %d.",  fileName, ITSA_MAJOR_VERSION, fileName, h.majorVersion);
-
-struct itsa *itsa;
-verbose(2, "itsa file %s size %lld\n", fileName, h.size);
-
-/* Get a pointer to data in memory, via memory map, or allocation and read. */
-struct itsaFileHeader *header ;
-if (memoryMap)
-    {
-#ifdef MACHTYPE_sparc
-    header = (struct itsaFileHeader *)mmap(NULL, h.size, PROT_READ, MAP_SHARED, fd, 0);
-#else
-    header = mmap(NULL, h.size, PROT_READ, MAP_FILE|MAP_SHARED, fd, 0);
-#endif
-    if (header == (void*)(-1))
-	errnoAbort("Couldn't mmap %s, sorry", fileName);
-    }
-else
-    {
-    header = needHugeMem(h.size);
-    if (lseek(fd, 0, SEEK_SET) < 0)
-	errnoAbort("Couldn't seek back to start of itsa file %s.  "
-		   "Splix files must be random access files, not pipes and the like"
-		   , fileName);
-    if (netReadAll(fd, header, h.size) < h.size)
-        errnoAbort("Couldn't read all of itsa file %s.", fileName);
-    }
-
-/* Allocate wrapper structure and fill it in. */
-AllocVar(itsa);
-itsa->header = header;
-itsa->isMapped = memoryMap;
-
-/* Make an array for easy access to chromosome names. */
-int chromCount = header->chromCount;
-char **chromNames = AllocArray(itsa->chromNames, chromCount);
-char *s = pointerOffset(header, sizeof(*header) );
-int i;
-for (i=0; i<chromCount; ++i)
-    {
-    chromNames[i] = s;
-    s += strlen(s)+1;
-    }
-
-/* Keep track of where we are in memmap. */
-bits64 mapOffset = sizeof(*header) + header->chromNamesSize;
-
-/* Point into chromSizes array. */
-bits32 *chromSizes = itsa->chromSizes 
-	= pointerOffset(header, mapOffset);
-mapOffset += sizeof(bits32) * chromCount;
-
-verbose(2, "total dna size %lld in %d chromosomes\n", (long long)header->dnaDiskSize, header->chromCount);
-itsa->allDna = pointerOffset(header, mapOffset);
-mapOffset += header->dnaDiskSize;
-
-/* Calculate chromOffset array. */
-bits32 offset = 0;
-bits32 *chromOffsets = AllocArray(itsa->chromOffsets, chromCount);
-for (i=0; i<chromCount; ++i)
-    {
-    chromOffsets[i] = offset;
-    offset += chromSizes[i] + 1;
-    verbose(2, "itsa contains %s,  %d bases, %d offset\n", 
-    	itsa->chromNames[i], (int)itsa->chromSizes[i], (int)chromOffsets[i]);
-    }
-
-/* Point to the suffix array. */
-itsa->array = pointerOffset(header, mapOffset);
-mapOffset += header->arraySize * sizeof(bits32);
-
-/* Point to the traverse array. */
-itsa->traverse = pointerOffset(header, mapOffset);
-mapOffset += header->arraySize * sizeof(bits32);
-
-/* Point to the 13-mer index. */
-itsa->index13 = pointerOffset(header, mapOffset);
-mapOffset += itsaSlotCount * sizeof(bits32);
-
-/* Make cursors array (faster to calculate than to load, and doesn't depend on data). */
-itsa->cursors13 = pointerOffset(header, mapOffset);
-mapOffset += itsaSlotCount * sizeof(UBYTE);
-
-assert(mapOffset == header->size);	/* Sanity check */
-return itsa;
-}
-
-void itsaFree(struct itsa **pItsa)
-/* Free up resources associated with index. */
-{
-struct itsa *itsa = *pItsa;
-if (itsa != NULL)
-    {
-    freeMem(itsa->chromNames);
-    freeMem(itsa->chromOffsets);
-    if (itsa->isMapped)
-	munmap((void *)itsa->header, itsa->header->size);
-    else
-	freeMem(itsa->header);
-    freez(pItsa);
-    }
-}
-
-int itsaOffsetToChromIx(struct itsa *itsa, bits32 tOffset)
-/* Figure out index of chromosome containing tOffset */
-{
-int i;
-int chromCount = itsa->header->chromCount;
-/* TODO - convert to binary search - at least chrom list is sorted in itsas. */
-for (i=0; i<chromCount; ++i)
-    {
-    int chromStart = itsa->chromOffsets[i];
-    int chromEnd = chromStart + itsa->chromSizes[i];
-    if (tOffset >= chromStart && tOffset < chromEnd)
-        return i;
-    }
-errAbort("tOffset %d out of range\n", tOffset);
-return -1;
-}
-
diff --git a/gbtools/src/blatSrc/lib/iupac.c b/gbtools/src/blatSrc/lib/iupac.c
deleted file mode 100644
index 9289d51..0000000
--- a/gbtools/src/blatSrc/lib/iupac.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/* iupac - routines to help cope with IUPAC ambiguity codes in DNA sequence. */
-
-/* Copyright (C) 2012 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "iupac.h"
-
-boolean iupacMatchLower(char iupac, char dna)
-/* See if iupac ambiguity code matches dna character where
- * both are lower case */
-{
-switch (iupac)
-    {
-    case 'a':
-        return dna == 'a';
-    case 'c':
-        return dna == 'c';
-    case 'g':
-        return dna == 'g';
-    case 't':
-    case 'u':
-        return dna == 't';
-    case 'r':
-        return dna == 'a' || dna == 'g';
-    case 'y':
-        return dna == 'c' || dna == 't';
-    case 's':
-        return dna == 'g' || dna == 'c';
-    case 'w':
-        return dna == 'a' || dna == 't';
-    case 'k':
-        return dna == 'g' || dna == 't';
-    case 'm':
-        return dna == 'a' || dna == 'c';
-    case 'b':
-        return dna == 'c' || dna == 'g' || dna == 't';
-    case 'd':
-        return dna == 'a' || dna == 'g' || dna == 't';
-    case 'h':
-        return dna == 'a' || dna == 'c' || dna == 't';
-    case 'v':
-        return dna == 'a' || dna == 'c' || dna == 'g';
-    case 'n':
-        return TRUE;
-    default:
-        errAbort("Unrecognized IUPAC code '%c'", iupac);
-	return FALSE;   // Not actually used but prevent compiler complaints
-    }
-}
-
-boolean iupacMatch(char iupac, char dna)
-/* See if iupac ambiguity code matches dna character */
-{
-return iupacMatchLower(tolower(iupac), tolower(dna));
-}
-
-boolean isIupacLower(char c)
-/* See if iupac c is a legal (lower case) iupac char */
-{
-switch (c)
-    {
-    case 'a':
-    case 'c':
-    case 'g':
-    case 't':
-    case 'u':
-    case 'r':
-    case 'y':
-    case 's':
-    case 'w':
-    case 'k':
-    case 'm':
-    case 'b':
-    case 'd':
-    case 'h':
-    case 'v':
-    case 'n':
-        return TRUE;
-    default:
-	return FALSE;
-    }
-}
-
-boolean isIupac(char c)
-/* See if iupac c is a legal iupac char */
-{
-return isIupacLower(tolower(c));
-}
-
-void iupacFilter(char *in, char *out)
-/* Filter out non-DNA non-UIPAC ambiguity code characters and change to lower case. */
-{
-char c;
-while ((c = *in++) != 0)
-    {
-    c = tolower(c);
-    if (isIupacLower(c))
-       *out++ = c;
-    }
-*out++ = 0;
-}
-
-boolean anyIupac(char *s)
-/* Return TRUE if there are any IUPAC ambiguity codes in s */
-{
-dnaUtilOpen();
-int c;
-while ((c = *s++) != 0)
-    {
-    switch (c)
-	{
-	case 'r':
-	case 'y':
-	case 's':
-	case 'w':
-	case 'k':
-	case 'm':
-	case 'b':
-	case 'd':
-	case 'h':
-	case 'v':
-	case 'n':
-	    return TRUE;
-	}
-    }
-return FALSE;
-}
-
-char iupacComplementBaseLower(char iupac)
-/* Return IUPAC complement for a single base */
-{
-switch (iupac)
-    {
-    case 'a':
-        return 't';
-    case 'c':
-        return 'g';
-    case 'g':
-        return 'c';
-    case 't':
-    case 'u':
-        return 'a';
-    case 'r':
-	return 'y';
-    case 'y':
-	return 'r';
-    case 's':
-	return 's';
-    case 'w':
-	return 'w';
-    case 'k':
-	return 'm';
-    case 'm':
-	return 'k';
-    case 'b':
-	return 'v';
-    case 'd':
-	return 'h';
-    case 'h':
-	return 'd';
-    case 'v':
-	return 'b';
-    case 'n':
-	return 'n';
-    default:
-        errAbort("Unrecognized IUPAC code '%c'", iupac);
-	return 0;   // Just to keep compiler from complaining, control won't reach here.
-    }
-}
-
-void iupacComplementLower(char *iupac, int iuSize)
-/* Return IUPAC complement many bases. Assumes iupac is lower case. */
-{
-int i;
-for (i=0; i<iuSize; ++i)
-    iupac[i] = iupacComplementBaseLower(iupac[i]);
-}
-
-void iupacReverseComplement(char *iu, int iuSize)
-/* Reverse complement a string containing DNA and IUPAC codes. Result will be always
- * lower case. */
-{
-toLowerN(iu, iuSize);
-reverseBytes(iu, iuSize);
-iupacComplementLower(iu, iuSize);
-}
-
-boolean iupacMatchStart(char *iupacPrefix, char *dnaString)
-/* Return TRUE if start of DNA is compatible with iupac */
-{
-char iupac;
-while ((iupac = *iupacPrefix++) != 0)
-    {
-    if (!iupacMatch(iupac, *dnaString++))
-        return FALSE;
-    }
-return TRUE;
-}
-
-char *iupacIn(char *needle, char *haystack)
-/* Return first place in haystack (DNA) that matches needle that may contain IUPAC codes. */
-{
-int needleSize = strlen(needle);
-int haySize = strlen(haystack);
-char *endOfHay = haystack + haySize - needleSize;
-char *h;
-for (h = haystack; h<=endOfHay; ++h)
-    {
-    if (iupacMatchStart(needle, h))
-        return h;
-    }
-return NULL;
-}
-
diff --git a/gbtools/src/blatSrc/lib/jointalign.c b/gbtools/src/blatSrc/lib/jointalign.c
deleted file mode 100644
index 2ddb209..0000000
--- a/gbtools/src/blatSrc/lib/jointalign.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* jointalign.c - routines for printing a joint alignment in html. 
- *
- * This file is copyright 2002 Ryan Weber, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "errAbort.h"
-#include "jointalign.h"
-
-
-
-void htmlPrintJointAlignment( char *seq1, char *seq2, int columnNum, 
-        int start, int end, char *strand )
-/* Print sequences 1 and 2 (assumed to be a joint alignment),
- * formatted for html output. Coordinates are printed based on
- * the start and end positions and oriented according to the
- * strand the sequences are on (+ or -). (NO COORDINATES YET)*/
-{
-int i;
-validateSeqs( seq1, seq2 );
-
-/*print the sequences with lines connecting identical residues
- *in columns of size columnNum*/
-for( i=0; i<strlen(seq1); i += columnNum )
-    htmlPrintJointAlignmentLine(seq1, seq2, i, min(i+columnNum, strlen(seq1)));
-
-/*printf( "<tt><hr><br>%s<br>%s<br></tt>", seq1, seq2 );*/
-
-}
-
-void htmlPrintJointAlignmentLine( char *seq1, char *seq2, int start, int end)
-/* Prints one line of the joint alignment between seq1 and seq2,
- * from seq[start] to seq[end-1].*/
-{
-
-int i;
-printf("<tt>");
-for( i=start; i<end; i++ )
-    printf("%c",seq1[i]);
-printf("<br>");
-for( i=start; i<end; i++ )
-    {
-    if(ucaseMatch( seq1[i], seq2[i] ))
-        printf("|");
-    else
-        printf(" ");
-    }
-printf("<br>");
-for( i=start; i<end; i++ )
-    printf("%c",seq2[i]);
-printf("</tt>");
-printf("<br><br>");
-   
-
-}
-
-boolean ucaseMatch( char a, char b )
-/* Case insensitive character matching */
-{
-if( toupper( a ) == toupper( b ) )
-    return( TRUE );
-else 
-    return( FALSE );
-}
-
-void validateSeqs( char *seq1, char *seq2 )
-/*Make sure sequences are the same length*/
-{
-if( strlen(seq1) != strlen(seq2) )
-    {
-    printf("%s<br>%s<br>", seq1, seq2 );
-    errAbort("The sequences are not properly aligned (different lengths)<br>\n"); 
-    }
-}
diff --git a/gbtools/src/blatSrc/lib/jpegSize.c b/gbtools/src/blatSrc/lib/jpegSize.c
deleted file mode 100644
index d197000..0000000
--- a/gbtools/src/blatSrc/lib/jpegSize.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/* jpegSize - read a jpeg header and figure out dimensions of image.
- * Adapted by Galt Barber from Matthias Wandel's jhead program */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-#include "common.h"
-#include "jpegSize.h"
-
-
-/* sections containing width and height     */
-#define M_SOF0  0xC0            /* Start Of Frame N                        */
-#define M_SOF1  0xC1            /* N indicates which compression process   */
-#define M_SOF2  0xC2            /* Only SOF0-SOF2 are now in common use    */
-#define M_SOF3  0xC3
-#define M_SOF5  0xC5            /* NB: codes C4 and CC are NOT SOF markers */
-#define M_SOF6  0xC6
-#define M_SOF7  0xC7
-#define M_SOF9  0xC9
-#define M_SOF10 0xCA
-#define M_SOF11 0xCB
-#define M_SOF13 0xCD
-#define M_SOF14 0xCE
-#define M_SOF15 0xCF
-
-#define M_SOI   0xD8            /* Start Of Image (beginning of datastream)*/
-#define M_EOI   0xD9            /* End Of Image (end of datastream)        */
-#define M_SOS   0xDA            /* Start Of Scan (begins compressed data)  */
-#define M_JFIF  0xE0            /* Jfif marker                             */
-#define M_EXIF  0xE1            /* Exif marker                             */
-
-#define MAX_SECTIONS 40
-
-typedef unsigned char uchar;
-
-void jpegSize(char *fileName, int *width, int *height)
-/* Read image width and height.
- * Parse marker stream until SOS or EOI; */
-{
-FILE * infile = mustOpen(fileName, "r"); 
-int sectionsRead = 0;
-boolean done = FALSE;
-boolean foundJFIF = FALSE;
-/* Scan the JPEG headers. */
-if (fgetc(infile) != 0xff || fgetc(infile) != M_SOI)
-    errAbort("error reading jpg header: %s",fileName);
-while(!done)
-    {
-    int itemlen;
-    int marker = 0;
-    int ll,lh, got;
-    int a=0;
-    uchar * data;
-
-    if (sectionsRead >= MAX_SECTIONS)
-	errAbort("Too many sections in jpg file: %s",fileName);
-
-    for (a=0;a<7;a++)
-	{
-	marker = fgetc(infile);
-	if (marker != 0xff) 
-	    break;
-	if (a >= 6)
-	    errAbort("too many padding bytes: %s",fileName);
-	}
-
-    /* 0xff is legal padding, but if we get that many, something's wrong. */
-    if (marker == 0xff)
-	errAbort("too many padding bytes: %s",fileName);
-
-    /* Read the length of the section. */
-    lh = fgetc(infile);
-    ll = fgetc(infile);
-
-    itemlen = (lh << 8) | ll;
-
-    if (itemlen < 2)
-	errAbort("invalid jpeg marker: %s",fileName);
-
-    data = (uchar *)needMem(itemlen);
-    if (data == NULL)
-	errAbort("Could not allocate %d bytes memory", itemlen);
-
-    /* Store first two pre-read bytes. */
-    data[0] = (uchar)lh;
-    data[1] = (uchar)ll;
-
-    got = fread(data+2, 1, itemlen-2, infile); /* Read the whole section. */
-    if (got != itemlen-2)
-	errAbort("Premature end of file?: %s",fileName);
-    
-    ++sectionsRead;
-
-    switch(marker)
-	{
-	case M_SOS:   /* stop before hitting compressed data */
-	    done = TRUE;
-	    break;
-	case M_EOI:   /* in case it's a tables-only JPEG stream */
-	    errAbort("No image in jpeg!: %s",fileName);
-	case M_JFIF:
-	    /* Regular jpegs always have this tag, 
-	       exif images have the exif marker instead or in addition 
-	       - could add check to make sure this is present
-	    */
-	    foundJFIF = TRUE;
-	    break;
-
-	case M_SOF0:
-	case M_SOF1:
-	case M_SOF2:
-	case M_SOF3:
-	case M_SOF5:
-	case M_SOF6:
-	case M_SOF7:
-	case M_SOF9:
-	case M_SOF10:
-	case M_SOF11:
-	case M_SOF13:
-	case M_SOF14:	    
-	case M_SOF15:
-	    *height = data[3]*256+data[4];
-	    *width  = data[5]*256+data[6];
-	    done = TRUE;
-	    break;
-	default:
-	    /* Skip any other sections. */
-	    break;
-	}
-	
-    freez(&data);
-    
-    }
-fclose(infile);
-if (!foundJFIF)
-    errAbort("JFIF marker not found jpeg: %s",fileName);
-return;
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/jsonParse.c b/gbtools/src/blatSrc/lib/jsonParse.c
deleted file mode 100644
index 3b9d034..0000000
--- a/gbtools/src/blatSrc/lib/jsonParse.c
+++ /dev/null
@@ -1,687 +0,0 @@
-/* jsonParse - routines to parse JSON strings and traverse and pick things out of the
- * resulting object tree. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "dystring.h"
-#include "sqlNum.h"
-#include "jsonParse.h"
-
-static struct jsonElement *newJsonElement(jsonElementType type)
-// generic constructor for a jsonElement; callers fill in the appropriate value
-{
-struct jsonElement *ele;
-AllocVar(ele);
-ele->type = type;
-return ele;
-}
-
-struct jsonElement *newJsonString(char *str)
-{
-struct jsonElement *ele = newJsonElement(jsonString);
-ele->val.jeString = cloneString(str);
-return ele;
-}
-
-struct jsonElement *newJsonBoolean(boolean val)
-{
-struct jsonElement *ele = newJsonElement(jsonBoolean);
-ele->val.jeBoolean = val;
-return ele;
-}
-
-struct jsonElement *newJsonNumber(long val)
-{
-struct jsonElement *ele = newJsonElement(jsonNumber);
-ele->val.jeNumber = val;
-return ele;
-}
-
-struct jsonElement *newJsonDouble(double val)
-{
-struct jsonElement *ele = newJsonElement(jsonDouble);
-ele->val.jeDouble = val;
-return ele;
-}
-
-struct jsonElement *newJsonObject(struct hash *h)
-{
-struct jsonElement *ele = newJsonElement(jsonObject);
-ele->val.jeHash = h;
-return ele;
-}
-
-struct jsonElement *newJsonList(struct slRef *list)
-{
-struct jsonElement *ele = newJsonElement(jsonList);
-ele->val.jeList = list;
-return ele;
-}
-
-void jsonObjectAdd(struct jsonElement *h, char *name, struct jsonElement *ele)
-// Add a new element to a jsonObject; existing values are replaced.
-{
-if(h->type != jsonObject)
-    errAbort("jsonObjectAdd called on element with incorrect type (%d)", h->type);
-hashReplace(h->val.jeHash, name, ele);
-}
-
-void jsonListAdd(struct jsonElement *list, struct jsonElement *ele)
-{
-if(list->type != jsonList)
-    errAbort("jsonListAdd called on element with incorrect type (%d)", list->type);
-slAddHead(&list->val.jeList, ele);
-}
-
-static void skipLeadingSpacesWithPos(char *s, int *posPtr)
-/* skip leading white space. */
-{
-for (;;)
-    {
-    char c = s[*posPtr];
-    if (!isspace(c))
-	return;
-    (*posPtr)++;
-    }
-}
-
-static void getSpecificChar(char c, char *str, int *posPtr)
-{
-// get specified char from string or errAbort
-if(str[*posPtr] != c)
-    errAbort("Unexpected character '%c' (expected '%c') - string position %d\n", str[*posPtr], c, *posPtr);
-(*posPtr)++;
-}
-
-static char *getString(char *str, int *posPtr)
-{
-// read a double-quote delimited string; we handle backslash escaping.
-// returns allocated string.
-boolean escapeMode = FALSE;
-int i;
-struct dyString *ds = dyStringNew(1024);
-getSpecificChar('"', str, posPtr);
-for(i = 0;; i++)
-    {
-    char c = str[*posPtr + i];
-    if(!c)
-        errAbort("Premature end of string (missing trailing double-quote); string position '%d'", *posPtr);
-    else if(escapeMode)
-        {
-        // We support escape sequences listed in http://www.json.org,
-        // except for Unicode which we cannot support in C-strings
-        switch(c)
-            {
-            case 'b':
-                c = '\b';
-                break;
-            case 'f':
-                c = '\f';
-                break;
-            case 'n':
-                c = '\n';
-                break;
-            case 'r':
-                c = '\r';
-                break;
-            case 't':
-                c = '\t';
-                break;
-            case 'u':
-		// Pass through Unicode
-		dyStringAppendC(ds, '\\');
-                break;
-            default:
-                // we don't need to convert \,/ or "
-		dyStringAppendC(ds, c);
-                break;
-            }
-        dyStringAppendC(ds, c);
-        escapeMode = FALSE;
-        }
-    else if(c == '"')
-        break;
-    else if(c == '\\')
-        escapeMode = TRUE;
-    else
-        {
-        dyStringAppendC(ds, c);
-        escapeMode = FALSE;
-        }
-    }
-*posPtr += i;
-getSpecificChar('"', str, posPtr);
-return dyStringCannibalize(&ds);
-}
-
-static struct jsonElement *jsonParseExpression(char *str, int *posPtr);
-
-static struct jsonElement *jsonParseObject(char *str, int *posPtr)
-{
-struct hash *h = newHash(5);
-getSpecificChar('{', str, posPtr);
-while(str[*posPtr] != '}')
-    {
-    // parse out a name : val pair
-    skipLeadingSpacesWithPos(str, posPtr);
-    char *name = getString(str, posPtr);
-    skipLeadingSpacesWithPos(str, posPtr);
-    getSpecificChar(':', str, posPtr);
-    skipLeadingSpacesWithPos(str, posPtr);
-    hashAdd(h, name, jsonParseExpression(str, posPtr));
-    skipLeadingSpacesWithPos(str, posPtr);
-    if(str[*posPtr] == ',')
-        (*posPtr)++;
-    else
-        break;
-    }
-skipLeadingSpacesWithPos(str, posPtr);
-getSpecificChar('}', str, posPtr);
-return newJsonObject(h);
-}
-
-static struct jsonElement *jsonParseList(char *str, int *posPtr)
-{
-struct slRef *list = NULL;
-getSpecificChar('[', str, posPtr);
-while(str[*posPtr] != ']')
-    {
-    struct slRef *e;
-    AllocVar(e);
-    skipLeadingSpacesWithPos(str, posPtr);
-    e->val = jsonParseExpression(str, posPtr);
-    slAddHead(&list, e);
-    skipLeadingSpacesWithPos(str, posPtr);
-    if(str[*posPtr] == ',')
-        (*posPtr)++;
-    else
-        break;
-    }
-skipLeadingSpacesWithPos(str, posPtr);
-getSpecificChar(']', str, posPtr);
-slReverse(&list);
-return newJsonList(list);
-}
-
-static struct jsonElement *jsonParseString(char *str, int *posPtr)
-{
-return newJsonString(getString(str, posPtr));
-}
-
-static struct jsonElement *jsonParseBoolean(char *str, int *posPtr)
-{
-struct jsonElement *ele = NULL;
-int i;
-for(i = 0; str[*posPtr + i] && isalpha(str[*posPtr + i]); i++)
-    ;
-char *val = cloneStringZ(str + *posPtr, i);
-if(sameString(val, "true"))
-    ele = newJsonBoolean(TRUE);
-else if(sameString(val, "false"))
-    ele =  newJsonBoolean(FALSE);
-else
-    errAbort("Invalid boolean value '%s'; pos: %d", val, *posPtr);
-*posPtr += i;
-freez(&val);
-return ele;
-}
-
-static struct jsonElement *jsonParseNumber(char *str, int *posPtr)
-{
-int i;
-boolean integral = TRUE;
-struct jsonElement *retVal = NULL;
-
-for(i = 0;; i++)
-    {
-    char c = str[*posPtr + i];
-    if(c == 'e' || c == 'E' || c == '.')
-        integral = FALSE;
-    else if(!c || (!isdigit(c) && c != '-'))
-        break;
-    }
-char *val = cloneStringZ(str + *posPtr, i);
-*posPtr += i;
-if(integral)
-    retVal = newJsonNumber(sqlLongLong(val));
-else
-    {
-    double d;
-    if(sscanf(val, "%lf", &d))
-        retVal = newJsonDouble(d);
-    else
-        errAbort("Invalid JSON Double: %s", val);
-    }
-freez(&val);
-return retVal;
-}
-
-static struct jsonElement *jsonParseExpression(char *str, int *posPtr)
-{
-skipLeadingSpacesWithPos(str, posPtr);
-char c = str[*posPtr];
-if(c == '{')
-    return jsonParseObject(str, posPtr);
-else if (c == '[')
-    return jsonParseList(str, posPtr);
-else if (c == '"')
-    return jsonParseString(str, posPtr);
-else if (isdigit(c) || c == '-')
-    return jsonParseNumber(str, posPtr);
-else
-    return jsonParseBoolean(str, posPtr);
-// XXXX support null?
-}
-
-struct jsonElement *jsonParse(char *str)
-{
-// parse string into an in-memory json representation
-int pos = 0;
-struct jsonElement *ele = jsonParseExpression(str, &pos);
-skipLeadingSpacesWithPos(str, &pos);
-if(str[pos])
-    errAbort("Invalid JSON: unprocessed trailing string at position: %d: %s", pos, str + pos);
-return ele;
-}
-
-char *jsonStringEscape(char *inString)
-/* backslash escape a string for use in a double quoted json string.
- * More conservative than javaScriptLiteralEncode because
- * some json parsers complain if you escape & or ' */
-{
-char c;
-int outSize = 0;
-char *outString, *out, *in;
-
-if (inString == NULL)
-    return(cloneString(""));
-
-/* Count up how long it will be */
-in = inString;
-while ((c = *in++) != 0)
-    {
-    switch(c)
-        {
-        case '\"':
-        case '\\':
-        case '/':
-        case '\b':
-        case '\f':
-        case '\n':
-        case '\r':
-        case '\t':
-            outSize += 2;
-            break;
-        default:
-            outSize += 1;
-        }
-    }
-outString = needMem(outSize+1);
-
-/* Encode string */
-in = inString;
-out = outString;
-while ((c = *in++) != 0)
-    {
-    switch(c)
-        {
-        case '\"':
-        case '\\':
-        case '/':
-        case '\b':
-        case '\f':
-        case '\n':
-        case '\r':
-        case '\t':
-            *out++ = '\\';
-            break;
-        }
-    *out++ = c;
-    }
-*out++ = 0;
-return outString;
-}
-
-void jsonFindNameRecurse(struct jsonElement *ele, char *jName, struct slName **pList)
-// Search the JSON tree recursively to find all the values associated to
-// the name, and add them to head of the list.  
-{
-switch (ele->type)
-    {
-    case jsonObject:
-        {
-        if(hashNumEntries(ele->val.jeHash))
-            {
-            struct hashEl *el, *list = hashElListHash(ele->val.jeHash);
-            slSort(&list, hashElCmp);
-            for (el = list; el != NULL; el = el->next)
-                {
-                struct jsonElement *val = el->val;
-                if sameString(el->name, jName)
-                    slNameAddHead(pList, jsonStringEscape(val->val.jeString));
-                jsonFindNameRecurse(val, jName, pList);
-                }
-            hashElFreeList(&list);
-            }
-        break;
-        }
-    case jsonList:
-        {
-        struct slRef *el;
-        if(ele->val.jeList)
-            {
-            for (el = ele->val.jeList; el != NULL; el = el->next)
-                {
-                struct jsonElement *val = el->val;
-                jsonFindNameRecurse(val, jName, pList);
-                }
-            }
-        break;
-        }
-    case jsonString:
-    case jsonBoolean:
-    case jsonNumber:
-    case jsonDouble:
-        {
-        break;
-        }
-    default:
-        {
-        errAbort("jsonFindNameRecurse; invalid type: %d", ele->type);
-        break;
-        }
-    }
-}
-
-struct slName *jsonFindName(struct jsonElement *json, char *jName)
-// Search the JSON tree to find all the values associated to the name
-// and add them to head of the list.  
-{
-struct slName *list = NULL;
-jsonFindNameRecurse(json, jName, &list);
-slReverse(&list);
-return list;
-}
-
-struct slName *jsonFindNameUniq(struct jsonElement *json, char *jName)
-// Search the JSON tree to find all the unique values associated to the name
-// and add them to head of the list. 
-{
-struct slName *list = NULL;
-jsonFindNameRecurse(json, jName, &list);
-slUniqify(&list, slNameCmp, slNameFree);
-slReverse(&list);
-return list;
-}
-
-void jsonElementRecurse(struct jsonElement *ele, char *name, boolean isLast,
-    void (*startCallback)(struct jsonElement *ele, char *name, boolean isLast, void *context),  
-    // Called at element start
-    void (*endCallback)(struct jsonElement *ele, char *name, boolean isLast, void *context),    
-    // Called at element end
-    void *context)
-/* Recurse through JSON tree calling callback functions with element and context.
- * Either startCallback or endCallback may be NULL*/
-{
-if (startCallback != NULL)
-    startCallback(ele, name, isLast, context);
-switch (ele->type)
-    {
-    case jsonObject:
-        {
-        if(hashNumEntries(ele->val.jeHash))
-            {
-            struct hashEl *el, *list = hashElListHash(ele->val.jeHash);
-            slSort(&list, hashElCmp);
-            for (el = list; el != NULL; el = el->next)
-                {
-                struct jsonElement *val = el->val;
-                jsonElementRecurse(val, el->name, el->next == NULL, 
-		    startCallback, endCallback, context);
-                }
-            hashElFreeList(&list);
-            }
-        break;
-        }
-    case jsonList:
-        {
-        struct slRef *el;
-        if(ele->val.jeList)
-            {
-            for (el = ele->val.jeList; el != NULL; el = el->next)
-                {
-                struct jsonElement *val = el->val;
-                jsonElementRecurse(val, NULL, el->next == NULL, 
-		    startCallback, endCallback, context);
-                }
-            }
-        break;
-        }
-    case jsonString:
-    case jsonBoolean:
-    case jsonNumber:
-    case jsonDouble:
-        {
-        break;
-        }
-    default:
-        {
-        errAbort("jsonElementRecurse; invalid type: %d", ele->type);
-        break;
-        }
-    }
-if (endCallback != NULL)
-    endCallback(ele, name, isLast, context);
-}
-
-void jsonPrintOneStart(struct jsonElement *ele, char *name, boolean isLast, int indent, FILE *f)
-/* Print the start of one json element - just name and maybe an opening brace or bracket.
- * Recursion is handled elsewhere. */
-{
-spaceOut(f, indent);
-if (name != NULL)
-    {
-    fprintf(f, "\"%s\": ", name);
-    }
-switch (ele->type)
-    {
-    case jsonObject:
-        {
-	fprintf(f, "{\n");
-        break;
-        }
-    case jsonList:
-        {
-	fprintf(f, "[\n");
-        break;
-        }
-    case jsonString:
-        {
-	char *escaped = jsonStringEscape(ele->val.jeString);
-	fprintf(f, "\"%s\"",  escaped);
-	freez(&escaped);
-	break;
-	}
-    case jsonBoolean:
-        {
-	char *val = (ele->val.jeBoolean ? "frue" : "false");
-	fprintf(f, "%s", val);
-	break;
-	}
-    case jsonNumber:
-        {
-	fprintf(f, "%ld", ele->val.jeNumber);
-	break;
-	}
-    case jsonDouble:
-        {
-	fprintf(f, "%g", ele->val.jeDouble);
-        break;
-        }
-    default:
-        {
-        errAbort("jsonPrintOneStart; invalid type: %d", ele->type);
-        break;
-        }
-    }
-}
-
-void jsonPrintOneEnd(struct jsonElement *ele, char *name, boolean isLast, boolean indent, FILE *f)
-/* Print object end */
-{
-switch (ele->type)
-    {
-    case jsonObject:
-        {
-	spaceOut(f, indent);
-	fprintf(f, "}");
-        break;
-        }
-    case jsonList:
-        {
-	spaceOut(f, indent);
-	fprintf(f, "]");
-        break;
-        }
-    case jsonString:
-    case jsonBoolean:
-    case jsonNumber:
-    case jsonDouble:
-        break;
-    default:
-        {
-        errAbort("jsonPrintOneEnd; invalid type: %d", ele->type);
-        break;
-        }
-    }
-if (!isLast)
-    fputc(',', f);
-fputc('\n', f);
-}
-
-struct jsonPrintContext
-/* Context for printing a JSON object nicely */
-    {
-    FILE *f;	// where to print it
-    int indent;	// How much to indent currently
-    int indentPer;  // How much to indent each level
-    };
-
-
-static void printIndentedNameStartCallback(struct jsonElement *ele, char *name, 
-    boolean isLast, void *context)
-{
-struct jsonPrintContext *jps = context;
-jsonPrintOneStart(ele, name,  isLast, jps->indent, jps->f);
-jps->indent += jps->indentPer;
-}
-
-static void printIndentedNameEndCallback(struct jsonElement *ele, char *name, 
-    boolean isLast, void *context)
-{
-struct jsonPrintContext *jps = context;
-jps->indent -= jps->indentPer;
-jsonPrintOneEnd(ele, name, isLast, jps->indent, jps->f);
-}
-
-void jsonPrintToFile(struct jsonElement *root, char *name, FILE *f, int indentPer)
-/* Print out JSON object and all children nicely indented to f as JSON objects. 
- * Name may be NULL.  Implemented via jsonPrintOneStart/jsonPrintOneEnd. */
-{
-struct jsonPrintContext jps = {f, 0, indentPer};
-jsonElementRecurse(root, NULL, TRUE, 
-	printIndentedNameStartCallback, printIndentedNameEndCallback, &jps);
-}
-
-/** Routines that check json type and return corresponding value. **/
-
-struct slRef *jsonListVal(struct jsonElement *ele, char *name)
-/* Enforce element is type jsonList.  Return list value */
-{
-if (ele->type != jsonList)
-    errAbort("json element %s is not a list", name);
-return ele->val.jeList;
-}
-
-struct hash *jsonObjectVal(struct jsonElement *ele, char *name)
-/* Enforce object is type jsonObject.  Return object hash */
-{
-if (ele->type != jsonObject)
-    errAbort("json element %s is not an object", name);
-return ele->val.jeHash;
-}
-
-long jsonNumberVal(struct jsonElement *ele, char *name)
-/* Enforce element is type jsonNumber and return value. */
-{
-if (ele->type != jsonNumber)
-    errAbort("json element %s is not a number", name);
-return ele->val.jeNumber;
-}
-
-double jsonDoubleVal(struct jsonElement *ele, char *name)
-/* Enforce element is type jsonDouble and return value. */
-{
-if (ele->type != jsonDouble)
-    errAbort("json element %s is not a number", name);
-return ele->val.jeDouble;
-}
-
-boolean jsonBooleanVal(struct jsonElement *ele, char *name)
-/* Enforce element is type jsonBoolean and return value. */
-{
-if (ele->type != jsonBoolean)
-    errAbort("json element %s is not a boolean", name);
-return ele->val.jeBoolean;
-}
-
-char *jsonStringVal(struct jsonElement *ele, char *eleName)
-/* Enforce element is type jsonString and return value. */
-{
-if (ele->type != jsonString)
-    errAbort("json element %s is not a string", eleName);
-return ele->val.jeString;
-}
-
-/** Routines that help work with json objects (bracket enclosed key/val pairs **/
-
-struct jsonElement *jsonFindNamedField(struct jsonElement *object, 
-    char *objectName, char *field)
-/* Find named field of object or return NULL if not found.  Abort if object
- * is not actually an object. */
-{
-struct hash *hash = jsonObjectVal(object, objectName);
-return hashFindVal(hash, field);
-}
-
-struct jsonElement *jsonMustFindNamedField(struct jsonElement *object, 
-    char *objectName, char *field)
-/* Find named field of object or die trying. */
-{
-struct jsonElement *ele = jsonFindNamedField(object, objectName, field);
-if (ele == NULL)
-   errAbort("Couldn't find field %s in json object %s", field, objectName);
-return ele;
-}
-
-char *jsonOptionalStringField(struct jsonElement *object, char *field, char *defaultVal)
-/* Return string valued field of object, or defaultVal if it doesn't exist. */
-{
-struct jsonElement *ele = jsonFindNamedField(object, "", field);
-if (ele == NULL)
-     return defaultVal;
-return jsonStringVal(ele, field);
-}
-
-char *jsonStringField(struct jsonElement *object, char *field)
-/* Return string valued field of object or abort if field doesn't exist. */
-{
-char *val = jsonOptionalStringField(object, field, NULL);
-if (val == NULL)
-    errAbort("Field %s doesn't exist in json object", field);
-return val;
-}
-
diff --git a/gbtools/src/blatSrc/lib/jsonWrite.c b/gbtools/src/blatSrc/lib/jsonWrite.c
deleted file mode 100644
index cef09dc..0000000
--- a/gbtools/src/blatSrc/lib/jsonWrite.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* jsonWrite - Helper routines for writing out JSON.  */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "dystring.h"
-#include "sqlNum.h"
-#include "jsonParse.h"
-#include "jsonWrite.h"
-
-struct jsonWrite *jsonWriteNew()
-/* Return new empty jsonWrite struct. */
-{
-struct jsonWrite *jw;
-AllocVar(jw);
-jw->dy = dyStringNew(0);
-return jw;
-}
-
-void jsonWriteFree(struct jsonWrite **pJw)
-/* Free up a jsonWrite object. */
-{
-struct jsonWrite *jw = *pJw;
-if (jw != NULL)
-    {
-    dyStringFree(&jw->dy);
-    freez(pJw);
-    }
-}
-
-static void jsonWritePushObjStack(struct jsonWrite *jw, bool val)
-/* Push val on stack */
-{
-int stackIx = jw->stackIx + 1;
-if (stackIx >= ArraySize(jw->objStack))
-    errAbort("Stack overflow in jsonWritePush");
-jw->objStack[stackIx] = val;
-jw->stackIx = stackIx;
-}
-
-static void jsonWritePopObjStack(struct jsonWrite *jw)
-/* pop object stack and just discard val. */
-{
-int stackIx = jw->stackIx - 1;
-if (stackIx < 0)
-    errAbort("Stack underflow in jsonWritePopObjStack");
-jw->stackIx = stackIx;
-}
-
-void jsonWriteTag(struct jsonWrite *jw, char *var)
-/* Print out quoted tag followed by colon. Print out preceding comma if need be.  */
-{
-struct dyString *dy = jw->dy;
-if (jw->objStack[jw->stackIx] != 0)
-    dyStringAppend(dy, ",\n");
-else
-    jw->objStack[jw->stackIx] = 1;
-if (var != NULL)
-    dyStringPrintf(jw->dy, "\"%s\": ", var);
-}
-
-void jsonWriteString(struct jsonWrite *jw, char *var, char *string)
-/* Print out "var": "val".  If var is NULL then just print out "val" */
-{
-struct dyString *dy = jw->dy;
-jsonWriteTag(jw, var);
-dyStringPrintf(dy, "\"%s\"", string);
-}
-
-void jsonWriteDateFromUnix(struct jsonWrite *jw, char *var, long long unixTimeVal)
-/* Add "var": YYYY-MM-DDT-HH:MM:SSZ given a Unix time stamp. Var may be NULL. */
-{
-struct dyString *dy = jw->dy;
-time_t timeStamp = unixTimeVal;
-struct tm tm;
-gmtime_r(&timeStamp, &tm);
-jsonWriteTag(jw, var);
-dyStringPrintf(dy, "\"%d:%02d:%02dT%02d:%02d:%02dZ\"",
-    1900+tm.tm_year, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
-}
-
-void jsonWriteNumber(struct jsonWrite *jw, char *var, long long val)
-/* print out "var": val as number. Var may be NULL. */
-{
-struct dyString *dy = jw->dy;
-jsonWriteTag(jw, var);
-dyStringPrintf(dy, "%lld", val);
-}
-
-void jsonWriteLink(struct jsonWrite *jw, char *var, char *objRoot, char *name)
-/* Print out the jsony type link to another object.  objRoot will start and end with a '/'
- * and may have additional slashes in this usage. Var may be NULL. */
-{
-struct dyString *dy = jw->dy;
-jsonWriteTag(jw, var);
-dyStringPrintf(dy, "\"%s%s\"", objRoot, name);
-}
-
-void jsonWriteLinkNum(struct jsonWrite *jw, char *var, char *objRoot, long long id)
-/* Print out the jsony type link to another object with a numerical id.  objRoot will start 
- * and end with a '/' and may have additional slashes in this usage. Var may be NULL */
-{
-struct dyString *dy = jw->dy;
-jsonWriteTag(jw, var);
-dyStringPrintf(dy, "\"%s%lld\"", objRoot, id);
-}
-
-void jsonWriteListStart(struct jsonWrite *jw, char *var)
-/* Start an array in JSON. Var may be NULL */
-{
-struct dyString *dy = jw->dy;
-jsonWriteTag(jw, var);
-dyStringAppend(dy, "[\n");
-jsonWritePushObjStack(jw, FALSE);
-}
-
-void jsonWriteListEnd(struct jsonWrite *jw)
-/* End an array in JSON */
-{
-struct dyString *dy = jw->dy;
-dyStringAppend(dy, "]\n");
-jsonWritePopObjStack(jw);
-}
-
-void jsonWriteObjectStart(struct jsonWrite *jw)
-/* Print start of object */
-{
-struct dyString *dy = jw->dy;
-dyStringAppend(dy, "{\n");
-jsonWritePushObjStack(jw, FALSE);
-}
-
-void jsonWriteObjectEnd(struct jsonWrite *jw)
-/* End object in JSON */
-{
-struct dyString *dy = jw->dy;
-dyStringAppend(dy, "}\n");
-jsonWritePopObjStack(jw);
-}
-
diff --git a/gbtools/src/blatSrc/lib/keys.c b/gbtools/src/blatSrc/lib/keys.c
deleted file mode 100644
index a9e14a1..0000000
--- a/gbtools/src/blatSrc/lib/keys.c
+++ /dev/null
@@ -1,558 +0,0 @@
-/* keys.c - Stuff to manage a little key/value pair table and
- * evaluate expressions on it. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "keys.h"
-#include "kxTok.h"
-
-
-struct kvt
-/* Key/value table. */
-    {
-    int used;             /* Number of keys used in table. */
-    int alloced;          /* Number allocated in table. */
-    struct keyVal *table; /* The table itself. */
-    };
-
-struct kvt *newKvt(int size)
-/* Get a new key value table. */
-{
-struct kvt *kvt;
-AllocVar(kvt);
-kvt->alloced = size;
-kvt->table = needMem(size * sizeof(kvt->table[0]));
-return kvt;
-}
-
-
-void freeKvt(struct kvt **pKvt)
-/* Free up key value table. */
-{
-struct kvt *kvt;
-if ((kvt = *pKvt) != NULL)
-    {
-    freeMem(kvt->table);
-    freez(pKvt);
-    }
-}
-
-void kvtClear(struct kvt *kvt)
-/* Clear the keys table. */
-{
-kvt->used = 0;
-}
-
-struct keyVal *kvtAdd(struct kvt *kvt, char *key, char *val)
-/* Add in new key. */
-{
-struct keyVal *kv;
-if (kvt->used == kvt->alloced)
-    errAbort("Too many keys in keyVal(%s %s)", key, val);
-kv = &kvt->table[kvt->used++];
-kv->key = key;
-kv->val = val;
-return kv;
-}
-
-void kvtParseAdd(struct kvt *kvt, char *text)
-/* Add in keys from text.  Text is in format:
- *     key val
- * for each line of text. Text gets many of it's
- * space characters and newlines replaced by 0's
- * and should persist until call to keysClear(). */
-{
-char *lines[256];
-int lineCount;
-int i;
-char *k, *v;
-
-lineCount = chopString(text, "\n\r", lines, ArraySize(lines));
-for (i=0; i<lineCount; ++i)
-    {
-    k = lines[i];
-    if ((v = strchr(k, ' ')) != NULL)
-        {
-        *v++ = 0;
-        kvtAdd(kvt, k, v);
-        }
-    }
-}
-
-struct keyVal* kvtGet(struct kvt *kvt, char *key)
-/* get the keyVal for the specified key, of NULL if not found. */
-{
-int i;
-struct keyVal *keyTable = kvt->table;
-int keysUsed = kvt->used;
-
-for (i=0; i<keysUsed; ++i)
-    {
-    if (sameString(key, keyTable[i].key))
-        return &keyTable[i];
-    }
-return NULL;
-}
-
-char *kvtLookup(struct kvt *kvt, char *key)
-/* Search table for key.  Return key value, or NULL if
- * key not found. */
-{
-struct keyVal *keyVal = kvtGet(kvt, key);
-if (keyVal == NULL)
-    return NULL;
-else
-    return keyVal->val;
-}
-
-void kvtWriteAll(struct kvt *kvt, FILE *f, struct slName *hideList)
-/* Write all keys to file except the ones in hideList */
-{
-int i;
-static char lf = '\n';
-struct keyVal *kv = kvt->table;
-int keyCount = kvt->used;
-
-for (i=0; i<keyCount; ++i)
-    {
-    char *key = kv->key;
-    if (kv->val != NULL && !slNameInList(hideList, key))
-        fprintf(f, "%s %s\n", key, kv->val);
-    ++kv;
-    }
-mustWrite(f, &lf, 1);   /* Instead of fputc for error checking. */
-}
-
-
-/* Expression evaluator - evaluates a parsed tree. */
-enum keyExpType
-    {
-    kxMatch,
-    kxWildMatch,
-    kxGT,      /* Greater Than */
-    kxGE,      /* Greater Than or Equal */
-    kxLT,      /* Less Than */
-    kxLE,      /* Less Than or Equal */
-    kxAnd,
-    kxOr,
-    kxNot,
-    kxXor,
-    };
-
-struct exp
-    {
-    void *left;
-    void *right;
-    enum keyExpType type;
-    };
-
-static void getIntVals(struct kvt *kvt, struct exp *exp, int *retLeft, int *retRight)
-/* Look up value for key on left hand side of expression and
- * literal string from right hand side.  Convert both to ints. */
-{
-char *rightString = exp->right;
-char *leftKey = exp->left;
-char *leftString = kvtLookup(kvt, leftKey);
-
-if (leftString == NULL)
-    *retLeft = 0;
-else
-    *retLeft = atoi(leftString);
-if (rightString == NULL)
-    *retRight = 0;
-else
-    *retRight = atoi(rightString);
-}
-
-#if 0 /* unused */
-static void dumpExp(struct kvt *kvt, struct exp *exp)
-/* Print out expression. */
-{
-switch (exp->type)
-    {
-    case kxMatch:
-        {
-        char *key = exp->left;
-        char *matcher = exp->right;
-        char *val = kvtLookup(kvt, key);
-	printf("%s(%s) match %s\n", key, val, matcher);
-	break;
-        }
-    case kxWildMatch:
-        {
-        char *key = exp->left;
-        char *matcher = exp->right;
-        char *val = kvtLookup(kvt, key);
-	printf("%s(%s) wildMatch %s\n", key, val, matcher);
-	break;
-        }
-    case kxGT:
-        {
-        int left, right;
-        getIntVals(kvt, exp, &left, &right);
-	printf("%d > %d\n", left, right);
-	break;
-        }
-    case kxGE:
-        {
-        int left, right;
-        getIntVals(kvt, exp, &left, &right);
-	printf("%d >= %d\n", left, right);
-	break;
-        }
-    case kxLT:
-        {
-        int left, right;
-        getIntVals(kvt, exp, &left, &right);
-	printf("%d < %d\n", left, right);
-	break;
-        }
-    case kxLE:
-        {
-        int left, right;
-        getIntVals(kvt, exp, &left, &right);
-	printf("%d <= %d\n", left, right);
-	break;
-        }
-    
-    case kxNot:
-        {
-	printf("!\n");
-	break;
-        }
-    case kxAnd:
-        {
-	printf("&\n");
-	break;
-        }
-    case kxOr:
-        {
-	printf("|\n");
-	break;
-        }
-    case kxXor:
-        {
-	printf("^\n");
-	break;
-        }
-    }
-}
-#endif
-
-static boolean rkeyEval(struct kvt *kvt, struct exp *exp)
-/* Recursively evaluate expression. */
-{
-if (exp == NULL)
-    return TRUE;
-switch (exp->type)
-    {
-    case kxMatch:
-        {
-        char *key = exp->left;
-        char *matcher = exp->right;
-        char *val = kvtLookup(kvt, key);
-        if (val == NULL)
-            return sameWord(matcher, "null");
-        else
-            return sameWord(matcher, val);
-        }
-    case kxWildMatch:
-        {
-        char *key = exp->left;
-        char *matcher = exp->right;
-        char *val = kvtLookup(kvt, key);
-        if (val == NULL)
-            return sameString(matcher, "*");
-        else
-            return wildMatch(matcher, val);
-        }
-    case kxGT:
-        {
-        int left, right;
-        getIntVals(kvt, exp, &left, &right);
-        return left > right;
-        }
-    case kxGE:
-        {
-        int left, right;
-        getIntVals(kvt, exp, &left, &right);
-        return left >= right;
-        }
-    case kxLT:
-        {
-        int left, right;
-        getIntVals(kvt, exp, &left, &right);
-        return left < right;
-        }
-    case kxLE:
-        {
-        int left, right;
-        getIntVals(kvt, exp, &left, &right);
-        return left <= right;
-        }
-    
-    case kxNot:
-        {
-        return !rkeyEval(kvt, exp->right);
-        }
-    case kxAnd:
-        {
-        return rkeyEval(kvt, exp->left) && rkeyEval(kvt, exp->right);
-        }
-    case kxOr:
-        {
-        return rkeyEval(kvt, exp->left) || rkeyEval(kvt, exp->right);
-        }
-    case kxXor:
-        {
-        return rkeyEval(kvt, exp->left) ^ rkeyEval(kvt, exp->right);
-        }
-    default:
-        {
-	errAbort("unknown expression type %d", exp->type);
-	return 0;
-	}
-    }
-}
-
-boolean keyExpEval(struct keyExp *keyExp, struct kvt *kvt)
-/* Evaluate key expression. */
-{
-return rkeyEval(kvt, keyExp->rootExp);
-}
-
-/***** A little recursive descent parser. *****/
-
-static struct kxTok *token;      /* Next token for parser. */
-
-static void advanceToken()
-/* Move to next token. */
-{
-token = token->next;
-}
-
-static struct exp *nextExp();       /* Get next expression. */
-
-static struct exp *parseRelation()
-/* Parse key=wildcard. */
-{
-struct kxTok *key, *match;
-
-if (token == NULL)
-    return NULL;
-if (token->type != kxtString)
-    errAbort("Expecting key got %s", token->string);
-key = token;
-advanceToken();
-if (token->type == kxtEquals)
-    {
-    advanceToken();
-    if (token->type == kxtString || token->type == kxtWildString)
-        {
-        struct exp *exp;
-        match = token;
-        advanceToken();
-        AllocVar(exp);
-        exp->left = key->string;
-        exp->right = match->string;
-        exp->type = (match->type == kxtString ? kxMatch : kxWildMatch);
-        return exp;
-        }
-    else
-        {
-        errAbort("Expecting string to match in key=match expression,\ngot %s", token->string);
-        }
-    }
-else if (token->type == kxtGT || token->type == kxtGE || token->type == kxtLT || token->type == kxtLE)
-    {
-    enum kxTokType relation = token->type;
-    advanceToken();
-    if (isdigit(token->string[0]))
-        {
-        struct exp *exp;
-        match = token;
-        advanceToken();
-        AllocVar(exp);
-        exp->left = key->string;
-        exp->right = match->string;
-        if (relation == kxtGT) exp->type = kxGT;
-        else if (relation == kxtGE) exp->type = kxGE;
-        else if (relation == kxtLT) exp->type = kxLT;
-        else if (relation == kxtLE) exp->type = kxLE;
-        return exp;
-        }
-    else
-        {
-        errAbort("Expecting number got %s", token->string);
-        }
-    }
-else
-    errAbort("Expecting = got %s", token->string);
-return NULL;
-}
-
-static struct exp *parseParenthesized()
-/* Parse parenthesized expressions. */
-{
-struct exp *exp;
-if (token == NULL)
-    return NULL;
-if (token->type == kxtOpenParen)
-    {
-    advanceToken();
-    exp = nextExp();
-    if (token->type != kxtCloseParen)
-        errAbort("Unmatched parenthesis");
-    advanceToken();
-    return exp;
-    }
-else
-    {
-    return parseRelation();
-    }            
-}
-
-static struct exp *parseNot()
-/* Parse not */
-{
-struct exp *exp;
-struct exp *right;
-
-if (token == NULL)
-    return NULL;
-if (token->type == kxtNot)
-    {
-    advanceToken();
-    right = nextExp();
-    AllocVar(exp);
-    exp->right = right;
-    exp->type = kxNot;
-    return exp;
-    }
-else
-    return parseParenthesized();
-}
-
-static struct exp *parseAndExp()
-/* Parse and level expressions. */
-{
-struct exp *left;
-struct exp *right, *exp;
-struct kxTok *tok;
-enum kxTokType type;
-
-if ((left = parseNot()) == NULL)
-    return NULL;
-if ((tok = token) == NULL)
-    return left;
-type = token->type;
-if (type == kxtAnd)
-    {
-    advanceToken();
-    right = nextExp();
-    if (right == NULL)
-        errAbort("Expecting expression on the other side of %s", tok->string);
-    AllocVar(exp);
-    exp->left = left;
-    exp->right = right;
-    exp->type = kxAnd;
-    return exp;
-    }
-else
-    return left;    
-}
-
-static struct exp *parseOrExp()
-/* Parse lowest level of precedent expressions - or and xor. */
-{
-struct exp *left;
-struct exp *right, *exp;
-struct kxTok *tok;
-enum kxTokType type;
-
-if ((left = parseAndExp()) == NULL)
-    return NULL;
-if ((tok = token) == NULL)
-    return left;
-type = token->type;
-if (type == kxtOr || type == kxtXor)
-    {
-    advanceToken();
-    right = nextExp();
-    if (right == NULL)
-        errAbort("Expecting expression on the other side of %s", tok->string);
-    AllocVar(exp);
-    exp->left = left;
-    exp->right = right;
-    if (type == kxtOr)
-        exp->type = kxOr;
-    else
-        exp->type = kxXor;
-    return exp;
-    }
-else
-    return left;    
-}
-
-static struct exp *nextExp()
-/* Get another expression. */
-{
-return parseOrExp();
-}
-
-static struct exp *parseExp(struct kxTok *tokList)
-/* Convert key expression from token stream to parse tree. */
-{
-struct exp *exp;
-token = tokList;
-exp =  nextExp();
-if (token->type != kxtEnd)
-    {
-    errAbort("Extra tokens past end of expression.  Missing &?");
-    }
-return exp;
-}
-
-struct keyExp *keyExpParse(char *text)
-/* Parse text into key expression.  Squawk and die if it
- * fails. */
-{
-struct keyExp *ke;
-struct kxTok *tok;
-AllocVar(ke);
-ke->tokenList = tok = kxTokenize(text, TRUE);
-ke->rootExp = parseExp(tok);
-
-return ke;
-}
-
-
-
-boolean keyTextScan(char *text, char *key, char *valBuf, int valBufSize)
-/* Get value of key. Return FALSE if key doesn't exist. */
-{
-int keySize = strlen(key);
-char *s, *nl;
-boolean ok = FALSE;
-
-for (s = text; !isspace(s[0]); s = nl+1)
-    {
-    nl = strchr(s, '\n');
-    assert(nl != NULL);
-    if (s[keySize] == ' ' && memcmp(s, key, keySize) == 0)
-        {
-        char *val = s + keySize + 1;
-        int valSize = nl - val;
-        if (valSize >= valBufSize)
-            valSize = valBufSize-1;
-        memcpy(valBuf, val, valSize);
-        valBuf[valSize] = 0;
-        ok = TRUE;
-        break;
-        }
-    }
-return ok;
-}
-
diff --git a/gbtools/src/blatSrc/lib/knetUdc.c b/gbtools/src/blatSrc/lib/knetUdc.c
deleted file mode 100644
index 4bbf9c2..0000000
--- a/gbtools/src/blatSrc/lib/knetUdc.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* knetUdc -- install udc i/o functions in knetfile interface in samtools. */
-/* As of 2/23/10, the KNETFILE_HOOKS extension is a UCSC-local modification of samtools. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#if ((defined USE_BAM || defined USE_TABIX) && defined KNETFILE_HOOKS)
-
-#include "common.h"
-#include "udc.h"
-#include "knetUdc.h"
-#include "knetfile.h"
-
-
-struct knetFile_s {
-    struct udcFile *udcf;
-}; // typedef'd to knetFile in knetfile.h
-
-static char *udcCacheDir = NULL;
-
-static knetFile *kuOpen(const char *filename, const char *mode)
-/* Open the given filename with mode which must be "r". */
-{
-if (!sameOk((char *)mode, "r"))
-    errAbort("mode passed to kuOpen must be 'r' not '%s'", mode);
-struct udcFile *udcf = udcFileMayOpen((char *)filename, udcCacheDir);
-if (udcf == NULL)
-    return NULL;
-knetFile *kf = NULL;
-AllocVar(kf);
-kf->udcf = udcf;
-verbose(2, "kuOpen: returning %lu\n", (unsigned long)(kf->udcf));
-return kf;
-}
-
-static knetFile *kuDopen(int fd, const char *mode)
-/* Open from a file descriptor -- not necessary for our use of samtools. */
-{
-errAbort("kuDopen not implemented");
-return NULL;
-}
-
-static off_t kuRead(knetFile *fp, void *buf, off_t len)
-/* Read len bytes into buf, return amount actually read. */
-{
-verbose(2, "udcRead(%lu, buf, %lld)\n", (unsigned long)(fp->udcf), (long long)len);
-return (off_t)udcRead(fp->udcf, buf, (int)len);
-}
-
-static off_t kuSeek(knetFile *fp, int64_t off, int whence)
-/* Seek to off according to whence (but don't waste time with samtools' SEEK_END to
- * check empty record at end of file.  Don't be fooled by the off_t return type --
- * it's 0 for OK, non-0 for fail. */
-{
-bits64 offset;
-if (whence == SEEK_SET)
-    offset = off;
-else if (whence == SEEK_CUR)
-    offset = off+ udcTell(fp->udcf);
-else
-    return -1;
-verbose(2, "udcSeek(%lu, %lld)\n", (unsigned long)(fp->udcf), offset);
-udcSeek(fp->udcf, offset);
-return 0;
-}
-
-static off_t kuTell(knetFile *fp)
-/* Tell current offset in file. */
-{
-verbose(2, "udcTell(%lu)\n", (unsigned long)(fp->udcf));
-return udcTell(fp->udcf);
-}
-
-static int kuClose(knetFile *fp)
-/* Close and free fp->udcf. */
-{
-verbose(2, "udcClose(%lu)\n", (unsigned long)(fp->udcf));
-udcFileClose(&(fp->udcf));
-return 0;
-}
-
-void knetUdcInstall()
-/* install udc i/o functions in knetfile interface in Heng Li's samtools lib. */
-{
-// maybe init udcCacheDir from hg.conf?
-knet_init_alt(kuOpen, kuDopen, kuRead, kuSeek, kuTell, kuClose);
-}
-
-
-#else// no (USE_BAM || USE_TABIX) && KNETFILE_HOOKS
-
-void knetUdcInstall()
-/* Required libs aren't installed; do nothing. */
-{
-}
-
-#endif
diff --git a/gbtools/src/blatSrc/lib/kxTok.c b/gbtools/src/blatSrc/lib/kxTok.c
deleted file mode 100644
index a9801e0..0000000
--- a/gbtools/src/blatSrc/lib/kxTok.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/* kxTok - quick little tokenizer for stuff first
- * loaded into memory.  Originally developed for
- * "Key eXpression" evaluator. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "kxTok.h"
-
-
-boolean includeQuotes = FALSE;
-
-static struct kxTok *kxTokNew(enum kxTokType type, char *string, int stringSize,
-	boolean spaceBefore)
-/* Allocate and initialize a new token. */
-{
-struct kxTok *tok;
-int totalSize = stringSize + sizeof(*tok);
-tok = needMem(totalSize);
-tok->type = type;
-tok->spaceBefore = spaceBefore;
-memcpy(tok->string, string, stringSize);
-return tok;
-}
-
-struct kxTok *kxTokenizeFancy(char *text, boolean wildAst,
-			      boolean wildPercent, boolean includeHyphen)
-/* Convert text to stream of tokens. If 'wildAst' is
- * TRUE then '*' character will be treated as wildcard
- * rather than multiplication sign.  
- * If wildPercent is TRUE then the '%' character will be treated as a 
- * wildcard (as in SQL) rather than a modulo (kxtMod) or percent sign.
- * If includeHyphen is TRUE then a '-' character in the middle of a String 
- * token will be treated as a hyphen (part of the String token) instead of 
- * a new kxtSub token. */
-{
-struct kxTok *tokList = NULL, *tok;
-char c, *s, *start = NULL, *end = NULL;
-enum kxTokType type = 0;
-boolean spaceBefore = FALSE;
-
-s = text;
-for (;;)
-    {
-    if ((c = *s) == 0)
-        break;
-    start = s++;
-    if (isspace(c))
-        {
-	spaceBefore = TRUE;
-        continue;
-        }
-    else if (isalnum(c) || c == '?' || (wildAst && c == '*') ||
-	     (wildPercent && c == '%'))
-        {
-        if (c == '?')
-            type = kxtWildString;
-	else if (wildAst && c == '*')
-            type = kxtWildString;
-	else if (wildPercent && c == '%')
-            type = kxtWildString;
-        else
-            type = kxtString;
-        for (;;)
-            {
-            c = *s;
-            if (isalnum(c) || c == ':' || c == '_' || c == '.' ||
-		(includeHyphen && c == '-'))
-                ++s;
-            else if (c == '?' || (wildAst && c == '*') ||
-		     (wildPercent && c == '%'))
-                {
-                type = kxtWildString;
-                ++s;
-                }
-            else
-                break;
-            }
-        end = s;
-        }
-    else if (c == '"')
-        {
-        type = kxtString;
-        if (! includeQuotes)
-	    start = s;
-        for (;;)
-            {
-            c = *s++;
-            if (c == '"')
-                break;
-            if (c == '*' || c == '?' || (wildPercent && c == '%'))
-                type = kxtWildString;
-            }
-	if (! includeQuotes)
-	    end = s-1;
-	else
-	    end = s;
-        }
-    else if (c == '\'')
-        {
-        type = kxtString;
-        if (! includeQuotes)
-	    start = s;
-        for (;;)
-            {
-            c = *s++;
-            if (c == '\'')
-                break;
-            if (c == '*' || c == '?' || (wildPercent && c == '%'))
-                type = kxtWildString;
-            }
-	if (! includeQuotes)
-	    end = s-1;
-	else
-	    end = s;
-        } 
-    else if (c == '=')
-        {
-        type = kxtEquals;
-        end = s;
-        }
-    else if (c == '&')
-        {
-        type = kxtAnd;
-        end = s;
-        }
-    else if (c == '|')
-        {
-        type = kxtOr;
-        end = s;
-        }
-    else if (c == '^')
-        {
-        type = kxtXor;
-        end = s;
-        }
-    else if (c == '+')
-        {
-	type = kxtAdd;
-	end = s;
-	}
-    else if (c == '-')
-        {
-	type = kxtSub;
-	end = s;
-	}
-    else if (c == '*')
-        {
-	type = kxtMul;
-	end = s;
-	}
-    else if (c == '/')
-        {
-	type = kxtDiv;
-	end = s;
-	}
-    else if (c == '(')
-        {
-        type = kxtOpenParen;
-        end = s;
-        }
-    else if (c == ')')
-        {
-        type = kxtCloseParen;
-        end = s;
-        }
-    else if (c == '!')
-        {
-        type = kxtNot;
-        end = s;
-        }
-    else if (c == '>')
-        {
-        if (*s == '=')
-            {
-            ++s;
-            type = kxtGE;
-            }
-        else
-            type = kxtGT;
-        end = s;
-        }
-    else if (c == '<')
-        {
-        if (*s == '=')
-            {
-            ++s;
-            type = kxtLE;
-            }
-        else
-            type = kxtLT;
-        end = s;
-        }
-    else if (c == '.')
-        {
-        type = kxtDot;
-        end = s;
-	}
-    else if (c == '%')
-        {
-        type = kxtMod;
-        end = s;
-	}
-    else if (ispunct(c))
-        {
-        type = kxtPunct;
-        end = s;
-	}
-    else
-        {
-        errAbort("Unrecognized character %c", c);
-        }
-    tok = kxTokNew(type, start, end-start, spaceBefore);
-    slAddHead(&tokList, tok);
-    spaceBefore = FALSE;
-    }
-tok = kxTokNew(kxtEnd, "end", 3, spaceBefore);
-slAddHead(&tokList, tok);
-slReverse(&tokList);
-return tokList;
-}
-
-
-struct kxTok *kxTokenize(char *text, boolean wildAst)
-/* Convert text to stream of tokens. If 'wildAst' is
- * TRUE then '*' character will be treated as wildcard
- * rather than multiplication sign. */
-{
-return kxTokenizeFancy(text, wildAst, FALSE, FALSE);
-}
-
-void kxTokIncludeQuotes(boolean val)
-/* Pass in TRUE if kxTok should include quote characters in string tokens. */
-{
-includeQuotes = val;
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/lineFileOnBigBed.c b/gbtools/src/blatSrc/lib/lineFileOnBigBed.c
deleted file mode 100644
index eec1035..0000000
--- a/gbtools/src/blatSrc/lib/lineFileOnBigBed.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* lineFileOnBigBed - set up lineFile support on a BigBed
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "linefile.h"
-#include "localmem.h"
-#include "bigBed.h"
-
-struct lfBigBedData
-/* data used during callbacks */
-    {	
-    struct bbiFile *bbiHandle;                            // BigBed handle
-    struct bbiChromInfo *bbiChrom, *bbiChromList;         // BigBed chrom info
-    struct lm *bbiLm;                                     // BigBed local memory
-    struct bigBedInterval *bbiInterval, *bbiIntervalList; // BigBed intervals
-    };
-
-void checkBigBedSupport(struct lineFile *lf, char *where)
-/* abort if not supported by bigBed */
-{
-if (sameString(where,"lineFileSeek"))
-    lineFileAbort(lf, "%s: not supported for lineFile on BigBed.", where);
-}
-
-boolean lineFileNextBigBed(struct lineFile *lf, char **retStart, int *retSize)
-/* skip to the next line */
-{
-struct lfBigBedData *lfBigBedData = lf->dataForCallBack;
-int lineSize = 0;
-if (!lfBigBedData->bbiChrom)
-    return FALSE;
-if (!lfBigBedData->bbiInterval)
-    return FALSE;
-lineSize = 1024; // some extra room
-lineSize += strlen(lfBigBedData->bbiChrom->name);
-if (lfBigBedData->bbiInterval->rest)
-    lineSize += strlen(lfBigBedData->bbiInterval->rest);
-
-if (lineSize > lf->bufSize)
-    lineFileExpandBuf(lf, lineSize * 2);
-safef(lf->buf, lf->bufSize, "%s\t%u\t%u", lfBigBedData->bbiChrom->name, lfBigBedData->bbiInterval->start, lfBigBedData->bbiInterval->end);
-if (lfBigBedData->bbiInterval->rest)
-    {
-    safecat(lf->buf, lf->bufSize, "\t");
-    safecat(lf->buf, lf->bufSize, lfBigBedData->bbiInterval->rest);
-    }
-lf->bufOffsetInFile = -1;
-lf->bytesInBuf = strlen(lf->buf);
-lf->lineIx++;
-lf->lineStart = 0;
-lf->lineEnd = lineSize;
-*retStart = lf->buf;
-if (retSize != NULL)
-    *retSize = lineSize;
-
-lfBigBedData->bbiInterval = lfBigBedData->bbiInterval->next;
-if (!lfBigBedData->bbiInterval)
-    {
-    lmCleanup(&lfBigBedData->bbiLm);
-    lfBigBedData->bbiLm = lmInit(0);
-    lfBigBedData->bbiChrom = lfBigBedData->bbiChrom->next;
-    if(lfBigBedData->bbiChrom)
-	lfBigBedData->bbiIntervalList = bigBedIntervalQuery(
-	    lfBigBedData->bbiHandle, lfBigBedData->bbiChrom->name, 0, lfBigBedData->bbiChrom->size, 0, lfBigBedData->bbiLm);
-    }
-
-return TRUE;
-}
-
-void lineFileCloseBigBed(struct lineFile *lf)
-/* release bigBed resources */
-{
-struct lfBigBedData *lfBigBedData = lf->dataForCallBack;
-lmCleanup(&lfBigBedData->bbiLm);
-bbiChromInfoFreeList(&lfBigBedData->bbiChromList);
-bbiFileClose(&lfBigBedData->bbiHandle);
-freez(&lf->dataForCallBack);
-}
-
-
-struct lineFile *lineFileOnBigBed(char *bigBedFileName)
-/* Wrap a line file object around a BigBed. */
-{
-struct lineFile *lf;
-AllocVar(lf);
-lf->fileName = cloneString(bigBedFileName);
-struct lfBigBedData *lfBigBedData;
-AllocVar(lfBigBedData);
-lf->dataForCallBack = lfBigBedData;
-lfBigBedData->bbiHandle = bigBedFileOpen(lf->fileName);
-lfBigBedData->bbiChromList = bbiChromList(lfBigBedData->bbiHandle);
-lfBigBedData->bbiChrom = lfBigBedData->bbiChromList;
-lfBigBedData->bbiLm = lmInit(0);
-if (lfBigBedData->bbiChrom)
-    {
-    lfBigBedData->bbiIntervalList = bigBedIntervalQuery(
-	lfBigBedData->bbiHandle, lfBigBedData->bbiChrom->name, 0, lfBigBedData->bbiChrom->size, 0, lfBigBedData->bbiLm);
-    lfBigBedData->bbiInterval = lfBigBedData->bbiIntervalList;
-    }
-lf->checkSupport = checkBigBedSupport;
-lf->nextCallBack = lineFileNextBigBed;
-lf->closeCallBack = lineFileCloseBigBed;
-lf->fd = -1;
-lf->lineIx = 0;
-lf->bufSize = 64 * 1024;
-lf->buf = needMem(lf->bufSize);
-return lf;
-}
-
diff --git a/gbtools/src/blatSrc/lib/linefile.c b/gbtools/src/blatSrc/lib/linefile.c
deleted file mode 100644
index 5416c24..0000000
--- a/gbtools/src/blatSrc/lib/linefile.c
+++ /dev/null
@@ -1,1450 +0,0 @@
-/* lineFile - stuff to rapidly read text files and parse them into
- * lines.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "hash.h"
-#include <fcntl.h>
-#include <signal.h>
-#include "dystring.h"
-#include "errAbort.h"
-#include "linefile.h"
-#include "pipeline.h"
-#include "localmem.h"
-#include "cheapcgi.h"
-#include "udc.h"
-
-char *getFileNameFromHdrSig(char *m)
-/* Check if header has signature of supported compression stream,
-   and return a phoney filename for it, or NULL if no sig found. */
-{
-char buf[20];
-char *ext=NULL;
-if (startsWith("\x1f\x8b",m)) ext = "gz";
-else if (startsWith("\x1f\x9d\x90",m)) ext = "Z";
-else if (startsWith("BZ",m)) ext = "bz2";
-else if (startsWith("PK\x03\x04",m)) ext = "zip";
-if (ext==NULL)
-    return NULL;
-safef(buf, sizeof(buf), LF_BOGUS_FILE_PREFIX "%s", ext);
-return cloneString(buf);
-}
-
-static char **getDecompressor(char *fileName)
-/* if a file is compressed, return the command to decompress the
- * approriate format, otherwise return NULL */
-{
-static char *GZ_READ[] = {"gzip", "-dc", NULL};
-static char *Z_READ[] = {"gzip", "-dc", NULL};
-static char *BZ2_READ[] = {"bzip2", "-dc", NULL};
-static char *ZIP_READ[] = {"gzip", "-dc", NULL};
-
-char **result = NULL;
-char *fileNameDecoded = cloneString(fileName);
-if (startsWith("http://" , fileName)
- || startsWith("https://", fileName)
- || startsWith("ftp://",   fileName))
-    cgiDecode(fileName, fileNameDecoded, strlen(fileName));
-
-if      (endsWith(fileNameDecoded, ".gz"))
-    result = GZ_READ;
-else if (endsWith(fileNameDecoded, ".Z"))
-    result = Z_READ;
-else if (endsWith(fileNameDecoded, ".bz2"))
-    result = BZ2_READ;
-else if (endsWith(fileNameDecoded, ".zip"))
-    result = ZIP_READ;
-
-freeMem(fileNameDecoded);
-return result;
-
-}
-
-static void metaDataAdd(struct lineFile *lf, char *line)
-/* write a line of metaData to output file
- * internal function called by lineFileNext */
-{
-struct metaOutput *meta = NULL;
-
-if (lf->isMetaUnique)
-    {
-    /* suppress repetition of comments */
-    if (hashLookup(lf->metaLines, line))
-        {
-        return;
-        }
-    hashAdd(lf->metaLines, line, NULL);
-    }
-for (meta = lf->metaOutput ; meta != NULL ; meta = meta->next)
-    if (line != NULL && meta->metaFile != NULL)
-        fprintf(meta->metaFile,"%s\n", line);
-}
-
-static void metaDataFree(struct lineFile *lf)
-/* free saved comments */
-{
-if (lf->isMetaUnique && lf->metaLines)
-    freeHash(&lf->metaLines);
-}
-
-void lineFileSetMetaDataOutput(struct lineFile *lf, FILE *f)
-/* set file to write meta data to,
- * should be called before reading from input file */
-{
-struct metaOutput *meta = NULL;
-if (lf == NULL)
-    return;
-AllocVar(meta);
-meta->next = NULL;
-meta->metaFile = f;
-slAddHead(&lf->metaOutput, meta);
-}
-
-void lineFileSetUniqueMetaData(struct lineFile *lf)
-/* suppress duplicate lines in metadata */
-{
-lf->isMetaUnique = TRUE;
-lf->metaLines = hashNew(8);
-}
-
-static char * headerBytes(char *fileName, int numbytes)
-/* Return specified number of header bytes from file
- * if file exists as a string which should be freed. */
-{
-int fd,bytesread=0;
-char *result = NULL;
-if ((fd = open(fileName, O_RDONLY)) >= 0)
-    {
-    result=needMem(numbytes+1);
-    if ((bytesread=read(fd,result,numbytes)) < numbytes)
-	freez(&result);  /* file too short? can read numbytes */
-    else
-	result[numbytes]=0;
-    close(fd);
-    }
-return result;
-}
-
-
-struct lineFile *lineFileDecompress(char *fileName, bool zTerm)
-/* open a linefile with decompression */
-{
-struct pipeline *pl;
-struct lineFile *lf;
-char *testName = NULL;
-char *testbytes = NULL;    /* the header signatures for .gz, .bz2, .Z,
-			    * .zip are all 2-4 bytes only */
-if (fileName==NULL)
-  return NULL;
-testbytes=headerBytes(fileName,4);
-if (!testbytes)
-    return NULL;  /* avoid error from pipeline */
-testName=getFileNameFromHdrSig(testbytes);
-freez(&testbytes);
-if (!testName)
-    return NULL;  /* avoid error from pipeline */
-pl = pipelineOpen1(getDecompressor(fileName), pipelineRead|pipelineSigpipe, fileName, NULL);
-lf = lineFileAttach(fileName, zTerm, pipelineFd(pl));
-lf->pl = pl;
-return lf;
-}
-
-struct lineFile *lineFileDecompressFd(char *name, bool zTerm, int fd)
-/* open a linefile with decompression from a file or socket descriptor */
-{
-struct pipeline *pl;
-struct lineFile *lf;
-pl = pipelineOpenFd1(getDecompressor(name), pipelineRead|pipelineSigpipe, fd, STDERR_FILENO);
-lf = lineFileAttach(name, zTerm, pipelineFd(pl));
-lf->pl = pl;
-return lf;
-}
-
-
-
-struct lineFile *lineFileDecompressMem(bool zTerm, char *mem, long size)
-/* open a linefile with decompression from a memory stream */
-{
-struct pipeline *pl;
-struct lineFile *lf;
-char *fileName = getFileNameFromHdrSig(mem);
-if (fileName==NULL)
-  return NULL;
-pl = pipelineOpenMem1(getDecompressor(fileName), pipelineRead|pipelineSigpipe, mem, size, STDERR_FILENO);
-lf = lineFileAttach(fileName, zTerm, pipelineFd(pl));
-lf->pl = pl;
-return lf;
-}
-
-
-
-struct lineFile *lineFileAttach(char *fileName, bool zTerm, int fd)
-/* Wrap a line file around an open'd file. */
-{
-struct lineFile *lf;
-AllocVar(lf);
-lf->fileName = cloneString(fileName);
-lf->fd = fd;
-lf->bufSize = 64*1024;
-lf->zTerm = zTerm;
-lf->buf = needMem(lf->bufSize+1);
-return lf;
-}
-
-struct lineFile *lineFileOnString(char *name, bool zTerm, char *s)
-/* Wrap a line file object around string in memory. This buffer
- * have zeroes written into it and be freed when the line file
- * is closed. */
-{
-struct lineFile *lf;
-AllocVar(lf);
-lf->fileName = cloneString(name);
-lf->fd = -1;
-lf->bufSize = lf->bytesInBuf = strlen(s);
-lf->zTerm = zTerm;
-lf->buf = s;
-return lf;
-}
-
-#if (defined USE_TABIX && defined KNETFILE_HOOKS && !defined USE_SAMTABIX)
-// UCSC aliases for backwards compatibility with independently patched & linked samtools and tabix:
-#define bgzf_tell ti_bgzf_tell
-#define bgzf_read ti_bgzf_read
-#endif
-
-struct lineFile *lineFileTabixMayOpen(char *fileOrUrl, bool zTerm)
-/* Wrap a line file around a data file that has been compressed and indexed
- * by the tabix command line program.  The index file <fileOrUrl>.tbi must be
- * readable in addition to fileOrUrl. If there's a problem, warn & return NULL.
- * This works only if kent/src has been compiled with USE_TABIX=1 and linked
- * with the tabix C library. */
-{
-#ifdef USE_TABIX
-if (fileOrUrl == NULL)
-    errAbort("lineFileTabixMayOpen: fileOrUrl is NULL");
-int tbiNameSize = strlen(fileOrUrl) + strlen(".tbi") + 1;
-char tbiName[tbiNameSize];
-safef(tbiName, sizeof(tbiName), "%s.tbi", fileOrUrl);
-tabix_t *tabix = ti_open(fileOrUrl, tbiName);
-if (tabix == NULL)
-    {
-    warn("Unable to open \"%s\"", fileOrUrl);
-    return NULL;
-    }
-if ((tabix->idx = ti_index_load(tbiName)) == NULL)
-    {
-    warn("Unable to load tabix index from \"%s\"", tbiName);
-    ti_close(tabix);
-    tabix = NULL;
-    return NULL;
-    }
-struct lineFile *lf = needMem(sizeof(struct lineFile));
-lf->fileName = cloneString(fileOrUrl);
-lf->fd = -1;
-lf->bufSize = 64 * 1024;
-lf->buf = needMem(lf->bufSize);
-lf->zTerm = zTerm;
-lf->tabix = tabix;
-lf->tabixIter = ti_iter_first();
-return lf;
-#else // no USE_TABIX
-warn(COMPILE_WITH_TABIX, "lineFileTabixMayOpen");
-return NULL;
-#endif // no USE_TABIX
-}
-
-boolean lineFileSetTabixRegion(struct lineFile *lf, char *seqName, int start, int end)
-/* Assuming lf was created by lineFileTabixMayOpen, tell tabix to seek to the specified region
- * and return TRUE (or if there are no items in region, return FALSE). */
-{
-#ifdef USE_TABIX
-if (lf->tabix == NULL)
-    errAbort("lineFileSetTabixRegion: lf->tabix is NULL.  Did you open lf with lineFileTabixMayOpen?");
-if (seqName == NULL)
-    return FALSE;
-int tabixSeqId = ti_get_tid(lf->tabix->idx, seqName);
-if (tabixSeqId < 0 && startsWith("chr", seqName))
-    // We will get some files that have chr-less Ensembl chromosome names:
-    tabixSeqId = ti_get_tid(lf->tabix->idx, seqName+strlen("chr"));
-if (tabixSeqId < 0)
-    return FALSE;
-ti_iter_t iter = ti_queryi(lf->tabix, tabixSeqId, start, end);
-if (iter == NULL)
-    return FALSE;
-if (lf->tabixIter != NULL)
-    ti_iter_destroy(lf->tabixIter);
-lf->tabixIter = iter;
-lf->bufOffsetInFile = bgzf_tell(lf->tabix->fp);
-lf->bytesInBuf = 0;
-lf->lineIx = -1;
-lf->lineStart = 0;
-lf->lineEnd = 0;
-return TRUE;
-#else // no USE_TABIX
-warn(COMPILE_WITH_TABIX, "lineFileSetTabixRegion");
-return FALSE;
-#endif // no USE_TABIX
-}
-
-struct lineFile *lineFileUdcMayOpen(char *fileOrUrl, bool zTerm)
-/* Create a line file object with an underlying UDC cache. NULL if not found. */
-{
-if (fileOrUrl == NULL)
-    errAbort("lineFileUdcMayOpen: fileOrUrl is NULL");
-
-struct udcFile *udcFile = udcFileMayOpen(fileOrUrl, NULL);
-if (udcFile == NULL)
-    return NULL;
-
-struct lineFile *lf;
-AllocVar(lf);
-lf->fileName = cloneString(fileOrUrl);
-lf->fd = -1;
-lf->bufSize = 0;
-lf->buf = NULL;
-lf->zTerm = zTerm;
-lf->udcFile = udcFile;
-return lf;
-}
-
-
-void lineFileExpandBuf(struct lineFile *lf, int newSize)
-/* Expand line file buffer. */
-{
-assert(newSize > lf->bufSize);
-lf->buf = needMoreMem(lf->buf, lf->bytesInBuf, newSize);
-lf->bufSize = newSize;
-}
-
-
-struct lineFile *lineFileStdin(bool zTerm)
-/* Wrap a line file around stdin. */
-{
-return lineFileAttach("stdin", zTerm, fileno(stdin));
-}
-
-struct lineFile *lineFileMayOpen(char *fileName, bool zTerm)
-/* Try and open up a lineFile. */
-{
-if (sameString(fileName, "stdin"))
-    return lineFileStdin(zTerm);
-else if (getDecompressor(fileName) != NULL)
-    return lineFileDecompress(fileName, zTerm);
-else
-    {
-    int fd = open(fileName, O_RDONLY);
-    if (fd == -1)
-        return NULL;
-    return lineFileAttach(fileName, zTerm, fd);
-    }
-}
-
-struct lineFile *lineFileOpen(char *fileName, bool zTerm)
-/* Open up a lineFile or die trying. */
-{
-struct lineFile *lf = lineFileMayOpen(fileName, zTerm);
-if (lf == NULL)
-    errAbort("Couldn't open %s , %s", fileName, strerror(errno));
-return lf;
-}
-
-void lineFileReuse(struct lineFile *lf)
-/* Reuse current line. */
-{
-lf->reuse = TRUE;
-}
-
-
-INLINE void noTabixSupport(struct lineFile *lf, char *where)
-{
-#ifdef USE_TABIX
-if (lf->tabix != NULL)
-    lineFileAbort(lf, "%s: not implemented for lineFile opened with lineFileTabixMayOpen.", where);
-#endif // USE_TABIX
-}
-
-void lineFileSeek(struct lineFile *lf, off_t offset, int whence)
-/* Seek to read next line from given position. */
-{
-noTabixSupport(lf, "lineFileSeek");
-if (lf->checkSupport)
-    lf->checkSupport(lf, "lineFileSeek");
-if (lf->pl != NULL)
-    errnoAbort("Can't lineFileSeek on a compressed file: %s", lf->fileName);
-lf->reuse = FALSE;
-if (lf->udcFile)
-    {
-    udcSeek(lf->udcFile, offset);
-    return;
-    }
-lf->lineStart = lf->lineEnd = lf->bytesInBuf = 0;
-if ((lf->bufOffsetInFile = lseek(lf->fd, offset, whence)) == -1)
-    errnoAbort("Couldn't lineFileSeek %s", lf->fileName);
-}
-
-void lineFileRewind(struct lineFile *lf)
-/* Return lineFile to start. */
-{
-lineFileSeek(lf, 0, SEEK_SET);
-lf->lineIx = 0;
-}
-
-int lineFileLongNetRead(int fd, char *buf, int size)
-/* Keep reading until either get no new characters or
- * have read size */
-{
-int oneSize, totalRead = 0;
-
-while (size > 0)
-    {
-    oneSize = read(fd, buf, size);
-    if (oneSize <= 0)
-        break;
-    totalRead += oneSize;
-    buf += oneSize;
-    size -= oneSize;
-    }
-return totalRead;
-}
-
-static void determineNlType(struct lineFile *lf, char *buf, int bufSize)
-/* determine type of newline used for the file, assumes buffer not empty */
-{
-char *c = buf;
-if (bufSize==0) return;
-if (lf->nlType != nlt_undet) return;  /* if already determined just exit */
-lf->nlType = nlt_unix;  /* start with default of unix lf type */
-while (c < buf+bufSize)
-    {
-    if (*c=='\r')
-	{
-    	lf->nlType = nlt_mac;
-	if (++c < buf+bufSize)
-    	    if (*c == '\n')
-    		lf->nlType = nlt_dos;
-	return;
-	}
-    if (*(c++) == '\n')
-	{
-	return;
-	}
-    }
-}
-
-boolean lineFileNext(struct lineFile *lf, char **retStart, int *retSize)
-/* Fetch next line from file. */
-{
-char *buf = lf->buf;
-int bytesInBuf = lf->bytesInBuf;
-int endIx = lf->lineEnd;
-boolean gotLf = FALSE;
-int newStart;
-
-if (lf->reuse)
-    {
-    lf->reuse = FALSE;
-    if (retSize != NULL)
-	*retSize = lf->lineEnd - lf->lineStart;
-    *retStart = buf + lf->lineStart;
-    if (lf->metaOutput && *retStart[0] == '#')
-        metaDataAdd(lf, *retStart);
-    return TRUE;
-    }
-
-if (lf->nextCallBack)
-    return lf->nextCallBack(lf, retStart, retSize);
-
-if (lf->udcFile)
-    {
-    lf->bufOffsetInFile = udcTell(lf->udcFile);
-    char *line = udcReadLine(lf->udcFile);
-    if (line==NULL)
-        return FALSE;
-    int lineSize = strlen(line);
-    lf->bytesInBuf = lineSize;
-    lf->lineIx = -1;
-    lf->lineStart = 0;
-    lf->lineEnd = lineSize;
-    *retStart = line;
-    freeMem(lf->buf);
-    lf->buf = line;
-    lf->bufSize = lineSize;
-    return TRUE;
-    }
-
-#ifdef USE_TABIX
-if (lf->tabix != NULL && lf->tabixIter != NULL)
-    {
-    // Just use line-oriented ti_read:
-    int lineSize = 0;
-    const char *line = ti_read(lf->tabix, lf->tabixIter, &lineSize);
-    if (line == NULL)
-	return FALSE;
-    lf->bufOffsetInFile = -1;
-    lf->bytesInBuf = lineSize;
-    lf->lineIx = -1;
-    lf->lineStart = 0;
-    lf->lineEnd = lineSize;
-    if (lineSize > lf->bufSize)
-	// shouldn't be!  but just in case:
-	lineFileExpandBuf(lf, lineSize * 2);
-    safecpy(lf->buf, lf->bufSize, line);
-    *retStart = lf->buf;
-    if (retSize != NULL)
-	*retSize = lineSize;
-    return TRUE;
-    }
-#endif // USE_TABIX
-
-determineNlType(lf, buf+endIx, bytesInBuf);
-
-/* Find next end of line in buffer. */
-switch(lf->nlType)
-    {
-    case nlt_unix:
-    case nlt_dos:
-	for (endIx = lf->lineEnd; endIx < bytesInBuf; ++endIx)
-	    {
-	    if (buf[endIx] == '\n')
-		{
-		gotLf = TRUE;
-		endIx += 1;
-		break;
-		}
-	    }
-	break;
-    case nlt_mac:
-	for (endIx = lf->lineEnd; endIx < bytesInBuf; ++endIx)
-	    {
-	    if (buf[endIx] == '\r')
-		{
-		gotLf = TRUE;
-		endIx += 1;
-		break;
-		}
-	    }
-	break;
-    case nlt_undet:
-	break;
-    }
-
-/* If not in buffer read in a new buffer's worth. */
-while (!gotLf)
-    {
-    int oldEnd = lf->lineEnd;
-    int sizeLeft = bytesInBuf - oldEnd;
-    int bufSize = lf->bufSize;
-    int readSize = bufSize - sizeLeft;
-
-    if (oldEnd > 0 && sizeLeft > 0)
-	{
-	memmove(buf, buf+oldEnd, sizeLeft);
-	}
-    lf->bufOffsetInFile += oldEnd;
-    if (lf->fd >= 0)
-	readSize = lineFileLongNetRead(lf->fd, buf+sizeLeft, readSize);
-#ifdef USE_TABIX
-    else if (lf->tabix != NULL && readSize > 0)
-	{
-	readSize = bgzf_read(lf->tabix->fp, buf+sizeLeft, readSize);
-	if (readSize < 1)
-	    return FALSE;
-	}
-#endif // USE_TABIX
-    else
-        readSize = 0;
-
-    if ((readSize == 0) && (endIx > oldEnd))
-	{
-	endIx = sizeLeft;
-	buf[endIx] = 0;
-	lf->bytesInBuf = newStart = lf->lineStart = 0;
-	lf->lineEnd = endIx;
-	++lf->lineIx;
-	if (retSize != NULL)
-	    *retSize = endIx - newStart;
-	*retStart = buf + newStart;
-        if (*retStart[0] == '#')
-            metaDataAdd(lf, *retStart);
-	return TRUE;
-	}
-    else if (readSize <= 0)
-	{
-	lf->bytesInBuf = lf->lineStart = lf->lineEnd = 0;
-	return FALSE;
-	}
-    bytesInBuf = lf->bytesInBuf = readSize + sizeLeft;
-    lf->lineEnd = 0;
-
-    determineNlType(lf, buf+endIx, bytesInBuf);
-
-    /* Look for next end of line.  */
-    switch(lf->nlType)
-	{
-    	case nlt_unix:
-	case nlt_dos:
-	    for (endIx = sizeLeft; endIx <bytesInBuf; ++endIx)
-		{
-		if (buf[endIx] == '\n')
-		    {
-		    endIx += 1;
-		    gotLf = TRUE;
-		    break;
-		    }
-		}
-	    break;
-	case nlt_mac:
-	    for (endIx = sizeLeft; endIx <bytesInBuf; ++endIx)
-		{
-		if (buf[endIx] == '\r')
-		    {
-		    endIx += 1;
-		    gotLf = TRUE;
-		    break;
-		    }
-		}
-	    break;
-	case nlt_undet:
-	    break;
-	}
-    if (!gotLf && bytesInBuf == lf->bufSize)
-        {
-	if (bufSize >= 512*1024*1024)
-	    {
-	    errAbort("Line too long (more than %d chars) line %d of %s",
-		lf->bufSize, lf->lineIx+1, lf->fileName);
-	    }
-	else
-	    {
-	    lineFileExpandBuf(lf, bufSize*2);
-	    buf = lf->buf;
-	    }
-	}
-    }
-
-if (lf->zTerm)
-    {
-    buf[endIx-1] = 0;
-    if ((lf->nlType == nlt_dos) && (buf[endIx-2]=='\r'))
-	{
-	buf[endIx-2] = 0;
-	}
-    }
-
-lf->lineStart = newStart = lf->lineEnd;
-lf->lineEnd = endIx;
-++lf->lineIx;
-if (retSize != NULL)
-    *retSize = endIx - newStart;
-*retStart = buf + newStart;
-if (*retStart[0] == '#')
-    metaDataAdd(lf, *retStart);
-return TRUE;
-}
-
-void lineFileVaAbort(struct lineFile *lf, char *format, va_list args)
-/* Print file name, line number, and error message, and abort. */
-{
-struct dyString *dy = dyStringNew(0);
-dyStringPrintf(dy,  "Error line %d of %s: ", lf->lineIx, lf->fileName);
-dyStringVaPrintf(dy, format, args);
-errAbort("%s", dy->string);
-dyStringFree(&dy);
-}
-
-void lineFileAbort(struct lineFile *lf, char *format, ...)
-/* Print file name, line number, and error message, and abort. */
-{
-va_list args;
-va_start(args, format);
-lineFileVaAbort(lf, format, args);
-va_end(args);
-}
-
-void lineFileUnexpectedEnd(struct lineFile *lf)
-/* Complain about unexpected end of file. */
-{
-errAbort("Unexpected end of file in %s", lf->fileName);
-}
-
-void lineFileNeedNext(struct lineFile *lf, char **retStart, int *retSize)
-/* Fetch next line from file.  Squawk and die if it's not there. */
-{
-if (!lineFileNext(lf, retStart, retSize))
-    lineFileUnexpectedEnd(lf);
-}
-
-void lineFileClose(struct lineFile **pLf)
-/* Close up a line file. */
-{
-struct lineFile *lf;
-if ((lf = *pLf) != NULL)
-    {
-    struct pipeline *pl = lf->pl;
-    if (pl != NULL)
-        {
-        pipelineClose(&lf->pl);
-        }
-    else if (lf->fd > 0 && lf->fd != fileno(stdin))
-	{
-	close(lf->fd);
-	freeMem(lf->buf);
-	}
-#ifdef USE_TABIX
-    else if (lf->tabix != NULL)
-	{
-	if (lf->tabixIter != NULL)
-	    ti_iter_destroy(lf->tabixIter);
-	ti_close(lf->tabix);
-	}
-#endif // USE_TABIX
-    else if (lf->udcFile != NULL)
-        udcFileClose(&lf->udcFile);
-
-    if (lf->closeCallBack)
-        lf->closeCallBack(lf);
-    freeMem(lf->fileName);
-    metaDataFree(lf);
-    freez(pLf);
-    }
-}
-
-void lineFileCloseList(struct lineFile **pList)
-/* Close up a list of line files. */
-{
-struct lineFile *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    lineFileClose(&el);
-    }
-*pList = NULL;
-}
-
-void lineFileExpectWords(struct lineFile *lf, int expecting, int got)
-/* Check line has right number of words. */
-{
-if (expecting != got)
-    errAbort("Expecting %d words line %d of %s got %d",
-	    expecting, lf->lineIx, lf->fileName, got);
-}
-
-void lineFileExpectAtLeast(struct lineFile *lf, int expecting, int got)
-/* Check line has right number of words. */
-{
-if (got < expecting)
-    errAbort("Expecting at least %d words line %d of %s got %d",
-	    expecting, lf->lineIx, lf->fileName, got);
-}
-
-void lineFileShort(struct lineFile *lf)
-/* Complain that line is too short. */
-{
-errAbort("Short line %d of %s", lf->lineIx, lf->fileName);
-}
-
-void lineFileReuseFull(struct lineFile *lf)
-// Reuse last full line read.  Unlike lineFileReuse,
-// lineFileReuseFull only works with previous lineFileNextFull call
-{
-assert(lf->fullLine != NULL);
-lf->fullLineReuse = TRUE;
-}
-
-
-boolean lineFileNextFull(struct lineFile *lf, char **retFull, int *retFullSize,
-                        char **retRaw, int *retRawSize)
-// Fetch next line from file joining up any that are continued by ending '\'
-// If requested, and was joined, the unjoined raw lines are also returned
-// NOTE: comment lines can't be continued!  ("# comment \ \n more comment" is 2 lines.)
-{
-// May have requested reusing the last full line.
-if (lf->fullLineReuse)
-    {
-    lf->fullLineReuse = FALSE;
-    assert(lf->fullLine != NULL);
-    *retFull = dyStringContents(lf->fullLine);
-    if (retFullSize)
-        *retFullSize = dyStringLen(lf->fullLine);
-    if (retRaw != NULL)
-        {
-        assert(lf->rawLines != NULL);
-        *retRaw = dyStringContents(lf->rawLines);
-        if (retRawSize)
-            *retRawSize = dyStringLen(lf->rawLines);
-        }
-    return TRUE;
-    }
-
-// Empty pointers
-*retFull = NULL;
-if (retRaw != NULL)
-    *retRaw = NULL;
-
-// Prepare lf buffers
-if (lf->fullLine == NULL)
-    {
-    lf->fullLine = dyStringNew(1024);
-    lf->rawLines = dyStringNew(1024); // Better to always create it than test every time
-    }
-else
-    {
-    dyStringClear(lf->fullLine);
-    dyStringClear(lf->rawLines);
-    }
-
-char *line;
-while (lineFileNext(lf, &line, NULL))
-    {
-    char *start = skipLeadingSpaces(line);
-
-    // Will the next line continue this one?
-    char *end = start;
-    if (*start == '#')  // Comment lines can't be continued!
-        end = start + strlen(start);
-    else
-        {
-        while (*end != '\0')  // walking forward for efficiency (avoid strlens())
-            {
-            for (;*end != '\0' && *end != '\\'; end++) ; // Tight loop to find '\'
-            if (*end == '\0')
-                break;
-
-            // This could be a continuation
-            char *slash = end;
-            if (*(++end) == '\\')  // escaped
-                continue;
-            end = skipLeadingSpaces(end);
-
-            if (*end == '\0') // Just whitespace after '\', so true continuation mark
-                {
-                if (retRaw != NULL) // Only if actually requested.
-                    {
-                    dyStringAppendN(lf->rawLines,line,(end - line));
-                    dyStringAppendC(lf->rawLines,'\n'); // New lines delimit raw lines.
-                    }
-                end = slash; // Don't need to zero, because of appending by length
-                break;
-                }
-            }
-        }
-
-    // Stitch together full lines
-    if (dyStringLen(lf->fullLine) == 0)
-        dyStringAppendN(lf->fullLine,line,(end - line)); // includes first line's whitespace
-    else if (start < end)             // don't include continued line's leading spaces
-        dyStringAppendN(lf->fullLine,start,(end - start));
-
-    if (*end == '\\')
-        continue;
-
-    // Got a full line now!
-    *retFull = dyStringContents(lf->fullLine);
-    if (retFullSize)
-        *retFullSize = dyStringLen(lf->fullLine);
-
-    if (retRaw != NULL && dyStringLen(lf->rawLines) > 0) // Only if actually requested & continued
-        {
-        // This is the final line which doesn't have a continuation char
-        dyStringAppendN(lf->rawLines,line,(end - line));
-        *retRaw = dyStringContents(lf->rawLines);
-        if (retRawSize)
-            *retRawSize = dyStringLen(lf->rawLines);
-        }
-    return TRUE;
-    }
-return FALSE;
-}
-
-boolean lineFileNextReal(struct lineFile *lf, char **retStart)
-/* Fetch next line from file that is not blank and
- *  * does not start with a '#'. */
-{
-char *s, c;
-while (lineFileNext(lf, retStart, NULL))
-    {
-    s = skipLeadingSpaces(*retStart);
-    c = s[0];
-    if (c != 0 && c != '#')
-        return TRUE;
-    }
-return FALSE;
-}
-
-boolean lineFileNextFullReal(struct lineFile *lf, char **retStart)
-// Fetch next line from file that is not blank and does not start with a '#'.
-// Continuation lines (ending in '\') are joined into a single line.
-{
-while (lineFileNextFull(lf, retStart, NULL, NULL, NULL))
-    {
-    char *clippedText = skipLeadingSpaces(*retStart);
-    if (clippedText[0] != '\0' && clippedText[0] != '#')
-        return TRUE;
-    }
-return FALSE;
-}
-
-
-int lineFileChopNext(struct lineFile *lf, char *words[], int maxWords)
-/* Return next non-blank line that doesn't start with '#' chopped into words. */
-{
-int lineSize, wordCount;
-char *line;
-
-while (lineFileNext(lf, &line, &lineSize))
-    {
-    if (line[0] == '#')
-        continue;
-    wordCount = chopByWhite(line, words, maxWords);
-    if (wordCount != 0)
-        return wordCount;
-    }
-return 0;
-}
-
-int lineFileChopCharNext(struct lineFile *lf, char sep, char *words[], int maxWords)
-/* Return next non-blank line that doesn't start with '#' chopped into
-   words delimited by sep. */
-{
-int lineSize, wordCount;
-char *line;
-
-while (lineFileNext(lf, &line, &lineSize))
-    {
-    if (line[0] == '#')
-        continue;
-    wordCount = chopByChar(line, sep, words, maxWords);
-    if (wordCount != 0)
-        return wordCount;
-    }
-return 0;
-}
-
-int lineFileChopNextTab(struct lineFile *lf, char *words[], int maxWords)
-/* Return next non-blank line that doesn't start with '#' chopped into words
- * on tabs */
-{
-int lineSize, wordCount;
-char *line;
-
-while (lineFileNext(lf, &line, &lineSize))
-    {
-    if (line[0] == '#')
-        continue;
-    wordCount = chopByChar(line, '\t', words, maxWords);
-    if (wordCount != 0)
-        return wordCount;
-    }
-return 0;
-}
-
-boolean lineFileNextCharRow(struct lineFile *lf, char sep, char *words[], int wordCount)
-/* Return next non-blank line that doesn't start with '#' chopped into words
- * delimited by sep. Returns FALSE at EOF.  Aborts on error. */
-{
-int wordsRead;
-wordsRead = lineFileChopCharNext(lf, sep, words, wordCount);
-if (wordsRead == 0)
-    return FALSE;
-if (wordsRead < wordCount)
-    lineFileExpectWords(lf, wordCount, wordsRead);
-return TRUE;
-}
-
-boolean lineFileNextRow(struct lineFile *lf, char *words[], int wordCount)
-/* Return next non-blank line that doesn't start with '#' chopped into words.
- * Returns FALSE at EOF.  Aborts on error. */
-{
-int wordsRead;
-wordsRead = lineFileChopNext(lf, words, wordCount);
-if (wordsRead == 0)
-    return FALSE;
-if (wordsRead < wordCount)
-    lineFileExpectWords(lf, wordCount, wordsRead);
-return TRUE;
-}
-
-boolean lineFileNextRowTab(struct lineFile *lf, char *words[], int wordCount)
-/* Return next non-blank line that doesn't start with '#' chopped into words
- * at tabs. Returns FALSE at EOF.  Aborts on error. */
-{
-int wordsRead;
-wordsRead = lineFileChopNextTab(lf, words, wordCount);
-if (wordsRead == 0)
-    return FALSE;
-if (wordsRead < wordCount)
-    lineFileExpectWords(lf, wordCount, wordsRead);
-return TRUE;
-}
-
-int lineFileNeedFullNum(struct lineFile *lf, char *words[], int wordIx)
-/* Make sure that words[wordIx] is an ascii integer, and return
- * binary representation of it. Require all chars in word to be digits.*/
-{
-char *c;
-for (c = words[wordIx]; *c; c++)
-    {
-    if (*c == '-' || isdigit(*c))
-        /* NOTE: embedded '-' will be caught by lineFileNeedNum */
-        continue;
-    errAbort("Expecting integer field %d line %d of %s, got %s",
-            wordIx+1, lf->lineIx, lf->fileName, words[wordIx]);
-    }
-return lineFileNeedNum(lf, words, wordIx);
-}
-
-int lineFileNeedNum(struct lineFile *lf, char *words[], int wordIx)
-/* Make sure that words[wordIx] is an ascii integer, and return
- * binary representation of it. Conversion stops at first non-digit char. */
-{
-char *ascii = words[wordIx];
-char c = ascii[0];
-if (c != '-' && !isdigit(c))
-    errAbort("Expecting number field %d line %d of %s, got %s",
-    	wordIx+1, lf->lineIx, lf->fileName, ascii);
-return atoi(ascii);
-}
-
-int lineFileCheckAllIntsNoAbort(char *s, void *val, 
-    boolean isSigned, int byteCount, char *typeString, boolean noNeg, 
-    char *errMsg, int errMsgSize)
-/* Convert string to (signed) integer of the size specified.  
- * Unlike atol assumes all of string is number, no trailing trash allowed.
- * Returns 0 if conversion possible, and value is returned in 'val'
- * Otherwise 1 for empty string or trailing chars, and 2 for numeric overflow,
- * and 3 for (-) sign in unsigned number.
- * Error messages if any are written into the provided buffer.
- * Pass NULL val if you only want validation.
- * Use noNeg if negative values are not allowed despite the type being signed,
- * returns 4. */
-{
-unsigned long long res = 0, oldRes = 0;
-boolean isMinus = FALSE;
-
-if ((byteCount != 1) 
- && (byteCount != 2)
- && (byteCount != 4)
- && (byteCount != 8))
-    errAbort("Unexpected error: Invalid byte count for integer size in lineFileCheckAllIntsNoAbort, expected 1 2 4 or 8, got %d.", byteCount);
-
-unsigned long long limit = 0xFFFFFFFFFFFFFFFFULL >> (8*(8-byteCount));
-
-if (isSigned) 
-    limit >>= 1;
-
-char *p, *p0 = s;
-
-if (*p0 == '-')
-    {
-    if (isSigned)
-	{
-	if (noNeg)
-	    {
-	    safef(errMsg, errMsgSize, "Negative value not allowed");
-	    return 4; 
-	    }
-	p0++;
-	++limit;
-	isMinus = TRUE;
-	}
-    else
-	{
-	safef(errMsg, errMsgSize, "Unsigned %s may not begin with minus sign (-)", typeString);
-	return 3; 
-	}
-    }
-p = p0;
-while ((*p >= '0') && (*p <= '9'))
-    {
-    res *= 10;
-    if (res < oldRes)
-	{
-	safef(errMsg, errMsgSize, "%s%s overflowed", isSigned ? "signed ":"", typeString);
-	return 2; 
-	}
-    oldRes = res;
-    res += *p - '0';
-    if (res < oldRes)
-	{
-	safef(errMsg, errMsgSize, "%s%s overflowed", isSigned ? "signed ":"", typeString);
-	return 2; 
-	}
-    if (res > limit)
-	{
-	safef(errMsg, errMsgSize, "%s%s overflowed, limit=%s%llu", isSigned ? "signed ":"", typeString, isMinus ? "-" : "", limit);
-	return 2; 
-	}
-    oldRes = res;
-    p++;
-    }
-/* test for invalid character, empty, or just a minus */
-if (*p != '\0')
-    {
-    safef(errMsg, errMsgSize, "Trailing characters parsing %s%s", isSigned ? "signed ":"", typeString);
-    return 1;
-    }
-if (p == p0)
-    {
-    safef(errMsg, errMsgSize, "Empty string parsing %s%s", isSigned ? "signed ":"", typeString);
-    return 1;
-    }
-
-if (!val)
-    return 0;  // only validation required
-
-switch (byteCount)
-    {
-    case 1:
-	if (isSigned)
-	    {
-	    if (isMinus)
-		*(char *)val = -res;
-	    else
-		*(char *)val = res;
-	    }
-	else
-	    *(unsigned char *)val = res;
-	break;
-    case 2:
-	if (isSigned)
-	    {
-	    if (isMinus)
-		*(short *)val = -res;
-	    else
-		*(short *)val = res;
-	    }
-	else
-	    *(unsigned short *)val = res;
-	break;
-    case 4:
-	if (isSigned)
-	    {
-	    if (isMinus)
-		*(int *)val = -res;
-	    else
-		*(int *)val = res;
-	    }
-	else
-	    *(unsigned *)val = res;
-	break;
-    case 8:
-	if (isSigned)
-	    {
-	    if (isMinus)
-		*(long long *)val = -res;
-	    else
-		*(long long *) val =res;
-	    }
-	else
-	    *(unsigned long long *)val = res;
-	break;
-    }
-
-
-return 0;
-}
-
-void lineFileAllInts(struct lineFile *lf, char *words[], int wordIx, void *val,
-  boolean isSigned,  int byteCount, char *typeString, boolean noNeg)
-/* Returns long long integer from converting the input string. Aborts on error. */
-{
-char *s = words[wordIx];
-char errMsg[256];
-int res = lineFileCheckAllIntsNoAbort(s, val, isSigned, byteCount, typeString, noNeg, errMsg, sizeof errMsg);
-if (res > 0)
-    {
-    errAbort("%s in field %d line %d of %s, got %s",
-	errMsg, wordIx+1, lf->lineIx, lf->fileName, s);
-    }
-}
-
-int lineFileAllIntsArray(struct lineFile *lf, char *words[], int wordIx, void *array, int arraySize,
-  boolean isSigned,  int byteCount, char *typeString, boolean noNeg)
-/* Convert comma separated list of numbers to an array.  Pass in
- * array and max size of array. Aborts on error. Returns number of elements in parsed array. */
-{
-char *s = words[wordIx];
-char errMsg[256];
-unsigned count = 0;
-char *cArray = array;
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0 || count == arraySize)
-        break;
-    e = strchr(s, ',');
-    if (e)
-        *e = 0;
-    int res = lineFileCheckAllIntsNoAbort(s, cArray, isSigned, byteCount, typeString, noNeg, errMsg, sizeof errMsg);
-    if (res > 0)
-	{
-	errAbort("%s in column %d of array field %d line %d of %s, got %s",
-	    errMsg, count, wordIx+1, lf->lineIx, lf->fileName, s);
-	}
-    if (cArray) // NULL means validation only.
-	cArray += byteCount;  
-    count++;
-    if (e)  // restore input string
-        *e++ = ',';
-    s = e;
-    }
-return count;
-}
-
-
-double lineFileNeedDouble(struct lineFile *lf, char *words[], int wordIx)
-/* Make sure that words[wordIx] is an ascii double value, and return
- * binary representation of it. */
-{
-char *valEnd;
-char *val = words[wordIx];
-double doubleValue;
-
-doubleValue = strtod(val, &valEnd);
-if ((*val == '\0') || (*valEnd != '\0'))
-    errAbort("Expecting double field %d line %d of %s, got %s",
-    	wordIx+1, lf->lineIx, lf->fileName, val);
-return doubleValue;
-}
-
-void lineFileSkip(struct lineFile *lf, int lineCount)
-/* Skip a number of lines. */
-{
-int i, lineSize;
-char *line;
-
-for (i=0; i<lineCount; ++i)
-    {
-    if (!lineFileNext(lf, &line, &lineSize))
-        errAbort("Premature end of file in %s", lf->fileName);
-    }
-}
-
-char *lineFileSkipToLineStartingWith(struct lineFile *lf, char *start, int maxCount)
-/* Skip to next line that starts with given string.  Return NULL
- * if no such line found, otherwise return the line. */
-{
-char *line;
-while (lineFileNext(lf, &line, NULL) && --maxCount >= 0)
-    {
-    if (startsWith(start, line))
-        return line;
-    }
-return NULL;
-}
-
-char *lineFileReadAll(struct lineFile *lf)
-/* Read remainder of lineFile and return it as a string. */
-{
-struct dyString *dy = dyStringNew(1024*4);
-lf->zTerm = 0;
-int size;
-char *line;
-while (lineFileNext(lf, &line, &size))
-    dyStringAppendN(dy, line, size);
-return dyStringCannibalize(&dy);
-}
-
-boolean lineFileParseHttpHeader(struct lineFile *lf, char **hdr,
-				boolean *chunked, int *contentLength)
-/* Extract HTTP response header from lf into hdr, tell if it's
- * "Transfer-Encoding: chunked" or if it has a contentLength. */
-{
-  struct dyString *header = newDyString(1024);
-  char *line;
-  int lineSize;
-
-  if (chunked != NULL)
-    *chunked = FALSE;
-  if (contentLength != NULL)
-    *contentLength = -1;
-  dyStringClear(header);
-  if (lineFileNext(lf, &line, &lineSize))
-    {
-      if (startsWith("HTTP/", line))
-	{
-	char *version, *code;
-	dyStringAppendN(header, line, lineSize-1);
-	dyStringAppendC(header, '\n');
-	version = nextWord(&line);
-	code = nextWord(&line);
-	if (code == NULL)
-	    {
-	    warn("%s: Expecting HTTP/<version> <code> header line, got this: %s\n", lf->fileName, header->string);
-	    *hdr = cloneString(header->string);
-	    dyStringFree(&header);
-	    return FALSE;
-	    }
-	if (!sameString(code, "200"))
-	    {
-	    warn("%s: Errored HTTP response header: %s %s %s\n", lf->fileName, version, code, line);
-	    *hdr = cloneString(header->string);
-	    dyStringFree(&header);
-	    return FALSE;
-	    }
-	while (lineFileNext(lf, &line, &lineSize))
-	    {
-	    /* blank line means end of HTTP header */
-	    if ((line[0] == '\r' && line[1] == 0) || line[0] == 0)
-	        break;
-	    if (strstr(line, "Transfer-Encoding: chunked") && chunked != NULL)
-	        *chunked = TRUE;
-	    dyStringAppendN(header, line, lineSize-1);
-	    dyStringAppendC(header, '\n');
-	    if (strstr(line, "Content-Length:"))
-	      {
-		code = nextWord(&line);
-		code = nextWord(&line);
-		if (contentLength != NULL)
-		    *contentLength = atoi(code);
-	      }
-	    }
-	}
-      else
-	{
-	  /* put the line back, don't put it in header/hdr */
-	  lineFileReuse(lf);
-	  warn("%s: Expecting HTTP/<version> <code> header line, got this: %s\n", lf->fileName, header->string);
-	  *hdr = cloneString(header->string);
-	  dyStringFree(&header);
-	  return FALSE;
-	}
-    }
-  else
-    {
-      *hdr = cloneString(header->string);
-      dyStringFree(&header);
-      return FALSE;
-    }
-
-  *hdr = cloneString(header->string);
-  dyStringFree(&header);
-  return TRUE;
-} /* lineFileParseHttpHeader */
-
-struct dyString *lineFileSlurpHttpBody(struct lineFile *lf,
-				       boolean chunked, int contentLength)
-/* Return a dyString that contains the http response body in lf.  Handle
- * chunk-encoding and content-length. */
-{
-  struct dyString *body = newDyString(64*1024);
-  char *line;
-  int lineSize;
-
-  dyStringClear(body);
-  if (chunked)
-    {
-      /* Handle "Transfer-Encoding: chunked" body */
-      /* Procedure from RFC2068 section 19.4.6 */
-      char *csword;
-      unsigned chunkSize = 0;
-      unsigned size;
-      do
-	{
-	  /* Read line that has chunk size (in hex) as first word. */
-	  if (lineFileNext(lf, &line, NULL))
-	    csword = nextWord(&line);
-	  else break;
-	  if (sscanf(csword, "%x", &chunkSize) < 1)
-	    {
-	      warn("%s: chunked transfer-encoding chunk size parse error.\n",
-		   lf->fileName);
-	      break;
-	    }
-	  /* If chunk size is 0, read in a blank line & then we're done. */
-	  if (chunkSize == 0)
-	    {
-	      lineFileNext(lf, &line, NULL);
-	      if (line == NULL || (line[0] != '\r' && line[0] != 0))
-		warn("%s: chunked transfer-encoding: expected blank line, got %s\n",
-		     lf->fileName, line);
-
-	      break;
-	    }
-	  /* Read (and save) lines until we have read in chunk. */
-	  for (size = 0;  size < chunkSize;  size += lineSize)
-	    {
-	      if (! lineFileNext(lf, &line, &lineSize))
-		break;
-	      dyStringAppendN(body, line, lineSize-1);
-	      dyStringAppendC(body, '\n');
-	    }
-	  /* Read blank line - or extra CRLF inserted in the middle of the
-	   * current line, in which case we need to trim it. */
-	  if (size > chunkSize)
-	    {
-	      body->stringSize -= (size - chunkSize);
-	      body->string[body->stringSize] = 0;
-	    }
-	  else if (size == chunkSize)
-	    {
-	      lineFileNext(lf, &line, NULL);
-	      if (line == NULL || (line[0] != '\r' && line[0] != 0))
-		warn("%s: chunked transfer-encoding: expected blank line, got %s\n",
-		     lf->fileName, line);
-	    }
-	} while (chunkSize > 0);
-      /* Try to read in next line.  If it's an HTTP header, put it back. */
-      /* If there is a next line but it's not an HTTP header, it's a footer. */
-      if (lineFileNext(lf, &line, NULL))
-	{
-	  if (startsWith("HTTP/", line))
-	    lineFileReuse(lf);
-	  else
-	    {
-	      /* Got a footer -- keep reading until blank line */
-	      warn("%s: chunked transfer-encoding: got footer %s, discarding it.\n",
-		   lf->fileName, line);
-	      while (lineFileNext(lf, &line, NULL))
-		{
-		  if ((line[0] == '\r' && line[1] == 0) || line[0] == 0)
-		    break;
-		  warn("discarding footer line: %s\n", line);
-		}
-	    }
-	}
-    }
-  else if (contentLength >= 0)
-    {
-      /* Read in known length */
-      int size;
-      for (size = 0;  size < contentLength;  size += lineSize)
-	{
-	  if (! lineFileNext(lf, &line, &lineSize))
-	    break;
-	  dyStringAppendN(body, line, lineSize-1);
-	  dyStringAppendC(body, '\n');
-	}
-    }
-  else
-    {
-      /* Read in to end of file (assume it's not a persistent connection) */
-      while (lineFileNext(lf, &line, &lineSize))
-	{
-	  dyStringAppendN(body, line, lineSize-1);
-	  dyStringAppendC(body, '\n');
-	}
-    }
-
-  return(body);
-} /* lineFileSlurpHttpBody */
-
-void lineFileRemoveInitialCustomTrackLines(struct lineFile *lf)
-/* remove initial browser and track lines */
-{
-char *line;
-while (lineFileNextReal(lf, &line))
-    {
-    if (!(startsWith("browser", line) || startsWith("track", line) ))
-        {
-        verbose(2, "found line not browser or track: %s\n", line);
-        lineFileReuse(lf);
-        break;
-        }
-    verbose(2, "skipping %s\n", line);
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/localmem.c b/gbtools/src/blatSrc/lib/localmem.c
deleted file mode 100644
index 50f62a1..0000000
--- a/gbtools/src/blatSrc/lib/localmem.c
+++ /dev/null
@@ -1,200 +0,0 @@
-/* LocalMem.c - local memory routines. 
- * 
- * These routines are meant for the sort of scenario where
- * a lot of little to medium size pieces of memory are
- * allocated, and then disposed of all at once.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-
-#include "common.h"
-#include "localmem.h"
-
-
-struct lm
-    {
-    struct lmBlock *blocks;
-    size_t blockSize;
-    size_t allignMask;
-    size_t allignAdd;
-    };
-
-struct lmBlock
-    {
-    struct lmBlock *next;
-    char *free;
-    char *end;
-    char *extra;
-    };
-
-static struct lmBlock *newBlock(struct lm *lm, size_t reqSize)
-/* Allocate a new block of at least reqSize */
-{
-size_t size = (reqSize > lm->blockSize ? reqSize : lm->blockSize);
-size_t fullSize = size + sizeof(struct lmBlock);
-struct lmBlock *mb = needLargeZeroedMem(fullSize);
-if (mb == NULL)
-    errAbort("Couldn't allocate %lld bytes", (long long)fullSize);
-mb->free = (char *)(mb+1);
-mb->end = ((char *)mb) + fullSize;
-mb->next = lm->blocks;
-lm->blocks = mb;
-return mb;
-}
-
-struct lm *lmInit(int blockSize)
-/* Create a local memory pool. */
-{
-struct lm *lm;
-int aliSize = sizeof(long);
-if (aliSize < sizeof(double))
-    aliSize = sizeof(double);
-if (aliSize < sizeof(void *))
-    aliSize = sizeof(void *);
-lm = needMem(sizeof(*lm));
-lm->blocks = NULL;
-if (blockSize <= 0)
-    blockSize = (1<<14);    /* 16k default. */
-lm->blockSize = blockSize;
-lm->allignAdd = (aliSize-1);
-lm->allignMask = ~lm->allignAdd;
-newBlock(lm, blockSize);
-return lm;
-}
-
-void lmCleanup(struct lm **pLm)
-/* Clean up a local memory pool. */
-{
-    struct lm *lm = *pLm;
-    if (lm == NULL)
-        return;
-    slFreeList(&lm->blocks);
-    freeMem(lm);
-    *pLm = NULL;
-}
-
-size_t lmAvailable(struct lm *lm)
-// Returns currently available memory in pool
-{
-struct lmBlock *mb = lm->blocks;
-return (mb->end - mb->free);
-}
-
-size_t lmSize(struct lm *lm)
-// Returns current size of pool, even for memory already allocated
-{
-size_t fullSize = 0;
-
-struct lmBlock *mb = lm->blocks;
-for (;mb != NULL;mb = mb->next)
-    fullSize += (mb->end - (char *)(mb+1));
-
-return fullSize;
-}
-
-void *lmAlloc(struct lm *lm, size_t size)
-/* Allocate memory from local pool. */
-{
-struct lmBlock *mb = lm->blocks;
-void *ret;
-size_t memLeft = mb->end - mb->free;
-if (memLeft < size)
-    mb = newBlock(lm, size);
-ret = mb->free;
-mb->free += ((size+lm->allignAdd)&lm->allignMask);
-if (mb->free > mb->end)
-    mb->free = mb->end;
-return ret;
-}
-
-void *lmAllocMoreMem(struct lm *lm, void *pt, size_t oldSize, size_t newSize)
-/* Adjust memory size on a block, possibly relocating it.  If block is grown,
- * new memory is zeroed. */
-{
-struct lmBlock *mb = lm->blocks;
-// rare case that pointer is to last lm alloc, but still try.
-// Note this is the one place where the pointer gets reused and it is known to be in this lm
-if ((char *)pt + oldSize == mb->free
-&&  (char *)pt + newSize <= mb->end)
-    {
-    if (newSize > oldSize) // only move the free pointer on more mem
-        mb->free = pt + newSize;
-    return pt;
-    }
-void *new = lmAlloc(lm, newSize);
-memcpy(new, pt, oldSize);
-return new;
-}
-
-void *lmCloneMem(struct lm *lm, void *pt, size_t size)
-/* Return a local mem copy of memory block. */
-{
-void *d = lmAlloc(lm, size);
-memcpy(d, pt, size);
-return d;
-}
-
-char *lmCloneStringZ(struct lm *lm, char *string, int size)
-/* Return local mem copy of string. */
-{
-if (string == NULL)
-    return NULL;
-else
-    {
-    char *s = lmAlloc(lm, size+1);
-    memcpy(s, string, size);
-    return s;
-    }
-}
-
-char *lmCloneString(struct lm *lm, char *string)
-/* Return local mem copy of string. */
-{
-if (string == NULL)
-    return NULL;
-else
-    return lmCloneStringZ(lm, string, strlen(string));
-}
-
-char *lmCloneFirstWord(struct lm *lm, char *line)
-/* Clone first word in line */
-{
-char *startFirstWord = skipLeadingSpaces(line);
-if (startFirstWord == NULL)
-    return NULL;
-char *endFirstWord = skipToSpaces(startFirstWord);
-if (endFirstWord == NULL)
-    return lmCloneString(lm, startFirstWord);
-else
-    return lmCloneStringZ(lm, startFirstWord, endFirstWord - startFirstWord);
-}
-    
-char *lmCloneSomeWord(struct lm *lm, char *line, int wordIx)
-/* Return a clone of the given space-delimited word within line.  Returns NULL if
- * not that many words in line. */
-{
-if (wordIx < 0)
-    return NULL;
-int i;
-for (i=0; i<wordIx; ++i)
-    {
-    line = skipLeadingSpaces(line);
-    line = skipToSpaces(line);
-    if (line == NULL)
-        return NULL;
-    }
-return lmCloneFirstWord(lm, line);
-}
-
-
-struct slName *lmSlName(struct lm *lm, char *name)
-/* Return slName in memory. */
-{
-struct slName *n;
-int size = sizeof(*n) + strlen(name) + 1;
-n = lmAlloc(lm, size);
-strcpy(n->name, name);
-return n;
-}
-
diff --git a/gbtools/src/blatSrc/lib/log.c b/gbtools/src/blatSrc/lib/log.c
deleted file mode 100644
index 953a991..0000000
--- a/gbtools/src/blatSrc/lib/log.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/* log.c - logging for servers, can log to a file and/or syslog.  Compile with
- * -DNO_SYSLOG for systems without syslog. */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "log.h"
-#include "errAbort.h"
-#include "dystring.h"
-#include "options.h"
-#include "portable.h"
-
-#ifndef NO_SYSLOG
-#include <syslog.h>
-#endif
-#include <time.h>
-
-
-static char *gProgram = "unknown";  /* name of program */
-static boolean gSysLogOn = FALSE;   /* syslog logging enabled? */
-static FILE *gLogFh = NULL;         /* logging file */
-
-struct nameVal
-/* pair of string name and integer value */
-{
-    char *name;
-    int val;
-};
-
-#ifndef NO_SYSLOG
-
-static struct nameVal facilityNameTbl[] =
-/* not all version of syslog have the facilitynames table, so  define our own */
-{
-    {"auth",         LOG_AUTH},
-#ifdef LOG_AUTHPRIV
-    {"authpriv",     LOG_AUTHPRIV},
-#endif
-    {"cron",         LOG_CRON},
-    {"daemon",       LOG_DAEMON},
-#ifdef LOG_FTP
-    {"ftp",          LOG_FTP},
-#endif
-    {"kern",         LOG_KERN},
-    {"lpr",          LOG_LPR},
-    {"mail",         LOG_MAIL},
-    {"news",         LOG_NEWS},
-    {"syslog",       LOG_SYSLOG},
-    {"user",         LOG_USER},
-#ifdef LOG_UUCP
-    {"uucp",         LOG_UUCP},
-#endif
-    {"local0",       LOG_LOCAL0},
-    {"local1",       LOG_LOCAL1},
-    {"local2",       LOG_LOCAL2},
-    {"local3",       LOG_LOCAL3},
-    {"local4",       LOG_LOCAL4},
-    {"local5",       LOG_LOCAL5},
-    {"local6",       LOG_LOCAL6},
-    {"local7",       LOG_LOCAL7},
-    {NULL,           0}
-};
-#endif
-
-/* Priority numbers and names used for setting minimum priority to log.  This
- * is kept independent of syslog, so it works on file logging too.  */
-#define	PRI_EMERG	0
-#define	PRI_ALERT	1
-#define	PRI_CRIT	2
-#define	PRI_ERR		3
-#define	PRI_WARNING	4
-#define	PRI_NOTICE	5
-#define	PRI_INFO	6
-#define	PRI_DEBUG	7
-
-static struct nameVal priorityNameTbl[] = {
-    {"panic", PRI_EMERG},
-    {"emerg", PRI_EMERG},
-    {"alert", PRI_ALERT},
-    {"crit", PRI_CRIT},
-    {"err", PRI_ERR},
-    {"error", PRI_ERR},
-    {"warn", PRI_WARNING},
-    {"warning", PRI_WARNING},
-    {"notice", PRI_NOTICE},
-    {"info", PRI_INFO},
-    {"debug", PRI_DEBUG},
-    {NULL, -1}
-    };
-
-static int gMinPriority = PRI_INFO;  // minimum priority to log (reverse numbering)
-
-static int nameValTblFind(struct nameVal *tbl, char *name)
-/* search a nameVal table, return -1 if not found */
-{
-int i;
-for (i = 0; tbl[i].name != NULL; i++)
-    {
-    if (sameString(tbl[i].name, name))
-        return tbl[i].val;
-    }
-return -1;
-}
-
-static char *nameValTblMsg(struct nameVal *tbl)
-/* generate a message for values in table */
-{
-struct dyString *msg = dyStringNew(256);
-int i;
-for (i = 0; tbl[i].name != NULL; i++)
-    {
-    if (i > 0)
-        dyStringAppend(msg, ", ");
-    dyStringAppend(msg, tbl[i].name);
-    }
-return dyStringCannibalize(&msg);
-}
-
-static void logWarnHandler(char *format, va_list args)
-/* Warn handler that logs message. */
-{
-if (isErrAbortInProgress())
-    logErrorVa(format, args);
-else
-    logWarnVa(format, args);
-}
-
-static void logAbortHandler()
-/* abort handler that logs this fact and exits. */
-{
-logError("%s aborted", gProgram);
-fprintf(stderr, "aborted");
-exit(1);
-}
-
-static void setProgram(char* program)
-/* set the program name, removing leading directories from file */
-{
-char name[128], ext[64];
-int len;
-splitPath(program, NULL, name, ext);
-len = strlen(name) + strlen(ext) + 1;
-gProgram = needMem(len);
-strcpy(gProgram, name);
-if (ext[0] != '\0')
-    strcat(gProgram, ext); /* includes dot */
-}
-
-#ifndef NO_SYSLOG
-static int parseFacility(char *facility)
-/* parse a facility name into a number, or use default if NULL. */
-{
-if (facility == NULL)
-    return LOG_LOCAL0;
-int val = nameValTblFind(facilityNameTbl, facility);
-if (val < 0)
-    errAbort("invalid log facility: %s, expected one of: %s", facility, nameValTblMsg(facilityNameTbl));
-return val;
-}
-#endif
-
-static int parsePriority(char *pri)
-/* parse a priority name into a number, or use default if NULL. */
-{
-if (pri == NULL)
-    return PRI_INFO;
-int val = nameValTblFind(priorityNameTbl, pri);
-if (val < 0)
-    errAbort("invalid log priority: %s, expected one of: %s", pri, nameValTblMsg(priorityNameTbl));
-return val;
-}
-
-void logOpenSyslog(char* program, char *facility)
-/* Initialize syslog using the specified facility.  Facility is the syslog
- * facility as specified in syslog.conf.  If facility is NULL, local0 is used.
- * This adds a warn and errAbort handlers that do logging.  If custom handlers
- * are added, they should call logErrorVa().
- */
-{
-#ifndef NO_SYSLOG
-setProgram(program);
-openlog(program, LOG_PID, parseFacility(facility));
-pushWarnHandler(logWarnHandler);
-pushAbortHandler(logAbortHandler);
-gSysLogOn = TRUE;
-#else
-errAbort("syslog support was not compiled into %s", __FILE__);
-#endif
-}
-
-void logOpenFile(char* program, char *logFile)
-/* Initialize logging to the specified file.  Append to the file if it exists.
- * This adds a warn and errAbort handlers that do logging.  If custom handlers
- * are added, they should call logErrorVa().
- */
-{
-setProgram(program);
-gLogFh = mustOpen(logFile, "a");
-pushWarnHandler(logWarnHandler);
-pushAbortHandler(logAbortHandler);
-}
-
-void logSetMinPriority(char *minPriority)
-/* set minimum priority to log, which is one of the syslog priority names,
- * even when logging to a file */
-{
-gMinPriority = parsePriority(minPriority);
-}
-
-FILE *logGetFile()
-/* Returns the log FILE object if file logging is enabled, or NULL if it
- * isn't. This is useful for logging debugging data that doesn't fit the log
- * message paradigm, For example, logging fasta records. */
-{
-return gLogFh;
-}
-
-static void logFilePrint(char* level, char *format, va_list args)
-/* write a message to the log file */
-{
-static char *timeFmt = "%Y/%m/%d %H:%M:%S";
-char timeBuf[128];
-time_t curTime = time(NULL);
-strftime(timeBuf, sizeof(timeBuf), timeFmt, localtime(&curTime));
-fprintf(gLogFh, "%s: %s: ", timeBuf, level);
-vfprintf(gLogFh, format, args);
-fputc('\n', gLogFh);
-fflush(gLogFh);
-}
-
-void logErrorVa(char *format, va_list args)
-/* Variable args logError. */
-{
-if (gMinPriority >= PRI_ERR)
-    {
-#ifndef NO_SYSLOG
-    if (gSysLogOn)
-        vsyslog(LOG_ERR, format, args);
-#endif
-    if (gLogFh != NULL)
-        logFilePrint("error", format, args);
-    }
-}
-
-void logError(char *format, ...)
-/* Log an error message. */
-{
-va_list args;
-va_start(args, format);
-logErrorVa(format, args);
-va_end(args);
-}
-
-void logWarnVa(char *format, va_list args)
-/* Variable args logWarn. */
-{
-if (gMinPriority >= PRI_WARNING)
-    {
-#ifndef NO_SYSLOG
-    if (gSysLogOn)
-        vsyslog(LOG_WARNING, format, args);
-#endif
-    if (gLogFh != NULL)
-        logFilePrint("warn", format, args);
-    }
-}
-
-void logWarn(char *format, ...)
-/* Log a warn message. */
-{
-va_list args;
-va_start(args, format);
-logWarnVa(format, args);
-va_end(args);
-}
-
-void logInfoVa(char *format, va_list args)
-/* Variable args logInfo. */
-{
-if (gMinPriority >= PRI_INFO)
-    {
-#ifndef NO_SYSLOG
-    if (gSysLogOn)
-        vsyslog(LOG_INFO, format, args);
-#endif
-    if (gLogFh != NULL)
-        logFilePrint("info", format, args);
-    }
-}
-
-void logInfo(char *format, ...)
-/* Log an info message. */
-{
-va_list args;
-va_start(args, format);
-logInfoVa(format, args);
-va_end(args);
-}
-
-void logDebugVa(char *format, va_list args)
-/* Variable args logDebug. */
-{
-if (gMinPriority >= PRI_DEBUG)
-    {
-#ifndef NO_SYSLOG
-    if (gSysLogOn)
-        vsyslog(LOG_DEBUG, format, args);
-#endif
-    if (gLogFh != NULL)
-        logFilePrint("debug", format, args);
-    }
-}
-
-void logDebug(char *format, ...)
-/* Log a debug message. */
-{
-va_list args;
-va_start(args, format);
-logDebugVa(format, args);
-va_end(args);
-}
-
-void logDaemonize(char *progName)
-/* daemonize parasol server process, closing open file descriptors and
- * starting logging based on the -logFacility and -log command line options .
- * if -debug is supplied , don't fork. */
-{
-if (!optionExists("debug"))
-    {
-    int i, maxFiles = getdtablesize();
-    if (mustFork() != 0)
-        exit(0);  /* parent goes away */
-
-    /* Put self in our own process group. */
-    setsid();
-
-    /* Close all open files first (before logging) */
-    for (i = 0; i < maxFiles; i++)
-        close(i);
-
-    /* Reopen standard files to /dev/null just in case somebody uses them. */
-    int nullFd = open("/dev/null", O_RDWR);  // Opens stdin
-    dup(nullFd);			     // Stdout goes also to /dev/null
-    dup(nullFd);			     // Stderr goes also to /dev/null
-    }
-
-/* Set up log handler. */
-if (optionExists("log"))
-    logOpenFile(progName, optionVal("log", NULL));
-else    
-    logOpenSyslog(progName, optionVal("logFacility", NULL));
-}
-
diff --git a/gbtools/src/blatSrc/lib/longToList.c b/gbtools/src/blatSrc/lib/longToList.c
deleted file mode 100644
index 448fc23..0000000
--- a/gbtools/src/blatSrc/lib/longToList.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* longToList - this is a way of associating a generic list with a long key.
- * You can retrieve back the list given the key,  and add to lists associated with
- * any given tree. The list can be any sort of singly-linked object that starts with
- * a next field. 
- *
- * Under the hood this uses a balanced binary tree to handle the key/list
- * association. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "localmem.h"
-#include "rbTree.h"
-#include "longToList.h"
-
-static int llKeyListCmp(void *va, void *vb)
-/* Compare to sort two llKeyLists on key */
-{
-/* Point typed pointers at a and b */
-struct llKeyList *a = va;
-struct llKeyList *b = vb;
-
-/* We can't just return a->key - b->key because of long/int overflow */
-if (a->key > b->key)
-    return 1;
-else if (a->key < b->key)
-    return -1;
-else
-    return 0;
-}
-
-struct longToList *longToListNew()
-/* Return new empty longToList */
-{
-struct longToList *ll;
-AllocVar(ll);
-ll->tree = rbTreeNew(llKeyListCmp);
-ll->lm = ll->tree->lm;
-return ll;
-}
-
-void longToListFree(struct longToList **pLl)
-/* Free up memory associated with longToList. */
-{
-struct longToList *ll = *pLl;
-if (ll != NULL)
-    {
-    rbTreeFree(&ll->tree);
-    freez(pLl);
-    }
-}
-
-struct llKeyList *longToListAdd(struct longToList *ll, long key, void *item)
-/* Add item to key-associated record in ll.  May make up new record if the
- * key has never been seen before.  If record already exists item will be prepended
- * to any existing items. Returns llKeyList associated with key, but most people just
- * ignore that. */
-{
-struct slRef *ref = lmAlloc(ll->lm, sizeof(struct slRef));
-ref->val = item;
-struct llKeyList find;
-find.key = key;
-struct llKeyList *lkl = rbTreeFind(ll->tree, &find);
-if (lkl == NULL)
-    {
-    lmAllocVar(ll->lm, lkl);
-    lkl->key = key;
-    rbTreeAdd(ll->tree, lkl);
-    }
-slAddHead(&lkl->list, ref);
-return lkl;
-}
-
-struct llKeyList *longToListLookup(struct longToList *ll, long key)
-/* Given a key return llKeyList associated with it if any, may return NULL */
-{
-struct llKeyList find;
-find.key = key;
-return rbTreeFind(ll->tree, &find);
-}
-
-struct slRef *longToListFindVal(struct longToList *ll, long key)
-/* Returns the list associated with this key, or NULL if key not in container. */
-{
-struct llKeyList *lkl = longToListLookup(ll, key);
-if (lkl == NULL)
-    return NULL;
-else
-    return lkl->list;
-}
-
-struct slRef *longToListMustFindVal(struct longToList *ll, long key)
-/* Returns the list associated with this key. Aborts if key not found in container. */
-{
-struct llKeyList *lkl = longToListLookup(ll, key);
-if (lkl == NULL)
-    errAbort("Can't find %ld in longToList, in longToListMustFindVal", key);
-return lkl->list;
-}
-
-
-
diff --git a/gbtools/src/blatSrc/lib/maf.c b/gbtools/src/blatSrc/lib/maf.c
deleted file mode 100644
index 11d205d..0000000
--- a/gbtools/src/blatSrc/lib/maf.c
+++ /dev/null
@@ -1,898 +0,0 @@
-/* maf.c - Read/write maf format. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "errAbort.h"
-#include "obscure.h"
-#include "dnautil.h"
-#include "axt.h"
-#include "maf.h"
-#include "hash.h"
-#include "net.h"
-#include <fcntl.h>
-
-
-char *mafRegDefTxUpstream = "txupstream";  // transcription start size upstream region
-
-struct mafFile *mafMayOpen(char *fileName)
-/* Open up a maf file and verify header. */
-{
-struct mafFile *mf;
-struct lineFile *lf;
-char *line, *word;
-char *sig = "##maf";
-
-if ( hasProtocol(fileName))
-    lf = lineFileUdcMayOpen(fileName, TRUE);
-else
-    lf = lineFileMayOpen(fileName, TRUE);
-
-if (lf == NULL)
-    return NULL;
-AllocVar(mf);
-mf->lf = lf;
-
-lineFileNeedNext(lf, &line, NULL);
-if (!startsWith(sig, line))
-    {
-    errAbort("%s does not start with %s", fileName, sig);
-    }
-line += strlen(sig);
-
-while ((word = nextWord(&line)) != NULL)
-    {
-    /* Parse name=val. */
-    char *name = word;
-    char *val = strchr(word, '=');
-    if (val == NULL)
-       errAbort("Missing = after %s line 1 of %s\n", name, fileName);
-    *val++ = 0;
-
-    if (sameString(name, "version"))
-        mf->version = atoi(val);
-    else if (sameString(name, "scoring"))
-        mf->scoring = cloneString(val);
-    }
-if (mf->version == 0)
-    errAbort("No version line 1 of %s\n", fileName);
-return mf;
-}
-
-struct mafFile *mafOpen(char *fileName)
-/* Open up a maf file.  Squawk and die if there's a problem. */
-{
-struct mafFile *mf = mafMayOpen(fileName);
-if (mf == NULL)
-    errnoAbort("Couldn't open %s\n", fileName);
-return mf;
-}
-
-void mafRewind(struct mafFile *mf)
-/* Seek to beginning of open maf file */
-{
-if (mf == NULL)
-    errAbort("maf file rewind failed -- file not open");
-lineFileSeek(mf->lf, 0, SEEK_SET);
-}
-
-static boolean nextLine(struct lineFile *lf, char **pLine)
-/* Get next line that is not a comment. */
-{
-for (;;)
-    {
-    if (!lineFileNext(lf, pLine, NULL))
-        return FALSE;
-    if (**pLine != '#')
-        return TRUE;
-    }
-}
-
-static void mafRegDefParse(struct mafFile *mf, struct mafAli *ali, char *line)
-/* parse a 'r' line of an 'a' paragraph. */
-{
-if (ali->regDef != NULL)
-    errAbort("multiple 'r' lines in an alignment paragraph: %d of %s", mf->lf->lineIx, mf->lf->fileName);
-char *row[3];
-int wordCount = chopByWhite(line, row, ArraySize(row));
-if (wordCount != 3)
-    lineFileExpectWords(mf->lf, 3+1, wordCount+1); // +1 for 'r'
-ali->regDef = mafRegDefNew(row[0], lineFileNeedFullNum(mf->lf, row, 1),
-                           row[2]);
-}
-
-struct mafAli *mafNextWithPos(struct mafFile *mf, off_t *retOffset)
-/* Return next alignment in FILE or NULL if at end.  If retOffset is
- * nonNULL, return start offset of record in file. */
-{
-struct lineFile *lf = mf->lf;
-struct mafAli *ali;
-char *line, *word;
-
-/* Loop until get an alignment paragraph or reach end of file. */
-for (;;)
-    {
-    /* Get alignment header line.  If it's not there assume end of file. */
-    if (!nextLine(lf, &line))
-	{
-	lineFileClose(&mf->lf);
-	return NULL;
-	}
-
-    /* Parse alignment header line. */
-    word = nextWord(&line);
-    if (word == NULL)
-	continue;	/* Ignore blank lines. */
-	
-    if (sameString(word, "a"))
-	{
-	if (retOffset != NULL)
-	    *retOffset = lineFileTell(mf->lf);
-	AllocVar(ali);
-	while ((word = nextWord(&line)) != NULL)
-	    {
-	    /* Parse name=val. */
-	    char *name = word;
-	    char *val = strchr(word, '=');
-	    if (val == NULL)
-	       errAbort("Missing = after %s line 1 of %s", name, lf->fileName);
-	    *val++ = 0;
-
-	    if (sameString(name, "score"))
-		ali->score = atof(val);
-	    }
-
-	/* Parse alignment components until blank line. */
-	for (;;)
-	    {
-	    if (!nextLine(lf, &line))
-		break;
-	    word = nextWord(&line);
-	    if (word == NULL)
-		break;
-	    if (sameString(word, "s") || sameString(word, "e"))
-		{
-		struct mafComp *comp;
-		int wordCount;
-		char *row[7];
-		int textSize;
-
-		/* Chop line up by white space.  This involves a few +-1's because
-		 * have already chopped out first word. */
-		row[0] = word;
-		wordCount = chopByWhite(line, row+1, ArraySize(row)-1) + 1; /* +-1 because of "s" */
-		lineFileExpectWords(lf, ArraySize(row), wordCount);
-		AllocVar(comp);
-
-		/* Convert ascii text representation to mafComp structure. */
-		comp->src = cloneString(row[1]);
-		comp->srcSize = lineFileNeedNum(lf, row, 5);
-		comp->strand = row[4][0];
-		comp->start = lineFileNeedNum(lf, row, 2);
-
-		if (sameString(word, "e"))
-		    {
-		    comp->size = 0;
-		    comp->rightLen = comp->leftLen = lineFileNeedNum(lf, row, 3);
-		    comp->rightStatus = comp->leftStatus = *row[6];
-		    }
-		else
-		    {
-		    comp->size = lineFileNeedNum(lf, row, 3);
-		    comp->text = cloneString(row[6]);
-		    textSize = strlen(comp->text);
-
-		    /* Fill in ali->text size. */
-		    if (ali->textSize == 0)
-			ali->textSize = textSize;
-		    else if (ali->textSize != textSize)
-			errAbort("Text size inconsistent (%d vs %d) line %d of %s",
-			    textSize, ali->textSize, lf->lineIx, lf->fileName);
-		    }
-
-		/* Do some sanity checking. */
-		if (comp->srcSize < 0 || comp->size < 0)
-		     errAbort("Got a negative size line %d of %s", lf->lineIx, lf->fileName);
-		if (comp->start < 0 || comp->start + comp->size > comp->srcSize)
-		     errAbort("Coordinates out of range line %d of %s", lf->lineIx, lf->fileName);
-		  
-		/* Add component to head of list. */
-		slAddHead(&ali->components, comp);
-		}
-	    if (sameString(word, "i"))
-		{
-		struct mafComp *comp;
-		int wordCount;
-		char *row[6];
-
-		/* Chop line up by white space.  This involves a few +-1's because
-		 * have already chopped out first word. */
-		row[0] = word;
-		wordCount = chopByWhite(line, row+1, ArraySize(row)-1) + 1; /* +-1 because of "s" */
-		lineFileExpectWords(lf, ArraySize(row), wordCount);
-		if (!sameString(row[1],ali->components->src))
-		    errAbort("i line src mismatch: i is %s :: s is %s\n", row[1], ali->components->src);
-
-		comp = ali->components;
-		comp->leftStatus = *row[2];
-		comp->leftLen = atoi(row[3]);
-		comp->rightStatus = *row[4];
-		comp->rightLen = atoi(row[5]);
-		}
-            if (sameString(word, "q"))
-		{
-		struct mafComp *comp;
-		int wordCount;
-		char *row[3];
-
-		/* Chop line up by white space.  This involves a few +-1's because
-		 * have already chopped out first word. */
-		row[0] = word;
-		wordCount = chopByWhite(line, row+1, ArraySize(row)-1) + 1; /* +-1 because of "s" */
-		lineFileExpectWords(lf, ArraySize(row), wordCount);
-		if (!sameString(row[1],ali->components->src))
-		    errAbort("q line src mismatch: q is %s :: s is %s\n", row[1], ali->components->src);
-
-			comp = ali->components;
-			comp->quality = cloneString(row[2]);
-		}
-	    if (sameString(word, "r"))
-                mafRegDefParse(mf, ali, line);
-	    }
-	slReverse(&ali->components);
-	return ali;
-	}
-    else  /* Skip over paragraph we don't understand. */
-	{
-	for (;;)
-	    {
-	    if (!nextLine(lf, &line))
-		return NULL;
-            if (nextWord(&line) == NULL)
-		break;
-	    }
-	}
-    }
-}
-
-
-struct mafAli *mafNext(struct mafFile *mf)
-/* Return next alignment in FILE or NULL if at end. */
-{
-return mafNextWithPos(mf, NULL);
-}
-
-
-struct mafFile *mafReadAll(char *fileName)
-/* Read all elements in a maf file */
-{
-struct mafFile *mf = mafOpen(fileName);
-struct mafAli *ali;
-while ((ali = mafNext(mf)) != NULL)
-    {
-    slAddHead(&mf->alignments, ali);
-    }
-slReverse(&mf->alignments);
-return mf;
-}
-
-void mafWriteStart(FILE *f, char *scoring)
-/* Write maf header and scoring scheme name (may be null) */
-{
-fprintf(f, "##maf version=1");
-if (scoring != NULL)
-    fprintf(f, " scoring=%s", scoring);
-fprintf(f, "\n");
-}
-
-
-void mafWrite(FILE *f, struct mafAli *ali)
-/* Write next alignment to file. */
-{
-struct mafComp *comp;
-int srcChars = 0, startChars = 0, sizeChars = 0, srcSizeChars = 0;
-
-/* Write out alignment header */
-fprintf(f, "a score=%f\n", ali->score);
-
-/* include region definition */
-if (ali->regDef != NULL)
-    fprintf(f, "r %s %d %s\n", ali->regDef->type, ali->regDef->size, ali->regDef->id);
-
-/* Figure out length of each field. */
-for (comp = ali->components; comp != NULL; comp = comp->next)
-    {
-    int len = 0;
-    /* a name like '.' will break some tools, so replace it
-    * with a generic name */
-    if (sameString(comp->src,"."))
-	comp->src=cloneString("defaultName");
-    len = strlen(comp->src);
-    if (srcChars < len)
-        srcChars = len;
-    len = digitsBaseTen(comp->start);
-    if (startChars < len)
-        startChars = len;
-    len = digitsBaseTen(comp->size);
-    if (sizeChars < len)
-        sizeChars = len;
-    len = digitsBaseTen(comp->srcSize);
-    if (srcSizeChars < len)
-        srcSizeChars = len;
-    }
-
-/* Write out each component. */
-for (comp = ali->components; comp != NULL; comp = comp->next)
-    {
-    if ((comp->size == 0) && (comp->leftStatus))
-	fprintf(f, "e %-*s %*d %*d %c %*d %c\n", 
-	    srcChars, comp->src, startChars, comp->start, 
-	    sizeChars, comp->leftLen, comp->strand, 
-	    srcSizeChars, comp->srcSize, comp->leftStatus);
-    else
-	{
-	fprintf(f, "s %-*s %*d %*d %c %*d %s\n", 
-	    srcChars, comp->src, startChars, comp->start, 
-	    sizeChars, comp->size, comp->strand, 
-	    srcSizeChars, comp->srcSize, comp->text);
-
-	if (comp->quality)
-		fprintf(f, "q %-*s %s\n",
-		srcChars + startChars + sizeChars + srcSizeChars + 5,
-		comp->src, comp->quality);
-
-	if (comp->leftStatus)
-	    fprintf(f,"i %-*s %c %d %c %d\n",srcChars,comp->src,
-		comp->leftStatus,comp->leftLen,comp->rightStatus,comp->rightLen);
-	}
-
-    }
-
-/* Write out blank separator line. */
-fprintf(f, "\n");
-}
-
-void mafWriteEnd(FILE *f)
-/* Write maf footer. In this case nothing */
-{
-}
-
-void mafWriteAll(struct mafFile *mf, char *fileName)
-/* Write out full mafFile. */
-{
-FILE *f = mustOpen(fileName, "w");
-struct mafAli *ali;
-mafWriteStart(f, mf->scoring);
-for (ali = mf->alignments; ali != NULL; ali = ali->next)
-    mafWrite(f, ali);
-mafWriteEnd(f);
-carefulClose(&f);
-}
-
-void mafCompFree(struct mafComp **pObj)
-/* Free up a maf component. */
-{
-struct mafComp *obj = *pObj;
-if (obj == NULL)
-    return;
-freeMem(obj->src);
-freeMem(obj->text);
-freeMem(obj->quality);
-freez(pObj);
-}
-
-void mafCompFreeList(struct mafComp **pList)
-/* Free up a list of maf components. */
-{
-struct mafComp *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    mafCompFree(&el);
-    }
-*pList = NULL;
-}
-
-char *mafCompGetSrcDb(struct mafComp *mc, char *buf, int bufSize)
-/* parse the srcDb name from the mafComp src name, return NULL if no srcDb */
-{
-char *e = strchr(mc->src, '.');
-if (e == NULL)
-    return NULL;
-int len = e - mc->src;
-if (len >= bufSize-1)
-    errAbort("srcDb name in \"%s\" overflows buffer length of %d", mc->src, bufSize);
-strncpy(buf, mc->src, len);
-buf[len] = '\0';
-return buf;
-}
-
-char *mafCompGetSrcName(struct mafComp *mc)
-/* parse the src sequence name from the mafComp src name */
-{
-char *e = strchr(mc->src, '.');
-if (e == NULL)
-    return mc->src;
-else
-    return e+1;
-}
-
-int mafPlusStart(struct mafComp *comp)
-/* Return start relative to plus strand of src. */
-{
-if (comp->strand == '-') 
-    return comp->srcSize - (comp->start + comp->size);
-else
-    return comp->start;
-}
-
-void mafAliFree(struct mafAli **pObj)
-/* Free up a maf alignment. */
-{
-struct mafAli *obj = *pObj;
-if (obj == NULL)
-    return;
-mafCompFreeList(&obj->components);
-mafRegDefFree(&obj->regDef);
-freez(pObj);
-}
-
-void mafAliFreeList(struct mafAli **pList)
-/* Free up a list of maf alignmentx. */
-{
-struct mafAli *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    mafAliFree(&el);
-    }
-*pList = NULL;
-}
-
-void mafFileFree(struct mafFile **pObj)
-/* Free up a maf file. */
-{
-struct mafFile *obj = *pObj;
-if (obj == NULL)
-    return;
-lineFileClose(&obj->lf);
-freeMem(obj->scoring);
-mafAliFreeList(&obj->alignments);
-freez(pObj);
-}
-
-void mafFileFreeList(struct mafFile **pList)
-/* Free up a list of maf files. */
-{
-struct mafFile *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    mafFileFree(&el);
-    }
-*pList = NULL;
-}
-
-struct mafComp *mafMayFindComponent(struct mafAli *maf, char *src)
-/* Find component of given source. Return NULL if not found. */
-{
-struct mafComp *mc;
-for (mc = maf->components; mc != NULL; mc = mc->next)
-    {
-    if (sameString(mc->src, src))
-        return mc;
-    }
-return NULL;
-}
-
-struct mafComp *mafMayFindComponentDb(struct mafAli *maf, char *db)
-/* Find component of given database, allowing component to be 
- * labeled "db", or "db.chrom" . Return NULL if not found. */
-{
-struct mafComp *mc;
-char *p, *q;
-for (mc = maf->components; mc != NULL; mc = mc->next)
-    {
-    for (p = mc->src, q = db; *p && *q; p++, q++)
-        {
-        if (*p != *q)
-            break;
-        }
-    if (*p == '.' && *q == 0)
-        return mc;
-    if (*p == *q)
-        return mc;
-    }
-return NULL;
-}
-
-struct mafComp *mafFindComponent(struct mafAli *maf, char *src)
-/* Find component of given source or die trying. */
-{
-struct mafComp *mc = mafMayFindComponent(maf, src);
-if (mc == NULL)
-    errAbort("Couldn't find %s in maf", src);
-return mc;
-}
-
-struct mafComp *mafMayFindCompSpecies(struct mafAli *maf, char *species, char sepChar)
-/* Find component of given source that starts with species possibly followed by sepChar or \0 .
-   Return NULL if not found. */
-{
-struct mafComp *mc;
-int speciesLen = strlen(species);
-
-for (mc = maf->components; mc != NULL; mc = mc->next)
-    {
-    if (startsWith(species, mc->src) )
-	{
-	char endChar = mc->src[speciesLen];
-
-	if ((endChar == '\0') || (endChar == sepChar))
-	    return mc;
-	}
-    }
-return NULL;
-}
-
-
-struct mafComp *mafFindCompSpecies(struct mafAli *maf, char *species, char sepChar)
-/* Find component of given source that starts with species followed by sepChar
-   or die trying. */
-{
-struct mafComp *mc = mafMayFindCompSpecies(maf, species, sepChar);
-if (mc == NULL)
-    errAbort("Couldn't find %s%c or just %s... in maf", species,sepChar,species);
-return mc;
-}
-
-struct mafComp *mafMayFindCompPrefix(struct mafAli *maf, char *pre, char *sep)
-/* Find component of given source that starts with pre followed by sep.
-   Return NULL if not found. */
-{
-struct mafComp *mc;
-char prefix[256];
-
-if (sep == NULL)
-    sep = "";
-snprintf(prefix, 256, "%s%s", pre, sep);
-
-for (mc = maf->components; mc != NULL; mc = mc->next)
-    {
-    if (startsWith(prefix, mc->src))
-        return mc;
-    }
-return NULL;
-}
-
-struct mafComp *mafFindCompPrefix(struct mafAli *maf, char *pre, char *sep)
-/* Find component of given source that starts with pre followed by sep
-   or die trying. */
-{
-struct mafComp *mc = mafMayFindCompPrefix(maf, pre, sep);
-if (mc == NULL)
-    errAbort("Couldn't find %s%s... in maf", pre,sep);
-return mc;
-}
-
-struct mafComp *mafMayFindComponentInHash(struct mafAli *maf, struct hash *cHash) 
-/* Find arbitrary component of given source that matches any string in the cHash.
-   Return NULL if not found. */
-{
-struct mafComp *mc;
-
-for (mc = maf->components; mc != NULL; mc = mc->next)
-    {
-    if (hashFindVal(cHash, mc->src))
-        return mc;
-    }
-return NULL;
-}
-
-struct mafComp *mafMayFindSpeciesInHash(struct mafAli *maf, struct hash *cHash, char sepChar) 
-/* Find arbitrary component of given who's source prefix (ended by sep)
-   matches matches any string in the cHash.  Return NULL if not found. */
-{
-struct mafComp *mc;
-
-for (mc = maf->components; mc != NULL; mc = mc->next)
-    {
-    char *sep = strchr(mc->src, sepChar);
-    if (sep != NULL)
-        *sep = '\0';
-    boolean hit = hashFindVal(cHash, mc->src) != NULL;
-    if (sep != NULL)
-        *sep = sepChar;
-    if (hit)
-        return mc;
-    }
-return NULL;
-}
-
-boolean mafMayFindAllComponents(struct mafAli *maf, struct hash *cHash) 
-/* Find component of given source that starts matches any string in the cHash.
-   Return NULL if not found. */
-{
-struct hashCookie cookie = hashFirst(cHash);
-struct hashEl *el;
-
-while ((el = hashNext(&cookie)) != NULL)
-    if (mafMayFindComponent(maf, el->name) == NULL)
-	return FALSE;
-return TRUE;
-}
-
-struct mafAli *mafSubset(struct mafAli *maf, char *componentSource,
-	int newStart, int newEnd)
-{
-return mafSubsetE(maf, componentSource, newStart, newEnd, FALSE);
-}
-
-struct mafAli *mafSubsetE(struct mafAli *maf, char *componentSource,
-	int newStart, int newEnd, bool getInitialDashes)
-/* Extract subset of maf that intersects a given range
- * in a component sequence.  The newStart and newEnd
- * are given in the forward strand coordinates of the
- * component sequence.  The componentSource is typically
- * something like 'mm3.chr1'.  This will return NULL
- * if maf does not intersect range.  The score field
- * in the returned maf will not be filled in (since
- * we don't know which scoring scheme to use). */
-{
-struct mafComp *mcMaster = mafFindComponent(maf, componentSource);
-struct mafAli *subset;
-struct mafComp *mc, *subMc;
-char *s, *e;
-int textStart, textSize;
-
-/* Reverse complement input range if necessary. */
-if (mcMaster->strand == '-')
-    reverseIntRange(&newStart, &newEnd, mcMaster->srcSize);
-
-/* Check if any real intersection and return NULL if not. */
-if (newStart >= newEnd)
-    return NULL;
-if (newStart >= mcMaster->start + mcMaster->size)
-    return NULL;
-if (newEnd <= mcMaster->start)
-    return NULL;
-
-/* Clip to bounds of actual data. */
-if (newStart < mcMaster->start)
-    newStart = mcMaster->start;
-if (newEnd > mcMaster->start + mcMaster->size)
-    newEnd = mcMaster->start + mcMaster->size;
-
-/* Translate position in master sequence to position in
- * multiple alignment. */
-s = skipIgnoringDash(mcMaster->text, newStart - mcMaster->start, TRUE);
-e = skipIgnoringDash(s, newEnd - newStart, TRUE);
-textStart = s - mcMaster->text;
-textSize = e - s;
-
-if (getInitialDashes && (newStart == mcMaster->start))
-    {
-    textStart = 0;
-    textSize += s - mcMaster->text;
-    }
-
-/* Allocate subset structure and fill it in */
-AllocVar(subset);
-subset->textSize = textSize;
-for (mc = maf->components; mc != NULL; mc = mc->next)
-    {
-    AllocVar(subMc);
-    subMc->src = cloneString(mc->src);
-    subMc->srcSize = mc->srcSize;
-    subMc->strand = mc->strand;
-    if (mc->size != 0)
-        {
-        subMc->start = mc->start + countNonDash(mc->text, textStart);
-        subMc->size = countNonDash(mc->text+textStart, textSize);
-        subMc->text = cloneStringZ(mc->text + textStart, textSize);
-        if (mc->quality != NULL)
-            subMc->quality = cloneStringZ(mc->quality + textStart, textSize);
-        }
-    else
-	{
-        /* empty row annotation */
-        subMc->size = 0;
-        subMc->start = mc->start;
-	}
-
-    subMc->leftStatus = mc->leftStatus;
-    subMc->leftLen = mc->leftLen;
-    subMc->rightStatus = mc->rightStatus;
-    subMc->rightLen = mc->rightLen;
-
-    slAddHead(&subset->components, subMc);
-    }
-slReverse(&subset->components);
-return subset;
-}
-
-void mafMoveComponentToTop(struct mafAli *maf, char *componentSource)
-/* Move given component to head of component list. */
-{
-struct mafComp *mcMaster = mafFindComponent(maf, componentSource);
-slRemoveEl(&maf->components, mcMaster);
-slAddHead(&maf->components, mcMaster);
-}
-
-boolean mafNeedSubset(struct mafAli *maf, char *componentSource,
-	int newStart, int newEnd)
-/* Return TRUE if maf only partially fits between newStart/newEnd
- * in given component. */
-{
-struct mafComp *mcMaster = mafFindComponent(maf, componentSource);
-
-/* Reverse complement input range if necessary. */
-if (mcMaster->strand == '-')
-    reverseIntRange(&newStart, &newEnd, mcMaster->srcSize);
-
-return newStart > mcMaster->start || newEnd < mcMaster->start + mcMaster->size;
-}
-
-void mafFlipStrand(struct mafAli *maf)
-/* Reverse complement maf. */
-{
-struct mafComp *mc;
-for (mc = maf->components; mc != NULL; mc = mc->next)
-    {
-    int e = mc->start + mc->size;
-    reverseIntRange(&mc->start, &e, mc->srcSize);
-    if (mc->text != NULL)
-        reverseComplement(mc->text, maf->textSize);
-	if (mc->quality != NULL)
-		reverseBytes(mc->quality, maf->textSize);
-    if (mc->strand == '-')
-        mc->strand = '+';
-    else
-        mc->strand = '-';
-    char holdStatus = mc->leftStatus;
-    mc->leftStatus = mc->rightStatus;
-    mc->rightStatus = holdStatus;
-    int holdLen = mc->leftLen;
-    mc->leftLen = mc->rightLen;
-    mc->rightLen = holdLen;
-    }
-}
-
-void mafSrcDb(char *name, char *retDb, int retDbSize)
-/* Parse out just database part of name (up to but not including
- * first dot). If dot found, return entire name */
-{
-int len;
-char *e = strchr(name, '.');
-/* Put prefix up to dot into buf. */
-len = (e == NULL ? strlen(name) : e - name);
-if (len >= retDbSize)
-     len = retDbSize-1;
-memcpy(retDb, name, len);
-retDb[len] = 0;
-}
-
-boolean mafColumnEmpty(struct mafAli *maf, int col)
-/* Return TRUE if the column is all '-' or '.' */
-{
-assert(col < maf->textSize);
-struct mafComp *comp;
-for (comp = maf->components; comp != NULL; comp = comp->next)
-    if (comp->text != NULL)
-        {
-        char c = comp->text[col];
-        if (c != '.' && c != '-')
-            return FALSE;
-        }
-return TRUE;
-}
-
-void mafStripEmptyColumns(struct mafAli *maf)
-/* Remove columns that are all '-' or '.' from  maf. */
-{
-/* Selectively copy over non-empty columns. */
-int readIx=0, writeIx = 0;
-struct mafComp *comp;
-for (readIx=0; readIx < maf->textSize; ++readIx)
-    {
-    if (!mafColumnEmpty(maf, readIx))
-        {
-        for (comp = maf->components; comp != NULL; comp = comp->next) 
-            {
-            if(comp->text != NULL)
-                comp->text[writeIx] = comp->text[readIx];
-            if (comp->quality != NULL)
-                comp->quality[writeIx] = comp->quality[readIx];
-            }
-        ++writeIx;
-        }
-    }
-/* Zero terminate text, and update textSize. */
-for (comp = maf->components; comp != NULL; comp = comp->next)
-    {
-    if (comp->text != NULL)
-        comp->text[writeIx] = 0;
-    if (comp->quality != NULL)
-        comp->quality[writeIx] = 0;
-    }
-maf->textSize = writeIx;
-}
-
-struct mafRegDef *mafRegDefNew(char *type, int size, char *id)
-/* construct a new mafRegDef object */
-{
-struct mafRegDef *mrd;
-AllocVar(mrd);
-if (sameString(type, mafRegDefTxUpstream))
-    mrd->type = mafRegDefTxUpstream;
-else
-    errAbort("invalid mafRefDef type: %s", type);
-mrd->size = size;
-mrd->id = cloneString(id);
-return mrd;
-}
-
-void mafRegDefFree(struct mafRegDef **mrdPtr)
-/* Free a mafRegDef object */
-{
-struct mafRegDef *mrd = *mrdPtr;
-if (mrd != NULL)
-    {
-    freeMem(mrd->id);
-    freeMem(mrd);
-    *mrdPtr = NULL;
-    }
-}
-
-boolean isContigOrTandem(char status)
-/* is status MAF_CONTIG_STATUS or MAF_TANDEM_STATUS */
-{
-return ((status == MAF_CONTIG_STATUS) ||
-	(status == MAF_TANDEM_STATUS));
-}
-
-struct mafComp *mafCompClone(struct mafComp *srcComp)
-/* clone a mafComp */
-{
-struct mafComp *comp;
-AllocVar(comp);
-comp->src = cloneString(srcComp->src);
-comp->srcSize = srcComp->srcSize;
-comp->strand = srcComp->strand;
-comp->start = srcComp->start;
-comp->size = srcComp->size;
-comp->text = cloneString(srcComp->text);
-comp->quality = cloneString(srcComp->quality);
-comp->leftStatus = srcComp->leftStatus;
-comp->leftLen = srcComp->leftLen;
-comp->rightStatus = srcComp->rightStatus;
-comp->rightLen = srcComp->rightLen;
-return comp;
-}
-
-static struct mafRegDef *mafRegDefClone(struct mafRegDef *srcRegDef)
-/* clone a srcRegDef */
-{
-return mafRegDefNew(srcRegDef->type, srcRegDef->size, srcRegDef->id);
-}
-
-struct mafAli *mafAliClone(struct mafAli *srcAli)
-/* clone a mafAli */
-{
-struct mafAli *ali;
-AllocVar(ali);
-ali->score = srcAli->score;
-struct mafComp *srcComp;
-for (srcComp = srcAli->components; srcComp != NULL; srcComp = srcComp->next)
-    slAddHead(&ali->components, mafCompClone(srcComp));
-slReverse(&ali->components);
-ali->textSize = srcAli->textSize;
-if (srcAli->regDef != NULL)
-    ali->regDef = mafRegDefClone(srcAli->regDef);
-return ali;
-}
diff --git a/gbtools/src/blatSrc/lib/maf.doc b/gbtools/src/blatSrc/lib/maf.doc
deleted file mode 100644
index 4cf7eb1..0000000
--- a/gbtools/src/blatSrc/lib/maf.doc
+++ /dev/null
@@ -1,222 +0,0 @@
-Specification of the Multiple Alignment Format (.maf) v1
-
-Introduction
-
-The multiple alignment format stores a series of multiple
-alignments in a format that is easy to parse and relatively
-easy to read.  We apologize for creating yet another
-multiple alignment format.  We realize that there are
-many in existence.  What motivates this format is
-to store multiple alignments at the dna level between
-entire genomes. The existing formats we are aware of
-are geared towards multiple alignments of single proteins,
-and would require considerable extension at the least to
-cope with genomic issues such as forward and reverse
-strand directions,  multiple pieces to the alignment,
-and so forth.
-
-A Simple Example
-
-Here is a simple example of a file with two alignments
-with three sequences each:
-
-##maf version=1 scoring=probability
-#mblastz 8.91 02-Jan-2005
-
-a score=0.128
-s human_hoxa 100  9 + 100257 ACA-TTACTA
-s horse_hoxa 120 10 -  98892 ACAATTGCTA
-s fugu_hoxa   88  8  + 90788 ACA--TGCTA
-
-a score=0.071
-s human_unc 9077 8 + 10998 ACAGTATT
-s horse_unc 4555 6 -  5099 ACA--ATT
-s fugu_unc  4000 4 +  4038 AC----TT
-
-
-General Structure
-
-The .maf format is line oriented. Multiple alignments each
-end with a blank line.  Each sequence in an alignment 
-is on a single line, which can get quite long. Words in
-a line are delimited by any white space. Lines 
-starting with # are considered comments.  Lines starting 
-with ## can be ignored by most programs, but contain 
-meta-data of one form or another.  
-
-The file is broken into paragraphs that terminate in a
-blank line.  Within a paragraph the first word of a line
-indicates it's type.  Each multiple alignment is in 
-a paragraph by itself that begins with an 'a' line and
-which contains an 's' line for each sequence in the
-multiple alignment.  Parsers for now should ignore
-other types of paragraphs, and other types of lines within
-an alignment paragraph. Parsers should also ignore extra
-blank lines before paragraphs.
-
-
-The First Line
-
-The first line of a .maf file begins with ##maf.  This
-word is followed by whitespace separated variable=value pairs.  
-There must *not* be white space surrounding the =.
-The currently defined variables are:
-   version - Required.  Currently set to one.
-   scoring - Optional. A name for the scoring scheme used for the
-             alignments.  The current scoring schemes are:
-	bit - roughly corresponds to blast bit values - roughly
-	      2 points per aligning base minus penalties for mismatches
-	      and inserts.
-	blastz - blastz scoring scheme - roughly 100 points per aligning
-	      base.
-	probability - some score normalized between 0 and 1.
-   program - Optional. Name of program generating alignment.
-Parsers ignore variables they do not understand.
-
-'a' Lines
-
-Each alignment begins with an 'a' line.  The 'a' is followed
-by name=value pairs.   There are no required name=value pairs.
-The currently defined variables are:
-    score - Optional. Floating point score. If this is present
-            it is good practice to also define scoring in the first 
-	    line.
-    pass - Optional.  Positive integer value.  For programs that
-           do multiple pass alignments such as blastz,
-	   this shows which pass this alignment came from.
-	   Typically the pass 1 will find the strongest alignments
-	   genome-wide,  and pass 2 will find weaker alignments
-	   between two first pass alignments.
-
-
-'s' Lines    
-
-The s lines together with the a lines define a multiple alignment.
-The s lines have the following fields which are defined by 
-position rather than name=value pairs. 
-
-  src - The name of one of the source sequences for the alignment.
-        Typically this will be the first word following the '>' in
-	a fasta file that was input to the multiple aligner.
-  start - The start of the aligning region in the source sequence.
-        This is a zero based number. If the strand field below is
-	'-' then this is the start relative to the reverse-complemented
-	source sequence.
-  size - The size of the aligning region in the source sequence.  This
-         number is equal to the number of non-dash characters in the
-	 alignment text field below.
-  strand - Either '+' or '-'.  If '-' then the alignment is to the
-         reverse complemented source.
-  srcSize - The size of the entire source sequence, not just the parts
-         involved in the alignment.
-  text - The bases (or amino acids) in the alignment and any dashes
-         as well.
-
-
-'i' Lines
-
-The i lines are optional.  They are used by the browser to display synteny
-breaks. An i line must immediately follow the s line that it describes
-(unless there is no s line for that species in the current block).
-The i lines have the following fields which are defined by 
-position rather than name=value pairs. 
-    src - The name of one of the source sequences for the alignment.
-	    This should match the s line above the i line.
-    leftStatus - the syntenic status of the alignment before us vis a vis ourselves.  
-	    Possible Values:
-	    MAF_INVERSE_STATUS		'V'
-	    MAF_INSERT_STATUS		'I'
-	    MAF_DUP_STATUS		'D'
-	    MAF_NEW_STATUS		'N'
-	    MAF_NEW_NESTED_STATUS	'n'
-	    MAF_CONTIG_STATUS		'C'
-	    MAF_TANDEM_STATUS		'T'
-            
-    leftLen - length related information for the previous alignment for the species
-    rightStatus - the syntenic status of the alignment after us vis a vis ourselves 
-	     Possible values are same as leftStatus.
-    rightLen - length related information for the following alignment for the species 
-
-'q' Lines
-
-The q lines are optional.  They are used to display quality data for a
-sequence.  Like the i lines, q lines follow the s line that it describes.
-The q lines contain the following fields:
-    src - The name of one of the source sequences for the alignment.
-          This should match the s line above the q line.
-    quality - The quality data for corresponding to the sequence on the s line.
-
-As we are generally interested in bases with low quality, the quality
-data in the maf is a compressed version of the actual quality data.
-The quality data in the maf is:
-
-    min( floor(actualy quality value/5), 9)
-
-This allows us to show more of the low-quality values.  The relationship
-between quality characters in the maf and the actualy quality value are
-summarized in the following table:
-
-    .: In Gap Q == FAKE_GAP_QUAL
-    0: 0 <= Q < 5 || Q == 98
-    1: 5 <= Q < 10
-    2: 10 <= Q < 15
-    3: 15 <= Q < 20
-    4: 20 <= Q < 25
-    5: 25 <= Q < 30
-    6: 30 <= Q < 35
-    7: 35 <= Q < 40
-    8: 40 <= Q < 45
-    9: 45 <= Q < 98
-    F: Q == 99
-
-'e' Lines
-
-The 'e' lines are optional and indicate that there isn't aligning 
-DNA for a species but that the current block is bridged by a chain 
-that connects blocks before and after this block.
-
-  src -- The name of one of the source sequences for the alignment. 
-  start -- The start of the non-aligning region in the source sequence. 
-      This is a zero-based number. If the strand field is '-' then this is 
-      the start relative to the reverse-complemented source sequence. 
-  size -- The size in base pairs of the non-aligning region in the 
-      source sequence. 
-  strand -- Either '+' or '-'. If '-', then the alignment is to the 
-      reverse-complemented source. 
-  srcSize -- The size of the entire source sequence, not just the parts 
-      involved in the alignment. alignment and any insertions (dashes) 
-      as well. 
-  status -- A character that specifies the relationship between the 
-      non-aligning sequence in this block and the sequence that appears 
-      in the previous and subsequent blocks. 
-
-The status character can be one of the following values: 
-
-  C -- the sequence before and after is contiguous implying that this 
-      region was either deleted in the source or inserted in the 
-      reference sequence. The browser draws a single line or a '-' 
-      in base mode in these blocks. 
-  I -- there are non-aligning bases in the source species between 
-      chained alignment blocks before and after this block. The 
-      browser shows a double line or '=' in base mode. 
-  M -- there are non-aligning bases in the source and more than 95% 
-      of them are Ns in the source. The browser shows a pale yellow bar. 
-  n -- there are non-aligning bases in the source and the next aligning 
-      block starts in a new chromosome or scaffold that is bridged by 
-      a chain between still other blocks. The browser shows either a 
-      single line or a double line based on how many bases are in the 
-      gap between the bridging alignments. 
-
-'r' Lines
-
-The r lines are optional.  They specify how this region of the
-MAF was defined.  A paragraph can only have one r line.  The
-first word defines the source type, with the remanded of the
-words specific to the source type.  The following source types
-are defined:
-
-   txupstream - Gene transcription start upstream regions:
-           r txupstream size geneId
-       size - is the number of bases in the region
-       geneId - gene identifier for the gene
-
diff --git a/gbtools/src/blatSrc/lib/mafFromAxt.c b/gbtools/src/blatSrc/lib/mafFromAxt.c
deleted file mode 100644
index c32546a..0000000
--- a/gbtools/src/blatSrc/lib/mafFromAxt.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* mafFromAxt - convert a axt into maf. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "axt.h"
-#include "maf.h"
-
-
-void mafFromAxtTemp(struct axt *axt, int tSize, int qSize,
-	struct mafAli *temp)
-/* Make a maf out of axt,  parasiting on the memory in axt.
- * Do *not* mafFree this temp.  The memory it has in pointers
- * is still owned by the axt.  Furthermore the next call to
- * this function will invalidate the previous temp value.
- * It's sort of a kludge, but quick to run and easy to implement. */
-{
-static struct mafComp qComp, tComp;
-ZeroVar(temp);
-ZeroVar(&qComp);
-ZeroVar(&tComp);
-temp->score = axt->score;
-temp->textSize = axt->symCount;
-qComp.src = axt->qName;
-qComp.srcSize = qSize;
-qComp.strand = axt->qStrand;
-qComp.start = axt->qStart;
-qComp.size = axt->qEnd - axt->qStart;
-qComp.text = axt->qSym;
-slAddHead(&temp->components, &qComp);
-tComp.src = axt->tName;
-tComp.srcSize = tSize;
-tComp.strand = axt->tStrand;
-tComp.start = axt->tStart;
-tComp.size = axt->tEnd - axt->tStart;
-tComp.text = axt->tSym;
-slAddHead(&temp->components, &tComp);
-}
-
-struct mafAli *mafFromAxt(struct axt *axt, int tSize, 
-	char *tPrefix, int qSize, char *qPrefix)
-/* Make up a maf file from axt.  Slower than mafFromAxtTemp,
- * but the axt and maf are independent afterwards. */
-{
-struct mafAli *maf;
-struct mafComp *mc;
-char name[256];
-AllocVar(maf);
-maf->score = axt->score;
-maf->textSize = axt->symCount;
-AllocVar(mc);
-if (qPrefix == NULL)
-    mc->src = cloneString(axt->qName);
-else
-    {
-    safef(name, sizeof(name), "%s.%s", qPrefix, axt->qName);
-    mc->src = cloneString(name);
-    }
-mc->srcSize = qSize;
-mc->strand = axt->qStrand;
-mc->start = axt->qStart;
-mc->size = axt->qEnd - axt->qStart;
-mc->text = cloneStringZ(axt->qSym, axt->symCount);
-slAddHead(&maf->components, mc);
-AllocVar(mc);
-if (tPrefix == NULL)
-    mc->src = cloneString(axt->tName);
-else
-    {
-    safef(name, sizeof(name), "%s.%s", tPrefix, axt->tName);
-    mc->src = cloneString(name);
-    }
-mc->srcSize = tSize;
-mc->strand = axt->tStrand;
-mc->start = axt->tStart;
-mc->size = axt->tEnd - axt->tStart;
-mc->text = cloneStringZ(axt->tSym, axt->symCount);
-slAddHead(&maf->components, mc);
-return maf;
-}
diff --git a/gbtools/src/blatSrc/lib/mafScore.c b/gbtools/src/blatSrc/lib/mafScore.c
deleted file mode 100644
index 6cc2675..0000000
--- a/gbtools/src/blatSrc/lib/mafScore.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* Score mafs and subsets of maf. 
- * This module is from Webb Miller at PSU. 
- * Some description of maf scoring is included in hgLoadMaf.c comments*/
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "maf.h"
-
-
-
-typedef struct gap_scores {
-	int E;
-	int O;
-} gap_scores_t;
-
-#define CLEN(s) (sizeof((s))-1)
-#define NACHARS 128
-#define SS(c,d) ss[(uchar)c][(uchar)d]
-#define GAP(w,x,y,z) gop[(gtype[w]<<6)+(gtype[x]<<4)+(gtype[y]<<2)+gtype[z]]
-#define DASH '-'
-
-typedef int ss_t[NACHARS][NACHARS];
-typedef unsigned char uchar;
-
-static ss_t ss;
-static gap_scores_t ds;
-static int gop[256], gtype[128];
-
-static const uchar nchars[] = "ACGT";
-static const int simpleScoringMatrix[4][4] = {
-  { 100, -10000, -10000, -10000},
-  { -10000, 100, -10000, -10000},
-  { -10000, -10000, 100, -10000},
-  { -10000, -10000, -10000, 100},
-};
-
-static const int HOXD70_sym[4][4] = {
-  {  91, -114,  -31, -123 },
-  {-114,  100, -125,  -31 },
-  { -31, -125,  100, -114 },
-  {-123,  -31, -114,   91 },
-};
-
-/* DNA_scores --------------------------  substitution scoring matrix for DNA */
-static void DNA_scores(ss_t ss, const int matrix[4][4])
-{
-    int i, j, bad, a, b, A, B;
-
-    for (i = 0; i < NACHARS; ++i)
-	    for (j = 0; j < NACHARS; ++j)
-		    ss[i][j] = -100;
-    for (i = 0; i < (signed)CLEN(nchars); ++i) {
-	    A = nchars[i];
-	    a = tolower(A);
-	    for (j = 0; j < (signed)CLEN(nchars); ++j) {
-		    B = nchars[j];
-		    b = tolower(B);
-		    ss[A][B] = ss[a][B] = ss[A][b] = ss[a][b] =
-			    matrix[i][j];
-	    }
-    }
-    bad = -1000;
-    for (i = 0; i < NACHARS; ++i)
-	    ss['X'][i] = ss[i]['X'] = ss['x'][i] = ss[i]['x'] = bad;
-}
-
-
-static void gap_costs(int *gop, int *gtype, int gap_open)
-{
-	int i, X, D;
-
-	for (i = 0; i < 128; ++i)
-		gtype[i] = 0;
-	D = DASH;
-	gtype[D] = 1;
-
-	for (i = 0; i < 256; ++i)
-		gop[i] = 0;
-	X = (uchar)'A';
-	GAP(X,X,X,D) = gap_open;
-	GAP(X,X,D,X) = gap_open;
-	GAP(X,D,D,X) = gap_open;
-	GAP(D,X,X,D) = gap_open;
-	GAP(D,D,X,D) = gap_open;
-	GAP(D,D,D,X) = gap_open;
-}
-
-static boolean ssInitialized = FALSE;
-
-void mafScoreUseSimple()
-/* use a simple scoring system useful for finding mismatches */
-{
-    int i; 
-    DNA_scores(ss, simpleScoringMatrix);
-    ds.E = 30;
-    ds.O = 400;
-    for (i = 0; i < 128; ++i)
-	    ss[i][DASH] = ss[DASH][i] = 0;
-    ss[DASH][DASH] = 0;
-    gap_costs(gop, gtype, ds.O);   /* quasi-natural gap costs */
-    ssInitialized = TRUE;
-}
-
-void mafScoreUseTraditional()
-/* use the tradition HOX scoring system */
-{
-    int i; 
-    DNA_scores(ss, HOXD70_sym);
-    ds.E = 30;
-    ds.O = 400;
-    for (i = 0; i < 128; ++i)
-	ss[i][DASH] = ss[DASH][i] = -ds.E;
-    ss[DASH][DASH] = 0;
-    gap_costs(gop, gtype, ds.O);   /* quasi-natural gap costs */
-    ssInitialized = TRUE;
-}
-
-double mafScoreRangeMultiz(struct mafAli *maf, int start, int size)
-/* Return score of a subset of an alignment.  Parameters are:
- *    maf - the alignment
- *    start - the (zero based) offset to start calculating score
- *    size - the size of the subset
- * The following relationship should hold:
- *   scoreRange(maf,start,size) =
- *	scoreRange(maf,0,start+size) - scoreRange(maf,0,start)
- */
-{
-uchar ai, ar, bi, br;
-int i;
-double score;
-struct mafComp *c1, *c2;
-
-if (start < 0 || size <= 0 || 
-    start+size > maf->textSize) {
-	errAbort( "mafScoreRange: start = %d, size = %d, textSize = %d\n",
-		start, size, maf->textSize);
-}
-if (!ssInitialized)
-    mafScoreUseTraditional();
-
-score = 0.0;
-for (i = start; i < start+size; ++i) {
-	for (c1 = maf->components; c1 != NULL; c1 = c1->next) {
-		if (c1->size == 0) continue;
-		br = c1->text[i];
-		for (c2 = c1->next; c2 != NULL; c2 = c2->next) {
-			if (c2->size == 0) continue;
-			bi = c2->text[i];
-			score += SS(br, bi);
-			if (i > 0) {
-				ar = c1->text[i-1];
-				ai = c2->text[i-1];
-				score -= GAP(ar,ai,br,bi);
-			}
-		}
-	}
-}
-return score;
-}
-
-double mafScoreMultiz(struct mafAli *maf)
-/* Return score of a maf (calculated rather than what is
- * stored in the structure. */
-{
-return mafScoreRangeMultiz(maf, 0, maf->textSize);
-}
-
-double mafScoreMultizMaxCol(int species)
-/* Return maximum possible score for a column. */
-{
-int i, count = 0;
-for (i=1; i<species; ++i)
-    count += i;
-return 100.0*count; 
-}
-
-void mafColMinMaxScore(struct mafAli *maf, 
-	double *retMin, double *retMax)
-/* Get min/max maf scores for a column. */
-{
-*retMax = mafScoreMultizMaxCol(slCount(maf->components));
-*retMin = -*retMax;
-}
-
diff --git a/gbtools/src/blatSrc/lib/mailViaPipe.c b/gbtools/src/blatSrc/lib/mailViaPipe.c
deleted file mode 100644
index 272a8fd..0000000
--- a/gbtools/src/blatSrc/lib/mailViaPipe.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* mailViaPipe - a safer and sharable sendmail utility using
- * more secure pipeline module.
- * Special note: 
- * Currently, RR never return exit or error status to the browser 
- * after sendmail, so the implementation here does not handle any 
- * error condition at all, and will return 0 regardless. */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
- 
-#include "pipeline.h"
-#include "common.h"
-#include "mailViaPipe.h"
-
-int mailViaPipe(char *toAddress, char *theSubject, char *theBody, char *fromAddress)
-/* Send mail via pipeline to sendmail.  Abort if a problem. */
-{
-char *cmd1[] = {"/usr/sbin/sendmail", "-t", "-oi", NULL};
-struct pipeline *dataPipe = pipelineOpen1(cmd1, pipelineWrite | pipelineNoAbort,
-"/dev/null", NULL);
-FILE *out = pipelineFile(dataPipe);
-fprintf(out, "To: %s\n", toAddress);
-fprintf(out, "From: %s\n", fromAddress);
-fprintf(out, "Subject: %s\n", theSubject);
-fprintf(out, "\n");
-fprintf(out, "%s\n", theBody);
-fflush(out);
-return pipelineClose(&dataPipe);
-}
-
diff --git a/gbtools/src/blatSrc/lib/makefile b/gbtools/src/blatSrc/lib/makefile
deleted file mode 100644
index 4076551..0000000
--- a/gbtools/src/blatSrc/lib/makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-include ../inc/localEnvironment.mk
-include ../inc/common.mk
-
-O = aliType.o annoAssembly.o annoFilter.o annoFormatter.o annoFormatTab.o \
-    annoGrator.o annoGrateWig.o annoGratorQuery.o annoOption.o annoRow.o \
-    annoStreamer.o annoStreamBigBed.o annoStreamBigWig.o annoStreamTab.o annoStreamVcf.o \
-    apacheLog.o asParse.o axt.o axtAffine.o bamFile.o base64.o \
-    basicBed.o bbiRead.o bbiWrite.o bigBed.o binRange.o bits.o \
-    blastOut.o blastParse.o boxClump.o boxLump.o bPlusTree.o \
-    bwgCreate.o bwgQuery.o bwgValsOnChrom.o \
-    cda.o chain.o chainBlock.o chainConnect.o chainToAxt.o chainToPsl.o \
-    cheapcgi.o cirTree.o codebias.o colHash.o common.o correlate.o crTree.o \
-    dgRange.o diGraph.o dlist.o dnaLoad.o dnaMarkov.o dnaMotif.o dnaseq.o \
-    dnautil.o dtdParse.o dyOut.o dystring.o elmTree.o \
-    emblParse.o errCatch.o errAbort.o \
-    fa.o ffAli.o ffScore.o fieldedTable.o filePath.o fixColor.o flydna.o fof.o \
-    font/mgCourier10.o font/mgCourier12.o font/mgCourier14.o font/mgCourier18.o \
-    font/mgCourier24.o font/mgCourier34.o font/mgCourier8.o font/mgHelvetica10.o \
-    font/mgHelvetica12.o font/mgHelvetica14.o font/mgHelvetica18.o font/mgHelvetica24.o \
-    font/mgHelvetica34.o font/mgHelvetica8.o font/mgHelveticaBold10.o font/mgHelveticaBold12.o \
-    font/mgHelveticaBold14.o font/mgHelveticaBold18.o font/mgHelveticaBold24.o \
-    font/mgHelveticaBold34.o font/mgHelveticaBold8.o font/mgSixhi6.o font/mgSail8.o \
-    font/mgTimes10.o font/mgTimes12.o font/mgTimes14.o font/mgTimes18.o \
-    font/mgTimes24.o font/mgTimes34.o font/mgTimes8.o font/mgMenlo12.o \
-    fq.o fuzzyShow.o \
-    gapCalc.o gdf.o gemfont.o genomeRangeTree.o \
-    gfNet.o gff.o gff3.o gfxPoly.o gifLabel.o \
-    hacTree.o hash.o hex.o histogram.o hmmPfamParse.o hmmstats.o htmlPage.o htmshell.o \
-    hmac.o https.o intExp.o intValTree.o internet.o itsa.o iupac.o \
-    jointalign.o jpegSize.o jsonParse.o jsonWrite.o \
-    keys.o knetUdc.o kxTok.o linefile.o lineFileOnBigBed.o localmem.o log.o longToList.o \
-    maf.o mafFromAxt.o mafScore.o mailViaPipe.o md5.o memalloc.o \
-    memgfx.o meta.o metaWig.o mgCircle.o \
-    mgPolygon.o mime.o net.o nib.o nibTwo.o nt4.o numObscure.o \
-    obscure.o oldGff.o oligoTm.o options.o osunix.o pairHmm.o pairDistance.o \
-    paraFetch.o peakCluster.o \
-    phyloTree.o pipeline.o portimpl.o pngwrite.o psGfx.o psPoly.o pscmGfx.o \
-    psl.o pslGenoShow.o pslShow.o pslTbl.o pslTransMap.o pthreadDoList.o pthreadWrap.o \
-    qa.o quickHeap.o quotedP.o \
-    ra.o rainbow.o raToStruct.o rbTree.o rangeTree.o regexHelper.o repMask.o \
-    rle.o rnautil.o rqlEval.o rqlParse.o rudp.o \
-    scoreWindow.o seg.o seqOut.o seqStats.o servBrcMcw.o servCrunx.o \
-    servcis.o servcl.o servmsII.o servpws.o shaRes.o slog.o snof.o \
-    snofmake.o snofsig.o spaceSaver.o spacedColumn.o spacedSeed.o \
-    splatAli.o sqlList.o sqlNum.o subText.o sufa.o sufx.o synQueue.o \
-    tabRow.o textOut.o tokenizer.o trix.o twoBit.o \
-    udc.o vcf.o vcfBits.o vGfx.o vPng.o verbose.o \
-    wildcmp.o wormdna.o \
-    xAli.o xa.o xap.o xenshow.o xmlEscape.o xp.o zlibFace.o
-
-$(MACHTYPE)/jkweb.a: $(O) $(MACHTYPE)
-	ar rcus $(MACHTYPE)/jkweb.a $(O)
-
-$(MACHTYPE):
-	mkdir $(MACHTYPE)
-
-test:
-	cd tests && ${MAKE} test
-
-clean:
-	rm -f ${O} $(MACHTYPE)/jkweb.a
-	cd tests && ${MAKE} clean
-
-tags:
-	etags ../inc/*.h ../lib/*.h ../lib/*.c  ../hg/inc/*.h ../hg/lib/*.h ../hg/lib/*.c ../hg/hgTracks/*.c ../hg/hgc/*.c ../hg/hgTrackUi/*.c
diff --git a/gbtools/src/blatSrc/lib/md5.c b/gbtools/src/blatSrc/lib/md5.c
deleted file mode 100644
index e16fff5..0000000
--- a/gbtools/src/blatSrc/lib/md5.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* md5 calculating functions and the like.  Just wrappers for md5sum program */
-
-#include "common.h"
-#include "hex.h"
-#include "linefile.h"
-#include "hash.h"
-#include "pipeline.h"
-#include "md5.h"
-
-char *md5ToHex(unsigned char md5[16])
-/* Convert binary representation of md5 to hex string. Do a freeMem on result when done. */
-{
-char hex[33];
-char *h;
-int i;
-for (i = 0, h=hex; i < 16; ++i, h += 2)
-    byteToHex( md5[i], h);  
-hex[32] = 0;
-return cloneString(hex);
-}
-
-void md5HexToMd5(char hexIn[32], unsigned char md5Out[16])
-/* Convert hexadecimal representation of md5 back to binary */
-{
-char *pt = hexIn;
-int i;
-for (i=0; i<16; ++i)
-     {
-     md5Out[i] = hexToByte(pt);
-     pt += 2;
-     }
-}
-
-char *md5HexForFile(char *fileName)
-/* Calculate md5 on file and return in hex format.  Use freeMem on result when done. */
-{
-/* Calculate md5 using pipeline to unix utility. */
-char *cmd[] = {"md5sum", NULL};
-struct pipeline *pl = pipelineOpen1(cmd, pipelineRead, fileName, NULL);
-FILE *f = pipelineFile(pl);
-char hex[33];
-mustRead(f, hex, 32);
-hex[32] = 0;
-pipelineClose(&pl);
-return cloneString(hex);
-}
-
-char *md5HexForBuf(char *buf, size_t bufSize)
-/* Return md5 sum of buffer. Use freeMem on result when done. */
-{
-/* Calculate md5 using pipeline to unix utility. */
-char *cmd[] = {"md5sum", NULL};
-struct pipeline *pl = pipelineOpenMem1(cmd, pipelineRead, buf, bufSize, fileno(stderr));
-FILE *f = pipelineFile(pl);
-char hex[33];
-mustRead(f, hex, 32);
-hex[32] = 0;
-pipelineClose(&pl);
-return cloneString(hex);
-}
-
-char *md5HexForString(char *string)
-/* Return md5 sum of zero-terminated string. Use freeMem on result when done. */
-{
-return md5HexForBuf(string, strlen(string));
-}
-
-void md5ForFile(char *fileName, unsigned char md5[16])
-/* Return MD5 sum for file in md5 in binary rather than hex format. */
-{
-char *hex = md5HexForFile(fileName);
-md5HexToMd5(hex, md5);
-freeMem(hex);
-}
-
-struct hash *md5FileHash(char *fileName)
-/* Read md5sum file and return a hash keyed by file names with md5sum values. */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *row[2];
-struct hash *hash = hashNew(0);
-while (lineFileRow(lf, row))
-    hashAdd(hash, row[1], cloneString(row[0]));
-lineFileClose(&lf);
-return hash;
-}
diff --git a/gbtools/src/blatSrc/lib/memalloc.c b/gbtools/src/blatSrc/lib/memalloc.c
deleted file mode 100644
index 2011c27..0000000
--- a/gbtools/src/blatSrc/lib/memalloc.c
+++ /dev/null
@@ -1,519 +0,0 @@
-/* memalloc.c - Routines to allocate and deallocate dynamic memory. 
- * This lets you have a stack of memory handlers.  The default
- * memory handler is a thin shell around malloc/free.  You can
- * substitute routines that do more integrety checking with
- * pushCarefulMem(), or routines of your own devising with
- * pushMemHandler(). 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include <pthread.h>
-#include "common.h"
-#include "obscure.h"
-#include "memalloc.h"
-#include "dlist.h"
-
-
-static void *defaultAlloc(size_t size)
-/* Default allocator. */
-{
-return malloc(size);
-}
-
-static void defaultFree(void *vpt)
-/* Default deallocator. */
-{
-free(vpt);
-}
-
-static void *defaultRealloc(void *vpt, size_t size)
-/* Default deallocator. */
-{
-return realloc(vpt, size);
-}
-
-static struct memHandler defaultMemHandler = 
-/* Default memory handler. */
-    {
-    NULL,
-    defaultAlloc,
-    defaultFree,
-    defaultRealloc,
-    };
-
-static struct memHandler *mhStack = &defaultMemHandler;
-
-struct memHandler *pushMemHandler(struct memHandler *newHandler)
-/* Use newHandler for memory requests until matching popMemHandler.
- * Returns previous top of memory handler stack. */
-{
-struct memHandler *oldHandler = mhStack;
-slAddHead(&mhStack, newHandler);
-return oldHandler;
-}
-
-
-struct memHandler *popMemHandler()
-/* Removes top element from memHandler stack and returns it. */
-{
-struct memHandler *oldHandler = mhStack;
-if (mhStack == &defaultMemHandler)
-    errAbort("Too many popMemHandlers()");
-mhStack = mhStack->next;
-return oldHandler;
-}
-
-
-void setDefaultMemHandler()
-/* Sets memHandler to the default. */
-{
-mhStack = &defaultMemHandler;
-}
-
-/* 128*8*1024*1024 == 1073741824 == 2^30 on 32 bit machines,size_t == 4 bytes*/
-/* on 64 bit machines, size_t = 8 bytes, 2^30 * 2 * 2 * 2 * 2 = 2^34 == 16 Gb */
-static size_t maxAlloc = (size_t)128*8*1024*1024*(sizeof(size_t)/4)*(sizeof(size_t)/4)*(sizeof(size_t)/4*(sizeof(size_t)/4));
-
-void setMaxAlloc(size_t s)
-/* Set large allocation limit. */
-{
-maxAlloc = s;
-}
-
-void *needLargeMem(size_t size)
-/* This calls abort if the memory allocation fails. The memory is
- * not initialized to zero. */
-{
-void *pt;
-if (size == 0 || size >= maxAlloc)
-    errAbort("needLargeMem: trying to allocate %llu bytes (limit: %llu)",
-         (unsigned long long)size, (unsigned long long)maxAlloc);
-if ((pt = mhStack->alloc(size)) == NULL)
-    errAbort("needLargeMem: Out of memory - request size %llu bytes, errno: %d\n",
-             (unsigned long long)size, errno);
-return pt;
-}
-
-void *needLargeZeroedMem(size_t size)
-/* Request a large block of memory and zero it. */
-{
-void *v;
-v = needLargeMem(size);
-memset(v, 0, size);
-return v;
-}
-
-void *needLargeMemResize(void* vp, size_t size)
-/* Adjust memory size on a block, possibly relocating it.  If vp is NULL,
- * a new memory block is allocated.  Memory not initted. */
-{
-void *pt;
-if (size == 0 || size >= maxAlloc)
-    errAbort("needLargeMemResize: trying to allocate %llu bytes (limit: %llu)",
-         (unsigned long long)size, (unsigned long long)maxAlloc);
-if ((pt = mhStack->realloc(vp, size)) == NULL)
-    errAbort("needLargeMemResize: Out of memory - request size %llu bytes, errno: %d\n",
-             (unsigned long long)size, errno);
-return pt;
-}
-
-void *needLargeZeroedMemResize(void* vp, size_t oldSize, size_t newSize)
-/* Adjust memory size on a block, possibly relocating it.  If vp is NULL, a
- * new memory block is allocated.  If block is grown, new memory is zeroed. */
-{
-void *v = needLargeMemResize(vp, newSize);
-if (newSize > oldSize)
-    memset(((char*)v)+oldSize, 0, newSize-oldSize);
-return v;
-}
-
-void *needHugeMem(size_t size)
-/* No checking on size.  Memory not initted. */
-{
-void *pt;
-if (size == 0)
-    errAbort("needHugeMem: trying to allocate 0 bytes");
-if ((pt = mhStack->alloc(size)) == NULL)
-    errAbort("needHugeMem: Out of huge memory - request size %llu bytes, errno: %d\n",
-             (unsigned long long)size, errno);
-return pt;
-}
-
-
-void *needHugeZeroedMem(size_t size)
-/* Request a large block of memory and zero it. */
-{
-void *v;
-v = needHugeMem(size);
-memset(v, 0, size);
-return v;
-}
-
-void *needHugeMemResize(void* vp, size_t size)
-/* Adjust memory size on a block, possibly relocating it.  If vp is NULL,
- * a new memory block is allocated.  No checking on size.  Memory not
- * initted. */
-{
-void *pt;
-if ((pt = mhStack->realloc(vp, size)) == NULL)
-    errAbort("needHugeMemResize: Out of memory - request resize %llu bytes, errno: %d\n",
-	(unsigned long long)size, errno);
-return pt;
-}
-
-
-void *needHugeZeroedMemResize(void* vp, size_t oldSize, size_t newSize)
-/* Adjust memory size on a block, possibly relocating it.  If vp is NULL, a
- * new memory block is allocated.  No checking on size.  If block is grown,
- * new memory is zeroed. */
-{
-void *v;
-v = needHugeMemResize(vp, newSize);
-if (newSize > oldSize)
-    memset(((char*)v)+oldSize, 0, newSize-oldSize);
-return v;
-}
-
-#define NEEDMEM_LIMIT 500000000
-
-void *needMem(size_t size)
-/* Need mem calls abort if the memory allocation fails. The memory
- * is initialized to zero. */
-{
-void *pt;
-if (size == 0 || size > NEEDMEM_LIMIT)
-    errAbort("needMem: trying to allocate %llu bytes (limit: %llu)",
-         (unsigned long long)size, (unsigned long long)NEEDMEM_LIMIT);
-if ((pt = mhStack->alloc(size)) == NULL)
-    errAbort("needMem: Out of memory - request size %llu bytes, errno: %d\n",
-             (unsigned long long)size, errno);
-memset(pt, 0, size);
-return pt;
-}
-
-void *needMoreMem(void *old, size_t oldSize, size_t newSize)
-/* Adjust memory size on a block, possibly relocating it.  If vp is NULL, a
- * new memory block is allocated.  No checking on size.  If block is grown,
- * new memory is zeroed. */
-{
-return needLargeZeroedMemResize(old, oldSize, newSize);
-}
-
-void *wantMem(size_t size)
-/* Want mem just calls malloc - no zeroing of memory, no
- * aborting if request fails. */
-{
-return mhStack->alloc(size);
-}
-
-void freeMem(void *pt)
-/* Free memory will check for null before freeing. */
-{
-if (pt != NULL)
-    mhStack->free(pt);
-}
-
-void freez(void *vpt)
-/* Pass address of pointer.  Will free pointer and set it 
- * to NULL. */
-{
-void **ppt = (void **)vpt;
-void *pt = *ppt;
-*ppt = NULL;
-freeMem(pt);
-}
-
-static pthread_mutex_t carefulMutex = PTHREAD_MUTEX_INITIALIZER;
-
-static int carefulAlignSize;    /* Alignment size for machine - 8 bytes for DEC alpha, 4 for Sparc. */
-static int carefulAlignAdd;     /* Do aliSize = *(unaliSize+carefulAlignAdd)&carefulAlignMask); */
-
-#if __WORDSIZE == 64
-static bits64 carefulAlignMask;    /* to make sure requests are aligned. */
-#elif __WORDSIZE == 32
-static bits32 carefulAlignMask;    /* to make sure requests are aligned. */
-#else
-static bits32 carefulAlignMask;    /* to make sure requests are aligned. */
-#endif
-
-static struct memHandler *carefulParent;
-
-static size_t carefulMaxToAlloc;
-static size_t carefulAlloced;
-
-struct carefulMemBlock
-/* Keep one of these for each outstanding memory block.   It's a doubly linked list. */
-    {
-    struct carefulMemBlock *next;
-    struct carefulMemBlock *prev;
-    int size;
-    int startCookie;
-    };
-
-int cmbStartCookie = 0x78753421;
-
-char cmbEndCookie[4] = {0x44, 0x33, 0x7F, 0x42};
-
-struct dlList *cmbAllocedList;
-
-static void carefulMemInit(size_t maxToAlloc)
-/* Initialize careful memory system */
-{
-carefulMaxToAlloc = maxToAlloc;
-cmbAllocedList = newDlList();
-carefulAlignSize = sizeof(double);
-if (sizeof(void *) > carefulAlignSize)
-    carefulAlignSize = sizeof(void *);
-if (sizeof(long) > carefulAlignSize)
-    carefulAlignSize = sizeof(long);
-if (sizeof(off_t) > carefulAlignSize)
-    carefulAlignSize = sizeof(off_t);
-if (sizeof(long long) > carefulAlignSize)
-    carefulAlignSize = sizeof(long long);
-carefulAlignAdd = carefulAlignSize-1;
-carefulAlignMask = ~carefulAlignAdd;
-}
-
-
-static void *carefulAlloc(size_t size)
-/* Allocate extra memory for cookies and list node, and then
- * return memory block. */
-{
-pthread_mutex_lock( &carefulMutex );
-struct carefulMemBlock *cmb;
-char *pEndCookie;
-size_t newAlloced = size + carefulAlloced;
-size_t aliSize;
-
-if (newAlloced > carefulMaxToAlloc)
-    {
-    char maxAlloc[32];
-    char allocRequest[32];
-    sprintLongWithCommas(maxAlloc, (long long)carefulMaxToAlloc);
-    sprintLongWithCommas(allocRequest, (long long)newAlloced);
-    pthread_mutex_unlock( &carefulMutex );
-    errAbort("carefulAlloc: Allocated too much memory - more than %s bytes (%s)",
-	maxAlloc, allocRequest);
-    }
-carefulAlloced = newAlloced;
-aliSize = ((size + sizeof(*cmb) + 4 + carefulAlignAdd)&carefulAlignMask);
-cmb = carefulParent->alloc(aliSize);
-cmb->size = size;
-cmb->startCookie = cmbStartCookie;
-pEndCookie = (char *)(cmb+1);
-pEndCookie += size;
-memcpy(pEndCookie, cmbEndCookie, sizeof(cmbEndCookie));
-dlAddHead(cmbAllocedList, (struct dlNode *)cmb);
-pthread_mutex_unlock( &carefulMutex );
-return (void *)(cmb+1);
-}
-
-static void carefulFree(void *vpt)
-/* Check cookies and free. */
-{
-pthread_mutex_lock( &carefulMutex );
-struct carefulMemBlock *cmb = ((struct carefulMemBlock *)vpt)-1;
-size_t size = cmb->size;
-char *pEndCookie;
-
-carefulAlloced -= size;
-pEndCookie = (((char *)(cmb+1)) + size);
-if (cmb->startCookie != cmbStartCookie)
-    {
-    pthread_mutex_unlock( &carefulMutex );
-    errAbort("Bad start cookie %x freeing %llx\n", cmb->startCookie,
-             ptrToLL(vpt));
-    }
-if (memcmp(pEndCookie, cmbEndCookie, sizeof(cmbEndCookie)) != 0)
-    {
-    pthread_mutex_unlock( &carefulMutex );
-    errAbort("Bad end cookie %x%x%x%x freeing %llx\n", 
-        pEndCookie[0], pEndCookie[1], pEndCookie[2], pEndCookie[3],
-             ptrToLL(vpt));
-    }
-dlRemove((struct dlNode *)cmb);
-carefulParent->free(cmb);
-pthread_mutex_unlock( &carefulMutex );
-}
-
-
-static void *carefulRealloc(void *vpt, size_t size)
-/* realloc a careful memblock block. */
-{
-unsigned char* newBlk = carefulAlloc(size);
-if (vpt != NULL)
-    {
-    struct carefulMemBlock *cmb = ((struct carefulMemBlock *)vpt)-1;
-    memcpy(newBlk, vpt, cmb->size);
-    carefulFree(vpt);
-    }
-return newBlk;
-}
-
-
-void carefulCheckHeap()
-/* Walk through allocated memory and make sure that all cookies are
- * in place. */
-{
-int maxPieces = 10000000;    /* Assume no more than this many pieces allocated. */
-struct carefulMemBlock *cmb;
-char *pEndCookie;
-size_t size;
-char errMsg[1024];
-boolean errFound = FALSE;
-
-if (carefulParent == NULL)
-    return;
-
-pthread_mutex_lock( &carefulMutex );
-for (cmb = (struct carefulMemBlock *)(cmbAllocedList->head); cmb->next != NULL; cmb = cmb->next)
-    {
-    size = cmb->size;
-    pEndCookie = (((char *)(cmb+1)) + size);
-    if (cmb->startCookie != cmbStartCookie)
-	{
-        safef(errMsg, sizeof errMsg, "Bad start cookie %x checking %llx\n", cmb->startCookie,
-                 ptrToLL(cmb+1));
-	errFound = TRUE;
-	break;
-	}
-    if (memcmp(pEndCookie, cmbEndCookie, sizeof(cmbEndCookie)) != 0)
-	{
-        safef(errMsg, sizeof errMsg, "Bad end cookie %x%x%x%x checking %llx\n", 
-                 pEndCookie[0], pEndCookie[1], pEndCookie[2], pEndCookie[3],
-                 ptrToLL(cmb+1));
-	errFound = TRUE;
-	break;
-	}
-    if (--maxPieces == 0)
-	{
-        safef(errMsg, sizeof errMsg, "Loop or more than 10000000 pieces in memory list");
-	errFound = TRUE;
-	break;
-	}
-    }
-pthread_mutex_unlock( &carefulMutex );
-if (errFound)
-    errAbort("%s", errMsg);
-}
-
-int carefulCountBlocksAllocated()
-/* How many memory items are allocated? */
-{
-pthread_mutex_lock( &carefulMutex );
-int result = dlCount(cmbAllocedList);
-pthread_mutex_unlock( &carefulMutex );
-return result;
-}
-
-size_t carefulTotalAllocated()
-/* Return total bases allocated */
-{
-pthread_mutex_lock( &carefulMutex );
-size_t result = carefulAlloced;
-pthread_mutex_unlock( &carefulMutex );
-return result;
-}
-
-static struct memHandler carefulMemHandler = 
-/* Default memory handler. */
-    {
-    NULL,
-    carefulAlloc,
-    carefulFree,
-    carefulRealloc,
-    };
-
-void pushCarefulMemHandler(size_t maxAlloc)
-/* Push the careful (paranoid, conservative, checks everything)
- * memory handler  top of the memHandler stack and use it. */
-{
-carefulMemInit(maxAlloc);
-carefulParent = pushMemHandler(&carefulMemHandler);
-}
-
-struct memTracker
-/* A structure to keep track of memory. */
-    {
-    struct memTracker *next;	 /* Next in list. */
-    struct dlList *list;	 /* List of allocated blocks. */
-    struct memHandler *parent;   /* Underlying memory handler. */
-    struct memHandler *handler;  /* Memory handler. */
-    };
-
-static struct memTracker *memTracker = NULL;	/* Head in memTracker list. */
-
-static void *memTrackerAlloc(size_t size)
-/* Allocate extra memory for cookies and list node, and then
- * return memory block. */
-{
-struct dlNode *node;
-
-size += sizeof (*node);
-node = memTracker->parent->alloc(size);
-if (node == NULL)
-    return node;
-dlAddTail(memTracker->list, node);
-return (void*)(node+1);
-}
-
-static void memTrackerFree(void *vpt)
-/* Check cookies and free. */
-{
-struct dlNode *node = vpt;
-node -= 1;
-dlRemove(node);
-memTracker->parent->free(node);
-}
-
-static void *memTrackerRealloc(void *vpt, size_t size)
-/* Resize a memory block from memTrackerAlloc. */
-{
-if (vpt == NULL)
-    return memTrackerAlloc(size);
-else
-    {
-    struct dlNode *node = ((struct dlNode *)vpt)-1;
-    size += sizeof(*node);
-    dlRemove(node);
-    node = memTracker->parent->realloc(node, size);
-    if (node == NULL)
-        return node;
-    dlAddTail(memTracker->list, node);
-    return (void*)(node+1);
-    }
-}
-
-void memTrackerStart()
-/* Push memory handler that will track blocks allocated so that
- * they can be automatically released with memTrackerEnd().  You
- * can have memTrackerStart one after the other, but memTrackerStart/End
- * need to nest. */
-{
-struct memTracker *mt;
-
-if (memTracker != NULL)
-     errAbort("multiple memTrackerStart calls");
-AllocVar(mt);
-AllocVar(mt->handler);
-mt->handler->alloc = memTrackerAlloc;
-mt->handler->free = memTrackerFree;
-mt->handler->realloc = memTrackerRealloc;
-mt->list = dlListNew();
-mt->parent = pushMemHandler(mt->handler);
-memTracker = mt;
-}
-
-void memTrackerEnd()
-/* Free any remaining blocks and pop tracker memory handler. */
-{
-struct memTracker *mt = memTracker;
-if (mt == NULL)
-    errAbort("memTrackerEnd without memTrackerStart");
-memTracker = NULL;
-popMemHandler();
-dlListFree(&mt->list);
-freeMem(mt->handler);
-freeMem(mt);
-}
diff --git a/gbtools/src/blatSrc/lib/memgfx.c b/gbtools/src/blatSrc/lib/memgfx.c
deleted file mode 100644
index 058abcc..0000000
--- a/gbtools/src/blatSrc/lib/memgfx.c
+++ /dev/null
@@ -1,1325 +0,0 @@
-/* memgfx - routines for drawing on bitmaps in memory.
- * Currently limited to 256 color bitmaps. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "memgfx.h"
-#include "gemfont.h"
-#include "localmem.h"
-#include "vGfx.h"
-#include "vGfxPrivate.h"
-#include "colHash.h"
-
-
-
-Color multiply(Color src, Color new)
-{
-#ifdef COLOR32
-unsigned char rs = (src >> 0) & 0xff;
-unsigned char gs = (src >> 8) & 0xff;
-unsigned char bs = (src >> 16) & 0xff;
-unsigned char rn = (new >> 0) & 0xff;
-unsigned char gn = (new >> 8) & 0xff;
-unsigned char bn = (new >> 16) & 0xff;
-
-unsigned char ro = ((unsigned) rn * rs) / 255;
-unsigned char go = ((unsigned) gn * gs) / 255;
-unsigned char bo = ((unsigned) bn * bs) / 255;
-return MAKECOLOR_32(ro, go, bo);
-#else
-/* no multiply write mode in 8 bit */
-return new;
-#endif /* COLOR32 */
-}
-
-
-#ifndef min3
-#define min3(x,y,z) (min(x,min(y,z)))
-/* Return min of x,y, and z. */
-#endif
-
-#ifndef max3
-#define max3(x,y,z) (max(x,max(y,z)))
-/* Return max of x,y, and z. */
-#endif
-
-void _mgPutDotMultiply(struct memGfx *mg, int x, int y,Color color)
-{
-Color *pt = _mgPixAdr(mg,x,y);
-*pt = multiply(*pt, color);
-}
-
-
-static void mgSetDefaultColorMap(struct memGfx *mg)
-/* Set up default color map for a memGfx. */
-{
-#ifdef COLOR32
-    return;
-#else
-
-/* Note dependency in order here and in MG_WHITE, MG_BLACK, etc. */
-int i;
-for (i=0; i<ArraySize(mgFixedColors); ++i)
-    {
-    struct rgbColor *c = &mgFixedColors[i];
-    mgAddColor(mg, c->r, c->g, c->b);
-    }
-#endif
-}
-
-
-
-void mgSetWriteMode(struct memGfx *mg, unsigned int writeMode)
-/* Set write mode */
-{
-mg->writeMode = writeMode;
-}
-
-void mgSetClip(struct memGfx *mg, int x, int y, int width, int height)
-/* Set clipping rectangle. */
-{
-int x2, y2;
-if (x < 0)
-    x = 0;
-if (y < 0)
-    y = 0;
-x2 = x + width;
-if (x2 > mg->width)
-    x2 = mg->width;
-y2 = y + height;
-if (y2 > mg->height)
-    y2 = mg->height;
-mg->clipMinX = x;
-mg->clipMaxX = x2;
-mg->clipMinY = y;
-mg->clipMaxY = y2;
-}
-
-void mgUnclip(struct memGfx *mg)
-/* Set clipping rect cover full thing. */
-{
-mgSetClip(mg, 0,0,mg->width, mg->height);
-}
-
-struct memGfx *mgNew(int width, int height)
-/* Return new memGfx. Note new pixel memory is uninitialized */
-{
-struct memGfx *mg;
-
-mg = needMem(sizeof(*mg));
-mg->width = width;
-mg->height = height;
-mg->pixels = needLargeMem(width*height*sizeof(Color));
-#ifndef COLOR32
-mg->colorHash = colHashNew();
-#endif
-mgSetDefaultColorMap(mg);
-mgUnclip(mg);
-return mg;
-}
-
-void mgClearPixels(struct memGfx *mg)
-/* Set all pixels to background. */
-{
-#ifdef COLOR32
-memset((unsigned char *)mg->pixels, 0xff, mg->width*mg->height*sizeof(unsigned int));
-#else
-zeroBytes(mg->pixels, mg->width*mg->height);
-#endif
-}
-
-void mgClearPixelsTrans(struct memGfx *mg)
-/* Set all pixels to transparent. */
-{
-#ifdef COLOR32
-unsigned int *ptr = mg->pixels;
-unsigned int *lastPtr = &mg->pixels[mg->width * mg->height];
-for(; ptr < lastPtr; ptr++)
-#ifdef MEMGFX_BIGENDIAN
-    *ptr = 0xffffff00;
-#else
-    *ptr = 0x00ffffff;  // transparent white
-#endif
-
-#else
-zeroBytes(mg->pixels, mg->width*mg->height);
-#endif
-}
-
-Color mgFindColor(struct memGfx *mg, unsigned char r, unsigned char g, unsigned char b)
-/* Returns closest color in color map to rgb values.  If it doesn't
- * already exist in color map and there's room, it will create
- * exact color in map. */
-{
-#ifdef COLOR32
-return MAKECOLOR_32(r,g,b);
-#else
-struct colHashEl *che;
-if ((che = colHashLookup(mg->colorHash, r, g, b)) != NULL)
-    return che->ix;
-if (mgColorsFree(mg))
-    return mgAddColor(mg, r, g, b);
-return mgClosestColor(mg, r, g, b);
-#endif
-}
-
-
-struct rgbColor mgColorIxToRgb(struct memGfx *mg, int colorIx)
-/* Return rgb value at color index. */
-{
-#ifdef COLOR32
-static struct rgbColor rgb;
-#ifdef MEMGFX_BIGENDIAN
-rgb.r = (colorIx >> 24) & 0xff;
-rgb.g = (colorIx >> 16) & 0xff;
-rgb.b = (colorIx >> 8) & 0xff;
-#else
-rgb.r = (colorIx >> 0) & 0xff;
-rgb.g = (colorIx >> 8) & 0xff;
-rgb.b = (colorIx >> 16) & 0xff;
-#endif
-
-return rgb;
-#else
-return mg->colorMap[colorIx];
-#endif
-}
-
-Color mgClosestColor(struct memGfx *mg, unsigned char r, unsigned char g, unsigned char b)
-/* Returns closest color in color map to r,g,b */
-{
-#ifdef COLOR32
-return MAKECOLOR_32(r,g,b);
-#else
-struct rgbColor *c = mg->colorMap;
-int closestDist = 0x7fffffff;
-int closestIx = -1;
-int dist, dif;
-int i;
-for (i=0; i<mg->colorsUsed; ++i)
-    {
-    dif = c->r - r;
-    dist = dif*dif;
-    dif = c->g - g;
-    dist += dif*dif;
-    dif = c->b - b;
-    dist += dif*dif;
-    if (dist < closestDist)
-        {
-        closestDist = dist;
-        closestIx = i;
-        }
-    ++c;
-    }
-return closestIx;
-#endif
-}
-
-
-Color mgAddColor(struct memGfx *mg, unsigned char r, unsigned char g, unsigned char b)
-/* Adds color to end of color map if there's room. */
-{
-#ifdef COLOR32
-return MAKECOLOR_32(r,g,b);
-#else
-int colIx = mg->colorsUsed;
-if (colIx < 256)
-    {
-    struct rgbColor *c = mg->colorMap + mg->colorsUsed;
-    c->r = r;
-    c->g = g;
-    c->b = b;
-    mg->colorsUsed += 1;
-    colHashAdd(mg->colorHash, r, g, b, colIx);
-    }
-return (Color)colIx;
-#endif
-}
-
-int mgColorsFree(struct memGfx *mg)
-/* Returns # of unused colors in color map. */
-{
-#ifdef COLOR32
-return 1 << 23;
-#else
-return 256-mg->colorsUsed;
-#endif
-}
-
-void mgFree(struct memGfx **pmg)
-{
-struct memGfx *mg = *pmg;
-if (mg != NULL)
-    {
-    if (mg->pixels != NULL)
-	freeMem(mg->pixels);
-    if (mg->colorHash)
-        colHashFree(&mg->colorHash);
-    zeroBytes(mg, sizeof(*mg));
-    freeMem(mg);
-    }
-*pmg = NULL;
-}
-
-static void nonZeroCopy(Color *d, Color *s, int width)
-/* Copy non-zero colors. */
-{
-Color c;
-int i;
-for (i=0; i<width; ++i)
-    {
-    if ((c = s[i]) != MG_WHITE)
-        d[i] = c;
-    }
-}
-
-static void mgPutSegMaybeZeroClear(struct memGfx *mg, int x, int y, int width, Color *dots, boolean zeroClear)
-/* Put a series of dots starting at x, y and going to right width pixels.
- * Possibly don't put zero dots though. */
-{
-int x2;
-Color *pt;
-if (y < mg->clipMinY || y > mg->clipMaxY)
-    return;
-x2 = x + width;
-if (x2 > mg->clipMaxX)
-    x2 = mg->clipMaxX;
-if (x < mg->clipMinX)
-    {
-    dots += mg->clipMinX - x;
-    x = mg->clipMinX;
-    }
-width = x2 - x;
-if (width > 0)
-    {
-    pt = _mgPixAdr(mg, x, y);
-    if (zeroClear)
-        nonZeroCopy(pt, dots, width);
-    else
-        {
-        width *= sizeof(Color);
-        memcpy(pt, dots, width * sizeof(Color));
-        }
-    }
-}
-
-void mgVerticalSmear(struct memGfx *mg,
-	int xOff, int yOff, int width, int height, 
-	Color *dots, boolean zeroClear)
-/* Put a series of one 'pixel' width vertical lines. */
-{
-while (--height >= 0)
-    {
-    mgPutSegMaybeZeroClear(mg, xOff, yOff, width, dots, zeroClear);
-    ++yOff;
-    }
-}
-
-
-void mgDrawBoxNormal(struct memGfx *mg, int x, int y, int width, int height, Color color)
-{
-int i;
-Color *pt;
-int x2 = x + width;
-int y2 = y + height;
-int wrapCount;
-
-if (x < mg->clipMinX)
-    x = mg->clipMinX;
-if (y < mg->clipMinY)
-    y = mg->clipMinY;
-if (x2 < mg->clipMinX)
-    x2 = mg->clipMinX;
-if (y2 < mg->clipMinY)
-    y2 = mg->clipMinY;
-
-if (x > mg->clipMaxX)
-    x = mg->clipMaxX;
-if (y > mg->clipMaxY)
-    y = mg->clipMaxY;
-if (x2 > mg->clipMaxX)
-    x2 = mg->clipMaxX;
-if (y2 > mg->clipMaxY)
-    y2 = mg->clipMaxY;
-width = x2-x;
-height = y2-y;
-if (width > 0 && height > 0)
-    {
-    pt = _mgPixAdr(mg,x,y);
-    /*colorBin[x][color]++;  increment color count for this pixel */
-    wrapCount = _mgBpr(mg) - width;
-    while (--height >= 0)
-	{
-        //Color src = *pt;
-	i = width;
-	while (--i >= 0)
-	    *pt++ = color;
-	pt += wrapCount;
-	}
-    }
-}
-
-void mgDrawBoxMultiply(struct memGfx *mg, int x, int y, int width, int height, Color color)
-{
-int i;
-Color *pt;
-int x2 = x + width;
-int y2 = y + height;
-int wrapCount;
-
-if (x < mg->clipMinX)
-    x = mg->clipMinX;
-if (y < mg->clipMinY)
-    y = mg->clipMinY;
-if (x2 > mg->clipMaxX)
-    x2 = mg->clipMaxX;
-if (y2 > mg->clipMaxY)
-    y2 = mg->clipMaxY;
-width = x2-x;
-height = y2-y;
-if (width > 0 && height > 0)
-    {
-    pt = _mgPixAdr(mg,x,y);
-    wrapCount = _mgBpr(mg) - width;
-    while (--height >= 0)
-	{
-        Color src = *pt;
-	i = width;
-	while (--i >= 0)
-	    *pt++ = multiply(src, color);
-	pt += wrapCount;
-	}
-    }
-}
-
-void mgDrawBox(struct memGfx *mg, int x, int y, int width, int height, Color color)
-{
-switch(mg->writeMode)
-    {
-    case MG_WRITE_MODE_NORMAL:
-        {
-        mgDrawBoxNormal(mg,x,y, width, height, color);
-        }
-        break;
-    case MG_WRITE_MODE_MULTIPLY:
-        {
-        mgDrawBoxMultiply(mg,x,y, width, height, color);
-        }
-        break;
-    }
-}
-
-
-INLINE void mixDot(struct memGfx *img, int x, int y,  float frac, Color col)
-/* Puts a single dot on the image, mixing it with what is already there
- * based on the frac argument. */
-{
-if ((x < img->clipMinX) || (x > img->clipMaxX) || (y < img->clipMinY) || (y > img->clipMaxY))
-    return;
-
-Color *pt = _mgPixAdr(img,x,y);
-float invFrac = 1 - frac;
-
-int r = COLOR_32_RED(*pt) * invFrac + COLOR_32_RED(col) * frac;
-int g = COLOR_32_GREEN(*pt) * invFrac + COLOR_32_GREEN(col) * frac;
-int b = COLOR_32_BLUE(*pt) * invFrac + COLOR_32_BLUE(col) * frac;
-mgPutDot(img,x,y,MAKECOLOR_32(r,g,b));
-}
- 
-#define fraction(X) (((double)(X))-(double)(int)(X))
-#define invFraction(X) (1.0-fraction(X))
-
-void mgAliasLine( struct memGfx *mg, int x1, int y1,
-  int x2, int y2, Color color)
-/* Draw an antialiased line using the Wu algorithm. */
-{
-double dx = (double)x2 - (double)x1;
-double dy = (double)y2 - (double)y1;
-
-// figure out what quadrant we're in
-if ( fabs(dx) > fabs(dy) ) 
-    {
-    if ( x2 < x1 ) 
-	{
-	// swap start and end points
-	int tmp = x2;
-	x2 = x1;
-	x1 = tmp;
-
-	tmp = y2;
-	y2 = y1;
-	y1 = tmp;
-	}
-
-    double gradient = dy / dx;
-    double xend = round(x1);
-    double yend = y1 + gradient*(xend - x1);
-    double xgap = invFraction(x1 + 0.5);
-    int xpxl1 = xend;
-    int ypxl1 = (int)yend;
-    mixDot(mg, xpxl1, ypxl1, invFraction(yend)*xgap, color);
-    mixDot(mg, xpxl1, ypxl1+1, fraction(yend)*xgap, color);
-
-    double intery = yend + gradient;
-
-    xend = round(x2);
-    yend = y2 + gradient*(xend - x2);
-    xgap = fraction(x2+0.5);
-    int xpxl2 = xend;
-    int ypxl2 = (int)yend;
-    mixDot(mg, xpxl2, ypxl2, invFraction(yend) * xgap, color);
-    mixDot(mg, xpxl2, ypxl2 + 1, fraction(yend) * xgap, color);
-
-    int x;
-    for(x=xpxl1+1; x <= (xpxl2-1); x++) 
-	{
-	mixDot(mg, x, (int)intery, invFraction(intery), color);
-	mixDot(mg, x, (int)intery + 1, fraction(intery), color);
-	intery += gradient;
-	}
-    } 
-else  // ( fabs(dx) <= fabs(dy) ) 
-    {    
-    if ( y2 < y1 ) 
-	{
-	// swap start and end points
-	int tmp = x2;
-	x2 = x1;
-	x1 = tmp;
-
-	tmp = y2;
-	y2 = y1;
-	y1 = tmp;
-	}
-
-    double gradient = dx / dy;
-    double yend = rint(y1);
-    double xend = x1 + gradient*(yend - y1);
-    double ygap = invFraction(y1 + 0.5);
-    int ypxl1 = yend;
-    int xpxl1 = (int)xend;
-    mixDot(mg, xpxl1, ypxl1, invFraction(xend)*ygap, color);
-    mixDot(mg, xpxl1, ypxl1+1, fraction(xend)*ygap, color);
-    double interx = xend + gradient;
-
-    yend = rint(y2);
-    xend = x2 + gradient*(yend - y2);
-    ygap = fraction(y2+0.5);
-    int ypxl2 = yend;
-    int xpxl2 = (int)xend;
-    mixDot(mg, xpxl2, ypxl2, invFraction(xend) * ygap, color);
-    mixDot(mg, xpxl2, ypxl2 + 1, fraction(xend) * ygap, color);
-
-    int y;
-    for(y=ypxl1+1; y <= (ypxl2-1); y++) 
-	{
-	mixDot(mg, (int)interx, y, invFraction(interx), color);
-	mixDot(mg, (int)interx + 1, y, fraction(interx), color);
-	interx += gradient;
-	}
-    }
-}
-#undef fraction
-#undef invFraction
-
-
-void mgBrezy(struct memGfx *mg, int x1, int y1, int x2, int y2, Color color,
-	int yBase, boolean fillFromBase)
-/* Brezenham line algorithm.  Optionally fill in under line. */
-{
-if (x1 == x2)
-    {
-    int y,height;
-    if (y1 > y2)
-	{
-	y = y2;
-	height = y1-y2+1;
-	}
-    else
-        {
-	y = y1;
-	height = y2-y1+1;
-	}
-    if (fillFromBase)
-        {
-	if (y < yBase)
-	    mgDrawBox(mg, x1, y, 1, yBase-y, color);
-	}
-    else
-        mgDrawBox(mg, x1, y, 1, height, color);
-    }
-else if (y1 == y2)
-    {
-    int x,width;
-    if (x1 > x2)
-        {
-	x = x2;
-	width = x1-x2+1;
-	}
-    else
-        {
-	x = x1;
-	width = x2-x1+1;
-	}
-    if (fillFromBase)
-        {
-	if (y1 < yBase)
-	    mgDrawBox(mg, x, y1, width, yBase - y1, color);
-	}
-    else
-        {
-	mgDrawBox(mg, x, y1, width, 1, color);
-	}
-    }
-else
-    {
-    int duty_cycle;
-    int incy;
-    int delta_x, delta_y;
-    int dots;
-    delta_y = y2-y1;
-    delta_x = x2-x1;
-    if (delta_y < 0) 
-	{
-	delta_y = -delta_y;
-	incy = -1;
-	}
-    else
-	{
-	incy = 1;
-	}
-    if (delta_x < 0) 
-	{
-	delta_x = -delta_x;
-	incy = -incy;
-	x1 = x2;
-	y1 = y2;
-	}
-    duty_cycle = (delta_x - delta_y)/2;
-    if (delta_x >= delta_y)
-	{
-	dots = delta_x+1;
-	while (--dots >= 0)
-	    {
-	    if (fillFromBase)
-		{
-		if (y1 < yBase)
-		    mgDrawBox(mg,x1,y1,1,yBase-y1,color);
-		}
-	    else
-		mgPutDot(mg,x1,y1,color);
-	    duty_cycle -= delta_y;
-	    x1 += 1;
-	    if (duty_cycle < 0)
-		{
-		duty_cycle += delta_x;	  /* update duty cycle */
-		y1+=incy;
-		}
-	    }
-	}
-    else
-	{
-	dots = delta_y+1;
-	while (--dots >= 0)
-	    {
-	    if (fillFromBase)
-		{
-		if (y1 < yBase)
-		    mgDrawBox(mg,x1,y1,1,yBase-y1,color);
-		}
-	    else
-		mgPutDot(mg,x1,y1,color);
-	    duty_cycle += delta_x;
-	    y1+=incy;
-	    if (duty_cycle > 0)
-		{
-		duty_cycle -= delta_y;	  /* update duty cycle */
-		x1 += 1;
-		}
-	    }
-	}
-    }
-}
-
-void mgDrawLine(struct memGfx *mg, int x1, int y1, int x2, int y2, Color color)
-/* Draw a line from one point to another. Draws it antialiased if
- * it's not horizontal or vertical. */
-{
-if ((x1 == x2) || (y1 == y2))
-    mgBrezy(mg, x1, y1, x2, y2, color, 0, FALSE);
-else
-    mgAliasLine(mg, x1, y1, x2, y2, color);
-}
-
-void mgFillUnder(struct memGfx *mg, int x1, int y1, int x2, int y2, 
-	int bottom, Color color)
-/* Draw a 4 sided filled figure that has line x1/y1 to x2/y2 at
- * it's top, a horizontal line at bottom as it's bottom, and
- * vertical lines from the bottom to y1 on the left and bottom to
- * y2 on the right. */
-{
-mgBrezy(mg, x1, y1, x2, y2, color, bottom, TRUE);
-}
-
-void mgPutSeg(struct memGfx *mg, int x, int y, int width, Color *dots)
-/* Put a series of dots starting at x, y and going to right width pixels. */
-{
-mgPutSegMaybeZeroClear(mg, x, y, width, dots, FALSE);
-}
-
-void mgPutSegZeroClear(struct memGfx *mg, int x, int y, int width, Color *dots)
-/* Put a series of dots starting at x, y and going to right width pixels.
- * Don't put zero dots though. */
-{
-mgPutSegMaybeZeroClear(mg, x, y, width, dots, TRUE);
-}
-
-
-void mgDrawHorizontalLine(struct memGfx *mg, int y1, Color color)
-/*special case of mgDrawLine, for horizontal line across entire window 
-  at y-value y1.*/
-{
-mgDrawLine( mg, mg->clipMinX, y1, mg->clipMaxX, y1, color);
-}
-
-void mgLineH(struct memGfx *mg, int y, int x1, int x2, Color color)
-/* Draw horizizontal line width pixels long starting at x/y in color */
-{
-if (y >= mg->clipMinY && y < mg->clipMaxY)
-    {
-    int w;
-    if (x1 < mg->clipMinX)
-        x1 = mg->clipMinX;
-    if (x2 > mg->clipMaxX)
-        x2 = mg->clipMaxX;
-    w = x2 - x1;
-    if (w > 0)
-        {
-	Color *pt = _mgPixAdr(mg,x1,y);
-	if (mg->writeMode == MG_WRITE_MODE_MULTIPLY)
-	    {
-	    while (--w >= 0)
-		{
-		*pt = multiply(*pt, color);
-		pt += 1;
-		}
-	    }
-	else
-	    {
-	    while (--w >= 0)
-		*pt++ = color;
-	    }
-	}
-    }
-}
-
-
-boolean mgClipForBlit(int *w, int *h, int *sx, int *sy,
-	struct memGfx *dest, int *dx, int *dy)
-{
-/* Make sure we don't overwrite destination. */
-int over;
-
-if ((over = dest->clipMinX - *dx) > 0)
-    {
-    *w -= over;
-    *sx += over;
-    *dx = dest->clipMinX;
-    }
-if ((over = dest->clipMinY - *dy) > 0)
-    {
-    *h -= over;
-    *sy += over;
-    *dy = dest->clipMinY;
-    }
-if ((over = *w + *dx - dest->clipMaxX) > 0)
-    *w -= over; 
-if ((over = *h + *dy - dest->clipMaxY) > 0)
-    *h -= over;
-return (*h > 0 && *w > 0);
-}
-
-void mgTextBlit(int width, int height, int bitX, int bitY,
-	unsigned char *bitData, int bitDataRowBytes, 
-	struct memGfx *dest, int destX, int destY, 
-	Color color, Color backgroundColor)
-{
-UBYTE *inLine;
-Color *outLine;
-UBYTE inLineBit;
-
-if (!mgClipForBlit(&width, &height, &bitX, &bitY, dest, &destX, &destY))
-    return;
-
-inLine = bitData + (bitX>>3) + bitY * bitDataRowBytes;
-inLineBit = (0x80 >> (bitX&7));
-outLine = _mgPixAdr(dest,destX,destY);
-while (--height >= 0)
-    {
-    UBYTE *in = inLine;
-    Color *out = outLine;
-    UBYTE inBit = inLineBit;
-    UBYTE inByte = *in++;
-    int i = width;
-    while (--i >= 0)
-	{
-	if (inBit & inByte)
-	    *out = color;
-	++out;
-	if ((inBit >>= 1) == 0)
-	    {
-	    inByte = *in++;
-	    inBit = 0x80;
-	    }
-	}
-    inLine += bitDataRowBytes;
-    outLine += _mgBpr(dest);
-    }
-}
-
-void mgTextBlitSolid(int width, int height, int bitX, int bitY,
-	unsigned char *bitData, int bitDataRowBytes, 
-	struct memGfx *dest, int destX, int destY, 
-	Color color, Color backgroundColor)
-{
-UBYTE *inLine;
-Color *outLine;
-UBYTE inLineBit;
-
-if (!mgClipForBlit(&width, &height, &bitX, &bitY, dest, &destX, &destY))
-    return;
-inLine = bitData + (bitX>>3) + bitY * bitDataRowBytes;
-inLineBit = (0x80 >> (bitX&7));
-outLine = _mgPixAdr(dest,destX,destY);
-while (--height >= 0)
-    {
-    UBYTE *in = inLine;
-    Color *out = outLine;
-    UBYTE inBit = inLineBit;
-    UBYTE inByte = *in++;
-    int i = width;
-    while (--i >= 0)
-	{
-	*out++ = ((inBit & inByte) ? color : backgroundColor);
-	if ((inBit >>= 1) == 0)
-	    {
-	    inByte = *in++;
-	    inBit = 0x80;
-	    }
-	}
-    inLine += bitDataRowBytes;
-    outLine += _mgBpr(dest);
-    }
-}
-
-
-void mgText(struct memGfx *mg, int x, int y, Color color, 
-	MgFont *font, char *text)
-/* Draw a line of text with upper left corner x,y. */
-{
-gfText(mg, font, text, x, y, color, mgTextBlit, MG_WHITE);
-}
-
-void mgTextCentered(struct memGfx *mg, int x, int y, int width, int height, 
-	Color color, MgFont *font, char *text)
-/* Draw a line of text centered in box defined by x/y/width/height */
-{
-int fWidth, fHeight;
-int xoff, yoff;
-fWidth = mgFontStringWidth(font, text);
-fHeight = mgFontPixelHeight(font);
-xoff = x + (width - fWidth)/2;
-yoff = y + (height - fHeight)/2;
-if (font == mgSmallFont())
-    {
-    xoff += 1;
-    yoff += 1;
-    }
-mgText(mg, xoff, yoff, color, font, text);
-}
-
-void mgTextRight(struct memGfx *mg, int x, int y, int width, int height, 
-	Color color, MgFont *font, char *text)
-/* Draw a line of text right justified in box defined by x/y/width/height */
-{
-int fWidth, fHeight;
-int xoff, yoff;
-fWidth = mgFontStringWidth(font, text);
-fHeight = mgFontPixelHeight(font);
-xoff = x + width - fWidth - 1;
-yoff = y + (height - fHeight)/2;
-if (font == mgSmallFont())
-    {
-    xoff += 1;
-    yoff += 1;
-    }
-mgText(mg, xoff, yoff, color, font, text);
-}
-
-int mgFontPixelHeight(MgFont *font)
-/* How high in pixels is font? */
-{
-return font_cel_height(font);
-}
-
-int mgGetFontPixelHeight(struct memGfx *mg, MgFont *font)
-/* How high in pixels is font? */
-{
-return mgFontPixelHeight(font);
-}
-
-int mgFontLineHeight(MgFont *font)
-/* How many pixels to next line ideally? */
-{
-return font_line_height(font);
-}
-
-int mgFontWidth(MgFont *font, char *chars, int charCount)
-/* How wide are a couple of letters? */
-{
-return fnstring_width(font, (unsigned char *)chars, charCount);
-}
-
-int mgFontStringWidth(MgFont *font, char *string)
-/* How wide is a string? */
-{
-return mgFontWidth(font, string, strlen(string));
-}
-
-int mgGetFontStringWidth(struct memGfx *mg, MgFont *font, char *string)
-/* How wide is a string? */
-{
-return mgFontStringWidth(font, string);
-}
-
-int mgFontCharWidth(MgFont *font, char c)
-/* How wide is a character? */
-{
-return mgFontWidth(font, &c, 1);
-}
-
-char *mgFontSizeBackwardsCompatible(char *size)
-/* Given "size" argument that may be in old tiny/small/medium/big/huge format,
- * return it in new numerical string format. Do NOT free the return string*/
-{
-if (isdigit(size[0]))
-    return size;
-else if (sameWord(size, "tiny"))
-    return "6";
-else if (sameWord(size, "small"))
-    return "8";
-else if (sameWord(size, "medium"))
-    return "14";
-else if (sameWord(size, "large"))
-    return "18";
-else if (sameWord(size, "huge"))
-    return "34";
-else
-    {
-    errAbort("unknown font size %s", size);
-    return NULL;
-    }
-}
-
-MgFont *mgFontForSizeAndStyle(char *textSize, char *fontType)
-/* Get a font of given size and style.  Abort with error message if not found.
- * The textSize should be 6,8,10,12,14,18,24 or 34.  For backwards compatibility
- * textSizes of "tiny" "small", "medium", "large" and "huge" are also ok.
- * The fontType should be "medium", "bold", or "fixed" */
-{
-textSize = mgFontSizeBackwardsCompatible(textSize);
-MgFont *font = NULL;
-if (sameString(fontType,"bold"))
-    {
-    if (sameString(textSize, "6"))
-	 font = mgTinyBoldFont();
-    else if (sameString(textSize, "8"))
-	 font = mgHelveticaBold8Font();
-    else if (sameString(textSize, "10"))
-	 font = mgHelveticaBold10Font();
-    else if (sameString(textSize, "12"))
-	 font = mgHelveticaBold12Font();
-    else if (sameString(textSize, "14"))
-	 font = mgHelveticaBold14Font();
-    else if (sameString(textSize, "18"))
-	 font = mgHelveticaBold18Font();
-    else if (sameString(textSize, "24"))
-	 font = mgHelveticaBold24Font();
-    else if (sameString(textSize, "34"))
-	 font = mgHelveticaBold34Font();
-    else
-	 errAbort("unknown textSize %s", textSize);
-    }
-else if (sameString(fontType,"fixed"))
-    {
-    if (sameString(textSize, "6"))
-	 font = mgTinyFixedFont();
-    else if (sameString(textSize, "8"))
-	 font = mgCourier8Font();
-    else if (sameString(textSize, "10"))
-	 font = mgCourier10Font();
-    else if (sameString(textSize, "12"))
-	 font = mgCourier12Font();
-    else if (sameString(textSize, "14"))
-	 font = mgCourier14Font();
-    else if (sameString(textSize, "18"))
-	 font = mgCourier18Font();
-    else if (sameString(textSize, "24"))
-	 font = mgCourier24Font();
-    else if (sameString(textSize, "34"))
-	 font = mgCourier34Font();
-    else
-	 errAbort("unknown textSize %s", textSize);
-    }
-else
-    {
-    if (sameString(textSize, "6"))
-	 font = mgTinyFont();
-    else if (sameString(textSize, "8"))
-	 font = mgSmallFont();
-    else if (sameString(textSize, "10"))
-	 font = mgHelvetica10Font();
-    else if (sameString(textSize, "12"))
-	 font = mgHelvetica12Font();
-    else if (sameString(textSize, "14"))
-	 font = mgHelvetica14Font();
-    else if (sameString(textSize, "18"))
-	 font = mgHelvetica18Font();
-    else if (sameString(textSize, "24"))
-	 font = mgHelvetica24Font();
-    else if (sameString(textSize, "34"))
-	 font = mgHelvetica34Font();
-    else
-	 errAbort("unknown textSize %s", textSize);
-    }
-return font;
-}
-
-MgFont *mgFontForSize(char *textSize)
-/* Get a font of given size and style.  Abort with error message if not found.
- * The textSize should be 6,8,10,12,14,18,24 or 34.  For backwards compatibility
- * textSizes of "tiny" "small", "medium", "large" and "huge" are also ok. */
-{
-return mgFontForSizeAndStyle(textSize, "medium");
-}
-
-
-void mgSlowDot(struct memGfx *mg, int x, int y, int colorIx)
-/* Draw a dot when a macro won't do. */
-{
-mgPutDot(mg, x, y, colorIx);
-}
-
-int mgSlowGetDot(struct memGfx *mg, int x, int y)
-/* Fetch a dot when a macro won't do. */
-{
-return mgGetDot(mg, x, y);
-}
-
-struct memGfx *mgRotate90(struct memGfx *in)
-/* Create a copy of input that is rotated 90 degrees clockwise. */
-{
-int iWidth = in->width, iHeight = in->height;
-struct memGfx *out = mgNew(iHeight, iWidth);
-Color *inCol, *outRow, *outRowStart;
-int i,j;
-
-memcpy(out->colorMap, in->colorMap, sizeof(out->colorMap));
-outRowStart = out->pixels;
-for (i=0; i<iWidth; ++i)
-    {
-    inCol = in->pixels + i;
-    outRow = outRowStart;
-    outRowStart += _mgBpr(out);
-    j = iHeight;
-    while (--j >= 0)
-        {
-	outRow[j] = *inCol;
-	inCol += _mgBpr(in);
-	}
-    }
-return out;
-}
-
-void mgSetHint(char *hint)
-/* dummy function */
-{
-return;
-}
-
-char *mgGetHint(char *hint)
-/* dummy function */
-{
-return "";
-}
-
-void vgMgMethods(struct vGfx *vg)
-/* Fill in virtual graphics methods for memory based drawing. */
-{
-vg->pixelBased = TRUE;
-vg->close = (vg_close)mgFree;
-vg->dot = (vg_dot)mgSlowDot;
-vg->getDot = (vg_getDot)mgSlowGetDot;
-vg->box = (vg_box)mgDrawBox;
-vg->line = (vg_line)mgDrawLine;
-vg->text = (vg_text)mgText;
-vg->textRight = (vg_textRight)mgTextRight;
-vg->textCentered = (vg_textCentered)mgTextCentered;
-vg->findColorIx = (vg_findColorIx)mgFindColor;
-vg->colorIxToRgb = (vg_colorIxToRgb)mgColorIxToRgb;
-vg->setWriteMode = (vg_setWriteMode)mgSetWriteMode;
-vg->setClip = (vg_setClip)mgSetClip;
-vg->unclip = (vg_unclip)mgUnclip;
-vg->verticalSmear = (vg_verticalSmear)mgVerticalSmear;
-vg->fillUnder = (vg_fillUnder)mgFillUnder;
-vg->drawPoly = (vg_drawPoly)mgDrawPoly;
-vg->setHint = (vg_setHint)mgSetHint;
-vg->getHint = (vg_getHint)mgGetHint;
-vg->getFontPixelHeight = (vg_getFontPixelHeight)mgGetFontPixelHeight;
-vg->getFontStringWidth = (vg_getFontStringWidth)mgGetFontStringWidth;
-}
-
-
-struct hslColor mgRgbToHsl(struct rgbColor rgb)
-/* Convert RGB to HSL colorspace (see http://en.wikipedia.org/wiki/HSL_and_HSV)
- * In HSL, Hue is the color in the range [0,360) with 0=red 120=green 240=blue,
- * Saturation goes from a shade of grey (0) to fully saturated color (1000), and
- * Lightness goes from black (0) through the hue (500) to white (1000). */
-{
-unsigned char rgbMax = max3(rgb.r, rgb.g, rgb.b);
-unsigned char rgbMin = min3(rgb.r, rgb.g, rgb.b);
-unsigned char delta = rgbMax - rgbMin;
-unsigned short minMax = rgbMax + rgbMin;
-int divisor;
-struct hslColor hsl = { 0.0, 0, (1000*minMax+255)/(2*255) }; // round up
-
-// if max=min then no saturation, and this is gray
-if (rgbMax == rgbMin)
-    return hsl;
-else if (hsl.l <= 500)
-    divisor = minMax;
-else
-    divisor = (2*255-minMax);
-hsl.s = (1000*delta + divisor/2)/divisor; // round up
-
-// Saturation so compute hue 0..360 degrees (same as for HSV)
-if (rgbMax == rgb.r) // red is 0 +/- offset in blue or green direction
-    {
-    hsl.h = 0 + 60.0*(rgb.g - rgb.b)/delta;
-    }
-else if (rgbMax == rgb.g) // green is 120 +/- offset in blue or red direction
-    {
-    hsl.h = 120 + 60.0*(rgb.b - rgb.r)/delta;
-    }
-else // rgb_max == rgb.b // blue is 240 +/- offset in red or green direction
-    {
-    hsl.h = 240 + 60.0*(rgb.r - rgb.g)/delta;
-    }
-// normalize to [0,360)
-if (hsl.h < 0.0)
-    hsl.h += 360.0;
-else if (hsl.h >= 360.0)
-    hsl.h -= 360.0;
-return hsl;
-}
-
-
-struct hsvColor mgRgbToHsv(struct rgbColor rgb) 
-/* Convert RGB to HSV colorspace (see http://en.wikipedia.org/wiki/HSL_and_HSV)
- * In HSV, Hue is the color in the range [0,360) with 0=red 120=green 240=blue,
- * Saturation goes from white (0) to fully saturated color (1000), and
- * Value goes from black (0) through to the hue (1000). */
-{
-unsigned char rgbMax = max3(rgb.r, rgb.g, rgb.b);
-unsigned char rgbMin = min3(rgb.r, rgb.g, rgb.b);
-unsigned char delta = rgbMax - rgbMin;
-struct hsvColor hsv = {0.0, 0, 1000*rgbMax/255};
-
-if (hsv.v == 0) 
-    return hsv;
-hsv.s = 1000*delta/rgbMax;
-// if no saturation, then this is gray
-if (hsv.s == 0) 
-    return hsv;
-// Saturation so compute hue 0..360 degrees (same as for HSL)
-if (rgbMax == rgb.r) // red is 0 +/- offset in blue or green direction
-    {
-    hsv.h = 0 + 60.0*(rgb.g - rgb.b)/delta;
-    } 
-else if (rgbMax == rgb.g) // green is 120 +/- offset in blue or red direction
-    {
-    hsv.h = 120 + 60.0*(rgb.b - rgb.r)/delta;
-    } 
-else // rgb_max == rgb.b // blue is 240 +/- offset in red or green direction
-    {
-    hsv.h = 240 + 60.0*(rgb.r - rgb.g)/delta;
-    }
-// normalize to [0,360)
-if (hsv.h < 0.0)
-    hsv.h += 360.0;
-else if (hsv.h >= 360.0)
-    hsv.h -= 360.0;
-return hsv;
-}
-
-
-struct rgbColor mgHslToRgb(struct hslColor hsl)
-/* Convert HSL to RGB colorspace http://en.wikipedia.org/wiki/HSL_and_HSV */
-{
-int p, q;
-double r, g, b;
-//unsigned short p, q, r, g, b;
-double tR, tG, tB;
-
-if( hsl.s == 0 ) // achromatic (grey)
-    return (struct rgbColor) {(255*hsl.l+500)/1000, (255*hsl.l+500)/1000, (255*hsl.l+500)/1000};
-if (hsl.l <= 500)
-    q = hsl.l + (hsl.l*hsl.s+500)/1000;
-else
-    q = hsl.l + hsl.s - (hsl.l*hsl.s+500)/1000;
-p = 2 * hsl.l - q;
-hsl.h /= 360.0; // normalize h to 0..1
-tR = hsl.h + 1/3.0;
-tG = hsl.h;
-tB = hsl.h - 1/3.0;
-if (tR < 0.0)
-    tR += 1.0;
-else if (tR > 1.0)
-    tR -= 1.0;
-if (tG < 0.0)
-    tG += 1.0;
-else if (tG > 1.0)
-    tG -= 1.0;
-if (tB < 0.0)
-    tB += 1.0;
-else if (tB > 1.0)
-    tB -= 1.0;
-// Red
-if (tR < 1/6.0)
-    r = p + (q-p)*6*tR;
-else if (tR < 0.5)
-    r = q;
-else if (tR < 2/3.0)
-    r = p + (q-p)*6*(2/3.0 - tR);
-else
-    r = p;
-// Green
-if (tG < 1/6.0)
-    g = p + (q-p)*6*tG;
-else if (tG < 0.5)
-    g = q;
-else if (tG < 2/3.0)
-    g = p + (q-p)*6*(2/3.0 - tG);
-else
-    g = p;
-// Blue
-if (tB < 1/6.0)
-    b = p + (q-p)*6*tB;
-else if (tB < 0.5)
-    b = q;
-else if (tB < 2/3.0)
-    b = p + (q-p)*6*(2/3.0 - tB);
-else
-    b = p;
-return (struct rgbColor) {(255*r+500)/1000, (255*g+500)/1000, (255*b+500)/1000}; // round up
-}
-
-
-struct rgbColor mgHsvToRgb(struct hsvColor hsv)
-/* Convert HSV to RGB colorspace http://en.wikipedia.org/wiki/HSL_and_HSV */
-{
-int i;
-double f;
-unsigned short low, q, t, r, g, b;
-
-if( hsv.s == 0 ) // achromatic (grey)
-    return (struct rgbColor) {(255*hsv.v+500)/1000, (255*hsv.v+500)/1000, (255*hsv.v+500)/1000};
-hsv.h /= 60.0; 
-i = (int) hsv.h;                     // floor the floating point value, sector 0 to 5
-f = hsv.h - i;                       // fractional part (distance) from hue 
-// hsv.v is highest r,g, or b value
-// low value is related to saturation
-low = hsv.v - (hsv.v * hsv.s / 1000); // lowest r,g, or b value
-t = low + (hsv.v - low) * f;         // scaled value from low..high
-q = low + (hsv.v - low) * (1.0-f);   // scaled value from low..high
-
-switch( i )
-    {
-    case 0:
-	r = hsv.v;
-        g = t;
-        b = low;
-        break;
-    case 1:
-        r = q;
-        g = hsv.v;
-        b = low;
-        break;
-    case 2:
-        r = low;
-        g = hsv.v;
-        b = t;
-        break;
-    case 3:
-        r = low;
-        g = q;
-        b = hsv.v;
-        break;
-    case 4:
-        r = t;
-        g = low;
-        b = hsv.v;
-        break;
-    default:                // case 5:
-        r = hsv.v;
-        g = low;
-        b = q;
-        break;
-    }
-return (struct rgbColor) {(255*r+500)/1000, (255*g+500)/1000, (255*b+500)/1000};
-}
-
-
-struct rgbColor mgRgbTransformHsl(struct rgbColor in, double h, double s, double l)
-/* Transform rgb 'in' value using
- *   hue shift 'h' (0..360 degrees), 
- *   saturation scale 's', and 
- *   lightness scale 'l'
- * Returns the transformed rgb value 
- * Use H=0, S=L=1 for identity transformation
- */
-{
-struct hslColor hsl = mgRgbToHsl(in);
-hsl.h += h;
-while (hsl.h < 0.0)
-    hsl.h += 360.0;
-while (hsl.h > 360.0)
-    hsl.h -= 360.0;
-hsl.s = min(max(hsl.s * s, 0), 1000);
-hsl.l = min(max(hsl.l * l, 0), 1000);
-return mgHslToRgb(hsl);
-}
-
-
-struct rgbColor mgRgbTransformHsv(struct rgbColor in, double h, double s, double v)
-/* Transform rgb 'in' value using
- *   hue shift 'h' (0..360 degrees), 
- *   saturation scale 's', and 
- *   value scale 'v'
- * Returns the transformed rgb value 
- * Use H=0, S=V=1 for identity transformation
- */
-{
-struct hsvColor hsv = mgRgbToHsv(in);
-hsv.h += h;
-while (hsv.h < 0.0)
-    hsv.h += 360.0;
-while (hsv.h > 360.0)
-    hsv.h -= 360.0;
-hsv.s = min(max(hsv.s * s, 0), 1000);
-hsv.v = min(max(hsv.v * v, 0), 1000);
-return mgHsvToRgb(hsv);
-}
-
diff --git a/gbtools/src/blatSrc/lib/meta.c b/gbtools/src/blatSrc/lib/meta.c
deleted file mode 100644
index 26da19a..0000000
--- a/gbtools/src/blatSrc/lib/meta.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-/* metaRa - stuff to parse and interpret a genome-hub meta.txt file, which is in 
- * a hierarchical ra format.  That is something like:
- *     meta topLevel
- *     cellLine HELA
- *
- *         meta midLevel
- *         target H3K4Me3
- *         antibody abCamAntiH3k4me3
- *       
- *            meta lowLevel
- *            fileName hg19/chipSeq/helaH3k4me3.narrowPeak.bigBed
- * The file is interpreted so that lower level stanzas inherit tags from higher level ones.
- */
-
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "errAbort.h"
-#include "meta.h"
-#include "net.h"
-#include "ra.h"
-
-struct metaTagVal *metaTagValNew(char *tag, char *val)
-/* Create new meta tag/val */
-{
-struct metaTagVal *mtv;
-AllocVar(mtv);
-mtv->tag = cloneString(tag);
-mtv->val = cloneString(val);
-return mtv;
-}
-
-void metaTagValFree(struct metaTagVal **pMtv)
-/* Free up metaTagVal. */
-{
-struct metaTagVal *mtv = *pMtv;
-if (mtv != NULL)
-    {
-    freeMem(mtv->tag);
-    freeMem(mtv->val);
-    freez(pMtv);
-    }
-}
-
-void metaTagValFreeList(struct metaTagVal **pList)
-/* Free a list of dynamically allocated metaTagVal's */
-{
-struct metaTagVal *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    metaTagValFree(&el);
-    }
-*pList = NULL;
-}
-
-int metaTagValCmp(const void *va, const void *vb)
-/* Compare to sort based on tag name . */
-{
-const struct metaTagVal *a = *((struct metaTagVal **)va);
-const struct metaTagVal *b = *((struct metaTagVal **)vb);
-return strcmp(a->tag, b->tag);
-}
-
-void metaFree(struct meta **pMeta)
-/* Free up memory associated with a meta. */
-{
-struct meta *meta = *pMeta;
-if (meta != NULL)
-    {
-    metaTagValFreeList(&meta->tagList);
-    freez(pMeta);
-    }
-}
-
-void metaFreeList(struct meta **pList)
-/* Free a list of dynamically allocated meta's. Use metaFreeForest to free children too. */
-{
-struct meta *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    metaFree(&el);
-    }
-*pList = NULL;
-}
-
-void metaFreeForest(struct meta **pForest)
-/* Free up all metas in forest and their children. */ 
-{
-struct meta *meta;
-for (meta = *pForest; meta != NULL; meta = meta->next)
-    {
-    if (meta->children)
-         metaFreeForest(&meta->children);
-    }
-metaFreeList(pForest);
-}
-
-
-void metaSortTags(struct meta *meta)
-/* Do canonical sort so that the first tag stays first but the
- * rest are alphabetical. */
-{
-slSort(&meta->tagList->next, metaTagValCmp);
-}
-
-int countLeadingSpacesDetabbing(char *s, int tabStop)
-/* Count up leading chars including those implied by tab. Set tabStop to 8
- * for usual UNIX results. */
-{
-int count = 0;
-char c;
-while ((c = *s++) != 0)
-    {
-    if (c == ' ')
-        ++count;
-    else if (c == '\t')
-        {
-	int tabBefore = (count % tabStop) * tabStop;
-	count = (tabBefore+1)*tabStop;
-	}
-    else
-        break;
-    }
-return count;
-}
-
-struct meta *metaNextStanza(struct lineFile *lf)
-/* Return next stanza in a meta file.  Does not set parent/child/next pointers. 
- * Returns NULL at end of file.  Does a little error checking,  making sure
- * that indentation level is consistent across all lines of stanza. Returns
- * indentation level. */
-{
-/* See if anything left in file, and if not return. */
-if (!raSkipLeadingEmptyLines(lf, NULL))
-    return NULL;
-
-/* Allocate return structure and vars to help parse. */
-struct meta *meta;
-AllocVar(meta);
-struct dyString *dy = dyStringNew(256);
-char *tag,*val;
-
-/* Loop to get all tags in stanza. */
-boolean firstTime = TRUE;
-int initialIndent = 0;
-for (;;)
-    {
-    dyStringClear(dy);
-    if (!raNextTagVal(lf, &tag, &val, dy))
-        break;
-
-    /* Make tag/val and add it to list. */
-    struct metaTagVal *mtv;
-    AllocVar(mtv);
-    mtv->tag = cloneString(tag);
-    mtv->val = cloneString(val);
-    slAddHead(&meta->tagList, mtv);
-
-    /* Check indentation. */
-    int indent =  countLeadingSpacesDetabbing(dy->string, 8);
-    if (firstTime)
-        {
-	initialIndent = indent;
-	firstTime = FALSE;
-	}
-    else
-        {
-	if (indent != initialIndent)
-	    {
-	    warn("Error line %d of %s\n", lf->lineIx, lf->fileName);
-	    warn("Indentation level %d doesn't match level %d at start of stanza.", 
-		indent, initialIndent);
-	    if (strchr(dy->string, '\t'))
-	        warn("There are tabs in the indentation, be sure tab stop is set to 8 spaces."); 
-	    noWarnAbort();
-	    }
-	}
-    }
-slReverse(&meta->tagList);
-
-/* Set up remaining fields and return. */
-assert(meta->tagList != NULL);
-meta->name = meta->tagList->val;
-meta->indent = initialIndent;
-return meta;
-}
-
-static struct meta *rReverseMetaList(struct meta *list)
-/* Return reverse list, and reverse all childen lists too.  Needed because
- * we addHead instead of addTail while building tree because it's faster,
- * especially as lists get long. */
-{
-slReverse(&list);
-struct meta *meta;
-for (meta = list; meta != NULL; meta = meta->next)
-    {
-    if (meta->children != NULL)
-        meta->children = rReverseMetaList(meta->children);
-    }
-return list;
-}
-
-struct meta *metaLoadAll(char *fileName, char *keyTag, char *parentTag,
-    boolean ignoreOtherStanzas, boolean ignoreIndent)
-/* Loads in all ra stanzas from file and turns them into a list of meta, some of which
- * may have children.  The keyTag parameter is optional.  If non-null it should be set to
- * the tag name that starts a stanza.   If null, the first tag of the first stanza will be used.
- * The parentTag if non-NULL will be a tag name used to define the parent of a stanza.
- * The ignoreOtherStanzas flag if set will ignore stanzas that start with other tags.  
- * If not set the routine will abort on such stanzas.  The ignoreIndent if set will
- * use the parentTag (which must be set) to define the hierarchy.  Otherwise the program
- * will look at the indentation, and if there is a parentTag complain about any
- * disagreements between indentation and parentTag. */
-{
-struct lineFile *lf = netLineFileOpen(fileName);
-struct meta *meta, *forest = NULL, *lastMeta = NULL;
-if (ignoreIndent)
-    {
-    errAbort("Currently metaLoadAll can't ignore indentation, sorry.");
-    }
-while ((meta = metaNextStanza(lf)) != NULL)
-    {
-    struct meta **pList;
-    if (forest == NULL)   /* First time. */
-        {
-	if (meta->indent != 0)
-	    errAbort("Initial stanza of %s should not be indented", fileName);
-	if (keyTag == NULL)
-	    keyTag = meta->tagList->tag;
-	pList = &forest;
-	}
-    else
-        {
-	if (!sameString(keyTag, meta->tagList->tag))
-	    {
-	    if (ignoreOtherStanzas)
-	        {
-		metaFree(&meta);
-		continue;
-		}
-	    else
-	        errAbort("Stanza beginning with %s instead of %s line %d of %s",
-		    meta->tagList->tag, keyTag, lf->lineIx, lf->fileName);
-	    }
-	if (meta->indent > lastMeta->indent)
-	    {
-	    pList = &lastMeta->children;
-	    meta->parent = lastMeta;
-	    }
-	else if (meta->indent == lastMeta->indent)
-	    {
-	    if (meta->indent == 0)
-		pList = &forest;
-	    else
-		{
-	        pList = &lastMeta->parent->children;
-		meta->parent = lastMeta->parent;
-		}
-	    }
-	else /* meta->indent < lastMeta->indent */
-	    {
-	    /* Find sibling at same level as us. */
-	    struct meta *olderSibling;
-	    for (olderSibling = lastMeta->parent; 
-		olderSibling != NULL; olderSibling = olderSibling->parent)
-	        {
-		if (meta->indent == olderSibling->indent)
-		    break;
-		}
-	    if (olderSibling == NULL)
-	        {
-		warn("Indentation inconsistent in stanza ending line %d of %s.", 
-		    lf->lineIx, lf->fileName);
-		warn("If you are using tabs, check your tab stop is set to 8.");
-		warn("Otherwise check that when you are reducing indentation in a stanza");
-		warn("that it is the same as the previous stanza at the same level.");
-		noWarnAbort();
-		}
-	    if (olderSibling->parent == NULL)
-	        pList = &forest;
-	    else
-	        {
-		pList = &olderSibling->parent->children;
-		meta->parent = olderSibling->parent;
-		}
-	    }
-	}
-    slAddHead(pList, meta);
-    lastMeta = meta;
-    }
-lineFileClose(&lf);
-forest = rReverseMetaList(forest);
-return forest;
-}
-
-static void rMetaListWrite(struct meta *metaList, struct meta *parent,
-    boolean level, int indent, boolean withParent, FILE *f)
-/* Write out list of stanzas at same level to file,  their children too. */
-{
-int totalIndent = level * indent;
-struct meta *meta;
-for (meta = metaList; meta != NULL; meta = meta->next)
-    {
-    struct metaTagVal *mtv;
-    boolean gotParent = FALSE;
-    for (mtv = meta->tagList; mtv != NULL; mtv = mtv->next)
-	{
-	if (sameString(mtv->tag, "parent"))
-	    {
-	    if (withParent)
-	        gotParent = TRUE;
-	    else
-	        continue;   
-	    }
-	spaceOut(f, totalIndent);
-	fprintf(f, "%s %s\n", mtv->tag, mtv->val);
-	}
-    if (withParent && !gotParent && parent != NULL)
-        {
-	spaceOut(f, totalIndent);
-	fprintf(f, "%s %s\n", "parent", parent->name);
-	}
-    fprintf(f, "\n");
-    if (meta->children)
-        rMetaListWrite(meta->children, meta, level+1, indent, withParent, f);
-    }
-}
-
-void metaWriteAll(struct meta *metaList, char *fileName, int indent, boolean withParent)
-/* Write out metadata, optionally adding meta tag. */
-{
-FILE *f = mustOpen(fileName, "w");
-rMetaListWrite(metaList, NULL, 0, indent, withParent, f);
-carefulClose(&f);
-}
-
-char *metaLocalTagVal(struct meta *meta, char *name)
-/* Return value of tag found in this node, not going up to parents. */
-{
-struct metaTagVal *mtv;
-for (mtv = meta->tagList; mtv != NULL; mtv = mtv->next)
-    if (sameString(mtv->tag, name))
-        return mtv->val;
-return NULL;
-}
-
-char *metaTagVal(struct meta *meta, char *name)
-/* Return value of tag found in this node or if its not there in parents.
- * Returns NULL if tag not found. */
-{
-struct meta *m;
-for (m = meta; m != NULL; m = m->parent)
-    {
-    char *val = metaLocalTagVal(m, name);
-    if (val != NULL)
-       return val;
-    }
-return NULL;
-}
-
-void metaAddTag(struct meta *meta, char *tag, char *val)
-/* Add tag to meta, replacing existing tag if any */
-{
-/* First loop through to replace an existing tag. */
-struct metaTagVal *mtv;
-for (mtv = meta->tagList; mtv != NULL; mtv = mtv->next)
-    {
-    if (sameString(mtv->tag, tag))
-       {
-       freeMem(mtv->val);
-       mtv->val = cloneString(val);
-       return;
-       }
-    }
-/* If didn't make it then add new tag (at end) */
-mtv = metaTagValNew(tag, val);
-slAddTail(&meta->tagList, mtv);
-}
-
-static void rHashMetaList(struct hash *hash, struct meta *list)
-/* Add list, and any children of list to hash */
-{
-struct meta *meta;
-for (meta = list; meta != NULL; meta = meta->next)
-    {
-    hashAddUnique(hash, meta->name, meta);
-    if (meta->children)
-        rHashMetaList(hash, meta->children);
-    }
-}
-
-struct hash *metaHash(struct meta *forest)
-/* Return hash of meta at all levels of heirarchy keyed by forest. */
-{
-struct hash *hash = hashNew(0);
-rHashMetaList(hash, forest);
-return hash;
-}
diff --git a/gbtools/src/blatSrc/lib/metaWig.c b/gbtools/src/blatSrc/lib/metaWig.c
deleted file mode 100644
index dd5c45c..0000000
--- a/gbtools/src/blatSrc/lib/metaWig.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* Copyright (C) 2010 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "linefile.h"
-#include "localmem.h"
-#include "bigWig.h"
-#include "bwgInternal.h"
-#include "metaWig.h"
-
-static struct hash *hashSectionChroms(struct bwgSection *sectionList)
-/* Return hash keyed by chromosome name with values that are the
- * first section in the chromosome. */
-{
-struct hash *hash = hashNew(0);
-struct bwgSection *section;
-for (section = sectionList; section != NULL; section = section->next)
-    {
-    if (!hashLookup(hash, section->chrom))
-        hashAdd(hash, section->chrom, section);
-    }
-return hash;
-}
-
-struct metaWig *metaWigOpen(char *fileName)
-/* Wrap self around file.  Read all of it if it's wig, just header if bigWig. */
-{
-struct metaWig *mw;
-AllocVar(mw);
-if (isBigWig(fileName))
-    {
-    mw->type = mwtBigWig;
-    mw->bwf = bigWigFileOpen(fileName);
-    }
-else
-    {
-    mw->lm = lmInit(0);
-    mw->sectionList = bwgParseWig(fileName, FALSE, NULL, 512, mw->lm);
-    mw->chromHash = hashSectionChroms(mw->sectionList);
-    mw->type = mwtSections;
-    }
-return mw;
-}
-
-void metaWigClose(struct metaWig **pMw)
-/* Close up metaWig file */
-{
-struct metaWig *mw = *pMw;
-if (mw != NULL)
-    {
-    bigWigFileClose(&mw->bwf);
-    lmCleanup(&mw->lm);
-    freez(pMw);
-    }
-}
-
-struct slName *metaWigChromList(struct metaWig *mw)
-/* Return list of chromosomes covered in wig. */
-{
-struct slName *list = NULL;
-switch (mw->type)
-    {
-    case mwtSections:
-        {
-	struct hashEl *chrom, *chromList = hashElListHash(mw->chromHash);
-	for (chrom = chromList; chrom != NULL; chrom = chrom->next)
-	    slNameAddHead(&list, chrom->name);
-	hashElFreeList(&chromList);
-	break;
-	}
-    case mwtBigWig:
-        {
-	struct bbiChromInfo *chrom, *chromList = bbiChromList(mw->bwf);
-	for (chrom = chromList; chrom != NULL; chrom = chrom->next)
-	    slNameAddHead(&list, chrom->name);
-	bbiChromInfoFreeList(&chromList);
-	break;
-	}
-    }
-slSort(&list, slNameCmpStringsWithEmbeddedNumbers);
-return list;
-}
-
-static void bedGraphSectionToIntervals(struct bwgSection *section, struct lm *lm,
-	struct bbiInterval **pList)
-/* Convert bedGraph section to interval format. */
-{
-struct bwgBedGraphItem *item;
-for (item = section->items.bedGraphList; item != NULL; item = item->next)
-    {
-    struct bbiInterval *el;
-    lmAllocVar(lm, el);
-    el->start = item->start;
-    el->end = item->end;
-    el->val = item->val;
-    slAddHead(pList, el);
-    }
-}
-
-static void varStepSectionToIntervals(struct bwgSection *section, struct lm *lm,
-	struct bbiInterval **pList)
-/* Convert bedGraph section to interval format. */
-{
-struct bwgVariableStepPacked *array = section->items.variableStepPacked;
-int i, count = section->itemCount;
-bits32 span = section->itemSpan;
-for (i=0; i<count; ++i)
-    {
-    struct bwgVariableStepPacked *item = &array[i];
-    struct bbiInterval *el;
-    lmAllocVar(lm, el);
-    el->start = item->start;
-    el->end = item->start + span;
-    el->val = item->val;
-    slAddHead(pList, el);
-    }
-}
-
-static void fixedStepSectionToIntervals(struct bwgSection *section, struct lm *lm,
-	struct bbiInterval **pList)
-/* Convert bedGraph section to interval format. */
-{
-struct bwgFixedStepPacked *array = section->items.fixedStepPacked;
-int i, count = section->itemCount;
-bits32 span = section->itemSpan;
-bits32 step = section->itemStep;
-bits32 start = section->start;
-for (i=0; i<count; ++i)
-    {
-    struct bwgFixedStepPacked *item = &array[i];
-    struct bbiInterval *el;
-    lmAllocVar(lm, el);
-    el->start = start;
-    el->end = start + span;
-    el->val = item->val;
-    start += step;
-    slAddHead(pList, el);
-    }
-}
-
-static void addIntervals(struct bwgSection *section, struct lm *lm, struct bbiInterval **pList)
-/* Convert section to list of allocated in lm */
-{
-switch (section->type)
-    {
-    case bwgTypeBedGraph:
-        bedGraphSectionToIntervals(section, lm, pList);
-        break;
-    case bwgTypeVariableStep:
-	varStepSectionToIntervals(section, lm, pList);
-        break;
-    case bwgTypeFixedStep:
-	fixedStepSectionToIntervals(section, lm, pList);
-	break;
-    default:
-        errAbort("unknown section type %d in addIntervals", section->type);
-	break;
-    }
-}
-
-struct bbiInterval *metaIntervalsForChrom(struct metaWig *mw, char *chrom, struct lm *lm)
-/* Get sorted list of all intervals with data on chromosome. */
-{
-struct bbiInterval *list = NULL;
-switch (mw->type)
-    {
-    case mwtSections:
-        {
-	struct bwgSection *section, *sectionList = hashFindVal(mw->chromHash, chrom);
-	for (section = sectionList; section != NULL; section = section->next)
-	   {
-	   if (!sameString(section->chrom, chrom))
-	       break;
-	   addIntervals(section, lm, &list);
-	   }
-	slReverse(&list);
-	break;
-	}
-    case mwtBigWig:
-        {
-	list = bigWigIntervalQuery(mw->bwf, chrom, 0, bbiChromSize(mw->bwf, chrom), lm);
-	break;
-	}
-    }
-return list;
-}
-
diff --git a/gbtools/src/blatSrc/lib/mgCircle.c b/gbtools/src/blatSrc/lib/mgCircle.c
deleted file mode 100644
index bdef3ea..0000000
--- a/gbtools/src/blatSrc/lib/mgCircle.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* mgCircle.c - Simple stepping draw a circle algorithm.  
-	Don't even correct aspect ratio. 
- * This file is copyright 1984-2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "memgfx.h"
-
-
-void mgCircle(struct memGfx *mg, int xCen, int yCen, int rad, 
-	Color color, boolean filled)
-/* Draw a circle using a stepping algorithm.  Doesn't correct
- * for non-square pixels. */
-{
-int err;
-int derr, yerr, xerr;
-int aderr, ayerr, axerr;
-register int x,y;
-int lasty;
-
-if (rad <= 0)
-    {
-    mgPutDot(mg, xCen, yCen, color);
-    return;
-    }
-err = 0;
-x = rad;
-lasty = y = 0;
-for (;;)
-    {
-    if (filled)
-	{
-	if (y == 0)
-	    mgLineH(mg, yCen, xCen-x, xCen+x, color);
-	else
-	    {
-	    if (lasty != y)
-		{
-		mgLineH(mg, yCen-y, xCen-x, xCen+x, color);
-		mgLineH(mg, yCen+y, xCen-x, xCen+x, color);
-		lasty = y;
-		}
-	    }
-	}
-    else
-	{
-	/* draw 4 quadrandts of a circle */
-	mgPutDot(mg, xCen+x, yCen+y, color);
-	mgPutDot(mg, xCen+x, yCen-y, color);
-	mgPutDot(mg, xCen-x, yCen+y, color);
-	mgPutDot(mg, xCen-x, yCen-y, color);
-	}
-    axerr = xerr = err -x-x+1;
-    ayerr = yerr = err +y+y+1;
-    aderr = derr = yerr+xerr-err;
-    if (aderr < 0)
-	aderr = -aderr;
-    if (ayerr < 0)
-	ayerr = -ayerr;
-    if (axerr < 0)
-	axerr = -axerr;
-    if (aderr <= ayerr && aderr <= axerr)
-	{
-	err = derr;
-	x -= 1;
-	y += 1;
-	}
-    else if (ayerr <= axerr)
-	{
-	err = yerr;
-	y += 1;
-	}
-    else
-	{
-	err = xerr;
-	x -= 1;
-	}
-    if (x < 0)
-	break;
-    }
-}
diff --git a/gbtools/src/blatSrc/lib/mgPolygon.c b/gbtools/src/blatSrc/lib/mgPolygon.c
deleted file mode 100644
index 61c7ef6..0000000
--- a/gbtools/src/blatSrc/lib/mgPolygon.c
+++ /dev/null
@@ -1,438 +0,0 @@
-/* mgPolygon - stuff to draw polygons in memory.  This code dates
- * back to 1984, was used in the Aegis Animator for the Atari ST. 
- * It was an exceedingly speed critical routine for that program.
- * For us it may be overkill, but the major speed tweak - the special
- * case for convex polygons - is only 1/3 of the module, so I'm leaving
- * it in.  I've lightly adapted the code to current conventions, but
- * you can still see some relics in the local and static variable names of 
- * other coding conventions.  
- * This file is copyright 1984-2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "bits.h"
-#include "memgfx.h"
-#include "gfxPoly.h"
-
-
-void mgDrawPolyOutline(struct memGfx *mg, struct gfxPoly *poly, Color color)
-/* Draw a singe pixel line around polygon. */
-{
-struct gfxPoint *a, *b, *end;
-
-a = end = poly->ptList;
-b = a->next;
-for (;;)
-    {
-    mgDrawLine(mg, a->x, a->y, b->x, b->y, color);
-    a = b;
-    b = b->next;
-    if (a == end)
-        break;
-    }
-}
-
-/* ----- Stuff for convex polygons that may contain crossing lines ----- 
- * This code works by allocating a bitmap big enough to hold the polygon
- * and drawing lines on the bitmap in a special fashion, and then
- * scanning the bitmap to connect together the dots with horizontal lines. */
-
-#define UPDIR 1
-#define DOWNDIR 0
-
-static UBYTE *on_off_buf;	/* Our bitplane. */
-
-static int pxmin, pxmax, pymin, pymax;	/* Bounds of polygon. */
-
-static void find_pminmax(struct gfxPoly *poly)
-{
-struct gfxPoint *pointpt;
-int i;
-
-pointpt = poly->ptList;
-pxmin = pxmax = pointpt->x;
-pymin = pymax = pointpt->y;
-pointpt = pointpt->next;
-
-i = poly->ptCount;
-while (--i > 0)
-   {
-   if (pxmin > pointpt->x) pxmin = pointpt->x;
-   if (pxmax < pointpt->x) pxmax = pointpt->x;
-   if (pymin > pointpt->y) pymin = pointpt->y;
-   if (pymax < pointpt->y) pymax = pointpt->y;
-   pointpt = pointpt->next;
-   }
-}
-
-static void xor_pt(int bpr, int x, int y)
-/* Xor in a bit at given location. */
-{
-UBYTE rot;
-
-rot = ((unsigned)0x80) >> (x&7);
-on_off_buf[ bpr*y + (x>>3) ] ^= rot;
-}
-
-
-static void y_xor_line(int bpr, int x1, int y1, int x2, int y2)
-/* Xor in a line onto on_off_buf, only plotting when we hit a new y-value. */
-{
-UBYTE *imagept = on_off_buf;
-UBYTE rot;
-int   duty_cycle;
-int   delta_x, delta_y;
-int dots;
-int swap;
-
-if (x1 > x2)
-    {
-    swap = x1;
-    x1 = x2;
-    x2 = swap;
-    swap = y1;
-    y1 = y2;
-    y2 = swap;
-    }
-delta_y = y2-y1;
-delta_x = x2-x1;
-rot = ((unsigned)0x80) >> (x1&7);
-imagept += bpr*y1 + (x1>>3);
-
-
-if (delta_y < 0) 
-    {
-    delta_y = -delta_y;
-    bpr = -bpr;
-    }
-duty_cycle = (delta_x - delta_y)/2;
-*(imagept) ^= rot;
-if (delta_x < delta_y)
-    {
-    dots = delta_y;
-    while (--dots >= 0)
-	{
-	*(imagept) ^= rot;
-	duty_cycle += delta_x;	  /* update duty cycle */
-	imagept += bpr;
-	if (duty_cycle > 0)
-	    {
-	    duty_cycle -= delta_y;
-	    rot >>= 1;
-	    if (rot == 0)
-		{
-		imagept++;
-		rot = 0x80;
-		}
-	    }
-	}
-    }
-else
-    {
-    dots = delta_x;
-    while (--dots >= 0)
-	{
-	duty_cycle -= delta_y;	  /* update duty cycle */
-	if (duty_cycle < 0)
-	    {
-	    *(imagept) ^= rot;
-	    duty_cycle += delta_x;
-	    imagept += bpr;
-	    }
-	rot >>= 1;
-	if (rot == 0)
-	    {
-	    imagept++;
-	    rot = 0x80;
-	    }
-	}
-    }
-}
-
- 
-static void drawAfterOnOff(struct memGfx *mg, Color color, int bpr, int width, 
-	int height)
-/* Examine bitmap and draw horizontal lines between set bits. */
-{
-UBYTE *linept = on_off_buf;
-int y;
-
-for (y=0; y<height; ++y)
-	{
-	int start = 0;
-	int end;
-	for (;;)
-	    {
-	    start = bitFindSet(linept, start, width);
-	    if (start >= width)
-	        break;
-	    end = bitFindSet(linept, start+1, width);
-	    mgLineH(mg, y+pymin, start+pxmin, end+pxmin, color);
-	    start = end+1;
-	    }
-	linept += bpr;
-	}
-}
-
-static void fillConcave(struct memGfx *mg, struct gfxPoly *poly, Color color)
-/* Draw concave polygon */
-{
-struct gfxPoint *pointpt;
-int x,y;
-int ox,oy;
-int lastdir;
-int i;
-int bpr;	/* Bytes per row */
-int width, height;
-long size;
-
-find_pminmax(poly);
-if (pymin==pymax)  /*Complex code can't cope with trivial case*/
-    {
-    mgLineH(mg, pymin, pxmin, pxmax,color);
-    return;
-    }
-width = pxmax - pxmin + 1;
-height = pymax - pymin + 1;
-bpr = ((width+7)>>3);
-size = (long)bpr*height;
-if ((on_off_buf = needMem(size)) == NULL)	
-    return;
-pointpt = poly->ptList;
-x = pointpt->x;
-y = pointpt->y;
-
-do
-	{
-	pointpt = pointpt->next;
-	ox = pointpt->x;
-	oy = pointpt->y;
-	}
-while (oy == y);
-
-if (oy>y)
-	lastdir = UPDIR;
-else
-	lastdir = DOWNDIR;
-
-i = poly->ptCount;
-while (--i >= 0)
-   {
-   pointpt = pointpt->next;
-   x = pointpt->x;
-   y = pointpt->y;
-   if (y!=oy)
-	  {
-	  y_xor_line(bpr,ox-pxmin,oy-pymin,x-pxmin,y-pymin);
-	  if (y>oy)
-		 if (lastdir == UPDIR)
-			xor_pt(bpr,ox-pxmin,oy-pymin);
-		 else
-			lastdir = UPDIR;
-	  else
-		 if (lastdir == DOWNDIR)
-			xor_pt(bpr,ox-pxmin,oy-pymin);
-		 else
-			lastdir = DOWNDIR;
-	  }
-   ox = x;
-   oy = y;
-   }
-
-drawAfterOnOff(mg, color, bpr, width, height);
-freez(&on_off_buf);
-return;
-}
-
-/*  ---- This section of code is for convex, polygons.  It's faster. ---- */
-
-#ifdef SOME_OFF_BY_ONE_PROBLEMS
-static int *xdda_ebuf(int *ebuf, int x1, int y1, int x2, int y2)
-/* Calculate the x-positions of a line from x1,y1  to x2/y2  */
-{
-int incx, incy;
-int x;
-int duty_cycle;
-int delta_x, delta_y;
-int dots;
-
-delta_y = y2-y1;
-delta_x = x2-x1;
-incx =  incy = 1;
-x = x1;
-if (delta_y < 0) 
-   {
-   delta_y = -delta_y;
-   incy = -1;
-   }
-
-if (delta_x < 0) 
-   {
-   delta_x = -delta_x;
-   incx = -1;
-   }
-
-duty_cycle = (delta_x - delta_y)/2;
-if (delta_x >= delta_y)
-    {
-    int lasty = y1-1;
-    dots = delta_x+1;
-    while (--dots >= 0)
-	{
-	if (lasty != y1)
-	    {
-	    *ebuf++ = x1;
-	    lasty = y1;
-	    }
-	duty_cycle -= delta_y;
-	x1 += incx;
-	if (duty_cycle < 0)
-	    {
-	    duty_cycle += delta_x;	  /* update duty cycle */
-	    y1+=incy;
-	    }
-	}
-    }
-else
-    {
-    dots = delta_y+1;
-    while (--dots >= 0)
-	{
-	*ebuf++ = x1;
-	duty_cycle += delta_x;
-	y1+=incy;
-	if (duty_cycle > 0)
-	    {
-	    duty_cycle -= delta_y;	  /* update duty cycle */
-	    x1 += incx;
-	    }
-	}
-    }
-return(ebuf);
-}
-#endif /* SOME_OFF_BY_ONE_PROBLEMS */
-
-
-#ifdef CONVEX_OPTIMIZATION
-int *fill_ebuf(struct gfxPoint *thread, int count, int *ebuf)
-/* Make list of x coordinates for a couple of lines.  Assumes that
- * the y coordinates are monotonic.  Ebuf needs to be as big as the
- * total height of thread.  Returns next free space in ebuf. */
-{
-int x, y, ox, oy;
-int i;
-
-ox = thread->x;
-oy = thread->y;
-
-for (i=0; i<count; ++i)
-   {
-   thread = thread->next;
-   x = thread->x;
-   y = thread->y;
-   if (y!=oy)
-      ebuf = xdda_ebuf(ebuf,ox,oy,x,y) - 1;
-   ox = x;
-   oy = y;
-   }
-return(ebuf+1);
-}
-
-static void blast_hlines(struct memGfx *mg, 
-	int *thread1, 	/* List of start X positions. */
-	int *thread2, 	/* Backwards list of end positions. */
-	int y, 		/* Y position. */
-	int count, 	/* Number of horizontal lines to draw. */
-	Color color)	/* Color. */
-/* Draw a whole bunch of horizontal lines. */
-{
-int x1, x2;
-thread2 += count;
-while (--count >= 0)
-    {
-    x1 = *thread1++;
-    x2 = *(--thread2);
-    if (x1 > x2)
-	mgLineH(mg, y, x2, x1, color);
-    else
-	mgLineH(mg, y, x1, x2, color);
-    y += 1;
-    }
-}
-
-void mgDrawPolyFilled(struct memGfx *mg, struct gfxPoly *poly, Color color)
-/* Draw filled polygon, possibly with outline in a seperate color. */
-{
-struct gfxPoint *p;
-struct gfxPoint *np;
-struct gfxPoint *peak;
-struct gfxPoint *valley;
-int highy;
-int i;
-int pcount;
-int lasty;
-
-peak = p = poly->ptList;
-i = poly->ptCount;
-highy = p->y;
-pcount = 0;
-while (--i > 0)
-    {
-    p = p->next;
-    if (p->y <= highy)
-	{
-	peak = p;
-	highy = p->y;
-	}
-    }
-p = peak;
-np = p->next;
-i = poly->ptCount;
-while (--i >= 0)
-    {
-    if (np->y < p->y)
-	{
-	int totalHeight;
-	int *thread1, *thread2;
-	valley = p;
-	p = np;
-	np = np->next;
-	while (--i >= 0)
-	    {
-	    if (np->y > p->y)
-		{
-		fillConcave(mg, poly, color);
-		return;	/*sorry its concave*/
-		}
-	    p = np;
-	    np = np->next;		
-	    }
-	totalHeight = valley->y - highy + 1;
-	AllocArray(thread1, totalHeight);
-	AllocArray(thread2, totalHeight);
-	fill_ebuf(peak, pcount, thread1);
-	pcount = fill_ebuf(valley, poly->ptCount - pcount, thread2)
-		- thread2;
-	blast_hlines(mg, thread1, thread2, highy, pcount, color);
-	freeMem(thread1);
-	freeMem(thread2);
-	return;
-	}
-    pcount++;
-    p = np;
-    np = np->next;
-    }	
-return;	/*all points of poly have same y value */
-}
-#endif /* CONVEX_OPTIMIZATION */
-
-void mgDrawPoly(struct memGfx *mg, struct gfxPoly *poly, Color color,
-	boolean filled)
-/* Draw polygon, possibly filled in color. */
-{
-if (filled)
-    fillConcave(mg, poly, color);
-    // mgDrawPolyFilled(mg, poly, color);
-mgDrawPolyOutline(mg, poly, color);
-}
-
diff --git a/gbtools/src/blatSrc/lib/mime.c b/gbtools/src/blatSrc/lib/mime.c
deleted file mode 100644
index 8a7084d..0000000
--- a/gbtools/src/blatSrc/lib/mime.c
+++ /dev/null
@@ -1,687 +0,0 @@
-/* Routines for processing MIME from a descriptor.
- *   For cgi post, the MIME descriptor is stdin.
- *   We want to parse it as it comes in so that 
- *   we can handle very large files if needed.
- *   Large data are saved to tempfiles.
- *   Small data stays as ptr+size in memory.
- *
- * This file is copyright 2005 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "hash.h"
-#include "linefile.h"
-#include "cheapcgi.h"
-#include "portable.h"
-#include "errAbort.h"
-#include "mime.h"
-
-/* 
- * Note: MIME is a nested structure that makes a tree that streams in depth-first.
- */
-
-#define MAXPARTSIZE 64LL*1024*1024*1024  /* max size before gets put in a tempfile to save memory. It currently has been set so large that it will not be triggered. */
-#define MAXPARTLINESIZE 1024 /* header lines should be small, so bad if bigger than this */
-#define MAXDATASIZE 64LL*1024*1024*1024 /* max size allowable for large uploads */
-#define MAXBOUNDARY 72+5     /* max size of buffer for boundary 72+--""0 */
-
-enum nlType nlType = nlt_undet;
-
-static void setEopMB(struct mimeBuf *b)
-/* do a search for boundary, set eop End Of Part if found */
-{
-if (b->blen > 0)
-    b->eop = memMatch(b->boundary, b->blen, b->i, b->eoi - b->i);
-else
-    b->eop = NULL;
-}
-
-static void setEodMB(struct mimeBuf *b)
-/* set end of data - eoi minus (boundary-size -1) */
-{
-if (b->blen > 1 && b->eoi == b->eom) 
-    {
-    b->eod = b->eoi - (b->blen-1);
-    }
-else
-    {
-    b->eod = b->eoi;
-    }
-}
-
-static void setBoundaryMB(struct mimeBuf *b, char *boundary)
-/* set boundary in b */
-{
-b->boundary = boundary;
-b->blen = boundary ? strlen(b->boundary) : 0;
-setEopMB(b);
-setEodMB(b);
-}
-
-#ifdef DEBUG
-static void dumpMB(struct mimeBuf *b)
-/* debug dump */
-{
-int i=0;
-
-fprintf(stderr,"b->i  =%lu "
-      "b->eop=%lu "
-      "b->eod=%lu "
-      "b->eoi=%lu "
-      "b->eom=%lu "
-      "%s "
-      "%d "
-      "\n", 
-    (unsigned long) b->i,
-    (unsigned long) b->eop,
-    (unsigned long) b->eod,
-    (unsigned long) b->eoi,
-    (unsigned long) b->eom,
-    b->boundary,
-    b->blen
-    );
-fprintf(stderr,"*");    
-for(i=0;i<MIMEBUFSIZE;++i)
-    {
-    fprintf(stderr,"%c", (b->buf[i] < 31 || (unsigned) b->buf[i] > 127) ? '.' : b->buf[i] );
-    }
-fprintf(stderr,"\n\n");    
-}
-#endif
-
-static void moreMimeBuf(struct mimeBuf *b)
-{
-int bytesRead = 0, bytesToRead = 0;
-if (b->blen > 1)
-    {
-    int r = b->eoi - b->i;
-    memmove(b->buf, b->i, r);
-    b->eoi = b->buf+r;
-    }
-else
-    {
-    b->eoi = b->buf;
-    }
-b->i = b->buf+0;
-bytesToRead = b->eom - b->eoi;
-while (bytesToRead > 0)
-    {
-    bytesRead = read(b->d, b->eoi, bytesToRead);
-    if (bytesRead < 0)
-        errnoAbort("moreMimeBuf: error reading MIME input descriptor");
-    b->eoi += bytesRead;
-    if (bytesRead == 0)
-        break;
-    bytesToRead = bytesToRead - bytesRead;
-    }
-setEopMB(b);
-setEodMB(b);
-//debug
-//fprintf(stderr,"post-moreMime dumpMB: ");
-//dumpMB(b);  //debug
-}
-
-static char getcMB(struct mimeBuf *b)
-/* read just one char from MIME buffer */
-{
-if (b->i >= b->eoi && b->eoi < b->eom)  /* at end of input */
-    errAbort("getcMB error - requested input beyond end of MIME input.");
-if (b->i >= b->eod && b->eoi == b->eom) /* at end of buffer */
-    moreMimeBuf(b);
-    
-//fprintf(stderr,"b->buf:%lu b->i:%lu %c \n",
-//    (unsigned long) b->buf,
-//    (unsigned long) b->i,
-//    *b->i
-//    );
-//fprintf(stderr,"%c",*b->i);
-//fflush(stderr); 
-return *b->i++;    
-}
-
-static void putBackMB(struct mimeBuf *b)
-/* Rewind just one char back in MIME buffer.
- * Do not use except for distinguishing line type initially */
-{
-if (b->i == b->buf)  /* at beginning of buffer */
-    errAbort("putBackMB error - requested pushback beyond beginning buffer.");
-b->i--;    
-}
-
-static char *getLineMB(struct mimeBuf *b)
-/* Reads one line up to CRLF, returned string does not include CRLF however. 
-   Use freeMem when done with string. */
-{
-char line[MAXPARTLINESIZE];
-int i = 0;
-char c = 0;
-line[0]=0;
-while(TRUE)
-    {
-    c =getcMB(b);
-    if ((c == 0x0d) || (c == 0x0a))  /* CR or LF is end of line */
-	break;
-    line[i++] = c;
-    if (i >= MAXPARTLINESIZE)
-	errAbort("getLineMB error - MIME input header too long, "
-		    "greater than %d chars",MAXPARTLINESIZE);
-    }
-line[i] = 0; /* terminate string */ 
-if (nlType == nlt_undet)  /* determine newline type */
-    {
-    if (c == 0x0d)
-	{
-	nlType = nlt_mac;
-	c = getcMB(b);
-	if (c == 0x0a)
-	    nlType = nlt_dos;
-	else
-    	    putBackMB(b);
-	}
-    else
-	{
-	nlType = nlt_unix;
-	}
-    }
-else if (nlType == nlt_dos)
-    {
-    if (c == 0x0d)
-    	getcMB(b); /* just waste the LF */
-    else
-	nlType = nlt_unix;
-    }
-return cloneString(line);
-}
-
-
-static void getChunkMB(struct mimeBuf *b, char **address, int *size, boolean *hasZeros)
-/* Pass back address and size of chunk, and whether it contains embedded zeros.
-   The chunk is the largest piece of data left in the buffer up to the eod or eop. */
-{
-char *eoc = b->eop ? b->eop : b->eod; /* end of chunk */
-//debug
-//fprintf(stderr,"pre-getChunkMB dumpMB: ");
-//dumpMB(b);  //debug
-*address=b->i;
-*size=eoc - b->i;
-*hasZeros = (memMatch("", 1,*address, *size) != NULL);
-b->i = eoc;
-}
-
-static void readPartHeaderMB(struct mimeBuf *b, struct mimePart *p, char *altHeader)
-/* Reads the header lines of the mimePart,
-   saves the header settings in a hash.  */
-{
-struct dyString *fullLine = dyStringNew(0);
-char *key=NULL, *val=NULL;
-struct lineFile *lf = NULL;
-char *line = NULL;
-char *lineAhead = NULL;
-int size = 0;
-p->hdr = newHash(3);
-	//debug
-    	//fprintf(stderr,"headers dumpMB: ");
-	//dumpMB(b);  //debug
-if (altHeader)
-    {
-    lf = lineFileOnString("MIME Header", TRUE, altHeader);
-    }
-/* read ahead one line, skipping any leading blanks lines */   
-do
-    {
-    if (altHeader)
-	lineFileNext(lf, &lineAhead, &size);
-    else
-	lineAhead = getLineMB(b);
-    } 
-    while (sameString(lineAhead,""));
-
-do
-    {
-    /* accumulate a full header line - some emailers split into mpl lines */
-    dyStringClear(fullLine);
-    do 
-	{
-	line = lineAhead;
-	if (altHeader)
-	    lineFileNext(lf, &lineAhead, &size);
-	else
-	    lineAhead = getLineMB(b);
-	dyStringAppend(fullLine,line);    
-	if (!altHeader) 
-	    freez(&line);
-	} while (isspace(lineAhead[0]));
-    line = fullLine->string;
-    //fprintf(stderr,"found a line! [%s]\n",line);  //debug
-    key = line;
-    val = strchr(line,':');
-    if (!val)
-	errAbort("readPartHeaderMB error - header-line colon not found, line=[%s]",line);
-    *val = 0;
-    val++;
-    key=trimSpaces(key);
-    // since the hash is case-sensitive, convert to lower case for ease of matching
-    tolowers(key);  
-    val=trimSpaces(val);
-    hashAdd(p->hdr,key,cloneString(val));
-    
-    //debug
-    //fprintf(stderr,"MIME header: key=[%s], val=[%s]\n",key,val);
-    //fflush(stderr); 
-    
-    } while (!sameString(lineAhead,""));
-if (altHeader)
-    {
-    if (nlType == nlt_undet)
-	nlType = lf->nlType;
-    lineFileClose(&lf);
-    }
-else
-    {
-    freez(&lineAhead);
-    }
-dyStringFree(&fullLine);
-    
-}
-
-
-struct mimeBuf * initMimeBuf(int d)
-/* d is a descriptor for a file or socket or some other descriptor 
-   that the MIME input can be read from. 
-   Initializes the mimeBuf structure. */
-{
-struct mimeBuf *b=AllocA(*b);
-b->d = d;
-b->boundary = NULL;
-b->blen = 0;
-b->eom = b->buf+MIMEBUFSIZE;
-b->eoi = b->eom;
-b->eod = b->eom;
-b->i = b->eom;
-moreMimeBuf(b);
-return b;
-}
-
-char *getMimeHeaderMainVal(char *header)
-/* Parse a typical mime header line returning the first
- * main value up to whitespace, punctuation, or end. 
- * freeMem the returned string when done */
-{
-char value[1024]; 
-char *h = header;
-int i = 0;
-char *puncChars = ",;: \t\r\n"; /* punctuation chars */
-i=0;
-/* The header should have already been trimmed of leading and trailing spaces */
-while(TRUE)
-    {
-    char c = *h++;
-    if (c==0 || strchr(puncChars,c))
-	break;
-    value[i++] = c;
-    if (i >= sizeof(value))
-	errAbort("error: main value too long (>%lu) in MIME header Content-type:%s",(unsigned long)sizeof(value),header);
-    }
-value[i] = 0;    
-
-return cloneString(value);
-
-}
-
-
-char *getMimeHeaderFieldVal(char *header, char *field)
-/* Parse a typical mime header line looking for field=
- * and return the value which may be quoted.
- * freeMem the returned string when done */
-{
-char value[1024]; 
-char *fld = header;
-int i = 0;
-char *puncChars = ",;: \t\r\n"; /* punctuation chars */
-while (TRUE)
-    {
-    fld = strstr(fld,field);
-    if (!fld)
-	return NULL;
-    if (fld > header && strchr(puncChars,fld[-1]))
-	{
-	fld+=strlen(field);
-	if (*fld == '=')
-	    {
-	    ++fld;
-	    break;
-	    }
-	}    
-    else
-	{
-	++fld;
-	}
-    }	
-if (*fld == '"')
-    {
-    puncChars = "\"";  /* quoted */
-    ++fld;
-    }
-i=0;
-while(TRUE)
-    {
-    char c = *fld++;
-    if (c==0 || strchr(puncChars,c))
-	break;
-    value[i++] = c;
-    if (i >= sizeof(value))
-	errAbort("error: %s= value too long (>%lu) in MIME header Content-type:%s",field,(unsigned long)sizeof(value),header);
-    }
-value[i] = 0;    
-
-return cloneString(value);
-
-}
-
-char *getNewLineByType()
-/* just use global nlType setting */
-{
-switch (nlType)
-    {
-    case nlt_dos:
-	//debug
-    	//fprintf(stderr,"nlType=nlt_dos\n");
-	return "\x0d\x0a";
-    case nlt_mac:
-	//debug
-    	//fprintf(stderr,"nlType=nlt_mac\n");
-	return "\x0d";
-    case nlt_unix:
-    default:
-	//debug
-    	//fprintf(stderr,"nlType=nlt_unix\n");
-	return "\x0a";
-    }
-}
-
-struct mimePart *parseMultiParts(struct mimeBuf *b, char *altHeader)
-/* This is a recursive function.  It parses multipart MIME messages.
-   Data that are binary or too large will be saved in mimePart->filename
-   otherwise saved as a c-string in mimePart->data.  If multipart,
-   then first child is mimePart->child, subsequent sibs are in child->next.
-   altHeader is a string of headers that can be fed in if the headers have
-   already been read off the stream by an earlier process, i.e. apache.
- */
-{ 
-struct mimePart *p=AllocA(*p);
-char *parentboundary = NULL, *boundary = NULL;
-char *ct = NULL;
-boolean autoBoundary = FALSE;
-
-
-//debug
-//fprintf(stderr,"altHeader=[%s]\n",altHeader);
-
-if (sameOk(altHeader, "autoBoundary"))
-    { /* process things with no explicit header.
-       *  look for *MIME* \n\n-- */
-    struct dyString *dy = dyStringNew(0);
-    char *prevPrevLine = NULL;
-    char *prevLine = NULL;
-    char *line = NULL;
-    boolean found = FALSE;
-    autoBoundary = TRUE;
-    while (TRUE)
-	{
-	if (b->i >= b->eoi && b->eoi < b->eom)  /* at end of input */
-	    break;
-	line = getLineMB(b);
-	if (line && startsWith("--",line) // && 
-	    //sameString(prevLine,"") && 
-	    //prevPrevLine &&
-	    //stringIn("MULTI",prevPrevLine) && 
-	    //stringIn("MIME",prevPrevLine) 
-	    )
-	    {
-	    found = TRUE;
-	    break;
-	    }
-	freez(&prevPrevLine);
-	prevPrevLine = prevLine;
-	prevLine = line;
-	if (prevPrevLine)
-	    touppers(prevPrevLine);
-	}
-    if (!found)
-	errAbort("autoBoundary: No initial boundary found.");
-
-    dyStringPrintf(dy, "CONTENT-TYPE:multipart/form-data; boundary=%s%s%s", 
-	line+2, getNewLineByType(), getNewLineByType() );
-    altHeader = dyStringCannibalize(&dy); 
-    
-    //debug
-    //fprintf(stderr,"autoBoundary altHeader = [%s]\n",altHeader);
-    //fflush(stderr); 
-
-    freez(&prevPrevLine);	    
-    freez(&prevLine);	    
-    freez(&line);	    
-    }
-
-//debug
-//fprintf(stderr,"\n");
-readPartHeaderMB(b,p,altHeader);
-
-ct = hashFindVal(p->hdr,"content-type");  /* use lowercase key */
-//debug
-//fprintf(stderr,"ct from hash:%s\n",ct);
-//fflush(stderr); 
-
-if (ct && startsWith("multipart/",ct))
-    {
-    char bound[MAXBOUNDARY]; 
-    char *bnd = NULL;
-    struct mimePart *child = NULL;
-
-    /* these 3 vars just for processing epilog chunk: */
-    char *bp=NULL;
-    int size=0;
-    boolean hasZeros=FALSE;
-
-    /* save */
-    parentboundary = b->boundary;
-
-    boundary = getMimeHeaderFieldVal(ct,"boundary");
-    if (strlen(boundary) >= MAXBOUNDARY)
-	errAbort("error: boundary= value too long in MIME header Content-type:%s",ct);
-    safef(bound, sizeof(bound), "--%s",boundary);  /* do not prepend CRLF to boundary yet */
-    freez(&boundary);
-    boundary = cloneString(bound);
-    //debug
-    //fprintf(stderr,"initial boundary parsed:%s\n",boundary);
-    //fflush(stderr); 
-
-    if (!autoBoundary)
-	{
-	/* skip any extra "prolog" before the initial boundary marker */
-	while (TRUE)
-	    {
-	    bnd = getLineMB(b);
-	    if (sameString(bnd,boundary)) 
-	       break;
-	    freez(&bnd);
-	    }
-	    //debug
-	    //fprintf(stderr,"initial boundary found:%s\n",bnd);
-	    //fflush(stderr); 
-	freez(&bnd);
-	}
-
-    /* include crlf in the boundary so bodies won't have trailing a CRLF
-     * this is done here so that in case there's no extra CRLF
-     * between the header and the boundary, it will still work,
-     * so we only prepend the CRLF to the boundary after initial found */
-    safef(bound,sizeof(bound),"%s%s", getNewLineByType(), boundary);
-    freez(&boundary);
-    boundary=cloneString(bound);
-    
-    setBoundaryMB(b, boundary);
-
-    while(TRUE)
-	{
-	int i = 0;
-	char c1 = ' ', c2 = ' ';
-    	child = parseMultiParts(b,NULL);
-	slAddHead(&p->multi,child);
-	//call getLine, compare to boundary 
-	/* skip extra initial boundary marker - it's moot anyway */
-	freez(&bnd);
-	    //debug
-	    //fprintf(stderr,"post-parse pre-getLineMB dumpMB: ");
-	    //dumpMB(b);  //debug
-	for (i=0;i<strlen(boundary);++i)
-	    bound[i] = getcMB(b);
-	bound[i] = 0;    
-	if (!sameString(bound,boundary))
-	    errAbort("expected boundary %s, but found %s in MIME",boundary,bound);
-	//debug
-    	//fprintf(stderr,"\nfound boundary:%s\n",bound);
-	//fflush(stderr); 
-    	c1 = getcMB(b);
-	if (c1 == '-')
-	    {
-	    c2 = getcMB(b);
-	    if (c2 == '-')
-    		break;  /* last boundary found */
-	    else		    
-	    	errAbort("expected -- after boundary %s, but found %c%c in MIME",boundary,c1,c2);
-	    }
-	if (nlType == nlt_dos)
-	    c2 = getcMB(b);
-	switch (nlType)
-	    {
-	    case nlt_dos:
-		if (c1 == 0x0d && c2 == 0x0a)
-		    break;
-		else		    
-		    errAbort("expected CRLF after boundary %s, but found %c%c in MIME",boundary,c1,c2);
-	    case nlt_unix:
-		if (c1 == 0x0a)
-		    break;
-		else		    
-		    errAbort("expected LF after boundary %s, but found %c in MIME",boundary,c1);
-	    case nlt_mac:
-		if (c1 == 0x0d)
-		    break;
-		else		    
-		    errAbort("expected CR after boundary %s, but found %c in MIME",boundary,c1);
-	    default:
-		    errAbort("unexpected nlType %d after boundary %s",nlType,boundary);
-	    }
-	setEopMB(b);
-	}	
-    freez(&bnd);
-    slReverse(&p->multi);
-    /* restore */
-    freez(&boundary);
-    boundary = parentboundary;
-	//debug
-    	//fprintf(stderr,"restoring parent boundary = %s\n",boundary);
-    setBoundaryMB(b, boundary);
-
-    /* dump any "epilog" that may be between the 
-     * end of the child boundary and the parent boundary */
-    getChunkMB(b, &bp, &size, &hasZeros);
-    //debug
-    //fprintf(stderr,"epilog size=%d\n",size);
-    	   
-    
-    }
-else
-    {
-    char *bp=NULL;
-    int size=0;
-    boolean hasZeros=FALSE;
-    boolean toobig=FALSE;
-    boolean asFile=FALSE;
-    boolean convert=FALSE;
-    FILE *f = NULL;
-    struct dyString *dy=newDyString(1024);
-    //debug
-    //fprintf(stderr,"starting new part (non-multi), dumpMB: \n");
-    //dumpMB(b);  //debug
-    
-    //debug
-    //ct = hashFindVal(p->hdr,"content-transfer-encoding");  /* use lowercase key */
-    //fprintf(stderr,"cte from hash:%s\n",ct);
-	
-    while(TRUE)
-	{
-	// break if eop, eod, eoi
-    	getChunkMB(b, &bp, &size, &hasZeros);
-	//debug
-    	//fprintf(stderr,"bp=%lu size=%d, hasZeros=%d \n", 
-	//    (unsigned long) bp,
-	//    size,
-	//    hasZeros);
-	if (hasZeros)
-	    {
-	    p->binary=TRUE;
-	    }
-	//if (hasZeros && !asFile)
-	//    {
-	//    convert=TRUE;
-	//    }
-	if (!asFile && p->size+size > MAXPARTSIZE)
-	    {
-	    toobig = TRUE;
-	    convert=TRUE;
-	    }
-	if (convert)
-	    {
-	    struct tempName uploadedData;
-	    convert=FALSE;
-	    asFile = TRUE;
-	    makeTempName(&uploadedData, "hgSs", ".cgi");
-	    p->fileName=cloneString(uploadedData.forCgi);
-	    f = mustOpen(p->fileName,"w");
-	    mustWrite(f,dy->string,dy->stringSize);
-	    freeDyString(&dy);
-	    }
-	if (asFile)
-	    {
-	    mustWrite(f,bp,size);
-	    }
-	else
-	    {
-    	    dyStringAppendN(dy,bp,size);
-	    }
-	p->size+=size;
-	if (p->size > MAXDATASIZE)
-	    errAbort("max data size allowable for upload in MIME exceeded %llu",(unsigned long long)MAXDATASIZE);
-	    
-	
-	if (b->eop && b->i == b->eop)  /* end of part */
-	    {
-	    break;
-	    }
-	if (b->i == b->eoi && b->eoi < b->eom) /* end of data */
-	    {
-	    break;
-	    }
-	moreMimeBuf(b);
-	}
-    if (dy)
-	{
-	p->data=needLargeMem(dy->stringSize+1);
-	memcpy(p->data,dy->string,dy->stringSize);
-	p->data[dy->stringSize] = 0;
-    	freeDyString(&dy);
-	}
-    if (f)
-	carefulClose(&f);
-
-    //debug
-    //fprintf(stderr,"p->fileName=%s p->data=[%s]\n",p->fileName,p->data);
-
-    }
-
-return p;
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/net.c b/gbtools/src/blatSrc/lib/net.c
deleted file mode 100644
index c1085ef..0000000
--- a/gbtools/src/blatSrc/lib/net.c
+++ /dev/null
@@ -1,2076 +0,0 @@
-/* net.c some stuff to wrap around net communications. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/time.h>
-#include <pthread.h>
-#include "internet.h"
-#include "errAbort.h"
-#include "hash.h"
-#include "net.h"
-#include "linefile.h"
-#include "base64.h"
-#include "cheapcgi.h"
-#include "https.h"
-#include "sqlNum.h"
-#include "obscure.h"
-
-/* Brought errno in to get more useful error messages */
-extern int errno;
-
-static int netStreamSocket()
-/* Create a TCP/IP streaming socket.  Complain and return something
- * negative if can't */
-{
-int sd = socket(AF_INET, SOCK_STREAM, 0);
-if (sd < 0)
-    warn("Couldn't make AF_INET socket.");
-return sd;
-}
-
-static int setSocketNonBlocking(int sd, boolean set)
-/* Use socket control flags to set O_NONBLOCK if set==TRUE,
- * or clear it if set==FALSE.
- * Return -1 if there are any errors, 0 if successful. */
-{
-long fcntlFlags;
-// Set or clear non-blocking
-if ((fcntlFlags = fcntl(sd, F_GETFL, NULL)) < 0) 
-    {
-    warn("Error fcntl(..., F_GETFL) (%s)", strerror(errno));
-    return -1;
-    }
-if (set)
-    fcntlFlags |= O_NONBLOCK;
-else
-    fcntlFlags &= (~O_NONBLOCK);
-if (fcntl(sd, F_SETFL, fcntlFlags) < 0) 
-    {
-    warn("Error fcntl(..., F_SETFL) (%s)", strerror(errno));
-    return -1;
-    }
-return 0;
-}
-
-int setReadWriteTimeouts(int sd, int seconds)
-/* Set read and write timeouts on socket sd 
- * Return -1 if there are any errors, 0 if successful. */
-{
-struct timeval timeout;      
-timeout.tv_sec = seconds;
-timeout.tv_usec = 0;
-
-if (setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(timeout)) < 0)
-    {
-    warn("setsockopt failed setting socket receive timeout\n");
-    return -1;
-    }
-
-if (setsockopt(sd, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeof(timeout)) < 0)
-    {
-    warn("setsockopt failed setting socket send timeout\n");
-    return -1;
-    }
-return 0;
-}
-
-
-static struct timeval tvMinus(struct timeval a, struct timeval b)
-/* Return the result of a - b; this handles wrapping of milliseconds. 
- * result.tv_usec will always be positive. 
- * result.tv_sec will be negative if b > a. */
-{
-// subtract b from a.
-if (a.tv_usec < b.tv_usec)
-    {
-    a.tv_usec += 1000000;
-    a.tv_sec--;
-    }
-a.tv_usec -= b.tv_usec;
-a.tv_sec -= b.tv_sec;
-return a;
-}
-
-static int netConnectWithTimeout(char *hostName, int port, long msTimeout)
-/* In order to avoid a very long default timeout (several minutes) for hosts that will
- * not answer the port, we are forced to connect non-blocking.
- * After the connection has been established, we return to blocking mode.
- * Also closes sd if error. */
-{
-int sd;
-struct sockaddr_in sai;		/* Some system socket info. */
-int res;
-fd_set mySet;
-
-if (hostName == NULL)
-    {
-    warn("NULL hostName in netConnect");
-    return -1;
-    }
-if (!internetFillInAddress(hostName, port, &sai))
-    return -1;
-if ((sd = netStreamSocket()) < 0)
-    return sd;
-
-// Set socket to nonblocking so we can manage our own timeout time.
-if (setSocketNonBlocking(sd, TRUE) < 0)
-    {
-    close(sd);
-    return -1;
-    }
-
-// Trying to connect with timeout
-res = connect(sd, (struct sockaddr*) &sai, sizeof(sai));
-if (res < 0)
-    {
-    if (errno == EINPROGRESS)
-	{
-	struct timeval startTime;
-	gettimeofday(&startTime, NULL);
-	struct timeval remainingTime;
-	remainingTime.tv_sec = (long) (msTimeout/1000);
-	remainingTime.tv_usec = (long) (((msTimeout/1000)-remainingTime.tv_sec)*1000000);
-	while (1) 
-	    {
-	    FD_ZERO(&mySet);
-	    FD_SET(sd, &mySet);
-	    // use tempTime (instead of using remainingTime directly) because on some platforms select() may modify the time val.
-	    struct timeval tempTime = remainingTime;
-	    res = select(sd+1, NULL, &mySet, &mySet, &tempTime);  
-	    if (res < 0) 
-		{
-		if (errno == EINTR)  // Ignore the interrupt 
-		    {
-                    // Subtract the elapsed time from remaining time since some platforms need this.
-		    struct timeval newTime;
-		    gettimeofday(&newTime, NULL);
-                    struct timeval elapsedTime = tvMinus(newTime, startTime);
-		    remainingTime = tvMinus(remainingTime, elapsedTime);
-		    if (remainingTime.tv_sec < 0)  // means our timeout has more than expired
-			{
-			remainingTime.tv_sec = 0;
-			remainingTime.tv_usec = 0;
-			}
-		    startTime = newTime;
-		    }
-		else
-		    {
-		    warn("Error in select() during TCP non-blocking connect %d - %s", errno, strerror(errno));
-		    close(sd);
-		    return -1;
-		    }
-		}
-	    else if (res > 0)
-		{
-		// Socket selected for write when it is ready
-		int valOpt;
-		socklen_t lon;
-                // But check the socket for any errors
-                lon = sizeof(valOpt);
-                if (getsockopt(sd, SOL_SOCKET, SO_ERROR, (void*) (&valOpt), &lon) < 0)
-                    {
-                    warn("Error in getsockopt() %d - %s", errno, strerror(errno));
-                    close(sd);
-                    return -1;
-                    }
-                // Check the value returned...
-                if (valOpt)
-                    {
-                    warn("Error in TCP non-blocking connect() %d - %s", valOpt, strerror(valOpt));
-                    close(sd);
-                    return -1;
-                    }
-		break;
-		}
-	    else
-		{
-		warn("TCP non-blocking connect() to %s timed-out in select() after %ld milliseconds - Cancelling!", hostName, msTimeout);
-		close(sd);
-		return -1;
-		}
-	    }
-	}
-    else
-	{
-	warn("TCP non-blocking connect() error %d - %s", errno, strerror(errno));
-	close(sd);
-	return -1;
-	}
-    }
-
-// Set to blocking mode again
-if (setSocketNonBlocking(sd, FALSE) < 0)
-    {
-    close(sd);
-    return -1;
-    }
-
-if (setReadWriteTimeouts(sd, DEFAULTREADWRITETTIMEOUTSEC) < 0)
-    {
-    close(sd);
-    return -1;
-    }
-
-return sd;
-
-}
-
-
-int netConnect(char *hostName, int port)
-/* Start connection with a server. */
-{
-return netConnectWithTimeout(hostName, port, DEFAULTCONNECTTIMEOUTMSEC); // 10 seconds connect timeout
-}
-
-int netMustConnect(char *hostName, int port)
-/* Start connection with server or die. */
-{
-int sd = netConnect(hostName, port);
-if (sd < 0)
-   noWarnAbort();
-return sd;
-}
-
-int netMustConnectTo(char *hostName, char *portName)
-/* Start connection with a server and a port that needs to be converted to integer */
-{
-if (!isdigit(portName[0]))
-    errAbort("netConnectTo: ports must be numerical, not %s", portName);
-return netMustConnect(hostName, atoi(portName));
-}
-
-
-int netAcceptingSocketFrom(int port, int queueSize, char *host)
-/* Create a socket that can accept connections from a 
- * IP address on the current machine if the current machine
- * has multiple IP addresses. */
-{
-struct sockaddr_in sai;
-int sd;
-int flag = 1;
-
-netBlockBrokenPipes();
-if ((sd = netStreamSocket()) < 0)
-    return sd;
-if (!internetFillInAddress(host, port, &sai))
-    return -1;
-if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(int)))
-    return -1;
-if (bind(sd, (struct sockaddr*)&sai, sizeof(sai)) == -1)
-    {
-    warn("Couldn't bind socket to %d: %s", port, strerror(errno));
-    close(sd);
-    return -1;
-    }
-listen(sd, queueSize);
-return sd;
-}
-
-int netAcceptingSocket(int port, int queueSize)
-/* Create a socket that can accept connections from
- * anywhere. */
-{
-return netAcceptingSocketFrom(port, queueSize, NULL);
-}
-
-int netAccept(int sd)
-/* Accept incoming connection from socket descriptor. */
-{
-socklen_t fromLen;
-return accept(sd, NULL, &fromLen);
-}
-
-int netAcceptFrom(int acceptor, unsigned char subnet[4])
-/* Wait for incoming connection from socket descriptor
- * from IP address in subnet.  Subnet is something
- * returned from netParseSubnet or internetParseDottedQuad. 
- * Subnet may be NULL. */
-{
-struct sockaddr_in sai;		/* Some system socket info. */
-ZeroVar(&sai);
-sai.sin_family = AF_INET;
-for (;;)
-    {
-    socklen_t addrSize = sizeof(sai);
-    int sd = accept(acceptor, (struct sockaddr *)&sai, &addrSize);
-    if (sd >= 0)
-	{
-	if (subnet == NULL)
-	    return sd;
-	else
-	    {
-	    unsigned char unpacked[4]; 
-	    internetUnpackIp(ntohl(sai.sin_addr.s_addr), unpacked);
-	    if (internetIpInSubnet(unpacked, subnet))
-		{
-		return sd;
-		}
-	    else
-		{
-		close(sd);
-		}
-	    }
-	}
-    }
-}
-
-FILE *netFileFromSocket(int socket)
-/* Wrap a FILE around socket.  This should be fclose'd
- * and separately the socket close'd. */
-{
-FILE *f;
-if ((socket = dup(socket)) < 0)
-   errnoAbort("Couldn't dupe socket in netFileFromSocket");
-f = fdopen(socket, "r+");
-if (f == NULL)
-   errnoAbort("Couldn't fdopen socket in netFileFromSocket");
-return f;
-}
-
-static boolean plumberInstalled = FALSE;
-
-void netBlockBrokenPipes()
-/* Make it so a broken pipe doesn't kill us. */
-{
-if (!plumberInstalled)
-    {
-    signal(SIGPIPE, SIG_IGN);       /* Block broken pipe signals. */
-    plumberInstalled = TRUE;
-    }
-}
-
-ssize_t netReadAll(int sd, void *vBuf, ssize_t size)
-/* Read given number of bytes into buffer.
- * Don't give up on first read! */
-{
-char *buf = vBuf;
-ssize_t totalRead = 0;
-int oneRead;
-
-if (!plumberInstalled)
-    netBlockBrokenPipes();
-while (totalRead < size)
-    {
-    oneRead = read(sd, buf + totalRead, size - totalRead);
-    if (oneRead < 0)
-	return oneRead;
-    if (oneRead == 0)
-        break;
-    totalRead += oneRead;
-    }
-return totalRead;
-}
-
-ssize_t netMustReadAll(int sd, void *vBuf, ssize_t size)
-/* Read given number of bytes into buffer or die.
- * Don't give up if first read is short! */
-{
-ssize_t ret = netReadAll(sd, vBuf, size);
-if (ret < 0)
-    errnoAbort("Couldn't finish netReadAll");
-return ret;
-}
-
-static void notGoodSubnet(char *sns)
-/* Complain about subnet format. */
-{
-errAbort("'%s' is not a properly formatted subnet.  Subnets must consist of\n"
-         "one to three dot-separated numbers between 0 and 255", sns);
-}
-
-void netParseSubnet(char *in, unsigned char out[4])
-/* Parse subnet, which is a prefix of a normal dotted quad form.
- * Out will contain 255's for the don't care bits. */
-{
-out[0] = out[1] = out[2] = out[3] = 255;
-if (in != NULL)
-    {
-    char *snsCopy = strdup(in);
-    char *words[5];
-    int wordCount, i;
-    wordCount = chopString(snsCopy, ".", words, ArraySize(words));
-    if (wordCount > 3 || wordCount < 1)
-        notGoodSubnet(in);
-    for (i=0; i<wordCount; ++i)
-	{
-	char *s = words[i];
-	int x;
-	if (!isdigit(s[0]))
-	    notGoodSubnet(in);
-	x = atoi(s);
-	if (x > 255)
-	    notGoodSubnet(in);
-	out[i] = x;
-	}
-    freez(&snsCopy);
-    }
-}
-
-static void parseByteRange(char *url, ssize_t *rangeStart, ssize_t *rangeEnd, boolean terminateAtByteRange)
-/* parse the byte range information from url */
-{
-char *x;
-/* default to no byte range specified */
-*rangeStart = -1;
-*rangeEnd = -1;
-x = strrchr(url, ';');
-if (x)
-    {
-    if (startsWith(";byterange=", x))
-	{
-	char *y=strchr(x, '=');
-	++y;
-	char *z=strchr(y, '-');
-	if (z)
-	    {
-	    ++z;
-	    if (terminateAtByteRange)
-		*x = 0;
-	    // TODO: use something better than atoll() ?
-	    *rangeStart = atoll(y); 
-	    if (z[0] != '\0')
-		*rangeEnd = atoll(z);
-	    }    
-	}
-    }
-
-}
-
-void netParseUrl(char *url, struct netParsedUrl *parsed)
-/* Parse a URL into components.   A full URL is made up as so:
- *   http://user:password@hostName:port/file;byterange=0-499
- * User and password may be cgi-encoded.
- * This is set up so that the http:// and the port are optional. 
- */
-{
-char *s, *t, *u, *v, *w;
-char buf[1024];
-
-/* Make local copy of URL. */
-if (strlen(url) >= sizeof(buf))
-    errAbort("Url too long: '%s'", url);
-strcpy(buf, url);
-url = buf;
-
-/* Find out protocol - default to http. */
-s = trimSpaces(url);
-s = stringIn("://", url);
-if (s == NULL)
-    {
-    strcpy(parsed->protocol, "http");
-    s = url;
-    }
-else
-    {
-    *s = 0;
-    tolowers(url);
-    safecpy(parsed->protocol, sizeof(parsed->protocol), url);
-    s += 3;
-    }
-
-/* Split off file part. */
-parsed->byteRangeStart = -1;  /* default to no byte range specified */
-parsed->byteRangeEnd = -1;
-u = strchr(s, '/');
-if (u == NULL)
-    strcpy(parsed->file, "/");
-else
-    {
-
-    parseByteRange(u, &parsed->byteRangeStart, &parsed->byteRangeEnd, TRUE);
-
-    if (sameWord(parsed->protocol,"http") ||
-        sameWord(parsed->protocol,"https"))
-	{
-	// http servers expect the URL request to be URL-encoded already.
-	/* need to encode spaces, but not ! other characters */
-	char *t=replaceChars(u," ","%20");
-	safecpy(parsed->file, sizeof(parsed->file), t);
-	freeMem(t);
-	}
-
-    *u = 0; // terminate the host:port string
-
-    if (sameWord(parsed->protocol,"ftp"))
-	{
-	++u; // that first slash is not considered part of the ftp path 
-	// decode now because the FTP server does NOT expect URL-encoding.
-	cgiDecodeFull(u,parsed->file,strlen(u));  // decodes %FF but not +
-	}
-
-    }
-
-/* Split off user part */
-v = strchr(s, '@');
-if (v == NULL)
-    {
-    if (sameWord(parsed->protocol,"http") ||
-        sameWord(parsed->protocol,"https"))
-	{
-	strcpy(parsed->user, "");
-	strcpy(parsed->password, "");
-	}
-    if (sameWord(parsed->protocol,"ftp"))
-	{
-	strcpy(parsed->user, "anonymous");
-	strcpy(parsed->password, "x at genome.ucsc.edu");
-	}
-    }
-else
-    {
-    *v = 0;
-    /* split off password part */
-    w = strchr(s, ':');
-    if (w == NULL)
-	{
-	safecpy(parsed->user, sizeof(parsed->user), s);
-	strcpy(parsed->password, "");
-	}
-    else
-	{
-	*w = 0;
-	safecpy(parsed->user, sizeof(parsed->user), s);
-	safecpy(parsed->password, sizeof(parsed->password), w+1);
-	}
-    
-    cgiDecode(parsed->user,parsed->user,strlen(parsed->user));
-    cgiDecode(parsed->password,parsed->password,strlen(parsed->password));
-    s = v+1;
-    }
-
-
-/* Save port if it's there.  If not default to 80. */
-t = strchr(s, ':');
-if (t == NULL)
-    {
-    if (sameWord(parsed->protocol,"http"))
-	strcpy(parsed->port, "80");
-    if (sameWord(parsed->protocol,"https"))
-	strcpy(parsed->port, "443");
-    if (sameWord(parsed->protocol,"ftp"))
-	strcpy(parsed->port, "21");
-    }
-else
-    {
-    *t++ = 0;
-    if (!isdigit(t[0]))
-	errAbort("Non-numeric port name %s", t);
-    safecpy(parsed->port, sizeof(parsed->port), t);
-    }
-
-/* What's left is the host. */
-safecpy(parsed->host, sizeof(parsed->host), s);
-}
-
-char *urlFromNetParsedUrl(struct netParsedUrl *npu)
-/* Build URL from netParsedUrl structure */
-{
-struct dyString *dy = newDyString(512);
-
-dyStringAppend(dy, npu->protocol);
-dyStringAppend(dy, "://");
-if (npu->user[0] != 0)
-    {
-    char *encUser = cgiEncode(npu->user);
-    dyStringAppend(dy, encUser);
-    freeMem(encUser);
-    if (npu->password[0] != 0)
-	{
-	dyStringAppend(dy, ":");
-	char *encPassword = cgiEncode(npu->password);
-	dyStringAppend(dy, encPassword);
-	freeMem(encPassword);
-	}
-    dyStringAppend(dy, "@");
-    }
-dyStringAppend(dy, npu->host);
-/* do not include port if it is the default */
-if (!(
- (sameString(npu->protocol, "ftp"  ) && sameString("21", npu->port)) ||
- (sameString(npu->protocol, "http" ) && sameString("80", npu->port)) ||
- (sameString(npu->protocol, "https") && sameString("443",npu->port))
-    ))
-    {
-    dyStringAppend(dy, ":");
-    dyStringAppend(dy, npu->port);
-    }
-dyStringAppend(dy, npu->file);
-if (npu->byteRangeStart != -1)
-    {
-    dyStringPrintf(dy, ";byterange=%lld-", (long long)npu->byteRangeStart);
-    if (npu->byteRangeEnd != -1)
-	dyStringPrintf(dy, "%lld", (long long)npu->byteRangeEnd);
-    }
-
-/* Clean up and return handle. */
-return dyStringCannibalize(&dy);
-}
-
-int netWaitForData(int sd, int microseconds)
-/* Wait for descriptor to have some data to read, up to given number of
- * microseconds.  Returns amount of data there or zero if timed out. */
-{
-struct timeval tv;
-fd_set set;
-int readyCount;
-
-for (;;)
-    {
-    if (microseconds >= 1000000)
-	{
-	tv.tv_sec = microseconds/1000000;
-	tv.tv_usec = microseconds%1000000;
-	}
-    else
-	{
-	tv.tv_sec = 0;
-	tv.tv_usec = microseconds;
-	}
-    FD_ZERO(&set);
-    FD_SET(sd, &set);
-    readyCount = select(sd+1, &set, NULL, NULL, &tv);
-    if (readyCount < 0) 
-	{
-	if (errno == EINTR)	/* Select interrupted, not timed out. */
-	    continue;
-    	else 
-    	    warn("select failure %s", strerror(errno));
-    	}
-    else
-	{
-    	return readyCount;	/* Zero readyCount indicates time out */
-	}
-    }
-}
-
-static boolean readReadyWait(int sd, int microseconds)
-/* Wait for descriptor to have some data to read, up to given number of
- * number of microseconds.  Returns true if there is data, false if timed out. */
-{
-int readyCount = netWaitForData(sd, microseconds);
-return readyCount > 0;	/* Zero readyCount indicates time out */
-}
-
-static void sendFtpCommandOnly(int sd, char *cmd)
-/* send command to ftp server */
-{   
-mustWriteFd(sd, cmd, strlen(cmd));
-}
-
-#define NET_FTP_TIMEOUT 1000000
-
-static boolean receiveFtpReply(int sd, char *cmd, struct dyString **retReply, int *retCode)
-/* send command to ftp server and check resulting reply code, 
- * warn and return FALSE if not desired reply.  If retReply is non-NULL, store reply text there. */
-{
-char *startLastLine = NULL;
-struct dyString *rs = newDyString(4*1024);
-while (1)
-    {
-    int readSize = 0;
-    while (1)
-	{
-	char buf[4*1024];
-	if (!readReadyWait(sd, NET_FTP_TIMEOUT))
-	    {
-	    warn("ftp server response timed out > %d microsec", NET_FTP_TIMEOUT);
-	    return FALSE;
-	    }
-	if ((readSize = read(sd, buf, sizeof(buf))) == 0)
-	    break;
-
-	dyStringAppendN(rs, buf, readSize);
-	if (endsWith(rs->string,"\n"))
-	    break;
-	}
-	
-    /* find the start of the last line in the buffer */
-    startLastLine = rs->string+strlen(rs->string)-1;
-    if (startLastLine >= rs->string)
-	if (*startLastLine == '\n') 
-	    --startLastLine;
-    while ((startLastLine >= rs->string) && (*startLastLine != '\n'))
-	--startLastLine;
-    ++startLastLine;
-	
-    if (strlen(startLastLine)>4)
-      if (
-	isdigit(startLastLine[0]) &&
-	isdigit(startLastLine[1]) &&
-	isdigit(startLastLine[2]) &&
-	startLastLine[3]==' ')
-	break;
-	
-    if (readSize == 0)
-	break;  // EOF
-    /* must be some text info we can't use, ignore it till we get status code */
-    }
-
-int reply = atoi(startLastLine);
-if ((reply < 200) || (reply > 399))
-    {
-    warn("ftp server error on cmd=[%s] response=[%s]",cmd,rs->string);
-    return FALSE;
-    }
-    
-if (retReply)
-    *retReply = rs;
-else
-    dyStringFree(&rs);
-if (retCode)
-    *retCode = reply;
-return TRUE;
-}
-
-static boolean sendFtpCommand(int sd, char *cmd, struct dyString **retReply, int *retCode)
-/* send command to ftp server and check resulting reply code, 
- * warn and return FALSE if not desired reply.  If retReply is non-NULL, store reply text there. */
-{   
-sendFtpCommandOnly(sd, cmd);
-return receiveFtpReply(sd, cmd, retReply, retCode);
-}
-
-static int parsePasvPort(char *rs)
-/* parse PASV reply to get the port and return it */
-{
-char *words[7];
-int wordCount;
-char *rsStart = strchr(rs,'(');
-char *rsEnd = strchr(rs,')');
-int result = 0;
-rsStart++;
-*rsEnd=0;
-wordCount = chopString(rsStart, ",", words, ArraySize(words));
-if (wordCount != 6)
-    errAbort("PASV reply does not parse correctly");
-result = atoi(words[4])*256+atoi(words[5]);    
-return result;
-}    
-
-
-static long long parseFtpSIZE(char *rs)
-/* parse reply to SIZE and return it */
-{
-char *words[3];
-int wordCount;
-char *rsStart = rs;
-long long result = 0;
-wordCount = chopString(rsStart, " ", words, ArraySize(words));
-if (wordCount != 2)
-    errAbort("SIZE reply does not parse correctly");
-result = atoll(words[1]);    
-return result;
-}    
-
-
-static time_t parseFtpMDTM(char *rs)
-/* parse reply to MDTM and return it
- * 200 YYYYMMDDhhmmss */
-{
-char *words[3];
-int wordCount = chopString(rs, " ", words, ArraySize(words));
-if (wordCount != 2)
-    errAbort("MDTM reply should have 2 words but has %d", wordCount);
-#define EXPECTED_MDTM_FORMAT "YYYYmmddHHMMSS"
-if (strlen(words[1]) < strlen(EXPECTED_MDTM_FORMAT))
-    errAbort("MDTM reply word [%s] shorter than " EXPECTED_MDTM_FORMAT, words[1]);
-// man strptime ->
-// "There should be whitespace or other alphanumeric characters between any two field descriptors."
-// There are no separators in the MDTM timestamp, so make a spread-out version for strptime:
-char spread[] = "YYYY mm dd HH MM SS";
-char *from = words[1];
-char *to = spread;
-*to++ = *from++;
-*to++ = *from++;
-*to++ = *from++;
-*to++ = *from++;
-*to++ = '-';
-*to++ = *from++;
-*to++ = *from++;
-*to++ = '-';
-*to++ = *from++;
-*to++ = *from++;
-*to++ = ' ';
-*to++ = *from++;
-*to++ = *from++;
-*to++ = ':';
-*to++ = *from++;
-*to++ = *from++;
-*to++ = ':';
-*to++ = *from++;
-*to++ = *from++;
-*to++ = 0;
-struct tm tm;
-if (strptime(spread, "%Y-%m-%d %H:%M:%S", &tm) == NULL)
-    errAbort("unable to parse MDTM string [%s]", spread);
-// Not set by strptime(); tells mktime() to determine whether daylight saving time is in effect:
-tm.tm_isdst = -1;
-time_t t = mktime(&tm);
-if (t == -1)
-    errAbort("mktime failed while parsing strptime'd MDTM string [%s]", words[1]);
-return t;
-}    
-
-
-static int openFtpControlSocket(char *host, int port, char *user, char *password)
-/* Open a socket to host,port; authenticate anonymous ftp; set type to I; 
- * return socket desc or -1 if there was an error. */
-{
-int sd = netConnect(host, port);
-if (sd < 0)
-    return -1;
-
-/* First read the welcome msg */
-if (readReadyWait(sd, NET_FTP_TIMEOUT))
-    sendFtpCommand(sd, "", NULL, NULL);
-
-char cmd[256];
-int retCode = 0;
-safef(cmd,sizeof(cmd),"USER %s\r\n", user);
-if (!sendFtpCommand(sd, cmd, NULL, &retCode))
-    {
-    close(sd);
-    return -1;
-    }
-
-if (retCode == 331)
-    {
-    safef(cmd,sizeof(cmd),"PASS %s\r\n", password);
-    if (!sendFtpCommand(sd, cmd, NULL, NULL))
-	{
-	close(sd);
-	return -1;
-	}
-    }
-
-if (!sendFtpCommand(sd, "TYPE I\r\n", NULL, NULL))
-    {
-    close(sd);
-    return -1;
-    }
-/* 200 Type set to I */
-/* (send the data as binary, so can support compressed files) */
-return sd;
-}
-
-boolean netGetFtpInfo(char *url, long long *retSize, time_t *retTime)
-/* Return date in UTC and size of ftp url file */
-{
-/* Parse the URL and connect. */
-struct netParsedUrl npu;
-netParseUrl(url, &npu);
-if (!sameString(npu.protocol, "ftp"))
-    errAbort("netGetFtpInfo: url (%s) is not for ftp.", url);
-
-// TODO maybe remove this workaround where udc cache wants info on URL "/" ?
-if (sameString(npu.file,"/"))
-    {
-    *retSize = 0;
-    *retTime = time(NULL);
-    return TRUE;
-    }
-
-int sd = openFtpControlSocket(npu.host, atoi(npu.port), npu.user, npu.password);
-if (sd < 0)
-    return FALSE;
-char cmd[256];
-safef(cmd,sizeof(cmd),"SIZE %s\r\n", npu.file);
-struct dyString *rs = NULL;
-if (!sendFtpCommand(sd, cmd, &rs, NULL))
-    {
-    close(sd);
-    return FALSE;
-    }
-*retSize = parseFtpSIZE(rs->string);
-/* 200 12345 */
-dyStringFree(&rs);
-
-safef(cmd,sizeof(cmd),"MDTM %s\r\n", npu.file);
-if (!sendFtpCommand(sd, cmd, &rs, NULL))
-    {
-    close(sd);
-    return FALSE;
-    }
-*retTime = parseFtpMDTM(rs->string);
-/* 200 YYYYMMDDhhmmss */
-dyStringFree(&rs);
-close(sd);   
-return TRUE;
-}
-
-struct netConnectFtpParams
-/* params to pass to thread */
-{
-pthread_t thread;
-int pipefd[2];
-int sd;
-int sdata; 
-struct netParsedUrl npu;
-};
-
-static void *sendFtpDataToPipeThread(void *threadParams)
-/* This is to be executed by the child process after the fork in netGetOpenFtpSockets.
- * It keeps the ftp control socket alive while reading from the ftp data socket
- * and writing to the pipe to the parent process, which closes the ftp sockets
- * and reads from the pipe. */
-{
-
-struct netConnectFtpParams *params = threadParams;
-
-pthread_detach(params->thread);  // this thread will never join back with it's progenitor
-
-char buf[32768];
-int rd = 0;
-long long dataPos = 0; 
-if (params->npu.byteRangeStart != -1)
-    dataPos = params->npu.byteRangeStart;
-while((rd = read(params->sdata, buf, 32768)) > 0) 
-    {
-    if (params->npu.byteRangeEnd != -1 && (dataPos + rd) > params->npu.byteRangeEnd)
-	rd = params->npu.byteRangeEnd - dataPos + 1;
-    int wt = write(params->pipefd[1], buf, rd);
-    if (wt == -1 && params->npu.byteRangeEnd != -1)
-	{
-	// errAbort in child process is messy; let reader complain if
-	// trouble.  If byterange was open-ended, we will hit this point
-	// when the parent stops reading and closes the pipe.
-	errnoWarn("error writing ftp data to pipe");
-	break;
-	}
-    dataPos += rd;
-    if (params->npu.byteRangeEnd != -1 && dataPos >= params->npu.byteRangeEnd)
-	break;	    
-    }
-if (rd == -1)
-    // Again, avoid abort in child process.
-    errnoWarn("error reading ftp socket");
-close(params->pipefd[1]);  /* we are done with it */
-close(params->sd);
-close(params->sdata);
-return NULL;
-}
-
-static int netGetOpenFtpSockets(char *url, int *retCtrlSd)
-/* Return a socket descriptor for url data (url can end in ";byterange:start-end",
- * or -1 if error.
- * If retCtrlSd is non-null, keep the control socket alive and set *retCtrlSd.
- * Otherwise, create a pipe and fork to keep control socket alive in the child 
- * process until we are done fetching data. */
-{
-char cmd[256];
-
-/* Parse the URL and connect. */
-struct netParsedUrl npu;
-netParseUrl(url, &npu);
-if (!sameString(npu.protocol, "ftp"))
-    errAbort("netGetOpenFtpSockets: url (%s) is not for ftp.", url);
-int sd = openFtpControlSocket(npu.host, atoi(npu.port), npu.user, npu.password);
-if (sd == -1)
-    return -1;
-
-struct dyString *rs = NULL;
-if (!sendFtpCommand(sd, "PASV\r\n", &rs, NULL))
-    {
-    close(sd);
-    return -1;
-    }
-/* 227 Entering Passive Mode (128,231,210,81,222,250) */
-
-if (npu.byteRangeStart != -1)
-    {
-    safef(cmd,sizeof(cmd),"REST %lld\r\n", (long long) npu.byteRangeStart);
-    if (!sendFtpCommand(sd, cmd, NULL, NULL))
-	{
-	close(sd);
-	return -1;
-	}
-    }
-
-/* RETR for files, LIST for directories ending in / */
-safef(cmd,sizeof(cmd),"%s %s\r\n",((npu.file[strlen(npu.file)-1]) == '/') ? "LIST" : "RETR", npu.file);
-sendFtpCommandOnly(sd, cmd);
-
-int sdata = netConnect(npu.host, parsePasvPort(rs->string));
-dyStringFree(&rs);
-if (sdata < 0)
-    {
-    close(sd);
-    return -1;
-    }
-
-int secondsWaited = 0;
-while (TRUE)
-    {
-    if (secondsWaited >= 10)
-	{
-	warn("ftp server error on cmd=[%s] timed-out waiting for data or error", cmd);
-	close(sd);
-	close(sdata);
-	return -1;
-	}
-    if (readReadyWait(sdata, NET_FTP_TIMEOUT))
-	break;   // we have some data
-    if (readReadyWait(sd, 0)) /* wait in microsec */
-	{
-	// this can see an error like bad filename
-	if (!receiveFtpReply(sd, cmd, NULL, NULL))
-	    {
-	    close(sd);
-	    close(sdata);
-	    return -1;
-	    }
-	}
-    ++secondsWaited;
-    }
-
-if (retCtrlSd != NULL)
-    {
-    *retCtrlSd = sd;
-    return sdata;
-    }
-else
-    {
-    /* Because some FTP servers will kill the data connection
-     * as soon as the control connection closes,
-     * we have to develop a workaround using a partner process. */
-    fflush(stdin);
-    fflush(stdout);
-    fflush(stderr);
-
-    struct netConnectFtpParams *params;
-    AllocVar(params);
-    params->sd = sd;
-    params->sdata = sdata;
-    params->npu = npu;
-    /* make a pipe (fds go in pipefd[0] and pipefd[1])  */
-    if (pipe(params->pipefd) != 0)
-	errAbort("netGetOpenFtpSockets: failed to create pipe: %s", strerror(errno));
-    int rc;
-    rc = pthread_create(&params->thread, NULL, sendFtpDataToPipeThread, (void *)params);
-    if (rc)
-	{
-	errAbort("Unexpected error %d from pthread_create(): %s",rc,strerror(rc));
-	}
-
-    return params->pipefd[0];
-    }
-}
-
-
-int connectNpu(struct netParsedUrl npu, char *url)
-/* Connect using NetParsedUrl. */
-{
-int sd = -1;
-if (sameString(npu.protocol, "http"))
-    {
-    sd = netConnect(npu.host, atoi(npu.port));
-    }
-else if (sameString(npu.protocol, "https"))
-    {
-    sd = netConnectHttps(npu.host, atoi(npu.port));
-    }
-else
-    {
-    errAbort("netHttpConnect: url (%s) is not for http.", url);
-    return -1;  /* never gets here, fixes compiler complaint */
-    }
-return sd;
-}
-
-void setAuthorization(struct netParsedUrl npu, char *authHeader, struct dyString *dy)
-/* Set the specified authorization header with BASIC auth base64-encoded user and password */
-{
-if (!sameString(npu.user,""))
-    {
-    char up[256];
-    char *b64up = NULL;
-    safef(up, sizeof(up), "%s:%s", npu.user, npu.password);
-    b64up = base64Encode(up, strlen(up));
-    dyStringPrintf(dy, "%s: Basic %s\r\n", authHeader, b64up);
-    freez(&b64up);
-    }
-}
-
-int netHttpConnect(char *url, char *method, char *protocol, char *agent, char *optionalHeader)
-/* Parse URL, connect to associated server on port, and send most of
- * the request to the server.  If specified in the url send user name
- * and password too.  Typically the "method" will be "GET" or "POST"
- * and the agent will be the name of your program or
- * library. optionalHeader may be NULL or contain additional header
- * lines such as cookie info. 
- * Proxy support via hg.conf httpProxy or env var http_proxy
- * Return data socket, or -1 if error.*/
-{
-struct netParsedUrl npu;
-struct netParsedUrl pxy;
-struct dyString *dy = newDyString(512);
-int sd = -1;
-/* Parse the URL and connect. */
-netParseUrl(url, &npu);
-
-char *proxyUrl = getenv("http_proxy");
-
-if (proxyUrl)
-    {
-    netParseUrl(proxyUrl, &pxy);
-    sd = connectNpu(pxy, url);
-    }
-else
-    {
-    sd = connectNpu(npu, url);
-    }
-if (sd < 0)
-    return -1;
-
-/* Ask remote server for a file. */
-char *urlForProxy = NULL;
-if (proxyUrl)
-    {
-    /* trim off the byterange part at the end of url because proxy does not understand it. */
-    urlForProxy = cloneString(url);
-    char *x = strrchr(urlForProxy, ';');
-    if (x && startsWith(";byterange=", x))
-	*x = 0;
-    }
-dyStringPrintf(dy, "%s %s %s\r\n", method, proxyUrl ? urlForProxy : npu.file, protocol);
-freeMem(urlForProxy);
-dyStringPrintf(dy, "User-Agent: %s\r\n", agent);
-/* do not need the 80 since it is the default */
-if ((sameString(npu.protocol, "http" ) && sameString("80", npu.port)) ||
-    (sameString(npu.protocol, "https") && sameString("443",npu.port)))
-    dyStringPrintf(dy, "Host: %s\r\n", npu.host);
-else
-    dyStringPrintf(dy, "Host: %s:%s\r\n", npu.host, npu.port);
-setAuthorization(npu, "Authorization", dy);
-if (proxyUrl)
-    setAuthorization(pxy, "Proxy-Authorization", dy);
-dyStringAppend(dy, "Accept: */*\r\n");
-if (npu.byteRangeStart != -1)
-    {
-    if (npu.byteRangeEnd != -1)
-	dyStringPrintf(dy, "Range: bytes=%lld-%lld\r\n"
-		       , (long long)npu.byteRangeStart
-		       , (long long)npu.byteRangeEnd);
-    else
-	dyStringPrintf(dy, "Range: bytes=%lld-\r\n"
-		       , (long long)npu.byteRangeStart);
-    }
-
-if (optionalHeader)
-    dyStringAppend(dy, optionalHeader);
-
-/* finish off the header with final blank line */
-dyStringAppend(dy, "\r\n");
-
-mustWriteFd(sd, dy->string, dy->stringSize);
-
-/* Clean up and return handle. */
-dyStringFree(&dy);
-return sd;
-}
-
-
-int netOpenHttpExt(char *url, char *method, char *optionalHeader)
-/* Return a file handle that will read the url.  optionalHeader
- * may by NULL or may contain cookies and other info.  */
-{
-return netHttpConnect(url, method, "HTTP/1.0", "genome.ucsc.edu/net.c", optionalHeader);
-}
-
-static int netGetOpenHttp(char *url)
-/* Return a file handle that will read the url.  */
-{
-return netOpenHttpExt(url, "GET", NULL);
-}
-
-int netUrlHeadExt(char *url, char *method, struct hash *hash)
-/* Go get head and return status.  Return negative number if
- * can't get head. If hash is non-null, fill it with header
- * lines with upper cased keywords for case-insensitive lookup, 
- * including hopefully CONTENT-TYPE: . */
-{
-int sd = netOpenHttpExt(url, method, NULL);
-int status = EIO;
-if (sd >= 0)
-    {
-    char *line, *word;
-    struct lineFile *lf = lineFileAttach(url, TRUE, sd);
-
-    if (lineFileNext(lf, &line, NULL))
-	{
-	if (startsWith("HTTP/", line))
-	    {
-	    word = nextWord(&line);
-	    word = nextWord(&line);
-	    if (word != NULL && isdigit(word[0]))
-	        {
-		status = atoi(word);
-		if (hash != NULL)
-		    {
-		    while (lineFileNext(lf, &line, NULL))
-		        {
-			word = nextWord(&line);
-			if (word == NULL)
-			    break;
-			hashAdd(hash, strUpper(word), cloneString(skipLeadingSpaces(line)));
-			}
-		    }
-		}
-	    }
-	}
-    lineFileClose(&lf);
-    }
-else
-    status = errno;
-return status;
-}
-
-
-int netUrlHead(char *url, struct hash *hash)
-/* Go get head and return status.  Return negative number if
- * can't get head. If hash is non-null, fill it with header
- * lines with upper cased keywords for case-insensitive lookup, 
- * including hopefully CONTENT-TYPE: . */
-{
-return netUrlHeadExt(url, "HEAD", hash);
-}
-
-
-long long netUrlSizeByRangeResponse(char *url)
-/* Use byteRange as a work-around alternate method to get file size (content-length).  
- * Return negative number if can't get. */
-{
-long long retVal = -1;
-char rangeUrl[2048];
-safef(rangeUrl, sizeof(rangeUrl), "%s;byterange=0-0", url);
-struct hash *hash = newHash(0);
-int status = netUrlHeadExt(rangeUrl, "GET", hash);
-if (status == 206)
-    { 
-    char *rangeString = hashFindValUpperCase(hash, "Content-Range:");
-    if (rangeString)
-	{
- 	/* input pattern: Content-Range: bytes 0-99/2738262 */
-	char *slash = strchr(rangeString,'/');
-	if (slash)
-	    {
-	    retVal = atoll(slash+1);
-	    }
-	}
-    }
-hashFree(&hash);
-return retVal;
-}
-
-
-int netUrlOpenSockets(char *url, int *retCtrlSocket)
-/* Return socket descriptor (low-level file handle) for read()ing url data,
- * or -1 if error. 
- * If retCtrlSocket is non-NULL and url is FTP, set *retCtrlSocket
- * to the FTP control socket which is left open for a persistent connection.
- * close(result) (and close(*retCtrlSocket) if applicable) when done. 
- * If url is missing :// then it's just treated as a file. */
-{
-if (stringIn("://", url) == NULL)
-    return open(url, O_RDONLY);
-else
-    {
-    if (startsWith("http://",url) || startsWith("https://",url))
-	return netGetOpenHttp(url);
-    else if (startsWith("ftp://",url))
-	return netGetOpenFtpSockets(url, retCtrlSocket);
-    else    
-	errAbort("Sorry, can only netUrlOpen http, https and ftp currently, not '%s'", url);
-    }
-return -1;    
-}
-
-int netUrlOpen(char *url)
-/* Return socket descriptor (low-level file handle) for read()ing url data,
- * or -1 if error.  Just close(result) when done. */
-{
-return netUrlOpenSockets(url, NULL);
-}
-
-struct dyString *netSlurpFile(int sd)
-/* Slurp file into dynamic string and return. */
-{
-char buf[4*1024];
-int readSize;
-struct dyString *dy = newDyString(4*1024);
-
-/* Slurp file into dy and return. */
-while ((readSize = read(sd, buf, sizeof(buf))) > 0)
-    dyStringAppendN(dy, buf, readSize);
-return dy;
-}
-
-struct dyString *netSlurpUrl(char *url)
-/* Go grab all of URL and return it as dynamic string. */
-{
-int sd = netUrlOpen(url);
-if (sd < 0)
-    errAbort("netSlurpUrl: failed to open socket for [%s]", url);
-struct dyString *dy = netSlurpFile(sd);
-close(sd);
-return dy;
-}
-
-static void parseContentRange(char *x, ssize_t *rangeStart, ssize_t *rangeEnd)
-/* parse the content range information from response header value 
-	"bytes 763400000-763400112/763400113"
- */
-{
-/* default to no byte range specified */
-*rangeStart = -1;
-*rangeEnd = -1;
-if (startsWith("bytes ", x))
-    {
-    char *y=strchr(x, ' ');
-    ++y;
-    char *z=strchr(y, '-');
-    if (z)
-	{
-	++z;
-	// TODO: use something better than atoll() ?
-	*rangeStart = atoll(y); 
-	if (z[0] != '\0')
-	    *rangeEnd = atoll(z);
-	}    
-    }
-
-}
-
-
-boolean netSkipHttpHeaderLinesWithRedirect(int sd, char *url, char **redirectedUrl)
-/* Skip http header lines. Return FALSE if there's a problem.
- * The input is a standard sd or fd descriptor.
- * This is meant to be able work even with a re-passable stream handle,
- * e.g. can pass it to the pipes routines, which means we can't
- * attach a linefile since filling its buffer reads in more than just the http header.
- * Handles 300, 301, 302, 303, 307 http redirects by setting *redirectedUrl to
- * the new location. */
-{
-char buf[2000];
-char *line = buf;
-int maxbuf = sizeof(buf);
-int i=0;
-char c = ' ';
-int nread = 0;
-char *sep = NULL;
-char *headerName = NULL;
-char *headerVal = NULL;
-boolean redirect = FALSE;
-boolean byteRangeUsed = (strstr(url,";byterange=") != NULL);
-ssize_t byteRangeStart = -1;
-ssize_t byteRangeEnd = -1;
-boolean foundContentRange = FALSE;
-ssize_t contentRangeStart = -1;
-ssize_t contentRangeEnd = -1;
-
-boolean mustUseProxy = FALSE;  /* User must use proxy 305 error*/
-char *proxyLocation = NULL;
-boolean mustUseProxyAuth = FALSE;  /* User must use proxy authentication 407 error*/
-
-if (byteRangeUsed)
-    {
-    parseByteRange(url, &byteRangeStart, &byteRangeEnd, FALSE);
-    }
-
-while(TRUE)
-    {
-    i = 0;
-    while (TRUE)
-	{
-	nread = read(sd, &c, 1);  /* one char at a time, but http headers are small */
-	if (nread != 1)
-	    {
-	    if (nread == -1)
-    		warn("Error (%s) reading http header on %s", strerror(errno), url);
-	    else if (nread == 0)
-    		warn("Error unexpected end of input reading http header on %s", url);
-	    else
-    		warn("Error reading http header on %s", url);
-	    return FALSE;  /* err reading descriptor */
-	    }
-	if (c == 10)
-	    break;
-	if (c != 13)
-    	    buf[i++] = c;
-	if (i >= maxbuf)
-	    {
-	    warn("http header line too long > %d chars.",maxbuf);
-	    return FALSE;
-	    }
-	}
-    buf[i] = 0;  /* add string terminator */
-
-    if (sameString(line,""))
-	{
-	break; /* End of Header found */
-	}
-    if (startsWith("HTTP/", line))
-        {
-	char *version, *code;
-	version = nextWord(&line);
-	code = nextWord(&line);
-	if (code == NULL)
-	    {
-	    warn("Strange http header on %s", url);
-	    return FALSE;
-	    }
-	if (startsWith("30", code) && isdigit(code[2])
-	    && ((code[2] >= '0' && code[2] <= '3') || code[2] == '7') && code[3] == 0)
-	    {
-	    redirect = TRUE;
-	    }
-	else if (sameString(code, "305"))
-	    {
-	    mustUseProxy = TRUE;
-	    }
-	else if (sameString(code, "407"))
-	    {
-	    mustUseProxyAuth = TRUE;
-	    }
-	else if (byteRangeUsed 
-	    /* hack for Apache bug 2.2.20 and 2.2.21 2011-10-21 should be OK to remove after one year. */
-		&& !(sameString(code, "200") && byteRangeStart == 0 && byteRangeEnd == -1))  
-	    {
-	    if (!sameString(code, "206"))
-		{
-		if (sameString(code, "200"))
-		    warn("Byte-range request was ignored by server. ");
-		warn("Expected Partial Content 206. %s: %s %s", url, code, line);
-		return FALSE;
-		}
-	    }
-	else if (sameString(code, "404"))
-	    {
-	    warn("404 file not found on %s", url);
-	    return FALSE;
-	    }
-	else if (!sameString(code, "200"))
-	    {
-	    warn("Expected 200 %s: %s %s", url, code, line);
-	    return FALSE;
-	    }
-	line = buf;  /* restore it */
-	}
-    headerName = line;
-    sep = strchr(line,':');
-    if (sep)
-	{
-	*sep = 0;
-	headerVal = skipLeadingSpaces(++sep);
-	}
-    else
-	{
-	headerVal = NULL;
-	}
-    if (sameWord(headerName,"Location"))
-	{
-	if (redirect)
-	    *redirectedUrl = cloneString(headerVal);
-	if (mustUseProxy)
-	    proxyLocation = cloneString(headerVal);
-	}
-    if (sameWord(headerName,"Content-Range"))
-	{
-	if (byteRangeUsed)
-	    {
-	    foundContentRange = TRUE;
-	    parseContentRange(headerVal, &contentRangeStart, &contentRangeEnd);	
-    	    if ((contentRangeStart != byteRangeStart) ||
-		(byteRangeEnd != -1 && (contentRangeEnd != byteRangeEnd)))
-		{
-		char bre[256];
-		safef(bre, sizeof bre, "%lld", (long long)byteRangeEnd);
-		if (byteRangeEnd == -1)
-		    bre[0] = 0;
-		warn("Found Content-Range: %s. Expected bytes %lld-%s. Improper caching of 206 reponse byte-ranges?",
-		    headerVal, (long long) byteRangeStart, bre);
-    		return FALSE;
-		}
-	    }
-	}
-    }
-if (mustUseProxy ||  mustUseProxyAuth)
-    {
-    warn("%s: %s error. Use Proxy%s. Location = %s", url, 
-	mustUseProxy ? "" : " Authentication", 
-	mustUseProxy ? "305" : "407", 
-	proxyLocation ? proxyLocation : "not given");
-    return FALSE;
-    }
-if (byteRangeUsed && !foundContentRange
-	    /* hack for Apache bug 2.2.20 and 2.2.21 2011-10-21 should be OK to remove after one year. */
-		&& !(byteRangeStart == 0 && byteRangeEnd == -1))  
-    {
-    char bre[256];
-    safef(bre, sizeof bre, "%lld", (long long)byteRangeEnd);
-    if (byteRangeEnd == -1)
-	bre[0] = 0;
-    warn("Expected response header Content-Range: %lld-%s", (long long) byteRangeStart, bre);
-    return FALSE;
-    }
-
-return TRUE;
-}
-
-
-boolean netSkipHttpHeaderLinesHandlingRedirect(int sd, char *url, int *redirectedSd, char **redirectedUrl)
-/* Skip http headers lines, returning FALSE if there is a problem.  Generally called as
- *    netSkipHttpHeaderLine(sd, url, &sd, &url);
- * where sd is a socket (file) opened with netUrlOpen(url), and url is in dynamic memory.
- * If the http header indicates that the file has moved, then it will update the *redirectedSd and
- * *redirectedUrl with the new socket and URL, first closing sd.
- * If for some reason you want to detect whether the forwarding has occurred you could
- * call this as:
- *    char *newUrl = NULL;
- *    int newSd = 0;
- *    netSkipHttpHeaderLine(sd, url, &newSd, &newUrl);
- *    if (newUrl != NULL)
- *          // Update sd with newSd, free url if appropriate and replace it with newUrl, etc.
- *          //  free newUrl when finished.
- * This routine handles up to 5 steps of redirection.
- * The logic to this routine is also complicated a little to make it work in a pipe, which means we
- * can't attach a lineFile since filling the lineFile buffer reads in more than just the http header. */
-{
-int redirectCount = 0;
-while (TRUE)
-    {
-    /* url needed for err msgs, and to return redirect location */
-    char *newUrl = NULL;
-    boolean success = netSkipHttpHeaderLinesWithRedirect(sd, url, &newUrl);
-    if (success && !newUrl) /* success after 0 to 5 redirects */
-        {
-	if (redirectCount > 0)
-	    {
-	    *redirectedSd = sd;
-	    *redirectedUrl = url;
-	    }
-	else
-	    {
-	    *redirectedSd = -1;
-	    *redirectedUrl = NULL;
-	    }
-	return TRUE;
-	}
-    close(sd);
-    if (redirectCount > 0)
-	freeMem(url);
-    if (success)
-	{
-	/* we have a new url to try */
-	++redirectCount;
-	if (redirectCount > 5)
-	    {
-	    warn("code 30x redirects: exceeded limit of 5 redirects, %s", newUrl);
-	    success = FALSE;
-	    }
-	else if (!startsWith("http://",newUrl) 
-              && !startsWith("https://",newUrl))
-	    {
-	    warn("redirected to non-http(s): %s", newUrl);
-	    success = FALSE;
-	    }
-	else 
-	    {
-	    struct netParsedUrl npu, newNpu;
-	    /* Parse the old URL to make parts available for graft onto the redirected url. */
-	    /* This makes redirection work with byterange urls and user:password@ */
-	    netParseUrl(url, &npu);
-	    netParseUrl(newUrl, &newNpu);
-	    boolean updated = FALSE;
-	    if (npu.byteRangeStart != -1)
-		{
-		newNpu.byteRangeStart = npu.byteRangeStart;
-		newNpu.byteRangeEnd = npu.byteRangeEnd;
-		updated = TRUE;
-		}
-	    if ((npu.user[0] != 0) && (newNpu.user[0] == 0))
-		{
-		safecpy(newNpu.user,     sizeof newNpu.user,     npu.user);
-		safecpy(newNpu.password, sizeof newNpu.password, npu.password);
-		updated = TRUE;
-		}
-	    if (updated)
-		{
-		freeMem(newUrl);
-		newUrl = urlFromNetParsedUrl(&newNpu);
-		}
-	    sd = netUrlOpen(newUrl);
-	    if (sd < 0)
-		{
-		warn("Couldn't open %s", newUrl);
-		success = FALSE;
-		}
-	    }
-	}
-    if (!success)
-	{  /* failure after 0 to 5 redirects */
-	if (redirectCount > 0)
-	    freeMem(newUrl);
-	return FALSE;
-	}
-    url = newUrl;
-    }
-return FALSE;
-}
-
-struct lineFile *netLineFileMayOpen(char *url)
-/* Return a lineFile attached to url. http skips header.
- * Supports some compression formats.  Prints warning message, but
- * does not abort, just returning NULL if there's a problem. */
-{
-int sd = netUrlOpen(url);
-if (sd < 0)
-    {
-    warn("Couldn't open %s", url);
-    return NULL;
-    }
-else
-    {
-    struct lineFile *lf = NULL;
-    char *newUrl = NULL;
-    int newSd = 0;
-    if (startsWith("http://",url) || startsWith("https://",url))
-	{  
-	if (!netSkipHttpHeaderLinesHandlingRedirect(sd, url, &newSd, &newUrl))
-	    {
-	    return NULL;
-	    }
-	if (newUrl != NULL)
-	    {
-    	    /*  Update sd with newSd, replace it with newUrl, etc. */
-	    sd = newSd;
-	    url = newUrl;
-	    }
-	}
-    char *urlDecoded = cloneString(url);
-    cgiDecode(url, urlDecoded, strlen(url));
-    boolean isCompressed =
-	(endsWith(urlDecoded,".gz") ||
-   	 endsWith(urlDecoded,".Z")  ||
-	 endsWith(urlDecoded,".bz2"));
-    freeMem(urlDecoded);
-    if (isCompressed)
-	{
-	lf = lineFileDecompressFd(url, TRUE, sd);
-           /* url needed only for compress type determination */
-	}
-    else
-	{
-	lf = lineFileAttach(url, TRUE, sd);
-	}
-    if (newUrl) 
-	freeMem(newUrl); 
-    return lf;
-    }
-}
-
-int netUrlMustOpenPastHeader(char *url)
-/* Get socket descriptor for URL.  Process header, handling any forwarding and
- * the like.  Do errAbort if there's a problem, which includes anything but a 200
- * return from http after forwarding. */
-{
-int sd = netUrlOpen(url);
-if (sd < 0)
-    noWarnAbort();
-int newSd = 0;
-if (startsWith("http://",url) || startsWith("https://",url))
-    {  
-    char *newUrl = NULL;
-    if (!netSkipHttpHeaderLinesHandlingRedirect(sd, url, &newSd, &newUrl))
-	noWarnAbort();
-    if (newUrl != NULL)
-	{
-	sd = newSd;
-	freeMem(newUrl); 
-	}
-    }
-return sd;
-}
-
-struct lineFile *netLineFileSilentOpen(char *url)
-/* Open a lineFile on a URL.  Just return NULL without any user
- * visible warning message if there's a problem. */
-{
-pushSilentWarnHandler();
-struct lineFile *lf = netLineFileMayOpen(url);
-popWarnHandler();
-return lf;
-}
-
-char *netReadTextFileIfExists(char *url)
-/* Read entire URL and return it as a string.  URL should be text (embedded zeros will be
- * interpreted as end of string).  If the url doesn't exist or has other problems,
- * returns NULL. */
-{
-struct lineFile *lf = netLineFileSilentOpen(url);
-if (lf == NULL)
-    return NULL;
-char *text = lineFileReadAll(lf);
-lineFileClose(&lf);
-return text;
-}
-
-struct lineFile *netLineFileOpen(char *url)
-/* Return a lineFile attached to url.  This one
- * will skip any headers.   Free this with
- * lineFileClose(). */
-{
-struct lineFile *lf = netLineFileMayOpen(url);
-if (lf == NULL)
-    noWarnAbort();
-return lf;
-}
-
-boolean netSendString(int sd, char *s)
-/* Send a string down a socket - length byte first. */
-{
-int length = strlen(s);
-UBYTE len;
-
-if (length > 255)
-    errAbort("Trying to send a string longer than 255 bytes (%d bytes)", length);
-len = length;
-if (write(sd, &len, 1)<0)
-    {
-    warn("Couldn't send string to socket");
-    return FALSE;
-    }
-if (write(sd, s, length)<0)
-    {
-    warn("Couldn't send string to socket");
-    return FALSE;
-    }
-return TRUE;
-}
-
-boolean netSendLongString(int sd, char *s)
-/* Send a long string down socket: two bytes for length. */
-{
-unsigned length = strlen(s);
-UBYTE b[2];
-
-if (length >= 64*1024)
-    {
-    warn("Trying to send a string longer than 64k bytes (%d bytes)", length);
-    return FALSE;
-    }
-b[0] = (length>>8);
-b[1] = (length&0xff);
-if (write(sd, b, 2) < 0)
-    {
-    warn("Couldn't send long string to socket");
-    return FALSE;
-    }
-if (write(sd, s, length)<0)
-    {
-    warn("Couldn't send long string to socket");
-    return FALSE;
-    }
-return TRUE;
-}
-
-boolean netSendHugeString(int sd, char *s)
-/* Send a long string down socket: four bytes for length. */
-{
-unsigned long length = strlen(s);
-unsigned long l = length;
-UBYTE b[4];
-int i;
-for (i=3; i>=0; --i)
-    {
-    b[i] = l & 0xff;
-    l >>= 8;
-    }
-if (write(sd, b, 4) < 0)
-    {
-    warn("Couldn't send huge string to socket");
-    return FALSE;
-    }
-if (write(sd, s, length) < 0)
-    {
-    warn("Couldn't send huge string to socket");
-    return FALSE;
-    }
-return TRUE;
-}
-
-
-char *netGetString(int sd, char buf[256])
-/* Read string into buf and return it.  If buf is NULL
- * an internal buffer will be used. Print warning message
- * and return NULL if any problem. */
-{
-static char sbuf[256];
-UBYTE len = 0;
-int length;
-int sz;
-if (buf == NULL) buf = sbuf;
-sz = netReadAll(sd, &len, 1);
-if (sz == 0)
-    return NULL;
-if (sz < 0)
-    {
-    warn("Couldn't read string length");
-    return NULL;
-    }
-length = len;
-if (length > 0)
-    if (netReadAll(sd, buf, length) < 0)
-	{
-	warn("Couldn't read string body");
-	return NULL;
-	}
-buf[length] = 0;
-return buf;
-}
-
-char *netGetLongString(int sd)
-/* Read string and return it.  freeMem
- * the result when done. */
-{
-UBYTE b[2];
-char *s = NULL;
-int length = 0;
-int sz;
-b[0] = b[1] = 0;
-sz = netReadAll(sd, b, 2);
-if (sz == 0)
-    return NULL;
-if (sz < 0)
-    {
-    warn("Couldn't read long string length");
-    return NULL;
-    }
-length = (b[0]<<8) + b[1];
-s = needMem(length+1);
-if (length > 0)
-    if (netReadAll(sd, s, length) < 0)
-	{
-	warn("Couldn't read long string body");
-	return NULL;
-	}
-s[length] = 0;
-return s;
-}
-
-char *netGetHugeString(int sd)
-/* Read string and return it.  freeMem
- * the result when done. */
-{
-UBYTE b[4];
-char *s = NULL;
-unsigned long length = 0;
-int sz, i;
-sz = netReadAll(sd, b, 4);
-if (sz == 0)
-    return NULL;
-if (sz < 4)
-    {
-    warn("Couldn't read huge string length");
-    return NULL;
-    }
-for (i=0; i<4; ++i)
-    {
-    length <<= 8;
-    length += b[i];
-    }
-s = needMem(length+1);
-if (length > 0)
-    {
-    if (netReadAll(sd, s, length) < 0)
-	{
-	warn("Couldn't read huge string body");
-	return NULL;
-	}
-    }
-s[length] = 0;
-return s;
-}
-
-
-char *netRecieveString(int sd, char buf[256])
-/* Read string into buf and return it.  If buf is NULL
- * an internal buffer will be used. Abort if any problem. */
-{
-char *s = netGetString(sd, buf);
-if (s == NULL)
-     noWarnAbort();   
-return s;
-}
-
-char *netRecieveLongString(int sd)
-/* Read string and return it.  freeMem
- * the result when done. Abort if any problem*/
-{
-char *s = netGetLongString(sd);
-if (s == NULL)
-     noWarnAbort();   
-return s;
-}
-
-char *netRecieveHugeString(int sd)
-/* Read string and return it.  freeMem
- * the result when done. Abort if any problem*/
-{
-char *s = netGetHugeString(sd);
-if (s == NULL)
-     noWarnAbort();   
-return s;
-}
-
-
-struct lineFile *netHttpLineFileMayOpen(char *url, struct netParsedUrl **npu)
-/* Parse URL and open an HTTP socket for it but don't send a request yet. */
-{
-int sd;
-struct lineFile *lf;
-
-/* Parse the URL and try to connect. */
-AllocVar(*npu);
-netParseUrl(url, *npu);
-if (!sameString((*npu)->protocol, "http"))
-    errAbort("netHttpLineFileMayOpen: url (%s) is not for http.", url);
-sd = netConnect((*npu)->host, atoi((*npu)->port));
-if (sd < 0)
-    return NULL;
-
-/* Return handle. */
-lf = lineFileAttach(url, TRUE, sd);
-return lf;
-} /* netHttpLineFileMayOpen */
-
-
-void netHttpGet(struct lineFile *lf, struct netParsedUrl *npu,
-		boolean keepAlive)
-/* Send a GET request, possibly with Keep-Alive. */
-{
-struct dyString *dy = newDyString(512);
-
-/* Ask remote server for the file/query. */
-dyStringPrintf(dy, "GET %s HTTP/1.1\r\n", npu->file);
-dyStringPrintf(dy, "User-Agent: genome.ucsc.edu/net.c\r\n");
-dyStringPrintf(dy, "Host: %s:%s\r\n", npu->host, npu->port);
-if (!sameString(npu->user,""))
-    {
-    char up[256];
-    char *b64up = NULL;
-    safef(up,sizeof(up), "%s:%s", npu->user, npu->password);
-    b64up = base64Encode(up, strlen(up));
-    dyStringPrintf(dy, "Authorization: Basic %s\r\n", b64up);
-    freez(&b64up);
-    }
-dyStringAppend(dy, "Accept: */*\r\n");
-if (keepAlive)
-  {
-    dyStringAppend(dy, "Connection: Keep-Alive\r\n");
-    dyStringAppend(dy, "Connection: Persist\r\n");
-  }
-else
-    dyStringAppend(dy, "Connection: close\r\n");
-dyStringAppend(dy, "\r\n");
-mustWriteFd(lf->fd, dy->string, dy->stringSize);
-/* Clean up. */
-dyStringFree(&dy);
-} /* netHttpGet */
-
-int netHttpGetMultiple(char *url, struct slName *queries, void *userData,
-		       void (*responseCB)(void *userData, char *req,
-					  char *hdr, struct dyString *body))
-/* Given an URL which is the base of all requests to be made, and a 
- * linked list of queries to be appended to that base and sent in as 
- * requests, send the requests as a batch and read the HTTP response 
- * headers and bodies.  If not all the requests get responses (i.e. if 
- * the server is ignoring Keep-Alive or is imposing a limit), try again 
- * until we can't connect or until all requests have been served. 
- * For each HTTP response, do a callback. */
-{
-  struct slName *qStart;
-  struct slName *qPtr;
-  struct lineFile *lf;
-  struct netParsedUrl *npu;
-  struct dyString *dyQ    = newDyString(512);
-  struct dyString *body;
-  char *base;
-  char *hdr;
-  int qCount;
-  int qTotal;
-  int numParseFailures;
-  int contentLength;
-  boolean chunked;
-  boolean done;
-  boolean keepAlive;
-
-  /* Find out how many queries we'll need to do so we know how many times 
-   * it's OK to run into end of file in case server ignores Keep-Alive. */
-  qTotal = 0;
-  for (qPtr = queries;  qPtr != NULL;  qPtr = qPtr->next)
-    {
-      qTotal++;
-    }
-
-  done = FALSE;
-  qCount = 0;
-  numParseFailures = 0;
-  qStart = queries;
-  while ((! done) && (qStart != NULL))
-    {
-      lf = netHttpLineFileMayOpen(url, &npu);
-      if (lf == NULL)
-	{
-	  done = TRUE;
-	  break;
-	}
-      base = cloneString(npu->file);
-      /* Send all remaining requests with keep-alive. */
-      for (qPtr = qStart;  qPtr != NULL;  qPtr = qPtr->next)
-	{
-	  dyStringClear(dyQ);
-	  dyStringAppend(dyQ, base);
-	  dyStringAppend(dyQ, qPtr->name);
-	  strcpy(npu->file, dyQ->string);
-	  keepAlive = (qPtr->next == NULL) ? FALSE : TRUE;
-	  netHttpGet(lf, npu, keepAlive);
-	}
-      /* Get as many responses as we can; call responseCB() and 
-       * advance qStart for each. */
-      for (qPtr = qStart;  qPtr != NULL;  qPtr = qPtr->next)
-        {
-	  if (lineFileParseHttpHeader(lf, &hdr, &chunked, &contentLength))
-	    {
-	      body = lineFileSlurpHttpBody(lf, chunked, contentLength);
-	      dyStringClear(dyQ);
-	      dyStringAppend(dyQ, base);
-	      dyStringAppend(dyQ, qPtr->name);
-	      responseCB(userData, dyQ->string, hdr, body);
-	      qStart = qStart->next;
-	      qCount++;
-	    }
-	  else
-	    {
-	      if (numParseFailures++ > qTotal) {
-		done = TRUE;
-	      }
-	      break;
-	    }
-	}
-    }
-
-  return qCount;
-} /* netHttpMultipleQueries */
-
-boolean hasProtocol(char *urlOrPath)
-/* Return TRUE if it looks like it has http://, ftp:// etc. */
-{
-return stringIn("://", urlOrPath) != NULL;
-}
-
diff --git a/gbtools/src/blatSrc/lib/nib.c b/gbtools/src/blatSrc/lib/nib.c
deleted file mode 100644
index d885513..0000000
--- a/gbtools/src/blatSrc/lib/nib.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/* Nib - nibble (4 bit) representation of nucleotide sequences. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "hash.h"
-#include "dnautil.h"
-#include "dnaseq.h"
-#include "nib.h"
-#include "sig.h"
-
-
-static char *findNibSubrange(char *fileName)
-/* find the colon starting a nib seq name/subrange in a nib file name, or NULL
- * if none */
-{
-char *baseName = strrchr(fileName, '/');
-baseName = (baseName == NULL) ? fileName : baseName+1;
-return strchr(baseName, ':');
-}
-
-static void parseSubrange(char *subrange, char *name, 
-	unsigned *start, unsigned *end)
-/* parse the subrange specification */
-{
-char *rangePart = strchr(subrange+1, ':');
-if (rangePart != NULL)
-    {
-    /* :seqId:start-end form */
-    *rangePart = '\0';
-    strcpy(name, subrange+1);
-    *rangePart = ':';
-    rangePart++;
-    }
-else
-    {
-    /* :start-end form */
-    rangePart = subrange+1;
-    strcpy(name, ""); 
-    }
-if ((sscanf(rangePart, "%u-%u", start, end) != 2) || (*start > *end))
-    errAbort("can't parse nib file subsequence specification: %s",
-             subrange);
-}
-
-void nibParseName(unsigned options, char *fileSpec, char *filePath,
-                         char *name, unsigned *start, unsigned *end)
-/* Parse the nib name, getting the file name, seq name to use, and
- * optionally the start and end positions. Zero is return for start
- * and end if they are not specified. Return the path to the file
- * and the name to use for the sequence. */
-{
-char *subrange = findNibSubrange(fileSpec);
-if (subrange != NULL)
-    {
-    *subrange = '\0';
-    parseSubrange(subrange, name, start, end);
-    strcpy(filePath, fileSpec);
-    *subrange = ':';
-    if (strlen(name) == 0)
-        {
-        /* no name in spec, generate one */
-        if (options & NIB_BASE_NAME)
-            splitPath(filePath, NULL, name, NULL);
-        else
-            strcpy(name, filePath);
-        sprintf(name+strlen(name), ":%u-%u", *start, *end);
-        }
-    }
-else
-    {
-    *start = 0;
-    *end = 0;
-    strcpy(filePath, fileSpec);
-    if (options & NIB_BASE_NAME)
-        splitPath(fileSpec, NULL, name, NULL);
-    else
-        strcpy(name, fileSpec);
-    }
-}
-
-void nibOpenVerify(char *fileName, FILE **retFile, int *retSize)
-/* Open file and verify it's in good nibble format. */
-{
-bits32 size;
-bits32 sig;
-FILE *f = fopen(fileName, "rb");
-char buffer[512];
-char buffer2[512];
-char buffer3[512];
-
-if (f == NULL)
-    {
-    /* see if nib is down a few directories ala faSplit -outDirDepth */
-    char *ptr = NULL;
-    char *dir, *file;
-    struct stat statBuf;
-
-    /* divide fileName into file and directory components */
-    safef(buffer, sizeof(buffer), "%s", fileName);
-    if ((ptr = strrchr(buffer, '/')) != NULL)
-	{
-	*ptr++ = 0;
-	dir = buffer;
-	file = ptr;
-	}
-    else
-	{
-	dir = "";
-	file = buffer;
-	}
-    
-    buffer3[0] = 0;
-    /* start at the end of the fileName (minus .nib) */
-    for(ptr = &file[strlen(file) - 5]; ; )
-	{
-	strcpy(buffer2, buffer3);
-	if (isdigit(*ptr))
-	    {
-	    /* if we have a digit in the fileName, see if there is a directory with this name */
-	    safef(buffer3, sizeof(buffer3), "%c/%s",*ptr,buffer2);
-	    ptr--;
-	    }
-	else
-	    /* we've run out of digits in the fileName, just add 0's */
-	    safef(buffer3, sizeof(buffer3), "0/%s",buffer2);
-
-	/* check to see if this directory exists */
-	safef(buffer2, sizeof(buffer2), "%s/%s", dir, buffer3);
-	if (stat(buffer2, &statBuf) < 0)
-	    break;
-
-	/* directory exists, see if our file is down there */
-	safef(buffer2, sizeof(buffer2), "%s/%s/%s", dir, buffer3, file);
-	if  ((f = fopen(buffer2, "rb")) != NULL)
-	    break;
-	}
-    if (f == NULL)
-	errAbort("Can't open %s to read: %s", fileName,  strerror(errno));
-    }
-dnaUtilOpen();
-mustReadOne(f, sig);
-mustReadOne(f, size);
-if (sig != nibSig)
-    {
-    sig = byteSwap32(sig);
-    size = byteSwap32(size);
-    if (sig != nibSig)
-	errAbort("%s is not a good .nib file.",  fileName);
-    }
-*retSize = size;
-*retFile = f;
-}
-
-static struct dnaSeq *nibInput(int options, char *fileName, char *seqName,
-                               FILE *f, int seqSize, int start, int size)
-/* Load part of an open .nib file. */
-{
-int end;
-DNA *d;
-int bVal;
-DNA *valToNtTbl = ((options &  NIB_MASK_MIXED) ? valToNtMasked : valToNt);
-struct dnaSeq *seq;
-Bits* mask = NULL;
-int bytePos, byteSize;
-int maskIdx = 0;
-
-assert(start >= 0);
-assert(size >= 0);
-
-end = start+size;
-if (end > seqSize)
-    errAbort("nib read past end of file (%d %d) in file: %s", 
-	     end, seqSize, (fileName != NULL ? fileName : "(NULL)"));
-
-AllocVar(seq);
-seq->size = size;
-seq->name = cloneString(seqName);
-seq->dna = d = needLargeMem(size+1);
-if (options & NIB_MASK_MIXED)
-    seq->mask = mask = bitAlloc(size);
-
-bytePos = (start>>1);
-fseek(f, bytePos + 2*sizeof(bits32), SEEK_SET);
-if (start & 1)
-    {
-    bVal = getc_unlocked(f);
-    if (bVal < 0)
-	{
-	errAbort("Read error 1 in %s", fileName);
-	}
-    *d++ = valToNtTbl[(bVal&0xf)];
-    size -= 1;
-    if (mask != NULL)
-        {
-        if ((bVal&0xf&MASKED_BASE_BIT) == 0)
-            bitSetOne(mask, maskIdx);
-        maskIdx++;
-        }
-    }
-byteSize = (size>>1);
-while (--byteSize >= 0)
-    {
-    bVal = getc_unlocked(f);
-    if (bVal < 0)
-	errAbort("Read error 2 in %s", fileName);
-    d[0] = valToNtTbl[(bVal>>4)];
-    d[1] = valToNtTbl[(bVal&0xf)];
-    d += 2;
-    if (mask != NULL)
-        {
-        if (((bVal>>4)&0xf) == 0)
-            bitSetOne(mask, maskIdx);
-        if ((bVal&0xf) == 0)
-            bitSetOne(mask, maskIdx+1);
-        maskIdx += 2;
-        }
-    }
-if (size&1)
-    {
-    bVal = getc_unlocked(f);
-    if (bVal < 0)
-	errAbort("Read error 3 in %s", fileName);
-    *d++ = valToNtTbl[(bVal>>4)];
-    if (mask != NULL)
-        {
-        if ((bVal>>4) == 0)
-            bitSetOne(mask, maskIdx);
-        maskIdx++;
-        }
-    }
-*d = 0;
-return seq;
-}
-
-static void nibOutput(int options, struct dnaSeq *seq, char *fileName)
-/* Write out file in format of four bits per nucleotide, with control over
- * handling of masked positions. */
-{
-UBYTE byte;
-DNA *dna = seq->dna;
-int dVal1, dVal2;
-bits32 size = seq->size;
-int byteCount = (size>>1);
-bits32 sig = nibSig;
-int *ntValTbl = ((options & NIB_MASK_MIXED) ? ntValMasked : ntVal5);
-Bits* mask = ((options & NIB_MASK_MAP) ? seq->mask : NULL);
-int maskIdx = 0;
-FILE *f = mustOpen(fileName, "w");
-
-assert(sizeof(bits32) == 4);
-
-writeOne(f, sig);
-writeOne(f, seq->size);
-
-printf("Writing %d bases in %d bytes\n", seq->size, ((seq->size+1)/2) + 8);
-while (--byteCount >= 0)
-    {
-    dVal1 = ntValTbl[(int)dna[0]];
-    dVal2 = ntValTbl[(int)dna[1]];
-    /* Set from mask, remember bit in character is opposite sense of bit
-     * in mask. */
-    if (mask != NULL)
-        {
-        if (!bitReadOne(mask, maskIdx))
-            dVal1 |= MASKED_BASE_BIT;
-        if (!bitReadOne(mask, maskIdx+1))
-            dVal2 |= MASKED_BASE_BIT;
-        maskIdx += 2;
-        }
-    byte = (dVal1<<4) | dVal2;
-    if (putc(byte, f) < 0)
-	{
-	perror("");
-	errAbort("Couldn't write all of %s", fileName);
-	}
-    dna += 2;
-    }
-if (size & 1)
-    {
-    dVal1 = ntValTbl[(int)dna[0]];
-    if ((mask != NULL) && !bitReadOne(mask, maskIdx))
-        dVal1 |= MASKED_BASE_BIT;
-    byte = (dVal1<<4);
-    putc(byte, f);
-    }
-carefulClose(&f);
-}
-
-struct dnaSeq *nibLdPartMasked(int options, char *fileName, FILE *f, int seqSize, int start, int size)
-/* Load part of an open .nib file, with control over handling of masked
- * positions. */
-{
-char nameBuf[512];
-safef(nameBuf, sizeof(nameBuf), "%s:%d-%d", fileName, start, start+size);
-return nibInput(options, fileName, nameBuf, f, seqSize, start, size);
-}
-
-struct dnaSeq *nibLdPart(char *fileName, FILE *f, int seqSize, int start, int size)
-/* Load part of an open .nib file. */
-{
-return nibLdPartMasked(0, fileName, f, seqSize, start, size);
-}
-
-struct dnaSeq *nibLoadPartMasked(int options, char *fileName, int start, int size)
-/* Load part of an .nib file, with control over handling of masked positions */
-{
-struct dnaSeq *seq;
-FILE *f;
-int seqSize;
-nibOpenVerify(fileName, &f, &seqSize);
-seq = nibLdPartMasked(options, fileName, f, seqSize, start, size);
-fclose(f);
-return seq;
-}
-
-struct dnaSeq *nibLoadPart(char *fileName, int start, int size)
-/* Load part of an .nib file. */
-{
-return nibLoadPartMasked(0, fileName, start, size);
-}
-
-struct dnaSeq *nibLoadAllMasked(int options, char *fileName)
-/* Load part of a .nib file, with control over handling of masked
- * positions. Subranges of nib files may specified in the file name
- * using the syntax:
- *    /path/file.nib:seqid:start-end
- * or\n"
- *    /path/file.nib:start-end
- * With the first form, seqid becomes the id of the subrange, with the second
- * form, a sequence id of file:start-end will be used.
- */
-{
-struct dnaSeq *seq;
-FILE *f;
-int seqSize;
-char filePath[PATH_LEN];
-char name[PATH_LEN];
-unsigned start, end;
-
-nibParseName(options, fileName, filePath, name, &start, &end);
-nibOpenVerify(filePath, &f, &seqSize);
-if (end == 0)
-    end = seqSize;
-seq = nibInput(options, fileName, name, f, seqSize, start, end-start);
-fclose(f);
-return seq;
-}
-
-struct dnaSeq *nibLoadAll(char *fileName)
-/* Load part of an .nib file. */
-{
-return nibLoadAllMasked(0, fileName);
-}
-
-void nibWriteMasked(int options, struct dnaSeq *seq, char *fileName)
-/* Write out file in format of four bits per nucleotide, with control over
- * handling of masked positions. */
-{
-    nibOutput(options, seq, fileName);
-}
-
-void nibWrite(struct dnaSeq *seq, char *fileName)
-/* Write out file in format of four bits per nucleotide. */
-{
-    nibWriteMasked(0, seq, fileName);
-}
-
-struct nibStream
-/* Struct to help write a nib file one base at a time. 
- * The routines that do this aren't very fast, but they
- * aren't used much currently. */
-    {
-    struct nibStream *next;
-    char *fileName;	/* Name of file - allocated here. */
-    FILE *f;		/* File handle. */
-    bits32 size;	/* Current size. */
-    UBYTE byte;		/* Two nibble's worth of data. */
-    };
-
-struct nibStream *nibStreamOpen(char *fileName)
-/* Create a new nib stream.  Open file and stuff. */
-{
-struct nibStream *ns;
-FILE *f;
-
-dnaUtilOpen();
-AllocVar(ns);
-ns->f = f = mustOpen(fileName, "wb");
-ns->fileName = cloneString(fileName);
-
-/* Write header - initially zero.  Will fix it up when we close. */
-writeOne(f, ns->size);
-writeOne(f, ns->size);
-
-return ns;
-}
-
-void nibStreamClose(struct nibStream **pNs)
-/* Close a nib stream.  Flush last nibble if need be.  Fix up header. */
-{
-struct nibStream *ns = *pNs;
-FILE *f;
-bits32 sig = nibSig;
-if (ns == NULL)
-    return;
-f = ns->f;
-if (ns->size&1)
-    writeOne(f, ns->byte);
-fseek(f,  0L, SEEK_SET);
-writeOne(f, sig);
-writeOne(f, ns->size);
-fclose(f);
-freeMem(ns->fileName);
-freez(pNs);
-}
-
-void nibStreamOne(struct nibStream *ns, DNA base)
-/* Write out one base to nibStream. */
-{
-UBYTE ub = ntVal5[(int)base];
-
-if ((++ns->size&1) == 0)
-    {
-    ub += ns->byte;
-    writeOne(ns->f, ub);
-    }
-else
-    {
-    ns->byte = (ub<<4);
-    }
-}
-
-void nibStreamMany(struct nibStream *ns, DNA *dna, int size)
-/* Write many bases to nibStream. */
-{
-int i;
-for (i=0; i<size; ++i)
-    nibStreamOne(ns, *dna++);
-}
-
-boolean nibIsFile(char *fileName)
-/* Return TRUE if file is a nib file. */
-{
-boolean isANib;
-char *subrange = findNibSubrange(fileName);
-if (subrange != NULL)
-    *subrange = '\0';
-isANib = endsWith(fileName, ".nib") || endsWith(fileName, ".NIB");
-if (subrange != NULL)
-    *subrange = ':';
-return isANib;
-}
-
-boolean nibIsRange(char *fileName)
-/* Return TRUE if file specifies a subrange of a nib file. */
-{
-boolean isANib;
-char *subrange = findNibSubrange(fileName);;
-if (subrange == NULL)
-    return FALSE;
-*subrange = '\0';
-isANib = endsWith(fileName, ".nib") || endsWith(fileName, ".NIB");
-*subrange = ':';
-return isANib;
-}
-
-struct nibInfo *nibInfoNew(char *path)
-/* Make a new nibInfo with open nib file. */
-{
-struct nibInfo *nib;
-AllocVar(nib);
-nib->fileName = cloneString(path);
-nibOpenVerify(path, &nib->f, &nib->size);
-return nib;
-}
-
-void nibInfoFree(struct nibInfo **pNib)
-/* Free up nib info and close file if open. */
-{
-struct nibInfo *nib = *pNib;
-if (nib != NULL)
-    {
-    carefulClose(&nib->f);
-    freeMem(nib->fileName);
-    freez(pNib);
-    }
-}
-
-struct nibInfo *nibInfoFromCache(struct hash *hash, char *nibDir, char *nibName)
-/* Get nibInfo on nibDir/nibName.nib from cache, filling cache if need be. */
-{
-struct nibInfo *nib;
-char path[PATH_LEN];
-safef(path, sizeof(path), "%s/%s.nib", nibDir, nibName);
-nib = hashFindVal(hash, path);
-if (nib == NULL)
-    {
-    nib = nibInfoNew(path);
-    hashAdd(hash, path, nib);
-    }
-return nib;
-}
-
-int nibGetSize(char* nibFile)
-/* Get the sequence length of a nib */
-{
-FILE* fh;
-int size;
-
-nibOpenVerify(nibFile, &fh, &size);
-carefulClose(&fh);
-return size;
-}
-
diff --git a/gbtools/src/blatSrc/lib/nibTwo.c b/gbtools/src/blatSrc/lib/nibTwo.c
deleted file mode 100644
index 3f50c98..0000000
--- a/gbtools/src/blatSrc/lib/nibTwo.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* nibTwo - Something to let you transparently access either
- * .2bit or .nib files. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "dnaseq.h"
-#include "nib.h"
-#include "twoBit.h"
-#include "nibTwo.h"
-
-
-struct nibTwoCache *nibTwoCacheNew(char *pathName)
-/* Get something that will more or less transparently get sequence from 
- * nib files or .2bit. */ 
-{
-struct nibTwoCache *ntc;
-AllocVar(ntc);
-ntc->pathName = cloneString(pathName);
-ntc->isTwoBit = twoBitIsFile(pathName);
-if (ntc->isTwoBit)
-    ntc->tbf = twoBitOpen(pathName);
-else
-    ntc->nibHash = newHash(10);
-return ntc;
-}
-
-void nibTwoCacheFree(struct nibTwoCache **pNtc)
-/* Free up resources associated with nibTwoCache. */
-{
-struct nibTwoCache *ntc = *pNtc;
-if (ntc != NULL)
-    {
-    freez(&ntc->pathName);
-    if (ntc->isTwoBit)
-        twoBitClose(&ntc->tbf);
-    else
-        {
-	struct hashEl *el, *list = hashElListHash(ntc->nibHash);
-	struct nibInfo *nib;
-	for (el = list; el != NULL; el = el->next)
-	     {
-	     nib = el->val;
-	     nibInfoFree(&nib);
-	     }
-	hashElFreeList(&list);
-	hashFree(&ntc->nibHash);
-	}
-    freez(pNtc);
-    }
-}
-
-struct dnaSeq *nibTwoCacheSeq(struct nibTwoCache *ntc, char *seqName)
-/* Return all of sequence. This will have repeats in lower case. */
-{
-if (ntc->isTwoBit)
-    return twoBitReadSeqFrag(ntc->tbf, seqName, 0, 0);
-else
-    {
-    struct nibInfo *nib = nibInfoFromCache(ntc->nibHash, ntc->pathName, seqName);
-    return nibLdPart(nib->fileName, nib->f, nib->size, 0, nib->size);
-    }
-}
-
-struct dnaSeq *nibTwoCacheSeqPartExt(struct nibTwoCache *ntc, char *seqName, int start, int size,
-                                     boolean doMask, int *retFullSeqSize)
-/* Return part of sequence. If *retFullSeqSize is non-null then return full
- * size of sequence (not just loaded part) there.   Sequence will be lower
- * case if doMask is false, mixed case (repeats in lower)
- * if doMask is true. */
-{
-if (ntc->isTwoBit)
-    {
-    return twoBitReadSeqFragExt(ntc->tbf, seqName, start, start+size,
-                                doMask, retFullSeqSize);
-    }
-else
-    {
-    struct nibInfo *nib = nibInfoFromCache(ntc->nibHash, ntc->pathName, seqName);
-    int opts = (doMask ? NIB_MASK_MIXED : 0);
-    if (retFullSeqSize != NULL)
-        *retFullSeqSize = nib->size;
-    return nibLdPartMasked(opts, nib->fileName, nib->f, nib->size, start, size);
-    }
-}
-
-struct dnaSeq *nibTwoCacheSeqPart(struct nibTwoCache *ntc, char *seqName, int start, int size,
-	int *retFullSeqSize)
-/* Return part of sequence. If *retFullSeqSize is non-null then return full size of
- * sequence (not just loaded part) there. This will have repeats in lower case. */
-{
-return nibTwoCacheSeqPartExt(ntc, seqName, start, size, TRUE, retFullSeqSize);
-}
-
-struct dnaSeq *nibTwoLoadOne(char *pathName, char *seqName)
-/* Return sequence from a directory full of nibs or a .2bit file. 
- * The sequence will have repeats in lower case. */
-{
-struct dnaSeq *seq;
-if (twoBitIsFile(pathName))
-    {
-    struct twoBitFile *tbf = twoBitOpen(pathName);
-    seq = twoBitReadSeqFrag(tbf, seqName, 0, 0);
-    twoBitClose(&tbf);
-    }
-else
-    {
-    char path[512];
-    safef(path, sizeof(path), "%s/%s.nib", pathName, seqName);
-    seq = nibLoadAllMasked(NIB_MASK_MIXED, path);
-    }
-return seq;
-}
-
-int nibTwoGetSize(struct nibTwoCache *ntc, char *seqName)
-/* Return size of sequence. */
-{
-if (ntc->isTwoBit)
-    return twoBitSeqSize(ntc->tbf, seqName);
-else
-    return nibInfoFromCache(ntc->nibHash, ntc->pathName, seqName)->size;
-}
-
diff --git a/gbtools/src/blatSrc/lib/nt4.c b/gbtools/src/blatSrc/lib/nt4.c
deleted file mode 100644
index f291066..0000000
--- a/gbtools/src/blatSrc/lib/nt4.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* nt4 - stuff to handle 2-bit-a-base representation of DNA.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "shaRes.h"
-#include "dnaseq.h"
-#include "nt4.h"
-#include "sig.h"
-
-
-static size_t bits32PaddedSize(size_t size)
-{
-    return (((size+15)>>4)<<2);
-}
-
-static struct nt4Seq *allocNt4(size_t baseCount, char *name)
-/* Create a new nt4Seq struct with memory for bases. */
-{
-size_t memSize = bits32PaddedSize(baseCount);
-struct nt4Seq *seq = needMem(sizeof(*seq));
-seq->baseCount = baseCount;
-seq->bases = needLargeMem(memSize);
-seq->name = cloneString(name);
-return seq;
-}
-
-
-struct nt4Seq *newNt4(DNA *dna, int size, char *name)
-/* Create a new DNA seq with 2 bits per base pair. */
-{
-bits32 *packed;
-DNA *unpacked;
-char last[16];
-struct nt4Seq *seq = allocNt4(size, name);
-packed = seq->bases;
-unpacked = dna;
-while (size > 16)
-    {
-    *packed++ = packDna16(dna);
-    dna += 16;
-    size -= 16;
-    }
-if (size > 0)
-    {
-    memcpy(last, dna, size);
-    *packed++ = packDna16(dna);
-    }
-return seq;
-}
-
-void freeNt4(struct nt4Seq **pSeq)
-/* Free up DNA seq with 2 bits per base pair */
-{
-struct nt4Seq *seq = *pSeq;
-if (seq == NULL)
-    return;
-freeMem(seq->bases);
-freeMem(seq->name);
-freez(pSeq);
-}
-
-static FILE *nt4OpenVerify(char *fileName)
-/* Open up an nt4 file and verify signature.
- * Abort if any problem. */
-{
-FILE *f = mustOpen(fileName, "rb");
-bits32 signature;
-mustReadOne(f, signature);
-if (signature != nt4Signature)
-    errAbort("%s is not a good Nt4 file", fileName);
-return f;
-}
-
-struct nt4Seq *loadNt4(char *fileName, char *seqName)
-/* Load up an nt4 sequence from a file. */
-{
-bits32 size;
-struct nt4Seq *seq;
-FILE *f = nt4OpenVerify(fileName);
-
-mustReadOne(f, size);
-if (seqName == NULL)
-    seqName = fileName;
-seq = allocNt4(size, seqName);
-mustRead(f, seq->bases, bits32PaddedSize(size));
-carefulClose(&f);
-return seq;
-}
-
-void  saveNt4(char *fileName, DNA *dna, bits32 dnaSize)
-/* Save dna in an NT4 file. */
-{
-FILE *f = mustOpen(fileName, "wb");
-bits32 signature = nt4Signature;
-bits32 bases;
-char last[16];
-
-writeOne(f, signature);
-writeOne(f, dnaSize);
-while (dnaSize >= 16)
-    {
-    bases = packDna16(dna);
-    writeOne(f, bases);
-    dna += 16;
-    dnaSize -= 16;
-    }
-if (dnaSize > 0)
-    {
-    zeroBytes(last, sizeof(last));
-    memcpy(last, dna, dnaSize);
-    bases = packDna16(last);
-    writeOne(f, bases);
-    }
-fclose(f);
-}
-
-int nt4BaseCount(char *fileName)
-/* Return number of bases in NT4 file. */
-{
-bits32 size;
-FILE *f = nt4OpenVerify(fileName);
-
-mustReadOne(f, size);
-fclose(f);
-return (int)size;
-}
-
-static void unpackRightSide(bits32 tile, int baseCount, DNA *out)
-/* Unpack last part of tile into DNA. */
-{
-int j;
-
-for (j=baseCount; --j>=0; )
-    {
-    out[j] = valToNt[tile & 0x3];
-    tile >>= 2;
-    }
-}
-
-static void unpackLeftSide(bits32 tile, int baseCount, DNA *out)
-/* Unpack first part of tile into DNA. */
-{
-int bitsToDump = ((16-baseCount)<<1);
-tile >>= bitsToDump;
-out += baseCount;
-while (--baseCount >= 0)
-    {
-    *--out = valToNt[tile&0x3];
-    tile >>= 2;
-    }
-}
-
-static void unpackMidWord(bits32 tile, int startBase, int baseCount, DNA *out)
-/* Unpack part of a single word. */
-{
-tile >>= ((16-startBase-baseCount)<<1);
-out += baseCount;
-while (--baseCount >= 0)
-    {
-    *--out = valToNt[tile&0x3];
-    tile >>= 2;
-    }
-}
-
-void unalignedUnpackDna(bits32 *tiles, int start, int size, DNA *unpacked)
-/* Unpack into out, even though not starting/stopping on tile 
- * boundaries. */
-{
-DNA *pt = unpacked;
-int sizeLeft = size;
-int firstBases, middleBases;
-bits32 *startTile, *endTile;
-
-dnaUtilOpen();
-
-/* See if all data is in a single word. */
-startTile = tiles + (start>>4);
-endTile = tiles + ((start + size - 1)>>4);
-if (startTile == endTile)
-    {
-    unpackMidWord(*startTile, start&0xf, size, unpacked);
-    return;
-    }
-
-/* Skip over initial stuff. */
-tiles = startTile;
-
-/* See if just have one tile to 
- * Unpack the right hand side of the first tile. */
-firstBases = (16 - (start&0xf));
-unpackRightSide(*tiles, firstBases, pt);
-pt += firstBases;
-sizeLeft -= firstBases;
-tiles += 1;
-
-/* Unpack all of the middle tiles. */
-middleBases = (sizeLeft&0x7ffffff0);
-unpackDna(tiles, middleBases>>4, pt);
-pt += middleBases;
-sizeLeft -= middleBases;
-tiles += (middleBases>>4);
-
-/* Unpack the left side of last tile. */
-if (sizeLeft > 0)
-    unpackLeftSide(*tiles, sizeLeft, pt);
-pt += sizeLeft;
-
-/* Add trailing zero to make it a DNA string. */
-assert(pt == unpacked+size);
-*pt = 0;
-}
-
-DNA *nt4Unpack(struct nt4Seq *n, int start, int size)
-/* Create an unpacked section of nt4 sequence.  */
-{
-DNA *unpacked = needLargeMem(size+1);
-unalignedUnpackDna(n->bases, start, size, unpacked);
-return unpacked;
-}
-
-
-DNA *nt4LoadPart(char *fileName, int start, int size)
-/* Load part of an nt4 file. */
-{
-bits32 basesInFile;
-int tStart, tEnd, tSize;
-int end;
-FILE *f;
-DNA *unpacked;
-bits32 *tiles;
-
-/* Open file, and make sure request is covered by file. */
-f = nt4OpenVerify(fileName);
-mustReadOne(f, basesInFile);
-
-assert(start >= 0);
-end = start + size;
-assert(end <= (int)basesInFile);
-
-/* Figure out tiles to load */
-tStart = (start>>4);
-tEnd = ((end+15)>>4);
-tSize = tEnd - tStart;
-
-/* Allocate tile array and read it from disk. */
-tiles = needLargeMem(tSize * sizeof(*tiles));
-fseek(f, tStart * sizeof(*tiles), SEEK_CUR);
-mustRead(f, tiles, tSize * sizeof(*tiles) );
-
-/* Allocate and unpack array. */
-unpacked = needLargeMem(size+1);
-unalignedUnpackDna(tiles, start - (tStart<<4), size, unpacked);
-
-freeMem(tiles);
-fclose(f);
-return unpacked;
-}
diff --git a/gbtools/src/blatSrc/lib/numObscure.c b/gbtools/src/blatSrc/lib/numObscure.c
deleted file mode 100644
index 4d53b2f..0000000
--- a/gbtools/src/blatSrc/lib/numObscure.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* numObscure - obscure but sometimes useful numerical functions. */
-
-/* Copyright (C) 2009 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-#include "common.h"
-#include "obscure.h"
-
-static void rangeIncludingZero(double start, double end, double *retStart, double *retEnd)
-/* If start == end, then make range go from zero to the start/end value. */
-{
-if (start < 0.0)
-    {
-    *retStart = start;
-    *retEnd = 0;
-    }
-else if (start > 0.0)
-    {
-    *retStart = 0;
-    *retEnd = end;
-    }
-else
-    {
-    *retStart = 0;
-    *retEnd = 1;
-    }
-return;
-}
-
-void rangeRoundUp(double start, double end, double *retStart, double *retEnd)
-/* Round start and end so that they cover a slightly bigger range, but with more round
- * numbers.  For instance 0.23:9.89 becomes 0:10 */
-{
-double size = end - start;
-if (size < 0)
-    errAbort("start (%g) after end (%g) in rangeRoundUp", start, end);
-
-/* Flat ranges get moved to include zero for scale. */
-if (size == 0.0)
-    {
-    rangeIncludingZero(start, end, &start, &end);
-    size = end - start;
-    }
-
-/* Figure out "increment", which will be 1, 2, 5, or 10, or a multiple of 10 of these 
- * Want to have at least two increments in range. */
-double exponent = 1;
-double scaledSize = size;
-double increment = 0;
-while (scaledSize < 100)
-    {
-    scaledSize *= 10;
-    exponent /= 10;
-    }
-while (scaledSize >= 100)
-    {
-    scaledSize /= 10;
-    exponent *= 10;
-    }
-/* At this point have a number between 10 and 100 */
-if (scaledSize < 12)
-    increment = 1;
-else if (scaledSize < 20)
-    increment = 2;
-else if (scaledSize < 75)
-    increment = 5;
-else
-    increment = 10;
-increment *= exponent;
-
-int startInIncrements = floor(start/increment);
-int endInIncrements = ceil(end/increment);
-*retStart = startInIncrements * increment;
-*retEnd = endInIncrements * increment;
-}
-
-void rangeFromMinMaxMeanStd(double minVal, double maxVal, double mean, double std,
-	double *retStart, double *retEnd)
-/* Given some basic statistical properties, set a range that will be good on a wide
- * range of biological data. */
-{
-double start,end;
-if (isnan(std))
-    {
-    /* Handle a case that occurred in version 1 bigWigs and bigBeds due to fault in
-     * sumSquares calculation. */
-    start = mean-5;
-    end = mean+5;
-    if (start < minVal) start = minVal;
-    if (end > maxVal) end = maxVal;
-    }
-else if (std == 0)
-    {
-    start = end = mean;
-    rangeIncludingZero(start, end, &start, &end);
-    }
-else
-    {
-    start = mean - 5*std;
-    end = mean + 5*std;
-    if (start < minVal) start = minVal;
-    if (end > maxVal) end = maxVal;
-    }
-*retStart = start;
-*retEnd = end;
-}
-
diff --git a/gbtools/src/blatSrc/lib/obscure.c b/gbtools/src/blatSrc/lib/obscure.c
deleted file mode 100644
index 0322d28..0000000
--- a/gbtools/src/blatSrc/lib/obscure.c
+++ /dev/null
@@ -1,823 +0,0 @@
-/* Obscure stuff that is handy every now and again. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include <unistd.h>
-#include "portable.h"
-#include "localmem.h"
-#include "hash.h"
-#include "obscure.h"
-#include "linefile.h"
-
-static int _dotForUserMod = 100; /* How often does dotForUser() output a dot. */
-
-long incCounterFile(char *fileName)
-/* Increment a 32 bit value on disk. */
-{
-long val = 0;
-FILE *f = fopen(fileName, "r+b");
-if (f != NULL)
-    {
-    mustReadOne(f, val);
-    rewind(f);
-    }
-else
-    {
-    f = fopen(fileName, "wb");
-    }
-++val;
-if (f != NULL)
-    {
-    fwrite(&val, sizeof(val), 1, f);
-    if (fclose(f) != 0)
-        errnoAbort("fclose failed");
-    }
-return val;
-}
-
-int digitsBaseTwo(unsigned long x)
-/* Return base two # of digits. */
-{
-int digits = 0;
-while (x)
-    {
-    digits += 1;
-    x >>= 1;
-    }
-return digits;
-}
-
-int digitsBaseTen(int x)
-/* Return number of digits base 10. */
-{
-int digCount = 1;
-if (x < 0)
-    {
-    digCount = 2;
-    x = -x;
-    }
-while (x >= 10)
-    {
-    digCount += 1;
-    x /= 10;
-    }
-return digCount;
-}
-
-void writeGulp(char *file, char *buf, int size)
-/* Write out a bunch of memory. */
-{
-FILE *f = mustOpen(file, "w");
-mustWrite(f, buf, size);
-carefulClose(&f);
-}
-
-void readInGulp(char *fileName, char **retBuf, size_t *retSize)
-/* Read whole file in one big gulp. */
-{
-size_t size = (size_t)fileSize(fileName);
-char *buf;
-FILE *f = mustOpen(fileName, "rb");
-*retBuf = buf = needLargeMem(size+1);
-mustRead(f, buf, size);
-buf[size] = 0;      /* Just in case it needs zero termination. */
-fclose(f);
-if (retSize != NULL)
-    *retSize = size;
-}
-
-void readAllWords(char *fileName, char ***retWords, int *retWordCount, char **retBuf)
-/* Read in whole file and break it into words. You need to freeMem both
- * *retWordCount and *retBuf when done. */
-{
-int wordCount;
-char *buf = NULL;
-char **words = NULL;
-size_t bufSize;
-
-readInGulp(fileName, &buf, &bufSize);
-wordCount = chopByWhite(buf, NULL, 0);
-if (wordCount != 0)
-    {
-    words = needMem(wordCount * sizeof(words[0]));
-    chopByWhite(buf, words, wordCount);
-    }
-*retWords = words;
-*retWordCount = wordCount;
-*retBuf = buf;
-}
-
-int countWordsInFile(char *fileName)
-/* Count number of words in file. */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *line;
-int wordCount = 0;
-while (lineFileNext(lf, &line, NULL))
-    wordCount += chopByWhite(line, NULL, 0);
-lineFileClose(&lf);
-return wordCount;
-}
-
-struct hash *hashWordsInFile(char *fileName, int hashSize)
-/* Create a hash of space delimited words in file. */
-{
-struct hash *hash = newHash(hashSize);
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *line, *word;
-while (lineFileNext(lf, &line, NULL))
-    {
-    while ((word = nextWord(&line)) != NULL)
-        hashAdd(hash, word, NULL);
-    }
-lineFileClose(&lf);
-return hash;
-}
-
-struct hash *hashNameIntFile(char *fileName)
-/* Given a two column file (name, integer value) return a
- * hash keyed by name with integer values */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *row[2];
-struct hash *hash = hashNew(16);
-while (lineFileRow(lf, row))
-    hashAddInt(hash, row[0], lineFileNeedNum(lf, row, 1));
-lineFileClose(&lf);
-return hash;
-}
-
-struct hash *hashTwoColumnFile(char *fileName)
-/* Given a two column file (key, value) return a hash. */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *row[2];
-struct hash *hash = hashNew(16);
-while (lineFileRow(lf, row))
-    {
-    char *name = row[0];
-    char *value = lmCloneString(hash->lm, row[1]);
-    hashAdd(hash, name, value);
-    }
-lineFileClose(&lf);
-return hash;
-}
-
-struct slName *readAllLines(char *fileName)
-/* Read all lines of file into a list.  (Removes trailing carriage return.) */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct slName *list = NULL, *el;
-char *line;
-
-while (lineFileNext(lf, &line, NULL))
-     {
-     el = newSlName(line);
-     slAddHead(&list, el);
-     }
-lineFileClose(&lf);
-slReverse(&list);
-return list;
-}
-
-void copyFile(char *source, char *dest)
-/* Copy file from source to dest. */
-{
-int bufSize = 64*1024;
-char *buf = needMem(bufSize);
-int bytesRead;
-int s, d;
-
-s = open(source, O_RDONLY);
-if (s < 0)
-    errAbort("Couldn't open %s. %s\n", source, strerror(errno));
-d = creat(dest, 0777);
-if (d < 0)
-    {
-    close(s);
-    errAbort("Couldn't open %s. %s\n", dest, strerror(errno));
-    }
-while ((bytesRead = read(s, buf, bufSize)) > 0)
-    {
-    if (write(d, buf, bytesRead) < 0)
-        errAbort("Write error on %s. %s\n", dest, strerror(errno));
-    }
-close(s);
-if (close(d) != 0)
-    errnoAbort("close failed");
-freeMem(buf);
-}
-
-void copyOpenFile(FILE *inFh, FILE *outFh)
-/* copy an open stdio file */
-{
-int c;
-while ((c = fgetc(inFh)) != EOF)
-    fputc(c, outFh);
-if (ferror(inFh))
-    errnoAbort("file read failed");
-if (ferror(outFh))
-    errnoAbort("file write failed");
-}
-
-void cpFile(int s, int d)
-/* Copy from source file to dest until reach end of file. */
-{
-int bufSize = 64*1024, readSize;
-char *buf = needMem(bufSize);
-
-for (;;)
-    {
-    readSize = read(s, buf, bufSize);
-    if (readSize > 0)
-        mustWriteFd(d, buf, readSize);
-    if (readSize <= 0)
-        break;
-    }
-freeMem(buf);
-}
-
-void *intToPt(int i)
-/* Convert integer to pointer. Use when really want to store an
- * int in a pointer field. */
-{
-char *pt = NULL;
-return pt+i;
-}
-
-int ptToInt(void *pt)
-/* Convert pointer to integer.  Use when really want to store a
- * pointer in an int. */
-{
-char *a = NULL, *b = pt;
-return b - a;
-}
-
-void *sizetToPt(size_t i)
-/* Convert size_t to pointer. Use when really want to store a
- * size_t in a pointer. */
-{
-char *pt = NULL;
-return pt+i;
-}
-
-size_t ptToSizet(void *pt)
-/* Convert pointer to size_t.  Use when really want to store a
- * pointer in a size_t. */
-{
-char *a = NULL, *b = pt;
-return b - a;
-}
-
-boolean parseQuotedStringNoEscapes( char *in, char *out, char **retNext)
-/* Read quoted string from in (which should begin with first quote).
- * Write unquoted string to out, which may be the same as in.
- * Return pointer to character past end of string in *retNext. 
- * Return FALSE if can't find end.
- * Unlike parseQuotedString() do not treat backslash as an escape
- *	character, merely pass it on through.
- */
-{
-char c, *s = in;
-int quoteChar = *s++;
-
-for (;;)
-   {
-   c = *s++;
-   if (c == 0)
-       {
-       warn("Unmatched %c", quoteChar);
-       return FALSE;
-       }
-   else if (c == quoteChar)
-       break;
-   else
-       *out++ = c;
-   }
-*out = 0;
-if (retNext != NULL)
-    *retNext = s;
-return TRUE;
-}
-
-boolean parseQuotedString( char *in, char *out, char **retNext)
-/* Read quoted string from in (which should begin with first quote).
- * Write unquoted string to out, which may be the same as in.
- * Return pointer to character past end of string in *retNext. 
- * Return FALSE if can't find end. */
-{
-char c, *s = in;
-int quoteChar = *s++;
-boolean escaped = FALSE;
-
-for (;;)
-   {
-   c = *s++;
-   if (c == 0)
-       {
-       warn("Unmatched %c", quoteChar);
-       return FALSE;
-       }
-   if (escaped)
-       {
-       if (c == '\\' || c == quoteChar)
-          *out++ = c;
-       else
-          {
-	  *out++ = '\\';
-	  *out++ = c;
-	  }
-       escaped = FALSE;
-       }
-   else
-       {
-       if (c == '\\')
-           escaped = TRUE;
-       else if (c == quoteChar)
-           break;
-       else
-           *out++ = c;
-       }
-   }
-*out = 0;
-if (retNext != NULL)
-    *retNext = s;
-return TRUE;
-}
-
-char *nextQuotedWord(char **pLine)
-/* Generalization of nextWord.  Returns next quoted
- * string or if no quotes next word.  Updates *pLine
- * to point past word that is returned. Does not return
- * quotes. */
-{
-char *line, c;
-line = skipLeadingSpaces(*pLine);
-if (line == NULL || line[0] == 0)
-    return NULL;
-c = *line;
-if (c == '"' || c == '\'')
-    {
-    if (!parseQuotedString(line, line, pLine))
-        return NULL;
-    return line;
-    }
-else
-    {
-    return nextWord(pLine);
-    }
-}
-
-void escCopy(char *in, char *out, char toEscape, char escape)
-/* Copy in to out, escaping as needed.  Out better be big enough. 
- * (Worst case is strlen(in)*2 + 1.) */
-{
-char c;
-for (;;)
-    {
-    c = *in++;
-    if (c == toEscape)
-        *out++ = escape;
-    *out++ = c;
-    if (c == 0)
-        break;
-    }
-}
-
-char *makeEscapedString(char *in, char toEscape)
-/* Return string that is a copy of in, but with all
- * toEscape characters preceded by '\' 
- * When done freeMem result. */
-{
-int newSize = strlen(in) + countChars(in, toEscape);
-char *out = needMem(newSize+1);
-escCopy(in, out, toEscape, '\\');
-return out;
-}
-
-char *makeQuotedString(char *in, char quoteChar)
-/* Create a string surrounded by quoteChar, with internal
- * quoteChars escaped.  freeMem result when done. */
-{
-int newSize = 2 + strlen(in) + countChars(in, quoteChar);
-char *out = needMem(newSize+1);
-out[0] = quoteChar;
-escCopy(in, out+1, quoteChar, '\\');
-out[newSize-1] = quoteChar;
-return out;
-}
-
-struct hash *hashThisEqThatLine(char *line, int lineIx, boolean firstStartsWithLetter)
-/* Return a symbol table from a line of form:
- *   1-this1=val1 2-this='quoted val2' var3="another val" 
- * If firstStartsWithLetter is true, then the left side of the equals must start with
- * a letter. */
-{
-char *dupe = cloneString(line);
-char *s = dupe, c;
-char *var, *val;
-struct hash *hash = newHash(8);
-
-for (;;)
-    {
-    if ((var = skipLeadingSpaces(s)) == NULL)
-        break;
-
-    if ((c = *var) == 0)
-        break;
-    if (firstStartsWithLetter && !isalpha(c))
-	errAbort("line %d of custom input: variable needs to start with letter '%s'", lineIx, var);
-    val = strchr(var, '=');
-    if (val == NULL)
-        {
-        errAbort("line %d of var %s in custom input: %s \n missing = in var/val pair", lineIx, var, line);
-        }
-    *val++ = 0;
-    c = *val;
-    if (c == '\'' || c == '"')
-        {
-	if (!parseQuotedString(val, val, &s))
-	    errAbort("line %d of input: missing closing %c", lineIx, c);
-	}
-    else
-	{
-	s = skipToSpaces(val);
-	if (s != NULL) *s++ = 0;
-	}
-    hashAdd(hash, var, cloneString(val));
-    }
-freez(&dupe);
-return hash;
-}
-
-struct hash *hashVarLine(char *line, int lineIx)
-/* Return a symbol table from a line of form:
- *   var1=val1 var2='quoted val2' var3="another val" */
-{
-return hashThisEqThatLine(line, lineIx, TRUE);
-}
-
-struct slName *stringToSlNames(char *string)
-/* Convert string to a list of slNames separated by
- * white space, but allowing multiple words in quotes.
- * Quotes if any are stripped.  */
-{
-struct slName *list = NULL, *name;
-char *dupe = cloneString(string);
-char c, *s = dupe, *e;
-
-for (;;)
-    {
-    if ((s = skipLeadingSpaces(s)) == NULL)
-        break;
-    if ((c = *s) == 0)
-        break;
-    if (c == '\'' || c == '"')
-        {
-	if (!parseQuotedString(s, s, &e))
-	    errAbort("missing closing %c in %s", c, string);
-	}
-    else
-        {
-	e = skipToSpaces(s);
-	if (e != NULL) *e++ = 0;
-	}
-    name = slNameNew(s);
-    slAddHead(&list, name);
-    s = e;
-    }
-freeMem(dupe);
-slReverse(&list);
-return list;
-}
-
-struct slName *charSepToSlNames(char *string, char c)
-/* Convert character-separated list of items to slName list. 
- * Note that the last occurence of c is optional.  (That
- * is for a comma-separated list a,b,c and a,b,c, are
- * equivalent. */
-{
-struct slName *list = NULL, *el;
-char *s, *e;
-
-s = string;
-while (s != NULL && s[0] != 0)
-    {
-    e = strchr(s, c);
-    if (e == NULL)
-        {
-	el = slNameNew(s);
-	slAddHead(&list, el);
-	break;
-	}
-    else
-        {
-	el = slNameNewN(s, e - s);
-	slAddHead(&list, el);
-	s = e+1;
-	}
-    }
-slReverse(&list);
-return list;
-}
-
-struct slName *commaSepToSlNames(char *commaSep)
-/* Convert comma-separated list of items to slName list.  */
-{
-return charSepToSlNames(commaSep, ',');
-}
-
-
-void sprintLongWithCommas(char *s, long long l)
-/* Print out a long number with commas a thousands, millions, etc. */
-{
-long long trillions, billions, millions, thousands;
-if (l >= 1000000000000LL)
-    {
-    trillions = l/1000000000000LL;
-    l -= trillions * 1000000000000LL;
-    billions = l/1000000000;
-    l -= billions * 1000000000;
-    millions = l/1000000;
-    l -= millions * 1000000;
-    thousands = l/1000;
-    l -= thousands * 1000;
-    sprintf(s, "%lld,%03lld,%03lld,%03lld,%03lld", trillions, billions, millions, thousands, l);
-    }
-else if (l >= 1000000000)
-    {
-    billions = l/1000000000;
-    l -= billions * 1000000000;
-    millions = l/1000000;
-    l -= millions * 1000000;
-    thousands = l/1000;
-    l -= thousands * 1000;
-    sprintf(s, "%lld,%03lld,%03lld,%03lld", billions, millions, thousands, l);
-    }
-else if (l >= 1000000)
-    {
-    millions = l/1000000;
-    l -= millions * (long long)1000000;
-    thousands = l/1000;
-    l -= thousands * 1000;
-    sprintf(s, "%lld,%03lld,%03lld", millions, thousands, l);
-    }
-else if (l >= 1000)
-    {
-    thousands = l/1000;
-    l -= thousands * 1000;
-    sprintf(s, "%lld,%03lld", thousands, l);
-    }
-else
-    sprintf(s, "%lld", l);
-}
-
-void printLongWithCommas(FILE *f, long long l)
-/* Print out a long number with commas at thousands, millions, etc. */
-{
-char ascii[32];
-sprintLongWithCommas(ascii, l);
-fprintf(f, "%s", ascii);
-}
-
-void sprintWithGreekByte(char *s, int slength, long long size)
-/* Numbers formatted with PB, TB, GB, MB, KB, B */
-{
-char *greek[] = {"B", "KB", "MB", "GB", "TB", "PB"};
-int i = 0;
-long long d = 1;
-while ((size/d) >= 1024)
-    {
-    ++i;
-    d *= 1024;
-    }
-double result = ((double)size)/d;
-if (result < 10)
-    safef(s,slength,"%3.1f %s",((double)size)/d, greek[i]);
-else
-    safef(s,slength,"%3.0f %s",((double)size)/d, greek[i]);
-}
-
-void shuffleArrayOfChars(char *array, int arraySize)
-/* Shuffle array of characters of given size given number of times. */
-{
-char c;
-int i, randIx;
-
-/* Randomly permute an array using the method from Cormen, et al */
-for (i=0; i<arraySize; ++i)
-    {
-    randIx = i + (rand() % (arraySize - i));
-    c = array[i];
-    array[i] = array[randIx];
-    array[randIx] = c;
-    }
-}
-
-void shuffleArrayOfInts(int *array, int arraySize)
-/* Shuffle array of ints of given size given number of times. */
-{
-int c;
-int i, randIx;
-
-/* Randomly permute an array using the method from Cormen, et al */
-for (i=0; i<arraySize; ++i)
-    {
-    randIx = i + (rand() % (arraySize - i));
-    c = array[i];
-    array[i] = array[randIx];
-    array[randIx] = c;
-    }
-}
-
-void shuffleArrayOfPointers(void *pointerArray, int arraySize)
-/* Shuffle array of pointers of given size given number of times. */
-{
-void **array = pointerArray, *pt;
-int i, randIx;
-
-/* Randomly permute an array using the method from Cormen, et al */
-for (i=0; i<arraySize; ++i)
-    {
-    randIx = i + (rand() % (arraySize - i));
-    pt = array[i];
-    array[i] = array[randIx];
-    array[randIx] = pt;
-    }
-}
-
-void shuffleList(void *pList)
-/* Randomize order of slList.  Usage:
- *     randomizeList(&list)
- * where list is a pointer to a structure that
- * begins with a next field. */
-{
-struct slList **pL = (struct slList **)pList;
-struct slList *list = *pL;
-int count;
-count = slCount(list);
-if (count > 1)
-    {
-    struct slList *el;
-    struct slList **array;
-    int i;
-    array = needLargeMem(count * sizeof(*array));
-    for (el = list, i=0; el != NULL; el = el->next, i++)
-        array[i] = el;
-    for (i=0; i<4; ++i)
-        shuffleArrayOfPointers(array, count);
-    list = NULL;
-    for (i=0; i<count; ++i)
-        {
-        array[i]->next = list;
-        list = array[i];
-        }
-    freeMem(array);
-    slReverse(&list);
-    *pL = list;       
-    }
-}
-
-void *slListRandomReduce(void *list, double reduceRatio)
-/* Reduce list to approximately reduceRatio times original size. Destroys original list. */
-{
-if (reduceRatio >= 1.0)
-    return list;
-int threshold = RAND_MAX * reduceRatio;
-struct slList *newList = NULL, *next, *el;
-for (el = list; el != NULL; el = next)
-    {
-    next = el->next;
-    if (rand() <= threshold)
-        {
-	slAddHead(&newList, el);
-	}
-    }
-return newList;
-}
-
-void *slListRandomSample(void *list, int maxCount)
-/* Return a sublist of list with at most maxCount. Destroy list in process */
-{
-if (list == NULL)
-    return list;
-int initialCount = slCount(list);
-if (initialCount <= maxCount)
-    return list;
-double reduceRatio = (double)maxCount/initialCount;
-if (reduceRatio < 0.9)
-    {
-    double conservativeReduceRatio = reduceRatio * 1.05;
-    list = slListRandomReduce(list, conservativeReduceRatio);
-    }
-int midCount = slCount(list);
-if (midCount <= maxCount)
-    return list;
-shuffleList(list);
-struct slList *lastEl = slElementFromIx(list, maxCount-1);
-lastEl->next = NULL;
-return list;
-}
-
-
-char *stripCommas(char *position)
-/* make a new string with commas stripped out */
-{
-char *newPos = cloneString(position);
-char *nPtr = newPos;
-
-if (position == NULL)
-    return NULL;
-while((*nPtr = *position++))
-    if (*nPtr != ',')
-	nPtr++;
-
-return newPos;
-}
-
-void dotForUserInit(int dotMod)
-/* Set how often dotForUser() outputs a dot. */
-{
-assert(dotMod > 0);
-_dotForUserMod = dotMod;
-}
-
-void dotForUser()
-/* Write out a dot every _dotForUserMod times this is called. */
-{
-static int dot = -10;
-/* Check to see if dot has been initialized. */
-if(dot == - 10)
-    dot = _dotForUserMod;
-
-if (--dot <= 0)
-    {
-    putc('.', stderr);
-    fflush(stderr);
-    dot = _dotForUserMod;
-    }
-}
-
-void spaceToUnderbar(char *s)
-/* Convert white space to underbar. */
-{
-char c;
-while ((c = *s) != 0)
-    {
-    if (isspace(c))
-        *s = '_';
-    ++s;
-    }
-}
-
-void printVmPeak()
-/* print to stderr peak Vm memory usage (if /proc/ business exists) */
-{
-pid_t pid = getpid();
-char temp[256];
-safef(temp, sizeof(temp), "/proc/%d/status", (int) pid);
-struct lineFile *lf = lineFileMayOpen(temp, TRUE);
-if (lf)
-    {
-    char *line;
-    while (lineFileNextReal(lf, &line))
-	{
-	if (stringIn("VmPeak", line))
-	    {
-	    fprintf(stderr, "# pid=%d: %s\n", pid, line);
-	    break;
-	    }
-	}
-    lineFileClose(&lf);
-    }
-else
-    fprintf(stderr, "# printVmPeak: %s - not available\n", temp);
-fflush(stderr);
-}
-
-boolean nameInCommaList(char *name, char *commaList)
-/* Return TRUE if name is in comma separated list. */
-{
-if (commaList == NULL)
-    return FALSE;
-int nameLen = strlen(name);
-for (;;)
-    {
-    char c = *commaList;
-    if (c == 0)
-        return FALSE;
-    if (memcmp(name, commaList, nameLen) == 0)
-        {
-	c = commaList[nameLen];
-	if (c == 0 || c == ',')
-	    return TRUE;
-	}
-    commaList = strchr(commaList, ',');
-    if (commaList == NULL)
-        return FALSE;
-    commaList += 1;
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/oldGff.c b/gbtools/src/blatSrc/lib/oldGff.c
deleted file mode 100644
index 602d2b2..0000000
--- a/gbtools/src/blatSrc/lib/oldGff.c
+++ /dev/null
@@ -1,643 +0,0 @@
-/* oldGff - module for reading GFFs.  This is largely if not
- * entirely superceded by the gff module. 
- *
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "oldGff.h"
-#include "dnaseq.h"
-#include "htmshell.h"
-#include "portable.h"
-#include "localmem.h"
-
-
-#define errfile stdout
-
-static char _gffIdent[] = "##gff-version";
-
-struct gffSegLine
-    {
-    char seqname[64];   /* Name of DNA sequence this refers to. */
-    char source[64];	/* Who put this segment here... */
-    char feature[64];      /* CDS, E, I, exon, intron, ??? */
-    long start, end;   /* Offsets into DNA array, end inclusive */
-    char score[62];	/* A number between 0 and 1 */
-    char strand[4];	/* + or - */
-    char frame[4];     /* 0, 1, 2, or . */
-    char group[128];  /* Name of gene  cosmid.number. */
-    };
-
-static int gffSegLineScan(struct gff* gff, struct gffSegLine *seg)
-{
-    int scanned = sscanf(gff->buf, "%s %s %s %ld %ld %s %1s %s %s",
-	seg->seqname, seg->source, seg->feature,
-	&seg->start, &seg->end,
-	seg->score, seg->strand, seg->frame, seg->group);
-    return scanned;
-}
-
-static boolean _gffGetLine(struct gff *gff)
-/* Get the next line into a gff file.  (private)
- * return FALSE at EOF or if problem. */
-{
-char *s;
-s = fgets(gff->buf, gff->bufSize, gff->file);
-if (s == NULL)
-    {
-    return FALSE;
-    }
-gff->bytesInBuf = strlen(gff->buf);
-gff->readIx = 0;
-gff->lineNumber += 1;
-return TRUE;
-}
-
-static boolean _gffSeekDoubleSharpLine(struct gff *gff)
-/* Go find next line that begins with ## */
-{
-for (;;)
-    {
-    if (!_gffGetLine(gff)) return FALSE;
-    if (gff->bytesInBuf >= 2)
-	if (gff->buf[0] == '#' && gff->buf[1] == '#') 
-		return TRUE;
-    }
-}
-
-boolean gffOpen(struct gff *gff, char *fileName)
-/* Initialize gff structure and open file for it. */
-{
-    dnaUtilOpen();
-
-    /* Initialize structure and open file. */
-    zeroBytes(gff, sizeof(*gff));
-    gff->memPool = lmInit(16*1024);
-    gff->fileSize = fileSize(fileName);
-    if (gff->fileSize < 0 ||
-       (gff->file = fopen(fileName, "rb")) == NULL)
-	    {
-            warn("Couldn't find the file named %s\n", fileName);
-	    return FALSE;
-	    }
-    strcpy(gff->fileName, fileName);
-    gff->bufSize = ArraySize(gff->buf);
-
-    /* Make sure it's a gff file. */
-    _gffSeekDoubleSharpLine(gff);
-    if (strncmp(gff->buf, _gffIdent, strlen(_gffIdent)) != 0)
-	{
-	warn("%s doesn't appear to be a .gff file\n", fileName);
-	return FALSE;
-	}
-
-    return TRUE;
-}
-
-void gffClose(struct gff *gff)
-/* Close down gff structure. */
-{
-if (gff->file != NULL)
-    fclose(gff->file);
-freeMem(gff->dna);
-lmCleanup(&gff->memPool);
-zeroBytes(gff, sizeof(*gff));
-}
-
-#if 0 /* unused */
-static boolean _gffAtEof(struct gff *gff)
-/* Returns TRUE if at the end of gff file. */
-{
-return gff->file == NULL;
-}
-#endif	
-
-#if 0 /* unused */
-static char _getGffChar(struct gff *gff)
-/* Return next byte (not next base) in gff file. Return zero
- * if at end of file. */
-{
-if (gff->readIx >= gff->bytesInBuf)
-	{
-	if (!_gffGetLine(gff)) return 0;
-	}
-return gff->buf[gff->readIx++];
-}
-#endif
-
-static boolean _gffSeekDna(struct gff *gff)
-/* Skip through file until you get the DNA */ 
-{
-static char dnaIdent[] = "##DNA";
-
-rewind(gff->file);
-for (;;)
-    {
-    if (!_gffGetLine(gff)) return FALSE;
-    if (strncmp(gff->buf, dnaIdent, strlen(dnaIdent)) == 0)
-	{
-	sscanf(gff->buf, "##DNA %s", gff->dnaName);
-	gff->bytesInBuf = 0; /* We're done with gff line. */
-	return TRUE;
-	}
-    }
-}
-
-static boolean gffNextDnaLine(struct gff *gff)
-/* Fetches next line of DNA. */
-{
-static char endIdent[] = "##end-DNA";
-
-if (!_gffSeekDoubleSharpLine(gff)) 
-    return FALSE;
-/* Check to see if have reached end of DNA sequence */
-if (strncmp(gff->buf, endIdent, strlen(endIdent))==0)
-    {
-    gff->bytesInBuf = 0; /* We're done with gff line. */
-    return FALSE;
-    }
-return TRUE;
-}
-
-boolean gffReadDna(struct gff *gff)
-/* Read all the DNA in a file. */
-{
-long dnaSize = 0;
-DNA *dna;
-DNA *line;
-int lineCount;
-DNA b;
-if (gff->dna != NULL)
-	return TRUE; /* We already read it. */
-if (!_gffSeekDna(gff))
-	return FALSE;
-if ((gff->dna = wantMem(gff->fileSize)) == NULL)
-    {
-    warn("Couldn't allocate %ld bytes for DNA\n",
-    	gff->fileSize);
-    return FALSE;
-    }
-dna = gff->dna;
-for (;;)
-    {
-    if (!gffNextDnaLine(gff))
-        break;
-    line = gff->buf + gff->readIx;
-    lineCount = gff->bytesInBuf-gff->readIx;
-    while (--lineCount >= 0)
-        {
-        b = *line++;
-        if ((b = ntChars[(int)b]) != 0)
-            {
-            *dna++ = b;
-            dnaSize += 1;
-            }
-        }
-    }
-gff->dnaSize = dnaSize;
-return TRUE;
-}
-
-struct gffGene *gffFindGene(struct gff *gff, char *geneName)
-/* Find gene with given name.  Case sensitive. */
-{
-struct gffGene *g;
-
-for (g=gff->genes; g!=NULL; g=g->next)
-    {
-    if (strcmp(geneName, g->name) == 0)
-	return g;
-    }
-return NULL;
-}
-
-struct gffGene *gffFindGeneIgnoreCase(struct gff *gff, char *geneName)
-/* Find gene with given name.  Not case sensitive. */
-{
-struct gffGene *g;
-
-for (g=gff->genes; g!=NULL; g=g->next)
-    {
-    if (differentWord(geneName, g->name) == 0)
-	return g;
-    }
-return NULL;
-}
-
-/* Allocate memory and clear it to zero.  Report error
- * and kill program if can't allocate it. */
-static void *gffNeedMem(struct gff *gff, int size)
-{
-return lmAlloc(gff->memPool, size);
-}
-
-static void gffSegmentInsertSort(struct gffSegment **plist, 
-	struct gffSegment *seg)
-/* Insert segment on list, keeping list ordered by start field 
-   parameters:
-         gffSegment **plist;	 Pointer to list. 
-         gffSegment *seg;	 Segment to insert 
- */
-{
-struct gffSegment *next;
-long segStart = seg->start;
-
-for (;;)
-    {
-    next = *plist;
-    if (next == NULL)
-	break;
-    if (next->start > segStart)
-	break;
-    plist = &(next->next);
-    }
-seg->next = next;   
-*plist = seg;
-}
-
-static void offsetsFromExons(struct gffGene *gene)
-/* Figure out start and end offsets of gene from it's exons. */
-{
-GffExon *exon;
-long end = 0;
-long start = 0x7fffffff; /* I should use a .h file constant here... */
-for (exon = gene->exons; exon != NULL; exon = exon->next)
-    {
-    if (exon->start < start)
-	start = exon->start;
-    if (exon->end > end)
-	end = exon->end;
-    }
-gene->start = start;
-gene->end = end;
-}
-
-void gffPrintInfo(struct gff *gff, FILE *out)
-/* Print summary info about file. */
-{
-struct gffGene *gene;
-
-fprintf(out, "\n%s\n", gff->fileName);
-fprintf(out, "DNA %s (%ld bases)\n", 
-	gff->dnaName, gff->dnaSize);
-fprintf(out, "%d genes\n", slCount(gff->genes));
-for (gene = gff->genes; gene != NULL; gene = gene->next)
-    {
-    fprintf(out, "gene %s has %ld bases, %d exons, %d introns\n",
-	gene->name, gene->end - gene->start + 1,
-	slCount(gene->exons), slCount(gene->introns));
-    }
-}
-
-static boolean checkWordCount(struct gff *gff, int wordCount)
-{
-if (wordCount >= 9)
-    return TRUE;
-else
-    {
-    warn("???%s???\n", gff->buf);
-    warn("Can't handle line %d of %s.\n", 
-	    gff->lineNumber, gff->fileName);
-    return FALSE;
-    }
-}
-
-boolean gffReadGenes(struct gff *gff)
-/* Read all the gene (as opposed to base) info in file. */
-{
-int wordCount;
-struct gffSegLine seg;
-char curGroup[128];
-struct gffGene *gene = NULL;
-GffIntron *intron = NULL;
-GffExon *exon = NULL;
-boolean warnedUnknown = FALSE;
-boolean isNewGene;
-
-curGroup[0] = 0; /* Start off with no group */
-
-/* Line scanning loop. */
-for (;;)
-    {
-    /* Get next line and parse it into segLine data structure. */
-    if (!_gffGetLine(gff)) 
-	break;	 /* End of file. */
-    if (gff->buf[0] == '#')
-	continue; /* Ignore sharp containing lines. */
-    wordCount = gffSegLineScan(gff, &seg);
-    if (wordCount < 9)
-	continue; /* Ignore blank lines and short ones. */
-
-    /* Make sure that start is less than or equal end. */
-    if (seg.start > seg.end)
-	{
-	warn("start greater than end line %d of %s.\n",
-		gff->lineNumber, gff->fileName);
-	return FALSE;
-	}
-
-    /* Get the gene we're working on.  First see if
-     * it's the same as last time around. */
-    isNewGene = FALSE;
-    if (strcmp(seg.group, curGroup) != 0)
-	{
-	strcpy(curGroup, seg.group);
-	if ((gene = gffFindGene(gff, seg.group)) == NULL)
-	    {
-	    /* It's a new gene! */
-	    if (!checkWordCount(gff, wordCount)) return FALSE;
-	    isNewGene = TRUE;
-	    gene = gffNeedMem(gff, sizeof(*gene));
-	    strcpy(gene->name, seg.group);
-	    slAddTail(&gff->genes, gene); 
-	    gene->strand = seg.strand[0];
-	    gene->frame = atoi(seg.frame);
-	    if (differentWord(seg.feature, "CDS") == 0)
-		{
-		gene->start = seg.start-1;
-		gene->end = seg.end-1;
-		}
-	    }
-	}
-
-    /* Look at what sort of feature it is, and decide what to do. */
-
-    if (differentWord(seg.feature, "CDS")==0)
-	{
-	/* CDS (coding segments) have been processed already
-	 * for the most part. Here just make sure they aren't
-	 * duplicated. */
-	if (!checkWordCount(gff, wordCount)) return FALSE;
-	if (!isNewGene)
-	    {
-	    if (gene->start != 0 || gene->end != 0)
-		{
-		warn("Warning duplicate CDS for %s\n",
-			seg.group);
-		warn("Line %d of %s\n", 
-			gff->lineNumber, gff->fileName);
-		}
-	    }
-	}
-    else if (differentWord(seg.feature, "SE") == 0 
-	||   differentWord(seg.feature, "IE") == 0
-	||   differentWord(seg.feature, "FE") == 0
-	||   differentWord(seg.feature, "E") == 0
-	||   differentWord(seg.feature, "exon") == 0)
-	{
-	/* It's some sort of exon.  We'll deal with the complications
-	 * of it being possibly on the minus strand later, so can
-	 * tread initial, final, single, and regular exons the same
-	 * here. */
-	if (!checkWordCount(gff, wordCount)) return FALSE;
-	exon = gffNeedMem(gff, sizeof(*exon));
-	exon->start = seg.start-1;
-	exon->end = seg.end-1;
-	exon->frame = atoi(seg.frame);
-	gffSegmentInsertSort(&gene->exons, exon);
-	}
-    else if (differentWord(seg.feature, "I") == 0 
-	||   differentWord(seg.feature, "intron") == 0)
-	{
-	/* It's an intron. */
-	if (!checkWordCount(gff, wordCount)) return FALSE;
-	intron = gffNeedMem(gff, sizeof(*intron));
-	intron->start = seg.start-1;
-	intron->end = seg.end-1;
-	intron->frame = atoi(seg.frame);
-	gffSegmentInsertSort(&gene->introns, intron);
-	}
-    else if (strcmp(seg.feature, "IG")  == 0)
-	{
-	/* I don't know what it is, but we can ignore it. */
-	}
-    else
-	{
-	if (!warnedUnknown)
-	    {
-	    warn("Unknown feature %s line %d of %s, ignoring\n",
-		    seg.feature,  gff->lineNumber, gff->fileName);
-	    warnedUnknown = TRUE;
-	    }
-	}
-    }
-
-/* Fix up gene length from exons if needed. */
-for (gene = gff->genes; gene != NULL; gene = gene->next)
-    {
-    if (gene->start >= gene->end)
-	{
-	offsetsFromExons(gene);
-	}
-    }
-return TRUE;
-}
-
-static boolean geneDna(struct gff *gff, struct gffGene *gene,
-    int leftExtra, int rightExtra, char **retDna, long *retDnaSize,
-    int *retStartOffset)
-/* Allocate an array and fill it with dna from a gene. */
-{
-char *dna;
-char *pt;
-long geneSize;
-long i;
-long seqStart, seqEnd, seqSize;
-
-/* Filter out unreasonable looking genes - input to this
- * program isn't totally clean. */
-geneSize = gene->end - gene->start + 1;
-if (geneSize <= 0 || geneSize >= 1000000)
-    return FALSE;  
-
-/* Figure out extents of DNA we're going to return.
- * Return extra they ask for if possible, but clip
- * it to what is actually in GFF file. */
-seqStart = gene->start - leftExtra;
-seqEnd = gene->end + rightExtra + 1;
-if (seqStart < 0)
-    seqStart = 0;
-if (seqEnd > gff->dnaSize)
-    seqEnd = gff->dnaSize;
-seqSize = seqEnd - seqStart;
-
-/* Allocate memory and fetch the dna. */
-dna = needMem(seqSize+1);
-pt = dna;
-for (i=0; i<seqSize; i++)
-    *pt++ = gff->dna[seqStart+i];
-*pt = 0;
-
-/* Report results back to caller. */
-*retDna = dna;
-*retDnaSize = seqSize;
-*retStartOffset = (gene->start - seqStart);
-return TRUE;
-}
-
-static void fixDirectionAndOffsets(struct gffGene *gene, char *dna, long dnaSize, int newStart)
-/* Reverse complement DNA if gene is on negative strand.
- * Update offsets of exons and introns in gene to 
- * make them point into dna, rather than into gff->dna. 
- */
-{
-long oldStart;
-long offset;
-GffIntron *intron;
-GffExon *exon;
-long temp;
-
-oldStart = gene->start;
-offset = oldStart - newStart;
-gene->start -= offset;
-gene->end -= offset;
-for (intron = gene->introns; intron != NULL; intron = intron->next)
-    {
-    intron->start -= offset;
-    intron->end -= offset;
-    }
-for (exon = gene->exons; exon != NULL; exon = exon->next)
-    {
-    exon->start -= offset;
-    exon->end -= offset;
-    }
-if (gene->strand == '-')
-    {
-    reverseComplement(dna, dnaSize);
-    temp = reverseOffset(gene->start, dnaSize);
-    gene->start = reverseOffset(gene->end, dnaSize);
-    gene->end = temp;
-    for (intron = gene->introns; intron != NULL; intron = intron->next)
-	{
-	temp = reverseOffset(intron->start, dnaSize);
-	intron->start = reverseOffset(intron->end, dnaSize);
-	intron->end = temp;
-	}
-    for (exon = gene->exons; exon != NULL; exon = exon->next)
-	{
-	temp = reverseOffset(exon->start, dnaSize);
-	exon->start = reverseOffset(exon->end, dnaSize);
-	exon->end = temp;
-	}
-    slReverse(&gene->introns);
-    slReverse(&gene->exons);
-    gene->strand = '+';
-    }
-}
-
-static struct gffSegment *dupeSegmentList(struct gffSegment *oldList,
-	struct gffSegment *newList)
-/* Duplicate a segment list into array of fresh memory. */
-{
-struct gffSegment *oldEl, *newEl;
-
-if (oldList == NULL)
-    return NULL;
-for (oldEl = oldList, newEl = newList; oldEl != NULL; oldEl=oldEl->next, newEl += 1)
-    {
-    memcpy(newEl, oldEl, sizeof(*newEl));
-    newEl->next = ((oldEl->next == NULL) ? NULL : newEl+1);
-    }
-return newList;
-}
-
-struct gffGene *gffDupeGeneAndSurrounds(struct gff *gff, struct gffGene *oldGene,
-    int leftExtra, int rightExtra)
-/* Make a duplicate of gene with extra DNA around coding region. 
- * gffFreeGene it when done. */
-/* In a perhaps hair brained scheme to save some cycles,
- * the memory allocation of the intron and exon lists
- * is shared with that of the gffGene itself. */
-{
-struct gffGene *g;
-int intronCount = slCount(oldGene->introns);
-int exonCount = slCount(oldGene->exons);
-int memSize = sizeof(*g) + (intronCount + exonCount) * sizeof(struct gffSegment);
-char *memPt;
-int firstExonOffset;
-
-
-memPt = needMem(memSize);
-g = (struct gffGene *)memPt;
-memPt += sizeof(*g);
-g->exons = (struct gffSegment *)memPt;
-memPt += exonCount*sizeof(struct gffSegment);
-g->introns = (struct gffSegment *)memPt;
-
-g->next = NULL;
-g->start = oldGene->start;
-g->end = oldGene->end;
-g->strand = oldGene->strand;
-memcpy(g->name, oldGene->name, sizeof(g->name));
-g->exons = dupeSegmentList(oldGene->exons, g->exons);
-g->introns = dupeSegmentList(oldGene->introns, g->introns);
-if (!geneDna(gff, oldGene, leftExtra, rightExtra, 
-    &g->dna, &g->dnaSize, &firstExonOffset))
-    {
-    gffFreeGene(&g);
-    return NULL;
-    }
-fixDirectionAndOffsets(g, g->dna, g->dnaSize, firstExonOffset);
-return g;
-}
-
-struct gffGene *gffDupeGene(struct gff *gff, struct gffGene *oldGene)
-/* Make a duplicate of gene (with it's own DNA) */
-{
-return gffDupeGeneAndSurrounds(gff, oldGene, 0, 0);
-}
-
-struct gffGene *gffGeneWithOwnDna(struct gff *gff, char *geneName)
-/* Find gene with given name.  Case sensitive. */
-{
-struct gffGene *oldGene;
-
-oldGene = gffFindGeneIgnoreCase(gff, geneName);
-if (oldGene == NULL)
-    return NULL;
-return gffDupeGene(gff, oldGene);
-}
-
-void gffFreeGene(struct gffGene **pGene)
-/* Free a gene returned with dupeGene or geneWithOwnDna. 
- * (You don't want to free the ones returned by findGene,
- * they are still owned by the gff.)
- */
-{
-struct gffGene *g = *pGene;
-if (g == NULL)
-    return;
-freeMem(g->dna);
-freeMem(g);
-*pGene = NULL;
-}
-
-struct dnaSeq *gffReadDnaSeq(char *fileName)
-/* Open gff file and read DNA sequence from it. */
-{
-struct gff gff;
-struct dnaSeq *seq = NULL;
-
-if (!gffOpen(&gff, fileName))
-    return NULL;
-if (gffReadDna(&gff))
-    {
-    seq = newDnaSeq(gff.dna, gff.dnaSize, gff.dnaName);
-    gff.dna = NULL;
-    }
-gffClose(&gff);
-return seq;
-}
-
-boolean gffOpenAndRead(struct gff *gff, char *fileName)
-/* Open up gff file and read everything in it. */
-{
-if (gffOpen(gff, fileName))
-    if (gffReadDna(gff))
-	if (gffReadGenes(gff))
-	    return TRUE;
-gffClose(gff);
-return FALSE;
-}
diff --git a/gbtools/src/blatSrc/lib/oligoTm.c b/gbtools/src/blatSrc/lib/oligoTm.c
deleted file mode 100644
index 5a550f8..0000000
--- a/gbtools/src/blatSrc/lib/oligoTm.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/* oligoTm - calculate melting temperature of relatively short DNA sequences.
- * This is based on the nearest-neighbor thermodynamics of bases from Breslauer,
- * Frank, Bloecker, and Markey, Proc. Natl. Acad. Sci. USA, vol 83, page 3748,
- * and uses work from see Rychlik, Spencer, Roads, Nucleic Acids Research, vol 18, 
- * no 21.  This code was imported from the oligotm module of Whitehead Institute's
- * primer3 program, and adapted into UCSC conventions by Jim Kent.  Any redistribution
- * of this code should contain the following copyright notice from Whitehead:
- *
- * Copyright (c) 1996,1997,1998,1999,2000,2001,2004
- *         Whitehead Institute for Biomedical Research. All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 
- * 1.      Redistributions must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the  documentation
- * and/or other materials provided with the distribution.  Redistributions of
- * source code must also reproduce this information in the source code itself.
- * 
- * 2.      If the program is modified, redistributions must include a notice
- * (in the same places as above) indicating that the redistributed program is
- * not identical to the version distributed by Whitehead Institute.
- * 
- * 3.      All advertising materials mentioning features or use of this
- * software  must display the following acknowledgment:
- *         This product includes software developed by the
- *         Whitehead Institute for Biomedical Research.
- * 
- * 4.      The name of the Whitehead Institute may not be used to endorse or
- * promote products derived from this software without specific prior written
- * permission.
- * 
- * We also request that use of this software be cited in publications as 
- * 
- *   Rozen, S., Skaletsky, H.  \"Primer3 on the WWW for general users
- *   and for biologist programmers.\"  In S. Krawetz and S. Misener, eds.
- *   Bioinformatics Methods and Protocols in the series Methods in 
- *   Molecular Biology.  Humana Press, Totowa, NJ, 2000, pages 365-386.
- *   Code available at
- *   http://fokker.wi.mit.edu/primer3/.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE WHITEHEAD INSTITUTE ``AS IS'' AND  ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE  IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE  ARE
- * DISCLAIMED. IN NO EVENT SHALL THE WHITEHEAD INSTITUTE BE LIABLE  FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS  OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)  HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE. */
-
-
-
-#include "common.h"
-#include "oligoTm.h"
-
-
-/* 
- * Tables of nearest-neighbor thermodynamics for DNA bases.  See Breslauer,
- * Frank, Bloecker, and Markey, Proc. Natl. Acad. Sci. USA, vol 83, page 3748,
- * table 2.
- */
-#define S_A_A 240
-#define S_A_C 173
-#define S_A_G 208
-#define S_A_T 239
-#define S_A_N 215
-  
-#define S_C_A 129
-#define S_C_C 266
-#define S_C_G 278
-#define S_C_T 208
-#define S_C_N 220  
-  
-#define S_G_A 135
-#define S_G_C 267
-#define S_G_G 266
-#define S_G_T 173
-#define S_G_N 210
-  
-#define S_T_A 169
-#define S_T_C 135
-#define S_T_G 129
-#define S_T_T 240
-#define S_T_N 168
-  
-#define S_N_A 168
-#define S_N_C 210
-#define S_N_G 220
-#define S_N_T 215
-#define S_N_N 203
-
-
-#define H_A_A  91
-#define H_A_C  65
-#define H_A_G  78
-#define H_A_T  86
-#define H_A_N  80
-
-#define H_C_A  58
-#define H_C_C 110
-#define H_C_G 119
-#define H_C_T  78
-#define H_C_N  91
-
-#define H_G_A  56
-#define H_G_C 111
-#define H_G_G 110
-#define H_G_T  65
-#define H_G_N  85
-
-#define H_T_A  60
-#define H_T_C  56
-#define H_T_G  58
-#define H_T_T  91
-#define H_T_N  66
-
-#define H_N_A  66
-#define H_N_C  85
-#define H_N_G  91
-#define H_N_T  80
-#define H_N_N  80
-
-/* Delta G's of disruption * 1000. */
-#define G_A_A  1900
-#define G_A_C  1300
-#define G_A_G  1600
-#define G_A_T  1500
-#define G_A_N  1575
-
-#define G_C_A  1900 
-#define G_C_C  3100
-#define G_C_G  3600
-#define G_C_T  1600
-#define G_C_N  2550
-
-#define G_G_A  1600
-#define G_G_C  3100
-#define G_G_G  3100
-#define G_G_T  1300
-#define G_G_N  2275
-
-#define G_T_A   900
-#define G_T_C  1600
-#define G_T_G  1900
-#define G_T_T  1900
-#define G_T_N  1575
-
-#define G_N_A  1575
-#define G_N_C  2275
-#define G_N_G  2550
-#define G_N_T  1575
-#define G_N_N  1994
-
-#define A_CHAR 'A'
-#define G_CHAR 'G'
-#define T_CHAR 'T'
-#define C_CHAR 'C'
-#define N_CHAR 'N'
-
-#define CATID5(A,B,C,D,E) A##B##C##D##E
-#define CATID2(A,B) A##B
-#define DO_PAIR(LAST,THIS)          \
-  if (CATID2(THIS,_CHAR) == c) {    \
-     dh += CATID5(H,_,LAST,_,THIS); \
-     ds += CATID5(S,_,LAST,_,THIS); \
-     goto CATID2(THIS,_STATE);      \
-  }
-
-#define STATE(LAST)     \
-   CATID2(LAST,_STATE): \
-   c = *s; s++;         \
-   DO_PAIR(LAST,A)      \
-   else DO_PAIR(LAST,T) \
-   else DO_PAIR(LAST,G) \
-   else DO_PAIR(LAST,C) \
-   else DO_PAIR(LAST,N) \
-   else if ('\0' == c)  \
-             goto DONE; \
-   else goto ERROR \
-
-double oligoTm(char *dna, double DNA_nM, double K_mM)
-/* Calculate melting point of short DNA sequence given DNA concentration in 
- * nanomoles, and salt concentration in millimoles.  This is calculated using eqn
- * (ii) in Rychlik, Spencer, Roads, Nucleic Acids Research, vol 18, no 21, page
- * 6410, with tables of nearest-neighbor thermodynamics for DNA bases as
- * provided in Breslauer, Frank, Bloecker, and Markey,
- * Proc. Natl. Acad. Sci. USA, vol 83, page 3748. */
-{
-    register int dh = 0, ds = 108;
-    register char c;
-    char *dupe = cloneString(dna);
-    char *s = dupe;
-    double delta_H, delta_S;
-
-    touppers(s);
-    /* Use a finite-state machine (DFA) to calucluate dh and ds for s. */
-    c = *s; s++;
-    if (c == 'A') goto A_STATE;
-    else if (c == 'G') goto G_STATE;
-    else if (c == 'T') goto T_STATE;
-    else if (c == 'C') goto C_STATE;
-    else if (c == 'N') goto N_STATE;
-    else goto ERROR;
-    STATE(A);
-    STATE(T);
-    STATE(G);
-    STATE(C);
-    STATE(N);
-
-    DONE:  /* dh and ds are now computed for the given sequence. */
-    delta_H = dh * -100.0;  /* 
-			     * Nearest-neighbor thermodynamic values for dh
-			     * are given in 100 cal/mol of interaction.
-			     */
-    delta_S = ds * -0.1;     /*
-			      * Nearest-neighbor thermodynamic values for ds
-			      * are in in .1 cal/K per mol of interaction.
-			      */
-
-    /* 
-     * See Rychlik, Spencer, Roads, Nucleic Acids Research, vol 18, no 21,
-     * page 6410, eqn (ii).
-     */
-    freeMem(dupe);
-    return delta_H / (delta_S + 1.987 * log(DNA_nM/4000000000.0))
-	- 273.15 + 16.6 * log10(K_mM/1000.0);
-
-    ERROR:  /* 
-	  * length of s was less than 2 or there was an illegal character in
-	  * s.
-	  */
-    freeMem(dupe);
-    errAbort("Not a valid oligo in oligoTm.");
-    return 0;
-}
-#undef DO_PAIR
-
-#define DO_PAIR(LAST,THIS)          \
-  if (CATID2(THIS,_CHAR) == c) {    \
-     dg += CATID5(G,_,LAST,_,THIS); \
-     goto CATID2(THIS,_STATE);      \
-  }
-
-double oligoDg(char *dna)
-/* Calculate dg (change in Gibb's free energy) from melting oligo
- * the nearest neighbor model. Seq should be relatively short, given 
- * the characteristics of the nearest neighbor model (36 bases or less
- * is best). */
-{
-    register int dg = 0;
-    register char c;
-    char *dupe = cloneString(dna);
-    char *s = dupe;
-
-    /* Use a finite-state machine (DFA) to calculate dg s. */
-    c = *s; s++;
-    if (c == 'A') goto A_STATE;
-    else if (c == 'G') goto G_STATE;
-    else if (c == 'T') goto T_STATE;
-    else if (c == 'C') goto C_STATE;
-    else if (c == 'N') goto N_STATE;
-    else goto ERROR;
-    STATE(A);
-    STATE(T);
-    STATE(G);
-    STATE(C);
-    STATE(N);
-
-    DONE:  /* dg is now computed for the given sequence. */
-    freeMem(dupe);
-    return dg / 1000.0;
-
-    ERROR:
-    freeMem(dupe);
-    errAbort("Not a valid oligo in oligoDg.");
-    return 0;
-}
-
-
-double longSeqTm(char *s, int start, int len, double salt_conc)
-/* Calculate the melting temperature of substr(seq, start, length) using the
- * formula from Bolton and McCarthy, PNAS 84:1390 (1962) as presented in
- * Sambrook, Fritsch and Maniatis, Molecular Cloning, p 11.46 (1989, CSHL
- * Press).
- *
- * Tm = 81.5 + 16.6(log10([Na+])) + .41*(%GC) - 600/length
- *
- * Where [Na+] is the molar sodium concentration, (%GC) is the percent of Gs
- * and Cs in the sequence, and length is the length of the sequence.
- *
- * A similar formula is used by the prime primer selection program in GCG
- * (http://www.gcg.com), which instead uses 675.0 / length in the last term
- * (after F. Baldino, Jr, M.-F. Chesselet, and M.E.  Lewis, Methods in
- * Enzymology 168:766 (1989) eqn (1) on page 766 without the mismatch and
- * formamide terms).  The formulas here and in Baldino et al. assume Na+ rather
- * than K+.  According to J.G. Wetmur, Critical Reviews in BioChem. and
- * Mol. Bio. 26:227 (1991) 50 mM K+ should be equivalent in these formulae to .2
- * M Na+.
- *
- * This function takes salt_conc to be the millimolar (mM) concentration,
- * since mM is the usual units in PCR applications.  */
-{
-  int GC_count = 0;
-  char *p, *end;
-
-  if(start + len > strlen(s) || start < 0 || len <= 0) 
-	errAbort("bad input to longSeqTm");
-  end = &s[start + len];
-  /* Length <= 0 is nonsensical. */
-  for (p = &s[start]; p < end; p++) {
-    if ('G' == *p || 'g' == *p || 'C' == *p || 'c' == *p)
-      GC_count++;
-  }
-
-  return
-    81.5
-    + (16.6 * log10(salt_conc / 1000.0))
-    + (41.0 * (((double) GC_count) / len))
-    - (600.0 / len);
-
-}
-
-double seqTm(char *seq, double dna_conc, double salt_conc)
-/* Figure out melting temperature of sequence of any length given
- * dna and salt concentration. */
-{
-  int len = strlen(seq);
-  return (len > 36)
-    ? longSeqTm(seq, 0, len, salt_conc) : oligoTm(seq, dna_conc, salt_conc);
-}
diff --git a/gbtools/src/blatSrc/lib/options.c b/gbtools/src/blatSrc/lib/options.c
deleted file mode 100644
index 4d07d0a..0000000
--- a/gbtools/src/blatSrc/lib/options.c
+++ /dev/null
@@ -1,450 +0,0 @@
-/* Options.c - stuff to handle command line options.
- * This is smaller and more flexible than the cgiSpoof
- * routines we used to use - though cgiSpoof is still the
- * method of choice for actual CGI routines that want to
- * be tested from the command line. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "hash.h"
-#include "verbose.h"
-#include "options.h"
-#include <limits.h>
-
-
-#ifdef MACHTYPE_alpha
-    #define strtoll strtol
-#endif
-
-static struct optionSpec commonOptions[] = {
-   {"verbose", OPTION_INT},
-   {NULL, 0},
-};
-
-static struct optionSpec *matchingOption(char *name, struct optionSpec *optionSpecs)
-/* Go through spec table and return spec that matches name, or NULL
- * if none. */
-{
-while (optionSpecs->name != NULL)
-    {
-    if (sameString(optionSpecs->name, name))
-        return optionSpecs;
-    optionSpecs += 1;
-    }
-return NULL;
-}
-
-static void validateOption(char *name, char *val, struct optionSpec *optionSpecs)
-/* validate an option against a list of values */
-{
-char *valEnd;
-struct optionSpec *optionSpec = matchingOption(name, optionSpecs);
-if (optionSpec == NULL)
-    optionSpec = matchingOption(name, commonOptions);
-if (optionSpec == NULL)
-    errAbort("-%s is not a valid option", name);
-
-long long discardMe = 0;
-switch (optionSpec->flags & OPTION_TYPE_MASK) {
-case OPTION_BOOLEAN:
-    if (val != NULL)
-        errAbort("boolean option -%s must not have value", name);
-    break;
-case OPTION_STRING:
-    if (val == NULL)
-        errAbort("string option -%s must have a value", name);
-    break;
-case OPTION_INT:
-    if (val == NULL)
-        errAbort("int option -%s must have a value", name);
-    discardMe = strtol(val, &valEnd, 10);
-    if ((*val == '\0') || (*valEnd != '\0'))
-        errAbort("value of -%s is not a valid integer: \"%s\"",
-                 name, val);
-    break;
-case OPTION_LONG_LONG:
-    if (val == NULL)
-        errAbort("int option -%s must have a value", name);
-    discardMe = strtoll(val, &valEnd, 10);
-    if ((*val == '\0') || (*valEnd != '\0'))
-        errAbort("value of -%s is not a valid long long: \"%s\"",
-                 name, val);
-    break;
-case OPTION_FLOAT:
-    if (val == NULL)
-        errAbort("float option -%s must have a value", name);
-    discardMe = (long long)strtod(val, &valEnd);
-    if ((*val == '\0') || (*valEnd != '\0'))
-        errAbort("value of -%s is not a valid float: \"%s\"",
-                 name, val);
-    break;
-case OPTION_DOUBLE:
-    if (val == NULL)
-        errAbort("double option -%s must have a value", name);
-    discardMe = (long long)strtod(val, &valEnd);
-    if ((*val == '\0') || (*valEnd != '\0'))
-        errAbort("value of -%s is not a valid double: \"%s\"",
-                 name, val);
-    break;
-default:
-    errAbort("bug: invalid type in optionSpec for %s", optionSpec->name);
-}
-}
-
-static void parseMultiOption(struct hash *hash, char *name, char* val, struct optionSpec *spec)
-/* process multiple instances of an option, requres that the optionSpec of the option */
-{
-struct slName *valList;
-switch (spec->flags & OPTION_TYPE_MASK)
-    {
-    case OPTION_STRING:
-        valList = hashFindVal(hash, name);
-        if (valList == NULL)   /* first multi option */
-            {
-            valList = newSlName(val);
-            hashAdd(hash, name, valList);
-            }
-        else
-            {
-            struct slName *el = newSlName(val);
-            slAddTail(valList, el); /* added next multi option */
-            }
-        break;
-    default:
-        errAbort("UNIMPLEMENTED: multiple instances of a non-string option is not currently implemented");
-    }
-}
-
-static boolean parseAnOption(struct hash *hash, char *arg, struct optionSpec *optionSpecs, boolean keepNumbers)
-/* Parse a single option argument and add to the hash, validating if
- * optionSpecs is not NULL.  Return TRUE if it's arg is an option argument
- * FALSE if it's not.  If boolean keepNumbers is set, then return FALSE 
- * when encountering negative ints or floats.
- */
-{
-char *name, *val;
-char *eqPtr = strchr(arg, '=');
-
-if (!((eqPtr != NULL) || (arg[0] == '-')))
-    return FALSE;  /* not an option */
-
-/* A dash by itself is not an option.   It can mean
- * negative strand for some of the DNA oriented utilities. */
-if (arg[0] == '-' && (arg[1] == 0 || isspace(arg[1])))
-    return FALSE;
-
-if ((keepNumbers) && (arg[0] == '-'))
-    {
-    int i = 1;
-    int num_dec = 0;
-    int num_dig = 0;
-    int num_other = 0;
-    while (i < strlen(arg))
-	{
-	if (isdigit(arg[i]))
-	    num_dig++;
-	else if (arg[i] == '.')
-	    num_dec++;
-	else
-	    num_other++;
-	i++;
-	}
-	if ((num_dig > 0) && (num_dec < 2) && (num_other == 0))
-	    return FALSE;
-    }
-
-/* We treat this=that as an option only if the '=' happens before any non-alphanumeric
- * characters.  This lets us have URLs and SQL statements in the command line even though
- * they can have equals in them. */
-if (eqPtr != NULL)
-    {
-    char *s, c;
-    for (s=arg; s < eqPtr; ++s)
-        {
-	c = *s;
-	if (c != '_' && c != '-' && !isalnum(c))
-	    return FALSE;
-	}
-    }
-
-name = arg;
-if (name[0] == '-')
-    name++;
-if (eqPtr != NULL)
-    {
-    *eqPtr = '\0';
-    val = eqPtr+1;
-    }
-else
-    val = NULL;
-
-if (optionSpecs != NULL)
-    validateOption(name, val, optionSpecs);
-if (val == NULL)
-    val = "on";
-if (optionSpecs == NULL)
-    hashAdd(hash, name, val);
-else
-    {
-    struct optionSpec *spec = matchingOption(name, optionSpecs);
-    if (spec != NULL && (spec->flags & OPTION_MULTI))    /* process multiple instances of option */
-        parseMultiOption(hash, name, val, spec);
-    else
-        hashAdd(hash, name, val);
-    }
-
-if (eqPtr != NULL)
-    *eqPtr = '=';
-return TRUE;
-}
-
-
-static struct hash *parseOptions(int *pArgc, char *argv[], boolean justFirst,
-                                 struct optionSpec *optionSpecs, boolean keepNumbers)
-/* Parse and optionally validate options */
-{
-int i, origArgc, newArgc = 1;
-char **rdPt = argv+1, **wrPt = argv+1;
-struct hash *hash = newHash(6);
-
-origArgc = *pArgc;
-
-/* parse arguments */
-for (i=1; i<origArgc; ++i)
-    {
-    if (sameString(*rdPt, "--"))
-        {
-        rdPt++;
-        i++;
-        break;
-        }
-    if (!parseAnOption(hash, *rdPt, optionSpecs, keepNumbers))
-        {
-        /* not an option */
-        if (justFirst)
-            break;
-        *wrPt++ = *rdPt;
-        newArgc++;
-        }
-    rdPt++;
-    }
-
-/* copy any remaining positional args */
-for (; i<origArgc; ++i)
-    {
-    *wrPt++ = *rdPt++;
-    newArgc++;
-    }
-
-*pArgc = newArgc;
-*wrPt = NULL; 
-return hash;
-}
-
-struct hash *optionParseIntoHash(int *pArgc, char *argv[], boolean justFirst)
-/* Read options in command line (only up to first real argument) into
- * options hash.   Options come in three forms:
- *      -option         words starting with dash
- *      option=val      words with = in the middle
- *      -option=val     combining the two.
- * The resulting hash will be keyed by the option name with the val
- * string for value.  For '-option' types the value is 'on'. */
-{
-return parseOptions(pArgc, argv, justFirst, NULL, FALSE);
-}
-
-struct hash *optionParseIntoHashExceptNumbers(int *pArgc, char *argv[], boolean justFirst)
-/* Read options in argc/argv into a hash (except negative numbers) of your own choosing. */
-{
-return parseOptions(pArgc, argv, justFirst, NULL, TRUE);
-}
-
-static struct hash *options = NULL;
-static struct optionSpec *optionSpecification = NULL;
-
-static void setOptions(struct hash *hash)
-/* Set global options hash to hash, and also do processing
- * of log file and other common options. */
-{
-options = hash;
-if (optionExists("verbose"))
-    verboseSetLevel(optionInt("verbose", 0));
-}
-
-void optionHashSome(int *pArgc, char *argv[], boolean justFirst)
-/* Set up option hash from command line, optionally only adding
- * up to first non-optional word. */
-{
-if (options == NULL)
-    {
-    struct hash *hash = parseOptions(pArgc, argv, justFirst, NULL, FALSE);
-    setOptions(hash);
-    }
-}
-
-void optionHash(int *pArgc, char *argv[])
-/* Read options in command line into options hash.   
- * Options come in three forms:
- *      -option         words starting with dash
- *      option=val      words with = in the middle
- *      -option=val     combining the two.
- * The resulting hash will be keyed by the option name with the val
- * string for value.  For '-option' types the value is 'on'. */
-{
-optionHashSome(pArgc, argv, FALSE);
-}
-
-void optionFree()
-/* free the option hash */
-{
-freeHash(&options);
-}
-
-void optionInit(int *pArgc, char *argv[], struct optionSpec *optionSpecs)
-/* Read options in command line into options hash.
- * Options come in three forms:
- *      -option         words starting with dash
- *      option=val      words with = in the middle
- *      -option=val     combining the two.
- * The resulting hash will be keyed by the option name with the val
- * string for value.  For '-option' types the value is 'on'.
- * The words in argv are parsed in assending order.  If a word of
- * "--" is encountered, argument parsing stops.
- * If optionSpecs is not NULL, it is an array of optionSpec that are
- * used to validate the options.  An option must exist in the array
- * and the value must be convertable to the type specified in flags.
- * Boolean options must no value, all other options must have one.
- * Array is terminated by a optionSpec with a NULL name.
- * If array NULL, no validation is done.
- */
-{
-if (options == NULL)
-    {
-    struct hash *hash = parseOptions(pArgc, argv, FALSE, optionSpecs, FALSE);
-    setOptions(hash);
-    optionSpecification = optionSpecs;
-    }
-}
-
-static char *optGet(char *name)
-/* Lookup option name.  Complain if options hash not set. */
-{
-if (options == NULL)
-    errAbort("optGet called before optionHash");
-return hashFindVal(options, name);
-}
- 
-char *optionVal(char *name, char *defaultVal)
-/* Return named option if in options hash, otherwise default. */
-{
-char *ret;
-/* if a optionSpec was used, make sure this option is not a multi option */
-if(optionSpecification != NULL) 
-    {
-    struct optionSpec *spec = matchingOption(name, optionSpecification);
-    if(spec != NULL && (spec->flags & OPTION_MULTI))    
-        errAbort("ERROR: optionVal cannot be used to get the value of an OPTION_MULTI");
-    }
-
-ret = optGet(name);
-if (ret == NULL)
-     ret = defaultVal;
-return ret;
-}
-
-int optionInt(char *name, int defaultVal)
-/* Return integer value of named option, or default value
- * if not set. */
-{
-char *s = optGet(name);
-char *valEnd;
-long lval;
-if (s == NULL)
-    return defaultVal;
-if (sameString(s,"on"))
-    return defaultVal;
-lval = strtol(s, &valEnd, 10);  // use strtol since strtoi does not exist
-if ((*s == '\0') || (*valEnd != '\0'))
-    errAbort("value of -%s is not a valid integer: \"%s\"", name, s);
-if (lval > INT_MAX)
-    errAbort("value of -%s is is too large: %ld, integer maximum is %d", name, lval, INT_MAX);
-if (lval < INT_MIN)
-    errAbort("value of -%s is is too small: %ld, integer minimum is %d", name, lval, INT_MIN);
-return lval;
-}
-
-long long optionLongLong(char *name, long long defaultVal)
-/* Return long long value of named option, or default value
- * if not set. */
-{
-char *s = optGet(name);
-char *valEnd;
-long long val;
-if (s == NULL)
-    return defaultVal;
-if (sameString(s,"on"))
-    return defaultVal;
-val = strtoll(s, &valEnd, 10);
-if ((*s == '\0') || (*valEnd != '\0'))
-    errAbort("value of -%s is not a valid long long: \"%s\"", name, s);
-return val;
-}
-
-float optionFloat(char *name, float defaultVal)
-/* Return floating point value or default value if not set. */
-{
-char *s = optGet(name);
-char *valEnd;
-float val;
-if (s == NULL)
-    return defaultVal;
-
-val = strtod(s, &valEnd);
-if ((*s == '\0') || (*valEnd != '\0'))
-    errAbort("value of -%s is not a valid float: \"%s\"", name, s);
-return val;
-}
-
-struct slName *optionMultiVal(char *name, struct slName *defaultVal)
-/* Return named option if in options hash, otherwise default. */
-{
-struct slName *ret;
-if(optionSpecification == NULL)
-    errAbort("ERROR: optionMultiVal can only be used after optionInit is called "
-             "with a non-NULL optionSpecs");
-
-ret = hashFindVal(options, name);
-if (ret == NULL)
-     ret = defaultVal;
-return ret;
-}
-
-double optionDouble(char *name, double defaultVal)
-/* Return double value or default value if not set */
-{
-char *s = optGet(name);
-char *valEnd;
-double val;
-if (s == NULL)
-    return defaultVal;
-
-val = strtod(s, &valEnd);
-if ((*s == '\0') || (*valEnd != '\0'))
-    errAbort("value of -%s is not a valid double: \"%s\"", name, s);
-return val;
-}
-
-boolean optionExists(char *name)
-/* Return TRUE if option has been set. */
-{
-return optGet(name) != NULL;
-}
-
-void optionMustExist(char *name)
-/* Abort if option has not been set. */
-{
-if (optGet(name) == NULL)
-    errAbort("Missing required command line flag %s", name);
-}
diff --git a/gbtools/src/blatSrc/lib/osunix.c b/gbtools/src/blatSrc/lib/osunix.c
deleted file mode 100644
index 2a9a85a..0000000
--- a/gbtools/src/blatSrc/lib/osunix.c
+++ /dev/null
@@ -1,711 +0,0 @@
-/* Some wrappers around operating-system specific stuff. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include <dirent.h>
-#include <sys/utsname.h>
-#include <sys/time.h>
-#include <sys/statvfs.h>
-#include <pwd.h>
-#include <termios.h>
-#include "portable.h"
-#include "portimpl.h"
-#include <sys/wait.h>
-#include <regex.h>
-#include <utime.h>
-
-
-
-
-off_t fileSize(char *pathname)
-/* get file size for pathname. return -1 if not found */
-{
-struct stat mystat;
-ZeroVar(&mystat);
-if (stat(pathname,&mystat)==-1)
-    {
-    return -1;
-    }
-return mystat.st_size;
-}
-
-long long freeSpaceOnFileSystem(char *path)
-/* Given a path to a file or directory on a file system,  return free space
- * in bytes. */
-{
-struct statvfs fi;
-int err = statvfs(path,&fi);
-if (err < 0)
-    errnoAbort("freeSpaceOnFileSystem could not statvfs");
-return (long long)fi.f_bsize * fi.f_bavail;
-}
-
-long clock1000()
-/* A millisecond clock. */
-{
-struct timeval tv;
-static long origSec;
-gettimeofday(&tv, NULL);
-if (origSec == 0)
-    origSec = tv.tv_sec;
-return (tv.tv_sec-origSec)*1000 + tv.tv_usec / 1000;
-}
-
-void sleep1000(int milli)
-/* Sleep for given number of 1000ths of second */
-{
-if (milli > 0)
-    {
-    struct timeval tv;
-    tv.tv_sec = milli/1000;
-    tv.tv_usec = (milli%1000)*1000;
-    select(0, NULL, NULL, NULL, &tv);
-    }
-}
-
-long clock1()
-/* A seconds clock. */
-{
-struct timeval tv;
-gettimeofday(&tv, NULL);
-return tv.tv_sec;
-}
-
-void uglyfBreak()
-/* Go into debugger. */
-{
-static char *nullPt = NULL;
-nullPt[0] = 0;
-}
-
-char *getCurrentDir()
-/* Return current directory.  Abort if it fails. */
-{
-static char dir[PATH_LEN];
-
-if (getcwd( dir, sizeof(dir) ) == NULL )
-    errnoAbort("getCurrentDir: can't get current directory");
-return dir;
-}
-
-void setCurrentDir(char *newDir)
-/* Set current directory.  Abort if it fails. */
-{
-if (chdir(newDir) != 0)
-    errnoAbort("setCurrentDir: can't to set current directory: %s", newDir);
-}
-
-boolean maybeSetCurrentDir(char *newDir)
-/* Change directory, return FALSE (and set errno) if fail. */
-{
-return chdir(newDir) == 0;
-}
-
-struct slName *listDir(char *dir, char *pattern)
-/* Return an alphabetized list of all files that match 
- * the wildcard pattern in directory. */
-{
-struct slName *list = NULL, *name;
-struct dirent *de;
-DIR *d;
-
-if ((d = opendir(dir)) == NULL)
-    return NULL;
-while ((de = readdir(d)) != NULL)
-    {
-    char *fileName = de->d_name;
-    if (differentString(fileName, ".") && differentString(fileName, ".."))
-	{
-	if (pattern == NULL || wildMatch(pattern, fileName))
-	    {
-	    name = newSlName(fileName);
-	    slAddHead(&list, name);
-	    }
-	}
-    }
-closedir(d);
-slNameSort(&list);
-return list;
-}
-
-struct slName *listDirRegEx(char *dir, char *regEx, int flags)
-/* Return an alphabetized list of all files that match 
- * the regular expression pattern in directory.
- * See REGCOMP(3) for flags (e.g. REG_ICASE)  */
-{
-struct slName *list = NULL, *name;
-struct dirent *de;
-DIR *d;
-regex_t re;
-int err = regcomp(&re, regEx, flags | REG_NOSUB);
-if(err)
-    errAbort("regcomp failed; err: %d", err);
-
-if ((d = opendir(dir)) == NULL)
-    return NULL;
-while ((de = readdir(d)) != NULL)
-    {
-    char *fileName = de->d_name;
-    if (differentString(fileName, ".") && differentString(fileName, ".."))
-	{
-	if (!regexec(&re, fileName, 0, NULL, 0))
-	    {
-	    name = newSlName(fileName);
-	    slAddHead(&list, name);
-	    }
-	}
-    }
-closedir(d);
-regfree(&re);
-slNameSort(&list);
-return list;
-}
-
-struct fileInfo *newFileInfo(char *name, off_t size, bool isDir, int statErrno, 
-	time_t lastAccess)
-/* Return a new fileInfo. */
-{
-int len = strlen(name);
-struct fileInfo *fi = needMem(sizeof(*fi) + len);
-fi->size = size;
-fi->isDir = isDir;
-fi->statErrno = statErrno;
-fi->lastAccess = lastAccess;
-strcpy(fi->name, name);
-return fi;
-}
-
-int cmpFileInfo(const void *va, const void *vb)
-/* Compare two fileInfo. */
-{
-const struct fileInfo *a = *((struct fileInfo **)va);
-const struct fileInfo *b = *((struct fileInfo **)vb);
-return strcmp(a->name, b->name);
-}
-
-boolean makeDir(char *dirName)
-/* Make dir.  Returns TRUE on success.  Returns FALSE
- * if failed because directory exists.  Prints error
- * message and aborts on other error. */
-{
-int err;
-if ((err = mkdir(dirName, 0777)) < 0)
-    {
-    if (errno != EEXIST)
-	{
-	perror("");
-	errAbort("Couldn't make directory %s", dirName);
-	}
-    return FALSE;
-    }
-return TRUE;
-}
-
-
-struct fileInfo *listDirXExt(char *dir, char *pattern, boolean fullPath, boolean ignoreStatFailures)
-/* Return list of files matching wildcard pattern with
- * extra info. If full path is true then the path will be
- * included in the name of each file. */
-{
-struct fileInfo *list = NULL, *el;
-struct dirent *de;
-DIR *d;
-int dirNameSize = strlen(dir);
-int fileNameOffset = dirNameSize+1;
-char pathName[512];
-
-if ((d = opendir(dir)) == NULL)
-    return NULL;
-memcpy(pathName, dir, dirNameSize);
-pathName[dirNameSize] = '/';
-
-while ((de = readdir(d)) != NULL)
-    {
-    char *fileName = de->d_name;
-    if (differentString(fileName, ".") && differentString(fileName, ".."))
-	{
-	if (pattern == NULL || wildMatch(pattern, fileName))
-	    {
-	    struct stat st;
-	    bool isDir = FALSE;
-	    int statErrno = 0;
-	    strcpy(pathName+fileNameOffset, fileName);
-	    if (stat(pathName, &st) < 0)
-		{
-		if (ignoreStatFailures)
-		    statErrno = errno;
-		else
-    		    errAbort("stat failed in listDirX");
-		}
-	    if (S_ISDIR(st.st_mode))
-		isDir = TRUE;
-	    if (fullPath)
-		fileName = pathName;
-	    el = newFileInfo(fileName, st.st_size, isDir, statErrno, st.st_atime);
-	    slAddHead(&list, el);
-	    }
-	}
-    }
-closedir(d);
-slSort(&list, cmpFileInfo);
-return list;
-}
-
-struct fileInfo *listDirX(char *dir, char *pattern, boolean fullPath)
-/* Return list of files matching wildcard pattern with
- * extra info. If full path is true then the path will be
- * included in the name of each file. */
-{
-return listDirXExt(dir, pattern, fullPath, FALSE);
-}
-
-time_t fileModTime(char *pathName)
-/* Return file last modification time.  The units of
- * these may vary from OS to OS, but you can depend on
- * later files having a larger time. */
-{
-struct stat st;
-if (stat(pathName, &st) < 0)
-    errAbort("stat failed in fileModTime: %s", pathName);
-return st.st_mtime;
-}
-
-
-char *getHost()
-/* Return host name. */
-{
-static char *hostName = NULL;
-static char buf[128];
-if (hostName == NULL)
-    {
-    hostName = getenv("HTTP_HOST");
-    if (hostName == NULL)
-        {
-	hostName = getenv("HOST");
-	if (hostName == NULL)
-	    {
-	    if (hostName == NULL)
-		{
-		static struct utsname unamebuf;
-		if (uname(&unamebuf) >= 0)
-		    hostName = unamebuf.nodename;
-		else
-		    hostName = "unknown";
-		}
-	    }
-        }
-    strncpy(buf, hostName, sizeof(buf));
-    chopSuffix(buf);
-    hostName = buf;
-    }
-return hostName;
-}
-
-char *mysqlHost()
-/* Return host computer on network for mySQL database. */
-{
-boolean gotIt = FALSE;
-static char *host = NULL;
-if (!gotIt)
-    {
-    static char hostBuf[128];
-    gotIt = TRUE;
-    if (fileExists("mysqlHost"))
-	{
-	return (host = firstWordInFile("mysqlHost", hostBuf, sizeof(hostBuf)));
-	}
-    else
-	return (host = getenv("MYSQLHOST"));
-    }
-return host;
-}
-
-char *semiUniqName(char *base)
-/* Figure out a name likely to be unique.
- * Name will have no periods.  Returns a static
- * buffer, so best to clone result unless using
- * immediately. */
-{
-int pid = getpid();
-int num = time(NULL)&0xFFFFF;
-char host[512];
-strcpy(host, getHost());
-char *s = strchr(host, '.');
-if (s != NULL)
-     *s = 0;
-subChar(host, '-', '_');
-subChar(host, ':', '_');
-static char name[PATH_LEN];
-safef(name, sizeof(name), "%s_%s_%x_%x",
-	base, host, pid, num);
-return name;
-}
-
-char *rTempName(char *dir, char *base, char *suffix)
-/* Make a temp name that's almost certainly unique. */
-{
-char *x;
-static char fileName[PATH_LEN];
-int i;
-char *lastSlash = (lastChar(dir) == '/' ? "" : "/");
-for (i=0;;++i)
-    {
-    x = semiUniqName(base);
-    safef(fileName, sizeof(fileName), "%s%s%s%d%s",
-    	dir, lastSlash, x, i, suffix);
-    if (!fileExists(fileName))
-        break;
-    }
-return fileName;
-}
-
-void mustRename(char *oldName, char *newName)
-/* Rename file or die trying. */
-{
-int err = rename(oldName, newName);
-if (err < 0)
-    errnoAbort("Couldn't rename %s to %s", oldName, newName);
-}
-
-void mustRemove(char *path)
-/* Remove file or die trying */
-{
-int err = remove(path);
-if (err < 0)
-    errnoAbort("Couldn't remove %s", path);
-}
-
-static void eatSlashSlashInPath(char *path)
-/* Convert multiple // to single // */
-{
-char *s, *d;
-s = d = path;
-char c, lastC = 0;
-while ((c = *s++) != 0)
-    {
-    if (c == '/' && lastC == c)
-        continue;
-    *d++ = c;
-    lastC = c;
-    }
-*d = 0;
-}
-
-static void eatExcessDotDotInPath(char *path)
-/* If there's a /.. in path take it out.  Turns 
- *      'this/long/../dir/file' to 'this/dir/file
- * and
- *      'this/../file' to 'file'  
- *
- * and
- *      'this/long/..' to 'this'
- * and
- *      'this/..' to  ''   
- * and
- *       /this/..' to '/' */
-{
-/* Take out each /../ individually */
-for (;;)
-    {
-    /* Find first bit that needs to be taken out. */
-    char *excess= strstr(path, "/../");
-    char *excessEnd = excess+4;
-    if (excess == NULL || excess == path)
-        break;
-
-    /* Look for a '/' before this */
-    char *excessStart = matchingCharBeforeInLimits(path, excess, '/');
-    if (excessStart == NULL) /* Preceding '/' not found */
-         excessStart = path;
-    else 
-         excessStart += 1;
-    strcpy(excessStart, excessEnd);
-    }
-
-/* Take out final /.. if any */
-if (endsWith(path, "/.."))
-    {
-    if (!sameString(path, "/.."))  /* We don't want to turn this to blank. */
-	{
-	int len = strlen(path);
-	char *excessStart = matchingCharBeforeInLimits(path, path+len-3, '/');
-	if (excessStart == NULL) /* Preceding '/' not found */
-	     excessStart = path;
-	else 
-	     excessStart += 1;
-	*excessStart = 0;
-	}
-    }
-}
-
-char *simplifyPathToDir(char *path)
-/* Return path with ~ and .. taken out.  Also any // or trailing /.   
- * freeMem result when done. */
-{
-/* Expand ~ if any with result in newPath */
-char newPath[PATH_LEN];
-int newLen = 0;
-char *s = path;
-if (*s == '~')
-    {
-    char *homeDir = getenv("HOME");
-    if (homeDir == NULL)
-        errAbort("No HOME environment var defined after ~ in simplifyPathToDir");
-    ++s;
-    if (*s == '/')  /*    ~/something      */
-        {
-	++s;
-	safef(newPath, sizeof(newPath), "%s/", homeDir);
-	}
-    else            /*   ~something        */
-	{
-	safef(newPath, sizeof(newPath), "%s/../", homeDir);
-	}
-    newLen = strlen(newPath);
-    }
-int remainingLen  = strlen(s);
-if (newLen + remainingLen >= sizeof(newPath))
-    errAbort("path too big in simplifyPathToDir");
-strcpy(newPath+newLen, s);
-
-/* Remove //, .. and trailing / */
-eatSlashSlashInPath(newPath);
-eatExcessDotDotInPath(newPath);
-int lastPos = strlen(newPath)-1;
-if (lastPos > 0 && newPath[lastPos] == '/')
-    newPath[lastPos] = 0;
-
-return cloneString(newPath);
-}
-
-#ifdef DEBUG
-void simplifyPathToDirSelfTest()
-{
-/* First test some cases which should remain the same. */
-assert(sameString(simplifyPathToDir(""),""));
-assert(sameString(simplifyPathToDir("a"),"a"));
-assert(sameString(simplifyPathToDir("a/b"),"a/b"));
-assert(sameString(simplifyPathToDir("/"),"/"));
-assert(sameString(simplifyPathToDir("/.."),"/.."));
-assert(sameString(simplifyPathToDir("/../a"),"/../a"));
-
-/* Now test removing trailing slash. */
-assert(sameString(simplifyPathToDir("a/"),"a"));
-assert(sameString(simplifyPathToDir("a/b/"),"a/b"));
-
-/* Test .. removal. */
-assert(sameString(simplifyPathToDir("a/.."),""));
-assert(sameString(simplifyPathToDir("a/../"),""));
-assert(sameString(simplifyPathToDir("a/../b"),"b"));
-assert(sameString(simplifyPathToDir("/a/.."),"/"));
-assert(sameString(simplifyPathToDir("/a/../"),"/"));
-assert(sameString(simplifyPathToDir("/a/../b"),"/b"));
-assert(sameString(simplifyPathToDir("a/b/.."),"a"));
-assert(sameString(simplifyPathToDir("a/b/../"),"a"));
-assert(sameString(simplifyPathToDir("a/b/../c"),"a/c"));
-assert(sameString(simplifyPathToDir("a/../b/../c"),"c"));
-assert(sameString(simplifyPathToDir("a/../b/../c/.."),""));
-assert(sameString(simplifyPathToDir("/a/../b/../c/.."),"/"));
-
-/* Test // removal */
-assert(sameString(simplifyPathToDir("//"),"/"));
-assert(sameString(simplifyPathToDir("//../"),"/.."));
-assert(sameString(simplifyPathToDir("a//b///c"),"a/b/c"));
-assert(sameString(simplifyPathToDir("a/b///"),"a/b"));
-}
-#endif /* DEBUG */
-
-char *getUser()
-/* Get user name */
-{
-uid_t uid = geteuid();
-struct passwd *pw = getpwuid(uid);
-if (pw == NULL)
-    errnoAbort("getUser: can't get user name for uid %d", (int)uid);
-return pw->pw_name;
-}
-
-int mustFork()
-/* Fork or abort. */
-{
-int childId = fork();
-if (childId == -1)
-    errnoAbort("mustFork: Unable to fork");
-return childId;
-}
-
-int rawKeyIn()
-/* Read in an unbuffered, unechoed character from keyboard. */
-{
-struct termios attr;
-tcflag_t old;
-char c;
-
-/* Set terminal to non-echoing non-buffered state. */
-if (tcgetattr(STDIN_FILENO, &attr) != 0)
-    errAbort("Couldn't do tcgetattr");
-old = attr.c_lflag;
-attr.c_lflag &= ~ICANON;
-attr.c_lflag &= ~ECHO;
-if (tcsetattr(STDIN_FILENO, TCSANOW, &attr) == -1)
-    errAbort("Couldn't do tcsetattr");
-
-/* Read one byte */
-if (read(STDIN_FILENO,&c,1) != 1)
-   errnoAbort("rawKeyIn: I/O error");
-
-/* Put back terminal to how it was. */
-attr.c_lflag = old;
-if (tcsetattr(STDIN_FILENO, TCSANOW, &attr) == -1)
-    errAbort("Couldn't do tcsetattr2");
-return c;
-}
-
-boolean isPipe(int fd)
-/* determine in an open file is a pipe  */
-{
-struct stat buf;
-if (fstat(fd, &buf) < 0)
-    errnoAbort("isPipe: fstat failed");
-return S_ISFIFO(buf.st_mode);
-}
-
-void childExecFailedExit(char *msg)
-/* Child exec failed, so quit without atexit cleanup */
-{
-fprintf(stderr, "child exec failed: %s\n", msg);
-fflush(stderr);
-_exit(1);  // Let the parent know that the child failed by returning 1.
-
-/* Explanation:
-_exit() is not the normal exit().  
-_exit() avoids the usual atexit() cleanup.
-The MySQL library that we link to uses atexit() cleanup to close any open MySql connections.
-However, because the child's mysql connections are shared by the parent,
-this causes the parent MySQL connections to become invalid,
-and causes the puzzling "MySQL has gone away" error in the parent
-when it tries to use its now invalid MySQL connections.
-*/
-
-}
-
-static void execPStack(pid_t ppid)
-/* exec pstack on the specified pid */
-{
-char *cmd[3], pidStr[32];
-safef(pidStr, sizeof(pidStr), "%ld", (long)ppid);
-cmd[0] = "pstack";
-cmd[1] = pidStr;
-cmd[2] = NULL;
-
-// redirect stdout to stderr
-if (dup2(2, 1) < 0)
-    errAbort("dup2 failed");
-
-execvp(cmd[0], cmd);
-
-childExecFailedExit(cmd[0]); // cannot use the normal errAbort.
-
-}
-
-void vaDumpStack(char *format, va_list args)
-/* debugging function to run the pstack program on the current process. In
- * prints a message, following by a new line, and then the stack track.  Just
- * prints errors to stderr rather than aborts. For debugging purposes
- * only.  */
-{
-static boolean inDumpStack = FALSE;  // don't allow re-entry if called from error handler
-if (inDumpStack)
-    return;
-inDumpStack = TRUE;
-
-fflush(stdout);  // clear buffer before forking
-vfprintf(stderr, format, args);
-fputc('\n', stderr);
-fflush(stderr);
-pid_t ppid = getpid();
-pid_t pid = fork();
-if (pid < 0)
-    {
-    perror("can't fork pstack");
-    return;
-    }
-if (pid == 0)
-    execPStack(ppid);
-int wstat;
-if (waitpid(pid, &wstat, 0) < 0)
-    perror("waitpid on pstack failed");
-else
-    {
-    if (WIFEXITED(wstat))
-        {
-        if (WEXITSTATUS(wstat) != 0)
-            fprintf(stderr, "pstack failed\n");
-        }
-    else if (WIFSIGNALED(wstat))
-        fprintf(stderr, "pstack signaled %d\n", WTERMSIG(wstat));
-    }
-inDumpStack = FALSE;
-}
-
-void dumpStack(char *format, ...)
-/* debugging function to run the pstack program on the current process. In
- * prints a message, following by a new line, and then the stack track.  Just
- * prints errors to stderr rather than aborts. For debugging purposes
- * only.  */
-{
-va_list args;
-va_start(args, format);
-vaDumpStack(format, args);
-va_end(args);
-}
-
-boolean maybeTouchFile(char *fileName)
-/* If file exists, set its access and mod times to now.  If it doesn't exist, create it.
- * Return FALSE if we have a problem doing so (e.g. when qateam is gdb'ing and code tries 
- * to touch some file owned by www). */
-{
-if (fileExists(fileName))
-    {
-    struct utimbuf ut;
-    ut.actime = ut.modtime = clock1();
-    int ret = utime(fileName, &ut);
-    if (ret != 0)
-	{
-	warn("utime(%s) failed (ownership?)", fileName);
-	return FALSE;
-	}
-    }
-else
-    {
-    FILE *f = fopen(fileName, "w");
-    if (f == NULL)
-	return FALSE;
-    else
-	carefulClose(&f);
-    }
-return TRUE;
-}
-
-boolean isRegularFile(char *fileName)
-/* Return TRUE if fileName is a regular file. */
-{
-struct stat st;
-
-if (stat(fileName, &st) < 0)
-    return FALSE;
-if (S_ISREG(st.st_mode))
-    return TRUE;
-return FALSE;
-}
-
-void makeSymLink(char *oldName, char *newName)
-/* Return a symbolic link from newName to oldName or die trying */
-{
-int err = symlink(oldName, newName);
-if (err < 0)
-     errnoAbort("Couldn't make symbolic link from %s to %s\n", oldName, newName);
-}
-
diff --git a/gbtools/src/blatSrc/lib/oswin9x.c b/gbtools/src/blatSrc/lib/oswin9x.c
deleted file mode 100644
index 5087f5a..0000000
--- a/gbtools/src/blatSrc/lib/oswin9x.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Stuff that's specific for Win95 goes here. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-#include "common.h"
-#include <io.h>
-#include <direct.h>
-#include "portable.h"
-
-
-/* Return how long the named file is in bytes. 
- * Return -1 if no such file. */
-off_t fileSize(char *fileName)
-{
-int fd;
-long size;
-fd = _open(fileName, _O_RDONLY, 0);
-if (fd < 0)
-    return -1;
-size = _lseek(fd, 0L, SEEK_END);
-_close(fd);
-return size;
-}
-
-long clock1000()
-/* A millisecond clock. */
-{
-return clock() /* 1000/CLOCKS_PER_SEC */;   /* CLOCKS_PER_SEC == 1000 for windows */
-}
-
-long clock1()
-/* Second clock. */
-{
-return clock()/CLOCKS_PER_SEC;
-}
-
-void uglyfBreak()
-/* Go into debugger. */
-{
-__asm { int 3 } /* uglyf */
-}
-
-char *getCurrentDir()
-/* Return current directory. */
-{
-static char dir[_MAX_PATH];
-
-if( _getcwd( dir, _MAX_PATH ) == NULL )
-    errnoAbort("can't get current directory");
-return dir;
-}
-
-void setCurrentDir(char *newDir)
-/* Set current directory.  Abort if it fails. */
-{
-if (_chdir(newDir) != 0)
-    errnoAbort("can't to set current directory: %s", newDir);
-}
-
-struct slName *listDir(char *dir, char *pattern)
-/* Return an alphabetized list of all files that match 
- * the wildcard pattern in directory. */
-{
-long hFile;
-struct _finddata_t fileInfo;
-struct slName *list = NULL, *name;
-boolean otherDir = FALSE;
-char *currentDir;
-
-if (dir == NULL || sameString(".", dir) || sameString("", dir))
-    dir = "";
-else
-    {
-    currentDir = getCurrentDir();
-    setCurrentDir(dir);
-    otherDir = TRUE;
-    }
-
-if (pattern == NULL)
-    pattern = *;
-if( (hFile = _findfirst( pattern, &fileInfo)) == -1L )
-    return NULL;
-
-do
-    {
-    if (!sameString(".", fileInfo.name) && !sameString("..", fileInfo.name))
-        {
-        name = newSlName(fileInfo.name);
-        slAddHead(&list, name);
-        }
-    }
-while( _findnext( hFile, &fileInfo) == 0 );
-_findclose( hFile );
-if (otherDir)
-    setCurrentDir(currentDir);
-slNameSort(&list);
-return list;
-}
diff --git a/gbtools/src/blatSrc/lib/pairDistance.c b/gbtools/src/blatSrc/lib/pairDistance.c
deleted file mode 100644
index 2c42232..0000000
--- a/gbtools/src/blatSrc/lib/pairDistance.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* pairDistance - help manage systems where you have a list of distances between pairs of
- * elements */
-
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "pairDistance.h"
-#include "sqlNum.h"
-
-struct pairDistance *pairDistanceReadAll(char *fileName)
-/* Read in file of format <a> <b> <distance> into list of pairs */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct pairDistance *list = NULL, *pair;
-char *row[3];
-while (lineFileRow(lf, row))
-    {
-    AllocVar(pair);
-    pair->a = cloneString(row[0]);
-    pair->b = cloneString(row[1]);
-    pair->distance = sqlDouble(row[2]);
-    slAddHead(&list, pair);
-    }
-slReverse(&list);
-return list;
-}
-
-struct hash *pairDistanceHashList(struct pairDistance *pairList)
-/* Return hash of all pairs keyed by pairDistanceName function on pair with pair values */
-{
-struct hash *hash = hashNew(0);
-struct pairDistance *pair;
-for (pair = pairList; pair != NULL; pair = pair->next)
-    {
-    char name[2*PATH_LEN];
-    pairDistanceName(pair->a, pair->b, name, sizeof(name));
-    hashAdd(hash, name, pair);
-    pairDistanceName(pair->b, pair->a, name, sizeof(name));
-    hashAdd(hash, name, pair);
-    }
-return hash;
-}
-
-double pairDistanceHashLookup(struct hash *pairHash, char *aName, char *bName)
-/* Return distance between a and b. */
-{
-char name[2*PATH_LEN];
-pairDistanceName(aName, bName, name, sizeof(name));
-struct pairDistance *pair = hashMustFindVal(pairHash, name);
-return pair->distance;
-}
-
-void pairDistanceInvert(struct pairDistance *list)
-/* Go through and reverse distances, and make them positive. */
-{
-if (list == NULL)
-    return;
-double min = list->distance, max = list->distance;
-struct pairDistance *pair;
-for (pair = list; pair != NULL; pair = pair->next)
-    {
-    double distance = pair->distance;
-    if (distance < min) min = distance;
-    if (distance > max) max = distance;
-    }
-double range = max - min;
-for (pair = list; pair != NULL; pair = pair->next)
-    {
-    double old = pair->distance;
-    pair->distance = range - (old - min);
-    }
-}
-
-char *pairDistanceName(char *a, char *b, char *outBuf, int outBufSize)
-/* Return name for pair */
-{
-safef(outBuf, outBufSize, "%s\t%s", a, b);
-return outBuf;
-}
-
diff --git a/gbtools/src/blatSrc/lib/pairHmm.c b/gbtools/src/blatSrc/lib/pairHmm.c
deleted file mode 100644
index 67eda43..0000000
--- a/gbtools/src/blatSrc/lib/pairHmm.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/* pairHmm - stuff to help implement pairwise hidden markov models,
- * which are useful ways of aligning two sequences. 
- *
- * This file is copyright 2000-2004 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "axt.h"
-#include "pairHmm.h"
-
-
-UBYTE phmmNullMommy = 0; /* mommy value for orphans.... */
-
-void phmmUnpackMommy(UBYTE mommy, int *retStateIx, int *retQoff, 
-	int *retToff)
-/* Unpack state, query, and target offset. */
-{
-*retStateIx = (mommy&31);
-*retQoff = -((mommy&32)>>5);
-*retToff = -((mommy&64)>>6);
-}
-
-struct phmmMatrix *phmmMatrixNew(int stateCount,
-    char *query, int querySize, char *target, int targetSize)
-/* Allocate all memory required for an phmmMatrix. Set up dimensions. */
-{
-int i;
-struct phmmMommy *allCells;
-int allCellSize;
-int rowSize;
-int *allScores;
-struct phmmMatrix *am;
-
-AllocVar(am);
-am->query = query;
-am->target = target;
-am->querySize = querySize;
-am->targetSize = targetSize;
-am->qDim = rowSize = am->querySize + 1;
-am->tDim = am->targetSize + 1;
-am->stateCount = stateCount;
-am->stateSize = rowSize * am->tDim;
-am->stateByteSize = am->stateSize * sizeof(struct phmmMommy);
-am->states = needMem(stateCount * sizeof(struct phmmState));
-
-/* Initialize matrix of cells for each state. */
-allCellSize = stateCount * am->stateByteSize;
-am->allCells = allCells = needLargeMem(allCellSize); 
-memset(allCells, 0, allCellSize);
-for (i=0; i<stateCount; ++i)
-    {
-    am->states[i].cells = allCells;
-    allCells += am->stateSize;
-    am->states[i].stateIx = i;
-    }
-
-/* Initialize two rows of scores for each state. */
-allScores = am->allScores = needMem(rowSize * 2 * stateCount * sizeof(int) );
-for (i=0; i<stateCount; ++i)
-    {
-    am->states[i].scores = allScores;
-    allScores += rowSize;
-    am->states[i].lastScores = allScores;
-    allScores += rowSize;
-    }
-return am;
-}
-
-void phmmMatrixFree(struct phmmMatrix **pAm)
-/* Free up memory required for an phmmMatrix and make sure
- * nobody reuses it. */
-{
-struct phmmMatrix *am = *pAm;
-if (am != NULL)
-    {
-    freeMem(am->states);
-    freeMem(am->allCells);
-    freeMem(am->allScores);
-    freez(pAm);
-    }
-}
-
-struct phmmState *phmmNameState(struct phmmMatrix *am, int stateIx, 
-	char *name, char emitLetter)
-/* Give a name to a state and return a pointer to it. */
-{
-struct phmmState *state;
-assert(stateIx < am->stateCount);
-state = &am->states[stateIx];
-state->name = name;
-state->emitLetter = emitLetter;
-return state;
-}
-
-static void phmmFindMatrixIx(struct phmmMatrix *am, struct phmmMommy *cell, 
-	int *retStateIx, int *retQix, int *retTix)
-/* Given a cell in matrix return state, query, and target index. */
-{
-int cellIx = cell - am->allCells;
-*retStateIx = cellIx/am->stateSize;
-cellIx %= am->stateSize;
-*retTix = cellIx / am->qDim;
-*retQix = cellIx % am->qDim;
-}
-
-static struct phmmMommy *phmmFindMommy(struct phmmMatrix *am, 
-	struct phmmMommy *baby)
-/* Find baby's mommy and return it. */
-{
-int momStateIx, qOff, tOff;
-int babyStateIx, qIx, tIx;
-UBYTE mommy;
-
-if ((mommy = baby->mommy) == phmmNullMommy)
-    return NULL;
-phmmUnpackMommy(mommy, &momStateIx, &qOff, &tOff);
-phmmFindMatrixIx(am, baby, &babyStateIx, &qIx, &tIx);
-return am->states[momStateIx].cells + (tOff + tIx) * am->qDim + (qOff + qIx);
-}
-
-struct phmmAliPair
-/* Each position in alignment gets one of these. */
-    {
-    struct phmmAliPair *next;
-    int queryIx;
-    int targetIx;
-    UBYTE hiddenIx;  /* If I code one of these with more than 255 states shoot me! */
-    char querySym;
-    char targetSym;
-    char hiddenSym;
-    };
-
-struct phmmAliPair *phmmTraceBack(struct phmmMatrix *am, struct phmmMommy *end)
-/* Create list of alignment pair by tracing back through matrix from end
- * state back to a start.*/
-{
-struct phmmAliPair *pairList = NULL, *pair;
-struct phmmMommy *cell, *parent = end;
-int parentSix, parentTix, parentQix;
-int sIx, tIx, qIx;
-
-phmmFindMatrixIx(am, parent, &parentSix, &parentQix, &parentTix);
-for (;;)
-    {
-    cell = parent;
-    sIx = parentSix;
-    tIx = parentTix;
-    qIx = parentQix;
-
-    if ((parent = phmmFindMommy(am, cell)) == NULL)
-        break;
-    phmmFindMatrixIx(am, parent, &parentSix, &parentQix, &parentTix);
-    
-    cell->mommy |= phmmMommyTraceBit;
-
-    AllocVar(pair);
-    pair->hiddenIx = (UBYTE)sIx;
-    pair->hiddenSym = am->states[sIx].emitLetter; 
-
-    if (parentQix == qIx - 1 && parentTix == tIx - 1 )
-        {
-        pair->queryIx = qIx-1;
-        pair->querySym = am->query[qIx-1];
-        pair->targetIx = tIx - 1;
-        pair->targetSym = am->target[tIx-1];
-        }
-    else if (parentQix == qIx) /* && parentTix == tIx-1 */
-        {
-        pair->queryIx = -1;
-        pair->querySym = '-';
-        pair->targetIx = tIx-1;
-        pair->targetSym = am->target[tIx-1];
-        }
-    else  /* parentTix == tIx  && parentQix == qIx-1 */
-        {
-        pair->queryIx = qIx-1;
-        pair->querySym = am->query[qIx-1];
-        pair->targetIx = -1;
-        pair->targetSym = '-';
-        }
-    slAddHead(&pairList, pair);
-    }
-return pairList;
-}
-
-void phmmPrintTrace(struct phmmMatrix *am, struct phmmAliPair *pairList, 
-	boolean showStates, FILE *f, boolean extraAtEnds)
-/* Print out trace to file. */
-{
-struct phmmAliPair *pair;
-#define lineLen 50
-char asyms[lineLen+1];
-char qsyms[lineLen+1];
-char tsyms[lineLen+1];
-char hsyms[lineLen+1];
-int lineIx = 0;
-int qs, ts;
-boolean gotQs = FALSE;
-
-if ((pair = pairList) == NULL)
-    {
-    fprintf(f, "Empty pair list\n");
-    return;
-    }
-
-qs = pair->queryIx;
-ts = pair->targetIx;
-
-/* Print out up to 25 bp of initial non-matching parts. */
-if (extraAtEnds)
-    {
-    int qStart = qs;
-    int tStart = ts;
-    int i;
-
-    for (i= -25; i < 0; ++i)
-        {
-        int qIx = qStart + i;
-        int tIx = tStart + i;
-        qsyms[lineIx] = (qIx >= 0 ? am->query[qIx] : ' ');
-        tsyms[lineIx] = (tIx >= 0 ? am->target[tIx] : ' ' );
-        asyms[lineIx] = hsyms[lineIx] = ' ';
-        if (qIx >= 0 || tIx >= 0)
-            {
-            ++lineIx;
-            if (!gotQs)
-                {
-                gotQs = TRUE;
-                qs = qIx;
-                ts = tIx;
-                }
-            }
-        }
-    }
-
-/* Print out matching parts */
-for (pair = pairList; pair != NULL; pair = pair->next)
-    {
-    qsyms[lineIx] = pair->querySym;
-    tsyms[lineIx] = pair->targetSym;
-    asyms[lineIx] = (pair->querySym == pair->targetSym ? '|' : ' ');
-    hsyms[lineIx] = pair->hiddenSym;
-    if (++lineIx == lineLen)
-        {
-        qsyms[lineIx] = asyms[lineIx] = tsyms[lineIx] = hsyms[lineIx] = 0;
-        fprintf(f, "%5d %s\n", qs, qsyms);
-        fprintf(f, "%5s %s\n", "", asyms);
-        fprintf(f, "%5d %s\n", ts, tsyms);
-        if (showStates)
-            fprintf(f, "%5s %s\n", "", hsyms);
-        fputc('\n', f);
-        lineIx = 0;
-        if (pair->next)
-            {
-            qs = pair->next->queryIx;
-            ts = pair->next->targetIx;
-            }
-        }
-    }
-
-/* Print out last bit - first get last pair. */
-if (extraAtEnds)
-    {
-    for (pair = pairList; pair->next != NULL; pair = pair->next)
-        ;
-
-        {
-        int qIx, tIx, i;
-        int residue = lineLen - lineIx;
-        for (i=1; i<=residue; i++)
-            {
-            if ((qIx = pair->queryIx+i) >= am->querySize)
-                qsyms[lineIx] = ' ';
-            else
-                qsyms[lineIx] = am->query[qIx];
-            if ((tIx = pair->targetIx+i) >= am->targetSize)
-                tsyms[lineIx] = ' ';
-            else
-                tsyms[lineIx] = am->target[tIx];
-            asyms[lineIx] = ' ';
-            hsyms[lineIx] = ' ';
-            ++lineIx;
-            assert(lineIx <= lineLen);
-            }
-        }
-    }
-
-/* Print out anything not printed out yet. */
-if (lineIx != 0)
-    {
-    qsyms[lineIx] = asyms[lineIx] = tsyms[lineIx] = hsyms[lineIx] = 0;
-    fprintf(f, "%5d %s\n", qs, qsyms);
-    fprintf(f, "%5s %s\n", "", asyms);
-    fprintf(f, "%5d %s\n", ts, tsyms);
-    if (showStates)
-        fprintf(f, "%5s %s\n", "", hsyms);
-    fputc('\n', f);
-    lineIx = 0;
-    }
-#undef lineLen
-}
-
-struct axt *phhmTraceToAxt(struct phmmMatrix *am, struct phmmAliPair *pairList, 
-	int score, char *qName, char *tName)
-/* Convert alignment from traceback format to axt. */
-{
-struct axt *axt;
-struct phmmAliPair *pair;
-int qEnd, tEnd;
-char *qSym, *tSym;
-int i;
-
-/* Make sure got something real. */
-if ((pair = pairList) == NULL)
-    return NULL;
-
-/* Allocate memory for axt. */
-AllocVar(axt);
-axt->symCount = slCount(pairList);
-axt->qSym = AllocArray(qSym, axt->symCount+1);
-axt->tSym = AllocArray(tSym, axt->symCount+1);
-
-/* Fill in basic fields. */
-axt->qName = cloneString(qName);
-axt->tName = cloneString(tName);
-axt->qStrand = axt->tStrand = '+';
-axt->qStart = qEnd = pair->queryIx;
-axt->tStart = tEnd = pair->targetIx;
-axt->score = score;
-
-/* Store alignment symbols and keep track of last symbol used. */
-for (i=0, pair = pairList; pair != NULL; pair = pair->next, ++i)
-    {
-    qSym[i] = pair->querySym;
-    tSym[i] = pair->targetSym;
-    qEnd = pair->queryIx;
-    tEnd = pair->targetIx;
-    }
-
-/* Store end and return. */
-axt->qEnd = qEnd + 1;
-axt->tEnd = tEnd + 1;
-return axt;
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/paraFetch.c b/gbtools/src/blatSrc/lib/paraFetch.c
deleted file mode 100644
index ee2e07b..0000000
--- a/gbtools/src/blatSrc/lib/paraFetch.c
+++ /dev/null
@@ -1,703 +0,0 @@
-/* paraFetch - fetch things from remote URLs in parallel. */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include <utime.h>
-#include "common.h"
-#include "internet.h"
-#include "errAbort.h"
-#include "hash.h"
-#include "linefile.h"
-#include "net.h"
-#include "https.h"
-#include "sqlNum.h"
-#include "obscure.h"
-#include "portable.h"
-#include "paraFetch.h"
-
-
-static void paraFetchWriteStatus(char *origPath, struct parallelConn *pcList, 
-    char *url, off_t fileSize, char *dateString, boolean isFinal)
-/* Write a status file.
- * This has two purposes.
- * First, we can use it to resume a failed transfer.
- * Second, we can use it to follow progress */
-{
-char outTempX[1024];
-char outTemp[1024];
-safef(outTempX, sizeof(outTempX), "%s.paraFetchStatusX", origPath);
-safef(outTemp, sizeof(outTemp), "%s.paraFetchStatus", origPath);
-struct parallelConn *pc = NULL;
-
-FILE *f = mustOpen(outTempX, "w");
-int part = 0;
-fprintf(f, "%s\n", url);
-fprintf(f, "%lld\n", (long long)fileSize);
-fprintf(f, "%s\n", dateString);
-for(pc = pcList; pc; pc = pc->next)
-    {
-    fprintf(f, "part%d %lld %lld %lld\n", part
-	, (long long)pc->rangeStart
-	, (long long)pc->partSize
-	, (long long)pc->received);
-    ++part;
-    }
-
-carefulClose(&f);
-
-/* rename the successful status to the original name */
-rename(outTempX, outTemp);
-
-if (isFinal)  /* We are done and just looking to get rid of the file. */
-    unlink(outTemp);
-}
-
-
-time_t paraFetchTempUpdateTime(char *origPath)
-/* Return last mod date of temp file - which is useful to see if process has stalled. */
-{
-char outTemp[1024];
-safef(outTemp, sizeof(outTemp), "%s.paraFetch", origPath);
-if (fileExists(outTemp))
-    return fileModTime(outTemp);
-else if (fileExists(origPath))
-    return fileModTime(origPath);
-else
-    {
-    errAbort("%s doesn't exist", origPath);
-    return 0;
-    }
-}
-
-void parallelFetchRemovePartial(char *destName)
-/* Remove any files associated with partial downloads of file of given name. */
-{
-char paraTmpFile[PATH_LEN];
-safef(paraTmpFile, PATH_LEN, "%s.paraFetch", destName);
-remove(paraTmpFile);
-safef(paraTmpFile, PATH_LEN, "%s.paraFetchStatus", destName);
-remove(paraTmpFile);
-}
-
-boolean paraFetchReadStatus(char *origPath, 
-    struct parallelConn **pPcList, char **pUrl, off_t *pFileSize, 
-    char **pDateString, off_t *pTotalDownloaded)
-/* Read a status file - which is just origPath plus .paraFetchStatus.  This is updated during 
- * transit by parallelFetch. Returns FALSE if status file not there - possibly because
- * transfer is finished.  Any of the return parameters (pThis and pThat) may be NULL */
-{
-char outTemp[1024];
-char outStat[1024];
-safef(outStat, sizeof(outStat), "%s.paraFetchStatus", origPath);
-safef(outTemp, sizeof(outTemp), "%s.paraFetch", origPath);
-struct parallelConn *pcList = NULL, *pc = NULL;
-off_t totalDownloaded = 0;
-
-if (!fileExists(outStat))
-    {
-    unlink(outTemp);
-    return FALSE;
-    }
-
-if (!fileExists(outTemp))
-    {
-    unlink(outStat);
-    return FALSE;
-    }
-
-char *line, *word;
-struct lineFile *lf = lineFileOpen(outStat, TRUE);
-if (!lineFileNext(lf, &line, NULL))
-    {
-    unlink(outTemp);
-    unlink(outStat);
-    return FALSE;
-    }
-char *url = cloneString(line);
-if (!lineFileNext(lf, &line, NULL))
-    {
-    unlink(outTemp);
-    unlink(outStat);
-    return FALSE;
-    }
-off_t fileSize = sqlLongLong(line);
-if (!lineFileNext(lf, &line, NULL))
-    {
-    unlink(outTemp);
-    unlink(outStat);
-    return FALSE;
-    }
-char *dateString = cloneString(line);
-while (lineFileNext(lf, &line, NULL))
-    {
-    word = nextWord(&line);
-    AllocVar(pc);
-    pc->next = NULL;
-    pc->sd = -4;  /* no connection tried yet */
-    word = nextWord(&line);
-    pc->rangeStart = sqlLongLong(word);
-    word = nextWord(&line);
-    pc->partSize = sqlLongLong(word);
-    word = nextWord(&line);
-    pc->received = sqlLongLong(word);
-    if (pc->received == pc->partSize)
-	pc->sd = -1;  /* part all done already */
-    totalDownloaded += pc->received;
-    slAddHead(&pcList, pc);
-    }
-slReverse(&pcList);
-
-lineFileClose(&lf);
-
-if (slCount(pcList) < 1)
-    {
-    unlink(outTemp);
-    unlink(outStat);
-    return FALSE;
-    }
-
-if (pPcList != NULL)
-    *pPcList = pcList;
-if (pUrl != NULL)
-    *pUrl = url;
-if (pFileSize != NULL)
-    *pFileSize = fileSize;
-if (pDateString != NULL)
-    *pDateString = dateString;
-if (pTotalDownloaded != NULL)
-    *pTotalDownloaded = totalDownloaded;
-
-return TRUE;
-}
-
-boolean parallelFetchInterruptable(char *url, char *outPath, int numConnections, int numRetries, 
-    boolean newer, boolean progress,
-    boolean (*interrupt)(void *context),  void *context)
-/* Open multiple parallel connections to URL to speed downloading.  If interrupt function 
- * is non-NULL,  then it gets called passing the context parameter,  and if it returns
- * TRUE the fetch is interrupted.   Overall the parallelFetchInterruptable returns TRUE
- * when the function succeeds without interrupt, FALSE otherwise. */
-{
-char *origPath = outPath;
-char outTemp[1024];
-safef(outTemp, sizeof(outTemp), "%s.paraFetch", outPath);
-outPath = outTemp;
-/* get the size of the file to be downloaded */
-off_t fileSize = 0;
-off_t totalDownloaded = 0;
-ssize_t sinceLastStatus = 0;
-char *dateString = "";
-int star = 1;  
-int starMax = 20;  
-off_t starStep = 1;
-// TODO handle case-sensitivity of protocols input
-if (startsWith("http://",url) || startsWith("https://",url))
-    {
-    struct hash *hash = newHash(0);
-    int status = netUrlHead(url, hash);
-    if (status != 200) // && status != 302 && status != 301)
-	{
-	warn("Error code: %d, expected 200 for %s, can't proceed, sorry", status, url);
-	return FALSE;
-	}
-    char *sizeString = hashFindValUpperCase(hash, "Content-Length:");
-    if (sizeString)
-	{
-	fileSize = atoll(sizeString);
-	}
-    else
-	{
-	warn("No Content-Length: returned in header for %s, must limit to a single connection, will not know if data is complete", url);
-	numConnections = 1;
-	fileSize = -1;
-	}
-    char *ds = hashFindValUpperCase(hash, "Last-Modified:");
-    if (ds)
-	dateString = cloneString(ds);
-    hashFree(&hash);
-    }
-else if (startsWith("ftp://",url))
-    {
-    long long size = 0;
-    time_t t;
-    boolean ok = netGetFtpInfo(url, &size, &t);
-    if (!ok)
-	{
-	warn("Unable to get size info from FTP for %s, can't proceed, sorry", url);
-	return FALSE;
-	}
-    fileSize = size;
-
-    struct tm  *ts;
-    char ftpTime[80];
- 
-    /* Format the time "Tue, 15 Jun 2010 06:45:08 GMT" */
-    ts = localtime(&t);
-    strftime(ftpTime, sizeof(ftpTime), "%a, %d %b %Y %H:%M:%S %Z", ts);
-    dateString = cloneString(ftpTime);
-
-    }
-else
-    {
-    warn("unrecognized protocol: %s", url);
-    return FALSE;
-    }
-
-
-verbose(2,"fileSize=%lld\n", (long long) fileSize);
-
-if (fileSize < 65536)    /* special case small file */
-    numConnections = 1;
-
-if (numConnections > 50)    /* ignore high values for numConnections */
-    {
-    warn("Currently maximum number of connections is 50. You requested %d. Will proceed with 50 on %s", numConnections, url);
-    numConnections = 50;
-    }
-
-verbose(2,"numConnections=%d\n", numConnections); //debug
-
-if (numConnections < 1)
-    {
-    warn("number of connections must be greater than 0 for %s, can't proceed, sorry", url);
-    return FALSE;
-    }
-
-if (numRetries < 0)
-    numRetries = 0;
-
-/* what is the size of each part */
-off_t partSize = (fileSize + numConnections -1) / numConnections;
-if (fileSize == -1) 
-    partSize = -1;
-off_t base = 0;
-int c;
-
-verbose(2,"partSize=%lld\n", (long long) partSize); //debug
-
-
-/* n is the highest-numbered descriptor */
-int n = 0;
-int connOpen = 0;
-int reOpen = 0;
-
-
-struct parallelConn *restartPcList = NULL;
-char *restartUrl = NULL;
-off_t restartFileSize = 0;
-char *restartDateString = "";
-off_t restartTotalDownloaded = 0;
-boolean restartable = paraFetchReadStatus(origPath, &restartPcList, &restartUrl, &restartFileSize, &restartDateString, &restartTotalDownloaded);
-if (fileSize == -1)
-    restartable = FALSE;
-
-struct parallelConn *pcList = NULL, *pc;
-
-if (restartable 
- && sameString(url, restartUrl)
- && fileSize == restartFileSize
- && sameString(dateString, restartDateString))
-    {
-    pcList = restartPcList;
-    totalDownloaded = restartTotalDownloaded;
-    }
-else
-    {
-
-    if (newer) // only download it if it is newer than what we already have
-	{
-	/* datestamp mtime from last-modified header */
-	struct tm tm;
-	// Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
-	// These strings are always GMT
-	if (strptime(dateString, "%a, %d %b %Y %H:%M:%S %Z", &tm) == NULL)
-	    {
-	    warn("unable to parse last-modified string [%s]", dateString);
-	    }
-	else
-	    {
-	    time_t t;
-	    // convert to UTC (GMT) time
-	    t = mktimeFromUtc(&tm);
-	    if (t == -1)
-		{
-		warn("mktimeFromUtc failed while converting last-modified string to UTC [%s]", dateString);
-		}
-	    else
-		{
-		// get the file mtime
-		struct stat mystat;
-		ZeroVar(&mystat);
-		if (stat(origPath,&mystat)==0)
-		    {
-		    if (t <= mystat.st_mtime)
-			{
-			verbose(2,"Since nothing newer was found, skipping %s\n", origPath);
-			verbose(3,"t from last-modified = %ld; st_mtime = %ld\n", (long) t, (long)mystat.st_mtime);
-			return TRUE;
-			}
-		    }
-		}
-	    }
-	}
-
-    /* make a list of connections */
-    for (c = 0; c < numConnections; ++c)
-	{
-	AllocVar(pc);
-	pc->next = NULL;
-	pc->rangeStart = base;
-	base += partSize;
-	pc->partSize = partSize;
-	if (fileSize != -1 && pc->rangeStart+pc->partSize >= fileSize)
-	    pc->partSize = fileSize - pc->rangeStart;
-	pc->received = 0;
-	pc->sd = -4;  /* no connection tried yet */
-	slAddHead(&pcList, pc);
-	}
-    slReverse(&pcList);
-    }
-
-if (progress)
-    {
-    char nicenumber[1024]="";
-    sprintWithGreekByte(nicenumber, sizeof(nicenumber), fileSize);
-    printf("downloading %s ", nicenumber); fflush(stdout);
-    starStep = fileSize/starMax;
-    if (starStep < 1)
-	starStep = 1;
-    }
-
-int out = open(outPath, O_CREAT|O_WRONLY, 0664);
-if (out < 0)
-    {
-    warn("Unable to open %s for write while downloading %s, can't proceed, sorry", outPath, url);
-    return FALSE;
-    }
-
-
-/* descriptors for select() */
-fd_set rfds;
-struct timeval tv;
-int retval;
-
-ssize_t readCount = 0;
-#define BUFSIZE 65536 * 4
-char buf[BUFSIZE];
-
-/* create paraFetchStatus right away for monitoring programs */
-paraFetchWriteStatus(origPath, pcList, url, fileSize, dateString, FALSE);
-sinceLastStatus = 0;
-
-int retryCount = 0;
-
-time_t startTime = time(NULL);
-
-#define SELTIMEOUT 10
-#define RETRYSLEEPTIME 30
-int scaledRetries = numRetries;
-if (fileSize != -1)
-    scaledRetries = round(numRetries * (1+fileSize/1e10) );
-verbose(2,"scaledRetries=%d\n", scaledRetries);
-while (TRUE)
-    {
-    verbose(2,"Top of big loop\n");
-    if (interrupt != NULL && (*interrupt)(context))
-	{
-	verbose(1, "Interrupted paraFetch.\n");
-	return FALSE;
-	}
-
-    if (progress)
-	{
-	while (totalDownloaded >= star * starStep)
-	    {
-	    printf("*");fflush(stdout);
-	    ++star;
-	    }
-	}
-
-    /* are we done? */
-    if (connOpen == 0)
-	{
-	boolean done = TRUE;
-	for(pc = pcList; pc; pc = pc->next)
-	    if (pc->sd != -1)
-		done = FALSE;
-	if (done) break;
-	}
-
-    /* See if we need to open any connections, either new or retries */
-    for(pc = pcList; pc; pc = pc->next)
-	{
-	if ((pc->sd == -4)  /* never even tried to open yet */
-	 || ((reOpen>0)      /* some connections have been released */
-	    && (pc->sd == -2  /* started but not finished */
-	    ||  pc->sd == -3)))  /* not even started */
-	    {
-	    char urlExt[1024];
-	    safef(urlExt, sizeof(urlExt), "%s;byterange=%llu-%llu"
-	    , url
-	    , (unsigned long long) (pc->rangeStart + pc->received)
-	    , (unsigned long long) (pc->rangeStart + pc->partSize - 1) );
-
-
-	    int oldSd = pc->sd;  /* in case we need to remember where we were */
-	    if (oldSd != -4)      /* decrement whether we succeed or not */
-		--reOpen;
-	    if (oldSd == -4) 
-		oldSd = -3;       /* ok this one just changes */
-	    if (fileSize == -1)
-		{
-		verbose(2,"opening url %s\n", url);
-		pc->sd = netUrlOpen(url);
-		}
-	    else
-		{
-		verbose(2,"opening url %s\n", urlExt);
-		pc->sd = netUrlOpen(urlExt);
-		}
-	    if (pc->sd < 0)
-		{
-		pc->sd = oldSd;  /* failed to open, can retry later */
-		}
-	    else
-		{
-		char *newUrl = NULL;
-		int newSd = 0;
-		if (startsWith("http://",url) || startsWith("https://",url))
-		    {
-		    if (!netSkipHttpHeaderLinesHandlingRedirect(pc->sd, urlExt, &newSd, &newUrl))
-			{
-			warn("Error processing http response for %s", url);
-			return FALSE;
-			}
-		    if (newUrl) 
-			{
-			/*  Update sd with newSd, replace it with newUrl, etc. */
-			pc->sd = newSd;
-			}
-		    }
-		++connOpen;
-		}
-	    }
-	}
-
-
-    if (connOpen == 0)
-	{
-	warn("Unable to open any connections to download %s, can't proceed, sorry", url);
-	return FALSE;
-	}
-
-
-    FD_ZERO(&rfds);
-    n = 0;
-    for(pc = pcList; pc; pc = pc->next)
-	{
-	if (pc->sd >= 0)
-	    {
-	    FD_SET(pc->sd, &rfds);    /* reset descriptor in readfds for select() */
-	    if (pc->sd > n)
-		n = pc->sd;
-	    }
-	}
-
-
-    /* Wait up to SELTIMEOUT seconds. */
-    tv.tv_sec = SELTIMEOUT;
-    tv.tv_usec = 0;
-    retval = select(n+1, &rfds, NULL, NULL, &tv);
-    /* Don't rely on the value of tv now! */
-
-    if (retval < 0)
-	{
-	perror("select retval < 0");
-	return FALSE;
-	}
-    else if (retval)
-	{
-
-	verbose(2,"returned from select, retval=%d\n", retval);
-
-	for(pc = pcList; pc; pc = pc->next)
-	    {
-	    if ((pc->sd >= 0) && FD_ISSET(pc->sd, &rfds))
-		{
-
-		verbose(2,"found a descriptor with data: %d\n", pc->sd);
-
-		readCount = read(pc->sd, buf, BUFSIZE);
-
-		verbose(2,"readCount = %lld\n", (long long) readCount);
-
-		if (readCount == 0)
-		    {
-		    close(pc->sd);
-
-		    verbose(2,"closing descriptor: %d\n", pc->sd);
-		    pc->sd = -1;
-
-		    if (fileSize != -1 && pc->received != pc->partSize)	
-			{
-			pc->sd = -2;  /* conn was closed before all data was sent, can retry later */
-			}
-		    --connOpen;
-		    ++reOpen;
-		    paraFetchWriteStatus(origPath, pcList, url, fileSize, dateString, FALSE);
-		    sinceLastStatus = 0;
-		    continue; 
-		    }
-		if (readCount < 0)
-		    {
-		    warn("error reading from socket for url %s", url);
-		    return FALSE;
-		    }
-
-		verbose(2,"rangeStart %llu  received %llu\n"
-			, (unsigned long long) pc->rangeStart
-			, (unsigned long long) pc->received );
-
-		verbose(2,"seeking to %llu\n", (unsigned long long) (pc->rangeStart + pc->received));
-
-		if (lseek(out, pc->rangeStart + pc->received, SEEK_SET) == -1)
-		    {
-		    perror("error seeking output file");
-		    warn("error seeking output file %s: rangeStart %llu  received %llu for url %s"
-			, outPath
-			, (unsigned long long) pc->rangeStart
-			, (unsigned long long) pc->received
-			, url);
-		    return FALSE;
-		    }
-		int writeCount = write(out, buf, readCount);
-		if (writeCount < 0)
-		    {
-		    warn("error writing output file %s", outPath);
-		    return FALSE;
-		    }
-		pc->received += readCount;
-		totalDownloaded += readCount;
-		sinceLastStatus += readCount;
-		if (sinceLastStatus >= 10*1024*1024)
-		    {
-		    paraFetchWriteStatus(origPath, pcList, url, fileSize, dateString, FALSE);
-		    sinceLastStatus = 0;
-		    }
-		}
-	    }
-	}
-    else
-	{
-	warn("No data within %d seconds for %s", SELTIMEOUT, url);
-	/* Retry ? */
-	if (retryCount >= scaledRetries)
-	    {
-    	    return FALSE;
-	    }
-	else
-	    {
-	    ++retryCount;
-	    /* close any open connections */
-	    for(pc = pcList; pc; pc = pc->next)
-		{
-		if (pc->sd >= 0) 
-		    {
-		    close(pc->sd);
-		    verbose(2,"closing descriptor: %d\n", pc->sd);
-		    }
-		if (pc->sd != -1) 
-		    pc->sd = -4;
-		}
-	    connOpen = 0;
-	    reOpen = 0;
-	    /* sleep for a while, maybe the server will recover */
-	    sleep(RETRYSLEEPTIME);
-	    }
-	}
-
-    }
-
-close(out);
-
-/* delete the status file - by passing TRUE */
-paraFetchWriteStatus(origPath, pcList, url, fileSize, dateString, TRUE); 
-
-/* restore original file datestamp mtime from last-modified header */
-struct tm tm;
-// Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
-// These strings are always GMT
-if (strptime(dateString, "%a, %d %b %Y %H:%M:%S %Z", &tm) == NULL)
-    {
-    warn("unable to parse last-modified string [%s]", dateString);
-    }
-else
-    {
-    time_t t;
-    // convert to UTC (GMT) time
-    t = mktimeFromUtc(&tm);
-    if (t == -1)
-	{
-	warn("mktimeFromUtc failed while converting last-modified string to UTC [%s]", dateString);
-	}
-    else
-	{
-	// update the file mtime
-	struct utimbuf ut;
-	struct stat mystat;
-	ZeroVar(&mystat);
-	if (stat(outTemp,&mystat)==0)
-	    {
-	    ut.actime = mystat.st_atime;
-	    ut.modtime = t;
-	    if (utime(outTemp, &ut)==-1)
-		{
-		char errMsg[256];
-                safef(errMsg, sizeof(errMsg), "paraFetch: error setting modification time of %s to %s\n", outTemp, dateString);
-		perror(errMsg);
-		}
-	    }
-	}
-    }
-
-/* rename the successful download to the original name */
-rename(outTemp, origPath);
-
-
-
-if (progress)
-    {
-    while (star <= starMax)
-	{
-	printf("*");fflush(stdout);
-	++star;
-	}
-    long timeDiff = (long)(time(NULL) - startTime);
-    if (timeDiff > 0)
-	{
-	printf(" %ld seconds", timeDiff);
-	float mbpersec =  ((totalDownloaded - restartTotalDownloaded)/1000000) / timeDiff;
-	printf(" %0.1f MB/sec", mbpersec);
-	}
-    printf("\n");fflush(stdout);
-    }
-
-if (fileSize != -1 && totalDownloaded != fileSize)
-    {
-    warn("Unexpected result: Total downloaded bytes %lld is not equal to fileSize %lld"
-	, (long long) totalDownloaded
-	, (long long) fileSize);
-    return FALSE;
-    }
-return TRUE;
-}
-
-boolean parallelFetch(char *url, char *outPath, int numConnections, int numRetries, 
-    boolean newer, boolean progress)
-/* Open multiple parallel connections to URL to speed downloading */
-{
-return parallelFetchInterruptable(url, outPath, numConnections, numRetries, 
-    newer, progress, NULL, NULL);
-}
-
diff --git a/gbtools/src/blatSrc/lib/peakCluster.c b/gbtools/src/blatSrc/lib/peakCluster.c
deleted file mode 100644
index f521d52..0000000
--- a/gbtools/src/blatSrc/lib/peakCluster.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/* peakCluster - cluster peak calls from different sources. Used by regCluster
- * and encodeMergeReplicates programs. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "linefile.h"
-#include "localmem.h"
-#include "sqlNum.h"
-#include "obscure.h"
-#include "peakCluster.h"
-#include "rangeTree.h"
-
-struct peakSource *peakSourceLoadAll(char *fileName, int dimCount)
-/* Read file, parse it line by line and return list of peakSources. */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-int rowSize = dimCount + 6;
-char *row[rowSize];
-struct peakSource *sourceList = NULL, *source;
-while (lineFileNextRow(lf, row, rowSize))
-    {
-    /* Allocate struct and read in fixed fields. */
-    AllocVar(source);
-    source->dataSource = cloneString(row[0]);
-    source->chromColIx = sqlUnsigned(row[1]);
-    source->startColIx = sqlUnsigned(row[2]);
-    source->endColIx = sqlUnsigned(row[3]);
-    source->scoreColIx = sqlUnsigned(row[4]);
-    source->normFactor = sqlDouble(row[5]);
-
-    /* Read in dimension labels. */
-    AllocArray(source->labels, dimCount);
-    int i;
-    for (i=0; i<dimCount; ++i)
-        source->labels[i] = cloneString(row[i+6]);
-
-    /* Calculate required columns. */
-    int minColCount = max(source->chromColIx, source->startColIx);
-    minColCount = max(minColCount, source->endColIx);
-    minColCount = max(minColCount, source->scoreColIx);
-    source->minColCount = minColCount + 1;
-    slAddHead(&sourceList, source);
-    }
-lineFileClose(&lf);
-slReverse(&sourceList);
-return sourceList;
-}
-
-void peakClusterMakerAddFromSource(struct peakClusterMaker *maker, struct peakSource *source)
-/* Read through data source and add items to it to rangeTrees in maker */
-{
-struct hash *chromHash = maker->chromHash;
-struct lineFile *lf = lineFileOpen(source->dataSource, TRUE);
-struct lm *lm = chromHash->lm;	/* Local memory pool - share with hash */
-char *row[source->minColCount];
-struct peakItem *item;
-char *line;
-while (lineFileNextReal(lf, &line))
-    {
-    char *asciiLine = lmCloneString(lm, line);
-    int wordCount = chopByWhite(line, row, source->minColCount);
-    lineFileExpectAtLeast(lf, source->minColCount, wordCount);
-    char *chrom = row[source->chromColIx];
-    struct hashEl *hel = hashLookup(chromHash, chrom);
-    if (hel == NULL)
-        {
-	struct rbTree *tree = rangeTreeNewDetailed(lm, maker->stack);
-	hel = hashAdd(chromHash, chrom, tree);
-	}
-    struct rbTree *tree = hel->val;
-    lmAllocVar(lm, item);
-    item->chrom = hel->name;
-    item->chromStart = sqlUnsigned(row[source->startColIx]);
-    item->chromEnd = sqlUnsigned(row[source->endColIx]);
-    item->score = sqlDouble(row[source->scoreColIx]) * source->normFactor;
-    if (item->score > 1000) item->score = 1000;
-    item->source = source;
-    item->asciiLine = asciiLine;
-    rangeTreeAddValList(tree, item->chromStart, item->chromEnd, item);
-    }
-lineFileClose(&lf);
-}
-
-static void addCluster(struct lm *lm, struct peakItem *itemList, int start, int end,
-	struct peakCluster **pList)
-/* Make cluster of all items that overlap start/end, and put it on list. */
-{
-struct peakCluster *cluster;
-lmAllocVar(lm, cluster);
-double score = 0.0;
-double maxSubScore = 0.0;
-struct slRef  *refList = NULL, *ref;
-struct peakItem *item;
-for (item = itemList; item != NULL; item = item->next)
-    {
-    if (rangeIntersection(start, end, item->chromStart, item->chromEnd) > 0)
-	{
-	lmAllocVar(lm, ref);
-	ref->val = item;
-	slAddHead(&refList, ref);
-	score += item->score;
-	if (item->score > maxSubScore) maxSubScore = item->score;
-	}
-    }
-slReverse(&refList);
-cluster->chrom = itemList->chrom;
-cluster->chromStart = start;
-cluster->chromEnd = end;
-cluster->itemRefList = refList;
-cluster->score = score;
-cluster->maxSubScore = maxSubScore;
-slAddHead(pList, cluster);
-}
-
-struct peakCluster *peakClusterItems(struct lm *lm, struct peakItem *itemList, 
-	double forceJoinScore, double weakLevel)
-/* Convert a list of items to a list of clusters of items.  This may break up clusters that
- * have weakly linked parts. 
-      [                ]
-      AAAAAAAAAAAAAAAAAA 
-       BBBBBB   DDDDDD
-        CCCC     EEEE
-   gets tranformed into
-       [    ]   [    ]
-      AAAAAAAAAAAAAAAAAA 
-       BBBBBB   DDDDDD
-        CCCC     EEEE
-   The strategy is to build a rangeTree of coverage, which might look something like so:
-      123333211123333211 
-   then define cluster ends that exceed the minimum limit, which is either weakLevel
-   (usually 10%) of the highest or forceJoinScore if weakLevel times the highest is 
-   more than forceJoinScore.  This will go to something like so:
-        [---]   [----]   
-   Finally the items that are overlapping a cluster are assigned to it.  Note that this
-   may mean that an item may be in multiple clusters.
-        [ABC]   [ ADE]
- */
-{
-int easyMax = round(1.0/weakLevel);
-int itemCount = slCount(itemList);
-struct peakCluster *clusterList = NULL;
-if (itemCount < easyMax)
-    {
-    struct peakItem *item = itemList;
-    int chromStart = item->chromStart;
-    int chromEnd = item->chromEnd;
-    for (item = item->next; item != NULL; item = item->next)
-        {
-	if (item->chromStart < chromStart) chromStart = item->chromStart;
-	if (item->chromEnd > chromEnd) chromEnd = item->chromEnd;
-	}
-    addCluster(lm, itemList, chromStart, chromEnd, &clusterList);
-    }
-else
-    {
-    /* Make up coverage tree. */
-    struct rbTree *covTree = rangeTreeNew();
-    struct peakItem *item;
-    for (item = itemList; item != NULL; item = item->next)
-	rangeTreeAddToCoverageDepth(covTree, item->chromStart, item->chromEnd);
-    struct range *range, *rangeList = rangeTreeList(covTree);
-
-    /* Figure out maximum coverage. */
-    int maxCov = 0;
-    for (range = rangeList; range != NULL; range = range->next)
-        {
-	int cov = ptToInt(range->val);
-	if (cov > maxCov) maxCov = cov;
-	}
-
-    /* Figure coverage threshold. */
-    int threshold = round(maxCov * weakLevel);
-    if (threshold > forceJoinScore-1) threshold = forceJoinScore-1;
-
-    /* Loop through emitting sections over threshold as clusters */
-    boolean inRange = FALSE;
-    boolean start = 0, end = 0;
-    for (range = rangeList; range != NULL; range = range->next)
-        {
-	int cov = ptToInt(range->val);
-	if (cov > threshold)
-	    {
-	    if (inRange)
-	       end = range->end;
-	    else
-	       {
-	       inRange = TRUE;
-	       start = range->start;
-	       end = range->end;
-	       }
-	    }
-	else
-	    {
-	    if (inRange)
-		{
-		addCluster(lm, itemList, start, end, &clusterList);
-		inRange = FALSE;
-		}
-	    }
-	}
-    if (inRange)
-        addCluster(lm, itemList, start, end, &clusterList);
-    }
-slReverse(&clusterList);
-return clusterList;
-}
-
-struct peakClusterMaker *peakClusterMakerNew()
-/* Return a new peakClusterMaker. */
-{
-struct peakClusterMaker *maker;
-AllocVar(maker);
-maker->chromHash = hashNew(0);
-return maker;
-}
-
-void peakClusterMakerFree(struct peakClusterMaker **pMaker)
-/* Free up a peakClusterMaker. */
-{
-struct peakClusterMaker *maker = *pMaker;
-if (maker != NULL)
-    {
-    hashFree(&maker->chromHash);
-    freez(pMaker);
-    }
-}
-
-static int cmpChromEls(const void *va, const void *vb)
-/* Compare to sort based on query start. */
-{
-const struct hashEl *a = *((struct hashEl **)va);
-const struct hashEl *b = *((struct hashEl **)vb);
-return cmpWordsWithEmbeddedNumbers(a->name, b->name);
-}
-
-struct hashEl *peakClusterMakerChromList(struct peakClusterMaker *maker)
-/* Return list of chromosomes.  In hashEl format where the hashEl val is
- * a rangeTree filled with items. */
-{
-struct hashEl *chromList =  hashElListHash(maker->chromHash);
-slSort(&chromList, cmpChromEls);
-return chromList;
-}
-
diff --git a/gbtools/src/blatSrc/lib/phyloTree.c b/gbtools/src/blatSrc/lib/phyloTree.c
deleted file mode 100644
index 11ce572..0000000
--- a/gbtools/src/blatSrc/lib/phyloTree.c
+++ /dev/null
@@ -1,421 +0,0 @@
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "dystring.h"
-#include "phyloTree.h"
-
-
-struct phyloTree *phyloReadTree(struct lineFile *lf)
-/* reads a phyloTree from lineFile (first line only) */
-{
-struct phyloTree *tree = NULL;
-char *ptr;
-int len;
-
-if (lineFileNext(lf, &ptr, &len) && (len > 0))
-    tree = phyloParseString(ptr);
-
-return tree;
-}
-
-struct phyloTree *phyloOpenTree(char *fileName)
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct phyloTree *tree = phyloReadTree(lf);
-
-lineFileClose(&lf);
-
-return tree;
-}
-
-
-static struct phyloName *parseIdent(char **ptrPtr)
-/* read a node name with possibile branch length */
-{
-struct phyloName *pName;
-char *start = *ptrPtr;
-char *ptr = *ptrPtr;
-
-AllocVar(pName);
-/* legal id's are alphanumeric */
-while(isalpha(*ptr) || isdigit(*ptr) || (*ptr == '/')
-     || (*ptr == '\'')
-     || (*ptr == '>')
-     || (*ptr == '<')
-    || (*ptr == '.') || (*ptr == '_')) 
-    ptr++;
-
-/* did we read something? */
-if(ptr > start)
-    {
-    char val;
-
-    val = *ptr;
-    *ptr = 0;
-    pName->name = cloneString(start);
-    *ptr = val;
-    }
-
-/* is there some branch length info */
-if (*ptr == ':')
-    {
-    ptr++;
-    sscanf(ptr, "%lg", &pName->length);
-    while ((*ptr != '[') && (*ptr != ')') && (*ptr != ',') && (*ptr != ';'))
-	ptr++;
-    }
-
-*ptrPtr = ptr;
-
-return pName;
-}
-
-static struct phyloTree *newEdge(struct phyloTree *parent, struct phyloTree *child)
-{
-parent->numEdges++;
-
-if (parent->numEdges > parent->allocedEdges)
-    {
-    int oldSize = parent->allocedEdges * sizeof (struct phyloTree *);
-    int newSize;
-
-    parent->allocedEdges += 5;
-    newSize = parent->allocedEdges * sizeof (struct phyloTree *);
-    parent->edges = needMoreMem(parent->edges, oldSize, newSize);
-    }
-
-if (!child)
-    errAbort("unexpected error: child is null in phyloTree.c::newEdge()");
-
-child->parent = parent;
-return parent->edges[parent->numEdges -1 ] = child;
-}
-
-struct phyloTree *phyloAddEdge(struct phyloTree *parent, struct phyloTree *child)
-/* add an edge to a phyloTree node */
-{
-return newEdge(parent, child);
-}
-
-static struct phyloTree *parseSubTree(char **ptrPtr)
-/* the recursive workhorse function, parses a tree from ptr */
-{
-struct phyloTree *node = NULL;
-char *ptr = *ptrPtr;
-
-/* trees are terminated by one of these three chars */
-if ((*ptr == ';') || (*ptr == ',') || (*ptr == ')') )
-    return NULL;
-
-AllocVar(node);
-if (*ptr == '(') 
-    {
-    struct phyloTree *edge;
-
-    ptr++;
-
-    do
-	{
-	struct phyloTree *child = parseSubTree(&ptr);
-	if (!child)
-	    errAbort("missing child/subTree at (%s)",ptr-1);
-	edge = newEdge(node,child);
-	edge->parent = node;
-	} while (*ptr++ == ',');
-    --ptr;
-    if (*ptr++ != ')') 
-	errAbort("unbalanced parenthesis at (%s)",ptr-1);
-    node->ident = parseIdent(&ptr);
-    }
-else 
-    if ((*ptr == ':') || (isalpha(*ptr))|| (isdigit(*ptr)) 
-	 || (*ptr == '\'') || (*ptr == '.'))
-	node->ident = parseIdent(&ptr);
-else
-    errAbort("illegal char '%c' in phyloString",*ptr);
-
-if (*ptr == '[')
-    {
-    if (startsWith("[&&NHX:D=Y]",ptr))
-	node->isDup = TRUE;
-
-    while(*ptr != ']')
-	ptr++;
-
-    ptr++;
-
-    }
-
-*ptrPtr = ptr;
-
-
-return node;
-}
-
-struct phyloTree *phyloParseString(char *string)
-/* build a phyloTree from a string */
-{
-struct phyloTree *tree = NULL;
-char *ptr = string;
-
-eraseWhiteSpace(string);
-
-tree = parseSubTree(&ptr);
-
-if (*ptr != ';')
-    errAbort("expecting tree terminator ';', found '%s'", ptr);
-
-return tree;
-}
-
-
-/*  some static stuff for printing out trees */
-static int recurseCount = 0;
-
-static void tabOut(FILE *f)
-{
-int i;
-
-for(i=0; i < recurseCount; i++)
-    fputc(' ',f);
-}
-
-static void pTree( struct phyloTree *tree,FILE *f, boolean noDups)
-/* print out phylogenetic tree in Newick format */
-{
-if (tree)
-    {
-    int ii;
-    if (noDups && (tree->numEdges == 1))
-	pTree(tree->edges[0], f, noDups);
-    else 
-	{
-	if (tree->numEdges)
-	    {
-	    fprintf(f,"(");
-	    for (ii= 0; ii < tree->numEdges; ii++)
-		{
-		pTree(tree->edges[ii], f, noDups);
-		if (ii + 1 < tree->numEdges)
-		    fprintf(f,",");
-		}
-	    fprintf(f,")");
-	    }
-	if (tree->ident->name)
-	    fprintf(f,"%s",tree->ident->name);
-	//if (tree->ident->length != 0.0)
-	    fprintf(f,":%0.04g", tree->ident->length);
-	if (tree->isDup)
-	    fprintf(f,"[&&NHX:D=Y]");
-	}
-    }
-}
-
-void phyloPrintTreeNoDups( struct phyloTree *tree,FILE *f)
-/* print out phylogenetic tree in Newick format (only speciation nodes) */
-{
-pTree(tree, f, TRUE);
-fprintf(f, ";\n");
-}
-
-void phyloPrintTree( struct phyloTree *tree,FILE *f)
-/* print out phylogenetic tree in Newick format */
-{
-pTree(tree, f, FALSE);
-fprintf(f, ";\n");
-}
-
-void phyloDebugTree( struct phyloTree *tree,FILE *f)
-/* print out phylogenetic tree */
-{
-if (tree)
-    {
-    int ii;
-    fprintf(f,"%s:%g numEdges %d\n",tree->ident->name, tree->ident->length, tree->numEdges);
-    recurseCount++;
-    for (ii= 0; ii < tree->numEdges; ii++)
-	{
-	tabOut(f);
-	phyloDebugTree(tree->edges[ii], f);
-	}
-    recurseCount--;
-    }
-}
-
-struct phyloTree *phyloFindName( struct phyloTree *tree,char *name )
-/* find the node with this name */
-{
-struct phyloTree *subTree = NULL;
-int ii;
-
-if (tree->ident->name && sameString(tree->ident->name, name))
-    return tree;
-
-for (ii=0; ii < tree->numEdges; ii++)
-    {
-    if ((subTree = phyloFindName( tree->edges[ii], name)) != NULL)
-	break;
-    }
-
-return subTree;
-}
-
-void phyloClearTreeMarks(struct phyloTree *tree)
-/* clear the favorite child marks */
-{
-int ii;
-
-tree->mark = 0;
-
-for (ii=0; ii < tree->numEdges; ii++)
-    phyloClearTreeMarks(tree->edges[ii]);
-}
-
-struct phyloTree *phyloFindMarkUpTree(struct phyloTree *tree)
-/* find a marked node somewhere above this node */
-{
-do
-    {
-    if (tree->mark)
-	return tree;
-    tree = tree->parent;
-    } while (tree);
-
-return NULL;
-}
-
-void phyloMarkUpTree(struct phyloTree *tree)
-/* mark all the nodes from this one up to the top of the tree */
-{
-    tree->mark = tree;
-    for(;tree->parent; tree = tree->parent)
-	tree->parent->mark = tree;
-}
-
-char *phyloFindPath(struct phyloTree *tree, char *ref, char *cross)
-/* find the shortest path from ref to cross (returns a list
- * of the node names separated by spaces) */
-{
-struct phyloTree *treeRef, *treeCross, *parent;
-struct dyString *ds = newDyString(0);
-
-if ((treeRef = phyloFindName(tree,ref)) == NULL)
-    return NULL;
-
-if ((treeCross = phyloFindName(tree,cross)) == NULL)
-    return NULL;
-
-phyloClearTreeMarks(tree);
-phyloMarkUpTree(treeCross);
-if ((parent = phyloFindMarkUpTree(treeRef)) == NULL)
-    return NULL;
-
-/* walk up the tree till we hit the common parent */
-while(treeRef != parent)
-    {
-    treeRef = treeRef->parent;
-    if (ds->stringSize)
-	dyStringAppendC(ds, ' ');
-    if (treeRef->ident->name)
-	dyStringAppendN(ds, treeRef->ident->name, strlen(treeRef->ident->name));
-    }
-
-/* now walk down the tree till we come to the target species */
-while (parent != treeCross)
-    {
-    parent = parent->mark;
-    dyStringAppendC(ds, ' ');
-    if (parent->ident->name)
-	dyStringAppendN(ds, parent->ident->name, strlen(parent->ident->name));
-    }
-
-return ds->string;
-}
-
-
-static void nodeNames(struct phyloTree *tree, struct dyString *ds)
-/* recursive workhorse to add all the node names to a string */
-{
-int ii;
-
-if (tree->ident->name)
-    {
-    dyStringAppendN(ds, tree->ident->name, strlen(tree->ident->name));
-    dyStringAppendC(ds, ' ');
-    }
-
-for (ii=0; ii < tree->numEdges; ii++)
-    nodeNames(tree->edges[ii],ds);
-}
-
-char *phyloNodeNames(struct phyloTree *tree)
-/* add all the node names to a dy string */
-{
-struct dyString *ds = newDyString(0);
-
-nodeNames(tree, ds);
-
-ds->string[ds->stringSize-1]=0;
-
-return ds->string;
-}
-
-
-static void reParent(struct phyloTree *tree)
-{
-if (tree->parent)
-    {
-    struct phyloTree *edge, *saveParent = tree->parent;
-
-    reParent(saveParent); /* make the parent into the root */
-    phyloDeleteEdge(saveParent, tree); /* remove this tree from the
-					  parent tree */
-    tree->parent = NULL; /* make this tree the root */
-    edge = newEdge(tree, saveParent); /* add the old parent tree as a
-					child of the new root */
-    edge->parent = tree; /* set the parent in the new child */
-
-    edge->ident->length = tree->ident->length;
-    }
-}
-
-struct phyloTree *phyloReRoot(struct phyloTree *tree)
-/* return a tree whose root is tree and what were parents are now "right" children */
-{
-reParent(tree);
-tree->ident->length = 0;
-
-return tree;
-}
-
-void phyloDeleteEdge(struct phyloTree *tree, struct phyloTree *edge)
-/* delete an edge from a node.  Aborts on error */
-{
-int ii;
-
-for (ii=0; ii < tree->numEdges; ii++)
-    if (tree->edges[ii] == edge)
-	{
-	memcpy(&tree->edges[ii], &tree->edges[ii+1], sizeof(tree) * (tree->numEdges - ii - 1));
-	tree->numEdges--;
-	//phyloFreeTree(edge);
-	return;
-	}
-
-errAbort("tried to delete non-existant edge");
-}
-
-int phyloCountLeaves(struct phyloTree *tree)
-{
-int ii, count = 0;
-
-if (tree->numEdges == 0)
-    return 1;
-
-for (ii=0; ii < tree->numEdges; ii++)
-    count += phyloCountLeaves(tree->edges[ii]);
-
-return count;
-}
diff --git a/gbtools/src/blatSrc/lib/pipeline.c b/gbtools/src/blatSrc/lib/pipeline.c
deleted file mode 100644
index d56ad26..0000000
--- a/gbtools/src/blatSrc/lib/pipeline.c
+++ /dev/null
@@ -1,735 +0,0 @@
-/* pipeline.c - create a process pipeline that can be used for reading or
- * writing  */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "pipeline.h"
-#include "common.h"
-#include "sqlNum.h"
-#include "dystring.h"
-#include "errAbort.h"
-#include "portable.h"
-#include "linefile.h"
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/wait.h>
-#include <signal.h>
-
-enum procState
-/* process state, in order of transition */
-{
-    procStateNew,  // plProc object created
-    procStateRun,  // proccess running
-    procStateDone  // process finished (ok or failed)
-};
-
-struct plProc
-/* A single process in a pipeline */
-{
-    struct plProc *next;   /* order list of processes */
-    struct pipeline *pl;   /* pipeline we are associated with */
-    char **cmd;            /* null-terminated command for this process */
-    pid_t  pid;            /* pid for process, -1 if not running */
-    enum procState state;  /* state of process */
-    int status;            /* status from wait */
-};
-
-struct pipeline
-/* Object for a process pipeline and associated open file.  Pipeline process
- * consist of a process group leader and then all of the child process.  The
- * group leader does no work, just wait on processes to complete and report
- * errors to the top level process.  This object is create in the calling
- * process, and then passed down, but not shared, via forks.
- */
-{
-    struct plProc *procs;      /* list of processes */
-    int numRunning;            /* number of processes running */
-    pid_t groupLeader;         /* process group id, or -1 if not set. This is pid of group leader */
-    char *procName;            /* name to use in error messages. */
-    int pipeFd;                /* fd of pipe to/from process, -1 if none */
-    unsigned options;          /* options */
-    FILE* pipeFh;              /* optional stdio around pipe */
-    char* stdioBuf;            /* optional stdio buffer */
-    struct lineFile *pipeLf;   /* optional lineFile around pipe */
-};
-
-/* file buffer size */
-#define FILE_BUF_SIZE 64*1024
-
-static int pipeCreate(int *writeFd)
-/* create a pipe or die, return readFd */
-{
-int pipeFds[2];
-if (pipe(pipeFds) < 0)
-    errnoAbort("can't create pipe");
-*writeFd = pipeFds[1];
-return pipeFds[0];
-}
-
-static void safeClose(int *fdPtr)
-/* Close with error checking.  *fdPtr == -1 indicated already closed */
-{
-int fd = *fdPtr;
-if (fd != -1)
-    {
-    if (close(fd) < 0)
-        errnoAbort("close failed on fd %d", fd);
-    *fdPtr = -1;
-    }
-}
-
-static void closeNonStdDescriptors(void)
-/* close non-standard file descriptors */
-{
-long maxFd = sysconf(_SC_OPEN_MAX);
-if (maxFd < 0)
-    maxFd = 4096;  // shouldn't really happen
-int fd;
-for (fd = STDERR_FILENO+1; fd < maxFd; fd++)
-    close(fd);
-}
-
-static char* joinCmd(char **cmd)
-/* join an cmd vector into a space separated string */
-{
-struct dyString *str = dyStringNew(512);
-int i;
-for (i = 0; cmd[i] != NULL; i++)
-    {
-    if (i > 0)
-        dyStringAppend(str, " ");
-    dyStringAppend(str, cmd[i]);
-    }
-return dyStringCannibalize(&str);
-}
-
-static char* joinCmds(char ***cmds)
-/* join an cmds vetor into a space and pipe separated string */
-{
-struct dyString *str = dyStringNew(512);
-int i, j;
-for (i = 0; cmds[i] != NULL; i++)
-    {
-    if (i > 0)
-        dyStringAppend(str, " | ");
-    for (j = 0; cmds[i][j] != NULL; j++)
-        {
-        if (j > 0)
-            dyStringAppend(str, " ");
-        dyStringAppend(str, cmds[i][j]);
-        }
-    }
-return dyStringCannibalize(&str);
-}
-
-static char** cloneCmdVector(char **cmd)
-/* make a copy of the vector */
-{
-int i, cmdLen = 0;
-for (i = 0; cmd[i] != NULL; i++)
-    cmdLen++;
-char **cmd2 = needMem((cmdLen+1)*sizeof(char*));
-
-for (i = 0; i < cmdLen; i++)
-    cmd2[i] = cloneString(cmd[i]);
-cmd2[cmdLen] = NULL;
-return cmd2;
-}
-
-static struct plProc* plProcNew(char **cmd, struct pipeline *pl)
-/* create a new plProc object for a command. */
-{
-struct plProc* proc;
-AllocVar(proc);
-proc->pl = pl;
-proc->cmd = cloneCmdVector(cmd);
-proc->state = procStateNew;
-return proc;
-}
-
-static void plProcFree(struct plProc *proc)
-/* free a plProc object. */
-{
-int i;
-for (i = 0; proc->cmd[i] != NULL; i++)
-    freeMem(proc->cmd[i]);
-freeMem(proc->cmd);
-freeMem(proc);
-}
-
-static void plProcStateTrans(struct plProc *proc, enum procState newState)
-/* do state transition for process changing it to a new state  */
-{
-// States must transition in order.  New state must immediately follow the
-// current state.
-if (newState != proc->state+1)
-    errAbort("invalid state transition: %d -> %d", proc->state, newState);
-proc->state = newState;
-}
-
-static void plProcSetup(struct plProc* proc, int stdinFd, int stdoutFd, int stderrFd)
-/* setup signal, error handling, and file descriptors after fork */
-{
-/* Optionally treat a closed pipe as an EOF rather than getting SIGPIPE */
-if (signal(SIGPIPE, ((proc->pl->options & pipelineSigpipe) ? SIG_DFL : SIG_IGN)) == SIG_ERR)
-    errnoAbort("error ignoring SIGPIPE");
-
-if (setpgid(getpid(), proc->pl->groupLeader) != 0)
-    errnoAbort("error from setpgid(%d, %d)", getpid(), proc->pl->groupLeader);
-
-/* child, first setup stdio files */
-if (stdinFd != STDIN_FILENO)
-    {
-    if (dup2(stdinFd, STDIN_FILENO) < 0)
-        errnoAbort("can't dup2 to stdin");
-    }
-    
-if (stdoutFd != STDOUT_FILENO)
-    {
-    if (dup2(stdoutFd, STDOUT_FILENO) < 0)
-        errnoAbort("can't dup2 to stdout");
-    }
-    
-if (stderrFd != STDERR_FILENO)
-    {
-    if (dup2(stderrFd, STDERR_FILENO) < 0)
-        errnoAbort("can't dup2 to stderr");
-    }
-closeNonStdDescriptors();
-}
-
-static void plProcExecChild(struct plProc* proc, int stdinFd, int stdoutFd, int stderrFd)
-/* child part of process startup. */
-{
-plProcSetup(proc, stdinFd, stdoutFd, stderrFd);
-execvp(proc->cmd[0], proc->cmd);
-errnoAbort("exec failed: %s", proc->cmd[0]);
-}
-
-static void plProcMemWrite(struct plProc* proc, int stdoutFd, int stderrFd, void *otherEndBuf, size_t otherEndBufSize)
-/* implements child process to write memory buffer to pipeline after
- * fork */
-{
-plProcSetup(proc, STDIN_FILENO, stdoutFd, stderrFd);
-ssize_t wrCnt = write(STDOUT_FILENO, otherEndBuf, otherEndBufSize);
-if (wrCnt < 0)
-    errnoAbort("pipeline input buffer write failed");
-else if (wrCnt != otherEndBufSize)
-    errAbort("pipeline input buffer short write %lld, expected %lld",
-             (long long)wrCnt, (long long)otherEndBufSize);
-else
-    {
-    close(STDOUT_FILENO);
-    exit(0);
-    }
-}
-
-static void plProcHandleSignaled(struct plProc* proc, int status)
-/* handle one of the processes terminating on a signal */
-{
-assert(WIFSIGNALED(proc->status));
-if (!((WTERMSIG(proc->status) == SIGPIPE) && (proc->pl->options & pipelineSigpipe)))
-    {
-    errAbort("process terminated on signal %d: \"%s\" in pipeline \"%s\"",
-             WTERMSIG(proc->status), joinCmd(proc->cmd), proc->pl->procName);
-    }
-}
-
-static void plProcHandleExited(struct plProc* proc, int status)
-/* handle one of the processes terminating on an exit */
-{
-assert(WIFEXITED(proc->status));
-if (WEXITSTATUS(proc->status) != 0)
-    {
-    // only print an error message if aborting
-    if (!(proc->pl->options & pipelineNoAbort))
-        fprintf(stderr, "process exited with %d: \"%s\" in pipeline \"%s\"\n",
-                WEXITSTATUS(proc->status), joinCmd(proc->cmd), proc->pl->procName);
-    exit(WEXITSTATUS(proc->status));  // pass back exit code
-    }
-}
-
-static void plProcHandleTerminate(struct plProc* proc, int status)
-/* handle one of the processes terminating, save exit status */
-{
-proc->pid = -1;
-proc->status = status;
-plProcStateTrans(proc, procStateDone);
-
-if (WIFSIGNALED(proc->status))
-    plProcHandleSignaled(proc, status);
-else
-    plProcHandleExited(proc, status);
-}
-
-static struct pipeline* pipelineNew(char ***cmds, unsigned options)
-/* create a new pipeline object. Doesn't start processes */
-{
-static char *memPseudoCmd[] = {"[mem]", NULL};
-struct pipeline *pl;
-int iCmd;
-
-AllocVar(pl);
-pl->groupLeader = -1;
-pl->pipeFd = -1;
-pl->options = options;
-pl->procName = joinCmds(cmds);
-
-if (cmds[0] == NULL)
-    errAbort("no commands in pipeline");
-
-if (options & pipelineMemInput)
-    {
-    /* add proc for forked process to write memory to pipeline */
-    slAddTail(&pl->procs, plProcNew(memPseudoCmd, pl));
-    }
-
-for(iCmd = 0; cmds[iCmd] != NULL; iCmd++)
-    slAddTail(&pl->procs, plProcNew(cmds[iCmd], pl));
-
-return pl;
-}
-
-void pipelineFree(struct pipeline **plPtr)
-/* free a pipeline object */
-{
-struct pipeline *pl = *plPtr;
-if (pl != NULL)
-    {
-    struct plProc *proc = pl->procs;
-    while (proc != NULL)
-        {
-        struct plProc *delProc = proc;
-        proc = proc->next;
-        plProcFree(delProc);
-        }
-    freez(&pl->procName);
-    freez(&pl->stdioBuf);
-    freez(plPtr);
-    }
-}
-
-static struct plProc *pipelineFindProc(struct pipeline *pl, pid_t pid)
-/* find a plProc by pid */
-{
-struct plProc *proc;
-for (proc = pl->procs; proc != NULL; proc = proc->next)
-    if (proc->pid == pid)
-        return proc;
-errAbort("pid not found in pipeline: %d", (int)pid);
-return 0; // never reached
-}
-
-static void execProcChild(struct pipeline* pl, struct plProc *proc,
-                          int procStdinFd, int procStdoutFd, int stderrFd,
-                          void *otherEndBuf, size_t otherEndBufSize)
-/* handle child process setup after fork.  This does not return */
-{
-if (otherEndBuf != NULL)
-    plProcMemWrite(proc, procStdoutFd, stderrFd, otherEndBuf, otherEndBufSize);
-else
-    plProcExecChild(proc, procStdinFd, procStdoutFd, stderrFd);
-}
-
-static int pipelineExecProc(struct pipeline* pl, struct plProc *proc,
-                            int prevStdoutFd, int stdinFd, int stdoutFd, int stderrFd,
-                            void *otherEndBuf, size_t otherEndBufSize)
-/* start a process in the pipeline, return the stdout fd of the process */
-{
-/* determine stdin/stdout to use */
-int procStdinFd, procStdoutFd;
-if (proc == pl->procs)
-    procStdinFd = stdinFd; /* first process in pipeline */
-else
-    procStdinFd = prevStdoutFd;
-if (proc->next == NULL)
-    procStdoutFd = stdoutFd; /* last process in pipeline */
-else
-    prevStdoutFd = pipeCreate(&procStdoutFd);
-
-/* start process */
-if ((proc->pid = fork()) < 0)
-    errnoAbort("can't fork");
-if (proc->pid == 0)
-    execProcChild(pl, proc, procStdinFd, procStdoutFd, stderrFd, otherEndBuf, otherEndBufSize);
-
-/* record that we did this */
-plProcStateTrans(proc, procStateRun);
-pl->numRunning++;
-
-/* don't leave intermediate pipes open in parent */
-if (proc != pl->procs)
-    safeClose(&procStdinFd);
-if (proc->next != NULL)
-    safeClose(&procStdoutFd);
-
-return prevStdoutFd;
-}
-
-static void pipelineGroupExec(struct pipeline* pl, int stdinFd, int stdoutFd, int stderrFd,
-                              void *otherEndBuf, size_t otherEndBufSize)
-/* Start all processes in a pipeline, stdinFd and stdoutFd are the ends of
- * the pipeline, stderrFd is applied to all processed */
-{
-struct plProc *proc;
-int prevStdoutFd = -1;
-for (proc = pl->procs; proc != NULL; proc = proc->next)
-    {
-    prevStdoutFd = pipelineExecProc(pl, proc, prevStdoutFd,
-                                    stdinFd, stdoutFd, stderrFd,
-                                    otherEndBuf, otherEndBufSize);
-    otherEndBuf = NULL;  /* only for first process (read pipes) */
-    otherEndBufSize = 0;
-    }
-}
-
-static void waitOnOne(struct pipeline *pl)
-/* wait on one process to finish */
-{
-int status;
-pid_t pid = waitpid(-pl->groupLeader, &status, 0);
-if (pid < 0)
-    errnoAbort("waitpid failed");
-plProcHandleTerminate(pipelineFindProc(pl, pid), status);
-pl->numRunning--;
-assert(pl->numRunning >= 0);
-}
-
-static void groupWait(struct pipeline *pl)
-/* Wait for pipeline to complete */
-{
-/* wait on all processes to complete */
-while (pl->numRunning > 0)
-    waitOnOne(pl);
-}
-
-static void groupLeaderRun(struct pipeline* pl, int stdinFd, int stdoutFd, int stderrFd,
-                           void *otherEndBuf, size_t otherEndBufSize)
-/* group leader process */
-{
-pl->groupLeader = getpid();
-if (setpgid(pl->groupLeader, pl->groupLeader) != 0)
-    errnoAbort("error from child setpgid(%d, %d)", pl->groupLeader, pl->groupLeader);
-pipelineGroupExec(pl, stdinFd, stdoutFd, stderrFd, otherEndBuf, otherEndBufSize);
-
-// only keep stderr open
-close(STDIN_FILENO);
-close(STDOUT_FILENO);
-closeNonStdDescriptors();
-groupWait(pl);
-exit(0);
-}
-
-static int groupLeaderWait(struct pipeline *pl)
-/* Wait for group leader to complete. If pipelineNoAbort was specified, return
- * the exit code of the first group process exit non-zero, or zero if none
- * failed. */
-{
-int status;
-pid_t pid = waitpid(-pl->groupLeader, &status, 0);
-if (pid < 0)
-    errnoAbort("waitpid failed");
-if (WIFSIGNALED(status))
-    errAbort("process pipeline terminated on signal %d", WTERMSIG(status));
-assert(WIFEXITED(status));
-
-if ((WEXITSTATUS(status) != 0) && !(pl->options & pipelineNoAbort))
-    errAbort("pipeline exited with %d", WEXITSTATUS(status));
-return WEXITSTATUS(status);
-}
-
-static void pipelineExec(struct pipeline* pl, int stdinFd, int stdoutFd, int stderrFd,
-                         void *otherEndBuf, size_t otherEndBufSize)
-/* Fork the group leader, which then launches all processes in a pipeline,
- * stdinFd and stdoutFd are the ends of the pipeline, stderrFd is applied to
- * all processes, including group leader */
-{
-assert(pl->groupLeader < 0);  // should not be set
-if ((pl->groupLeader = fork()) < 0)
-    errnoAbort("can't fork");
-if (pl->groupLeader == 0)
-    {
-    groupLeaderRun(pl, stdinFd, stdoutFd, stderrFd, otherEndBuf, otherEndBufSize);
-    exit(1); // doesn't return to here
-    }
-else
-    {
-    // parent also must also setpgid to prevent race condition
-    if (setpgid(pl->groupLeader, pl->groupLeader) != 0)
-        errnoAbort("error from parent setpgid(%d, %d)", pl->groupLeader, pl->groupLeader);
-    }
-} 
-
-static int openRead(char *fname)
-/* open a file for reading */
-{
-int fd = open(fname, O_RDONLY);
-if (fd < 0)
-    errnoAbort("can't open for read access: %s", fname);
-return fd;
-}
-
-static int openWrite(char *fname, boolean append)
-/* open a file for write access */
-{
-int flags = O_WRONLY|O_CREAT;
-if (append)
-    flags |= O_APPEND;
-else
-    flags |= O_TRUNC;
-int fd = open(fname, flags, 0666);
-if (fd < 0)
-    errnoAbort("can't open for write access: %s", fname);
-return fd;
-}
-
-static void pipelineStartRead(struct pipeline *pl, int stdinFd, int stderrFd,
-                              void *otherEndBuf, size_t otherEndBufSize)
-/* start a read pipeline */
-{
-int pipeWrFd;
-pl->pipeFd = pipeCreate(&pipeWrFd);
-pipelineExec(pl, stdinFd, pipeWrFd, stderrFd, otherEndBuf, otherEndBufSize);
-safeClose(&pipeWrFd);
-}
-
-static void pipelineStartWrite(struct pipeline *pl, int stdoutFd, int stderrFd)
-/* start a write pipeline */
-{
-int pipeRdFd = pipeCreate(&pl->pipeFd);
-pipelineExec(pl, pipeRdFd, stdoutFd, stderrFd, NULL, 0);
-safeClose(&pipeRdFd);
-}
-
-static void checkOpts(unsigned opts)
-/* check option set for consistency */
-{
-if (((opts & (pipelineRead|pipelineWrite)) == 0)
-    || ((opts & (pipelineRead|pipelineWrite)) == (pipelineRead|pipelineWrite)))
-    errAbort("must specify one of pipelineRead or pipelineWrite to pipelineOpen");
-if ((opts & pipelineAppend) && ((opts & pipelineWrite) == 0))
-    errAbort("pipelineAppend is valid only in conjunction with pipelineWrite");
-}
-
-struct pipeline *pipelineOpenFd(char ***cmds, unsigned opts,
-                                int otherEndFd, int stderrFd)
-/* Create a pipeline from an array of commands.  See pipeline.h for
- * full documentation. */
-{
-struct pipeline *pl;
-
-checkOpts(opts);
-pl = pipelineNew(cmds, opts);
-if (opts & pipelineRead)
-    pipelineStartRead(pl, otherEndFd, stderrFd, NULL, 0);
-else
-    pipelineStartWrite(pl, otherEndFd, stderrFd);
-return pl;
-}
-
-struct pipeline *pipelineOpen(char ***cmds, unsigned opts,
-                              char *otherEndFile, char *stderrFile)
-/* Create a pipeline from an array of commands.  See pipeline.h for
- * full documentation */
-{
-int otherEndFd;
-int stderrFd = (stderrFile == NULL) ? STDERR_FILENO : openWrite(stderrFile, FALSE);
-
-checkOpts(opts);
-boolean append = ((opts & pipelineAppend) != 0);
-if (opts & pipelineRead)
-    otherEndFd = (otherEndFile == NULL) ? STDIN_FILENO : openRead(otherEndFile);
-else
-    otherEndFd = (otherEndFile == NULL) ? STDOUT_FILENO : openWrite(otherEndFile, append);
-struct pipeline *pl = pipelineOpenFd(cmds, opts, otherEndFd, stderrFd);
-safeClose(&otherEndFd);
-if (stderrFile != NULL)
-    safeClose(&stderrFd);
-return pl;
-}
-
-struct pipeline *pipelineOpenMem(char ***cmds, unsigned opts,
-                                 void *otherEndBuf, size_t otherEndBufSize,
-                                 int stderrFd)
-/* Create a pipeline from an array of commands, with the pipeline input/output
- * in a memory buffer.  See pipeline.h for full documentation.  Currently only
- * input to a read pipeline is supported  */
-{
-struct pipeline *pl;
-checkOpts(opts);
-if (opts & pipelineWrite)
-    errAbort("pipelineOpenMem only supports read pipelines at this time");
-opts |= pipelineMemInput;
-
-pl = pipelineNew(cmds, opts);
-pipelineStartRead(pl, STDIN_FILENO, stderrFd, otherEndBuf, otherEndBufSize);
-return pl;
-}
-
-struct pipeline *pipelineOpenFd1(char **cmd, unsigned opts,
-                                 int otherEndFd, int stderrFd)
-/* like pipelineOpenFd(), only takes a single command */
-{
-char **cmds[2];
-cmds[0] = cmd;
-cmds[1] = NULL;
-return pipelineOpenFd(cmds, opts, otherEndFd, stderrFd);
-}
-
-struct pipeline *pipelineOpen1(char **cmd, unsigned opts,
-                               char *otherEndFile, char *stderrFile)
-/* like pipelineOpen(), only takes a single command */
-{
-char **cmds[2];
-cmds[0] = cmd;
-cmds[1] = NULL;
-return pipelineOpen(cmds, opts, otherEndFile, stderrFile);
-}
-
-struct pipeline *pipelineOpenMem1(char **cmd, unsigned opts,
-                                  void *otherEndBuf, size_t otherEndBufSize,
-                                  int stderrFd)
-/* like pipelineOpenMem(), only takes a single command */
-{
-char **cmds[2];
-cmds[0] = cmd;
-cmds[1] = NULL;
-return pipelineOpenMem(cmds, opts, otherEndBuf, otherEndBufSize, stderrFd);
-}
-
-char *pipelineDesc(struct pipeline *pl)
-/* Get the description of a pipeline for use in error messages */
-{
-return pl->procName;
-}
-
-int pipelineFd(struct pipeline *pl)
-/* Get the file descriptor for a pipeline */
-{
-return pl->pipeFd;
-}
-
-FILE *pipelineFile(struct pipeline *pl)
-/* Get a FILE object wrapped around the pipeline.  Do not close the FILE, is
- * owned by the pipeline object.  A FILE is created on first call to this
- * function.  Subsequent calls return the same FILE.*/
-{
-if (pl->pipeFh == NULL)
-    {
-    /* create FILE* on first access */
-    char *mode = (pl->options & pipelineRead) ? "r" : "w";
-    if (pl->pipeLf != NULL)
-        errAbort("can't call pipelineFile after having associated a lineFile with a pipeline");
-    pl->pipeFh = fdopen(pl->pipeFd, mode);
-    if (pl->pipeFh == NULL)
-        errnoAbort("fdopen failed for: %s", pl->procName);
-    pl->stdioBuf = needLargeMem(FILE_BUF_SIZE);
-    setvbuf(pl->pipeFh, pl->stdioBuf,  _IOFBF, FILE_BUF_SIZE);
-    }
-return pl->pipeFh;
-}
-
-struct lineFile *pipelineLineFile(struct pipeline *pl)
-/* Get a lineFile object wrapped around the pipeline.  Do not close the
- * lineFile, is owned by the pipeline object.  A lineFile is created on first
- * call to this function.  Subsequent calls return the same object.*/
-{
-if (pl->pipeLf == NULL)
-    {
-    /* create line on first acess */
-    if (pl->pipeFh != NULL)
-        errAbort("can't call pipelineLineFile after having associated a FILE with a pipeline");
-    if (pl->options & pipelineWrite)
-        errAbort("can't associated a lineFile with a write pipeline");
-    pl->pipeLf = lineFileAttach(pipelineDesc(pl), TRUE, pl->pipeFd);
-    }
-return pl->pipeLf;
-}
-
-static void closePipelineFile(struct pipeline *pl)
-/* close a pipeline with a FILE associated with it */
-{
-if (pl->options & pipelineWrite)
-    {
-    fflush(pl->pipeFh);
-    if (ferror(pl->pipeFh))
-        errAbort("write failed to pipeline: %s ", pl->procName);
-    }
-else if (ferror(pl->pipeFh))
-    errAbort("read failed from pipeline: %s ", pl->procName);
-
-if (fclose(pl->pipeFh) == EOF)
-    errAbort("close failed on pipeline: %s ", pl->procName);
-pl->pipeFh = NULL;
-}
-
-static void closePipeline(struct pipeline *pl)
-/* Close the pipe file */
-{
-if (pl->pipeFh != NULL)
-    closePipelineFile(pl);
-else if (pl->pipeLf != NULL)
-    lineFileClose(&pl->pipeLf);
-else
-    {
-    if (close(pl->pipeFd) < 0)
-        errAbort("close failed on pipeline: %s ", pl->procName);
-    }
-pl->pipeFd = -1;
-}
-
-int pipelineWait(struct pipeline *pl)
-/* Wait for processes in a pipeline to complete; normally aborts if any
- * process exists non-zero.  If pipelineNoAbort was specified, return the exit
- * code of the first process exit non-zero, or zero if none failed. */
-{
-/* must close before waiting to so processes get pipe EOF */
-closePipeline(pl);
-return groupLeaderWait(pl);
-}
-
-int pipelineClose(struct pipeline **pPl)
-/* Wait for pipeline to finish and free it. Same as pipelineWait then pipelineClose.
- * Returns pipelineWait result (normally 0). */
-{
-struct pipeline *pl = *pPl;
-int ret = 0;
-if (pl != NULL)
-    {
-    ret = pipelineWait(pl);
-    pipelineFree(pPl);
-    }
-return ret;
-}
-
-void pipelineSetNoAbort(struct pipeline *pl)
-/* Make it so pipeline won't abort on error - can be done after the fact.
- * (This is needed to close a pipelined lineFile early.) */
-{
-pl->options |= pipelineNoAbort;
-}
-
-void pipelineDumpCmds(char ***cmds)
-/* Dump out pipeline-formatted commands to stdout for debugging. */
-{
-char **cmd;
-boolean first = TRUE;
-while ((cmd = *cmds++) != NULL)
-   {
-   char *word;
-   if (first)
-      first = FALSE;
-   else
-      printf("| ");
-   while ((word = *cmd++) != NULL)
-       printf("%s ", word);
-   }
-printf("<BR>\n");
-}
-
-/*
- * Local Variables:
- * c-file-style: "jkent-c"
- * End:
- */
diff --git a/gbtools/src/blatSrc/lib/pngwrite.c b/gbtools/src/blatSrc/lib/pngwrite.c
deleted file mode 100644
index debdd4b..0000000
--- a/gbtools/src/blatSrc/lib/pngwrite.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/* pngwrite.c - write out a memGfx to a PNG file, using the reference library libpng */
-/* (libpng is available from sourceforge and included in many open source distros,
- *  has a wide-open license intended to encourage usage of the PNG format, and the lib
- *  has been under development and testing for 14 years -- http://libpng.org/) */
-
-
-#include "png.h"   // MUST come before common.h, due to setjmp checking  in pngconf.h 
-#include "common.h"
-#include "memgfx.h"
-
-
-static void pngAbort(png_structp png, png_const_charp errorMessage)
-/* type png_error wrapper around errAbort */
-{
-errAbort("%s", (char *)errorMessage);
-}
-
-static void pngWarn(png_structp png, png_const_charp warningMessage)
-/* type png_error wrapper around warn */
-{
-warn("%s", (char *)warningMessage);
-}
-
-boolean mgSaveToPng(FILE *png_file, struct memGfx *mg, boolean useTransparency)
-/* Save PNG to an already open file.
- * If useTransparency, then the first color in memgfx's colormap/palette is
- * assumed to be the image background color, and pixels of that color
- * are made transparent. */
-/* Reference: http://libpng.org/pub/png/libpng-1.2.5-manual.html */
-{
-if (!png_file || !mg)
-    errAbort("mgSaveToPng: called with a NULL");
-png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING,
-					  NULL, // don't need pointer to data for err/warn handlers
-					  pngAbort, pngWarn);
-if (!png)
-    {
-    errAbort("png_write_struct failed");
-    return FALSE;
-    }
-png_infop info = png_create_info_struct(png);
-if (!info)
-    {
-    errAbort("png create_info_struct failed");
-    png_destroy_write_struct(&png, NULL);
-    return FALSE;
-    }
-
-// If setjmp returns nonzero, it means png_error is returning control here.
-// But that should not happen because png_error should call pngAbort which calls errAbort.
-if (setjmp(png_jmpbuf(png)))
-    {
-    png_destroy_write_struct(&png, &info);
-    fclose(png_file);
-    errAbort("pngwrite: setjmp nonzero.  "
-	     "why didn't png_error..pngAbort..errAbort stop execution before this errAbort?");
-    return FALSE;
-    }
-
-// Configure PNG output params:
-png_init_io(png, png_file);
-#ifdef COLOR32
-png_set_IHDR(png, info, mg->width, mg->height, 8, // 8=bit_depth
-             PNG_COLOR_TYPE_RGBA, PNG_INTERLACE_NONE,
-             PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
-#else
-png_set_IHDR(png, info, mg->width, mg->height, 8, // 8=bit_depth
-             PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
-             PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
-png_set_PLTE(png, info,
-             (png_color *)(mg->colorMap), // png_color is same as struct rgbColor!
-             mg->colorsUsed);
-#endif
-#ifndef COLOR32
-if (useTransparency)
-    {
-    // First palette color is assumed to be background/transparent, so
-    // that's the only one we need in the parallel array opacities[].
-    png_byte opacities[] = {0};
-    int num_opacities = ArraySize(opacities);
-    png_color_16p nonPalette_opacities_values = NULL; // n/a for us, we're using palette
-    png_set_tRNS(png, info, opacities, num_opacities, nonPalette_opacities_values);
-    }
-#endif
-
-// Write header/params, write pixels, close and clean up.
-// PNG wants a 2D array of pointers to byte offsets into palette/colorMap.
-// mg has a 1D array of byte offsets.  Make row pointers for PNG:
-
-png_byte **row_pointers = needMem(mg->height * sizeof(png_byte *));
-int i;
-for (i = 0;  i < mg->height;  i++)
-    row_pointers[i] = (unsigned char *)&(mg->pixels[i*mg->width]);
-png_set_rows(png, info, row_pointers);
-png_write_png(png, info, PNG_TRANSFORM_IDENTITY, // no transform
-	      NULL); // unused as of PNG 1.2
-png_destroy_write_struct(&png, &info);
-return TRUE;
-}
-
-void mgSavePng(struct memGfx *mg, char *filename, boolean useTransparency)
-/* Save memory bitmap to filename as a PNG.
- * If useTransparency, then the first color in memgfx's colormap/palette is
- * assumed to be the image background color, and pixels of that color
- * are made transparent. */
-{
-FILE *pngFile = mustOpen(filename, "wb");
-if (!mgSaveToPng(pngFile, mg, useTransparency))
-    {
-    remove(filename);
-    errAbort("Couldn't save %s", filename);
-    }
-if (fclose(pngFile) != 0)
-    errnoAbort("fclose failed");
-}
diff --git a/gbtools/src/blatSrc/lib/portimpl.c b/gbtools/src/blatSrc/lib/portimpl.c
deleted file mode 100644
index c0a7d19..0000000
--- a/gbtools/src/blatSrc/lib/portimpl.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Implementation file for some portability stuff mostly aimed
- * at making the same code run under different web servers.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "htmshell.h"
-#include "portable.h"
-#include "obscure.h"
-#include "portimpl.h"
-#include <dirent.h>
-
-
-static struct webServerSpecific *wss = NULL;
-
-static void setupWss()
-{
-if (wss == NULL)
-    {
-    char *s = getenv("SERVER_SOFTWARE");
-    wss = &wssDefault;
-    if (s == NULL)
-        {
-	wss = &wssCommandLine;
-        }
-    else
-        {
-        if (strncmp(wssMicrosoftII.name, s, strlen(wssMicrosoftII.name)) == 0)
-            wss = &wssMicrosoftII;
-        else if (strncmp(wssMicrosoftPWS.name, s, strlen(wssMicrosoftPWS.name)) == 0)
-            wss = &wssMicrosoftPWS;
-	else 
-	    {
-	    char *t = getenv("HTTP_HOST");
-	    if (t != NULL)
-		{
-		if (sameWord(t, "Crunx"))
-		    wss = &wssLinux;
-		else if (endsWith(t, "brc.mcw.edu"))
-		    wss = &wssBrcMcw;
-		}
-	    }
-        }
-    }
-}
-
-void makeTempName(struct tempName *tn, char *base, char *suffix)
-/* Figure out a temp name, and how CGI and HTML will access it. */
-{
-setupWss();
-wss->makeTempName(tn,base,suffix);
-}
-
-char *cgiDir()
-{
-setupWss();
-return wss->cgiDir();
-}
-
-char *trashDir()
-/* Return the relative path to trash directory for CGI binaries */
-{
-setupWss();
-return wss->trashDir();
-}
-
-double machineSpeed()
-/* Return relative speed of machine.  UCSC CSE dept. 1999 web server is 1.0 */
-{
-setupWss();
-return wss->speed();
-}
-
-void envUpdate(char *name, char *value)
-/* Update an environment string */
-{
-int size = strlen(name) + strlen(value) + 2;
-char *s = needMem(size);
-safef(s, size, "%s=%s", name, value);
-putenv(s);
-}
-
-void mkdirTrashDirectory(char *prefix)
-/*	create the specified trash directory if it doesn't exist */
-{
-struct stat buf;
-char trashDirName[128];
-safef(trashDirName, sizeof(trashDirName), "%s/%s", trashDir(), prefix);
-if (stat(trashDirName,&buf))
-    {
-    int result = mkdir (trashDirName, S_IRWXU | S_IRWXG | S_IRWXO);
-    if (0 != result)
-	errnoAbort("failed to create directory %s", trashDirName);
-    }
-}
-
-
-void makeDirsOnPath(char *pathName)
-/* Create directory specified by pathName.  If pathName contains
- * slashes, create directory at each level of path if it doesn't
- * already exist.  Abort with error message if there's a problem.
- * (It's not considered a problem for the directory to already
- * exist. ) */
-{
-
-/* shortcut for paths that already exist */
-if (fileExists(pathName))
-    return;
-
-/* Make local copy of pathName. */
-int len = strlen(pathName);
-char pathCopy[len+1];
-strcpy(pathCopy, pathName);
-
-/* Tolerate double-slashes in path, everyone else does it. */
-
-/* Start at root if it's an absolute path name. */
-char *s = pathCopy, *e;
-while (*s++ == '/')
-    /* do nothing */;
-
-/* Step through it one slash at a time 
- * making directory if possible, else dying. */
-for (; !isEmpty(s); s = e)
-    {
-    /* Find end of this section and terminate string there. */
-    e = strchr(s, '/');
-    if (e != NULL)
-	*e = 0;
-    makeDir(pathCopy);
-    if (e != NULL)
-	*e++ = '/';
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/portimpl.h b/gbtools/src/blatSrc/lib/portimpl.h
deleted file mode 100644
index 9beadb4..0000000
--- a/gbtools/src/blatSrc/lib/portimpl.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* Implement portable stuff.... */
-
-/* There is one of the following structures for each web server
- * we support.  During run time looking at the environment variable
- * SERVER_SOFTWARE we decide which of these to use. */
-struct webServerSpecific
-    {
-    char *name;
-
-    /* Make a good name for a temp file. */
-    void (*makeTempName)(struct tempName *tn, char *base, char *suffix);
-
-    /* Return directory to look for cgi in. */
-    char * (*cgiDir)();
-
-#ifdef NEVER
-    /* Return cgi suffix. */
-    char * (*cgiSuffix)();
-#endif /* NEVER */
-    
-    /* Return relative speed of CPU. (UCSC CSE 1999 FTP machine is 1.0) */
-    double (*speed)();
-
-    /* The relative path to trash directory for CGI binaries */
-    char * (*trashDir)();
-
-    };
-
-
-extern struct webServerSpecific wssMicrosoftII, wssMicrosoftPWS, wssDefault,
-	wssLinux, wssCommandLine, wssBrcMcw;
-
-char *rTempName(char *dir, char *base, char *suffix);
-/* Make a temp name that's almost certainly unique. */
diff --git a/gbtools/src/blatSrc/lib/psGfx.c b/gbtools/src/blatSrc/lib/psGfx.c
deleted file mode 100644
index 3e891b5..0000000
--- a/gbtools/src/blatSrc/lib/psGfx.c
+++ /dev/null
@@ -1,413 +0,0 @@
-/* PostScript graphics - 
- * This provides a bit of a shell around writing graphics to
- * a postScript file.  Perhaps the most important thing it
- * does is convert 0,0 from being at the bottom left to
- * being at the top left. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "psPoly.h"
-#include "psGfx.h"
-#include "linefile.h"
-
-
-static void psFloatOut(FILE *f, double x)
-/* Write out a floating point number, but not in too much
- * precision. */
-{
-int i = round(x);
-if (i == x)
-   fprintf(f, "%d ", i);
-else
-   fprintf(f, "%0.4f ", x);
-}
-
-void psClipRect(struct psGfx *ps, double x, double y, 
-	double width, double height)
-/* Set clipping rectangle. */
-{
-FILE *f = ps->f;
-fprintf(f, "cliprestore ");
-psXyOut(ps, x, y+height); 
-psWhOut(ps, width, height);       
-fprintf(f, "rectclip\n");
-}
-
-static void psWriteHeader(FILE *f, double width, double height)
-/* Write postScript header.  It's encapsulated PostScript
- * actually, so you need to supply image width and height
- * in points. */
-{
-char *s =
-#include "common.pss"
-;
-
-fprintf(f, "%%!PS-Adobe-3.1 EPSF-3.0\n");
-fprintf(f, "%%%%BoundingBox: 0 0 %d %d\n", (int)ceil(width), (int)ceil(height));
-fprintf(f, "%%%%LanguageLevel: 3\n\n");
-fprintf(f, "%s", s);
-}
-
-void psSetLineWidth(struct psGfx *ps, double factor)
-/* Set line width to factor * a single pixel width. */
-{
-fprintf(ps->f, "%f setlinewidth\n", factor * ps->xScale);
-}
-
-struct psGfx *psOpen(char *fileName, 
-	double userWidth, double userHeight, /* Dimension of image in user's units. */
-	double ptWidth, double ptHeight,     /* Dimension of image in points. */
-	double ptMargin)                     /* Image margin in points. */
-/* Open up a new postscript file.  If ptHeight is 0, it will be
- * calculated to keep pixels square. */
-{
-struct psGfx *ps;
-
-/* Allocate structure and open file. */
-AllocVar(ps);
-ps->f = mustOpen(fileName, "w");
-
-/* Save page dimensions and calculate scaling factors. */
-ps->userWidth = userWidth;
-ps->userHeight = userHeight;
-ps->ptWidth = ptWidth;
-ps->xScale = (ptWidth - 2*ptMargin)/userWidth;
-if (ptHeight != 0.0)
-   {
-   ps->ptHeight = ptHeight;
-   ps->yScale = (ptHeight - 2*ptMargin) / userHeight;
-   }
-else
-   {
-   ps->yScale = ps->xScale;
-   ptHeight = ps->ptHeight = userHeight * ps->yScale + 2*ptMargin;
-   }
-/* 0.5, 0.5 is the center of the pixel in upper-left corner which corresponds to (0,0) */
-ps->xOff = ptMargin;
-ps->yOff = ptMargin;
-ps->fontHeight = 10;
-
-/* Cope with fact y coordinates are bottom to top rather
- * than top to bottom. */
-ps->yScale = -ps->yScale;
-ps->yOff = ps->ptHeight - ps->yOff;
-
-psWriteHeader(ps->f, ptWidth, ptHeight);
-
-/* adding a gsave here fixes an old ghostview bug with cliprestore */
-fprintf(ps->f, "gsave\n");
-
-/* Set initial clipping rectangle. */
-psClipRect(ps, 0, 0, ps->userWidth, ps->userHeight);
-
-/* Set line width to a single pixel. */
-psSetLineWidth(ps,1);
-
-return ps;
-}
-
-void psTranslate(struct psGfx *ps, double xTrans, double yTrans)
-/* add a constant to translate all coordinates */
-{
-ps->xOff += xTrans*ps->xScale;   
-ps->yOff += yTrans*ps->yScale;
-}
-
-void psClose(struct psGfx **pPs)
-/* Close out postScript file. */
-{
-struct psGfx *ps = *pPs;
-if (ps != NULL)
-    {
-    carefulClose(&ps->f);
-    freez(pPs);
-    }
-}
-
-void psXyOut(struct psGfx *ps, double x, double y)
-/* Output x,y position transformed into PostScript space. */
-{
-FILE *f = ps->f;
-psFloatOut(f, x * ps->xScale + ps->xOff);
-psFloatOut(f, y * ps->yScale + ps->yOff);
-}
-
-void psWhOut(struct psGfx *ps, double width, double height)
-/* Output width/height transformed into PostScript space. */
-{
-FILE *f = ps->f;
-psFloatOut(f, width * ps->xScale);
-psFloatOut(f, height * -ps->yScale);
-}
-
-void psMoveTo(struct psGfx *ps, double x, double y)
-/* Move PostScript position to given point. */
-{
-psXyOut(ps, x, y);
-fprintf(ps->f, "moveto\n");
-}
-
-void psLineTo(struct psGfx *ps, double x, double y)
-/* Draw line from current point to given point,
- * and make given point new current point. */
-{
-psXyOut(ps, x, y);
-fprintf(ps->f, "lineto\n");
-}
-
-void psDrawBox(struct psGfx *ps, double x, double y, 
-	double width, double height)
-/* Draw a filled box in current color. */
-{
-if (width > 0 && height > 0)
-    {
-    psWhOut(ps, width, height);
-    psXyOut(ps, x, y+height); 
-    fprintf(ps->f, "fillBox\n");
-    }
-}
-
-void psDrawLine(struct psGfx *ps, double x1, double y1, double x2, double y2)
-/* Draw a line from x1/y1 to x2/y2 */
-{
-FILE *f = ps->f;
-fprintf(f, "newpath\n");
-psMoveTo(ps, x1, y1);
-psXyOut(ps, x2, y2);
-fprintf(ps->f, "lineto\n");
-fprintf(f, "stroke\n");
-}
-
-void psFillUnder(struct psGfx *ps, double x1, double y1, 
-	double x2, double y2, double bottom)
-/* Draw a 4 sided filled figure that has line x1/y1 to x2/y2 at
- * it's top, a horizontal line at bottom at it's bottom,  and
- * vertical lines from the bottom to y1 on the left and bottom to
- * y2 on the right. */
-{
-FILE *f = ps->f;
-fprintf(f, "newpath\n");
-psMoveTo(ps, x1, y1);
-psLineTo(ps, x2, y2);
-psLineTo(ps, x2, bottom);
-psLineTo(ps, x1, bottom);
-fprintf(f, "closepath\n");
-fprintf(f, "fill\n");
-}
-
-void psTimesFont(struct psGfx *ps, double size)
-/* Set font to times of a certain size. */
-{
-FILE *f = ps->f;
-fprintf(f, "/Helvetica findfont ");
-
-/* Note the 1.2 and the 1.0 below seem to get it to 
- * position about where the stuff developed for pixel
- * based systems expects it.  It is all a kludge though! */
-fprintf(f, "%f scalefont setfont\n", -size*ps->yScale*1.2);
-ps->fontHeight = size*0.8;
-}
-
-void psTextBox(struct psGfx *ps, double x, double y, char *text)
-/* Output text in current font at given position. */
-{
-char c;
-psMoveTo(ps, x, y + ps->fontHeight);
-fprintf(ps->f, "(");
-while ((c = *text++) != 0)
-    {
-    if (c == ')' || c == '(')
-        fprintf(ps->f, "\\");
-    fprintf(ps->f, "%c", c);
-    }
-fprintf(ps->f, ") fillTextBox\n");
-}
-
-void psTextAt(struct psGfx *ps, double x, double y, char *text)
-/* Output text in current font at given position. */
-{
-char c;
-psMoveTo(ps, x, y + ps->fontHeight);
-fprintf(ps->f, "(");
-while ((c = *text++) != 0)
-    {
-    if (c == ')' || c == '(')
-        fprintf(ps->f, "\\");
-    fprintf(ps->f, "%c", c);
-    }
-fprintf(ps->f, ") show\n");
-}
-
-void psTextRight(struct psGfx *ps, double x, double y, 
-	double width, double height, 
-	char *text)
-/* Draw a line of text right justified in box defined by x/y/width/height */
-{
-y += (height - ps->fontHeight)/2;
-psMoveTo(ps, x+width, y + ps->fontHeight);
-fprintf(ps->f, "(%s) showBefore\n", text);
-}
-
-void psTextCentered(struct psGfx *ps, double x, double y, 
-	double width, double height, 
-	char *text)
-/* Draw a line of text centered in box defined by x/y/width/height */
-{
-char c;
-y += (height - ps->fontHeight)/2;
-psMoveTo(ps, x+width/2, y + ps->fontHeight);
-fprintf(ps->f, "(");
-while ((c = *text++) != 0)
-    {
-    if (c == ')' || c == '(')
-        fprintf(ps->f, "\\");
-    fprintf(ps->f, "%c", c);
-    }
-fprintf(ps->f, ") showMiddle\n");
-}
-
-void psTextDown(struct psGfx *ps, double x, double y, char *text)
-/* Output text going downwards rather than across at position. */
-{
-psMoveTo(ps, x, y);
-fprintf(ps->f, "gsave\n");
-fprintf(ps->f, "-90 rotate\n");
-fprintf(ps->f, "(%s) show\n", text);
-fprintf(ps->f, "grestore\n");
-}
-
-void psSetColor(struct psGfx *ps, int r, int g, int b)
-/* Set current color. */
-{
-FILE *f = ps->f;
-double scale = 1.0/255;
-if (r == g && g == b)
-    {
-    psFloatOut(f, scale * r);
-    fprintf(f, "setgray\n");
-    }
-else
-    {
-    psFloatOut(f, scale * r);
-    psFloatOut(f, scale * g);
-    psFloatOut(f, scale * b);
-    fprintf(f, "setrgbcolor\n");
-    }
-}
-
-void psSetGray(struct psGfx *ps, double grayVal)
-/* Set gray value. */
-{
-FILE *f = ps->f;
-if (grayVal < 0) grayVal = 0;
-if (grayVal > 1) grayVal = 1;
-psFloatOut(f, grayVal);
-fprintf(f, "setgray\n");
-}
-
-void psPushG(struct psGfx *ps)
-/* Save graphics state on stack. */
-{
-fprintf(ps->f, "gsave\n");
-}
-
-void psPopG(struct psGfx *ps)
-/* Pop off saved graphics state. */
-{
-fprintf(ps->f, "grestore\n");
-}
-
-void psDrawPoly(struct psGfx *ps, struct psPoly *poly, boolean filled)
-/* Draw a possibly filled polygon */
-{
-FILE *f = ps->f;
-struct psPoint *p = poly->ptList;
-fprintf(f, "newpath\n");
-psMoveTo(ps, p->x, p->y);
-for (;;)
-    {
-    p = p->next;
-    psLineTo(ps, p->x, p->y);
-    if (p == poly->ptList)
-	break;
-    }
-if (filled)
-    {
-    fprintf(f, "fill\n");
-    }
-else
-    {
-    fprintf(f, "closepath\n");
-    fprintf(f, "stroke\n");
-    }
-}
-
-
-void psFillEllipse(struct psGfx *ps, double x, double y, double xrad, double yrad)
-{
-FILE *f = ps->f;
-fprintf(f, "newpath\n");
-psXyOut(ps, x, y);
-psWhOut(ps, xrad, yrad);
-psFloatOut(f, 0.0);
-psFloatOut(f, 360.0);
-fprintf(f, "ellipse\n");
-fprintf(f, "closepath\n");
-fprintf(f, "fill\n");
-}
-
-void psDrawEllipse(struct psGfx *ps, double x, double y, double xrad, double yrad,
-    double startAngle, double endAngle)
-{
-FILE *f = ps->f;
-fprintf(f, "newpath\n");
-psXyOut(ps, x, y);
-psWhOut(ps, xrad, yrad);
-psFloatOut(f, startAngle);
-psFloatOut(f, endAngle);
-fprintf(f, "ellipse\n");
-fprintf(f, "closepath\n");
-fprintf(f, "stroke\n");
-}
-
-char * convertEpsToPdf(char *epsFile) 
-/* Convert EPS to PDF and return filename, or NULL if failure. */
-{
-char *pdfTmpName = NULL, *pdfName=NULL;
-char cmdBuffer[2048];
-int sysVal = 0;
-struct lineFile *lf = NULL;
-char *line;
-int lineSize=0;
-float width=0, height=0;
-pdfTmpName = cloneString(epsFile);
-
-/* Get the dimensions of bounding box. */
-lf = lineFileOpen(epsFile, TRUE);
-while(lineFileNext(lf, &line, &lineSize)) 
-    {
-    if(strstr( line, "BoundingBox:")) 
-	{
-	char *words[5];
-	chopLine(line, words);
-	width = atof(words[3]);
-	height = atof(words[4]);
-	break;
-	}
-    }
-lineFileClose(&lf);
-	
-/* Do conversion. */
-chopSuffix(pdfTmpName);
-pdfName = addSuffix(pdfTmpName, ".pdf");
-safef(cmdBuffer, sizeof(cmdBuffer), "ps2pdf -dDEVICEWIDTHPOINTS=%d -dDEVICEHEIGHTPOINTS=%d %s %s", 
-      round(width), round(height), epsFile, pdfName);
-sysVal = system(cmdBuffer);
-if(sysVal != 0)
-    freez(&pdfName);
-freez(&pdfTmpName);
-return pdfName;
-}
-
diff --git a/gbtools/src/blatSrc/lib/psPoly.c b/gbtools/src/blatSrc/lib/psPoly.c
deleted file mode 100644
index e16f3bb..0000000
--- a/gbtools/src/blatSrc/lib/psPoly.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* psPoly - two dimensional polygon. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "psPoly.h"
-
-
-struct psPoly *psPolyNew()
-/* Create new (empty) polygon */
-{
-struct psPoly *poly;
-AllocVar(poly);
-return poly;
-}
-
-void psPolyFree(struct psPoly **pPoly)
-/* Free up resources associated with polygon */
-{
-struct psPoly *poly = *pPoly;
-if (poly != NULL)
-    {
-    if (poly->lastPoint != NULL)
-	{
-	poly->lastPoint->next = NULL;
-	slFreeList(&poly->ptList);
-	}
-    freez(pPoly);
-    }
-}
-
-void psPolyAddPoint(struct psPoly *poly, double x, double y)
-/* Add point to polygon. */
-{
-struct psPoint *pt;
-poly->ptCount += 1;
-AllocVar(pt);
-pt->x = x;
-pt->y = y;
-if (poly->ptList == NULL)
-    {
-    poly->ptList = poly->lastPoint = pt;
-    pt->next = pt;
-    }
-else
-    {
-    poly->lastPoint->next = pt;
-    pt->next = poly->ptList;
-    poly->lastPoint = pt;
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/pscmGfx.c b/gbtools/src/blatSrc/lib/pscmGfx.c
deleted file mode 100644
index af30b54..0000000
--- a/gbtools/src/blatSrc/lib/pscmGfx.c
+++ /dev/null
@@ -1,816 +0,0 @@
-/* pscmGfx - routines for making postScript output seem a
- * lot like 256 color bitmap output. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include <math.h>
-#ifdef MACHTYPE_sparc
-#include <ieeefp.h>
-int isinf(double x) { return !finite(x) && x==x; }
-#endif
-#include "common.h"
-#include "hash.h"
-#include "memgfx.h"
-#include "gfxPoly.h"
-#include "colHash.h"
-#include "psGfx.h"
-#include "pscmGfx.h"
-#include "gemfont.h"
-#include "vGfx.h"
-#include "vGfxPrivate.h"
-
-
-
-static struct pscmGfx *boxPscm;	 /* Used to keep from drawing the same box again
-                                  * and again with no other calls between.  This
-				  * ends up cutting down the file size by 5x
-				  * in the whole chromosome case of the browser. */
-
-void pscmSetHint(struct pscmGfx *pscm, char *hint, char *value)
-/* set a hint */
-{
-if (!value) return;
-if (sameString(value,""))
-    {
-    hashRemove(pscm->hints, hint);
-    }
-struct hashEl *el = hashLookup(pscm->hints, hint);
-if (el) 
-    {
-    freeMem(el->val);
-    el->val = cloneString(value);
-    }
-else
-    {
-    hashAdd(pscm->hints, hint, cloneString(value));
-    }
-}
-
-char *pscmGetHint(struct pscmGfx *pscm, char *hint)
-/* get a hint */
-{
-return hashOptionalVal(pscm->hints, hint, "");
-}
-
-int pscmGetFontPixelHeight(struct pscmGfx *pscm, MgFont *font)
-/* How high in pixels is font? */
-{
-return font_cel_height(font);
-}
-
-int pscmGetFontStringWidth(struct pscmGfx *pscm, MgFont *font, char *string)
-/* How wide is a string? */
-{
-return fnstring_width(font, (unsigned char *)string, strlen(string));
-}
-
-void pscmSetClip(struct pscmGfx *pscm, int x, int y, int width, int height)
-/* Set clipping rectangle. */
-{
-double x2 = x + width;
-double y2 = y + height;
-pscm->clipMinX = x;
-pscm->clipMinY = y;
-pscm->clipMaxX = x2;     /* one beyond actual last pixel */
-pscm->clipMaxY = y2;
-/* adjust to pixel-centered coordinates */
-x2 -= 1;
-y2 -= 1;
-double x1 = x;
-double y1 = y;
-/* pad a half-pixel all the way around the box */
-x1 -= 0.5;
-y1 -= 0.5;
-x2 += 0.5;
-y2 += 0.5;
-psClipRect(pscm->ps, x1, y1, x2-x1, y2-y1);
-}
-
-void pscmUnclip(struct pscmGfx *pscm)
-/* Set clipping rect to cover full thing. */
-{
-pscmSetClip(pscm, 0, 0, pscm->ps->userWidth, pscm->ps->userHeight);
-}
-
-#ifndef COLOR32
-static Color pscmClosestColor(struct pscmGfx *pscm, 
-	unsigned char r, unsigned char g, unsigned char b)
-/* Returns closest color in color map to r,g,b */
-{
-struct rgbColor *c = pscm->colorMap;
-int closestDist = 0x7fffffff;
-int closestIx = -1;
-int dist, dif;
-int i;
-
-for (i=0; i<pscm->colorsUsed; ++i)
-    {
-    dif = c->r - r;
-    dist = dif*dif;
-    dif = c->g - g;
-    dist += dif*dif;
-    dif = c->b - b;
-    dist += dif*dif;
-    if (dist < closestDist)
-        {
-        closestDist = dist;
-        closestIx = i;
-        }
-    ++c;
-    }
-return closestIx;
-}
-
-static Color pscmAddColor(struct pscmGfx *pscm, 
-	unsigned char r, unsigned char g, unsigned char b)
-/* Adds color to end of color map if there's room. */
-{
-int colIx = pscm->colorsUsed;
-struct rgbColor *c = pscm->colorMap + pscm->colorsUsed;
-c->r = r;
-c->g = g;
-c->b = b;
-pscm->colorsUsed += 1;
-colHashAdd(pscm->colorHash, r, g, b, colIx);;
-return (Color)colIx;
-}
-#endif
-
-int pscmFindColorIx(struct pscmGfx *pscm, int r, int g, int b)
-/* Returns closest color in color map to rgb values.  If it doesn't
- * already exist in color map and there's room, it will create
- * exact color in map. */
-{
-#ifdef COLOR32
-return MAKECOLOR_32(r,g,b);
-#else
-struct colHashEl *che;
-if (r>255||g>255||b>255) 
-    errAbort("RGB values out of range (0-255).  r:%d g:%d b:%d", r, g, b);
-if ((che = colHashLookup(pscm->colorHash, r, g, b)) != NULL)
-    return che->ix;
-if (pscm->colorsUsed < 256)
-    return pscmAddColor(pscm, r, g, b);
-return pscmClosestColor(pscm, r, g, b);
-#endif
-}
-
-
-struct rgbColor pscmColorIxToRgb(struct pscmGfx *pscm, int colorIx)
-/* Return rgb value at color index. */
-{
-#ifdef COLOR32
-static struct rgbColor rgb;
-rgb.r = (colorIx >> 0) & 0xff;
-rgb.g = (colorIx >> 8) & 0xff;
-rgb.b = (colorIx >> 16) & 0xff;
-
-return rgb;
-#else
-return pscm->colorMap[colorIx];
-#endif
-}
-
-#ifndef COLOR32
-static void pscmSetDefaultColorMap(struct pscmGfx *pscm)
-/* Set up default color map for a memGfx. */
-{
-/* Note dependency in order here and in MG_WHITE, MG_BLACK, etc. */
-int i;
-for (i=0; i<ArraySize(mgFixedColors); ++i)
-    {
-    struct rgbColor *c = &mgFixedColors[i];
-    pscmFindColorIx(pscm, c->r, c->g, c->b);
-    }
-}
-#endif
-
-void pscmSetWriteMode(struct pscmGfx *pscm, unsigned int writeMode)
-/* Set write mode */
-{
-pscm->writeMode = writeMode;
-}
-
-struct pscmGfx *pscmOpen(int width, int height, char *file)
-/* Return new pscmGfx. */
-{
-struct pscmGfx *pscm;
-
-AllocVar(pscm);
-pscm->ps = psOpen(file, width, height, 72.0 * 7.5, 0, 0);
-psTranslate(pscm->ps,0.5,0.5);  /* translate all coordinates to pixel centers */
-#ifndef COLOR32
-pscm->colorHash = colHashNew();
-pscmSetDefaultColorMap(pscm);
-#endif
-pscm->clipMinX = pscm->clipMinY = 0;
-pscm->clipMaxX = width;     
-pscm->clipMaxY = height;
-pscm->hints = hashNew(6);
-return pscm;
-}
-
-void pscmClose(struct pscmGfx **pPscm)
-/* Finish writing out and free structure. */
-{
-struct pscmGfx *pscm = *pPscm;
-if (pscm != NULL)
-    {
-    psClose(&pscm->ps);
-    colHashFree(&pscm->colorHash);
-    freez(pPscm);
-    }
-}
-
-void pscmSetColor(struct pscmGfx *pscm, Color color)
-/* Set current color to Color. */
-{
-struct rgbColor *col;
-
-#ifdef COLOR32
-struct rgbColor myCol;
-col = &myCol;
-
-col->r = (color >> 0) & 0xff;
-col->g = (color >> 8) & 0xff;
-col->b = (color >> 16) & 0xff;
-#else
-col = pscm->colorMap + color;
-#endif
-
-if (color != pscm->curColor)
-    {
-    psSetColor(pscm->ps, col->r, col->g, col->b);
-    pscm->curColor = color;
-    }
-}
-
-void pscmBoxToPs(struct pscmGfx *pscm, int x, int y, 
-	int width, int height)
-/* adjust coordinates for PS */
-{
-/* Do some clipping here to make the postScript
- * easier to edit in illustrator. */
-double x2 = x + width;
-double y2 = y + height;
-
-if (x < pscm->clipMinX) x = pscm->clipMinX;
-if (y < pscm->clipMinY) y = pscm->clipMinY;
-if (x2 > pscm->clipMaxX) x2 = pscm->clipMaxX;
-if (y2 > pscm->clipMaxY) y2 = pscm->clipMaxY;
-
-/* adjust to pixel-centered coordinates */
-x2 -= 1;
-y2 -= 1;
-double x1 = x;
-double y1 = y;
-/* pad a half-pixel all the way around the box */
-x1 -= 0.5;
-y1 -= 0.5;
-x2 += 0.5;
-y2 += 0.5;
-psDrawBox(pscm->ps, x1, y1, x2-x1, y2-y1);
-}
-
-void pscmBox(struct pscmGfx *pscm, int x, int y, 
-	int width, int height, int color)
-/* Draw a box. */
-{
-/* When viewing whole chromosomes the browser tends
- * to draw the same little vertical tick over and
- * over again.  This tries to remove the worst of
- * the redundancy anyway. */
-
-static int lx, ly, lw, lh, lc=-1;
-if (x != lx || y != ly || width != lw || height != lh || color != lc || 
-	pscm != boxPscm)
-    {
-    pscmSetColor(pscm, color);
-    pscmBoxToPs(pscm, x, y, width, height);
-    lx = x;
-    ly = y;
-    lw = width;
-    lh = height;
-    lc = color;
-    boxPscm = pscm;
-    }
-}
-
-void pscmDot(struct pscmGfx *pscm, int x, int y, int color)
-/* Set a dot. */
-{
-pscmBox(pscm, x, y, 1, 1, color);
-}
-
-
-
-static void pscmVerticalSmear(struct pscmGfx *pscm,
-	int xOff, int yOff, int width, int height, 
-	Color *dots, boolean zeroClear)
-/* Put a series of one 'pixel' width vertical lines. */
-{
-int x, i;
-struct psGfx *ps = pscm->ps;
-Color c;
-for (i=0; i<width; ++i)
-    {
-    x = xOff + i;
-    c = dots[i];
-    if (c != MG_WHITE || !zeroClear)
-	{
-	pscmSetColor(pscm, c);
-	psDrawBox(ps, x, yOff, 1, height);
-	}
-    }
-}
-
-static void pscmSetFont(struct pscmGfx *pscm, MgFont *font)
-/* Set font. */
-{
-/* For now we basically still get the sizing info from the old
- * gem fonts.   I'm not sure how to get sizing info out of
- * PostScript.  We'll try and arrange it so that the PostScript
- * fonts match the gem fonts more or less. */
-void *v = font;
-if (v != pscm->curFont)
-    {
-    psTimesFont(pscm->ps, font->psHeight);
-    pscm->curFont = v;
-    }
-}
-
-void pscmText(struct pscmGfx *pscm, int x, int y, int color, 
-	MgFont *font, char *text)
-/* Draw a line of text with upper left corner x,y. */
-{
-pscmSetColor(pscm, color);
-pscmSetFont(pscm, font);
-psTextAt(pscm->ps, x, y, text);
-boxPscm = NULL;
-}
-
-void pscmTextRight(struct pscmGfx *pscm, int x, int y, int width, int height,
-	int color, MgFont *font, char *text)
-/* Draw a line of text right justified in box defined by x/y/width/height */
-{
-pscmSetColor(pscm, color);
-pscmSetFont(pscm, font);
-psTextRight(pscm->ps, x, y, width, height, text);
-boxPscm = NULL;
-}
-
-void pscmTextCentered(struct pscmGfx *pscm, int x, int y, 
-	int width, int height, int color, MgFont *font, char *text)
-/* Draw a line of text centered in box defined by x/y/width/height */
-{
-pscmSetColor(pscm, color);
-pscmSetFont(pscm, font);
-psTextCentered(pscm->ps, x, y, width, height, text);
-boxPscm = NULL;
-}
-
-void pscmFillUnder(struct pscmGfx *pscm, int x1, int y1, int x2, int y2, 
-	int bottom, Color color)
-/* Draw a 4 sided filled figure that has line x1/y1 to x2/y2 at
- * it's top, a horizontal line at bottom at it's bottom,  and
- * vertical lines from the bottom to y1 on the left and bottom to
- * y2 on the right. */
-{
-pscmSetColor(pscm, color);
-psFillUnder(pscm->ps, x1, y1, x2, y2, bottom);
-boxPscm = NULL;
-}
-
-void psPolyFindExtremes(struct gfxPoly *poly, 
-  int *pMinX, int *pMaxX,  
-  int *pMinY, int *pMaxY)
-/* find min and max of x and y */
-{
-struct gfxPoint *p = poly->ptList;
-int minX, maxX, minY, maxY;
-minX = maxX =  p->x;
-minY = maxY =  p->y;
-for (;;)
-    {
-    p = p->next;
-    if (p == poly->ptList)
-	break;
-    if (minX > p->x) minX = p->x;
-    if (minY > p->y) minY = p->y;
-    if (maxX < p->x) maxX = p->x;
-    if (maxY < p->y) maxY = p->y;
-    }
-*pMinX = minX;
-*pMaxX = maxX;
-*pMinY = minY;
-*pMaxY = maxY;
-}
-
-double gfxSlope(struct gfxPoint *q, struct gfxPoint *p)
-/* determine slope from two gfxPoints */
-{
-double dx = p->x - q->x;
-double dy = p->y - q->y;
-return dy/dx;
-}
-
-boolean colinearPoly(struct gfxPoly *poly)
-/* determine if points are co-linear */
-{
-if (poly->ptCount < 2) return TRUE;
-struct gfxPoint *q = poly->ptList, *p=q->next;
-double m0 = gfxSlope(q,p);
-for (;;)
-    {
-    p = p->next;
-    if (p == poly->ptList)
-	break;
-    double m1 = gfxSlope(q,p);
-    if (!(isinf(m0) && isinf(m1)) && (m1 != m0))
-	return FALSE;
-    }
-return TRUE;
-}
-
-double fatPixel(double c, double center, double fat)
-/* fatten coordinate by scaling */
-{
-return center+((c-center)*fat);
-}
-
-
-void pscmPolyFatten(struct psPoly *psPoly, 
-  int minX, int maxX, int minY, int maxY)
-/* Fatten polygon by finding the center and then
- * scaling by 0.5 pixel from the center in all directions.
- * Caller assures dx and dy will NOT be zero. */
-{
-int dx = maxX - minX;
-int dy = maxY - minY;
-double centerX = (maxX + minX) / 2.0;
-double centerY = (maxY + minY) / 2.0;
-double fatX = (dx + 1.0)/dx;
-double fatY = (dy + 1.0)/dy;
-struct psPoint *p = psPoly->ptList;
-for (;;)
-    {
-    p->x = fatPixel(p->x, centerX, fatX);
-    p->y = fatPixel(p->y, centerY, fatY);
-    p = p->next;
-    if (p == psPoly->ptList)
-	break;
-    }
-}
-
-void findLineParams(double x1, double y1, double x2, double y2, double *m, double *b)
-/* Return parameters slope m and y-intercept b of equation for line from x1,y1 to x2,y2, 
- * vertical lines return infinite slope with b = x value instead */
-{
-double dx = x2 - x1;
-double dy = y2 - y1;
-*m = dy/dx;
-if (dx == 0)
-    *b = x1;
-else
-    *b = y1 - (*m)*x1;
-}
-
-
-double bDeltaForParallelLine(double d, double m)
-/* find delta-b value for parallel line at distance d for line slope m */
-{
-return d * sqrt(1 + m*m); /* do not call with m == infinity */
-}
-
-void adjustBForParallelLine(boolean cw, double m, 
-double x1, double y1, 
-double x2, double y2, 
-double *b)
-/* adjust the b value for parallel line at distance d for line slope m 
- *  cw if clockwise */
-{
-if (isinf(m))  /* handle vertical lines */
-    {
-    if ((cw && (y2 < y1)) || (!cw && (y2 > y1)))
-	*b += 1;   /* b holds x-value rather than y-intercept */
-    else
-	*b -= 1;
-    }
-else
-    {
-    /* Y axis is increasing downwards */
-    double bDelta = bDeltaForParallelLine(1.0, m);
-    if ((cw && (x2 > x1)) || (!cw && (x2 < x1)))
-       *b += bDelta; 
-    else
-       *b -= bDelta;
-    }
-}
-
-void findLinesIntersection(boolean cw, double m0, double b0, double m1, double b1, 
-double px, double py, boolean posDeltaX, boolean posDeltaY,
-double *ix, double *iy)
-/* find intersection between two lines */
-{
-
-/* colinear vert */
-if ((isinf(m0) && isinf(m1)) && (b0 == b1)) 
-    {
-    if (cw ^ posDeltaY)
-    	*ix = px+1;
-    else
-    	*ix = px-1;
-    *iy = py; 
-    }
-/* colinear horiz */
-else if (((m0==0)&&(m1==0)) && (b0 == b1)) 
-    {
-    if (cw ^ posDeltaX)
-    	*iy = py+1;
-    else
-    	*iy = py-1;
-    *ix = px; 
-    }
-/* colinear */
-else if ((m0 == m1) && (b0 == b1))  
-    {
-    /* inner point shifted 1 pixel away from the point,
-     *   moving perpendicular to m0 towards the center */
-
-    double dx, dy;
-    double m = -1/m0; 
-    dx = sqrt(1/(1+m*m));
-    dy = m * dx;
-
-    if (!(cw ^ posDeltaX))
-	{
-	*ix = px + dx;
-	*iy = py + dy;
-	}
-    else
-	{
-	*ix = px - dx;
-	*iy = py - dy;
-	}
-
-    }
-/* non-colinear */
-else
-    {
-    if (isinf(m0) && isinf(m1))
-	{  /* should be handled earlier by colinear vert lines above */
-	errAbort("pscmGfx: m0 and m1 both inf, shouldn't get here");
-	}
-    else if (!isinf(m0) && isinf(m1))
-	{
-    	*ix = b1;
-	*iy = m0*(*ix)+b0;
-	}
-    else if (isinf(m0) && !isinf(m1))
-	{
-    	*ix = b0;
-	*iy = m1*(*ix)+b1;
-	}
-    else if (!isinf(m0) && !isinf(m1))
-	{
-    	*ix = -(b1-b0)/(m1-m0);
-	*iy = m0*(*ix)+b0;
-	}
-    }
-}
-
-boolean pscmIsClockwise(struct psPoly *psPoly)
-/* determine if polygon points are in clockwise order or not
- * using cross-product sum*/
-{
-struct psPoint *p = psPoly->ptList,*q;
-double x0, y0; 
-double x1, y1;
-double x2, y2;
-double crossProd = 0;
-x1 = p->x;
-y1 = p->y;
-p = p->next;
-x2 = p->x;
-y2 = p->y;
-p = p->next;
-q = p;
-for (;;)
-    {
-    x0 = x1;
-    y0 = y1;
-    x1 = x2;
-    y1 = y2;
-    x2 = p->x;
-    y2 = p->y;
-    crossProd += ((x1-x0)*(y2-y1) - (y1-y0)*(x2-x1));
-    p = p->next;
-    if (p == q) 
-	break;
-    }
-return (crossProd > 0);
-}
-
-void pscmPolyTrapStrokeOutline(struct pscmGfx *pscm, struct psPoly *psPoly)
-/* Stroke a fattened polygon using trapezoids. 
- * Make each stroke-segment of the poly be made of a 4-sided trapezoidal figure
- * whose inner edge is parallel 1 pixel away and the points are found
- * by finding the intersections of these parallel lines. */
-{
-
-struct psPoint *p = psPoly->ptList,*q;
-double px0, py0; /* outer points */
-double px1, py1;
-double m0,b0;
-double m1,b1;
-double ix0,iy0;  /* inner points */
-double ix1,iy1;
-
-boolean cw = pscmIsClockwise(psPoly);
-
-px1 = p->x;
-py1 = p->y;
-p = p->next;
-findLineParams(px1, py1, p->x, p->y, &m1, &b1);
-adjustBForParallelLine(cw, m1, px1, py1, p->x, p->y, &b1);
-px0 = px1;
-py0 = py1;
-px1 = p->x;
-py1 = p->y;
-p = p->next;
-m0 = m1;
-b0 = b1;
-findLineParams(px1, py1, p->x, p->y, &m1, &b1);
-adjustBForParallelLine(cw, m1, px1, py1, p->x, p->y, &b1);
-
-findLinesIntersection(cw,m0,b0,m1,b1,px1,py1,
-    (px1<px0) ^ (m0 < 0),
-    (py1>py0),
-    &ix1,&iy1);
-
-px0 = px1;
-py0 = py1;
-px1 = p->x;
-py1 = p->y;
-p = p->next;
-q = p;
-for (;;)
-    {
-
-    m0 = m1;
-    b0 = b1;
-    ix0 = ix1;
-    iy0 = iy1;
-    findLineParams(px1, py1, p->x, p->y, &m1, &b1);
-    adjustBForParallelLine(cw, m1, px1, py1, p->x, p->y, &b1);
-
-    findLinesIntersection(cw,m0,b0,m1,b1,px1,py1,
-	(px1<px0) ^ (m0 < 0),
-	(py1>py0),
-	&ix1,&iy1);
-
-    struct psPoly *inner = psPolyNew();
-    psPolyAddPoint(inner,px0, py0);
-    psPolyAddPoint(inner,px1, py1);
-    psPolyAddPoint(inner,ix1, iy1);
-    psPolyAddPoint(inner,ix0, iy0);
-    psDrawPoly(pscm->ps, inner, TRUE);
-    psPolyFree(&inner);
-
-    px0 = px1;
-    py0 = py1;
-    px1 = p->x;
-    py1 = p->y;
-    p = p->next;
-    if (p == q) 
-	break;
-    }
-
-}
-
-void pscmDrawPoly(struct pscmGfx *pscm, struct gfxPoly *poly, Color color, 
-	boolean filled)
-/* Draw a polygon, possibly filled, in color. */
-{
-struct gfxPoint *p = poly->ptList;
-struct psPoly *psPoly = psPolyNew();
-int minX, maxX, minY, maxY;
-if (poly->ptCount < 1)  /* nothing to do */
-    {
-    return;
-    }
-psPolyFindExtremes(poly, &minX, &maxX, &minY, &maxY);
-/*  check for co-linear polygon, render as line instead */
-if (colinearPoly(poly)) 
-    {
-    pscmLine(pscm, minX, minY, maxX, maxY, color);
-    return;
-    }
-pscmSetColor(pscm, color);
-/* convert pixel coords to real values */
-for (;;)
-    {
-    psPolyAddPoint(psPoly,p->x, p->y);
-    p = p->next;
-    if (p == poly->ptList)
-	break;
-    }
-boolean fat = sameString(pscmGetHint(pscm,"fat"),"on");
-if (fat)
-    pscmPolyFatten(psPoly, minX, maxX, minY, maxY);
-if (fat && !filled)
-    pscmPolyTrapStrokeOutline(pscm,psPoly);
-else
-    psDrawPoly(pscm->ps, psPoly, filled);
-psPolyFree(&psPoly);
-}
-
-
-
-void pscmFatLine(struct pscmGfx *pscm, double x1, double y1, double x2, double y2)
-/* Draw a line from x1/y1 to x2/y2 by making a filled polygon.
- *  This also avoids some problems with stroke-width variation
- *  from different postscript implementations. */
-{
-struct psPoly *psPoly = psPolyNew();
-
-double cX = (x1+x2)/2.0;
-double cY = (y1+y2)/2.0;
-double fX;
-double fY;
-
-/* fatten by lengthing line by 0.5 at each end */
-fX = fY = 1.0+0.5*sqrt(0.5);  
-
-/* expand the length of the line by a half-pixel on each end */
-x1 = fatPixel(x1,cX,fX);
-x2 = fatPixel(x2,cX,fX);
-y1 = fatPixel(y1,cY,fY);
-y2 = fatPixel(y2,cY,fY);
-
-
-/* calculate 4 corners {h,i,j,k} of the rectangle covered */
-
-double m = (y2 - y1)/(x2 - x1);
-m = -1/m;  /* rotate slope 90 degrees */
-
-double ddX = sqrt( (0.5*0.5) / (m*m+1) );
-double ddY = m * ddX;
-
-double hX = x1-ddX, hY = y1-ddY;
-double iX = x1+ddX, iY = y1+ddY;
-double jX = x2+ddX, jY = y2+ddY;
-double kX = x2-ddX, kY = y2-ddY;
-
-psPolyAddPoint(psPoly,hX,hY);
-psPolyAddPoint(psPoly,iX,iY);
-psPolyAddPoint(psPoly,jX,jY);
-psPolyAddPoint(psPoly,kX,kY);
-psDrawPoly(pscm->ps, psPoly, TRUE);
-psPolyFree(&psPoly);
-
-}
-
-
-void pscmLine(struct pscmGfx *pscm, 
-	int x1, int y1, int x2, int y2, int color)
-/* Draw a line from one point to another. */
-{
-pscmSetColor(pscm, color);
-boolean fat = sameString(pscmGetHint(pscm,"fat"),"on");
-if (fat)
-    pscmFatLine(pscm, x1, y1, x2, y2);
-else
-    psDrawLine(pscm->ps, x1, y1, x2, y2);
-boxPscm = NULL;
-}
-
-
-struct vGfx *vgOpenPostScript(int width, int height, char *fileName)
-/* Open up something that will someday be a PostScript file. */
-{
-struct vGfx *vg = vgHalfInit(width, height);
-vg->data = pscmOpen(width, height, fileName);
-vg->close = (vg_close)pscmClose;
-vg->dot = (vg_dot)pscmDot;
-vg->box = (vg_box)pscmBox;
-vg->line = (vg_line)pscmLine;
-vg->text = (vg_text)pscmText;
-vg->textRight = (vg_textRight)pscmTextRight;
-vg->textCentered = (vg_textCentered)pscmTextCentered;
-vg->findColorIx = (vg_findColorIx)pscmFindColorIx;
-vg->colorIxToRgb = (vg_colorIxToRgb)pscmColorIxToRgb;
-vg->setClip = (vg_setClip)pscmSetClip;
-vg->unclip = (vg_unclip)pscmUnclip;
-vg->verticalSmear = (vg_verticalSmear)pscmVerticalSmear;
-vg->fillUnder = (vg_fillUnder)pscmFillUnder;
-vg->drawPoly = (vg_drawPoly)pscmDrawPoly;
-vg->setHint = (vg_setHint)pscmSetHint;
-vg->getHint = (vg_getHint)pscmGetHint;
-vg->getFontPixelHeight = (vg_getFontPixelHeight)pscmGetFontPixelHeight;
-vg->getFontStringWidth = (vg_getFontStringWidth)pscmGetFontStringWidth;
-vg->setWriteMode = (vg_setWriteMode)pscmSetWriteMode;
-return vg;
-}
-
diff --git a/gbtools/src/blatSrc/lib/psl.as b/gbtools/src/blatSrc/lib/psl.as
deleted file mode 100644
index 7114683..0000000
--- a/gbtools/src/blatSrc/lib/psl.as
+++ /dev/null
@@ -1,25 +0,0 @@
-table psl
-"Summary info about a patSpace alignment"
-    (
-    uint matches;  "Number of bases that match that aren't repeats"
-    uint misMatches; "Number of bases that don't match"
-    uint repMatches; "Number of bases that match but are part of repeats"
-    uint nCount;  "Number of 'N' bases"
-    uint qNumInsert; "Number of inserts in query"
-    int qBaseInsert; "Number of bases inserted in query"
-    uint tNumInsert; "Number of inserts in target"
-    int tBaseInsert; "Number of bases inserted in target"
-    char[2] strand; "+ or - for strand. First character query, second target (optional)"
-    string qName; "Query sequence name"
-    uint qSize; "Query sequence size"
-    uint qStart; "Alignment start position in query"
-    uint qEnd; "Alignment end position in query"
-    string tName; "Target sequence name"
-    uint tSize; "Target sequence size"
-    uint tStart; "Alignment start position in target"
-    uint tEnd; "Alignment end position in target"
-    uint blockCount; "Number of blocks in alignment"
-    uint[blockCount] blockSizes; "Size of each block"
-    uint[blockCount] qStarts; "Start of each block in query."
-    uint[blockCount] tStarts; "Start of each block in target."
-    )
diff --git a/gbtools/src/blatSrc/lib/psl.c b/gbtools/src/blatSrc/lib/psl.c
deleted file mode 100644
index 8e4611a..0000000
--- a/gbtools/src/blatSrc/lib/psl.c
+++ /dev/null
@@ -1,1961 +0,0 @@
-/* psl.c was originally generated by the autoSql program, which also 
- * generated as_psl.h and as_psl.sql.  This module links the database and the RAM 
- * representation of objects. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "sqlNum.h"
-#include "sqlList.h"
-#include "localmem.h"
-#include "psl.h"
-#include "hash.h"
-#include "linefile.h"
-#include "dnaseq.h"
-#include "dystring.h"
-#include "fuzzyFind.h"
-#include "aliType.h"
-#include "binRange.h"
-#include "rangeTree.h"
-
-
-struct psl *pslxLoad(char **row)
-/* Load a psl from row fetched with select * from psl
- * from database.  Dispose of this with pslFree(). */
-{
-struct psl *ret = pslLoad(row);
-int retSize;
-sqlStringDynamicArray(row[21],&ret->qSequence, &retSize);
-sqlStringDynamicArray(row[22],&ret->tSequence, &retSize);
-return ret;
-}
-
-struct psl *pslLoad(char **row)
-/* Load a psl from row fetched with select * from psl
- * from database.  Dispose of this with pslFree(). */
-{
-struct psl *ret;
-int sizeOne;
-
-AllocVar(ret);
-ret->blockCount = sqlUnsigned(row[17]);
-ret->match = sqlUnsigned(row[0]);
-ret->misMatch = sqlUnsigned(row[1]);
-ret->repMatch = sqlUnsigned(row[2]);
-ret->nCount = sqlUnsigned(row[3]);
-ret->qNumInsert = sqlUnsigned(row[4]);
-ret->qBaseInsert = sqlSigned(row[5]);
-ret->tNumInsert = sqlUnsigned(row[6]);
-ret->tBaseInsert = sqlSigned(row[7]);
-strcpy(ret->strand, row[8]);
-ret->qName = cloneString(row[9]);
-ret->qSize = sqlUnsigned(row[10]);
-ret->qStart = sqlUnsigned(row[11]);
-ret->qEnd = sqlUnsigned(row[12]);
-ret->tName = cloneString(row[13]);
-ret->tSize = sqlUnsigned(row[14]);
-ret->tStart = sqlUnsigned(row[15]);
-ret->tEnd = sqlUnsigned(row[16]);
-sqlUnsignedDynamicArray(row[18], &ret->blockSizes, &sizeOne);
-if (sizeOne != ret->blockCount)
-    {
-    printf("sizeOne bloxksizes %d bs %d block=%s\n",sizeOne, ret->blockCount,row[18]);
-    }
-assert(sizeOne == ret->blockCount);
-sqlUnsignedDynamicArray(row[19], &ret->qStarts, &sizeOne);
-if (sizeOne != ret->blockCount)
-    {
-    printf("sizeOne qStarts %d bs %d\n",sizeOne, ret->blockCount);
-    }
-assert(sizeOne == ret->blockCount);
-sqlUnsignedDynamicArray(row[20], &ret->tStarts, &sizeOne);
-if (sizeOne != ret->blockCount)
-    {
-    printf("sizeOne tStarts %d bs %d\n",sizeOne, ret->blockCount);
-    }
-assert(sizeOne == ret->blockCount);
-return ret;
-}
-
-struct psl *pslCommaIn(char **pS, struct psl *ret)
-/* Create a psl out of a comma separated string. 
- * This will fill in ret if non-null, otherwise will
- * return a new psl */
-{
-char *s = *pS;
-int i;
-
-if (ret == NULL)
-    AllocVar(ret);
-ret->match = sqlUnsignedComma(&s);
-ret->misMatch = sqlUnsignedComma(&s);
-ret->repMatch = sqlUnsignedComma(&s);
-ret->nCount = sqlUnsignedComma(&s);
-ret->qNumInsert = sqlUnsignedComma(&s);
-ret->qBaseInsert = sqlSignedComma(&s);
-ret->tNumInsert = sqlUnsignedComma(&s);
-ret->tBaseInsert = sqlSignedComma(&s);
-sqlFixedStringComma(&s, ret->strand, sizeof(ret->strand));
-ret->qName = sqlStringComma(&s);
-ret->qSize = sqlUnsignedComma(&s);
-ret->qStart = sqlUnsignedComma(&s);
-ret->qEnd = sqlUnsignedComma(&s);
-ret->tName = sqlStringComma(&s);
-ret->tSize = sqlUnsignedComma(&s);
-ret->tStart = sqlUnsignedComma(&s);
-ret->tEnd = sqlUnsignedComma(&s);
-ret->blockCount = sqlUnsignedComma(&s);
-s = sqlEatChar(s, '{');
-AllocArray(ret->blockSizes, ret->blockCount);
-for (i=0; i<ret->blockCount; ++i)
-    {
-    ret->blockSizes[i] = sqlUnsignedComma(&s);
-    }
-s = sqlEatChar(s, '}');
-s = sqlEatChar(s, ',');
-s = sqlEatChar(s, '{');
-AllocArray(ret->qStarts, ret->blockCount);
-for (i=0; i<ret->blockCount; ++i)
-    {
-    ret->qStarts[i] = sqlUnsignedComma(&s);
-    }
-s = sqlEatChar(s, '}');
-s = sqlEatChar(s, ',');
-s = sqlEatChar(s, '{');
-AllocArray(ret->tStarts, ret->blockCount);
-for (i=0; i<ret->blockCount; ++i)
-    {
-    ret->tStarts[i] = sqlUnsignedComma(&s);
-    }
-s = sqlEatChar(s, '}');
-s = sqlEatChar(s, ',');
-*pS = s;
-return ret;
-}
-
-void pslFree(struct psl **pEl)
-/* Free a single dynamically allocated psl such as created
- * with pslLoad(). */
-{
-struct psl *el;
-
-if ((el = *pEl) == NULL) return;
-freeMem(el->qName);
-freeMem(el->tName);
-freeMem(el->blockSizes);
-freeMem(el->qStarts);
-freeMem(el->tStarts);
-if (el->qSequence)
-    {
-    freeMem(el->qSequence[0]);
-    freeMem(el->qSequence);
-    }
-if (el->tSequence)
-    {
-    freeMem(el->tSequence[0]);
-    freeMem(el->tSequence);
-    }
-freez(pEl);
-}
-
-void pslFreeList(struct psl **pList)
-/* Free a list of dynamically allocated psl's */
-{
-struct psl *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    pslFree(&el);
-    }
-*pList = NULL;
-}
-
-void pslOutput(struct psl *el, FILE *f, char sep, char lastSep) 
-/* Print out psl.  Separate fields with sep. Follow last field with lastSep. */
-{
-int i;
-fprintf(f, "%u", el->match);
-fputc(sep,f);
-fprintf(f, "%u", el->misMatch);
-fputc(sep,f);
-fprintf(f, "%u", el->repMatch);
-fputc(sep,f);
-fprintf(f, "%u", el->nCount);
-fputc(sep,f);
-fprintf(f, "%u", el->qNumInsert);
-fputc(sep,f);
-fprintf(f, "%d", el->qBaseInsert);
-fputc(sep,f);
-fprintf(f, "%u", el->tNumInsert);
-fputc(sep,f);
-fprintf(f, "%d", el->tBaseInsert);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->strand);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->qName);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%u", el->qSize);
-fputc(sep,f);
-fprintf(f, "%u", el->qStart);
-fputc(sep,f);
-fprintf(f, "%u", el->qEnd);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->tName);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%u", el->tSize);
-fputc(sep,f);
-fprintf(f, "%u", el->tStart);
-fputc(sep,f);
-fprintf(f, "%u", el->tEnd);
-fputc(sep,f);
-fprintf(f, "%u", el->blockCount);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->blockCount; ++i)
-    {
-    fprintf(f, "%u", el->blockSizes[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->blockCount; ++i)
-    {
-    fprintf(f, "%u", el->qStarts[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->blockCount; ++i)
-    {
-    fprintf(f, "%u", el->tStarts[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-if (el->qSequence)
-    {
-    fputc(sep,f);
-    if (sep == ',') fputc('{',f);
-    for (i=0; i<el->blockCount; ++i)
-	{
-	fprintf(f, "%s", el->qSequence[i]);
-	fputc(',', f);
-	}
-    if (sep == ',') fputc('}',f);
-    fputc(sep,f);
-    if (sep == ',') fputc('{',f);
-    for (i=0; i<el->blockCount; ++i)
-	{
-	fprintf(f, "%s", el->tSequence[i]);
-	fputc(',', f);
-	}
-    if (sep == ',') fputc('}',f);
-    }
-
-fputc(lastSep,f);
-if (ferror(f))
-    {
-    perror("Error writing psl file\n");
-    errAbort("\n");
-    }
-}
-
-/* ----- end autoSql generated part --------------- */
-
-void pslOutputShort(struct psl *el, FILE *f, char sep, char lastSep) 
-/* Print out psl.  Separate fields with sep. Follow last field with lastSep. */
-{
-fprintf(f, "%u", el->match);
-fputc(sep,f);
-fprintf(f, "%u", el->misMatch);
-fputc(sep,f);
-fprintf(f, "%u", el->repMatch);
-fputc(sep,f);
-fprintf(f, "%u", el->qNumInsert);
-fputc(sep,f);
-fprintf(f, "%d", el->qBaseInsert);
-fputc(sep,f);
-fprintf(f, "%u", el->tNumInsert);
-fputc(sep,f);
-fprintf(f, "%d", el->tBaseInsert);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->strand);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->qName);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%u", el->qStart);
-fputc(sep,f);
-fprintf(f, "%u", abs(el->qEnd - el->qStart));
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->tName);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%u", el->tStart);
-fputc(sep,f);
-fprintf(f, "%u", abs(el->tEnd - el->tStart));
-fputc(sep,f);
-fprintf(f, "%u", el->blockCount);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-fputc(lastSep,f);
-if (ferror(f))
-    {
-    perror("Error writing psl file\n");
-    errAbort("\n");
-    }
-}
-
-void pslOutFormat(struct psl *el, FILE *f, char sep, char lastSep) 
-/* Print out selected psl values.  Separate fields with sep. Follow last field with lastSep. */
-/* Prints out a better format with bold field headings followed by value */
-/* Requires further upstream work to ensure that only the field headers */
-/* declared here are printed if replacing an existing psl print function*/
-{
-const char *headers[] = {"Matches", "Mismatches", "Matches in repeats", "Number of N bases", "Query name", "Size", "Start", "End", "Chromosome", "Strand", "Start", "End"};
-char *hformat = "<B>%s:</B> "; /* string for formatted print for headers */
-char *uformat = "<B>%s:</B> %u%c"; /* string for formatted print for unsigned variable */
-char *targName;
-
-fprintf(f, uformat, headers[0], el->match, sep);
-fprintf(f, uformat, headers[1], el->misMatch, sep);
-fprintf(f, uformat, headers[2], el->repMatch, sep);
-fprintf(f, uformat, headers[3], el->nCount, sep);
-
-fprintf(f, hformat, headers[4]);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->qName);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-
-fprintf(f, uformat, headers[5], el->qSize, sep);
-fprintf(f, uformat, headers[6], el->qStart, sep);
-fprintf(f, uformat, headers[7], el->qEnd, sep);
-
-fprintf(f, hformat, headers[8]);
-if (sep == ',') fputc('"',f);
-/* skip leading 'chr' in string to get only chromosome part */
-targName = el->tName;
-if (startsWith("chr", el->tName))
-   targName += 3;
-fprintf(f, "%s", targName);
-
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-
-fprintf(f, hformat, headers[9]);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->strand);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-
-fprintf(f, uformat, headers[10], el->tStart, sep);
-fprintf(f, uformat, headers[11], el->tEnd, sep);
-
-fputc(lastSep,f);
-
-if (ferror(f))
-    {
-    perror("Error writing psl file\n");
-    errAbort("\n");
-    }
-
-}
-
-struct psl *pslLoadAll(char *fileName)
-/* Load all psl's in file. */
-{
-struct lineFile *lf = pslFileOpen(fileName);
-struct psl *pslList = NULL, *psl;
-while ((psl = pslNext(lf)) != NULL)
-    {
-    slAddHead(&pslList, psl);
-    }
-slReverse(&pslList);
-lineFileClose(&lf);
-return pslList;
-}
-
-
-int pslCmpQuery(const void *va, const void *vb)
-/* Compare to sort based on query start. */
-{
-const struct psl *a = *((struct psl **)va);
-const struct psl *b = *((struct psl **)vb);
-int dif;
-dif = strcmp(a->qName, b->qName);
-if (dif == 0)
-    dif = a->qStart - b->qStart;
-return dif;
-}
-
-int pslCmpTarget(const void *va, const void *vb)
-/* Compare to sort based on target start. */
-{
-const struct psl *a = *((struct psl **)va);
-const struct psl *b = *((struct psl **)vb);
-int dif;
-dif = strcmp(a->tName, b->tName);
-if (dif == 0)
-    dif = a->tStart - b->tStart;
-return dif;
-}
-
-int pslCmpTargetAndStrand(const void *va, const void *vb)
-/* Compare to sort based on target, strand,  tStart. */
-{
-const struct psl *a = *((struct psl **)va);
-const struct psl *b = *((struct psl **)vb);
-int dif;
-dif = strcmp(a->tName, b->tName);
-if (dif == 0)
-    dif = strcmp(a->strand, b->strand);
-if (dif == 0)
-    dif = a->tStart - b->tStart;
-return dif;
-}
-
-
-int pslCmpScore(const void *va, const void *vb)
-/* Compare to sort based on score (descending). */
-{
-const struct psl *a = *((struct psl **)va);
-const struct psl *b = *((struct psl **)vb);
-return pslScore(b) - pslScore(a);
-}
-
-int pslCmpQueryScore(const void *va, const void *vb)
-/* Compare to sort based on query then score (descending). */
-{
-const struct psl *a = *((struct psl **)va);
-const struct psl *b = *((struct psl **)vb);
-int diff = strcmp(a->qName, b->qName);
-if (diff == 0)
-    diff = pslScore(b) - pslScore(a);
-return diff;
-}
-
-int pslCmpMatch(const void *va, const void *vb)
-/* Compare to sort based on match */
-{
-const struct psl *a = *((struct psl **)va);
-const struct psl *b = *((struct psl **)vb);
-return b->match - a->match;
-}
-
-static void pslLabelColumns(FILE *f)
-/* Write column info. */
-{
-fputs("\n"
-"match\tmis- \trep. \tN's\tQ gap\tQ gap\tT gap\tT gap\tstrand\tQ        \tQ   \tQ    \tQ  \tT        \tT   \tT    \tT  \tblock\tblockSizes \tqStarts\t tStarts\n"
-"     \tmatch\tmatch\t   \tcount\tbases\tcount\tbases\t      \tname     \tsize\tstart\tend\tname     \tsize\tstart\tend\tcount\n" 
-"---------------------------------------------------------------------------------------------------------------------------------------------------------------\n",
-f);
-}
-
-void pslxWriteHead(FILE *f, enum gfType qType, enum gfType tType)
-/* Write header for extended (possibly protein) psl file. */
-{
-fprintf(f, "psLayout version 4 %s %s\n", gfTypeName(qType), gfTypeName(tType));
-pslLabelColumns(f);
-}
-
-void pslWriteHead(FILE *f)
-/* Write head of psl. */
-{
-fputs("psLayout version 3\n", f);
-pslLabelColumns(f);
-}
-
-void pslWriteAll(struct psl *pslList, char *fileName, boolean writeHeader)
-/* Write a psl file from list. */
-{
-FILE *f;
-struct psl *psl;
-
-f = mustOpen(fileName, "w");
-if (writeHeader)
-    pslWriteHead(f);
-for (psl = pslList; psl != NULL; psl = psl->next)
-    pslTabOut(psl, f);
-fclose(f);
-}
-
-void pslxFileOpen(char *fileName, enum gfType *retQueryType, enum gfType *retTargetType, struct lineFile **retLf)
-/* Read header part of psl and make sure it's right.  Return
- * sequence types and file handle. */
-{
-char *line;
-int lineSize;
-char *words[30];
-char *version;
-int wordCount;
-int i;
-enum gfType qt = gftRna,  tt = gftDna;
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-
-if (!lineFileNext(lf, &line, &lineSize))
-    warn("%s is empty", fileName);
-else
-    {
-    if (startsWith("psLayout version", line))
-	{
-	wordCount = chopLine(line, words);
-	if (wordCount < 3)
-	    errAbort("%s is not a psLayout file", fileName);
-	version = words[2];
-	if (sameString(version, "3"))
-	    {
-	    }
-	else if (sameString(version, "4"))
-	    {
-	    qt = gfTypeFromName(words[3]);
-	    tt = gfTypeFromName(words[4]);
-	    }
-	else
-	    {
-	    errAbort("%s is version %s of psLayout, this program can only handle through version 4",
-		fileName,  version);
-	    }
-	for (i=0; i<4; ++i)
-	    {
-	    if (!lineFileNext(lf, &line, &lineSize))
-		errAbort("%s severely truncated", fileName);
-	    }
-	}
-    else
-	lineFileReuse(lf); 
-    }
-*retQueryType = qt;
-*retTargetType = tt;
-*retLf = lf;
-}
-
-static void pslxFileOpenWithMetaConfig(char *fileName, bool isMetaUnique, enum gfType *retQueryType, enum gfType *retTargetType, struct lineFile **retLf, FILE *f)
-/* Read header part of psl and make sure it's right.  Return
- * sequence types and file handle and send meta data to output file f */
-{
-char *line;
-int lineSize;
-char *words[30];
-char *version;
-int wordCount;
-int i;
-enum gfType qt = gftRna,  tt = gftDna;
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-
-lineFileSetMetaDataOutput(lf, f);
-if (isMetaUnique)
-    lineFileSetUniqueMetaData(lf);
-if (!lineFileNext(lf, &line, &lineSize))
-    warn("%s is empty", fileName);
-else
-    {
-    if (startsWith("psLayout version", line))
-	{
-	wordCount = chopLine(line, words);
-	if (wordCount < 3)
-	    errAbort("%s is not a psLayout file", fileName);
-	version = words[2];
-	if (sameString(version, "3"))
-	    {
-	    }
-	else if (sameString(version, "4"))
-	    {
-	    qt = gfTypeFromName(words[3]);
-	    tt = gfTypeFromName(words[4]);
-	    }
-	else
-	    {
-	    errAbort("%s is version %s of psLayout, this program can only handle through version 4",
-		fileName,  version);
-	    }
-	for (i=0; i<4; ++i)
-	    {
-	    if (!lineFileNext(lf, &line, &lineSize))
-		errAbort("%s severely truncated", fileName);
-	    }
-	}
-    else
-        {
-	char *s = cloneString(line);
-        boolean eof = FALSE;
-        while ((line[0] == '#') && (!eof))
-            {
-            freeMem(s);
-            if (!lineFileNext(lf, &line, &lineSize))
-                eof = TRUE;
-            s = cloneString(line);
-            }
-	wordCount = chopLine(s, words);
-	if ((wordCount < 21 || wordCount > 23 || (words[8][0] != '+' && words[8][0] != '-')) && (!eof))
-	    errAbort("%s is not a psLayout file", fileName);
-	else
-	    lineFileReuse(lf); 
-	freeMem(s);
-	}
-    }
-*retQueryType = qt;
-*retTargetType = tt;
-*retLf = lf;
-}
-
-void pslxFileOpenWithMeta(char *fileName, enum gfType *retQueryType, enum gfType *retTargetType, struct lineFile **retLf, FILE *f)
-/* Read header part of psl and make sure it's right.  Return
- * sequence types and file handle and send meta data to output file f */
-{
-pslxFileOpenWithMetaConfig(fileName, FALSE, retQueryType, retTargetType, retLf, f);
-}
-
-void pslxFileOpenWithUniqueMeta(char *fileName, enum gfType *retQueryType, enum gfType *retTargetType, struct lineFile **retLf, FILE *f)
-/* Read header part of psl and make sure it's right.  Return
- * sequence types and file handle and send only unique meta data to output f */
-{
-pslxFileOpenWithMetaConfig(fileName, TRUE, retQueryType, retTargetType, retLf, f);
-}
-
-struct lineFile *pslFileOpen(char *fileName)
-/* Read header part of psl and make sure it's right. 
- * Return line file handle to it. */
-{
-enum gfType qt, tt;
-struct lineFile *lf;
-pslxFileOpen(fileName, &qt, &tt, &lf);
-return lf;
-}
-
-struct lineFile *pslFileOpenWithMeta(char *fileName, FILE *f)
-/* Read header part of psl and make sure it's right. 
- * Return line file handle to it. */
-{
-enum gfType qt, tt;
-struct lineFile *lf;
-pslxFileOpenWithMeta(fileName, &qt, &tt, &lf, f);
-return lf;
-}
-
-struct lineFile *pslFileOpenWithUniqueMeta(char *fileName, FILE *f)
-/* Read header part of psl and make sure it's right. 
- * Set flag to suppress duplicate header comments.
- * Return line file handle to it. */
-{
-enum gfType qt, tt;
-struct lineFile *lf;
-pslxFileOpenWithUniqueMeta(fileName, &qt, &tt, &lf, f);
-return lf;
-}
-
-struct psl *pslNext(struct lineFile *lf)
-/* Read next line from file and convert it to psl.  Return
- * NULL at eof. */
-{
-char *line;
-int lineSize;
-char *words[32];
-int wordCount;
-static int lineAlloc = 0;
-static char *chopBuf = NULL;
-
-if (!lineFileNextReal(lf, &line))
-    {
-    return NULL;
-    }
-lineSize = strlen(line);
-if (lineSize >= lineAlloc)
-    {
-    lineAlloc = lineSize+256;
-    chopBuf = needMoreMem(chopBuf, 0, lineAlloc);
-    }
-memcpy(chopBuf, line, lineSize+1);
-wordCount = chopLine(chopBuf, words);
-if (wordCount == 21)
-    {
-    return pslLoad(words);
-    }
-if (wordCount == 23)
-    {
-    return pslxLoad(words);
-    }
-else
-    {
-    errAbort("Bad line %d of %s wordCount is %d instead of 21 or 23\n", lf->lineIx, lf->fileName, wordCount);
-    return NULL;
-    }
-}
-
-struct psl *pslxLoadLm(char **row, struct lm *lm)
-/* Load row into local memory pslx. */
-{
-struct psl *ret = pslLoadLm(row, lm);
-ret->qSequence = lmAlloc(lm, sizeof(ret->qSequence[0]) * ret->blockCount);
-sqlStringArray(lmCloneString(lm,row[21]),ret->qSequence, ret->blockCount);
-ret->tSequence = lmAlloc(lm, sizeof(ret->tSequence[0]) * ret->blockCount);
-sqlStringArray(lmCloneString(lm,row[22]),ret->tSequence, ret->blockCount);
-return ret;
-}
-
-struct psl *pslLoadLm(char **row, struct lm *lm)
-/* Load row into local memory psl. */
-{
-struct psl *ret;
-
-ret = lmAlloc(lm, sizeof(*ret));
-ret->blockCount = sqlUnsigned(row[17]);
-ret->match = sqlUnsigned(row[0]);
-ret->misMatch = sqlUnsigned(row[1]);
-ret->repMatch = sqlUnsigned(row[2]);
-ret->nCount = sqlUnsigned(row[3]);
-ret->qNumInsert = sqlUnsigned(row[4]);
-ret->qBaseInsert = sqlSigned(row[5]);
-ret->tNumInsert = sqlUnsigned(row[6]);
-ret->tBaseInsert = sqlSigned(row[7]);
-strcpy(ret->strand, row[8]);
-ret->qName = lmCloneString(lm,row[9]);
-ret->qSize = sqlUnsigned(row[10]);
-ret->qStart = sqlUnsigned(row[11]);
-ret->qEnd = sqlUnsigned(row[12]);
-ret->tName = lmCloneString(lm, row[13]);
-ret->tSize = sqlUnsigned(row[14]);
-ret->tStart = sqlUnsigned(row[15]);
-ret->tEnd = sqlUnsigned(row[16]);
-ret->blockSizes = lmAlloc(lm, sizeof(ret->blockSizes[0]) * ret->blockCount);
-sqlUnsignedArray(row[18], ret->blockSizes, ret->blockCount);
-ret->qStarts = lmAlloc(lm, sizeof(ret->qStarts[0]) * ret->blockCount);
-sqlUnsignedArray(row[19], ret->qStarts, ret->blockCount);
-ret->tStarts = lmAlloc(lm, sizeof(ret->tStarts[0]) * ret->blockCount);
-sqlUnsignedArray(row[20], ret->tStarts, ret->blockCount);
-return ret;
-}
-
-boolean pslIsProtein(const struct psl *psl)
-/* is psl a protein psl (are it's blockSizes and scores in protein space) */
-{
-int lastBlock = psl->blockCount - 1;
-
-return  (((psl->strand[1] == '+' ) &&
-    (psl->tEnd == psl->tStarts[lastBlock] + 3*psl->blockSizes[lastBlock])) ||
-   ((psl->strand[1] == '-') && 
-    (psl->tStart == (psl->tSize-(psl->tStarts[lastBlock] + 3*psl->blockSizes[lastBlock])))));
-}
-
-int pslCalcMilliBad(struct psl *psl, boolean isMrna)
-/* Calculate badness in parts per thousand. */
-{
-int sizeMul = pslIsProtein(psl) ? 3 : 1;
-int qAliSize, tAliSize, aliSize;
-int milliBad = 0;
-int sizeDif;
-int insertFactor;
-int total;
-
-qAliSize = sizeMul * (psl->qEnd - psl->qStart);
-tAliSize = psl->tEnd - psl->tStart;
-aliSize = min(qAliSize, tAliSize);
-if (aliSize <= 0)
-    return 0;
-sizeDif = qAliSize - tAliSize;
-if (sizeDif < 0)
-    {
-    if (isMrna)
-	sizeDif = 0;
-    else
-	sizeDif = -sizeDif;
-    }
-insertFactor = psl->qNumInsert;
-if (!isMrna)
-    insertFactor += psl->tNumInsert;
-
-total = (sizeMul * (psl->match + psl->repMatch + psl->misMatch));
-if (total != 0)
-    milliBad = (1000 * (psl->misMatch*sizeMul + insertFactor + round(3*log(1+sizeDif)))) / total;
-return milliBad;
-}
-
-int pslScore(const struct psl *psl)
-/* Return score for psl. */
-{
-int sizeMul = pslIsProtein(psl) ? 3 : 1;
-
-return sizeMul * (psl->match + ( psl->repMatch>>1)) - 
-	sizeMul * psl->misMatch - psl->qNumInsert - psl->tNumInsert;
-}
-
-int pslCmpScoreDesc(const void *va, const void *vb)
-/* Compare to sort based on score. */
-{
-const struct psl *a = *((struct psl **)va);
-const struct psl *b = *((struct psl **)vb);
-return pslScore(b) - pslScore(a);
-}
-
-
-struct ffAli *pslToFakeFfAli(struct psl *psl, DNA *needle, DNA *haystack)
-/* Convert from psl to ffAli format.  In some cases you can pass NULL
- * for needle and haystack - depending what the post-processing is going
- * to be. */
-{
-struct ffAli *ffList = NULL, *ff;
-int blockCount = psl->blockCount;
-unsigned *blockSizes = psl->blockSizes;
-unsigned *qStarts = psl->qStarts;
-unsigned *tStarts = psl->tStarts;
-int size;
-int i;
-
-for (i=0; i<blockCount; ++i)
-    {
-    size = blockSizes[i];
-    AllocVar(ff);
-    ff->left = ffList;
-    ffList = ff;
-    ff->nStart = ff->nEnd = needle + qStarts[i];
-    ff->nEnd += size;
-    ff->hStart = ff->hEnd = haystack + tStarts[i];
-    ff->hEnd += size;
-    }
-ffList = ffMakeRightLinks(ffList);
-return ffList;
-}
-
-struct psl *pslFromFakeFfAli(struct ffAli *ff, 
-	DNA *needle, DNA *haystack, char strand,
-	char *qName, int qSize, char *tName, int tSize)
-/* This will create a basic psl structure from a sorted series of ffAli
- * blocks.  The fields that would need actual sequence to be filled in
- * are left zero however - fields including match, repMatch, mismatch. */
-{
-struct psl *psl;
-unsigned *blockSizes;
-unsigned *qStarts;
-unsigned *tStarts;
-int blockCount;
-int i;
-int nStart, hStart;
-int nEnd, hEnd;
-
-AllocVar(psl);
-psl->blockCount = blockCount = ffAliCount(ff);
-psl->blockSizes = AllocArray(blockSizes, blockCount);
-psl->qStarts = AllocArray(qStarts, blockCount);
-psl->tStarts = AllocArray(tStarts, blockCount);
-psl->qName = cloneString(qName);
-psl->qSize = qSize;
-psl->tName = cloneString(tName);
-psl->tSize = tSize;
-psl->strand[0] = strand;
-
-for (i=0; i<blockCount; ++i)
-    {
-    nStart = ff->nStart - needle;
-    nEnd = ff->nEnd - needle;
-    hStart = ff->hStart - haystack;
-    hEnd = ff->hEnd - haystack;
-    blockSizes[i] = nEnd - nStart;
-    qStarts[i] = nStart;
-    tStarts[i] = hStart;
-    if (i == 0)
-       {
-       psl->qStart = nStart;
-       psl->tStart = hStart;
-       }
-    if (i == blockCount-1)
-       {
-       psl->qEnd = nEnd;
-       psl->tEnd = hEnd;
-       }
-    ff = ff->right;
-    }
-if (strand == '-')
-    {
-    reverseIntRange(&psl->qStart, &psl->qEnd, psl->qSize);
-    }
-return psl;
-}
-
-struct ffAli *pslToFfAli(struct psl *psl, struct dnaSeq *query, struct dnaSeq *target,
-	int targetOffset)
-/* Convert from psl to ffAli format.  Clip to parts that we actually
- * have sequence for. */
-{
-struct ffAli *ffList = NULL, *ff;
-DNA *needle = query->dna;
-DNA *haystack = target->dna;
-int blockCount = psl->blockCount;
-unsigned *blockSizes = psl->blockSizes;
-unsigned *qStarts = psl->qStarts;
-unsigned *tStarts = psl->tStarts;
-int size;
-int i;
-int tMin = targetOffset;
-int tMax = targetOffset + target->size;
-int tStart, tEnd;
-int clipStart, clipEnd, clipOffset, clipSize;
-
-for (i=0; i<blockCount; ++i)
-    {
-    clipStart = tStart = tStarts[i];
-    size = blockSizes[i];
-    clipEnd = tEnd = tStart + size;
-    if (tStart < tMax && tEnd > tMin)
-	{
-	if (clipStart < tMin) clipStart = tMin;
-	if (clipEnd > tMax) clipEnd = tMax;
-	clipOffset = clipStart - tStart;
-	clipSize = clipEnd - clipStart;
-	AllocVar(ff);
-	ff->left = ffList;
-	ffList = ff;
-	ff->nStart = ff->nEnd = needle + qStarts[i] + clipOffset;
-	ff->nEnd += clipSize;
-	ff->hStart = ff->hEnd = haystack + clipStart - targetOffset;
-	ff->hEnd += clipSize;
-	}
-    }
-ffList = ffMakeRightLinks(ffList);
-ffCountGoodEnds(ffList);
-return ffList;
-}
-
-int pslOrientation(struct psl *psl)
-/* Translate psl strand + or - to orientation +1 or -1 */
-{
-if (psl->strand[1] != '\0')
-    {
-    /* translated blat */
-    if (psl->strand[0] != psl->strand[1])
-        return -1;
-    else
-        return 1;
-    }
-else
-    {
-    if (psl->strand[0] == '-')
-        return -1;
-    else
-        return 1;
-    }
-}
-
-int pslWeightedIntronOrientation(struct psl *psl, struct dnaSeq *genoSeq, int offset)
-/* Return >0 if introns make it look like alignment is on + strand,
- *        <0 if introns make it look like alignment is on - strand,
- *        0 if can't tell.  The absolute value of the return indicates
- * how many splice sites we've seen supporting the orientation.
- * Sequence should NOT be reverse complemented.  */
-{
-int intronDir = 0;
-int oneDir;
-int i;
-DNA *dna = genoSeq->dna;
-
-/* code below doesn't support negative target strand (translated blat) */
-if (psl->strand[1] == '-')
-    errAbort("pslWeightedIntronOrientation doesn't support a negative target strand");
-
-for (i=1; i<psl->blockCount; ++i)
-    {
-    int iStart, iEnd, blockSize = psl->blockSizes[i-1];
-    if (psl->qStarts[i-1] + blockSize == psl->qStarts[i])
-	{
-	iStart = psl->tStarts[i-1] + psl->blockSizes[i-1] - offset;
-	iEnd = psl->tStarts[i] - offset;
-	oneDir = intronOrientation(dna+iStart, dna+iEnd);
-	intronDir += oneDir;
-	}
-    }
-return intronDir;
-}
-
-int pslIntronOrientation(struct psl *psl, struct dnaSeq *genoSeq, int offset)
-/* Return 1 if introns make it look like alignment is on + strand,
- *       -1 if introns make it look like alignment is on - strand,
- *        0 if can't tell.
- * Sequence should NOT be reverse complemented.  */
-{
-int intronDir = pslWeightedIntronOrientation(psl, genoSeq, offset);
-if (intronDir < 0)
-    intronDir = -1;
-else if (intronDir > 0)
-    intronDir = 1;
-return intronDir;
-}
-
-boolean pslHasIntron(struct psl *psl, struct dnaSeq *seq, int seqOffset)
-/* Return TRUE if there's a probable intron. Sequence should NOT be
- * reverse complemented.*/
-{
-int blockCount = psl->blockCount, i;
-unsigned *tStarts = psl->tStarts;
-unsigned *blockSizes = psl->blockSizes;
-unsigned *qStarts = psl->qStarts;
-int blockSize, start, end;
-DNA *dna = seq->dna;
-
-for (i=1; i<blockCount; ++i)
-    {
-    blockSize = blockSizes[i-1];
-    start = qStarts[i-1]+blockSize;
-    end = qStarts[i];
-    if (start == end)
-        {
-        start = tStarts[i-1] + blockSize;
-        end = tStarts[i];
-        if (psl->strand[1] == '-')
-            reverseIntRange(&start, &end, psl->tSize);
-        start -= seqOffset;
-        end -= seqOffset;
-	if (intronOrientation(dna+start, dna+end) != 0)
-	    return TRUE;
-	}
-    }
-return FALSE;
-}
-
-void pslTailSizes(struct psl *psl, int *retStartTail, int *retEndTail)
-/* Find the length of "tails" (rather than extensions) implied by psl. */
-{
-int orientation = pslOrientation(psl);
-int qFloppyStart, qFloppyEnd;
-int tFloppyStart, tFloppyEnd;
-
-if (orientation > 0)
-    {
-    qFloppyStart = psl->qStart;
-    qFloppyEnd = psl->qSize - psl->qEnd;
-    }
-else
-    {
-    qFloppyStart = psl->qSize - psl->qEnd;
-    qFloppyEnd = psl->qStart;
-    }
-tFloppyStart = psl->tStart;
-tFloppyEnd = psl->tSize - psl->tEnd;
-*retStartTail = min(qFloppyStart, tFloppyStart);
-*retEndTail = min(qFloppyEnd, tFloppyEnd);
-}
-
-static void rcSeqs(char **seqs, unsigned blockCount, unsigned *blockSizes)
-/* reverses complement sequences in list, maintain property that all strings
- * are in one malloc block.   blockSizes should already be reversed. */
-{
-char *buf, *next;
-int i, memSz = 0;
-
-/* get a new memory block for strings */
-for (i = 0; i < blockCount; i++)
-    memSz += blockSizes[i]+1;
-next = buf = needLargeMem(memSz);
-
-/* reverse compliment and copy to new memory block */
-for (i = blockCount-1; i >= 0; i--)
-    {
-    int len = strlen(seqs[i]);
-    reverseComplement(seqs[i], len);
-    memcpy(next, seqs[i], len+1);
-    next += len+1;
-    }
-
-/* swap memory and update pointers */
-freeMem(seqs[0]);
-seqs[0] = buf;
-next = buf;
-
-for (i = 0; i < blockCount; i++)
-    {
-    seqs[i] = next;
-    next += blockSizes[i]+1;
-    }
-}
-
-void pslRc(struct psl *psl)
-/* Reverse-complement a PSL alignment.  This makes the target strand explicit. */
-{
-unsigned tSize = psl->tSize, qSize = psl->qSize;
-unsigned blockCount = psl->blockCount, i;
-unsigned *tStarts = psl->tStarts, *qStarts = psl->qStarts, *blockSizes = psl->blockSizes;
-
-/* swap strand, forcing target to have an explict strand */
-psl->strand[0] = (psl->strand[0] != '-') ? '-' : '+';
-psl->strand[1] = (psl->strand[1] != '-') ? '-' : '+';
-psl->strand[2] = 0;
-
-for (i=0; i<blockCount; ++i)
-    {
-    tStarts[i] = tSize - (tStarts[i] + blockSizes[i]);
-    qStarts[i] = qSize - (qStarts[i] + blockSizes[i]);
-    }
-reverseUnsigned(tStarts, blockCount);
-reverseUnsigned(qStarts, blockCount);
-reverseUnsigned(blockSizes, blockCount);
-if (psl->qSequence != NULL)
-    {
-    rcSeqs(psl->qSequence, blockCount, blockSizes);
-    rcSeqs(psl->tSequence, blockCount, blockSizes);
-    }
-}
-
-
-/* macro to swap to variables */
-#define swapVars(a, b, tmp) ((tmp) = (a), (a) = (b), (b) = (tmp))
-
-static void swapBlocks(struct psl *psl)
-/* Swap the blocks in a psl without reverse complementing them. */
-{
-int i;
-unsigned utmp;
-char *stmp; 
-for (i = 0; i < psl->blockCount; i++)
-    {
-    swapVars(psl->qStarts[i], psl->tStarts[i], utmp);
-    if (psl->qSequence != NULL)
-        swapVars(psl->qSequence[i], psl->tSequence[i], stmp);
-    }
-}
-
-static void swapRCBlocks(struct psl *psl)
-/* Swap and reverse complement blocks in a psl. Other psl fields must
- * be modified first */
-{
-int i;
-unsigned *uatmp;
-char **satmp;
-reverseUnsigned(psl->tStarts, psl->blockCount);
-reverseUnsigned(psl->qStarts, psl->blockCount);
-reverseUnsigned(psl->blockSizes, psl->blockCount);
-swapVars(psl->tStarts, psl->qStarts, uatmp);
-
-/* qSize and tSize have already been swapped */
-for (i = 0; i < psl->blockCount; i++)
-    {
-    psl->qStarts[i] = psl->qSize - (psl->qStarts[i] + psl->blockSizes[i]);
-    psl->tStarts[i] = psl->tSize - (psl->tStarts[i] + psl->blockSizes[i]);
-    }
-if (psl->qSequence != NULL)
-    {
-    /* note: all block sequences are stored in one malloc block, which is
-     * entry zero */
-    rcSeqs(psl->qSequence, psl->blockCount, psl->blockSizes);
-    rcSeqs(psl->tSequence, psl->blockCount, psl->blockSizes);
-    swapVars(psl->qSequence, psl->tSequence, satmp);
-    }
-}
-
-void pslSwap(struct psl *psl, boolean noRc)
-/* swap query and target in psl.  If noRc is TRUE, don't reverse-complement
- * PSL if needed, instead make target strand explict. */
-{
-int itmp;
-unsigned utmp;
-char ctmp, *stmp; 
-swapVars(psl->qBaseInsert, psl->tBaseInsert, utmp);
-swapVars(psl->tNumInsert, psl->qNumInsert, utmp);
-swapVars(psl->qName, psl->tName, stmp);
-swapVars(psl->qSize, psl->tSize, utmp);
-swapVars(psl->qStart, psl->tStart, itmp);
-swapVars(psl->qEnd, psl->tEnd, itmp);
-
-/* handle strand and block copy */
-if (psl->strand[1] != '\0')
-    {
-    /* translated */
-    swapVars(psl->strand[0], psl->strand[1], ctmp);
-    swapBlocks(psl);
-    }
-else if (noRc)
-    {
-    /* untranslated with no reverse complement */
-    psl->strand[1] = psl->strand[0];
-    psl->strand[0] = '+';
-    swapBlocks(psl);
-    }
-else
-    {
-    /* untranslated */
-    if (psl->strand[0] == '+')
-        swapBlocks(psl);
-    else
-        swapRCBlocks(psl);
-    }
-}
-
-void pslTargetOffset(struct psl *psl, int offset)
-/* Add offset to target positions in psl. */
-{
-int i, blockCount = psl->blockCount;
-unsigned *tStarts = psl->tStarts;
-psl->tStart += offset;
-psl->tEnd += offset;
-for (i=0; i<blockCount; ++i)
-   tStarts[i] += offset;
-}
-
-void pslDump(struct psl *psl, FILE *f)
-/* Dump most of PSL to file - for debugging. */
-{
-int i;
-fprintf(f, "<PRE>\n");
-fprintf(f, "psl %s:%d-%d %s %s:%d-%d %d\n", 
-	psl->qName, psl->qStart, psl->qEnd, psl->strand,
-	psl->tName, psl->tStart, psl->tEnd, psl->blockCount);
-for (i=0; i<psl->blockCount; ++i)
-    fprintf(f, "  size %d, qStart %d, tStart %d\n", 
-    	psl->blockSizes[i], psl->qStarts[i], psl->tStarts[i]);
-fprintf(f, "</PRE>");
-}
-
-static void pslRecalcBounds(struct psl *psl)
-/* Calculate qStart/qEnd tStart/tEnd at top level to be consistent
- * with blocks. */
-{
-int qStart, qEnd, tStart, tEnd, size;
-int last = psl->blockCount - 1;
-qStart = psl->qStarts[0];
-tStart = psl->tStarts[0];
-size = psl->blockSizes[last];
-qEnd = psl->qStarts[last] + size;
-tEnd = psl->tStarts[last] + size;
-if (psl->strand[0] == '-')
-    reverseIntRange(&qStart, &qEnd, psl->qSize);
-if (psl->strand[1] == '-')
-    reverseIntRange(&tStart, &tEnd, psl->tSize);
-psl->qStart = qStart;
-psl->qEnd = qEnd;
-psl->tStart = tStart;
-psl->tEnd = tEnd;
-}
-
-struct psl *pslTrimToTargetRange(struct psl *oldPsl, int tMin, int tMax)
-/* Return psl trimmed to fit inside tMin/tMax.  Note this does not
- * update the match/misMatch and related fields. */
-{
-int newSize;
-int oldBlockCount = oldPsl->blockCount;
-boolean tIsRc = (oldPsl->strand[1] == '-');
-int newBlockCount = 0, completeBlockCount = 0;
-int i;
-struct psl *newPsl = NULL;
-int tMn = tMin, tMx = tMax;   /* tMin/tMax adjusted for strand. */
-
-/* Deal with case where we're completely trimmed out quickly. */
-newSize = rangeIntersection(oldPsl->tStart, oldPsl->tEnd, tMin, tMax);
-if (newSize <= 0)
-    return NULL;
-
-if (tIsRc)
-    reverseIntRange(&tMn, &tMx, oldPsl->tSize);
-
-/* Count how many blocks will survive trimming. */
-oldBlockCount = oldPsl->blockCount;
-for (i=0; i<oldBlockCount; ++i)
-    {
-    int s = oldPsl->tStarts[i];
-    int e = s + oldPsl->blockSizes[i];
-    int sz = e - s;
-    int overlap;
-    if ((overlap = rangeIntersection(s, e, tMn, tMx)) > 0)
-        ++newBlockCount;
-    if (overlap == sz)
-        ++completeBlockCount;
-    }
-
-if (newBlockCount == 0)
-    return NULL;
-
-/* Allocate new psl and fill in what we already know. */
-AllocVar(newPsl);
-strcpy(newPsl->strand, oldPsl->strand);
-newPsl->qName = cloneString(oldPsl->qName);
-newPsl->qSize = oldPsl->qSize;
-newPsl->tName = cloneString(oldPsl->tName);
-newPsl->tSize = oldPsl->tSize;
-newPsl->blockCount = newBlockCount;
-AllocArray(newPsl->blockSizes, newBlockCount);
-AllocArray(newPsl->qStarts, newBlockCount);
-AllocArray(newPsl->tStarts, newBlockCount);
-
-/* Fill in blockSizes, qStarts, tStarts with real data. */
-newBlockCount = completeBlockCount = 0;
-for (i=0; i<oldBlockCount; ++i)
-    {
-    int oldSz = oldPsl->blockSizes[i];
-    int sz = oldSz;
-    int tS = oldPsl->tStarts[i];
-    int tE = tS + sz;
-    int qS = oldPsl->qStarts[i];
-    int qE = qS + sz;
-    if (rangeIntersection(tS, tE, tMn, tMx) > 0)
-        {
-	int diff;
-	if ((diff = (tMn - tS)) > 0)
-	    {
-	    tS += diff;
-	    qS += diff;
-	    sz -= diff;
-	    }
-	if ((diff = (tE - tMx)) > 0)
-	    {
-	    tE -= diff;
-	    qE -= diff;
-	    sz -= diff;
-	    }
-	newPsl->qStarts[newBlockCount] = qS;
-	newPsl->tStarts[newBlockCount] = tS;
-	newPsl->blockSizes[newBlockCount] = sz;
-	++newBlockCount;
-	if (sz == oldSz)
-	    ++completeBlockCount;
-	}
-    }
-pslRecalcBounds(newPsl);
-return newPsl;
-}
-
-struct psl *pslTrimToQueryRange(struct psl *oldPsl, int qMin, int qMax)
-/* Return psl trimmed to fit inside qMin/qMax.  Note this does not
- * update the match/misMatch and related fields. */
-{
-int newSize;
-int oldBlockCount = oldPsl->blockCount;
-boolean qIsRc = (oldPsl->strand[0] == '-');
-int newBlockCount = 0, completeBlockCount = 0;
-int i;
-struct psl *newPsl = NULL;
-int qMn = qMin, qMx = qMax;   /* qMin/qMax adjusted for strand. */
-
-/* Deal with case where we're completely trimmed out quickly. */
-newSize = rangeIntersection(oldPsl->qStart, oldPsl->qEnd, qMin, qMax);
-if (newSize <= 0)
-    return NULL;
-
-if (qIsRc)
-    reverseIntRange(&qMn, &qMx, oldPsl->qSize);
-
-/* Count how many blocks will survive trimming. */
-oldBlockCount = oldPsl->blockCount;
-for (i=0; i<oldBlockCount; ++i)
-    {
-    int s = oldPsl->qStarts[i];
-    int e = s + oldPsl->blockSizes[i];
-    int sz = e - s;
-    int overlap;
-    if ((overlap = rangeIntersection(s, e, qMn, qMx)) > 0)
-        ++newBlockCount;
-    if (overlap == sz)
-        ++completeBlockCount;
-    }
-
-if (newBlockCount == 0)
-    return NULL;
-
-/* Allocate new psl and fill in what we already know. */
-AllocVar(newPsl);
-strcpy(newPsl->strand, oldPsl->strand);
-newPsl->qName = cloneString(oldPsl->qName);
-newPsl->qSize = oldPsl->qSize;
-newPsl->tName = cloneString(oldPsl->tName);
-newPsl->tSize = oldPsl->tSize;
-newPsl->blockCount = newBlockCount;
-AllocArray(newPsl->blockSizes, newBlockCount);
-AllocArray(newPsl->qStarts, newBlockCount);
-AllocArray(newPsl->tStarts, newBlockCount);
-
-/* Fill in blockSizes, qStarts, tStarts with real data. */
-newBlockCount = completeBlockCount = 0;
-for (i=0; i<oldBlockCount; ++i)
-    {
-    int oldSz = oldPsl->blockSizes[i];
-    int sz = oldSz;
-    int qS = oldPsl->qStarts[i];
-    int qE = qS + sz;
-    int tS = oldPsl->tStarts[i];
-    int tE = tS + sz;
-    if (rangeIntersection(qS, qE, qMn, qMx) > 0)
-        {
-	int diff;
-	if ((diff = (qMn - qS)) > 0)
-	    {
-	    tS += diff;
-	    qS += diff;
-	    sz -= diff;
-	    }
-	if ((diff = (qE - qMx)) > 0)
-	    {
-	    tE -= diff;
-	    qE -= diff;
-	    sz -= diff;
-	    }
-	newPsl->qStarts[newBlockCount] = qS;
-	newPsl->tStarts[newBlockCount] = tS;
-	newPsl->blockSizes[newBlockCount] = sz;
-	++newBlockCount;
-	if (sz == oldSz)
-	    ++completeBlockCount;
-	}
-    }
-pslRecalcBounds(newPsl);
-return newPsl;
-}
-
-static void printPslDesc(char* pslDesc, FILE* out, struct psl* psl)
-/* print description of a PSL on first error */
-{
-fprintf(out, "Error: invalid PSL: %s:%u-%u %s:%u-%u %s %s\n",
-        psl->qName, psl->qStart, psl->qEnd,
-        psl->tName, psl->tStart, psl->tEnd,
-        psl->strand, pslDesc);
-}
-
-
-static void chkError(char* pslDesc, FILE* out, struct psl* psl, int* errCount, char* format, ...)
-/* forward needed to specify printf signature for gcc checking */
-#if defined(__GNUC__)
-__attribute__((format(printf, 5, 6)))
-#endif
-;
-
-static void chkError(char* pslDesc, FILE* out, struct psl* psl, int* errCount, char* format, ...)
-/* error handling on an pslCheck error, counting error and issuing description
- * of PSL on the first error. */
-{
-if (*errCount == 0)
-    printPslDesc(pslDesc, out, psl);
-va_list args;
-va_start(args, format);
-vfprintf(out, format, args);
-va_end(args);
-(*errCount)++;
-}
-
-static void chkBlkRanges(char* pslDesc, FILE* out, struct psl* psl,
-                         char* pName, char* pLabel, char pCLabel, char pStrand,
-                         unsigned pSize, unsigned pStart, unsigned pEnd,
-                         unsigned iBlk, unsigned* blockSizes,
-                         unsigned* pBlockStarts, int* errCount)
-/* check the target or query ranges in a PSL incrementing errorCnt */
-{
-unsigned blkStart = pBlockStarts[iBlk];
-unsigned blkEnd = blkStart+blockSizes[iBlk];
-/* translate stand to genomic coords */
-unsigned gBlkStart = (pStrand == '+') ? blkStart : (pSize - blkEnd);
-unsigned gBlkEnd = (pStrand == '+') ? blkEnd : (pSize - blkStart);
-
-if ((pSize > 0) && (blkEnd > pSize))
-    chkError(pslDesc, out, psl, errCount,
-             "\t%s %s block %u end %u > %cSize %u\n",
-             pName, pLabel, iBlk, blkEnd, pCLabel, pSize);
-if (gBlkStart < pStart)
-    chkError(pslDesc, out, psl, errCount,
-             "\t%s %s block %u start %u < %cStart %u\n",
-             pName, pLabel, iBlk, gBlkStart, pCLabel, pStart);
-if (gBlkStart >= pEnd)
-    chkError(pslDesc, out, psl, errCount,
-             "\t%s %s block %u start %u >= %cEnd %u\n",
-             pName, pLabel, iBlk, gBlkStart, pCLabel, pEnd);
-if (gBlkEnd < pStart)
-    chkError(pslDesc, out, psl, errCount,
-             "\t%s %s block %u end %u < %cStart %u\n",
-             pName, pLabel, iBlk, gBlkEnd, pCLabel, pStart);
-if (gBlkEnd > pEnd)
-    chkError(pslDesc, out, psl, errCount,
-             "\t%s %s block %u end %u > %cEnd %u\n",
-             pName, pLabel, iBlk, gBlkEnd, pCLabel, pEnd);
-if (iBlk > 0)
-    {
-    unsigned prevBlkEnd = pBlockStarts[iBlk-1]+blockSizes[iBlk-1];
-    if (blkStart < prevBlkEnd)
-        chkError(pslDesc, out, psl, errCount,
-                 "\t%s %s block %u start %u < previous block end %u\n",
-                 pName, pLabel, iBlk, blkStart, prevBlkEnd);
-    }
-}
-
-static void chkRanges(char* pslDesc, FILE* out, struct psl* psl,
-                      char* pName, char* pLabel, char pCLabel, char pStrand,
-                      unsigned pSize, unsigned pStart, unsigned pEnd,
-                      unsigned blockCount, unsigned* blockSizes,
-                      unsigned* pBlockStarts, int blockSizeMult, int* errCount)
-/* check the target or query ranges in a PSL, increment errorCnt */
-{
-unsigned iBlk;
-if (pStart >= pEnd)
-    chkError(pslDesc, out, psl, errCount,
-             "\t%s %cStart %u >= %cEnd %u\n",
-             pName, pCLabel, pStart, pCLabel, pEnd);
-if (pEnd > pSize)
-    chkError(pslDesc, out, psl, errCount,
-             "\t%s %cEnd %u >= %cSize %u\n",
-             pName, pCLabel, pEnd, pCLabel, pSize);
-// check that block start/end matches overall start end
-unsigned pStartStrand = pStart, pEndStrand = pEnd;
-if (pStrand != '+')
-    reverseUnsignedRange(&pStartStrand, &pEndStrand, pSize);
-unsigned lastBlkEnd = pBlockStarts[blockCount-1] + (blockSizeMult * blockSizes[blockCount-1]);
-if ((pStartStrand != pBlockStarts[0]) || (pEndStrand != lastBlkEnd))
-    chkError(pslDesc, out, psl, errCount,
-             "\t%s strand \"%c\" adjusted %cStart-%cEnd range %u-%u != block range %u-%u\n",
-             pName, pStrand, pCLabel, pCLabel, pStartStrand, pEndStrand, pBlockStarts[0], lastBlkEnd);
-
-for (iBlk = 0; iBlk < blockCount; iBlk++)
-    chkBlkRanges(pslDesc, out, psl, pName, pLabel, pCLabel, pStrand,
-                 pSize, pStart, pEnd, iBlk, blockSizes, pBlockStarts, errCount);
-}
-
-int pslCheck(char *pslDesc, FILE* out, struct psl* psl)
-/* Validate a PSL for consistency.  pslDesc is printed the error messages
- * to file out (open /dev/null to discard). Return count of errors. */
-{
-static char* VALID_STRANDS[] = {
-    "+", "-", "++", "+-", "-+", "--", NULL
-};
-int i, errCount = 0;
-int tBlockSizeMult = pslIsProtein(psl) ? 3 : 1;
-
-/* check strand value */
-for (i = 0; VALID_STRANDS[i] != NULL; i++)
-    {
-    if (strcmp(psl->strand, VALID_STRANDS[i]) == 0)
-        break;
-    }
-if (VALID_STRANDS[i] == NULL)
-    chkError(pslDesc, out, psl, &errCount,
-             "\tinvalid PSL strand: \"%s\"\n", psl->strand);
-
-/* check target */
-chkRanges(pslDesc, out, psl, psl->tName, "target", 't', pslTStrand(psl), psl->tSize, psl->tStart, psl->tEnd,
-          psl->blockCount, psl->blockSizes, psl->tStarts, tBlockSizeMult, &errCount);
-
-/* check query */
-chkRanges(pslDesc, out, psl, psl->qName, "query", 'q', pslQStrand(psl), psl->qSize, psl->qStart, psl->qEnd,
-          psl->blockCount, psl->blockSizes, psl->qStarts, 1, &errCount);
-
-return errCount;
-}
-
-struct hash *readPslToBinKeeper(char *sizeFileName, char *pslFileName)
-/* read a list of psls and return results in hash of binKeeper structure for fast query*/
-{
-struct binKeeper *bk; 
-struct psl *psl;
-struct lineFile *sf = lineFileOpen(sizeFileName, TRUE);
-struct lineFile *pf = lineFileOpen(pslFileName , TRUE);
-struct hash *hash = newHash(0);
-char *chromRow[2];
-char *row[21] ;
-
-while (lineFileRow(sf, chromRow))
-    {
-    char *name = chromRow[0];
-    int size = lineFileNeedNum(sf, chromRow, 1);
-
-    if (hashLookup(hash, name) != NULL)
-        warn("Duplicate %s, ignoring all but first\n", name);
-    else
-        {
-        bk = binKeeperNew(0, size);
-        assert(size > 1);
-	hashAdd(hash, name, bk);
-        }
-    }
-while (lineFileNextRow(pf, row, ArraySize(row)))
-    {
-    psl = pslLoad(row);
-    bk = hashMustFindVal(hash, psl->tName);
-    binKeeperAdd(bk, psl->tStart, psl->tEnd, psl);
-    }
-lineFileClose(&pf);
-lineFileClose(&sf);
-return hash;
-}
-
-static boolean isDelChar(char c)
-/* is this a indel character? */
-{
-return (c == '-') || (c == '.') || (c == '=') || (c == '_');
-}
-
-static void trimAlignment(struct psl* psl, char** qStrPtr, char** tStrPtr,
-                          int* aliSizePtr)
-/* remove leading or trailing indels from alignment */
-{
-char* qStr = *qStrPtr;
-char* tStr = *tStrPtr;
-int aliSize = *aliSizePtr;
-
-// skip lending indels
-while ((aliSize > 0) && (isDelChar(*qStr) || isDelChar(*tStr)))
-    {
-    if (!isDelChar(*qStr))
-        psl->qStart++;
-    else if (!isDelChar(*tStr))
-        psl->tStart++;
-    qStr++;
-    tStr++;
-    aliSize--;
-    }
-
-// skip trailing indels
-while ((aliSize > 0) && (isDelChar(qStr[aliSize-1]) || isDelChar(tStr[aliSize-1])))
-    {
-    if (!isDelChar(qStr[aliSize-1]))
-        psl->qEnd--;
-    else if (!isDelChar(tStr[aliSize-1]))
-        psl->tEnd--;
-    aliSize--;
-    }
-*qStrPtr = qStr;
-*tStrPtr = tStr;
-*aliSizePtr = aliSize;
-}
-
-static void addBlock(struct psl* psl, int qs, int qe, int ts, int te,
-                     int *blockSpace)
-/* add a block to the psl, growing if necessary */
-{
-assert((qe-qs) == (te-ts));  /* same lengths? */
-if (psl->blockCount == *blockSpace)
-    pslGrow(psl, blockSpace);
-psl->blockSizes[psl->blockCount] = qe - qs;
-psl->qStarts[psl->blockCount] = qs;
-psl->tStarts[psl->blockCount] = ts;
-psl->blockCount++;
-}
-
-static void accumCounts(struct psl *psl, char prevQ, char prevT,
-                        char q, char t, unsigned options)
-/* accumulate block and base counts  */
-{
-if (!isDelChar(q) && !isDelChar(t))
-    {
-    /* aligned column. */
-    char qu = toupper(q);
-    char tu = toupper(t);
-    if ((q == 'N') || (t == 'N'))
-        psl->nCount++;
-    else if (qu == tu)
-        {
-        if ((options & PSL_IS_SOFTMASK) && ((qu != q) || (tu != t)))
-            psl->repMatch++;
-        else
-            psl->match++;
-        }
-    else
-        psl->misMatch++;
-    }
-else if (isDelChar(q) && !isDelChar(t))
-    {
-    /* target insert */
-    psl->tBaseInsert++;
-    if (!isDelChar(prevQ))
-        psl->tNumInsert++;
-    }
-else if (isDelChar(t) && !isDelChar(q))
-    {
-    /* query insert */
-    psl->qBaseInsert++;
-    if (!isDelChar(prevT))
-        psl->qNumInsert++;
-    }
-}
-
-struct psl* pslFromAlign(char *qName, int qSize, int qStart, int qEnd, char *qString,
-                         char *tName, int tSize, int tStart, int tEnd, char *tString,
-                         char* strand, unsigned options)
-/* Create a PSL from an alignment.  Options PSL_IS_SOFTMASK if lower case
- * bases indicate repeat masking.  Returns NULL if alignment is empty after
- * triming leading and trailing indels.*/
-{
-/* Note, the unit tests for these programs exercise this function:
- *   hg/embossToPsl
- *   hg/mouseStuff/axtToPsl
- *   hg/spideyToPsl
- *   utils/est2genomeToPsl
- */
-
-int blockSpace = 16;
-struct psl* psl = NULL;
-int aliSize = strlen(qString);
-boolean eitherInsert = FALSE;	/* True if either in insert state. */
-int i, qs,qe,ts,te;
-char prevQ = '\0',  prevT = '\0';
-AllocVar(psl);
-
-if (strlen(tString) != aliSize)
-    errAbort("query and target alignment strings are different lengths");
-
-psl = pslNew(qName, qSize, qStart, qEnd, tName, tSize, tStart, tEnd,
-             strand, blockSpace, 0);
-trimAlignment(psl, &qString, &tString, &aliSize);
-
-/* Don't create if either query or target is zero length after trim */
- if ((psl->qStart == psl->qEnd) || (psl->tStart == psl->tEnd))
-     {
-     pslFree(&psl);
-     return NULL;
-     }
-
-/* Get range of alignment in strand-specified coordinates */
-qs = psl->qStart;
-qe = psl->qEnd;
-if (strand[0] == '-')
-    reverseIntRange(&qs, &qe, psl->qSize);
-ts = psl->tStart;
-te = psl->tEnd;
-if (strand[1] == '-')
-    reverseIntRange(&ts, &te, psl->tSize);
-
-eitherInsert = FALSE;
-qe = qs;  /* current block coords */
-te = ts;
-for (i=0; i<aliSize; ++i)
-    {
-    char q = qString[i];
-    char t = tString[i];
-    if (isDelChar(q) && isDelChar(t))
-        {
-        continue; /* nothing in this column, just ignore it */
-        }
-    else if (isDelChar(q) || isDelChar(t))
-        {
-        /* insert in one of the columns */
-	if (!eitherInsert)
-	    {
-            /* end of a block */
-            addBlock(psl, qs, qe, ts, te, &blockSpace);
-	    eitherInsert = TRUE;
-	    }
-	if (!isDelChar(q))
-            qe += 1;
-	if (!isDelChar(t))
-            te += 1;
-	}
-    else
-        {
-        /* columns aligned */
-	if (eitherInsert)
-	    {
-            /* start new block */
-	    qs = qe;
-	    ts = te;
-	    eitherInsert = FALSE;
-	    }
-	qe += 1;
-	te += 1;
-	}
-    accumCounts(psl, prevQ, prevT, q, t, options);
-    prevQ = q; /* will not include skipped empty columns */
-    prevT = t;
-    }
-addBlock(psl, qs, qe, ts, te, &blockSpace);
-return psl;
-}
-
-struct psl* pslNew(char *qName, unsigned qSize, int qStart, int qEnd,
-                   char *tName, unsigned tSize, int tStart, int tEnd,
-                   char *strand, unsigned blockSpace, unsigned opts)
-/* create a new psl with space for the specified number of blocks allocated.
- * pslGrow maybe used to expand this space if needed.  Valid options are
- * PSL_XA_FORMAT. */
-{
-struct psl *psl;
-AllocVar(psl);
-assert(blockSpace > 0);
-psl->qName = cloneString(qName);
-psl->qSize = qSize;
-psl->qStart = qStart;
-psl->qEnd = qEnd;
-psl->tName = cloneString(tName);
-psl->tSize = tSize;
-psl->tStart = tStart;
-psl->tEnd = tEnd;
-strncpy(psl->strand, strand, 2);
-AllocArray(psl->blockSizes, blockSpace);
-AllocArray(psl->qStarts, blockSpace);
-AllocArray(psl->tStarts, blockSpace);
-if (opts & PSL_XA_FORMAT)
-    {
-    AllocArray(psl->qSequence, blockSpace);
-    AllocArray(psl->tSequence, blockSpace);
-    }
-return psl;
-}
-
-void pslGrow(struct psl *psl, int *blockSpacePtr)
-/* Increase memory allocated to a psl to hold more blocks.  blockSpacePtr
- * should point the the current maximum number of blocks and will be
- * updated to with the new amount of space. */
-{
-int blockSpace = *blockSpacePtr;
-int newSpace = 2 * blockSpace;
-ExpandArray(psl->blockSizes, blockSpace, newSpace);
-ExpandArray(psl->qStarts, blockSpace, newSpace);
-ExpandArray(psl->tStarts, blockSpace, newSpace);
-if (psl->qSequence != NULL)
-    {
-    ExpandArray(psl->qSequence, blockSpace, newSpace);
-    ExpandArray(psl->tSequence, blockSpace, newSpace);
-    }
-*blockSpacePtr = newSpace;
-}
-
-static boolean getNextCigarOp(char *startPtr, boolean reverse, char **ptr, char *op, int *size)
-/* gets one cigar op out of the CIGAR string.  Reverse the order if asked */
-{
-char *str = *ptr;
-
-if (str == NULL)
-    return FALSE;
-
-if ((!reverse && (*str == 0)) || (reverse && (str == startPtr)))
-    return FALSE;
-
-// between each cigar op there could be nothing, or a space, or a plus
-if (reverse)
-    {
-    char *end = str - 1;
-    for(;*end ; end--)
-	{
-	if (isalpha(*end))
-	    break;
-	}
-    str = end;
-    *ptr = end;
-    }
-else
-    {
-    char *end = str + 1;
-    for(;*end ; end++)
-	{
-	if (! (isdigit(*end)  || (*end == ' ') || (*end == '+')))
-	    break;
-	}
-
-    *ptr = end;
-    }
-
-*op = *str++;
-*size = atoi(str);
-
-return TRUE;
-}
-
-struct psl* pslFromGff3Cigar(char *qName, int qSize, int qStart, int qEnd,
-                             char *tName, int tSize, int tStart, int tEnd,
-                             char* strand, char *cigar)
-/* create a PSL from a GFF3-style cigar formatted alignment */
-{
-// this is currently tested by the gff3ToPsl
-int blocksAlloced = 4;
-struct psl *psl = pslNew(qName, qSize, qStart, qEnd, tName, tSize, tStart, tEnd, strand, blocksAlloced, 0);
-
-char op;
-int size;
-int qNext = qStart, qBlkEnd = qEnd;
-int totalSize = 0;
-
-if (strand[0] == '-')
-    reverseIntRange(&qNext, &qBlkEnd, qSize);
-int tNext = tStart, tBlkEnd = tEnd;
-if (strand[1] == '-')
-    reverseIntRange(&tNext, &tBlkEnd, tSize);
-
-if (cigar == NULL)
-    {
-    // no cigar means one block
-    size = qEnd - qStart;
-    totalSize += size;
-    psl->blockSizes[psl->blockCount] = size;
-    psl->qStarts[psl->blockCount] = qNext;
-    psl->tStarts[psl->blockCount] = tNext;
-    psl->blockCount++;
-    tNext += size;
-    qNext += size;
-    }
-else
-    {
-    char cigarSpec[strlen(cigar+1)];  // copy since parsing is destructive
-    strcpy(cigarSpec, cigar);
-    char *cigarNext = cigarSpec;
-    if (strand[0] == '-')
-	for(; *cigarNext; cigarNext++)
-	    ;
-    while(getNextCigarOp(cigarSpec, (strand[0] == '-'), &cigarNext, &op, &size))
-	{
-	switch (op)
-	    {
-	    case 'M': // match or mismatch (gapless aligned block)
-		if (psl->blockCount == blocksAlloced)
-		    pslGrow(psl, &blocksAlloced);
-
-		totalSize += size;
-		psl->blockSizes[psl->blockCount] = size;
-		psl->qStarts[psl->blockCount] = qNext;
-		psl->tStarts[psl->blockCount] = tNext;
-		psl->blockCount++;
-		tNext += size;
-		qNext += size;
-		break;
-	    case 'I': // inserted in target
-		tNext += size;
-		break;
-	    case 'D': // deleted from target
-		qNext += size;
-		break;
-	    
-	    default:
-		errAbort("unrecognized CIGAR op %c in %s", op, cigar);
-	    }
-	}
-    }
-assert(qNext == qBlkEnd);
-assert(tNext == tBlkEnd);
-psl->match = totalSize;
-return psl;
-}
-
-int pslRangeTreeOverlap(struct psl *psl, struct rbTree *rangeTree)
-/* Return amount that psl overlaps (on target side) with rangeTree. */
-{
-int i;
-int overlap = 0;
-boolean isRc = (psl->strand[1] == '-');
-for (i=0; i<psl->blockCount; ++i)
-    {
-    int start = psl->tStarts[i];
-    int end = start + psl->blockSizes[i];
-    if (isRc)
-        reverseIntRange(&start, &end, psl->tSize);
-    overlap += rangeTreeOverlapSize(rangeTree, start, end);
-    }
-return overlap;
-}
-
-float pslIdent(struct psl *psl)
-/* computer fraction identity */
-{
-float aligned = psl->match + psl->misMatch + psl->repMatch;
-if (aligned == 0.0)
-    return 0.0;
-else
-    return ((float)(psl->match + psl->repMatch))/aligned;
-}
-
-float pslQueryAligned(struct psl *psl)
-/* compute fraction of query that was aligned */
-{
-float aligned = psl->match + psl->misMatch + psl->repMatch;
-return aligned/(float)psl->qSize;
-}
-
diff --git a/gbtools/src/blatSrc/lib/psl.sql b/gbtools/src/blatSrc/lib/psl.sql
deleted file mode 100644
index 8a1698a..0000000
--- a/gbtools/src/blatSrc/lib/psl.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-# as_psl.sql was originally generated by the autoSql program, which also 
-# generated as_psl.c and as_psl.h.  This creates the database representation of
-# an object which can be loaded and saved from RAM in a fairly 
-# automatic way.
-
-#Summary info about a patSpace alignment
-CREATE TABLE psl (
-    matches int unsigned not null,	# Number of bases that match that aren't repeats
-    misMatches int unsigned not null,	# Number of bases that don't match
-    repMatches int unsigned not null,	# Number of bases that match but are part of repeats
-    nCount int unsigned not null,	# Number of 'N' bases
-    qNumInsert int unsigned not null,	# Number of inserts in query
-    qBaseInsert int unsigned not null,	# Number of bases inserted in query
-    tNumInsert int unsigned not null,	# Number of inserts in target
-    tBaseInsert int unsigned not null,	# Number of bases inserted in target
-    strand char(2) not null,	# + or - for strand
-    qName varchar(255) not null,	# Query sequence name
-    qSize int unsigned not null,	# Query sequence size
-    qStart int unsigned not null,	# Alignment start position in query
-    qEnd int unsigned not null,	# Alignment end position in query
-    tName varchar(255) not null,	# Target sequence name
-    tSize int unsigned not null,	# Target sequence size
-    tStart int unsigned not null,	# Alignment start position in target
-    tEnd int unsigned not null,	# Alignment end position in target
-    blockCount int unsigned not null,	# Number of blocks in alignment
-    blockSizes longblob not null,	# Size of each block
-    qStarts longblob not null,	# Start of each block in query.
-    tStarts longblob not null,	# Start of each block in target.
-              #Indices
-    INDEX(tStart),
-    INDEX(qName(12)),
-    INDEX(tEnd)
-);
diff --git a/gbtools/src/blatSrc/lib/pslGenoShow.c b/gbtools/src/blatSrc/lib/pslGenoShow.c
deleted file mode 100644
index 2e3e46d..0000000
--- a/gbtools/src/blatSrc/lib/pslGenoShow.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/* Show aligned exons between a pre-located gene (a stamper gene) in the genome 
- *and its homologues (stamp elements) in the genome. 
- *The aligned exon sequences are shown in blue as regular blat alignment. 
- * The unaligned exon sequence are shown in red. Intron sequences are shown in black.
- * It is modified from pslShow.c */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-
-#include "common.h"
-#include "dnaseq.h"
-#include "htmshell.h"
-#include "psl.h"
-#include "cda.h"
-#include "seqOut.h"
-
-
-static void pslShowAlignmentStranded2(struct psl *psl, boolean isProt,
-	char *qName, bioSeq *qSeq, int qStart, int qEnd,
-	char *tName, bioSeq *tSeq, int tStart, int tEnd, int exnStarts[], int exnEnds[], int exnCnt, FILE *f)
-/* Show stamper gene and stamp elements alignment using genomic sequence.
- * The aligned exons' sequence of stamper gene are shown in colors as usual, but the
- * the unaligned exon's sequence of stamper gene are shown in red color.
- */
-{
-boolean tIsRc = (psl->strand[1] == '-');
-boolean qIsRc = (psl->strand[0] == '-');
-int mulFactor = (isProt ? 3 : 1);
-DNA *dna = NULL;	/* Mixed case version of genomic DNA. */
-int qSize = qSeq->size;
-char *qLetters = cloneString(qSeq->dna);
-int qbafStart, qbafEnd, tbafStart, tbafEnd;
-int qcfmStart, qcfmEnd, tcfmStart, tcfmEnd;
-
-int lineWidth = isProt ? 60 : 50;
-
-tbafStart = tStart;
-tbafEnd   = tEnd;
-tcfmStart = tStart;
-tcfmEnd   = tEnd;
-
-qbafStart = qStart;
-qbafEnd   = qEnd;
-qcfmStart = qStart;
-qcfmEnd   = qEnd;
-
-/* Deal with minus strand. */
-if (tIsRc)
-    {
-    int temp;
-    reverseComplement(tSeq->dna, tSeq->size);
-
-    tbafStart = tEnd;
-    tbafEnd   = tStart;
-    tcfmStart = tEnd;
-    tcfmEnd   = tStart;
-    
-    temp = psl->tSize - tEnd;
-    tEnd = psl->tSize - tStart;
-    tStart = temp;
-    }
-if (qIsRc)
-    {
-    int temp, j;
-    reverseComplement(qSeq->dna, qSeq->size);
-    reverseComplement(qLetters, qSeq->size);
-
-    qcfmStart = qEnd;
-    qcfmEnd   = qStart;
-    qbafStart = qEnd;
-    qbafEnd   = qStart;
-    
-    temp = psl->qSize - qEnd;
-    qEnd = psl->qSize - qStart;
-    qStart = temp;
-    for(j = 0; j < exnCnt; j++)
-	{
-	temp = psl->qSize - exnStarts[j];
-	exnStarts[j] = psl->qSize - exnEnds[j];
-	exnEnds[j] = temp;
-	}
-    reverseInts(exnEnds, exnCnt);
-    reverseInts(exnStarts, exnCnt);
-    }
-
-dna = cloneString(tSeq->dna);
-
-if (qName == NULL) 
-    qName = psl->qName;
-if (tName == NULL)
-    tName = psl->tName;
-
-
-fputs("Matching bases are colored blue and capitalized. " 
-      "Light blue bases mark the boundaries of gaps in either aligned sequence. "
-      "Red bases are unaligned exons' bases of the query gene. \n", f);
-
-fprintf(f, "<H4><A NAME=cDNA></A>%s%s</H4>\n", qName, (qIsRc  ? " (reverse complemented)" : ""));
-fprintf(f, "<PRE><TT>");
-tolowers(qLetters);
-
-/* Display query sequence. */
-    {
-    struct cfm *cfm;
-    char *colorFlags = needMem(qSeq->size);
-    int i = 0, j = 0, exnIdx = 0;
-    int preStop = 0;
-    
-    for (i=0; i<psl->blockCount; ++i)
-	{
-	int qs = psl->qStarts[i] - qStart;
-	int ts = psl->tStarts[i] - tStart;
-	int sz = psl->blockSizes[i]-1;
-	int end = 0;
-	bool omitExon = FALSE;
-	while(exnIdx < exnCnt && psl->qStarts[i] > exnEnds[exnIdx])
-	    {
-	    if(omitExon)
-		{
-		for( j = exnStarts[exnIdx] - qStart; j < exnEnds[exnIdx]-qStart; j++)
-		    {
-		    colorFlags[j] = socRed;
-		    }
-		}
-	    exnIdx++;
-	    preStop = exnStarts[exnIdx] - qStart;
-	    omitExon = TRUE;
-	    }
-
-	/*mark the boundary bases */
-	colorFlags[qs] = socBrightBlue;
-	qLetters[qs] = toupper(qLetters[qs]);
-	colorFlags[qs+sz] = socBrightBlue;
-	qLetters[qs+sz] = toupper(qLetters[qs+sz]);
-	
-	/* determine block end */
-	if( i < psl->blockCount -1)
-	    end = psl->qStarts[i+1] < exnEnds[exnIdx] ? psl->qStarts[i+1] - qStart : exnEnds[exnIdx] - qStart;
-	else
-	    end = qs + sz;
-	    
-	for (j=preStop; j < end; j++)
-	    {
-	    if(j == 82)
-		fprintf(stderr, "right here\n");
-	    if (j > qs && j < qs+sz)
-		{
-		if (qSeq->dna[j] == tSeq->dna[ts+j-qs])
-		    {
-		    colorFlags[j] = socBlue;
-		    qLetters[j] = toupper(qLetters[j]);
-		    }		
-		}
-	    else if(colorFlags[j] != socBrightBlue && colorFlags[j] != socBlue)
-		colorFlags[j] = socRed;
-	    }
-	preStop = end;
-	}
-    cfm = cfmNew(10, lineWidth, TRUE, qIsRc, f, qcfmStart);
-    for (i=0; i<qSize; ++i)
-	cfmOut(cfm, qLetters[i], seqOutColorLookup[(int)colorFlags[i]]);
-    cfmFree(&cfm);
-    freez(&colorFlags);
-    htmHorizontalLine(f);
-    }
-fprintf(f, "</TT></PRE>\n");
-fprintf(f, "<H4><A NAME=genomic></A>%s %s:</H4>\n", 
-	tName, (tIsRc ? "(reverse strand)" : ""));
-fprintf(f, "<PRE><TT>");
-
-/* Display DNA sequence. */
-    {
-    struct cfm *cfm;
-    char *colorFlags = needMem(tSeq->size);
-    int i,j;
-    int curBlock = 0;
-
-    for (i=0; i<psl->blockCount; ++i)
-	{
-	int qs = psl->qStarts[i] - qStart;
-	int ts = psl->tStarts[i] - tStart;
-	int sz = psl->blockSizes[i];
-	if (isProt)
-	    {
-	    for (j=0; j<sz; ++j)
-		{
-		AA aa = qSeq->dna[qs+j];
-		int codonStart = ts + 3*j;
-		DNA *codon = &tSeq->dna[codonStart];
-		AA trans = lookupCodon(codon);
-		if (trans != 'X' && trans == aa)
-		    {
-		    colorFlags[codonStart] = socBlue;
-		    colorFlags[codonStart+1] = socBlue;
-		    colorFlags[codonStart+2] = socBlue;
-		    toUpperN(dna+codonStart, 3);
-		    }
-		}
-	    }
-	else
-	    {
-	    for (j=0; j<sz; ++j)
-		{
-		if (qSeq->dna[qs+j] == tSeq->dna[ts+j])
-		    {
-		    colorFlags[ts+j] = socBlue;
-		    dna[ts+j] = toupper(dna[ts+j]);
-		    }
-		}
-	    }
-	colorFlags[ts] = socBrightBlue;
-	colorFlags[ts+sz*mulFactor-1] = socBrightBlue;
-	}
-
-    cfm = cfmNew(10, lineWidth, TRUE, tIsRc, f, tcfmStart);
-	
-    for (i=0; i<tSeq->size; ++i)
-	{
-	/* Put down "anchor" on first match position in haystack
-	 * so user can hop here with a click on the needle. */
-	if (curBlock < psl->blockCount && psl->tStarts[curBlock] == (i + tStart) )
-	    {
-	    fprintf(f, "<A NAME=%d></A>", ++curBlock);
-	    /* Watch out for (rare) out-of-order tStarts! */
-	    while (curBlock < psl->blockCount &&
-		   psl->tStarts[curBlock] <= tStart + i)
-		curBlock++;
-	    }
-	cfmOut(cfm, dna[i], seqOutColorLookup[(int)colorFlags[i]]);
-	}
-    cfmFree(&cfm);
-    freez(&colorFlags);
-    htmHorizontalLine(f);
-    }
-
-/* Display side by side. */
-fprintf(f, "</TT></PRE>\n");
-fprintf(f, "<H4><A NAME=ali></A>Side by Side Alignment*</H4>\n");
-fprintf(f, "<PRE><TT>");
-    {
-    struct baf baf;
-    int i,j;
-
-    bafInit(&baf, qSeq->dna, qbafStart, qIsRc,
-	    tSeq->dna, tbafStart, tIsRc, f, lineWidth, isProt);
-		
-    if (isProt)
-	{
-	for (i=0; i<psl->blockCount; ++i)
-	    {
-	    int qs = psl->qStarts[i] - qStart;
-	    int ts = psl->tStarts[i] - tStart;
-	    int sz = psl->blockSizes[i];
-
-	    bafSetPos(&baf, qs, ts);
-	    bafStartLine(&baf);
-	    for (j=0; j<sz; ++j)
-		{
-		AA aa = qSeq->dna[qs+j];
-		int codonStart = ts + 3*j;
-		DNA *codon = &tSeq->dna[codonStart];
-		bafOut(&baf, ' ', codon[0]);
-		bafOut(&baf, aa, codon[1]);
-		bafOut(&baf, ' ', codon[2]);
-		}
-	    bafFlushLine(&baf);
-	    }
-	fprintf( f, "<I>*when aa is different, BLOSUM positives are in green, BLOSUM negatives in red</I>\n");
-	}
-    else
-	{
-	int lastQe = psl->qStarts[0] - qStart;
-	int lastTe = psl->tStarts[0] - tStart;
-	int maxSkip = 8;
-	bafSetPos(&baf, lastQe, lastTe);
-	bafStartLine(&baf);
-	for (i=0; i<psl->blockCount; ++i)
-	    {
-	    int qs = psl->qStarts[i] - qStart;
-	    int ts = psl->tStarts[i] - tStart;
-	    int sz = psl->blockSizes[i];
-	    boolean doBreak = TRUE;
-	    int qSkip = qs - lastQe;
-	    int tSkip = ts - lastTe;
-
-	    if (qSkip >= 0 && qSkip <= maxSkip && tSkip == 0)
-		{
-		for (j=0; j<qSkip; ++j)
-		    bafOut(&baf, qSeq->dna[lastQe+j], '-');
-		doBreak = FALSE;
-		}
-	    else if (tSkip > 0 && tSkip <= maxSkip && qSkip == 0)
-		{
-		for (j=0; j<tSkip; ++j)
-		    bafOut(&baf, '-', tSeq->dna[lastTe+j]);
-		doBreak = FALSE;
-		}
-	    if (doBreak)
-		{
-		bafFlushLine(&baf);
-		bafSetPos(&baf, qs, ts);
-		bafStartLine(&baf);
-		}
-	    for (j=0; j<sz; ++j)
-		bafOut(&baf, qSeq->dna[qs+j], tSeq->dna[ts+j]);
-	    lastQe = qs + sz;
-	    lastTe = ts + sz;
-	    }
-	bafFlushLine(&baf);
-
-	fprintf( f, "<I>*Aligned Blocks with gaps <= %d bases are merged for this display</I>\n", maxSkip);
-	}
-    }
-fprintf(f, "</TT></PRE>");
-if (qIsRc)
-    reverseComplement(qSeq->dna, qSeq->size);
-if (tIsRc)
-    reverseComplement(tSeq->dna, tSeq->size);
-freeMem(dna);
-freeMem(qLetters);
-}
-
-
-int pslGenoShowAlignment(struct psl *psl, boolean isProt,
-	char *qName, bioSeq *qSeq, int qStart, int qEnd,
-	char *tName, bioSeq *tSeq, int tStart, int tEnd, int exnStarts[], int exnEnds[], int exnCnt, FILE *f)
-/* Show aligned exons between a pre-located gene (a stamper gene)and its homologues (stamp elements)
- * in the genome. The aligned exon sequences are shown in blue as regular blat alignment. * The unaligned exon sequence are shown in red. Intron sequences are shown in black */
-{
-/* At this step we just do a little shuffling of the strands for
- * untranslated DNA alignments. */
-char origStrand[2];
-boolean needsSwap = (psl->strand[0] == '-' && psl->strand[1] == 0);
-if (needsSwap)
-    {
-    memcpy(origStrand, psl->strand, 2);
-    pslRc(psl);
-    }
-pslShowAlignmentStranded2(psl, isProt, qName, qSeq, qStart, qEnd,
-    tName, tSeq, tStart, tEnd,exnStarts, exnEnds, exnCnt, f);
-if (needsSwap)
-    {
-    pslRc(psl);
-    memcpy(psl->strand, origStrand, 2);
-    }
-return psl->blockCount;
-}
-
diff --git a/gbtools/src/blatSrc/lib/pslShow.c b/gbtools/src/blatSrc/lib/pslShow.c
deleted file mode 100644
index c827e9a..0000000
--- a/gbtools/src/blatSrc/lib/pslShow.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/* pslShow - stuff to help visual psl format alignments. 
- * This file is copyright 2002-2004 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "dnaseq.h"
-#include "htmshell.h"
-#include "psl.h"
-#include "cda.h"
-#include "seqOut.h"
-
-
-static void pslShowAlignmentStranded(struct psl *psl, boolean isProt,
-	char *qName, bioSeq *qSeq, int qStart, int qEnd,
-	char *tName, bioSeq *tSeq, int tStart, int tEnd, FILE *f)
-/* Show protein/DNA alignment or translated DNA alignment in HTML format. */
-{
-boolean tIsRc = (psl->strand[1] == '-');
-boolean qIsRc = (psl->strand[0] == '-');
-int mulFactor = (isProt ? 3 : 1);
-DNA *dna = NULL;	/* Mixed case version of genomic DNA. */
-int qSize = qSeq->size;
-char *qLetters = cloneString(qSeq->dna);
-int qbafStart, qbafEnd, tbafStart, tbafEnd;
-int qcfmStart, qcfmEnd, tcfmStart, tcfmEnd;
-
-int lineWidth = isProt ? 60 : 50;
-
-tbafStart = tStart;
-tbafEnd   = tEnd;
-tcfmStart = tStart;
-tcfmEnd   = tEnd;
-
-qbafStart = qStart;
-qbafEnd   = qEnd;
-qcfmStart = qStart;
-qcfmEnd   = qEnd;
-
-/* Deal with minus strand. */
-if (tIsRc)
-    {
-    int temp;
-    reverseComplement(tSeq->dna, tSeq->size);
-
-    tbafStart = tEnd;
-    tbafEnd   = tStart;
-    tcfmStart = tEnd;
-    tcfmEnd   = tStart;
-
-    temp = psl->tSize - tEnd;
-    tEnd = psl->tSize - tStart;
-    tStart = temp;
-    }
-if (qIsRc)
-    {
-    int temp;
-    reverseComplement(qSeq->dna, qSeq->size);
-    reverseComplement(qLetters, qSeq->size);
-
-    qcfmStart = qEnd;
-    qcfmEnd   = qStart;
-    qbafStart = qEnd;
-    qbafEnd   = qStart;
-    
-    temp = psl->qSize - qEnd;
-    qEnd = psl->qSize - qStart;
-    qStart = temp;
-    }
-dna = cloneString(tSeq->dna);
-
-if (qName == NULL) 
-    qName = psl->qName;
-if (tName == NULL)
-    tName = psl->tName;
-
-
-fputs("Matching bases are colored blue and capitalized. " 
-      "Light blue bases mark the boundaries of gaps in either sequence.\n", f);
-
-fprintf(f, "<H4><A NAME=cDNA></A>%s%s</H4>\n", qName, (qIsRc  ? " (reverse complemented)" : ""));
-fprintf(f, "<PRE><TT>");
-tolowers(qLetters);
-
-/* Display query sequence. */
-    {
-    struct cfm *cfm;
-    char *colorFlags = needMem(qSeq->size);
-    int i,j;
-
-    for (i=0; i<psl->blockCount; ++i)
-	{
-	int qs = psl->qStarts[i] - qStart;
-	int ts = psl->tStarts[i] - tStart;
-	int sz = psl->blockSizes[i]-1;
-	colorFlags[qs] = socBrightBlue;
-	qLetters[qs] = toupper(qLetters[qs]);
-	colorFlags[qs+sz] = socBrightBlue;
-	qLetters[qs+sz] = toupper(qLetters[qs+sz]);
-	if (isProt)
-	    {
-	    for (j=1; j<sz; ++j)
-		{
-		AA aa = qSeq->dna[qs+j];
-		DNA *codon = &tSeq->dna[ts + 3*j];
-		AA trans = lookupCodon(codon);
-		if (trans != 'X' && trans == aa)
-		    {
-		    colorFlags[qs+j] = socBlue;
-		    qLetters[qs+j] = toupper(qLetters[qs+j]);
-		    }
-		}
-	    }
-	else
-	    {
-	    for (j=1; j<sz; ++j)
-		{
-		if (qSeq->dna[qs+j] == tSeq->dna[ts+j])
-		    {
-		    colorFlags[qs+j] = socBlue;
-		    qLetters[qs+j] = toupper(qLetters[qs+j]);
-		    }
-		}
-	    }
-	}
-    cfm = cfmNew(10, lineWidth, TRUE, qIsRc, f, qcfmStart);
-    for (i=0; i<qSize; ++i)
-	cfmOut(cfm, qLetters[i], seqOutColorLookup[(int)colorFlags[i]]);
-    cfmFree(&cfm);
-    freez(&colorFlags);
-    htmHorizontalLine(f);
-    }
-fprintf(f, "</TT></PRE>\n");
-fprintf(f, "<H4><A NAME=genomic></A>%s %s:</H4>\n", 
-	tName, (tIsRc ? "(reverse strand)" : ""));
-fprintf(f, "<PRE><TT>");
-
-/* Display DNA sequence. */
-    {
-    struct cfm *cfm;
-    char *colorFlags = needMem(tSeq->size);
-    int i,j;
-    int curBlock = 0;
-
-    for (i=0; i<psl->blockCount; ++i)
-	{
-	int qs = psl->qStarts[i] - qStart;
-	int ts = psl->tStarts[i] - tStart;
-	int sz = psl->blockSizes[i];
-	if (isProt)
-	    {
-	    for (j=0; j<sz; ++j)
-		{
-		AA aa = qSeq->dna[qs+j];
-		int codonStart = ts + 3*j;
-		DNA *codon = &tSeq->dna[codonStart];
-		AA trans = lookupCodon(codon);
-		if (trans != 'X' && trans == aa)
-		    {
-		    colorFlags[codonStart] = socBlue;
-		    colorFlags[codonStart+1] = socBlue;
-		    colorFlags[codonStart+2] = socBlue;
-		    toUpperN(dna+codonStart, 3);
-		    }
-		}
-	    }
-	else
-	    {
-	    for (j=0; j<sz; ++j)
-		{
-		if (qSeq->dna[qs+j] == tSeq->dna[ts+j])
-		    {
-		    colorFlags[ts+j] = socBlue;
-		    dna[ts+j] = toupper(dna[ts+j]);
-		    }
-		}
-	    }
-	colorFlags[ts] = socBrightBlue;
-	colorFlags[ts+sz*mulFactor-1] = socBrightBlue;
-	}
-
-    cfm = cfmNew(10, lineWidth, TRUE, tIsRc, f, tcfmStart);
-	
-    for (i=0; i<tSeq->size; ++i)
-	{
-	/* Put down "anchor" on first match position in haystack
-	 * so user can hop here with a click on the needle. */
-	if (curBlock < psl->blockCount && psl->tStarts[curBlock] == (i + tStart) )
-	    {
-	    fprintf(f, "<A NAME=%d></A>", ++curBlock);
-	    /* Watch out for (rare) out-of-order tStarts! */
-	    while (curBlock < psl->blockCount &&
-		   psl->tStarts[curBlock] <= tStart + i)
-		curBlock++;
-	    }
-	cfmOut(cfm, dna[i], seqOutColorLookup[(int)colorFlags[i]]);
-	}
-    cfmFree(&cfm);
-    freez(&colorFlags);
-    htmHorizontalLine(f);
-    }
-
-/* Display side by side. */
-fprintf(f, "</TT></PRE>\n");
-fprintf(f, "<H4><A NAME=ali></A>Side by Side Alignment*</H4>\n");
-fprintf(f, "<PRE><TT>");
-    {
-    struct baf baf;
-    int i,j;
-
-    bafInit(&baf, qSeq->dna, qbafStart, qIsRc,
-	    tSeq->dna, tbafStart, tIsRc, f, lineWidth, isProt);
-		
-    if (isProt)
-	{
-	for (i=0; i<psl->blockCount; ++i)
-	    {
-	    int qs = psl->qStarts[i] - qStart;
-	    int ts = psl->tStarts[i] - tStart;
-	    int sz = psl->blockSizes[i];
-
-	    bafSetPos(&baf, qs, ts);
-	    bafStartLine(&baf);
-	    for (j=0; j<sz; ++j)
-		{
-		AA aa = qSeq->dna[qs+j];
-		int codonStart = ts + 3*j;
-		DNA *codon = &tSeq->dna[codonStart];
-		bafOut(&baf, ' ', codon[0]);
-		bafOut(&baf, aa, codon[1]);
-		bafOut(&baf, ' ', codon[2]);
-		}
-	    bafFlushLine(&baf);
-	    }
-	fprintf( f, 
-"<I>*When the translated amino acid in the genomic sequence differs from the \n"
-"corresponding amino acid in the protein, the coloring indicates the\n"
-"similarity of the two amino acids.  Similar amino acids are green, \n"
-"dissimilar amino acids are red.  The sign of the corresponding entry in\n"
-"the BLOSUM 62 matrix is used as the basis of this coloring.</I>\n");
-	}
-    else
-	{
-	int lastQe = psl->qStarts[0] - qStart;
-	int lastTe = psl->tStarts[0] - tStart;
-	int maxSkip = 8;
-	bafSetPos(&baf, lastQe, lastTe);
-	bafStartLine(&baf);
-	for (i=0; i<psl->blockCount; ++i)
-	    {
-	    int qs = psl->qStarts[i] - qStart;
-	    int ts = psl->tStarts[i] - tStart;
-	    int sz = psl->blockSizes[i];
-	    boolean doBreak = TRUE;
-	    int qSkip = qs - lastQe;
-	    int tSkip = ts - lastTe;
-
-	    if (qSkip >= 0 && qSkip <= maxSkip && tSkip == 0)
-		{
-		for (j=0; j<qSkip; ++j)
-		    bafOut(&baf, qSeq->dna[lastQe+j], '-');
-		doBreak = FALSE;
-		}
-	    else if (tSkip > 0 && tSkip <= maxSkip && qSkip == 0)
-		{
-		for (j=0; j<tSkip; ++j)
-		    bafOut(&baf, '-', tSeq->dna[lastTe+j]);
-		doBreak = FALSE;
-		}
-	    if (doBreak)
-		{
-		bafFlushLine(&baf);
-		bafSetPos(&baf, qs, ts);
-		bafStartLine(&baf);
-		}
-	    for (j=0; j<sz; ++j)
-		bafOut(&baf, qSeq->dna[qs+j], tSeq->dna[ts+j]);
-	    lastQe = qs + sz;
-	    lastTe = ts + sz;
-	    }
-	bafFlushLine(&baf);
-
-	fprintf( f, "<I>*Aligned Blocks with gaps <= %d bases are merged for this display</I>\n", maxSkip);
-	}
-    }
-fprintf(f, "</TT></PRE>");
-if (qIsRc)
-    reverseComplement(qSeq->dna, qSeq->size);
-if (tIsRc)
-    reverseComplement(tSeq->dna, tSeq->size);
-freeMem(dna);
-freeMem(qLetters);
-}
-
-int pslShowAlignment(struct psl *psl, boolean isProt,
-	char *qName, bioSeq *qSeq, int qStart, int qEnd,
-	char *tName, bioSeq *tSeq, int tStart, int tEnd, FILE *f)
-/* Show protein/DNA alignment or translated DNA alignment in HTML format. */
-{
-/* At this step we just do a little shuffling of the strands for
- * untranslated DNA alignments. */
-char origStrand[2];
-boolean needsSwap = (psl->strand[0] == '-' && psl->strand[1] == 0);
-if (needsSwap)
-    {
-    memcpy(origStrand, psl->strand, 2);
-    pslRc(psl);
-    }
-pslShowAlignmentStranded(psl, isProt, qName, qSeq, qStart, qEnd,
-    tName, tSeq, tStart, tEnd, f);
-if (needsSwap)
-    {
-    pslRc(psl);
-    memcpy(psl->strand, origStrand, 2);
-    }
-return psl->blockCount;
-}
-
diff --git a/gbtools/src/blatSrc/lib/pslTbl.c b/gbtools/src/blatSrc/lib/pslTbl.c
deleted file mode 100644
index 54f0739..0000000
--- a/gbtools/src/blatSrc/lib/pslTbl.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* table of psl alignments, grouped by query */
-
-/* Copyright (C) 2005 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "pslTbl.h"
-#include "psl.h"
-#include "hash.h"
-#include "linefile.h"
-#include "localmem.h"
-
-static struct pslQuery *pslQueryGet(struct pslTbl *pslTbl,
-                                    char *qName)
-/* get pslQuery object for qName, creating if it doesn't exist. */
-{
-struct hashEl *qHel = hashStore(pslTbl->queryHash, qName);
-if (qHel->val == NULL)
-    {
-    struct pslQuery *pslQuery;
-    lmAllocVar(pslTbl->queryHash->lm, pslQuery);
-    pslQuery->qName = qHel->name;
-    qHel->val = pslQuery;
-    }
-return qHel->val;
-}
-
-static void loadPsl(struct pslTbl *pslTbl, char **row)
-/* load a psl record into the table */
-{
-struct psl *psl = pslLoadLm(row, pslTbl->queryHash->lm);
-struct pslQuery *pslQuery = pslQueryGet(pslTbl, psl->qName);
-slAddHead(&pslQuery->psls, psl);
-}
-
-static void loadPsls(struct pslTbl *pslTbl, char *pslFile)
-/* load a psl records into the table */
-{
-struct lineFile *lf = lineFileOpen(pslFile, TRUE);
-char *row[PSL_NUM_COLS];
-while (lineFileNextRowTab(lf, row, ArraySize(row)))
-    loadPsl(pslTbl, row);
-lineFileClose(&lf);
-}
-
-struct pslTbl *pslTblNew(char *pslFile, char *setName)
-/* construct a new object, loading the psl file.  If setName is NULL, the file
-* name is saved as the set name. */
-{
-struct pslTbl *pslTbl;
-AllocVar(pslTbl);
-pslTbl->setName = (setName == NULL) ? cloneString(pslFile)
-    : cloneString(setName);
-pslTbl->queryHash = hashNew(22);
-loadPsls(pslTbl, pslFile);
-return pslTbl;
-}
-
-void pslTblFree(struct pslTbl **pslTblPtr)
-/* free object */
-{
-struct pslTbl *pslTbl = *pslTblPtr;
-if (pslTbl != NULL)
-    {
-    /* pslQuery and psl objects are in local mem */
-    freeMem(pslTbl->setName);
-    hashFree(&pslTbl->queryHash);
-    freeMem(pslTbl);
-    }
-}
-
-void pslTblFreeList(struct pslTbl **pslTblList)
-/* free list of pslTbls */
-{
-struct pslTbl *pslTbl = *pslTblList;
-while (pslTbl != NULL)
-    {
-    struct pslTbl *pslTblDel = pslTbl;
-    pslTbl = pslTbl->next;
-    pslTblFree(&pslTblDel);
-    }
-*pslTblList = NULL;
-}
-
-/*
- * Local Variables:
- * c-file-style: "jkent-c"
- * End:
- */
-
diff --git a/gbtools/src/blatSrc/lib/pslTransMap.c b/gbtools/src/blatSrc/lib/pslTransMap.c
deleted file mode 100644
index f082a5d..0000000
--- a/gbtools/src/blatSrc/lib/pslTransMap.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/* pslTransMap - transitive mapping of an alignment another sequence, via a
- * common alignment */
-
-/* Copyright (C) 2009 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-#include "common.h"
-#include "pslTransMap.h"
-#include "psl.h"
-
-/*
- * Notes:
- *  - This code is used with both large and small mapping psls.  Large
- *    psls used for doing cross-species mappings and small psl are used for
- *    doing protein to mRNA mappings.  This introduces some speed issues.  For
- *    chain mapping, a large amount of time is spent in getBlockMapping()
- *    searching for the starting point of a mapping.  However an optimization
- *    to find the starting point, such as a binKeeper, could be inefficient
- *    for a large number of small psls.  Implementing such an optimzation
- *    would have to be dependent on the type of mapping.  The code was made
- *    16x faster for genome mappings by remembering the current location in
- *    the mapping psl between blocks (iMapBlkPtr arg).  This will do for a
- *    while.
- */
-
-
-struct block
-/* coordinates of a block */
-{
-    int qStart;          /* Query start position. */
-    int qEnd;            /* Query end position. */
-    int tStart;          /* Target start position. */
-    int tEnd;            /* Target end position. */
-};
-
-static void pslProtToNA(struct psl *psl)
-/* convert a protein/NA alignment to a NA/NA alignment */
-{
-int iBlk;
-
-psl->qStart *= 3;
-psl->qEnd *= 3;
-psl->qSize *= 3;
-for (iBlk = 0; iBlk < psl->blockCount; iBlk++)
-    {
-    psl->blockSizes[iBlk] *= 3;
-    psl->qStarts[iBlk] *= 3;
-    }
-}
-
-static void pslNAToProt(struct psl *psl)
-/* undo pslProtToNA */
-{
-int iBlk;
-
-psl->qStart /= 3;
-psl->qEnd /= 3;
-psl->qSize /= 3;
-for (iBlk = 0; iBlk < psl->blockCount; iBlk++)
-    {
-    psl->blockSizes[iBlk] /= 3;
-    psl->qStarts[iBlk] /= 3;
-    }
-}
-
-static struct psl* createMappedPsl(struct psl* inPsl, struct psl *mapPsl,
-                                   int mappedPslMax)
-/* setup a PSL for the output alignment */
-{
-char strand[3];
-assert(pslTStrand(inPsl) == pslQStrand(mapPsl));
-
-/* strand can be taken from both alignments, since common sequence is in same
- * orientation. */
-strand[0] = pslQStrand(inPsl);
-strand[1] = pslTStrand(mapPsl);
-strand[2] = '\n';
-
-return pslNew(inPsl->qName, inPsl->qSize, 0, 0,
-              mapPsl->tName, mapPsl->tSize, 0, 0,
-              strand, mappedPslMax, 0);
-}
-
-static struct block blockFromPslBlock(struct psl* psl, int iBlock)
-/* fill in a block object from a psl block */
-{
-struct block block;
-block.qStart = psl->qStarts[iBlock];
-block.qEnd = psl->qStarts[iBlock] + psl->blockSizes[iBlock];
-block.tStart = psl->tStarts[iBlock];
-block.tEnd = psl->tStarts[iBlock] + psl->blockSizes[iBlock];
-return block;
-}
-
-static void addPslBlock(struct psl* psl, struct block* blk, int* pslMax)
-/* add a block to a psl */
-{
-unsigned newIBlk = psl->blockCount;
-
-assert((blk->qEnd - blk->qStart) == (blk->tEnd - blk->tStart));
-if (newIBlk >= *pslMax)
-    pslGrow(psl, pslMax);
-psl->qStarts[newIBlk] = blk->qStart;
-psl->tStarts[newIBlk] = blk->tStart;
-psl->blockSizes[newIBlk] = blk->qEnd - blk->qStart;
-/* lie about match counts. */
-psl->match += psl->blockSizes[newIBlk];
-/* count gaps */
-if (newIBlk > 0)
-    {
-    if (psl->qStarts[newIBlk] > pslQEnd(psl, newIBlk-1))
-        {
-        psl->qNumInsert++;
-        psl->qBaseInsert += psl->qStarts[newIBlk] - pslQEnd(psl, newIBlk-1);
-        }
-    if (psl->tStarts[newIBlk] > pslTEnd(psl, newIBlk-1))
-        {
-        psl->tNumInsert++;
-        psl->tBaseInsert += psl->tStarts[newIBlk] - pslTEnd(psl, newIBlk-1);
-        }
-    }
-psl->blockCount++;
-}
-
-static void setPslBounds(struct psl* mappedPsl)
-/* set sequences bounds on mapped PSL */
-{
-int lastBlk = mappedPsl->blockCount-1;
-
-/* set start/end of sequences */
-mappedPsl->qStart = mappedPsl->qStarts[0];
-mappedPsl->qEnd = mappedPsl->qStarts[lastBlk] + mappedPsl->blockSizes[lastBlk];
-if (pslQStrand(mappedPsl) == '-')
-    reverseIntRange(&mappedPsl->qStart, &mappedPsl->qEnd, mappedPsl->qSize);
-
-mappedPsl->tStart = mappedPsl->tStarts[0];
-mappedPsl->tEnd = mappedPsl->tStarts[lastBlk] + mappedPsl->blockSizes[lastBlk];
-if (pslTStrand(mappedPsl) == '-')
-    reverseIntRange(&mappedPsl->tStart, &mappedPsl->tEnd, mappedPsl->tSize);
-}
-
-static void adjustOrientation(unsigned opts, struct psl *inPsl, char *inPslOrigStrand,
-                              struct psl* mappedPsl)
-/* adjust strand, possibly reverse complementing, based on
- * pslTransMapKeepTrans option and input psls. */
-{
-if (!(opts&pslTransMapKeepTrans) || ((inPslOrigStrand[1] == '\0') && (mappedPsl->strand[1] == '\0')))
-    {
-    /* make untranslated */
-    if (pslTStrand(mappedPsl) == '-')
-        pslRc(mappedPsl);
-    mappedPsl->strand[1] = '\0';  /* implied target strand */
-    }
-}
-
-static struct block getBeforeBlockMapping(unsigned mqStart, unsigned mqEnd,
-                                          struct block* align1Blk)
-/* map part of an ungapped psl block that occurs before a mapPsl block */
-{
-struct block mappedBlk;
-
-/* mRNA start in genomic gap before this block, this will
- * be an inPsl insert */
-unsigned size = (align1Blk->tEnd < mqStart)
-    ? (align1Blk->tEnd - align1Blk->tStart)
-    : (mqStart - align1Blk->tStart);
-ZeroVar(&mappedBlk);
-mappedBlk.qStart = align1Blk->qStart;
-mappedBlk.qEnd = align1Blk->qStart + size;
-return mappedBlk;
-}
-
-static struct block getOverBlockMapping(unsigned mqStart, unsigned mqEnd,
-                                        unsigned mtStart, struct block* align1Blk)
-/* map part of an ungapped psl block that overlapps a mapPsl block. */
-{
-struct block mappedBlk;
-
-/* common sequence start contained in this block, this handles aligned
- * and genomic inserts */
-unsigned off = align1Blk->tStart - mqStart;
-unsigned size = (align1Blk->tEnd > mqEnd)
-    ? (mqEnd - align1Blk->tStart)
-    : (align1Blk->tEnd - align1Blk->tStart);
-ZeroVar(&mappedBlk);
-mappedBlk.qStart = align1Blk->qStart;
-mappedBlk.qEnd = align1Blk->qStart + size;
-mappedBlk.tStart = mtStart + off;
-mappedBlk.tEnd = mtStart + off + size;
-return mappedBlk;
-}
-
-static struct block getBlockMapping(struct psl* inPsl, struct psl *mapPsl,
-                                    int *iMapBlkPtr, struct block* align1Blk)
-/* Map part or all of a ungapped psl block to the genome.  This returns the
- * coordinates of the sub-block starting at the beginning of the align1Blk.
- * If this is a gap, either the target or query coords are zero.  This works
- * in genomic strand space.  The search starts at the specified map block,
- * which is updated to prevent rescanning large psls.
- */
-{
-int iBlk;
-struct block mappedBlk;
-
-/* search for block or gap containing start of mrna block */
-for (iBlk = *iMapBlkPtr; iBlk < mapPsl->blockCount; iBlk++)
-    {
-    unsigned mqStart = mapPsl->qStarts[iBlk];
-    unsigned mqEnd = mapPsl->qStarts[iBlk]+mapPsl->blockSizes[iBlk];
-    if (align1Blk->tStart < mqStart)
-        {
-        *iMapBlkPtr = iBlk;
-        return getBeforeBlockMapping(mqStart, mqEnd, align1Blk);
-        }
-    if ((align1Blk->tStart >= mqStart) && (align1Blk->tStart < mqEnd))
-        {
-        *iMapBlkPtr = iBlk;
-        return getOverBlockMapping(mqStart, mqEnd, mapPsl->tStarts[iBlk], align1Blk);
-        }
-    }
-
-/* reached the end of the mRNA->genome alignment, finish off the 
- * rest of the the protein as an insert */
-ZeroVar(&mappedBlk);
-mappedBlk.qStart = align1Blk->qStart;
-mappedBlk.qEnd = align1Blk->qEnd;
-*iMapBlkPtr = iBlk;
-return mappedBlk;
-}
-
-static boolean mapBlock(struct psl *inPsl, struct psl *mapPsl, int *iMapBlkPtr,
-                        struct block *align1Blk, struct psl* mappedPsl,
-                        int* mappedPslMax)
-/* Add a PSL block from a ungapped portion of an alignment, mapping it to the
- * genome.  If the started of the inPsl block maps to a part of the mapPsl
- * that is aligned, it is added as a PSL block, otherwise the gap is skipped.
- * Block starts are adjusted for next call.  Return FALSE if the end of the
- * alignment is reached. */
-{
-struct block mappedBlk;
-unsigned size;
-assert(align1Blk->qStart <= align1Blk->qEnd);
-assert(align1Blk->tStart <= align1Blk->tEnd);
-assert((align1Blk->qEnd - align1Blk->qStart) == (align1Blk->tEnd - align1Blk->tStart));
-
-if ((align1Blk->qStart >= align1Blk->qEnd) || (align1Blk->tStart >= align1Blk->tEnd))
-    return FALSE;  /* end of ungapped block. */
-
-/* find block or gap with start coordinates of mrna */
-mappedBlk = getBlockMapping(inPsl, mapPsl, iMapBlkPtr, align1Blk);
-
-if ((mappedBlk.qEnd != 0) && (mappedBlk.tEnd != 0))
-    addPslBlock(mappedPsl, &mappedBlk, mappedPslMax);
-
-/* advance past block or gap */
-size = (mappedBlk.qEnd != 0)
-    ? (mappedBlk.qEnd - mappedBlk.qStart)
-    : (mappedBlk.tEnd - mappedBlk.tStart);
-align1Blk->qStart += size;
-align1Blk->tStart += size;
-
-return TRUE;
-}
-
-struct psl* pslTransMap(unsigned opts, struct psl *inPsl, struct psl *mapPsl)
-/* map a psl via a mapping psl, a single psl is returned, or NULL if it
- * couldn't be mapped. */
-{
-int mappedPslMax = 8; /* allocated space in output psl */
-int iMapBlk = 0;
-char inPslOrigStrand[3];
-boolean rcInPsl = (pslTStrand(inPsl) != pslQStrand(mapPsl));
-boolean cnv1 = (pslIsProtein(inPsl) && !pslIsProtein(mapPsl));
-boolean cnv2 = (pslIsProtein(mapPsl) && !pslIsProtein(inPsl));
-int iBlock;
-struct psl* mappedPsl;
-
-/* sanity check size, but allow names to vary to allow ids to have
- * unique-ifying suffixes. */
-if (inPsl->tSize != mapPsl->qSize)
-    errAbort("Error: inPsl %s tSize (%d) != mapPsl %s qSize (%d)",
-            inPsl->tName, inPsl->tSize, mapPsl->qName, mapPsl->qSize);
-
-/* convert protein PSLs */
-if (cnv1)
-    pslProtToNA(inPsl);
-if (cnv2)
-    pslProtToNA(mapPsl);
-
-/* need to ensure common sequence is in same orientation, save strand for later */
-safef(inPslOrigStrand, sizeof(inPslOrigStrand), "%s", inPsl->strand);
-if (rcInPsl)
-    pslRc(inPsl);
-
-mappedPsl = createMappedPsl(inPsl, mapPsl, mappedPslMax);
-
-/* Fill in ungapped blocks.  */
-for (iBlock = 0; iBlock < inPsl->blockCount; iBlock++)
-    {
-    struct block align1Blk = blockFromPslBlock(inPsl, iBlock);
-    while (mapBlock(inPsl, mapPsl, &iMapBlk, &align1Blk, mappedPsl,
-                    &mappedPslMax))
-        continue;
-    }
-
-/* finish up psl, or free if no blocks were added */
-assert(mappedPsl->blockCount <= mappedPslMax);
-if (mappedPsl->blockCount == 0)
-    pslFree(&mappedPsl);  /* nothing made it */
-else
-    {
-    setPslBounds(mappedPsl);
-    adjustOrientation(opts, inPsl, inPslOrigStrand, mappedPsl);
-    }
-
-/* restore input */
-if (rcInPsl)
-    {
-    pslRc(inPsl);
-    strcpy(inPsl->strand, inPslOrigStrand);
-    }
-if (cnv1)
-    pslNAToProt(inPsl);
-if (cnv2)
-    pslNAToProt(mapPsl);
-
-return mappedPsl;
-}
-
diff --git a/gbtools/src/blatSrc/lib/pslWScore.as b/gbtools/src/blatSrc/lib/pslWScore.as
deleted file mode 100644
index 59bf474..0000000
--- a/gbtools/src/blatSrc/lib/pslWScore.as
+++ /dev/null
@@ -1,26 +0,0 @@
-table pslWScore
-"Summary info about a patSpace alignment with a score addition"
-    (
-    uint    match;      "Number of bases that match that aren't repeats"
-    uint    misMatch;   "Number of bases that don't match"
-    uint    repMatch;   "Number of bases that match but are part of repeats"
-    uint    nCount;       "Number of 'N' bases"
-    uint    qNumInsert;   "Number of inserts in query"
-    int     qBaseInsert;  "Number of bases inserted in query"
-    uint    tNumInsert;   "Number of inserts in target"
-    int     tBaseInsert;  "Number of bases inserted in target"
-    char[2] strand;       "+ or - for query strand. For mouse second +/- for genomic strand"
-    string  qName;        "Query sequence name"
-    uint    qSize;        "Query sequence size"
-    uint    qStart;       "Alignment start position in query"
-    uint    qEnd;         "Alignment end position in query"
-    string  tName;        "Target sequence name"
-    uint    tSize;        "Target sequence size"
-    uint    tStart;       "Alignment start position in target"
-    uint    tEnd;         "Alignment end position in target"
-    uint    blockCount;   "Number of blocks in alignment"
-    uint[blockCount] blockSizes;  "Size of each block"
-    uint[blockCount] qStarts;     "Start of each block in query."
-    uint[blockCount] tStarts;     "Start of each block in target."
-    float     score;         "score field"
-    )
diff --git a/gbtools/src/blatSrc/lib/pslWScore.sql b/gbtools/src/blatSrc/lib/pslWScore.sql
deleted file mode 100644
index 80f40ad..0000000
--- a/gbtools/src/blatSrc/lib/pslWScore.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-# pslWScore.sql was originally generated by the autoSql program, which also 
-# generated pslWScore.c and pslWScore.h.  This creates the database representation of
-# an object which can be loaded and saved from RAM in a fairly 
-# automatic way.
-
-#Summary info about a patSpace alignment with a score addition
-CREATE TABLE uniGene (
-    matches int unsigned not null,	# Number of bases that match that arent repeats
-    misMatch int unsigned not null,	# Number of bases that dont match
-    repMatch int unsigned not null,	# Number of bases that match but are part of repeats
-    nCount int unsigned not null,	# Number of N bases
-    qNumInsert int unsigned not null,	# Number of inserts in query
-    qBaseInsert int not null,	# Number of bases inserted in query
-    tNumInsert int unsigned not null,	# Number of inserts in target
-    tBaseInsert int not null,	# Number of bases inserted in target
-    strand char(2) not null,	# + or - for query strand. For mouse second +- for genomic strand
-    qName varchar(255) not null,	# Query sequence name
-    qSize int unsigned not null,	# Query sequence size
-    qStart int unsigned not null,	# Alignment start position in query
-    qEnd int unsigned not null,	# Alignment end position in query
-    tName varchar(255) not null,	# Target sequence name
-    tSize int unsigned not null,	# Target sequence size
-    tStart int unsigned not null,	# Alignment start position in target
-    tEnd int unsigned not null,	# Alignment end position in target
-    blockCount int unsigned not null,	# Number of blocks in alignment
-    blockSizes longblob not null,	# Size of each block
-    qStarts longblob not null,	# Start of each block in query.
-    tStarts longblob not null,	# Start of each block in target.
-    score float not null,	# score field
-    index(tName(32),tStart,tEnd)
-);
diff --git a/gbtools/src/blatSrc/lib/pthreadDoList.c b/gbtools/src/blatSrc/lib/pthreadDoList.c
deleted file mode 100644
index 99cda8a..0000000
--- a/gbtools/src/blatSrc/lib/pthreadDoList.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* pthreadDoList - do something to all items in list using multiple threads in parallel. 
- * See pthreadDoList.h for documentation on how to use. */
-
-#include "common.h"
-#include "pthreadWrap.h"
-#include "synQueue.h"
-#include "pthreadDoList.h"
-#include "dlist.h"
-
-struct pthreadWorkList
-/* Manage threads to work on a list of items in parallel. */
-    {
-    struct pthreadWorkList *next;   /* Next in list */
-    void *context;		    /* Constant context data for each item */
-    PthreadListWorker *worker;   /* Routine that does work in a single thread */
-    pthread_t *pthreads;		    /* Array of pthreads */
-    struct synQueue *inQueue;	    /* Put all inputs here */
-    };
-
-static void pthreadWorkListFree(struct pthreadWorkList **pPwl)
-/* Free up memory resources associated with work list */
-{
-struct pthreadWorkList *pwl = *pPwl;
-if (pwl != NULL)
-    {
-    synQueueFree(&pwl->inQueue);
-    freez(&pwl->pthreads);
-    freez(pPwl);
-    }
-}
-
-static void *pthreadWorker(void *vWorkList)
-/* The worker-bee for a workList thread.  This grabs next input, processes it, and
- * puts result on output queue.  It returns when no more input. */
-{
-struct pthreadWorkList *pwl = vWorkList;
-void *item;
-while ((item = synQueueGrab(pwl->inQueue)) != NULL)
-    {
-    /* Do work on the item. */
-    pwl->worker(item, pwl->context);
-    }
-return NULL;
-}
-
-void pthreadDoList(int threadCount, void *workList,  PthreadListWorker *worker, void *context)
-/* Work through list with threadCount workers each in own thread. 
- * The worker will be called in parallel with an item from work list and the context
- *       worker(item, context)
- * The context is constant across all threads and items. */
-{
-if (workList == NULL)
-    return;
-if (threadCount < 1 || threadCount > 256)
-    errAbort("pthreadDoList - threadCount %d, but must be between 1 and 256", threadCount);
-
-/* Allocate basic structure */
-struct pthreadWorkList *pwl;
-AllocVar(pwl);
-pwl->context = context;
-pwl->worker = worker;
-AllocArray(pwl->pthreads, threadCount);
-struct synQueue *inQueue = pwl->inQueue = synQueueNew();
-
-/* Loop through all items in list and add them to inQueue */
-struct slList *item;
-for (item = workList; item != NULL; item = item->next)
-    synQueuePutUnprotected(inQueue, item);
-
-/* Start up pthreads */
-int i;
-for (i=0; i<threadCount; ++i)
-    pthreadCreate(&pwl->pthreads[i], NULL, pthreadWorker, pwl);
-
-/* Wait for threads to finish*/
-for (i=0; i<threadCount; ++i)
-    pthread_join(pwl->pthreads[i], NULL);
-
-/* Clean up */
-pthreadWorkListFree(&pwl);
-}
-
diff --git a/gbtools/src/blatSrc/lib/pthreadWrap.c b/gbtools/src/blatSrc/lib/pthreadWrap.c
deleted file mode 100644
index f532e2d..0000000
--- a/gbtools/src/blatSrc/lib/pthreadWrap.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* pthreadWrap - error checking wrappers around Posix
- * thread functions.  Most of the errors here are invariably
- * fatal, but shouldn't happen unless the kernal or
- * the program is hosed. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "errAbort.h"
-#include "pthreadWrap.h"
-
-
-static void pwarn(char *function, int err)
-/* Print a warning message on non-zero error code. */
-{
-if (err != 0)
-    warn("Couldn't %s: %s\n", function, strerror(err));
-}
-
-static void perr(char *function, int err)
-/* Print out error for function and abort on
- * non-zero error code.. */
-{
-if (err != 0)
-    {
-    pwarn(function, err);
-    noWarnAbort();
-    }
-}
-
-void pthreadCreate(pthread_t *thread, const pthread_attr_t *attr,
-	void *(*start_routine)(void *), void *arg)
-/* Create a thread or squawk and die. */
-{
-int err = pthread_create(thread, attr, start_routine, arg);
-perr("pthread_create", err);
-}
-
-boolean pthreadMayCreate(pthread_t *thread, const pthread_attr_t *attr,
-	void *(*start_routine)(void *), void *arg)
-/* Create a thread.  Warn and return FALSE if there is a problem. */
-{
-int err = pthread_create(thread, attr, start_routine, arg);
-pwarn("pthread_create", err);
-return err == 0;
-}
-
-void pthreadMutexInit(pthread_mutex_t *mutex)
-/* Initialize mutex or die trying */
-{
-int err = pthread_mutex_init(mutex, NULL);
-perr("pthread_mutex_init", err);
-}
-
-void pthreadMutexDestroy(pthread_mutex_t *mutex)
-/* Free up mutex. */
-{
-int err = pthread_mutex_destroy(mutex);
-perr("pthread_mutex_destroy", err);
-}
-
-void pthreadMutexLock(pthread_mutex_t *mutex)
-/* Lock a mutex to gain exclusive access or die trying. */
-{
-int err = pthread_mutex_lock(mutex);
-perr("pthread_mutex_lock", err);
-}
-
-void pthreadMutexUnlock(pthread_mutex_t *mutex)
-/* Unlock a mutex or die trying. */
-{
-int err = pthread_mutex_unlock(mutex);
-perr("pthread_mutex_unlock", err);
-}
-
-void pthreadCondInit(pthread_cond_t *cond)
-/* Initialize pthread conditional. */
-{
-int err = pthread_cond_init(cond, NULL);
-perr("pthread_cond_init", err);
-}
-
-void pthreadCondDestroy(pthread_cond_t *cond)
-/* Free up conditional. */
-{
-int err = pthread_cond_destroy(cond);
-perr("pthread_cond_destroy", err);
-}
-
-void pthreadCondSignal(pthread_cond_t *cond)
-/* Set conditional signal to wake up a sleeping thread, or
- * die trying. */
-{
-int err = pthread_cond_signal(cond);
-perr("pthread_cond_signal", err);
-}
-
-void pthreadCondWait(pthread_cond_t *cond, pthread_mutex_t *mutex)
-/* Wait for conditional signal. */
-{
-int err = pthread_cond_wait(cond, mutex);
-perr("pthread_cond_wait", err);
-}
-
diff --git a/gbtools/src/blatSrc/lib/qa.c b/gbtools/src/blatSrc/lib/qa.c
deleted file mode 100644
index d5060fc..0000000
--- a/gbtools/src/blatSrc/lib/qa.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/* qa - Modules to help do testing, especially on html based apps. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "dystring.h"
-#include "portable.h"
-#include "htmlPage.h"
-#include "errAbort.h"
-#include "errCatch.h"
-#include "htmshell.h"
-#include "qa.h"
-
-
-char *qaStringBetween(char *text, char *startPattern, char *endPattern)
-/* Return text that occurs between startPattern and endPattern,
- * or NULL if no startPattern.  (Will return up to 100 characters
- * after startPattern if there is no endPattern) */
-{
-char *startMid = stringIn(startPattern, text);
-if (startMid != NULL)
-    {
-    char *endMid;
-    int midSize;
-    startMid += strlen(startPattern);
-    endMid = stringIn(startMid, endPattern);
-    if (endMid == NULL)
-        {
-	midSize = strlen(startMid);
-	if (midSize > 100)
-	    midSize = 100;
-	}
-    else
-        midSize = endMid - startMid;
-    return cloneStringZ(startMid, midSize);
-    }
-return NULL;
-}
-
-char *qaScanForErrorMessage(char *text)
-/* Scan text for error message.  If one exists then
- * return copy of it.  Else return NULL. */
-{
-return qaStringBetween(text, htmlWarnStartPattern(), htmlWarnEndPattern());
-}
-
-int qaCountBetween(char *s, char *startPattern, char *endPattern, 
-	char *midPattern)
-/* Count the number of midPatterns that occur between start and end pattern. */
-{
-int count = 0;
-char *e;
-s = stringIn(startPattern, s);
-if (s != NULL)
-    {
-    s += strlen(startPattern);
-    e = stringIn(endPattern, s);
-    while (s < e)
-        {
-	if (startsWith(midPattern, s))
-	    ++count;
-	s += 1;
-	}
-    }
-return count;
-}
-
-void qaStatusReportOne(FILE *f, struct qaStatus *qs, char *format, ...)
-/* Report status */
-{
-char *errMessage = qs->errMessage;
-char *severity = "ok";
-va_list args;
-va_start(args, format);
-if (errMessage == NULL)
-    errMessage = "";
-else
-    {
-    if (qs->hardError)
-        severity = "hard";
-    else
-        severity = "soft";
-    }
-  
-vfprintf(f, format, args);
-fprintf(f, " %4.3fs (%s) %s\n", 0.001*qs->milliTime, severity, errMessage);
-va_end(args);
-}
-
-static struct qaStatus *qaStatusOnPage(struct errCatch *errCatch, 
-	struct htmlPage *page, long startTime, struct htmlPage **retPage)
-/* Assuming you have fetched page with the given error catcher,
- * starting the fetch at the given startTime, then create a
- * qaStatus that describes how the fetch went.  If *retPage is non-null
- * then return the page there, otherwise free it. */
-{
-char *errMessage = NULL;
-struct qaStatus *qs;
-AllocVar(qs);
-if (errCatch->gotError || page == NULL)
-    {
-    errMessage = errCatch->message->string;
-    qs->hardError = TRUE;
-    }
-else
-    {
-    if (page->status->status != 200)
-	{
-	dyStringPrintf(errCatch->message, "HTTP status code %d\n", 
-		page->status->status);
-	errMessage = errCatch->message->string;
-	qs->hardError = TRUE;
-	htmlPageFree(&page);
-	}
-    else
-        {
-	errMessage = qaScanForErrorMessage(page->fullText);
-	}
-    }
-qs->errMessage = cloneString(errMessage);
-if (qs->errMessage != NULL)
-    subChar(qs->errMessage, '\n', ' ');
-qs->milliTime = clock1000() - startTime;
-if (retPage != NULL)
-    *retPage = page;
-else
-    htmlPageFree(&page);
-return qs;
-}
-
-struct qaStatus *qaPageGet(char *url, struct htmlPage **retPage)
-/* Get info on given url, (and return page if retPage non-null). */
-{
-struct errCatch *errCatch = errCatchNew();
-struct qaStatus *qs;
-struct htmlPage *page = NULL;
-long startTime = clock1000();
-if (errCatchStart(errCatch))
-    {
-    page = htmlPageGet(url);
-    htmlPageValidateOrAbort(page);
-    }
-else
-    {
-    htmlPageFree(&page);
-    }
-errCatchEnd(errCatch);
-qs = qaStatusOnPage(errCatch, page, startTime, retPage);
-errCatchFree(&errCatch);
-return qs;
-}
-
-struct qaStatus *qaPageFromForm(struct htmlPage *origPage, struct htmlForm *form, 
-	char *buttonName, char *buttonVal, struct htmlPage **retPage)
-/* Get update to form based on pressing a button. */
-{
-struct errCatch *errCatch = errCatchNew();
-struct qaStatus *qs;
-struct htmlPage *page = NULL;
-long startTime = clock1000();
-if (errCatchStart(errCatch))
-    {
-    page = htmlPageFromForm(origPage, form, buttonName, buttonVal);
-    htmlPageValidateOrAbort(page);
-    }
-else
-    {
-    htmlPageFree(&page);
-    }
-errCatchEnd(errCatch);
-qs = qaStatusOnPage(errCatch, page, startTime, retPage);
-errCatchFree(&errCatch);
-return qs;
-}
-
-void qaStatusSoftError(struct qaStatus *qs, char *format, ...)
-/* Add error message for something less than a crash. */
-{
-struct dyString *dy = dyStringNew(0);
-va_list args, args2;
-va_start(args, format);
-/* args can't be reused, so vaWarn needs its own va_list: */
-va_start(args2, format);
-vaWarn(format, args2);
-if (qs->errMessage)
-    {
-    dyStringAppend(dy, qs->errMessage);
-    dyStringAppendC(dy, '\n');
-    }
-dyStringVaPrintf(dy, format, args);
-va_end(args);
-va_end(args2);
-freez(&qs->errMessage);
-qs->errMessage = cloneString(dy->string);
-dyStringFree(&dy);
-}
-
-void qaStatisticsAdd(struct qaStatistics *stats, struct qaStatus *qs)
-/* Add test results to totals */
-{
-stats->testCount += 1;
-stats->milliTotal += qs->milliTime;
-if (qs->errMessage)
-    {
-    if (qs->hardError)
-        stats->hardCount += 1;
-    else
-        stats->softCount += 1;
-    }
-}
-
-void qaStatisticsReport(struct qaStatistics *stats, char *label, FILE *f)
-/* Write a line of stats to file. */
-{
-fprintf(f, "%20s:  %3d tests, %2d soft errors, %2d hard errors, %5.2f seconds\n",
-	label, stats->testCount, stats->softCount, stats->hardCount, 
-	0.001 * stats->milliTotal);
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/quickHeap.c b/gbtools/src/blatSrc/lib/quickHeap.c
deleted file mode 100644
index eec8fe2..0000000
--- a/gbtools/src/blatSrc/lib/quickHeap.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* quickHeap - Heap implemented as an array for speed.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial.
- *
- *    The array can be resized as it grows.
- *  By preserving the relationship that the children of n are at 2n+1 and 2n+2,
- *  and therefore the parent of n is at (n-1)/2, we can save alot of pointer
- *  manipulation and get some speed.  
- *    This routine could for instance be used at the heart of a multi-way mergesort
- *  or other situation such as a priority queue.
- *
- * Maintaining the heap is quick and easy since
- * we just use an array with the following relationships:
- * children(n) == 2n+1,2n+2. parent(n) == (n-1)/2.
- * The highest score is always at the top of the heap in 
- * position 0. When the top element is consumed and 
- * and the next element for the previously top elem is 
- * set in, we simply balance the heap to maintain the heap property
- * by swapping with the largest child until both children 
- * are smaller, or we hit the end of the array (==heapCount).
- * Also note that scores are not necessarily unique, heap members
- * may have equal score.  So A parent need not only be greater
- * than its children, it may also be equal to them.
- */
-
-#include "common.h"
-#include "quickHeap.h"
-
-
-
-struct quickHeap *newQuickHeap(int initSize, 
-   int (*compare )(const void *elem1,  const void *elem2))
-/* Create a new array quick heap of initial size specified,
- * The compare function must return > 0 if elem1 > elem2, etc.*/
-{
-struct quickHeap *h;
-if (initSize < 1)
-    errAbort("invalid initial size for newQuickHeap: %d",initSize);
-AllocVar(h);
-h->heapCount=0;
-h->heapMax = initSize;
-h->heap = AllocN(void *,h->heapMax);
-h->compareFunc = compare;
-return h;
-}
-
-
-void freeQuickHeap(struct quickHeap **pH)
-/* Heap needs more space, double the size of the array preserving elements */
-{
-struct quickHeap *h = *pH;
-freez(&h->heap);
-freez(pH);
-}
-
-static void expandQuickHeap(struct quickHeap *h)
-/* Heap needs more space, double the size of the array preserving elements */
-{
-int newSize = h->heapMax * 2;
-ExpandArray(h->heap, h->heapMax, newSize);
-h->heapMax = newSize;
-}
-
-void addToQuickHeap(struct quickHeap *h, void *elem)
-/* add to heap at end (expands array if needed), rebalance */
-{
-int n, p;   /* node, parent */
-if (h->heapCount >= h->heapMax)
-    expandQuickHeap(h);
-/* preserve heap property as it grows */
-n = h->heapCount;
-h->heap[h->heapCount++] = elem;
-p = (n-1)/2;
-while (n > 0 && h->compareFunc(h->heap[p], h->heap[n]) < 0)
-    {
-    void *temp = h->heap[p];
-    h->heap[p] = h->heap[n];
-    h->heap[n] = temp;
-    n = p;
-    p = (n-1)/2;
-    }
-}
-
-
-static void quickHeapBalanceWithChildren(struct quickHeap *h, int n)
-/* only the value of the n-th element has changed, now rebalance */
-{
-int c1, c2, hc;   /* child1, child2, heapCount */
-if (n < 0 || n >= h->heapCount)
-    errAbort("attempt to quickHeapBalanceWithChildren with invalid value "
-		"for n: %d, heapCount=%d", n, h->heapCount);
-/* balance heap - swap node with biggest child until both children are 
- * either less or equal or hit end of heap (no more children) */
-hc = h->heapCount;
-c1 = 2*n+1;
-c2 = 2*n+2;
-while (TRUE)
-    {
-    void *temp = NULL;
-    int bestc = n;
-    if (c1 < hc && h->compareFunc(h->heap[c1], h->heap[bestc]) > 0)
-	bestc = c1;
-    if (c2 < hc && h->compareFunc(h->heap[c2], h->heap[bestc]) > 0)
-	bestc = c2;
-    if (bestc == n)
-	break;
-    temp = h->heap[bestc];
-    h->heap[bestc] = h->heap[n];
-    h->heap[n] = temp;
-    n = bestc;
-    c1 = 2*n+1;
-    c2 = 2*n+2;
-    }
-}
-
-
-void quickHeapTopChanged(struct quickHeap *h)
-/* only the value of the top element has changed, now rebalance */
-{
-/* balance heap - swap node with biggest child until both children are 
- * either less or equal or hit end of heap (no more children) */
-quickHeapBalanceWithChildren(h,0);
-}
-
-boolean quickHeapEmpty(struct quickHeap *h)
-/* return TRUE if quick heap is empty, otherwise FALSE */
-{
-return h->heapCount < 1;
-}
-
-static void removeFromQuickHeapN(struct quickHeap *h, int n)
-/* Remove element n from the heap by swapping 
- * it with the last element in the heap and rebalancing.
- * If heap is empty it will errAbort, but that should not happen. */
-{
-if (n < 0 || n >= h->heapCount)
-    errAbort("attempt to removeFromQuickHeapN with invalid value "
-		"for n: %d, heapCount=%d", n, h->heapCount);
-h->heap[n] = h->heap[--h->heapCount]; /* wipes out n by moving tail to it */
-h->heap[h->heapCount] = NULL; /* not needed but clean */
-/* balance heap - swap node with biggest child until both children are 
- * either less or equal or hit end of heap (no more children) */
-if (n < h->heapCount)  /* i.e. true for all but when n was the tail */
-    quickHeapBalanceWithChildren(h,n);
-}
-
-
-static int findElemInQuickHeap(struct quickHeap *h, void *elem)
-/* Do a linear search in heap array for elem,
- * return position n or -1 if not found */
-{
-int n = -1;
-while (++n < h->heapCount)
-    {
-    if (h->heap[n] == elem)
-	return n;
-    }
-return -1;    
-}
-
-
-boolean removeFromQuickHeapByElem(struct quickHeap *h, void *elem)
-/* Do a linear search in heap array for elem,
- * then remove it by position n. Return TRUE
- * if found and removed, otherwise return FALSE. */
-{
-int n = findElemInQuickHeap(h, elem);
-if (n < 0) 
-    return FALSE;
-removeFromQuickHeapN(h,n);
-return TRUE;
-}
-
-void *peekQuickHeapTop(struct quickHeap *h)
-/* return the top element or NULL if empty */
-{
-if (h->heapCount < 1) 
-    return NULL;
-return h->heap[0];    
-}
-
-void *removeQuickHeapTop(struct quickHeap *h)
-/* Return elem (pointer) in heap array[0]
- * which will be NULL if heap is empty.
- * Then that top element if found is removed. */
-{
-void *result = h->heap[0]; 
-/* this is ok, but depends on removeFromQuickHeapN NULLing as it empties */   
-if (h->heapCount > 0) 
-    {
-    removeFromQuickHeapN(h,0);
-    }
-return result;
-}
-
diff --git a/gbtools/src/blatSrc/lib/quotedP.c b/gbtools/src/blatSrc/lib/quotedP.c
deleted file mode 100644
index 7dbd111..0000000
--- a/gbtools/src/blatSrc/lib/quotedP.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "dystring.h"
-#include "quotedP.h"
-
-
-char *quotedPrintableEncode(char *input)
-/* Use Quoted-Printable standard to encode a string. */
-{
-struct dyString *dy = dyStringNew(0);
-size_t i=0,l=strlen(input);
-int width = 0;
-for (i=0; i < l; ++i)
-    {
-    char c = input[i];
-    switch (c)
-	{
-	case '=':
-	case '\t':
-	case '\r':
-	case '\n':
-	case ' ':
-	    dyStringAppendC(dy, '=');
-	    dyStringPrintf(dy, "%2x", c);
-	    width += 3;
-	    break;
-	default:
-	    dyStringAppendC(dy, c);
-	    ++width;
-	}
-    if (width > 72)
-	{
-	dyStringAppendC(dy, '=');
-	dyStringAppendC(dy, '\n');
-	width = 0;
-	}
-	
-    }
-/* add terminator to prevent extra newline */
-if (lastChar(dy->string) != '=')  
-    dyStringAppendC(dy, '=');
-    
-return dyStringCannibalize(&dy);
-}
-
-boolean quotedPCollapse(char *line)
-/* Use Quoted-Printable standard to decode a string.
- * Return true if the line does not end in '='
- * which indicate continuation. */
-{
-size_t i=0,j=0,l=strlen(line);
-boolean result = lastChar(line) != '=';
-char c1 = ' ', c2 = ' ';
-while(i < l)
-    {
-    if (line[i] == '=')
-	{
-	if (i > (l-3)) 
-	    break;     /* not enough room left for whole char */
-	++i;	    
-	c1 = line[i++];
-	c2 = line[i++];
-	c1 = toupper(c1);
-	c2 = toupper(c2);
-	if (isdigit(c1))
-	    c1 -= 48;
-	else
-	    c1 -= 55;
-	if (isdigit(c2))
-	    c2 -= 48;
-	else
-	    c2 -= 55;
-	line[j++] = (c1 * 16) + c2;
-	}
-    else
-	{
-	line[j++] = line[i++];
-	}
-    }
-line[j] = 0; /* terminate line */
-return result;
-}
-
-char *quotedPrintableDecode(char *input)
-/* Use Quoted-Printable standard to decode a string.  Return decoded
- * string which will be freeMem'd.  */
-{
-size_t inplen = strlen(input);
-char *result = (char *)needMem(inplen+1);
-size_t j=0;
-char *line = NULL;
-int size = 0;
-int i = 0;
-boolean newLine = FALSE;
-
-struct lineFile *lf = lineFileOnString("", TRUE, cloneString(input));
-
-while (lineFileNext(lf, &line, &size))
-    {
-    newLine = quotedPCollapse(line);
-    size = strlen(line); 
-    for (i = 0; i < size; )
-	result[j++] = line[i++];
-    if (newLine)
-	result[j++] = '\n';
-    }
-
-lineFileClose(&lf);  /* frees cloned string */
-
-result[j] = 0;  /* terminate text string */
-     
-return result;
-}
-
diff --git a/gbtools/src/blatSrc/lib/ra.c b/gbtools/src/blatSrc/lib/ra.c
deleted file mode 100644
index efabdf3..0000000
--- a/gbtools/src/blatSrc/lib/ra.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/* Stuff to parse .ra files. Ra files are simple text databases.
- * The database is broken into records by blank lines.
- * Each field takes a line.  The name of the field is the first
- * word in the line.  The value of the field is the rest of the line.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "localmem.h"
-#include "dystring.h"
-#include "ra.h"
-
-
-boolean raSkipLeadingEmptyLines(struct lineFile *lf, struct dyString *dy)
-/* Skip leading empty lines and comments.  Returns FALSE at end of file.
- * Together with raNextTagVal you can construct your own raNextRecord....
- * If dy parameter is non-null, then the text parsed gets placed into dy. */
-{
-char *line;
-/* Skip leading empty lines and comments. */
-if (dy)
-    dyStringClear(dy);
-for (;;)
-    {
-    if (!lineFileNext(lf, &line, NULL))
-       return FALSE;
-    char *tag = skipLeadingSpaces(line);
-    if (tag[0] == 0 || tag[0] == '#')
-       {
-       if (dy)
-	   {
-	   dyStringAppend(dy, line);
-	   dyStringAppendC(dy, '\n');
-	   }
-	}
-    else
-       break;
-    }
-lineFileReuse(lf);
-return TRUE;
-}
-
-boolean raNextTagVal(struct lineFile *lf, char **retTag, char **retVal, struct dyString *dyRecord)
-// Read next line.  Return FALSE at end of file or blank line.  Otherwise fill in
-// *retTag and *retVal and return TRUE.  If dy parameter is non-null, then the text parsed
-// gets appended to dy. Continuation lines in RA file will be joined to produce tag and val,
-// but dy will be filled with the unedited multiple lines containing the continuation chars.
-// NOTE: retTag & retVal, if returned, point to static mem which will be overwritten on next call!
-{
-*retTag = NULL;
-*retVal = NULL;
-
-char *line, *raw = NULL;
-int lineLen,rawLen;
-
-// Don't bother with raw if it isn't used.
-char **pRaw    = NULL;
-int   *pRawLen = NULL;
-if (dyRecord != NULL)
-    {
-    pRaw    = &raw;
-    pRawLen = &rawLen;
-    }
-
-while (lineFileNextFull(lf, &line, &lineLen, pRaw, pRawLen)) // Joins continuation lines
-    {
-    char *clippedText = skipLeadingSpaces(line);
-    if (*clippedText == 0)
-        {
-        if (dyRecord)
-            lineFileReuse(lf);   // Just so don't loose leading space in dy.
-        return FALSE;
-        }
-
-    // Append whatever line was read from file.
-    if (dyRecord)
-        {
-        if (raw != NULL)
-            dyStringAppendN(dyRecord, raw, rawLen);
-        else
-            dyStringAppendN(dyRecord, line, lineLen);
-        dyStringAppendC(dyRecord,'\n');
-        }
-
-    // Skip comments
-    if (*clippedText == '#')
-        {
-        if (startsWith("#EOF", clippedText))
-            return FALSE;
-        else
-            continue;
-        }
-    *retTag = nextWord(&line);
-    *retVal = trimSpaces(line);
-    return TRUE;
-    }
-return FALSE;
-}
-
-struct hash *raNextStanza(struct lineFile *lf)
-// Return a hash containing next record.
-// Will ignore '#' comments and joins continued lines (ending in '\').
-// Returns NULL at end of file.  freeHash this when done.
-// Note this will free the hash keys and values as well,
-// so you'll have to cloneMem them if you want them for later.
-{
-struct hash *hash = NULL;
-char *key, *val;
-
-if (!raSkipLeadingEmptyLines(lf, NULL))
-    return NULL;
-
-while (raNextTagVal(lf, &key, &val, NULL))
-    {
-    if (hash == NULL)
-        hash = newHash(7);
-    hashAdd(hash, key, lmCloneString(hash->lm, val));
-    }
-return hash;
-}
-
-struct slPair *raNextStanzAsPairs(struct lineFile *lf)
-// Return ra stanza as an slPair list instead of a hash.  Handy to preserve the
-// order.  Will ignore '#' comments and joins continued lines (ending in '\').
-{
-struct slPair *list = NULL;
-char *key, *val;
-if (!raSkipLeadingEmptyLines(lf, NULL))
-    return NULL;
-
-while (raNextTagVal(lf, &key, &val, NULL))
-    {
-    slPairAdd(&list, key, cloneString(val)); // key gets cloned by slPairAdd
-    }
-
-slReverse(&list);
-return list;
-}
-
-struct slPair *raNextStanzaLinesAndUntouched(struct lineFile *lf)
-// Return list of lines starting from current position, up through last line of next stanza.
-// May return a few blank/comment lines at end with no real stanza.
-// Will join continuation lines, allocating memory as needed.
-// returns pairs with name=joined line and if joined,
-// val will contain raw lines '\'s and linefeeds, else val will be NULL.
-{
-struct slPair *pairs = NULL;
-boolean stanzaStarted = FALSE;
-char *line, *raw;
-int lineLen,rawLen;
-while (lineFileNextFull(lf, &line, &lineLen, &raw, &rawLen)) // Joins continuation lines
-    {
-    char *clippedText = skipLeadingSpaces(line);
-
-    if (stanzaStarted && clippedText[0] == 0)
-        {
-        lineFileReuse(lf);
-        break;
-        }
-    if (!stanzaStarted && clippedText[0] != 0 && clippedText[0] != '#')
-        stanzaStarted = TRUE; // Comments don't start stanzas and may be followed by blanks
-
-    slPairAdd(&pairs, line,(raw != NULL ? cloneString(raw) : NULL));
-    }
-slReverse(&pairs);
-return pairs;
-}
-
-struct hash *raFromString(char *string)
-/* Return hash of key/value pairs from string.
- * As above freeHash this when done. */
-{
-char *dupe = cloneString(string);
-char *s = dupe, *lineEnd;
-struct hash *hash = newHash(7);
-char *key, *val;
-
-for (;;)
-    {
-    s = skipLeadingSpaces(s);
-    if (s == NULL || s[0] == 0)
-        break;
-    lineEnd = strchr(s, '\n');
-    if (lineEnd != NULL)
-        *lineEnd++ = 0;
-    key = nextWord(&s);
-    val = skipLeadingSpaces(s);
-    s = lineEnd;
-    val = lmCloneString(hash->lm, val);
-    hashAdd(hash, key, val);
-    }
-freeMem(dupe);
-return hash;
-}
-
-char *raFoldInOneRetName(struct lineFile *lf, struct hash *hashOfHash)
-/* Fold in one record from ra file into hashOfHash.
- * This will add ra's and ra fields to whatever already
- * exists in the hashOfHash,  overriding fields of the
- * same name if they exist already. */
-{
-char *word, *line, *name;
-struct hash *ra;
-struct hashEl *hel;
-
-/* Get first nonempty non-comment line and make sure
- * it contains name. */
-if (!lineFileNextFullReal(lf, &line))
-    return NULL;
-word = nextWord(&line);
-if (!sameString(word, "name"))
-    errAbort("Expecting 'name' line %d of %s, got %s",
-             lf->lineIx, lf->fileName, word);
-name = nextWord(&line);
-if (name == NULL)
-    errAbort("Short name field line %d of %s", lf->lineIx, lf->fileName);
-
-/* Find ra hash associated with name, making up a new
- * one if need be. */
-if ((ra = hashFindVal(hashOfHash, name)) == NULL)
-    {
-    ra = newHash(7);
-    hashAdd(hashOfHash, name, ra);
-    hashAdd(ra, "name", lmCloneString(ra->lm, name));
-    }
-
-/* Fill in fields of ra hash with data up to next
- * blank line or end of file. */
-for (;;)
-    {
-    if (!lineFileNextFull(lf, &line, NULL,NULL,NULL)) // Not using FullReal to detect end of stanza
-        break;
-    line = skipLeadingSpaces(line);
-    if (line[0] == 0)
-        break;                                        // End of stanza detected
-    if (line[0] == '#')
-        continue;
-    word = nextWord(&line);
-    line = skipLeadingSpaces(line);
-    if (line == NULL)
-        line = "";
-    hel = hashLookup(ra, word);
-    if (hel == NULL)
-        hel = hashAdd(ra, word, lmCloneString(ra->lm, line));
-    else
-        hel->val = lmCloneString(ra->lm, line);
-    }
-return hashFindVal(ra, "name");
-}
-
-boolean raFoldInOne(struct lineFile *lf, struct hash *hashOfHash)
-{
-return raFoldInOneRetName(lf, hashOfHash) != NULL;
-}
-
-void raFoldIn(char *fileName, struct hash *hashOfHash)
-/* Read ra's in file name and fold them into hashOfHash.
- * This will add ra's and ra fields to whatever already
- * exists in the hashOfHash,  overriding fields of the
- * same name if they exist already. */
-{
-struct lineFile *lf = lineFileMayOpen(fileName, TRUE);
-if (lf != NULL)
-    {
-    struct hash *uniqHash = hashNew(0);
-    char *name;
-    while ((name = raFoldInOneRetName(lf, hashOfHash)) != NULL)
-	{
-	if (hashLookup(uniqHash, name))
-            errAbort("%s duplicated in record ending line %d of %s", name,
-                     lf->lineIx, lf->fileName);
-	hashAdd(uniqHash, name, NULL);
-	}
-    lineFileClose(&lf);
-    hashFree(&uniqHash);
-    }
-}
-
-struct hash *raReadSingle(char *fileName)
-/* Read in first ra record in file and return as hash. */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct hash *hash = raNextRecord(lf);
-lineFileClose(&lf);
-return hash;
-}
-
-struct hash *raReadAll(char *fileName, char *keyField)
-/* Return hash that contains all ra records in file keyed
- * by given field, which must exist.  The values of the
- * hash are themselves hashes. */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct hash *bigHash = hashNew(0);
-struct hash *hash;
-while ((hash = raNextRecord(lf)) != NULL)
-    {
-    char *key = hashFindVal(hash, keyField);
-    if (key == NULL)
-        errAbort("Couldn't find key field %s line %d of %s",
-		keyField, lf->lineIx, lf->fileName);
-    hashAdd(bigHash, key, hash);
-    }
-lineFileClose(&lf);
-return bigHash;
-}
-
-struct hash *raReadWithFilter(char *fileName, char *keyField,char *filterKey,char *filterValue)
-/* Return hash that contains all filtered ra records in file keyed by given field, which must exist.
- * The values of the hash are themselves hashes.  The filter is a key/value pair that must exist.
- * Example raReadWithFilter(file,"term","type","antibody"): returns hash of hashes of every term with type=antibody */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct hash *bigHash = hashNew(14);
-struct hash *hash;
-while ((hash = raNextRecord(lf)) != NULL)
-    {
-    char *key = hashFindVal(hash, keyField);
-    if (key == NULL)
-        errAbort("Couldn't find key field %s line %d of %s",
-                 keyField, lf->lineIx, lf->fileName);
-    if (filterKey != NULL)
-        {
-        char *filter = hashFindVal(hash, filterKey);
-        if (filter == NULL)
-            {
-            hashFree(&hash);
-            continue;
-            }
-        if (filterValue != NULL && differentString(filterValue,filter))
-            {
-            hashFree(&hash);
-            continue;
-            }
-        }
-    hashAdd(bigHash, key, hash);
-    }
-lineFileClose(&lf);
-if (hashNumEntries(bigHash) == 0)
-    hashFree(&bigHash);
-return bigHash;
-}
-
-struct hash *raReadThreeLevels(char *fileName, char *lowKeyField, char *middleKeyField)
-/* Return 3 level hash that contains all ra records in file keyed by lowKeyField, which must exist.
- * and broken into sub hashes based upon middleKeyField that must exist.
- * Example raReadThreeLevels("cv.ra","term","type"):
- *         returns hash of 'type' hashes of 'term' hashes of every stanza in cv.ra */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct hash *topHash = hashNew(0); // Not expecting that many types
-struct hash *bottomHash;
-while ((bottomHash = raNextRecord(lf)) != NULL)
-    {
-    char *lowKey = hashFindVal(bottomHash, lowKeyField);
-    if (lowKey == NULL)
-        errAbort("Couldn't find key field %s line %d of %s",
-                 lowKeyField, lf->lineIx, lf->fileName);
-
-    char *middleKey = hashFindVal(bottomHash, middleKeyField);
-    if (middleKey == NULL)
-        errAbort("Couldn't find middle key field %s line %d of %s",
-                 middleKeyField, lf->lineIx, lf->fileName);
-
-    struct hash *middleHash = hashFindVal(topHash, middleKey);
-    if (middleHash == NULL)
-        {
-        middleHash = hashNew(16); // could be quite a few terms per type.
-        hashAdd(topHash, middleKey, middleHash);
-        }
-    hashAdd(middleHash, lowKey, bottomHash);
-    }
-lineFileClose(&lf);
-if (hashNumEntries(topHash) == 0)
-    hashFree(&topHash);
-return topHash;
-}
-
-struct hash *raTagVals(char *fileName, char *tag)
-/* Return a hash of all values of given tag seen in any stanza of ra file. */
-{
-struct hash *hash = hashNew(0);
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *line;
-while (lineFileNextFullReal(lf, &line))
-    {
-    char *word = nextWord(&line);
-    if (sameString(word, tag))
-        {
-	char *val = trimSpaces(line);
-	if (!hashLookup(hash, val))
-	    hashAdd(hash, val, NULL);
-	}
-    }
-lineFileClose(&lf);
-return hash;
-}
diff --git a/gbtools/src/blatSrc/lib/raToStruct.c b/gbtools/src/blatSrc/lib/raToStruct.c
deleted file mode 100644
index 7f108ec..0000000
--- a/gbtools/src/blatSrc/lib/raToStruct.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/* raToStruct - stuff to help read ra files into C structures.  Works with raToStructGen
- * which makes parsers based on .as files. */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "linefile.h"
-#include "raToStruct.h"
-#include "obscure.h"
-
-struct raToStructReader *raToStructReaderNew(char *name,  int fieldCount, char **fields,  
-    int requiredFieldCount, char **requiredFields)
-/* Create a helper object for parsing an ra file into a C structure.  This structure will
- * contain */
-{
-struct raToStructReader *reader;
-AllocVar(reader);
-reader->name = cloneString(name);
-reader->fieldCount = fieldCount;
-reader->fields = fields;
-reader->requiredFieldCount = requiredFieldCount;
-reader->requiredFields = requiredFields;
-struct hash *fieldIds = reader->fieldIds = hashNew(4);
-int i;
-for (i=0; i<fieldCount; ++i)
-    hashAddInt(fieldIds, fields[i], i);
-if (requiredFieldCount > 0)
-    {
-    AllocArray(reader->requiredFieldIds, requiredFieldCount);
-    for (i=0; i<requiredFieldCount; ++i)
-        {
-	char *required = requiredFields[i];
-	struct hashEl *hel = hashLookup(fieldIds, required);
-	if (hel == NULL)
-	    errAbort("Required field %s is not in field list", required);
-	reader->requiredFieldIds[i] = ptToInt(hel->val);
-	}
-    }
-AllocArray(reader->fieldsObserved, fieldCount);
-return reader;
-}
-
-void raToStructReaderFree(struct raToStructReader **pReader)
-/* Free up memory associated with reader. */
-{
-struct raToStructReader *reader = *pReader;
-if (reader != NULL)
-    {
-    freeMem(reader->name);
-    freeHash(&reader->fieldIds);
-    freeMem(reader->fieldIds);
-    freeMem(reader->fieldsObserved);
-    freez(pReader);
-    }
-}
-
-void raToStructReaderCheckRequiredFields(struct raToStructReader *reader, struct lineFile *lf)
-/* Make sure that all required files have been seen in the stanza we just parsed. */
-{
-int *requiredFieldIds = reader->requiredFieldIds;
-bool *fieldsObserved = reader->fieldsObserved;
-int i;
-for (i=0; i<reader->requiredFieldCount; ++i)
-    {
-    if (!fieldsObserved[requiredFieldIds[i]])
-	{
-	errAbort("Required field %s not found line %d of %s", reader->requiredFields[i],
-	    lf->lineIx, lf->fileName);
-	}
-    }
-}
-
-void raToStructArraySignedSizer(struct lineFile *lf, int curSize, int *pSize, char *fieldName)
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-{
-int oldSize = *pSize;
-if (oldSize == 0)
-    *pSize = curSize;
-else if (curSize != oldSize)
-    errAbort("Array dimension mismatch between %s and another field in stanza ending line %d of %s",
-	fieldName, lf->lineIx, lf->fileName);
-}
-
-void raToStructArrayUnsignedSizer(struct lineFile *lf, unsigned curSize, 
-    unsigned *pSize, char *fieldName)
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-{
-unsigned oldSize = *pSize;
-if (oldSize == 0)
-    *pSize = curSize;
-else if (curSize != oldSize)
-    errAbort("Array dimension mismatch between %s and another field in stanza ending line %d of %s",
-	fieldName, lf->lineIx, lf->fileName);
-}
-
-void raToStructArrayShortSizer(struct lineFile *lf, short curSize, 
-    short *pSize, char *fieldName)
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-{
-short oldSize = *pSize;
-if (oldSize == 0)
-    *pSize = curSize;
-else if (curSize != oldSize)
-    errAbort("Array dimension mismatch between %s and another field in stanza ending line %d of %s",
-	fieldName, lf->lineIx, lf->fileName);
-}
-
-void raToStructArrayUshortSizer(struct lineFile *lf, unsigned short curSize, 
-    unsigned short *pSize, char *fieldName)
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-{
-unsigned short oldSize = *pSize;
-if (oldSize == 0)
-    *pSize = curSize;
-else if (curSize != oldSize)
-    errAbort("Array dimension mismatch between %s and another field in stanza ending line %d of %s",
-	fieldName, lf->lineIx, lf->fileName);
-}
-
-void raToStructArrayByteSizer(struct lineFile *lf, signed char curSize, 
-    signed char *pSize, char *fieldName)
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-{
-signed char oldSize = *pSize;
-if (oldSize == 0)
-    *pSize = curSize;
-else if (curSize != oldSize)
-    errAbort("Array dimension mismatch between %s and another field in stanza ending line %d of %s",
-	fieldName, lf->lineIx, lf->fileName);
-}
-
-void raToStructArrayUbyteSizer(struct lineFile *lf, unsigned char curSize, 
-    unsigned char *pSize, char *fieldName)
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-{
-unsigned char oldSize = *pSize;
-if (oldSize == 0)
-    *pSize = curSize;
-else if (curSize != oldSize)
-    errAbort("Array dimension mismatch between %s and another field in stanza ending line %d of %s",
-	fieldName, lf->lineIx, lf->fileName);
-}
-
-void raToStructArrayLongLongSizer(struct lineFile *lf, long long curSize, 
-    long long *pSize, char *fieldName)
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-{
-long long oldSize = *pSize;
-if (oldSize == 0)
-    *pSize = curSize;
-else if (curSize != oldSize)
-    errAbort("Array dimension mismatch between %s and another field in stanza ending line %d of %s",
-	fieldName, lf->lineIx, lf->fileName);
-}
-
-#ifdef NEVER
-void raToStructArrayXyzSizer(struct lineFile *lf, xyz curSize, 
-    xyz *pSize, char *fieldName)
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-{
-xyz oldSize = *pSize;
-if (oldSize == 0)
-    *pSize = curSize;
-else if (curSize != oldSize)
-    errAbort("Array dimension mismatch between %s and another field in stanza ending line %d of %s",
-	fieldName, lf->lineIx, lf->fileName);
-}
-#endif /* NEVER */
diff --git a/gbtools/src/blatSrc/lib/rainbow.c b/gbtools/src/blatSrc/lib/rainbow.c
deleted file mode 100644
index 95e8021..0000000
--- a/gbtools/src/blatSrc/lib/rainbow.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* rainbow - stuff to generate rainbow colors. 
- * This file is copyright 1984-2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "memgfx.h"
-#include "rainbow.h"
-
-struct rgbColor saturatedRainbowTable[28] = {
-/* This table was built by hand for the default Autodesk Animator palette, and then edited
- * to reduce the amount of green colors that are indistinguishable. */
-    {255, 0, 0},
-    {255, 64, 0},
-    {255, 128, 0},
-    {255, 164, 0},
-    {255, 210, 0},
-    {255, 255, 0},
-    {210, 255, 0},
-    {164, 255, 0},
-    {128, 255, 0},
-    {0, 255, 0},
-    {0, 255, 128},
-    {0, 255, 164},
-    {0, 255, 210},
-    {0, 255, 255},
-    {0, 210, 255},
-    {0, 164, 255},
-    {0, 128, 255},
-    {0, 64, 255},
-    {0, 0, 255},
-    {64, 0, 255},
-    {128, 0, 255},
-    {164, 0, 255},
-    {210, 0, 255},
-    {255, 0, 255},
-    {255, 0, 210},
-    {255, 0, 164},
-    {255, 0, 128},
-    {255, 0, 64},
-    };
-
-static struct rgbColor lightRainbowTable[28] = {
-/* This is a mixture of 1/2 white and 1/2 saturated rainbow.  It's good for rainbow
- * fringe graphs with a moderate amount of colors (up to about 10) */
-   {255,128,128},
-   {255,160,128},
-   {255,192,128},
-   {255,210,128},
-   {255,233,128},
-   {255,255,128},
-   {233,255,128},
-   {210,255,128},
-   {192,255,128},
-   {128,255,128},
-   {128,255,192},
-   {128,255,210},
-   {128,255,233},
-   {128,255,255},
-   {128,233,255},
-   {128,210,255},
-   {128,192,255},
-   {128,160,255},
-   {128,128,255},
-   {160,128,255},
-   {192,128,255},
-   {210,128,255},
-   {233,128,255},
-   {255,128,255},
-   {255,128,233},
-   {255,128,210},
-   {255,128,192},
-   {255,128,160},
-};
-
-static struct rgbColor veryLightRainbowTable[30] = {
-/* This is a mixture of 2/3 white and 1/3 saturated rainbow.  It's good for rainbow
- * fringe graphs with a lot of colors (more than 10) */
-   {255,174,174},
-   {255,191,174},
-   {255,207,174},
-   {255,223,174},
-   {255,239,174},
-   {255,255,174},
-   {239,255,174},
-   {223,255,174},
-   {207,255,174},
-   {191,255,174},
-   {174,255,174},
-   {174,255,191},
-   {174,255,207},
-   {174,255,223},
-   {174,255,239},
-   {174,255,255},
-   {174,239,255},
-   {174,223,255},
-   {174,207,255},
-   {174,191,255},
-   {174,174,255},
-   {191,174,255},
-   {207,174,255},
-   {223,174,255},
-   {239,174,255},
-   {255,174,255},
-   {255,174,239},
-   {255,174,223},
-   {255,174,207},
-   {255,174,191},
-};
-
-static struct rgbColor interpolatedHue(struct rgbColor *table, int tableSize, double pos)
-/* Given pos, a number between 0 and 1, return interpolated color, doing interpolation
- * between first and last color for numbers close to 1. */
-{
-double wrappedPos = pos - floor(pos);	/* Make it so numbers higher than 1 keep circling rainbow */
-double scaledPos = tableSize * wrappedPos;
-double startSlot = floor(scaledPos);	
-double endFactor = scaledPos - startSlot;
-double startFactor = 1.0 - endFactor;
-int startIx = startSlot;
-int endIx = startIx + 1;
-if (endIx == tableSize)
-    endIx = 0;
-
-struct rgbColor *start = table+startIx;
-struct rgbColor *end = table+endIx;
-struct rgbColor col;
-col.r = start->r * startFactor + end->r * endFactor;
-col.g = start->g * startFactor + end->g * endFactor;
-col.b = start->b * startFactor + end->b * endFactor;
-return col;
-}
-
-struct rgbColor veryLightRainbowAtPos(double pos)
-/* Given pos, a number between 0 and 1, return a light rainbow rgbColor
- * where 0 maps to red,  0.1 is orange, and 0.9 is violet and 1.0 is back to red */
-{
-return interpolatedHue(veryLightRainbowTable, ArraySize(veryLightRainbowTable), pos);
-}
-
-struct rgbColor lightRainbowAtPos(double pos)
-/* Given pos, a number between 0 and 1, return a lightish rainbow rgbColor
- * where 0 maps to red,  0.1 is orange, and 0.9 is violet and 1.0 is back to red */
-{
-return interpolatedHue(lightRainbowTable, ArraySize(lightRainbowTable), pos);
-}
-
-struct rgbColor saturatedRainbowAtPos(double pos)
-/* Given pos, a number between 0 and 1, return a saturated rainbow rgbColor
- * where 0 maps to red,  0.1 is orange, and 0.9 is violet and 1.0 is back to red */
-{
-return interpolatedHue(saturatedRainbowTable, ArraySize(saturatedRainbowTable), pos);
-}
-
diff --git a/gbtools/src/blatSrc/lib/rangeTree.c b/gbtools/src/blatSrc/lib/rangeTree.c
deleted file mode 100644
index 7e8b708..0000000
--- a/gbtools/src/blatSrc/lib/rangeTree.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/* rangeTree - This module is a way of keeping track of
- * non-overlapping ranges (half-open intervals). It is
- * based on the self-balancing rbTree code.  Use it in
- * place of a bitmap when the total number of ranges
- * is significantly smaller than the number of bits would
- * be. 
- * Beware the several static/global variables which can be
- * changed by various function calls. */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "limits.h"
-#include "localmem.h"
-#include "obscure.h"
-#include "rbTree.h"
-#include "rangeTree.h"
-
-
-int rangeCmp(void *va, void *vb)
-/* Return -1 if a before b,  0 if a and b overlap,
- * and 1 if a after b. */
-{
-struct range *a = va;
-struct range *b = vb;
-if (a->end <= b->start)
-    return -1;
-else if (b->end <= a->start)
-    return 1;
-else
-    return 0;
-}
-
-
-static void *sumInt(void *a, void *b)
-/* Local function used by rangeTreeAddValCount, which sums two ints a and b, 
- * referenced by void pointers, returning the result in a */
-{
-int *i = a, *j = b;
-*i += *j;
-return a;
-}
-
-
-struct range *rangeTreeAddVal(struct rbTree *tree, int start, int end, void *val, void *(*mergeVals)(void *existingVal, void *newVal) )
-/* Add range to tree, merging with existing ranges if need be. 
- * If this is a new range, set the value to this val.
- * If there are existing items for this range, and if mergeVals function is not null, 
- * apply mergeVals to the existing values and this new val, storing the result as the val
- * for this range (see rangeTreeAddValCount() and rangeTreeAddValList() below for examples). */
-{
-struct range *r, *existing;
-r = lmAlloc(tree->lm, sizeof(*r)); /* alloc new zeroed range */
-r->start = start;
-r->end = end;
-r->val = val;
-while ((existing = rbTreeRemove(tree, r)) != NULL)
-    {
-    r->start = min(r->start, existing->start);
-    r->end = max(r->end, existing->end);
-    if (mergeVals)
-	r->val = mergeVals(existing->val, r->val);
-    }
-rbTreeAdd(tree, r);
-return r;
-}
-
-
-struct range *rangeTreeAdd(struct rbTree *tree, int start, int end)
-/* Add range to tree, merging with existing ranges if need be. */
-{
-    return rangeTreeAddVal(tree, start, end, NULL, NULL);
-}
-
-
-struct range *rangeTreeAddValCount(struct rbTree *tree, int start, int end)
-/* Add range to tree, merging with existing ranges if need be. 
- * Set range val to count of elements in the range. Counts are pointers to 
- * ints allocated in tree localmem */
-{
-    int *a = lmAlloc(tree->lm, sizeof(*a)); /* keep the count in localmem */
-    *a = 1;
-    return rangeTreeAddVal(tree, start, end, (void *)a, sumInt);
-}
-
-
-struct range *rangeTreeAddValList(struct rbTree *tree, int start, int end, void *val)
-/* Add range to tree, merging with existing ranges if need be. 
- * Add val to the list of values (if any) in each range.
- * val must be valid argument to slCat (ie, be a struct with a 'next' pointer as its first member) */
-{
-    return rangeTreeAddVal(tree, start, end, val, slCat);
-}
-
-void rangeTreeAddToCoverageDepth(struct rbTree *tree, int start, int end)
-/* Add area from start to end to a tree that is being built up to store the
- * depth of coverage.  Recover coverage back out by looking at ptToInt(range->val)
- * on tree elements. */
-{
-struct range q;
-q.start = start;
-q.end = end;
-
-struct range *r, *existing = rbTreeFind(tree, &q);
-if (existing == NULL)
-    {
-    lmAllocVar(tree->lm, r);
-    r->start = start;
-    r->end = end;
-    r->val = intToPt(1);
-    rbTreeAdd(tree, r);
-    }
-else
-    {
-    if (existing->start <= start && existing->end >= end)
-    /* The existing one completely encompasses us */
-        {
-	/* Make a new section for the bit before start. */
-	if (existing->start < start)
-	    {
-	    lmAllocVar(tree->lm, r);
-	    r->start = existing->start;
-	    r->end = start;
-	    r->val = existing->val;
-	    existing->start = start;
-	    rbTreeAdd(tree, r);
-	    }
-	/* Make a new section for the bit after end. */
-	if (existing->end > end)
-	    {
-	    lmAllocVar(tree->lm, r);
-	    r->start = end;
-	    r->end = existing->end;
-	    r->val = existing->val;
-	    existing->end = end;
-	    rbTreeAdd(tree, r);
-	    }
-	/* Increment existing section in overlapping area. */
-        existing->val = (char *)(existing->val) + 1;
-	}
-    else
-    /* In general case fetch list of regions that overlap us. 
-       Remaining cases to handle are: 
-	     r >> e     rrrrrrrrrrrrrrrrrrrr
-			     eeeeeeeeee
-
-	     e < r           rrrrrrrrrrrrrrr
-			eeeeeeeeeeee
-
-	     r < e      rrrrrrrrrrrr
-			     eeeeeeeeeeeee
-     */
-        {
-	struct range *existingList = rangeTreeAllOverlapping(tree, start, end);
-
-#ifdef DEBUG
-	/* Make sure that list is really sorted for debugging... */
-	int lastStart = existingList->start;
-	for (r = existingList; r != NULL; r = r->next)
-	    {
-	    int start = r->start;
-	    if (start < lastStart)
-	        internalErr();
-	    }
-#endif /* DEBUG */
-
-	int s = start, e = end;
-	for (existing = existingList; existing != NULL; existing = existing->next)
-	    {
-	    /* Deal with start of new range that comes before existing */
-	    if (s < existing->start)
-	        {
-		lmAllocVar(tree->lm, r);
-		r->start = s;
-		r->end = existing->start;
-		r->val = intToPt(1);
-		s = existing->start;
-		rbTreeAdd(tree, r);
-		}
-	    else if (s > existing->start)
-	        {
-		lmAllocVar(tree->lm, r);
-		r->start = existing->start;
-		r->end = s;
-		r->val = existing->val;
-		existing->start = s;
-		rbTreeAdd(tree, r);
-		}
-	    existing->val = (char *)(existing->val) + 1;
-	    s = existing->end;
-	    }
-	if (s < e)
-	/* Deal with end of new range that doesn't overlap with anything. */
-	    {
-	    lmAllocVar(tree->lm, r);
-	    r->start = s;
-	    r->end = e;
-	    r->val = intToPt(1);
-	    rbTreeAdd(tree, r);
-	    }
-	}
-    }
-
-}
-
-boolean rangeTreeOverlaps(struct rbTree *tree, int start, int end)
-/* Return TRUE if start-end overlaps anything in tree */
-{
-struct range tempR;
-tempR.start = start;
-tempR.end = end;
-tempR.val = NULL;
-return rbTreeFind(tree, &tempR) != NULL;
-}
-
-static struct range *rangeList;
-
-static void rangeListAdd(void *v)
-/* Callback to add item to range list. */
-{
-struct range *r = v;
-slAddHead(&rangeList, r);
-}
-
-struct range *rangeTreeList(struct rbTree *tree)
-/* Return list of all ranges in tree in order.  Not thread safe. 
- * No need to free this when done, memory is local to tree. */
-{
-rangeList = NULL;
-rbTreeTraverse(tree, rangeListAdd);
-slReverse(&rangeList);
-return rangeList;
-}
-
-struct range *rangeTreeFindEnclosing(struct rbTree *tree, int start, int end)
-/* Find item in range tree that encloses range between start and end 
- * if there is any such item. */
-{
-struct range tempR, *r;
-tempR.start = start;
-tempR.end = end;
-r = rbTreeFind(tree, &tempR);
-if (r != NULL && r->start <= start && r->end >= end)
-    {
-    r->next = NULL; /* this can be set by previous calls to the List functions */
-    return r;
-    }
-return NULL;
-}
-
-struct range *rangeTreeAllOverlapping(struct rbTree *tree, int start, int end)
-/* Return list of all items in range tree that overlap interval start-end.
- * Do not free this list, it is owned by tree.  However it is only good until
- * next call to rangeTreeFindInRange or rangeTreeList. Not thread safe. */
-{
-struct range tempR;
-tempR.start = start;
-tempR.end = end;
-rangeList = NULL;
-rbTreeTraverseRange(tree, &tempR, &tempR, rangeListAdd);
-slReverse(&rangeList);
-return rangeList;
-}
-
-
-struct range *rangeTreeMaxOverlapping(struct rbTree *tree, int start, int end)
-/* Return item that overlaps most with start-end. Not thread safe.  Trashes list used
- * by rangeTreeAllOverlapping. */
-{
-struct range *range, *best = NULL;
-int bestOverlap = 0; 
-for (range  = rangeTreeAllOverlapping(tree, start, end); range != NULL; range = range->next)
-    {
-    int overlap = rangeIntersection(range->start, range->end, start, end);
-    if (overlap > bestOverlap)
-        {
-	bestOverlap = overlap;
-	best = range;
-	}
-    }
-if (best)
-    best->next = NULL; /* could be set by calls to List functions */
-return best;
-}
-
-/* A couple of variables used to calculate total overlap. */
-static int totalOverlap;
-static int overlapStart, overlapEnd;
-
-static void addOverlap(void *v)
-/* Callback to add item to range list. */
-{
-struct range *r = v;
-totalOverlap += positiveRangeIntersection(r->start, r->end, 
-	overlapStart, overlapEnd);
-}
-
-int rangeTreeOverlapSize(struct rbTree *tree, int start, int end)
-/* Return the total size of intersection between interval
- * from start to end, and items in range tree. Sadly not
- * thread-safe. 
- * On 32 bit machines be careful not to overflow
- * range of start, end or total size return value. */
-{
-struct range tempR;
-tempR.start = overlapStart = start;
-tempR.end = overlapEnd = end;
-totalOverlap = 0;
-rbTreeTraverseRange(tree, &tempR, &tempR, addOverlap);
-return totalOverlap;
-}
-
-int rangeTreeOverlapTotalSize(struct rbTree *tree)
-/* Return the total size of all ranges in range tree.
- * Sadly not thread-safe. 
- * On 32 bit machines be careful not to overflow
- * range of start, end or total size return value. */
-{
-return rangeTreeOverlapSize(tree, INT_MIN, INT_MAX);
-}
-
-void rangeTreeSumRangeCallback(void *item, void *context)
-/* This is a callback for rbTreeTraverse with context.  It just adds up
- * end-start */
-{
-struct range *range = item;
-long long *pSum = context;
-*pSum += range->end - range->start;
-}
-
-long long rangeTreeSumRanges(struct rbTree *tree)
-/* Return sum of end-start of all items. */
-{
-long long sum = 0;
-rbTreeTraverseWithContext(tree, rangeTreeSumRangeCallback, &sum);
-return sum;
-}
-
-
-struct rbTree *rangeTreeNew()
-/* Create a new, empty, rangeTree. */
-{
-return rbTreeNew(rangeCmp);
-}
-
-struct rbTree *rangeTreeNewDetailed(struct lm *lm, struct rbTreeNode *stack[128])
-/* Allocate rangeTree on an existing local memory & stack.  This is for cases
- * where you want a lot of trees, and don't want the overhead for each one. 
- * Note, to clean these up, just do freez(&rbTree) rather than rbFreeTree(&rbTree). */
-{
-return rbTreeNewDetailed(rangeCmp, lm, stack);
-}
-
diff --git a/gbtools/src/blatSrc/lib/rbTree.c b/gbtools/src/blatSrc/lib/rbTree.c
deleted file mode 100644
index 42952f8..0000000
--- a/gbtools/src/blatSrc/lib/rbTree.c
+++ /dev/null
@@ -1,740 +0,0 @@
-/* rbTree - rbTreeRed-rbTreeBlack Tree - a type of binary tree which 
- * automatically keeps relatively balanced during
- * inserts and deletions.
- *   original author: Shane Saunders
- *   adapted into local conventions: Jim Kent
- */
-
-#include "common.h"
-#include "localmem.h"
-#include "rbTree.h"
-
-
-
-static struct rbTreeNode *restructure(struct rbTree *t, int tos, 
-	struct rbTreeNode *x, struct rbTreeNode *y, struct rbTreeNode *z)
-/* General restructuring function - checks for all
- * restructuring cases.  Call when insert has messed up tree.
- * Sadly delete has to do even more work. */
-{
-struct rbTreeNode *parent, *midNode;
-
-if(y == x->left) 
-    {
-    if(z == y->left) 
-        {  /* in-order:  z, y, x */
-	midNode = y;
-	y->left = z;
-	x->left = y->right;
-	y->right = x;
-	}
-    else 
-        {  /* in-order:  y, z, x */
-	midNode = z;
-	y->right = z->left;
-	z->left = y;
-	x->left = z->right;
-	z->right = x;
-	}
-    }
-else 
-    {
-    if(z == y->left) 
-	{  /* in-order:  x, z, y */
-	midNode = z;
-	x->right = z->left;
-	z->left = x;
-	y->left = z->right;
-	z->right = y;
-	}
-    else 
-	{  /* in-order:  x, y, z */
-	midNode = y;
-	x->right = y->left;
-	y->left = x;
-	y->right = z;
-	}
-    }
-if(tos != 0) 
-    {
-    parent = t->stack[tos-1];
-    if(x == parent->left) 
-	parent->left = midNode;
-    else 
-	parent->right = midNode;
-    }
-else 
-    t->root = midNode;
-
-return midNode;
-}
-
-struct rbTree *rbTreeNewDetailed(int (*compare)(void *, void *), struct lm *lm, 
-	struct rbTreeNode *stack[128])
-/* Allocate rbTree on an existing local memory & stack.  This is for cases
- * where you want a lot of trees, and don't want the overhead for each one. 
- * Note, to clean these up, just do freez(&rbTree) rather than rbFreeTree(&rbTree). */
-{
-struct rbTree *t;
-AllocVar(t);
-t->root = NULL;
-t->compare = compare;
-t->lm = lm;
-t->stack = stack;	
-t->n = 0;
-return t;
-}
-
-struct rbTree *rbTreeNew(int (*compare)(void *, void *))
-/* rbTreeNew() - Allocates space for a red-black tree and returns a pointer
- * to it.  The function compare compares they keys of two items, and returns a
- * negative, zero, or positive integer depending on whether the first item is
- * less than, equal to, or greater than the second.  */
-{
-/* The stack keeps us from having to keep explicit
- * parent, grandparent, greatgrandparent variables.
- * It needs to be big enough for the maximum depth
- * of tree.  Since the whole point of rb trees is
- * that they are self-balancing, this is not all
- * that deep, just 2*log2(N).  Therefore a stack of
- * 128 is good for up to 2^64 items in stack, which
- * should keep us for the next couple of decades... */
-struct lm *lm = lmInit(0);
-struct rbTreeNode **stack = lmAlloc(lm, 128 * sizeof(stack[0]));	
-return rbTreeNewDetailed(compare, lm, stack);
-}
-
-
-void rbTreeFree(struct rbTree **pTree)
-/* rbTreeFree() - Frees space used by the red-black tree pointed to by t. */
-{
-struct rbTree *tree = *pTree;
-if (tree != NULL)
-    {
-    lmCleanup(&tree->lm);
-    freez(pTree);
-    }
-}
-
-void rbTreeFreeList(struct rbTree **pList)
-/* Free up a list of rbTrees. */
-{
-struct rbTree *tree, *next;
-for (tree = *pList; tree != NULL; tree = next)
-    {
-    next = tree->next;
-    rbTreeFree(&tree);
-    }
-}
-
-void *rbTreeAdd(struct rbTree *t, void *item)
-/* rbTreeAdd() - Inserts an item into the red-black tree pointed to by t,
- * according the the value its key.  The key of an item in the red-black
- * tree must be unique among items in the tree.  If an item with the same key
- * already exists in the tree, a pointer to that item is returned.  Otherwise,
- * NULL is returned, indicating insertion was successful.
- */
-{
-struct rbTreeNode *x, *p, *q, *m, **attachX;
-int (* compare)(void *, void *);
-int cmpResult;
-rbTreeColor col;
-struct rbTreeNode **stack = NULL;
-int tos;
-
-tos = 0;    
-if((p = t->root) != NULL) 
-    {
-    compare = t->compare;
-    stack = t->stack;
-
-    /* Repeatedly explore either the left branch or the right branch
-     * depending on the value of the key, until an empty branch is chosen.
-     */
-    for(;;) 
-        {
-	stack[tos++] = p;
-	cmpResult = compare(item, p->item);
-	if(cmpResult < 0) 
-	    {
-	    p = p->left;
-	    if(!p) 
-	        {
-		p = stack[--tos];
-		attachX = &p->left;
-		break;
-		}
-	    }
-	else if(cmpResult > 0) 
-	    {
-	    p = p->right;
-	    if(!p) 
-	        {
-		p = stack[--tos];
-		attachX = &p->right;
-		break;
-		}
-	    }
-	else 
-	    {
-	    return p->item;
-	    }
-	}
-    col = rbTreeRed;
-    }
-else 
-    {
-    attachX = &t->root;
-    col = rbTreeBlack;
-    }
-
-/* Allocate new node and place it in tree. */
-if ((x = t->freeList) != NULL)
-    t->freeList = x->right;
-else
-    lmAllocVar(t->lm, x);
-x->left = x->right = NULL;
-x->item = item;
-x->color = col;
-*attachX = x;
-t->n++;
-
-/* Restructuring or recolouring will be needed if node x and its parent, p,
- * are both red.
- */
-if(tos > 0) 
-    {
-    while(p->color == rbTreeRed) 
-	{  /* Double red problem. */
-
-	/* Obtain a pointer to p's parent, m, and sibling, q. */
-	m = stack[--tos];
-	q = p == m->left ? m->right : m->left;
-	
-	/* Determine whether restructuring or recolouring is needed. */
-	if(!q || q->color == rbTreeBlack) 
-	    {
-	    /* Sibling is black.  ==>  Perform restructuring. */
-	    
-	    /* Restructure according to the left to right order, of nodes
-	     * m, p, and x.
-	     */
-	    m = restructure(t, tos, m, p, x);
-	    m->color = rbTreeBlack;
-	    m->left->color = m->right->color = rbTreeRed;
-
-	    /* Restructuring eliminates the double red problem. */
-	    break;
-	    }
-	/* else just need to flip color */
-	
-	/* Sibling is also red.  ==>  Perform recolouring. */
-	p->color = rbTreeBlack;
-	q->color = rbTreeBlack;
-
-	if(tos == 0) break;  /* The root node always remains black. */
-	    
-	m->color = rbTreeRed;
-
-	/* Continue, checking colouring higher up. */
-	x = m;
-	p = stack[--tos];
-	}
-    }
-
-return NULL;
-}
-
-
-void *rbTreeFind(struct rbTree *t, void *item)
-/* rbTreeFind() - Find an item in the red-black tree with the same key as the
- * item pointed to by `item'.  Returns a pointer to the item found, or NULL
- * if no item was found.
- */
-{
-struct rbTreeNode *p, *nextP;
-int (*compare)(void *, void *) = t->compare;
-int cmpResult;
-    
-/* Repeatedly explore either the left or right branch, depending on the
- * value of the key, until the correct item is found.  */
-for (p = t->root; p != NULL; p = nextP)
-    {
-    cmpResult = compare(item, p->item);
-    if(cmpResult < 0) 
-	nextP = p->left;
-    else if(cmpResult > 0) 
-	nextP = p->right;
-    else 
-	return p->item;
-    }
-return NULL;
-}
-
-
-void *rbTreeRemove(struct rbTree *t, void *item)
-/* rbTreeRemove() - Delete an item in the red-black tree with the same key as
- * the item pointed to by `item'.  Returns a pointer to the deleted item,
- * and NULL if no item was found.
- */
-{
-struct rbTreeNode *p, *r, *x, *y, *z, *b, *newY;
-struct rbTreeNode *m;
-rbTreeColor removeCol;
-void *returnItem;
-int (* compare)(void *, void *);
-int cmpResult;
-struct rbTreeNode **stack;
-int i, tos;
-
-
-/* Attempt to locate the item to be deleted. */
-if((p = t->root)) 
-    {
-    compare = t->compare;
-    stack = t->stack;
-    tos = 0;
-    
-    for(;;) 
-	{
-	stack[tos++] = p;
-	cmpResult = compare(item, p->item);
-	if(cmpResult < 0) 
-	    p = p->left;
-	else if(cmpResult > 0) 
-	    p = p->right;
-	else 
-	    /* Item found. */
-	    break;
-	if(!p) return NULL;
-	}
-    }
-else 
-    return NULL;
-
-/* p points to the node to be deleted, and is currently on the top of the
- * stack.
- */
-if(!p->left) 
-    {
-    tos--;  /* Adjust tos to remove p. */
-    /* Right child replaces p. */
-    if(tos == 0) 
-	{
-	r = t->root = p->right;
-	x = y = NULL;
-	}
-    else 
-	{
-	x = stack[--tos];
-	if(p == x->left) 
-	    {
-	    r = x->left = p->right;
-	    y = x->right;
-	    }
-	else 
-	    {
-	    r = x->right = p->right;
-	    y = x->left;
-	    }
-	}
-    removeCol = p->color;
-    }
-else if(!p->right) 
-    {
-    tos--;  /* Adjust tos to remove p. */
-    /* Left child replaces p. */
-    if(tos == 0) 
-	{
-	r = t->root = p->left;
-	x = y = NULL;
-	}
-    else 
-	{
-	x = stack[--tos];
-	if(p == x->left) 
-	    {
-	    r = x->left = p->left;
-	    y = x->right;
-	    }
-	else 
-	    {
-	    r = x->right = p->left;
-	    y = x->left;
-	    }
-	}
-    removeCol = p->color;
-    }
-else 
-    {
-    /* Save p's stack position. */
-    i = tos-1;
-    
-    /* Minimum child, m, in the right subtree replaces p. */
-    m = p->right;
-    do 
-	{
-	stack[tos++] = m;
-	m = m->left;
-	} while(m);
-    m = stack[--tos];
-
-    /* Update either the left or right child pointers of p's parent. */
-    if(i == 0) 
-	{
-	t->root = m;
-	}
-    else 
-	{
-	x = stack[i-1];  /* p's parent. */
-	if(p == x->left) 
-	    {
-	    x->left = m;
-	    }
-	else 
-	    {
-	    x->right = m;
-	    }
-	}
-    
-    /* Update the tree part m is removed from, and assign m the child
-     * pointers of p (only if m is not the right child of p).
-     */
-    stack[i] = m;  /* Node m replaces node p on the stack. */
-    x = stack[--tos];
-    r = m->right;
-    if(tos != i) 
-	{  /* x is equal to the parent of m. */
-	y = x->right;
-	x->left = r;
-	m->right = p->right;
-	}
-    else 
-	{ /* m was the right child of p, and x is equal to m. */
-	y = p->left;
-	}
-    m->left = p->left;
-
-    /* We treat node m as the node which has been removed. */
-    removeCol = m->color;
-    m->color = p->color;
-    }
-
-/* Get return value and reuse the space used by node p. */
-returnItem = p->item;
-p->right = t->freeList;
-t->freeList = p;
-
-t->n--;
-
-/* The pointers x, y, and r point to nodes which may be involved in
- * restructuring and recolouring.
- *  x - the parent of the removed node.
- *  y - the sibling of the removed node.
- *  r - the node which replaced the removed node.
- * From the above code, the next entry off the stack will be the parent of
- * node x.
- */
-
-/* The number of black nodes on paths to all external nodes (NULL child
- * pointers) must remain the same for all paths.  Restructuring or
- * recolouring of nodes may be necessary to enforce this.
- */
-if(removeCol == rbTreeBlack) 
-    {
-    /* Removal of a black node requires some adjustment. */
-    
-    if(!r || r->color == rbTreeBlack) 
-	{
-	/* A black node replaced the deleted black node.  Note that
-	 * external nodes (NULL child pointers) are always black, so
-	 * if r is NULL it is treated as a black node.
-	 */
-
-	/* This causes a double-black problem, since node r would need to
-	 * be coloured double-black in order for the black color on
-	 * paths through r to remain the same as for other paths.
-	 */
-
-	/* If r is the root node, the double-black color is not necessary
-	 * to maintain the color balance.  Otherwise, some adjustment of
-	 * nearby nodes is needed in order to eliminate the double-black
-	 * problem.  NOTE:  x points to the parent of r.
-	 */
-	if(x) for(;;) 
-	    {
-
-	    /* There are three adjustment cases:
-	     *  1.  r's sibling, y, is black and has a red child, z.
-	     *  2.  r's sibling, y, is black and has two black children.
-	     *  3.  r's sibling, y, is red.
-	     */
-	    if(y->color == rbTreeBlack) 
-		{
-
-		/* Note the conditional evaluation for assigning z. */
-		if(((z = y->left) && z->color == rbTreeRed) ||
-		   ((z = y->right) && z->color == rbTreeRed)) 
-		       {		    
-		    /* Case 1:  perform a restructuring of nodes x, y, and
-		     * z.
-		     */
-		    
-		    b = restructure(t, tos, x, y, z);
-		    b->color = x->color;
-		    b->left->color = b->right->color = rbTreeBlack;
-		    
-		    break;
-		    }
-		else 
-		    {
-		    /* Case 2:  recolour node y red. */
-		    
-		    y->color = rbTreeRed;
-		    
-		    if(x->color == rbTreeRed) 
-			{
-			x->color = rbTreeBlack;
-			break;
-			}
-		    /* else */
-
-		    if(tos == 0) break;  /* Root level reached. */
-		    /* else */
-		    
-		    r = x;
-		    x = stack[--tos];  /* x <- parent of x. */
-		    y = x->left == r ? x->right : x->left;
-		    }
-		}
-	    else 
-		{
-		/* Case 3:  Restructure nodes x, y, and z, where:
-		 *  - If node y is the left child of x, then z is the left
-		 *    child of y.  Otherwise z is the right child of y.
-		 */
-		if(x->left == y) 
-		    {
-		    newY = y->right;
-		    z = y->left;
-		    }
-		else 
-		    {
-		    newY = y->left;
-		    z = y->right;
-		    }
-		
-		restructure(t, tos, x, y, z);
-		y->color = rbTreeBlack;
-		x->color = rbTreeRed;
-
-		/* Since x has moved down a place in the tree, and y is the
-		 * new the parent of x, the stack must be adjusted so that
-		 * the parent of x is correctly identified in the next call
-		 * to restructure().
-		 */
-		stack[tos++] = y;
-
-		/* After restructuring, node r has a black sibling, newY,
-		 * so either case 1 or case 2 applies.  If case 2 applies
-		 * the double-black problem does not reappear.
-		 */
-		y = newY;
-		
-		/* Note the conditional evaluation for assigning z. */
-		if(((z = y->left) && z->color == rbTreeRed) ||
-		   ((z = y->right) && z->color == rbTreeRed)) 
-		   {		    
-		    /* Case 1:  perform a restructuring of nodes x, y, and
-		     * z.
-		     */
-		    
-		    b = restructure(t, tos, x, y, z);
-		    b->color = rbTreeRed;  /* Since node x was red. */
-		    b->left->color = b->right->color = rbTreeBlack;
-		    }
-		else 
-		    {
-		    /* Case 2:  recolour node y red. */
-
-		    /* Note that node y is black and node x is red. */
-		    
-		    y->color = rbTreeRed;
-		    x->color = rbTreeBlack;
-		    }
-
-		break;
-		}
-	    }
-	}
-    else 
-	{
-	/* A red node replaced the deleted black node. */
-
-	/* In this case we can simply color the red node black. */
-	r->color = rbTreeBlack;
-	}
-    }
-return returnItem;
-}
-
-/* Some variables to help recursively dump tree. */
-static int dumpLevel;	/* Indentation level. */
-static FILE *dumpFile;  /* Output file */
-static void (*dumpIt)(void *item, FILE *f);  /* Item dumper. */
-
-static void rTreeDump(struct rbTreeNode *n)
-/* Recursively dump. */
-{
-if (n == NULL)
-    return;
-spaceOut(dumpFile, ++dumpLevel * 3);
-fprintf(dumpFile, "%c ", (n->color ==  rbTreeRed ? 'r' : 'b'));
-dumpIt(n->item, dumpFile);
-fprintf(dumpFile, "\n");
-rTreeDump(n->left);
-rTreeDump(n->right);
---dumpLevel;
-}
-
-void rbTreeDump(struct rbTree *tree, FILE *f, 
-	void (*dumpItem)(void *item, FILE *f))
-/* Dump out rb tree to file, mostly for debugging. */
-{
-dumpFile = f;
-dumpLevel = 0;
-dumpIt = dumpItem;
-fprintf(f, "rbTreeDump\n");
-rTreeDump(tree->root);
-}
-
-
-
-/* Variables to help recursively traverse tree. */
-static void (*doIt)(void *item);
-static void *minIt, *maxIt;
-static int (*compareIt)(void *, void *);
-
-static void rTreeTraverseRange(struct rbTreeNode *n)
-/* Recursively traverse tree in range applying doIt. */
-{
-if (n != NULL)
-   {
-   int minCmp = compareIt(n->item, minIt);
-   int maxCmp = compareIt(n->item, maxIt);
-   if (minCmp >= 0)
-       rTreeTraverseRange(n->left);
-   if (minCmp >= 0 && maxCmp <= 0)
-       doIt(n->item);
-   if (maxCmp <= 0)
-       rTreeTraverseRange(n->right);
-   }
-}
-
-static void rTreeTraverse(struct rbTreeNode *n)
-/* Recursively traverse full tree applying doIt. */
-{
-if (n != NULL)
-    {
-    rTreeTraverse(n->left);
-    doIt(n->item);
-    rTreeTraverse(n->right);
-    }
-}
-
-
-void rbTreeTraverseRange(struct rbTree *tree, void *minItem, void *maxItem,
-	void (*doItem)(void *item))
-/* Apply doItem function to all items in tree such that
- * minItem <= item <= maxItem */
-{
-doIt = doItem;
-minIt = minItem;
-maxIt = maxItem;
-compareIt = tree->compare;
-rTreeTraverseRange(tree->root);
-}
-
-void rbTreeTraverse(struct rbTree *tree, void (*doItem)(void *item))
-/* Apply doItem function to all items in tree */
-{
-doIt = doItem;
-rTreeTraverse(tree->root);
-}
-
-struct rTreeContext
-/* Context for traversing a tree when you want to be fully thread safe and reentrant. */
-    {
-    void *context;	/* Some context carried from user and passed to doIt. */
-    void (*doItem)(void *item, void *context);
-    };
-
-static void rTreeTraverseWithContext(struct rbTreeNode *n, struct rTreeContext *context)
-/* Traverse tree with a little context so don't need little static variables that
- * prevent reentrancy of callback functions. */
-{
-if (n != NULL)
-    {
-    rTreeTraverseWithContext(n->left, context);
-    context->doItem(n->item, context->context);
-    rTreeTraverseWithContext(n->right, context);
-    }
-}
-
-void rbTreeTraverseWithContext(struct rbTree *tree, 
-	void (*doItem)(void *item, void *context), void *context)
-/* Traverse tree calling doItem on every item with context pointer passed through to doItem.
- * This often avoids having to declare global or static variables for the doItem callback to use. */
-{
-struct rTreeContext ctx;
-ctx.context = context;
-ctx.doItem = doItem;
-rTreeTraverseWithContext(tree->root, &ctx);
-}
-
-struct slRef *itList;  /* List of items that rbTreeItemsInRange returns. */
-
-static void addRef(void *item)
-/* Add item it itList. */
-{
-refAdd(&itList, item);
-}
-
-struct slRef *rbTreeItemsInRange(struct rbTree *tree, void *minItem, void *maxItem)
-/* Return a sorted list of references to items in tree between range.
- * slFreeList this list when done. */
-{
-itList = NULL;
-rbTreeTraverseRange(tree, minItem, maxItem, addRef);
-slReverse(&itList);
-return itList;
-}
-
-static void addRefWithContext(void *item, void *context)
-/* Add item it itList. */
-{
-struct slRef **pList = context;
-refAdd(pList, item);
-}
-
-
-struct slRef *rbTreeItems(struct rbTree *tree)
-/* Return sorted list of items.  slFreeList this when done.*/
-{
-struct slRef *list = NULL;
-rbTreeTraverseWithContext(tree, addRefWithContext, &list);
-slReverse(&list);
-return list;
-}
-
-int rbTreeCmpString(void *a, void *b)
-/* Set up rbTree so as to work on strings. */
-{
-return strcmp(a, b);
-}
-
-int rbTreeCmpWord(void *a, void *b)	
-/* Set up rbTree so as to work on case-insensitive strings. */
-{
-return differentWord(a,b);
-}
diff --git a/gbtools/src/blatSrc/lib/regexHelper.c b/gbtools/src/blatSrc/lib/regexHelper.c
deleted file mode 100644
index 04e8ab5..0000000
--- a/gbtools/src/blatSrc/lib/regexHelper.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* regexHelper: easy wrappers on POSIX Extended Regular Expressions (man 7 regex, man 3 regex) */
-
-/* Copyright (C) 2012 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "regexHelper.h"
-#include "hash.h"
-
-const regex_t *regexCompile(const char *exp, const char *description, int compileFlags)
-/* Compile exp (or die with an informative-as-possible error message).
- * Cache pre-compiled regex's internally (so don't free result after use). */
-{
-static struct hash *reHash = NULL;
-struct hashEl *hel = NULL;
-char key[512];
-safef(key, sizeof(key), "%d.%s", compileFlags, exp);
-
-if (reHash == NULL)
-    reHash = newHash(10);
-hel = hashLookup(reHash, key);
-if (hel != NULL)
-    return((regex_t *)hel->val);
-else
-    {
-    regex_t *compiledExp = NULL;
-    int errNum = 0;
-    AllocVar(compiledExp);
-    errNum = regcomp(compiledExp, exp, compileFlags);
-    if (errNum != 0)
-	{
-	char errBuf[512];
-	regerror(errNum, compiledExp, errBuf, sizeof(errBuf));
-	errAbort("%s \"%s\" got regular expression compilation error %d:\n%s\n",
-		 description, exp, errNum, errBuf);
-	}
-    hashAdd(reHash, key, compiledExp);
-    return(compiledExp);
-    }
-}
-
-static boolean regexMatchSubstrMaybeCase(const char *string, const char *exp,
-					 regmatch_t substrArr[], size_t substrArrSize,
-					 boolean isCaseInsensitive)
-/* Return TRUE if string matches regular expression exp;
- * regexec fills in substrArr with substring offsets. */
-{
-if (string == NULL)
-    return FALSE;
-int compileFlags = REG_EXTENDED;
-char desc[256];
-safecpy(desc, sizeof(desc), "Regular expression");
-if (isCaseInsensitive)
-    {
-    compileFlags |= REG_ICASE;
-    safecat(desc, sizeof(desc), " (case insensitive)");
-    }
-if (substrArr == NULL)
-    compileFlags |= REG_NOSUB;
-else
-    safecat(desc, sizeof(desc), " with substrings");
-
-const regex_t *compiledExp = regexCompile(exp, desc, compileFlags);
-return(regexec(compiledExp, string, substrArrSize, substrArr, 0) == 0);
-}
-
-boolean regexMatch(const char *string, const char *exp)
-/* Return TRUE if string matches regular expression exp (case sensitive). */
-{
-return regexMatchSubstrMaybeCase(string, exp, NULL, 0, FALSE);
-}
-
-boolean regexMatchNoCase(const char *string, const char *exp)
-/* Return TRUE if string matches regular expression exp (case insensitive). */
-{
-return regexMatchSubstrMaybeCase(string, exp, NULL, 0, TRUE);
-}
-
-boolean regexMatchSubstr(const char *string, const char *exp,
-			 regmatch_t substrArr[], size_t substrArrSize)
-/* Return TRUE if string matches regular expression exp (case sensitive);
- * regexec fills in substrArr with substring offsets. */
-{
-return regexMatchSubstrMaybeCase(string, exp, substrArr, substrArrSize, FALSE);
-}
-
-boolean regexMatchSubstrNoCase(const char *string, const char *exp,
-			       regmatch_t substrArr[], size_t substrArrSize)
-/* Return TRUE if string matches regular expression exp (case insensitive);
- * regexec fills in substrArr with substring offsets. */
-{
-return regexMatchSubstrMaybeCase(string, exp, substrArr, substrArrSize, TRUE);
-}
-
diff --git a/gbtools/src/blatSrc/lib/repMask.c b/gbtools/src/blatSrc/lib/repMask.c
deleted file mode 100644
index 8fab09b..0000000
--- a/gbtools/src/blatSrc/lib/repMask.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* repMask.c was originally generated by the autoSql program, which also 
- * generated repMask.h and repMask.sql.  This module links the database and the RAM 
- * representation of objects. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "sqlList.h"
-#include "sqlNum.h"
-#include "repMask.h"
-
-
-void repeatMaskOutStaticLoad(char **row, struct repeatMaskOut *ret)
-/* Load a row from repeatMaskOut table into ret.  The contents of ret will
- * be replaced at the next call to this function. */
-{
-int i;
-
-ret->score = sqlUnsigned(row[0]);
-ret->percDiv = atof(row[1]);
-ret->percDel = atof(row[2]);
-ret->percInc = atof(row[3]);
-ret->qName = row[4];
-ret->qStart = sqlSigned(row[5]);
-ret->qEnd = sqlSigned(row[6]);
-ret->qLeft = row[7];
-strcpy(ret->strand, row[8]);
-ret->rName = row[9];
-ret->rFamily = row[10];
-ret->rStart = row[11];	/* sometimes this number is enclosed in (parens) */
-/* This row[12] is interpreted as an Unsigned - but I can find no good reason
- * for it to be an error exit when there is a negative number here.
- * The only programs that use this routine are blat, psLayout and
- * maskOutFa and none of them even use this number for anything.
- * For data base loading of the rmsk tracks, these .out files are parsed
- * by hgLoadOut and none of this business is referenced.
- */
-i = sqlSigned(row[12]);
-if( i < 0 ) {
-    warn("WARNING: negative rEnd: %d %s:%d-%d %s", i, ret->qName, ret->qStart, ret->qEnd, ret->rName);
-    ret->rEnd = 0;
-} else {
-ret->rEnd = sqlUnsigned(row[12]);
-}
-ret->rLeft = row[13];
-}
-
-struct repeatMaskOut *repeatMaskOutLoad(char **row)
-/* Load a repeatMaskOut from row fetched with select * from repeatMaskOut
- * from database.  Dispose of this with repeatMaskOutFree(). */
-{
-struct repeatMaskOut *ret;
-
-AllocVar(ret);
-ret->score = sqlUnsigned(row[0]);
-ret->percDiv = atof(row[1]);
-ret->percDel = atof(row[2]);
-ret->percInc = atof(row[3]);
-ret->qName = cloneString(row[4]);
-ret->qStart = sqlSigned(row[5]);
-ret->qEnd = sqlSigned(row[6]);
-ret->qLeft = cloneString(row[7]);
-strcpy(ret->strand, row[8]);
-ret->rName = cloneString(row[9]);
-ret->rFamily = cloneString(row[10]);
-ret->rStart = cloneString(row[11]);
-ret->rEnd = sqlUnsigned(row[12]);
-ret->rLeft = cloneString(row[13]);
-return ret;
-}
-
-struct repeatMaskOut *repeatMaskOutCommaIn(char **pS)
-/* Create a repeatMaskOut out of a comma separated string. */
-{
-struct repeatMaskOut *ret;
-char *s = *pS;
-
-AllocVar(ret);
-ret->score = sqlUnsignedComma(&s);
-ret->percDiv = sqlSignedComma(&s);
-ret->percDel = sqlSignedComma(&s);
-ret->percInc = sqlSignedComma(&s);
-ret->qName = sqlStringComma(&s);
-ret->qStart = sqlSignedComma(&s);
-ret->qEnd = sqlSignedComma(&s);
-ret->qLeft = sqlStringComma(&s);
-sqlFixedStringComma(&s, ret->strand, sizeof(ret->strand));
-ret->rName = sqlStringComma(&s);
-ret->rFamily = sqlStringComma(&s);
-ret->rStart = sqlStringComma(&s);
-ret->rEnd = sqlUnsignedComma(&s);
-ret->rLeft = sqlStringComma(&s);
-*pS = s;
-return ret;
-}
-
-void repeatMaskOutFree(struct repeatMaskOut **pEl)
-/* Free a single dynamically allocated repeatMaskOut such as created
- * with repeatMaskOutLoad(). */
-{
-struct repeatMaskOut *el;
-
-if ((el = *pEl) == NULL) return;
-freeMem(el->qName);
-freeMem(el->qLeft);
-freeMem(el->rName);
-freeMem(el->rFamily);
-freeMem(el->rStart);
-freeMem(el->rLeft);
-freez(pEl);
-}
-
-void repeatMaskOutFreeList(struct repeatMaskOut **pList)
-/* Free a list of dynamically allocated repeatMaskOut's */
-{
-struct repeatMaskOut *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    repeatMaskOutFree(&el);
-    }
-*pList = NULL;
-}
-
-void repeatMaskOutOutput(struct repeatMaskOut *el, FILE *f, char sep, char lastSep) 
-/* Print out repeatMaskOut.  Separate fields with sep. Follow last field with lastSep. */
-{
-fprintf(f, "%u", el->score);
-fputc(sep,f);
-fprintf(f, "%f", el->percDiv);
-fputc(sep,f);
-fprintf(f, "%f", el->percDel);
-fputc(sep,f);
-fprintf(f, "%f", el->percInc);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->qName);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%d", el->qStart);
-fputc(sep,f);
-fprintf(f, "%d", el->qEnd);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->qLeft);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->strand);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->rName);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->rFamily);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->rStart);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%u", el->rEnd);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->rLeft);
-if (sep == ',') fputc('"',f);
-fputc(lastSep,f);
-}
-
diff --git a/gbtools/src/blatSrc/lib/rle.c b/gbtools/src/blatSrc/lib/rle.c
deleted file mode 100644
index 58ff09b..0000000
--- a/gbtools/src/blatSrc/lib/rle.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* rle - byte oriented run length encoding. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "rle.h"
-
-
-static int countSameAsStart(signed char *s, int max)
-/* Count number of signed chars that are the same as first. */
-{
-signed char v = *s;
-int i;
-if (max > 127)
-    max = 127;
-for (i=1; i<max; ++i)
-   if (s[i] != v)
-       break;
-return i;
-}
-
-int rleCompress(void *vIn, int inSize, signed char *out)
-/* Compress in to out.  Out should be at least inSize * 1.5. 
- * Returns compressed size. */
-{
-signed char *in = vIn;
-signed char *endIn = in + inSize;
-signed char *s = in, *d = out;
-signed char *uncStart = in;
-int uncSize, sameCount;
-int sizeLeft;
-
-while ((sizeLeft = (endIn - s)) != 0)
-    {
-    sameCount = countSameAsStart(s, sizeLeft);
-    uncSize = s - uncStart;
-    if (sameCount >= 3)
-        {
-	int uncSize = s - uncStart;
-	while (uncSize > 0)
-	    {
-	    int size = uncSize;
-	    if (size > 127) size = 127;
-	    *d++ = size;
-	    memcpy(d, uncStart, size);
-	    d += size;
-	    uncSize -= size;
-	    uncStart += size;
-	    }
-	*d++ = -sameCount;
-	*d++ = *s;
-	s += sameCount;
-	uncStart = s;
-	}
-    else
-        s += sameCount;
-    }  
-uncSize = s - uncStart;
-while (uncSize > 0)
-    {
-    int size = uncSize;
-    if (size > 127) size = 127;
-    *d++ = size;
-    memcpy(d, uncStart, size);
-    d += size;
-    uncSize -= size;
-    uncStart += size;
-    }
-return d - out;
-}
-
-void rleUncompress(signed char *in, int inSize, void *vOut, int outSize)
-/* Uncompress in to out. */
-{
-int count;
-signed char *out = vOut;
-signed char *endOut = out + outSize;
-#ifndef NDEBUG
-signed char *endIn = in + inSize;
-#endif
-
-while (out < endOut)
-     {
-     count = *in++;
-     if (count > 0)
-          {
-	  memcpy(out, in, count);
-	  in += count;
-	  out += count;
-	  }
-    else
-          {
-	  count = -count;
-	  memset(out, *in++, count);
-	  out += count;
-	  }
-	  
-    }
-assert(out == endOut && in == endIn);
-}
-
diff --git a/gbtools/src/blatSrc/lib/rnautil.c b/gbtools/src/blatSrc/lib/rnautil.c
deleted file mode 100644
index 06795fb..0000000
--- a/gbtools/src/blatSrc/lib/rnautil.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* rnautil.c - functions for dealing with RNA and RNA secondary structure.  */
-
-/* Copyright (C) 2007 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-#include "rnautil.h"
-#include "common.h"
-
-const char *RNA_PAIRS[] = {"AU","UA","GC","CG","GU","UG",0};
-/* Null terminated array of rna pairs */
-
-void dna2rna(char *s)
-/* Replace 't' with 'u' and 'T' with 'U' in s. */
-{
-for (;*s;s++)
-    {
-    if (*s == 't')
-	*s = 'u';
-    if (*s == 'T')
-	*s = 'U';
-    }
-}
-
-bool rnaPair(char a, char b)
-/* Returns TRUE if a and b can pair, and false otherwise */
-{
-char pair[] = {a,b,'\0'};
-int i;
-dna2rna(pair);
-touppers(pair);
-
-for (i=0;RNA_PAIRS[i] != 0; i++)
-    if (pair[0] == RNA_PAIRS[i][0] && pair[1] == RNA_PAIRS[i][1] )
-	return TRUE;
-return FALSE;
-}
-
-void reverseFold(char *s)
-/* Reverse the order of the parenthesis defining an RNA secondary structure annotation. */
-{
-reverseBytes(s, strlen(s));
-for (;*s;s++)
-    {
-    if (*s == '(')
-	*s = ')';
-    else if (*s == ')')
-	*s = '(';
-    }
-}
-
-void fold2pairingList(char *fold, int len, int **p2pairList)
-/* take a parenthesis string, allocate and return an array of pairing
-   positions: pairList[i] = j <=> i pair with j and pairList[i] = -1
-   <=> i does not pair.*/
-{
-int i,j, stackSize = 0;
-int *pairList      = needMem(len * sizeof(int));
-*p2pairList        = pairList;
-
-/* initialize array */
-for (i = 0; i < len; i++)
-    pairList[i] = -1;
-
-/* fill out pairList */
-for (i = 0; i < len; i++) 
-    {
-    if (fold[i] == '(')
-	{
-	stackSize = 1;
-	for (j = i+1; j < len; j++) 
-	    {
-	    if (fold[j] == '(')
-		stackSize += 1;
-	    else if (fold[j] == ')')
-		stackSize -= 1;
-	    if (stackSize == 0)  /* found pair partner */
-		{
-		pairList[i] = j;
-		pairList[j] = i;
-		break;
-		}
-	    }
-	}
-    }
-}
-
-void mkPairPartnerSymbols(int *pairList, char *pairSymbols, int size)
-{
-/* Make a symbol string indicating pairing partner */
-int i;
-char symbols[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*=+{}|[]\\;'"; /* length 80 */
-int  symbolMax = strlen(symbols);
-int index;
-for (i = 0, index = 0; i < size; i++)
-    {
-    pairSymbols[i] = ' ';
-    if (pairList[i] >= 0)
-	{
-	if (pairList[i] < i)
-	    {
-            --index;
-	    if (index<0)
-		index = symbolMax-1;
-	    }
-	pairSymbols[i] = symbols[index];
-	if (pairList[i] > i)
-	    {
-            ++index;
-	    if (index>=symbolMax)
-		index=0;
-	    }
-	}
-    }
-}
-
-char * projectString(char *s, char *ref, char refChar, char insertChar)
-/* Insert 'insertChar' in 's' at every position 'ref' has 'refChar'. */
-{
-int i,j,size = strlen(ref);
-char *copy = (char *) needMem(size + 1);
-
-if (strlen(s) != strlen(ref) - countChars(ref, refChar))
-  errAbort("ERROR from rnautil::projectString: Input string 's' has wrong length.\n"); 
-
-for (i = 0, j = 0; i < size; i++)
-    {
-    if (ref[i] == refChar)
-	copy[i] = insertChar;
-    else
-	{	
-	copy[i] = s[j];
-	j++;
-	}
-    }
-return copy;
-}
-
-char *gapAdjustFold(char *s, char *ref)
-/* Insert space in s when there is a gap ('-') in ref. */
-{
-return projectString(s, ref, '-', ' ');
-}
-
-
-int *projectIntArray(int *in, char *ref, char refChar, int insertInt)
-/* Insert 'insertChar' in 's' at every positin 'ref' has 'refChar'. */
-{
-int i,j,size = strlen(ref);
-int   *copy = (int *) needMem(size *sizeof(int) );
-
-for (i = 0, j = 0; i < size; i++)
-    {
-    if (ref[i] == refChar)
-	copy[i] = insertInt;
-    else
-	{	
-	copy[i] = in[j];
-	j++;
-	}
-    }
-return copy;
-}
-
-int * gapIntArrayAdjust(int *in, char *ref)
-/* Insert space in s when there is a gap ('-') in ref. */
-{
-return projectIntArray(in, ref, '-', 0);
-}
-
-void markCompensatoryMutations(char *s, char *ref, int *pairList, int *markList)
-/* Compares s to ref and pairList and sets values in markList
- * according to pairing properties. The value of markList[i] specifies
- * the pairing property of the i'th position. The following values are
- * used: 
- * 0: not pairing, no substitution (default) 
- * 1: not pairing, single substitution
- * 2: pairing, no substitutions 
- * 3: pairing, single substitution (one of: CG<->TG, GC<->GT, TA<->TG, AT<->GT)
- * 4: pairing, double substitution (i.e. a compensatory change)
- * 5: annotated as pairing but dinucleotide cannot pair, single substitution
- * 6: annotated as pairing but dinucleotide cannot pair, doubble substitution
- * 7: annotated as pairing but dinucleotide cannot pair, involves indel ('-' substitution)
- */
-{
-int i, size = strlen(s);
-for (i = 0; i < size; i++)
-    {
-    if (pairList[i] == -1)
-	if (toupper(s[i]) != toupper(ref[i]) && s[i] != '.' && s[i] != '-' && ref[i] != '-')
-	    markList[i] = 1;
-	else
-	    markList[i] = 0;
-    else
-	{
-	if (s[i] == '.' || s[pairList[i]] == '.') /* treat missing data as possible pair partner */
-	    markList[i] = 2;
-	else if (!rnaPair(s[i], s[pairList[i]]))
-	  if (s[i] == '-' || s[pairList[i]] == '-')
-	    markList[i] = 7;
-	  else if (toupper( s[i] ) != toupper( ref[i] ) && toupper( s[pairList[i]] ) != toupper( ref[pairList[i]] ) )
-	    markList[i] = 6;
-	  else
-	    markList[i] = 5;
-	else if (toupper( s[i] ) != toupper( ref[i] ) && toupper( s[pairList[i]] ) != toupper( ref[pairList[i]] ) )
-	    markList[i] = 4;
-	else if (toupper( s[i] ) != toupper( ref[i] ) || toupper( s[pairList[i]] ) != toupper( ref[pairList[i]] ) )
-	    markList[i] = 3;
-	else
-	    markList[i] = 2;
-	}
-    }
-}
-
-int assignBin(double val, double minVal, double maxVal, int binCount)
-/* Divide range given by minVal and maxVal into binCount intervals
-   (bins), and return index of the bin val falls into. */
-{
-double range = maxVal - minVal;
-int maxBin   = binCount - 1;
-int level    = (int) ( (val-minVal)*maxBin/range);
-if (level <= 0) level = 0;
-if (level > maxBin) level = maxBin;
-return level;
-}
diff --git a/gbtools/src/blatSrc/lib/rqlEval.c b/gbtools/src/blatSrc/lib/rqlEval.c
deleted file mode 100644
index ca81223..0000000
--- a/gbtools/src/blatSrc/lib/rqlEval.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/* rqlEval - evaluate tree returned by rqlParse given a record and function to lookup fields
- * in the record. . */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "dystring.h"
-#include "localmem.h"
-#include "tokenizer.h"
-#include "sqlNum.h"
-#include "rql.h"
-
-
-static struct rqlEval rqlLocalEval(struct rqlParse *p, void *record, RqlEvalLookup lookup, 
-	struct lm *lm);
-/* Evaluate self on parse tree, allocating memory if needed from lm. */
-
-struct rqlEval rqlEvalCoerceToBoolean(struct rqlEval r)
-/* Return TRUE if it's a nonempty string or a non-zero number. */
-{
-switch (r.type)
-    {
-    case rqlTypeBoolean:
-	break;	/* It's already done. */
-    case rqlTypeString:
-        r.val.b = (r.val.s != NULL && r.val.s[0] != 0);
-	break;
-    case rqlTypeInt:
-        r.val.b = (r.val.i != 0);
-	break;
-    case rqlTypeDouble:
-        r.val.b = (r.val.x != 0.0);
-	break;
-    default:
-	internalErr();
-	r.val.b = FALSE;
-	break;
-    }
-r.type = rqlTypeBoolean;
-return r;
-}
-
-static struct rqlEval rqlEvalEq(struct rqlParse *p, 
-	void *record, RqlEvalLookup lookup, struct lm *lm)
-/* Return true if two children are equal regardless of children type
- * (which are just gauranteed to be the same). */
-{
-struct rqlParse *lp = p->children;
-struct rqlParse *rp = lp->next;
-struct rqlEval lv = rqlLocalEval(lp, record, lookup, lm);
-struct rqlEval rv = rqlLocalEval(rp, record, lookup, lm);
-struct rqlEval res;
-res.type = rqlTypeBoolean;
-assert(lv.type == rv.type);
-switch (lv.type)
-    {
-    case rqlTypeBoolean:
-        res.val.b = (lv.val.b == rv.val.b);
-	break;
-    case rqlTypeString:
-	res.val.b = sameString(lv.val.s, rv.val.s);
-	break;
-    case rqlTypeInt:
-	res.val.b = (lv.val.i == rv.val.i);
-	break;
-    case rqlTypeDouble:
-	res.val.b = (lv.val.x == rv.val.x);
-	break;
-    default:
-	internalErr();
-	res.val.b = FALSE;
-	break;
-    }
-return res;
-}
-
-static struct rqlEval rqlEvalLt(struct rqlParse *p, void *record, RqlEvalLookup lookup,
-	struct lm *lm)
-/* Return true if r < l . */
-{
-struct rqlParse *lp = p->children;
-struct rqlParse *rp = lp->next;
-struct rqlEval lv = rqlLocalEval(lp, record, lookup, lm);
-struct rqlEval rv = rqlLocalEval(rp, record, lookup, lm);
-struct rqlEval res;
-res.type = rqlTypeBoolean;
-switch (lv.type)
-    {
-    case rqlTypeBoolean:
-        res.val.b = (lv.val.b < rv.val.b);
-	break;
-    case rqlTypeString:
-	res.val.b = strcmp(lv.val.s, rv.val.s) < 0;
-	break;
-    case rqlTypeInt:
-	res.val.b = (lv.val.i < rv.val.i);
-	break;
-    case rqlTypeDouble:
-	res.val.b = (lv.val.x < rv.val.x);
-	break;
-    default:
-	internalErr();
-	res.val.b = FALSE;
-	break;
-    }
-return res;
-}
-
-static struct rqlEval rqlEvalGt(struct rqlParse *p, void *record, RqlEvalLookup lookup,
-	struct lm *lm)
-/* Return true if r > l . */
-{
-struct rqlParse *lp = p->children;
-struct rqlParse *rp = lp->next;
-struct rqlEval lv = rqlLocalEval(lp, record, lookup, lm);
-struct rqlEval rv = rqlLocalEval(rp, record, lookup, lm);
-struct rqlEval res;
-res.type = rqlTypeBoolean;
-switch (lv.type)
-    {
-    case rqlTypeBoolean:
-        res.val.b = (lv.val.b > rv.val.b);
-	break;
-    case rqlTypeString:
-	res.val.b = strcmp(lv.val.s, rv.val.s) > 0;
-	break;
-    case rqlTypeInt:
-	res.val.b = (lv.val.i > rv.val.i);
-	break;
-    case rqlTypeDouble:
-	res.val.b = (lv.val.x > rv.val.x);
-	break;
-    default:
-	internalErr();
-	res.val.b = FALSE;
-	break;
-    }
-return res;
-}
-
-static struct rqlEval rqlEvalLike(struct rqlParse *p, void *record, RqlEvalLookup lookup,
-	struct lm *lm)
-/* Return true if r like l . */
-{
-struct rqlParse *lp = p->children;
-struct rqlParse *rp = lp->next;
-struct rqlEval lv = rqlLocalEval(lp, record, lookup, lm);
-struct rqlEval rv = rqlLocalEval(rp, record, lookup, lm);
-struct rqlEval res;
-res.type = rqlTypeBoolean;
-assert(rv.type == rqlTypeString);
-assert(rv.type == lv.type);
-res.val.b = sqlMatchLike(rv.val.s, lv.val.s);
-return res;
-}
-
-static struct rqlEval rqlEvalArrayIx(struct rqlParse *p, void *record, RqlEvalLookup lookup,
-	struct lm *lm)
-/* Handle parse tree generated by an indexed array. */
-{
-struct rqlParse *array = p->children;
-struct rqlParse *index = array->next;
-struct rqlEval arrayVal = rqlLocalEval(array, record, lookup, lm);
-struct rqlEval indexVal = rqlLocalEval(index, record, lookup, lm);
-struct rqlEval res;
-res.type = rqlTypeString;
-res.val.s = emptyForNull(lmCloneSomeWord(lm, arrayVal.val.s, indexVal.val.i));
-return res;
-}
-
-static struct rqlEval rqlLocalEval(struct rqlParse *p, void *record, RqlEvalLookup lookup, 
-	struct lm *lm)
-/* Evaluate self on parse tree, allocating memory if needed from lm. */
-{
-struct rqlEval res;
-switch (p->op)
-    {
-    case rqlOpLiteral:
-	res.val = p->val;
-	res.type = p->type;
-	break;
-    case rqlOpSymbol:
-	res.type = rqlTypeString;
-	char *s = lookup(record, p->val.s);
-	if (s == NULL)
-	    res.val.s = "";
-	else
-	    res.val.s = s;
-	break;
-    case rqlOpEq:
-	res = rqlEvalEq(p, record, lookup, lm);
-	break;
-    case rqlOpNe:
-	res = rqlEvalEq(p, record, lookup, lm);
-	res.val.b = !res.val.b;
-	break;
-
-    /* Inequalities. */
-    case rqlOpLt:
-        res = rqlEvalLt(p, record, lookup, lm);
-	break;
-    case rqlOpGt:
-        res = rqlEvalGt(p, record, lookup, lm);
-	break;
-    case rqlOpLe:
-        res = rqlEvalGt(p, record, lookup, lm);
-	res.val.b = !res.val.b;
-	break;
-    case rqlOpGe:
-        res = rqlEvalLt(p, record, lookup, lm);
-	res.val.b = !res.val.b;
-	break;
-    case rqlOpLike:
-        res = rqlEvalLike(p,record, lookup, lm);
-	break;
-
-    /* Logical ops. */
-    case rqlOpAnd:
-	{
-        res.type = rqlTypeBoolean;
-	res.val.b = TRUE;
-	struct rqlParse *c;
-	for (c = p->children; c != NULL; c= c->next)
-	    {
-	    struct rqlEval e = rqlLocalEval(c, record, lookup, lm);
-	    if (!e.val.b)
-		{
-	        res.val.b = FALSE;
-		break;
-		}
-	    }
-	break;
-	}
-    case rqlOpOr:
-	{
-        res.type = rqlTypeBoolean;
-	res.val.b = FALSE;
-	struct rqlParse *c;
-	for (c = p->children; c != NULL; c= c->next)
-	    {
-	    struct rqlEval e = rqlLocalEval(c, record, lookup, lm);
-	    if (e.val.b)
-		{
-	        res.val.b = TRUE;
-		break;
-		}
-	    }
-	break;
-	}
-
-    case rqlOpNot:
-        res = rqlLocalEval(p->children, record, lookup, lm);
-	res.val.b = !res.val.b;
-	break;
-
-    /* Type casts. */
-    case rqlOpStringToBoolean:
-	res = rqlLocalEval(p->children, record, lookup, lm);
-	res.type = rqlTypeBoolean;
-	res.val.b = (res.val.s[0] != 0);
-	break;
-    case rqlOpIntToBoolean:
-        res = rqlLocalEval(p->children, record, lookup, lm);
-	res.type = rqlTypeBoolean;
-	res.val.b = (res.val.i != 0);
-	break;
-    case rqlOpDoubleToBoolean:
-        res = rqlLocalEval(p->children, record, lookup, lm);
-	res.type = rqlTypeBoolean;
-	res.val.b = (res.val.x != 0.0);
-	break;
-    case rqlOpStringToInt:
-	res = rqlLocalEval(p->children, record, lookup, lm);
-	res.type = rqlTypeInt;
-	res.val.i = atoi(res.val.s);
-	break;
-    case rqlOpDoubleToInt:
-	res = rqlLocalEval(p->children, record, lookup, lm);
-	res.type = rqlTypeInt;
-	res.val.i = res.val.x;
-	break;
-
-    case rqlOpStringToDouble:
-	res = rqlLocalEval(p->children, record, lookup, lm);
-	res.type = rqlTypeDouble;
-	res.val.x = atof(res.val.s);
-	break;
-    case rqlOpBooleanToInt:
-	res = rqlLocalEval(p->children, record, lookup, lm);
-	res.type = rqlTypeInt;
-	res.val.i = res.val.b;
-	break;
-    case rqlOpBooleanToDouble:
-	res = rqlLocalEval(p->children, record, lookup, lm);
-	res.type = rqlTypeDouble;
-	res.val.x = res.val.b;
-	break;
-    case rqlOpIntToDouble:
-	res = rqlLocalEval(p->children, record, lookup, lm);
-	res.type = rqlTypeDouble;
-	res.val.x = res.val.b;
-	break;
-
-    /* Arithmetical negation. */
-    case rqlOpUnaryMinusInt:
-        res = rqlLocalEval(p->children, record, lookup, lm);
-	res.val.i = -res.val.i;
-	break;
-    case rqlOpUnaryMinusDouble:
-        res = rqlLocalEval(p->children, record, lookup, lm);
-	res.val.x = -res.val.x;
-	break;
-
-    case rqlOpArrayIx:
-       res = rqlEvalArrayIx(p, record, lookup, lm);
-       break;
-
-    default:
-        errAbort("Unknown op %s\n", rqlOpToString(p->op));
-	res.type = rqlTypeInt;	// Keep compiler from complaining.
-	res.val.i = 0;	// Keep compiler from complaining.
-	break;
-    }
-return res;
-}
-
-struct rqlEval rqlEvalOnRecord(struct rqlParse *p, void *record, RqlEvalLookup lookup, 
-	struct lm *lm)
-/* Evaluate parse tree on record, using lm for memory for string operations. */
-{
-return rqlLocalEval(p, record, lookup, lm);
-}
diff --git a/gbtools/src/blatSrc/lib/rqlParse.c b/gbtools/src/blatSrc/lib/rqlParse.c
deleted file mode 100644
index d91b30f..0000000
--- a/gbtools/src/blatSrc/lib/rqlParse.c
+++ /dev/null
@@ -1,767 +0,0 @@
-/* rqlParse - parse restricted sql-like query language.  Produce rqlParse tree.  See rqlEval.c
- * for the rqlParse interpreter. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "hash.h"
-#include "dystring.h"
-#include "tokenizer.h"
-#include "sqlNum.h"
-#include "rql.h"
-
-
-char *rqlOpToString(enum rqlOp op)
-/* Return string representation of parse op. */
-{
-switch (op)
-    {
-    case rqlOpLiteral:
-	return "rqlOpLiteral";
-    case rqlOpSymbol:
-	return "rqlOpSymbol";
-    
-    case rqlOpStringToBoolean:
-        return "rqlOpStringToBoolean";
-    case rqlOpIntToBoolean:
-        return "rqlOpIntToBoolean";
-    case rqlOpDoubleToBoolean:
-        return "rqlOpDoubleToBoolean";
-    case rqlOpStringToInt:
-        return "rqlOpStringToInt";
-    case rqlOpDoubleToInt:
-        return "rqlOpDoubleToInt";
-    case rqlOpBooleanToInt:
-        return "rqlOpBooleanToInt";
-    case rqlOpStringToDouble:
-        return "rqlOpStringToDouble";
-    case rqlOpBooleanToDouble:
-        return "rqlOpBooleanToDouble";
-    case rqlOpIntToDouble:
-        return "rqlOpIntToDouble";
-
-    case rqlOpEq:
-	return "rqlOpEq";
-    case rqlOpNe:
-	return "rqlOpNe";
-    case rqlOpGt:
-        return "rqlOpGt";
-    case rqlOpLt:
-        return "rqlOpLt";
-    case rqlOpGe:
-        return "rqlOpGe";
-    case rqlOpLe:
-        return "rqlOpLe";
-    case rqlOpLike:
-	return "rqlOpLike";
-
-    case rqlOpAnd:
-	return "rqlOpAnd";
-    case rqlOpOr:
-	return "rqlOpOr";
-    case rqlOpNot:
-        return "rqlOpNot";
-
-    case rqlOpUnaryMinusInt:
-        return "rqlOpUnaryMinusInt";
-    case rqlOpUnaryMinusDouble:
-        return "rqlOpUnaryMinusDouble";
-
-    case rqlOpArrayIx:
-        return "rqlOpArrayIx";
-
-    default:
-	return "rqlOpUnknown";
-    }
-}
-
-void rqlValDump(union rqlVal val, enum rqlType type, FILE *f)
-/* Dump out value to file. */
-{
-switch (type)
-    {
-    case rqlTypeBoolean:
-        fprintf(f, "%s", (val.b ? "true" : "false") );
-	break;
-    case rqlTypeString:
-        fprintf(f, "%s", val.s);
-	break;
-    case rqlTypeInt:
-        fprintf(f, "%d", val.i);
-	break;
-    case rqlTypeDouble:
-        fprintf(f, "%f", val.x);
-	break;
-    }
-}
-
-void rqlParseDump(struct rqlParse *p, int depth, FILE *f)
-/* Dump out rqlParse tree and children. */
-{
-spaceOut(f, 3*depth);
-fprintf(f, "%s ", rqlOpToString(p->op));
-rqlValDump(p->val, p->type,  f);
-fprintf(f, "\n");
-struct rqlParse *child;
-for (child = p->children; child != NULL; child= child->next)
-    rqlParseDump(child, depth+1, f);
-}
-
-static void expectingGot(struct tokenizer *tkz, char *expecting, char *got)
-/* Print out error message about unexpected input. */
-{
-errAbort("Expecting %s, got %s, line %d of %s", expecting, got, tkz->lf->lineIx,
-	tkz->lf->fileName);
-}
-
-static void skipOverRequired(struct tokenizer *tkz, char *expecting)
-/* Make sure that next token is tok, and skip over it. */
-{
-tokenizerMustHaveNext(tkz);
-if (!sameString(tkz->string, expecting))
-    expectingGot(tkz, expecting, tkz->string);
-}
-
-
-struct rqlParse *rqlParseExpression(struct tokenizer *tkz);
-/* Parse out a clause, usually a where clause. */
-
-static struct rqlParse *rqlParseAtom(struct tokenizer *tkz)
-/* Return low level (symbol or literal) */
-{
-char *tok = tokenizerMustHaveNext(tkz);
-struct rqlParse *p;
-AllocVar(p);
-char c = tok[0];
-if (c == '\'' || c == '"')
-    {
-    p->op = rqlOpLiteral;
-    p->type = rqlTypeString;
-    int len = strlen(tok+1);
-    p->val.s = cloneStringZ(tok+1, len-1);
-    }
-else if (isalpha(c) || c == '_')
-    {
-    p->op = rqlOpSymbol;
-    p->type = rqlTypeString;	/* String until promoted at least. */
-    p->val.s = cloneString(tok);
-    }
-else if (isdigit(c))
-    {
-    p->op = rqlOpLiteral;
-    p->type = rqlTypeInt;
-    p->val.i = sqlUnsigned(tok);
-    if ((tok = tokenizerNext(tkz)) != NULL)
-	{
-	if (tok[0] == '.')
-	    {
-	    char buf[32];
-	    tok = tokenizerMustHaveNext(tkz);
-	    safef(buf, sizeof(buf), "%d.%s", p->val.i, tok);
-	    p->type = rqlTypeDouble;
-	    p->val.x = sqlDouble(buf);
-	    }
-	else
-	    tokenizerReuse(tkz);
-	}
-    }
-else if (c == '(')
-    {
-    p = rqlParseExpression(tkz);
-    skipOverRequired(tkz, ")");
-    }
-else
-    {
-    errAbort("Unexpected %s line %d of %s", tok, tkz->lf->lineIx, tkz->lf->fileName);
-    }
-return p;
-}
-
-static enum rqlType commonTypeForBop(enum rqlType left, enum rqlType right)
-/* Return type that will work for a binary operation. */
-{
-if (left == right)
-    return left;
-else if (left == rqlTypeDouble || right == rqlTypeDouble)
-    return rqlTypeDouble;
-else if (left == rqlTypeInt || right == rqlTypeInt)
-    return rqlTypeInt;
-else if (left == rqlTypeBoolean || right == rqlTypeBoolean)
-    return rqlTypeBoolean;
-else if (left == rqlTypeString || right == rqlTypeString)
-    return rqlTypeString;
-else
-    {
-    errAbort("Can't find commonTypeForBop");
-    return rqlTypeInt;
-    }
-}
-
-static enum rqlOp booleanCastOp(enum rqlType oldType)
-/* Return op to convert oldType to boolean. */
-{
-switch (oldType)
-    {
-    case rqlTypeString:
-        return rqlOpStringToBoolean;
-    case rqlTypeInt:
-        return rqlOpIntToBoolean;
-    case rqlTypeDouble:
-        return rqlOpDoubleToBoolean;
-    default:
-        internalErr();
-	return rqlOpUnknown;
-    }
-}
-
-static enum rqlOp intCastOp(enum rqlType oldType)
-/* Return op to convert oldType to int. */
-{
-switch (oldType)
-    {
-    case rqlTypeString:
-        return rqlOpStringToInt;
-    case rqlTypeBoolean:
-        return rqlOpBooleanToInt;
-    case rqlTypeDouble:
-        return rqlOpDoubleToInt;
-    default:
-        internalErr();
-	return rqlOpUnknown;
-    }
-}
-
-static enum rqlOp doubleCastOp(enum rqlType oldType)
-/* Return op to convert oldType to double. */
-{
-switch (oldType)
-    {
-    case rqlTypeString:
-        return rqlOpStringToDouble;
-    case rqlTypeBoolean:
-        return rqlOpBooleanToDouble;
-    case rqlTypeInt:
-        return rqlOpIntToDouble;
-    default:
-        internalErr();
-	return rqlOpUnknown;
-    }
-}
-
-
-static struct rqlParse *rqlParseCoerce(struct rqlParse *p, enum rqlType type)
-/* If p is not of correct type, wrap type conversion node around it. */
-{
-if (p->type == type)
-    return p;
-else
-    {
-    struct rqlParse *cast;
-    AllocVar(cast);
-    cast->children = p;
-    cast->type = type;
-    switch (type)
-        {
-	case rqlTypeBoolean:
-	    cast->op = booleanCastOp(p->type);
-	    break;
-	case rqlTypeInt:
-	    cast->op = intCastOp(p->type);
-	    break;
-	case rqlTypeDouble:
-	    cast->op = doubleCastOp(p->type);
-	    break;
-	default:
-	    internalErr();
-	    break;
-	}
-    return cast;
-    }
-}
-
-static struct rqlParse *rqlParseIndex(struct tokenizer *tkz)
-/* Handle the [] in this[6].  Convert it into tree:
-*         rqlOpArrayIx
-*            rqlParseAtom
-*            rqlParseAtom */
-{
-struct rqlParse *collection = rqlParseAtom(tkz);
-struct rqlParse *p = collection;
-char *tok = tokenizerNext(tkz);
-if (tok == NULL)
-    tokenizerReuse(tkz);
-else if (tok[0] == '[')
-    {
-    // struct rqlParse *index = rqlParseExpression(tkz);
-    struct rqlParse *index = rqlParseAtom(tkz);
-    index = rqlParseCoerce(index, rqlTypeInt);
-    skipOverRequired(tkz, "]");
-    AllocVar(p);
-    p->op = rqlOpArrayIx;
-    p->type = rqlTypeString;
-    p->children = collection;
-    collection->next = index;
-    }
-else
-    tokenizerReuse(tkz);
-return p;
-}
-
-
-static struct rqlParse *rqlParseUnaryMinus(struct tokenizer *tkz)
-/* Return unary minus sort of parse tree if there's a leading '-' */
-{
-char *tok = tokenizerMustHaveNext(tkz);
-if (tok[0] == '-')
-    {
-    struct rqlParse *c = rqlParseIndex(tkz);
-    struct rqlParse *p;
-    AllocVar(p);
-    if (c->type == rqlTypeInt)
-        {
-	p->op = rqlOpUnaryMinusInt;
-	p->type = rqlTypeInt;
-	}
-    else
-	{
-	c = rqlParseCoerce(c, rqlTypeDouble);
-	p->op = rqlOpUnaryMinusDouble;
-	p->type = rqlTypeDouble;
-	}
-    p->children = c;
-    return p;
-    }
-else
-    {
-    tokenizerReuse(tkz);
-    return rqlParseIndex(tkz);
-    }
-}
-
-static boolean eatMatchingTok(struct tokenizer *tkz, char *s)
-/* If next token matches s then eat it and return TRUE */
-{
-char *tok = tokenizerNext(tkz);
-if (tok != NULL && sameString(tok, s))
-    return TRUE;
-else
-    {
-    tokenizerReuse(tkz);
-    return FALSE;
-    }
-}
-
-static struct rqlParse *rqlParseCmp(struct tokenizer *tkz)
-/* Parse out comparison. */
-{
-struct rqlParse *l = rqlParseUnaryMinus(tkz);
-struct rqlParse *p = l;
-char *tok = tokenizerNext(tkz);
-boolean forceString = FALSE;
-boolean needNot = FALSE;
-if (tok != NULL)
-    {
-    enum rqlOp op = rqlOpUnknown;
-    if (sameString(tok, "="))
-        {
-	op = rqlOpEq;
-	}
-    else if (sameString(tok, "!"))
-        {
-	op = rqlOpNe;
-	skipOverRequired(tkz, "=");
-	}
-    else if (sameString(tok, ">"))
-        {
-	if (eatMatchingTok(tkz, "="))
-	    op = rqlOpGe;
-	else
-	    op = rqlOpGt;
-	}
-    else if (sameString(tok, "<"))
-        {
-	if (eatMatchingTok(tkz, "="))
-	    op = rqlOpGe;
-	else
-	    op = rqlOpLe;
-	}
-    else if (sameString(tok, "not"))
-        {
-	forceString = TRUE;
-	op = rqlOpLike;
-	needNot = TRUE;
-	skipOverRequired(tkz, "like");
-	}
-    else if (sameString(tok, "like"))
-        {
-	forceString = TRUE;
-	op = rqlOpLike;
-	}
-    else
-        {
-	tokenizerReuse(tkz);
-	return p;
-	}
-    struct rqlParse *r = rqlParseUnaryMinus(tkz);
-    AllocVar(p);
-    p->op = op;
-    p->type = rqlTypeBoolean;
-
-    /* Now force children to be the same type, inserting casts if need be. */
-    if (forceString)
-	{
-	if (l->type != rqlTypeString || r->type != rqlTypeString)
-	    {
-	    errAbort("Expecting string type around comparison line %d of %s",
-	    	tkz->lf->lineIx, tkz->lf->fileName);
-	    }
-	}
-    else
-	{
-	enum rqlType childType = commonTypeForBop(l->type, r->type);
-	l = rqlParseCoerce(l, childType);
-	r = rqlParseCoerce(r, childType);
-	}
-
-    /* Now hang children onto node. */
-    p->children = l;
-    l->next = r;
-
-    /* Put in a not around self if need be. */
-    if (needNot)
-        {
-	struct rqlParse *n;
-	AllocVar(n);
-	n->op = rqlOpNot;
-	n->type = rqlTypeBoolean;
-	n->children = p;
-	p = n;
-	}
-    }
-return p;
-}
-
-static struct rqlParse *rqlParseNot(struct tokenizer *tkz)
-/* parse out a logical not. */
-{
-char *tok = tokenizerNext(tkz);
-if (sameString(tok, "not"))
-    {
-    struct rqlParse *p = rqlParseCoerce(rqlParseCmp(tkz), rqlTypeBoolean);
-    struct rqlParse *n;
-    AllocVar(n);
-    n->op = rqlOpNot;
-    n->type = rqlTypeBoolean;
-    n->children = p;
-    return n;
-    }
-else
-    {
-    tokenizerReuse(tkz);
-    return rqlParseCmp(tkz);
-    }
-}
-
-static struct rqlParse *rqlParseAnd(struct tokenizer *tkz)
-/* Parse out and or or. */
-{
-struct rqlParse *p = rqlParseNot(tkz);
-struct rqlParse *parent = NULL;
-for (;;)
-    {
-    char *tok = tokenizerNext(tkz);
-    if (tok == NULL || !sameString(tok, "and"))
-        {
-	tokenizerReuse(tkz);
-	return p;
-	}
-    else
-        {
-	if (parent == NULL)
-	    {
-	    p = rqlParseCoerce(p, rqlTypeBoolean);
-	    AllocVar(parent);
-	    parent->op = rqlOpAnd;
-	    parent->type = rqlTypeBoolean;
-	    parent->children = p;
-	    p = parent;
-	    }
-	struct rqlParse *r = rqlParseCoerce(rqlParseNot(tkz), rqlTypeBoolean);
-	slAddTail(&parent->children, r);
-	}
-    }
-}
-
-static struct rqlParse *rqlParseOr(struct tokenizer *tkz)
-/* Parse out and or or. */
-{
-struct rqlParse *p = rqlParseAnd(tkz);
-struct rqlParse *parent = NULL;
-for (;;)
-    {
-    char *tok = tokenizerNext(tkz);
-    if (tok == NULL || !sameString(tok, "or"))
-        {
-	tokenizerReuse(tkz);
-	return p;
-	}
-    else
-        {
-	if (parent == NULL)
-	    {
-	    p = rqlParseCoerce(p, rqlTypeBoolean);
-	    AllocVar(parent);
-	    parent->op = rqlOpOr;
-	    parent->type = rqlTypeBoolean;
-	    parent->children = p;
-	    p = parent;
-	    }
-	struct rqlParse *r = rqlParseCoerce(rqlParseAnd(tkz), rqlTypeBoolean);
-	slAddTail(&parent->children, r);
-	}
-    }
-}
-
-struct rqlParse *rqlParseExpression(struct tokenizer *tkz)
-/* Parse out a clause, usually a where clause. */
-{
-return rqlParseOr(tkz);
-}
-
-static char *rqlParseFieldSpec(struct tokenizer *tkz, struct dyString *buf)
-/* Return a field spec, which may contain * and ?. Put results in buf, and 
- * return buf->string. */
-{
-boolean firstTime = TRUE;
-dyStringClear(buf);
-for (;;)
-   {
-   char *tok = tokenizerNext(tkz);
-   if (tok == NULL)
-       break;
-   char c = *tok;
-   if (c == '?' || c == '*' || isalpha(c) || c == '_' || c == '/' || c == '.')
-       {
-       if (firstTime)
-	   dyStringAppend(buf, tok);
-       else
-           {
-	   if (tkz->leadingSpaces == 0)
-	       dyStringAppend(buf, tok);
-	   else
-	       {
-	       tokenizerReuse(tkz);
-	       break;
-	       }
-	   }
-       }
-   else
-       {
-       tokenizerReuse(tkz);
-       break;
-       }
-    firstTime = FALSE;
-    }
-if (buf->stringSize == 0)
-    errAbort("Expecting field name line %d of %s", tkz->lf->lineIx, tkz->lf->fileName);
-return buf->string;
-}
-
-
-void rqlParseVarsUsed(struct rqlParse *p, struct slName **pVarList)
-/* Put variables used by self and children onto varList. */
-{
-if (p->op == rqlOpSymbol)
-    slNameStore(pVarList, p->val.s);
-struct rqlParse *child;
-for (child = p->children; child != NULL; child = child->next)
-    rqlParseVarsUsed(child, pVarList);
-}
-
-struct rqlStatement *rqlStatementParse(struct lineFile *lf)
-/* Parse an RQL statement out of text */
-{
-struct tokenizer *tkz = tokenizerOnLineFile(lf);
-tkz->uncommentShell = TRUE;
-tkz->uncommentC = TRUE;
-tkz->leaveQuotes = TRUE;
-struct rqlStatement *rql;
-AllocVar(rql);
-rql->command = cloneString(tokenizerMustHaveNext(tkz));
-if (sameString(rql->command, "select"))
-    {
-    struct dyString *buf = dyStringNew(0);
-    struct slName *list = NULL;
-    char *tok = rqlParseFieldSpec(tkz, buf);
-    /* Look for count(*) as special case. */
-    boolean countOnly = FALSE;
-    if (sameString(tok, "count"))
-        {
-	char *paren = tokenizerNext(tkz);
-	if (paren[0] == '(')
-	    {
-	    while ((paren = tokenizerMustHaveNext(tkz)) != NULL)
-	        {
-		if (paren[0] == ')')
-		    break;
-		}
-	    countOnly = TRUE;
-	    freez(&rql->command);
-	    rql->command = cloneString("count");
-	    }
-	else
-	    {
-	    tokenizerReuse(tkz);
-	    }
-	}
-    if (!countOnly)
-	{
-	list = slNameNew(tok);
-	for (;;)
-	    {
-	    /* Parse out comma-separated field list. */
-	    char *comma = tokenizerNext(tkz);
-	    if (comma == NULL || comma[0] != ',')
-		{
-		tokenizerReuse(tkz);
-		break;
-		}
-	    slNameAddHead(&list, rqlParseFieldSpec(tkz, buf));
-	    }
-	slReverse(&list);
-	rql->fieldList = list;
-	}
-    dyStringFree(&buf);
-    }
-else if (sameString(rql->command, "count"))
-    {
-    /* No parameters to count. */
-    }
-else
-    errAbort("Unknown RQL command '%s line %d of %s\n", rql->command, lf->lineIx, lf->fileName);
-    
-char *from = tokenizerNext(tkz);
-if (from != NULL)
-    {
-    if (sameString(from, "from"))
-        {
-	for (;;)
-	    {
-	    struct dyString *buf = dyStringNew(0);
-	    char *table = rqlParseFieldSpec(tkz, buf);
-	    slNameAddTail(&rql->tableList, table);
-	    char *comma = tokenizerNext(tkz);
-	    if (comma == NULL)
-	        break;
-	    if (comma[0] != ',')
-	        {
-		tokenizerReuse(tkz);
-		break;
-		}
-	    dyStringFree(&buf);
-	    }
-	}
-    else
-	{
-	errAbort("missing 'from' clause in %s\n", rql->command);
-	}
-    }
-
-/* Parse where clause. */
-char *where = tokenizerNext(tkz);
-if (where != NULL)
-    {
-    if (!sameString(where, "where"))
-	{
-        tokenizerReuse(tkz);
-	}
-    else
-        {
-	rql->whereClause = rqlParseExpression(tkz);
-	rqlParseVarsUsed(rql->whereClause, &rql->whereVarList);
-	}
-    }
-
-/* Parse limit clause. */
-char *limit = tokenizerNext(tkz);
-rql->limit = -1;	
-if (limit != NULL)
-    {
-    if (!sameString(limit, "limit"))
-        errAbort("Unknown clause '%s' line %d of %s", limit, lf->lineIx, lf->fileName);
-    char *count = tokenizerMustHaveNext(tkz);
-    if (!isdigit(count[0]))
-       errAbort("Expecting number after limit, got %s line %d of %s", 
-       	count, lf->lineIx, lf->fileName);
-    rql->limit = atoi(count);
-    }
-
-/* Check that are at end of statement. */
-char *extra = tokenizerNext(tkz);
-if (extra != NULL)
-    errAbort("Extra stuff starting with '%s' past end of statement line %d of %s", 
-    	extra, lf->lineIx, lf->fileName);
-return rql;
-}
-
-void rqlStatementDump(struct rqlStatement *rql, FILE *f)
-/* Print out statement to file. */
-{
-fprintf(f, "%s:", rql->command);
-if (rql->fieldList)
-    {
-    fprintf(f, " ");
-    struct slName *field = rql->fieldList;
-    fprintf(f, "%s", field->name);
-    for (field = field->next; field != NULL; field = field->next)
-        fprintf(f, ",%s", field->name);
-    }
-fprintf(f, "\n");
-if (rql->tableList)
-    {
-    fprintf(f, "from: ");
-    struct slName *table = rql->tableList;
-    fprintf(f, "%s", table->name);
-    for (table = table->next; table != NULL; table = table->next)
-        fprintf(f, ",%s", table->name);
-    fprintf(f, "\n");
-    }
-if (rql->whereClause)
-    {
-    fprintf(f, " where:\n");
-    rqlParseDump(rql->whereClause, 0, f);
-    }
-if (rql->limit >= 0)
-    fprintf(f, "limit: %d\n", rql->limit);
-}
-
-static void rqlParseFreeRecursive(struct rqlParse *p)
-/* Depth-first recursive free. */
-{
-struct rqlParse *child, *next;
-for (child = p->children; child != NULL; child = next)
-    {
-    next = child->next;
-    rqlParseFreeRecursive(child);
-    }
-freeMem(p);
-}
-
-void rqlStatementFree(struct rqlStatement **pRql)
-/* Free up an rql statement. */
-{
-struct rqlStatement *rql = *pRql;
-if (rql != NULL)
-    {
-    freeMem(rql->command);
-    slFreeList(&rql->fieldList);
-    slFreeList(&rql->tableList);
-    if (rql->whereClause !=NULL)
-	rqlParseFreeRecursive(rql->whereClause);
-    slFreeList(&rql->whereVarList);
-    freez(pRql);
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/rudp.c b/gbtools/src/blatSrc/lib/rudp.c
deleted file mode 100644
index 2ada0cf..0000000
--- a/gbtools/src/blatSrc/lib/rudp.c
+++ /dev/null
@@ -1,563 +0,0 @@
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-/* rudp - (semi) reliable UDP communication.  This adds an
- * acknowledgement and resend layer on top of UDP. 
- *
- * UDP is a packet based rather than stream based internet communication 
- * protocol. Messages sent by UDP are checked for integrety by the UDP layer, 
- * and discarded if transmission errors are detected.  However packets are
- * not necessarily received in the same order that they are sent,
- * and packets may be duplicated or lost.  
- 
- * Using rudp packets are only very rarely lost, and the sender is 
- * notified if they are.  After rudp there are still duplicate
- * packets that may arrive out of order.  Aside from the duplicates
- * the packets are in order though.
- *
- * For many, perhaps most applications, TCP/IP is a saner choice
- * than UDP or rudp.  If the communication channel is between just 
- * two computers you can pretty much just treat TCP/IP as a fairly
- * reliable pipe.   However if the communication involves many
- * computers sometimes UDP can be a better choice.  It is possible to
- * do broadcast and multicast with UDP but not with TCP/IP.  Also
- * for systems like parasol, where a server may be making and breaking
- * connections rapidly to thousands of computers, TCP paradoxically
- * can end up less reliable than UDP.  Though TCP is relatively 
- * robust when a connection is made,  it can relatively easily fail
- * to make a connection in the first place, and spend quite a long
- * time figuring out that the connection can't be made.  Moreover at
- * the end of each connection TCP goes into a 'TIMED_WAIT' state,  which
- * prevents another connection from coming onto the same port for a
- * time that can be as long as 255 seconds.  Since there are only
- * about 15000 available ports,  this limits TCP/IP to 60 connections
- * per second in some cases.  Generally the system does not handle
- * running out of ports gracefully, and this did occur with the 
- * TCP/IP based version of Parasol.
- *
- * This module puts a thin layer around UDP to make it a little bit more
- * reliable.  Currently the interface is geared towards Parasol rather
- * than broadcast type applications.  This module will try to send
- * a message a limited number of times before giving up.  It puts
- * a small header containing a message ID and timestamp on each message.   
- * This header is echoed back in acknowledgment by the reciever. This
- * echo lets the sender know if it needs to resend the message, and
- * lets it know how long a message takes to get to the destination and
- * back.  It uses this round trip time information to figure out how
- * long to wait between resends. 
- *
- * Much of this code is based on the 'Adding Reliability to a UDP Application
- * section in volume I, chapter 20, section 5, of _UNIX Network Programming_
- * by W. Richard Stevens. */
-
-
-#include "common.h"
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <pthread.h>
-#include "errAbort.h"
-#include "hash.h"
-#include "dlist.h"
-#include "obscure.h"
-#include "rudp.h"
-
-
-#define MAX_TIME_OUT 999999
-
-static int rudpCalcTimeOut(struct rudp *ru)
-/* Return calculation of time out based on current data. */
-{
-int timeOut = ru->rttAve + (ru->rttVary<<2);
-if (timeOut > MAX_TIME_OUT) timeOut = MAX_TIME_OUT; /* No more than a second. */
-if (timeOut < 10000) timeOut = 10000;	/* No less than 1/100th second */
-return timeOut;
-}
-
-static void rudpAddRoundTripTime(struct rudp *ru, int time)
-/* Add info about round trip time and based on this recalculate
- * time outs. */
-{
-int delta;
-ru->rttLast = time;
-delta = time - ru->rttAve;
-ru->rttAve += (delta>>3);		      /* g = 1/8 */
-if (delta < 0) delta = -delta;
-ru->rttVary += ((delta - ru->rttVary) >> 2);  /* h = 1/4 */
-ru->timeOut = rudpCalcTimeOut(ru);
-}
-
-static void rudpTimedOut(struct rudp *ru)
-/* Tell system about a time-out. */
-{
-ru->timeOut <<=  1;   /* Back off exponentially. */
-if (ru->timeOut >= MAX_TIME_OUT)
-    ru->timeOut = MAX_TIME_OUT;
-}
-
-struct rudp *rudpNew(int socket)
-/* Wrap a rudp around a socket. Call rudpFree when done, or
- * rudpClose if you also want to close(socket). */
-{
-/* Note scope of variable and mutex are the same */
-static pthread_mutex_t rudpConnMutex = PTHREAD_MUTEX_INITIALIZER;
-static int nextRudpConnId=0;
-struct rudp *ru;
-assert(socket >= 0);
-AllocVar(ru);
-ru->socket = socket;
-ru->rttVary = 250;	/* Initial variance 250 microseconds. */
-ru->timeOut = rudpCalcTimeOut(ru);
-ru->maxRetries = 7;
-ru->pid = getpid();
-pthread_mutex_lock( &rudpConnMutex );
-ru->connId = ++nextRudpConnId;
-pthread_mutex_unlock( &rudpConnMutex );
-return ru;
-}
-
-void freePacketSeen(struct packetSeen **pP)
-/* Free packet seen */
-{
-freez(pP);
-}
-
-void rudpFree(struct rudp **pRu)
-/* Free up rudp.  Note this does *not* close the associated socket. */
-{
-struct rudp *ru = *pRu;
-if (ru->recvHash)
-    {
-    struct dlNode *node;
-    while (!dlEmpty(ru->recvList))
-	{
-	node = dlPopHead(ru->recvList);
-	struct packetSeen *p = node->val;
-	freeMem(node);
-	hashRemove(ru->recvHash, p->recvHashKey);
-    	freePacketSeen(&p);
-	}
-    freeDlList(&ru->recvList);
-    hashFree(&ru->recvHash);
-    }
-freez(pRu);
-}
-
-struct rudp *rudpOpen()
-/* Open up an unbound rudp.   This is suitable for
- * writing to and for reading responses.  However 
- * you'll want to rudpBind if you want to listen for
- * incoming messages.   Call rudpClose() when done 
- * with this one.  Warns and returns NULL if there is
- * a problem. */
-{
-int sd = socket(AF_INET,  SOCK_DGRAM, IPPROTO_UDP);
-if (sd < 0)
-    {
-    warn("Couldn't open socket in rudpOpen %s", strerror(errno));
-    return NULL;
-    }
-return rudpNew(sd);
-}
-
-struct rudp *rudpMustOpen()
-/* Open up unbound rudp.  Warn and die if there is a problem. */
-{
-struct rudp *ru = rudpOpen();
-if (ru == NULL)
-    noWarnAbort();
-return ru;
-}
-
-struct rudp *rudpOpenBound(struct sockaddr_in *sai)
-/* Open up a rudp socket bound to a particular port and address.
- * Use this rather than rudpOpen if you want to wait for
- * messages at a specific address in a server or the like. */
-{
-struct rudp *ru = rudpOpen();
-if (ru != NULL)
-    {
-    if (bind(ru->socket, (struct sockaddr *)sai, sizeof(*sai)) < 0)
-	{
-	warn("Couldn't bind rudp socket: %s", strerror(errno));
-	rudpClose(&ru);
-	}
-    }
-return ru;
-}
-
-struct rudp *rudpMustOpenBound(struct sockaddr_in *sai)
-/* Open up a rudp socket bound to a particular port and address
- * or die trying. */
-{
-struct rudp *ru = rudpOpenBound(sai);
-if (ru == NULL)
-    noWarnAbort();
-return ru;
-}
-
-void rudpClose(struct rudp **pRu)
-/* Close socket and free memory. */
-{
-struct rudp *ru = *pRu;
-if (ru != NULL)
-    {
-    close(ru->socket);
-    rudpFree(pRu);
-    }
-}
-
-static int timeDiff(struct timeval *t1, struct timeval *t2)
-/* Return difference in microseconds between t1 and t2.  t2 must be
- * later than t1 (but less than 50 minutes later). */
-{
-int secDiff = t2->tv_sec - t1->tv_sec;
-int microDiff = 0;
-if (secDiff != 0)
-    microDiff = secDiff * 1000000;
-microDiff += (t2->tv_usec - t1->tv_usec);
-if (microDiff < 0)
-    {
-    /* Note, this case actually happens, currently particularly on
-     * kkr2u62 and kkr8u19.  I think this is just a bug in their clock
-     * hardware/software.  However in general it _could_ happen very
-     * rarely on normal machines when the clock is reset by the
-     * network time protocol thingie. */
-    warn("t1 %u.%u, t2 %u.%u.  t1 > t2 but later?!", (unsigned)t1->tv_sec,
-         (unsigned)t1->tv_usec, (unsigned)t2->tv_sec, (unsigned)t2->tv_usec);
-    microDiff = 0;
-    }
-return microDiff;
-}
-
-static boolean readReadyWait(int sd, int microseconds)
-/* Wait for descriptor to have some data to read, up to
- * given number of microseconds. */
-{
-struct timeval tv;
-fd_set set;
-int readyCount;
-
-for (;;)
-    {
-    if (microseconds >= 1000000)
-	{
-	tv.tv_sec = microseconds/1000000;
-	tv.tv_usec = microseconds%1000000;
-	}
-    else
-	{
-	tv.tv_sec = 0;
-	tv.tv_usec = microseconds;
-	}
-    FD_ZERO(&set);
-    FD_SET(sd, &set);
-    readyCount = select(sd+1, &set, NULL, NULL, &tv);
-    if (readyCount < 0) 
-	{
-	if (errno == EINTR)	/* Select interrupted, not timed out. */
-	    continue;
-    	else 
-    	    warn("select failure in rudp: %s", strerror(errno));
-    	}
-    else
-	{
-    	return readyCount > 0;	/* Zero readyCount indicates time out */
-	}
-    }
-}
-
-static boolean getOurAck(struct rudp *ru, struct timeval *startTv, struct sockaddr_in *sai)
-/* Wait for acknowledgement to the message we just sent.
- * The set should be zeroed out. Only wait for up to
- * ru->timeOut microseconds.   Prints a message and returns FALSE
- * if there's a problem.   */
-{
-struct rudpHeader head;
-int readSize;
-int timeOut = ru->timeOut;
-struct sockaddr_in retFrom;
-unsigned int retFromSize = sizeof(retFrom);
-
-for (;;)
-    {
-    /* Set up select with our time out. */
-    int dt;
-    struct timeval tv;
-
-    if (readReadyWait(ru->socket, timeOut))
-	{
-	/* Read message and if it's our ack return true.   */
-	readSize = recvfrom(ru->socket, &head, sizeof(head), 0, 
-		    (struct sockaddr*)&retFrom, &retFromSize);
-	if (readSize >= sizeof(head) && head.type == rudpAck && head.id == ru->lastId)
-	    {
-	    if ((sai->sin_addr.s_addr==retFrom.sin_addr.s_addr) &&
-		(sai->sin_port==retFrom.sin_port))
-		{
-		gettimeofday(&tv, NULL);
-		dt = timeDiff(startTv, &tv);
-		rudpAddRoundTripTime(ru, dt);
-		return TRUE;
-		}
-	    else
-		{
-		char retFromDottedQuad[17];
-		char saiDottedQuad[17];
-		internetIpToDottedQuad(ntohl(retFrom.sin_addr.s_addr), retFromDottedQuad);
-		internetIpToDottedQuad(ntohl(sai->sin_addr.s_addr), saiDottedQuad);
-		warn("rudp: discarding mistaken ack from %s:%d by confirming recipient ip:port %s:%d"
-		    , retFromDottedQuad, retFrom.sin_port
-		    , saiDottedQuad, sai->sin_port
-		    );
-		}
-	    }
-	}
-
-    /* If we got to here then we did get a message, but it's not our
-     * ack.  We ignore the message and loop around again,  but update
-     * our timeout so that we won't keep getting other people's messages
-     * forever. */
-    gettimeofday(&tv, NULL);
-    timeOut = ru->timeOut - timeDiff(startTv, &tv);
-    if (timeOut <= 0)
-	return FALSE;
-    }
-}
-
-int rudpSend(struct rudp *ru, struct sockaddr_in *sai, void *message, int size)
-/* Send message of given size to port at host via rudp.  Prints a warning and
- * sets errno and returns -1 if there's a problem. */
-{
-struct timeval sendTv;	/* Current time. */
-
-char outBuf[udpEthMaxSize];
-struct rudpHeader *head;
-int fullSize = size + sizeof(*head);
-int i, err = 0, maxRetry = ru->maxRetries;
-
-
-/* Make buffer with header in front of message. 
- * At some point we might replace this with a scatter/gather
- * iovector. */
-ru->sendCount += 1;
-ru->resend = FALSE;
-assert(size <= rudpMaxSize);
-head = (struct rudpHeader *)outBuf;
-memcpy(head+1, message, size);
-head->pid = ru->pid;
-head->connId = ru->connId;
-head->id = ++ru->lastId;
-head->type = rudpData;
-
-/* Go into send/wait for ack/retry loop. */
-for (i=0; i<maxRetry; ++i)
-    {
-    gettimeofday(&sendTv, NULL);
-    head->sendSec = sendTv.tv_sec;
-    head->sendMicro = sendTv.tv_usec;
-    err =  sendto(ru->socket, outBuf, fullSize, 0, 
-	(struct sockaddr *)sai, sizeof(*sai));
-    if (err < 0) 
-	{
-	/* Warn, wait, and retry. */
-	struct timeval tv;
-	warn("sendto problem %s", strerror(errno));
-	tv.tv_sec = 0;
-	tv.tv_usec = ru->timeOut;
-	select(0, NULL, NULL, NULL, &tv);
-	rudpTimedOut(ru);
-	ru->resendCount += 1;
-	ru->resend = TRUE;
-	continue;
-	}
-    if (getOurAck(ru, &sendTv, sai))
-	{
-	return 0;
-	}
-    rudpTimedOut(ru);
-    ru->resendCount += 1;
-    ru->resend = TRUE;
-    }
-if (err >= 0)
-    {
-    err = ETIMEDOUT;
-    warn("rudpSend timed out");
-    }
-ru->failCount += 1;
-return err;
-}
-
-void sweepOutOldPacketsSeen(struct rudp *ru, long now)
-/* Sweep out old packets seen, we can only remember so many. */
-{
-int period = 8;  /* seconds */
-struct dlNode *node;
-struct packetSeen *p;
-while (TRUE)
-    {
-    if (dlEmpty(ru->recvList))
-        break;
-    p = ru->recvList->head->val;
-    if (now - p->lastChecked < period)
-        break;
-    --ru->recvCount;
-    node = dlPopHead(ru->recvList);
-    freeMem(node);
-    hashRemove(ru->recvHash, p->recvHashKey);
-    freePacketSeen(&p);
-    }
-}
-
-
-int rudpReceiveTimeOut(struct rudp *ru, void *messageBuf, int bufSize, 
-	struct sockaddr_in *retFrom, int timeOut)
-/* Read message into buffer of given size.  Returns actual size read on
- * success. On failure prints a warning, sets errno, and returns -1. 
- * Also returns ip address of message source. If timeOut is nonzero,
- * it represents the timeout in milliseconds.  It will set errno to
- * ETIMEDOUT in this case.*/
-{
-char inBuf[udpEthMaxSize];
-struct rudpHeader *head = (struct rudpHeader *)inBuf;
-struct rudpHeader ackHead;
-struct sockaddr_in sai;
-socklen_t saiSize = sizeof(sai);
-int readSize, err;
-assert(bufSize <= rudpMaxSize);
-ru->receiveCount += 1;
-for (;;)
-    {
-    if (timeOut != 0)
-	{
-	if (!readReadyWait(ru->socket, timeOut))
-	    {
-	    warn("rudpReceive timed out\n");
-	    errno = ETIMEDOUT;
-	    return -1;
-	    }
-	}
-    readSize = recvfrom(ru->socket, inBuf, sizeof(inBuf), 0, 
-	(struct sockaddr*)&sai, &saiSize);
-    if (retFrom != NULL)
-	*retFrom = sai;
-    if (readSize < 0)
-	{
-	if (errno == EINTR)
-	    continue;
-	warn("recvfrom error: %s", strerror(errno));
-	ru->failCount += 1;
-	return readSize;
-	}
-    if (readSize < sizeof(*head))
-	{
-	warn("rudpRecieve truncated message");
-	continue;
-	}
-    if (head->type != rudpData)
-	{
-	if (head->type != rudpAck)
-	    warn("skipping non-data message %d in rudpReceive", head->type);
-	continue;
-	}
-    ackHead = *head;
-    ackHead.type = rudpAck;
-    err = sendto(ru->socket, &ackHead, sizeof(ackHead), 0, 
-	(struct sockaddr *)&sai, sizeof(sai));
-    if (err < 0)
-	{
-	warn("problem sending ack in rudpRecieve: %s", strerror(errno));
-	}
-    readSize -= sizeof(*head);
-    if (readSize > bufSize)
-	{
-	warn("read more bytes than have room for in rudpReceive");
-	readSize = bufSize;
-	}
-    memcpy(messageBuf, head+1, readSize);
-
-    /* check for duplicate packet */
-    if (!ru->recvHash)
-	{ /* take advantage of new auto-expanding hashes */
-	ru->recvHash = newHashExt(4, FALSE);  /* do not use local mem in hash */
-	ru->recvList = newDlList();
-	ru->recvCount = 0;
-	}
-    char hashKey[64];
-    char saiDottedQuad[17];
-    internetIpToDottedQuad(ntohl(sai.sin_addr.s_addr), saiDottedQuad);
-    safef(hashKey, sizeof(hashKey), "%s-%d-%d-%d" 
-    	, saiDottedQuad 
-        , head->pid              
-        , head->connId
-        , head->id
-      );		    
-    if (hashLookup(ru->recvHash, hashKey))
-	{
-	warn("duplicate packet filtered out: %s", hashKey);
-	continue;
-	}
-    long now = time(NULL);
-    struct packetSeen *p;
-    AllocVar(p);
-    AllocVar(p->node);
-    p->node->val = p;
-    p->recvHashKey = hashStoreName(ru->recvHash, hashKey);
-    p->lastChecked = now;
-    dlAddTail(ru->recvList, p->node);
-    ++ru->recvCount;
-   
-    sweepOutOldPacketsSeen(ru, now);
-
-    ru->lastIdReceived = head->id;
-    break;
-    }
-return readSize;
-}
-
-
-int rudpReceiveFrom(struct rudp *ru, void *messageBuf, int bufSize, 
-	struct sockaddr_in *retFrom)
-/* Read message into buffer of given size.  Returns actual size read on
- * success. On failure prints a warning, sets errno, and returns -1. 
- * Also returns ip address of message source. */
-{
-return rudpReceiveTimeOut(ru, messageBuf, bufSize, retFrom, 0);
-}
-
-int rudpReceive(struct rudp *ru, void *messageBuf, int bufSize)
-/* Read message into buffer of given size.  Returns actual size read on
- * success. On failure prints a warning, sets errno, and returns -1. */
-{
-return rudpReceiveFrom(ru, messageBuf, bufSize, NULL);
-}
-
-void rudpPrintStatus(struct rudp *ru)
-/* Print out rudpStatus */
-{
-printf("rudp status:\n");
-printf("  receiveCount %d\n", ru->receiveCount);
-printf("  sendCount %d\n", ru->sendCount);
-printf("  resendCount %d\n", ru->resendCount);
-printf("  failCount %d\n", ru->failCount);
-printf("  timeOut %d\n", ru->timeOut);
-printf("  rttVary %d\n", ru->rttVary);
-printf("  rttAve %d\n", ru->rttAve);
-printf("  rttLast %d\n", ru->rttLast);
-}
-
-void rudpTest()
-/* Test out rudp stuff. */
-{
-static int times[] = {1000, 200, 200, 100, 200, 200, 200, 400, 200, 200, 200, 200, 1000, 
-	200, 200, 200, 200};
-struct rudp *ru = rudpNew(0);
-int i;
-
-for (i=0; i<ArraySize(times); ++i)
-    {
-    int oldTimeOut = ru->timeOut;
-    rudpAddRoundTripTime(ru, times[i]);
-    printf("%d\t%d\t%d\t%d\n", i, oldTimeOut, times[i], ru->timeOut);
-    }
-}
diff --git a/gbtools/src/blatSrc/lib/scoreWindow.c b/gbtools/src/blatSrc/lib/scoreWindow.c
deleted file mode 100644
index 41ee994..0000000
--- a/gbtools/src/blatSrc/lib/scoreWindow.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* scoreWindow - find window with most matches to a given char */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-
-
-int scoreWindow(char c, char *s, int size, int *score, int *start, int *end, int match, int misMatch)
-/* simple program to find max scoring window representing string of char c in a string s of size size */
-/* index of max score is returned , match and misMatch are the scores to assign, suggested defaults are match=1 and misMatch=1*/
-/* when used for scoring polyA tails, set c='A' for positive strand  or c='T' for neg strand */
-/* start, end are returned pointing to the start and end of the highest scoring window in s */
-{
-int i=0, j=0, max=0, count = 0; 
-
-*end = 0;
-
-for (i=0 ; i<size ; i++)
-    {
-    int prevScore = (i > 0) ? score[i-1] : 0;
-
-    if (toupper(s[i]) == toupper(c) )
-        score[i] = prevScore+match;
-    else
-        score[i] = prevScore-misMatch;
-    if (score[i] >= max)
-        {
-        max = score[i];
-        *end = i;
-        /* traceback to find start */
-        for (j=i ; j>=0 ; j--)
-            if (score[j] == 0)
-                {
-                *start = j+1;
-                break;
-                }
-        }
-    if (score[i] < 0) 
-        score[i] = 0;
-    }
-assert (*end < size);
-
-for (i=*start ; i<=*end ; i++)
-    {
-    assert (i < size);
-    if (toupper(s[i]) == toupper(c) )
-        count++;
-    }
-return count;
-}
diff --git a/gbtools/src/blatSrc/lib/seg.c b/gbtools/src/blatSrc/lib/seg.c
deleted file mode 100644
index c4d18e6..0000000
--- a/gbtools/src/blatSrc/lib/seg.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/* seg.c - read/write seg format. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "errAbort.h"
-#include "obscure.h"
-#include "seg.h"
-#include "hash.h"
-#include <fcntl.h>
-
-
-
-
-void segCompFree(struct segComp **pObj)
-/* Free up a segment component. */
-{
-struct segComp *obj = *pObj;
-if (obj == NULL)
-	return;
-freeMem(obj->src);
-freez(pObj);
-}
-
-
-void segCompFreeList(struct segComp **pList)
-/* Free up a list of segment components. */
-{
-struct segComp *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-	{
-	next = el->next;
-	segCompFree(&el);
-	}
-*pList = NULL;
-}
-
-
-void segBlockFree(struct segBlock **pObj)
-/* Free up a segment block. */
-{
-struct segBlock *obj = *pObj;
-if (obj == NULL)
-	return;
-freeMem(obj->name);
-segCompFreeList(&obj->components);
-freez(pObj);
-}
-
-
-void segBlockFreeList(struct segBlock **pList)
-/* Free up a list of segment blocks. */
-{
-struct segBlock *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-	{
-	next = el->next;
-	segBlockFree(&el);
-	}
-*pList = NULL;
-}
-
-
-void segFileFree(struct segFile **pObj)
-/* Free up a segment file including closing file handle if necessary. */
-{
-struct segFile *obj = *pObj;
-if (obj == NULL)
-	return;
-segBlockFreeList(&obj->blocks);
-lineFileClose(&obj->lf);
-freez(pObj);
-}
-
-
-void segFileFreeList(struct segFile **pList)
-/* Free up a list of segment files. */
-{
-struct segFile *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-	{
-	next = el->next;
-	segFileFree(&el);
-	}
-*pList = NULL;
-}
-
-
-struct segFile *segMayOpen(char *fileName)
-/* Open up a segment file for reading. Read header and verify. Prepare
- * for subsequent calls to segNext(). Return NULL if file does not exist. */
-{
-struct segFile *sf;
-struct lineFile *lf;
-char *line, *name, *val, *word;
-char *sig = "##seg";
-
-/* Open fileName. */
-if ((lf = lineFileMayOpen(fileName, TRUE)) == NULL)
-	return NULL;
-AllocVar(sf);
-sf->lf = lf;
-
-/* Check for a valid signature. */
-lineFileNeedNext(lf, &line, NULL);
-if (!startsWith(sig, line))
-	errAbort("%s does not start with %s", fileName, sig);
-line += strlen(sig);
-
-/* parse name=val. */
-while ((word = nextWord(&line)) != NULL)
-	{
-	name = word;
-	val = strchr(word, '=');
-	if (val == NULL)
-		errAbort("Missing = after %s line 1 of %s", name, fileName);
-	*val++ = 0;
-
-	if (sameString(name, "version"))
-		sf->version = atoi(val);
-	}
-
-if (sf->version == 0)
-	errAbort("No version line 1 of %s", fileName);
-
-return sf;
-}
-
-
-struct segFile *segOpen(char *fileName)
-/* Like segMayOpen() above, but prints an error message and aborts if
- * there is a problem. */
-{
-struct segFile *sf = segMayOpen(fileName);
-if (sf == NULL)
-	errnoAbort("Couldn't open %s", fileName);
-return sf;
-}
-
-
-void segRewind(struct segFile *sf)
-/* Seek to beginning of open segment file */
-{
-if (sf == NULL)
-	errAbort("segment file rewind failed -- file not open");
-lineFileSeek(sf->lf, 0, SEEK_SET);
-}
-
-static boolean nextLine(struct lineFile *lf, char **pLine)
-/* Get next line that is not a comment. */
-{
-for (;;)
-	{
-	if (!lineFileNext(lf, pLine, NULL))
-		return FALSE;
-	if (**pLine != '#')
-		return TRUE;
-	}
-}
-
-
-struct segBlock *segNextWithPos(struct segFile *sf, off_t *retOffset)
-/* Return next segment in segment file or NULL if at end. If retOffset
- * is not NULL, return start offset of record in file. */
-{
-struct lineFile *lf = sf->lf;
-struct segBlock *block;
-struct segComp *comp, *tail = NULL;
-char *line, *name, *row[6], *val, *word;
-int wordCount;
-
-/* Loop until we get a segment paragraph or reach end of file. */
-for (;;)
-	{
-	/* Get segment header line. If it's not there assume end of file. */
-	if (!nextLine(lf, &line))
-		{
-		lineFileClose(&sf->lf);
-		return NULL;
-		}
-
-	/* Parse segment header line. */
-	word = nextWord(&line);
-	if (word == NULL)
-		continue;	/* Ignore blank lines. */
-
-	if (sameString(word, "b"))
-		{
-		if (retOffset != NULL)
-			*retOffset = lineFileTell(sf->lf);
-		AllocVar(block);
-		/* Parse name=val. */
-		while ((word = nextWord(&line)) != NULL)
-			{
-			name = word;
-			val = strchr(word, '=');
-			if (val == NULL)
-				errAbort("Missing = after %s line %d of %s",
-					name, lf->lineIx, lf->fileName);
-			*val++ = 0;
-
-			if (sameString(name, "name"))
-				block->name = cloneString(val);
-			else if (sameString(name, "val"))
-				block->val = atoi(val);
-			}
-
-		/* Parse segment components until blank line. */
-		for (;;)
-			{
-			if (!nextLine(lf, &line))
-				errAbort("Unexpected end of file %s", lf->fileName);
-			word = nextWord(&line);
-			if (word == NULL)
-				break;
-			if (sameString(word, "s"))
-				{
-				/* Chop line up by white space. This involves a few +=1's
-				 * because we have already chopped out the first word. */
-				row[0] = word;
-				wordCount = chopByWhite(line, row+1, ArraySize(row)-1) +1;
-				lineFileExpectWords(lf, ArraySize(row), wordCount);
-				AllocVar(comp);
-
-				/* Convert ASCII text representation to segComp structure. */
-				comp->src     = cloneString(row[1]);
-				comp->start   = lineFileNeedNum(lf, row, 2);
-				comp->size    = lineFileNeedNum(lf, row, 3);
-				comp->strand  = row[4][0];
-				comp->srcSize = lineFileNeedNum(lf, row, 5);
-
-				/* Do some sanity checking. */
-				if (comp->size <= 0 || comp->srcSize <= 0)
-					errAbort("Got a negative or zero size line %d of %s",
-						lf->lineIx, lf->fileName);
-				if (comp->start < 0 || comp->start + comp->size > comp->srcSize)
-					errAbort("Coordinates out of range line %d of %s",
-						lf->lineIx, lf->fileName);
-				if (comp->strand != '+' && comp->strand != '-')
-					errAbort("Invalid strand line %d of %s",
-						lf->lineIx, lf->fileName);
-
-				/* Add the new component to the current list. */
-				if (block->components == NULL)
-					block->components = comp;
-				else
-					tail->next = comp;
-				tail = comp;
-				}
-			}
-		return block;
-		}
-		else	/* Skip over paragraph we don't understand. */
-		{
-		for (;;)
-			{
-			if (!nextLine(lf, &line))
-				return NULL;
-			if (nextWord(&line) == NULL)
-				break;
-			}
-		}
-	}
-}
-
-
-struct segBlock *segNext(struct segFile *sf)
-/* Return next segment in segment file or NULL if at end.  This will
- * close the open file handle at the end as well. */
-{
-return segNextWithPos(sf, NULL);
-}
-
-
-struct segFile *segReadAll(char *fileName)
-/* Read in full segment file */
-{
-struct segFile *sf = segOpen(fileName);
-struct segBlock *block, *tail = NULL;
-while ((block = segNext(sf)) != NULL)
-	{
-	if (sf->blocks == NULL)
-		sf->blocks = block;
-	else
-		{
-		tail->next = block;
-		block->prev = tail;
-		}
-	tail = block;
-	}
-return sf;
-}
-
-
-void segWriteStart(FILE *f)
-/* Write segment file header to the file. */
-{
-fprintf(f, "##seg version=1\n");
-}
-
-
-void segWrite(FILE *f, struct segBlock *block)
-/* Write next segment block to the file. */
-{
-struct segComp *comp;
-int srcChars = 0, startChars = 0, sizeChars = 0, srcSizeChars = 0;
-
-/* Write segment block header. */
-fprintf(f, "b");
-if (block->name != NULL)
-	fprintf(f, " name=%s", block->name);
-if (block->val != 0)
-	fprintf(f, " val=%d", block->val);
-fprintf(f, "\n");
-
-/* Figure out length of each field. */
-for (comp = block->components; comp != NULL; comp = comp->next)
-	{
-	int len = 0;
-	/* A name line '.' will break some tools, so replace it with a
-	 * generic name */
-	if (sameString(comp->src, "."))
-		{
-		freeMem(&comp->src);
-		comp->src = cloneString("defaultName");
-		}
-	len = strlen(comp->src);
-	if (srcChars < len)
-		srcChars = len;
-	len = digitsBaseTen(comp->start);
-	if (startChars < len)
-		startChars = len;
-	len = digitsBaseTen(comp->size);
-	if (sizeChars < len)
-		sizeChars = len;
-	len = digitsBaseTen(comp->srcSize);
-	if (srcSizeChars < len)
-		srcSizeChars = len;
-	}
-
-/* Write out each component. */
-for (comp = block->components; comp != NULL; comp = comp->next)
-	{
-	fprintf(f, "s %-*s %*d %*d %c %*d\n",
-		srcChars, comp->src, startChars, comp->start, sizeChars, comp->size,
-		comp->strand, srcSizeChars, comp->srcSize);
-	}
-
-/* Write out blank separator line. */
-fprintf(f, "\n");
-}
-
-
-void segWriteEnd(FILE *f)
-/* Write segment file end tag to the file.  In this case, nothing. */
-{
-}
-
-struct segComp *segMayFindCompSpecies(struct segBlock *sb, char *src,
-	char sepChar)
-/* Find component with a source that matches src up to and possibly
-   including sepChar. Return NULL if not found. */
-{
-struct segComp *sc;
-char *p, *q;
-
-for (sc = sb->components; sc != NULL; sc = sc->next)
-	{
-	for (p = sc->src, q = src;
-		 *p != '\0' && *p != sepChar && *q != '\0' && *q != sepChar;
-		 p++, q++)
-		{
-		if (*p != *q)
-			break;
-		}
-
-	if ((*p == *q)
-		|| (*p == sepChar && *q == '\0')
-		|| (*p == '\0' && *q == sepChar))
-		{
-		return(sc);
-		}
-	}
-
-return(NULL);
-}
-
-
-struct segComp *segFindCompSpecies(struct segBlock *sb, char *src,
-	char sepChar)
-/* Find component with a source that matches src up to and possibly
-   including sepChar or die trying. */
-{
-struct segComp *sc = segMayFindCompSpecies(sb, src, sepChar);
-char *p;
-
-if (sc == NULL)
-	{
-	if ((p = strchr(src, sepChar)) != NULL)
-		*p = '\0';
-
-	errAbort("Couldn't find %s%c or just %s... in block.", src, sepChar, src);
-	}
-
-return(sc);
-}
-
-struct segComp *cloneSegComp(struct segComp *sc)
-/* Return a copy of the argument segment component. */
-{
-struct segComp *newSc;
-
-AllocVar(newSc);
-
-newSc->next    = sc->next;
-newSc->src     = cloneString(sc->src);
-newSc->start   = sc->start;
-newSc->size    = sc->size;
-newSc->strand  = sc->strand;
-newSc->srcSize = sc->srcSize;
-
-return(newSc);
-}
-
-char *segFirstCompSpecies(struct segBlock *sb, char sepChar)
-/* Return the species possibly followed by sepChar of the first component
-   of the argument block. Return NULL if the block has no components. */
-{
-char *p, *species;
-
-if (sb->components == NULL)
-	return(NULL);
-
-/* Temporarily split src into species and chrom. */
-if ((p = strchr(sb->components->src, sepChar)) != NULL)
-	*p = '\0';
-
-species = cloneString(sb->components->src);
-
-/* Restore src. */
-if (p != NULL)
-	*p = sepChar;
-
-return(species);
-}
-
-struct slName *segSecSpeciesList(struct segBlock *sb, struct segComp *refComp,
-    char sepChar)
-/* Return a name list containing the species possibly followed by sepChar
-of all components other than refComp on the block. */
-{
-struct segComp *sc;
-char *p;
-struct slName *speciesList = NULL;
-
-for (sc = sb->components; sc != NULL; sc = sc->next)
-	{
-	if (sc == refComp)
-		continue;
-
-	if ((p = strchr(sc->src, '.')) != NULL)
-		*p = '\0';
-
-	slNameStore(&speciesList, sc->src);
-
-	if (p != NULL)
-		*p = '.';
-	}
-
-return(speciesList);
-}
diff --git a/gbtools/src/blatSrc/lib/seqOut.c b/gbtools/src/blatSrc/lib/seqOut.c
deleted file mode 100644
index 1a44eed..0000000
--- a/gbtools/src/blatSrc/lib/seqOut.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/* seqOut - stuff to output sequences and alignments in web
- * or ascii viewable form.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "obscure.h"
-#include "dnautil.h"
-#include "fuzzyFind.h"
-#include "seqOut.h"
-#include "htmshell.h"
-#include "axt.h"
-
-
-struct cfm *cfmNew(int wordLen, int lineLen,
-	boolean lineNumbers, boolean countDown, FILE *out, int numOff)
-/* Set up colored sequence formatting for html. */
-{
-struct cfm *cfm;
-AllocVar(cfm);
-cfm->inWord = cfm->inLine = cfm->charCount = 0;
-cfm->color = 0;
-cfm->wordLen = wordLen;
-cfm->lineLen = lineLen;
-cfm->lineNumbers = lineNumbers;
-cfm->countDown = countDown;
-cfm->out = out;
-cfm->numOff = numOff;
-cfm->bold = cfm->underline = cfm->italic = FALSE;
-return cfm;
-}
-
-static void cfmPopFormat(struct cfm *cfm)
-/* Restore format to default. */
-{
-if (cfm->color != 0)
-    fprintf(cfm->out, "</span>");
-if (cfm->underline)
-    fprintf(cfm->out, "</span>");
-if (cfm->bold)
-  fprintf(cfm->out, "</B>");
-if (cfm->italic)
-  fprintf(cfm->out, "</I>");
-}
-
-static void cfmPushFormat(struct cfm *cfm)
-/* Set format. */
-{
-if (cfm->italic)
-  fprintf(cfm->out, "<I>");
-if (cfm->bold)
-  fprintf(cfm->out, "<B>");
-if (cfm->underline)
-    fprintf(cfm->out, "<span style='text-decoration:underline;'>");
-if (cfm->color != 0)
-    fprintf(cfm->out, "<span style='color:#%06X;'>", cfm->color);
-}
-
-void cfmOutExt(struct cfm *cfm, char c, int color, boolean underline, boolean bold, boolean italic)
-/* Write out a byte, and formatting extras  */
-{
-if (color != cfm->color || underline != cfm->underline
-   || bold != cfm->bold || italic != cfm->italic)
-   {
-   cfmPopFormat(cfm);
-   cfm->color = color;
-   cfm->underline = underline;
-   cfm->bold = bold;
-   cfm->italic = italic;
-   cfmPushFormat(cfm);
-   }
-
-++cfm->charCount;
-fputc(c, cfm->out);
-if (cfm->wordLen)
-    {
-    if (++cfm->inWord >= cfm->wordLen)
-	{
-	cfmPopFormat(cfm);
-	fputc(' ', cfm->out);
-	cfmPushFormat(cfm);
-	cfm->inWord = 0;
-	}
-    }
-if (cfm->lineLen)
-    {
-    if (++cfm->inLine >= cfm->lineLen)
-	{
-	if (cfm->lineNumbers)
-	    {
-	    int pos = cfm->charCount;
-	    if (cfm->countDown)
-		{
-	        pos = 1-pos;
-		}
-	    pos += cfm->numOff;
-	    cfmPopFormat(cfm);
-	    fprintf(cfm->out, " %d", pos);
-	    cfmPushFormat(cfm);
-	    }
-	fprintf(cfm->out, "\n");
-	cfm->inLine = 0;
-	}
-    }
-}
-
-void cfmOut(struct cfm *cfm, char c, int color)
-/* Write out a byte, and depending on color formatting extras  */
-{
-cfmOutExt(cfm, c, color, FALSE, FALSE, FALSE);
-}
-
-void cfmFree(struct cfm **pCfm)
-/* Finish up cfm formatting job. */
-{
-struct cfm *cfm = *pCfm;
-if (cfm != NULL)
-    {
-    cfmPopFormat(cfm);
-    freez(pCfm);
-    }
-}
-
-int seqOutColorLookup[] =
-    {
-    0x000000,
-    0x3300FF,
-    0x22CCEE,
-    0xFF0033,
-    0xFFcc22,
-    0x00aa00,
-    0xFF0000,
-    };
-
-
-void bafInit(struct baf *baf, DNA *needle, int nNumOff,  boolean nCountDown,
-        DNA *haystack, int hNumOff, boolean hCountDown, FILE *out,
-        int lineSize, boolean isTrans )
-/* Initialize block alignment formatter. */
-{
-baf->cix = 0;
-baf->needle = needle;
-baf->nCountDown = nCountDown;
-baf->haystack = haystack;
-baf->nNumOff = nNumOff;
-baf->hNumOff = hNumOff;
-baf->hCountDown = hCountDown;
-baf->out = out;
-baf->lineSize = lineSize;
-baf->isTrans = isTrans;
-baf->nCurPos = baf->hCurPos = 0;
-baf->nLineStart = baf->hLineStart = 0;
-}
-
-void bafSetAli(struct baf *baf, struct ffAli *ali)
-/* Set up block formatter around an ffAli block. */
-{
-baf->nCurPos = ali->nStart - baf->needle;
-baf->hCurPos = ali->hStart - baf->haystack;
-}
-
-void bafSetPos(struct baf *baf, int nStart, int hStart)
-/* Set up block formatter starting at nStart/hStart. */
-{
-if (baf->isTrans)
-    nStart *= 3;
-baf->nCurPos = nStart;
-baf->hCurPos = hStart;
-}
-
-void bafStartLine(struct baf *baf)
-/* Set up block formatter to start new line at current position. */
-{
-baf->nLineStart = baf->nCurPos;
-baf->hLineStart = baf->hCurPos;
-}
-
-static int maxDigits(int x, int y)
-{
-int xDigits = digitsBaseTen(x);
-int yDigits = digitsBaseTen(y);
-return (xDigits > yDigits ? xDigits : yDigits);
-}
-
-void bafWriteLine(struct baf *baf)
-/* Write out a line of an alignment (which takes up
- * three lines on the screen. */
-{
-int i;
-int count = baf->cix;
-int nStart = baf->nLineStart + 1 + baf->nNumOff;
-int hStart = baf->hLineStart + 1 + baf->hNumOff;
-int nEnd = baf->nCurPos + baf->nNumOff;
-int hEnd = baf->hCurPos + baf->hNumOff;
-int startDigits = maxDigits(nStart, hStart);
-int endDigits = maxDigits(nEnd, hEnd);
-int hStartNum, hEndNum;
-int nStartNum, nEndNum;
-static struct axtScoreScheme *ss = 0;  /* Scoring scheme. */
-struct cfm cfm;
-extern char blosumText[];
-extern struct axtScoreScheme *axtScoreSchemeFromProteinText(char *text, char *fileName);
-boolean revArrows = (baf->nCountDown ^ baf->hCountDown);
-char arrowChar = (revArrows ? '<' : '>');
-
-ZeroVar(&cfm);
-cfm.out = baf->out;
-if (ss == 0)
-    ss = axtScoreSchemeFromProteinText(blosumText, "fake");
-
-if (baf->nCountDown)
-    {
-    nStartNum = baf->nNumOff - baf->nLineStart;
-    nEndNum = 1+baf->nNumOff - baf->nCurPos;
-    }
-else
-    {
-    nStartNum = 1+baf->nNumOff + baf->nLineStart;
-    nEndNum = baf->nNumOff + baf->nCurPos;
-    }
-fprintf(baf->out, "%0*d ", startDigits, nStartNum);
-for (i=0; i<count; ++i)
-    fputc(baf->nChars[i], baf->out);
-fprintf(baf->out, " %0*d\n", endDigits, nEndNum);
-
-for (i=0; i<startDigits; ++i)
-    fputc(arrowChar, baf->out);
-fputc(' ', baf->out);
-for (i=0; i<count; ++i)
-    {
-    char n,h,c =  ' ';
-
-    n = baf->nChars[i];
-    h = baf->hChars[i];
-    if (baf->isTrans)
-        {
-	if (n != ' ')
-	    {
-	    DNA codon[4];
-	    codon[0] = baf->hChars[i-1];
-	    codon[1] = h;
-	    codon[2] = baf->hChars[i+1];
-	    codon[3] = 0;
-	    tolowers(codon);
-	    c  = lookupCodon(codon);
-	    cfmPushFormat(&cfm);
-	    if (toupper(n) == c)
-		cfmOut(&cfm, '|', seqOutColorLookup[0]);
-            else
-                {
-                int color;
-
-                if (c == 0)
-                    c = 'X';
-                if (ss->matrix[(int)toupper(n)][(int)c] > 0)
-		    color = 5;
-		else
-		    color = 6;
-		cfmOut(&cfm, c, seqOutColorLookup[color]);
-		}
-	    cfmPopFormat(&cfm);
-	    }
-	else
-	    {
-	    fputc(c, baf->out);
-	    }
-	}
-    else
-        {
-	if (toupper(n) == toupper(h))
-	     c = '|';
-	fputc(c, baf->out);
-	}
-    }
-fputc(' ', baf->out);
-for (i=0; i<endDigits; ++i)
-    fputc(arrowChar, baf->out);
-fprintf(baf->out, "\n");
-
-if (baf->hCountDown)
-    {
-    hStartNum = baf->hNumOff - baf->hLineStart;
-    hEndNum = 1+baf->hNumOff - baf->hCurPos;
-    }
-else
-    {
-    hStartNum = 1+baf->hNumOff + baf->hLineStart;
-    hEndNum = baf->hNumOff + baf->hCurPos;
-    }
-fprintf(baf->out, "%0*d ", startDigits, hStartNum);
-for (i=0; i<count; ++i)
-    fputc(baf->hChars[i], baf->out);
-fprintf(baf->out, " %0*d\n\n", endDigits, hEndNum);
-}
-
-void bafOut(struct baf *baf, char n, char h)
-/* Write a pair of character to block alignment. */
-{
-baf->nChars[baf->cix] = n;
-baf->hChars[baf->cix] = h;
-if (n != '.' && n != '-')
-    baf->nCurPos += 1;
-if (h != '.' && h != '-')
-    baf->hCurPos += 1;
-if (++(baf->cix) >= baf->lineSize)
-    {
-    bafWriteLine(baf);
-    baf->cix = 0;
-    baf->nLineStart = baf->nCurPos;
-    baf->hLineStart = baf->hCurPos;
-    }
-}
-
-void bafFlushLineNoHr(struct baf *baf)
-/* Write out alignment line if it has any characters in it (no <HR>). */
-{
-if (baf->cix > 0)
-    bafWriteLine(baf);
-fflush(baf->out);
-baf->cix = 0;
-}
-
-void bafFlushLine(struct baf *baf)
-/* Write out alignment line if it has any characters in it, and an <HR>. */
-{
-bafFlushLineNoHr(baf);
-fprintf(baf->out, "<HR ALIGN=\"CENTER\">");
-}
-
diff --git a/gbtools/src/blatSrc/lib/seqStats.c b/gbtools/src/blatSrc/lib/seqStats.c
deleted file mode 100644
index e1e0df0..0000000
--- a/gbtools/src/blatSrc/lib/seqStats.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 2005 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "seqStats.h"
-
-double dnaMatchEntropy(DNA *query, DNA *target, int baseCount)
-/* Return entropy of matching bases - a number between 0 and 1, with
- * higher numbers the more diverse the matching bases. */
-{
-#define log4 1.386294
-#define invLog4 (1.0/log4)
-double p, q, e = 0, invTotal;
-int c, count[4], total;
-int i, qVal, tVal;
-count[0] = count[1] = count[2] = count[3] = 0;
-for (i=0; i<baseCount; ++i)
-    {
-    qVal = ntVal[(int)query[i]];
-    tVal = ntVal[(int)target[i]];
-    if (qVal == tVal && qVal >= 0)
-	count[qVal] += 1;
-    }
-total = count[0] + count[1] + count[2] + count[3];
-invTotal = 1.0/total;
-for (i=0; i<4; ++i)
-    {
-    if ((c = count[i]) > 0)
-        {
-	p = c * invTotal;
-	q = log(p);
-	e -= p*q;
-	}
-    }
-e *= invLog4;
-return e;
-}
-
diff --git a/gbtools/src/blatSrc/lib/servBrcMcw.c b/gbtools/src/blatSrc/lib/servBrcMcw.c
deleted file mode 100644
index 6e945d1..0000000
--- a/gbtools/src/blatSrc/lib/servBrcMcw.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Stuff that's specific for .brc.mcw.edu server goes here. 
- *
- * This file is copyright 2004 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "portable.h"
-#include "portimpl.h"
-#include "obscure.h"
-#include "hash.h"
-
-
-static char *__trashDir = "/trash";
-
-static void _makeTempName(struct tempName *tn, char *base, char *suffix)
-/* Figure out a temp name, and how CGI and HTML will access it. */
-{
-char *tname;
-
-tname = rTempName(__trashDir, base, suffix);
-strcpy(tn->forCgi, tname);
-strcpy(tn->forHtml, tname);
-}
-
-static char *_cgiDir()
-{
-return "/cgi-bin/";
-}
-
-static char *_trashDir()
-{
-return __trashDir;
-}
-
-static double _speed()
-{
-return 3.0;
-}
-    
-struct webServerSpecific wssBrcMcw =
-    {
-    "default",
-    _makeTempName,
-    _cgiDir,
-    _speed,
-    _trashDir,
-    };
diff --git a/gbtools/src/blatSrc/lib/servCrunx.c b/gbtools/src/blatSrc/lib/servCrunx.c
deleted file mode 100644
index a85e1f7..0000000
--- a/gbtools/src/blatSrc/lib/servCrunx.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Stuff that's specific for local linux server goes here. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "portable.h"
-#include "portimpl.h"
-#include "obscure.h"
-
-
-static char *__trashDir = "/home/httpd/html/trash";
-
-static void _makeTempName(struct tempName *tn, char *base, char *suffix)
-/* Figure out a temp name, and how CGI and HTML will access it. */
-{
-char *tname;
-char *tempDirCgi = __trashDir;
-char *tempDirHtml = "/trash";
-int tlcLen = strlen(tempDirCgi);
-int tlhLen = strlen(tempDirHtml);
-
-tname = rTempName(tempDirCgi, base, suffix);
-strcpy(tn->forCgi, tname);
-memcpy(tn->forHtml, tempDirHtml, tlhLen);
-strcpy(tn->forHtml+tlhLen, tn->forCgi+tlcLen);
-}
-
-static char *_cgiDir()
-{
-return "../cgi-bin/";
-}
-
-static char *_trashDir()
-{
-return __trashDir;
-}
-
-static double _speed()
-{
-return 3.0;
-}
-    
-struct webServerSpecific wssLinux =
-    {
-    "linux",
-    _makeTempName,
-    _cgiDir,
-    _speed,
-    _trashDir,
-    };
diff --git a/gbtools/src/blatSrc/lib/servcis.c b/gbtools/src/blatSrc/lib/servcis.c
deleted file mode 100644
index b79e15c..0000000
--- a/gbtools/src/blatSrc/lib/servcis.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Stuff that's specific for Comp Science dept. web server goes here. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "portable.h"
-#include "portimpl.h"
-#include "obscure.h"
-#include "hash.h"
-
-
-static char *__trashDir = "../trash";
-
-static void _makeTempName(struct tempName *tn, char *base, char *suffix)
-/* Figure out a temp name, and how CGI and HTML will access it. */
-{
-char *tname;
-
-tname = rTempName(__trashDir, base, suffix);
-strcpy(tn->forCgi, tname);
-strcpy(tn->forHtml, tname);
-}
-
-static char *_cgiDir()
-{
-return "../cgi-bin/";
-}
-
-static char *_trashDir()
-{
-return __trashDir;
-}
-
-static double _speed()
-{
-return 3.0;
-}
-
-    
-struct webServerSpecific wssDefault =
-    {
-    "default",
-    _makeTempName,
-    _cgiDir,
-    _speed,
-    _trashDir,
-    };
diff --git a/gbtools/src/blatSrc/lib/servcl.c b/gbtools/src/blatSrc/lib/servcl.c
deleted file mode 100644
index 0825d66..0000000
--- a/gbtools/src/blatSrc/lib/servcl.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* "Web Server" for command line execution. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "portable.h"
-#include "portimpl.h"
-#include "obscure.h"
-
-
-static char *__trashDir = ".";
-
-static void _makeTempName(struct tempName *tn, char *base, char *suffix)
-/* Figure out a temp name, and how CGI and HTML will access it. */
-{
-char *tname = rTempName(__trashDir, base, suffix);
-strcpy(tn->forCgi, tname);
-strcpy(tn->forHtml, tn->forCgi);
-}
-
-static char *_cgiDir()
-{
-char *jkwebDir;
-if ((jkwebDir = getenv("JKWEB")) == NULL)
-    return "";
-else
-    return jkwebDir;
-}
-
-static char *_trashDir()
-{
-return __trashDir;
-}
-
-static double _speed()
-{
-return 1.0;
-}
-    
-    
-struct webServerSpecific wssCommandLine =
-    {
-    "commandLine",
-    _makeTempName,
-    _cgiDir,
-    _speed,
-    _trashDir,
-    };
diff --git a/gbtools/src/blatSrc/lib/servmsII.c b/gbtools/src/blatSrc/lib/servmsII.c
deleted file mode 100644
index c56c6c3..0000000
--- a/gbtools/src/blatSrc/lib/servmsII.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Stuff that's specific for the MS II Web Server goes here. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "portable.h"
-#include "portimpl.h"
-#include "obscure.h"
-
-
-static char *__trashDir = "..\\trash";
-
-static void _makeTempName(struct tempName *tn, char *base, char *suffix)
-/* Figure out a temp name, and how CGI and HTML will access it. */
-{
-long tempIx = incCounterFile("tcounter");
-sprintf(tn->forCgi, "%s\\%s%ld%s", __trashDir, base, tempIx, suffix);
-sprintf(tn->forHtml, "%s\\%s%ld%s", __trashDir, base, tempIx, suffix);
-}
-
-static char *_cgiDir()
-{
-return "";
-}
-
-static char *_trashDir()
-{
-return __trashDir;
-}
-
-static double _speed()
-{
-return 2.5;
-}
-
-    
-struct webServerSpecific wssMicrosoftII =
-    {
-    "Microsoft-IIS",
-    _makeTempName,
-    _cgiDir,
-    _speed,
-    _trashDir,
-    };
diff --git a/gbtools/src/blatSrc/lib/servpws.c b/gbtools/src/blatSrc/lib/servpws.c
deleted file mode 100644
index 6ee091e..0000000
--- a/gbtools/src/blatSrc/lib/servpws.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Stuff that's specific for the Personal Web Server goes here. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "portable.h"
-#include "portimpl.h"
-#include "obscure.h"
-
-
-static char *__trashDir = "..\\trash";
-
-static void _makeTempName(struct tempName *tn, char *base, char *suffix)
-/* Figure out a temp name, and how CGI and HTML will access it. */
-{
-long tempIx = incCounterFile("tcounter");
-sprintf(tn->forCgi, "%s\\%s%ld%s", __trashDir, base, tempIx, suffix);
-sprintf(tn->forHtml, "%s\\%s%ld%s", __trashDir, base, tempIx, suffix);
-}
-
-static char *_cgiDir()
-{
-return "../cgi-bin/";
-}
-
-static char *_trashDir()
-{
-return __trashDir;
-}
-
-static double _speed()
-{
-return 1.25;
-}
-        
-struct webServerSpecific wssMicrosoftPWS =
-    {
-    "Microsoft-PWS",
-    _makeTempName,
-    _cgiDir,
-    _speed,
-    _trashDir,
-    };
diff --git a/gbtools/src/blatSrc/lib/shaRes.c b/gbtools/src/blatSrc/lib/shaRes.c
deleted file mode 100644
index 740d472..0000000
--- a/gbtools/src/blatSrc/lib/shaRes.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* ShaRes.c - implementation of shared resources 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "shaRes.h"
-
-
-static void shaFreeNode(struct shaResNode *node)
-/* Free a node.  (Don't look at link count, just do it.) */
-{
-struct shaResNode *next = node->next;
-struct shaResNode *prev = node->prev;
-struct shaResList *list = node->list;
-
-if (next != NULL)
-    next->prev = prev;
-if (prev != NULL)
-    prev->next = next;
-else
-    list->head = next;
-list->freeData(node->data);
-freeMem(node->name);
-freeMem(node);
-}        
-
-void shaUnlink(struct shaResNode *node)
-/* Decrement link count and free if down to zero. */
-{
-if (--node->links <= 0)
-    shaFreeNode(node);
-}
-
-void shaLink(struct shaResNode *node)
-/* Increment link count. */
-{
-++node->links;
-}
-
-struct shaResNode *shaNewNode(struct shaResList *list, char *name, void *data)
-/* Create a new node with link count of one. */
-{
-struct shaResNode *nn = needMem(sizeof(*nn));
-struct shaResNode *head = list->head;
-
-/* Store the goods and what list we're on, and start with one link. */
-nn->list = list;
-nn->data = data;
-nn->links = 1;
-nn->name = cloneString(name);
-
-/* Put us at the front of the list. */
-nn->next = head;
-nn->prev = NULL;
-if (head != NULL)
-    head->prev = nn;
-list->head = nn;
-return nn;
-}
-
-void shaCleanup(struct shaResList *list)
-/* Free every node on list. */
-{
-struct shaResNode *node, *next;
-
-for (node = list->head;node != NULL;node = next)
-    {
-    next = node->next;
-    shaFreeNode(node);
-    }
-list->head = NULL;
-}
-
-void shaInit(struct shaResList *list, void (*freeData)(void *pData))
-/* Start up resource list. */
-{
-list->head = NULL;
-list->freeData = freeData;
-}
diff --git a/gbtools/src/blatSrc/lib/slog.c b/gbtools/src/blatSrc/lib/slog.c
deleted file mode 100644
index a38bcd5..0000000
--- a/gbtools/src/blatSrc/lib/slog.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* slog - fixed point scaled logarithm stuff. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "slog.h"
-
-
-double fSlogScale = 8192.0;	/* Convert to fixed point by multiplying by this. */
-double invSlogScale = 0.0001220703125; /* Conver back to floating point with this. */
-
-int slog(double val)
-/* Return scaled log. */
-{
-return (round(fSlogScale*log(val)));
-}
-
-int carefulSlog(double val)
-/* Returns scaled log that makes sure there's no int overflow. */
-{
-if (val < 0.0000001)
-    val = 0.0000001;
-return slog(val);
-}
-
-double invSlog(int scaledLog)
-/* Inverse of slog. */
-{
-return exp(scaledLog*invSlogScale);
-}
-
diff --git a/gbtools/src/blatSrc/lib/snof.c b/gbtools/src/blatSrc/lib/snof.c
deleted file mode 100644
index cea5631..0000000
--- a/gbtools/src/blatSrc/lib/snof.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/* Snof.c Sorted Name Offset File.
- * This accesses a file of name/offset pairs that are sorted by
- * name.  Does a binary search of file to find the offset given name.
- * Most typically this is used to do a quick lookup given an index file. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "snof.h"
-#include "snofmake.h"
-
-
-void snofClose(struct snof **pSnof)
-/* Close down the index file. */
-{
-struct snof *snof = *pSnof;
-if (snof != NULL)
-    {
-    if (snof->file != NULL)
-        fclose(snof->file);
-    if (snof->first != NULL)
-        freeMem(snof->first);
-    freeMem(snof);
-    *pSnof = NULL;
-    }
-}
-
-static boolean makeSnofName(char *snofName, char *rootName)
-/* Figure out whether it's .xi or .ix by looking at
- * signature.  Usually just need to open a file to
- * do this once per program run. */
-{
-static char *suffixes[2] = {".ix", ".xi"};
-static char *suff = NULL;
-int sigBuf[4];
-FILE *f;
-int i;
-
-if (suff == NULL)
-    {
-    for (i=0; i<ArraySize(suffixes); ++i)
-	{
-	sprintf(snofName, "%s%s", rootName, suffixes[i]);
-	if ((f = fopen(snofName, "rb")) != NULL)
-	    {
-	    if ((fread(sigBuf, sizeof(sigBuf), 1, f)) == 1)
-		{
-		if (isSnofSig(&sigBuf))
-		    {
-		    suff = suffixes[i];
-		    }
-		}
-	    fclose(f);
-	    }
-	if (suff != NULL)
-	    break;
-	}
-    }
-if (suff == NULL)
-    return FALSE;
-sprintf(snofName, "%s%s", rootName, suff);
-return TRUE;
-}
-
-struct snof *snofOpen(char *indexName)
-/* Open up the index file.  Returns NULL if there's any problem. */
-{
-struct snof *snof;
-int sigBuf[4];
-FILE *f;
-char fileName[512];
-
-if (!makeSnofName(fileName, indexName))
-    return NULL;
-if ((snof = needMem(sizeof(*snof))) == NULL)
-    return NULL;
-
-if ((snof->file = f = fopen(fileName, "rb")) == NULL)
-    {
-    freeMem(snof);
-    return NULL;
-    }
-if ((fread(sigBuf, sizeof(sigBuf), 1, f)) != 1)
-    {
-    snofClose(&snof);
-    return NULL;
-    }
-if (!isSnofSig(&sigBuf))
-    {
-    snofClose(&snof);
-    return NULL;
-    }
-if ((fread(&snof->maxNameSize, sizeof(snof->maxNameSize), 1, f)) != 1)
-    {
-    snofClose(&snof);
-    return NULL;
-    }
-snof->headSize = ftell(f);
-snof->itemSize = snof->maxNameSize + sizeof(unsigned);
-if ((snof->first = needMem(5*snof->itemSize)) == NULL)
-    {
-    snofClose(&snof);
-    return NULL;
-    }
-snof->last = snof->first + snof->itemSize;
-snof->less = snof->last + snof->itemSize;
-snof->mid = snof->less + snof->itemSize;
-snof->more = snof->mid + snof->itemSize;
-
-if (fread(snof->first, snof->itemSize, 1, f) != 1)
-    {
-    snofClose(&snof);
-    return NULL;
-    }
-fseek(f, -snof->itemSize, SEEK_END);
-snof->endIx = (ftell(f)-snof->headSize)/snof->itemSize;
-if (fread(snof->last, snof->itemSize, 1, f) != 1)
-    {
-    snofClose(&snof);
-    return NULL;
-    }
-return snof;
-}
-
-struct snof *snofMustOpen(char *indexName)
-/* Open up index file or die. */
-{
-struct snof *snof = snofOpen(indexName);
-if (snof == NULL)
-    errAbort("Couldn't open index file %s", indexName);
-return snof;
-}
-
-static long retrieveOffset(char *item, int itemSize)
-{
-unsigned offset;
-memcpy(&offset, item+itemSize-sizeof(offset), sizeof(offset));
-return offset;
-}
-
-static int snofCmp(char *prefix, char *name, int maxSize, boolean isPrefix)
-{
-if (isPrefix)
-    return memcmp(prefix, name, maxSize);
-else
-    return strcmp(prefix, name);
-}
-
-static boolean snofSearch(struct snof *snof, char *name, int nameSize, 
-    boolean isPrefix, int *pIx, char **pNameOffset)
-/* Find index of name by binary search.
- * Returns FALSE if no such name in the index file. */
- {
-char *startName, *endName, *midName;
-int startIx, endIx, midIx;
-int cmp;
-int itemSize = snof->itemSize;
-FILE *f = snof->file;
-int headSize = snof->headSize;
-
-/* Truncate name size if necessary. */
-if (nameSize > snof->maxNameSize)
-    nameSize = snof->maxNameSize;
-
-/* Set up endpoints of binary search */
-startName = snof->less;
-memcpy(startName, snof->first, itemSize);
-endName = snof->more;
-memcpy(endName, snof->last, itemSize);
-midName = snof->mid;
-
-startIx = 0;
-endIx = snof->endIx;
-
-/* Check for degenerate initial case */
-if (snofCmp(name, startName, nameSize, isPrefix) == 0)
-    {
-    *pIx = startIx;
-    *pNameOffset = startName;
-    return TRUE;
-    }
-if (snofCmp(name, endName, nameSize, isPrefix) == 0)
-    {
-    *pIx = endIx;
-    *pNameOffset =  endName;
-    return TRUE;
-    }
-
-/* Do binary search. */
-for (;;)
-    {
-    midIx = (startIx + endIx ) / 2;
-    if (midIx == startIx || midIx == endIx)
-	{
-        *pIx = -1;
-        return FALSE;
-        }
-    fseek(f, headSize + midIx*itemSize, SEEK_SET);
-    if (fread(midName, itemSize, 1, f) < 1)
-        {
-        *pIx = 0;
-        return FALSE;
-        }
-    cmp = snofCmp(name, midName, nameSize, isPrefix);
-    if (cmp == 0)
-        {
-        *pIx = midIx;
-        *pNameOffset = midName;
-        return TRUE;
-        }
-    else if (cmp > 0)
-	{
-	memcpy(startName, midName, itemSize);
-	startIx = midIx;
-	}
-    else
-	{
-	memcpy(endName, midName, itemSize);
-	endIx = midIx;
-	}
-    }
-}
-
-boolean snofFindOffset(struct snof *snof, char *name, long *pOffset)
-/* Find offset corresponding with name.  Returns FALSE if no such name
- * in the index file. */
-{
-char *nameOffset;
-int matchIx;
-if (!snofSearch(snof, name, strlen(name), FALSE,  &matchIx, &nameOffset))
-    {
-    *pOffset = matchIx; /* Pass along error code such as it is. */
-    return FALSE;
-    }
-*pOffset = retrieveOffset(nameOffset, snof->itemSize);
-return TRUE;
-}
-
-boolean snofFindFirstStartingWith(struct snof *snof, char *prefix, int prefixSize,
-    int *pSnofIx)
-/* Find first index in snof file whose name begins with prefix. */
-{
-char *nameOffset;
-int matchIx;
-if (!snofSearch(snof, prefix, prefixSize, TRUE,  &matchIx, &nameOffset))
-    {
-    *pSnofIx = matchIx; /* Pass along error code such as it is. */
-    return FALSE;
-    }
-while (--matchIx >= 0)
-    {
-    nameOffset = snofNameAtIx(snof, matchIx);
-    if (snofCmp(prefix, nameOffset, prefixSize, TRUE) != 0)
-        break;
-    }
-++matchIx;
-*pSnofIx = matchIx;
-return TRUE;
-}
-
-int snofElementCount(struct snof *snof)
-/* How many names are in snof file? */
-{
-return snof->endIx + 1;
-}
-
-long snofOffsetAtIx(struct snof *snof, int ix)
-/* The offset of a particular index in file. */
-{
-char *nameOffset = snofNameAtIx(snof, ix);
-return retrieveOffset(nameOffset, snof->itemSize);
-}
-
-char *snofNameAtIx(struct snof *snof, int ix)
-/* The name at a particular index in file.  (This will be overwritten by
- * later calls to snof system. Strdup if you want to keep it.)
- */
-{
-fseek(snof->file, snof->headSize + ix*snof->itemSize, SEEK_SET);
-if (fread(snof->mid, snof->itemSize, 1, snof->file) != 1 && ferror(snof->file))
-    errAbort("snofNameAtIx: fread failed: %s", strerror(ferror(snof->file)));
-return snof->mid;
-}
-
-void snofNameOffsetAtIx(struct snof *snof, int ix, char **pName, long *pOffset)
-/* Get both name and offset for an index. */
-{
-char *nameOffset = snofNameAtIx(snof, ix);
-*pName = nameOffset;
-*pOffset = retrieveOffset(nameOffset, snof->itemSize);
-}
-
diff --git a/gbtools/src/blatSrc/lib/snofmake.c b/gbtools/src/blatSrc/lib/snofmake.c
deleted file mode 100644
index 5cf5209..0000000
--- a/gbtools/src/blatSrc/lib/snofmake.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/* snofmake - Write out an index file. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "localmem.h"
-#include "snofmake.h"
-#include "errAbort.h"
-
-
-static jmp_buf errRecover;
-
-static void ourErrAbort()
-/* Default error handler. Prints message and exits
- * program. */
-{
-longjmp(errRecover, -1);
-}
-
-static struct lm *lm;
-
-static void initMem()
-{
-lm = lmInit((1<<16));
-}
-
-static void cleanupMem()
-{
-lmCleanup(&lm);
-}
-
-static void *localNeedMem(int size)
-{
-return lmAlloc(lm, size);
-}
-
-struct offsetList
-    {
-    struct offsetList *next;
-    char *name;
-    unsigned offset;
-    };
-
-static struct offsetList *newOffset(char *name, int nameLen)
-/* Return a fresh name list entry. */
-{
-struct offsetList *nl = localNeedMem(sizeof(*nl));
-nl->name = localNeedMem(nameLen+1);
-memcpy(nl->name, name, nameLen);
-nl->name[nameLen] = 0;
-return nl;
-}
-
-static int cmpOffsetPointers(const void *va, const void *vb)
-/* comparison function for qsort on an array of offset pointers*/
-{
-struct offsetList **pa, **pb;
-struct offsetList *a, *b;
-pa = (struct offsetList **)va;
-pb = (struct offsetList **)vb;
-a = *pa;
-b = *pb;
-return strcmp(a->name, b->name);
-}
-
-static int longestNameSize(struct offsetList *list)
-{
-struct offsetList *el;
-int size, longestSize = 0;
-
-for (el = list; el != NULL; el = el->next)
-    {
-    size = strlen(el->name);
-    if (size > longestSize) 
-        {
-        longestSize = size;
-        }
-    }
-return longestSize;
-}
-
-static struct offsetList *makeOffsetList(FILE *inFile, 
-    boolean (*nextRecord)(FILE *inFile, void *data, char **rName, int *rNameLen), void *data)
-/* Build up a list of records and their offsets into file. */
-{
-struct offsetList *list = NULL;
-struct offsetList *newEl;
-for (;;)
-    {
-    long offset = ftell(inFile);
-    char *name;
-    int nameLen;
-    if (!nextRecord(inFile, data, &name, &nameLen))
-        break;
-    if (nameLen > 0)
-        {
-        newEl = newOffset(name, nameLen);
-        newEl->offset = offset;
-        newEl->next = list;
-        list = newEl;
-        }
-    }
-slReverse(&list);
-return list;
-}
-
-boolean warnAboutDupes(struct offsetList **array, int size)
-/* Since list is sorted it's easy to warn about duplications. */
-{
-char *name, *prevName;
-int i;
-boolean ok = TRUE;
-
-if (size < 2)
-    return FALSE;
-prevName = array[0]->name;
-for (i=1; i<size; ++i)
-    {
-    name = array[i]->name;
-    if (!differentWord(name, prevName))
-	{
-        warn("Duplicate strings: %s %s", prevName, name);
-	ok = FALSE;
-	}
-    prevName = name;
-    }
-return ok;
-}
-
-static void makeIndex(FILE *in, FILE *out, 
-    boolean (*nextRecord)(FILE *in, void *data, char **rName, int *rNameLen), void *data,
-    boolean dupeOk)
-/* Make index.  Throw error if there's a problem. */
-{
-struct offsetList *list;
-int listSize;
-struct offsetList **array;
-int i;
-struct offsetList *el;
-int nameSize;
-char *nameBuf;
-char *indexSig;
-int indexSigSize;
-
-printf("Reading input\n");
-list = makeOffsetList(in, nextRecord, data);
-listSize = slCount(list);
-array = localNeedMem(listSize * sizeof(*array));
-nameSize = longestNameSize(list)+1;
-
-printf("Got %d offsets %d nameSize.  Sorting...\n", listSize, nameSize);
-nameBuf = localNeedMem(nameSize);
-
-/* Make an array of pointers, one for each element in list. */
-for (i=0, el = list; i<listSize; i+=1, el = el->next)
-    array[i] = el;
-
-/* Sort alphabetically based on name. */
-qsort(array, listSize, sizeof(array[0]), cmpOffsetPointers);
-if (!dupeOk)
-    warnAboutDupes(array, listSize);
-
-/* Write out file header */
-printf("Writing index file \n");
-snofSignature(&indexSig, &indexSigSize);
-mustWrite(out, indexSig, indexSigSize);
-mustWrite(out, &nameSize, sizeof(nameSize));
-    
-/* Write out sorted output */
-for (i=0; i<listSize; ++i)
-    {
-    zeroBytes(nameBuf, nameSize);
-    strcpy(nameBuf, array[i]->name);
-    mustWrite(out, nameBuf, nameSize);
-    mustWrite(out, &array[i]->offset, sizeof(array[i]->offset));
-    }
-}
-
-boolean snofDupeOkIndex(FILE *inFile, char *outName, 
-    boolean (*nextRecord)(FILE *inFile, void *data, char **rName, int *rNameLen), 
-    void *data, boolean dupeOk)
-/* Make an index file, as in snofMakeIndex, but optionally allow duplicates
- * without complaining. */
-{
-FILE *outFile;
-int status;
-
-/* Initialize */
-if ((outFile = fopen(outName, "wb")) == NULL)
-    {
-    fprintf(stderr, "Couldn't create index file %s\n", outName);
-    return FALSE;
-    }
-initMem();
-
-/* Wrap error recovery around main routine. */
-status = setjmp(errRecover);
-if (status == 0)
-    {
-    pushAbortHandler(ourErrAbort);
-    makeIndex(inFile, outFile, nextRecord, data, dupeOk);
-    }
-popAbortHandler();
-
-/* Cleanup. */
-fclose(outFile);
-cleanupMem();
-return status == 0;
-}
-
-boolean snofMakeIndex(FILE *inFile, char *outName, 
-    boolean (*nextRecord)(FILE *inFile, void *data, char **rName, int *rNameLen), 
-    void *data)
-/* Make an index file - name/offset pairs that are sorted by name.
- * Inputs:
- *     inFile - open file that you're indexing with header read and verified.
- *     outName - name of index file to create
- *     nextRecord - function that reads next record in file you're indexing
- *                  and returns the name of that record.
- *     data - void pointer passed through to nextRecord.
- *
- * In this implementation this function just is an error recovery wrapper
- * around the local function makeIndex, which does the real work. */
-{
-return snofDupeOkIndex(inFile, outName, nextRecord, data, FALSE);
-}
-
diff --git a/gbtools/src/blatSrc/lib/snofsig.c b/gbtools/src/blatSrc/lib/snofsig.c
deleted file mode 100644
index 9ae6b22..0000000
--- a/gbtools/src/blatSrc/lib/snofsig.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* snofSig - signature (first 16 bytes) of a snof format file. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "snofmake.h"
-
-
-static int ixSig[4] = {0x693F8ED1, 0x7EDA1C32, 0x4BA58983, 0x277CB89C,};
-
-void snofSignature(char **rSig, int *rSigSize)
-/* Return signature. */
-{
-*rSig = (char *)ixSig;
-*rSigSize = sizeof(ixSig);
-}
-
-boolean isSnofSig(void *sig)
-/* Return true if sig is right. */
-{
-return memcmp(sig, ixSig, sizeof(ixSig)) == 0;
-}
-
diff --git a/gbtools/src/blatSrc/lib/spaceSaver.c b/gbtools/src/blatSrc/lib/spaceSaver.c
deleted file mode 100644
index b39bd60..0000000
--- a/gbtools/src/blatSrc/lib/spaceSaver.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* spaceSaver - routines that help layout 1-D objects into a
- * minimum number of tracks so that no two objects overlap
- * within a single track. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "spaceSaver.h"
-
-
-
-struct spaceSaver *spaceSaverMaxCellsNew(int winStart, int winEnd, int maxRows, int maxCells)
-/* Create a new space saver around the given window.   */
-{
-struct spaceSaver *ss;
-float winWidth;
-
-AllocVar(ss);
-ss->winStart = winStart;
-ss->winEnd = winEnd;
-ss->maxRows = maxRows;
-winWidth = winEnd - winStart;
-ss->cellsInRow = winWidth;
-while (ss->cellsInRow > maxCells)
-    ss->cellsInRow /= 2;
-ss->scale = ss->cellsInRow/winWidth;
-return ss;
-}
-
-struct spaceSaver *spaceSaverNew(int winStart, int winEnd, int maxRows)
-/* Create a new space saver around the given window.   */
-{
-return spaceSaverMaxCellsNew(winStart, winEnd, maxRows, 800);
-}
-
-void spaceSaverFree(struct spaceSaver **pSs)
-/* Free up a space saver. */
-{
-struct spaceSaver *ss = *pSs;
-if (ss != NULL)
-    {
-    struct spaceRowTracker *srt;
-    for (srt = ss->rowList; srt != NULL; srt = srt->next)
-	freeMem(srt->used);
-    slFreeList(&ss->rowList);
-    slFreeList(&ss->nodeList);
-    freez(pSs);
-    }
-}
-
-static boolean allClear(bool *b, int count)
-/* Return TRUE if count bools starting at b are all 0 */
-{
-int i;
-for (i=0; i<count; ++i)
-    if (b[i])
-	return FALSE;
-return TRUE;
-}
-
-struct spaceNode *spaceSaverAddOverflow(struct spaceSaver *ss, int start, int end, 
-					void *val, boolean allowOverflow)
-/* Add a new node to space saver. Returns NULL if can't fit item in
- * and allowOverflow == FALSE. If allowOverflow == TRUE then put items
- * that won't fit in last row. */
-{
-int cellStart, cellEnd, cellWidth;
-struct spaceRowTracker *srt, *freeSrt = NULL;
-int rowIx = 0;
-struct spaceNode *sn;
-
-if (ss->isFull)
-    return NULL;
-
-if ((start -= ss->winStart) < 0)
-    start = 0;
-end -= ss->winStart;	/* We'll clip this in cell coordinates. */
-
-cellStart = round(start * ss->scale);
-cellEnd = round(end * ss->scale)+1;
-if (cellEnd > ss->cellsInRow)
-    cellEnd = ss->cellsInRow;
-cellWidth = cellEnd - cellStart;
-
-/* Find free row. */
-for (srt = ss->rowList; srt != NULL; srt = srt->next)
-    {
-    if (allClear(srt->used + cellStart, cellWidth))
-	{
-	freeSrt = srt;
-	break;
-	}
-    ++rowIx;
-    }
-
-/* If no free row make new row. */
-if (freeSrt == NULL)
-    {
-    if (ss->rowCount >= ss->maxRows)
-	{
-	/* Abort if too many rows and no
-	   overflow allowed. */
-	if(!allowOverflow) 
-	    {
-	    ss->isFull = TRUE;
-	    return NULL;
-	    }
-	}
-    else 
-	{
-	AllocVar(freeSrt);
-	freeSrt->used = needMem(ss->cellsInRow);
-	slAddTail(&ss->rowList, freeSrt);
-	++ss->rowCount;
-	}
-    }
-
-/* Mark that part of row used (except in overflow case). */
-if(freeSrt != NULL)
-    memset(freeSrt->used + cellStart, 1, cellWidth);
-
-/* Make a space node. If allowing overflow it will
- all end up in the last row. */
-AllocVar(sn);
-sn->row = rowIx;
-sn->val = val;
-slAddHead(&ss->nodeList, sn);
-return sn;
-}
-
-struct spaceNode *spaceSaverAdd(struct spaceSaver *ss, 
-	int start, int end, void *val)
-/* Add a new node to space saver. Returns NULL if can't fit
- * item in. */
-{
-return spaceSaverAddOverflow(ss, start, end, val, FALSE);
-}
-
-void spaceSaverFinish(struct spaceSaver *ss)
-/* Tell spaceSaver done adding nodes. */
-{
-slReverse(&ss->nodeList);
-}
diff --git a/gbtools/src/blatSrc/lib/spacedColumn.c b/gbtools/src/blatSrc/lib/spacedColumn.c
deleted file mode 100644
index 371216b..0000000
--- a/gbtools/src/blatSrc/lib/spacedColumn.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* spacedColumn - stuff to handle parsing text files where fields are
- * fixed width rather than tab delimited. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "linefile.h"
-#include "spacedColumn.h"
-#include "obscure.h"
-#include "sqlNum.h"
-
-
-struct spacedColumn *spacedColumnFromSample(char *sample)
-/* Return spaced column list from a sampleline , which is assumed to
- * have no spaces except between columns */
-{
-struct spacedColumn *col, *colList = NULL;
-char *dupe = cloneString(sample);
-char *word, *line = dupe;
-while ((word = nextWord(&line)) != NULL)
-    {
-    AllocVar(col);
-    col->start = word - dupe;
-    col->size = strlen(word);
-    slAddHead(&colList, col);
-    }
-freeMem(dupe);
-slReverse(&colList);
-return colList;
-}
-
-struct spacedColumn *spacedColumnFromLineFile(struct lineFile *lf)
-/* Scan through lineFile and figure out column spacing. Assumes
- * file contains nothing but columns. */
-{
-int maxLine = 64*1024;
-int lineSize, widestLine = 0;
-char *projection = needMem(maxLine+1);
-char *line;
-struct spacedColumn *colList;
-int i;
-
-/* Create projection of all lines. */
-for (i=0; i<maxLine; ++i)
-    projection[i] = ' ';
-while (lineFileNext(lf, &line, &lineSize))
-    {
-    if (lineSize > widestLine)
-         widestLine = lineSize;
-    for (i=0; i<lineSize; ++i)
-        {
-	char c = line[i];
-	if (c != 0 && c != ' ')
-	    projection[i] = line[i];
-	}
-    }
-projection[widestLine] = 0;
-colList = spacedColumnFromSample(projection);
-freeMem(projection);
-return colList;
-}
-
-struct spacedColumn *spacedColumnFromFile(char *fileName)
-/* Read file and figure out where columns are. */
-{
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-struct spacedColumn *colList = spacedColumnFromLineFile(lf);
-lineFileClose(&lf);
-return colList;
-}
-
-int spacedColumnBiggestSize(struct spacedColumn *colList)
-/* Return size of biggest column. */
-{
-int maxSize = 0;
-struct spacedColumn *col;
-for (col = colList; col != NULL; col = col->next)
-    if (maxSize < col->size)
-        maxSize = col->size;
-return maxSize;
-}
-
-boolean spacedColumnParseLine(struct spacedColumn *colList, 
-	char *line, char *row[])
-/* Parse line into row according to colList.  This will
- * trim leading and trailing spaces. It will write 0's
- * into line.  Returns FALSE if there's a problem (like
- * line too short.) */
-{
-struct spacedColumn *col;
-int i, len = strlen(line);
-for (i=0, col = colList; col != NULL; col = col->next, ++i)
-    {
-    if (col->start > len)
-	return FALSE;
-    int end = col->start + col->size;
-    if (end > len) end = len;
-    line[end] = 0;
-    row[i] = trimSpaces(line + col->start);
-    }
-return TRUE;
-}
-
-struct spacedColumn *spacedColumnFromWidthArray(int array[], int size)
-/* Return a list of spaced columns corresponding to widths in array.
- * The final char in each column should be whitespace. */
-{
-struct spacedColumn *col, *colList = NULL;
-int i;
-int start = 0;
-for (i=0; i<size; ++i)
-    {
-    int width = array[i];
-    AllocVar(col);
-    col->start = start;
-    col->size = width-1;
-    slAddHead(&colList, col);
-    start += width;
-    }
-slReverse(&colList);
-return colList;
-}
-
-struct spacedColumn *spacedColumnFromSizeCommaList(char *commaList)
-/* Given an comma-separated list of widths in ascii, return
- * a list of spacedColumns. */
-{
-struct slName *ascii, *asciiList = commaSepToSlNames(commaList);
-int colCount = slCount(asciiList);
-int widths[colCount], i;
-for (ascii = asciiList, i=0; ascii != NULL; ascii = ascii->next, ++i)
-    widths[i] = sqlUnsigned(ascii->name);
-slFreeList(&asciiList);
-return spacedColumnFromWidthArray(widths, colCount);
-}
-
diff --git a/gbtools/src/blatSrc/lib/spacedSeed.c b/gbtools/src/blatSrc/lib/spacedSeed.c
deleted file mode 100644
index 4554eb4..0000000
--- a/gbtools/src/blatSrc/lib/spacedSeed.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* spacedSeed - stuff to help with spaced seeds for alignments. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "spacedSeed.h"
-
-
-/* Seeds - the weight 9 and 11 seeds are from PatternHunter paper.
- * The weights 10,12,13,14,15,16,17 and 18 are from the Choi, Zeng,
- * and Zhang paper.  The others are just guesses. */
-
-char *spacedSeeds[] = {
-    /*  0 */ "",
-    /*  1 */ "1",
-    /*  2 */ "11",
-    /*  3 */ "1101",
-    /*  4 */ "110101",
-    /*  5 */ "1101011",
-    /*  6 */ "111001011",
-    /*  7 */ "1110010111",
-    /*  8 */ "1110010100111",
-    /*  9 */ "111001010011011",
-    /* 10 */ "1101100011010111",
-    /* 11 */ "111010010100110111",
-    /* 12 */ "111010110100110111",
-    /* 13 */ "11101011001100101111",
-    /* 14 */ "111011100101100101111",
-    /* 15 */ "11110010101011001101111",
-#ifdef EVER_NEEDED_IN_64_BIT_MACHINE
-    /* 16 */ "111100110101011001101111",
-    /* 17 */ "111101010111001101101111",
-    /* 18 */ "1111011001110101011011111",
-#endif /* EVER_NEEDED_IN_64_BIT_MACHINE */
-};
-
-int spacedSeedMaxWeight()
-/* Return max weight of spaced seed. */
-{
-return ArraySize(spacedSeeds)-1;
-}
-
-int *spacedSeedOffsets(int weight)
-/* Return array with offsets for seed of given weight. */
-{
-char *seed;
-int *output, offset, outCount = 0, seedSize;
-
-assert(weight >= 1 && weight < ArraySize(spacedSeeds));
-seed = spacedSeeds[weight];
-seedSize = strlen(seed);
-AllocArray(output, weight);
-for (offset=0; offset<seedSize; ++offset)
-    {
-    if (seed[offset] == '1')
-	output[outCount++] = offset;
-    }
-assert(outCount == weight);
-return output;
-}
-
-int spacedSeedSpan(int weight)
-/* Return span of seed of given weight */
-{
-return strlen(spacedSeeds[weight]);
-}
-
diff --git a/gbtools/src/blatSrc/lib/splatAli.as b/gbtools/src/blatSrc/lib/splatAli.as
deleted file mode 100644
index 0e8c7c0..0000000
--- a/gbtools/src/blatSrc/lib/splatAli.as
+++ /dev/null
@@ -1,12 +0,0 @@
-table splatAli
-"A parsed out splat format alignment."
-    (
-    string chrom;	"Chromosome mapped to"
-    int chromStart;	"Start position in chromosome (zero based)"
-    int chromEnd;	"End position in genome (one based)"
-    string alignedBases;"Tag bases - in upper case for match, -/^ for insert/delete"
-    int score;		"Mapping score. 1000/placesMapped"
-    char[1] strand;     "+ or - for strand"
-    string readName;	"Name of read"
-    )
-
diff --git a/gbtools/src/blatSrc/lib/splatAli.c b/gbtools/src/blatSrc/lib/splatAli.c
deleted file mode 100644
index dcd9809..0000000
--- a/gbtools/src/blatSrc/lib/splatAli.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* splatAli.c was originally generated by the autoSql program, which also 
- * generated splatAli.h and splatAli.sql.  This module links the database and
- * the RAM representation of objects. */
-/* This file is copyright 2008 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "linefile.h"
-#include "dystring.h"
-#include "sqlNum.h"
-#include "sqlList.h"
-#include "splatAli.h"
-
-
-void splatAliStaticLoad(char **row, struct splatAli *ret)
-/* Load a row from splatAli table into ret.  The contents of ret will
- * be replaced at the next call to this function. */
-{
-
-ret->chrom = row[0];
-ret->chromStart = sqlSigned(row[1]);
-ret->chromEnd = sqlSigned(row[2]);
-ret->alignedBases = row[3];
-ret->score = sqlSigned(row[4]);
-safecpy(ret->strand, sizeof(ret->strand), row[5]);
-ret->readName = row[6];
-}
-
-struct splatAli *splatAliLoad(char **row)
-/* Load a splatAli from row fetched with select * from splatAli
- * from database.  Dispose of this with splatAliFree(). */
-{
-struct splatAli *ret;
-
-AllocVar(ret);
-ret->chrom = cloneString(row[0]);
-ret->chromStart = sqlSigned(row[1]);
-ret->chromEnd = sqlSigned(row[2]);
-ret->alignedBases = cloneString(row[3]);
-ret->score = sqlSigned(row[4]);
-safecpy(ret->strand, sizeof(ret->strand), row[5]);
-ret->readName = cloneString(row[6]);
-return ret;
-}
-
-struct splatAli *splatAliLoadAll(char *fileName) 
-/* Load all splatAli from a whitespace-separated file.
- * Dispose of this with splatAliFreeList(). */
-{
-struct splatAli *list = NULL, *el;
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *row[7];
-
-while (lineFileRow(lf, row))
-    {
-    el = splatAliLoad(row);
-    slAddHead(&list, el);
-    }
-lineFileClose(&lf);
-slReverse(&list);
-return list;
-}
-
-struct splatAli *splatAliLoadAllByChar(char *fileName, char chopper) 
-/* Load all splatAli from a chopper separated file.
- * Dispose of this with splatAliFreeList(). */
-{
-struct splatAli *list = NULL, *el;
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *row[7];
-
-while (lineFileNextCharRow(lf, chopper, row, ArraySize(row)))
-    {
-    el = splatAliLoad(row);
-    slAddHead(&list, el);
-    }
-lineFileClose(&lf);
-slReverse(&list);
-return list;
-}
-
-struct splatAli *splatAliCommaIn(char **pS, struct splatAli *ret)
-/* Create a splatAli out of a comma separated string. 
- * This will fill in ret if non-null, otherwise will
- * return a new splatAli */
-{
-char *s = *pS;
-
-if (ret == NULL)
-    AllocVar(ret);
-ret->chrom = sqlStringComma(&s);
-ret->chromStart = sqlSignedComma(&s);
-ret->chromEnd = sqlSignedComma(&s);
-ret->alignedBases = sqlStringComma(&s);
-ret->score = sqlSignedComma(&s);
-sqlFixedStringComma(&s, ret->strand, sizeof(ret->strand));
-ret->readName = sqlStringComma(&s);
-*pS = s;
-return ret;
-}
-
-void splatAliFree(struct splatAli **pEl)
-/* Free a single dynamically allocated splatAli such as created
- * with splatAliLoad(). */
-{
-struct splatAli *el;
-
-if ((el = *pEl) == NULL) return;
-freeMem(el->chrom);
-freeMem(el->alignedBases);
-freeMem(el->readName);
-freez(pEl);
-}
-
-void splatAliFreeList(struct splatAli **pList)
-/* Free a list of dynamically allocated splatAli's */
-{
-struct splatAli *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    splatAliFree(&el);
-    }
-*pList = NULL;
-}
-
-void splatAliOutput(struct splatAli *el, FILE *f, char sep, char lastSep) 
-/* Print out splatAli.  Separate fields with sep. Follow last field with lastSep. */
-{
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->chrom);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%d", el->chromStart);
-fputc(sep,f);
-fprintf(f, "%d", el->chromEnd);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->alignedBases);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%d", el->score);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->strand);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->readName);
-if (sep == ',') fputc('"',f);
-fputc(lastSep,f);
-}
-
-/* -------------------------------- End autoSql Generated Code -------------------------------- */
-
-int splatAliCmpReadName(const void *va, const void *vb)
-/* Compare two based on readName. Also separate secondarily on chrom position. */
-{
-const struct splatAli *a = *((struct splatAli **)va);
-const struct splatAli *b = *((struct splatAli **)vb);
-int diff = strcmp(a->readName, b->readName);
-if (diff == 0)
-    diff = a->chromStart - b->chromStart;
-if (diff == 0)
-    diff = a->chromEnd - b->chromEnd;
-if (diff == 0)
-    diff = a->strand - b->strand;
-if (diff == 0)
-    diff = strcmp(a->chrom, b->chrom);
-return diff;
-}
-
-int splatAliScore(char *ali)
-/* Score splat-encoded alignment. */
-{
-int score = 0;
-char c;
-while ((c = *ali++))
-    {
-    switch (c)
-        {
-	case 'a':
-	case 'c':
-	case 'g':
-	case 't':
-	    score -= 2;
-	    break;
-	case 'A':
-	case 'C':
-	case 'G':
-	case 'T':
-	    score += 2;
-	    break;
-	case 'n':
-	case 'N':
-	    break;
-	case '^':
-	    score -= 3;
-	    ali += 1;
-	    break;
-	case '-':
-	    score -= 3;
-	    break;
-	}
-    }
-return score;
-}
-
-void splatAliLookForBest(struct splatAli *start, struct splatAli *end, 
-	int *retBestScore, int *retBestCount)
-/* Scan through list from start up to but not including end (which may be NULL)
- * and figure out best score and number of elements in list with that score. */
-{
-int bestScore = 0, bestCount = 0;
-struct splatAli *el;
-for (el = start; el != end; el = el->next)
-    {
-    int score = splatAliScore(el->alignedBases);
-    if (score >= bestScore)
-        {
-	if (score > bestScore)
-	    {
-	    bestScore = score;
-	    bestCount = 1;
-	    }
-	else
-	    bestCount += 1;
-	}
-    }
-*retBestScore = bestScore;
-*retBestCount = bestCount;
-}
-
diff --git a/gbtools/src/blatSrc/lib/sqlList.c b/gbtools/src/blatSrc/lib/sqlList.c
deleted file mode 100644
index b51e162..0000000
--- a/gbtools/src/blatSrc/lib/sqlList.c
+++ /dev/null
@@ -1,1273 +0,0 @@
-/* Stuff for processing comma separated lists - a little long so
- * in a separate module from jksql.c though interface is still
- * in jksql.c. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-/* The various static routines sql<Type>StaticArray are NOT thread-safe. */
-
-#include "common.h"
-#include "sqlNum.h"
-#include "sqlList.h"
-#include "dystring.h"
-#include "hash.h"
-
-
-int sqlByteArray(char *s, signed char *array, int arraySize)
-/* Convert comma separated list of numbers to an array.  Pass in 
- * array an max size of array. */
-{
-unsigned count = 0;
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0 || count == arraySize)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    array[count++] = sqlSigned(s);
-    s = e;
-    }
-return count;
-}
-
-void sqlByteStaticArray(char *s, signed char **retArray, int *retSize)
-/* Convert comma separated list of numbers to an array which will be
- * overwritten next call to this function, but need not be freed. */
-{
-static signed char *array = NULL;
-static unsigned alloc = 0;
-unsigned count = 0;
-
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    if (count >= alloc)
-	{
-	if (alloc == 0)
-	    alloc = 64;
-	else
-	    alloc <<= 1;
-	ExpandArray(array, count, alloc);
-	}
-    array[count++] = sqlSigned(s);
-    s = e;
-    }
-*retSize = count;
-*retArray = array;
-}
-
-void sqlByteDynamicArray(char *s, signed char **retArray, int *retSize)
-/* Convert comma separated list of numbers to an dynamically allocated
- * array, which should be freeMem()'d when done. Thread-safe. */
-{
-signed char *array = NULL;
-int count = 0;
-
-if (s)
-    {
-    count = countSeparatedItems(s, ',');
-    if (count > 0)
-	{
-	AllocArray(array, count);
-	count = 0;
-	for (;;)
-	    {
-	    array[count++] = sqlSignedInList(&s);
-	    if (*s++ == 0)
-		break;
-	    if (*s == 0)
-		break;
-	    }
-	}
-    }
-*retArray = array;
-*retSize = count;
-}
-
-/*-------------------------*/
-
-int sqlUbyteArray(char *s, unsigned char *array, int arraySize)
-/* Convert comma separated list of numbers to an array.  Pass in 
- * array an max size of array. */
-{
-unsigned count = 0;
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0 || count == arraySize)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    array[count++] = sqlUnsigned(s);
-    s = e;
-    }
-return count;
-}
-
-void sqlUbyteStaticArray(char *s, unsigned char **retArray, int *retSize)
-/* Convert comma separated list of numbers to an array which will be
- * overwritten next call to this function, but need not be freed. */
-{
-static unsigned char *array = NULL;
-static unsigned alloc = 0;
-unsigned count = 0;
-
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    if (count >= alloc)
-	{
-	if (alloc == 0)
-	    alloc = 64;
-	else
-	    alloc <<= 1;
-	ExpandArray(array, count, alloc);
-	}
-    array[count++] = sqlUnsigned(s);
-    s = e;
-    }
-*retSize = count;
-*retArray = array;
-}
-
-void sqlUbyteDynamicArray(char *s, unsigned char **retArray, int *retSize)
-/* Convert comma separated list of numbers to an dynamically allocated
- * array, which should be freeMem()'d when done. Thread-safe. */
-{
-unsigned char *array = NULL;
-int count = 0;
-
-if (s)
-    {
-    count = countSeparatedItems(s, ',');
-    if (count > 0)
-	{
-	AllocArray(array, count);
-	count = 0;
-	for (;;)
-	    {
-	    array[count++] = sqlUnsignedInList(&s);
-	    if (*s++ == 0)
-		break;
-	    if (*s == 0)
-		break;
-	    }
-	}
-    }
-*retArray = array;
-*retSize = count;
-}
-
-/*-------------------------*/
-
-int sqlCharArray(char *s, char *array, int arraySize)
-/* Convert comma separated list of chars to an array.  Pass in 
- * array and max size of array. */
-{
-unsigned count = 0;
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0 || count == arraySize)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    array[count++] = s[0];
-    s = e;
-    }
-return count;
-}
-
-void sqlCharStaticArray(char *s, char **retArray, int *retSize)
-/* Convert comma separated list of chars to an array which will be
- * overwritten next call to this function, but need not be freed. */
-{
-static char *array = NULL;
-static unsigned alloc = 0;
-unsigned count = 0;
-
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    if (count >= alloc)
-	{
-	if (alloc == 0)
-	    alloc = 64;
-	else
-	    alloc <<= 1;
-	ExpandArray(array, count, alloc);
-	}
-    array[count++] = s[0];
-    s = e;
-    }
-*retSize = count;
-*retArray = array;
-}
-
-void sqlCharDynamicArray(char *s, char **retArray, int *retSize)
-/* Convert comma separated list of chars to a dynamically allocated
- * array, which should be freeMem()'d when done. Thread-safe. */
-{
-char *array = NULL;
-int count = 0;
-
-if (s)
-    {
-    count = countSeparatedItems(s, ',');
-    if (count > 0)
-	{
-	AllocArray(array, count);
-	count = 0;
-	for (;;)
-	    {
-	    if (*s == ',')
-		errAbort("Empty element in list. Each element should contain one character.");
-	    array[count++] = *s++;
-	    if (!(*s == 0 || *s == ','))
-		{
-		--s;
-		char *e = strchr(s, ',');
-		if (e)
-		    *e = 0;
-		errAbort("Invalid character: %s", s);
-		}
-	    if (*s++ == 0)
-		break;
-	    if (*s == 0)
-		break;
-	    }
-	}
-    }
-*retArray = array;
-*retSize = count;
-}
-
-/*-------------------------*/
-
-int sqlShortArray(char *s, short *array, int arraySize)
-/* Convert comma separated list of numbers to an array.  Pass in 
- * array an max size of array. */
-{
-unsigned count = 0;
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0 || count == arraySize)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    array[count++] = sqlSigned(s);
-    s = e;
-    }
-return count;
-}
-
-void sqlShortStaticArray(char *s, short **retArray, int *retSize)
-/* Convert comma separated list of numbers to an array which will be
- * overwritten next call to this function, but need not be freed. */
-{
-static short *array = NULL;
-static unsigned alloc = 0;
-unsigned count = 0;
-
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    if (count >= alloc)
-	{
-	if (alloc == 0)
-	    alloc = 64;
-	else
-	    alloc <<= 1;
-	ExpandArray(array, count, alloc);
-	}
-    array[count++] = sqlSigned(s);
-    s = e;
-    }
-*retSize = count;
-*retArray = array;
-}
-
-void sqlShortDynamicArray(char *s, short **retArray, int *retSize)
-/* Convert comma separated list of numbers to an dynamically allocated
- * array, which should be freeMem()'d when done. Thread-safe. */
-{
-short *array = NULL;
-int count = 0;
-
-if (s)
-    {
-    count = countSeparatedItems(s, ',');
-    if (count > 0)
-	{
-	AllocArray(array, count);
-	count = 0;
-	for (;;)
-	    {
-	    array[count++] = sqlSignedInList(&s);
-	    if (*s++ == 0)
-		break;
-	    if (*s == 0)
-		break;
-	    }
-	}
-    }
-*retArray = array;
-*retSize = count;
-}
-
-/*-------------------------*/
-
-int sqlUshortArray(char *s, unsigned short *array, int arraySize)
-/* Convert comma separated list of numbers to an array.  Pass in 
- * array an max size of array. */
-{
-unsigned count = 0;
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0 || count == arraySize)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    array[count++] = sqlUnsigned(s);
-    s = e;
-    }
-return count;
-}
-
-void sqlUshortStaticArray(char *s, unsigned short **retArray, int *retSize)
-/* Convert comma separated list of numbers to an array which will be
- * overwritten next call to this function, but need not be freed. */
-{
-static unsigned short *array = NULL;
-static unsigned alloc = 0;
-unsigned count = 0;
-
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    if (count >= alloc)
-	{
-	if (alloc == 0)
-	    alloc = 64;
-	else
-	    alloc <<= 1;
-	ExpandArray(array, count, alloc);
-	}
-    array[count++] = sqlUnsigned(s);
-    s = e;
-    }
-*retSize = count;
-*retArray = array;
-}
-
-void sqlUshortDynamicArray(char *s, unsigned short **retArray, int *retSize)
-/* Convert comma separated list of numbers to an dynamically allocated
- * array, which should be freeMem()'d when done. Thread-safe. */
-{
-unsigned short *array = NULL;
-int count = 0;
-
-if (s)
-    {
-    count = countSeparatedItems(s, ',');
-    if (count > 0)
-	{
-	AllocArray(array, count);
-	count = 0;
-	for (;;)
-	    {
-	    array[count++] = sqlUnsignedInList(&s);
-	    if (*s++ == 0)
-		break;
-	    if (*s == 0)
-		break;
-	    }
-	}
-    }
-*retArray = array;
-*retSize = count;
-}
-
-/*-------------------------*/
-int sqlDoubleArray(char *s, double *array, int maxArraySize)
-/* Convert comma separated list of floating point numbers to an array.  
- * Pass in array and max size of array. */
-{
-unsigned count = 0;
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0 || count == maxArraySize)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    array[count++] = atof(s);
-    s = e;
-    }
-return count;
-}
-
-
-int sqlFloatArray(char *s, float *array, int maxArraySize)
-/* Convert comma separated list of floating point numbers to an array.  
- * Pass in array and max size of array. */
-{
-unsigned count = 0;
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0 || count == maxArraySize)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    array[count++] = atof(s);
-    s = e;
-    }
-return count;
-}
-
-void sqlDoubleStaticArray(char *s, double **retArray, int *retSize)
-/* Convert comma separated list of numbers to an array which will be
- * overwritten next call to this function, but need not be freed. */
-{
-static double *array = NULL;
-static unsigned alloc = 0;
-unsigned count = 0;
-
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    if (count >= alloc)
-	{
-	if (alloc == 0)
-	    alloc = 64;
-	else
-	    alloc <<= 1;
-	ExpandArray(array, count, alloc);
-	}
-    array[count++] = atof(s);
-    s = e;
-    }
-*retSize = count;
-*retArray = array;
-}
-
-void sqlFloatStaticArray(char *s, float **retArray, int *retSize)
-/* Convert comma separated list of numbers to an array which will be
- * overwritten next call to this function, but need not be freed. */
-{
-static float *array = NULL;
-static unsigned alloc = 0;
-unsigned count = 0;
-
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    if (count >= alloc)
-	{
-	if (alloc == 0)
-	    alloc = 128;
-	else
-	    alloc <<= 1;
-	ExpandArray(array, count, alloc);
-	}
-    array[count++] = atof(s);
-    s = e;
-    }
-*retSize = count;
-*retArray = array;
-}
-
-void sqlDoubleDynamicArray(char *s, double **retArray, int *retSize)
-/* Convert comma separated list of numbers to an dynamically allocated
- * array, which should be freeMem()'d when done. Thread-safe.*/
-{
-double *array = NULL;
-int count = 0;
-
-if (s)
-    {
-    count = countSeparatedItems(s, ',');
-    if (count > 0)
-	{
-	AllocArray(array, count);
-	count = 0;
-	for (;;)
-	    {
-	    array[count++] = sqlDoubleInList(&s);
-	    if (*s++ == 0)
-		break;
-	    if (*s == 0)
-		break;
-	    }
-	}
-    }
-*retArray = array;
-*retSize = count;
-}
-
-void sqlFloatDynamicArray(char *s, float **retArray, int *retSize)
-/* Convert comma separated list of numbers to an dynamically allocated
- * array, which should be freeMem()'d when done. Thread-safe. */
-{
-float *array = NULL;
-int count = 0;
-
-if (s)
-    {
-    count = countSeparatedItems(s, ',');
-    if (count > 0)
-	{
-	AllocArray(array, count);
-	count = 0;
-	for (;;)
-	    {
-	    array[count++] = sqlFloatInList(&s);
-	    if (*s++ == 0)
-		break;
-	    if (*s == 0)
-		break;
-	    }
-	}
-    }
-*retArray = array;
-*retSize = count;
-}
-
-/*-------------------------*/
-
-int sqlUnsignedArray(char *s, unsigned *array, int arraySize)
-/* Convert comma separated list of numbers to an array.  Pass in 
- * array and max size of array. */
-{
-unsigned count = 0;
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0 || count == arraySize)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    array[count++] = sqlUnsigned(s);
-    s = e;
-    }
-return count;
-}
-
-void sqlUnsignedStaticArray(char *s, unsigned **retArray, int *retSize)
-/* Convert comma separated list of numbers to an array which will be
- * overwritten next call to this function, but need not be freed. */
-{
-static unsigned *array = NULL;
-static unsigned alloc = 0;
-unsigned count = 0;
-
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    if (count >= alloc)
-	{
-	if (alloc == 0)
-	    alloc = 64;
-	else
-	    alloc <<= 1;
-	ExpandArray(array, count, alloc);
-	}
-    array[count++] = sqlUnsigned(s);
-    s = e;
-    }
-*retSize = count;
-*retArray = array;
-}
-
-void sqlUnsignedDynamicArray(char *s, unsigned **retArray, int *retSize)
-/* Convert comma separated list of numbers to an dynamically allocated
- * array, which should be freeMem()'d when done. Thread-safe. */
-{
-unsigned *array = NULL;
-int count = 0;
-
-if (s)
-    {
-    count = countSeparatedItems(s, ',');
-    if (count > 0)
-	{
-	AllocArray(array, count);
-	count = 0;
-	for (;;)
-	    {
-	    array[count++] = sqlUnsignedInList(&s);
-	    if (*s++ == 0)
-		break;
-	    if (*s == 0)
-		break;
-	    }
-	}
-    }
-*retArray = array;
-*retSize = count;
-}
-
-/*-------------------------*/
-
-int sqlSignedArray(char *s, int *array, int arraySize)
-/* Convert comma separated list of numbers to an array.  Pass in 
- * array an max size of array. */
-{
-int count = 0;
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0 || count == arraySize)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    array[count++] = sqlSigned(s);
-    s = e;
-    }
-return count;
-}
-
-void sqlSignedStaticArray(char *s, int **retArray, int *retSize)
-/* Convert comma separated list of numbers to an array which will be
- * overwritten next call to this function, but need not be freed. */
-{
-static int *array = NULL;
-static int alloc = 0;
-int count = 0;
-
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    if (count >= alloc)
-	{
-	if (alloc == 0)
-	    alloc = 64;
-	else
-	    alloc <<= 1;
-	ExpandArray(array, count, alloc);
-	}
-    array[count++] = sqlSigned(s);
-    s = e;
-    }
-*retSize = count;
-*retArray = array;
-}
-
-void sqlSignedDynamicArray(char *s, int **retArray, int *retSize)
-/* Convert comma separated list of numbers to an dynamically allocated
- * array, which should be freeMem()'d when done. Thread-safe. */
-{
-int *array = NULL;
-int count = 0;
-
-if (s)
-    {
-    count = countSeparatedItems(s, ',');
-    if (count > 0)
-	{
-	AllocArray(array, count);
-	count = 0;
-	for (;;)
-	    {
-	    array[count++] = sqlSignedInList(&s);
-	    if (*s++ == 0)
-		break;
-	    if (*s == 0)
-		break;
-	    }
-	}
-    }
-*retArray = array;
-*retSize = count;
-}
-
-
-/*-------------------------*/
-
-int sqlLongLongArray(char *s, long long *array, int arraySize)
-/* Convert comma separated list of numbers to an array.  Pass in 
- * array and max size of array. */
-{
-unsigned count = 0;
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0 || count == arraySize)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    array[count++] = sqlLongLong(s);
-    s = e;
-    }
-return count;
-}
-
-void sqlLongLongStaticArray(char *s, long long **retArray, int *retSize)
-/* Convert comma separated list of numbers to an array which will be
- * overwritten next call to this function, but need not be freed. */
-{
-static long long *array = NULL;
-static unsigned alloc = 0;
-unsigned count = 0;
-
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    if (count >= alloc)
-	{
-	if (alloc == 0)
-	    alloc = 64;
-	else
-	    alloc <<= 1;
-	ExpandArray(array, count, alloc);
-	}
-    array[count++] = sqlLongLong(s);
-    s = e;
-    }
-*retSize = count;
-*retArray = array;
-}
-
-void sqlLongLongDynamicArray(char *s, long long **retArray, int *retSize)
-/* Convert comma separated list of numbers to an dynamically allocated
- * array, which should be freeMem()'d when done. Thread-safe. */
-{
-long long *array = NULL;
-int count = 0;
-
-if (s)
-    {
-    count = countSeparatedItems(s, ',');
-    if (count > 0)
-	{
-	AllocArray(array, count);
-	count = 0;
-	for (;;)
-	    {
-	    array[count++] = sqlLongLongInList(&s);
-	    if (*s++ == 0)
-		break;
-	    if (*s == 0)
-		break;
-	    }
-	}
-    }
-*retArray = array;
-*retSize = count;
-}
-
-/*-------------------------*/
-
-
-int sqlStringArray(char *s, char **array, int maxArraySize)
-/* Convert comma separated list of strings to an array.  Pass in 
- * array and max size of array.  Returns actual size*/
-{
-int count = 0;
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0 || count == maxArraySize)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    array[count++] = s;
-    s = e;
-    }
-return count;
-}
-
-void sqlStringStaticArray(char *s, char  ***retArray, int *retSize)
-/* Convert comma separated list of strings to an array which will be
- * overwritten next call to this function,  but need not be freed. */
-{
-static char **array = NULL;
-static int alloc = 0;
-int count = 0;
-
-for (;;)
-    {
-    char *e;
-    if (s == NULL || s[0] == 0)
-	break;
-    e = strchr(s, ',');
-    if (e != NULL)
-	*e++ = 0;
-    if (count >= alloc)
-	{
-	if (alloc == 0)
-	    alloc = 64;
-	else
-	    alloc <<= 1;
-	ExpandArray(array, count, alloc);
-	}
-    array[count++] = s;
-    s = e;
-    }
-*retSize = count;
-*retArray = array;
-}
-
-void sqlStringDynamicArray(char *s, char ***retArray, int *retSize)
-/* Convert comma separated list of strings to an dynamically allocated
- * array, which should be freeMem()'d when done. As a speed option all
- * of the elements in the array are needMem()'d at the same time. This 
- * means that all the entries are free()'d by calling freeMem() on the
- * first element. For example:
- * sqlStringDynamicArray(s, &retArray, &retSize);
- * DoSomeFunction(retArray, retSize);
- * freeMem(retArray[0]);
- * freeMem(retArray);
- * Thread-safe. */
-{
-char **array = NULL;
-int count = 0;
-if (s)
-    {
-    count = countSeparatedItems(s, ',');
-    if (count > 0)
-	{
-	AllocArray(array, count);
-	count = 0;
-	s = cloneString(s);
-	for (;;)
-	    {
-	    char *e;
-	    if (s == NULL || s[0] == 0)
-		break;
-	    e = strchr(s, ',');
-	    if (e != NULL)
-		*e++ = 0;
-	    array[count++] = s;
-	    s = e;
-	    }
-	}
-    }
-*retArray = array;
-*retSize = count;
-}
-
-char *sqlDoubleArrayToString( double *array, int arraySize)
-{
-int i;
-struct dyString *string = newDyString(256);
-for( i = 0 ; i < arraySize; i++ )
-    {
-    dyStringPrintf(string, "%f,", array[i]);
-    }
-return dyStringCannibalize(&string);
-}
-
-char *sqlFloatArrayToString( float *array, int arraySize)
-{
-int i;
-struct dyString *string = newDyString(256);
-for( i = 0 ; i < arraySize; i++ )
-    {
-    dyStringPrintf(string, "%f,", array[i]);
-    }
-return dyStringCannibalize(&string);
-}
-
-char *sqlUnsignedArrayToString( unsigned *array, int arraySize)
-{
-int i;
-struct dyString *string = newDyString(256);
-for( i = 0 ; i < arraySize; i++ )
-    {
-    dyStringPrintf(string, "%u,", array[i]);
-    }
-return dyStringCannibalize(&string);
-}
-
-char *sqlSignedArrayToString( int *array, int arraySize)
-{
-int i;
-struct dyString *string = newDyString(256);
-for( i = 0 ; i < arraySize; i++ )
-    {
-    dyStringPrintf(string, "%d,", array[i]);
-    }
-return dyStringCannibalize(&string);
-}
-
-char *sqlShortArrayToString( short *array, int arraySize)
-{
-int i;
-struct dyString *string = newDyString(256);
-for( i = 0 ; i < arraySize; i++ )
-    {
-    dyStringPrintf(string, "%d,", array[i]);
-    }
-return dyStringCannibalize(&string);
-}
-
-char *sqlUshortArrayToString( unsigned short *array, int arraySize)
-{
-int i;
-struct dyString *string = newDyString(256);
-for( i = 0 ; i < arraySize; i++ )
-    {
-    dyStringPrintf(string, "%u,", array[i]);
-    }
-return dyStringCannibalize(&string);
-}
-
-char *sqlByteArrayToString( signed char *array, int arraySize)
-{
-int i;
-struct dyString *string = newDyString(256);
-for( i = 0 ; i < arraySize; i++ )
-    {
-    dyStringPrintf(string, "%d,", array[i]);
-    }
-return dyStringCannibalize(&string);
-}
-
-char *sqlUbyteArrayToString( unsigned char *array, int arraySize)
-{
-int i;
-struct dyString *string = newDyString(256);
-for( i = 0 ; i < arraySize; i++ )
-    {
-    dyStringPrintf(string, "%u,", array[i]);
-    }
-return dyStringCannibalize(&string);
-}
-
-char *sqlCharArrayToString( char *array, int arraySize)
-{
-int i;
-struct dyString *string = newDyString(256);
-for( i = 0 ; i < arraySize; i++ )
-    {
-    dyStringPrintf(string, "%c,", array[i]);
-    }
-return dyStringCannibalize(&string);
-}
-
-char *sqlLongLongArrayToString( long long *array, int arraySize)
-{
-int i;
-struct dyString *string = newDyString(256);
-for( i = 0 ; i < arraySize; i++ )
-    {
-    dyStringPrintf(string, "%lld,", array[i]);
-    }
-return dyStringCannibalize(&string);
-}
-
-char *sqlStringArrayToString( char **array, int arraySize)
-{
-int i;
-struct dyString *string = newDyString(256);
-for( i = 0 ; i < arraySize; i++ )
-    {
-    dyStringPrintf(string, "%s,", array[i]);
-    }
-return dyStringCannibalize(&string);
-}
-
-
-/* -------------- */
-
-
-
-void sqlStringFreeDynamicArray(char ***pArray)
-/* Free up a dynamic array (ends up freeing array and first string on it.) */
-{
-char **array;
-if ((array = *pArray) != NULL)
-    {
-    freeMem(array[0]);
-    freez(pArray);
-    }
-}
-
-int sqlUnsignedComma(char **pS)
-/* Return signed number at *pS.  Advance *pS past comma at end */
-{
-char *s = *pS;
-char *e = strchr(s, ',');
-unsigned ret;
-
-*e++ = 0;
-*pS = e;
-ret = sqlUnsigned(s);
-return ret;
-}
-
-
-int sqlSignedComma(char **pS)
-/* Return signed number at *pS.  Advance *pS past comma at end */
-{
-char *s = *pS;
-char *e = strchr(s, ',');
-int ret;
-
-*e++ = 0;
-*pS = e;
-ret = sqlSigned(s);
-return ret;
-}
-
-char sqlCharComma(char **pS)
-/* Return char at *pS.  Advance *pS past comma after char */
-{
-char *s = *pS;
-char *e = strchr(s, ',');
-int ret;
-
-*e++ = 0;
-*pS = e;
-ret = s[0];
-return ret;
-}
-
-long long sqlLongLongComma(char **pS)
-/* Return offset (often 64 bits) at *pS.  Advance *pS past comma at 
- * end */
-{
-char *s = *pS;
-char *e = strchr(s, ',');
-long long ret;
-
-*e++ = 0;
-*pS = e;
-ret = sqlLongLong(s);
-return ret;
-}
-
-float sqlFloatComma(char **pS)
-/* Return signed number at *pS.  Advance *pS past comma at end */
-{
-char *s = *pS;
-char *e = strchr(s, ',');
-float ret;
-
-*e++ = 0;
-*pS = e;
-ret = atof(s);
-return ret;
-}
-
-double sqlDoubleComma(char **pS)
-/* Return signed number at *pS.  Advance *pS past comma at end */
-{
-char *s = *pS;
-char *e = strchr(s, ',');
-double ret;
-
-*e++ = 0;
-*pS = e;
-ret = atof(s);
-return ret;
-}
-
-
-static char *findStringEnd(char *start, char endC)
-/* Return end of string. */
-{
-char c;
-char *s = start;
-
-for (;;)
-    {
-    c = *s;
-    if (c == endC)
-	return s;
-    else if (c == 0)
-	errAbort("Unterminated string");
-    ++s;
-    }
-}
-
-static char *sqlGetOptQuoteString(char **pS)
-/* Return string at *pS.  (Either quoted or not.)  Advance *pS. */
-{
-char *s = *pS;
-char *e;
-char c = *s;
-
-if (c  == '"' || c == '\'')
-    {
-    s += 1;
-    e = findStringEnd(s, c);
-    *e++ = 0;
-    if (*e++ != ',')
-	errAbort("Expecting comma after string");
-    }
-else
-    {
-    e = strchr(s, ',');
-    *e++ = 0;
-    }
-*pS = e;
-return s;
-}
-
-char *sqlStringComma(char **pS)
-/* Return string at *pS.  (Either quoted or not.)  Advance *pS. */
-{
-return cloneString(sqlGetOptQuoteString(pS));
-}
-
-void sqlFixedStringComma(char **pS, char *buf, int bufSize)
-/* Copy string at *pS to buf.  Advance *pS. */
-{
-strncpy(buf, sqlGetOptQuoteString(pS), bufSize);
-}
-
-char *sqlEatChar(char *s, char c)
-/* Make sure next character is 'c'.  Return past next char */
-{
-if (*s++ != c)
-    errAbort("Expecting %c got %c (%d) in database", c, s[-1], s[-1]);
-return s;
-}
-
-static struct hash *buildSymHash(char **values, boolean isEnum)
-/* build a hash of values for either enum or set symbolic column */
-{
-struct hash *valHash = hashNew(0);
-unsigned setVal = 1; /* not used for enum */
-int iVal;
-for (iVal = 0; values[iVal] != NULL; iVal++)
-    {
-    if (isEnum)
-        hashAddInt(valHash, values[iVal], iVal);
-    else
-        {
-        hashAddInt(valHash, values[iVal], setVal);
-        setVal = setVal << 1;
-        }
-    }
-return valHash;
-}
-
-unsigned sqlEnumParse(char *valStr, char **values, struct hash **valHashPtr)
-/* parse an enumerated column value */
-{
-if (*valHashPtr == NULL)
-    *valHashPtr = buildSymHash(values, TRUE);
-return hashIntVal(*valHashPtr, valStr);
-}
-
-unsigned sqlEnumComma(char **pS, char **values, struct hash **valHashPtr)
-/* Return enum at *pS.  (Either quoted or not.)  Advance *pS. */
-{
-return sqlEnumParse(sqlGetOptQuoteString(pS), values, valHashPtr);
-}
-
-void sqlEnumPrint(FILE *f, unsigned value, char **values)
-/* print an enumerated column value */
-{
-fputs(values[value], f);
-}
-
-unsigned sqlSetParse(char *valStr, char **values, struct hash **valHashPtr)
-/* parse a set column value */
-{
-if (*valHashPtr == NULL)
-    *valHashPtr = buildSymHash(values, FALSE);
-/* parse comma separated string */
-unsigned value = 0;
-char *val = strtok(valStr, ",");
-while (val != NULL)
-    {
-    value |= hashIntVal(*valHashPtr, val);
-    val = strtok(NULL, ",");
-    }
-
-return value;
-}
-
-unsigned sqlSetComma(char **pS, char **values, struct hash **valHashPtr)
-/* Return set at *pS.  (Either quoted or not.)  Advance *pS. */
-{
-return sqlSetParse(sqlGetOptQuoteString(pS), values, valHashPtr);
-}
-
-void sqlSetPrint(FILE *f, unsigned value, char **values)
-/* print a set column value */
-{
-int iVal;
-unsigned curVal = 1;
-int cnt = 0;
-for (iVal = 0; values[iVal] != NULL; iVal++, curVal = curVal << 1)
-    {
-    if (curVal & value)
-        {
-        if (cnt > 0)
-            fputc(',', f);
-        fputs(values[iVal], f);
-        cnt++;
-        }
-    }
-}
diff --git a/gbtools/src/blatSrc/lib/sqlNum.c b/gbtools/src/blatSrc/lib/sqlNum.c
deleted file mode 100644
index 081f857..0000000
--- a/gbtools/src/blatSrc/lib/sqlNum.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/* sqlnum.c - Routines to convert from ascii to integer
- * representation of numbers. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "sqlNum.h"
-
-/* The sql<Type>InList functions allow for fast thread-safe processing of dynamic arrays in sqlList */
-
-
-unsigned sqlUnsigned(char *s)
-/* Convert series of digits to unsigned integer about
- * twice as fast as atoi (by not having to skip white 
- * space or stop except at the null byte.) */
-{
-unsigned res = 0;
-char *p = s;
-char c;
-
-while (((c = *(p++)) >= '0') && (c <= '9'))
-    {
-    res *= 10;
-    res += c - '0';
-    }
---p;
-/* test for invalid character or empty */
-if ((c != '\0') || (p == s))
-    errAbort("invalid unsigned integer: \"%s\"", s);
-return res;
-}
-
-unsigned sqlUnsignedInList(char **pS)
-/* Convert series of digits to unsigned integer about
- * twice as fast as atoi (by not having to skip white 
- * space or stop except at the null byte.) 
- * All of string is number. Number may be delimited by a comma. 
- * Returns the position of the delimiter or the terminating 0. */
-{
-char *s = *pS;
-unsigned res = 0;
-char *p = s;
-char c;
-
-while (((c = *(p++)) >= '0') && (c <= '9'))
-    {
-    res *= 10;
-    res += c - '0';
-    }
---p;
-if (!(c == '\0' || c == ',') || (p == s))
-    {
-    char *e = strchr(s, ',');
-    if (e)
-	*e = 0;
-    errAbort("invalid unsigned integer: \"%s\"", s);
-    }
-*pS = p;
-return res;
-}
-
-unsigned long sqlUnsignedLong(char *s)
-/* Convert series of digits to unsigned long about
- * twice as fast as atol (by not having to skip white 
- * space or stop except at the null byte.) */
-{
-unsigned long res = 0;
-char *p = s;
-char c;
-
-while (((c = *(p++)) >= '0') && (c <= '9'))
-    {
-    res *= 10;
-    res += c - '0';
-    }
---p;
-if ((c != '\0') || (p == s))
-    errAbort("invalid unsigned long: \"%s\"", s);
-return res;
-}
-
-unsigned long sqlUnsignedLongInList(char **pS)
-/* Convert series of digits to unsigned long about
- * twice as fast as atol (by not having to skip white 
- * space or stop except at the null byte.) 
- * All of string is number. Number may be delimited by a comma. 
- * Returns the position of the delimiter or the terminating 0. */
-{
-char *s = *pS;
-unsigned long res = 0;
-char *p = s;
-char c;
-
-while (((c = *(p++)) >= '0') && (c <= '9'))
-    {
-    res *= 10;
-    res += c - '0';
-    }
---p;
-if (!(c == '\0' || c == ',') || (p == s))
-    {
-    char *e = strchr(s, ',');
-    if (e)
-	*e = 0;
-    errAbort("invalid unsigned long: \"%s\"", s);
-    }
-*pS = p;
-return res;
-}
-
-int sqlSigned(char *s)
-/* Convert string to signed integer.  Unlike atol assumes 
- * all of string is number. */
-{
-int res = 0;
-char *p, *p0 = s;
-
-if (*p0 == '-')
-    p0++;
-p = p0;
-while ((*p >= '0') && (*p <= '9'))
-    {
-    res *= 10;
-    res += *p - '0';
-    p++;
-    }
-/* test for invalid character, empty, or just a minus */
-if ((*p != '\0') || (p == p0))
-    errAbort("invalid signed integer: \"%s\"", s);
-if (*s == '-')
-    return -res;
-else
-    return res;
-}
-
-int sqlSignedInList(char **pS)
-/* Convert string to signed integer.  Unlike atol assumes 
- * all of string is number. Number may be delimited by a comma. 
- * Returns the position of the delimiter or the terminating 0. */
-{
-char *s = *pS;
-int res = 0;
-char *p, *p0 = s;
-
-if (*p0 == '-')
-    p0++;
-p = p0;
-while ((*p >= '0') && (*p <= '9'))
-    {
-    res *= 10;
-    res += *p - '0';
-    p++;
-    }
-/* test for invalid character, empty, or just a minus */
-if (!(*p == '\0' || *p == ',') || (p == p0))
-    {
-    char *e = strchr(s, ',');
-    if (e)
-	*e = 0;
-    errAbort("invalid signed integer: \"%s\"", s);
-    }
-*pS = p;
-if (*s == '-')
-    return -res;
-else
-    return res;
-}
-
-long long sqlLongLong(char *s)
-/* Convert string to a long long.  Unlike atol assumes all of string is
- * number. */
-{
-long long res = 0;
-char *p, *p0 = s;
-
-if (*p0 == '-')
-    p0++;
-p = p0;
-while ((*p >= '0') && (*p <= '9'))
-    {
-    res *= 10;
-    res += *p - '0';
-    p++;
-    }
-/* test for invalid character, empty, or just a minus */
-if ((*p != '\0') || (p == p0))
-    errAbort("invalid signed long long: \"%s\"", s);
-if (*s == '-')
-    return -res;
-else
-    return res;
-}
-
-long long sqlLongLongInList(char **pS)
-/* Convert string to a long long.  Unlike atol, assumes 
- * all of string is number. Number may be delimited by a comma. 
- * Returns the position of the delimiter or the terminating 0. */
-{
-char *s = *pS;
-long long res = 0;
-char *p, *p0 = s;
-
-if (*p0 == '-')
-    p0++;
-p = p0;
-while ((*p >= '0') && (*p <= '9'))
-    {
-    res *= 10;
-    res += *p - '0';
-    p++;
-    }
-/* test for invalid character, empty, or just a minus */
-if (!(*p == '\0' || *p == ',') || (p == p0))
-    {
-    char *e = strchr(s, ',');
-    if (e)
-	*e = 0;
-    errAbort("invalid signed long long: \"%s\"", s);
-    }
-*pS = p;
-if (*s == '-')
-    return -res;
-else
-    return res;
-}
-
-float sqlFloat(char *s)
-/* Convert string to a float.  Assumes all of string is number
- * and aborts on an error. */
-{
-char* end;
-/*	used to have an ifdef here to use strtof() but that doesn't
- *	actually exist on all systems and since strtod() does, may as
- *	well use it since it will do the job here.
- */
-float val = (float) strtod(s, &end);
-
-if ((end == s) || (*end != '\0'))
-    errAbort("invalid float: %s", s);
-return val;
-}
-
-float sqlFloatInList(char **pS)
-/* Convert string to a float.  Assumes all of string is number
- * and aborts on an error. 
- * Number may be delimited by a comma. 
- * Returns the position of the delimiter or the terminating 0. */
-{
-char *s = *pS;
-char* end;
-/*	used to have an ifdef here to use strtof() but that doesn't
- *	actually exist on all systems and since strtod() does, may as
- *	well use it since it will do the job here.
- */
-float val = (float) strtod(s, &end);
-
-if ((end == s) || !(*end == '\0' || *end == ','))
-    {
-    char *e = strchr(s, ',');
-    if (e)
-	*e = 0;
-    errAbort("invalid float: %s", s);
-    }
-*pS = end;
-return val;
-}
-
-double sqlDouble(char *s)
-/* Convert string to a double.  Assumes all of string is number
- * and aborts on an error. */
-{
-char* end;
-double val = strtod(s, &end);
-
-if ((end == s) || (*end != '\0'))
-    errAbort("invalid double: %s", s);
-return val;
-}
-
-double sqlDoubleInList(char **pS)
-/* Convert string to a double.  Assumes all of string is number
- * and aborts on an error.
- * Number may be delimited by a comma.
- * Returns the position of the delimiter or the terminating 0. */
-{
-char *s = *pS;
-char* end;
-double val = strtod(s, &end);
-
-if ((end == s) || !(*end == '\0' || *end == ','))
-    {
-    char *e = strchr(s, ',');
-    if (e)
-        *e = 0;
-    errAbort("invalid double: %s", s);
-    }
-*pS = end;
-return val;
-}
-
diff --git a/gbtools/src/blatSrc/lib/status b/gbtools/src/blatSrc/lib/status
deleted file mode 100644
index c9a46e0..0000000
--- a/gbtools/src/blatSrc/lib/status
+++ /dev/null
@@ -1,1638 +0,0 @@
-# On branch master
-# Your branch is ahead of 'origin/master' by 4 commits.
-#
-# Changes not staged for commit:
-#   (use "git add/rm <file>..." to update what will be committed)
-#   (use "git checkout -- <file>..." to discard changes in working directory)
-#
-#	modified:   ../hg/encode3/eap/oneShot/eapToHub/eapToHub.c
-#	deleted:    ../hg/encode3/encodeDataWarehouse/edwMakeValidFile/sorted.bb
-#	modified:   ../hg/oneShot/freen/freen.c
-#
-# Untracked files:
-#   (use "git add <file>..." to include in what will be committed)
-#
-#	../../clean.log
-#	../../compile.log
-#	../../diff
-#	../../edw
-#	../../ew.txt
-#	../../foo2
-#	../../hui.c.kate
-#	../../pull
-#	../../python/.styleCommentsJk.txt.swp
-#	../../python/ENV/
-#	../../python/idioms.txt
-#	../../python/makefile
-#	../../python/users/kent/django/mysite/cvDb/backup/
-#	../../python/users/kent/django/mysite/jkSp/backup/
-#	../../python/users/kent/django/mysite/jkSp/makefile
-#	../../python/users/kent/django/mysite/jkSp/subs.in
-#	../../python/users/kent/django/mysite/nullOk.sql
-#	../../python/users/kent/django/mysite/polls/
-#	../ai/wordChain/996
-#	../ai/wordChain/donQuixote.chain
-#	../ai/wordChain/donQuixote.non
-#	../ai/wordChain/donQuixote.txt
-#	../ai/wordChain/foo.chain
-#	../ai/wordChain/foo.nonsense
-#	../ai/wordChain/jumbled.txt
-#	../ai/wordChain/nonsense
-#	../ai/wordChain/pull
-#	../ai/wordChain/questions
-#	../ai/wordChain/quixote.chain
-#	../ai/wordChain/short.txt
-#	../alpha.out
-#	../blat/foo.psl
-#	../blat/mCrea.geno.rc
-#	../cscope.files
-#	../cscope.out
-#	../dateModified.lst
-#	../dateModified.sh
-#	../diff
-#	../diffs
-#	../foo2
-#	../foo3
-#	../hg/autoSql/foo.django
-#	../hg/autoSql/foo.h
-#	../hg/autoSql/foo.sql
-#	../hg/autoSql/out/
-#	../hg/autoSql/status
-#	../hg/autoSql/tests/input/ebdwTest.as
-#	../hg/checkTableCoords/tests/1
-#	../hg/cirm/quakeLab/djangoModelToAs/makefile
-#	../hg/cirm/quakeLab/djangoModelToAs/test.py
-#	../hg/cirm/quakeLab/djangoModels/models.zip
-#	../hg/diffs
-#	../hg/encode/converters/pairedTagToBed12/pairedTagToBed12.c.blame
-#	../hg/encode/converters/tagToBed12/tagToBed12.c.blame
-#	../hg/encode/docId/docIdReport/docIdReport.c.blame
-#	../hg/encode/docId/docIdSubmitDir/docIdSubmitDir.c.blame
-#	../hg/encode/docId/docIdTidy/docIdTidy.c.blame
-#	../hg/encode/docId/docIdView/docIdView.c.blame
-#	../hg/encode/docId/inc/docId.h.blame
-#	../hg/encode/docId/lib/docIdSub.c.blame
-#	../hg/encode/encodeExp/encodeExp.c.blame
-#	../hg/encode/encodeExp/foo.ra
-#	../hg/encode/encodeMergeReplicates/encodeMergeReplicates.c.blame
-#	../hg/encode/encodeMergeReplicates/foo1
-#	../hg/encode/encodeMergeReplicates/merged.narrowPeak
-#	../hg/encode/encodeMergeReplicates/out
-#	../hg/encode/encodeMergeReplicates/outRep1Rep2Add.narrowPeak
-#	../hg/encode/encodeMergeReplicates/outRep1Rep2AddAddMin.narrowPeak
-#	../hg/encode/encodeMergeReplicates/outRep1Rep2Agree.narrowPeak
-#	../hg/encode/encodeMergeReplicates/outRep1Rep2Default.narrowPeak
-#	../hg/encode/encodeMergeReplicates/outRep1Rep2Threshold10.narrowPeak
-#	../hg/encode/encodeMergeReplicatesBatch/doHud.sh
-#	../hg/encode/encodeMergeReplicatesBatch/encodeMergeReplicatesBatch.c.blame
-#	../hg/encode/encodeMergeReplicatesBatch/hud.ra
-#	../hg/encode/encodeMergeReplicatesBatch/hudOut.ra
-#	../hg/encode/encodeMergeReplicatesBatch/inDir
-#	../hg/encode/encodeMergeReplicatesBatch/out.ra
-#	../hg/encode/encodeMergeReplicatesBatch/out.sh
-#	../hg/encode/encodeMergeReplicatesBatch/snyder.ra
-#	../hg/encode/encodeMergeReplicatesBatch/status
-#	../hg/encode/encodePatchTdb/encodePatchTdb.c.blame
-#	../hg/encode/encodeRenameObj/encodeRenameObj.c.blame
-#	../hg/encode/hgEncodeApi/hgEncodeApi.c.blame
-#	../hg/encode/hgEncodeDataVersions/hgEncodeDataVersions.c.blame
-#	../hg/encode/hgEncodeScheduler/hgEncodeScheduler.c.blame
-#	../hg/encode/hgEncodeVocab/hgEncodeVocab.c.blame
-#	../hg/encode/inc/bedLogR.h.blame
-#	../hg/encode/inc/encodePatchTdb.h.blame
-#	../hg/encode/ldGencodeIntron/ldGencodeIntron.c.blame
-#	../hg/encode/lib/bedLogR.c.blame
-#	../hg/encode/lib/encodePatchTdb.c.blame
-#	../hg/encode/metaCheck/metaCheck.c.blame
-#	../hg/encode/metaCollect/metaCollect.c.blame
-#	../hg/encode/metaRename/metaRename.c.blame
-#	../hg/encode/regionAgp/regionAgp.c.blame
-#	../hg/encode/regionOrtho/regionOrtho.c.blame
-#	../hg/encode/regionOrtho/regionOrtho.h.blame
-#	../hg/encode/validateCv/validateCv.c.blame
-#	../hg/encode/validateFiles/
-#	../hg/encode3/eap/cleanupEapScratch.sh
-#	../hg/encode3/eap/eapAddSoftware/voo
-#	../hg/encode3/eap/eapAddStep/.eapAddStep.c.swp
-#	../hg/encode3/eap/eapDaemon/foo.001
-#	../hg/encode3/eap/eapDaemon/foo.002
-#	../hg/encode3/eap/eapDaemon/foo.log
-#	../hg/encode3/eap/eapDaemon/start
-#	../hg/encode3/eap/eapDaemon/tmpJob.sql
-#	../hg/encode3/eap/eapFreen/dep.sql
-#	../hg/encode3/eap/eapFreen/dep2.sql
-#	../hg/encode3/eap/eapFreen/firstResponse
-#	../hg/encode3/eap/eapFreen/firstResponse.json
-#	../hg/encode3/eap/eapFreen/makefile
-#	../hg/encode3/eap/eapFreen/software.json
-#	../hg/encode3/eap/eapMetaSync/out
-#	../hg/encode3/eap/eapMetaSync/testIt
-#	../hg/encode3/eap/eapSchedule/0.100000
-#	../hg/encode3/eap/eapSchedule/analysis.sql
-#	../hg/encode3/eap/eapSchedule/err
-#	../hg/encode3/eap/hardQueries/README
-#	../hg/encode3/eap/hardQueries/edwRunDaemon.log
-#	../hg/encode3/eap/hardQueries/fastqToBam
-#	../hg/encode3/eap/hardQueries/foo.sql
-#	../hg/encode3/eap/hardQueries/moreOk
-#	../hg/encode3/eap/hardQueries/repDnaExp.sql
-#	../hg/encode3/eap/hardQueries/repDnaExp.tab
-#	../hg/encode3/eap/hardQueries/replicated
-#	../hg/encode3/eap/hardQueries/wgEncodeEH003007
-#	../hg/encode3/eap/lib/addMetaUuid.sql
-#	../hg/encode3/eap/lib/eapDb.h
-#	../hg/encode3/eap/lib/eapStep.sql
-#	../hg/encode3/eap/lib/edwToEap1/
-#	../hg/encode3/eap/lib/foo.sql
-#	../hg/encode3/eap/notes/
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/anshulFail.tab
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/anshulPass.tab
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/chipSeqFileIds.tab
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/diffRepVsCrossEn.c
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/doIt
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/edwQaPairSampleOverlap.tab
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/efoo.zip
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/fromAnshul.head
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/makefile
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/old1/
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/old2/
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/out.tab
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/qualSheet.as
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/qualSheet.c
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/qualSheet.h
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/qualSheet.sql
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/sharpAnshul.tab
-#	../hg/encode3/eap/oneShot/diffRepVsCrossEn/someAnshul.tab
-#	../hg/encode3/eap/oneShot/dnaseHg38Batch/runDir/
-#	../hg/encode3/eap/oneShot/eapToHub/foo11/
-#	../hg/encode3/eap/oneShot/eapToHub/old
-#	../hg/encode3/eap/oneShot/eapToHub/test1/
-#	../hg/encode3/eap/oneShot/eapToHub/test10/
-#	../hg/encode3/eap/oneShot/eapToHub/test11/
-#	../hg/encode3/eap/oneShot/eapToHub/test12/
-#	../hg/encode3/eap/oneShot/eapToHub/test13/
-#	../hg/encode3/eap/oneShot/eapToHub/test14/
-#	../hg/encode3/eap/oneShot/eapToHub/test2/
-#	../hg/encode3/eap/oneShot/eapToHub/test3/
-#	../hg/encode3/eap/oneShot/eapToHub/test4/
-#	../hg/encode3/eap/oneShot/eapToHub/test5/
-#	../hg/encode3/eap/oneShot/eapToHub/test6/
-#	../hg/encode3/eap/oneShot/eapToHub/test7/
-#	../hg/encode3/eap/oneShot/eapToHub/test8/
-#	../hg/encode3/eap/oneShot/eapToHub/test9/
-#	../hg/encode3/eap/oneShot/eapToHub2/
-#	../hg/encode3/eap/subs.in
-#	../hg/encode3/eap/subs.out
-#	../hg/encode3/encodeDataWarehouse/addAnalysisTables.sql
-#	../hg/encode3/encodeDataWarehouse/edwCorrectFileTags/badTest.tab
-#	../hg/encode3/encodeDataWarehouse/edwCorrectFileTags/test.tab
-#	../hg/encode3/encodeDataWarehouse/edwCorrectFileTags/untest.tab
-#	../hg/encode3/encodeDataWarehouse/edwFakeManifestFromSubmit/test101/
-#	../hg/encode3/encodeDataWarehouse/edwMakeContaminationQa/foo.sql
-#	../hg/encode3/encodeDataWarehouse/edwMakeContaminationQa/makk
-#	../hg/encode3/encodeDataWarehouse/edwMakeEnrichments/makk
-#	../hg/encode3/encodeDataWarehouse/edwMakeRepeatQa/makk
-#	../hg/encode3/encodeDataWarehouse/edwMakeReplicateQa/makk
-#	../hg/encode3/encodeDataWarehouse/edwMakeValidFile/edwMakeValidFile.old
-#	../hg/encode3/encodeDataWarehouse/edwMakeWigSpotQa/
-#	../hg/encode3/encodeDataWarehouse/edwMetaManiToTdb/biggish.meta
-#	../hg/encode3/encodeDataWarehouse/edwMetaManiToTdb/biggish.tdb
-#	../hg/encode3/encodeDataWarehouse/edwMetaManiToTdb/biggish.test
-#	../hg/encode3/encodeDataWarehouse/edwMetaManiToTdb/foo.tdb
-#	../hg/encode3/encodeDataWarehouse/edwMetaManiToTdb/foo2
-#	../hg/encode3/encodeDataWarehouse/edwMetaManiToTdb/foo3
-#	../hg/encode3/encodeDataWarehouse/edwMetaManiToTdb/go
-#	../hg/encode3/encodeDataWarehouse/edwMetaManiToTdb/twoExp.meta
-#	../hg/encode3/encodeDataWarehouse/edwMetaManiToTdb/twoExp.tdb
-#	../hg/encode3/encodeDataWarehouse/edwMetaManiToTdb/twoExp.test
-#	../hg/encode3/encodeDataWarehouse/edwRunDaemon/edwRunDaemon.new
-#	../hg/encode3/encodeDataWarehouse/edwRunDaemon/edwRunDaemon.old
-#	../hg/encode3/encodeDataWarehouse/edwRunDaemon/log
-#	../hg/encode3/encodeDataWarehouse/edwRunOnIds/makk
-#	../hg/encode3/encodeDataWarehouse/edwRunner.log
-#	../hg/encode3/encodeDataWarehouse/edwScriptSubmitStatus/foo2
-#	../hg/encode3/encodeDataWarehouse/edwSubmit/validated.test
-#	../hg/encode3/encodeDataWarehouse/edwSubmit/validated.test.1
-#	../hg/encode3/encodeDataWarehouse/edwSubmit/validated.txt
-#	../hg/encode3/encodeDataWarehouse/edwUndeprecate/makefile
-#	../hg/encode3/encodeDataWarehouse/edwUndeprecate/test.acc
-#	../hg/encode3/encodeDataWarehouse/edwWebBrowse/status
-#	../hg/encode3/encodeDataWarehouse/exit.bash
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixBamUcscDb/
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixBasesInSample/makk
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixDeleteSampleBed/
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixFoo/
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixOldPairedEnds/
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixTechRepsFromTarballs/makefile
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixTstToTstff/makefile
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixTstToTstff/out
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixTstToTstff/out.csh
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixTstToTstff/out.sql
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixTstToTstff/out2
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixTstToTstff/rest.csh
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixUniqueMapRatio/makefile
-#	../hg/encode3/encodeDataWarehouse/fix/edwFixUniqueMapRatio/status
-#	../hg/encode3/encodeDataWarehouse/lib/.nfs0000000009cc2523003f8b1c
-#	../hg/encode3/encodeDataWarehouse/lib/beta.sizes
-#	../hg/encode3/encodeDataWarehouse/lib/beta.snoop
-#	../hg/encode3/encodeDataWarehouse/lib/doFoo
-#	../hg/encode3/encodeDataWarehouse/lib/edwQaAgent.log
-#	../hg/encode3/encodeDataWarehouse/lib/edwQaDnaseSingStats5m.sql
-#	../hg/encode3/encodeDataWarehouse/lib/edwSubmit.log
-#	../hg/encode3/encodeDataWarehouse/lib/new.sql
-#	../hg/encode3/encodeDataWarehouse/lib/populateTest
-#	../hg/encode3/encodeDataWarehouse/lib/prod.snoop
-#	../hg/encode3/encodeDataWarehouse/lib/subFifo
-#	../hg/encode3/encodeDataWarehouse/lib/test.sizes
-#	../hg/encode3/encodeDataWarehouse/lib/test.snoop
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/april2.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/april7.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/cache/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/doFoo
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/edwBiosample.sql
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/edwBiosample.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/feb10.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/foo.json
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/foo2
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/jan3.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/jun2.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/out.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFakeBiosample/testIt
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwFreen/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/edwAnalysis.sql
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out10/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out11/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out12/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out13/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out14/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out15/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out16/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out17/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out18/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out19/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out2/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out20/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out21/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out22/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out23/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out3/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out4/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out5/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out6/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out7/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out8/
-#	../hg/encode3/encodeDataWarehouse/oneShot/edwToEap1/out9/
-#	../hg/encode3/encodeDataWarehouse/oneShot/reloadExpTable
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/april7.acc
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/april7.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/cache/
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/dec14.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/dec17.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/dec18.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/dec18_sorted.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/dec9.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/doIt
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/edwBiosample.as
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/edwExperiment.sql
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/feb10.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/gone.acc
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/jan16.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/jan17.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/jun2.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/myKey
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/new.acc
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/oldCache/
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/oldOut.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/out.acc
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/out.tab
-#	../hg/encode3/encodeDataWarehouse/oneShot/rsyncEdwExpDataType/testIt
-#	../hg/encode3/encodeDataWarehouse/oneShot/sampleBam/ENCFF000ABR.01.bam
-#	../hg/encode3/encodeDataWarehouse/oneShot/sampleBam/ENCFF000ABR.01.sam
-#	../hg/encode3/encodeDataWarehouse/oneShot/sampleBam/ENCFF000ABR.bam
-#	../hg/encode3/encodeDataWarehouse/oneShot/sampleBam/bamHeader
-#	../hg/encode3/encodeDataWarehouse/oneShot/sampleBam/foo.bed
-#	../hg/encode3/encodeDataWarehouse/oneShot/testSubmitValid/
-#	../hg/encode3/encodeDataWarehouse/pull
-#	../hg/encode3/encodeDataWarehouse/snoop.full
-#	../hg/encode3/encodeDataWarehouse/status
-#	../hg/encode3/encodeDataWarehouse/timingNotes
-#	../hg/encode3/encodeDataWarehouse/upgrade/
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/edwBamStats.good
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/edwBamStats.lowMem
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/foo.bed
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/foo.ra
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/foo2.ra
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/foo3.ra
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/n.bam
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/n.ra
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/pair.bam
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/pair.ra
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/s.bam
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/s.ra
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/s5.bam
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/s5.sam
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/s500.bam
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/s50000.bam
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamStats/s50000.ra
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamToWig/encode_regions_r2.bam
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamToWig/makefile
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamToWig/test.bw
-#	../hg/encode3/encodeDataWarehouse/utils/edwBamToWig/test.out
-#	../hg/encode3/encodeDataWarehouse/utils/edwComparePeaks/a.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwComparePeaks/b.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwComparePeaks/out.ra
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/484_1.broadPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/484_485_rep.broadPeak
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/485_1.broadPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/488.merge
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/488_1.broadPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/488_1.narrowPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/488_2.broadPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/488_2.narrowPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/488_foo.broadPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/488_foo.narrowPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/488_r.broadPeak
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/488_rep.broadPeak
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/488_rep.narrowPeak
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/TSTFF003YCG.broadPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/TSTFF003YCH.narrowPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/TSTFF003YLI.broadPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/TSTFF003YLJ.narrowPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/TSTFF003YVA.broadPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/TSTFF003YVG.broadPeak.bigBed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/a.broadPeak
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/a1.bb
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/a1.broadPeak
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/a2.bb
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/a2.broadPeak
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/clustersOver2.bed
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/tmp.broadPeak
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/tmp.narrowPeak
-#	../hg/encode3/encodeDataWarehouse/utils/edwReplicatedPeaks/tmp.narrowPeak.bb
-#	../hg/encode3/encodeDataWarehouse/utils/edwSamPairedEndStats/foo2
-#	../hg/encode3/encodeDataWarehouse/utils/edwSamPairedEndStats/test.out
-#	../hg/encode3/encodeDataWarehouse/utils/edwSamPairedEndStats/test.ra
-#	../hg/encode3/encodeDataWarehouse/utils/edwSamPairedEndStats/test.sam
-#	../hg/encode3/encodeDataWarehouse/utils/edwSamRepeatAnalysis/makk
-#	../hg/encode3/encodeDataWarehouse/utils/edwSamRepeatAnalysis/out.ra
-#	../hg/encode3/encodeDataWarehouse/utils/edwSolexaToSangerFastq/fixed.fq.gz
-#	../hg/encode3/encodeDataWarehouse/utils/edwSolexaToSangerFastq/foo.fq
-#	../hg/encode3/encodeDataWarehouse/utils/edwSolexaToSangerFastq/subs.in
-#	../hg/encode3/encodeDataWarehouse/utils/edwValidKey/
-#	../hg/encode3/importEncode2/encode2AddSumsAndSizes/
-#	../hg/encode3/importEncode2/encode2AddTgzContentsToManifest/
-#	../hg/encode3/importEncode2/encode2BedDoctor/fixed.bed
-#	../hg/encode3/importEncode2/encode2BedDoctor/weird.bed
-#	../hg/encode3/importEncode2/encode2CmpMd5/match.tab
-#	../hg/encode3/importEncode2/encode2CmpMd5/mismatch.lst
-#	../hg/encode3/importEncode2/encode2CmpMd5/mismatch.tab
-#	../hg/encode3/importEncode2/encode2CmpMd5/recalcHit.tab
-#	../hg/encode3/importEncode2/encode2CmpMd5/recalcMiss.tab
-#	../hg/encode3/importEncode2/encode2CmpMd5/recalcMissesUcsc.md5sum
-#	../hg/encode3/importEncode2/encode2CmpMd5/sdsc.md5sum
-#	../hg/encode3/importEncode2/encode2CmpMd5/sdscOnly.tab
-#	../hg/encode3/importEncode2/encode2CmpMd5/ucsc.md5sum
-#	../hg/encode3/importEncode2/encode2CmpMd5/ucscOnly.tab
-#	../hg/encode3/importEncode2/encode2ExpDumpFlat/expFlat.sql
-#	../hg/encode3/importEncode2/encode2ExpDumpFlat/expFlat.tab
-#	../hg/encode3/importEncode2/encode2ExpDumpFlat/go
-#	../hg/encode3/importEncode2/encode2ExpDumpFlat/noSeries
-#	../hg/encode3/importEncode2/encode2ExpDumpFlat/noSeries.tab
-#	../hg/encode3/importEncode2/encode2ExpDumpFlat/output.tab
-#	../hg/encode3/importEncode2/encode2ExpDumpFlat/view.sql
-#	../hg/encode3/importEncode2/encode2FastqSubdirsInManifest/
-#	../hg/encode3/importEncode2/encode2GffDoctor/fixed.bed
-#	../hg/encode3/importEncode2/encode2GffDoctor/fixed.gff
-#	../hg/encode3/importEncode2/encode2GffDoctor/manifest.tab
-#	../hg/encode3/importEncode2/encode2GffDoctor/test.gff
-#	../hg/encode3/importEncode2/encode2JustBeddy/
-#	../hg/encode3/importEncode2/encode2MakeEncode3/big.make
-#	../hg/encode3/importEncode2/encode2MakeEncode3/big.make.out
-#	../hg/encode3/importEncode2/encode2MakeEncode3/encode2encode3.make
-#	../hg/encode3/importEncode2/encode2MakeEncode3/gfft.make
-#	../hg/encode3/importEncode2/encode2MakeEncode3/gfftManifest.new
-#	../hg/encode3/importEncode2/encode2MakeEncode3/gfftManifest.tab
-#	../hg/encode3/importEncode2/encode2MakeEncode3/gfftRemap.lst
-#	../hg/encode3/importEncode2/encode2MakeEncode3/go
-#	../hg/encode3/importEncode2/encode2MakeEncode3/manifest.new
-#	../hg/encode3/importEncode2/encode2MakeEncode3/manifest.tab
-#	../hg/encode3/importEncode2/encode2MakeEncode3/remap.lst
-#	../hg/encode3/importEncode2/encode2Manifest/foo2
-#	../hg/encode3/importEncode2/encode2Manifest/go
-#	../hg/encode3/importEncode2/encode2Manifest/manifest.firstBig
-#	../hg/encode3/importEncode2/encode2Manifest/manifest.tab
-#	../hg/encode3/importEncode2/encode2Manifest/simpleManifest.tab
-#	../hg/encode3/importEncode2/encode2Manifest/validatedManifest.tab
-#	../hg/encode3/importEncode2/encode2Md5UpdateManifest/both
-#	../hg/encode3/importEncode2/encode2Md5UpdateManifest/fixed.tab
-#	../hg/encode3/importEncode2/encode2Md5UpdateManifest/header.tab
-#	../hg/encode3/importEncode2/encode2Md5UpdateManifest/manifest.tab
-#	../hg/encode3/importEncode2/encode2Md5UpdateManifest/patch.md5
-#	../hg/encode3/importEncode2/encode2Meta/backup/
-#	../hg/encode3/importEncode2/encode2Meta/bigBedInfo
-#	../hg/encode3/importEncode2/encode2Meta/foo.txt
-#	../hg/encode3/importEncode2/encode2Meta/go
-#	../hg/encode3/importEncode2/encode2Meta/hg19MetaFromRr.txt
-#	../hg/encode3/importEncode2/encode2Meta/manifest.tab
-#	../hg/encode3/importEncode2/encode2Meta/meta.ra
-#	../hg/encode3/importEncode2/encode2Meta/mm9MetaFromRr.txt
-#	../hg/encode3/importEncode2/encode2Meta/noParent.ra
-#	../hg/encode3/importEncode2/encode2Meta/parented.ra
-#	../hg/encode3/importEncode2/encode2Meta/sample.ra
-#	../hg/encode3/importEncode2/encode2Meta/sampleHoisted.ra
-#	../hg/encode3/importEncode2/encode2Meta/ugly.tree
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/foo2
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/go
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/manifest.txt
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/metaFlat.txt
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/metaNoParents.gz
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/metaNoParents.txt
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/metaWithParents.txt
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/patched.ra
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/reformat.patch
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/reformat.ra
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/test.out
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/tgz.dir.patch
-#	../hg/encode3/importEncode2/encode2MetaPatchRenamed/untarred.ra
-#	../hg/encode3/importEncode2/encode2ReplacedAndDepricated/
-#	../hg/encode3/importEncode2/encodeCvToDb/ab.sql
-#	../hg/encode3/importEncode2/encodeCvToDb/abTarget.sql
-#	../hg/encode3/importEncode2/encodeCvToDb/backup2/
-#	../hg/encode3/importEncode2/encodeCvToDb/cv.as
-#	../hg/encode3/importEncode2/encodeCvToDb/cv.atree
-#	../hg/encode3/importEncode2/encodeCvToDb/cv.django/
-#	../hg/encode3/importEncode2/encodeCvToDb/cv.ra
-#	../hg/encode3/importEncode2/encodeCvToDb/cv.sql
-#	../hg/encode3/importEncode2/encodeCvToDb/cv.stats
-#	../hg/encode3/importEncode2/encodeCvToDb/cv.tab/
-#	../hg/encode3/importEncode2/encodeCvToDb/dump/
-#	../hg/encode3/importEncode2/encodeCvToDb/go
-#	../hg/encode3/importEncode2/encodeCvToDb/loadTabs
-#	../hg/encode3/importEncode2/encodeCvToDb/makeEncodeMetaDb
-#	../hg/encode3/importEncode2/encodeCvToDb/old.atree
-#	../hg/encode3/importEncode2/encodeCvToDb/out
-#	../hg/encode3/importEncode2/encodeCvToDb/pull
-#	../hg/encode3/importEncode2/encodeCvToDb/raTagNames
-#	../hg/encode3/importEncode2/encodeCvToDb/status
-#	../hg/encode3/importEncode2/encodeCvToDb/tableDescriptions.tab
-#	../hg/encode3/importEncode2/encodeCvToDb/testCvToSql.out
-#	../hg/encode3/importEncode2/encodeExpToCvDb/backup/
-#	../hg/encode3/importEncode2/encodeExpToCvDb/django.py
-#	../hg/encode3/importEncode2/encodeExpToCvDb/django18.py
-#	../hg/encode3/importEncode2/encodeExpToCvDb/exp.django
-#	../hg/encode3/importEncode2/encodeExpToCvDb/exp.tab
-#	../hg/encode3/importEncode2/encodeExpToCvDb/experiment.as
-#	../hg/encode3/importEncode2/encodeExpToCvDb/experiment.tab
-#	../hg/encode3/importEncode2/encodeExpToCvDb/experiment18.tab
-#	../hg/encode3/importEncode2/encodeExpToCvDb/files.tab
-#	../hg/encode3/importEncode2/encodeExpToCvDb/foo.c
-#	../hg/encode3/importEncode2/encodeExpToCvDb/foo.django
-#	../hg/encode3/importEncode2/encodeExpToCvDb/foo.h
-#	../hg/encode3/importEncode2/encodeExpToCvDb/foo.sql
-#	../hg/encode3/importEncode2/encodeExpToCvDb/out
-#	../hg/encode3/importEncode2/encodeExpToCvDb/result.as
-#	../hg/encode3/importEncode2/encodeExpToCvDb/result.tab
-#	../hg/encode3/importEncode2/encodeExpToCvDb/result18.tab
-#	../hg/encode3/importEncode2/encodeExpToCvDb/series.as
-#	../hg/encode3/importEncode2/encodeExpToCvDb/series.tab
-#	../hg/encode3/importEncode2/encodeExpToCvDb/series18.tab
-#	../hg/encode3/importEncode2/encodeMd5sum.zip
-#	../hg/encode3/importEncode2/renamedFiles
-#	../hg/encode3/notesOnBwa.txt
-#	../hg/encode3/stanFace/
-#	../hg/encode3/status
-#	../hg/err
-#	../hg/foo.ra
-#	../hg/genePredToBed/foo.bed
-#	../hg/hgGene/status
-#	../hg/hgHubConnect/status
-#	../hg/hgTables/all.joiner
-#	../hg/hgTables/hgTablesTest.log
-#	../hg/hgTables/status
-#	../hg/hgTablesTest/log
-#	../hg/hgTrackUi/cgapSageUi.c.blame
-#	../hg/hgTrackUi/coo
-#	../hg/hgTrackUi/encodePeakUi.c.blame
-#	../hg/hgTrackUi/hgTrackUi.c.blame
-#	../hg/hgTrackUi/hgTrackUi.h.blame
-#	../hg/hgTrackUi/status
-#	../hg/hgTracks/bam.ra
-#	../hg/hgTracks/blame
-#	../hg/hgTracks/cart.ra
-#	../hg/hgTracks/diff
-#	../hg/hgTracks/foo.ra
-#	../hg/hgTracks/gilt.out
-#	../hg/hgTracks/hgt/
-#	../hg/hgTracks/hgtIdeo/
-#	../hg/hgTracks/output.ps
-#	../hg/hgTracks/track.ra
-#	../hg/hgTracks/track2.ra
-#	../hg/hgTracks/track3.ra
-#	../hg/hgTracks/wigDraws.lst
-#	../hg/hgc/status
-#	../hg/inc/omiciaUi.h
-#	../hg/inc/oregannoOther.h
-#	../hg/lib/HInv.c.blame
-#	../hg/lib/acemblyClass.c.blame
-#	../hg/lib/affy10K.c.blame
-#	../hg/lib/affy10KDetails.c.blame
-#	../hg/lib/affy120KDetails.c.blame
-#	../hg/lib/affyAllExonProbe.c.blame
-#	../hg/lib/affyAtlas.c.blame
-#	../hg/lib/affyGenoDetails.c.blame
-#	../hg/lib/affyOffset.c.blame
-#	../hg/lib/affyPairs.c.blame
-#	../hg/lib/affyTransLifted.c.blame
-#	../hg/lib/affyTranscriptome.c.blame
-#	../hg/lib/agp.c.blame
-#	../hg/lib/agpFrag.c.blame
-#	../hg/lib/agpGap.c.blame
-#	../hg/lib/alignInfo.c.blame
-#	../hg/lib/alignSeqSizes.c.blame
-#	../hg/lib/alleleFreqs.c.blame
-#	../hg/lib/allpredictions.c.blame
-#	../hg/lib/altGraph.c.blame
-#	../hg/lib/altGraphX.c.blame
-#	../hg/lib/ancientRref.c.blame
-#	../hg/lib/annoGrateWig.c.blame
-#	../hg/lib/annoGratorGpVar.c.blame
-#	../hg/lib/annoStreamDb.c.blame
-#	../hg/lib/annoStreamWig.c.blame
-#	../hg/lib/api.c.blame
-#	../hg/lib/arCOGs.c.blame
-#	../hg/lib/arcogdesc.c.blame
-#	../hg/lib/atomDb.c.blame
-#	../hg/lib/axtInfo.c.blame
-#	../hg/lib/axtLib.c.blame
-#	../hg/lib/bacCloneAlias.c.blame
-#	../hg/lib/bacCloneXRef.c.blame
-#	../hg/lib/bacEndAlias.c.blame
-#	../hg/lib/bactigPos.c.blame
-#	../hg/lib/baseMaskCommon.c.blame
-#	../hg/lib/bdgpExprLink.c.blame
-#	../hg/lib/bdgpGeneInfo.c.blame
-#	../hg/lib/bdgpSwissProt.c.blame
-#	../hg/lib/bed.c.blame
-#	../hg/lib/bed12Source.c.blame
-#	../hg/lib/bed12wSeq.c.blame
-#	../hg/lib/bed5FloatScore.c.blame
-#	../hg/lib/bed5Pval.c.blame
-#	../hg/lib/bed6FloatScore.c.blame
-#	../hg/lib/bed8Attrs.c.blame
-#	../hg/lib/bedCart.c.blame
-#	../hg/lib/bedDetail.c.blame
-#	../hg/lib/bgiGeneInfo.c.blame
-#	../hg/lib/bgiGeneSnp.c.blame
-#	../hg/lib/bgiSnp.c.blame
-#	../hg/lib/bioImage.c.blame
-#	../hg/lib/blame
-#	../hg/lib/blastTab.c.blame
-#	../hg/lib/blastzNet.c.blame
-#	../hg/lib/blatServers.c.blame
-#	../hg/lib/borf.c.blame
-#	../hg/lib/borkPseudoHom.c.blame
-#	../hg/lib/botDelay.c.blame
-#	../hg/lib/cart.c.blame
-#	../hg/lib/cart.new
-#	../hg/lib/cartDb.c.blame
-#	../hg/lib/ccdsGeneMap.c.blame
-#	../hg/lib/ccdsInfo.c.blame
-#	../hg/lib/ccdsNotes.c.blame
-#	../hg/lib/cddDesc.c.blame
-#	../hg/lib/cddInfo.c.blame
-#	../hg/lib/cdsEvidence.c.blame
-#	../hg/lib/cdsOrtho.c.blame
-#	../hg/lib/cdsPick.c.blame
-#	../hg/lib/cdsSpec.c.blame
-#	../hg/lib/celeraCoverage.c.blame
-#	../hg/lib/celeraDupPositive.c.blame
-#	../hg/lib/cgh.c.blame
-#	../hg/lib/chainCart.c.blame
-#	../hg/lib/chainDb.c.blame
-#	../hg/lib/chainGap.c.blame
-#	../hg/lib/chainLink.c.blame
-#	../hg/lib/chainNet.c.blame
-#	../hg/lib/chainNetDbLoad.c.blame
-#	../hg/lib/chicken13kInfo.c.blame
-#	../hg/lib/chr18deletions.c.blame
-#	../hg/lib/chromBins.c.blame
-#	../hg/lib/chromGraph.c.blame
-#	../hg/lib/chromGraphFactory.c.blame
-#	../hg/lib/chromInfo.c.blame
-#	../hg/lib/chromInserts.c.blame
-#	../hg/lib/chromKeeper.c.blame
-#	../hg/lib/clonePos.c.blame
-#	../hg/lib/cnpIafrate.c.blame
-#	../hg/lib/cnpIafrate2.c.blame
-#	../hg/lib/cnpLocke.c.blame
-#	../hg/lib/cnpRedon.c.blame
-#	../hg/lib/cnpSebat.c.blame
-#	../hg/lib/cnpSebat2.c.blame
-#	../hg/lib/cnpSharp.c.blame
-#	../hg/lib/cnpSharp2.c.blame
-#	../hg/lib/cnpSharpCutoff.c.blame
-#	../hg/lib/cnpSharpSample.c.blame
-#	../hg/lib/codeBlast.c.blame
-#	../hg/lib/codeBlastScore.c.blame
-#	../hg/lib/cogs.c.blame
-#	../hg/lib/cogsxra.c.blame
-#	../hg/lib/columnInfo.c.blame
-#	../hg/lib/contigAcc.c.blame
-#	../hg/lib/coordConv.c.blame
-#	../hg/lib/cpgIsland.c.blame
-#	../hg/lib/cpgIslandExt.c.blame
-#	../hg/lib/ctgPos.c.blame
-#	../hg/lib/ctgPos2.c.blame
-#	../hg/lib/customFactory.c.blame
-#	../hg/lib/customPp.c.blame
-#	../hg/lib/customTrack.c.blame
-#	../hg/lib/cutter.c.blame
-#	../hg/lib/cv.c.blame
-#	../hg/lib/cytoBand.c.blame
-#	../hg/lib/dbDb.c.blame
-#	../hg/lib/dbRIP.c.blame
-#	../hg/lib/dbSnpRs.c.blame
-#	../hg/lib/defaultDb.c.blame
-#	../hg/lib/delConrad2.c.blame
-#	../hg/lib/delHinds2.c.blame
-#	../hg/lib/dgv.c.blame
-#	../hg/lib/diff
-#	../hg/lib/dless.c.blame
-#	../hg/lib/dnaMarkovSql.c.blame
-#	../hg/lib/dnaMotifSql.c.blame
-#	../hg/lib/dnaProbe.c.blame
-#	../hg/lib/dv.c.blame
-#	../hg/lib/dvBed.c.blame
-#	../hg/lib/dvXref2.c.blame
-#	../hg/lib/easyGene.c.blame
-#	../hg/lib/ec.c.blame
-#	../hg/lib/ecAttribute.c.blame
-#	../hg/lib/ecAttributeCode.c.blame
-#	../hg/lib/ecCode.c.blame
-#	../hg/lib/encode/foo.py
-#	../hg/lib/ensFace.c.blame
-#	../hg/lib/ensInfo.c.blame
-#	../hg/lib/ensPhusionBlast.c.blame
-#	../hg/lib/ensXRefZfish.c.blame
-#	../hg/lib/est3.c.blame
-#	../hg/lib/estOrientInfo.c.blame
-#	../hg/lib/estPair.c.blame
-#	../hg/lib/exoFish.c.blame
-#	../hg/lib/expData.c.blame
-#	../hg/lib/expRecord.c.blame
-#	../hg/lib/exprBed.c.blame
-#	../hg/lib/fbTables.c.blame
-#	../hg/lib/featureBits.c.blame
-#	../hg/lib/fileUi.c.blame
-#	../hg/lib/findKGAlias.c.blame
-#	../hg/lib/findKGProtAlias.c.blame
-#	../hg/lib/fishClones.c.blame
-#	../hg/lib/flyBase2004Xref.c.blame
-#	../hg/lib/flyBaseSwissProt.c.blame
-#	../hg/lib/flyreg.c.blame
-#	../hg/lib/flyreg2.c.blame
-#	../hg/lib/fosEndPairs.c.blame
-#	../hg/lib/gbExtFile.c.blame
-#	../hg/lib/gbMiscDiff.c.blame
-#	../hg/lib/gbProtAnn.c.blame
-#	../hg/lib/gbRNAs.c.blame
-#	../hg/lib/gbSeq.c.blame
-#	../hg/lib/gbWarn.c.blame
-#	../hg/lib/gcPercent.c.blame
-#	../hg/lib/genMapDb.c.blame
-#	../hg/lib/genbank.c.blame
-#	../hg/lib/genbankBlackList.c.blame
-#	../hg/lib/gencodeGeneClass.c.blame
-#	../hg/lib/gencodeIntron.c.blame
-#	../hg/lib/geneBands.c.blame
-#	../hg/lib/geneCheck.c.blame
-#	../hg/lib/geneCheckDetails.c.blame
-#	../hg/lib/geneCheckWidget.c.blame
-#	../hg/lib/geneGraph.c.blame
-#	../hg/lib/genePix.c.blame
-#	../hg/lib/genePred.c.blame
-#	../hg/lib/genePredReader.c.blame
-#	../hg/lib/geneSimilarities.c.blame
-#	../hg/lib/geneTree.c.blame
-#	../hg/lib/genoLay.c.blame
-#	../hg/lib/genomeRangeTreeFile.c.blame
-#	../hg/lib/genomicDups.c.blame
-#	../hg/lib/genomicSuperDups.c.blame
-#	../hg/lib/genotype.c.blame
-#	../hg/lib/genotypeFreqs.c.blame
-#	../hg/lib/geoMirror.c.blame
-#	../hg/lib/ggCluster.c.blame
-#	../hg/lib/ggDbIo.c.blame
-#	../hg/lib/ggDbRep.c.blame
-#	../hg/lib/ggDump.c.blame
-#	../hg/lib/ggGraph.c.blame
-#	../hg/lib/ggMrnaAli.c.blame
-#	../hg/lib/ggTypes.c.blame
-#	../hg/lib/glDbRep.c.blame
-#	../hg/lib/goa.c.blame
-#	../hg/lib/goaPart.c.blame
-#	../hg/lib/googleAnalytics.c.blame
-#	../hg/lib/gpFx.c.blame
-#	../hg/lib/growthCondition.c.blame
-#	../hg/lib/grp.c.blame
-#	../hg/lib/gv.c.blame
-#	../hg/lib/gvUi.c.blame
-#	../hg/lib/gwasCatalog.c.blame
-#	../hg/lib/hCommon.c.blame
-#	../hg/lib/hCytoBand.c.blame
-#	../hg/lib/hPrint.c.blame
-#	../hg/lib/hVarSubst.c.blame
-#	../hg/lib/hapmapAlleleFreq.c.blame
-#	../hg/lib/hapmapAlleles.c.blame
-#	../hg/lib/hapmapAllelesCombined.c.blame
-#	../hg/lib/hapmapAllelesOrtho.c.blame
-#	../hg/lib/hapmapAllelesSummary.c.blame
-#	../hg/lib/hapmapLd.c.blame
-#	../hg/lib/hapmapPhaseIIISummary.c.blame
-#	../hg/lib/hapmapPrimateAlleles.c.blame
-#	../hg/lib/hapmapSnps.c.blame
-#	../hg/lib/hapmapSnpsCombined.c.blame
-#	../hg/lib/hdb.c.blame
-#	../hg/lib/hgBam.c.blame
-#	../hg/lib/hgColors.c.blame
-#	../hg/lib/hgConfig.c.blame
-#	../hg/lib/hgExp.c.blame
-#	../hg/lib/hgFind.c.blame
-#	../hg/lib/hgFindSpec.c.blame
-#	../hg/lib/hgFindSpecCustom.c.blame
-#	../hg/lib/hgGene.c.blame
-#	../hg/lib/hgMaf.c.blame
-#	../hg/lib/hgRelate.c.blame
-#	../hg/lib/hgSeq.c.blame
-#	../hg/lib/hgdpGeo.c.blame
-#	../hg/lib/hgnc.c.blame
-#	../hg/lib/hubConnect.c.blame
-#	../hg/lib/hui.c.blame
-#	../hg/lib/humanParalog.c.blame
-#	../hg/lib/hvGfx.c.blame
-#	../hg/lib/imageClone.c.blame
-#	../hg/lib/isochores.c.blame
-#	../hg/lib/ispyTables.c.blame
-#	../hg/lib/itemAttr.c.blame
-#	../hg/lib/itemConf.c.blame
-#	../hg/lib/itemDetailsHtml.c.blame
-#	../hg/lib/jalview.c.blame
-#	../hg/lib/jaxOrtholog.c.blame
-#	../hg/lib/jaxQTL.c.blame
-#	../hg/lib/jaxQTL2.c.blame
-#	../hg/lib/jaxQTL3.c.blame
-#	../hg/lib/jgiGene.c.blame
-#	../hg/lib/jksql.c.blame
-#	../hg/lib/joiner.c.blame
-#	../hg/lib/jsHelper.c.blame
-#	../hg/lib/kg1ToKg2.c.blame
-#	../hg/lib/kgAlias.c.blame
-#	../hg/lib/kgColor.c.blame
-#	../hg/lib/kgMapName.c.blame
-#	../hg/lib/kgProtAlias.c.blame
-#	../hg/lib/kgXref.c.blame
-#	../hg/lib/knownCanonical.c.blame
-#	../hg/lib/knownInfo.c.blame
-#	../hg/lib/knownMore.c.blame
-#	../hg/lib/knownToSuper.c.blame
-#	../hg/lib/landmark.c.blame
-#	../hg/lib/landmarkUi.c.blame
-#	../hg/lib/ld.c.blame
-#	../hg/lib/ld2.c.blame
-#	../hg/lib/lfs.c.blame
-#	../hg/lib/liftOver.c.blame
-#	../hg/lib/liftOverChain.c.blame
-#	../hg/lib/liftUp.c.blame
-#	../hg/lib/llaInfo.c.blame
-#	../hg/lib/lowelabArkinOperonScore.c.blame
-#	../hg/lib/lowelabPfamHit.c.blame
-#	../hg/lib/lowelabPfamHit.h.blame
-#	../hg/lib/lowelabTIGROperonScore.c.blame
-#	../hg/lib/loweutils.c.blame
-#	../hg/lib/lsSnpPdb.c.blame
-#	../hg/lib/lsSnpPdbChimera.c.blame
-#	../hg/lib/mafFrames.c.blame
-#	../hg/lib/mafGene.c.blame
-#	../hg/lib/mafSummary.c.blame
-#	../hg/lib/makeItemsItem.c.blame
-#	../hg/lib/mammalPsg.c.blame
-#	../hg/lib/mapSts.c.blame
-#	../hg/lib/mcnBreakpoints.c.blame
-#	../hg/lib/mdb.c.blame
-#	../hg/lib/med
-#	../hg/lib/megablastInfo.c.blame
-#	../hg/lib/metaChromGraph.c.blame
-#	../hg/lib/mgiID.c.blame
-#	../hg/lib/microarray.c.blame
-#	../hg/lib/minChromSize.c.blame
-#	../hg/lib/minGeneInfo.c.blame
-#	../hg/lib/mouseOrtho.c.blame
-#	../hg/lib/mouseSyn.c.blame
-#	../hg/lib/mouseSynWhd.c.blame
-#	../hg/lib/mrnaMisMatch.c.blame
-#	../hg/lib/mysqlTableStatus.c.blame
-#	../hg/lib/ncRna.c.blame
-#	../hg/lib/netAlign.c.blame
-#	../hg/lib/netCart.c.blame
-#	../hg/lib/nonCodingUi.c.blame
-#	../hg/lib/omicia.c.blame
-#	../hg/lib/omiciaUi.c
-#	../hg/lib/omiciaUi.c.blame
-#	../hg/lib/omimTitle.c.blame
-#	../hg/lib/ooUtils.c.blame
-#	../hg/lib/oreganno.c.blame
-#	../hg/lib/oregannoOther.as
-#	../hg/lib/oregannoOther.c
-#	../hg/lib/oregannoOther.c.blame
-#	../hg/lib/oregannoOther.sql
-#	../hg/lib/oregannoUi.c.blame
-#	../hg/lib/orthoAlleles.c.blame
-#	../hg/lib/pal.c.blame
-#	../hg/lib/pbStamp.c.blame
-#	../hg/lib/pcrResult.c.blame
-#	../hg/lib/pepPred.c.blame
-#	../hg/lib/pgPhenoAssoc.c.blame
-#	../hg/lib/pgPolyphenPred.c.blame
-#	../hg/lib/pgSiftPred.c.blame
-#	../hg/lib/pgSnp.c.blame
-#	../hg/lib/plasEndPairs.c.blame
-#	../hg/lib/polyGenotype.c.blame
-#	../hg/lib/protFeat.c.blame
-#	../hg/lib/protVar.c.blame
-#	../hg/lib/pscreen.c.blame
-#	../hg/lib/pseudoGeneLink.c.blame
-#	../hg/lib/pslReader.c.blame
-#	../hg/lib/pslWQueryID.c.blame
-#	../hg/lib/pslWScore.c.blame
-#	../hg/lib/pull
-#	../hg/lib/push
-#	../hg/lib/putaInfo.c.blame
-#	../hg/lib/qaSeq.c.blame
-#	../hg/lib/rangeTreeFile.c.blame
-#	../hg/lib/rankProp.c.blame
-#	../hg/lib/recombRate.c.blame
-#	../hg/lib/recombRateMouse.c.blame
-#	../hg/lib/recombRateRat.c.blame
-#	../hg/lib/refLink.c.blame
-#	../hg/lib/refSeqStatus.c.blame
-#	../hg/lib/retroMrnaInfo.c.blame
-#	../hg/lib/rgdQtl.c.blame
-#	../hg/lib/rhMapInfo.c.blame
-#	../hg/lib/rhMapZfishInfo.c.blame
-#	../hg/lib/riken.c.blame
-#	../hg/lib/rikenBest.c.blame
-#	../hg/lib/rikenCluster.c.blame
-#	../hg/lib/rmskOut.c.blame
-#	../hg/lib/rnaFold.c.blame
-#	../hg/lib/rnaGene.c.blame
-#	../hg/lib/rnaGenes.c.blame
-#	../hg/lib/rnaGroup.c.blame
-#	../hg/lib/rnaHybridization.c.blame
-#	../hg/lib/rnaPLFold.c.blame
-#	../hg/lib/rnaSecStr.c.blame
-#	../hg/lib/roughAli.c.blame
-#	../hg/lib/sage.c.blame
-#	../hg/lib/sageCounts.c.blame
-#	../hg/lib/sageExp.c.blame
-#	../hg/lib/samAlignment.c.blame
-#	../hg/lib/sample.c.blame
-#	../hg/lib/sanger22extra.c.blame
-#	../hg/lib/sangerGene.c.blame
-#	../hg/lib/sangerGeneToWBGeneID.c.blame
-#	../hg/lib/sargassoSeaXra.c.blame
-#	../hg/lib/scopDes.c.blame
-#	../hg/lib/scoredRef.c.blame
-#	../hg/lib/search.c.blame
-#	../hg/lib/sgdAbundance.c.blame
-#	../hg/lib/sgdClone.c.blame
-#	../hg/lib/sgdDescription.c.blame
-#	../hg/lib/sgdOther.c.blame
-#	../hg/lib/simpleNucDiff.c.blame
-#	../hg/lib/simpleRepeat.c.blame
-#	../hg/lib/snoRNAs.c.blame
-#	../hg/lib/snoRNAs.h.blame
-#	../hg/lib/snp.c.blame
-#	../hg/lib/snp125.c.blame
-#	../hg/lib/snp125CodingCoordless.c.blame
-#	../hg/lib/snp125Exceptions.c.blame
-#	../hg/lib/snp125Ui.c.blame
-#	../hg/lib/snp132Ext.c.blame
-#	../hg/lib/snpExceptions.c.blame
-#	../hg/lib/snpExtFile.c.blame
-#	../hg/lib/snpFasta.c.blame
-#	../hg/lib/snpMap.c.blame
-#	../hg/lib/snpSeq.c.blame
-#	../hg/lib/snpTmp.c.blame
-#	../hg/lib/snpUi.c.blame
-#	../hg/lib/softPromoter.c.blame
-#	../hg/lib/softberryHom.c.blame
-#	../hg/lib/spDb.c.blame
-#	../hg/lib/splignAlign.c.blame
-#	../hg/lib/sqlProg.c.blame
-#	../hg/lib/stanMad.c.blame
-#	../hg/lib/status
-#	../hg/lib/stsAlias.c.blame
-#	../hg/lib/stsInfo.c.blame
-#	../hg/lib/stsInfo2.c.blame
-#	../hg/lib/stsInfoMouse.c.blame
-#	../hg/lib/stsInfoMouseNew.c.blame
-#	../hg/lib/stsInfoRat.c.blame
-#	../hg/lib/stsMap.c.blame
-#	../hg/lib/stsMapMouse.c.blame
-#	../hg/lib/stsMapMouseNew.c.blame
-#	../hg/lib/stsMapRat.c.blame
-#	../hg/lib/stsMarker.c.blame
-#	../hg/lib/suggest.c.blame
-#	../hg/lib/switchDbTss.c.blame
-#	../hg/lib/synMap.c.blame
-#	../hg/lib/synteny100000.c.blame
-#	../hg/lib/syntenyBerk.c.blame
-#	../hg/lib/syntenySanger.c.blame
-#	../hg/lib/tRNAs.c.blame
-#	../hg/lib/tableDescriptions.c.blame
-#	../hg/lib/tableStatus.c.blame
-#	../hg/lib/targetDb.c.blame
-#	../hg/lib/taxonDivision.c.blame
-#	../hg/lib/taxonGeneticCode.c.blame
-#	../hg/lib/taxonName.c.blame
-#	../hg/lib/taxonNode.c.blame
-#	../hg/lib/taxonXref.c.blame
-#	../hg/lib/tests/foo.sh
-#	../hg/lib/tfbsCons.c.blame
-#	../hg/lib/tfbsConsFactors.c.blame
-#	../hg/lib/tfbsConsMap.c.blame
-#	../hg/lib/tfbsConsSites.c.blame
-#	../hg/lib/tigrCmrGene.c.blame
-#	../hg/lib/tigrOperon.c.blame
-#	../hg/lib/tilingPath.c.blame
-#	../hg/lib/traceInfo.c.blame
-#	../hg/lib/trackDb.c.blame
-#	../hg/lib/trackDbCustom.c.blame
-#	../hg/lib/trackHub.c.blame
-#	../hg/lib/trackLayout.c.blame
-#	../hg/lib/trackTable.c.blame
-#	../hg/lib/trackVersion.c.blame
-#	../hg/lib/transMapGene.c.blame
-#	../hg/lib/transMapInfo.c.blame
-#	../hg/lib/transMapSrc.c.blame
-#	../hg/lib/transMapStuff.c.blame
-#	../hg/lib/transRegCode.c.blame
-#	../hg/lib/transRegCodeCondition.c.blame
-#	../hg/lib/transRegCodeProbe.c.blame
-#	../hg/lib/trashDir.c.blame
-#	../hg/lib/txCluster.c.blame
-#	../hg/lib/txCommon.c.blame
-#	../hg/lib/txEdgeBed.c.blame
-#	../hg/lib/txEdgeOrtho.c.blame
-#	../hg/lib/txGraph.c.blame
-#	../hg/lib/txInfo.c.blame
-#	../hg/lib/txRnaAccs.c.blame
-#	../hg/lib/ucscRetroInfo.c.blame
-#	../hg/lib/ucscRetroOrtho.c.blame
-#	../hg/lib/validateGisaid.c.blame
-#	../hg/lib/variant.c.blame
-#	../hg/lib/variome.c.blame
-#	../hg/lib/vcfUi.c.blame
-#	../hg/lib/vegaInfo.c.blame
-#	../hg/lib/vegaInfoZfish.c.blame
-#	../hg/lib/visiGene.c.blame
-#	../hg/lib/vntr.c.blame
-#	../hg/lib/wabAli.c.blame
-#	../hg/lib/web.c.blame
-#	../hg/lib/wgRna.c.blame
-#	../hg/lib/wigAsciiToBinary.c.blame
-#	../hg/lib/wigDataStream.c.blame
-#	../hg/lib/wiggle.c.blame
-#	../hg/lib/wiggleCart.c.blame
-#	../hg/lib/wiggleUtils.c.blame
-#	../hg/lib/wikiLink.c.blame
-#	../hg/lib/wikiTrack.c.blame
-#	../hg/lib/yaleGencodeAssoc.c.blame
-#	../hg/lib/zdobnovSynt.c.blame
-#	../hg/logCrawl/encodeUserDbCrawl/foo2
-#	../hg/logCrawl/encodeUserDbCrawl/foo3
-#	../hg/logCrawl/encodeUserDbCrawl/foo4
-#	../hg/logCrawl/encodeUserDbCrawl/goo3
-#	../hg/logCrawl/encodeUserDbCrawl/out
-#	../hg/makeDb/doc/foo1
-#	../hg/makeDb/doc/hg18.old
-#	../hg/makeDb/doc/log
-#	../hg/makeDb/doc/status
-#	../hg/makeDb/genbank/bin/
-#	../hg/makeDb/genbank/lib/
-#	../hg/makeDb/outside/uwDnaseTrackHub/foo.as
-#	../hg/makeDb/schema/dbSnoop/biosample.tab
-#	../hg/makeDb/schema/dbSnoop/edw.dev
-#	../hg/makeDb/schema/dbSnoop/edw.pro
-#	../hg/makeDb/schema/dbSnoop/edw.tst
-#	../hg/makeDb/schema/dbSnoop/err
-#	../hg/makeDb/schema/foo.joiner
-#	../hg/makeDb/schema/joinTwoInfo/hgFixed.snoop
-#	../hg/makeDb/schema/joinTwoInfo/snoop
-#	../hg/makeDb/schema/sp090821.snoop
-#	../hg/makeDb/schema/sp100331.snoop
-#	../hg/makeDb/schema/sp101005.snoop
-#	../hg/makeDb/schema/status
-#	../hg/makeDb/schema/uniProt.snoop
-#	../hg/makeDb/trackDb/allRas
-#	../hg/makeDb/trackDb/fileList
-#	../hg/makeDb/trackDb/foo.ra.gz
-#	../hg/makeDb/trackDb/human/hg18/myTrackDb.ra
-#	../hg/makeDb/trackDb/human/hg19/foo2.ra
-#	../hg/makeDb/trackDb/human/hg19/jkExperiments.ra
-#	../hg/makeDb/trackDb/status
-#	../hg/merge
-#	../hg/oneShot/addUcscCopyright/list
-#	../hg/oneShot/addUcscCopyright/makefile
-#	../hg/oneShot/cartSim/cartSim.log
-#	../hg/oneShot/cartSim/jorgesDbs/
-#	../hg/oneShot/cartSim/longInnoDb1/
-#	../hg/oneShot/cartSim/longRun1/
-#	../hg/oneShot/cartSim/longRun2/
-#	../hg/oneShot/cartSim/longRun3/
-#	../hg/oneShot/cartSim/notes
-#	../hg/oneShot/cartSimNoInsert/cartFreen.log
-#	../hg/oneShot/freen/foo.ix
-#	../hg/oneShot/freen/foo10.bigWig
-#	../hg/oneShot/freen/foo2
-#	../hg/oneShot/freen/foo3
-#	../hg/oneShot/freen/freen.in
-#	../hg/oneShot/freen/freen.log
-#	../hg/oneShot/freen/freen.out
-#	../hg/oneShot/freen/ish
-#	../hg/oneShot/freen/now
-#	../hg/oneShot/freen/now2
-#	../hg/oneShot/freen/output
-#	../hg/oneShot/freen/para
-#	../hg/oneShot/freen/pull
-#	../hg/oneShot/freen/soon
-#	../hg/oneShot/freen/test.fastq
-#	../hg/oneShot/freen/test.stats
-#	../hg/oneShot/ga4ghToBed/debug
-#	../hg/oneShot/ga4ghToBed/test.bed
-#	../hg/oneShot/ga4ghToBed/testIt
-#	../hg/oneShot/hgFusion/
-#	../hg/oneShot/testBamStuff/
-#	../hg/oneShot/testSimpleCgi/
-#	../hg/oneShot/transparentTriangleTest/makefile
-#	../hg/oneShot/tryGtexBoxPlot/refresh.sh
-#	../hg/oneShot/tryNewColorOverlay/foo.png
-#	../hg/oneShot/tryNewColorOverlay/oneRna.lst
-#	../hg/oneShot/tryNewColorOverlay/rna.lst
-#	../hg/oneShot/wgEncodeRegGenRa/status
-#	../hg/protein/spToDb/blame
-#	../hg/protein/spToDb/spDbInno.sql
-#	../hg/protein/spToDb/spDbInnoDjango.sql
-#	../hg/protein/spToDb/spToDb.myVersion.c
-#	../hg/protein/spToDb/subs.in
-#	../hg/regulate/companion/hive
-#	../hg/regulate/companion/regCompanion5C/foo.out
-#	../hg/regulate/companion/regCompanion5C/test.bed
-#	../hg/regulate/companion/regCompanion5C/test.download
-#	../hg/regulate/companion/regCompanionChia/50kPromEnhanceViaChia.notes
-#	../hg/regulate/companion/regCompanionChia/50kPromEnhanceViaChia.tab
-#	../hg/regulate/companion/regCompanionChia/chia3enh3pro.tab
-#	../hg/regulate/companion/regCompanionChia/chia3pro3pro.tab
-#	../hg/regulate/companion/regCompanionChia/chiaPetK562SameChrom.tab
-#	../hg/regulate/companion/regCompanionChia/chiaPetK562SameChromSepBlocks.bed
-#	../hg/regulate/companion/regCompanionChia/chiaPromOtherEnd.bed
-#	../hg/regulate/companion/regCompanionChia/chiaPromOtherEnd.tab
-#	../hg/regulate/companion/regCompanionChia/chiaSamChromK562Exons.bed
-#	../hg/regulate/companion/regCompanionChia/chiaSameChromK562.bed
-#	../hg/regulate/companion/regCompanionChia/enhStringentGm12878.bed
-#	../hg/regulate/companion/regCompanionChia/enhStringentK562.bed
-#	../hg/regulate/companion/regCompanionChia/foo2
-#	../hg/regulate/companion/regCompanionChia/foo3
-#	../hg/regulate/companion/regCompanionChia/foo4
-#	../hg/regulate/companion/regCompanionChia/foo5
-#	../hg/regulate/companion/regCompanionChia/foo6
-#	../hg/regulate/companion/regCompanionChia/foo7
-#	../hg/regulate/companion/regCompanionChia/foofoo
-#	../hg/regulate/companion/regCompanionChia/gm12878Ctcf.bed
-#	../hg/regulate/companion/regCompanionChia/oneEnd.lst
-#	../hg/regulate/companion/regCompanionChia/oneEnd.tab
-#	../hg/regulate/companion/regCompanionChia/other.bed
-#	../hg/regulate/companion/regCompanionChia/other.lst
-#	../hg/regulate/companion/regCompanionChia/promoters.bed
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/1.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/1shuf.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/2-7.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/2-8.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/actToAct.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/actToAct90.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/actToPermuted.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/activeEnh.bed
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/activeEnh.lst
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/activeEnh.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/activeEnhToProm.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/activeGene.bed
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/activeGene.lst
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/activeGene.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/bed.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/ctcfInterference.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/enh.bed
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/enhToProm.bed
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/enhToProm.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/enhToProm100k.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/enhToProm10k.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/foo.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/outBad
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/outGood
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/permute707.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/permute90.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/permuted.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/permutedGene.lst
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/permutedGene.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/permutedOut.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/pro.bed
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/r90Lengths.tab
-#	../hg/regulate/companion/regCompanionCorrelateEnhancerAndExpression/rc
-#	../hg/regulate/companion/regCompanionCtcfInterference/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/Gm12878.lst
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/GmPhylo.lst
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/H1hesc.lst
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/K562.lst
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/canonical/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/chromHmm/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/corEnhGm12878.tab
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/corEnhStrandedGm12878.tab
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/ctcf/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/enh/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/enh2/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/ez/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/firstCodingSplice/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/gmEnh/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/oldOne.tab
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/one.lst
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/one.tab
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/p300/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/phyloP.lst
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/regPeaks/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/run2/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/secondCodingSplice/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/short.lst
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/stringent3/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/stringent4/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/stringent5/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/stringent6/
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/take2.err
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/tier1.lst
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/tier1Txn.lst
-#	../hg/regulate/companion/regCompanionGraphVsFixedPoints/toR.csh
-#	../hg/regulate/companion/regCompanionHistoneBox/bedToTabR.csh
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878Dnase.bed
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878Dnase.fat
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878Dnase.tab
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k27acBox.bed
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k27acBox.fat
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k27acBox.narrowPeak
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k27acBox.tab
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k4me1Box.bed
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k4me1Box.fat
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k4me1Box.narrowPeak
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k4me1Box.tab
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k4me1Box30.bed
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k4me1Box30.fat
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k4me1Box30.narrowPeak
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k4me1Box30.tab
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k4me3Box50.bed
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k4me3Box50.fat
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k4me3Box50.narrowPeak
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseH3k4me3Box50.tab
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseTop50.bed
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseTop50.fat
-#	../hg/regulate/companion/regCompanionHistoneBox/gm12878DnaseTop50.tab
-#	../hg/regulate/companion/regCompanionPickEnhancers/examplesByHand.txt
-#	../hg/regulate/companion/regCompanionPickEnhancers/foo.csh
-#	../hg/regulate/companion/regCompanionPickEnhancers/hsmm.csh
-#	../hg/regulate/companion/regCompanionPickEnhancers/loose.csh
-#	../hg/regulate/companion/regCompanionPickEnhancers/nhek.csh
-#	../hg/regulate/companion/regCompanionPickEnhancers/nhekDnaseChr1.narrowPeak
-#	../hg/regulate/companion/regCompanionPickEnhancers/oldOut.tab
-#	../hg/regulate/companion/regCompanionPickEnhancers/out.tab
-#	../hg/regulate/companion/regCompanionPickEnhancers/pickedBeds/
-#	../hg/regulate/companion/regCompanionPickEnhancers/std20.tab
-#	../hg/regulate/companion/regCompanionPickEnhancers/std25.tab
-#	../hg/regulate/companion/regCompanionPickEnhancers/std30.tab
-#	../hg/regulate/companion/regCompanionPickEnhancers/stringent.csh
-#	../hg/regulate/companion/regCompanionPickEnhancers/stringent.tab
-#	../hg/regulate/companion/regCompanionPickEnhancers/stringent2.csh
-#	../hg/regulate/companion/regCompanionPickEnhancers/stringent2/
-#	../hg/regulate/companion/regCompanionPickEnhancers/stringent3.csh
-#	../hg/regulate/companion/regCompanionPickEnhancers/stringent3/
-#	../hg/regulate/companion/regCompanionPickEnhancers/stringent4.csh
-#	../hg/regulate/companion/regCompanionPickEnhancers/stringent4/
-#	../hg/regulate/companion/regCompanionPickEnhancers/stringent5.csh
-#	../hg/regulate/companion/regCompanionPickEnhancers/stringent5/
-#	../hg/regulate/companion/regCompanionPickEnhancers/stringent6/
-#	../hg/regulate/companion/regCompanionPickEnhancers/subsetH1hesc.narrowPeak
-#	../hg/regulate/companion/regCompanionPickEnhancers/take1/
-#	../hg/regulate/companion/regCompanionPickEnhancers/take2/
-#	../hg/regulate/companion/regCompanionPickEnhancers/take3/
-#	../hg/regulate/companion/regCompanionPickEnhancers/take4/
-#	../hg/regulate/companion/regCompanionPickEnhancers/take5/
-#	../hg/regulate/companion/regCompanionSquishGraph/
-#	../hg/regulate/companion/regCompanionTopPeaks/
-#	../hg/regulate/log
-#	../hg/regulate/regBeadPos/.readBeadPos.doc.swp
-#	../hg/regulate/regBeadPos/bak/
-#	../hg/regulate/regBeadPos/dnaseSize.tab
-#	../hg/regulate/regBeadPos/firstGenomeRun.csh
-#	../hg/regulate/regBeadPos/firstGenomeRun.in
-#	../hg/regulate/regBeadPos/foo.bed
-#	../hg/regulate/regBeadPos/foo2
-#	../hg/regulate/regBeadPos/fullDnase.bw
-#	../hg/regulate/regBeadPos/fullH3k27ac.bw
-#	../hg/regulate/regBeadPos/fullH3k4me1.bw
-#	../hg/regulate/regBeadPos/histSize.tab
-#	../hg/regulate/regBeadPos/peak.bed
-#	../hg/regulate/regBeadPos/regBeads.narrowPeak
-#	../hg/regulate/regBeadPos/run2.bed
-#	../hg/regulate/regBeadPos/run2.csh
-#	../hg/regulate/regBeadPos/run2.in
-#	../hg/regulate/regBeadPos/run2.narrowPeak
-#	../hg/regulate/regBeadPos/stateProbes.cur
-#	../hg/regulate/regBeadPos/stateProbs.txt
-#	../hg/regulate/regBeadPos/test2.in
-#	../hg/regulate/regBeadPos/testAc.bw
-#	../hg/regulate/regBeadPos/testDnase.bw
-#	../hg/regulate/regCluster/diff
-#	../hg/regulate/regCluster/status
-#	../hg/regulate/regCluster/tests/needBreak/out.bed
-#	../hg/regulate/regCluster/tests/needBreak/out.cluster
-#	../hg/regulate/regClusterAttachMetadataToTableOfTables/filtered.bed
-#	../hg/regulate/regClusterBedExpCfg/hud/
-#	../hg/regulate/regClusterBedExpCfg/in.ra
-#	../hg/regulate/regClusterBedExpCfg/in.tab
-#	../hg/regulate/regClusterBedExpCfg/out.bed
-#	../hg/regulate/regClusterBedExpCfg/out.cfg
-#	../hg/regulate/regClusterBedExpCfg/out.exps
-#	../hg/regulate/regClusterBedExpCfg/yale
-#	../hg/regulate/regClusterTreeCells/clusterInput.lst
-#	../hg/regulate/regClusterTreeCells/foo2
-#	../hg/regulate/regClusterTreeCells/matrix
-#	../hg/regulate/regClusterTreeCells/status
-#	../hg/regulate/regClusterTreeCells/test2.lst
-#	../hg/regulate/regClusterTreeCells/tests/in2/
-#	../hg/regulate/regClusterTreeCells/tests/out.tree
-#	../hg/regulate/regClusterTreeCells/uwAffy.lst
-#	../hg/regulate/regStartSampleEmbl/.extra.embl.swp
-#	../hg/regulate/regStartSampleEmbl/extra.embl
-#	../hg/regulate/regStartSampleEmbl/foo2.embl
-#	../hg/regulate/status
-#	../hg/status
-#	../hg/test.ra
-#	../hg/trash/
-#	../hg/txCds/txCdsPredict/out.cds
-#	../hg/txCds/txCdsPredict/outMaf.cds
-#	../hg/txCds/txCdsPredict/outNmd.cds
-#	../hg/txGene/txGeneAccession/txLastId
-#	../hg/utils/bedRandom/5000.bed
-#	../hg/utils/bedRandom/5000masked.bed
-#	../hg/utils/bedRandom/5000maskedGc.tab
-#	../hg/utils/bedRandom/chrom.sizes
-#	../hg/utils/bedRandom/foo.bed
-#	../hg/utils/bedRandom/rmsk.bed
-#	../hg/utils/gffToBed/basic.bed
-#	../hg/utils/gffToBed/basic.gtf
-#	../hg/utils/gffToBed/cufflinks.bed
-#	../hg/utils/gffToBed/cufflinks.gff
-#	../hg/utils/gffToBed/foo.bed
-#	../hg/utils/gffToBed/foo.gp
-#	../hg/utils/gffToBed/go
-#	../hg/utils/gffToBed/test.bed
-#	../hg/utils/gffToBed/testGtf.bed
-#	../hg/utils/gffToBed/weird.bed
-#	../hg/utils/gffToBed/weird.gff
-#	../hg/utils/hubCheck/status
-#	../hg/utils/hubCheck/udc/
-#	../hg/utils/makeTrackIndex/foo2
-#	../hg/utils/mdbQuery/log
-#	../hg/utils/mdbQuery/status
-#	../hgFiles
-#	../includesUcsc
-#	../index/status
-#	../index/trixSearch/foo.ix
-#	../index/trixSearch/foo.ixx
-#	../isPcr/webPcr/webPcr
-#	../kehayden/alphaChain/.noChildLeftBehind.after.swp
-#	../kehayden/alphaChain/backupModel.after
-#	../kehayden/alphaChain/backupModel.chain
-#	../kehayden/alphaChain/backupModel.out
-#	../kehayden/alphaChain/chr3.after
-#	../kehayden/alphaChain/chr3.before
-#	../kehayden/alphaChain/chr3.out
-#	../kehayden/alphaChain/chrY.out
-#	../kehayden/alphaChain/doChr3
-#	../kehayden/alphaChain/doIt2
-#	../kehayden/alphaChain/doIt5
-#	../kehayden/alphaChain/foo.before
-#	../kehayden/alphaChain/foo.chain
-#	../kehayden/alphaChain/horID_21.D3Z1_alphaChain.txt
-#	../kehayden/alphaChain/horID_21.D3Z1_alphaChain_monOrder_count.txt
-#	../kehayden/alphaChain/monNum.txt
-#	../kehayden/alphaChain/monomerCount
-#	../kehayden/alphaChain/noChange
-#	../kehayden/alphaChain/noChildLeftBehind.after
-#	../kehayden/alphaChain/noChildLeftBehind.out
-#	../kehayden/alphaChain/old/
-#	../kehayden/alphaChain/sample.chain
-#	../kehayden/alphaChain/sample.out
-#	../kehayden/alphaChain/status
-#	../kehayden/alphaChain/test.after
-#	../kehayden/alphaChain/test.before
-#	../kehayden/alphaChain/test.txt
-#	../kehayden/alphaChain/test5
-#	../kehayden/alphaChain/test5.afterChain
-#	../kehayden/alphaChain/test5.chain
-#	../kehayden/alphaChain/test5.out
-#	../kehayden/alphaChain/test5.out2
-#	../kehayden/alphaChain/test5.out3
-#	../kehayden/alphaChain/test5.txt
-#	../kehayden/alphaChain/test6
-#	../kehayden/alphaChain/test6.afterChain
-#	../kehayden/alphaChain/test6.chain
-#	../kehayden/alphaChain/test6.out
-#	../kehayden/alphaChain/test6.txt
-#	../kehayden/alphaChain/testSize5.after
-#	../kehayden/alphaChain/testSize5.chain
-#	../kehayden/alphaChain/testSize5.out
-#	../kehayden/alphaChain/threeMers.chain
-#	../kehayden/alphaChain/threeMers.out
-#	../kehayden/alphaChain/threeMers.txt
-#	../kehayden/alphaChain/ugly.chain
-#	../kehayden/calcMonomersInCenReads/
-#	../kehayden/faToCenRead/
-#	../kehayden/linearSat/130130_alphaChain/
-#	../kehayden/linearSat/3Reads.txt
-#	../kehayden/linearSat/3TypeOrder.txt
-#	../kehayden/linearSat/after.chain
-#	../kehayden/linearSat/alphaAsm.weird
-#	../kehayden/linearSat/alphaAsmLoop_121218.pl
-#	../kehayden/linearSat/alphaAsmLoop_130130.pl
-#	../kehayden/linearSat/alphaChain/
-#	../kehayden/linearSat/backupModel.after
-#	../kehayden/linearSat/backupModel.chain
-#	../kehayden/linearSat/backupModel.out
-#	../kehayden/linearSat/before.chain
-#	../kehayden/linearSat/blame
-#	../kehayden/linearSat/cenX/
-#	../kehayden/linearSat/cenY/
-#	../kehayden/linearSat/chrX/
-#	../kehayden/linearSat/chrXwithU/
-#	../kehayden/linearSat/diffIt
-#	../kehayden/linearSat/doIt
-#	../kehayden/linearSat/doIt.out
-#	../kehayden/linearSat/doItLong
-#	../kehayden/linearSat/doItSmallProblem
-#	../kehayden/linearSat/doTwo.txt
-#	../kehayden/linearSat/doX
-#	../kehayden/linearSat/doY
-#	../kehayden/linearSat/foo2
-#	../kehayden/linearSat/genome/
-#	../kehayden/linearSat/group11/
-#	../kehayden/linearSat/group12AsBases/
-#	../kehayden/linearSat/group56/
-#	../kehayden/linearSat/group66/
-#	../kehayden/linearSat/in.words
-#	../kehayden/linearSat/input.counts
-#	../kehayden/linearSat/inputX.counts
-#	../kehayden/linearSat/longReads
-#	../kehayden/linearSat/monNumFull.txt
-#	../kehayden/linearSat/monNumOk.txt
-#	../kehayden/linearSat/monNum_uCorrect_huRefChrCorrect.txt
-#	../kehayden/linearSat/monOrder/
-#	../kehayden/linearSat/notTooDeep.after
-#	../kehayden/linearSat/notTooDeep.chain
-#	../kehayden/linearSat/notTooDeep.out
-#	../kehayden/linearSat/out.words
-#	../kehayden/linearSat/out/
-#	../kehayden/linearSat/pairedOrphans.after
-#	../kehayden/linearSat/pairedOrphans.chain
-#	../kehayden/linearSat/pairedOrphans.out
-#	../kehayden/linearSat/problem.txt
-#	../kehayden/linearSat/pull
-#	../kehayden/linearSat/randomReads
-#	../kehayden/linearSat/recovered
-#	../kehayden/linearSat/sample.chain
-#	../kehayden/linearSat/sample.out
-#	../kehayden/linearSat/sample.txt
-#	../kehayden/linearSat/status
-#	../kehayden/linearSat/test.after
-#	../kehayden/linearSat/test.before
-#	../kehayden/linearSat/test.chain
-#	../kehayden/linearSat/test.monomers
-#	../kehayden/linearSat/test.out
-#	../kehayden/linearSat/test.txt
-#	../kehayden/linearSat/test3.after
-#	../kehayden/linearSat/test3.before
-#	../kehayden/linearSat/test3.out
-#	../kehayden/linearSat/testLong.after
-#	../kehayden/linearSat/testLong.chain
-#	../kehayden/linearSat/testLong.out
-#	../kehayden/linearSat/testY.after
-#	../kehayden/linearSat/testY.before
-#	../kehayden/linearSat/testY.out
-#	../kehayden/linearSat/unsubbed.missing
-#	../kehayden/linearSat/unsubbed.out
-#	../kehayden/linearSat/verbose.out
-#	../kehayden/linearSat/words.in
-#	../kehayden/linearSat/words.missing
-#	../kehayden/linearSat/words.out
-#	../kehayden/linearSat/yMonomers
-#	../kehayden/lookupCenSequence/
-#	../kehayden/removeCenUs/
-#	../kehayden/status
-#	TAGS
-#	c
-#	coo
-#	diff
-#	diffs
-#	fo
-#	foo2
-#	status
-#	x86_64/stXXXX0Bjo48
-#	../log
-#	../merge
-#	../meta/metaHoist/flat.out
-#	../meta/metaHoist/go
-#	../meta/metaHoist/test.out
-#	../meta/metaReformat/status
-#	../oneShot/bigWigCluster/
-#	../oneShot/fakeManifestFromFiles/
-#	../oneShot/fastqEveryN/
-#	../oneShot/hacTreeTest/.out.costlyMerges.swp
-#	../oneShot/hacTreeTest/out.costlyMerges
-#	../oneShot/hacTreeTest/out.fromItems
-#	../oneShot/hacTreeTest/out.multiThread
-#	../oneShot/hacTreeTest/out.multiThreads
-#	../oneShot/hacTreeTest/pull
-#	../oneShot/hacTreeTest/stauts
-#	../oneShot/orderMiddle/invert.out
-#	../oneShot/orderMiddle/test.out
-#	../oneShot/rgbaGfxTest/9
-#	../oneShot/sampleNewProg/
-#	../oneShot/status
-#	../oneShot/testCorrelation/
-#	../oneShot/testGitRename/blame
-#	../oneShot/testGitRename/status
-#	../oneShot/testGitRename/test.out
-#	../oneShot/testGitRename/testGitRename.blame
-#	../oneShot/testGitRename/upperFile.blame
-#	../oneShot/testNothing/
-#	../oneShot/testXmlIssues/
-#	../oneShot/wjkCallsToGraph/
-#	../oneShot/wordsBySize/testWords.txt
-#	../parasol/lib/paraMessage_soon.c
-#	../parasol/paa/
-#	../parasol/paraHub/makk
-#	../parasol/parasol/para.results
-#	../parasol/parasol/parasol.conflict
-#	../parasol/parasol/results
-#	../pull
-#	../sourceFiles
-#	../status
-#	../tdb
-#	../tee
-#	../toCopyright.lst
-#	../utils/bedCommonRegions/status
-#	../utils/bedCommonRegions/tests/inOver/
-#	../utils/bedGeneParts/foo2
-#	../utils/bedGeneParts/ugly.out
-#	../utils/bedGraphToBigWig/10.bedGraph
-#	../utils/bedGraphToBigWig/10.bw
-#	../utils/bedGraphToBigWig/bad1.bedGraph
-#	../utils/bedGraphToBigWig/bad1.bw
-#	../utils/bedGraphToBigWig/bad3.bedGraph
-#	../utils/bedGraphToBigWig/bad3.bw
-#	../utils/bedGraphToBigWig/bad4.bedGraph
-#	../utils/bedGraphToBigWig/bad4.bw
-#	../utils/bedGraphToBigWig/foo.bedGraph
-#	../utils/bedGraphToBigWig/foo.bw
-#	../utils/bedGraphToBigWig/nozoom.bedGraph
-#	../utils/bedGraphToBigWig/nozoom.bw
-#	../utils/bedGraphToBigWig/test.bw
-#	../utils/bedIntersectReplicates/
-#	../utils/bedRemoveOverlap/status
-#	../utils/bedToBigBed/bigGenes.bb
-#	../utils/bedToBigBed/bigGenes.bed
-#	../utils/bedToBigBed/err
-#	../utils/bedToBigBed/foo.bb
-#	../utils/bedToBigBed/foo2
-#	../utils/bedToBigBed/itemRgb.bb
-#	../utils/bedToBigBed/itemRgb.bbFoo
-#	../utils/bedToBigBed/itemRgb.bbNo
-#	../utils/bedToBigBed/longFoo
-#	../utils/bedToBigBed/smallGenes.bb
-#	../utils/bedToBigBed/smallGenes.bbNoName
-#	../utils/bedToBigBed/smallGenes.bed
-#	../utils/bedToBigBed/status
-#	../utils/bedToBigBed/ucscGenes.bb
-#	../utils/bedToBigBed/ucscGenes.bed
-#	../utils/bedToClosestPoint/enhK562.bed
-#	../utils/bedToClosestPoint/makefile
-#	../utils/bedToClosestPoint/promo.bed
-#	../utils/bedToClosestPoint/refSeq.bed
-#	../utils/bedToClosestPoint/testOne.bed
-#	../utils/bigBedNamedItems/test.bb
-#	../utils/bigBedNamedItems/test.bed
-#	../utils/bigBedNamedItems/test.some
-#	../utils/bigWigAverageOverBed/bad.bed
-#	../utils/bigWigAverageOverBed/bad.out
-#	../utils/bigWigAverageOverBed/big.bed
-#	../utils/bigWigAverageOverBed/big.out
-#	../utils/bigWigAverageOverBed/bigBlock.out
-#	../utils/bigWigAverageOverBed/bigChrom.out
-#	../utils/bigWigAverageOverBed/block.out
-#	../utils/bigWigAverageOverBed/chr22.bed
-#	../utils/bigWigAverageOverBed/chrom.out
-#	../utils/bigWigAverageOverBed/dupe.bed
-#	../utils/bigWigAverageOverBed/foo1
-#	../utils/bigWigAverageOverBed/foo2
-#	../utils/bigWigAverageOverBed/out.bed
-#	../utils/bigWigAverageOverBed/out.ra
-#	../utils/bigWigAverageOverBed/out.tab
-#	../utils/bigWigAverageOverBed/phylop.bw
-#	../utils/bigWigAverageOverBed/phylop_1.ave
-#	../utils/bigWigAverageOverBed/phylop_2.ave
-#	../utils/bigWigAverageOverBed/phylop_3.ave
-#	../utils/bigWigAverageOverBed/phylop_4.ave
-#	../utils/bigWigAverageOverBed/rna1.bw
-#	../utils/bigWigAverageOverBed/rna1_1.ave
-#	../utils/bigWigAverageOverBed/rna1_2.ave
-#	../utils/bigWigAverageOverBed/rna1_3.ave
-#	../utils/bigWigAverageOverBed/rna1_4.ave
-#	../utils/bigWigAverageOverBed/rna1_5.ave
-#	../utils/bigWigAverageOverBed/rna1_6.ave
-#	../utils/bigWigAverageOverBed/test.bed
-#	../utils/bigWigAverageOverBed/test.out
-#	../utils/bigWigAverageOverBed/timeNotes
-#	../utils/bigWigAverageOverBed/ucscGenes.out
-#	../utils/bigWigMerge/18m.bw
-#	../utils/bigWigMerge/18p.bw
-#	../utils/bigWigMerge/19m.bw
-#	../utils/bigWigMerge/19p.bw
-#	../utils/bigWigMerge/in.lst
-#	../utils/bigWigMerge/merged.bedGraph
-#	../utils/bigWigMerge/out.bigWig
-#	../utils/colTransform/test.in
-#	../utils/colTransform/test.out
-#	../utils/compareIds/
-#	../utils/distributeRgbRainbow/test.out
-#	../utils/faUniqify/makk
-#	../utils/fastqMaskSpectrum/
-#	../utils/fastqStatsAndSubsample/1000.fastq
-#	../utils/fastqStatsAndSubsample/10000.fastq
-#	../utils/fastqStatsAndSubsample/100000.fastq
-#	../utils/fastqStatsAndSubsample/ENCFF000ABP.sample
-#	../utils/fastqStatsAndSubsample/ENCFF000ABP.stats
-#	../utils/fastqStatsAndSubsample/ENCFF001DVB.fastq
-#	../utils/fastqStatsAndSubsample/ENCFF001DVB.fastq.gz
-#	../utils/fastqStatsAndSubsample/ENCFF001DVB.sample
-#	../utils/fastqStatsAndSubsample/ENCFF001DVB.stats
-#	../utils/fastqStatsAndSubsample/fastqStatsAndSubsample.works
-#	../utils/fastqStatsAndSubsample/fastqSubsample1RcFb1
-#	../utils/fastqStatsAndSubsample/fastqSubsampleKyfZP4
-#	../utils/fastqStatsAndSubsample/fastqSubsampleOsgUFw
-#	../utils/fastqStatsAndSubsample/foo.stats
-#	../utils/fastqStatsAndSubsample/fooDir/
-#	../utils/fastqStatsAndSubsample/makk
-#	../utils/fastqStatsAndSubsample/new.fastq
-#	../utils/fastqStatsAndSubsample/new.stats
-#	../utils/fastqStatsAndSubsample/out.fastq
-#	../utils/fastqStatsAndSubsample/out.stats
-#	../utils/linesInAllFiles/in1.txt
-#	../utils/linesInAllFiles/in2.txt
-#	../utils/linesInAllFiles/in3.txt
-#	../utils/lovd/
-#	../utils/paraFetch/notes
-#	../utils/raToStructGen/edwBamFile.as
-#	../utils/raToStructGen/foo.fastq
-#	../utils/raToStructGen/foo.stats
-#	../utils/raToStructGen/testOut/test.out
-#	../utils/raToStructGen/testOut/testStruct.c
-#	../utils/raToStructGen/testOut/testStruct.h
-#	../utils/raToStructGen/testOut/testStruct.sql
-#	../utils/replaceTextBetween/testOut
-#	../utils/replaceTextBetween/testOutWithEnds
-#	../utils/reverseLineOrder/makefile
-#	../utils/rowsToCols/gnfHumanAtlas2MedianVal.tab
-#	../utils/rowsToCols/gnfHumanAtlas2MedianValTransposed.tab
-#	../utils/rowsToCols/gnfInverse.tab
-#	../utils/status
-#	../utils/textBetween/pull
-#	../utils/textBetween/status
-#	../utils/verticalSplitSqlTable/doIt
-#	../utils/verticalSplitSqlTable/status
-#	../utils/wigToBigWig/dupTest1.wig
-#	../utils/wigToBigWig/dupTest2.wig
-#	../utils/wigToBigWig/dupTest3.wig
-#	../utils/wigToBigWig/foo.bigWig
-#	../utils/wigToBigWig/quickCheckWig.pl
-#	../webBlat/webBlat
-#	../../status
-#	../../tags.log
-#	../../test.log
-#	../../throughputNotest.txt
-no changes added to commit (use "git add" and/or "git commit -a")
diff --git a/gbtools/src/blatSrc/lib/subText.c b/gbtools/src/blatSrc/lib/subText.c
deleted file mode 100644
index c5bf83e..0000000
--- a/gbtools/src/blatSrc/lib/subText.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* subText - Stuff to do text substitutions. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "subText.h"
-
-
-struct subText *subTextNew(char *in, char *out)
-/* Make new substitution structure. */
-{
-struct subText *sub;
-AllocVar(sub);
-sub->in = cloneString(in);
-sub->out = cloneString(out);
-sub->inSize = strlen(in);
-sub->outSize = strlen(out);
-return sub;
-}
-
-void subTextFree(struct subText **pSub)
-/* Free a subText. */
-{
-struct subText *sub = *pSub;
-if (sub != NULL)
-    {
-    freeMem(sub->in);
-    freeMem(sub->out);
-    freez(pSub);
-    }
-}
-
-void subTextFreeList(struct subText **pList)
-/* Free a list of dynamically allocated subText's */
-{
-struct subText *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    subTextFree(&el);
-    }
-*pList = NULL;
-}
-
-#if 0 /* unused */
-static boolean firstSame(char *s, char *t, int len)
-/* Return TRUE if  the  first len characters of the strings s and t
- * are the same. */
-{
-while (--len >= 0)
-    {
-    if (*s++ != *t++)
-	return FALSE;
-    }
-return TRUE;
-}
-#endif
-
-static struct subText *firstInList(struct subText *l, char *name)
-/* Return first element in Sub list who's in string matches the
- * first part of name. */
-{
-struct subText *text = l;
-char *start;
-char *end;
-char *cmp;
-
-for(; text; text = text->next)
-    {
-    start = text->in;
-    end = &start[text->inSize];
-    cmp = name;
-    for(;(start < end) && (*start == *cmp); start++, cmp++)
-	;
-    if (start == end)
-    	return text;
-    }
-return NULL;
-}
-
-
-int subTextSizeAfter(struct subText *subList, char *in)
-/* Return size string will be after substitutions. */
-{
-struct subText *sub;
-char *s;
-int size = 0;
-
-s = in;
-while (*s)
-    {
-    if ((sub = firstInList(subList, s)) != NULL)
-	{
-	s += sub->inSize;
-	size += sub->outSize;
-	}
-    else
-	{
-	size += 1;
-	s += 1;
-	}
-    }
-return size;
-}
-
-
-static void doSub(char *in, char *buf, struct subText *subList)
-/* Do substitutions in list while copying from in to buf.  This
- * cheap little routine doesn't check that out is big enough.... */
-{
-struct subText *sub;
-char *s, *d;
-
-s = in;
-d = buf;
-while (*s)
-    {
-    if ((sub = firstInList(subList, s)) != NULL)
-	{
-	s += sub->inSize;
-	memcpy(d, sub->out, sub->outSize);
-	d += strlen(sub->out);
-	}
-    else
-	{
-	*d++ = *s++;
-	}
-    }
-*d++ = 0;
-}
-
-void subTextStatic(struct subText *subList, char *in, char *out, int outMaxSize)
-/* Do substition to output buffer of given size.  Complain
- * and die if not big enough. */
-{
-int newSize = subTextSizeAfter(subList, in);
-if (newSize >= outMaxSize)
-    errAbort("%s would expand to more than %d bytes", in, outMaxSize);
-doSub(in, out, subList);
-}
-
-char *subTextString(struct subText *subList, char *in)
-/* Return string with substitutions in list performed.  freeMem
- * this string when done. */
-{
-int size = subTextSizeAfter(subList, in);
-char *out = needMem(size+1);
-doSub(in, out, subList);
-return out;
-}
-
diff --git a/gbtools/src/blatSrc/lib/sufa.c b/gbtools/src/blatSrc/lib/sufa.c
deleted file mode 100644
index 81e0c01..0000000
--- a/gbtools/src/blatSrc/lib/sufa.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* sufa - suffix array for genome.  Use sufaMake utility to create one of these, and
- * the routines here to access it. */
-/* This file is copyright 2008 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include <sys/mman.h>
-#include "sufa.h"
-
-static void *pointerOffset(void *pt, bits64 offset)
-/* A little wrapper around pointer arithmetic in terms of bytes. */
-{
-char *s = pt;
-return s + offset;
-}
-
-struct sufa *sufaRead(char *fileName, boolean memoryMap)
-/* Read in a sufa from a file.  Does this via memory mapping if you like,
- * which will be faster typically for about 100 reads, and slower for more
- * than that (_much_ slower for thousands of reads and more). */
-{
-/* Open file (low level), read in header, and check it. */
-int fd = open(fileName, O_RDONLY);
-if (fd < 0)
-    errnoAbort("Can't open %s", fileName);
-struct sufaFileHeader h;
-if (read(fd, &h, sizeof(h)) < sizeof(h))
-    errnoAbort("Couldn't read header of file %s", fileName);
-if (h.magic != SUFA_MAGIC)
-    errAbort("%s does not seem to be a sufa file.", fileName);
-if (h.majorVersion > SUFA_MAJOR_VERSION)
-    errAbort("%s is a newer, incompatible version of sufa format. "
-             "This program works on version %d and below. "
-	     "%s is version %d.",  fileName, SUFA_MAJOR_VERSION, fileName, h.majorVersion);
-
-struct sufa *sufa;
-verbose(2, "sufa file %s size %lld\n", fileName, h.size);
-
-/* Get a pointer to data in memory, via memory map, or allocation and read. */
-struct sufaFileHeader *header ;
-if (memoryMap)
-    {
-#ifdef MACHTYPE_sparc
-    header = (struct sufaFileHeader *)mmap(NULL, h.size, PROT_READ, MAP_SHARED, fd, 0);
-#else
-    header = mmap(NULL, h.size, PROT_READ, MAP_FILE|MAP_SHARED, fd, 0);
-#endif
-    if (header == (void*)(-1))
-	errnoAbort("Couldn't mmap %s, sorry", fileName);
-    }
-else
-    {
-    header = needHugeMem(h.size);
-    if (lseek(fd, 0, SEEK_SET) < 0)
-	errnoAbort("Couldn't seek back to start of sufa file %s.  "
-		   "Splix files must be random access files, not pipes and the like"
-		   , fileName);
-    if (read(fd, header, h.size) < h.size)
-        errnoAbort("Couldn't read all of sufa file %s.", fileName);
-    }
-
-/* Allocate wrapper structure and fill it in. */
-AllocVar(sufa);
-sufa->header = header;
-sufa->isMapped = memoryMap;
-
-/* Make an array for easy access to chromosome names. */
-int chromCount = header->chromCount;
-char **chromNames = AllocArray(sufa->chromNames, chromCount);
-char *s = pointerOffset(header, sizeof(*header) );
-int i;
-for (i=0; i<chromCount; ++i)
-    {
-    chromNames[i] = s;
-    s += strlen(s)+1;
-    }
-
-/* Keep track of where we are in memmap. */
-bits64 mapOffset = sizeof(*header) + header->chromNamesSize;
-
-/* Point into chromSizes array. */
-bits32 *chromSizes = sufa->chromSizes 
-	= pointerOffset(header, mapOffset);
-mapOffset += sizeof(bits32) * chromCount;
-
-verbose(2, "total dna size %lld in %d chromosomes\n", (long long)header->dnaDiskSize, header->chromCount);
-sufa->allDna = pointerOffset(header, mapOffset);
-mapOffset += header->dnaDiskSize;
-
-/* Calculate chromOffset array. */
-bits32 offset = 0;
-bits32 *chromOffsets = AllocArray(sufa->chromOffsets, chromCount);
-for (i=0; i<chromCount; ++i)
-    {
-    chromOffsets[i] = offset;
-    offset += chromSizes[i] + 1;
-    verbose(2, "sufa contains %s,  %d bases, %d offset\n", 
-    	sufa->chromNames[i], (int)sufa->chromSizes[i], (int)chromOffsets[i]);
-    }
-
-/* Finally point to the suffix array!. */
-sufa->array = pointerOffset(header, mapOffset);
-mapOffset += header->arraySize * sizeof(bits32);
-
-
-assert(mapOffset == header->size);	/* Sanity check */
-return sufa;
-}
-
-void sufaFree(struct sufa **pSufa)
-/* Free up resources associated with index. */
-{
-struct sufa *sufa = *pSufa;
-if (sufa != NULL)
-    {
-    freeMem(sufa->chromNames);
-    freeMem(sufa->chromOffsets);
-    if (sufa->isMapped)
-	munmap((void *)sufa->header, sufa->header->size);
-    else
-	freeMem(sufa->header);
-    freez(pSufa);
-    }
-}
-
-int sufaOffsetToChromIx(struct sufa *sufa, bits32 tOffset)
-/* Figure out index of chromosome containing tOffset */
-{
-int i;
-int chromCount = sufa->header->chromCount;
-/* TODO - convert to binary search - will need to sort chromosome list though.... */
-for (i=0; i<chromCount; ++i)
-    {
-    int chromStart = sufa->chromOffsets[i];
-    int chromEnd = chromStart + sufa->chromSizes[i];
-    if (tOffset >= chromStart && tOffset < chromEnd)
-        return i;
-    }
-errAbort("tOffset %d out of range\n", tOffset);
-return -1;
-}
-
diff --git a/gbtools/src/blatSrc/lib/sufx.c b/gbtools/src/blatSrc/lib/sufx.c
deleted file mode 100644
index b706c2b..0000000
--- a/gbtools/src/blatSrc/lib/sufx.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* sufx - suffix array for genome.  Use sufxMake utility to create one of these, and
- * the routines here to access it. */
-/* This file is copyright 2008 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include <sys/mman.h>
-#include "sufx.h"
-#include "net.h"
-
-static void *pointerOffset(void *pt, bits64 offset)
-/* A little wrapper around pointer arithmetic in terms of bytes. */
-{
-char *s = pt;
-return s + offset;
-}
-
-struct sufx *sufxRead(char *fileName, boolean memoryMap)
-/* Read in a sufx from a file.  Does this via memory mapping if you like,
- * which will be faster typically for about 100 reads, and slower for more
- * than that (_much_ slower for thousands of reads and more). */
-{
-/* Open file (low level), read in header, and check it. */
-int fd = open(fileName, O_RDONLY);
-if (fd < 0)
-    errnoAbort("Can't open %s", fileName);
-struct sufxFileHeader h;
-if (read(fd, &h, sizeof(h)) < sizeof(h))
-    errnoAbort("Couldn't read header of file %s", fileName);
-if (h.magic != SUFX_MAGIC)
-    errAbort("%s does not seem to be a sufx file.", fileName);
-if (h.majorVersion > SUFX_MAJOR_VERSION)
-    errAbort("%s is a newer, incompatible version of sufx format. "
-             "This program works on version %d and below. "
-	     "%s is version %d.",  fileName, SUFX_MAJOR_VERSION, fileName, h.majorVersion);
-
-struct sufx *sufx;
-verbose(2, "sufx file %s size %lld\n", fileName, h.size);
-
-/* Get a pointer to data in memory, via memory map, or allocation and read. */
-struct sufxFileHeader *header ;
-if (memoryMap)
-    {
-#ifdef MACHTYPE_sparc
-    header = (struct sufxFileHeader *)mmap(NULL, h.size, PROT_READ, MAP_SHARED, fd, 0);
-#else
-    header = mmap(NULL, h.size, PROT_READ, MAP_FILE|MAP_SHARED, fd, 0);
-#endif
-    if (header == (void*)(-1))
-	errnoAbort("Couldn't mmap %s, sorry", fileName);
-    }
-else
-    {
-    header = needHugeMem(h.size);
-    if (lseek(fd, 0, SEEK_SET) < 0)
-	errnoAbort("Couldn't seek back to start of sufx file %s.  "
-		   "Splix files must be random access files, not pipes and the like"
-		   , fileName);
-    if (netReadAll(fd, header, h.size) < h.size)
-        errnoAbort("Couldn't read all of sufx file %s.", fileName);
-    }
-
-/* Allocate wrapper structure and fill it in. */
-AllocVar(sufx);
-sufx->header = header;
-sufx->isMapped = memoryMap;
-
-/* Make an array for easy access to chromosome names. */
-int chromCount = header->chromCount;
-char **chromNames = AllocArray(sufx->chromNames, chromCount);
-char *s = pointerOffset(header, sizeof(*header) );
-int i;
-for (i=0; i<chromCount; ++i)
-    {
-    chromNames[i] = s;
-    s += strlen(s)+1;
-    }
-
-/* Keep track of where we are in memmap. */
-bits64 mapOffset = sizeof(*header) + header->chromNamesSize;
-
-/* Point into chromSizes array. */
-bits32 *chromSizes = sufx->chromSizes 
-	= pointerOffset(header, mapOffset);
-mapOffset += sizeof(bits32) * chromCount;
-
-verbose(2, "total dna size %lld in %d chromosomes\n", (long long)header->dnaDiskSize, header->chromCount);
-sufx->allDna = pointerOffset(header, mapOffset);
-mapOffset += header->dnaDiskSize;
-
-/* Calculate chromOffset array. */
-bits32 offset = 0;
-bits32 *chromOffsets = AllocArray(sufx->chromOffsets, chromCount);
-for (i=0; i<chromCount; ++i)
-    {
-    chromOffsets[i] = offset;
-    offset += chromSizes[i] + 1;
-    verbose(2, "sufx contains %s,  %d bases, %d offset\n", 
-    	sufx->chromNames[i], (int)sufx->chromSizes[i], (int)chromOffsets[i]);
-    }
-
-/* Point to the suffix array. */
-sufx->array = pointerOffset(header, mapOffset);
-mapOffset += header->arraySize * sizeof(bits32);
-
-/* Finally point to the traverse array!. */
-sufx->traverse = pointerOffset(header, mapOffset);
-mapOffset += header->arraySize * sizeof(bits32);
-
-assert(mapOffset == header->size);	/* Sanity check */
-return sufx;
-}
-
-void sufxFree(struct sufx **pSufx)
-/* Free up resources associated with index. */
-{
-struct sufx *sufx = *pSufx;
-if (sufx != NULL)
-    {
-    freeMem(sufx->chromNames);
-    freeMem(sufx->chromOffsets);
-    if (sufx->isMapped)
-	munmap((void *)sufx->header, sufx->header->size);
-    else
-	freeMem(sufx->header);
-    freez(pSufx);
-    }
-}
-
-int sufxOffsetToChromIx(struct sufx *sufx, bits32 tOffset)
-/* Figure out index of chromosome containing tOffset */
-{
-int i;
-int chromCount = sufx->header->chromCount;
-/* TODO - convert to binary search - will need to sort chromosome list though.... */
-for (i=0; i<chromCount; ++i)
-    {
-    int chromStart = sufx->chromOffsets[i];
-    int chromEnd = chromStart + sufx->chromSizes[i];
-    if (tOffset >= chromStart && tOffset < chromEnd)
-        return i;
-    }
-errAbort("tOffset %d out of range\n", tOffset);
-return -1;
-}
-
diff --git a/gbtools/src/blatSrc/lib/synQueue.c b/gbtools/src/blatSrc/lib/synQueue.c
deleted file mode 100644
index 34dd626..0000000
--- a/gbtools/src/blatSrc/lib/synQueue.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* synQueue - a sychronized message queue for messages between
- * threads. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "dlist.h"
-#include "pthreadWrap.h"
-#include "synQueue.h"
-
-
-struct synQueue
-/* A synchronized queue for messages between threads. */
-    {
-    struct synQueue *next;	/* Next in list of queues. */
-    struct dlList *queue;	/* The queue itself. */
-    pthread_mutex_t mutex;	/* Mutex to prevent simultanious access. */
-    pthread_cond_t cond;	/* Conditional to allow waiting until non-empty. */
-    };
-
-struct synQueue *synQueueNew()
-/* Make a new, empty, synQueue. */
-{
-struct synQueue *sq;
-AllocVar(sq);
-pthreadMutexInit(&sq->mutex);
-pthreadCondInit(&sq->cond);
-sq->queue = dlListNew();
-return sq;
-}
-
-void synQueueFree(struct synQueue **pSq)
-/* Free up synQueue.  Be sure no other threads are using
- * it first though! This will not free any dynamic memory
- * in the messages.  Use synQueueFreeAndVals for that. */
-{
-struct synQueue *sq = *pSq;
-if (sq == NULL)
-    return;
-dlListFree(&sq->queue);
-pthreadCondDestroy(&sq->cond);
-pthreadMutexDestroy(&sq->mutex);
-freez(pSq);
-}
-
-void synQueueFreeAndVals(struct synQueue **pSq)
-/* Free up synQueue.  Be sure no other threads are using
- * it first though! This will freeMem all the messages */
-{
-struct synQueue *sq = *pSq;
-if (sq == NULL)
-    return;
-dlListFreeAndVals(&sq->queue);
-pthreadCondDestroy(&sq->cond);
-pthreadMutexDestroy(&sq->mutex);
-freez(pSq);
-}
-
-void synQueuePutUnprotected(struct synQueue *sq, void *message)
-/* Add message to end of queue without protecting against multithreading
- * contention - used before pthreads are launched perhaps. */
-{
-dlAddValTail(sq->queue, message);
-}
-
-void synQueuePut(struct synQueue *sq, void *message)
-/* Add message to end of queue. */
-{
-pthreadMutexLock(&sq->mutex);
-dlAddValTail(sq->queue, message);
-pthreadCondSignal(&sq->cond);
-pthreadMutexUnlock(&sq->mutex);
-}
-
-void *synQueueGet(struct synQueue *sq)
-/* Get message off start of queue.  Wait until there is
- * a message if queue is empty. */
-{
-void *message;
-struct dlNode *node;
-pthreadMutexLock(&sq->mutex);
-while (dlEmpty(sq->queue))
-    pthreadCondWait(&sq->cond, &sq->mutex);
-node = dlPopHead(sq->queue);
-pthreadMutexUnlock(&sq->mutex);
-message = node->val;
-freeMem(node);
-return message;
-}
-
-void *synQueueGrab(struct synQueue *sq)
-/* Get message off start of queue.  Return NULL immediately 
- * if queue is empty. */
-{
-void *message = NULL;
-struct dlNode *node;
-pthreadMutexLock(&sq->mutex);
-node = dlPopHead(sq->queue);
-pthreadMutexUnlock(&sq->mutex);
-if (node != NULL)
-    {
-    message = node->val;
-    freeMem(node);
-    }
-return message;
-}
-
-int synQueueSize(struct synQueue *sq)
-/* Return number of messages currently on queue. */
-{
-int size;
-pthreadMutexLock(&sq->mutex);
-size = dlCount(sq->queue);
-pthreadMutexUnlock(&sq->mutex);
-return size;
-}
diff --git a/gbtools/src/blatSrc/lib/tabRow.c b/gbtools/src/blatSrc/lib/tabRow.c
deleted file mode 100644
index 5f9fbce..0000000
--- a/gbtools/src/blatSrc/lib/tabRow.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/* tabRow - a row from a database or a tab-separated file held in
- * memory.   Just a light wrapper around an array of strings. 
- * Also some routines to convert slLines to tabRows. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "tabRow.h"
-
-
-struct tabRow *tabRowNew(int colCount)
-/* Return new row. */
-{
-struct tabRow *row = needMem(sizeof(*row) + colCount*sizeof(char*));
-row->colCount = colCount;
-return row;
-}
-
-int tabRowMaxColCount(struct tabRow *rowList)
-/* Return largest column count */
-{
-int maxCount = 0;
-struct tabRow *row;
-for (row = rowList; row != NULL; row = row->next)
-    if (row->colCount > maxCount)
-        maxCount = row->colCount;
-return maxCount;
-}
-
-struct tabRow *tabRowByWhite(struct slName *lineList, char *fileName,
-	boolean varCol)
-/* Convert lines to rows based on spaces.  If varCol is TRUE then not
- * all rows need to have same number of columns. */
-{
-struct slName *line;
-struct tabRow *rowList = NULL, *row;
-
-if (varCol)
-    {
-    for (line = lineList; line != NULL; line = line->next)
-        {
-	char *s = line->name;
-	int rowSize = chopByWhite(s, NULL, 0);
-	row = tabRowNew(rowSize);
-	chopByWhite(s, row->columns, rowSize);
-	slAddHead(&rowList, row);
-	}
-    }
-else
-    {
-    if (lineList)
-        {
-	int rowSize = chopByWhite(lineList->name, NULL, 0);
-	int extraSize = rowSize+1;
-	int ix = 1;
-	for (line = lineList; line != NULL; line = line->next, ++ix)
-	    {
-	    int oneSize;
-	    row = tabRowNew(rowSize);
-	    oneSize = chopByWhite(line->name, row->columns, extraSize);
-	    if (oneSize != rowSize)
-	        {
-		if (oneSize > rowSize)
-		    errAbort("Got more than the expected %d columns line %d of %s",
-			    rowSize, ix, fileName);
-		else
-		    errAbort("Expecting %d columns got %d, line %d of %s",
-		    	rowSize, oneSize, ix, fileName);
-
-		}
-	    slAddHead(&rowList, row);
-	    }
-	}
-    }
-slReverse(&rowList);
-return rowList;
-}
-
-struct tabRow *tabRowByChar(struct slName *lineList, char c, char *fileName,
-	boolean varCol)
-/* Convert lines to rows based on character separation.  If varCol is TRUE then not
- * all rows need to have same number of columns. */
-{
-struct slName *line;
-struct tabRow *rowList = NULL, *row;
-
-if (varCol)
-    {
-    for (line = lineList; line != NULL; line = line->next)
-        {
-	char *s = line->name;
-	int rowSize = countChars(s, c) + 1;
-	row = tabRowNew(rowSize);
-	chopByChar(s, c, row->columns, rowSize);
-	slAddHead(&rowList, row);
-	}
-    }
-else
-    {
-    if (lineList)
-        {
-	int rowSize = countChars(lineList->name, c) + 1;
-	int extraSize = rowSize+1;
-	int ix = 1;
-	for (line = lineList; line != NULL; line = line->next, ++ix)
-	    {
-	    int oneSize;
-	    row = tabRowNew(rowSize);
-	    oneSize = chopByChar(line->name, c, row->columns, extraSize);
-	    if (oneSize != rowSize)
-	        {
-		if (oneSize > rowSize)
-		    errAbort("Got more than the expected %d columns line %d of %s",
-			    rowSize, ix, fileName);
-		else
-		    errAbort("Expecting %d columns got %d, line %d of %s",
-		    	rowSize, oneSize, ix, fileName);
-
-		}
-	    slAddHead(&rowList, row);
-	    }
-	}
-    }
-return rowList;
-}
-
-struct slInt *tabRowGuessFixedOffsets(struct slName *lineList, char *fileName)
-/* Return our best guess list of starting positions for space-padded fixed
- * width fields. */
-{
-struct slInt *offList = NULL, *off;
-
-if (lineList)
-    {
-    char *spaceRec = cloneString(lineList->name), *s;
-    int lineSize = strlen(spaceRec);
-    struct slName *line;
-    int lineIx=1;
-
-    /* First 'or' together all lines into spaceRec, which will
-     * have a space wherever all columns of all lines are space and
-     * non-space elsewhere. */
-    for (line = lineList->next; line != NULL; line = line->next, ++lineIx)
-        {
-	int i;
-	s = line->name;
-	if (strlen(s) != lineSize)
-	   errAbort("Line %d of %s has %lu chars, but first line has just %d",
-	       lineIx, fileName, (unsigned long)strlen(s), lineSize);
-	for (i=0; i<lineSize; ++i)
-	    {
-	    if (s[i] != ' ')
-	        spaceRec[i] = 'X';
-	    }
-	}
-
-    /* Now make up slInt list that describes where words begin */
-    s = spaceRec;
-    for (;;)
-        {
-	s = skipLeadingSpaces(s);
-	if (s == NULL || s[0] == 0)
-	    break;
-	AllocVar(off);
-	off->val = s - spaceRec;
-	slAddHead(&offList, off);
-	s = skipToSpaces(s);
-	}
-    slReverse(&offList);
-    }
-return offList;
-}
-
-struct tabRow *tabRowByFixedOffsets(struct slName *lineList, struct slInt *offList,
-	char *fileName)
-/* Return rows parsed into fixed width fields whose starts are defined by
- * offList. */
-{
-struct slName *line;
-struct slInt *off;
-struct tabRow *rowList = NULL, *row;
-int rowSize = slCount(offList);
-
-if (lineList)
-    {
-    int lineSize = strlen(lineList->name);
-    int lineIx = 1;
-    for (off = offList; off != NULL; off = off->next)
-        {
-	if (off->val >= lineSize)
-	    errAbort("Offset %d is bigger than lineSize of %d", off->val, lineSize);
-	}
-    for (line = lineList; line != NULL; line = line->next, ++lineIx)
-	{
-	char *linePt = line->name;
-	int offIx = 0;
-	if (strlen(linePt) != lineSize)
-	   errAbort("Line %d of %s has %lu chars, but first line has just %d",
-	       lineIx, fileName, (unsigned long)strlen(linePt), lineSize);
-	row = tabRowNew(rowSize);
-	for (off = offList; off != NULL; off = off->next, ++offIx)
-	    {
-	    int start = off->val, end;
-	    if (off->next != NULL)
-		{
-	        end = off->next->val-1;
-		if (linePt[end] != ' ')
-		   errAbort("Line %d of %s expecting space column %d, got %c",
-			   lineIx, fileName, end, linePt[end]);
-		}
-	    else
-	        end = lineSize;
-	    linePt[end] = 0;
-	    row->columns[offIx] = trimSpaces(linePt + start);
-	    }
-	slAddHead(&rowList, row);
-	}
-    slReverse(&rowList);
-    }
-return rowList;
-}
-
-struct tabRow *tabRowByFixedGuess(struct slName *lineList, char *fileName)
-/* Return rows parsed into fixed-width fields. */
-{
-struct slInt *offList = tabRowGuessFixedOffsets(lineList, fileName);
-struct tabRow *rowList = tabRowByFixedOffsets(lineList, offList, fileName);
-slFreeList(&offList);
-return rowList;
-}
-
diff --git a/gbtools/src/blatSrc/lib/textOut.c b/gbtools/src/blatSrc/lib/textOut.c
deleted file mode 100644
index 9ab111e..0000000
--- a/gbtools/src/blatSrc/lib/textOut.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* textOut - set up stdout to be HTTP text, file or compressed file. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "errAbort.h"
-#include "cheapcgi.h"
-#include "pipeline.h"
-#include "textOut.h"
-
-
-static void textOutWarnHandler(char *format, va_list args)
-/* Text mode error message handler. */
-{
-char *hLine =
-"---------------------------------------------------------------------------\n";
-if (format != NULL) {
-    fflush(stdout);
-    fprintf(stdout, "%s", hLine);
-    vfprintf(stdout, format, args);
-    fprintf(stdout, "\n");
-    fprintf(stdout, "%s", hLine);
-    }
-}
-
-static void textOutAbortHandler()
-/* Text mode abort handler. */
-{
-exit(-1);
-}
-
-char *getCompressSuffix(char *compressType)
-/* Return the file dot-suffix (including the dot) for compressType. */
-{
-static char *gzipSuffix = ".gz";
-static char *compressSuffix = ".Z";
-static char *bz2Suffix = ".bz2";
-static char *zipSuffix = ".zip";
-if (sameWord(compressType, textOutCompressGzip))
-    return gzipSuffix;
-else if (sameWord(compressType, textOutCompressCompress))
-    return compressSuffix;
-else if (sameWord(compressType, textOutCompressBzip2))
-    return bz2Suffix;
-else if (sameWord(compressType, textOutCompressZip))
-    return zipSuffix;
-else
-    errAbort("getCompressSuffix: Unsupported textOutCompress type %s",
-	     compressType);
-return NULL;
-}
-
-static char **getCompressor(char *compressType)
-/* Return a compressor specification for pipelineOpen1(). */
-{
-static char *GZ_WRITE[] = {"gzip", "-qc", NULL};
-static char *Z_WRITE[] = {"compress", "-c", NULL};
-static char *BZ2_WRITE[] = {"bzip2", "-qzc", NULL};
-static char *ZIP_WRITE[] = {"zip", "-q", NULL};
-
-if (sameWord(compressType, textOutCompressGzip))
-    return GZ_WRITE;
-else if (sameWord(compressType, textOutCompressCompress))
-    return Z_WRITE;
-else if (sameWord(compressType, textOutCompressBzip2))
-    return BZ2_WRITE;
-else if (sameWord(compressType, textOutCompressZip))
-    return ZIP_WRITE;
-else
-    errAbort("getCompressor: Unsupported textOutCompress type %s",
-	     compressType);
-return NULL;
-}
-
-static void cleanEnvVars(char *compressType)
-/* Ensure vanilla behavior of compressors by removing environment variables 
- * that they read for option settings. */
-{
-if (sameWord(compressType, textOutCompressGzip))
-    {
-    unsetenv("GZIP");
-    unsetenv("GZIP_OPT");
-    }
-else if (sameWord(compressType, textOutCompressCompress))
-    {
-    /* No environment variables mentioned in man page. */
-    }
-else if (sameWord(compressType, textOutCompressBzip2))
-    {
-    unsetenv("BZIP");
-    unsetenv("BZIP2");
-    }
-else if (sameWord(compressType, textOutCompressZip))
-    {
-    unsetenv("ZIPOPT");
-    }
-else
-    {
-    errAbort("cleanEnvVars: Unsupported textOutCompress type %s",
-	     compressType);
-    }
-}
-
-
-struct pipeline *textOutInit(char *fileName, char *compressType, int *saveStdout)
-/* Set up stdout to be HTTP text, file (if fileName is specified), or 
- * compressed file (if both fileName and compressType are specified -- 
- * see textOut.h for supported compression types).  
- * Return NULL if no compression, otherwise a pipeline handle on which 
- * textOutClose should be called when we're done writing stdout. */
-{
-struct pipeline *compressPipeline = NULL;
-
-// if path contains a slash, we are outputting to a local file
-boolean outToFile = (strchr(fileName, '/') != NULL);
-if (outToFile)
-    {
-    FILE *f;
-    f = fopen(fileName, "w");
-    /* We want to capture stdout output to a file */
-    fflush(stdout);
-    int tempOut = dup(STDOUT_FILENO);
-    if (saveStdout)
-	*saveStdout = tempOut;
-    dup2(fileno(f),STDOUT_FILENO);   /* closes STDOUT before setting it again */
-    fclose(f);
-    }
-
-trimSpaces(fileName);
-if (isEmpty(fileName))
-    {
-    printf("Content-Type: text/plain\n\n");
-    }
-else if (isEmpty(compressType) || sameWord(compressType, textOutCompressNone))
-    {
-    if (!outToFile)
-	{
-	printf("Content-Type: application/octet-stream\n");
-	printf("Content-Disposition: attachment; filename=%s\n\n", fileName);
-	}
-    }
-else
-    {
-
-    if (!outToFile)
-	{
-	char *suffix = getCompressSuffix(compressType);
-	printf("Content-Type: application/x-%s\n", compressType);
-	if (endsWith(fileName, suffix))
-	    printf("Content-Disposition: attachment; filename=%s\n\n", fileName);
-	else
-	    printf("Content-Disposition: attachment; filename=%s%s\n\n",
-		   fileName, suffix);
-	/* Send the Content header uncompressed! */
-	fflush(stdout);
-	}
-
-    /* Make sure no environment variables interfere with compressor. */
-    cleanEnvVars(compressType);
-
-    /* Redirect stdout to compressor pipeline object. */
-    compressPipeline = pipelineOpen1(getCompressor(compressType),
-				     pipelineWrite, NULL, NULL);
-    if (-1 == dup2(pipelineFd(compressPipeline), STDOUT_FILENO))
-	errnoAbort("dup2(pipelineFd %d, stdout %d) failed in textOpen()",
-		   pipelineFd(compressPipeline), STDOUT_FILENO);
-    }
-pushWarnHandler(textOutWarnHandler);
-pushAbortHandler(textOutAbortHandler);
-return(compressPipeline);
-}
-
-void textOutClose(struct pipeline **pCompressPipeline, int *saveStdout)
-/* Flush and close stdout, wait for the pipeline to finish, and then free 
- * the pipeline object. */
-{
-if (pCompressPipeline && *pCompressPipeline)
-    {
-    fflush(stdout);
-    close(STDOUT_FILENO); // Do not use fclose
-    pipelineClose(pCompressPipeline);
-    }
-if (saveStdout)
-    {
-    if (*saveStdout != -1)
-	{
-	/* restore stdout */
-	fflush(stdout);
-	dup2(*saveStdout,STDOUT_FILENO);  /* closes STDOUT before setting it back to saved descriptor */
-	close(*saveStdout);
-	*saveStdout = -1;
-	}
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/tokenizer.c b/gbtools/src/blatSrc/lib/tokenizer.c
deleted file mode 100644
index 9dfdc59..0000000
--- a/gbtools/src/blatSrc/lib/tokenizer.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/* tokenizer - A tokenizer structure that will chop up file into
- * tokens.  It is aware of quoted strings and otherwise tends to return
- * white-space or punctuated-separated words, with punctuation in
- * a separate token.  This is used by autoSql. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "errAbort.h"
-#include "linefile.h"
-#include "tokenizer.h"
-
-
-struct tokenizer *tokenizerOnLineFile(struct lineFile *lf)
-/* Create a new tokenizer on open lineFile. */
-{
-struct tokenizer *tkz;
-AllocVar(tkz);
-tkz->sAlloc = 128;
-tkz->string = needMem(tkz->sAlloc);
-tkz->lf = lf;
-tkz->curLine = tkz->linePt = "";
-return tkz;
-}
-
-struct tokenizer *tokenizerNew(char *fileName)
-/* Return a new tokenizer. */
-{
-return tokenizerOnLineFile(lineFileOpen(fileName, TRUE));
-}
-
-void tokenizerFree(struct tokenizer **pTkz)
-/* Tear down a tokenizer. */
-{
-struct tokenizer *tkz;
-if ((tkz = *pTkz) != NULL)
-    {
-    freeMem(tkz->string);
-    lineFileClose(&tkz->lf);
-    freez(pTkz);
-    }
-}
-
-void tokenizerReuse(struct tokenizer *tkz)
-/* Reuse token. */
-{
-if (!tkz->eof)
-    tkz->reuse = TRUE;
-}
-
-int tokenizerLineCount(struct tokenizer *tkz)
-/* Return line of current token. */
-{
-return tkz->lf->lineIx;
-}
-
-char *tokenizerFileName(struct tokenizer *tkz)
-/* Return name of file. */
-{
-return tkz->lf->fileName;
-}
-
-char *tokenizerNext(struct tokenizer *tkz)
-/* Return token's next string (also available as tkz->string) or
- * NULL at EOF. */
-{
-char *start, *end;
-char c, *s;
-int size;
-if (tkz->reuse)
-    {
-    tkz->reuse = FALSE;
-    return tkz->string;
-    }
-tkz->leadingSpaces = 0;
-for (;;)	/* Skip over white space and comments. */
-    {
-    int lineSize;
-    s = start = skipLeadingSpaces(tkz->linePt);
-    tkz->leadingSpaces += s - tkz->linePt;
-    if ((c = start[0]) != 0)
-	{
-	if (tkz->uncommentC && c == '/')
-	     {
-	     if (start[1] == '/')
-		 ;  /* Keep going in loop effectively ignoring rest of line. */
-	     else if (start[1] == '*')
-		 {
-		 start += 2;
-		 for (;;)
-		     {
-		     char *end = stringIn("*/", start);
-		     if (end != NULL)
-			  {
-			  tkz->linePt = end+2;
-			  break;
-			  }
-		     if (!lineFileNext(tkz->lf, &tkz->curLine, &lineSize))
-			  errAbort("End of file (%s) in comment", tokenizerFileName(tkz));
-		     start = tkz->curLine;
-		     }
-		 continue;
-		 }
-	     else
-		 break;
-	     }
-	else if (tkz->uncommentShell && c == '#')
-	     ;  /* Keep going in loop effectively ignoring rest of line. */
-	else
-	    break;	/* Got something real. */
-	}
-    if (!lineFileNext(tkz->lf, &tkz->curLine, &lineSize))
-	{
-	tkz->eof = TRUE;
-	return NULL;
-	}
-    tkz->leadingSpaces += 1;
-    tkz->linePt = tkz->curLine;
-    }
-if (isalnum(c) || (c == '_'))
-    {
-    for (;;)
-	{
-        s++;
-	if (!(isalnum(*s) || (*s == '_')))
-	    break;
-	}
-    end = s;
-    }
-else if (c == '"' || c == '\'')
-    {
-    char quot = c;
-    if (tkz->leaveQuotes)
-	start = s++;
-    else
-	start = ++s;
-    for (;;)
-	{
-	c = *s;
-	if (c == quot)
-	    {
-	    if (s[-1] == '\\')
-		{
-		if (s >= start+2 && s[-2] == '\\')
-		    break;
-		}
-	    else
-		break;
-	    }
-	else if (c == 0)
-	    {
-	    break;
-	    }
-	++s;
-	}
-    end = s;
-    if (c != 0)
-	++s;
-    if (tkz->leaveQuotes)
-	end += 1;
-    }
-else
-    {
-    end = ++s;
-    }
-tkz->linePt = s;
-size = end - start;
-if (size >= tkz->sAlloc)
-    {
-    tkz->sAlloc = size+128;
-    tkz->string = needMoreMem(tkz->string, 0, tkz->sAlloc);
-    }
-memcpy(tkz->string, start, size);
-tkz->string[size] = 0;
-return tkz->string;
-}
-
-
-void tokenizerErrAbort(struct tokenizer *tkz, char *format, ...)
-/* Print error message followed by file and line number and
- * abort. */
-{
-va_list args;
-va_start(args, format);
-vaWarn(format, args);
-errAbort("line %d of %s:\n%s", 
-	tokenizerLineCount(tkz), tokenizerFileName(tkz), tkz->curLine);
-}
-
-void tokenizerNotEnd(struct tokenizer *tkz)
-/* Squawk if at end. */
-{
-if (tkz->eof)
-    errAbort("Unexpected end of file");
-}
-
-char *tokenizerMustHaveNext(struct tokenizer *tkz)
-/* Get next token, which must be there. */
-{
-char *s = tokenizerNext(tkz);
-if (s == NULL)
-    errAbort("Unexpected end of file");
-return s;
-}
-
-void tokenizerMustMatch(struct tokenizer *tkz, char *string)
-/* Require next token to match string.  Return next token
- * if it does, otherwise abort. */
-{
-if (sameWord(tkz->string, string))
-    tokenizerMustHaveNext(tkz);
-else
-    tokenizerErrAbort(tkz, "Expecting %s got %s", string, tkz->string);
-}
-
diff --git a/gbtools/src/blatSrc/lib/trix.c b/gbtools/src/blatSrc/lib/trix.c
deleted file mode 100644
index 2289c58..0000000
--- a/gbtools/src/blatSrc/lib/trix.c
+++ /dev/null
@@ -1,760 +0,0 @@
-/* trix - text retrieval index.  Stuff for fast two level index
- * of text for fast word searches. */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "linefile.h"
-#include "trix.h"
-#include "sqlNum.h"
-#include "udc.h"
-#include "net.h"
-
-
-/* Some local structures for the search. */
-struct trixHitPos 
-/* A hit to the index. */
-    {
-    struct trixHitPos *next;	/* Next in list */
-    char *itemId;		/* Associated itemId */
-    int wordIx;			/* Which word this is part of. */
-    int leftoverLetters;	/* Number of letters at end of word not matched */
-    };
-
-struct trixWordResult
-/* Results of a search on one word. */
-    {
-    struct trixWordResult *next;
-    char *word;			/* Word name. */
-    struct trixHitPos *hitList;	/* Hit list.  May be shared (not allocated here). */
-    struct trixHitPos *hit;	/* Current position while iterating through hit list. */
-    struct trixHitPos *iHit;	/* Current position during an inner iteration. */
-    };
-
-struct trixIxx
-/* A prefix and */
-    {
-    off_t pos;	   /* Position where prefix first occurs in file. */
-    char prefix[trixPrefixSize];/* Space padded first five letters of what we're indexing. */
-    };
-
-/* Some cleanup code. */
-
-static void trixHitPosFree(struct trixHitPos **pPos)
-/* Free up trixHitPos. */
-{
-struct trixHitPos *pos = *pPos;
-if (pos != NULL)
-    {
-    freeMem(pos->itemId);
-    freez(pPos);
-    }
-}
-
-static void trixHitPosFreeList(struct trixHitPos **pList)
-/* Free up a list of trixHitPoss. */
-{
-struct trixHitPos *el, *next;
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    trixHitPosFree(&el);
-    }
-*pList = NULL;
-}
-
-static void trixWordResultFree(struct trixWordResult **pTwr)
-/* Free up a trixWordResult */
-{
-struct trixWordResult *twr = *pTwr;
-if (twr != NULL)
-    {
-    freeMem(twr->word);
-    freez(pTwr);
-    }
-}
-
-static void trixWordResultFreeList(struct trixWordResult **pList)
-/* Free up a list of trixWordResults. */
-{
-struct trixWordResult *el, *next;
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    trixWordResultFree(&el);
-    }
-*pList = NULL;
-}
-
-static void freeHitCallback(void *val)
-/* Val is actually list trixHitPos.  This called to free stuff in hash. */
-{
-struct trixHitPos *posList = val;
-trixHitPosFreeList(&posList);
-}
-
-void trixClose(struct trix **pTrix)
-/* Close up index and free up associated resources. */
-{
-struct trix *trix = *pTrix;
-if (trix != NULL)
-    {
-    freeMem(trix->ixx);
-    hashTraverseVals(trix->wordHitHash, freeHitCallback);
-    hashFree(&trix->wordHitHash);	/* Need to free items? */
-    freez(pTrix);
-    }
-}
-
-void trixSearchResultFree(struct trixSearchResult **pTsr)
-/* Free up data associated with trixSearchResult. */
-{
-struct trixSearchResult *tsr = *pTsr;
-if (tsr != NULL)
-    {
-    freeMem(tsr->itemId);
-    freez(pTsr);
-    }
-}
-
-void trixSearchResultFreeList(struct trixSearchResult **pList)
-/* Free up a list of trixSearchResults. */
-{
-struct trixSearchResult *el, *next;
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    trixSearchResultFree(&el);
-    }
-*pList = NULL;
-}
-
-
-/* Code that makes, rather than cleans up. */
-
-static char unhexTable[128];	/* Lookup table to help with hex conversion. */
-
-static void initUnhexTable()
-/* Initialize a table for fast unhexing of numbers. */
-{
-unhexTable['0'] = 0;
-unhexTable['1'] = 1;
-unhexTable['2'] = 2;
-unhexTable['3'] = 3;
-unhexTable['4'] = 4;
-unhexTable['5'] = 5;
-unhexTable['6'] = 6;
-unhexTable['7'] = 7;
-unhexTable['8'] = 8;
-unhexTable['9'] = 9;
-unhexTable['A'] = 10;
-unhexTable['B'] = 11;
-unhexTable['C'] = 12;
-unhexTable['D'] = 13;
-unhexTable['E'] = 14;
-unhexTable['F'] = 15;
-}
-
-static off_t unhex(char hex[10])
-/* Convert 10 character hex string to off_t */
-{
-off_t  x = 0;
-int i;
-
-for (i=0; i<10; ++i)
-   {
-   x <<= 4;
-   x += unhexTable[(unsigned)hex[i]];
-   }
-return x;
-}
-
-struct trix *trixNew()
-/* Create a new empty trix index. */
-{
-struct trix *trix;
-AllocVar(trix);
-trix->ixxAlloc = 8*1024;
-AllocArray(trix->ixx, trix->ixxAlloc);
-trix->wordHitHash = newHash(8);
-return trix;
-}
-
-void trixAddToIxx(struct trix *trix, off_t pos, char *prefix)
-/* Add to trix->ixx. */
-{
-struct trixIxx *ixx;
-if (trix->ixxSize >= trix->ixxAlloc)
-     {
-     trix->ixxAlloc += trix->ixxAlloc;	/* Double allocation. */
-     ExpandArray(trix->ixx, trix->ixxSize, trix->ixxAlloc);
-     }
-ixx = trix->ixx + trix->ixxSize;
-ixx->pos = pos;
-memcpy(ixx->prefix, prefix, sizeof(ixx->prefix));
-trix->ixxSize += 1;
-}
-
-// wrappers around the udc or lineFile routines
-static void *ourOpen(struct trix *trix, char *fileName)
-{
-if (trix->useUdc)
-    return (void *)udcFileOpen(fileName, NULL);
-return (void *)lineFileOpen(fileName, TRUE);
-}
-
-static boolean ourReadLine(struct trix *trix, void *lf, char **line)
-{
-if (trix->useUdc)
-    {
-    *line = udcReadLine((struct udcFile *)lf);
-    return *line != NULL;
-    }
-return lineFileNext((struct lineFile *)lf, line, NULL);
-}
-
-static void ourClose(struct trix *trix, void **lf)
-{
-if (trix->useUdc)
-    udcFileClose((struct udcFile **)lf);
-else
-    lineFileClose((struct lineFile **)lf);
-}
-
-void ourSeek(struct trix *trix, off_t ixPos)
-{
-if (trix->useUdc)
-    udcSeek((struct udcFile *)trix->lf, ixPos);
-else
-    lineFileSeek((struct lineFile *)trix->lf, ixPos, SEEK_SET);
-}
-
-struct trix *trixOpen(char *ixFile)
-/* Open up index.  Load second level index in memory. */
-{
-struct trix *trix = trixNew();
-trix->useUdc = FALSE;
-if (hasProtocol(ixFile))
-    trix->useUdc = TRUE;
-
-char ixxFile[PATH_LEN];
-void *lf;
-char *line;
-
-initUnhexTable();
-safef(ixxFile, sizeof(ixxFile), "%sx", ixFile);
-lf = ourOpen(trix, ixxFile);
-while (ourReadLine(trix, lf, &line) )
-    {
-    off_t pos = unhex(line+trixPrefixSize);
-    trixAddToIxx(trix, pos, line);
-    }
-ourClose(trix, &lf);
-trix->lf = ourOpen(trix, ixFile);
-return trix;
-}
-
-void trixCopyToPrefix(char *word, char *prefix)
-/* Copy first part of word to prefix.  If need be end pad with spaces. */
-{
-int len = strlen(word);
-if (len >= trixPrefixSize)
-    memcpy(prefix, word, trixPrefixSize);
-else
-    {
-    memset(prefix, ' ', trixPrefixSize);
-    memcpy(prefix, word, len);
-    }
-}
-
-static off_t trixFindIndexStartLine(struct trix *trix, char *word)
-/* Find start position of line we want to start at in the first level
- * index. */
-{
-char wordPrefix[trixPrefixSize];
-int i;
-off_t pos = 0;
-
-trixCopyToPrefix(word, wordPrefix);
-toLowerN(wordPrefix, trixPrefixSize);
-for (i=0; i<trix->ixxSize; ++i)
-    {
-    struct trixIxx *ixx = trix->ixx + i;
-    if (memcmp(wordPrefix, ixx->prefix, trixPrefixSize) < 0)
-       break;
-    pos = ixx->pos;
-    }
-return pos;
-}
-
-static struct trixHitPos *trixParseHitList(char *hitWord, char *hitString,
-	int leftoverLetters)
-/* Parse out hit string, inserting zeroes in it during process.
- * Return result as list of trixHitPos. */
-{
-struct trixHitPos *hit, *hitList = NULL;
-char *word;
-while ((word = nextWord(&hitString)) != NULL)
-    {
-    char *parts[3];
-    int partCount;
-    partCount = chopByChar(word, ',', parts, ArraySize(parts));
-    if (partCount != 2)
-        errAbort("Error in index format at word %s", hitWord);
-    AllocVar(hit);
-    hit->itemId = cloneString(parts[0]);
-    hit->wordIx = sqlUnsigned(parts[1]);
-    hit->leftoverLetters = leftoverLetters;
-    slAddHead(&hitList, hit);
-    }
-slReverse(&hitList);
-return hitList;
-}
-
-int trixHitPosCmp(struct trixHitPos *a, struct trixHitPos *b)
-/* Compare function to sort trixHitPos. */
-{
-int diff = strcmp(a->itemId, b->itemId);
-if (diff == 0)
-    {
-    diff = a->wordIx - b->wordIx;
-    if (diff == 0)
-        diff = a->leftoverLetters - b->leftoverLetters;
-    }
-return diff;
-}
-
-
-struct trixHitPos *mergeHits(struct trixHitPos *aList, struct trixHitPos *bList)
-/* Return hit list that merges aList and bList.  The input is sorted,
- * and so is the output. */
-{
-struct trixHitPos *a, *b, *aNext, *bNext, *newList = NULL;
-
-a = aList;
-b = bList;
-for (;;)
-    {
-    if (a == NULL)
-        {
-	if (b == NULL)
-	    break;
-	bNext = b->next;
-	slAddHead(&newList, b);
-	b = bNext;
-	}
-    else if (b == NULL)
-        {
-	aNext = a->next;
-	slAddHead(&newList, a);
-	a = aNext;
-	}
-    else if (trixHitPosCmp(a, b) < 0)
-        {
-	aNext = a->next;
-	slAddHead(&newList, a);
-	a = aNext;
-	}
-    else
-        {
-	bNext = b->next;
-	slAddHead(&newList, b);
-	b = bNext;
-	}
-    }
-slReverse(&newList);
-return newList;
-}
-
-static int reasonablePrefix(char *prefix, char *word, boolean expand)
-/* Return non-negative if prefix is reasonable for word.
- * Returns number of letters left in word not matched by
- * prefix. */
-{
-int prefixLen = strlen(prefix);
-int wordLen = strlen(word);
-int suffixLen = wordLen - prefixLen;
-if (suffixLen == 0)
-   return 0;
-else if (expand && prefixLen >= 3)
-    {
-    int wordEnd;
-    char *suffix = word + prefixLen;
-    boolean prefixEndsInDigit = isdigit(word[prefixLen-1]);
-    /* Find a word marker - either end of string, '-', '.', or '_'
-     * or a number. */
-    for (wordEnd=0; wordEnd < suffixLen; ++wordEnd)
-        {
-	char c = suffix[wordEnd];
-	if (c == '-' || c == '.' || c == '_' || (!prefixEndsInDigit && isdigit(c)))
-	    break;
-	}
-    if (wordEnd <= 2)
-       return wordEnd;
-    if (wordEnd == 3 && startsWith("ing", suffix))
-       return wordEnd;
-    }
-return -1;
-}
-
-
-struct trixWordResult *trixSearchWordResults(struct trix *trix, 
-	char *searchWord, boolean expand)
-/* Get results for single word from index.  Returns NULL if no matches. */
-{
-char *line, *word;
-struct trixWordResult *twr = NULL;
-struct trixHitPos *hitList = hashFindVal(trix->wordHitHash, searchWord);
-
-if (hitList == NULL)
-    {
-    struct trixHitPos *oneHitList;
-    off_t ixPos = trixFindIndexStartLine(trix, searchWord);
-    ourSeek(trix, ixPos);
-    while (ourReadLine(trix, trix->lf, &line))
-	{
-	word = nextWord(&line);
-	if (startsWith(searchWord, word))
-	    {
-	    int leftoverLetters = reasonablePrefix(searchWord, word, expand);
-	    /* uglyf("reasonablePrefix(%s,%s)=%d<BR>\n", searchWord, word, leftoverLetters); */
-	    if (leftoverLetters >= 0)
-		{
-		oneHitList = trixParseHitList(searchWord, line, 
-			leftoverLetters);
-		hitList = mergeHits(hitList, oneHitList);
-		}
-	    }
-	else if (strcmp(searchWord, word) < 0)
-	    break;
-	}
-    hashAdd(trix->wordHitHash, searchWord, hitList);
-    }
-if (hitList != NULL)
-    {
-    AllocVar(twr);
-    twr->word = cloneString(searchWord);
-    twr->hitList = hitList;
-    }
-return twr;
-}
-
-
-#ifdef DEBUG
-void trwDump(struct trixWordResult *twr)
-/* Dump out one trixWordResult to stdout. */
-{
-struct trixHitPos *hit;
-int hitIx, maxHits = 8;
-
-printf("%d matches to %s:", slCount(twr->hitList), twr->word);
-for (hit=twr->hitList, hitIx=0; hit != NULL && hitIx < maxHits; hit=hit->next, hitIx+=1)
-    printf(" %s@%d", hit->itemId, hit->wordIx);
-if (hit != NULL)
-    printf(" ...");
-printf("<BR>\n");
-}
-#endif /* DEBUG */
-
-static char *highestId(struct trixWordResult *twrList)
-/* Return highest itemId at current twr->hit */
-{
-char *itemId = twrList->hit->itemId;
-struct trixWordResult *twr;
-
-for (twr = twrList->next; twr != NULL; twr = twr->next)
-    {
-    if (strcmp(itemId, twr->hit->itemId) < 0)
-        itemId = twr->hit->itemId;
-    }
-return itemId;
-}
-
-static boolean seekOneToId(struct trixWordResult *twr, char *itemId)
-/* Move twr->hit forward until it hits itemId.  Return FALSE if
- * moved past where itemId would be without hitting it. */
-{
-struct trixHitPos *hit;
-int diff = -1;
-for (hit = twr->hit; hit != NULL; hit = hit->next)
-    {
-    diff = strcmp(itemId, hit->itemId);
-    if (diff <= 0)
-        break;
-    }
-twr->hit = hit;
-return diff == 0;
-}
-
-static boolean seekAllToId(struct trixWordResult *twrList, char *itemId)
-/* Try to seek all twr's in list to the same itemId */
-{
-struct trixWordResult *twr;
-boolean allHit = TRUE;
-for (twr = twrList; twr != NULL; twr = twr->next)
-    {
-    if (!seekOneToId(twr, itemId))
-        allHit = FALSE;
-    }
-return allHit;
-}
-
-static void seekAllPastId(struct trixWordResult *twrList, char *itemId)
-/* Try to seek all twr's in list to past the itemId. */
-{
-struct trixWordResult *twr;
-for (twr = twrList; twr != NULL; twr = twr->next)
-    {
-    struct trixHitPos *hit;
-    for (hit = twr->hit; hit != NULL; hit = hit->next)
-	if (!sameString(hit->itemId, itemId))
-	    break;
-    twr->hit = hit;
-    }
-}
-
-static boolean anyTwrDone(struct trixWordResult *twrList)
-/* Return TRUE if any of the items in list are done */
-{
-struct trixWordResult *twr;
-for (twr = twrList; twr != NULL; twr = twr->next)
-    if (twr->hit == NULL)
-        return TRUE;
-return FALSE;
-}
-
-static void findUnorderedSpan(struct trixWordResult *twrList,
-	char *itemId, int *retSpan, int *retLeftoverLetters)
-/* Find out smallest number of words in doc that will cover
- * all words in search. */
-{
-int minSpan = BIGNUM;
-int leftoverLetters = 0;
-struct trixWordResult *twr;
-
-/* Set up iHit pointers we use to keep track of our 
- * search.  Don't want to mess with hit pointers as they
- * will be used later. */
-for (twr = twrList; twr != NULL; twr = twr->next)
-    twr->iHit = twr->hit;
-
-for (;;)
-    {
-    int minWord = BIGNUM, maxWord=0, span;
-    int curLeftover = 0;
-
-    /* Figure out current span and save as min if it's smallest so far. */
-    for (twr = twrList; twr != NULL; twr = twr->next)
-        {
-	int curWord = twr->iHit->wordIx;
-	if (curWord < minWord)
-	    minWord = curWord;
-	if (curWord > maxWord)
-	    maxWord = curWord;
-	curLeftover += twr->iHit->leftoverLetters;
-	}
-    span = maxWord - minWord;
-    if (span < minSpan)
-	{
-        minSpan = span;
-	leftoverLetters = curLeftover;
-	}
-
-    /* Advance iHit past minWord.  Break if we go outside of our doc or item. */
-    for (twr = twrList; twr != NULL; twr = twr->next)
-        {
-	if (twr->iHit->wordIx == minWord)
-	    {
-	    struct trixHitPos *hit = twr->iHit = twr->iHit->next;
-	    if (hit == NULL || !sameString(hit->itemId, itemId))
-	        {
-		*retSpan = minSpan+1;
-		*retLeftoverLetters = leftoverLetters;
-		return;
-		}
-	    }
-	}
-    }
-} 
-
-static int findWordPos(struct trixWordResult *twrList, char *itemId)
-/* Figure out the first word position.  For multiple words, this
- * will be the maximimum first word position of all words. 
- * This assumes that the hits are sorted by word position
- * within a document. */
-{
-int firstWordPos = 0;
-struct trixWordResult *twr;
-for (twr = twrList; twr != NULL; twr = twr->next)
-    {
-    int pos = twr->hit->wordIx;
-    if (firstWordPos < pos)
-        firstWordPos = pos;
-    }
-return firstWordPos;
-}
-
-static int findOrderedSpan(struct trixWordResult *twrList,
-	char *itemId)
-/* Find out smallest number of words in doc that will cover
- * all words in search. */
-{
-int minSpan = BIGNUM - 1;  // subtract 1 to accomodate adding 1 below
-struct trixWordResult *twr;
-
-/* Set up iHit pointers we use to keep track of our 
- * search.  Don't want to mess with hit pointers as they
- * will be used later. */
-for (twr = twrList; twr != NULL; twr = twr->next)
-    twr->iHit = twr->hit;
-
-for (;;)
-    {
-    int startWord = twrList->iHit->wordIx;
-    int endWord = startWord;
-    int span;
-    struct trixHitPos *hit;
-
-    /* Set up twr->iHit to be closest one past hit of previous twr. */
-    for (twr = twrList->next; twr != NULL; twr = twr->next)
-        {
-	for (hit = twr->iHit; ; hit = hit->next)
-	    {
-	    if (hit == NULL || !sameString(hit->itemId, itemId))
-	        return minSpan + 1;
-	    if (hit->wordIx > endWord)
-	        break;
-	    }
-	twr->iHit = hit;
-	endWord = hit->wordIx;
-	}
-    span = endWord - startWord;
-    if (span < minSpan)
-        minSpan = span;
-
-    /* Advance to next occurence of first word. */
-    hit = twrList->iHit = twrList->iHit->next;
-    if (hit == NULL || !sameString(hit->itemId, itemId))
-	return minSpan+1;
-    }
-}
-
-
-static struct trixSearchResult *findMultipleWordHits(struct trixWordResult *twrList)
-/* Return list of items that are hit by all words. */
-{
-struct trixWordResult *twr;
-struct trixSearchResult *tsList = NULL, *ts;
-
-/* Initially set hit position to start on all words. */
-for (twr = twrList; twr != NULL; twr = twr->next)
-    twr->hit = twr->hitList;
-
-for (;;)
-    {
-    char *itemId = highestId(twrList);
-    if (seekAllToId(twrList, itemId))
-        {
-	AllocVar(ts);
-	ts->itemId = cloneString(itemId);
-	findUnorderedSpan(twrList, itemId, 
-		&ts->unorderedSpan, &ts->leftoverLetters);
-	ts->orderedSpan = findOrderedSpan(twrList, itemId);
-	ts->wordPos = findWordPos(twrList, itemId);
-	slAddHead(&tsList, ts);
-	}
-    seekAllPastId(twrList, itemId);
-    if (anyTwrDone(twrList))
-        break;
-    }
-slReverse(&tsList);
-return tsList;
-}
-
-int trixSearchResultCmp(const void *va, const void *vb)
-/* Compare two trixSearchResult by itemId. */
-{
-const struct trixSearchResult *a = *((struct trixSearchResult **)va);
-const struct trixSearchResult *b = *((struct trixSearchResult **)vb);
-int dif;
-dif = a->unorderedSpan - b->unorderedSpan;
-if (dif == 0)
-   {
-   dif = a->orderedSpan - b->orderedSpan;
-   if (dif == 0)
-       {
-       dif = a->leftoverLetters - b->leftoverLetters;
-       if (dif == 0)
-	   dif = a->wordPos - b->wordPos;
-       }
-   }
-       
-return dif;
-}
-
-struct trixSearchResult *trixSearch(struct trix *trix, int wordCount, char **words,
-	boolean expand)
-/* Return a list of items that match all words.  This will be sorted so that
- * multiple-word matches where the words are closer to each other and in the
- * right order will be first.  Do a trixSearchResultFreeList when done. 
- * If expand is TRUE then this will match not only the input words, but also
- * additional words that start with the input words. */
-{
-struct trixWordResult *twr, *twrList = NULL;
-struct trixSearchResult *ts, *tsList = NULL;
-int wordIx;
-boolean gotMiss = FALSE;
-
-if (wordCount == 1)
-    {
-    struct trixHitPos *hit;
-    char *lastId = "";
-    twr = twrList = trixSearchWordResults(trix, words[0], expand);
-    if (twr == NULL)
-        return NULL;
-    for (hit = twr->hitList; hit != NULL; hit = hit->next)
-        {
-	if (!sameString(lastId, hit->itemId))
-	    {
-	    lastId = hit->itemId;
-	    AllocVar(ts);
-	    ts->itemId = hit->itemId;	/* Transfer itemId */
-	    hit->itemId = NULL;
-	    ts->orderedSpan = 1;
-	    ts->unorderedSpan = 1;
-	    ts->wordPos = hit->wordIx;
-	    ts->leftoverLetters = hit->leftoverLetters;
-	    slAddHead(&tsList, ts);
-	    }
-	}
-    }
-else
-    {
-    for (wordIx=0; wordIx<wordCount; ++wordIx)
-	{
-	char *searchWord = words[wordIx];
-	twr = trixSearchWordResults(trix, searchWord, expand);
-	if (twr == NULL)
-	    {
-	    gotMiss = TRUE;
-	    break;
-	    }
-	slAddHead(&twrList, twr);
-#ifdef DEBUG
-	trwDump(twr);
-#endif /* DEBUG */
-	}
-    if (!gotMiss)
-	{
-	slReverse(&twrList);
-	tsList = findMultipleWordHits(twrList);
-	}
-    }
-trixWordResultFreeList(&twrList);
-slSort(&tsList, trixSearchResultCmp);
-return tsList;
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/twoBit.c b/gbtools/src/blatSrc/lib/twoBit.c
deleted file mode 100644
index 077fb10..0000000
--- a/gbtools/src/blatSrc/lib/twoBit.c
+++ /dev/null
@@ -1,1235 +0,0 @@
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "dnaseq.h"
-#include "dnautil.h"
-#include "sig.h"
-#include "localmem.h"
-#include "linefile.h"
-#include "obscure.h"
-#include "bPlusTree.h"
-#include "twoBit.h"
-#include "udc.h"
-#include "net.h"
-#include "portable.h"
-#include <limits.h>
-
-/* following are the wrap functions for the UDC and stdio functoins
- * that read twoBit files.   All of these are to get around the C compiler
- * complaining about the automatic cast of a void * to FILE * or 
- * struct udcFile *.
- */
-/* first the UDC wrappers */
-static void udcSeekCurWrap(void *file, bits64 offset)
-{
-udcSeekCur((struct udcFile *)file, offset);
-}
-
-static void udcSeekWrap(void *file, bits64 offset)
-{
-udcSeek((struct udcFile *)file, offset);
-}
-
-static void udcMustReadWrap(void *file, void *buf, size_t size)
-{
-udcMustRead((struct udcFile *)file, buf, size);
-}
-
-static void udcFileCloseWrap(void *pFile)
-{
-udcFileClose((struct udcFile **)pFile);
-}
-
-static bits32 udcReadBits32Wrap(void *f, boolean isSwapped)
-{
-return udcReadBits32((struct udcFile *)f, isSwapped);
-}
-
-static boolean udcFastReadStringWrap(void *f, char buf[256])
-{
-return udcFastReadString((struct udcFile *)f, buf);
-}
-
-/* now the stdio wrappers */
-static void seekCurWrap(void *file, bits64 offset)
-{
-fseek((FILE *)file, offset, SEEK_CUR);
-}
-
-static void seekWrap(void *file, bits64 offset)
-{
-fseek((FILE *)file, offset, SEEK_SET);
-}
-
-static void mustReadWrap(void *file, void *buf, size_t size)
-{
-mustRead((FILE *)file, buf, size);
-}
-
-static void fileCloseWrap(void *pFile)
-{
-carefulClose((FILE **)pFile);
-}
-
-static bits32 readBits32Wrap(void *f, boolean isSwapped)
-{
-return readBits32((FILE *)f, isSwapped);
-}
-
-static boolean fastReadStringWrap(void *f, char buf[256])
-{
-return fastReadString((FILE *)f, buf);
-}
-
-static void setFileFuncs( struct twoBitFile *tbf, boolean useUdc)
-/* choose the proper function pointers depending on whether
- * this open twoBit is using stdio or UDC
- */
-{
-if (useUdc)
-    {
-    tbf->ourSeekCur = udcSeekCurWrap;
-    tbf->ourSeek = udcSeekWrap;
-    tbf->ourReadBits32 = udcReadBits32Wrap;
-    tbf->ourFastReadString = udcFastReadStringWrap;
-    tbf->ourClose = udcFileCloseWrap;
-    tbf->ourMustRead = udcMustReadWrap;
-    }
-else
-    {
-    tbf->ourSeekCur = seekCurWrap;
-    tbf->ourSeek = seekWrap;
-    tbf->ourReadBits32 = readBits32Wrap;
-    tbf->ourFastReadString = fastReadStringWrap;
-    tbf->ourClose = fileCloseWrap;
-    tbf->ourMustRead = mustReadWrap;
-    }
-}
-
-static int countBlocksOfN(char *s, int size)
-/* Count number of blocks of N's (or n's) in s. */
-{
-int i;
-boolean isN, lastIsN = FALSE;
-char c;
-int blockCount = 0;
-
-for (i=0; i<size; ++i)
-    {
-    c = s[i];
-    isN = (c == 'n' || c == 'N');
-    if (isN && !lastIsN)
-	++blockCount;
-    lastIsN = isN;
-    }
-return blockCount;
-}
-
-static int countBlocksOfLower(char *s, int size)
-/* Count number of blocks of lower case letters. */
-{
-int i;
-boolean isLower, lastIsLower = FALSE;
-int blockCount = 0;
-
-for (i=0; i<size; ++i)
-    {
-    isLower = islower(s[i]);
-    if (isLower && !lastIsLower)
-	++blockCount;
-    lastIsLower = isLower;
-    }
-return blockCount;
-}
-
-static void storeBlocksOfN(char *s, int size, bits32 *starts, bits32 *sizes)
-/* Store starts and sizes of blocks of N's. */
-{
-int i;
-boolean isN, lastIsN = FALSE;
-int startN = 0;
-char c;
-
-for (i=0; i<size; ++i)
-    {
-    c = s[i];
-    isN = (c == 'n' || c == 'N');
-    if (isN)
-        {
-	if (!lastIsN)
-	    startN = i;
-	}
-    else
-        {
-	if (lastIsN)
-	    {
-	    *starts++ = startN;
-	    *sizes++ = i - startN;
-	    }
-	}
-    lastIsN = isN;
-    }
-if (lastIsN)
-    {
-    *starts = startN;
-    *sizes = i - startN;
-    }
-}
-
-static void storeBlocksOfLower(char *s, int size, bits32 *starts, bits32 *sizes)
-/* Store starts and sizes of blocks of lower case letters. */
-{
-int i;
-boolean isLower, lastIsLower = FALSE;
-int startLower = 0;
-
-for (i=0; i<size; ++i)
-    {
-    isLower = islower(s[i]);
-    if (isLower)
-        {
-	if (!lastIsLower)
-	    startLower = i;
-	}
-    else
-        {
-	if (lastIsLower)
-	    {
-	    *starts++ = startLower;
-	    *sizes++ = i - startLower;
-	    }
-	}
-    lastIsLower = isLower;
-    }
-if (lastIsLower)
-    {
-    *starts = startLower;
-    *sizes = i - startLower;
-    }
-}
-
-static int packedSize(int unpackedSize)
-/* Return size when packed, rounding up. */
-{
-return ((unpackedSize + 3) >> 2);
-}
-
-struct twoBit *twoBitFromDnaSeq(struct dnaSeq *seq, boolean doMask)
-/* Convert dnaSeq representation in memory to twoBit representation.
- * If doMask is true interpret lower-case letters as masked. */
-{
-int ubyteSize = packedSize(seq->size);
-UBYTE *pt;
-struct twoBit *twoBit;
-DNA last4[4];	/* Holds few bases. */
-DNA *dna;
-int i, end;
-
-/* Allocate structure and fill in name. */
-AllocVar(twoBit);
-pt = AllocArray(twoBit->data, ubyteSize);
-twoBit->name = cloneString(seq->name);
-twoBit->size = seq->size;
-
-/* Convert to 4-bases per byte representation. */
-dna = seq->dna;
-end = seq->size - 4;
-for (i=0; i<end; i += 4)
-    {
-    *pt++ = packDna4(dna+i);
-    }
-
-/* Take care of conversion of last few bases. */
-last4[0] = last4[1] = last4[2] = last4[3] = 'T';
-memcpy(last4, dna+i, seq->size-i);
-*pt = packDna4(last4);
-
-/* Deal with blocks of N. */
-twoBit->nBlockCount = countBlocksOfN(dna, seq->size);
-if (twoBit->nBlockCount > 0)
-    {
-    AllocArray(twoBit->nStarts, twoBit->nBlockCount);
-    AllocArray(twoBit->nSizes, twoBit->nBlockCount);
-    storeBlocksOfN(dna, seq->size, twoBit->nStarts, twoBit->nSizes);
-    }
-
-/* Deal with masking */
-if (doMask)
-    {
-    twoBit->maskBlockCount = countBlocksOfLower(dna, seq->size);
-    if (twoBit->maskBlockCount > 0)
-        {
-	AllocArray(twoBit->maskStarts, twoBit->maskBlockCount);
-	AllocArray(twoBit->maskSizes, twoBit->maskBlockCount);
-	storeBlocksOfLower(dna, seq->size, 
-		twoBit->maskStarts, twoBit->maskSizes);
-	}
-    }
-return twoBit;
-}
-
-
-static int twoBitSizeInFile(struct twoBit *twoBit)
-/* Figure out size structure will take in file. */
-{
-return packedSize(twoBit->size) 
-	+ sizeof(twoBit->size)
-	+ sizeof(twoBit->nBlockCount)
-	+ sizeof(twoBit->nStarts[0]) * twoBit->nBlockCount
-	+ sizeof(twoBit->nSizes[0]) * twoBit->nBlockCount
-	+ sizeof(twoBit->maskBlockCount)
-	+ sizeof(twoBit->maskStarts[0]) * twoBit->maskBlockCount
-	+ sizeof(twoBit->maskSizes[0]) * twoBit->maskBlockCount
-	+ sizeof(twoBit->reserved);
-}
-
-void twoBitWriteOne(struct twoBit *twoBit, FILE *f)
-/* Write out one twoBit sequence to binary file. 
- * Note this does not include the name, which is
- * stored only in index. */
-{
-writeOne(f, twoBit->size);
-writeOne(f, twoBit->nBlockCount);
-if (twoBit->nBlockCount > 0)
-    {
-    fwrite(twoBit->nStarts, sizeof(twoBit->nStarts[0]), 
-    	twoBit->nBlockCount, f);
-    fwrite(twoBit->nSizes, sizeof(twoBit->nSizes[0]), 
-    	twoBit->nBlockCount, f);
-    }
-writeOne(f, twoBit->maskBlockCount);
-if (twoBit->maskBlockCount > 0)
-    {
-    fwrite(twoBit->maskStarts, sizeof(twoBit->maskStarts[0]), 
-    	twoBit->maskBlockCount, f);
-    fwrite(twoBit->maskSizes, sizeof(twoBit->maskSizes[0]), 
-    	twoBit->maskBlockCount, f);
-    }
-writeOne(f, twoBit->reserved);
-mustWrite(f, twoBit->data, packedSize(twoBit->size));
-}
-
-void twoBitWriteHeader(struct twoBit *twoBitList, FILE *f)
-/* Write out header portion of twoBit file, including initial
- * index */
-{
-bits32 sig = twoBitSig;
-bits32 version = 0;
-bits32 seqCount = slCount(twoBitList);
-bits32 reserved = 0;
-bits32 offset = 0;
-struct twoBit *twoBit;
-long long counter = 0; /* check for 32 bit overflow */
-
-/* Write out fixed parts of header. */
-writeOne(f, sig);
-writeOne(f, version);
-writeOne(f, seqCount);
-writeOne(f, reserved);
-
-/* Figure out location of first byte past index.
- * Each index entry contains 4 bytes of offset information
- * and the name of the sequence, which is variable length. */
-offset = sizeof(sig) + sizeof(version) + sizeof(seqCount) + sizeof(reserved);
-for (twoBit = twoBitList; twoBit != NULL; twoBit = twoBit->next)
-    {
-    int nameLen = strlen(twoBit->name);
-    if (nameLen > 255)
-        errAbort("name %s too long", twoBit->name);
-    offset += nameLen + 1 + sizeof(bits32);
-    }
-
-/* Write out index. */
-for (twoBit = twoBitList; twoBit != NULL; twoBit = twoBit->next)
-    {
-    int size = twoBitSizeInFile(twoBit);
-    writeString(f, twoBit->name);
-    writeOne(f, offset);
-    offset += size;
-    counter += (long long)size;
-    if (counter > UINT_MAX )
-        errAbort("Error in faToTwoBit, index overflow at %s. The 2bit format "
-                "does not support indexes larger than %dGb, \n"
-                "please split up into smaller files.\n", 
-                twoBit->name, UINT_MAX/1000000000);
-    }
-}
-
-void twoBitClose(struct twoBitFile **pTbf)
-/* Free up resources associated with twoBitFile. */
-{
-struct twoBitFile *tbf = *pTbf;
-if (tbf != NULL)
-    {
-    freez(&tbf->fileName);
-    (*tbf->ourClose)(&tbf->f);
-    hashFree(&tbf->hash);
-    /* The indexList is allocated out of the hash's memory pool. */
-    bptFileClose(&tbf->bpt);
-    freez(pTbf);
-    }
-}
-
-boolean twoBitSigRead(struct twoBitFile *tbf, boolean *isSwapped)
-/* read twoBit signature, return FALSE if not good 
- * set isSwapped to TRUE if twoBit file is byte swapped */
-{
-bits32 sig;
-
-*isSwapped = FALSE;
-(*tbf->ourMustRead)(tbf->f, &sig, sizeof(sig));
-if (sig == twoBitSwapSig)
-    *isSwapped = TRUE;
-else if (sig != twoBitSig)
-    return FALSE;
-
-return TRUE;
-}
-
-static struct twoBitFile *getTbfAndOpen(char *fileName, boolean useUdc)
-{
-struct twoBitFile *tbf;
-
-AllocVar(tbf);
-setFileFuncs(tbf, useUdc);
-
-if (useUdc)
-    tbf->f = udcFileOpen(fileName, NULL);
-else
-    tbf->f = mustOpen(fileName, "rb");
-
-return tbf;
-}
-
-static struct twoBitFile *twoBitOpenReadHeader(char *fileName, boolean useUdc)
-/* Open file, read in header but not index.  
- * Squawk and die if there is a problem. */
-{
-struct twoBitFile *tbf;
-boolean isSwapped = FALSE;
-
-tbf = getTbfAndOpen(fileName, useUdc);
-
-/* Allocate header verify signature, and read in
- * the constant-length bits. */
-
-if (!twoBitSigRead(tbf, &isSwapped))
-    errAbort("%s doesn't have a valid twoBitSig", fileName);
-
-tbf->isSwapped = isSwapped;
-tbf->fileName = cloneString(fileName);
-tbf->version = (*tbf->ourReadBits32)(tbf->f, isSwapped);
-if (tbf->version != 0)
-    {
-    errAbort("Can only handle version 0 of this file. This is version %d",
-    	(int)tbf->version);
-    }
-tbf->seqCount = (*tbf->ourReadBits32)(tbf->f, isSwapped);
-tbf->reserved = (*tbf->ourReadBits32)(tbf->f, isSwapped);
-return tbf;
-}
-
-
-struct twoBitFile *twoBitOpen(char *fileName)
-/* Open file, read in header and index.  
- * Squawk and die if there is a problem. */
-{
-boolean useUdc = FALSE;
-if (hasProtocol(fileName))
-    useUdc = TRUE;
-struct twoBitFile *tbf = twoBitOpenReadHeader(fileName, useUdc);
-struct twoBitIndex *index;
-boolean isSwapped = tbf->isSwapped;
-int i;
-struct hash *hash;
-void *f = tbf->f;
-
-/* Read in index. */
-hash = tbf->hash = hashNew(digitsBaseTwo(tbf->seqCount));
-for (i=0; i<tbf->seqCount; ++i)
-    {
-    char name[256];
-    if (!(*tbf->ourFastReadString)(f, name))
-        errAbort("%s is truncated", fileName);
-    lmAllocVar(hash->lm, index);
-    index->offset = (*tbf->ourReadBits32)(f, isSwapped);
-    hashAddSaveName(hash, name, index, &index->name);
-    slAddHead(&tbf->indexList, index);
-    }
-slReverse(&tbf->indexList);
-return tbf;
-}
-
-struct twoBitFile *twoBitOpenExternalBptIndex(char *twoBitName, char *bptName)
-/* Open file, read in header, but not regular index.  Instead use
- * bpt index.   Beware if you use this the indexList field will be NULL
- * as will the hash. */
-{
-struct twoBitFile *tbf = twoBitOpenReadHeader(twoBitName, FALSE);
-tbf->bpt = bptFileOpen(bptName);
-if (tbf->seqCount != tbf->bpt->itemCount)
-    errAbort("%s and %s don't have same number of sequences!", twoBitName, bptName);
-return tbf;
-}
-
-
-static int findGreatestLowerBound(int blockCount, bits32 *pos, 
-	int val)
-/* Find index of greatest element in posArray that is less 
- * than or equal to val using a binary search. */
-{
-int startIx=0, endIx=blockCount-1, midIx;
-int posVal;
-
-for (;;)
-    {
-    if (startIx == endIx)
-        {
-	posVal = pos[startIx];
-	if (posVal <= val || startIx == 0)
-	    return startIx;
-	else
-	    return startIx-1;
-	}
-    midIx = ((startIx + endIx)>>1);
-    posVal = pos[midIx];
-    if (posVal < val)
-        startIx = midIx+1;
-    else
-        endIx = midIx;
-    }
-}
-
-static void twoBitSeekTo(struct twoBitFile *tbf, char *name)
-/* Seek to start of named record.  Abort if can't find it. */
-{
-if (tbf->bpt)
-    {
-    bits32 offset;
-    if (!bptFileFind(tbf->bpt, name, strlen(name), &offset, sizeof(offset)))
-	 errAbort("%s is not in %s", name, tbf->bpt->fileName);
-    (*tbf->ourSeek)(tbf->f, offset);
-    }
-else
-    {
-    struct twoBitIndex *index = hashFindVal(tbf->hash, name);
-    if (index == NULL)
-	 errAbort("%s is not in %s", name, tbf->fileName);
-    (*tbf->ourSeek)(tbf->f, index->offset);
-    }
-}
-
-static void readBlockCoords(struct twoBitFile *tbf, boolean isSwapped, bits32 *retBlockCount,
-			    bits32 **retBlockStarts, bits32 **retBlockSizes)
-/* Read in blockCount, starts and sizes from file. (Same structure used for
- * both blocks of N's and masked blocks.) */
-{
-bits32 blkCount = (*tbf->ourReadBits32)(tbf->f, isSwapped);
-*retBlockCount = blkCount;
-if (blkCount == 0)
-    {
-    *retBlockStarts = NULL;
-    *retBlockSizes = NULL;
-    }
-else
-    {
-    bits32 *nStarts, *nSizes;
-    AllocArray(nStarts, blkCount);
-    AllocArray(nSizes, blkCount);
-    (*tbf->ourMustRead)(tbf->f, nStarts, sizeof(nStarts[0]) * blkCount);
-    (*tbf->ourMustRead)(tbf->f, nSizes, sizeof(nSizes[0]) * blkCount);
-    if (isSwapped)
-	{
-	int i;
-	for (i=0; i<blkCount; ++i)
-	    {
-	    nStarts[i] = byteSwap32(nStarts[i]);
-	    nSizes[i] = byteSwap32(nSizes[i]);
-	    }
-	}
-    *retBlockStarts = nStarts;
-    *retBlockSizes = nSizes;
-    }
-}
-
-struct twoBit *twoBitOneFromFile(struct twoBitFile *tbf, char *name)
-/* Get single sequence as two bit. */
-{
-bits32 packByteCount;
-boolean isSwapped = tbf->isSwapped;
-struct twoBit *twoBit;
-AllocVar(twoBit);
-twoBit->name = cloneString(name);
-void *f = tbf->f;
-
-/* Find offset in index and seek to it */
-twoBitSeekTo(tbf, name);
-
-/* Read in seqSize. */
-twoBit->size = (*tbf->ourReadBits32)(f, isSwapped);
-
-/* Read in blocks of N. */
-readBlockCoords(tbf, isSwapped, &(twoBit->nBlockCount),
-		&(twoBit->nStarts), &(twoBit->nSizes));
-
-/* Read in masked blocks. */
-readBlockCoords(tbf, isSwapped, &(twoBit->maskBlockCount),
-		&(twoBit->maskStarts), &(twoBit->maskSizes));
-
-/* Reserved word. */
-twoBit->reserved = (*tbf->ourReadBits32)(f, isSwapped);
-
-/* Read in data. */
-packByteCount = packedSize(twoBit->size);
-twoBit->data = needLargeMem(packByteCount);
-(*tbf->ourMustRead)(f, twoBit->data, packByteCount);
-
-return twoBit;
-}
-
-struct twoBit *twoBitFromFile(char *fileName)
-/* Get twoBit list of all sequences in twoBit file. */
-{
-struct twoBitFile *tbf = twoBitOpen(fileName);
-struct twoBitIndex *index;
-struct twoBit *twoBitList = NULL;
-
-for (index = tbf->indexList; index != NULL; index = index->next)
-    {
-    struct twoBit *twoBit = twoBitOneFromFile(tbf, index->name);
-    slAddHead(&twoBitList, twoBit);
-    }
-
-twoBitClose(&tbf);
-slReverse(&twoBitList);
-return twoBitList;
-}
-
-void twoBitFree(struct twoBit **pTwoBit)
-/* Free up a two bit structure. */
-{
-struct twoBit *twoBit = *pTwoBit;
-if (twoBit != NULL)
-    {
-    freeMem(twoBit->nStarts);
-    freeMem(twoBit->nSizes);
-    freeMem(twoBit->maskStarts);
-    freeMem(twoBit->maskSizes);
-    freeMem(twoBit->data);
-    freez(pTwoBit);
-    }
-}
-
-void twoBitFreeList(struct twoBit **pList)
-/* Free a list of dynamically allocated twoBit's */
-{
-struct twoBit *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    twoBitFree(&el);
-    }
-*pList = NULL;
-}
-
-
-struct dnaSeq *twoBitReadSeqFragExt(struct twoBitFile *tbf, char *name,
-	int fragStart, int fragEnd, boolean doMask, int *retFullSize)
-/* Read part of sequence from .2bit file.  To read full
- * sequence call with start=end=0.  Sequence will be lower
- * case if doMask is false, mixed case (repeats in lower)
- * if doMask is true. */
-{
-struct dnaSeq *seq;
-bits32 seqSize;
-bits32 nBlockCount, maskBlockCount;
-bits32 *nStarts = NULL, *nSizes = NULL;
-bits32 *maskStarts = NULL, *maskSizes = NULL;
-boolean isSwapped = tbf->isSwapped;
-void *f = tbf->f;
-int i;
-int packByteCount, packedStart, packedEnd, remainder, midStart, midEnd;
-int outSize;
-UBYTE *packed, *packedAlloc;
-DNA *dna;
-
-/* Find offset in index and seek to it */
-dnaUtilOpen();
-twoBitSeekTo(tbf, name);
-
-/* Read in seqSize. */
-seqSize = (*tbf->ourReadBits32)(f, isSwapped);
-if (fragEnd == 0)
-    fragEnd = seqSize;
-if (fragEnd > seqSize)
-    errAbort("twoBitReadSeqFrag in %s end (%d) >= seqSize (%d)", name, fragEnd, seqSize);
-outSize = fragEnd - fragStart;
-if (outSize < 1)
-    errAbort("twoBitReadSeqFrag in %s start (%d) >= end (%d)", name, fragStart, fragEnd);
-
-/* Read in blocks of N. */
-readBlockCoords(tbf, isSwapped, &nBlockCount, &nStarts, &nSizes);
-
-/* Read in masked blocks. */
-readBlockCoords(tbf, isSwapped, &maskBlockCount, &maskStarts, &maskSizes);
-
-/* Skip over reserved word. */
-(*tbf->ourReadBits32)(f, isSwapped);
-
-/* Allocate dnaSeq, and fill in zero tag at end of sequence. */
-AllocVar(seq);
-if (outSize == seqSize)
-    seq->name = cloneString(name);
-else
-    {
-    char buf[256*2];
-    safef(buf, sizeof(buf), "%s:%d-%d", name, fragStart, fragEnd);
-    seq->name = cloneString(buf);
-    }
-seq->size = outSize;
-dna = seq->dna = needLargeMem(outSize+1);
-seq->dna[outSize] = 0;
-
-
-/* Skip to bits we need and read them in. */
-packedStart = (fragStart>>2);
-packedEnd = ((fragEnd+3)>>2);
-packByteCount = packedEnd - packedStart;
-packed = packedAlloc = needLargeMem(packByteCount);
-(*tbf->ourSeekCur)(f, packedStart);
-(*tbf->ourMustRead)(f, packed, packByteCount);
-
-/* Handle case where everything is in one packed byte */
-if (packByteCount == 1)
-    {
-    int pOff = (packedStart<<2);
-    int pStart = fragStart - pOff;
-    int pEnd = fragEnd - pOff;
-    UBYTE partial = *packed;
-    assert(pEnd <= 4);
-    assert(pStart >= 0);
-    for (i=pStart; i<pEnd; ++i)
-	*dna++ = valToNt[(partial >> (6-i-i)) & 3];
-    }
-else
-    {
-    /* Handle partial first packed byte. */
-    midStart = fragStart;
-    remainder = (fragStart&3);
-    if (remainder > 0)
-	{
-	UBYTE partial = *packed++;
-	int partCount = 4 - remainder;
-	for (i=partCount-1; i>=0; --i)
-	    {
-	    dna[i] = valToNt[partial&3];
-	    partial >>= 2;
-	    }
-	midStart += partCount;
-	dna += partCount;
-	}
-
-    /* Handle middle bytes. */
-    remainder = fragEnd&3;
-    midEnd = fragEnd - remainder;
-    for (i=midStart; i<midEnd; i += 4)
-        {
-	UBYTE b = *packed++;
-	dna[3] = valToNt[b&3];
-	b >>= 2;
-	dna[2] = valToNt[b&3];
-	b >>= 2;
-	dna[1] = valToNt[b&3];
-	b >>= 2;
-	dna[0] = valToNt[b&3];
-	dna += 4;
-	}
-
-    if (remainder >0)
-	{
-	UBYTE part = *packed;
-	part >>= (8-remainder-remainder);
-	for (i=remainder-1; i>=0; --i)
-	    {
-	    dna[i] = valToNt[part&3];
-	    part >>= 2;
-	    }
-	}
-    }
-freez(&packedAlloc);
-
-if (nBlockCount > 0)
-    {
-    int startIx = findGreatestLowerBound(nBlockCount, nStarts, fragStart);
-    for (i=startIx; i<nBlockCount; ++i)
-        {
-	int s = nStarts[i];
-	int e = s + nSizes[i];
-	if (s >= fragEnd)
-	    break;
-	if (s < fragStart)
-	   s = fragStart;
-	if (e > fragEnd)
-	   e = fragEnd;
-	if (s < e)
-	    memset(seq->dna + s - fragStart, 'n', e - s);
-	}
-    }
-
-if (doMask)
-    {
-    toUpperN(seq->dna, seq->size);
-    if (maskBlockCount > 0)
-	{
-	int startIx = findGreatestLowerBound(maskBlockCount, maskStarts, 
-		fragStart);
-	for (i=startIx; i<maskBlockCount; ++i)
-	    {
-	    int s = maskStarts[i];
-	    int e = s + maskSizes[i];
-	    if (s >= fragEnd)
-		break;
-	    if (s < fragStart)
-		s = fragStart;
-	    if (e > fragEnd)
-		e = fragEnd;
-	    if (s < e)
-		toLowerN(seq->dna + s - fragStart, e - s);
-	    }
-	}
-    }
-freez(&nStarts);
-freez(&nSizes);
-freez(&maskStarts);
-freez(&maskSizes);
-if (retFullSize != NULL)
-    *retFullSize = seqSize;
-return seq;
-}
-
-struct dnaSeq *twoBitReadSeqFrag(struct twoBitFile *tbf, char *name,
-	int fragStart, int fragEnd)
-/* Read part of sequence from .2bit file.  To read full
- * sequence call with start=end=0.  Note that sequence will
- * be mixed case, with repeats in lower case and rest in
- * upper case. */
-{
-return twoBitReadSeqFragExt(tbf, name, fragStart, fragEnd, TRUE, NULL);
-}
-
-struct dnaSeq *twoBitReadSeqFragLower(struct twoBitFile *tbf, char *name,
-	int fragStart, int fragEnd)
-/* Same as twoBitReadSeqFrag, but sequence is returned in lower case. */
-{
-return twoBitReadSeqFragExt(tbf, name, fragStart, fragEnd, FALSE, NULL);
-}
-
-int twoBitSeqSize(struct twoBitFile *tbf, char *name)
-/* Return size of sequence in two bit file in bases. */
-{
-twoBitSeekTo(tbf, name);
-return (*tbf->ourReadBits32)(tbf->f, tbf->isSwapped);
-}
-
-long long twoBitTotalSize(struct twoBitFile *tbf)
-/* Return total size of all sequences in two bit file. */
-{
-struct twoBitIndex *index;
-long long totalSize = 0;
-for (index = tbf->indexList; index != NULL; index = index->next)
-    {
-    (*tbf->ourSeek)(tbf->f, index->offset);
-    totalSize += (*tbf->ourReadBits32)(tbf->f, tbf->isSwapped);
-    }
-return totalSize;
-}
-
-struct dnaSeq *twoBitLoadAll(char *spec)
-/* Return list of all sequences matching spec, which is in
- * the form:
- *
- *    file/path/input.2bit[:seqSpec1][,seqSpec2,...]
- *
- * where seqSpec is either
- *     seqName
- *  or
- *     seqName:start-end */
-{
-struct twoBitSpec *tbs = twoBitSpecNew(spec);
-struct twoBitFile *tbf = twoBitOpen(tbs->fileName);
-struct dnaSeq *list = NULL;
-if (tbs->seqs != NULL)
-    {
-    struct twoBitSeqSpec *tbss;
-    for (tbss = tbs->seqs; tbss != NULL; tbss = tbss->next)
-        slSafeAddHead(&list, twoBitReadSeqFrag(tbf, tbss->name,
-                                               tbss->start, tbss->end));
-    }
-else
-    {
-    struct twoBitIndex *index;
-    for (index = tbf->indexList; index != NULL; index = index->next)
-	slSafeAddHead(&list, twoBitReadSeqFrag(tbf, index->name, 0, 0));
-    }
-slReverse(&list);
-twoBitClose(&tbf);
-twoBitSpecFree(&tbs);
-return list;
-}
-
-struct slName *twoBitSeqNames(char *fileName)
-/* Get list of all sequences in twoBit file. */
-{
-struct twoBitFile *tbf = twoBitOpen(fileName);
-struct twoBitIndex *index;
-struct slName *name, *list = NULL;
-for (index = tbf->indexList; index != NULL; index = index->next)
-    {
-    name = slNameNew(index->name);
-    slAddHead(&list, name);
-    }
-twoBitClose(&tbf);
-slReverse(&list);
-return list;
-}
-
-boolean twoBitIsFile(char *fileName)
-/* Return TRUE if file is in .2bit format. */
-{
-boolean useUdc = FALSE;
-if (hasProtocol(fileName))
-    useUdc = TRUE;
-else if (!isRegularFile(fileName))
-    return FALSE;
-
-struct twoBitFile *tbf = getTbfAndOpen(fileName, useUdc);
-boolean isSwapped;
-boolean isTwoBit = twoBitSigRead(tbf, &isSwapped);
-
-(*tbf->ourClose)(&tbf->f);
-
-return isTwoBit;
-}
-
-boolean twoBitParseRange(char *rangeSpec, char **retFile, 
-	char **retSeq, int *retStart, int *retEnd)
-/* Parse out something in format
- *    file/path/name:seqName:start-end
- * or
- *    file/path/name:seqName
- * or
- *    file/path/name:seqName1,seqName2,seqName3,...
- * This will destroy the input 'rangeSpec' in the process.  Returns FALSE if
- * it doesn't fit this format, setting retFile to rangeSpec, and retSet to
- * null.  If it is the shorter form then start and end will both be returned
- * as zero, which is ok by twoBitReadSeqFrag.  Any of the return arguments
- * maybe NULL.
- */
-{
-char *s, *e;
-int n;
-
-/* default returns */
-if (retFile != NULL)
-    *retFile = rangeSpec;
-if (retSeq != NULL)
-    *retSeq = NULL;
-if (retStart != NULL)
-    *retStart = 0;
-if (retEnd != NULL)
-    *retEnd = 0;
-
-/* start with final name  */
-s = strrchr(rangeSpec, '/');
-if (s == NULL)
-    s = rangeSpec;
-else
-    s++;
-
-/* Grab seqName, zero terminate fileName. */
-s = strchr(s, ':');
-if (s == NULL)
-    return FALSE;
-*s++ = 0;
-if (retSeq != NULL)
-    *retSeq = s;
-
-/* Grab start, zero terminate seqName. */
-s = strchr(s, ':');
-if (s == NULL)
-    return TRUE;  /* no range spec */
-*s++ = 0;
-n = strtol(s, &e, 0);
-if (*e != '-')
-    return FALSE; /* not a valid range */
-if (retStart != NULL)
-    *retStart = n;
-s = e+1;
-
-/* Grab end. */
-n = strtol(s, &e, 0);
-if (*e != '\0')
-    return FALSE; /* not a valid range */
-if (retEnd != NULL)
-    *retEnd = n;
-return TRUE;
-}
-
-boolean twoBitIsRange(char *rangeSpec)
-/* Return TRUE if it looks like a two bit range specifier. */
-{
-char *dupe = cloneString(rangeSpec);
-char *file, *seq;
-int start, end;
-boolean isRange = twoBitParseRange(dupe, &file, &seq, &start, &end);
-if (isRange)
-    isRange = twoBitIsFile(file);
-freeMem(dupe);
-return isRange;
-}
-
-boolean twoBitIsFileOrRange(char *spec)
-/* Return TRUE if it is a two bit file or subrange. */
-{
-return twoBitIsFile(spec) || twoBitIsRange(spec);
-}
-
-static struct twoBitSeqSpec *parseSeqSpec(char *seqSpecStr)
-/* parse one sequence spec */
-{
-boolean isOk = TRUE;
-char *s, *e;
-struct twoBitSeqSpec *seq;
-AllocVar(seq);
-seq->name = cloneString(seqSpecStr);
-
-/* Grab start */
-s = strchr(seq->name, ':');
-if (s == NULL)
-    return seq;  /* no range spec */
-*s++ = 0;
-seq->start = strtol(s, &e, 0);
-if (*e != '-')
-    isOk = FALSE;
-else
-    {
-    /* Grab end */
-    s = e+1;
-    seq->end = strtol(s, &e, 0);
-    if (*e != '\0')
-        isOk = FALSE;
-    }
-if (!isOk || (seq->end < seq->start))
-    errAbort("invalid twoBit sequence specification: \"%s\"", seqSpecStr);
-return seq;
-}
-
-boolean twoBitIsSpec(char *spec)
-/* Return TRUE spec is a valid 2bit spec (see twoBitSpecNew) */
-{
-struct twoBitSpec *tbs = twoBitSpecNew(spec);
-boolean isSpec = (tbs != NULL);
-twoBitSpecFree(&tbs);
-return isSpec;
-}
-
-struct twoBitSpec *twoBitSpecNew(char *specStr)
-/* Parse a .2bit file and sequence spec into an object.
- * The spec is a string in the form:
- *
- *    file/path/input.2bit[:seqSpec1][,seqSpec2,...]
- *
- * where seqSpec is either
- *     seqName
- *  or
- *     seqName:start-end
- *
- * free result with twoBitSpecFree().
- */
-{
-char *s, *e;
-int i, numSeqs;
-char **seqSpecs;
-struct twoBitSpec *spec;
-AllocVar(spec);
-spec->fileName = cloneString(specStr);
-
-/* start with final file name  */
-s = strrchr(spec->fileName, '/');
-if (s == NULL)
-    s = spec->fileName;
-else
-    s++;
-
-/* find end of file name and zero-terminate */
-e = strchr(s, ':');
-if (e == NULL)
-    s = NULL; /* just file name */
-else
-    {
-    *e++ = '\0';
-    s = e;
-    }
-
-if (!twoBitIsFile(spec->fileName))
-    {
-    twoBitSpecFree(&spec);
-    return NULL; /* not a 2bit file */
-    }
-
-if (s != NULL)
-    {
-    /* chop seqs at commas and parse */
-    numSeqs = chopString(s, ",", NULL, 0);
-    AllocArray(seqSpecs, numSeqs);
-    chopString(s, ",", seqSpecs, numSeqs);
-    for (i = 0; i< numSeqs; i++)
-        slSafeAddHead(&spec->seqs, parseSeqSpec(seqSpecs[i]));
-    slReverse(&spec->seqs);
-    }
-return spec;
-}
-
-struct twoBitSpec *twoBitSpecNewFile(char *twoBitFile, char *specFile)
-/* parse a file containing a list of specifications for sequences in the
- * specified twoBit file. Specifications are one per line in forms:
- *     seqName
- *  or
- *     seqName:start-end
- */
-{
-struct lineFile *lf = lineFileOpen(specFile, TRUE);
-char *line;
-struct twoBitSpec *spec;
-AllocVar(spec);
-spec->fileName = cloneString(twoBitFile);
-while (lineFileNextReal(lf, &line))
-    slSafeAddHead(&spec->seqs, parseSeqSpec(trimSpaces(line)));
-slReverse(&spec->seqs);
-lineFileClose(&lf);
-return spec;
-}
-
-void twoBitSpecFree(struct twoBitSpec **specPtr)
-/* free a twoBitSpec object */
-{
-struct twoBitSpec *spec = *specPtr;
-if (spec != NULL)
-    {
-    struct twoBitSeqSpec *seq;
-    while ((seq = slPopHead(&spec->seqs)) != NULL)
-        {
-        freeMem(seq->name);
-        freeMem(seq);
-        }
-    freeMem(spec->fileName);
-    freeMem(spec);
-    *specPtr = NULL;
-    }
-}
-
-void twoBitOutNBeds(struct twoBitFile *tbf, char *seqName, FILE *outF)
-/* output a series of bed3's that enumerate the number of N's in a sequence*/
-{
-int nBlockCount;
-
-twoBitSeekTo(tbf, seqName);
-
-(*tbf->ourReadBits32)(tbf->f, tbf->isSwapped);
-
-/* Read in blocks of N. */
-nBlockCount = (*tbf->ourReadBits32)(tbf->f, tbf->isSwapped);
-
-if (nBlockCount > 0)
-    {
-    bits32 *nStarts = NULL, *nSizes = NULL;
-    int i;
-
-    AllocArray(nStarts, nBlockCount);
-    AllocArray(nSizes, nBlockCount);
-    (*tbf->ourMustRead)(tbf->f, nStarts, sizeof(nStarts[0]) * nBlockCount);
-    (*tbf->ourMustRead)(tbf->f, nSizes, sizeof(nSizes[0]) * nBlockCount);
-    if (tbf->isSwapped)
-	{
-	for (i=0; i<nBlockCount; ++i)
-	    {
-	    nStarts[i] = byteSwap32(nStarts[i]);
-	    nSizes[i] = byteSwap32(nSizes[i]);
-	    }
-	}
-
-    for (i=0; i<nBlockCount; ++i)
-	{
-	fprintf(outF, "%s\t%d\t%d\n", seqName, nStarts[i], nStarts[i] + nSizes[i]);
-	}
-
-    freez(&nStarts);
-    freez(&nSizes);
-    }
-}
-
-int twoBitSeqSizeNoNs(struct twoBitFile *tbf, char *seqName)
-/* return the size of the sequence, not counting N's*/
-{
-int nBlockCount;
-int size;
-
-twoBitSeekTo(tbf, seqName);
-
-size = (*tbf->ourReadBits32)(tbf->f, tbf->isSwapped);
-
-/* Read in blocks of N. */
-nBlockCount = (*tbf->ourReadBits32)(tbf->f, tbf->isSwapped);
-
-if (nBlockCount > 0)
-    {
-    bits32 *nStarts = NULL, *nSizes = NULL;
-    
-    int i;
-
-    AllocArray(nStarts, nBlockCount);
-    AllocArray(nSizes, nBlockCount);
-    (*tbf->ourMustRead)(tbf->f, nStarts, sizeof(nStarts[0]) * nBlockCount);
-    (*tbf->ourMustRead)(tbf->f, nSizes, sizeof(nSizes[0]) * nBlockCount);
-    if (tbf->isSwapped)
-	{
-	for (i=0; i<nBlockCount; ++i)
-	    {
-	    nStarts[i] = byteSwap32(nStarts[i]);
-	    nSizes[i] = byteSwap32(nSizes[i]);
-	    }
-	}
-
-    for (i=0; i<nBlockCount; ++i)
-	{
-	size -= nSizes[i];
-	}
-
-    freez(&nStarts);
-    freez(&nSizes);
-    }
-
-return(size);
-}
-
-long long twoBitTotalSizeNoN(struct twoBitFile *tbf)
-/* return the size of the all the sequence in file, not counting N's*/
-{
-struct twoBitIndex *index;
-long long totalSize = 0;
-for (index = tbf->indexList; index != NULL; index = index->next)
-    {
-    int size = twoBitSeqSizeNoNs(tbf, index->name);
-    totalSize += size;
-    }
-return totalSize;
-}
-
-boolean twoBitIsSequence(struct twoBitFile *tbf, char *chromName)
-/* Return TRUE if chromName is in 2bit file. */
-{
-return (hashFindVal(tbf->hash, chromName) != NULL);
-}
diff --git a/gbtools/src/blatSrc/lib/udc.c b/gbtools/src/blatSrc/lib/udc.c
deleted file mode 100644
index 39fd825..0000000
--- a/gbtools/src/blatSrc/lib/udc.c
+++ /dev/null
@@ -1,1686 +0,0 @@
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-/* udc - url data cache - a caching system that keeps blocks of data fetched from URLs in
- * sparse local files for quick use the next time the data is needed. 
- *
- * This cache is enormously simplified by there being no local _write_ to the cache,
- * just reads.  
- *
- * The overall strategy of the implementation is to have a root cache directory
- * with a subdir for each file being cached.  The directory for a single cached file
- * contains two files - "bitmap" and "sparseData" that contains information on which
- * parts of the URL are cached and the actual cached data respectively. The subdirectory name
- * associated with the file is constructed from the URL in a straightforward manner.
- *     http://genome.ucsc.edu/cgi-bin/hgGateway
- * gets mapped to:
- *     rootCacheDir/http/genome.ucsc.edu/cgi-bin/hgGateway/
- * The URL protocol is the first directory under the root, and the remainder of the
- * URL, with some necessary escaping, is used to define the rest of the cache directory
- * structure, with each '/' after the protocol line translating into another directory
- * level.
- *    
- * The bitmap file contains time stamp and size data as well as an array with one bit
- * for each block of the file that has been fetched.  Currently the block size is 8K. */
-
-#include <sys/file.h>
-#include "common.h"
-#include "hash.h"
-#include "obscure.h"
-#include "bits.h"
-#include "linefile.h"
-#include "portable.h"
-#include "sig.h"
-#include "net.h"
-#include "cheapcgi.h"
-#include "udc.h"
-
-
-#define udcBlockSize (8*1024)
-/* All fetch requests are rounded up to block size. */
-
-#define udcMaxBytesPerRemoteFetch (udcBlockSize * 32)
-/* Very large remote reads are broken down into chunks this size. */
-
-struct connInfo
-/* Socket descriptor and associated info, for keeping net connections open. */
-    {
-    int socket;                 /* Socket descriptor for data connection (or 0). */
-    bits64 offset;		/* Current file offset of socket. */
-    int ctrlSocket;             /* (FTP only) Control socket descriptor or 0. */
-    };
-
-typedef int (*UdcDataCallback)(char *url, bits64 offset, int size, void *buffer,
-			       struct connInfo *ci);
-/* Type for callback function that fetches file data. */
-
-struct udcRemoteFileInfo
-/* Information about a remote file. */
-    {
-    bits64 updateTime;	/* Last update in seconds since 1970 */
-    bits64 size;	/* Remote file size */
-    struct connInfo ci; /* Connection info for open net connection */
-    };
-
-typedef boolean (*UdcInfoCallback)(char *url, struct udcRemoteFileInfo *retInfo);
-/* Type for callback function that fetches file timestamp and size. */
-
-struct udcProtocol
-/* Something to handle a communications protocol like http, https, ftp, local file i/o, etc. */
-    {
-    struct udcProtocol *next;	/* Next in list */
-    UdcDataCallback fetchData;	/* Data fetcher */
-    UdcInfoCallback fetchInfo;	/* Timestamp & size fetcher */
-    };
-
-struct udcFile
-/* A file handle for our caching system. */
-    {
-    struct udcFile *next;	/* Next in list. */
-    char *url;			/* Name of file - includes protocol */
-    char *protocol;		/* The URL up to the first colon.  http: etc. */
-    struct udcProtocol *prot;	/* Protocol specific data and methods. */
-    time_t updateTime;		/* Last modified timestamp. */
-    bits64 size;		/* Size of file. */
-    bits64 offset;		/* Current offset in file. */
-    char *cacheDir;		/* Directory for cached file parts. */
-    char *bitmapFileName;	/* Name of bitmap file. */
-    char *sparseFileName;	/* Name of sparse data file. */
-    int fdSparse;		/* File descriptor for sparse data file. */
-    boolean sparseReadAhead;    /* Read-ahead has something in the buffer */
-    char *sparseReadAheadBuf;   /* Read-ahead buffer, if any */
-    bits64 sparseRAOffset;      /* Read-ahead buffer offset */
-    struct udcBitmap *bits;     /* udcBitMap */
-    bits64 startData;		/* Start of area in file we know to have data. */
-    bits64 endData;		/* End of area in file we know to have data. */
-    bits32 bitmapVersion;	/* Version of associated bitmap we were opened with. */
-    struct connInfo connInfo;   /* Connection info for open net connection. */
-    };
-
-struct udcBitmap
-/* The control structure including the bitmap of blocks that are cached. */
-    {
-    struct udcBitmap *next;	/* Next in list. */
-    bits32 blockSize;		/* Number of bytes per block of file. */
-    bits64 remoteUpdate;	/* Remote last update time. */
-    bits64 fileSize;		/* File size */
-    bits32 version;		/* Version - increments each time cache is stale. */
-    bits64 localUpdate;		/* Time we last fetched new data into cache. */
-    bits64 localAccess;		/* Time we last accessed data. */
-    boolean isSwapped;		/* If true need to swap all bytes on read. */
-    int fd;			/* File descriptor for file with current block. */
-    };
-static char *bitmapName = "bitmap";
-static char *sparseDataName = "sparseData";
-#define udcBitmapHeaderSize (64)
-static int cacheTimeout = 0;
-
-#define MAX_SKIP_TO_SAVE_RECONNECT (udcMaxBytesPerRemoteFetch / 2)
-
-static void readAndIgnore(int sd, bits64 size)
-/* Read size bytes from sd and return. */
-{
-static char *buf = NULL;
-if (buf == NULL)
-    buf = needMem(udcBlockSize);
-bits64 remaining = size, total = 0;
-while (remaining > 0)
-    {
-    bits64 chunkSize = min(remaining, udcBlockSize);
-    ssize_t rd = read(sd, buf, chunkSize);
-    if (rd < 0)
-	errnoAbort("readAndIgnore: error reading socket after %lld bytes", total);
-    remaining -= rd;
-    total += rd;
-    }
-if (total < size)
-    errAbort("readAndIgnore: got EOF at %lld bytes (wanted %lld)", total, size);
-}
-
-static int connInfoGetSocket(struct connInfo *ci, char *url, bits64 offset, int size)
-/* If ci has an open socket and the given offset matches ci's current offset,
- * reuse ci->socket.  Otherwise close the socket, open a new one, and update ci,
- * or return -1 if there is an error opening a new one. */
-{
-if (ci != NULL && ci->socket > 0 && ci->offset != offset)
-    {
-    bits64 skipSize = (offset - ci->offset);
-    if (skipSize > 0 && skipSize <= MAX_SKIP_TO_SAVE_RECONNECT)
-	{
-	verbose(2, "!! skipping %lld bytes @%lld to avoid reconnect\n", skipSize, ci->offset);
-	readAndIgnore(ci->socket, skipSize);
-	ci->offset = offset;
-	}
-    else
-	{
-	verbose(2, "Offset mismatch (ci %lld != new %lld), reopening.\n", ci->offset, offset);
-	mustCloseFd(&(ci->socket));
-	if (ci->ctrlSocket > 0)
-	    mustCloseFd(&(ci->ctrlSocket));
-	ZeroVar(ci);
-	}
-    }
-int sd;
-if (ci == NULL || ci->socket <= 0)
-    {
-    char rangeUrl[2048];
-    if (ci == NULL)
-	{
-	safef(rangeUrl, sizeof(rangeUrl), "%s;byterange=%lld-%lld",
-	      url, offset, (offset + size - 1));
-	sd = netUrlOpen(rangeUrl);
-	}
-    else
-	{
-	safef(rangeUrl, sizeof(rangeUrl), "%s;byterange=%lld-", url, offset);
-	sd = ci->socket = netUrlOpenSockets(rangeUrl, &(ci->ctrlSocket));
-	ci->offset = offset;
-	}
-    if (sd < 0)
-	return -1;
-    if (startsWith("http", url))
-	{
-	char *newUrl = NULL;
-	int newSd = 0;
-	if (!netSkipHttpHeaderLinesHandlingRedirect(sd, rangeUrl, &newSd, &newUrl))
-	    return -1;
-	if (newUrl)
-	    {
-	    freeMem(newUrl); 
-	    sd = newSd;
-	    if (ci != NULL)
-		ci->socket = newSd;
-	    }
-	}
-    }
-else
-    sd = ci->socket;
-return sd;
-}
-
-/********* Section for local file protocol **********/
-
-static char *assertLocalUrl(char *url)
-/* Make sure that url is local and return bits past the protocol. */
-{
-if (startsWith("local:", url))
-    url += 6;
-if (url[0] != '/')
-    errAbort("Local urls must start at /");
-if (stringIn("..", url) || stringIn("~", url) || stringIn("//", url) ||
-    stringIn("/./", url) || endsWith("/.", url))
-    {
-    errAbort("relative paths not allowed in local urls (%s)", url);
-    }
-return url;
-}
-
-static int udcDataViaLocal(char *url, bits64 offset, int size, void *buffer, struct connInfo *ci)
-/* Fetch a block of data of given size into buffer using the http: protocol.
-* Returns number of bytes actually read.  Does an errAbort on
-* error.  Typically will be called with size in the 8k - 64k range. */
-{
-/* Need to check time stamp here. */
-verbose(2, "reading remote data - %d bytes at %lld - on %s\n", size, offset, url);
-url = assertLocalUrl(url);
-FILE *f = mustOpen(url, "rb");
-fseek(f, offset, SEEK_SET);
-int sizeRead = fread(buffer, 1, size, f);
-if (ferror(f))
-    {
-    warn("udcDataViaLocal failed to fetch %d bytes at %lld", size, offset);
-    errnoAbort("file %s", url);
-    }
-carefulClose(&f);
-return sizeRead;
-}
-
-static boolean udcInfoViaLocal(char *url, struct udcRemoteFileInfo *retInfo)
-/* Fill in *retTime with last modified time for file specified in url.
- * Return FALSE if file does not even exist. */
-{
-verbose(2, "checking remote info on %s\n", url);
-url = assertLocalUrl(url);
-struct stat status;
-int ret = stat(url, &status);
-if (ret < 0)
-    return FALSE;
-retInfo->updateTime = status.st_mtime;
-retInfo->size = status.st_size;
-return TRUE;
-}
-
-/********* Section for transparent file protocol **********/
-
-static int udcDataViaTransparent(char *url, bits64 offset, int size, void *buffer,
-				 struct connInfo *ci)
-/* Fetch a block of data of given size into buffer using the http: protocol.
-* Returns number of bytes actually read.  Does an errAbort on
-* error.  Typically will be called with size in the 8k - 64k range. */
-{
-internalErr();	/* Should not get here. */
-return size;
-}
-
-static boolean udcInfoViaTransparent(char *url, struct udcRemoteFileInfo *retInfo)
-/* Fill in *retInfo with last modified time for file specified in url.
- * Return FALSE if file does not even exist. */
-{
-internalErr();	/* Should not get here. */
-return FALSE;
-}
-
-/********* Section for slow local file protocol - simulates network... **********/
-
-static int udcDataViaSlow(char *url, bits64 offset, int size, void *buffer, struct connInfo *ci)
-/* Fetch a block of data of given size into buffer using the http: protocol.
-* Returns number of bytes actually read.  Does an errAbort on
-* error.  Typically will be called with size in the 8k - 64k range. */
-{
-verbose(2, "slow reading remote data - %d bytes at %lld - on %s\n", size, offset, url);
-sleep1000(500);
-char *fileName = url + 5;  /* skip over 'slow:' */
-FILE *f = mustOpen(fileName, "rb");
-fseek(f, offset, SEEK_SET);
-char *pt = buffer;
-int i, step=1024;
-int sizeRead = 0;
-for (i=0; i<size; i += step)
-    {
-    sleep1000(250);
-    int readChunk = size - i;
-    if (readChunk > step)
-        readChunk = step;
-    int oneReadSize = fread(pt, 1, readChunk, f);
-    verbose(2, "slowly read %d bytes\n", oneReadSize);
-    if (ferror(f))
-	{
-	warn("udcDataViaSlow failed to fetch %d bytes at %lld", size, offset);
-	errnoAbort("file %s", fileName);
-	}
-    pt += step;
-    sizeRead += oneReadSize;
-    }
-carefulClose(&f);
-return sizeRead;
-}
-
-static boolean udcInfoViaSlow(char *url, struct udcRemoteFileInfo *retInfo)
-/* Fill in *retTime with last modified time for file specified in url.
- * Return FALSE if file does not even exist. */
-{
-char *fileName = url + 5;  /* skip over 'slow:' */
-verbose(2, "slow checking remote info on %s\n", url);
-sleep1000(500);
-struct stat status;
-int ret = stat(fileName, &status);
-if (ret < 0)
-    return FALSE;
-retInfo->updateTime = status.st_mtime;
-retInfo->size = status.st_size;
-return TRUE;
-}
-
-/********* Section for http protocol **********/
-
-int udcDataViaHttpOrFtp(char *url, bits64 offset, int size, void *buffer, struct connInfo *ci)
-/* Fetch a block of data of given size into buffer using url's protocol,
- * which must be http, https or ftp.  Returns number of bytes actually read.
- * Does an errAbort on error.
- * Typically will be called with size in the 8k-64k range. */
-{
-if (startsWith("http://",url) || startsWith("https://",url) || startsWith("ftp://",url))
-    verbose(2, "reading http/https/ftp data - %d bytes at %lld - on %s\n", size, offset, url);
-else
-    errAbort("Invalid protocol in url [%s] in udcDataViaFtp, only http, https, or ftp supported",
-	     url); 
-int sd = connInfoGetSocket(ci, url, offset, size);
-if (sd < 0)
-    errAbort("Can't get data socket for %s", url);
-int rd = 0, total = 0, remaining = size;
-char *buf = (char *)buffer;
-while ((remaining > 0) && ((rd = read(sd, buf, remaining)) > 0))
-    {
-    total += rd;
-    buf += rd;
-    remaining -= rd;
-    }
-if (rd == -1)
-    errnoAbort("udcDataViaHttpOrFtp: error reading socket");
-if (ci == NULL)
-    mustCloseFd(&sd);
-else
-    ci->offset += total;
-return total;
-}
-
-boolean udcInfoViaHttp(char *url, struct udcRemoteFileInfo *retInfo)
-/* Gets size and last modified time of URL
- * and returns status of HEAD GET. */
-{
-verbose(2, "checking http remote info on %s\n", url);
-struct hash *hash = newHash(0);
-int status = netUrlHead(url, hash);
-if (status != 200) // && status != 302 && status != 301)
-    return FALSE;
-char *sizeString = hashFindValUpperCase(hash, "Content-Length:");
-if (sizeString == NULL)
-    {
-    /* try to get remote file size by an alternate method */
-    long long retSize = netUrlSizeByRangeResponse(url);
-    if (retSize < 0)
-	{
-    	hashFree(&hash);
-	errAbort("No Content-Length: returned in header for %s, can't proceed, sorry", url);
-	}
-    retInfo->size = retSize;
-    }
-else
-    {
-    retInfo->size = atoll(sizeString);
-    }
-
-char *lastModString = hashFindValUpperCase(hash, "Last-Modified:");
-if (lastModString == NULL)
-    {
-    // Date is a poor substitute!  It will always appear that the cache is stale.
-    // But at least we can read files from dropbox.com.
-    lastModString = hashFindValUpperCase(hash, "Date:");
-    if (lastModString == NULL)
-	{
-	hashFree(&hash);
-	errAbort("No Last-Modified: or Date: returned in header for %s, can't proceed, sorry", url);
-	}
-    }
-struct tm tm;
-time_t t;
-// Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
-// This will always be GMT
-if (strptime(lastModString, "%a, %d %b %Y %H:%M:%S %Z", &tm) == NULL)
-    { /* Handle error */;
-    hashFree(&hash);
-    errAbort("unable to parse last-modified string [%s]", lastModString);
-    }
-t = mktimeFromUtc(&tm);
-if (t == -1)
-    { /* Handle error */;
-    hashFree(&hash);
-    errAbort("mktimeFromUtc failed while converting last-modified string [%s] from UTC time", lastModString);
-    }
-retInfo->updateTime = t;
-
-hashFree(&hash);
-return status;
-}
-
-
-/********* Section for ftp protocol **********/
-
-// fetchData method: See udcDataViaHttpOrFtp above.
-
-boolean udcInfoViaFtp(char *url, struct udcRemoteFileInfo *retInfo)
-/* Gets size and last modified time of FTP URL */
-{
-verbose(2, "checking ftp remote info on %s\n", url);
-long long size = 0;
-time_t t, tUtc;
-struct tm *tm = NULL;
-// TODO: would be nice to add int *retCtrlSocket to netGetFtpInfo so we can stash 
-// in retInfo->connInfo and keep socket open.
-boolean ok = netGetFtpInfo(url, &size, &tUtc);
-if (!ok)
-    return FALSE;
-// Convert UTC to localtime
-tm = localtime(&tUtc);
-t = mktimeFromUtc(tm);
-if (t == -1)
-    { /* Handle error */;
-    errAbort("mktimeFromUtc failed while converting FTP UTC last-modified time %ld to local time", (long) tUtc);
-    }
-retInfo->size = size;
-retInfo->updateTime = t;
-return TRUE;
-}
-
-
-/********* Non-protocol-specific bits **********/
-
-boolean udcFastReadString(struct udcFile *f, char buf[256])
-/* Read a string into buffer, which must be long enough
- * to hold it.  String is in 'writeString' format. */
-{
-UBYTE bLen;
-int len;
-if (!udcReadOne(f, bLen))
-    return FALSE;
-if ((len = bLen)> 0)
-    udcMustRead(f, buf, len);
-buf[len] = 0;
-return TRUE;
-}
-
-void msbFirstWriteBits64(FILE *f, bits64 x);
-
-static char *fileNameInCacheDir(struct udcFile *file, char *fileName)
-/* Return the name of a file in the cache dir, from the cache root directory on down.
- * Do a freeMem on this when done. */
-{
-int dirLen = strlen(file->cacheDir);
-int nameLen = strlen(fileName);
-char *path = needMem(dirLen + nameLen + 2);
-memcpy(path, file->cacheDir, dirLen);
-path[dirLen] = '/';
-memcpy(path+dirLen+1, fileName, nameLen);
-return path;
-}
-
-static void udcNewCreateBitmapAndSparse(struct udcFile *file, 
-	bits64 remoteUpdate, bits64 remoteSize, bits32 version)
-/* Create a new bitmap file around the given remoteUpdate time. */
-{
-int fd = mustOpenFd(file->bitmapFileName, O_WRONLY | O_CREAT | O_TRUNC);
-bits32 sig = udcBitmapSig;
-bits32 blockSize = udcBlockSize;
-bits64 reserved64 = 0;
-bits32 reserved32 = 0;
-int blockCount = (remoteSize + udcBlockSize - 1)/udcBlockSize;
-int bitmapSize = bitToByteSize(blockCount);
-
-/* Write out fixed part of header. */
-writeOneFd(fd, sig);
-writeOneFd(fd, blockSize);
-writeOneFd(fd, remoteUpdate);
-writeOneFd(fd, remoteSize);
-writeOneFd(fd, version);
-writeOneFd(fd, reserved32);
-writeOneFd(fd, reserved64);
-writeOneFd(fd, reserved64);
-writeOneFd(fd, reserved64);
-writeOneFd(fd, reserved64);
-long long offset = mustLseek(fd, 0, SEEK_CUR);
-if (offset != udcBitmapHeaderSize)
-    errAbort("offset in fd=%d, f=%s is %lld, not expected udcBitmapHeaderSize %d",
-	     fd, file->bitmapFileName, offset, udcBitmapHeaderSize);
-
-/* Write out initial all-zero bitmap, using sparse-file method: write 0 to final address. */
-unsigned char zero = 0;
-mustLseek(fd, bitmapSize-1, SEEK_CUR);
-mustWriteFd(fd, &zero, 1);
-
-/* Clean up bitmap file and name. */
-mustCloseFd(&fd);
-
-/* Create an empty data file. */
-fd = mustOpenFd(file->sparseFileName, O_WRONLY | O_CREAT | O_TRUNC);
-mustCloseFd(&fd);
-}
-
-static struct udcBitmap *udcBitmapOpen(char *fileName)
-/* Open up a bitmap file and read and verify header.  Return NULL if file doesn't
- * exist, abort on error. */
-{
-/* Open file, returning NULL if can't. */
-int fd = open(fileName, O_RDWR);
-if (fd < 0)
-    {
-    if (errno == ENOENT)
-	return NULL;
-    else
-	errnoAbort("Can't open(%s, O_RDWR)", fileName);
-    }
-
-/* Get status info from file. */
-struct stat status;
-fstat(fd, &status);
-if (status.st_size < udcBitmapHeaderSize) // check for truncated invalid bitmap files.
-    {
-    close(fd);
-    return NULL;  // returning NULL will cause the fresh creation of bitmap and sparseData files.
-    }  
-
-/* Read signature and decide if byte-swapping is needed. */
-// TODO: maybe buffer the I/O for performance?  Don't read past header - 
-// fd offset needs to point to first data block when we return.
-bits32 magic;
-boolean isSwapped = FALSE;
-mustReadOneFd(fd, magic);
-if (magic != udcBitmapSig)
-    {
-    magic = byteSwap32(magic);
-    isSwapped = TRUE;
-    if (magic != udcBitmapSig)
-       errAbort("%s is not a udcBitmap file", fileName);
-    }
-
-/* Allocate bitmap object, fill it in, and return it. */
-bits32 reserved32;
-bits64 reserved64;
-struct udcBitmap *bits;
-AllocVar(bits);
-bits->blockSize = fdReadBits32(fd, isSwapped);
-bits->remoteUpdate = fdReadBits64(fd, isSwapped);
-bits->fileSize = fdReadBits64(fd, isSwapped);
-bits->version = fdReadBits32(fd, isSwapped);
-reserved32 = fdReadBits32(fd, isSwapped);
-reserved64 = fdReadBits64(fd, isSwapped);
-reserved64 = fdReadBits64(fd, isSwapped);
-reserved64 = fdReadBits64(fd, isSwapped);
-reserved64 = fdReadBits64(fd, isSwapped);
-bits->localUpdate = status.st_mtime;
-bits->localAccess = status.st_atime;
-bits->isSwapped = isSwapped;
-bits->fd = fd;
-
-return bits;
-}
-
-static void udcBitmapClose(struct udcBitmap **pBits)
-/* Free up resources associated with udcBitmap. */
-{
-struct udcBitmap *bits = *pBits;
-if (bits != NULL)
-    {
-    mustCloseFd(&(bits->fd));
-    freez(pBits);
-    }
-}
-
-static struct udcProtocol *udcProtocolNew(char *upToColon)
-/* Build up a new protocol around a string such as "http" or "local" */
-{
-struct udcProtocol *prot;
-AllocVar(prot);
-if (sameString(upToColon, "local"))
-    {
-    prot->fetchData = udcDataViaLocal;
-    prot->fetchInfo = udcInfoViaLocal;
-    }
-else if (sameString(upToColon, "slow"))
-    {
-    prot->fetchData = udcDataViaSlow;
-    prot->fetchInfo = udcInfoViaSlow;
-    }
-else if (sameString(upToColon, "http") || sameString(upToColon, "https"))
-    {
-    prot->fetchData = udcDataViaHttpOrFtp;
-    prot->fetchInfo = udcInfoViaHttp;
-    }
-else if (sameString(upToColon, "ftp"))
-    {
-    prot->fetchData = udcDataViaHttpOrFtp;
-    prot->fetchInfo = udcInfoViaFtp;
-    }
-else if (sameString(upToColon, "transparent"))
-    {
-    prot->fetchData = udcDataViaTransparent;
-    prot->fetchInfo = udcInfoViaTransparent;
-    }
-else
-    {
-    errAbort("Unrecognized protocol %s in udcProtNew", upToColon);
-    }
-return prot;
-}
-
-static void udcProtocolFree(struct udcProtocol **pProt)
-/* Free up protocol resources. */
-{
-freez(pProt);
-}
-
-static void setInitialCachedDataBounds(struct udcFile *file, boolean useCacheInfo)
-/* Open up bitmap file and read a little bit of it to see if cache is stale,
- * and if not to see if the initial part is cached.  Sets the data members
- * startData, and endData.  If the case is stale it makes fresh empty
- * cacheDir/sparseData and cacheDir/bitmap files. */
-{
-bits32 version = 0;
-
-/* Get existing bitmap, and if it's stale clean up. */
-struct udcBitmap *bits = udcBitmapOpen(file->bitmapFileName);
-if (bits != NULL)
-    {
-    if (useCacheInfo)
-	{
-	file->size = bits->fileSize;
-	file->updateTime = bits->remoteUpdate;
-	}
-    version = bits->version;
-    if (bits->remoteUpdate != file->updateTime || bits->fileSize != file->size ||
-	!fileExists(file->sparseFileName))
-	{
-	verbose(2, "removing stale version (%lld! = %lld or %lld! = %lld or %s doesn't exist), "
-		"new version %d\n",
-		bits->remoteUpdate, (long long)file->updateTime, bits->fileSize, file->size,
-		file->sparseFileName, version);
-        udcBitmapClose(&bits);
-	remove(file->bitmapFileName);
-	remove(file->sparseFileName);
-	++version;
-	}
-    }
-else
-    verbose(2, "bitmap file %s does not already exist, creating.\n", file->bitmapFileName);
-
-/* If no bitmap, then create one, and also an empty sparse data file. */
-if (bits == NULL)
-    {
-    udcNewCreateBitmapAndSparse(file, file->updateTime, file->size, version);
-    bits = udcBitmapOpen(file->bitmapFileName);
-    if (bits == NULL)
-        errAbort("Unable to open bitmap file %s", file->bitmapFileName);
-    }
-
-file->bitmapVersion = bits->version;
-
-/* Read in a little bit from bitmap while we have it open to see if we have anything cached. */
-if (file->size > 0)
-    {
-    Bits b;
-    off_t wasAt = lseek(bits->fd, 0, SEEK_CUR);
-    mustReadOneFd(bits->fd, b);
-    int endBlock = (file->size + udcBlockSize - 1)/udcBlockSize;
-    if (endBlock > 8)
-        endBlock = 8;
-    int initialCachedBlocks = bitFindClear(&b, 0, endBlock);
-    file->endData = initialCachedBlocks * udcBlockSize;
-    mustLseek(bits->fd, wasAt, SEEK_SET);
-    } 
-
-file->bits = bits;
-
-}
-
-static boolean qEscaped(char c)
-/* Returns TRUE if character needs to be escaped in q-encoding. */
-{
-if (isalnum(c))
-    return c == 'Q';
-else
-    return c != '_' && c != '-' && c != '/' && c != '.';
-}
-
-static char *qEncode(char *input)
-/* Do a simple encoding to convert input string into "normal" characters.
- * Abnormal letters, and '!' get converted into Q followed by two hexadecimal digits. */
-{
-/* First go through and figure out encoded size. */
-int size = 0;
-char *s, *d, c;
-s = input;
-while ((c = *s++) != 0)
-    {
-    if (qEscaped(c))
-	size += 3;
-    else
-	size += 1;
-    }
-
-/* Allocate and fill in output. */
-char *output = needMem(size+1);
-s = input;
-d = output;
-while ((c = *s++) != 0)
-    {
-    if (qEscaped(c))
-        {
-	sprintf(d, "Q%02X", (unsigned)c);
-	d += 3;
-	}
-    else
-        *d++ = c;
-    }
-return output;
-}
-
-void udcParseUrlFull(char *url, char **retProtocol, char **retAfterProtocol, char **retColon,
-		     char **retAuth)
-/* Parse the URL into components that udc treats separately.
- * *retAfterProtocol is Q-encoded to keep special chars out of filenames.  
- * Free all *ret's except *retColon when done. */
-{
-char *protocol, *afterProtocol;
-char *colon = strchr(url, ':');
-if (!colon)
-    {
-    *retColon = NULL;
-    return;
-    }
-int colonPos = colon - url;
-protocol = cloneStringZ(url, colonPos);
-afterProtocol = url + colonPos + 1;
-while (afterProtocol[0] == '/')
-   afterProtocol += 1;
-char *userPwd = strchr(afterProtocol, '@');
-if (userPwd)
-    {
-    if (retAuth)
-	{
-	char auth[1024];
-	safencpy(auth, sizeof(auth), afterProtocol, userPwd+1-afterProtocol);
-	*retAuth = qEncode(auth);
-	}
-    char *afterHost = strchr(afterProtocol, '/');
-    if (!afterHost)
-	{
-	afterHost = afterProtocol+strlen(afterProtocol);
-	}
-    if (userPwd < afterHost)
-	afterProtocol = userPwd + 1;
-    }
-else if (retAuth)
-    *retAuth = NULL;
-afterProtocol = qEncode(afterProtocol);
-*retProtocol = protocol;
-*retAfterProtocol = afterProtocol;
-*retColon = colon;
-}
-
-void udcParseUrl(char *url, char **retProtocol, char **retAfterProtocol, char **retColon)
-/* Parse the URL into components that udc treats separately.
- * *retAfterProtocol is Q-encoded to keep special chars out of filenames.  
- * Free  *retProtocol and *retAfterProtocol but not *retColon when done. */
-{
-udcParseUrlFull(url, retProtocol, retAfterProtocol, retColon, NULL);
-}
-
-void udcPathAndFileNames(struct udcFile *file, char *cacheDir, char *protocol, char *afterProtocol)
-/* Initialize udcFile path and names */
-{
-int len = strlen(cacheDir) + 1 + strlen(protocol) + 1 + strlen(afterProtocol) + 1;
-file->cacheDir = needMem(len);
-safef(file->cacheDir, len, "%s/%s/%s", cacheDir, protocol, afterProtocol);
-
-/* Create file names for bitmap and data portions. */
-file->bitmapFileName = fileNameInCacheDir(file, bitmapName);
-file->sparseFileName = fileNameInCacheDir(file, sparseDataName);
-}
-
-static long long int udcSizeAndModTimeFromBitmap(char *bitmapFileName, time_t *retTime)
-/* Look up the file size from the local cache bitmap file, or -1 if there
- * is no cache for url. If retTime is non-null, store the remote update time in it. */
-{
-long long int ret = -1;
-struct udcBitmap *bits = udcBitmapOpen(bitmapFileName);
-if (bits != NULL)
-    {
-    ret = bits->fileSize;
-    if (retTime)
-	*retTime = bits->remoteUpdate;
-    }
-udcBitmapClose(&bits);
-return ret;
-}
-
-struct udcFile *udcFileMayOpen(char *url, char *cacheDir)
-/* Open up a cached file. cacheDir may be null in which case udcDefaultDir() will be
- * used.  Return NULL if file doesn't exist. */
-{
-if (cacheDir == NULL)
-    cacheDir = udcDefaultDir();
-verbose(2, "udcfileOpen(%s, %s)\n", url, cacheDir);
-/* Parse out protocol.  Make it "transparent" if none specified. */
-char *protocol = NULL, *afterProtocol = NULL, *colon;
-boolean isTransparent = FALSE;
-udcParseUrl(url, &protocol, &afterProtocol, &colon);
-if (!colon)
-    {
-    freeMem(protocol);
-    protocol = cloneString("transparent");
-    freeMem(afterProtocol);
-    afterProtocol = cloneString(url);
-    isTransparent = TRUE;
-    }
-struct udcProtocol *prot;
-prot = udcProtocolNew(protocol);
-
-/* Figure out if anything exists. */
-boolean useCacheInfo = FALSE;
-struct udcRemoteFileInfo info;
-ZeroVar(&info);
-if (!isTransparent)
-    {
-    useCacheInfo = (udcCacheAge(url, cacheDir) < udcCacheTimeout());
-    if (!useCacheInfo)
-	{
-	if (!prot->fetchInfo(url, &info))
-	    {
-	    udcProtocolFree(&prot);
-	    freeMem(protocol);
-	    freeMem(afterProtocol);
-	    return NULL;
-	    }
-	}
-    }
-
-/* Allocate file object and start filling it in. */
-struct udcFile *file;
-AllocVar(file);
-file->url = cloneString(url);
-file->protocol = protocol;
-file->prot = prot;
-if (isTransparent)
-    {
-    /* If transparent dummy up things so that the "sparse" file pointer is actually
-     * the file itself, which appears to be completely loaded in cache. */
-    int fd = file->fdSparse = mustOpenFd(url, O_RDONLY);
-    struct stat status;
-    fstat(fd, &status);
-    file->startData = 0;
-    file->endData = file->size = status.st_size;
-    }
-else
-    {
-    udcPathAndFileNames(file, cacheDir, protocol, afterProtocol);
-    if (!useCacheInfo)
-	{
-	file->updateTime = info.updateTime;
-	file->size = info.size;
-	memcpy(&(file->connInfo), &(info.ci), sizeof(struct connInfo));
-	// update cache file mod times, so if we're caching we won't do this again
-	// until the timeout has expired again:
-	if (udcCacheTimeout() > 0 && fileExists(file->bitmapFileName))
-	    (void)maybeTouchFile(file->bitmapFileName);
-	}
-
-    /* Make directory. */
-    makeDirsOnPath(file->cacheDir);
-
-    /* Figure out a little bit about the extent of the good cached data if any. Open bits bitmap. */
-    setInitialCachedDataBounds(file, useCacheInfo);
-
-    file->fdSparse = mustOpenFd(file->sparseFileName, O_RDWR);
-
-    }
-freeMem(afterProtocol);
-return file;
-}
-
-struct udcFile *udcFileOpen(char *url, char *cacheDir)
-/* Open up a cached file.  cacheDir may be null in which case udcDefaultDir() will be
- * used.  Abort if if file doesn't exist. */
-{
-struct udcFile *udcFile = udcFileMayOpen(url, cacheDir);
-if (udcFile == NULL)
-    errAbort("Couldn't open %s", url);
-return udcFile;
-}
-
-
-struct slName *udcFileCacheFiles(char *url, char *cacheDir)
-/* Return low-level list of files used in cache. */
-{
-char *protocol, *afterProtocol, *colon;
-struct udcFile *file;
-udcParseUrl(url, &protocol, &afterProtocol, &colon);
-if (colon == NULL)
-    return NULL;
-AllocVar(file);
-udcPathAndFileNames(file, cacheDir, protocol, afterProtocol);
-struct slName *list = NULL;
-slAddHead(&list, slNameNew(file->bitmapFileName));
-slAddHead(&list, slNameNew(file->sparseFileName));
-slReverse(&list);
-freeMem(file->cacheDir);
-freeMem(file->bitmapFileName);
-freeMem(file->sparseFileName);
-freeMem(file);
-freeMem(protocol);
-freeMem(afterProtocol);
-return list;
-}
-
-void udcFileClose(struct udcFile **pFile)
-/* Close down cached file. */
-{
-struct udcFile *file = *pFile;
-if (file != NULL)
-    {
-    if (file->connInfo.socket != 0)
-	mustCloseFd(&(file->connInfo.socket));
-    if (file->connInfo.ctrlSocket != 0)
-	mustCloseFd(&(file->connInfo.ctrlSocket));
-    freeMem(file->url);
-    freeMem(file->protocol);
-    udcProtocolFree(&file->prot);
-    freeMem(file->cacheDir);
-    freeMem(file->bitmapFileName);
-    freeMem(file->sparseFileName);
-    freeMem(file->sparseReadAheadBuf);
-    mustCloseFd(&(file->fdSparse));
-    udcBitmapClose(&file->bits);
-    }
-freez(pFile);
-}
-
-static void qDecode(const char *input, char *buf, size_t size)
-/* Reverse the qEncode performed on afterProcotol above into buf or abort. */
-{
-safecpy(buf, size, input);
-char c, *r = buf, *w = buf;
-while ((c = *r++) != '\0')
-    {
-    if (c == 'Q')
-	{
-	int q;
-	if (sscanf(r, "%02X", &q))
-	    {
-	    *w++ = (char)q;
-	    r += 2;
-	    }
-	else
-	    errAbort("qDecode: input \"%s\" does not appear to be properly formatted "
-		     "starting at \"%s\"", input, r);
-	}
-    else
-	*w++ = c;
-    }
-*w = '\0';
-}
-
-char *udcPathToUrl(const char *path, char *buf, size_t size, char *cacheDir)
-/* Translate path into an URL, store in buf, return pointer to buf if successful
- * and NULL if not. */
-{
-if (cacheDir == NULL)
-    cacheDir = udcDefaultDir();
-int offset = 0;
-if (startsWith(cacheDir, (char *)path))
-    offset = strlen(cacheDir);
-if (path[offset] == '/')
-    offset++;
-char protocol[16];
-strncpy(protocol, path+offset, sizeof(protocol));
-protocol[ArraySize(protocol)-1] = '\0';
-char *p = strchr(protocol, '/');
-if (p == NULL)
-    {
-    errAbort("unable to parse protocol (first non-'%s' directory) out of path '%s'\n",
-	     cacheDir, path);
-    return NULL;
-    }
-*p++ = '\0';
-char afterProtocol[4096];
-qDecode(path+1+strlen(protocol)+1, afterProtocol, sizeof(afterProtocol));
-safef(buf, size, "%s://%s", protocol, afterProtocol);
-return buf;
-}
-
-long long int udcSizeFromCache(char *url, char *cacheDir)
-/* Look up the file size from the local cache bitmap file, or -1 if there
- * is no cache for url. */
-{
-long long int ret = -1;
-if (cacheDir == NULL)
-    cacheDir = udcDefaultDir();
-struct slName *sl, *slList = udcFileCacheFiles(url, cacheDir);
-for (sl = slList;  sl != NULL;  sl = sl->next)
-    if (endsWith(sl->name, bitmapName))
-	{
-	ret = udcSizeAndModTimeFromBitmap(sl->name, NULL);
-	break;
-	}
-slNameFreeList(&slList);
-return ret;
-}
-
-unsigned long udcCacheAge(char *url, char *cacheDir)
-/* Return the age in seconds of the oldest cache file.  If a cache file is
- * missing, return the current time (seconds since the epoch). */
-{
-unsigned long now = clock1(), oldestTime = now;
-if (cacheDir == NULL)
-    cacheDir = udcDefaultDir();
-struct slName *sl, *slList = udcFileCacheFiles(url, cacheDir);
-if (slList == NULL)
-    return now;
-for (sl = slList;  sl != NULL;  sl = sl->next)
-    if (endsWith(sl->name, bitmapName))
-	{
-	if (fileExists(sl->name))
-	    oldestTime = min(fileModTime(sl->name), oldestTime);
-	else
-	    return now;
-	}
-return (now - oldestTime);
-}
-
-static void readBitsIntoBuf(int fd, int headerSize, int bitStart, int bitEnd,
-	Bits **retBits, int *retPartOffset)
-/* Do some bit-to-byte offset conversions and read in all the bytes that
- * have information in the bits we're interested in. */
-{
-int byteStart = bitStart/8;
-int byteEnd = bitToByteSize(bitEnd);
-int byteSize = byteEnd - byteStart;
-Bits *bits = needLargeMem(byteSize);
-mustLseek(fd, headerSize + byteStart, SEEK_SET);
-mustReadFd(fd, bits, byteSize);
-*retBits = bits;
-*retPartOffset = byteStart*8;
-}
-
-static boolean allBitsSetInFile(int bitStart, int bitEnd, int partOffset, Bits *bits)
-/* Return TRUE if all bits in file between start and end are set. */
-{
-int partBitStart = bitStart - partOffset;
-int partBitEnd = bitEnd - partOffset;
-int nextClearBit = bitFindClear(bits, partBitStart, partBitEnd);
-boolean allSet = (nextClearBit >= partBitEnd);
-return allSet;
-}
-
-// For tests/udcTest.c debugging: not declared in udc.h, but not static either:
-boolean udcCheckCacheBits(struct udcFile *file, int startBlock, int endBlock)
-/* Warn and return TRUE if any bit in (startBlock,endBlock] is not set. */
-{
-boolean gotUnset = FALSE;
-struct udcBitmap *bitmap = udcBitmapOpen(file->bitmapFileName);
-int partOffset;
-Bits *bits;
-readBitsIntoBuf(bitmap->fd, udcBitmapHeaderSize, startBlock, endBlock, &bits, &partOffset);
-
-int partBitStart = startBlock - partOffset;
-int partBitEnd = endBlock - partOffset;
-int nextClearBit = bitFindClear(bits, partBitStart, partBitEnd);
-while (nextClearBit < partBitEnd)
-    {
-    int clearBlock = nextClearBit + partOffset;
-    warn("... udcFile 0x%04lx: bit for block %d (%lld..%lld] is not set",
-	 (unsigned long)file, clearBlock,
-	 ((long long)clearBlock * udcBlockSize), (((long long)clearBlock+1) * udcBlockSize));
-    gotUnset = TRUE;
-    int nextSetBit = bitFindSet(bits, nextClearBit, partBitEnd);
-    nextClearBit = bitFindClear(bits, nextSetBit, partBitEnd);
-    }
-return gotUnset;
-}
-
-static void fetchMissingBlocks(struct udcFile *file, struct udcBitmap *bits, 
-	int startBlock, int blockCount, int blockSize)
-/* Fetch missing blocks from remote and put them into file.  errAbort if trouble. */
-{
-bits64 startPos = (bits64)startBlock * blockSize;
-bits64 endPos = startPos + (bits64)blockCount * blockSize;
-if (endPos > file->size)
-    endPos = file->size;
-if (endPos > startPos)
-    {
-    bits64 readSize = endPos - startPos;
-    void *buf = needLargeMem(readSize);
-    
-    int actualSize = file->prot->fetchData(file->url, startPos, readSize, buf, &(file->connInfo));
-    if (actualSize != readSize)
-	errAbort("unable to fetch %lld bytes from %s @%lld (got %d bytes)",
-		 readSize, file->url, startPos, actualSize);
-    mustLseek(file->fdSparse, startPos, SEEK_SET);
-    mustWriteFd(file->fdSparse, buf, readSize);
-    freez(&buf);
-    }
-}
-
-static boolean fetchMissingBits(struct udcFile *file, struct udcBitmap *bits,
-	bits64 start, bits64 end, bits64 *retFetchedStart, bits64 *retFetchedEnd)
-/* Scan through relevant parts of bitmap, fetching blocks we don't already have. */
-{
-/* Fetch relevant part of bitmap into memory */
-int partOffset;
-Bits *b;
-int startBlock = start / bits->blockSize;
-int endBlock = (end + bits->blockSize - 1) / bits->blockSize;
-readBitsIntoBuf(bits->fd, udcBitmapHeaderSize, startBlock, endBlock, &b, &partOffset);
-if (allBitsSetInFile(startBlock, endBlock, partOffset, b))
-    {  // it is already in the cache
-    freeMem(b);
-    return TRUE;
-    }
-
-/* Loop around first skipping set bits, then fetching clear bits. */
-boolean dirty = FALSE;
-int s = startBlock - partOffset;
-int e = endBlock - partOffset;
-for (;;)
-    {
-    int nextClearBit = bitFindClear(b, s, e);
-    if (nextClearBit >= e)
-        break;
-    int nextSetBit = bitFindSet(b, nextClearBit, e);
-    int clearSize =  nextSetBit - nextClearBit;
-
-    fetchMissingBlocks(file, bits, nextClearBit + partOffset, clearSize, bits->blockSize);
-    bitSetRange(b, nextClearBit, clearSize);
-
-    dirty = TRUE;
-    if (nextSetBit >= e)
-        break;
-    s = nextSetBit;
-    }
-
-if (dirty)
-    {
-    /* Update bitmap on disk.... */
-    int byteStart = startBlock/8;
-    int byteEnd = bitToByteSize(endBlock);
-    int byteSize = byteEnd - byteStart;
-    mustLseek(bits->fd, byteStart + udcBitmapHeaderSize, SEEK_SET);
-    mustWriteFd(bits->fd, b, byteSize);
-    }
-
-freeMem(b);
-*retFetchedStart = startBlock * bits->blockSize;
-*retFetchedEnd = endBlock * bits->blockSize;
-return FALSE;
-}
-
-static boolean rangeIntersectOrTouch64(bits64 start1, bits64 end1, bits64 start2, bits64 end2)
-/* Return true if two 64-bit ranges intersect or touch. */
-{  // cannot use the version of this function that is in common.c since it only handles integers.
-bits64 s = max(start1,start2);
-bits64 e = min(end1,end2);
-return e >= s;
-}
-
-
-static void udcFetchMissing(struct udcFile *file, struct udcBitmap *bits, bits64 start, bits64 end)
-/* Fetch missing pieces of data from file */
-{
-/* Call lower level routine fetch remote data that is not already here. */
-bits64 fetchedStart, fetchedEnd;
-if (fetchMissingBits(file, bits, start, end, &fetchedStart, &fetchedEnd))
-    return;
-
-/* Update file startData/endData members to include new data (and old as well if
- * the new data overlaps the old). */
-if (rangeIntersectOrTouch64(file->startData, file->endData, fetchedStart, fetchedEnd))
-    {
-    if (fetchedStart > file->startData)
-        fetchedStart = file->startData;
-    if (fetchedEnd < file->endData)
-        fetchedEnd = file->endData;
-    }
-file->startData = fetchedStart;
-file->endData = fetchedEnd;
-}
-
-static boolean udcCachePreload(struct udcFile *file, bits64 offset, bits64 size)
-/* Make sure that given data is in cache - fetching it remotely if need be. 
- * Return TRUE on success. */
-{
-boolean ok = TRUE;
-/* We'll break this operation into blocks of a reasonable size to allow
- * other processes to get cache access, since we have to lock the cache files. */
-bits64 s,e, endPos=offset+size;
-for (s = offset; s < endPos; s = e)
-    {
-    /* Figure out bounds of this section. */
-    e = s + udcMaxBytesPerRemoteFetch;
-    if (e > endPos)
-	e = endPos;
-
-    struct udcBitmap *bits = file->bits;
-    if (bits->version == file->bitmapVersion)
-	{
-        udcFetchMissing(file, bits, s, e);
-	}
-    else
-	{
-	ok = FALSE;
-	verbose(2, "udcCachePreload version check failed %d vs %d", 
-		bits->version, file->bitmapVersion);
-	}
-    if (!ok)
-        break;
-    }
-return ok;
-}
-
-#define READAHEADBUFSIZE 4096
-bits64 udcRead(struct udcFile *file, void *buf, bits64 size)
-/* Read a block from file.  Return amount actually read. */
-{
-
-/* Figure out region of file we're going to read, and clip it against file size. */
-bits64 start = file->offset;
-if (start > file->size)
-    return 0;
-bits64 end = start + size;
-if (end > file->size)
-    end = file->size;
-size = end - start;
-char *cbuf = buf;
-
-/* use read-ahead buffer if present */
-bits64 bytesRead = 0;
-
-bits64 raStart;
-bits64 raEnd;
-while(TRUE)
-    {
-    if (file->sparseReadAhead)
-	{
-	raStart = file->sparseRAOffset;
-	raEnd = raStart+READAHEADBUFSIZE;
-	if (start >= raStart && start < raEnd)
-	    {
-	    // copy bytes out of rabuf
-	    bits64 endInBuf = min(raEnd, end);
-	    bits64 sizeInBuf = endInBuf - start;
-	    memcpy(cbuf, file->sparseReadAheadBuf + (start-raStart), sizeInBuf);
-	    cbuf += sizeInBuf;
-	    bytesRead += sizeInBuf;
-	    start = raEnd;
-	    size -= sizeInBuf;
-	    file->offset += sizeInBuf;
-	    if (size == 0)
-		break;
-	    }
-	file->sparseReadAhead = FALSE;
-	mustLseek(file->fdSparse, start, SEEK_SET);
-	}
-
-    bits64 saveEnd = end;
-    if (size < READAHEADBUFSIZE)
-	{
-	file->sparseReadAhead = TRUE;
-	if (!file->sparseReadAheadBuf)
-	    file->sparseReadAheadBuf = needMem(READAHEADBUFSIZE);
-	file->sparseRAOffset = start;
-	size = READAHEADBUFSIZE;
-	end = start + size;
-	if (end > file->size)
-	    {
-	    end = file->size;
-	    size = end - start;
-	    }
-	}
-
-
-    /* If we're outside of the window of file we already know is good, then have to
-     * consult cache on disk, and maybe even fetch data remotely! */
-    if (start < file->startData || end > file->endData)
-	{
-
-	if (!udcCachePreload(file, start, size))
-	    {
-	    verbose(2, "udcCachePreload failed");
-	    bytesRead = 0;
-	    break;
-	    }
-
-	/* Currently only need fseek here.  Would be safer, but possibly
-	 * slower to move fseek so it is always executed in front of read, in
-	 * case other code is moving around file pointer. */
-
-	mustLseek(file->fdSparse, start, SEEK_SET);
-	}
-
-    if (file->sparseReadAhead)
-	{
-	mustReadFd(file->fdSparse, file->sparseReadAheadBuf, size);
-	end = saveEnd;
-	size = end - start;
-	}
-    else
-	{
-	mustReadFd(file->fdSparse, cbuf, size);
-	file->offset += size;
-	bytesRead += size;
-	break;
-	}
-    }
-
-return bytesRead;
-}
-
-void udcMustRead(struct udcFile *file, void *buf, bits64 size)
-/* Read a block from file.  Abort if any problem, including EOF before size is read. */
-{
-bits64 sizeRead = udcRead(file, buf, size);
-if (sizeRead < size)
-    errAbort("udc couldn't read %llu bytes from %s, did read %llu", size, file->url, sizeRead);
-}
-
-int udcGetChar(struct udcFile *file)
-/* Get next character from file or die trying. */
-{
-UBYTE b;
-udcMustRead(file, &b, 1);
-return b;
-}
-
-bits64 udcReadBits64(struct udcFile *file, boolean isSwapped)
-/* Read and optionally byte-swap 64 bit entity. */
-{
-bits64 val;
-udcMustRead(file, &val, sizeof(val));
-if (isSwapped)
-    val = byteSwap64(val);
-return val;
-}
-
-bits32 udcReadBits32(struct udcFile *file, boolean isSwapped)
-/* Read and optionally byte-swap 32 bit entity. */
-{
-bits32 val;
-udcMustRead(file, &val, sizeof(val));
-if (isSwapped)
-    val = byteSwap32(val);
-return val;
-}
-
-bits16 udcReadBits16(struct udcFile *file, boolean isSwapped)
-/* Read and optionally byte-swap 16 bit entity. */
-{
-bits16 val;
-udcMustRead(file, &val, sizeof(val));
-if (isSwapped)
-    val = byteSwap16(val);
-return val;
-}
-
-float udcReadFloat(struct udcFile *file, boolean isSwapped)
-/* Read and optionally byte-swap floating point number. */
-{
-float val;
-udcMustRead(file, &val, sizeof(val));
-if (isSwapped)
-    val = byteSwapFloat(val);
-return val;
-}
-
-double udcReadDouble(struct udcFile *file, boolean isSwapped)
-/* Read and optionally byte-swap double-precision floating point number. */
-{
-double val;
-udcMustRead(file, &val, sizeof(val));
-if (isSwapped)
-    val = byteSwapDouble(val);
-return val;
-}
-
-char *udcReadLine(struct udcFile *file)
-/* Fetch next line from udc cache or NULL. */
-{
-char shortBuf[2], *longBuf = NULL, *buf = shortBuf;
-int i, bufSize = sizeof(shortBuf);
-for (i=0; ; ++i)
-    {
-    /* See if need to expand buffer, which is initially on stack, but if it gets big goes into 
-     * heap. */
-    if (i >= bufSize)
-        {
-	int newBufSize = bufSize*2;
-	char *newBuf = needLargeMem(newBufSize);
-	memcpy(newBuf, buf, bufSize);
-	freeMem(longBuf);
-	buf = longBuf = newBuf;
-	bufSize = newBufSize;
-	}
-
-    char c;
-    bits64 sizeRead = udcRead(file, &c, 1);
-    if (sizeRead == 0)
-	return NULL;
-    buf[i] = c;
-    if (c == '\n')
-	{
-	buf[i] = 0;
-	break;
-	}
-    }
-char *retString = cloneString(buf);
-freeMem(longBuf);
-return retString;
-}
-
-char *udcReadStringAndZero(struct udcFile *file)
-/* Read in zero terminated string from file.  Do a freeMem of result when done. */
-{
-char shortBuf[2], *longBuf = NULL, *buf = shortBuf;
-int i, bufSize = sizeof(shortBuf);
-for (i=0; ; ++i)
-    {
-    /* See if need to expand buffer, which is initially on stack, but if it gets big goes into 
-     * heap. */
-    if (i >= bufSize)
-        {
-	int newBufSize = bufSize*2;
-	char *newBuf = needLargeMem(newBufSize);
-	memcpy(newBuf, buf, bufSize);
-	freeMem(longBuf);
-	buf = longBuf = newBuf;
-	bufSize = newBufSize;
-	}
-    char c = udcGetChar(file);
-    buf[i] = c;
-    if (c == 0)
-        break;
-    }
-char *retString = cloneString(buf);
-freeMem(longBuf);
-return retString;
-}
-
-char *udcFileReadAll(char *url, char *cacheDir, size_t maxSize, size_t *retSize)
-/* Read a complete file via UDC. The cacheDir may be null in which case udcDefaultDir()
- * will be used.  If maxSize is non-zero, check size against maxSize
- * and abort if it's bigger.  Returns file data (with an extra terminal for the
- * common case where it's treated as a C string).  If retSize is non-NULL then
- * returns size of file in *retSize. Do a freeMem or freez of the returned buffer
- * when done. */
-{
-struct udcFile  *file = udcFileOpen(url, cacheDir);
-size_t size = file->size;
-if (maxSize != 0 && size > maxSize)
-    errAbort("%s is %lld bytes, but maxSize to udcFileReadAll is %lld",
-    	url, (long long)size, (long long)maxSize);
-char *buf = needLargeMem(size+1);
-udcMustRead(file, buf, size);
-buf[size] = 0;	// add trailing zero for string processing
-udcFileClose(&file);
-if (retSize != NULL)
-    *retSize = size;
-return buf;
-}
-
-struct lineFile *udcWrapShortLineFile(char *url, char *cacheDir, size_t maxSize)
-/* Read in entire short (up to maxSize) url into memory and wrap a line file around it.
- * The cacheDir may be null in which case udcDefaultDir() will be used.  If maxSize
- * is zero then a default value (currently 64 meg) will be used. */
-{
-if (maxSize == 0) maxSize = 64 * 1024 * 1024;
-char *buf = udcFileReadAll(url, cacheDir, maxSize, NULL);
-return lineFileOnString(url, TRUE, buf);
-}
-
-void udcSeekCur(struct udcFile *file, bits64 offset)
-/* Seek to a particular position in file. */
-{
-file->offset += offset;
-mustLseek(file->fdSparse, offset, SEEK_CUR);
-}
-
-void udcSeek(struct udcFile *file, bits64 offset)
-/* Seek to a particular position in file. */
-{
-file->offset = offset;
-mustLseek(file->fdSparse, offset, SEEK_SET);
-}
-
-bits64 udcTell(struct udcFile *file)
-/* Return current file position. */
-{
-return file->offset;
-}
-
-static long bitRealDataSize(char *fileName)
-/* Return number of real bytes indicated by bitmaps */
-{
-struct udcBitmap *bits = udcBitmapOpen(fileName);
-int blockSize = bits->blockSize;
-long byteSize = 0;
-int blockCount = (bits->fileSize + blockSize - 1)/blockSize;
-if (blockCount > 0)
-    {
-    int bitmapSize = bitToByteSize(blockCount);
-    Bits *b = needLargeMem(bitmapSize);
-    mustReadFd(bits->fd, b, bitmapSize);
-    int bitsSet = bitCountRange(b, 0, blockCount);
-    byteSize = (long)bitsSet*blockSize;
-    freez(&b);
-    }
-udcBitmapClose(&bits);
-return byteSize;
-}
-
-static bits64 rCleanup(time_t deleteTime, boolean testOnly)
-/* Delete any bitmap or sparseData files last accessed before deleteTime */
-{
-struct fileInfo *file, *fileList = listDirX(".", "*", FALSE);
-bits64 results = 0;
-for (file = fileList; file != NULL; file = file->next)
-    {
-    if (file->isDir)
-        {
-	setCurrentDir(file->name);
-	bits64 oneResult = rCleanup(deleteTime, testOnly);
-	setCurrentDir("..");
-	if (oneResult > 0)
-	    {
-	    if (!testOnly)
-		remove(file->name);
-	    results += oneResult;
-	    results += file->size;
-	    }
-	}
-    else if (sameString(file->name, bitmapName))
-        {
-	if (file->size > udcBitmapHeaderSize) /* prevent failure on bitmap files of size 0 or less than header size */
-	    verbose(2, "%ld (%ld) %s/%s\n", bitRealDataSize(file->name), (long)file->size, getCurrentDir(), file->name);
-	if (file->lastAccess < deleteTime)
-	    {
-	    /* Remove all files when get bitmap, so that can ensure they are deleted in 
-	     * right order. */
-	    results += file->size;
-	    if (!testOnly)
-		{
-		remove(bitmapName);
-		remove(sparseDataName);
-		}
-	    }
-	}
-    else if (sameString(file->name, sparseDataName))
-        {
-	if (results > 0)
-	    results += file->size;
-	}
-    }
-return results;
-}
-
-bits64 udcCleanup(char *cacheDir, double maxDays, boolean testOnly)
-/* Remove cached files older than maxDays old. If testOnly is set
- * no clean up is done, but the size of the files that would be
- * cleaned up is still. */
-
-{
-time_t maxSeconds = maxDays * 24 * 60 * 60;
-char *curPath = cloneString(getCurrentDir());
-setCurrentDir(cacheDir);
-time_t deleteTime = time(NULL) - maxSeconds;
-bits64 result = rCleanup(deleteTime, testOnly);
-setCurrentDir(curPath);
-return result;
-}
-
-static char *defaultDir = "/tmp/udcCache";
-
-char *udcDefaultDir()
-/* Get default directory for cache */
-{
-return defaultDir;
-}
-
-void udcSetDefaultDir(char *path)
-/* Set default directory for cache */
-{
-defaultDir = cloneString(path);
-}
-
-
-int udcCacheTimeout()
-/* Get cache timeout (if local cache files are newer than this many seconds,
- * we won't ping the remote server to check the file size and update time). */
-{
-return cacheTimeout;
-}
-
-void udcSetCacheTimeout(int timeout)
-/* Set cache timeout (if local cache files are newer than this many seconds,
- * we won't ping the remote server to check the file size and update time). */
-{
-cacheTimeout = timeout;
-}
-
-time_t udcUpdateTime(struct udcFile *udc)
-/* return udc->updateTime */
-{
-if (sameString("transparent", udc->protocol))
-    {
-    struct stat status;
-    int ret = stat(udc->url, &status);
-    if (ret < 0)
-	return 0;
-    else
-	return  status.st_mtime;
-    }
-return udc->updateTime;
-}
-
-off_t udcFileSize(char *url)
-/* fetch file size from given URL or local path 
- * returns -1 if not found. */
-{
-if (udcIsLocal(url))
-    return fileSize(url);
-
-// don't go to the network if we can avoid it
-int cacheSize = udcSizeFromCache(url, NULL);
-if (cacheSize!=-1)
-    return cacheSize;
-
-off_t ret = -1;
-struct udcRemoteFileInfo info;
-
-if (startsWith("http://",url) || startsWith("https://",url))
-    {
-    if (udcInfoViaHttp(url, &info))
-	ret = info.size;
-    }
-else if (startsWith("ftp://",url))
-    {
-    if (udcInfoViaFtp(url, &info))
-	ret = info.size;
-    }
-else
-    errAbort("udc/udcFileSize: invalid protocol for url %s, can only do http/https/ftp", url);
-
-return ret;
-}
-
-boolean udcIsLocal(char *url) 
-/* return true if file is not a http or ftp file, just a local file */
-{
-// copied from above
-char *protocol = NULL, *afterProtocol = NULL, *colon;
-udcParseUrl(url, &protocol, &afterProtocol, &colon);
-freez(&protocol);
-freez(&afterProtocol);
-return colon==NULL;
-}
-
-boolean udcExists(char *url)
-/* return true if a local or remote file exists */
-{
-return udcFileSize(url)!=-1;
-}
diff --git a/gbtools/src/blatSrc/lib/vGfx.c b/gbtools/src/blatSrc/lib/vGfx.c
deleted file mode 100644
index eae0647..0000000
--- a/gbtools/src/blatSrc/lib/vGfx.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* vGfx - interface to polymorphic graphic object
- * that currently can either be a memory buffer or
- * a postScript file. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "vGfx.h"
-
-
-
-/* Most of the implementation of this is in macros in vGfx.h. */
-
-void vgClose(struct vGfx **pVg)
-/* Close down virtual graphics object, and finish writing it to file. */
-{
-struct vGfx *vg = *pVg;
-if (vg != NULL)
-    {
-    vg->close(&vg->data);
-    freez(pVg);
-    }
-}
-
-struct vGfx *vgHalfInit(int width, int height)
-/* Close down virtual graphics object, and finish writing it to file. */
-{
-struct vGfx *vg;
-AllocVar(vg);
-vg->width = width;
-vg->height = height;
-return vg;
-}
-
-int vgFindRgb(struct vGfx *vg, struct rgbColor *rgb)
-/* Find color index corresponding to rgb color. */
-{
-return vgFindColorIx(vg, rgb->r, rgb->g, rgb->b);
-}
-
-Color vgContrastingColor(struct vGfx *vg, int backgroundIx)
-/* Return black or white whichever would be more visible over
- * background. */
-{
-struct rgbColor c = vgColorIxToRgb(vg, backgroundIx);
-int val = (int)c.r + c.g + c.g + c.b;
-if (val > 512)
-    return MG_BLACK;
-else
-    return MG_WHITE;
-}
-
diff --git a/gbtools/src/blatSrc/lib/vGfxPrivate.h b/gbtools/src/blatSrc/lib/vGfxPrivate.h
deleted file mode 100644
index 242e3ea..0000000
--- a/gbtools/src/blatSrc/lib/vGfxPrivate.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* vGfx private - stuff that the implementers of 
- * a vGfx need to know about, but not the clients. */
-
-/* Copyright (C) 2010 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-
-struct vGfx *vgHalfInit(int width, int height);
-/* Return a partially initialized vGfx structure. 
- * Generally not called by clients.*/
-
-void vgMgMethods(struct vGfx *vg);
-/* Fill in virtual graphics methods for memory based drawing. */
-
-/* A bunch of things to make the type-casting easier.
- * This is a price you pay for object oriented
- * polymorphism in C... */
-
-typedef void (*vg_close)(void **pV);
-typedef void (*vg_dot)(void *v, int x, int y, int colorIx);
-typedef int (*vg_getDot)(void *v, int x, int y);
-typedef void (*vg_box)(void *v, int x, int y, 
-	int width, int height, int colorIx);
-typedef void (*vg_line)(void *v, 
-	int x1, int y1, int x2, int y2, int colorIx);
-typedef void (*vg_text)(void *v, int x, int y, int colorIx, void *font,
-	char *text);
-typedef void (*vg_textRight)(void *v, int x, int y, int width, int height,
-	int colorIx, void *font, char *text);
-typedef void (*vg_textCentered)(void *v, int x, int y, int width, int height,
-	int colorIx, void *font, char *text);
-typedef int (*vg_findColorIx)(void *v, int r, int g, int b);
-typedef struct rgbColor (*vg_colorIxToRgb)(void *v, int colorIx);
-typedef void (*vg_setClip)(void *v, int x, int y, int width, int height);
-typedef void (*vg_setWriteMode)(void *v, unsigned int writeMode);
-typedef void (*vg_unclip)(void *v);
-typedef void (*vg_verticalSmear)(void *v,
-	    int xOff, int yOff, int width, int height, 
-	    Color *dots, boolean zeroClear);
-typedef void (*vg_fillUnder)(void *v, int x1, int y1, 
-	int x2, int y2, int bottom, Color color);
-typedef void (*vg_drawPoly)(void *v, struct gfxPoly *poly, Color color, boolean filled);
-typedef void (*vg_setHint)(void *v, char *hint, char *value);
-typedef char * (*vg_getHint)(void *v, char *hint);
-typedef int (*vg_getFontPixelHeight)(void *v, void *font);
-typedef int (*vg_getFontStringWidth)(void *v, void *font, char *string);
-
diff --git a/gbtools/src/blatSrc/lib/vGif.c b/gbtools/src/blatSrc/lib/vGif.c
deleted file mode 100644
index cc2b3f2..0000000
--- a/gbtools/src/blatSrc/lib/vGif.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* vGif - a virtual graphic object wrapper around
- * an in-memory buffer destined to become a 
- * 256-color GIF file. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "memgfx.h"
-#include "vGfx.h"
-#include "vGfxPrivate.h"
-
-
-#ifndef COLOR32
-
-struct memGif
-/* Something that handles a gif. */
-    {
-    struct memGfx mg;	/* Memory form.  This needs to be first field. */
-    char *fileName;	/* Gif file name. */
-    boolean useTransparency;
-    };
-
-void memGifClose(struct memGif **pG)
-/* Write out and close and free. */
-{
-struct memGif *g = *pG;
-if (g != NULL)
-    {
-    struct memGfx *mg = (struct memGfx *)g;
-    mgSaveGif(mg, g->fileName, g->useTransparency);
-    freez(&g->fileName);
-    mgFree(&mg);
-    *pG = NULL;
-    }
-}
-
-struct vGfx *vgOpenGif(int width, int height, char *fileName, boolean useTransparency)
-/* Open up something that will someday be a PostScript file. */
-{
-struct memGif *gif;
-struct memGfx *mg;
-struct vGfx *vg;
-
-/* Set up virtual graphics with memory methods. */
-vg = vgHalfInit(width, height);
-vgMgMethods(vg);
-vg->close = (vg_close)memGifClose;
-
-/* Get our mg + fileName structure.  We're forcing
- * inheritence from mg essentially. */
-AllocVar(gif);
-gif->fileName = cloneString(fileName);
-gif->useTransparency = useTransparency;
-
-/* Fill in the mg part of this structure with normal memGfx. */
-mg = mgNew(width, height);
-mgClearPixels(mg);
-gif->mg = *mg;
-freez(&mg);	/* We don't need this copy any more. */
-
-vg->data = gif;
-return vg;
-}
-
-#endif
diff --git a/gbtools/src/blatSrc/lib/vPng.c b/gbtools/src/blatSrc/lib/vPng.c
deleted file mode 100644
index 90aaae3..0000000
--- a/gbtools/src/blatSrc/lib/vPng.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* vPng - a virtual graphic object wrapper around an in-memory buffer destined to become a 256-color PNG file. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-
-#include "common.h"
-#include "memgfx.h"
-#include "vGfx.h"
-#include "vGfxPrivate.h"
-
-
-struct memPng
-/* Something that handles a PNG. */
-    {
-    struct memGfx mg;	/* Memory form.  This needs to be first field. */
-    char *fileName;	/* PNG file name. */
-    boolean useTransparency;   /* Make background color transparent if TRUE. */
-    };
-
-void memPngClose(struct memPng **pG)
-/* Write out and close and free. */
-{
-struct memPng *g = *pG;
-if (g != NULL)
-    {
-    struct memGfx *mg = (struct memGfx *)g;
-    mgSavePng(mg, g->fileName, g->useTransparency);
-    freez(&g->fileName);
-    mgFree(&mg);
-    *pG = NULL;
-    }
-}
-
-struct vGfx *vgOpenPng(int width, int height, char *fileName, boolean useTransparency)
-/* Open up something that will write out a PNG file upon vgClose.  
- * If useTransparency, then the first color in memgfx's colormap/palette is
- * assumed to be the image background color, and pixels of that color
- * are made transparent. */
-{
-struct memPng *png;
-struct memGfx *mg;
-struct vGfx *vg;
-
-/* Set up virtual graphics with memory methods. */
-vg = vgHalfInit(width, height);
-vgMgMethods(vg);
-vg->close = (vg_close)memPngClose;
-
-/* Get our mg + fileName structure.  We're forcing
- * inheritence from mg essentially. */
-AllocVar(png);
-png->fileName = cloneString(fileName);
-png->useTransparency = useTransparency;
-
-/* Fill in the mg part of this structure with normal memGfx. */
-mg = mgNew(width, height);
-if (png->useTransparency)
-    mgClearPixelsTrans(mg);
-else
-    mgClearPixels(mg);
-png->mg = *mg;
-freez(&mg);	/* We don't need this copy any more. */
-
-vg->data = png;
-return vg;
-}
-
diff --git a/gbtools/src/blatSrc/lib/valgrind.suppress b/gbtools/src/blatSrc/lib/valgrind.suppress
deleted file mode 100644
index 44c76fe..0000000
--- a/gbtools/src/blatSrc/lib/valgrind.suppress
+++ /dev/null
@@ -1,106 +0,0 @@
-# valgrind uppressions for expected memory leaks from kent/src/lib modules.
-# specify this file to  valgrind with something like:
-#    --suppressions=../lib/valgrind.suppress
-# if you need to create new suppressions, run your program with valgrind using
-# the --gen-suppressions=yes option.  This will interactive prompt you to
-# and output the suppressions that you must edit and add to this file.
-# Name the option and delete lower-level calling context entries so that
-# the last function in the list the the particular library entry point.
-# 
-#  valgrind --tool=memcheck --suppressions=../lib/valgrind.suppress --num-callers=100 --leak-check=full --leak-resolution=high --show-reachable=yes  yourProg yourArgs ...
-#
-{
-   options1
-   Memcheck:Leak
-   fun:malloc
-   fun:defaultAlloc
-   fun:needMem
-   fun:lmInit
-   fun:newHashExt
-   fun:parseOptions
-   fun:optionInit
-}
-{
-   options2
-   Memcheck:Leak
-   fun:malloc
-   fun:defaultAlloc
-   fun:needMem
-   fun:newHashExt
-   fun:parseOptions
-   fun:optionInit
-}
-{
-   options3
-   Memcheck:Leak
-   fun:malloc
-   fun:defaultAlloc
-   fun:needLargeMem
-   fun:needLargeZeroedMem
-   fun:newBlock
-   fun:lmAlloc
-   fun:hashAddN
-   fun:hashAdd
-   fun:parseAnOption
-   fun:parseOptions
-   fun:optionInit
-}
-{
-   options4
-   Memcheck:Leak
-   fun:malloc
-   fun:defaultAlloc
-   fun:needLargeMem
-   fun:needLargeZeroedMem
-   fun:newBlock
-   fun:lmInit
-   fun:newHash
-   fun:parseOptions
-   fun:optionInit
-}
-{
-   options5
-   Memcheck:Leak
-   fun:malloc
-   fun:defaultAlloc
-   fun:needLargeMem
-   fun:needLargeZeroedMem
-   fun:newBlock
-   fun:lmAlloc
-   fun:newHashExt
-   fun:parseOptions
-   fun:optionInit
-}
-{
-   sqlUnsignedArray
-   Memcheck:Leak
-   fun:malloc
-   fun:realloc
-   fun:defaultRealloc
-   fun:needLargeMemResize
-   fun:needLargeZeroedMemResize
-   fun:needMoreMem
-   fun:sqlUnsignedStaticArray
-}
-{
-   sqlSignedArray   
-   Memcheck:Leak
-   fun:malloc
-   fun:realloc
-   fun:defaultRealloc
-   fun:needLargeMemResize
-   fun:needLargeZeroedMemResize
-   fun:needMoreMem
-   fun:sqlSignedStaticArray
-}
-{
-   sqlFloatArray
-   Memcheck:Leak
-   fun:malloc
-   fun:realloc
-   fun:defaultRealloc
-   fun:needLargeMemResize
-   fun:needLargeZeroedMemResize
-   fun:needMoreMem
-   fun:sqlFloatStaticArray
-}
diff --git a/gbtools/src/blatSrc/lib/vcf.c b/gbtools/src/blatSrc/lib/vcf.c
deleted file mode 100644
index cde6810..0000000
--- a/gbtools/src/blatSrc/lib/vcf.c
+++ /dev/null
@@ -1,1285 +0,0 @@
-/* VCF: Variant Call Format, version 4.0 / 4.1
- * http://www.1000genomes.org/wiki/Analysis/Variant%20Call%20Format/vcf-variant-call-format-version-40
- * http://www.1000genomes.org/wiki/Analysis/Variant%20Call%20Format/vcf-variant-call-format-version-41
- */
-
-/* Copyright (C) 2014 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "errAbort.h"
-#include <limits.h>
-#include "localmem.h"
-#include "net.h"
-#include "regexHelper.h"
-#include "vcf.h"
-
-/* Reserved but optional INFO keys: */
-const char *vcfInfoAncestralAllele = "AA";
-const char *vcfInfoPerAlleleGtCount = "AC";	// allele count in genotypes, for each ALT allele,
-						// in the same order as listed
-const char *vcfInfoAlleleFrequency = "AF";	// allele frequency for each ALT allele in the same
-						// order as listed: use this when estimated from
-						// primary data, not called genotypes
-const char *vcfInfoNumAlleles = "AN";		// total number of alleles in called genotypes
-const char *vcfInfoBaseQuality = "BQ";		// RMS base quality at this position
-const char *vcfInfoCigar = "CIGAR";		// cigar string describing how to align an
-						// alternate allele to the reference allele
-const char *vcfInfoIsDbSnp = "DB";		// dbSNP membership
-const char *vcfInfoDepth = "DP";		// combined depth across samples, e.g. DP=154
-const char *vcfInfoEnd = "END";			// end position of the variant described in this
-						// record (esp. for CNVs)
-const char *vcfInfoIsHapMap2 = "H2";		// membership in hapmap2
-const char *vcfInfoIsHapMap3 = "H3";		// membership in hapmap3
-const char *vcfInfoIs1000Genomes = "1000G";	// membership in 1000 Genomes
-const char *vcfInfoMappingQuality = "MQ";	// RMS mapping quality, e.g. MQ=52
-const char *vcfInfoMapQual0Count = "MQ0";	// number of MAPQ == 0 reads covering this record
-const char *vcfInfoNumSamples = "NS";		// Number of samples with data
-const char *vcfInfoStrandBias = "SB";		// strand bias at this position
-const char *vcfInfoIsSomatic = "SOMATIC";	// indicates that the record is a somatic mutation,
-						// for cancer genomics
-const char *vcfInfoIsValidated = "VALIDATED";	// validated by follow-up experiment
-
-/* Reserved but optional per-genotype keys: */
-const char *vcfGtGenotype = "GT";	// Integer allele indices separated by "/" (unphased)
-					// or "|" (phased). Allele values are 0 for
-					// reference allele, 1 for the first allele in ALT,
-					// 2 for the second allele in ALT and so on.
-const char *vcfGtDepth = "DP";		// Read depth at this position for this sample
-const char *vcfGtFilter = "FT";		// Analogous to variant's FILTER field
-const char *vcfGtLikelihoods = "GL";	// Three floating point log10-scaled likelihoods for
-					// AA,AB,BB genotypes where A=ref and B=alt;
-					// not applicable if site is not biallelic.
-const char *vcfGtPhred = "PL";		// Phred-scaled genotype likelihoods rounded to closest int
-const char *vcfGtConditionalQual = "GQ";// Conditional genotype quality
-					// i.e. phred quality -10log_10 P(genotype call is wrong,
-					// conditioned on the site's being variant)
-const char *vcfGtHaplotypeQualities = "HQ";	// two phred qualities comma separated
-const char *vcfGtPhaseSet = "PS";	// Set of phased genotypes to which this genotype belongs
-const char *vcfGtPhasingQuality = "PQ";	// Phred-scaled P(alleles ordered wrongly in heterozygote)
-const char *vcfGtExpectedAltAlleleCount = "EC";	// Typically used in association analyses
-
-
-// Make definitions of reserved INFO and genotype keys, in case people take them for
-// granted and don't make ##INFO headers for them:
-static struct vcfInfoDef *vcfSpecInfoDefs = NULL;
-static struct vcfInfoDef *vcfSpecGtFormatDefs = NULL;
-
-static void addInfoDef(struct vcfInfoDef **pList,
-		       const char *key, int fieldCount, enum vcfInfoType type, char *description)
-/* Allocate and initialize an info def and add it to pList. */
-{
-struct vcfInfoDef *def;
-AllocVar(def);
-def->key = (char *)key;
-def->fieldCount = fieldCount;
-def->type = type;
-def->description = description;
-slAddHead(pList, def);
-}
-
-static void initVcfSpecInfoDefs()
-/* Make linked list of INFO defs reserved in the spec. */
-{
-if (vcfSpecInfoDefs != NULL)
-    return;
-addInfoDef(&vcfSpecInfoDefs, vcfInfoAncestralAllele, 1, vcfInfoString, "Ancestral allele");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoPerAlleleGtCount, 1, vcfInfoInteger,
-	   "Allele count in genotypes, for each ALT allele, in the same order as listed");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoAlleleFrequency, -1, vcfInfoFloat,
-	   "Allele frequency for each ALT allele in the same order as listed: "
-	   "use this when estimated from primary data, not called genotypes");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoNumAlleles, 1, vcfInfoInteger,
-	   "Total number of alleles in called genotypes");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoBaseQuality, 1, vcfInfoFloat,
-	   "RMS base quality at this position");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoCigar, 1, vcfInfoString,
-	   "CIGAR string describing how to align an alternate allele to the reference allele");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoIsDbSnp, 0, vcfInfoFlag, "dbSNP membership");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoDepth, 1, vcfInfoString,
-	   "Combined depth across samples, e.g. DP=154");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoEnd, 1, vcfInfoInteger,
-	   "End position of the variant described in this record "
-	   "(especially for structural variants)");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoIsHapMap2, 1, vcfInfoFlag, "Membership in HapMap 2");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoIsHapMap3, 1, vcfInfoFlag, "Membership in HapMap 3");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoIs1000Genomes, 1, vcfInfoFlag, "Membership in 1000 Genomes");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoMappingQuality, 1, vcfInfoFloat,
-	   "RMS mapping quality, e.g. MQ=52");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoMapQual0Count, 1, vcfInfoInteger,
-	   "Number of MAPQ == 0 reads covering this record");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoNumSamples, 1, vcfInfoInteger, "Number of samples with data");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoStrandBias, 1, vcfInfoString, "Strand bias at this position");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoIsSomatic, 1, vcfInfoFlag,
-	   "Indicates that the record is a somatic mutation, for cancer genomics");
-addInfoDef(&vcfSpecInfoDefs, vcfInfoIsValidated, 1, vcfInfoFlag,
-	   "Validated by follow-up experiment");
-}
-
-
-static void initVcfSpecGtFormatDefs()
-/* Make linked list of genotype info defs reserved in spec. */
-{
-if (vcfSpecGtFormatDefs != NULL)
-    return;
-addInfoDef(&vcfSpecGtFormatDefs, vcfGtGenotype, 1, vcfInfoString,
-	   "Integer allele indices separated by \"/\" (unphased) "
-	   "or \"|\" (phased). Allele values are 0 for "
-	   "reference allele, 1 for the first allele in ALT, "
-	   "2 for the second allele in ALT and so on, or \".\" for unknown");
-addInfoDef(&vcfSpecGtFormatDefs, vcfGtDepth, 1, vcfInfoInteger,
-	   "Read depth at this position for this sample");
-addInfoDef(&vcfSpecGtFormatDefs, vcfGtFilter, 1, vcfInfoString,
-	   "PASS to indicate that all filters have been passed, "
-	   "a semi-colon separated list of codes for filters that fail, "
-	   "or \".\" to indicate that filters have not been applied");
-addInfoDef(&vcfSpecGtFormatDefs, vcfGtLikelihoods, -1, vcfInfoFloat,
-	   "Genotype likelihoods comprised of comma separated floating point "
-	   "log10-scaled likelihoods for all possible genotypes given the set "
-	   "of alleles defined in the REF and ALT fields. ");
-addInfoDef(&vcfSpecGtFormatDefs, vcfGtPhred, -1, vcfInfoInteger,
-	   "Phred-scaled genotype likelihoods rounded to the closest integer "
-	   "(and otherwise defined precisely as the genotype likelihoods (GL) field)");
-addInfoDef(&vcfSpecGtFormatDefs, vcfGtConditionalQual, -1, vcfInfoFloat,
-	   "phred-scaled genotype posterior probabilities "
-	   "(and otherwise defined precisely as the genotype likelihoods (GL) field)"
-	   "; intended to store imputed genotype probabilities");
-addInfoDef(&vcfSpecGtFormatDefs, vcfGtHaplotypeQualities, 2, vcfInfoFloat,
-	   "Two comma-separated phred-scaled haplotype qualities");
-addInfoDef(&vcfSpecGtFormatDefs, vcfGtPhaseSet, 1, vcfInfoFloat,
-	   "A set of phased genotypes to which this genotype belongs");
-addInfoDef(&vcfSpecGtFormatDefs, vcfGtPhasingQuality, 1, vcfInfoFloat,
-	   "Phasing quality, the phred-scaled probability that alleles are ordered "
-	   "incorrectly in a heterozygote (against all other members in the phase set)");
-addInfoDef(&vcfSpecGtFormatDefs, vcfGtExpectedAltAlleleCount, 1, vcfInfoFloat,
-	   "Expected alternate allele count (typically used in association analyses)");
-}
-
-static bool vcfFileStopDueToErrors(struct vcfFile *vcff)
-/* determine if we should stop due to the number of errors */
-{
-return vcff->errCnt > vcff->maxErr;
-}
-
-static void vcfFileErr(struct vcfFile *vcff, char *format, ...)
-#if defined(__GNUC__)
-__attribute__((format(printf, 2, 3)))
-#endif
-;
-
-static void vcfFileErr(struct vcfFile *vcff, char *format, ...)
-/* Send error message to errabort stack's warn handler and abort */
-{
-vcff->errCnt++;
-if (vcff->maxErr == VCF_IGNORE_ERRS)
-    return;
-va_list args;
-va_start(args, format);
-char formatPlus[1024];
-if (vcff->lf != NULL)
-    sprintf(formatPlus, "%s:%d: %s", vcff->lf->fileName, vcff->lf->lineIx, format);
-else
-    strcpy(formatPlus, format);
-vaWarn(formatPlus, args);
-va_end(args);
-if (vcfFileStopDueToErrors(vcff))
-    errAbort("VCF: %d parser errors, quitting", vcff->errCnt);
-}
-
-static void *vcfFileAlloc(struct vcfFile *vcff, size_t size)
-/* Use vcff's local mem to allocate memory. */
-{
-return lmAlloc( vcfFileLm(vcff), size);
-}
-
-INLINE char *vcfFileCloneStrZ(struct vcfFile *vcff, char *str, size_t size)
-/* Use vcff's local mem to allocate memory for a string and copy it. */
-{
-return lmCloneStringZ( vcfFileLm(vcff), str, size);
-}
-
-INLINE char *vcfFileCloneStr(struct vcfFile *vcff, char *str)
-/* Use vcff's local mem to allocate memory for a string and copy it. */
-{
-return vcfFileCloneStrZ(vcff, str, strlen(str));
-}
-
-INLINE char *vcfFileCloneSubstr(struct vcfFile *vcff, char *line, regmatch_t substr)
-/* Allocate memory for and copy a substring of line. */
-{
-return vcfFileCloneStrZ(vcff, line+substr.rm_so, (substr.rm_eo - substr.rm_so));
-}
-
-#define vcfFileCloneVar(vcff, var) lmCloneMem( vcfFileLm(vcff), var, sizeof(var))
-
-char *vcfFilePooledStr(struct vcfFile *vcff, char *str)
-/* Allocate memory for a string from vcff's shared string pool. */
-{
-return hashStoreName(vcff->pool, str);  // Always stored in main pool, not reuse pool
-}
-
-static enum vcfInfoType vcfInfoTypeFromSubstr(struct vcfFile *vcff, char *line, regmatch_t substr)
-/* Translate substring of line into vcfInfoType or complain. */
-{
-char typeWord[16];
-int substrLen = substr.rm_eo - substr.rm_so;
-if (substrLen > sizeof(typeWord) - 1)
-    {
-    vcfFileErr(vcff, "substring passed to vcfInfoTypeFromSubstr is too long.");
-    return vcfInfoString;
-    }
-safencpy(typeWord, sizeof(typeWord), line + substr.rm_so, substrLen);
-if (sameString("Integer", typeWord))
-    return vcfInfoInteger;
-if (sameString("Float", typeWord))
-    return vcfInfoFloat;
-if (sameString("Flag", typeWord))
-    return vcfInfoFlag;
-if (sameString("Character", typeWord))
-    return vcfInfoCharacter;
-if (sameString("String", typeWord))
-    return vcfInfoString;
-vcfFileErr(vcff, "Unrecognized type word \"%s\" in metadata line \"%s\"", typeWord, line);
-return vcfInfoString;
-}
-
-// Regular expressions to check format and extract information from header lines:
-static const char *fileformatRegex = "^##(file)?format=VCFv([0-9]+)(\\.([0-9]+))?$";
-static const char *infoOrFormatRegex =
-    "^##(INFO|FORMAT)="
-    "<ID=([A-Za-z0-9_:-]+),"
-    "Number=(\\.|A|G|[0-9-]+),"
-    "Type=([A-Za-z]+),"
-    "Description=\"?(.*)\"?>$";
-static const char *filterOrAltRegex =
-    "^##(FILTER|ALT)="
-    "<ID=([^,]+),"
-    "(Description|Type)=\"?(.*)\"?>$";
-// VCF version 3.3 was different enough to warrant separate regexes:
-static const char *infoOrFormatRegex3_3 =
-    "^##(INFO|FORMAT)="
-    "([A-Za-z0-9_:-]+),"
-    "(\\.|A|G|[0-9-]+),"
-    "([A-Za-z]+),"
-    "\"?(.*)\"?$";
-static const char *filterRegex3_3 =
-    "^##(FILTER)="
-    "([^,]+),"
-    "()\"?(.*)\"?$";
-
-INLINE void nonAsciiWorkaround(char *line)
-// Workaround for annoying 3-byte quote marks included in some 1000 Genomes files:
-{
-(void)strSwapStrs(line, strlen(line)+1, "\342\200\234", "\"");
-(void)strSwapStrs(line, strlen(line)+1, "\342\200\235", "\"");
-}
-
-static void parseMetadataLine(struct vcfFile *vcff, char *line)
-/* Parse a VCF header line beginning with "##" that defines a metadata. */
-{
-char *ptr = line;
-if (ptr == NULL && !startsWith(ptr, "##"))
-    errAbort("Bad line passed to parseMetadataLine");
-ptr += 2;
-char *firstEq = strchr(ptr, '=');
-if (firstEq == NULL)
-    {
-    if (vcff->majorVersion > 4 ||
-	(vcff->majorVersion == 4 && vcff->minorVersion > 0))
-	vcfFileErr(vcff, "Metadata line lacks '=': \"%s\"", line);
-    return;
-    }
-regmatch_t substrs[8];
-// Some of the metadata lines are crucial for parsing the rest of the file:
-if (startsWith("##fileformat=", line) || startsWith("##format", line))
-    {
-    if (regexMatchSubstr(line, fileformatRegex, substrs, ArraySize(substrs)))
-	{
-	// substrs[2] is major version #, substrs[3] is set only if there is a minor version,
-	// and substrs[4] is the minor version #.
-	vcff->majorVersion = atoi(line + substrs[2].rm_so);
-	if (substrs[3].rm_so != -1)
-	    vcff->minorVersion = atoi(line + substrs[4].rm_so);
-	}
-    else
-	vcfFileErr(vcff, "##fileformat line does not match expected pattern /%s/: \"%s\"",
-		   fileformatRegex, line);
-    }
-else if (startsWith("##INFO=", line) || startsWith("##FORMAT=", line))
-    {
-    boolean isInfo = startsWith("##INFO=", line);
-    nonAsciiWorkaround(line);
-    if (regexMatchSubstr(line, infoOrFormatRegex, substrs, ArraySize(substrs)) ||
-	regexMatchSubstr(line, infoOrFormatRegex3_3, substrs, ArraySize(substrs)))
-	// substrs[2] is ID/key, substrs[3] is Number, [4] is Type and [5] is Description.
-	{
-	struct vcfInfoDef *def = vcfFileAlloc(vcff, sizeof(struct vcfInfoDef));
-	def->key = vcfFileCloneSubstr(vcff, line, substrs[2]);
-	char *number = vcfFileCloneSubstr(vcff, line, substrs[3]);
-	if (sameString(number, ".") || sameString(number, "A") || sameString(number, "G"))
-	    // A is #alts which varies line-to-line; "G" is #genotypes which we haven't
-	    // yet seen.  Why is there a G here -- shouldn't such attributes go in the
-	    // genotype columns?
-	    def->fieldCount = -1;
-	else
-	    def->fieldCount = atoi(number);
-	def->type = vcfInfoTypeFromSubstr(vcff, line, substrs[4]);
-	// greedy regex pulls in end quote, trim if found:
-	if (line[substrs[5].rm_eo-1] == '"')
-	    line[substrs[5].rm_eo-1] = '\0';
-	def->description = vcfFileCloneSubstr(vcff, line, substrs[5]);
-	slAddHead((isInfo ? &(vcff->infoDefs) : &(vcff->gtFormatDefs)), def);
-	}
-    else
-	vcfFileErr(vcff, "##%s line does not match expected pattern /%s/ or /%s/: \"%s\"",
-		   (isInfo ? "INFO" : "FORMAT"), infoOrFormatRegex, infoOrFormatRegex3_3, line);
-    }
-else if (startsWith("##FILTER=", line) || startsWith("##ALT=", line))
-    {
-    boolean isFilter = startsWith("##FILTER", line);
-    if (regexMatchSubstr(line, filterOrAltRegex, substrs, ArraySize(substrs)) ||
-	regexMatchSubstr(line, filterRegex3_3, substrs, ArraySize(substrs)))
-	{
-	// substrs[2] is ID/key, substrs[4] is Description.
-	struct vcfInfoDef *def = vcfFileAlloc(vcff, sizeof(struct vcfInfoDef));
-	def->key = vcfFileCloneSubstr(vcff, line, substrs[2]);
-	// greedy regex pulls in end quote, trim if found:
-	if (line[substrs[4].rm_eo-1] == '"')
-	    line[substrs[4].rm_eo-1] = '\0';
-	def->description = vcfFileCloneSubstr(vcff, line, substrs[4]);
-	slAddHead((isFilter ? &(vcff->filterDefs) : &(vcff->altDefs)), def);
-	}
-    else
-	{
-	if (isFilter)
-	    vcfFileErr(vcff, "##FILTER line does not match expected pattern /%s/ or /%s/: \"%s\"",
-		       filterOrAltRegex, filterRegex3_3, line);
-	else
-	    vcfFileErr(vcff, "##ALT line does not match expected pattern /%s/: \"%s\"",
-		       filterOrAltRegex, line);
-	}
-    }
-}
-
-static void expectColumnName2(struct vcfFile *vcff, char *exp1, char *exp2, char *words[], int ix)
-/* Every file must include a header naming the columns, though most column names are
- * fixed; make sure the names of fixed columns are as expected. */
-{
-if (! sameString(exp1, words[ix]))
-    {
-    if (exp2 == NULL)
-	vcfFileErr(vcff, "Expected column %d's name in header to be \"%s\" but got \"%s\"",
-		   ix+1, exp1, words[ix]);
-    else if (! sameString(exp2, words[ix]))
-	vcfFileErr(vcff, "Expected column %d's name in header to be \"%s\"  or \"%s\" "
-		   "but got \"%s\"", ix+1, exp1, exp2, words[ix]);
-    }
-}
-
-#define expectColumnName(vcff, exp, words, ix) expectColumnName2(vcff, exp, NULL, words, ix)
-
-// There might be a whole lot of genotype columns...
-#define VCF_MAX_COLUMNS 16 * 1024
-
-static void parseColumnHeaderRow(struct vcfFile *vcff, char *line)
-/* Make sure column names are as we expect, and store genotype sample IDs if any are given. */
-{
-if (line[0] != '#')
-    {
-    vcfFileErr(vcff, "Expected to find # followed by column names (\"#CHROM POS ...\"), "
-	       "not \"%s\"", line);
-    lineFileReuse(vcff->lf);
-    return;
-    }
-char *words[VCF_MAX_COLUMNS];
-int wordCount = chopLine(line+1, words);
-if (wordCount >= VCF_MAX_COLUMNS)
-    vcfFileErr(vcff, "header contains at least %d columns; "
-	       "VCF_MAX_COLUMNS may need to be increased in vcf.c!", VCF_MAX_COLUMNS);
-expectColumnName(vcff, "CHROM", words, 0);
-expectColumnName(vcff, "POS", words, 1);
-expectColumnName(vcff, "ID", words, 2);
-expectColumnName(vcff, "REF", words, 3);
-expectColumnName(vcff, "ALT", words, 4);
-expectColumnName2(vcff, "QUAL", "PROB", words, 5);
-expectColumnName(vcff, "FILTER", words, 6);
-expectColumnName(vcff, "INFO", words, 7);
-if (wordCount > 8)
-    {
-    expectColumnName(vcff, "FORMAT", words, 8);
-    if (wordCount < 10)
-	vcfFileErr(vcff, "FORMAT column is given, but no sample IDs for genotype columns...?");
-    vcff->genotypeCount = (wordCount - 9);
-    vcff->genotypeIds = vcfFileAlloc(vcff, vcff->genotypeCount * sizeof(char *));
-    int i;
-    for (i = 9;  i < wordCount;  i++)
-	vcff->genotypeIds[i-9] = vcfFileCloneStr(vcff, words[i]);
-    }
-}
-
-struct vcfFile *vcfFileNew()
-/* Return a new, empty vcfFile object. */
-{
-struct vcfFile *vcff = NULL;
-AllocVar(vcff);
-vcff->pool = hashNew(0);
-vcff->reusePool = NULL;  // Must explicitly request a separate record pool
-return vcff;
-}
-
-void vcfFileMakeReusePool(struct vcfFile *vcff, int initialSize)
-// Creates a separate memory pool for records.  Establishing this pool allows
-// using vcfFileFlushRecords to abandon previously read records and free
-// the associated memory. Very useful when reading an entire file in batches.
-{
-assert(vcff->reusePool == NULL); // don't duplicate this
-vcff->reusePool = lmInit(initialSize);
-}
-
-void vcfFileFlushRecords(struct vcfFile *vcff)
-// Abandons all previously read vcff->records and flushes the reuse pool (if it exists).
-// USE WITH CAUTION.  All previously allocated record pointers are now invalid.
-{
-if (vcff->reusePool != NULL)
-    {
-    size_t poolSize = lmSize(vcff->reusePool);
-    //if (poolSize > (48 * 1024 * 1024))
-    //    printf("\nReuse pool %ld of %ld unused\n",lmAvailable(vcff->reusePool),poolSize);
-    lmCleanup(&vcff->reusePool);
-    vcff->reusePool = lmInit(poolSize);
-    }
-vcff->records = NULL;
-}
-
-static struct vcfFile *vcfFileHeaderFromLineFile(struct lineFile *lf, int maxErr)
-/* Parse a VCF file into a vcfFile object.  If maxErr not zero, then
- * continue to parse until this number of error have been reached.  A maxErr
- * less than zero does not stop and reports all errors.
- * Set maxErr to VCF_IGNORE_ERRS for silence */
-{
-initVcfSpecInfoDefs();
-initVcfSpecGtFormatDefs();
-if (lf == NULL)
-    return NULL;
-struct vcfFile *vcff = vcfFileNew();
-vcff->lf = lf;
-vcff->fileOrUrl = vcfFileCloneStr(vcff, lf->fileName);
-vcff->maxErr = (maxErr < 0) ? INT_MAX : maxErr;
-
-struct dyString *dyHeader = dyStringNew(1024);
-char *line = NULL;
-// First, metadata lines beginning with "##":
-while (lineFileNext(lf, &line, NULL) && startsWith("##", line))
-    {
-    dyStringAppend(dyHeader, line);
-    dyStringAppendC(dyHeader, '\n');
-    parseMetadataLine(vcff, line);
-    }
-slReverse(&(vcff->infoDefs));
-slReverse(&(vcff->filterDefs));
-slReverse(&(vcff->gtFormatDefs));
-// Did we get the bare minimum VCF header with supported version?
-if (vcff->majorVersion == 0)
-    vcfFileErr(vcff, "missing ##fileformat= header line?  Assuming 4.1.");
-if ((vcff->majorVersion != 4 || (vcff->minorVersion != 0 && vcff->minorVersion != 1)) &&
-    (vcff->majorVersion != 3))
-    vcfFileErr(vcff, "VCFv%d.%d not supported -- only v3.*, v4.0 or v4.1",
-	       vcff->majorVersion, vcff->minorVersion);
-// Next, one header line beginning with single "#" that names the columns:
-if (line == NULL)
-    // EOF after metadata
-    return vcff;
-dyStringAppend(dyHeader, line);
-dyStringAppendC(dyHeader, '\n');
-parseColumnHeaderRow(vcff, line);
-vcff->headerString = dyStringCannibalize(&dyHeader);
-return vcff;
-}
-
-
-#define VCF_MAX_INFO 512
-
-static void parseRefAndAlt(struct vcfFile *vcff, struct vcfRecord *record, char *ref, char *alt)
-/* Make an array of alleles, ref first, from the REF and comma-sep'd ALT columns.
- * Use the length of the reference sequence to set record->chromEnd.
- * Note: this trashes the alt argument, since this is expected to be its last use. */
-{
-char *altAlleles[VCF_MAX_INFO];
-int altCount = chopCommas(alt, altAlleles);
-record->alleleCount = 1 + altCount;
-record->alleles = vcfFileAlloc(vcff, record->alleleCount * sizeof(record->alleles[0]));
-record->alleles[0] = vcfFilePooledStr(vcff, ref);
-int i;
-for (i = 0;  i < altCount;  i++)
-    record->alleles[1+i] = vcfFilePooledStr(vcff, altAlleles[i]);
-int refLen = strlen(ref);
-if (refLen == dnaFilteredSize(ref))
-    record->chromEnd = record->chromStart + refLen;
-}
-
-static void parseFilterColumn(struct vcfFile *vcff, struct vcfRecord *record, char *filterStr)
-/* Transform ;-separated filter codes into count + string array. */
-{
-// We don't want to modify something allocated with vcfFilePooledStr because that uses
-// hash element names for storage!  So don't make a vcfFilePooledStr copy of filterStr and
-// chop that; instead, chop a temp string and pool the words separately.
-static struct dyString *tmp = NULL;
-if (tmp == NULL)
-    tmp = dyStringNew(0);
-dyStringClear(tmp);
-dyStringAppend(tmp, filterStr);
-record->filterCount = countChars(filterStr, ';') + 1;
-record->filters = vcfFileAlloc(vcff, record->filterCount * sizeof(char **));
-(void)chopByChar(tmp->string, ';', record->filters, record->filterCount);
-int i;
-for (i = 0;  i < record->filterCount;  i++)
-    record->filters[i] = vcfFilePooledStr(vcff, record->filters[i]);
-}
-
-struct vcfInfoDef *vcfInfoDefForKey(struct vcfFile *vcff, const char *key)
-/* Return infoDef for key, or NULL if it wasn't specified in the header or VCF spec. */
-{
-struct vcfInfoDef *def;
-// I expect there to be fairly few definitions (less than a dozen) so
-// I'm just doing a linear search not hash:
-for (def = vcff->infoDefs;  def != NULL;  def = def->next)
-    {
-    if (sameString(key, def->key))
-	return def;
-    }
-for (def = vcfSpecInfoDefs;  def != NULL;  def = def->next)
-    {
-    if (sameString(key, def->key))
-	return def;
-    }
-return NULL;
-}
-
-static enum vcfInfoType typeForInfoKey(struct vcfFile *vcff, const char *key)
-/* Look up the type of INFO component key, in the definitions from the header,
- * and failing that, from the keys reserved in the spec. */
-{
-struct vcfInfoDef *def = vcfInfoDefForKey(vcff, key);
-return def ? def->type : vcfInfoString;
-}
-
-static int parseInfoValue(struct vcfRecord *record, char *infoKey, enum vcfInfoType type,
-			  char *valStr, union vcfDatum **pData, bool **pMissingData)
-/* Parse a comma-separated list of values into array of union vcfInfoDatum and return count. */
-{
-char *valWords[VCF_MAX_INFO];
-int count = chopCommas(valStr, valWords);
-struct vcfFile *vcff = record->file;
-union vcfDatum *data = vcfFileAlloc(vcff, count * sizeof(union vcfDatum));
-bool *missingData = vcfFileAlloc(vcff, count * sizeof(*missingData));
-int j;
-for (j = 0;  j < count;  j++)
-    {
-    if (type != vcfInfoString && type != vcfInfoCharacter && sameString(valWords[j], "."))
-	missingData[j] = TRUE;
-    switch (type)
-	{
-	case vcfInfoInteger:
-	    data[j].datInt = atoi(valWords[j]);
-	    break;
-	case vcfInfoFloat:
-	    data[j].datFloat = atof(valWords[j]);
-	    break;
-	case vcfInfoFlag:
-	    // Flag key might have a value in older VCFs e.g. 3.2's DB=0, DB=1
-	    data[j].datString = vcfFilePooledStr(vcff, valWords[j]);
-	    break;
-	case vcfInfoCharacter:
-	    data[j].datChar = valWords[j][0];
-	    break;
-	case vcfInfoString:
-	    data[j].datString = vcfFilePooledStr(vcff, valWords[j]);
-	    break;
-	default:
-	    errAbort("invalid vcfInfoType (uninitialized?) %d", type);
-	    break;
-	}
-    }
-// If END is given, use it as chromEnd:
-if (sameString(infoKey, vcfInfoEnd))
-    record->chromEnd = data[0].datInt;
-*pData = data;
-*pMissingData = missingData;
-return count;
-}
-
-static void parseInfoColumn(struct vcfFile *vcff, struct vcfRecord *record, char *string)
-/* Translate string into array of vcfInfoElement. */
-{
-if (sameString(string, "."))
-    {
-    record->infoCount = 0;
-    return;
-    }
-char *elWords[VCF_MAX_INFO];
-record->infoCount = chopByChar(string, ';', elWords, ArraySize(elWords));
-if (record->infoCount >= VCF_MAX_INFO)
-    vcfFileErr(vcff, "INFO column contains at least %d elements; "
-	       "VCF_MAX_INFO may need to be increased in vcf.c!", VCF_MAX_INFO);
-record->infoElements = vcfFileAlloc(vcff, record->infoCount * sizeof(struct vcfInfoElement));
-char *emptyString = vcfFilePooledStr(vcff, "");
-int i;
-for (i = 0;  i < record->infoCount;  i++)
-    {
-    char *elStr = elWords[i];
-    char *eq = strchr(elStr, '=');
-    struct vcfInfoElement *el = &(record->infoElements[i]);
-    if (eq == NULL)
-	{
-	el->key = vcfFilePooledStr(vcff, elStr);
-	enum vcfInfoType type = typeForInfoKey(vcff, el->key);
-	if (type != vcfInfoFlag)
-	    {
-	    struct vcfInfoDef *def = vcfInfoDefForKey(vcff, el->key);
-	    // Complain only if we are expecting a particular number of values for this keyword:
-	    if (def != NULL && def->fieldCount >= 0)
-		vcfFileErr(vcff, "Missing = after key in INFO element: \"%s\" (type=%d)",
-			   elStr, type);
-	    if (type == vcfInfoString)
-		{
-		el->values = vcfFileAlloc(vcff, sizeof(union vcfDatum));
-		el->values[0].datString = emptyString;
-		}
-	    }
-	continue;
-	}
-    *eq = '\0';
-    el->key = vcfFilePooledStr(vcff, elStr);
-    enum vcfInfoType type = typeForInfoKey(vcff, el->key);
-    char *valStr = eq+1;
-    el->count = parseInfoValue(record, el->key, type, valStr, &(el->values), &(el->missingData));
-    if (el->count >= VCF_MAX_INFO)
-	vcfFileErr(vcff, "A single element of the INFO column has at least %d values; "
-	       "VCF_MAX_INFO may need to be increased in vcf.c!", VCF_MAX_INFO);
-    }
-}
-
-struct vcfRecord *vcfRecordFromRow(struct vcfFile *vcff, char **words)
-/* Parse words from a VCF data line into a VCF record structure. */
-{
-struct vcfRecord *record = vcfFileAlloc(vcff, sizeof(struct vcfRecord));
-record->file = vcff;
-record->chrom = vcfFilePooledStr(vcff, words[0]);
-record->chromStart = lineFileNeedNum(vcff->lf, words, 1) - 1;
-// chromEnd may be overwritten by parseRefAndAlt and parseInfoColumn.
-record->chromEnd = record->chromStart+1;
-record->name = vcfFilePooledStr(vcff, words[2]);
-parseRefAndAlt(vcff, record, words[3], words[4]);
-record->qual = vcfFilePooledStr(vcff, words[5]);
-parseFilterColumn(vcff, record, words[6]);
-parseInfoColumn(vcff, record, words[7]);
-if (vcff->genotypeCount > 0)
-    {
-    record->format = vcfFilePooledStr(vcff, words[8]);
-    record->genotypeUnparsedStrings = vcfFileAlloc(vcff,
-						   vcff->genotypeCount * sizeof(char *));
-    int i;
-    // Don't bother actually parsing all these until & unless we need the info:
-    for (i = 0;  i < vcff->genotypeCount;  i++)
-	record->genotypeUnparsedStrings[i] = vcfFileCloneStr(vcff, words[9+i]);
-    }
-return record;
-}
-
-static int checkWordCount(struct vcfFile *vcff, char **words, int wordCount)
-// Compensate for error in 1000 Genomes Phase 1 file
-// ALL.chr21.integrated_phase1_v3.20101123.snps_indels_svs.genotypes.vcf.gz
-// which has some lines that have an extra "\t" at the end of line,
-// causing the wordCount to be too high by 1:
-{
-int expected = 8;
-if (vcff->genotypeCount > 0)
-    expected = 9 + vcff->genotypeCount;
-if (wordCount == expected+1 && words[expected][0] == '\0')
-    wordCount--;
-lineFileExpectWords(vcff->lf, expected, wordCount);
-return wordCount;
-}
-
-struct vcfRecord *vcfNextRecord(struct vcfFile *vcff)
-/* Parse the words in the next line from vcff into a vcfRecord. Return NULL at end of file.
- * Note: this does not store record in vcff->records! */
-{
-char *words[VCF_MAX_COLUMNS];
-int wordCount;
-if ((wordCount = lineFileChopTab(vcff->lf, words)) <= 0)
-    return NULL;
-wordCount = checkWordCount(vcff, words, wordCount);
-return vcfRecordFromRow(vcff, words);
-}
-
-static boolean allelesHavePaddingBase(char **alleles, int alleleCount)
-/* Examine alleles to see if they either a) all start with the same base or
- * b) include a symbolic or 0-length allele.  In either of those cases, there
- * must be an initial padding base that we'll need to trim from non-symbolic
- * alleles. */
-{
-boolean hasPaddingBase = TRUE;
-char firstBase = '\0';
-if (isAllNt(alleles[0], strlen(alleles[0])))
-    firstBase = alleles[0][0];
-int i;
-for (i = 1;  i < alleleCount;  i++)
-    {
-    if (isAllNt(alleles[i], strlen(alleles[i])))
-	{
-	if (firstBase == '\0')
-	    firstBase = alleles[i][0];
-	if (alleles[i][0] != firstBase)
-	    // Different first base implies unpadded alleles.
-	    hasPaddingBase = FALSE;
-	}
-    else
-	{
-	// Symbolic ALT allele: REF must have the padding base.
-	hasPaddingBase = TRUE;
-	break;
-	}
-    }
-return hasPaddingBase;
-}
-
-unsigned int vcfRecordTrimIndelLeftBase(struct vcfRecord *rec)
-/* For indels, VCF includes the left neighboring base; for example, if the alleles are
- * AA/- following a G base, then the VCF record will start one base to the left and have
- * "GAA" and "G" as the alleles.  Also, if any alt allele is symbolic (e.g. <DEL>) then
- * the ref allele must have a padding base.
- * That is not nice for display for two reasons:
- * 1. Indels appear one base wider than their dbSNP entries.
- * 2. In pgSnp display mode, the two alleles are always the same color.
- * However, for hgTracks' mapBox we need the correct chromStart for identifying the
- * record in hgc -- so return the original chromStart. */
-{
-unsigned int chromStartOrig = rec->chromStart;
-struct vcfFile *vcff = rec->file;
-if (rec->alleleCount > 1)
-    {
-    boolean hasPaddingBase = allelesHavePaddingBase(rec->alleles, rec->alleleCount);
-    if (hasPaddingBase)
-	{
-	rec->chromStart++;
-	int i;
-	for (i = 0;  i < rec->alleleCount;  i++)
-	    {
-	    if (rec->alleles[i][1] == '\0')
-		rec->alleles[i] = vcfFilePooledStr(vcff, "-");
-	    else if (isAllNt(rec->alleles[i], strlen(rec->alleles[i])))
-		rec->alleles[i] = vcfFilePooledStr(vcff, rec->alleles[i]+1);
-	    else // don't trim first character of symbolic allele
-		rec->alleles[i] = vcfFilePooledStr(vcff, rec->alleles[i]);
-	    }
-	}
-    }
-return chromStartOrig;
-}
-
-static boolean allEndsGEStartsAndIdentical(char **starts, char **ends, int count)
-/* Given two arrays with <count> elements, return true if all strings in ends[] are
- * greater than or equal to the corresponding strings in starts[], and all ends[]
- * have the same char. */
-{
-int i;
-char refEnd = ends[0][0];
-for (i = 0;  i < count;  i++)
-    {
-    if (ends[i] < starts[i] || ends[i][0] != refEnd)
-	return FALSE;
-    }
-return TRUE;
-}
-
-static int countIdenticalBasesRight(char **alleles, int alCount)
-/* Return the number of bases that are identical at the end of each allele (usually 0). */
-{
-char *alleleEnds[alCount];
-int i;
-for (i = 0;  i < alCount;  i++)
-    {
-    int alLen = strlen(alleles[i]);
-    // If any allele is symbolic, don't try to trim.
-    if (!isAllNt(alleles[i], alLen))
-	return 0;
-    alleleEnds[i] = alleles[i] + alLen-1;
-    }
-int trimmedBases = 0;
-while (allEndsGEStartsAndIdentical(alleles, alleleEnds, alCount))
-    {
-    trimmedBases++;
-    // Trim identical last base of alleles and move alleleEnds[] items back.
-    for (i = 0;  i < alCount;  i++)
-	alleleEnds[i]--;
-    }
-return trimmedBases;
-}
-
-unsigned int vcfRecordTrimAllelesRight(struct vcfRecord *rec)
-/* Some tools output indels with extra base to the right, for example ref=ACC, alt=ACCC
- * which should be ref=A, alt=AC.  When the extra bases make the variant extend from an
- * intron (or gap) into an exon, it can cause a false appearance of a frameshift.
- * To avoid this, when all alleles have identical base(s) at the end, trim all of them,
- * and update rec->chromEnd.
- * For hgTracks' mapBox we need the correct chromStart for identifying the record in hgc,
- * so return the original chromEnd. */
-{
-unsigned int chromEndOrig = rec->chromEnd;
-int alCount = rec->alleleCount;
-char **alleles = rec->alleles;
-int trimmedBases = countIdenticalBasesRight(alleles, alCount);
-if (trimmedBases > 0)
-    {
-    struct vcfFile *vcff = rec->file;
-    // Allocate new pooled strings for the trimmed alleles.
-    int i;
-    for (i = 0;  i < alCount;  i++)
-	{
-	int alLen = strlen(alleles[i]); // alLen >= trimmedBases > 0
-	char trimmed[alLen+1];
-	safencpy(trimmed, sizeof(trimmed), alleles[i], alLen - trimmedBases);
-	if (isEmpty(trimmed))
-	    safencpy(trimmed, sizeof(trimmed), "-", 1);
-	alleles[i] = vcfFilePooledStr(vcff, trimmed);
-	}
-    rec->chromEnd -= trimmedBases;
-    }
-return chromEndOrig;
-}
-
-static boolean chromsMatch(char *chromA, char *chromB)
-// Return TRUE if chromA and chromB are non-NULL and identical, possibly ignoring
-// "chr" at the beginning of one but not the other.
-{
-if (chromA == NULL || chromB == NULL)
-    return FALSE;
-char *chromAPlus = startsWith("chr", chromA) ? chromA+3 : chromA;
-char *chromBPlus = startsWith("chr", chromB) ? chromB+3 : chromB;
-return sameString(chromAPlus, chromBPlus);
-}
-
-static struct vcfRecord *vcfParseData(struct vcfFile *vcff, char *chrom, int start, int end,
-				      int maxRecords)
-// Given a vcfFile into which the header has been parsed, and whose
-// lineFile is positioned at the beginning of a data row, parse and
-// return all data rows (in region, if chrom is non-NULL) from lineFile,
-// up to maxRecords.
-{
-if (vcff == NULL)
-    return NULL;
-int recCount = 0;
-struct vcfRecord *records = NULL;
-struct vcfRecord *record;
-while ((record = vcfNextRecord(vcff)) != NULL)
-    {
-    if (maxRecords >= 0 && recCount >= maxRecords)
-        break;
-    if (chrom == NULL)
-	{
-	slAddHead(&records, record);
-	recCount++;
-	}
-    else if (chromsMatch(chrom, record->chrom))
-	{
-	if (end > 0 && record->chromStart >= end)
-	    break;
-	else if (record->chromEnd > start)
-	    {
-	    slAddHead(&records, record);
-	    recCount++;
-	    }
-	}
-    }
-slReverse(&records);
-return records;
-}
-
-struct vcfFile *vcfFileMayOpen(char *fileOrUrl, char *chrom, int start, int end,
-			       int maxErr, int maxRecords, boolean parseAll)
-/* Open fileOrUrl and parse VCF header; return NULL if unable.
- * If chrom is non-NULL, scan past any variants that precede {chrom, chromStart}.
- * Note: this is very inefficient -- it's better to use vcfTabix if possible!
- * If parseAll, then read in all lines in region, parse and store in
- * vcff->records; if maxErr >= zero, then continue to parse until
- * there are maxErr+1 errors.  A maxErr less than zero does not stop
- * and reports all errors. Set maxErr to VCF_IGNORE_ERRS for silence */
-{
-struct lineFile *lf = NULL;
-if (startsWith("http://", fileOrUrl) || startsWith("ftp://", fileOrUrl) ||
-    startsWith("https://", fileOrUrl))
-    lf = netLineFileOpen(fileOrUrl);
-else
-    lf = lineFileMayOpen(fileOrUrl, TRUE);
-struct vcfFile *vcff = vcfFileHeaderFromLineFile(lf, maxErr);
-if (vcff && chrom != NULL)
-    {
-    char *line = NULL;
-    while (lineFileNextReal(vcff->lf, &line))
-	{
-	char lineCopy[strlen(line)+1];
-	safecpy(lineCopy, sizeof(lineCopy), line);
-	char *words[VCF_MAX_COLUMNS];
-	int wordCount = chopTabs(lineCopy, words);
-	wordCount = checkWordCount(vcff, words, wordCount);
-	struct vcfRecord *record = vcfRecordFromRow(vcff, words);
-	if (chromsMatch(chrom, record->chrom))
-	    {
-	    if (record->chromEnd < start)
-		continue;
-	    else
-		{
-		lineFileReuse(vcff->lf);
-		break;
-		}
-	    }
-	}
-    }
-if (vcff && parseAll)
-    {
-    vcff->records = vcfParseData(vcff, chrom, start, end, maxRecords);
-    lineFileClose(&(vcff->lf)); // Not sure why it is closed.  Angie?
-    }
-return vcff;
-}
-
-struct vcfFile *vcfTabixFileMayOpen(char *fileOrUrl, char *chrom, int start, int end,
-				    int maxErr, int maxRecords)
-/* Open a VCF file that has been compressed and indexed by tabix and
- * parse VCF header, or return NULL if unable.  If chrom is non-NULL,
- * seek to the position range and parse all lines in range into
- * vcff->records.  If maxErr >= zero, then continue to parse until
- * there are maxErr+1 errors.  A maxErr less than zero does not stop
- * and reports all errors. Set maxErr to VCF_IGNORE_ERRS for silence */
-{
-struct lineFile *lf = lineFileTabixMayOpen(fileOrUrl, TRUE);
-struct vcfFile *vcff = vcfFileHeaderFromLineFile(lf, maxErr);
-if (vcff == NULL)
-    return NULL;
-if (isNotEmpty(chrom) && start != end)
-    {
-    if (lineFileSetTabixRegion(lf, chrom, start, end))
-        {
-        vcff->records = vcfParseData(vcff, NULL, 0, 0, maxRecords);
-        lineFileClose(&(vcff->lf)); // Not sure why it is closed.  Angie?
-        }
-    }
-return vcff;
-}
-
-int vcfRecordCmp(const void *va, const void *vb)
-/* Compare to sort based on position. */
-{
-const struct vcfRecord *a = *((struct vcfRecord **)va);
-const struct vcfRecord *b = *((struct vcfRecord **)vb);
-int dif;
-dif = strcmp(a->chrom, b->chrom);
-if (dif == 0)
-    dif = a->chromStart - b->chromStart;
-if (dif == 0)
-    dif = a->chromEnd - b->chromEnd; // shortest first
-if (dif == 0)
-    dif = strcmp(a->name, b->name);  // finally by name
-return dif;
-}
-
-int vcfTabixBatchRead(struct vcfFile *vcff, char *chrom, int start, int end,
-                      int maxErr, int maxRecords)
-// Reads a batch of records from an opened and indexed VCF file, adding them to
-// vcff->records and returning the count of new records added in this batch.
-// Note: vcff->records will continue to be sorted, even if batches are loaded
-// out of order.  Additionally, resulting vcff->records will contain no duplicates
-// so returned count refects only the new records added, as opposed to all records
-// in range.  If maxErr >= zero, then continue to parse until there are maxErr+1
-// errors.  A maxErr less than zero does not stop and reports all errors.  Set
-// maxErr to VCF_IGNORE_ERRS for silence.
-{
-int oldCount = slCount(vcff->records);
-
-if (lineFileSetTabixRegion(vcff->lf, chrom, start, end))
-    {
-    struct vcfRecord *records = vcfParseData(vcff, NULL, 0, 0, maxRecords);
-    if (records)
-        {
-        struct vcfRecord *lastRec = vcff->records;
-        if (lastRec == NULL)
-            vcff->records = records;
-        else
-            {
-            // Considered just asserting the batches were in order, but a problem may
-            // result when non-overlapping location windows pick up the same long variant.
-            slSortMergeUniq(&(vcff->records), records, vcfRecordCmp, NULL);
-            }
-        }
-    }
-
-return slCount(vcff->records) - oldCount;
-}
-
-void vcfFileFree(struct vcfFile **pVcff)
-/* Free a vcfFile object. */
-{
-if (pVcff == NULL || *pVcff == NULL)
-    return;
-struct vcfFile *vcff = *pVcff;
-if (vcff->maxErr == VCF_IGNORE_ERRS && vcff->errCnt > 0)
-    {
-    vcff->maxErr++; // Never completely silent!  Go ahead and report how many errs were detected
-    vcfFileErr(vcff,"Closing with %d errors.",vcff->errCnt);
-    }
-freez(&(vcff->headerString));
-hashFree(&(vcff->pool));
-if (vcff->reusePool)
-    lmCleanup(&vcff->reusePool);
-hashFree(&(vcff->byName));
-lineFileClose(&(vcff->lf));
-freez(pVcff);
-}
-
-const struct vcfRecord *vcfFileFindVariant(struct vcfFile *vcff, char *variantId)
-/* Return all records with name=variantId, or NULL if not found. */
-{
-struct vcfRecord *varList = NULL;
-if (vcff->byName == NULL)
-    {
-    vcff->byName = hashNew(0);
-    struct vcfRecord *rec;
-    for (rec = vcff->records;  rec != NULL;  rec = rec->next)
-	{
-	if (sameString(rec->name, variantId))
-	    {
-	    // Make shallow copy of rec so we can alter ->next:
-	    struct vcfRecord *newRec = vcfFileCloneVar(vcff,rec);
-	    slAddHead(&varList, newRec);
-	    }
-	hashAdd(vcff->byName, rec->name, rec);
-	}
-    slReverse(&varList);
-    }
-else
-    {
-    struct hashEl *hel = hashLookup(vcff->byName, variantId);
-    while (hel != NULL)
-	{
-	if (sameString(hel->name, variantId))
-	    {
-	    struct vcfRecord *rec = hel->val;
-	    struct vcfRecord *newRec = vcfFileCloneVar(vcff,rec);
-	    slAddHead(&varList, newRec);
-	    }
-	hel = hel->next;
-	}
-    // Don't reverse varList -- hash element list was already reversed
-    }
-return varList;
-}
-
-const struct vcfInfoElement *vcfRecordFindInfo(const struct vcfRecord *record, char *key)
-/* Find an INFO element, or NULL. */
-{
-int i;
-for (i = 0;  i < record->infoCount;  i++)
-    {
-    if (sameString(key, record->infoElements[i].key))
-	return &(record->infoElements[i]);
-    }
-return NULL;
-}
-
-struct vcfInfoDef *vcfInfoDefForGtKey(struct vcfFile *vcff, const char *key)
-/* Look up the type of genotype FORMAT component key, in the definitions from the header,
- * and failing that, from the keys reserved in the spec. */
-{
-struct vcfInfoDef *def;
-// I expect there to be fairly few definitions (less than a dozen) so
-// I'm just doing a linear search not hash:
-for (def = vcff->gtFormatDefs;  def != NULL;  def = def->next)
-    {
-    if (sameString(key, def->key))
-	return def;
-    }
-for (def = vcfSpecGtFormatDefs;  def != NULL;  def = def->next)
-    {
-    if (sameString(key, def->key))
-	return def;
-    }
-return NULL;
-}
-
-static enum vcfInfoType typeForGtFormat(struct vcfFile *vcff, const char *key)
-/* Look up the type of FORMAT component key, in the definitions from the header,
- * and failing that, from the keys reserved in the spec. */
-{
-struct vcfInfoDef *def = vcfInfoDefForGtKey(vcff, key);
-return def ? def->type : vcfInfoString;
-}
-
-#define VCF_MAX_FORMAT VCF_MAX_INFO
-#define VCF_MAX_FORMAT_LEN (VCF_MAX_FORMAT * 4)
-
-void vcfParseGenotypes(struct vcfRecord *record)
-/* Translate record->genotypesUnparsedStrings[] into proper struct vcfGenotype[].
- * This destroys genotypesUnparsedStrings. */
-{
-if (record->genotypeUnparsedStrings == NULL)
-    return;
-struct vcfFile *vcff = record->file;
-record->genotypes = vcfFileAlloc(vcff, vcff->genotypeCount * sizeof(struct vcfGenotype));
-char format[VCF_MAX_FORMAT_LEN];
-safecpy(format, sizeof(format), record->format);
-char *formatWords[VCF_MAX_FORMAT];
-int formatWordCount = chopByChar(format, ':', formatWords, ArraySize(formatWords));
-if (formatWordCount >= VCF_MAX_FORMAT)
-    {
-    vcfFileErr(vcff, "The FORMAT column has at least %d words; "
-	       "VCF_MAX_FORMAT may need to be increased in vcf.c!", VCF_MAX_FORMAT);
-    formatWordCount = VCF_MAX_FORMAT;
-    }
-if (differentString(formatWords[0], vcfGtGenotype))
-    vcfFileErr(vcff, "FORMAT column should begin with \"%s\" but begins with \"%s\"",
-	       vcfGtGenotype, formatWords[0]);
-int i;
-// Store the pooled format word pointers and associated types for use in inner loop below.
-enum vcfInfoType formatTypes[VCF_MAX_FORMAT];
-for (i = 0;  i < formatWordCount;  i++)
-    {
-    formatTypes[i] = typeForGtFormat(vcff, formatWords[i]);
-    formatWords[i] = vcfFilePooledStr(vcff, formatWords[i]);
-    }
-for (i = 0;  i < vcff->genotypeCount;  i++)
-    {
-    char *string = record->genotypeUnparsedStrings[i];
-    struct vcfGenotype *gt = &(record->genotypes[i]);
-    // Each genotype can have multiple :-separated info elements:
-    char *gtWords[VCF_MAX_FORMAT];
-    int gtWordCount = chopByChar(string, ':', gtWords, ArraySize(gtWords));
-    if (gtWordCount != formatWordCount)
-	vcfFileErr(vcff, "The FORMAT column has %d words but the genotype column for %s "
-		   "has %d words", formatWordCount, vcff->genotypeIds[i], gtWordCount);
-    if (gtWordCount > formatWordCount)
-	gtWordCount = formatWordCount;
-    gt->id = vcff->genotypeIds[i];
-    gt->infoCount = gtWordCount;
-    gt->infoElements = vcfFileAlloc(vcff, gtWordCount * sizeof(struct vcfInfoElement));
-    int j;
-    for (j = 0;  j < gtWordCount;  j++)
-	{
-	// Special parsing of genotype:
-	if (sameString(formatWords[j], vcfGtGenotype))
-	    {
-	    char *genotype = gtWords[j];
-	    char *sep = strchr(genotype, '|');
-	    if (sep != NULL)
-		gt->isPhased = TRUE;
-	    else
-		sep = strchr(genotype, '/');
-	    if (genotype[0] == '.')
-		gt->hapIxA = -1;
-	    else
-		gt->hapIxA = atoi(genotype);
-	    if (sep == NULL)
-		gt->isHaploid = TRUE;
-	    else if (sep[1] == '.')
-		gt->hapIxB = -1;
-	    else
-		gt->hapIxB = atoi(sep+1);
-	    }
-	struct vcfInfoElement *el = &(gt->infoElements[j]);
-	el->key = formatWords[j];
-	el->count = parseInfoValue(record, formatWords[j], formatTypes[j], gtWords[j],
-				   &(el->values), &(el->missingData));
-	if (el->count >= VCF_MAX_INFO)
-	    vcfFileErr(vcff, "A single element of the genotype column for \"%s\" "
-		       "has at least %d values; "
-		       "VCF_MAX_INFO may need to be increased in vcf.c!",
-		       gt->id, VCF_MAX_INFO);
-	}
-    }
-record->genotypeUnparsedStrings = NULL;
-}
-
-const struct vcfGenotype *vcfRecordFindGenotype(struct vcfRecord *record, char *sampleId)
-/* Find the genotype and associated info for the individual, or return NULL.
- * This calls vcfParseGenotypes if it has not already been called. */
-{
-struct vcfFile *vcff = record->file;
-if (sampleId == NULL || vcff->genotypeCount == 0)
-    return NULL;
-vcfParseGenotypes(record);
-int ix = stringArrayIx(sampleId, vcff->genotypeIds, vcff->genotypeCount);
-if (ix >= 0)
-    return &(record->genotypes[ix]);
-return NULL;
-}
-
-static char *vcfDataLineAutoSqlString =
-        "table vcfDataLine"
-        "\"The fields of a Variant Call Format data line\""
-        "    ("
-        "    string chrom;      \"An identifier from the reference genome\""
-        "    uint pos;          \"The reference position, with the 1st base having position 1\""
-        "    string id;         \"Semi-colon separated list of unique identifiers where available\""
-        "    string ref;                \"Reference base(s)\""
-        "    string alt;                \"Comma separated list of alternate non-reference alleles "
-                                         "called on at least one of the samples\""
-        "    string qual;       \"Phred-scaled quality score for the assertion made in ALT. i.e. "
-                                 "give -10log_10 prob(call in ALT is wrong)\""
-        "    string filter;     \"PASS if this position has passed all filters. Otherwise, a "
-                                  "semicolon-separated list of codes for filters that fail\""
-        "    string info;       \"Additional information encoded as a semicolon-separated series "
-                                 "of short keys with optional comma-separated values\""
-        "    string format;     \"If genotype columns are specified in header, a "
-                                 "semicolon-separated list of of short keys starting with GT\""
-        "    string genotypes;  \"If genotype columns are specified in header, a tab-separated "
-                                 "set of genotype column values; each value is a colon-separated "
-                                 "list of values corresponding to keys in the format column\""
-        "    )";
-
-struct asObject *vcfAsObj()
-// Return asObject describing fields of VCF
-{
-return asParseText(vcfDataLineAutoSqlString);
-}
-
-char *vcfGetSlashSepAllelesFromWords(char **words, struct dyString *dy)
-/* Overwrite dy with a /-separated allele string from VCF words,
- * skipping the extra initial base that VCF requires for indel alleles if necessary,
- * and trimming identical bases at the ends of all alleles if there are any.
- * Return dy->string for convenience. */
-{
-// VCF reference allele gets its own column:
-char *refAllele = words[3];
-char *altAlleles = words[4];
-// Make a vcfRecord-like allele array (ref in [0], alts after) so we can check for padding base:
-int alCount = 1 + countChars(altAlleles, ',') + 1;
-char *alleles[alCount];
-alleles[0] = refAllele;
-char altAlCopy[strlen(altAlleles)+1];
-safecpy(altAlCopy, sizeof(altAlCopy), altAlleles);
-chopByChar(altAlCopy, ',', &(alleles[1]), alCount-1);
-int i;
-if (allelesHavePaddingBase(alleles, alCount))
-    {
-    // Skip padding base (unless we have a symbolic allele):
-    for (i = 0;  i < alCount;  i++)
-	if (isAllNt(alleles[i], strlen(alleles[i])))
-	    alleles[i]++;
-    }
-// Having dealt with left padding base, now look for identical bases on the right:
-int trimmedBases = countIdenticalBasesRight(alleles, alCount);
-// Build a /-separated allele string, trimming bases on the right if necessary:
-dyStringClear(dy);
-for (i = 0;  i < alCount;  i++)
-    {
-    if (i > 0)
-	dyStringAppendC(dy, '/');
-    char *allele = alleles[i];
-    if (allele[trimmedBases] == '\0')
-	dyStringAppendC(dy, '-');
-    else
-	dyStringAppendN(dy, allele, strlen(allele)-trimmedBases);
-    }
-return dy->string;
-}
diff --git a/gbtools/src/blatSrc/lib/vcfBits.c b/gbtools/src/blatSrc/lib/vcfBits.c
deleted file mode 100644
index 75d3a05..0000000
--- a/gbtools/src/blatSrc/lib/vcfBits.c
+++ /dev/null
@@ -1,696 +0,0 @@
-/* vcfBits.c/.h: Variant Call Format, analysis by bit maps.
- * The routines found here are dependent upon vcf.c/.h for accessing vcf records.
- * They allow analysis of a set of vcf records by bit maps with one bit map per variant
- * location and where each haplotype covered by the vcf record is represented by a single
- * bit (or pair of bits). Additional analysis can be performed by creating haplotype based
- * bit maps from variant bit maps.  There is one haplotype bit map for each haplotype
- * (subject chromosome) with one (or two) bits for each variant location in the set of records. */
-
-/* Copyright (C) 2013 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "errAbort.h"
-#include <limits.h>
-#include "localmem.h"
-#include "net.h"
-#include "regexHelper.h"
-#include "vcf.h"
-#include "vcfBits.h"
-
-
-static struct variantBits *vcfOneRecordToVariantBits(struct vcfFile *vcff,struct vcfRecord *record,
-                                                     boolean phasedOnly, boolean homozygousOnly)
-// Returns bit array covering all genotypes/haplotype/alleles per record.  One slot per genotype
-// containing 2 slots for haplotypes and 1 or 2 bits per allele. The normal (simple) case of
-// 1 reference and 1 alternate allele results in 1 allele bit with 0:ref. Two or three alt alleles
-// is represented by two bits per allele (>3 alternate alleles is unsupported).
-// If phasedOnly, unphased haplotype bits will all be set only if all agree (00 is uninterpretable)
-// Haploid genotypes (e.g. chrY) and homozygousOnly bitmaps contain 1 haplotype slot.
-{
-// parse genotypes if needed
-if (record->genotypes == NULL)
-    vcfParseGenotypes(record);
-assert(vcff->genotypeCount > 0);
-int ix = 0;
-
-// allocate vBits struct
-struct variantBits *vBits;
-struct lm *lm = vcfFileLm(vcff);
-lmAllocVar(lm,vBits);
-vBits->genotypeSlots  = vcff->genotypeCount;
-vBits->record         = record;
-vBits->haplotypeSlots = 2;  // assume diploid, but then check for complete haploid
-if (homozygousOnly)
-    vBits->haplotypeSlots = 1;
-else
-    { // spin through all the subjects to see if all are haploid
-    for (ix = 0; ix < vcff->genotypeCount && record->genotypes[ix].isHaploid;ix++)
-        ;
-    if (ix == vcff->genotypeCount)
-        vBits->haplotypeSlots = 1;  // All are haploid: chrY
-    assert(vBits->haplotypeSlots == 2 || record->chrom[strlen(record->chrom) - 1] == 'Y');
-    }
-
-// Type of variant?
-assert(record->alleles != NULL);
-if(record->alleles != NULL)
-    {
-    int nonRefLen = 0;
-    assert(record->alleles[0] != NULL);
-    int refLen = record->alleles[0] ? strlen(record->alleles[0]) : 0;
-    for (ix = 1; ix < record->alleleCount; ix++)
-        {
-        assert(record->alleles[ix] != NULL);
-        int thisLen = record->alleles[ix] && differentWord(record->alleles[ix],"<DEL>") ?
-                                                                  strlen(record->alleles[ix]) : 0;
-        if (nonRefLen < thisLen)
-            nonRefLen = thisLen;
-        }
-    if (refLen == 1 && nonRefLen == 1)
-        vBits->vType = vtSNP;
-    else if (refLen < nonRefLen)
-        vBits->vType = vtInsertion;
-    else if (refLen > nonRefLen)
-        vBits->vType = vtDeletion;
-    // else unknown
-    }
-
-// allocate bits
-assert(record->alleleCount < 4);
-vBits->alleleSlots = (record->alleleCount <= 2 ? 1 : 2);
-int bitCount = vBitsSlotCount(vBits);
-Bits *bits = lmBitAlloc(lm,bitCount);
-vBits->bits = bits;
-
-
-// walk through genotypes and set the bit
-for (ix = 0; ix < vcff->genotypeCount;ix++)
-    {
-    struct vcfGenotype *gt = gt = &(record->genotypes[ix]);
-
-    boolean homozygous = (gt->isHaploid || gt->hapIxA == gt->hapIxB);
-
-    if ((!phasedOnly || gt->isPhased || homozygous))
-        {
-        if ((!homozygousOnly || homozygous) && gt->hapIxA > 0)
-            {
-            switch (gt->hapIxA)
-                {
-                case 1: bitSetOne(bits,  vBitsSlot(vBits,ix,0,0));   vBits->bitsOn++;    break;
-                case 2: bitSetOne(bits,  vBitsSlot(vBits,ix,0,1));   vBits->bitsOn++;    break;
-                case 3: bitSetRange(bits,vBitsSlot(vBits,ix,0,0),2); vBits->bitsOn += 2; break;
-                default:                                             break;
-                }
-            }
-        if (!gt->isHaploid && !homozygousOnly && gt->hapIxB > 0)
-            {
-            switch (gt->hapIxB)
-                {
-                case 1: bitSetOne(bits,  vBitsSlot(vBits,ix,1,0));   vBits->bitsOn++;    break;
-                case 2: bitSetOne(bits,  vBitsSlot(vBits,ix,1,1));   vBits->bitsOn++;    break;
-                case 3: bitSetRange(bits,vBitsSlot(vBits,ix,1,0),2); vBits->bitsOn += 2; break;
-                default:                                             break;
-                }
-            }
-        }
-    }
-
-return vBits;
-}
-
-static Bits *vcfRecordUnphasedBits(struct vcfFile *vcff, struct vcfRecord *record)
-// Returns array (1 bit per genotype) for each unphased genotype.
-{
-// allocate bits
-Bits *bits = lmBitAlloc(vcfFileLm(vcff),vcff->genotypeCount);
-
-// parse genotypes if needed
-if (record->genotypes == NULL)
-    vcfParseGenotypes(record);
-
-// walk through genotypes and set the bit
-int ix = 0;
-for ( ; ix < vcff->genotypeCount;ix++)
-    {
-    if (record->genotypes[ix].isPhased == FALSE
-    && record->genotypes[ix].isHaploid == FALSE)
-        bitSetOne(bits,ix);
-    }
-return bits;
-}
-
-Bits *vcfRecordHaploidBits(struct vcfFile *vcff, struct vcfRecord *record)
-// Returns array (1 bit per genotype) for each haploid genotype.
-// This is useful for interpreting chrX.
-{
-// allocate bits
-Bits *bits = lmBitAlloc(vcfFileLm(vcff),vcff->genotypeCount);
-
-// parse genotypes if needed
-if (record->genotypes == NULL)
-    vcfParseGenotypes(record);
-
-// walk through genotypes and set the bit
-int ix = 0;
-for ( ; ix < vcff->genotypeCount;ix++)
-    {
-    if (record->genotypes[ix].isHaploid)
-        bitSetOne(bits,ix);
-    }
-return bits;
-}
-
-int vBitsHaploidCount(struct variantBits *vBits)
-// Returns the number of subjects in the VCF dataset that are haploid at this location
-{
-int haploid = 0;  // Most are not haploid
-
-char *chrom = vBits->record->chrom;
-if (chrom[strlen(chrom) - 1] == 'Y')
-    haploid = vcfBitsSubjectCount(vBits);
-else if (chrom[strlen(chrom) - 1] == 'X')  // chrX is tricky: males are haploid except in PAR
-    {
-    struct vcfRecord *record = vBits->record;
-    struct vcfFile *vcff = record->file;
-
-    // parse genotypes if needed
-    if (record->genotypes == NULL)
-        vcfParseGenotypes(record);
-
-    // walk through genotypes
-    int ix = 0;
-    for ( ; ix < vcff->genotypeCount;ix++)
-        {
-        if (record->genotypes[ix].isHaploid)
-            haploid++;
-        }
-    }
-return haploid;
-}
-
-int vBitsSubjectChromCount(struct variantBits *vBits)
-// Returns the chromosomes in the VCF dataset that are covered at this location
-{
-int haploid = vBitsHaploidCount(vBits);
-int diploid = vcfBitsSubjectCount(vBits) - haploid;
-return ((diploid * 2) + haploid);
-}
-
-struct variantBits *vcfRecordsToVariantBits(struct vcfFile *vcff, struct vcfRecord *records,
-                                            boolean phasedOnly, boolean homozygousOnly,
-                                            boolean unphasedBits)
-// Returns list of bit arrays covering all genotypes/haplotype/alleles per record for each record
-// provided.  If records is NULL will use vcff->records. Bit map has one slot per genotype
-// containing 2 slots for haplotypes and 1 or 2 bits per allele. The normal (simple) case of
-// 1 reference and 1 alternate allele results in 1 allele bit with 0:ref. Two or three alt alleles
-// is represented by two bits per allele (>3 non-reference alleles unsupported).
-// If phasedOnly, unphased haplotype bits will be set only if both agree (00 is uninterpretable)
-// Haploid genotypes (e.g. chrY) and homozygousOnly bitmaps contain 1 haplotype slot.
-// If unphasedBits, then vBits->unphased will contain a bitmap with 1s for all unphased genotypes.
-// NOTE: allocated from vcff pool, so closing file or flushing reusePool will invalidate this.
-{
-struct variantBits *vBitsList = NULL;
-
-struct vcfRecord *record = records ? records : vcff->records;
-for (;record != NULL; record = record->next)
-    {
-    struct variantBits *vBits = vcfOneRecordToVariantBits(vcff, record, phasedOnly, homozygousOnly);
-    if (unphasedBits)
-        vBits->unphased = vcfRecordUnphasedBits(vcff, record);
-    slAddHead(&vBitsList,vBits);
-    }
-slReverse(&vBitsList);
-
-return vBitsList;
-}
-
-int vcfVariantBitsDropSparse(struct variantBits **vBitsList, int haploGenomeMin,
-                             boolean dropRefMissing)
-// Drops vBits found in less than a minimum number of haplotype genomes.  Supplying 1 will
-// drop variants found in no haplotype genomes.  Declaring dropRefMissing will drop variants
-// in all haplotype genomes (variants where reference is not represented in dataset and
-// *might* be in error). Returns count of vBits structure that were dropped.
-{
-struct variantBits *vBitsKeep = NULL;
-struct variantBits *vBits = NULL;
-int dropped = 0;
-while ((vBits = slPopHead(vBitsList)) != NULL)
-    {
-    if (vBits->bitsOn >= haploGenomeMin)
-        slAddHead(&vBitsKeep,vBits);
-    else
-        dropped++;  // if not demoted, drop memory, since this is on lm
-    }
-*vBitsList = vBitsKeep;
-
-if (dropRefMissing)
-    {
-    vBitsKeep = NULL;
-    while ((vBits = slPopHead(vBitsList)) != NULL)
-        {
-        boolean foundRef = FALSE;
-        int genoIx = 0;
-        for (; !foundRef && genoIx < vBits->genotypeSlots; genoIx++)
-            {
-            int haploIx = 0;
-            for (; !foundRef && haploIx < vBits->haplotypeSlots; haploIx++)
-                {
-                if (bitCountRange(vBits->bits,
-                                  vBitsSlot(vBits,genoIx,haploIx,0), vBits->alleleSlots) == 0)
-                    foundRef = TRUE;
-                }
-            }
-
-        if (foundRef)
-            slAddHead(&vBitsKeep,vBits);
-        else  // drop memory, since this is on lm
-            dropped++;  // if not demoted, drop memory, since this is on lm
-        }
-    *vBitsList = vBitsKeep;
-    }
-else
-    slReverse(vBitsList);
-
-return dropped;
-}
-
-int vcfVariantBitsAlleleOccurs(struct variantBits *vBits, unsigned char alleleIx,
-                               boolean homozygousOrHaploid)
-// Counts the number of times a particular allele occurs in the subjects*chroms covered.
-// If homozygousOrHaploid then the allele must occur in both chroms to be counted
-{
-assert((vBits->alleleSlots == 1 && alleleIx <= 1)
-    || (vBits->alleleSlots == 2 && alleleIx <= 3));
-
-// To count ref, we need to know the number of subjects the bitmap covers
-// chrX is the culprit here since it is haploid/diploid
-int subjTotal = vBits->genotypeSlots * vBits->haplotypeSlots;
-if (alleleIx == 0)
-    subjTotal = vBitsSubjectChromCount(vBits);
-
-// Simple case can be taken care of easily
-if (vBits->alleleSlots == 1
-&&  (!homozygousOrHaploid || vBits->haplotypeSlots == 1))
-    {
-    if (alleleIx == 1)           // non-reference
-        return vBits->bitsOn;
-    else                         // reference
-        return subjTotal - vBits->bitsOn;
-    }
-
-// Otherwise, we have to walk the bitmap
-int occurs           = 0;
-int occursHomozygous = 0;
-int genoIx = 0;
-for (; genoIx < vBits->genotypeSlots; genoIx++)
-    {
-    int haploIx = 0;
-    int occursThisSubject = 0;
-    for (; haploIx < vBits->haplotypeSlots; haploIx++)
-        {
-        int bitSlot = vBitsSlot(vBits,genoIx,haploIx,0);
-        switch (alleleIx)
-            {
-            case 0: if (bitCountRange(vBits->bits,bitSlot, vBits->alleleSlots) != 0)
-                        occursThisSubject++; // Any non-reference bit
-                    break;
-            case 1: if (vBits->alleleSlots == 1)
-                        {
-                        if (bitReadOne(vBits->bits,bitSlot))
-                            occursThisSubject++;
-                        }
-                    else
-                        {
-                        if ( bitReadOne(vBits->bits,bitSlot)
-                        &&  !bitReadOne(vBits->bits,bitSlot + 1) )
-                            occursThisSubject++;
-                        }
-                    break;
-            case 2: if (!bitReadOne(vBits->bits,bitSlot)
-                    &&   bitReadOne(vBits->bits,bitSlot + 1) )
-                        occursThisSubject++;
-                    break;
-            case 3: if (bitCountRange(vBits->bits,bitSlot, 2) == 2)
-                        occursThisSubject++;
-                    break;
-            default:
-                    break;
-            }
-        }
-    occurs += occursThisSubject;
-    if ((alleleIx == 0 && occursThisSubject == 0)
-    ||  (alleleIx >  0 && vBits->haplotypeSlots == occursThisSubject))
-        occursHomozygous++;
-    }
-if (alleleIx == 0)
-    occurs = subjTotal - occurs;
-
-return (homozygousOrHaploid ? occursHomozygous : occurs);
-}
-
-int vcfVariantBitsReferenceOccurs(struct vcfFile *vcff, struct variantBits *vBitsList,
-                                  boolean homozygousOrHaploid)
-// For an entire list of vBits structs, counts the times the reference allele occurs.
-// If homozygousOrHaploid then the reference allele must occur in both chroms to be counted
-{
-assert(vBitsList != NULL);
-struct variantBits *vBits = vBitsList;
-// Allocate temporary vBits struct which can hold the 'OR' version of all bitmaps in list
-struct lm *lm = vcfFileLm(vcff);
-struct variantBits *vBitsTemp;
-lmAllocVar(lm,vBitsTemp);
-vBitsTemp->genotypeSlots  = vBits->genotypeSlots;
-vBitsTemp->haplotypeSlots = vBits->haplotypeSlots;
-vBitsTemp->alleleSlots    = vBits->alleleSlots;
-vBitsTemp->record         = vBits->record;
-
-int bitSlots = vBitsSlotCount(vBits);
-vBitsTemp->bits = lmBitClone(lm,vBits->bits, bitSlots);
-
-
-for (vBits = vBits->next; vBits != NULL; vBits = vBits->next)
-    bitOr(vBitsTemp->bits, vBits->bits, bitSlots);
-
-vBitsTemp->bitsOn = bitCountRange(vBitsTemp->bits,0,bitSlots);
-
-// Note the memory will be leaked but it is lm
-return vcfVariantBitsAlleleOccurs(vBitsTemp, 0, homozygousOrHaploid);
-}
-
-int vcfVariantMostPopularCmp(const void *va, const void *vb)
-// Compare to sort variantBits based upon how many genomes/chrom has the variant
-// This can be used to build haploBits in most populous order for tree building
-{
-const struct variantBits *a = *((struct variantBits **)va);
-const struct variantBits *b = *((struct variantBits **)vb);
-//int ret = memcmp(a->bits, b->bits, bitToByteSize(vBitsSlotCount(a)));
-int ret = (b->bitsOn - a->bitsOn); // higher bits first (descending order)
-if (ret == 0)
-    { // sort deterministically
-    ret = (a->record->chromStart - b->record->chromStart);
-    if (ret == 0)
-        ret = (a->record->chromEnd - b->record->chromEnd);
-    }
-return ret;
-}
-
-struct haploBits *vcfVariantBitsToHaploBits(struct vcfFile *vcff, struct variantBits *vBitsList,
-                                            boolean ignoreReference)
-// Converts a set of variant bits to haplotype bits, resulting in one bit struct
-// per haplotype genome that has non-reference variations.  If ignoreReference, only
-// haplotype genomes with at least one non-reference variant are returned.
-// A haploBit array has one variant slot per vBit struct and one or more bits per allele.
-// NOTE: allocated from vcff pool, so closing file or flushing reusePool will invalidate this.
-{
-// First determine dimensions
-int variantSlots = 0;
-unsigned char alleleSlots  = 1;
-struct variantBits *vBits = vBitsList;
-for ( ; vBits != NULL; vBits = vBits->next)
-    {
-    variantSlots++;
-    if (vBits->alleleSlots == 2)
-        alleleSlots = 2; // Will normalize allele slots across all variants.
-    // This should catch any problems where chrX is haploid/diploid
-    assert(vBitsList->haplotypeSlots == vBits->haplotypeSlots);
-    }
-
-
-// Now create a struct per haplotype
-struct lm *lm = vcfFileLm(vcff);
-struct haploBits *hBitsList = NULL;
-int genoIx = 0;
-for (; genoIx < vBitsList->genotypeSlots; genoIx++)
-    {
-    int haploIx = 0;
-    for (; haploIx < vBitsList->haplotypeSlots; haploIx++)
-        {
-        // allocate struct
-        struct haploBits *hBits;
-        lmAllocVar(lm,hBits);
-        hBits->variantSlots = variantSlots;
-        hBits->alleleSlots  = alleleSlots;
-        hBits->haploGenomes = 1;
-        int bitCount = hBitsSlotCount(hBits);
-
-        // allocate bits
-        Bits *bits = lmBitAlloc(lm,bitCount);
-        hBits->bits = bits;
-
-        int variantIx = 0;
-        for (vBits =  vBitsList; vBits != NULL; vBits = vBits->next, variantIx++)
-            {
-            if (bitReadOne(vBits->bits,vBitsSlot(vBits,genoIx,haploIx,0)))
-                {
-                bitSetOne(        bits,hBitsSlot(hBits,variantIx,     0));
-                hBits->bitsOn++;
-                }
-
-            if (vBits->alleleSlots == 2) // (hBit->alleleSlot will also == 2)
-                {
-                if (bitReadOne(vBits->bits,vBitsSlot(vBits,genoIx,haploIx,1)))
-                    {
-                    bitSetOne(        bits,hBitsSlot(hBits,variantIx,     1));
-                    hBits->bitsOn++;
-                    }
-                }
-            }
-
-        // gonna keep it? so flesh it out (ignoreRef means > 0 && < all)
-        if (!ignoreReference || hBits->bitsOn)
-            {
-            hBits->genomeIx  = genoIx;
-            hBits->haploidIx = haploIx;
-            struct vcfRecord *record = vBitsList->record; // any will do
-            struct vcfGenotype *gt = &(record->genotypes[genoIx]);
-
-            if (hBits->bitsOn                   // if including reference, then chrX could
-            ||  haploIx == 0 || !gt->isHaploid) // have unused diploid positions!
-                {
-                if (gt->isHaploid || vBitsList->haplotypeSlots == 1)
-                    { // chrX will have haplotypeSlots==2 but be haploid for this subject.
-                      // Meanwhile if vBits were for homozygous only,  haplotypeSlots==1
-                    //assert(haploIx == 0);
-                    hBits->ids = lmCloneString(lm,gt->id);
-                    }
-                else
-                    {
-                    int sz = strlen(gt->id) + 3;
-                    hBits->ids = lmAlloc(lm,sz);
-                    safef(hBits->ids,sz,"%s-%c",gt->id,'a' + haploIx);
-                    }
-                slAddHead(&hBitsList,hBits);
-                }
-            }
-        //else
-        //    haploBitsFree(&hBits); // lm so just abandon
-        }
-    }
-slReverse(&hBitsList);
-
-return hBitsList;
-}
-
-/*
-int vcfHaploBitsOnCmp(const void *va, const void *vb)
-// Compare to sort haploBits based upon how many bits are on
-{
-const struct haploBits *a = *((struct haploBits **)va);
-const struct haploBits *b = *((struct haploBits **)vb);
-int ret = (a->bitsOn - b->bitsOn);
-if (ret == 0)
-    { // sort deterministically
-    ret = (a->genomeIx - b->genomeIx);
-    if (ret == 0)
-        ret = (a->haploidIx - b->haploidIx);
-    }
-return ret;
-}
-*/
-
-int vcfHaploBitsMemCmp(const void *va, const void *vb)
-// Compare to sort haploBits based on bit by bit memory compare
-// When hBits has been created from vBits sorted by popularity,
-// a mem sort will then allow elmTreeGrow() to add popular variants first.
-{
-const struct haploBits *a = *((struct haploBits **)va);
-const struct haploBits *b = *((struct haploBits **)vb);
-int ret = memcmp(a->bits, b->bits, bitToByteSize(hBitsSlotCount(a)));
-if (ret == 0)
-    { // sort deterministically
-    ret = (a->genomeIx - b->genomeIx);
-    if (ret == 0)
-        ret = (a->haploidIx - b->haploidIx);
-    }
-return ret;
-}
-
-static struct haploBits *hBitsCollapsePair(struct lm *lm, struct haploBits *hBits,
-                                           struct haploBits *dupMap)
-// Adds Ids of duplicate bitmap to hBits and abandons the duplicate.
-{
-char *ids = lmAlloc(lm,strlen(dupMap->ids) + strlen(hBits->ids) + 2);
-// NOTE: Putting Dup Ids first could leave these in lowest genomeIx/haploidIx order
-sprintf(ids,"%s,%s",dupMap->ids,hBits->ids);
-hBits->ids = ids;
-hBits->haploGenomes++;
-hBits->genomeIx  = dupMap->genomeIx;  // Arbitrary but could leave lowest first
-hBits->haploidIx = dupMap->haploidIx;
-return hBits;
-}
-
-int vcfHaploBitsListCollapseIdentical(struct vcfFile *vcff, struct haploBits **phBitsList,
-                                      int haploGenomeMin)
-// Collapses a list of haploBits based upon identical bit arrays.
-// If haploGenomeMin > 1, will drop all hBits structs covering less than N haploGenomes.
-// Returns count of hBit structs removed.
-{
-struct lm *lm = vcfFileLm(vcff);
-int collapsed = 0;
-struct haploBits *hBitsPassed = NULL;
-struct haploBits *hBitsToTest = *phBitsList;
-if (hBitsToTest->next == NULL)
-    return 0;
-
-// Sort early bits first
-slSort(&hBitsToTest, vcfHaploBitsMemCmp);
-
-// Walk through those of matching size and compare
-int bitCount = hBitsSlotCount(hBitsToTest);
-int memSize = bitToByteSize(bitCount);
-struct haploBits *hBitsQ = NULL;
-while ((hBitsQ = slPopHead(&hBitsToTest)) != NULL)
-    {
-    struct haploBits *hBitsT = hBitsToTest; //hBitsQ->next; is already null.
-    for (;hBitsT != NULL;hBitsT = hBitsT->next)
-        {
-        // If the 2 bitmaps do not have the same number of bits on, they are not identical
-        if (hBitsT->bitsOn != hBitsQ->bitsOn)
-            break;
-
-        // If 2 bitmaps are identical, then collapse into one
-        if (memcmp(hBitsT->bits,hBitsQ->bits,memSize) == 0)
-            {     // collapse
-            hBitsCollapsePair(lm,hBitsT,hBitsQ);
-            hBitsQ = NULL; // abandon lm memory
-            collapsed++;
-            break;  // hBitsQ used up so make hBitsT the new Q.
-            }
-        }
-
-    // If hBitsQ survived the collapsing, then don't loose it.
-    if (hBitsQ != NULL)
-        slAddHead(&hBitsPassed,hBitsQ);
-    }
-
-// Now that we have collapsed hBits, we can drop any that are not found in enough subjects
-if (haploGenomeMin > 1)
-    {
-    hBitsToTest = hBitsPassed;
-    hBitsPassed = NULL;
-    while ((hBitsQ = slPopHead(hBitsToTest)) != NULL)
-        {
-        if (hBitsQ->haploGenomes >= haploGenomeMin)
-            slAddHead(&hBitsPassed,hBitsQ);
-        else  // drop memory, since this is on lm
-            collapsed++;
-        }
-    // double pop passes means no reverse required.
-    }
-else
-    slReverse(&hBitsPassed);
-
-*phBitsList = hBitsPassed;
-
-return collapsed;
-}
-
-unsigned char vcfHaploBitsToVariantAlleleIx(struct haploBits *hBits,int bitIx)
-// Given a hBits struct and bitIx, what is the actual variant allele ix
-// to use when accessing the vcfRecord?  NOTE: here 0 is reference allele
-{
-if (hBits->alleleSlots == 1)
-    return bitReadOne(hBits->bits,bitIx); // 0 or 1
-else
-    {
-    assert(hBits->alleleSlots == 2); // Only supports 1-3 variants encoded as 2 bits
-    unsigned char varIx = 0;
-    int bit = variantSlotFromBitIx(hBits,bitIx);
-    if (bitReadOne(hBits->bits,bit++))
-        varIx = 1;  // Note that bitmaps represent 1,2,3 as 10,01,11
-    if (bitReadOne(hBits->bits,bit))
-        varIx += 2;
-    return varIx;
-    }
-}
-
-enum elmNodeOverlap vcfHaploBitsCmp(const struct slList *elA, const struct slList *elB,
-                                    int *matchWeight, void *extra)
-// HaploBits compare routine for building tree of relations using elmTreeGrow().
-{
-const struct haploBits *a = (struct haploBits *)elA;
-const struct haploBits *b = (struct haploBits *)elB;
-
-int bitCount = hBitsSlotCount(a);
-int and = bitAndCount(a->bits,b->bits,bitCount);
-if (matchWeight)
-    *matchWeight = and;
-if (and == 0)// && a->bitsOn > 0)
-    return enoExcluding; // nothing in common
-if (a->bitsOn == and)
-    {
-    if (b->bitsOn == and)
-        return enoEqual; // perfect match
-    else
-        return enoSubset;
-    }
-// super and mixed?
-if (b->bitsOn == and)
-    return enoSuperset;
-return enoMixed;
-}
-
-struct slList *vcfHaploBitsMatching(const struct slList *elA, const struct slList *elB,
-                                    void *extra)
-// Returns a HaploBits structure representing the common parts of elements A and B.
-// Used with elmTreeGrow() to create nodes that are the common parts between leaves/branches.
-{
-struct haploBits *a = (struct haploBits *)elA;
-struct haploBits *b = (struct haploBits *)elB;
-struct lm *lm = extra;
-
-// If the 2 bitmaps are equal, then collapse into a single struct
-if (enoEqual == vcfHaploBitsCmp(elA,elB,NULL,extra))
-    {
-    if (hBitsIsReal(a)) // bitmap represents variants on at least one subject chromosome
-        {
-        assert(!hBitsIsReal(b));  // Won't always work but hBits have been precollapsed
-        if (hBitsIsReal(b)) // Should not be if these have already been collapsed.
-            {
-            hBitsCollapsePair(lm,a,b);    // a is real, b is real so collapse into one
-            //haploBitsFreeList(&b);   // lm so just abandon
-            return (struct slList *)a;
-            }
-        else
-            return (struct slList *)a; // a is real, b is not so just use a
-        }
-    else if (hBitsIsReal(b))
-        return (struct slList *)b;    // b is real, a is not so just use b
-    }
-
-// Must make non "real" bitmap which is the common bits of a and b
-struct haploBits *match;
-lmAllocVar(lm,match);
-match->alleleSlots  = a->alleleSlots;
-match->variantSlots = a->variantSlots;
-match->haploGenomes = 0;  // Marking this as a subset
-
-int bitCount  = hBitsSlotCount(match);
-match->bits = lmBitClone(lm,a->bits, bitCount);
-bitAnd(match->bits, b->bits, bitCount);
-match->bitsOn = bitCountRange(match->bits, 0, bitCount);
-
-return (struct slList *)match;
-}
diff --git a/gbtools/src/blatSrc/lib/verbose.c b/gbtools/src/blatSrc/lib/verbose.c
deleted file mode 100644
index 2a037a0..0000000
--- a/gbtools/src/blatSrc/lib/verbose.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* verbose.c - write out status messages according to the
- * current verbosity level.  These messages go to stderr. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "portable.h"
-#include "verbose.h"
-
-
-static int logVerbosity = 1;	/* The level of log verbosity.  0 is silent. */
-static FILE *logFile;	/* File to log to. */
-
-static boolean checkedDotsEnabled = FALSE;  /* have we check for dot output
-                                             * being enabled? */
-static boolean dotsEnabled = FALSE;         /* is dot output enabled? */
-
-void verboseVa(int verbosity, char *format, va_list args)
-/* Log with at given verbosity vprintf formatted args. */
-{
-if (verbosity <= logVerbosity)
-    {
-    if (logFile == NULL)
-        logFile = stderr;
-    vfprintf(logFile, format, args);
-    fflush(logFile);
-    }
-}
-
-void verbose(int verbosity, char *format, ...)
-/* Write printf formatted message to log (which by
- * default is stderr) if global verbose variable
- * is set to verbosity or higher. */
-{
-va_list args;
-va_start(args, format);
-verboseVa(verbosity, format, args);
-va_end(args);
-}
-
-static long lastTime = -1;  // previous call time.
-
-void verboseTimeInit(void)
-/* Initialize or reinitialize the previous time for use by verboseTime. */
-{
-lastTime = clock1000();
-}
-
-void verboseTime(int verbosity, char *label, ...)
-/* Print label and how long it's been since last call.  Start time can be
- * initialized with verboseTimeInit, otherwise the elapsed time will be
- * zero. */
-{
-assert(label != NULL);  // original version allowed this, but breaks some GCCs
-if (lastTime < 0)
-    verboseTimeInit();
-long time = clock1000();
-va_list args;
-va_start(args, label);
-verboseVa(verbosity, label, args);
-verbose(verbosity, ": %ld millis\n", time - lastTime);
-lastTime = time;
-va_end(args);
-}
-
-
-boolean verboseDotsEnabled()
-/* check if outputting of happy dots are enabled.  They will be enabled if the
- * verbosity is > 0, stderr is a tty and we don't appear to be running an
- * emacs shell. */
-{
-if (!checkedDotsEnabled)
-    {
-    if (logFile == NULL)
-        logFile = stderr;
-    dotsEnabled = (logVerbosity > 0) && isatty(fileno(logFile));
-    if (dotsEnabled)
-        {
-        /* check for an possible emacs shell */
-        char *emacs = getenv("emacs");
-        char *term = getenv("TERM");
-        if ((emacs != NULL) && (emacs[0] == 't'))
-            dotsEnabled = FALSE;
-        else if ((term != NULL) && sameString(term, "dumb"))
-            dotsEnabled = FALSE;
-        }
-    checkedDotsEnabled = TRUE;
-    }
-return dotsEnabled;
-}
-
-void verboseDot()
-/* Write I'm alive dot (at verbosity level 1) */
-{
-if (verboseDotsEnabled())
-    verbose(1, ".");
-}
-
-void verboseSetLevel(int verbosity)
-/* Set verbosity level in log.  0 for no logging,
- * higher number for increasing verbosity. */
-{
-logVerbosity = verbosity;
-checkedDotsEnabled = FALSE; /* force rechecking of dots enabled */
-}
-
-int verboseLevel(void)
-/* Get verbosity level. */
-{
-return logVerbosity;
-}
-
-void verboseSetLogFile(char *name)
-/* Set logFile for verbose messages overrides stderr. */
-{
-if (sameString(name, "stdout"))
-    logFile = stdout;
-else if (sameString(name, "stderr"))
-    logFile = stderr;
-else
-    logFile = mustOpen(name, "w");
-}
-
-FILE *verboseLogFile()
-/* Get the verbose log file. */
-{
-if (logFile == NULL)
-    logFile = stderr;
-return logFile;
-}
diff --git a/gbtools/src/blatSrc/lib/wildcmp.c b/gbtools/src/blatSrc/lib/wildcmp.c
deleted file mode 100644
index 1fa1309..0000000
--- a/gbtools/src/blatSrc/lib/wildcmp.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Wildcard matching. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-
-
-static int subMatch(const char *str, const char *wild, char single, char multi)
-/* Returns number of characters that match between str and wild up
- * to the next wildcard in wild (or up to end of string.). */
-{
-int len = 0;
-
-for(;;)
-    {
-    if(toupper(*str++) != toupper(*wild++) )
-        return(0);
-    ++len;
-    char c = *wild;
-    if (c == 0 || c == single || c == multi)
-       return len;
-    }
-}
-
-boolean anyWild(const char *string)
-/* Return TRUE if any wild card characters in string. */
-{
-char c;
-while ((c = *string++) != 0)
-    {
-    if (c == '?' || c == '*')
-        return TRUE;
-    }
-return FALSE;
-}
-
-static boolean globMatch(const char *wildCard, const char *string, char single, char multi)
-/* does a case sensitive wild card match with a string.
- * * matches any string or no character.
- * ? matches any single character.
- * anything else etc must match the character exactly. */
-{
-boolean matchStar = 0;
-int starMatchSize;
-char c;
-
-for(;;)
-    {
-NEXT_WILD:
-    c = *wildCard;
-    if (c == 0)
-	{
-	if(matchStar)
-	    {
-	    while(*string++)
-		;
-	    return TRUE;
-	    }
-	else if(*string)
-	    return FALSE;
-	else
-	    return TRUE;
-	}
-    else if (c == multi)
-	{
-	matchStar = TRUE;
-	}
-    else if (c == single)
-	{
-	if(*string == 0)
-	    return FALSE; /* out of string, no match for ? */
-	++string;
-	}
-    else
-	{
-	if(matchStar)
-	    {
-	    for(;;)
-		{
-		if(*string == 0) /* if out of string no match */
-		    return FALSE;
-
-		/* note matchStar is re-used here for substring
-		 * after star match length */
-		if((starMatchSize = subMatch(string,wildCard,single,multi)) != 0)
-		    {
-		    string += starMatchSize;
-		    wildCard += starMatchSize;
-		    matchStar = FALSE;
-		    goto NEXT_WILD;
-		    }
-		++string;
-		}
-	    }
-
-	/* default: they must be equal or no match */
-	if(toupper(*string) != toupper(*wildCard))
-	    return FALSE;
-	++string;
-	}
-    ++wildCard;
-    }
-}
-
-boolean wildMatch(const char *wildCard, const char *string)
-/* Match using * and ? wildcards. */
-{
-return globMatch(wildCard, string, '?', '*');
-}
-
-boolean sqlMatchLike(char *wildCard, char *string)
-/* Match using % and _ wildcards. */
-{
-return globMatch(wildCard, string, '_', '%');
-}
diff --git a/gbtools/src/blatSrc/lib/wormdna.c b/gbtools/src/blatSrc/lib/wormdna.c
deleted file mode 100644
index ad50ca8..0000000
--- a/gbtools/src/blatSrc/lib/wormdna.c
+++ /dev/null
@@ -1,1212 +0,0 @@
-/* wormDna - Stuff for finding worm DNA and annotation features.
- * This is pretty much the heart of the cobbled-together 'database'
- * behind the intronerator. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "dnautil.h"
-#include "dnaseq.h"
-#include "fa.h"
-#include "gdf.h"
-#include "nt4.h"
-#include "snof.h"
-#include "wormdna.h"
-#include "cda.h"
-#include "sig.h"
-#include "dystring.h"
-
-
-static char *jkwebDir = NULL;
-
-static char *cdnaDir = NULL;
-static char *featDir = NULL;
-static char *nt4Dir = NULL;
-static char *sangerDir = NULL;
-static char *genieDir = NULL;
-static char *xenoDir = NULL;
-
-static void getDirs()
-/* Look up the directories where our data is stored. */
-{
-if (jkwebDir == NULL)
-    {
-    char buf[512];
-    
-    /* Look up directory where directory pointer files are stored
-     * in environment string if it's there. */
-    if ((jkwebDir = getenv("JKWEB")) == NULL)
-        jkwebDir = "";
-
-    sprintf(buf, "%scdna.dir", jkwebDir);
-    firstWordInFile(buf, buf, sizeof(buf));
-    cdnaDir = cloneString(buf);
-
-    sprintf(buf, "%sfeat.dir", jkwebDir);
-    firstWordInFile(buf, buf, sizeof(buf));
-    featDir = cloneString(buf);
-
-    sprintf(buf, "%snt4.dir", jkwebDir);
-    firstWordInFile(buf, buf, sizeof(buf));
-    nt4Dir = cloneString(buf);
-
-    sprintf(buf, "%ssanger/", featDir); 
-    sangerDir = cloneString(buf);
-
-    sprintf(buf, "%sgenie/", featDir);
-    genieDir = cloneString(buf);
-
-    sprintf(buf, "%sxeno.dir", jkwebDir);
-    firstWordInFile(buf, buf, sizeof(buf));
-    xenoDir = cloneString(buf);
-    }
-}
-
-char *wormFeaturesDir()
-/* Return the features directory. (Includes trailing slash.) */
-{
-getDirs();
-return featDir;
-}
-
-char *wormChromDir()
-/* Return the directory with the chromosomes. */
-{
-getDirs();
-return nt4Dir;
-}
-
-char *wormCdnaDir()
-/* Return directory with cDNA data. */
-{
-getDirs();
-return cdnaDir;
-}
-
-char *wormSangerDir()
-/* Return directory with Sanger specific gene predictions. */
-{
-getDirs();
-return sangerDir;
-}
-
-char *wormGenieDir()
-/* Return directory with Genie specific gene predictions. */
-{
-getDirs();
-return genieDir;
-}
-
-char *wormXenoDir()
-/* Return directory with cross-species alignments. */
-{
-getDirs();
-return xenoDir;
-}
-
-static char *chromIds[] = {"i", "ii", "iii", "iv", "v", "x", "m", };
-
-void wormChromNames(char ***retNames, int *retNameCount)
-/* Get list of worm chromosome names. */
-{
-*retNames = chromIds;
-*retNameCount = ArraySize(chromIds);
-}
-
-int wormChromIx(char *name)
-/* Return index of worm chromosome. */
-{
-return stringIx(name, chromIds);
-}
-
-char *wormChromForIx(int ix)
-/* Given ix, return worm chromosome official name. */
-{
-assert(ix >= 0 && ix <= ArraySize(chromIds));
-return chromIds[ix];
-}
-
-char *wormOfficialChromName(char *name)
-/* This returns a pointer to our official string for the chromosome name.
- * (This allows some routines to do direct pointer comparisons rather
- * than string comparisons.) */
-{
-int ix = wormChromIx(name);
-if (ix < 0) return NULL;
-return chromIds[ix];
-}
-
-
-static struct snof *cdnaSnof = NULL;
-static FILE *cdnaFa = NULL;
-
-static void wormCdnaCache()
-/* Set up to read cDNAs */
-{
-getDirs();
-if (cdnaSnof == NULL)
-    {
-    char buf[512];
-
-    sprintf(buf, "%s%s", cdnaDir, "allcdna");
-    cdnaSnof = snofMustOpen(buf);
-    sprintf(buf, "%s%s", cdnaDir, "allcdna.fa");
-    cdnaFa = mustOpen(buf, "rb");
-    }
-}
-
-void wormCdnaUncache()
-/* Tear down structure for reading cDNAs. */
-{
-snofClose(&cdnaSnof);
-carefulClose(&cdnaFa);
-freez(&cdnaDir);
-}
-
-void wormFreeCdnaInfo(struct wormCdnaInfo *ci)
-/* Free the mother string in the cdnaInfo.  (The info structure itself normally isn't
- * dynamically allocated. */
-{
-freeMem(ci->motherString);
-zeroBytes(ci, sizeof(*ci));
-}
-
-static char *realInfoString(char *s)
-/* Returns NULL if s is just "?", the NULL placeholder. */
-{
-if (s[0] == '?' && s[1] == 0) return NULL;
-return s;
-}
-
-static void parseRestOfCdnaInfo(char *textInfo, struct wormCdnaInfo *retInfo)
-/* Parse text info string into a binary structure retInfo. */
-{
-int wordCount;
-char *words[32];
-char *s;
-
-wordCount = chopString(textInfo, "|", words, ArraySize(words));
-if (wordCount < 8)
-    errAbort("Expecting at least 8 fields in cDNA database, got %d", wordCount);
-if ((s = realInfoString(words[0])) != NULL)
-    retInfo->orientation = s[0];
-retInfo->gene = realInfoString(words[1]);
-retInfo->product = realInfoString(words[2]);
-if ((s = realInfoString(words[3])) != NULL)
-    {
-    char *parts[2];
-    int partCount;
-    partCount = chopString(s, ".", parts, ArraySize(parts));
-    if (partCount == 2)
-        {
-        retInfo->knowStart = retInfo->knowEnd = TRUE;
-        if (parts[0][0] == '<')
-            {
-            retInfo->knowStart = FALSE;
-            parts[0] += 1;
-            }
-        if (parts[1][0] == '>')
-            {
-            retInfo->knowEnd = FALSE;
-            parts[1] += 1;
-            }
-        retInfo->cdsStart = atoi(parts[0]);
-        retInfo->cdsEnd = atoi(parts[1]);
-        }
-    }
-if ((s = realInfoString(words[4])) != NULL)
-    {
-    if (sameString("embryo", s))
-        retInfo->isEmbryonic = TRUE;
-    else if (sameString("adult", s))
-        retInfo->isAdult = TRUE;
-    }
-if ((s = realInfoString(words[5])) != NULL)
-    {
-    if (sameString("herm", s))
-        retInfo->isHermaphrodite = TRUE;
-    else if (sameString("male", s))
-        retInfo->isMale = TRUE;
-    }
-
-if ((s = realInfoString(words[6])) != NULL)
-    {
-    /* Reserved. Unused currently */
-    }
-retInfo->description = realInfoString(words[7]);
-}
-
-void wormFaCommentIntoInfo(char *faComment, struct wormCdnaInfo *retInfo)
-/* Process line from .fa file containing information about cDNA into binary
- * structure. */
-{
-if (retInfo)
-    {
-    char *s;
-    zeroBytes(retInfo, sizeof(*retInfo));
-    /* Separate out first word and use it as name. */
-    s = strchr(faComment, ' ');
-    if (s == NULL)
-        errAbort("Expecting lots of info, just got %s", faComment);
-    *s++ = 0;
-    retInfo->name = faComment+1;
-    retInfo->motherString = faComment;
-
-    parseRestOfCdnaInfo(s, retInfo);
-    }
-}
-
-boolean wormCdnaInfo(char *name, struct wormCdnaInfo *retInfo)
-/* Get info about cDNA sequence. */
-{
-char commentBuf[512];
-char *comment;
-long offset;
-
-wormCdnaCache();
-if (!snofFindOffset(cdnaSnof, name, &offset))
-    return FALSE;
-fseek(cdnaFa, offset, SEEK_SET);
-mustGetLine(cdnaFa, commentBuf, sizeof(commentBuf));
-if (commentBuf[0] != '>')
-    errAbort("Expecting line starting with > in cDNA fa file.\nGot %s", commentBuf);
-comment = cloneString(commentBuf);
-wormFaCommentIntoInfo(comment, retInfo);
-return TRUE;
-}
-
-boolean wormCdnaSeq(char *name, struct dnaSeq **retDna, struct wormCdnaInfo *retInfo)
-/* Get a single worm cDNA sequence. Optionally (if retInfo is non-null) get additional
- * info about the sequence. */
-{
-long offset;
-char *faComment;
-char **pFaComment = (retInfo == NULL ? NULL : &faComment);
-
-wormCdnaCache();
-if (!snofFindOffset(cdnaSnof, name, &offset))
-    return FALSE;
-fseek(cdnaFa, offset, SEEK_SET);
-if (!faReadNext(cdnaFa, name, TRUE, pFaComment, retDna))
-    return FALSE;
-wormFaCommentIntoInfo(faComment, retInfo);
-return TRUE;
-}
-
-struct wormFeature *newWormFeature(char *name, char *chrom, int start, int end, char typeByte)
-/* Allocate a new feature. */
-{
-int size = sizeof(struct wormFeature) + strlen(name);
-struct wormFeature *feat = needMem(size);
-feat->chrom = chrom;
-feat->start = start;
-feat->end = end;
-feat->typeByte = typeByte;
-strcpy(feat->name, name);
-return feat;
-}
-
-
-static struct wormFeature *scanChromOffsetFile(char *dir, char *suffix, 
-    bits32 signature, int nameOffset, char *chromId, int start, int end,
-    int addEnd)
-/* Scan a chrom.pgo or chrom.cdo file for names of things that are within
- * range. */
-{
-FILE *f;
-char fileName[512];
-bits32 sig, nameSize, entryCount;
-int entrySize;
-int *entry;
-char *name;
-bits32 i;
-struct wormFeature *list = NULL, *el;
-char *typePt;
-char typeByte;
-
-sprintf(fileName, "%s%s%s", dir, chromId, suffix);
-f = mustOpen(fileName, "rb");
-mustReadOne(f, sig);
-if (sig != signature)
-    errAbort("Bad signature on %s", fileName);
-mustReadOne(f, entryCount);
-mustReadOne(f, nameSize);
-entrySize = nameSize + nameOffset;
-entry = needMem(entrySize + 1);
-name = (char *)entry;
-name += nameOffset;
-typePt = name-1;
-for (i=0; i<entryCount; ++i)
-    {
-    mustRead(f, entry, entrySize);
-    if (entry[0] > end)
-        break;
-    if (entry[1] < start)
-        continue;
-    typeByte = *typePt;
-    el = newWormFeature(name, chromId, entry[0], entry[1]+addEnd, typeByte);
-    slAddHead(&list, el);
-    }
-slReverse(&list);
-fclose(f);
-freeMem(entry);
-return list;
-}
-
-struct wormFeature *wormCdnasInRange(char *chromId, int start, int end)
-/* Get all cDNAs that overlap the range. freeDnaSeqList the returned
- * list when you are through with it. */
-{
-/* This routine looks through the .CDO files made by cdnaOff
- */
-getDirs();
-return scanChromOffsetFile(cdnaDir, ".cdo", cdoSig, 2*sizeof(int)+1, 
-    chromId, start, end, 0);
-}
-
-struct wormFeature *wormSomeGenesInRange(char *chromId, int start, int end, char *gdfDir)
-/* Get info on genes that overlap range in a particular set of gene predictions. */
-{
-return scanChromOffsetFile(gdfDir, ".pgo", pgoSig, 2*sizeof(int)+1,
-    chromId, start, end, 0);
-}
-
-struct wormFeature *wormGenesInRange(char *chromId, int start, int end)
-/* Get names of all genes that overlap the range. */
-{
-/* This routine looks through the .PGO files made by makePgo
- */
-getDirs();
-return wormSomeGenesInRange(chromId, start, end, sangerDir);
-}
-
-struct wormFeature *wormCosmidsInRange(char *chromId, int start, int end)
-/* Get names of all genes that overlap the range. */
-{
-/* This routine looks through the .COO files made by makePgo
- */
-getDirs();
-return scanChromOffsetFile(featDir, ".coo", pgoSig, 2*sizeof(int)+1,
-    chromId, start, end, 1);
-}
-
-FILE *wormOpenGoodAli()
-/* Opens good alignment file and reads signature. 
- * (You can then cdaLoadOne() it.) */
-{
-char fileName[512];
-getDirs();
-sprintf(fileName, "%sgood.ali", cdnaDir);
-return cdaOpenVerify(fileName);
-}
-
-struct cdaAli *wormCdaAlisInRange(char *chromId, int start, int end)
-/* Return list of cdna alignments that overlap range. */
-{
-struct cdaAli *list = NULL, *el;
-char fileName[512];
-FILE *ixFile, *aliFile;
-bits32 sig;
-int s, e;
-long fpos;
-
-aliFile = wormOpenGoodAli();
-
-sprintf(fileName, "%s%s.alx", cdnaDir, chromId);
-ixFile = mustOpen(fileName, "rb");
-mustReadOne(ixFile, sig);
-if (sig != alxSig)
-    errAbort("Bad signature on %s", fileName);
-
-for (;;)
-    {
-    if (!readOne(ixFile, s))
-        break;
-    mustReadOne(ixFile, e);
-    mustReadOne(ixFile, fpos);
-    if (e <= start)
-        continue;
-    if (s >= end)
-        break;
-    AllocVar(el);
-    fseek(aliFile, fpos, SEEK_SET);
-    el = cdaLoadOne(aliFile);
-    if (el == NULL)
-        errAbort("Truncated cdnaAli file");
-    slAddHead(&list, el);
-    }
-slReverse(&list);
-fclose(aliFile);
-fclose(ixFile);
-return list;
-}
-
-boolean nextWormCdnaAndInfo(struct wormCdnaIterator *it, struct dnaSeq **retSeq, 
-    struct wormCdnaInfo *retInfo)
-/* Return next sequence and associated info from database. */
-{
-char *faComment;
-
-if (!faReadNext(it->faFile, "unknown", TRUE, &faComment, retSeq))
-    return FALSE;
-wormFaCommentIntoInfo(faComment, retInfo);
-return TRUE;
-}
-
-struct dnaSeq *nextWormCdna(struct wormCdnaIterator *it)
-/* Return next sequence in database */
-{
-return faReadOneDnaSeq(it->faFile, "unknown", TRUE);
-}
-
-boolean wormSearchAllCdna(struct wormCdnaIterator **retSi)
-/* Set up to search entire database or worm cDNA */
-{
-char buf[512];
-struct wormCdnaIterator *it;
-
-it = needMem(sizeof(*it));
-getDirs();
-sprintf(buf, "%s%s", cdnaDir, "allcdna.fa");
-it->faFile = mustOpen(buf, "rb");
-*retSi = it;
-return TRUE;
-}
-
-void freeWormCdnaIterator(struct wormCdnaIterator **pIt)
-/* Free up iterator returned by wormSearchAllCdna() */
-{
-struct wormCdnaIterator *it = *pIt;
-if (it != NULL)
-    {
-    carefulClose(&it->faFile);
-    freez(pIt);
-    }
-}
-
-static boolean isAllAlpha(char *s)
-/* Returns TRUE if every character in string is a letter. */
-{
-char c;
-while ((c = *s++) != 0)
-    {
-    if (!isalpha(c)) return FALSE;
-    }
-return TRUE;
-}
-
-static boolean isAllDigit(char *s)
-/* Returns TRUE if every character in string is a digit. */
-{
-char c;
-while ((c = *s++) != 0)
-    {
-    if (!isdigit(c)) return FALSE;
-    }
-return TRUE;
-}
-
-boolean wormIsOrfName(char *in)
-/* Check to see if the input is formatted correctly to be
- * an ORF. */
-{
-return strchr(in, '.') != NULL;
-}
-
-boolean wormIsGeneName(char *name)
-/* See if it looks like a worm gene name - that is
- *   abc-12
- * letters followed by a dash followed by a number. */
-{
-char buf[128];
-int partCount;
-strncpy(buf, name, sizeof(buf));
-partCount = chopString(buf, "-", NULL, 0);
-if (partCount == 2)
-    {
-    char *parts[2];
-    chopString(buf, "-", parts, 2);
-    return isAllAlpha(parts[0]) && isAllDigit(parts[1]);
-    }
-else
-    {
-    return FALSE;
-    }
-}
-
-struct slName *wormGeneToOrfNames(char *name)
-/* Returns list of cosmid.N type ORF names that are known by abc-12 type name. */
-{
-struct slName *synList = NULL;
-char synFileName[512];
-FILE *synFile;
-char lineBuf[128];
-int nameLen = strlen(name);
-
-/* genes are supposed to be lower case. */
-tolowers(name);
-
-/* Open synonym file and loop through each line of it */
-sprintf(synFileName, "%ssyn", wormFeaturesDir());
-if ((synFile = fopen(synFileName, "r")) == NULL)
-    errAbort("Can't find synonym file '%s'. (errno: %d)\n", synFileName, errno);
-while (fgets(lineBuf, ArraySize(lineBuf), synFile))
-    {
-    /* If first part of line matches chop up line. */
-    if (strncmp(name, lineBuf, nameLen) == 0)
-	{
-	char *syns[32];
-	int count;
-	count = chopString(lineBuf, whiteSpaceChopper, syns, ArraySize(syns));
-
-	/* Looks like we got a synonym.  Add all the aliases. */
-	if (strcmp(name, syns[0]) == 0)
-	    {
-	    int i;
-	    for (i=1; i<count; ++i)
-                slAddTail(&synList, newSlName(syns[i]));
-	    break;
-	    }
-	}
-    }
-fclose(synFile);
-return synList;
-}
-
-char *wormGeneFirstOrfName(char *geneName)
-/* Return first ORF synonym to gene. */
-{
-struct slName *synList = wormGeneToOrfNames(geneName);
-char *name;
-if (synList == NULL)
-    return NULL;
-name = cloneString(synList->name);
-slFreeList(&synList);
-return name;
-}
-
-boolean wormGeneForOrf(char *orfName, char *geneNameBuf, int bufSize)
-/* Look for gene type (unc-12 or something) synonym for cosmid.N name. */
-{
-FILE *f;
-char fileName[512];
-char lineBuf[512];
-int nameLen = strlen(orfName);
-boolean ok = FALSE;
-
-sprintf(fileName, "%sorf2gene", wormFeaturesDir());
-f = mustOpen(fileName, "r");
-while (fgets(lineBuf, sizeof(lineBuf), f))
-    {
-    if (strncmp(lineBuf, orfName, nameLen) == 0 && lineBuf[nameLen] == ' ')
-        {
-        char *words[2];
-        int wordCount;
-        wordCount = chopLine(lineBuf, words);
-        assert((int)strlen(words[1]) < bufSize);
-        strncpy(geneNameBuf, words[1], bufSize);
-        ok = TRUE;
-        break;
-        }
-    }
-fclose(f);
-return ok;
-}
-
-boolean wormInfoForGene(char *orfName, struct wormCdnaInfo *retInfo)
-/* Return info if any on ORF, or NULL if none exists. freeMem() return value. */
-{
-FILE *f;
-char fileName[512];
-char lineBuf[512];
-int nameLen;
-char *info = NULL;
-char *synName = NULL;
-int lineCount = 0;
-
-/* Make this one work for orfs as well as gene names */
-if (wormIsGeneName(orfName))
-    {
-    synName = wormGeneFirstOrfName(orfName);
-    if (synName != NULL)
-        orfName = synName;
-    }
-sprintf(fileName, "%sorfInfo", wormFeaturesDir());
-nameLen = strlen(orfName);
-f = mustOpen(fileName, "r");
-while (fgets(lineBuf, sizeof(lineBuf), f))
-    {
-    ++lineCount;
-    if (strncmp(lineBuf, orfName, nameLen) == 0 && lineBuf[nameLen] == ' ')
-        {
-        info = cloneString(lineBuf);
-        break;
-        }
-    }
-freeMem(synName);
-fclose(f);
-if (info == NULL)
-    return FALSE;
-wormFaCommentIntoInfo(info, retInfo);
-return TRUE;;
-}
-
-boolean getWormGeneDna(char *name, DNA **retDna, boolean upcExons)
-/* Get the DNA associated with a gene.  Optionally upper case exons. */
-{
-struct gdfGene *g;
-struct slName *syn = NULL;
-long lstart, lend;
-int start, end;
-int dnaSize;
-DNA *dna;
-struct wormGdfCache *gdfCache;
-
-/* Translate biologist type name to cosmid.N name */
-if (wormIsGeneName(name))
-    {
-    syn = wormGeneToOrfNames(name);
-    if (syn != NULL)
-        name = syn->name;
-    }
-if (strncmp(name, "g-", 2) == 0)
-    gdfCache = &wormGenieGdfCache;
-else
-    gdfCache = &wormSangerGdfCache;
-if ((g = wormGetSomeGdfGene(name, gdfCache)) == NULL)
-    return FALSE;
-gdfGeneExtents(g, &lstart, &lend);
-start = lstart;
-end = lend;
-/* wormClipRangeToChrom(chromIds[g->chromIx], &start, &end); */
-dnaSize = end-start;
-*retDna = dna = wormChromPart(chromIds[g->chromIx], start, dnaSize);
-
-gdfOffsetGene(g, -start);
-if (g->strand == '-')
-    {
-    reverseComplement(dna, dnaSize);
-    gdfRcGene(g, dnaSize);
-    }
-if (upcExons)
-    {
-    int i;
-    struct gdfDataPoint *pt = g->dataPoints;
-    for (i=0; i<g->dataCount; i += 2)
-        {
-        toUpperN(dna + pt[i].start, pt[i+1].start - pt[i].start);
-        }
-    }
-gdfFreeGene(g);
-return TRUE;
-}
-
-boolean getWormGeneExonDna(char *name, DNA **retDna)
-/* Get the DNA associated with a gene, without introns.  */
-{
-struct gdfGene *g;
-struct slName *syn = NULL;
-long lstart, lend;
-int start, end;
-int dnaSize;
-DNA *dna;
-int i;
-struct gdfDataPoint *pt = NULL;
-struct wormGdfCache *gdfCache;
-struct dyString *dy = newDyString(1000);
-/* Translate biologist type name to cosmid.N name */
-if (wormIsGeneName(name))
-    {
-    syn = wormGeneToOrfNames(name);
-    if (syn != NULL)
-        name = syn->name;
-    }
-if (strncmp(name, "g-", 2) == 0)
-    gdfCache = &wormGenieGdfCache;
-else
-    gdfCache = &wormSangerGdfCache;
-if ((g = wormGetSomeGdfGene(name, gdfCache)) == NULL)
-    return FALSE;
-gdfGeneExtents(g, &lstart, &lend);
-start = lstart;
-end = lend;
-/*wormClipRangeToChrom(chromIds[g->chromIx], &start, &end);*/
-dnaSize = end-start;
-dna = wormChromPart(chromIds[g->chromIx], start, dnaSize);
-
-gdfOffsetGene(g, -start);
-if (g->strand == '-')
-    {
-    reverseComplement(dna, dnaSize);
-    gdfRcGene(g, dnaSize);
-    }
-pt = g->dataPoints;
-for (i=0; i<g->dataCount; i += 2)
-    {
-    dyStringAppendN(dy, (dna+pt[i].start), (pt[i+1].start - pt[i].start));
-    }
-*retDna = cloneString(dy->string);
-dyStringFree(&dy);
-gdfFreeGene(g);
-return TRUE;
-}
-
-static void makeChromFileName(char *chromId, char *buf)
-{
-getDirs();
-sprintf(buf, "%s%s.nt4", nt4Dir, chromId);
-}
-
-void wormLoadNt4Genome(struct nt4Seq ***retNt4Seq, int *retNt4Count)
-/* Load up entire packed worm genome into memory. */
-{
-int count = ArraySize(chromIds);
-struct nt4Seq **nt4s = needMem(count*sizeof(*nt4s));
-int i;
-char fileName[512];
-
-for (i=0; i<count; ++i)
-    {
-    makeChromFileName(chromIds[i], fileName);
-    nt4s[i] = loadNt4(fileName, chromIds[i]);
-    }
-*retNt4Seq = nt4s;
-*retNt4Count = count;
-}
-
-void wormFreeNt4Genome(struct nt4Seq ***pNt4Seq)
-/* Free up packed worm genome. */
-{
-struct nt4Seq **seqs;
-int i;
-if ((seqs = *pNt4Seq) == NULL)
-    return;
-for (i=0; i<ArraySize(chromIds); ++i)
-    freeNt4(&seqs[i]);
-freez(pNt4Seq);
-}
-
-int wormChromSize(char *chrom)
-/* Return size of worm chromosome. */
-{
-static int sizes[ArraySize(chromIds)];
-int ix;
-int size;
-
-if ((ix = wormChromIx(chrom)) < 0)
-    errAbort("%s isn't a chromosome", chrom);
-size = sizes[ix];
-
-/* If we don't know it already have to get it from file. */
-if (size == 0)
-    {
-    char fileName[512];
-    makeChromFileName(chromIds[ix], fileName);
-    size = sizes[ix] = nt4BaseCount(fileName);
-    }
-return size;
-}
-
-
-DNA *wormChromPart(char *chromId, int start, int size)
-/* Return part of a worm chromosome. */
-{
-char fileName[512];
-makeChromFileName(chromId, fileName);
-return nt4LoadPart(fileName, start, size);
-}
-
-DNA *wormChromPartExonsUpper(char *chromId, int start, int size)
-/* Return part of a worm chromosome with exons in upper case. */
-{
-DNA *dna = wormChromPart(chromId, start, size);
-struct wormFeature *geneFeat = wormGenesInRange(chromId, start, start+size);
-struct wormFeature *feat;
-
-for (feat = geneFeat; feat != NULL; feat = feat->next)
-    {
-    char *name = feat->name;
-    if (!wormIsNamelessCluster(name))
-        {
-        struct gdfGene *gene = wormGetGdfGene(name);
-        gdfUpcExons(gene, feat->start, dna, size, start);
-        gdfFreeGene(gene);
-        }
-    }
-slFreeList(&geneFeat);
-return dna;
-}
-
-void wormClipRangeToChrom(char *chrom, int *pStart, int *pEnd)
-/* Make sure that we stay inside chromosome. */
-{
-int chromEnd = wormChromSize(chrom);
-int temp;
-
-/* Swap ends if reversed. */
-if (*pStart > *pEnd)
-    {
-    temp = *pEnd;
-    *pEnd = *pStart;
-    *pStart = temp;
-    }
-/* Generally speaking try to slide the range covered by
- * start-end inside the chromosome rather than just
- * truncating an end. */
-if (*pStart < 0)
-    {
-    *pEnd -= *pStart;
-    *pStart = 0;
-    }
-if (*pEnd > chromEnd)
-    {
-    *pStart -= *pEnd - chromEnd;
-    *pEnd = chromEnd;
-    }
-/* This handles case where the range is larger than the chromosome. */
-if (*pStart < 0)
-    *pStart = 0;
-}
-
-boolean wormParseChromRange(char *in, char **retChromId, int *retStart, int *retEnd)
-/* Chop up a string representation of a range within a chromosome and put the
- * pieces into the return variables. Return FALSE if it isn't formatted right. */
-{
-char *words[5];
-int wordCount;
-char *chromId;
-char buf[128];
-
-strncpy(buf, in, sizeof(buf));
-wordCount = chopString(buf, "- \t\r\n:", words, ArraySize(words));
-if (wordCount != 3)
-    return FALSE;
-chromId = wormOfficialChromName(words[0]);
-if (chromId == NULL)
-    return FALSE;
-if (!isdigit(words[1][0]) || !isdigit(words[2][0]))
-    return FALSE;
-*retChromId = chromId;
-*retStart = atoi(words[1]);
-*retEnd = atoi(words[2]);
-wormClipRangeToChrom(chromId, retStart, retEnd);
-return TRUE;
-}
-
-boolean wormIsChromRange(char *in)
-/* Check to see if the input is formatted correctly to be
- * a range of a chromosome. */
-{
-char *chromId;
-int start, end;
-boolean ok;
-ok =  wormParseChromRange(in, &chromId, &start, &end);
-return ok;
-}
-
-boolean wormFixupOrfName(char *name)
-/* Turn something into a proper cosmid.# style name. Return FALSE if it can't be done. */
-{
-char *dot = strrchr(name, '.');
-if (dot == NULL)
-    return FALSE;
-toUpperN(name, dot-name);   /* First part always upper case. */
-if (!isdigit(dot[1]))          /* Nameless cluster - just leave following digits be. */
-    return TRUE;
-else
-    tolowers(dot+1);        /* Suffix is lower case. */
-return TRUE;
-}
-
-boolean wormIsAltSplicedName(char *name)
-/* Is name in right form to be an isoform? */
-{
-char *dot = strrchr(name, '.');
-if (dot == NULL)
-    return FALSE;
-if (!isdigit(dot[1]))
-    return FALSE;
-return isalpha(dot[strlen(dot)-1]);
-}
-
-static void makeIsoformBaseName(char *name)
-{
-if (wormIsAltSplicedName(name))
-    name[strlen(name)-1] = 0;
-}
-
-static boolean findAltSpliceRange(char *name, struct snof *snof, FILE *f, 
-    char **retChrom, int *retStart, int *retEnd, char *retStrand)
-/* Return range of chromosome covered by a gene and all of it's isoforms. */
-{
-char baseName[64];
-char bName[64];
-int snIx, maxIx;
-int start = 0x7fffffff;
-int end = -start;
-char lineBuf[128];
-char *words[3];
-int wordCount;
-int baseNameSize;
-
-strcpy(baseName, name);
-makeIsoformBaseName(baseName);
-baseNameSize = strlen(baseName);
-if (!snofFindFirstStartingWith(snof, baseName, baseNameSize, &snIx))
-    return FALSE;
-maxIx = snofElementCount(snof);
-for (;snIx < maxIx; ++snIx)
-    {
-    long offset;
-    char *geneName;
-
-    snofNameOffsetAtIx(snof, snIx, &geneName, &offset);
-    if (strncmp(geneName, baseName, baseNameSize) != 0)
-        break;
-    strcpy(bName, geneName);
-    makeIsoformBaseName(bName);
-    if (sameString(baseName, bName))
-        {
-        int s, e;
-        fseek(f, offset, SEEK_SET);
-        mustGetLine(f, lineBuf, sizeof(lineBuf));
-        wordCount = chopLine(lineBuf, words);
-        assert(wordCount == 3);
-        wormParseChromRange(words[0], retChrom, &s, &e);
-        *retStrand = words[1][0];
-        if (start > s)
-            start = s;
-        if (end < e)
-            end = e;
-        }
-    }
-*retStart = start;
-*retEnd = end;
-return TRUE;
-}
-
-
-boolean wormGeneRange(char *name, char **retChrom, char *retStrand, int *retStart, int *retEnd)
-/* Return chromosome position of a chrom range, gene, ORF, cosmid, or nameless cluster. */
-{
-static struct snof *c2gSnof = NULL, *c2cSnof = NULL;
-static FILE *c2gFile = NULL, *c2cFile = NULL;
-long offset;
-char fileName[512];
-struct slName *syn = NULL;
-boolean ok;
-
-if (wormIsChromRange(name))
-    {
-    *retStrand = '.';
-    return wormParseChromRange(name, retChrom, retStart, retEnd);
-    }
-
-getDirs();
-
-/* Translate biologist type name to cosmid.N name */
-if (wormIsGeneName(name))
-    {
-    syn = wormGeneToOrfNames(name);
-    if (syn != NULL)
-	{
-        name = syn->name;
-	}
-    }
-if (wormFixupOrfName(name)) /* See if ORF, and if so make nice. */
-    {
-    if (c2gSnof == NULL)
-        {
-        sprintf(fileName, "%sc2g", featDir);
-        c2gSnof = snofMustOpen(fileName);
-        sprintf(fileName, "%sc2g", featDir);
-        c2gFile = mustOpen(fileName, "rb");
-        }
-    ok = findAltSpliceRange(name, c2gSnof, c2gFile, retChrom, retStart, retEnd, retStrand);
-    }
-else    /* Lets say it's a cosmid. */
-    {
-    char lineBuf[128];
-    char *words[3];
-    int wordCount;
-    touppers(name);
-    if (c2cSnof == NULL)
-        {
-        sprintf(fileName, "%sc2c", featDir);
-        c2cSnof = snofMustOpen(fileName);
-        sprintf(fileName, "%sc2c", featDir);
-        c2cFile = mustOpen(fileName, "rb");
-        }
-    if (!snofFindOffset(c2cSnof, name, &offset) )
-        return FALSE;
-    fseek(c2cFile, offset, SEEK_SET);
-    mustGetLine(c2cFile, lineBuf, sizeof(lineBuf));
-    wordCount = chopLine(lineBuf, words);
-    assert(wordCount == 3);
-    assert(strcmp(words[2], name) == 0);
-    assert(wormIsChromRange(words[0]));
-    *retStrand = words[1][0];
-    ok = wormParseChromRange(words[0], retChrom, retStart, retEnd);
-    }
-slFreeList(&syn);
-return ok;
-}
-
-boolean wormIsNamelessCluster(char *name)
-/* Returns true if name is of correct format to be a nameless cluster. */
-{
-char *e = strrchr(name, '.');
-if (e == NULL)
-    return FALSE;
-if (e[1] != 'N')
-    return FALSE;
-if (!isdigit(e[2]))
-    return FALSE;
-return TRUE;
-}
-
-DNA *wormGetNamelessClusterDna(char *name)
-/* Get DNA associated with nameless cluster */
-{
-char *chrom;
-int start, end;
-char strand;
-if (!wormGeneRange(name, &chrom, &strand, &start, &end))
-    errAbort("Can't find %s in database", name);
-return wormChromPart(chrom, start, end-start);
-}
-
-struct wormGdfCache wormSangerGdfCache = {&sangerDir,NULL,NULL};
-struct wormGdfCache wormGenieGdfCache = {&genieDir,NULL,NULL};
-struct wormGdfCache *defaultGdfCache = &wormSangerGdfCache;
-
-
-static void wormCacheSomeGdf(struct wormGdfCache *cache)
-/* Cache one gene prediction set. */
-{
-if (cache->snof == NULL)
-    {
-    char fileName[512];
-    char *dir;
-    bits32 sig;
-    getDirs();
-    dir = *(cache->pDir);
-    sprintf(fileName, "%sgenes", dir);
-    cache->snof = snofMustOpen(fileName);
-    sprintf(fileName, "%sgenes.gdf", dir);
-    cache->file = mustOpen(fileName, "rb");
-    mustReadOne(cache->file, sig);
-    if (sig != glSig)
-        errAbort("%s is not a good file", fileName);
-    }
-}
-
-#if 0 /* unused */
-static void wormCacheGdf()
-/* Set up for fast access to GDF file entries. */
-{
-wormCacheSomeGdf(defaultGdfCache);
-}
-#endif
-
-void wormUncacheSomeGdf(struct wormGdfCache *cache)
-/* Uncache some gene prediction set. */
-{
-snofClose(&cache->snof);
-carefulClose(&cache->file);
-}
-
-void wormUncacheGdf()
-/* Free up resources associated with fast GDF access. */
-{
-wormUncacheSomeGdf(defaultGdfCache);
-}
-
-struct gdfGene *wormGetSomeGdfGene(char *name, struct wormGdfCache *cache)
-/* Get a single gdfGene of given name. */
-{
-long offset;
-
-wormCacheSomeGdf(cache);
-if (!snofFindOffset(cache->snof, name, &offset) )
-    return NULL;
-fseek(cache->file, offset, SEEK_SET);
-return gdfReadOneGene(cache->file);
-}
-
-struct gdfGene *wormGetGdfGene(char *name)
-/* Get a single gdfGene of given name. */
-{
-return wormGetSomeGdfGene(name, defaultGdfCache);
-}
-
-struct gdfGene *wormGetSomeGdfGeneList(char *baseName, int baseNameSize, struct wormGdfCache *cache)
-/* Get all gdfGenes that start with a given name. */
-{
-int snIx;
-int maxIx;
-struct snof *snof;
-FILE *f;
-struct gdfGene *list = NULL, *el;
-
-wormCacheSomeGdf(cache);
-snof = cache->snof;
-f = cache->file;
-if (!snofFindFirstStartingWith(snof, baseName, baseNameSize, &snIx))
-    return NULL;
-
-maxIx = snofElementCount(snof);
-for (;snIx < maxIx; ++snIx)
-    {
-    long offset;
-    char *geneName;
-
-    snofNameOffsetAtIx(snof, snIx, &geneName, &offset);
-    if (strncmp(geneName, baseName, baseNameSize) != 0)
-        break;
-    fseek(f, offset, SEEK_SET);
-    el = gdfReadOneGene(f);
-    slAddTail(&list, el);
-    }
-slReverse(&list);
-return list;
-}
-
-struct gdfGene *wormGetGdfGeneList(char *baseName, int baseNameSize)
-/* Get all gdfGenes that start with a given name. */
-{
-return wormGetSomeGdfGeneList(baseName, baseNameSize, defaultGdfCache);
-}
-
-struct gdfGene *wormGdfGenesInRange(char *chrom, int start, int end, 
-    struct wormGdfCache *geneFinder)
-/* Get list of genes in range according to given gene finder. */
-{
-char *dir = NULL;
-struct gdfGene *gdfList = NULL, *gdf;
-struct wormFeature *nameList, *name;
-
-if (geneFinder == &wormSangerGdfCache)
-    dir = wormSangerDir();
-else if (geneFinder == &wormGenieGdfCache)
-    dir = wormGenieDir();
-else
-    errAbort("Unknown geneFinder line %d of %s", __LINE__, __FILE__);
-
-nameList = wormSomeGenesInRange(chrom, start, end, dir);
-for (name = nameList; name != NULL; name = name->next)
-    {
-    char *n = name->name;
-    if (!wormIsNamelessCluster(n))
-        {
-        gdf = wormGetSomeGdfGene(n, geneFinder);
-        slAddHead(&gdfList, gdf);
-        }
-    }
-slFreeList(&nameList);
-slReverse(&gdfList);
-return gdfList;
-}
-
-
diff --git a/gbtools/src/blatSrc/lib/xAli.as b/gbtools/src/blatSrc/lib/xAli.as
deleted file mode 100644
index c737f7b..0000000
--- a/gbtools/src/blatSrc/lib/xAli.as
+++ /dev/null
@@ -1,27 +0,0 @@
-table xAli
-"An alignment - like psl but includes the sequence itself"
-    (
-    uint match;  "Number of bases that match that aren't repeats"
-    uint misMatch; "Number of bases that don't match"
-    uint repMatch; "Number of bases that match but are part of repeats"
-    uint nCount;  "Number of 'N' bases"
-    uint qNumInsert; "Number of inserts in query"
-    int qBaseInsert; "Number of bases inserted in query"
-    uint tNumInsert; "Number of inserts in target"
-    int tBaseInsert; "Number of bases inserted in target"
-    char[2] strand; "+ or - for strand. First character query, second target (optional)"
-    string qName; "Query sequence name"
-    uint qSize; "Query sequence size"
-    uint qStart; "Alignment start position in query"
-    uint qEnd; "Alignment end position in query"
-    string tName; "Target sequence name"
-    uint tSize; "Target sequence size"
-    uint tStart; "Alignment start position in target"
-    uint tEnd; "Alignment end position in target"
-    uint blockCount; "Number of blocks in alignment"
-    uint[blockCount] blockSizes; "Size of each block"
-    uint[blockCount] qStarts; "Start of each block in query."
-    uint[blockCount] tStarts; "Start of each block in target."
-    lstring[blockCount] qSeq; "Query sequence for each block."
-    lstring[blockCount] tSeq; "Target sequence for each block."
-    )
diff --git a/gbtools/src/blatSrc/lib/xAli.c b/gbtools/src/blatSrc/lib/xAli.c
deleted file mode 100644
index f65adff..0000000
--- a/gbtools/src/blatSrc/lib/xAli.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/* xAli.c was originally generated by the autoSql program, which also 
- * generated xAli.h and xAli.sql.  This module links the database and
- * the RAM representation of objects. 
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "linefile.h"
-#include "dystring.h"
-#include "sqlNum.h"
-#include "sqlList.h"
-#include "xAli.h"
-
-
-struct xAli *xAliLoad(char **row)
-/* Load a xAli from row fetched with select * from xAli
- * from database.  Dispose of this with xAliFree(). */
-{
-struct xAli *ret;
-int sizeOne;
-
-AllocVar(ret);
-ret->blockCount = sqlUnsigned(row[17]);
-ret->match = sqlUnsigned(row[0]);
-ret->misMatch = sqlUnsigned(row[1]);
-ret->repMatch = sqlUnsigned(row[2]);
-ret->nCount = sqlUnsigned(row[3]);
-ret->qNumInsert = sqlUnsigned(row[4]);
-ret->qBaseInsert = sqlSigned(row[5]);
-ret->tNumInsert = sqlUnsigned(row[6]);
-ret->tBaseInsert = sqlSigned(row[7]);
-strcpy(ret->strand, row[8]);
-ret->qName = cloneString(row[9]);
-ret->qSize = sqlUnsigned(row[10]);
-ret->qStart = sqlUnsigned(row[11]);
-ret->qEnd = sqlUnsigned(row[12]);
-ret->tName = cloneString(row[13]);
-ret->tSize = sqlUnsigned(row[14]);
-ret->tStart = sqlUnsigned(row[15]);
-ret->tEnd = sqlUnsigned(row[16]);
-sqlUnsignedDynamicArray(row[18], &ret->blockSizes, &sizeOne);
-assert(sizeOne == ret->blockCount);
-sqlUnsignedDynamicArray(row[19], &ret->qStarts, &sizeOne);
-assert(sizeOne == ret->blockCount);
-sqlUnsignedDynamicArray(row[20], &ret->tStarts, &sizeOne);
-assert(sizeOne == ret->blockCount);
-sqlStringDynamicArray(row[21], &ret->qSeq, &sizeOne);
-assert(sizeOne == ret->blockCount);
-sqlStringDynamicArray(row[22], &ret->tSeq, &sizeOne);
-assert(sizeOne == ret->blockCount);
-return ret;
-}
-
-struct xAli *xAliLoadAll(char *fileName) 
-/* Load all xAli from a tab-separated file.
- * Dispose of this with xAliFreeList(). */
-{
-struct xAli *list = NULL, *el;
-struct lineFile *lf = lineFileOpen(fileName, TRUE);
-char *row[23];
-
-while (lineFileRow(lf, row))
-    {
-    el = xAliLoad(row);
-    slAddHead(&list, el);
-    }
-lineFileClose(&lf);
-slReverse(&list);
-return list;
-}
-
-struct xAli *xAliCommaIn(char **pS, struct xAli *ret)
-/* Create a xAli out of a comma separated string. 
- * This will fill in ret if non-null, otherwise will
- * return a new xAli */
-{
-char *s = *pS;
-int i;
-
-if (ret == NULL)
-    AllocVar(ret);
-ret->match = sqlUnsignedComma(&s);
-ret->misMatch = sqlUnsignedComma(&s);
-ret->repMatch = sqlUnsignedComma(&s);
-ret->nCount = sqlUnsignedComma(&s);
-ret->qNumInsert = sqlUnsignedComma(&s);
-ret->qBaseInsert = sqlSignedComma(&s);
-ret->tNumInsert = sqlUnsignedComma(&s);
-ret->tBaseInsert = sqlSignedComma(&s);
-sqlFixedStringComma(&s, ret->strand, sizeof(ret->strand));
-ret->qName = sqlStringComma(&s);
-ret->qSize = sqlUnsignedComma(&s);
-ret->qStart = sqlUnsignedComma(&s);
-ret->qEnd = sqlUnsignedComma(&s);
-ret->tName = sqlStringComma(&s);
-ret->tSize = sqlUnsignedComma(&s);
-ret->tStart = sqlUnsignedComma(&s);
-ret->tEnd = sqlUnsignedComma(&s);
-ret->blockCount = sqlUnsignedComma(&s);
-s = sqlEatChar(s, '{');
-AllocArray(ret->blockSizes, ret->blockCount);
-for (i=0; i<ret->blockCount; ++i)
-    {
-    ret->blockSizes[i] = sqlUnsignedComma(&s);
-    }
-s = sqlEatChar(s, '}');
-s = sqlEatChar(s, ',');
-s = sqlEatChar(s, '{');
-AllocArray(ret->qStarts, ret->blockCount);
-for (i=0; i<ret->blockCount; ++i)
-    {
-    ret->qStarts[i] = sqlUnsignedComma(&s);
-    }
-s = sqlEatChar(s, '}');
-s = sqlEatChar(s, ',');
-s = sqlEatChar(s, '{');
-AllocArray(ret->tStarts, ret->blockCount);
-for (i=0; i<ret->blockCount; ++i)
-    {
-    ret->tStarts[i] = sqlUnsignedComma(&s);
-    }
-s = sqlEatChar(s, '}');
-s = sqlEatChar(s, ',');
-s = sqlEatChar(s, '{');
-AllocArray(ret->qSeq, ret->blockCount);
-for (i=0; i<ret->blockCount; ++i)
-    {
-    ret->qSeq[i] = sqlStringComma(&s);
-    }
-s = sqlEatChar(s, '}');
-s = sqlEatChar(s, ',');
-s = sqlEatChar(s, '{');
-AllocArray(ret->tSeq, ret->blockCount);
-for (i=0; i<ret->blockCount; ++i)
-    {
-    ret->tSeq[i] = sqlStringComma(&s);
-    }
-s = sqlEatChar(s, '}');
-s = sqlEatChar(s, ',');
-*pS = s;
-return ret;
-}
-
-void xAliFree(struct xAli **pEl)
-/* Free a single dynamically allocated xAli such as created
- * with xAliLoad(). */
-{
-struct xAli *el;
-
-if ((el = *pEl) == NULL) return;
-freeMem(el->qName);
-freeMem(el->tName);
-freeMem(el->blockSizes);
-freeMem(el->qStarts);
-freeMem(el->tStarts);
-/* All strings in qSeq are allocated at once, so only need to free first. */
-if (el->qSeq != NULL)
-    freeMem(el->qSeq[0]);
-freeMem(el->qSeq);
-/* All strings in tSeq are allocated at once, so only need to free first. */
-if (el->tSeq != NULL)
-    freeMem(el->tSeq[0]);
-freeMem(el->tSeq);
-freez(pEl);
-}
-
-void xAliFreeList(struct xAli **pList)
-/* Free a list of dynamically allocated xAli's */
-{
-struct xAli *el, *next;
-
-for (el = *pList; el != NULL; el = next)
-    {
-    next = el->next;
-    xAliFree(&el);
-    }
-*pList = NULL;
-}
-
-void xAliOutput(struct xAli *el, FILE *f, char sep, char lastSep) 
-/* Print out xAli.  Separate fields with sep. Follow last field with lastSep. */
-{
-int i;
-fprintf(f, "%u", el->match);
-fputc(sep,f);
-fprintf(f, "%u", el->misMatch);
-fputc(sep,f);
-fprintf(f, "%u", el->repMatch);
-fputc(sep,f);
-fprintf(f, "%u", el->nCount);
-fputc(sep,f);
-fprintf(f, "%u", el->qNumInsert);
-fputc(sep,f);
-fprintf(f, "%d", el->qBaseInsert);
-fputc(sep,f);
-fprintf(f, "%u", el->tNumInsert);
-fputc(sep,f);
-fprintf(f, "%d", el->tBaseInsert);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->strand);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->qName);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%u", el->qSize);
-fputc(sep,f);
-fprintf(f, "%u", el->qStart);
-fputc(sep,f);
-fprintf(f, "%u", el->qEnd);
-fputc(sep,f);
-if (sep == ',') fputc('"',f);
-fprintf(f, "%s", el->tName);
-if (sep == ',') fputc('"',f);
-fputc(sep,f);
-fprintf(f, "%u", el->tSize);
-fputc(sep,f);
-fprintf(f, "%u", el->tStart);
-fputc(sep,f);
-fprintf(f, "%u", el->tEnd);
-fputc(sep,f);
-fprintf(f, "%u", el->blockCount);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->blockCount; ++i)
-    {
-    fprintf(f, "%u", el->blockSizes[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->blockCount; ++i)
-    {
-    fprintf(f, "%u", el->qStarts[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->blockCount; ++i)
-    {
-    fprintf(f, "%u", el->tStarts[i]);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->blockCount; ++i)
-    {
-    if (sep == ',') fputc('"',f);
-    fprintf(f, "%s", el->qSeq[i]);
-    if (sep == ',') fputc('"',f);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-fputc(sep,f);
-if (sep == ',') fputc('{',f);
-for (i=0; i<el->blockCount; ++i)
-    {
-    if (sep == ',') fputc('"',f);
-    fprintf(f, "%s", el->tSeq[i]);
-    if (sep == ',') fputc('"',f);
-    fputc(',', f);
-    }
-if (sep == ',') fputc('}',f);
-fputc(lastSep,f);
-}
-
-/* --------------------Start of human generated code. -------------------- */
-
-struct xAli *xAliNext(struct lineFile *lf)
-/* Read next line from file and convert it to xAli.  Return
- * NULL at eof. */
-{
-char *row[23];
-if (!lineFileRow(lf, row))
-    return NULL;
-return xAliLoad(row);
-}
diff --git a/gbtools/src/blatSrc/lib/xAli.sql b/gbtools/src/blatSrc/lib/xAli.sql
deleted file mode 100644
index a0a54f5..0000000
--- a/gbtools/src/blatSrc/lib/xAli.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-# xAli.sql was originally generated by the autoSql program, which also 
-# generated xAli.c and xAli.h.  This creates the database representation of
-# an object which can be loaded and saved from RAM in a fairly 
-# automatic way.
-
-#An alignment - like psl but includes the sequence itself
-CREATE TABLE xAli (
-    match int unsigned not null,	# Number of bases that match that aren't repeats
-    misMatch int unsigned not null,	# Number of bases that don't match
-    repMatch int unsigned not null,	# Number of bases that match but are part of repeats
-    nCount int unsigned not null,	# Number of 'N' bases
-    qNumInsert int unsigned not null,	# Number of inserts in query
-    qBaseInsert int not null,	# Number of bases inserted in query
-    tNumInsert int unsigned not null,	# Number of inserts in target
-    tBaseInsert int not null,	# Number of bases inserted in target
-    strand char(2) not null,	# + or - for strand. First character query, second target (optional)
-    qName varchar(255) not null,	# Query sequence name
-    qSize int unsigned not null,	# Query sequence size
-    qStart int unsigned not null,	# Alignment start position in query
-    qEnd int unsigned not null,	# Alignment end position in query
-    tName varchar(255) not null,	# Target sequence name
-    tSize int unsigned not null,	# Target sequence size
-    tStart int unsigned not null,	# Alignment start position in target
-    tEnd int unsigned not null,	# Alignment end position in target
-    blockCount int unsigned not null,	# Number of blocks in alignment
-    blockSizes longblob not null,	# Size of each block
-    qStarts longblob not null,	# Start of each block in query.
-    tStarts longblob not null,	# Start of each block in target.
-    qSeq longblob not null,	# Query sequence for each block.
-    tSeq longblob not null,	# Target sequence for each block.
-              #Indices
-    PRIMARY KEY(match)
-);
diff --git a/gbtools/src/blatSrc/lib/xa.c b/gbtools/src/blatSrc/lib/xa.c
deleted file mode 100644
index 79a437c..0000000
--- a/gbtools/src/blatSrc/lib/xa.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* xao.c - Manage cross-species alignments in Intronerator database. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "sig.h"
-#include "xa.h"
-
-
-void xaAliFree(struct xaAli *xa)
-/* Free up a single xaAli. */
-{
-freeMem(xa->name);
-freeMem(xa->query);
-freeMem(xa->target);
-freeMem(xa->qSym);
-freeMem(xa->tSym);
-freeMem(xa->hSym);
-freeMem(xa);
-}
-
-void xaAliFreeList(struct xaAli **pXa)
-/* Free up a list of xaAlis. */
-{
-struct xaAli *xa, *next;
-for (xa = *pXa; xa != NULL; xa = next)
-    {
-    next = xa->next;
-    xaAliFree(xa);
-    }
-*pXa = NULL;
-}
-
-int xaAliCmpTarget(const void *va, const void *vb)
-/* Compare two xaAli's to sort by ascending target positions. */
-{
-const struct xaAli *a = *((struct xaAli **)va);
-const struct xaAli *b = *((struct xaAli **)vb);
-int diff;
-if ((diff = strcmp(a->target, b->target)) == 0)
-    diff = a->tStart - b->tStart;
-return diff;
-}
-
-
-FILE *xaOpenVerify(char *fileName)
-/* Open file, verify it's the right type, and
- * position file pointer for first xaReadNext(). */
-{
-FILE *f = mustOpen(fileName, "rb");
-return f;
-}
-
-FILE *xaIxOpenVerify(char *fileName)
-/* Open file, verify that it's a good xa index. */
-{
-FILE *f;
-bits32 sig;
-f = mustOpen(fileName, "rb");
-mustReadOne(f, sig);
-if (sig != xaoSig)
-    errAbort("Bad signature on %s", fileName);
-return f;
-}
-
-static void eatLf(FILE *f)
-/* Read next char and make sure it's a lf. */
-{
-int c;
-c = fgetc(f);
-if (c == '\r')
-    c = fgetc(f);
-if (c != '\n')
-    errAbort("Expecting new line in cross-species alignment file.");
-}
-
-static void eatThroughLf(FILE *f)
-/* Read through next lf (discarding results). */
-{
-int c;
-while ((c = fgetc(f)) != EOF)
-    if (c == '\n')
-        break;
-}
-
-/* An example line from .st file. 
-   G11A11.SEQ.c1 align 53.9% of 6096 ACTIN2~1\G11A11.SEQ:0-4999 - v:9730780-9736763 +
-         0         1     2    3   4             5               6        7          8
- */
-
-struct xaAli *xaReadNext(FILE *f, boolean condensed)
-/* Read next xaAli from file. If condensed
- * don't fill int query, target, qSym, tSym, or hSym. */
-{
-char line[512];
-char *words[16];
-int wordCount;
-struct xaAli *xa;
-char *parts[5];
-int partCount;
-double percentScore;
-int symCount;
-int newOffset = 0;
-char *s, *e;
-
-/* Get first line and parse out everything but the sym lines. */
-if (fgets(line, sizeof(line), f) == NULL)
-    return NULL;
-wordCount = chopLine(line, words);
-if (wordCount < 9)
-    errAbort("Short line in cross-species alignment file");
-if (wordCount == 10)
-    newOffset = 1;
-if (!sameString(words[1], "align"))
-    errAbort("Bad line in cross-species alignment file");
-AllocVar(xa);
-xa->name = cloneString(words[0]);
-s = words[5+newOffset];
-e = strrchr(s, ':');
-if (e == NULL)
-    errAbort("Bad line (no colon) in cross-species alignment file");
-*e++ = 0;
-partCount = chopString(e, "-", parts, ArraySize(parts));
-if (partCount != 2)
-    errAbort("Bad range format in cross-species alignment file");
-if (!condensed)
-    xa->query = cloneString(s);
-xa->qStart = atoi(parts[0]);
-xa->qEnd = atoi(parts[1]);
-xa->qStrand = words[6+newOffset][0];
-partCount = chopString(words[7+newOffset], ":-", parts, ArraySize(parts));
-if (!condensed)
-    xa->target = cloneString(parts[0]);
-xa->tStart = atoi(parts[1]);
-xa->tEnd = atoi(parts[2]);
-xa->tStrand = words[8+newOffset][0];
-percentScore = atof(words[2]);
-xa->milliScore = round(percentScore*10);    
-xa->symCount = symCount = atoi(words[4]);
-
-/* Get symbol lines. */
-if (condensed)
-    {
-    eatThroughLf(f);
-    eatThroughLf(f);
-    eatThroughLf(f);
-    }
-else
-    {
-    xa->qSym = needMem(symCount+1);
-    mustRead(f, xa->qSym, symCount);
-    eatLf(f);
-
-    xa->tSym = needMem(symCount+1);
-    mustRead(f, xa->tSym, symCount);
-    eatLf(f);
-
-    xa->hSym = needMem(symCount+1);
-    mustRead(f, xa->hSym, symCount);
-    eatLf(f);
-    }
-return xa;
-}
-
-struct xaAli *xaRdRange(FILE *ix, FILE *data, 
-    int start, int end, boolean condensed)
-/* Return list of all xaAlis that range from start to end.  
- * Assumes that ix and data files are open. If condensed
- * don't fill int query, target, qSym, tSym, or hSym. */
-{
-int s, e;
-int maxS, minE;
-long offset;
-struct xaAli *list = NULL, *xa;
-
-
-/* Scan through index file looking for things in range.
- * When find one read it from data file and add it to list. */
-fseek(ix, sizeof(bits32), SEEK_SET);
-for (;;)
-    {
-    if (!readOne(ix, s))
-        break;
-    mustReadOne(ix, e);
-    mustReadOne(ix, offset);
-    if (s >= end)
-        break;
-    maxS = max(s, start);
-    minE = min(e, end);
-    if (minE - maxS > 0)
-        {
-        fseek(data, offset, SEEK_SET);
-        xa = xaReadNext(data, condensed);
-        slAddHead(&list, xa);
-        }
-    }
-
-slReverse(&list);
-return list;
-}
-
-struct xaAli *xaReadRange(char *rangeIndexFileName, char *dataFileName, 
-    int start, int end, boolean condensed)
-/* Return list of all xaAlis that range from start to end.  If condensed
- * don't fill int query, target, qSym, tSym, or hSym. */
-{
-FILE *ix = xaIxOpenVerify(rangeIndexFileName);
-FILE *data = xaOpenVerify(dataFileName);
-struct xaAli *xa = xaRdRange(ix, data, start, end, condensed);
-fclose(data);
-fclose(ix);
-return xa;
-}
-
-
-char *xaAlignSuffix()
-/* Return suffix of file with actual alignments. */
-{
-return ".st";
-}
-
-char *xaChromIxSuffix()
-/* Return suffix of files that index xa's by chromosome position. */
-{
-return ".xao";
-}
-
-
-
diff --git a/gbtools/src/blatSrc/lib/xap.c b/gbtools/src/blatSrc/lib/xap.c
deleted file mode 100644
index 3201aa2..0000000
--- a/gbtools/src/blatSrc/lib/xap.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* xap - XML Automatic Parser - together with autoXml this helps automatically
- * read in automatically generated data structures.  Calls lower level routine
- * in xp module, which originally was just a thin shell around expat. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "xap.h"
-#include "errAbort.h"
-#include "xp.h"
-
-
-void xapError(struct xap *xap, char *format, ...)
-/* Issue an error message and abort*/
-{
-va_list args;
-va_start(args, format);
-vaWarn(format, args);
-errAbort("line %d of %s", xpLineIx(xap->xp), xap->fileName);
-va_end(args);
-}
-
-static void xapStartTag(void *userData, char *name, char **atts)
-/* Handle beginning of a tag. */
-{
-struct xap *xap = userData;
-struct xapStack *stack;
-
-stack = --xap->stack;
-if (stack < xap->stackBuf)
-    xapError(xap, "xap stack overflow");
-++xap->stackDepth;
-if (stack->text == NULL)
-    stack->text = newDyString(256);
-stack->elName = (char*)name;
-if (xap->skipDepth == 0)
-    stack->object = xap->startHandler(xap, (char*)name, (char**)atts);
-if (xap->stackDepth == 1)
-    {
-    freeMem(xap->topType);
-    xap->topType = cloneString(stack->elName);
-    xap->topObject = stack->object;
-    }
-}
-
-static void xapEndTag(void *userData, char *name, char *text)
-/* Handle end of tag. */
-{
-struct xap *xap = userData;
-struct xapStack *stack;
-
-dyStringAppend(xap->stack->text, text);
-if (xap->skipDepth == 0 || xap->skipDepth <= xap->stackDepth)
-    {
-    xap->skipDepth = 0;
-    if (xap->endHandler)
-	xap->endHandler(xap, (char*)name);
-    }
-stack = xap->stack++;
-if (xap->stack > xap->endStack)
-    xapError(xap, "xap stack underflow");
---xap->stackDepth;
-dyStringClear(stack->text);
-}
-
-#ifdef EXPAT
-static void xapText(void *userData, char *s, int len)
-/* Handle some text. */
-{
-struct xap *xap = userData;
-if (xap->skipDepth == 0)
-    dyStringAppendN(xap->stack->text, (char *)s, len);
-}
-#endif /* EXPAT */
-
-static int xapRead(void *userData, char *buf, int bufSize)
-/* Read some text. */
-{
-struct xap *xap = userData;
-return fread(buf, 1, bufSize, xap->f);
-}
-
-struct xap *xapNew(void *(*startHandler)(struct xap *xap, char *name, char **atts),
-	void (*endHandler)(struct xap *xap, char *name) , char *fileName)
-/* Create a new parse stack. */
-{
-struct xap *xap;
-AllocVar(xap);
-xap->endStack = xap->stack = xap->stackBuf + ArraySize(xap->stackBuf) - 1;
-xap->startHandler = startHandler;
-xap->endHandler = endHandler;
-xap->xp = xpNew(xap, xapStartTag, xapEndTag, xapRead, fileName);
-xap->fileName = cloneString(fileName);
-return xap;
-}
-
-void xapFree(struct xap **pXp)
-/* Free up a parse stack. */
-{
-struct xap *xap = *pXp;
-if (xap != NULL)
-    {
-    struct xapStack *stack;
-    for (stack = xap->stackBuf; stack < xap->endStack; ++stack)
-        {
-	if (stack->text != NULL)
-	   freeDyString(&stack->text);
-	}
-    xpFree(&xap->xp);
-    freeMem(xap->fileName);
-    freeMem(xap->topType);
-    freez(pXp);
-    }
-}
-
-void xapParseFile(struct xap *xap, char *fileName)
-/* Open up file and parse it all. */
-{
-xap->f = mustOpen(fileName, "r");
-xpParse(xap->xp);
-carefulClose(&xap->f);
-}
-
-void xapIndent(int count, FILE *f)
-/* Write out some spaces. */
-{
-int i;
-for (i=0; i<count; ++i)
-    {
-    fputc(' ', f);
-    }
-}
-
-void xapSkip(struct xap *xap)
-/* Skip current tag and any children.  Called from startHandler. */
-{
-xap->skipDepth = xap->stackDepth;
-}
-
-void xapParseAny(char *fileName, char *type, 
-	void *(*startHandler)(struct xap *xap, char *name, char **atts),
-	void (*endHandler)(struct xap *xap, char *name),
-	char **retType, void *retObj)
-/* Parse any object out of an XML file. 
- * If type parameter is non-NULL, force type.
- * example:
- *     xapParseAny("file.xml", "das", dasStartHandler, dasEndHandler, &type, &obj); */
-{
-struct xap *xap = xapNew(startHandler, endHandler, fileName);
-void **pObj = retObj;
-xapParseFile(xap, fileName);
-if (type != NULL && !sameString(xap->topType, type))
-    xapError(xap, "Got %s, expected %s\n", xap->topType, type);
-if (retType != NULL)
-    *retType = cloneString(xap->topType);
-*pObj = xap->topObject;
-xapFree(&xap);
-}
-
-struct xap *xapOpen(char *fileName, 
-	void *(*startHandler)(struct xap *xap, char *name, char **atts),
-	void (*endHandler)(struct xap *xap, char *name))
-/* Open up an xml file, but don't start parsing it yet.
- * Instead call xapNext to get the elements you want out of
- * the file.  When all done call xapFree. */
-{
-struct xap *xap = xapNew(startHandler, endHandler, fileName);
-xap->f =  mustOpen(fileName, "r");
-return xap;
-}
-
-void *xapNext(struct xap *xap, char *tag)
-/* Return next item matching tag (and all of it's children). */
-{
-if (!xpParseNext(xap->xp, tag))
-    return NULL;
-if (!sameString(xap->topType, tag))
-    errAbort("Expecting %s tag, got %s tag", tag, xap->topType);
-return xap->topObject;
-}
-
diff --git a/gbtools/src/blatSrc/lib/xenshow.c b/gbtools/src/blatSrc/lib/xenshow.c
deleted file mode 100644
index c776c72..0000000
--- a/gbtools/src/blatSrc/lib/xenshow.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* xenshow - show a cross-species alignment. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "nt4.h"
-#include "xenalign.h"
-
-
-static void printMatchers(char *a, char *b, int lineSize, FILE *f)
-/* Print '|' where a[i] and b[i] match, ' ' where they don't */
-{
-int i;
-for (i=0; i<lineSize; ++i)
-   {
-   char c = ((a[i] == b[i]) ? '|' : ' ');
-   fputc(c, f);
-   }
-}
-
-static int nonDashCount(char *s, int size)
-/* Return number of characters in s[0] to s[size-1] that
- * aren't dashes. */
-{
-int count = 0;
-int i;
-for (i=0; i<size; ++i)
-    if (s[i] != '-')
-        ++count;
-return count;
-}
-
-void xenShowAli(char *qSym, char *tSym, char *hSym, int symCount, FILE *f,
-   int qOffset, int tOffset, char qStrand, char tStrand, int maxLineSize)
-/* Print alignment and HMM symbols maxLineSize bases at a time to file. */
-{
-int i;
-int lineSize;
-int count;
-
-for (i=0; i<symCount; i += lineSize)
-    {
-    lineSize = symCount - i;
-    if (lineSize > maxLineSize) lineSize = maxLineSize;
-    mustWrite(f, qSym+i, lineSize);
-    count = nonDashCount(qSym+i, lineSize);
-    if (qStrand == '-')
-        count = -count;
-    qOffset += count;
-    fprintf(f, " %9d\n", qOffset);
-    printMatchers(qSym+i, tSym+i, lineSize, f);
-    fputc('\n', f);
-    mustWrite(f, tSym+i, lineSize);
-    count = nonDashCount(tSym+i, lineSize);
-    if (tStrand == '-')
-        count = -count;
-    tOffset += count;
-    fprintf(f, " %9d\n", tOffset);
-    mustWrite(f, hSym+i, lineSize);
-    fputc('\n', f);
-    fputc('\n', f);
-    }
-}
-
diff --git a/gbtools/src/blatSrc/lib/xmlEscape.c b/gbtools/src/blatSrc/lib/xmlEscape.c
deleted file mode 100644
index 6912d5a..0000000
--- a/gbtools/src/blatSrc/lib/xmlEscape.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Handle escaping for XML files.  Deal with things like
- * & and &quot. */
-
-/* Copyright (C) 2011 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include "hash.h"
-#include "xmlEscape.h"
-
-
-struct hash *xmlEscapeSymHash()
-/* Return hash of predefined xml character symbols to lookup. */
-{
-struct hash *symHash = newHash(6);
-hashAdd(symHash, "lt", "<");
-hashAdd(symHash, "gt", ">");
-hashAdd(symHash, "amp", "&");
-hashAdd(symHash, "apos", "'");
-hashAdd(symHash, "quot", "\"");
-return symHash;
-}
-
-void xmlEscapeBytesToFile(unsigned char *buffer, int len, FILE *f)
-/* Write buffer of given length to file, escaping as need be. */
-{
-unsigned char c;
-int i;
-for (i=0; i<len; ++i)
-    {
-    c = buffer[i];
-    if (isalnum(c))
-        fputc(c, f);
-    else
-        {
-	switch (c)
-	    {
-	    case '&':
-	        fputs("&", f);
-		break;
-	    case '\'':
-	        fputs("'", f);
-		break;
-	    case '"':
-	        fputs(""", f);
-		break;
-	    case '<':
-	        fputs("<", f);
-		break;
-	    case '>':
-	        fputs(">", f);
-		break;
-	    case ' ':
-	    case '-':
-	    case '\t':
-	    case '\n':
-	    case ',':
-	    case '.':
-	    case ';':
-	    case ':':
-	    case '(':
-	    case ')':
-	    case '[':
-	    case ']':
-	    case '#':
-	    case '/':
-	        fputc(c, f);
-		break;
-	    default:
-	        fprintf(f, "&#%d;", c);
-		break;
-	    }
-	}
-    }
-}
-
-void xmlEscapeStringToFile(char *s, FILE *f)
-/* Write escaped zero-terminated string to file. */
-{
-int len = strlen(s);
-xmlEscapeBytesToFile((unsigned char *)s, len, f);
-}
diff --git a/gbtools/src/blatSrc/lib/xp.c b/gbtools/src/blatSrc/lib/xp.c
deleted file mode 100644
index 87e67fa..0000000
--- a/gbtools/src/blatSrc/lib/xp.c
+++ /dev/null
@@ -1,553 +0,0 @@
-/* xp - A minimal non-verifying xml parser.  It's
- * stream oriented much like expas.  It's a bit faster
- * and smaller than expas.  I'm not sure it handles unicode
- * as well.
- *
- * This file is copyright 2002-2005 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#include "common.h"
-#include "dystring.h"
-#include "errAbort.h"
-#include "hash.h"
-#include "xp.h"
-#include "xmlEscape.h"
-
-
-
-char xpNextBuf(struct xp *xp)
-/* Fetch a new buffer and return first char.  Return 0 at EOF. */
-{
-int size = xp->read(xp->userData, xp->inBuf, sizeof(xp->inBuf));
-if (size <= 0)
-    return 0;
-xp->inBufEnd = xp->inBuf + size;
-xp->in = xp->inBuf+1;
-return xp->inBuf[0];
-}
-
-#define xpGetChar(xp) \
-    (xp->in < xp->inBufEnd ? *xp->in++ : xpNextBuf(xp))
-/* Macro to quickly fetch next char. */
-
-#define xpUngetChar(xp) \
-    (--xp->in)
-/* Oops, don't fetch that after all. */
-
-struct xp *xpNew(void *userData, 
-   void (*atStartTag)(void *userData, char *name, char **atts),
-   void (*atEndTag)(void *userData, char *name, char *text),
-   int (*read)(void *userData, char *buf, int bufSize),
-   char *fileName)
-/* Form a new xp parser.  File name may be NULL - just used for
- * error reporting. */
-{
-struct xp *xp;
-AllocVar(xp);
-xp->stack = xp->stackBufEnd = xp->stackBuf + ArraySize(xp->stackBuf);
-xp->userData = userData;
-xp->atStartTag = atStartTag;
-xp->atEndTag = atEndTag;
-xp->read = read;
-xp->lineIx = 1;
-xp->endTag = newDyString(64);
-if (fileName)
-    xp->fileName = cloneString(fileName);
-else
-    xp->fileName = cloneString("XML");
-xp->inBufEnd = xp->in = xp->inBuf;		
-xp->symHash = xmlEscapeSymHash();
-return xp;
-}
-
-int xpReadFromFile(void *userData, char *buf, int bufSize)
-/* Read some text assuming a file was passed in as user data. */
-{
-FILE *f = userData;
-return fread(buf, 1, bufSize, f);
-}
-
-
-
-void xpFree(struct xp **pXp)
-/* Free up an xp parser. */
-{
-int i;
-struct xp *xp = *pXp;
-if (xp != NULL)
-    {
-    struct xpStack *stack;
-    for (stack = xp->stackBufEnd; --stack >= xp->stackBuf; )
-        {
-	if (stack->tag == NULL)
-	    break;
-	freeDyString(&stack->tag);
-	freeDyString(&stack->text);
-	}
-    for (i=0; i<ArraySize(xp->attDyBuf); ++i)
-        {
-	if (xp->attDyBuf[i] == NULL)
-	    break;
-	freeDyString(&xp->attDyBuf[i]);
-	}
-    freeDyString(&xp->endTag);
-    freeMem(xp->fileName);
-    hashFree(&xp->symHash);
-    freez(pXp);
-    }
-}
-
-int xpLineIx(struct xp *xp)
-/* Return current line number. */
-{
-return xp->lineIx;
-}
-
-char *xpFileName(struct xp *xp)
-/* Return current file name. */
-{
-return xp->fileName;
-}
-
-void xpError(struct xp *xp, char *format, ...)
-/* Output an error message with filename and line number included. */
-{
-va_list args;
-va_start(args, format);
-vaWarn(format, args);
-errAbort("line %d of %s", xpLineIx(xp), xpFileName(xp));
-va_end(args);
-}
-
-static void xpUnexpectedEof(struct xp *xp)
-/* Squawk and die about EOF. */
-{
-xpError(xp, "Unexpected end of file.");
-}
-
-static void xpEatComment(struct xp *xp, char commentC)
-/* Skip characters until comment end. */
-{
-int startLine = xp->lineIx;
-char lastC = 0;
-char c;
-for (;;)
-    {
-    if ((c = xpGetChar(xp)) == 0)
-        xpError(xp, "End of file in comment that started line %d", startLine);
-    if (c == '\n')
-        ++xp->lineIx;
-    if (c == '>')
-        {
-	if (lastC == commentC || commentC == '!')
-	break;
-	}
-    lastC = c;
-    }
-}
-
-static void xpLookup(struct xp *xp, struct dyString *temp, struct dyString *text)
-/* Parse after '&' until ';' and look up symbol.  Put result into text. */
-{
-char c;
-char *s;
-dyStringClear(temp);
-for (;;)
-    {
-    if ((c = xpGetChar(xp)) == 0)
-	xpError(xp, "End of file in after & and before ;");
-    if (isspace(c))
-        xpError(xp, "& without ;");
-    if (c == ';')
-        break;
-    dyStringAppendC(temp, c);
-    }
-s = temp->string;
-if (s[0] == '#')
-    {
-    c = atoi(s+1);
-    dyStringAppendC(text, c);
-    }
-else if ((s = hashFindVal(xp->symHash, s)) == NULL)
-    {
-    dyStringAppendC(text, '&');
-    dyStringAppend(text, temp->string);
-    dyStringAppendC(text, ';');
-    }
-else
-    {
-    dyStringAppend(text, s);
-    }
-}
-
-void xpForceMatch(struct xp *xp, char *matchString)
-/* Make sure that the next characters are match, and eat them. */
-{
-char *match = matchString, m;
-while ((m = *match++) != 0)
-    {
-    if (m != xpGetChar(xp))
-        xpError(xp, "Expecting %s", matchString);
-    }
-}
-
-void xpTextUntil(struct xp *xp, char *endPattern)
-/* Stuff xp->text with everything up to endPattern. */
-{
-int endSize = strlen(endPattern);
-int endPos = 0;
-char c;
-struct dyString *dy = xp->stack->text;
-for (;;)
-    {
-    if ((c = xpGetChar(xp)) == 0)
-	xpUnexpectedEof(xp);
-    if (c == endPattern[endPos])
-        {
-	endPos += 1;
-	if (endPos == endSize)
-	    return;
-	}
-    else
-        {
-	if (endPos > 0)
-	    dyStringAppendN(dy, endPattern, endPos);
-	dyStringAppendC(dy, c);
-	endPos = 0;
-	}
-    }
-}
-
-
-void xpParseStartTag(struct xp *xp, 
-	int maxAttCount,		  /* Maximum attribute count. */
-	struct dyString *retName, 	  /* Returns tag name */
-	int *retAttCount, 		  /* Returns attribute count. */
-	struct dyString **retAttributes,  /* Name, value, name, value... */
-	boolean *retClosed)	  /* If true then is self-closing (ends in />) */
-/* Call this after the first '<' in a tag has been read.  It'll
- * parse out until the '>' tag. */
-{
-char c, quotC;
-int attCount = 0;
-struct dyString *dy;
-int lineStart;
-
-dyStringClear(retName);
-
-/* Skip white space after '<' and before tag name. */
-for (;;)
-    {
-    if ((c = xpGetChar(xp)) == 0)
-	xpUnexpectedEof(xp);
-    if (isspace(c))
-        {
-	if (c == '\n')
-	    ++xp->lineIx;
-        }
-    else
-        break;
-    }
-
-/* Read in tag name. */
-for (;;)
-    {
-    dyStringAppendC(retName, c);
-    if ((c = xpGetChar(xp)) == 0)
-	xpUnexpectedEof(xp);
-    if (c == '>' || c == '/' || isspace(c))
-        break;
-    }
-if (c == '\n')
-    ++xp->lineIx;
-
-/* Parse attributes. */
-if (c != '>' && c != '/')
-    {
-    for (;;)
-	{
-	/* Skip leading white space. */
-	for (;;)
-	    {
-	    if ((c = xpGetChar(xp)) == 0)
-		xpUnexpectedEof(xp);
-	    if (isspace(c))
-		{
-		if (c == '\n')
-		    ++xp->lineIx;
-		}
-	    else
-		break;
-	    }
-	if (c == '>' || c == '/')
-	    break;
-
-	/* Allocate space in attribute table. */
-	if (attCount >= maxAttCount - 2)
-	    xpError(xp, "Attribute stack overflow");
-	dy = retAttributes[attCount];
-	if (dy == NULL)
-	    dy = retAttributes[attCount] = newDyString(64);
-	else
-	    dyStringClear(dy);
-	++attCount;
-
-	/* Read until not a label character. */
-	for (;;)
-	    {
-	    dyStringAppendC(dy, c);
-	    if ((c = xpGetChar(xp)) == 0)
-		xpUnexpectedEof(xp);
-	    if (isspace(c))
-		{
-		if (c == '\n')
-		    ++xp->lineIx;
-		break;
-		}
-	    if (c == '=')
-		break;
-	    if (c == '/' || c == '>')
-		xpError(xp, "Expecting '=' after attribute name");
-	    }
-
-	/* Skip white space until '=' */
-	if (c != '=')
-	    {
-	    for (;;)
-		{
-		if ((c = xpGetChar(xp)) == 0)
-		    xpUnexpectedEof(xp);
-		if (isspace(c))
-		    {
-		    if (c == '\n')
-			++xp->lineIx;
-		    }
-		else
-		    break;
-		}
-	    if (c != '=')
-		xpError(xp, "Expecting '=' after attribute name");
-	    }
-
-	/* Skip space until quote. */
-	for (;;)
-	    {
-	    if ((c = xpGetChar(xp)) == 0)
-		xpUnexpectedEof(xp);
-	    else if (isspace(c))
-		{
-		if (c == '\n')
-		    ++xp->lineIx;
-		}
-	    else
-		break;
-	    }
-	if (c != '\'' && c != '"')
-	    xpError(xp, "Expecting quoted string after =");
-
-	/* Allocate space in attribute table. */
-	if (attCount >= maxAttCount - 2)
-	    xpError(xp, "Attribute stack overflow");
-	dy = retAttributes[attCount];
-	if (dy == NULL)
-	    dy = retAttributes[attCount] = newDyString(64);
-	else
-	    dyStringClear(dy);
-	++attCount;
-
-	/* Read until next quote. */
-	quotC = c;
-	lineStart = xp->lineIx;
-	for (;;)
-	    {
-	    if ((c = xpGetChar(xp)) == 0)
-	       xpError(xp, "End of file inside literal string that started at line %d", lineStart);
-	    if (c == quotC)
-		break;
-	    if (c == '&')
-	       xpLookup(xp, xp->endTag, dy);
-	    else
-		{
-		if (c == '\n')
-		    ++xp->lineIx;
-		dyStringAppendC(dy, c);
-		}
-	    }
-	}
-    }
-if (c == '/')
-    {
-    *retClosed = TRUE;
-    c = xpGetChar(xp);
-    if (c != '>')
-        xpError(xp, "Expecting '>' after '/'");
-    }
-else
-    *retClosed = FALSE;
-*retAttCount = attCount;
-}
-
-void xpParseEndTag(struct xp *xp, char *tagName)
-/* Call this after have seen </.  It will parse through
- * > and make sure that the tagName matches. */
-{
-struct dyString *dy = xp->endTag;
-char c;
-
-dyStringClear(dy);
-
-/* Skip leading space. */
-for (;;)
-    {
-    if ((c = xpGetChar(xp)) == 0)
-	xpUnexpectedEof(xp);
-    if (isspace(c))
-	{
-	if (c == '\n')
-	    ++xp->lineIx;
-	}
-    else
-	break;
-    }
-
-/* Read end tag. */
-for (;;)
-    {
-    dyStringAppendC(dy, c);
-    if ((c = xpGetChar(xp)) == 0)
-	xpUnexpectedEof(xp);
-    if (isspace(c))
-	{
-	if (c == '\n')
-	    ++xp->lineIx;
-	break;
-	}
-    if (c == '>')
-	break;
-    }
-
-/* Skip until '>' */
-while (c != '>')
-    {
-    dyStringAppendC(dy, c);
-    if ((c = xpGetChar(xp)) == 0)
-	xpUnexpectedEof(xp);
-    if (isspace(c))
-	{
-	if (c == '\n')
-	    ++xp->lineIx;
-	}
-    else if (c != '>')
-	xpError(xp, "Unexpected characters past first word in /%s tag", dy->string);
-    }
-
-if (!sameString(dy->string, tagName))
-    xpError(xp, "Mismatch between start tag %s and end tag %s",  tagName, dy->string);
-}
-
-boolean xpParseNext(struct xp *xp, char *tag)
-/* Skip through file until get given tag.  Then parse out the
- * tag and all of it's children (calling atStartTag/atEndTag).
- * You can call this repeatedly to process all of a given tag
- * in file. */
-
-{
-char c;
-int i, attCount = 0;
-struct dyString *text = NULL;
-boolean isClosed;
-boolean inside = (tag == NULL);
-struct xpStack *initialStack = xp->stack;
-
-for (;;)
-    {
-    /* Load up text until next tag. */
-    for (;;)
-        {
-	if ((c = xpGetChar(xp)) == 0)
-	    return FALSE;
-	if (c == '<')
-	    break;
-	if (c == '&')
-	   xpLookup(xp, xp->endTag, text);
-	else 
-	    {
-	    if (c == '\n')
-		++xp->lineIx;
-	    if (text != NULL)
-		dyStringAppendC(text, c);
-	    }
-	}
-
-    /* Get next character to figure out what type of tag. */
-    c = xpGetChar(xp);
-    if (c == 0)
-       xpError(xp, "End of file inside tag");
-    else if (c == '?' || c == '!')
-        xpEatComment(xp, c);
-    else if (c == '/')  /* Closing tag. */
-        {
-	struct xpStack *stack = xp->stack;
-	if (stack >= xp->stackBufEnd)
-	    xpError(xp, "Extra end tag");
-	xpParseEndTag(xp, stack->tag->string);
-	if (inside)
-	    xp->atEndTag(xp->userData, stack->tag->string, stack->text->string);
-	xp->stack += 1;
-	if (xp->stack == initialStack)
-	    return TRUE;
-	}
-    else	/* Start tag. */
-        {
-	/* Push new frame on stack and check for overflow and unallocated strings. */
-	struct xpStack *stack = --xp->stack;
-	if (stack < xp->stackBuf)
-	    xpError(xp, "Stack overflow");
-	if (stack->tag == NULL)
-	    stack->tag = newDyString(32);
-	else
-	    dyStringClear(stack->tag);
-	if (stack->text == NULL)
-	    stack->text = newDyString(256);
-	else
-	    dyStringClear(stack->text);
-	text = stack->text;
-
-	/* Parse the start tag. */
-	xpUngetChar(xp);
-	xpParseStartTag(xp, ArraySize(xp->attDyBuf), stack->tag, 
-		&attCount, xp->attDyBuf, &isClosed);
-
-	if (!inside && sameString(stack->tag->string, tag))
-	    {
-	    inside = TRUE;
-	    initialStack = xp->stack + 1;
-	    }
-
-	/* Call user start function, and if closed tag, end function too. */
-	if (inside)
-	    {
-	    /* Unpack attributes into simple array of strings. */
-	    for (i=0; i<attCount; ++i)
-		xp->attBuf[i] = xp->attDyBuf[i]->string;
-	    xp->attBuf[attCount] = NULL;
-	    xp->atStartTag(xp->userData, stack->tag->string, xp->attBuf);
-	    }
-	if (isClosed)
-	    {
-	    if (inside)
-		xp->atEndTag(xp->userData, stack->tag->string, stack->text->string);
-	    xp->stack += 1;
-	    if (xp->stack == initialStack)
-		return TRUE;
-	    }
-	}
-    }
-}
-
-void xpParse(struct xp *xp)
-/* Parse from start tag to end tag.  Throw error if a problem. */
-{
-xpParseNext(xp, NULL);
-}
-
diff --git a/gbtools/src/blatSrc/lib/zlibFace.c b/gbtools/src/blatSrc/lib/zlibFace.c
deleted file mode 100644
index 0748a21..0000000
--- a/gbtools/src/blatSrc/lib/zlibFace.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Wrappers around zlib to make interfacing to it a bit easier. */
-
-/* Copyright (C) 2009 The Regents of the University of California 
- * See README in this or parent directory for licensing information. */
-
-#include "common.h"
-#include <zlib.h>
-
-static char *zlibErrorMessage(int err)
-/* Convert error code to errorMessage */
-{
-switch (err)
-    {
-    case Z_STREAM_END:
-        return "zlib stream end";
-    case Z_NEED_DICT:
-        return "zlib need dictionary";
-    case Z_ERRNO:
-        return "zlib errno";
-    case Z_STREAM_ERROR:
-        return "zlib data error";
-    case Z_DATA_ERROR:
-        return "zlib data error";
-    case Z_MEM_ERROR:
-        return "zlib mem error";
-    case Z_BUF_ERROR:
-        return "zlib buf error";
-    case Z_VERSION_ERROR:
-        return "zlib version error";
-    case Z_OK:
-        return NULL;
-    default:
-	{
-	static char msg[128];
-	safef(msg, sizeof(msg), "zlib error code %d", err);
-        return msg;
-	}
-    }
-}
-
-size_t zCompress(
-	void *uncompressed, 	/* Start of area to compress. */
-	size_t uncompressedSize,  /* Size of area to compress. */
-	void *compBuf,       /* Where to put compressed bits */
-	size_t compBufSize) /* Size of compressed bits - calculate using zCompBufSize */
-/* Compress data from memory to memory.  Returns size after compression. */
-{
-uLongf compSize = compBufSize;
-int err = compress((Bytef*)compBuf, &compSize, (Bytef*)uncompressed, (uLong)uncompressedSize);
-if (err != 0)
-    errAbort("Couldn't zCompress %lld bytes: %s", 
-    	(long long)uncompressedSize, zlibErrorMessage(err));
-return compSize;
-}
-
-size_t zCompBufSize(size_t uncompressedSize)
-/* Return size of buffer needed to compress something of given size uncompressed. */
-{
-return 1.001*uncompressedSize + 13;
-}
-
-size_t zUncompress(
-        void *compressed,	/* Compressed area */
-	size_t compressedSize,	/* Size after compression */
-	void *uncompBuf,	/* Where to put uncompressed bits */
-	size_t uncompBufSize)	/* Max size of uncompressed bits. */
-/* Uncompress data from memory to memory.  Returns size after decompression. */
-{
-uLongf uncSize = uncompBufSize;
-int err = uncompress(uncompBuf,  &uncSize, compressed, compressedSize);
-if (err != 0)
-    errAbort("Couldn't zUncompress %lld bytes: %s", 
-    	(long long)compressedSize, zlibErrorMessage(err));
-return uncSize;
-}
-
-void zSelfTest(int count)
-/* Run an internal diagnostic. */
-{
-bits32 testData[count];
-int uncSize = count*sizeof(bits32);
-int i;
-for (i=0; i<count; ++i)
-    testData[i] = i;
-int compBufSize = zCompBufSize(uncSize);
-char compBuf[compBufSize];
-int compSize = zCompress(testData, uncSize, compBuf, compBufSize);
-char uncBuf[uncSize];
-zUncompress(compBuf, compSize, uncBuf, uncSize);
-if (memcmp(uncBuf, testData, uncSize) != 0)
-    errAbort("zSelfTest %d failed", count);
-else
-    verbose(2, "zSelfTest %d passed, compression ratio %3.1f\n", count, (double)compSize/uncSize);
-}
diff --git a/gbtools/src/include/blatSrc/ace.h b/gbtools/src/include/blatSrc/ace.h
deleted file mode 100644
index 5b6c0f3..0000000
--- a/gbtools/src/include/blatSrc/ace.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* ace - a format written by phrap, read by consed.
- *
- * This file contains routines to read such files.
- * Note that though the coordinates are one based and
- * closed on disk, they get converted to our usual half
- * open zero based in memory.  */
-
-#ifndef ACE_H
-#define ACE_H
-
-#ifndef LINEFILE_H
-#include "linefile.h"
-#endif 
-
-#ifndef DNASEQ_H
-#include "dnaseq.h"
-#endif
-
-struct aceAS
-/* This contains an AS entry. */
-    {
-    int contigs;
-    int reads;
-    };
-
-struct aceCO
-/* This contains a CO entry. */
-    {
-    char *contigName;
-    int bases;
-    int reads;
-    struct dnaSeq *seq;
-    };
-
-struct aceAF
-/* This contains an AF entry. */
-    {
-    struct aceAF *next;
-    char *readName;
-    int startPos;
-    };
-
-struct aceRD
-/* This contains an RD entry. */
-    {
-    struct aceRD *next;
-    char *readName;
-    int bases;
-    struct dnaSeq *seq;
-    };
-
-struct ace
-/* This contains information about one ace element. */
-    {
-    struct ace *next;
-    struct aceAS aceAS;
-    struct aceCO aceCO;
-    struct aceAF *afList;
-    struct aceRD *rdList;
-    };
-
-void aceFree(struct ace **pEl);
-/* Free an ace. */
-
-void aceFreeList(struct ace **pList);
-/* Free a list of dynamically allocated ace's */
-
-struct ace *aceRead(struct lineFile *lf);
-/* Read in from .ace file and return it.
- * Returns NULL at EOF. */
-
-boolean aceCheck(struct ace *ace, struct lineFile *lf);
-/* Return FALSE if there's a problem with ace. */
-
-void aceWrite(struct ace *ace, FILE *f);
-/* Output ace to ace file. */
-
-#endif /* ACE_H */
-
diff --git a/gbtools/src/include/blatSrc/aliType.h b/gbtools/src/include/blatSrc/aliType.h
deleted file mode 100644
index 2a338f2..0000000
--- a/gbtools/src/include/blatSrc/aliType.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* aliType - some definitions for type of alignment. */
-
-#ifndef ALITYPE_H
-#define ALITYPE_H
-
-enum gfType
-/* Types of sequence genoFind deals with. */
-    {
-    gftDna = 0,		/* DNA (genomic) */
-    gftRna = 1,		/* RNA */
-    gftProt = 2,         /* Protein. */
-    gftDnaX = 3,		/* Genomic DNA translated to protein */
-    gftRnaX = 4,         /* RNA translated to protein */
-    };
-
-char *gfTypeName(enum gfType type);
-/* Return string representing type. */
-
-enum gfType gfTypeFromName(char *name);
-/* Return type from string. */
-
-enum ffStringency
-/* How tight of a match is required. */
-    {
-    ffExact = 0,	/* Only an exact match will do. */
-
-    ffCdna = 1,		/* Near exact.  Tolerate long gaps in target (genomic) */
-    ffTight = 2,        /* Near exact.  Not so tolerant of long gaps in target. */
-    ffLoose = 3,        /* Less exact. */
-    };
-
-#endif /* ALITYPE_H */
diff --git a/gbtools/src/include/blatSrc/annoAssembly.h b/gbtools/src/include/blatSrc/annoAssembly.h
deleted file mode 100644
index 3d89bff..0000000
--- a/gbtools/src/include/blatSrc/annoAssembly.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* annoAssembly -- basic metadata about an assembly for the annoGrator framework. */
-
-#ifndef ANNOASSEMBLY_H
-#define ANNOASSEMBLY_H
-
-#include "common.h"
-#include "hash.h"
-
-struct annoAssembly
-/* Basic information about a genome assembly. */
-    {
-    char *name;			// UCSC symbolic name for assembly, e.g. "hg19"
-    struct twoBitFile *tbf;	// Opened twoBit sequence file for assembly
-    char *twoBitPath;		// twoBit file name
-    struct hash *seqSizes;	// cache of sequence names to sizes (twoBitSeqSize does a seek&read)
-    struct dnaSeq *curSeq;	// cache of most recently accessed sequence (chrom/scaffold)
-    };
-
-struct annoAssembly *annoAssemblyNew(char *name, char *twoBitPath);
-/* Return an annoAssembly with open twoBitFile. */
-
-struct slName *annoAssemblySeqNames(struct annoAssembly *aa);
-/* Return a list of sequence names in this assembly. */
-
-uint annoAssemblySeqSize(struct annoAssembly *aa, char *seqName);
-/* Return the number of bases in seq which must be in aa's twoBitFile. */
-
-void annoAssemblyGetSeq(struct annoAssembly *aa, char *seqName, uint start, uint end,
-			char *buf, size_t bufSize);
-/* Copy sequence to buf; bufSize must be at least end-start+1 chars in length. */
-
-void annoAssemblyClose(struct annoAssembly **pAa);
-/* Close aa's twoBitFile and free mem. */
-
-#endif//ndef ANNOASSEMBLY_H
diff --git a/gbtools/src/include/blatSrc/annoFilter.h b/gbtools/src/include/blatSrc/annoFilter.h
deleted file mode 100644
index 9326865..0000000
--- a/gbtools/src/include/blatSrc/annoFilter.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* annoFilter -- autoSql-driven data filtering for annoGratorQuery framework */
-
-#ifndef ANNOFILTER_H
-#define ANNOFILTER_H
-
-#include "common.h"
-#include "asParse.h"
-
-enum annoFilterOp
-/* Types of filtering actions; most use a value defined elsewhere in annoFilter. */
-// NOTE: would be nice to have set ops, afInSet & afNotInSet
-    {
-    afNoFilter,		// Any column value passes filter
-    afMatch,		// Stringish column value must match given value(s)
-    afNotMatch,		// Stringish column value must not match given value(s)
-    afLT,		// Numeric column value is less than a given value
-    afLTE,		// Numeric column value is less than or equal to a given value
-    afEqual,		// Numeric column value equals a given value
-    afNotEqual,		// Numeric column value does not equal a given value
-    afGTE,		// Numeric column value is greater than or equal to a given value
-    afGT,		// Numeric column value is greater than a given value
-    afInRange,		// Numeric column value falls within fully-closed [given min, given max]
-    };
-
-union aNumber
-    {
-    long long anInt;
-    long double aDouble;
-    };
-
-struct annoFilter;  // circular definition
-
-typedef boolean AnnoFilterFunction(struct annoFilter *self, char **row, int rowSize);
-/* Custom filtering function that operates on plain row from data source.
- * Return TRUE if any filter fails (or passes, if self->isExclude). */
-
-struct annoFilter
-/* A filter on a row or specific column of data: operand and value(s). This info can tell the
- * UI what filtering options to offer and what their current values are; and it tells the
- * annoStreamer what filters to apply. */
-    {
-    struct annoFilter *next;
-    AnnoFilterFunction *filterFunc;  // If non-NULL, pass whole row to this function.
-    char *label;		// Option label for UI
-    int columnIx;		// If filterFunc is NULL, index of column in row
-    enum asTypes type;		// Data type (determines which filter operations are applicable)
-    enum annoFilterOp op;	// Action to be performed
-    void *values;		// Depending on op: name(s) to match, thresholds to compare, etc.
-    boolean isList;		// True if column contains a comma-separated list of values.
-    boolean isExclude;		// True if we are excluding items that pass, false if including.
-    boolean rightJoin;		// A la SQL: if this filter fails, discard primary row.
-    boolean hasMinMax;		// True if we know the allowable range for numeric thresholds
-				// so e.g. UI can enforce limits
-    union aNumber min;		// Lowest valid threshold value
-    union aNumber max;		// Highest valid threshold value
-    };
-
-struct annoFilter *annoFilterFromAsColumn(struct asObject *asObj, char *colName,
-					  enum annoFilterOp op, struct slName *valList);
-/* Look up description of colName in asObj and return an annoFilter
- * using values parsed from valList if applicable. */
-
-struct annoFilter *annoFilterFromFunction(AnnoFilterFunction *func, void *values);
-/* Return an annoFilter that calls func on each item, using values. */
-
-boolean annoFilterRowFails(struct annoFilter *filterList, char **row, int rowSize,
-			   boolean *retRightJoin);
-/* Apply filters to row, using autoSql column definitions to interpret
- * each word of row.  Return TRUE if any filter fails (or passes, if isExclude).
- * Set retRightJoin to TRUE if a rightJoin filter has failed. */
-
-boolean annoFilterWigValueFails(struct annoFilter *filterList, double value,
-				boolean *retRightJoin);
-/* Apply filters to value.  Return TRUE if any filter fails (or passes, if isExclude).
- * Set retRightJoin to TRUE if a rightJoin filter has failed. */
-
-enum annoFilterOp afOpFromString(char *string);
-/* Translate string (e.g. "afNotEqual") into enum value (e.g. afNotEqual). */
-
-char *stringFromAfOp(enum annoFilterOp op);
-/* Translate op into a string.  Do not free result. */
-
-#endif//ndef ANNOFILTER_H
diff --git a/gbtools/src/include/blatSrc/annoFormatTab.h b/gbtools/src/include/blatSrc/annoFormatTab.h
deleted file mode 100644
index 2cab5d4..0000000
--- a/gbtools/src/include/blatSrc/annoFormatTab.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* annoFormatTab -- collect fields from all inputs and print them out, tab-separated. */
-
-#ifndef ANNOFORMATTAB_H
-#define ANNOFORMATTAB_H
-
-#include "annoFormatter.h"
-
-struct annoFormatter *annoFormatTabNew(char *fileName);
-/* Return a formatter that will write its tab-separated output to fileName. */
-
-#endif//ndef ANNOFORMATTAB_H
diff --git a/gbtools/src/include/blatSrc/annoFormatter.h b/gbtools/src/include/blatSrc/annoFormatter.h
deleted file mode 100644
index 8f42713..0000000
--- a/gbtools/src/include/blatSrc/annoFormatter.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* annoFormatter -- aggregates, formats and writes output from multiple sources */
-
-#ifndef ANNOFORMATTER_H
-#define ANNOFORMATTER_H
-
-#include "annoOption.h"
-#include "annoStreamer.h"
-
-// The real work of aggregating and formatting data is left to
-// subclass implementations.  The purpose of this module is to provide
-// an interface for communication with other components of the
-// annoGratorQuery framework, and simple methods shared by all
-// subclasses.
-
-struct annoFormatter
-/* Generic interface to aggregate data fields from multiple sources and write
- * output. */
-    {
-    struct annoFormatter *next;
-
-    // Public methods
-    struct annoOption *(*getOptions)(struct annoFormatter *self);
-    void (*setOptions)(struct annoFormatter *self, struct annoOption *options);
-    /* Get and set output options */
-
-    void (*initialize)(struct annoFormatter *self, struct annoStreamer *primarySource,
-		       struct annoStreamer *integrators);
-    /* Initialize output (print header if applicable, etc). */
-
-    void (*comment)(struct annoFormatter *self, char *content);
-    /* Print a comment in whatever form is appropriate.  Content must not contain '\n'. */
-
-    void (*formatOne)(struct annoFormatter *self, struct annoStreamRows *primaryData,
-		      struct annoStreamRows gratorData[], int gratorCount);
-    /* Aggregate all sources' data for a single primary-source item into output. */
-
-    void (*close)(struct annoFormatter **pSelf);
-    /* End of input; finish output, close connection/handle and free self. */
-
-    // Private members -- callers are on the honor system to access these using only methods above.
-    struct annoOption *options;
-    struct annoGratorQuery *query;
-    };
-
-// ---------------------- annoFormatter default methods -----------------------
-
-struct annoOption *annoFormatterGetOptions(struct annoFormatter *self);
-/* Return supported options and current settings.  Callers can modify and free when done. */
-
-void annoFormatterSetOptions(struct annoFormatter *self, struct annoOption *newOptions);
-/* Free old options and use clone of newOptions. */
-
-void annoFormatterFree(struct annoFormatter **pSelf);
-/* Free self. This should be called at the end of subclass close methods, after
- * subclass-specific connections are closed and resources are freed. */
-
-#endif//ndef ANNOFORMATTER_H
diff --git a/gbtools/src/include/blatSrc/annoGrateWig.h b/gbtools/src/include/blatSrc/annoGrateWig.h
deleted file mode 100644
index 2131681..0000000
--- a/gbtools/src/include/blatSrc/annoGrateWig.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* annoGrateWig -- subclass of annoGrator for bigWig or wiggle data */
-
-#ifndef ANNOGRATEWIG_H
-#define ANNOGRATEWIG_H
-
-#include "annoGrator.h"
-
-struct annoGrator *annoGrateWigNew(struct annoStreamer *wigSource);
-/* Create an annoGrator subclass for source with rowType == arWig. */
-
-struct annoGrator *annoGrateBigWigNew(char *fileOrUrl, struct annoAssembly *aa);
-/* Create an annoGrator subclass for bigWig file or URL. */
-
-#endif//ndef ANNOGRATEWIG_H
diff --git a/gbtools/src/include/blatSrc/annoGrator.h b/gbtools/src/include/blatSrc/annoGrator.h
deleted file mode 100644
index a86b667..0000000
--- a/gbtools/src/include/blatSrc/annoGrator.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* annoGrator -- annoStreamer that integrates genomic annotations from two annoStreamers */
-
-// Subclasses of annoGrator can add new columns of output such as predicted function given
-// a variant and a gene; the base class simply intersects by position, returning
-// all rows from its internal data source that overlap the position of primaryRow.
-// The interface to an annoGrator is almost the same as the interface to an annoStreamer,
-// *except* you call integrate() instead of nextRow().
-
-#ifndef ANNOGRATOR_H
-#define ANNOGRATOR_H
-
-#include "annoStreamer.h"
-
-enum annoGratorOverlap
-/* How integrate() method handles overlap (or non-overlap) of internal rows with primary row */
-    {
-    agoNoConstraint,	// Default: overlap with primary row doesn't matter
-    agoMustOverlap,	// integrate() sets RJFilterFail if no internal rows overlap primary
-    agoMustNotOverlap   // integrate() sets RJFilterFail if any internal rows overlap primary
-    };
-
-struct annoGrator
-/* annoStreamer that can integrate an internal annoStreamer's data
- * with data from a primary source. */
-    {
-    struct annoStreamer streamer;	// external annoStreamer interface
-
-    // Public method that makes this a 'grator:
-    struct annoRow *(*integrate)(struct annoGrator *self, struct annoStreamRows *primaryData,
-				 boolean *retRJFilterFailed, struct lm *callerLm);
-    /* Integrate internal source's data with single row of primary source's data */
-
-    void (*setOverlapRule)(struct annoGrator *self, enum annoGratorOverlap rule);
-    /* Tell annoGrator how to handle overlap of its rows with primary row. */
-
-    // Private members -- callers are on the honor system to access these using only methods above.
-    struct annoStreamer *mySource;	// internal source
-    struct annoRow *qHead;		// head of FIFO queue of rows from internal source
-    struct annoRow *qTail;		// head of FIFO queue of rows from internal source
-    struct lm *qLm;			// localmem for FIFO queue
-    int qSkippedCount;			// Number of qLm-allocated rows skipped
-    char *prevPChrom;			// for detection of unsorted input from primary
-    uint prevPStart;			// for detection of unsorted input from primary
-    boolean eof;			// stop asking internal source for rows when it's done
-    boolean haveRJIncludeFilter;	// TRUE if some filter has !isExclude && rightJoin
-    enum annoGratorOverlap overlapRule;	// constraint (if any) on overlap of internal & primary
-    };
-
-#endif//ndef ANNOGRATOR_H
-
-// ---------------------- annoGrator default methods -----------------------
-
-struct annoRow *annoGratorIntegrate(struct annoGrator *self, struct annoStreamRows *primaryData,
-				    boolean *retRJFilterFailed, struct lm *callerLm);
-/* Given a single row from the primary source, get all overlapping rows from internal
- * source, and produce joined output rows.  Use callerLm to allocate the output rows.
- * If retRJFilterFailed is non-NULL:
- * - any overlapping row has a rightJoin filter failure (see annoFilter.h), or
- * - overlap rule is agoMustOverlap and no rows overlap, or
- * - overlap rule is agoMustNotOverlap and any overlapping row is found,
- * then set retRJFilterFailed and stop. */
-
-void annoGratorInit(struct annoGrator *self, struct annoStreamer *mySource);
-/* Initialize an integrator of columns from mySource with (positions of)
- * rows passed to integrate().
- * mySource becomes property of the annoGrator. */
-
-struct annoGrator *annoGratorNew(struct annoStreamer *mySource);
-/* Make a new integrator of columns from mySource with (positions of) rows passed to integrate().
- * mySource becomes property of the new annoGrator. */
-
-void annoGratorClose(struct annoStreamer **pSelf);
-/* Free self (including mySource). */
diff --git a/gbtools/src/include/blatSrc/annoGratorQuery.h b/gbtools/src/include/blatSrc/annoGratorQuery.h
deleted file mode 100644
index fcdbb0f..0000000
--- a/gbtools/src/include/blatSrc/annoGratorQuery.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* annoGratorQuery -- framework for integrating genomic annotations from many sources */
-
-#ifndef ANNOGRATORQUERY_H
-#define ANNOGRATORQUERY_H
-
-#include "annoFormatter.h"
-#include "annoGrator.h"
-
-struct annoGratorQuery;
-/* Representation of a complex query: multiple sources, each with its own filters,
- * output data and means of integration, aggregated and output by a formatter. */
-
-struct annoGratorQuery *annoGratorQueryNew(struct annoAssembly *assembly,
-					   struct annoStreamer *primarySource,
-					   struct annoGrator *integrators,
-					   struct annoFormatter *formatters);
-/* Create an annoGratorQuery from all of its components.
- * integrators may be NULL.  All other inputs must be non-NULL. */
-
-void annoGratorQuerySetRegion(struct annoGratorQuery *query, char *chrom, uint rStart, uint rEnd);
-/* Set genomic region for query; if chrom is NULL, position is whole genome. */
-
-void annoGratorQueryExecute(struct annoGratorQuery *query);
-/* For each annoRow from query->primarySource, invoke integrators and
- * pass their annoRows to formatters. */
-
-void annoGratorQueryFree(struct annoGratorQuery **pQuery);
-/* Close and free all inputs and outputs; free self. */
-
-#endif//ndef ANNOGRATORQUERY_H
diff --git a/gbtools/src/include/blatSrc/annoOption.h b/gbtools/src/include/blatSrc/annoOption.h
deleted file mode 100644
index 0fc7ca9..0000000
--- a/gbtools/src/include/blatSrc/annoOption.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* annoOption -- optionSpec-style param plus its value */
-
-#ifndef ANNOOPTION_H
-#define ANNOOPTION_H
-
-#include "options.h"
-
-struct annoOption
-/* A named and typed option and its value. */
-    {
-    struct annoOption *next;
-    struct optionSpec spec;
-    void *value;
-    };
-
-struct annoOption *annoOptionCloneList(struct annoOption *list);
-/* Return a newly allocated copy of list. */
-
-void annoOptionFreeList(struct annoOption **pList);
-/* Free the same things that we clone above. */
-
-#endif//ndef ANNOOPTION_H
diff --git a/gbtools/src/include/blatSrc/annoRow.h b/gbtools/src/include/blatSrc/annoRow.h
deleted file mode 100644
index 9c94b1f..0000000
--- a/gbtools/src/include/blatSrc/annoRow.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* annoRow -- basic data interchange unit of annoGratorQuery framework. */
-
-#ifndef ANNOROW_H
-#define ANNOROW_H
-
-#include "common.h"
-#include "localmem.h"
-
-enum annoRowType { arUnknown, arWords, arWig };
-
-struct annoRow
-/* Representation of a row from a database table or file.  The chrom, start and end
- * facilitate intersection by position.  If type is arWords, then data is an array
- * of strings corresponding to columns in the autoSql definition provided by the
- * source of the annoRow.  If type is arWig, then data is an array of floats.
- * rightJoinFail is true if this row failed a filter marked as rightJoin, meaning it
- * can knock out the primary row (see annoFilter.h). */
-    {
-    struct annoRow *next;
-    char *chrom;
-    uint start;
-    uint end;
-    void *data;
-    boolean rightJoinFail;
-    };
-
-struct annoRow *annoRowFromStringArray(char *chrom, uint start, uint end, boolean rightJoinFail,
-				       char **wordsIn, int numCols, struct lm *lm);
-/* Allocate & return an annoRow with data cloned from wordsIn. */
-
-struct annoRow *annoRowWigNew(char *chrom, uint start, uint end, boolean rightJoinFail,
-			      float *values, struct lm *lm);
-/* Allocate & return an annoRowWig, with clone of values; length of values is (end-start). */
-
-struct annoRow *annoRowClone(struct annoRow *rowIn, enum annoRowType rowType, int numCols,
-			     struct lm *lm);
-/* Allocate & return a single annoRow cloned from rowIn.  If rowIn is NULL, return NULL.
- * If type is arWig, numCols is ignored. */
-
-int annoRowCmp(const void *va, const void *vb);
-/* Compare two annoRows' {chrom, start, end}. */
-
-#endif//ndef ANNOROW_H
diff --git a/gbtools/src/include/blatSrc/annoStreamBigBed.h b/gbtools/src/include/blatSrc/annoStreamBigBed.h
deleted file mode 100644
index b57284b..0000000
--- a/gbtools/src/include/blatSrc/annoStreamBigBed.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* annoStreamBigBed -- subclass of annoStreamer for bigBed file or URL */
-
-#ifndef ANNOSTREAMBIGBED_H
-#define ANNOSTREAMBIGBED_H
-
-#include "annoStreamer.h"
-
-struct annoStreamer *annoStreamBigBedNew(char *fileOrUrl, struct annoAssembly *aa, int maxItems);
-/* Create an annoStreamer (subclass) object from a file or URL; if
- * maxItems is 0, all items from a query will be returned, otherwise
- * output is limited to maxItems. */
-
-#endif//ndef ANNOSTREAMBIGBED_H
diff --git a/gbtools/src/include/blatSrc/annoStreamBigWig.h b/gbtools/src/include/blatSrc/annoStreamBigWig.h
deleted file mode 100644
index fdb7218..0000000
--- a/gbtools/src/include/blatSrc/annoStreamBigWig.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* annoStreamBigWig -- subclass of annoStreamer for bigWig file or URL */
-
-#ifndef ANNOSTREAMBIGWIG_H
-#define ANNOSTREAMBIGWIG_H
-
-#include "annoStreamer.h"
-
-struct annoStreamer *annoStreamBigWigNew(char *fileOrUrl, struct annoAssembly *aa);
-/* Create an annoStreamer (subclass) object from a file or URL. */
-
-#endif//ndef ANNOSTREAMBIGWIG_H
diff --git a/gbtools/src/include/blatSrc/annoStreamTab.h b/gbtools/src/include/blatSrc/annoStreamTab.h
deleted file mode 100644
index e9cb92f..0000000
--- a/gbtools/src/include/blatSrc/annoStreamTab.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* annoStreamTab -- subclass of annoStreamer for tab-separated text files/URLs */
-
-#ifndef ANNOSTREAMTAB_H
-#define ANNOSTREAMTAB_H
-
-#include "annoStreamer.h"
-
-struct annoStreamer *annoStreamTabNew(char *fileOrUrl, struct annoAssembly *aa,
-				      struct asObject *asObj);
-/* Create an annoStreamer (subclass) object from a tab-separated text file/URL
- * whose columns are described by asObj (possibly excepting bin column at beginning). */
-
-#endif//ndef ANNOSTREAMTAB_H
diff --git a/gbtools/src/include/blatSrc/annoStreamVcf.h b/gbtools/src/include/blatSrc/annoStreamVcf.h
deleted file mode 100644
index f45c550..0000000
--- a/gbtools/src/include/blatSrc/annoStreamVcf.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* annoStreamVcf -- subclass of annoStreamer for VCF files */
-
-#ifndef ANNOSTREAMVCF_H
-#define ANNOSTREAMVCF_H
-
-#include "annoStreamer.h"
-
-struct annoStreamer *annoStreamVcfNew(char *fileOrUrl, boolean isTabix, struct annoAssembly *aa,
-				      int maxRecords);
-/* Create an annoStreamer (subclass) object from a VCF file, which may
- * or may not have been compressed and indexed by tabix. */
-
-#endif//ndef ANNOSTREAMVCF_H
diff --git a/gbtools/src/include/blatSrc/annoStreamer.h b/gbtools/src/include/blatSrc/annoStreamer.h
deleted file mode 100644
index d6ba052..0000000
--- a/gbtools/src/include/blatSrc/annoStreamer.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* annoStreamer -- returns items sorted by genomic position to successive nextRow calls */
-
-#ifndef ANNOSTREAMER_H
-#define ANNOSTREAMER_H
-
-#include "annoAssembly.h"
-#include "annoFilter.h"
-#include "annoRow.h"
-
-// The real work of fetching and filtering data is left to subclass
-// implementations.  The purpose of this module is to provide an
-// interface for communication with other components of the
-// annoGratorQuery framework, and simple methods shared by all
-// subclasses.
-
-struct annoStreamer
-/* Generic interface to configure a data source's filters and output data, and then
- * retrieve data, which must be sorted by genomic position.  Subclasses of this
- * will do all the actual work. */
-    {
-    struct annoStreamer *next;
-
-    // Public methods
-    struct asObject *(*getAutoSqlObject)(struct annoStreamer *self);
-    void (*setAutoSqlObject)(struct annoStreamer *self, struct asObject *asObj);
-    /* Get and set autoSql representation (do not modify or free asObj!) */
-
-    void (*setRegion)(struct annoStreamer *self, char *chrom, uint rStart, uint rEnd);
-    /* Set genomic region for query; if chrom is NULL, region is whole genome.
-     * This must be called on all annoGrator components in query, not a subset. */
-
-    char *(*getHeader)(struct annoStreamer *self);
-    /* Get the file header as a string (possibly NULL, possibly multi-line). */
-
-    void (*setFilters)(struct annoStreamer *self, struct annoFilter *newFilters);
-    void (*addFilters)(struct annoStreamer *self, struct annoFilter *newFilters);
-    /* Set/add filters. Memory management of filters is up to caller. */
-
-    struct annoRow *(*nextRow)(struct annoStreamer *self, char *minChrom, uint minEnd,
-			       struct lm *lm);
-    /* Get the next item from this source.  If minChrom is non-NULL, optionally use
-     * that as a hint to skip items that precede {minChrom, minEnd}.
-     * Use localmem lm to store returned annoRow. */
-
-    void (*close)(struct annoStreamer **pSelf);
-    /* Close connection to source and free self. */
-
-    // Public members -- callers are on the honor system to access these read-only.
-    struct annoAssembly *assembly;	// Genome assembly that provides coords for annotations
-    struct asObject *asObj;		// Annotation data definition
-    char *name;				// Short identifier, e.g. name of file or database table
-    struct annoFilter *filters;		// Filters to constrain output
-    char *chrom;			// Non-NULL if querying a particular region
-    uint regionStart;			// If chrom is non-NULL, region start coord
-    uint regionEnd;			// If chrom is non-NULL, region end coord
-    boolean positionIsGenome;		// True if doing a whole-genome query
-    enum annoRowType rowType;		// Type of annotations (words or wiggle data)
-    int numCols;			// For word-based annotations, number of words/columns
-    };
-
-struct annoStreamRows
-/* An annoStreamer and (possibly NULL) list of rows it generated. */
-    {
-    struct annoStreamer *streamer;	// annoStreamer interface for metadata about row data
-    struct annoRow *rowList;		// row data
-    };
-
-// ---------------------- annoStreamer default methods -----------------------
-
-struct asObject *annoStreamerGetAutoSqlObject(struct annoStreamer *self);
-/* Return parsed autoSql definition of this streamer's data type. */
-
-void annoStreamerSetAutoSqlObject(struct annoStreamer *self, struct asObject *asObj);
-/* Use new asObj and update internal state derived from asObj. */
-
-void annoStreamerSetRegion(struct annoStreamer *self, char *chrom, uint rStart, uint rEnd);
-/* Set genomic region for query; if chrom is NULL, position is genome.
- * Many subclasses should make their own setRegion method that calls this and
- * configures their data connection to change to the new position. */
-
-void annoStreamerSetFilters(struct annoStreamer *self, struct annoFilter *newFilters);
-/* Replace any existing filters with newFilters.  It is up to calling code to
- * free old filters and allocate newFilters. */
-
-void annoStreamerAddFilters(struct annoStreamer *self, struct annoFilter *newFilters);
-/* Add newFilter(s).  It is up to calling code to allocate newFilters. */
-
-void annoStreamerInit(struct annoStreamer *self, struct annoAssembly *assembly,
-		      struct asObject *asObj, char *name);
-/* Initialize a newly allocated annoStreamer with default annoStreamer methods and
- * default filters and columns based on asObj.
- * In general, subclasses' constructors will call this first; override nextRow, close,
- * and probably setRegion; and then initialize their private data. */
-
-void annoStreamerFree(struct annoStreamer **pSelf);
-/* Free self. This should be called at the end of subclass close methods, after
- * subclass-specific connections are closed and resources are freed. */
-
-boolean annoStreamerFindBed3Columns(struct annoStreamer *self,
-			    int *retChromIx, int *retStartIx, int *retEndIx,
-			    char **retChromField, char **retStartField, char **retEndField);
-/* Scan autoSql for recognized column names corresponding to BED3 columns.
- * Set ret*Ix to list index of each column if found, or -1 if not found.
- * Set ret*Field to column name if found, or NULL if not found.
- * If all three are found, return TRUE; otherwise return FALSE. */
-
-// -----------------------------------------------------------------------------
-
-struct annoStreamRows *annoStreamRowsNew(struct annoStreamer *streamerList);
-/* Returns an array of aSR, one for each streamer in streamerList.
- * Typically array is reused by overwriting elements' rowList pointers.
- * Free array when done. */
-
-#endif//ndef ANNOSTREAMER_H
diff --git a/gbtools/src/include/blatSrc/apacheLog.h b/gbtools/src/include/blatSrc/apacheLog.h
deleted file mode 100644
index df53afd..0000000
--- a/gbtools/src/include/blatSrc/apacheLog.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* apacheLog - stuff to parse out apache web server logs, currently
- * just the access log. */
-
-#ifndef APACHELOG_H
-#define APACHELOG_H
-
-struct apacheAccessLog
-/* Parsed out apache access log line */
-    {
-    struct apacheAccessLog *next;
-    char *buf;		/* All memory for apacheAccessLog fields is allocated at once here. */
-    char *ip;		/* IP Address: dotted quad of numbers, or xxx.com. */
-    char *dash1;	/* Unknown, usually a dash */
-    char *dash2;	/* Unknown, usually a dash */
-    char *timeStamp;	/* Time stamp like 23/Nov/2003:04:21:08 */
-    char *timeZone;	/* Extra number after timeStamp, usually -0800 */
-    char *method;	/* GET/POST etc. */
-    char *url;		/* Requested URL */
-    char *httpVersion;  /* Something like HTTP/1.1 */
-    int status;		/* Status code - 200 is good! */
-    char *num1;		/* Some number, I'm not sure what it is. */
-    char *referrer;	/* Referring URL, may be NULL. */
-    char *program;	/* Requesting program,  often Mozilla 4.0 */
-    time_t tick;	/* Unix tick (seconds since 1970) - derived from timeStamp. */
-    int runTime;	/* Overall time (optional) in milliseconds */
-    };
-
-struct apacheAccessLog *apacheAccessLogParse(char *line, 
-	char *fileName, int lineIx);
-/* Return a apacheAccessLog from line.  Return NULL if there's a parsing 
- * problem, but don't abort. */
-
-void apacheAccessLogFree(struct apacheAccessLog **pLl);
-/* Free up apacheAccessLog. */
-
-time_t apacheAccessLogTimeToTick(char *timeStamp);
-/* Convert something like 27/Aug/2009:09:25:32 to Unix timestamp (seconds since 1970).
- * On error returns zero. */
-
-int apacheAccessLogCmpTick(const void *va, const void *vb);
-/* Compare items to sort by tick (which tracks timestamp) */
-
-#endif /* APACHELOG_H */
diff --git a/gbtools/src/include/blatSrc/asParse.h b/gbtools/src/include/blatSrc/asParse.h
deleted file mode 100644
index 140de20..0000000
--- a/gbtools/src/include/blatSrc/asParse.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* asParse - parse out an autoSql .as file. */
-
-#ifndef ASPARSE_H
-#define ASPARSE_H
-
-enum asTypes
-/* Different low level types (not including lists and objects) */
-   {
-   t_double,   /* double precision floating point. */
-   t_float,    /* single precision floating point. */
-   t_char,     /* character or fixed size character array. */
-   t_int,      /* signed 32 bit integer */
-   t_uint,     /* unsigned 32 bit integer */
-   t_short,    /* signed 16 bit integer */
-   t_ushort,   /* unsigned 16 bit integer */
-   t_byte,     /* signed 8 bit integer */
-   t_ubyte,    /* unsigned 8 bit integer */
-   t_off,      /* 64 bit integer. */
-   t_string,   /* varchar/char * (variable size string up to 255 chars)  */
-   t_lstring,     /* variable sized large string. */
-   t_object,   /* composite object - object/table - forms lists. */
-   t_simple,   /* simple composite object - forms arrays. */
-   t_enum,     /* enumerated symbolic values */
-   t_set,      /* set of symbolic values */
-   };
-
-char *asTypesIntSizeDescription(enum asTypes type);
-/* Return description of integer size.  Do not free. */
-
-int asTypesIntSize(enum asTypes type);
-/* Return size in bytes of any integer type - short, long, unsigned, etc. */
-
-boolean asTypesIsUnsigned(enum asTypes type);
-/* Return TRUE if it's any integer type - short, long, unsigned, etc. */
-
-boolean asTypesIsInt(enum asTypes type);
-/* Return TRUE if it's any integer type - short, long, unsigned, etc. */
-
-boolean asTypesIsFloating(enum asTypes type);
-/* Return TRUE if it's any floating point type - float or double. */
-
-struct asTypeInfo
-    {
-    enum asTypes type;		   /* Numeric ID of low level type. */
-    char *name;                    /* Text ID of low level type. */
-    bool isUnsigned;               /* True if an unsigned int of some type. */
-    bool stringy;                  /* True if a string or blob. */
-    char *sqlName;                 /* SQL type name. */
-    char *cName;                   /* C type name. */
-    char *listyName;               /* What functions that load a list are called. */
-    char *nummyName;               /* What functions that load a number are called. */
-    char *outFormat;		   /* Output format for printf. %d, %u, etc. */
-    char *djangoName;              /* Django type name */
-    };
-
-struct asTypeInfo *asTypeFindLow(char *name);
-/* Return asType for a low level type of given name.  (Low level because may be decorated 
- * with array or pointer  stuff at a higher level).  Returns NULL if not found. */
-
-struct asIndex
-/* Information about an index */
-    {
-    struct asIndex *next;   /* In case it needs to be on a list. */
-    char *type;	/* 'primary' 'index' or 'uniq' to pass to SQL */
-    int size;	/* If nonzero only index prefix of this many chars. */
-    };
-
-struct asColumn
-/* Info on one column/field */
-    {
-    struct asColumn *next;           /* Next column. */
-    char *name;                    /* Column name. */
-    char *comment;		   /* Comment string on column. */
-    struct asTypeInfo *lowType;   /* Root type info. */
-    char *obName;                  /* Name of object or table. */
-    struct asObject *obType;       /* Name of composite object. */
-    int fixedSize;		   /* 0 if not fixed size, otherwise size of list. */
-    char *linkedSizeName;          /* Points to variable that holds size of list. */
-    struct asColumn *linkedSize;     /* Column for linked size. */
-    bool isSizeLink;               /* Flag to tell if have read link. */
-    bool isList;                   /* TRUE if a list. */
-    bool isArray;                  /* TRUE if an array. */
-    bool autoIncrement;		   /* TRUE if we want to auto_increment this field. */
-    struct slName *values;         /* values for symbolic types */
-    struct asIndex *index;	   /* Possibly null index description. */
-    };
-
-struct asObject
-/* Info on whole asObject. */
-    {
-    struct asObject *next;
-    char *name;			/* Name of object. */
-    char *comment;		/* Comment describing object. */
-    struct asColumn *columnList;  /* List of columns. */
-    bool isTable;	        /* True if a table. */
-    bool isSimple;	        /* True if a simple object. */
-    };
-
-struct dyString *asColumnToSqlType(struct asColumn *col);
-/* Convert column to a sql type spec in returned dyString */
-
-char *asTypeNameFromSqlType(char *sqlType);
-/* Return the autoSql type name (not enum) for the given SQL type, or NULL.
- * Don't attempt to free result. */
-
-struct asObject *asParseFile(char *fileName);
-/* Parse autoSql .as file. */
-
-struct asObject *asParseText(char *text);
-/* Parse autoSql from text (as opposed to file). */
-
-void asObjectFree(struct asObject **as);
-/* free a single asObject */
-
-void asObjectFreeList(struct asObject **as);
-/* free a list of asObject */
-
-void asColumnFree(struct asColumn **as);
-/* free a single asColumn */
-
-void asColumnFreeList(struct asColumn **as);
-/* free a list of asColumn */
-
-struct asColumn *asColumnFind(struct asObject *as, char *name);
-/* Return column of given name from object, or NULL if not found. */
-
-int asColumnFindIx(struct asColumn *list, char *name);
-/* Return index of first element of asColumn list that matches name.
- * Return -1 if not found. */
-
-boolean asCompareObjs(char *name1, struct asObject *as1, char *name2, struct asObject *as2, int numColumnsToCheck,
- int *retNumColumnsSame, boolean abortOnDifference);
-/* Compare as-objects as1 and as2 making sure several important fields show they are the same name and type.
- * If difference found, print it to stderr.  If abortOnDifference, errAbort.
- * Othewise, return TRUE if the objects columns match through the first numColumnsToCheck fields. 
- * If retNumColumnsSame is not NULL, then it will be set to the number of contiguous matching columns. */
-
-INLINE boolean asObjectsMatch(struct asObject *as1, struct asObject *as2)
-{
-int colCount = slCount(as1->columnList);
-if (slCount(as2->columnList) != colCount)
-    return FALSE;
-return asCompareObjs(as1->name, as1, as2->name, as2, colCount, NULL, FALSE);
-}
-
-boolean asColumnNamesMatchFirstN(struct asObject *as1, struct asObject *as2, int n);
-/* Compare only the column names of as1 and as2, not types because if an asObj has been
- * created from sql type info, longblobs are cast to lstrings but in the proper autoSql
- * might be lists instead (e.g. longblob in sql, uint exonStarts[exonCount] in autoSql. */
-
-#endif /* ASPARSE_H */
diff --git a/gbtools/src/include/blatSrc/axt.h b/gbtools/src/include/blatSrc/axt.h
deleted file mode 100644
index 5ab86d1..0000000
--- a/gbtools/src/include/blatSrc/axt.h
+++ /dev/null
@@ -1,272 +0,0 @@
-/* AXT - A simple alignment format with four lines per
- * alignment.  The first specifies the names of the
- * two sequences that align and the position of the
- * alignment, as well as the strand.  The next two
- * lines contain the alignment itself including dashes
- * for inserts.  The alignment is separated from the
- * next alignment with a blank line. 
- *
- * This file contains routines to read such alignments.
- * Note that though the coordinates are one based and
- * closed on disk, they get converted to our usual half
- * open zero based in memory. 
- *
- * This also contains code for simple DNA alignment scoring
- * schemes. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef AXT_H
-#define AXT_H
-
-#ifndef LINEFILE_H
-#include "linefile.h"
-#endif 
-
-#ifndef DNASEQ_H
-#include "dnaseq.h"
-#endif
-
-#ifndef CHAIN_H
-#include "chain.h"
-#endif
-
-struct axt
-/* This contains information about one xeno alignment. */
-    {
-    struct axt *next;
-    char *qName;		/* Name of query sequence. */
-    int qStart, qEnd;		/* Half open zero=based coordinates. */
-    char qStrand;		/* Is this forward or reverse strand + or - */
-    char *tName;		/* Name of target. */
-    int tStart, tEnd;		/* Target coordinates. */
-    char tStrand;               /* Target strand - currently always +. */
-    int score;	                /* Score.  Zero for unknown.  Units arbitrary. */
-    int symCount;               /* Size of alignments. */
-    char *qSym, *tSym;          /* Alignments. */
-    int frame;			/* If non-zero then translation frame. */
-    };
-
-void axtFree(struct axt **pEl);
-/* Free an axt. */
-
-void axtFreeList(struct axt **pList);
-/* Free a list of dynamically allocated axt's */
-
-struct axt *axtRead(struct lineFile *lf);
-/* Read in next record from .axt file and return it.
- * Returns NULL at EOF. */
-
-struct axt *axtReadWithPos(struct lineFile *lf, off_t *retOffset);
-/* Read next axt, and if retOffset is not-NULL, fill it with
- * offset of start of axt. */
-
-boolean axtCheck(struct axt *axt, struct lineFile *lf);
-/* Return FALSE if there's a problem with axt. */
-
-void axtWrite(struct axt *axt, FILE *f);
-/* Output axt to axt file. */
-
-int axtCmpQuery(const void *va, const void *vb);
-/* Compare to sort based on query position. */
-
-int axtCmpTarget(const void *va, const void *vb);
-/* Compare to sort based on target position. */
-
-int axtCmpScore(const void *va, const void *vb);
-/* Compare to sort based on score. */
-
-int axtCmpTargetScoreDesc(const void *va, const void *vb);
-/* Compare to sort based on target name and score descending. */
-
-struct axtScoreScheme
-/* A scoring scheme or DNA alignment. */
-    {
-    struct scoreMatrix *next;
-    int matrix[256][256];   /* Look up with letters. */
-    int gapOpen;	/* Gap open cost. */
-    int gapExtend;	/* Gap extension. */
-    char *extra;        /* extra parameters */
-    };
-
-void axtScoreSchemeFree(struct axtScoreScheme **pObj);
-/* Free up score scheme. */
-
-struct axtScoreScheme *axtScoreSchemeDefault();
-/* Return default scoring scheme (after blastz).  Do NOT axtScoreSchemeFree
- * this. */
-
-struct axtScoreScheme *axtScoreSchemeSimpleDna(int match, int misMatch, int gapOpen, int gapExtend);
-/* Return a relatively simple scoring scheme for DNA. */
-
-struct axtScoreScheme *axtScoreSchemeRnaDefault();
-/* Return default scoring scheme for RNA/DNA alignments
- * within the same species.  Do NOT axtScoreSchemeFree
- * this. */
-
-struct axtScoreScheme *axtScoreSchemeFromBlastzMatrix(char *text, int gapOpen, int gapExtend);
-/* return scoring schema from a string in the following format */
-/* 91,-90,-25,-100,-90,100,-100,-25,-25,-100,100,-90,-100,-25,-90,91 */
-
-struct axtScoreScheme *axtScoreSchemeRnaFill();
-/* Return scoreing scheme a little more relaxed than 
- * RNA/DNA defaults for filling in gaps. */
-
-struct axtScoreScheme *axtScoreSchemeProteinDefault();
-/* Returns default protein scoring scheme.  This is
- * scaled to be compatible with the blastz one.  Don't
- * axtScoreSchemeFree this. */
-
-struct axtScoreScheme *axtScoreSchemeProteinRead(char *fileName);
-/* read in blosum-like matrix */
-
-struct axtScoreScheme *axtScoreSchemeRead(char *fileName);
-/* Read in scoring scheme from file. Looks like
-    A    C    G    T
-    91 -114  -31 -123
-    -114  100 -125  -31
-    -31 -125  100 -114
-    -123  -31 -114   91
-    O = 400, E = 30
- * axtScoreSchemeFree this when done. */
-
-struct axtScoreScheme *axtScoreSchemeReadLf(struct lineFile *lf );
-/* Read in scoring scheme from file. Looks like
-    A    C    G    T
-    91 -114  -31 -123
-    -114  100 -125  -31
-    -31 -125  100 -114
-    -123  -31 -114   91
-    O = 400, E = 30
- * axtScoreSchemeFree this when done. */
-
-void axtScoreSchemeDnaWrite(struct axtScoreScheme *ss, FILE *f, char *name);
-/* output the score dna based score matrix in meta Data format to File f,
-name should be set to the name of the program that is using the matrix */
-
-int axtScoreSym(struct axtScoreScheme *ss, int symCount, char *qSym, char *tSym);
-/* Return score without setting up an axt structure. */
-
-int axtScore(struct axt *axt, struct axtScoreScheme *ss);
-/* Return calculated score of axt. */
-
-int axtScoreFilterRepeats(struct axt *axt, struct axtScoreScheme *ss);
-/* Return calculated score of axt. do not score gaps if they are repeat masked*/
-
-int axtScoreUngapped(struct axtScoreScheme *ss, char *q, char *t, int size);
-/* Score ungapped alignment. */
-
-int axtScoreDnaDefault(struct axt *axt);
-/* Score DNA-based axt using default scheme. */
-
-int axtScoreProteinDefault(struct axt *axt);
-/* Score protein-based axt using default scheme. */
-
-boolean axtGetSubsetOnT(struct axt *axt, struct axt *axtOut,
-			int newStart, int newEnd, struct axtScoreScheme *ss,
-			boolean includeEdgeGaps);
-/* Return FALSE if axt is not in the new range.  Otherwise, set axtOut to
- * a subset that goes from newStart to newEnd in target coordinates. 
- * If includeEdgeGaps, don't trim target gaps before or after the range. */
-
-void axtSubsetOnT(struct axt *axt, int newStart, int newEnd, 
-	struct axtScoreScheme *ss, FILE *f);
-/* Write out subset of axt that goes from newStart to newEnd
- * in target coordinates. */
-
-int axtTransPosToQ(struct axt *axt, int tPos);
-/* Convert from t to q coordinates */
-
-void axtSwap(struct axt *axt, int tSize, int qSize);
-/* Flip target and query on one axt. */
-
-struct axtBundle
-/* A bunch of axt's on the same query/target sequence. */
-    {
-    struct axtBundle *next;
-    struct axt *axtList;	/* List of alignments. */
-    int tSize;			/* Size of target. */
-    int qSize;			/* Size of query. */
-    };
-
-void axtBundleFree(struct axtBundle **pObj);
-/* Free a axtBundle. */
-
-void axtBundleFreeList(struct axtBundle **pList);
-/* Free a list of gfAxtBundles. */
-
-void axtBlastOut(struct axtBundle *abList, 
-	int queryIx, boolean isProt, FILE *f, 
-	char *databaseName, int databaseSeqCount, double databaseLetterCount, 
-	char *blastType, char *ourId, double minIdentity);
-/* Output a bundle of axt's on the same query sequence in blast format.
- * The parameters in detail are:
- *   ab - the list of bundles of axt's. 
- *   f  - output file handle
- *   databaseSeqCount - number of sequences in database
- *   databaseLetterCount - number of bases or aa's in database
- *   blastType - blast/wublast/blast8/blast9/xml
- *   ourId - optional (may be NULL) thing to put in header
- */
-
-struct axt *axtAffine(bioSeq *query, bioSeq *target, struct axtScoreScheme *ss);
-/* Return alignment if any of query and target using scoring scheme.  This does
- * dynamic program affine-gap based alignment.  It's not suitable for very large
- * sequences. */
-
-boolean axtAffineSmallEnough(double querySize, double targetSize);
-/* Return TRUE if it is reasonable to align sequences of given sizes
- * with axtAffine. */
-
-
-struct axt *axtAffine2Level(bioSeq *query, bioSeq *target, struct axtScoreScheme *ss);
-/* 
-
-   Return alignment if any of query and target using scoring scheme. 
-   
-   2Level uses an economical amount of ram and should work for large target sequences.
-   
-   If Q is query size and T is target size and M is memory size, then
-   Total memory used M = 30*Q*sqrt(T).  When the target is much larger than the query
-   this method saves ram, and average runtime is only 50% greater, or 1.5 QT.  
-   If Q=5000 and T=245,522,847 for hg17 chr1, then M = 2.2 GB ram.  
-   axtAffine would need M=3QT = 3.4 TB.
-   Of course massive alignments will be painfully slow anyway.
-
-   Works for protein as well as DNA given the correct scoreScheme.
-  
-   NOTES:
-   Double-gap cost is equal to gap-extend cost, but gap-open would also work.
-   On very large target, score integer may overflow.
-   Input sequences not checked for invalid chars.
-   Input not checked but query should be shorter than target.
-   
-*/
-
-void axtAddBlocksToBoxInList(struct cBlock **pList, struct axt *axt);
-/* Add blocks (gapless subalignments) from (non-NULL!) axt to block list. 
- * Note: list will be in reverse order of axt blocks. */
-
-void axtPrintTraditional(struct axt *axt, int maxLine, struct axtScoreScheme *ss, 
-	FILE *f);
-/* Print out an alignment with line-breaks. */
-
-void axtPrintTraditionalExtra(struct axt *axt, int maxLine,
-			      struct axtScoreScheme *ss, FILE *f,
-			      boolean reverseTPos, boolean reverseQPos);
-/* Print out an alignment with line-breaks.  If reverseTPos is true, then
- * the sequence has been reverse complemented, so show the coords starting
- * at tEnd and decrementing down to tStart; likewise for reverseQPos. */
-
-double axtIdWithGaps(struct axt *axt);
-/* Return ratio of matching bases to total symbols in alignment. */
-
-double axtCoverage(struct axt *axt, int qSize, int tSize);
-/* Return % of q and t covered. */
-
-void axtOutPretty(struct axt *axt, int lineSize, FILE *f);
-/* Output axt in pretty format. */
-
-#endif /* AXT_H */
-
diff --git a/gbtools/src/include/blatSrc/bPlusTree.h b/gbtools/src/include/blatSrc/bPlusTree.h
deleted file mode 100644
index d24f933..0000000
--- a/gbtools/src/include/blatSrc/bPlusTree.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* bptFile - B+ Trees.  These are a method of indexing data similar to binary trees, but 
- * with many children rather than just two at each node. They work well when stored on disk,
- * since typically only two or three disk accesses are needed to locate any particular
- * piece of data.  This implementation is *just* for disk based storage.  For memory
- * use the rbTree instead. Currently the implementation is just useful for data warehouse
- * type applications.  That is it implements a function to create a b+ tree from bulk data
- * (bptFileCreate) and a function to lookup a value given a key (bptFileFind) but not functions
- * to add or delete individual items.
- *
- *
- * The layout of the file on disk is:
- *    header
- *    root node
- *    (other nodes)
- * In general when the tree is first built the higher level nodes are stored before the
- * lower level nodes.  It is possible if a b+ tree is dynamically updated for this to
- * no longer be strictly true, but actually currently the b+ tree code here doesn't implement
- * dynamic updates - it just creates a b+ tree from a sorted list.
- *
- * Each node can be one of two types - index or leaf.  The index nodes contain pointers
- * to child nodes.  The leaf nodes contain the actual data. 
- *
- * The layout of the file header is:
- *       <magic number>  4 bytes - The value bptSig (0x78CA8C91)
- *       <block size>    4 bytes - Number of children per block (not byte size of block)
- *       <key size>      4 bytes - Number of significant bytes in key
- *       <val size>      4 bytes - Number of bytes in value
- *       <item count>    8 bytes - Number of items in index
- *       <reserved2>     4 bytes - Always 0 for now
- *       <reserved3>     4 bytes - Always 0 for now
- * The magic number may be byte-swapped, in which case all numbers in the file
- * need to be byte-swapped. 
- *
- * The nodes start with a header:
- *       <is leaf>       1 byte  - 1 for leaf nodes, 0 for index nodes.
- *       <reserved>      1 byte  - Always 0 for now.
- *       <count>         2 bytes - The number of children/items in node
- * This is followed by count items.  For the index nodes the items are
- *       <key>           key size bytes - always written most significant byte first
- *       <offset>        8 bytes - Offset of child node in index file.
- * For leaf nodes the items are
- *       <key>           key size bytes - always written most significant byte first
- *       <val>           val sized bytes - the value associated with the key.
- * Note in general the leaf nodes may not be the same size as the index nodes, though in
- * the important case where the values are file offsets they will be.
- */
-
-#ifndef BPLUSTREE_H
-#define BPLUSTREE_H
-
-struct bptFile
-/* B+ tree index file handle. */
-    {
-    struct bptFile *next;	/* Next in list of index files if any. */
-    char *fileName;		/* Name of file - for error reporting. */
-    struct udcFile *udc;			/* Open file pointer. */
-    bits32 blockSize;		/* Size of block. */
-    bits32 keySize;		/* Size of keys. */
-    bits32 valSize;		/* Size of values. */
-    bits64 itemCount;		/* Number of items indexed. */
-    boolean isSwapped;		/* If TRUE need to byte swap everything. */
-    bits64 rootOffset;		/* Offset of root block. */
-    };
-
-struct bptFile *bptFileOpen(char *fileName);
-/* Open up index file - reading header and verifying things. */
-
-void bptFileClose(struct bptFile **pBpt);
-/* Close down and deallocate index file. */
-
-struct bptFile *bptFileAttach(char *fileName, struct udcFile *udc);
-/* Open up index file on previously open file, with header at current file position. */
-
-void bptFileDetach(struct bptFile **pBpt);
-/* Detach and free up bptFile opened with bptFileAttach. */
-
-boolean bptFileFind(struct bptFile *bpt, void *key, int keySize, void *val, int valSize);
-/* Find value associated with key.  Return TRUE if it's found. 
- *  Parameters:
- *     bpt - file handle returned by bptFileOpen
- *     key - pointer to key string
- *     keySize - size of key.  Normally just strlen(key)
- *     val - pointer to where to put retrieved value
- *     valSize - size of memory buffer that will hold val.  Should match bpt->valSize.
- */
-
-struct slRef *bptFileFindMultiple(struct bptFile *bpt, void *key, int keySize, int valSize);
-/* Find all values associated with key.  Store this in ->val item of returned list. 
- * Do a slRefFreeListAndVals() on list when done. */
-
-void bptFileTraverse(struct bptFile *bpt, void *context,
-    void (*callback)(void *context, void *key, int keySize, void *val, int valSize) );
-/* Traverse bPlusTree on file, calling supplied callback function at each
- * leaf item. */
-
-void bptKeyAtPos(struct bptFile *bpt, bits64 itemPos, void *result);
-/* Fill in result with the key at given itemPos.  For first piece of data itemPos is 0 
- * and for last piece is bpt->itemCount - 1.  Result must be at least bpt->keySize.  
- * If result is a string it won't be zero terminated
- * by this routine.  Use bptStringKeyAtPos instead. */
-
-void bptStringKeyAtPos(struct bptFile *bpt, bits64 itemPos, char *result, int maxResultSize);
-/* Fill in result with the key at given itemPos.  The maxResultSize should be 1+bpt->keySize
- * to accommodate zero termination of string. */
-
-void bptFileCreate(
-	void *itemArray, 	/* Sorted array of things to index. */
-	int itemSize, 		/* Size of each element in array. */
-	bits64 itemCount, 	/* Number of elements in array. */
-	bits32 blockSize,	/* B+ tree block size - # of children for each node. */
-	void (*fetchKey)(const void *va, char *keyBuf),  /* Given item, copy key to keyBuf */ 
-	bits32 keySize,					 /* Size of key */
-	void* (*fetchVal)(const void *va), 		 /* Given item, return pointer to value */
-	bits32 valSize, 				 /* Size of value */
-	char *fileName);                                 /* Name of output file. */
-/* Create a b+ tree index file from a sorted array. */
-
-void bptFileBulkIndexToOpenFile(void *itemArray, int itemSize, bits64 itemCount, bits32 blockSize,
-	void (*fetchKey)(const void *va, char *keyBuf), bits32 keySize,
-	void* (*fetchVal)(const void *va), bits32 valSize, FILE *f);
-/* Create a b+ tree index from a sorted array, writing output starting at current position
- * of an already open file.  See bptFileCreate for explanation of parameters. */
-
-#define bptFileHeaderSize 32
-#define bptBlockHeaderSize 4
-
-#endif /* BPLUSTREE_H */
diff --git a/gbtools/src/include/blatSrc/bamFile.h b/gbtools/src/include/blatSrc/bamFile.h
deleted file mode 100644
index 84b7b45..0000000
--- a/gbtools/src/include/blatSrc/bamFile.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/* bamFile -- interface to binary alignment format files using Heng Li's samtools lib. */
-
-#ifndef BAMFILE_H
-#define BAMFILE_H
-
-#include "dnaseq.h"
-#include "dystring.h"
-
-#ifdef USE_BAM
-
-// bam.h is incomplete without _IOLIB set to 1, 2 or 3.  2 is used by Makefile.generic:
-#ifndef _IOLIB
-#define _IOLIB 2
-#endif
-#include "bam.h"
-#include "sam.h"
-
-#else // no USE_BAM
-typedef struct { } bam1_t;
-typedef struct { } bam_index_t;
-typedef struct { } samfile_t;
-typedef int (*bam_fetch_f)(const bam1_t *b, void *data);
-
-#define COMPILE_WITH_SAMTOOLS "%s: in order to use this functionality you must " \
-    "install the samtools library (<A HREF=\"http://samtools.sourceforge.net\" " \
-    "TARGET=_BLANK>http://samtools.sourceforge.net</A>) and recompile kent/src with " \
-    "USE_BAM=1 in your environment " \
-    "(see <A HREF=\"http://genomewiki.ucsc.edu/index.php/Build_Environment_Variables\" " \
-    "TARGET=_BLANK>http://genomewiki.ucsc.edu/index.php/Build_Environment_Variables</A>)."
-
-#endif // USE_BAM
-
-struct bamChromInfo
-    {
-    struct bamChromInfo *next;
-    char *name;		/* Chromosome name */
-    bits32 size;	/* Chromosome size in bases */
-    };
-
-boolean bamFileExists(char *bamFileName);
-/* Return TRUE if we can successfully open the bam file and its index file. */
-
-void bamFileAndIndexMustExist(char *fileOrUrl);
-/* Open both a bam file and its accompanying index or errAbort; this is what it
- * takes for diagnostic info to propagate up through errCatches in calling code. */
-
-samfile_t *bamOpen(char *fileOrUrl, char **retBamFileName);
-/* Return an open bam file as well as the filename of the bam. */
-
-samfile_t *bamMustOpenLocal(char *fileName, char *mode, void *extraHeader);
-/* Open up sam or bam file or die trying.  The mode parameter is 
- *    "r" - open SAM to read
- *    "rb" - open BAM to read
- *    "w" - open SAM to write
- *    "wb" - open BAM to write
- * The extraHeader is generally NULL in the read case, and the write case
- * contains a pointer to a bam_header_t with information about the header.
- * The implementation is just a wrapper around samopen from the samtools library
- * that aborts with error message if there's a problem with the open. */
-
-void bamFetchAlreadyOpen(samfile_t *samfile, bam_index_t *idx, char *bamFileName, 
-			 char *position, bam_fetch_f callbackFunc, void *callbackData);
-/* With the open bam file, return items the same way with the callbacks as with bamFetch() */
-/* except in this case use an already-open bam file and index (use bam_index_load and free() for */
-/* the index). It seems a little strange to pass the filename in with the open bam, but */
-/* it's just used to report errors. */
-
-void bamFetch(char *fileOrUrl, char *position, bam_fetch_f callbackFunc, void *callbackData,
-	samfile_t **pSamFile);
-/* Open the .bam file, fetch items in the seq:start-end position range,
- * and call callbackFunc on each bam item retrieved from the file plus callbackData.
- * This handles BAM files with "chr"-less sequence names, e.g. from Ensembl. 
- * The pSamFile parameter is optional.  If non-NULL it will be filled in, just for
- * the benefit of the callback function, with the open samFile.  */
-
-void bamClose(samfile_t **pSamFile);
-/* Close down a samefile_t */
-
-boolean bamIsRc(const bam1_t *bam);
-/* Return TRUE if alignment is on - strand. */
-
-INLINE int bamUnpackCigarElement(unsigned int packed, char *retOp)
-/* Given an unsigned int containing a number of bases and an offset into an
- * array of BAM-enhanced-CIGAR ASCII characters (operations), store operation 
- * char into *retOp (retOp must not be NULL) and return the number of bases. */
-{
-#ifdef USE_BAM
-// decoding lifted from samtools bam.c bam_format1_core(), long may it remain stable:
-#define BAM_DOT_C_OPCODE_STRING "MIDNSHP=X"
-int n = packed>>BAM_CIGAR_SHIFT;
-int opcode = packed & BAM_CIGAR_MASK;
-if (opcode >= strlen(BAM_DOT_C_OPCODE_STRING))
-    errAbort("bamUnpackCigarElement: unrecognized opcode %d. "
-	     "(I only recognize 0..%lu [" BAM_DOT_C_OPCODE_STRING "])  "
-	     "Perhaps samtools bam.c's bam_format1 encoding changed?  If so, update me.",
-	     opcode, (unsigned long)(strlen(BAM_DOT_C_OPCODE_STRING)-1));
-*retOp = BAM_DOT_C_OPCODE_STRING[opcode];
-return n;
-#else // no USE_BAM
-errAbort(COMPILE_WITH_SAMTOOLS, "bamUnpackCigarElement");
-return 0;
-#endif// USE_BAM
-}
-
-void bamGetSoftClipping(const bam1_t *bam, int *retLow, int *retHigh, int *retClippedQLen);
-/* If retLow is non-NULL, set it to the number of "soft-clipped" (skipped) bases at
- * the beginning of the query sequence and quality; likewise for retHigh at end.
- * For convenience, retClippedQLen is the original query length minus soft clipping
- * (and the length of the query sequence that will be returned). */
-
-void bamUnpackQuerySequence(const bam1_t *bam, boolean useStrand, char *qSeq);
-/* Fill in qSeq with the nucleotide sequence encoded in bam.  The BAM format 
- * reverse-complements query sequence when the alignment is on the - strand,
- * so if useStrand is given we rev-comp it back to restore the original query 
- * sequence. */
-
-char *bamGetQuerySequence(const bam1_t *bam, boolean useStrand);
-/* Return the nucleotide sequence encoded in bam.  The BAM format 
- * reverse-complements query sequence when the alignment is on the - strand,
- * so if useStrand is given we rev-comp it back to restore the original query 
- * sequence. */
-
-UBYTE *bamGetQueryQuals(const bam1_t *bam, boolean useStrand);
-/* Return the base quality scores encoded in bam as an array of ubytes. */
-
-void bamUnpackCigar(const bam1_t *bam, struct dyString *dyCigar);
-/* Unpack CIGAR string into dynamic string */
-
-char *bamGetCigar(const bam1_t *bam);
-/* Return a BAM-enhanced CIGAR string, decoded from the packed encoding in bam. */
-
-void bamShowCigarEnglish(const bam1_t *bam);
-/* Print out cigar in English e.g. "20 (mis)Match, 1 Deletion, 3 (mis)Match" */
-
-void bamShowFlagsEnglish(const bam1_t *bam);
-/* Print out flags in English, e.g. "Mate is on '-' strand; Properly paired". */
-
-int bamGetTargetLength(const bam1_t *bam);
-/* Tally up the alignment's length on the reference sequence from
- * bam's packed-int CIGAR representation. */
-
-bam1_t *bamClone(const bam1_t *bam);
-/* Return a newly allocated copy of bam. */
-
-void bamShowTags(const bam1_t *bam);
-/* Print out tags in HTML: bold key, no type indicator for brevity. */
-
-char *bamGetTagString(const bam1_t *bam, char *tag, char *buf, size_t bufSize);
-/* If bam's tags include the given 2-character tag, place the value into 
- * buf (zero-terminated, trunc'd if nec) and return a pointer to buf,
- * or NULL if tag is not present. */
-
-void bamUnpackAux(const bam1_t *bam, struct dyString *dy);
-/* Unpack the tag:type:val part of bam into dy */
-
-struct bamChromInfo *bamChromList(samfile_t *fh);
-/* Return list of chromosomes from bam header. We make no attempty to normalize chromosome names to UCSC format,
-   so list may contain things like "1" for "chr1", "I" for "chrI", "MT" for "chrM" etc. */
-
-void bamChromInfoFreeList(struct bamChromInfo **pList);
-/* Free a list of dynamically allocated bamChromInfo's */
-
-void samToBed(char *samIn, char *bedOut);
-/* samToBed - Convert SAM file to a pretty simple minded bed file.. */
-
-void samToOpenBed(char *samIn, FILE *f);
-/* Like samToOpenBed, but the output is the already open file f. */
-
-#endif//ndef BAMFILE_H
diff --git a/gbtools/src/include/blatSrc/bandExt.h b/gbtools/src/include/blatSrc/bandExt.h
deleted file mode 100644
index 63f2ba9..0000000
--- a/gbtools/src/include/blatSrc/bandExt.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* bandExt - banded Smith-Waterman extension of alignments. 
- * An aligner might first find perfectly matching hits of
- * a small size, then extend these hits as far as possible
- * while the sequences perfectly match, then call on routines
- * in this module to do further extensions allowing small
- * gaps and mismatches. */
-
-#ifndef BANDEXT_H
-#define BANDEXT_H
-
-#ifndef LOCALMEM_H
-#include "localmem.h"
-#endif
-
-boolean bandExt(boolean global, struct axtScoreScheme *ss, int maxInsert,
-	char *aStart, int aSize, char *bStart, int bSize, int dir,
-	int symAlloc, int *retSymCount, char *retSymA, char *retSymB, 
-	int *retRevStartA, int *retRevStartB);
-/* Try to extend an alignment from aStart/bStart onwards.
- * If global is set it will always go to end (aStart+aSize-1,
- * bStart+bSize-1).  Set maxInsert to the maximum gap size allowed.  
- * 3 is often a good choice.  aStart/aSize bStart/bSize describe the
- * sequence to extend through (not including any of the existing
- * alignment. Set dir = 1 for forward extension, dir = -1 for backwards. 
- * retSymA and retSymB should point to arrays of characters of
- * symAlloc size.  symAlloc needs to be aSize*2 or so.  The
- * alignment is returned in the various ret values.  The function
- * overall returns TRUE if an extension occurred, FALSE if not. */
-
-struct ffAli *bandExtFf(
-	struct lm *lm,	/* Local memory pool, NULL to use global allocation for ff */
-	struct axtScoreScheme *ss, 	/* Scoring scheme to use. */
-	int maxInsert,			/* Maximum number of inserts to allow. */
-	struct ffAli *origFf,		/* Alignment block to extend. */
-	char *nStart, char *nEnd,	/* Bounds of region to extend through */
-	char *hStart, char *hEnd,	/* Bounds of region to extend through */
-	int dir,			/* +1 to extend end, -1 to extend start */
-	int maxExt);			/* Maximum length of extension. */
-/* Extend a gapless alignment in one direction.  Returns extending
- * ffAlis, not linked into origFf, or NULL if no extension possible. */
-
-#endif /* BANDEXT_H */
diff --git a/gbtools/src/include/blatSrc/base64.h b/gbtools/src/include/blatSrc/base64.h
deleted file mode 100644
index d2c21c1..0000000
--- a/gbtools/src/include/blatSrc/base64.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Base64 encoding and decoding.
- * by Galt Barber */
-
-#ifndef BASE64_H
-#define BASE64_H
-
-#define B64CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
-
-char *base64Encode(char *input, size_t inplen);
-/* Use base64 to encode a string.  Returns one long encoded
- * string which need to be freeMem'd. Note: big-endian algorithm.
- * For some applications you may need to break the base64 output
- * of this function into lines no longer than 76 chars.
- */
-
-boolean base64Validate(char *input);
-/* Return true if input is valid base64.
- * Note that the input string is changed by 
- * eraseWhiteSpace(). */
-
-char *base64Decode(char *input, size_t *returnSize);
-/* Use base64 to decode a string.  Return decoded
- * string which will be freeMem'd. Note: big-endian algorithm.
- * Call eraseWhiteSpace() and check for invalid input 
- * before passing in input if needed.  
- * Optionally set retun size for use with binary data.
- */
-
-#endif /* BASE64_H */
-
diff --git a/gbtools/src/include/blatSrc/basicBed.h b/gbtools/src/include/blatSrc/basicBed.h
deleted file mode 100644
index 28fb8ef..0000000
--- a/gbtools/src/include/blatSrc/basicBed.h
+++ /dev/null
@@ -1,312 +0,0 @@
-/* basicBed.h contains the basic interface to Browser Extensible Data (bed) files and tables.
- * The idea behind bed is that the first three fields are defined and required.
- * A total of 15 fields are defined, and the file can contain any number of these.
- * In addition after any number of defined fields there can be custom fields that
- * are not defined in the bed spec.
- *
- * There's additional bed-related code in src/hg/inc/bed.h.  This module contains the
- * stuff that's independent of the database and other genomic structures. */
-
-#ifndef BASICBED_H
-#define BASICBED_H
-
-#include "psl.h"
-#include "asParse.h"
-
-struct bed
-/* Browser extensible data */
-    {
-    struct bed *next;  /* Next in singly linked list. */
-    char *chrom;	/* Human chromosome or FPC contig */
-    unsigned chromStart;	/* Start position in chromosome */
-    unsigned chromEnd;	/* End position in chromosome */
-    char *name;	/* Name of item */
-
-    /* The following items are not loaded by   the bedLoad routines. */
-    int score; /* Score - 0-1000 */  /* Should be uint but there are still some ct users with neg values, .as DOES say uint */
-    char strand[2];  /* + or -.  */
-    unsigned thickStart; /* Start of where display should be thick (start codon for genes) */
-    unsigned thickEnd;   /* End of where display should be thick (stop codon for genes) */
-    unsigned itemRgb;    /* RGB 8 bits each */
-    unsigned blockCount; /* Number of blocks. */
-    int *blockSizes;     /* Comma separated list of block sizes.  */
-    int *chromStarts;    /* Start positions inside chromosome.  Relative to chromStart*/
-
-
-    int expCount;	/* Experiment count */
-    int *expIds;		/* Comma separated list of Experiment ids */
-    float *expScores;	/* Comma separated list of Experiment scores. */
-    };
-
-#define bedKnownFields 15	/* Maximum known fields in bed */
-
-#define BB_MAX_CHROM_STRING 32  /* Maximum string length for chromosome length */
-
-struct bed3
-/* Browser extensible data - first three fields */
-    {
-    struct bed3 *next;  /* Next in singly linked list. */
-    char *chrom;	/* Human chromosome or FPC contig */
-    unsigned chromStart;	/* Start position in chromosome */
-    unsigned chromEnd;	/* End position in chromosome */
-    };
-
-struct bed3 *bed3New(char *chrom, int start, int end);
-/* Make new bed3. */
-
-void bed3Free(struct bed3 **pBed);
-/* Free up bed3 */
-
-void bed3FreeList(struct bed3 **pList);
-/* Free a list of dynamically allocated bed3's */
-
-struct bed3 *bed3LoadAll(char *fileName);
-/* Load three columns from file as bed3. */
-
-long long bed3TotalSize(struct bed3 *bedList);
-/* Return sum of chromEnd-chromStart. */
-
-struct bed4
-/* Browser extensible data - first four fields */
-    {
-    struct bed4 *next;  /* Next in singly linked list. */
-    char *chrom;	/* Human chromosome or FPC contig */
-    unsigned chromStart;	/* Start position in chromosome */
-    unsigned chromEnd;	/* End position in chromosome */
-    char *name;	/* Name of item */
-    };
-
-
-struct bed4 *bed4New(char *chrom, int start, int end, char *name);
-/* Make new bed4. */
-
-void bed4Free(struct bed4 **pBed);
-/* Free up bed4 */
-
-void bed4FreeList(struct bed4 **pList);
-/* Free a list of dynamically allocated bed4's */
-
-void bedStaticLoad(char **row, struct bed *ret);
-/* Load a row from bed table into ret.  The contents of ret will
- * be replaced at the next call to this function. */
-
-struct bed *bedLoad(char **row);
-/* Load a bed from row fetched with select * from bed
- * from database.  Dispose of this with bedFree(). 
- * This loads first four fields. */
-
-struct bed *bedCommaIn(char **pS, struct bed *ret);
-/* Create a bed out of a comma separated string. 
- * This will fill in ret if non-null, otherwise will
- * return a new bed */
-
-void bedFree(struct bed **pEl);
-/* Free a single dynamically allocated bed such as created
- * with bedLoad(). */
-
-void bedFreeList(struct bed **pList);
-/* Free a list of dynamically allocated bed's */
-
-void bedOutput(struct bed *el, FILE *f, char sep, char lastSep);
-/* Print out bed.  Separate fields with sep. Follow last field with lastSep. */
-
-#define bedTabOut(el,f) bedOutput(el,f,'\t','\n');
-/* Print out bed as a line in a tab-separated file. */
-
-#define bedCommaOut(el,f) bedOutput(el,f,',',',');
-/* Print out bed as a comma separated list including final comma. */
-
-/* --------------- End of AutoSQL generated code. --------------- */
-
-int bedCmp(const void *va, const void *vb);
-/* Compare to sort based on chrom,chromStart. */
-
-int bedCmpEnd(const void *va, const void *vb);
-/* Compare to sort based on chrom,chromEnd. */
-
-int bedCmpScore(const void *va, const void *vb);
-/* Compare to sort based on score - lowest first. */
-
-int bedCmpPlusScore(const void *va, const void *vb);
-/* Compare to sort based on chrom, chromStart and score - lowest first. */
-
-int bedCmpSize(const void *va, const void *vb);
-/* Compare to sort based on size of element (end-start == size) */
-
-int bedCmpChromStrandStart(const void *va, const void *vb);
-/* Compare to sort based on chrom,strand,chromStart. */
-
-struct bedLine
-/* A line in a bed file with chromosome, start position parsed out. */
-    {
-    struct bedLine *next;	/* Next in list. */
-    char *chrom;                /* Chromosome parsed out. */
-    int chromStart;             /* Start position (still in rest of line). */
-    char *line;                 /* Rest of line. */
-    };
-
-struct bedLine *bedLineNew(char *line);
-/* Create a new bedLine based on tab-separated string s. */
-
-void bedLineFree(struct bedLine **pBl);
-/* Free up memory associated with bedLine. */
-
-void bedLineFreeList(struct bedLine **pList);
-/* Free a list of dynamically allocated bedLine's */
-
-int bedLineCmp(const void *va, const void *vb);
-/* Compare to sort based on chrom,chromStart. */
-
-void bedSortFile(char *inFile, char *outFile);
-/* Sort a bed file (in place, overwrites old file. */
-
-struct bed *bedLoad3(char **row);
-/* Load first three fields of bed. */
-
-struct bed *bedLoad5(char **row);
-/* Load first five fields of bed. */
-
-struct bed *bedLoad6(char **row);
-/* Load first six fields of bed. */
-
-struct bed *bedLoad12(char **row);
-/* Load all 12 fields of bed. */
-
-struct bed *bedLoadN(char *row[], int wordCount);
-/* Convert a row of strings to a bed. */
-
-struct bed *bedLoadNAllChrom(char *fileName, int numFields, char* chrom);
-/* Load bed entries from a tab-separated file that have the given chrom.
- * Dispose of this with bedFreeList(). */
-
-struct bed *bedLoadNAll(char *fileName, int numFields);
-/* Load all bed from a tab-separated file.
- * Dispose of this with bedFreeList(). */
-
-struct bed *bedLoadAll(char *fileName);
-/* Determines how many fields are in a bedFile and load all beds from
- * a tab-separated file.  Dispose of this with bedFreeList(). */
-
-void bedLoadAllReturnFieldCount(char *fileName, struct bed **retList, int *retFieldCount);
-/* Load bed of unknown size and return number of fields as well as list of bed items.
- * Ensures that all lines in bed file have same field count. */
-
-void bedLoadAllReturnFieldCountAndRgb(char *fileName, struct bed **retList, int *retFieldCount, 
-    boolean *retRgb);
-/* Load bed of unknown size and return number of fields as well as list of bed items.
- * Ensures that all lines in bed file have same field count.  Also returns whether 
- * column 9 is being used as RGB or not. */
-
-void bedOutputN(struct bed *el, int wordCount, FILE *f, char sep, char lastSep);
-/* Write a bed of wordCount fields. */
-
-void bedOutputNitemRgb(struct bed *el, int wordCount, FILE *f,
-	char sep, char lastSep);
-/* Write a bed of wordCount fields, interpret column 9 as RGB. */
-
-void bedOutFlexible(struct bed *el, int wordCount, FILE *f,
-	char sep, char lastSep, boolean useItemRgb);
-/* Write a bed of wordCount fields, optionally interpreting field nine as R,G,B values. */
-
-#define bedTabOutNitemRgb(el,wordCount, f) bedOutputNitemRgb(el,wordCount,f,'\t','\n')
-/* Print out bed as a line in a tab-separated file. Interpret
-   column 9 as RGB */
-
-#define bedTabOutN(el,wordCount, f) bedOutputN(el,wordCount,f,'\t','\n')
-/* Print out bed as a line in a tab-separated file. */
-
-#define bedCommaOutN(el,wordCount, f) bedOutputN(el,wordCount,f,',',',')
-/* Print out bed as a comma separated list including final comma. */
-
-int bedTotalBlockSize(struct bed *bed);
-/* Return total size of all blocks. */
-
-int bedTotalThickBlockSize(struct bed *bed);
-/* Return total size of all thick blocks. */
-
-int bedStartThinSize(struct bed *bed);
-/* Return total size of all blocks before thick part. */
-
-int bedEndThinSize(struct bed *bed);
-/* Return total size of all blocks after thick part. */
-
-int bedBlockSizeInRange(struct bed *bed, int rangeStart, int rangeEnd);
-/* Get size of all parts of all exons between rangeStart and rangeEnd. */
-
-struct bed *bedFromPsl(struct psl *psl);
-/* Convert a single psl to a bed structure */
-
-void makeItBed12(struct bed *bedList, int numFields);
-/* If it's less than bed 12, make it bed 12. The numFields */
-/* param is for how many fields the bed *currently* has. */
-
-struct bed *cloneBed(struct bed *bed);
-/* Make an all-newly-allocated copy of a single bed record. */
-
-struct bed *cloneBedList(struct bed *bed);
-/* Make an all-newly-allocated list copied from bed. */
-
-struct bed *bedListNextDifferentChrom(struct bed *bedList);
-/* Return next bed in list that is from a different chrom than the start of the list. */
-
-struct bed *lmCloneBed(struct bed *bed, struct lm *lm);
-/* Make a copy of bed in local memory. */
-
-struct bed *bedCommaInN(char **pS, struct bed *ret, int fieldCount);
-/* Create a bed out of a comma separated string looking for fieldCount
- * fields. This will fill in ret if non-null, otherwise will return a
- * new bed */
-
-struct hash *readBedToBinKeeper(char *sizeFileName, char *bedFileName, int wordCount);
-/* Read a list of beds and return results in hash of binKeeper structure for fast query
- * See also bedsIntoKeeperHash, which takes the beds read into a list already, but
- * dispenses with the need for the sizeFile. */
-
-int bedParseRgb(char *itemRgb);
-/*	parse a string: "r,g,b" into three unsigned char values
-	returned as 24 bit number, or -1 for failure */
-
-long long bedTotalSize(struct bed *bedList);
-/* Add together sizes of all beds in list. */
-
-int bedSameStrandOverlap(struct bed *a, struct bed *b);
-/* Return amount of block-level overlap on same strand between a and b */
-
-boolean bedExactMatch(struct bed *oldBed, struct bed *newBed);
-/* Return TRUE if it's an exact match. */
-
-boolean bedCompatibleExtension(struct bed *oldBed, struct bed *newBed);
-/* Return TRUE if newBed is a compatible extension of oldBed, meaning
- * all internal exons and all introns of old bed are contained, in the 
- * same order in the new bed. */
-
-struct rbTree *bedToRangeTree(struct bed *bed);
-/* Convert bed into a range tree. */
-
-void bedIntoRangeTree(struct bed *bed, struct rbTree *rangeTree);
-/* Add all blocks in bed to range tree.  For beds without blocks,
- * add entire bed. */
-
-int bedRangeTreeOverlap(struct bed *bed, struct rbTree *rangeTree);
-/* Return number of bases bed overlaps with rangeTree. */
-
-struct bed *bedThickOnly(struct bed *in);
-/* Return a bed that only has the thick part. (Which is usually the CDS). */
-
-struct bed *bedThickOnlyList(struct bed *inList);
-/* Return a list of beds that only are the thick part of input. */
-
-char *bedAsDef(int bedFieldCount, int totalFieldCount);
-/* Return an autoSql definition for a bed of given number of fields. 
- * Normally totalFieldCount is equal to bedFieldCount.  If there are extra
- * fields they are just given the names field16, field17, etc and type string. */
-
-boolean asCompareObjAgainstStandardBed(struct asObject *asYours, int numColumnsToCheck, boolean abortOnDifference);
-/* Compare user's .as object asYours to the standard BED.
- * abortOnDifference specifies whether to warn or abort if they differ within the first numColumnsToCheck columns.
- * Returns TRUE if they match. */
-
-void loadAndValidateBed(char *row[], int wordCount, int fieldCount, struct lineFile *lf, struct bed * bed, struct asObject *as, boolean isCt);
-/* Convert a row of strings to a bed and validate the contents.  Abort with message if invalid data. Optionally validate bedPlus via asObject. */
-
-#endif /* BASICBED_H */
diff --git a/gbtools/src/include/blatSrc/bbiFile.h b/gbtools/src/include/blatSrc/bbiFile.h
deleted file mode 100644
index e582038..0000000
--- a/gbtools/src/include/blatSrc/bbiFile.h
+++ /dev/null
@@ -1,454 +0,0 @@
-/* bbiFile - Big Binary Indexed file.  Stuff that's common between bigWig and bigBed. */
-
-#ifndef BBIFILE_H
-#define BBIFILE_H
-
-#include "cirTree.h"
-#include "linefile.h"
-#include "localmem.h"
-
-/* bigWig/bigBed file structure:
- *     fixedWidthHeader
- *         magic# 		4 bytes
- *         version              2 bytes
- *	   zoomLevels		2 bytes
- *         chromosomeTreeOffset	8 bytes
- *         fullDataOffset	8 bytes
- *	   fullIndexOffset	8 bytes
- *         fieldCount           2 bytes (for bigWig 0)
- *         definedFieldCount    2 bytes (for bigWig 0)
- *         autoSqlOffset        8 bytes (for bigWig 0) (0 if no autoSql information)
- *         totalSummaryOffset   8 bytes (0 in earlier versions of file lacking totalSummary)
- *         uncompressBufSize    4 bytes (Size of uncompression buffer.  0 if uncompressed.)
- *         extensionOffset      8 bytes (Offset to header extension 0 if no such extension)
- *     zoomHeaders		there are zoomLevels number of these
- *         reductionLevel	4 bytes
- *	   reserved		4 bytes
- *	   dataOffset		8 bytes
- *         indexOffset          8 bytes
- *     autoSql string (zero terminated - only present if autoSqlOffset non-zero)
- *     totalSummary - summary of all data in file - only present if totalSummaryOffset non-zero
- *         basesCovered        8 bytes
- *         minVal              8 bytes float (for bigBed minimum depth of coverage)
- *         maxVal              8 bytes float (for bigBed maximum depth of coverage)
- *         sumData             8 bytes float (for bigBed sum of coverage)
- *         sumSquared          8 bytes float (for bigBed sum of coverage squared)
- *     extendedHeader
- *         extensionSize       2 size of extended header in bytes - currently 64
- *         extraIndexCount     2 number of extra fields we will be indexing
- *         extraIndexListOffset 8 Offset to list of non-chrom/start/end indexes
- *         reserved            48 All zeroes for now
- *     extraIndexList - one of these for each extraIndex 
- *         type                2 Type of index.  Always 0 for bPlusTree now
- *         fieldCount          2 Number of fields used in this index.  Always 1 for now
- *         indexOffset         8 offset for this index in file
- *         reserved            4 All zeroes for now
- *         fieldList - one of these for each field being used in _this_ index
- *            fieldId          2 index of field within record
- *            reserved         2 All zeroes for now
- *     chromosome b+ tree       bPlusTree index
- *     full data
- *         sectionCount		8 bytes (item count for bigBeds)
- *         section data		section count sections, of three types (bed data for bigBeds)
- *     full index               cirTree index
- *     zoom info             one of these for each zoom level
- *         zoom data
- *             zoomCount	4 bytes
- *             zoom data	there are zoomCount of these items
- *                 chromId	4 bytes
- *	           chromStart	4 bytes
- *                 chromEnd     4 bytes
- *                 validCount	4 bytes
- *                 minVal       4 bytes float 
- *                 maxVal       4 bytes float
- *                 sumData      4 bytes float
- *                 sumSquares   4 bytes float
- *         zoom index        	cirTree index
- *     extraIndexes [optional]  bPlusTreeIndex for each extra field that is indexed
- *     magic# 		4 bytes - same as magic number at start of header
- */
-
-#ifndef CIRTREE_H
-#include "cirTree.h"
-#endif
-
-#define bbiCurrentVersion 4
-/* Version history (of file format, not utilities - corresponds to version field in header)
- *    1 - Initial release
- *    1 - Unfortunately when attempting a transparent change to encoders, made the sectionCount 
- *        field inconsistent, sometimes not present, sometimes 32 bits.  Since offset positions
- *        in index were still accurate this did not break most applications, but it did show
- *        up in the summary section of the Table Browser.
- *    2 - Made sectionCount consistently 64 bits. Also fixed missing zoomCount in first level of
- *        zoom in files made by bedToBigBed and bedGraphToBigWig.  (The older wigToBigWig was fine.)
- *        Added totalSummary section.
- *    3 - Adding zlib compression.  Only active if uncompressBufSize is non-zero in header.
- *    4 - Fixed problem in encoder for the max field in zoom levels higher than the first one.
- *        Added an extra sig at end of file.
- */
-
-struct bbiZoomLevel
-/* A zoom level in bigWig file. */
-    {
-    struct bbiZoomLevel *next;		/* Next in list. */
-    bits32 reductionLevel;		/* How many bases per item */
-    bits32 reserved;			/* Zero for now. */
-    bits64 dataOffset;			/* Offset of data for this level in file. */
-    bits64 indexOffset;			/* Offset of index for this level in file. */
-    };
-
-struct bbiZoomLevel *bbiBestZoom(struct bbiZoomLevel *levelList, int desiredReduction);
-/* Return zoom level that is the closest one that is less than or equal to 
- * desiredReduction. */
-
-struct bbiFile 
-/* An open bbiFile */
-    {
-    struct bbiFile *next;	/* Next in list. */
-    char *fileName;		/* Name of file - for better error reporting. */
-    struct udcFile *udc;	/* Open UDC file handle. */
-    bits32 typeSig;		/* bigBedSig or bigWigSig for now. */
-    boolean isSwapped;		/* If TRUE need to byte swap everything. */
-    struct bptFile *chromBpt;	/* Index of chromosomes. */
-    bits16 version;		/* Version number - initially 1. */
-    bits16 zoomLevels;		/* Number of zoom levels. */
-    bits64 chromTreeOffset;	/* Offset to chromosome index. */
-    bits64 unzoomedDataOffset;	/* Start of unzoomed data. */
-    bits64 unzoomedIndexOffset;	/* Start of unzoomed index. */
-    bits16 fieldCount;		/* Number of columns in bed version. */
-    bits16 definedFieldCount;   /* Number of columns using bed standard definitions. */
-    bits64 asOffset;		/* Offset to embedded null-terminated AutoSQL file. */
-    bits64 totalSummaryOffset;	/* Offset to total summary information if any.  
-				   (On older files have to calculate) */
-    bits32 uncompressBufSize;	/* Size of uncompression buffer, 0 if uncompressed */
-    bits64 extensionOffset;	/* Start of header extension block or 0 if none. */
-    struct cirTreeFile *unzoomedCir;	/* Unzoomed data index in memory - may be NULL. */
-    struct bbiZoomLevel *levelList;	/* List of zoom levels. */
-
-    /* Fields based on extension block. */
-    bits16 extensionSize;   /* Size of extension block */
-    bits16 extraIndexCount; /* Number of extra indexes (on fields other than chrom,start,end */ 
-    bits64 extraIndexListOffset;    /* Offset to list of extra indexes */
-    };
-
-
-struct bbiFile *bbiFileOpen(char *fileName, bits32 sig, char *typeName);
-/* Open up big wig or big bed file. */
-
-void bbiFileClose(struct bbiFile **pBwf);
-/* Close down a big wig/big bed file. */
-
-struct fileOffsetSize *bbiOverlappingBlocks(struct bbiFile *bbi, struct cirTreeFile *ctf,
-	char *chrom, bits32 start, bits32 end, bits32 *retChromId);
-/* Fetch list of file blocks that contain items overlapping chromosome range. */
- 
-struct bbiChromIdSize
-/* We store an id/size pair in chromBpt bPlusTree */
-    {
-    bits32 chromId;	/* Chromosome ID */
-    bits32 chromSize;	/* Chromosome Size */
-    };
-
-struct bbiChromInfo
-/* Pair of a name and a 32-bit integer. Used to assign IDs to chromosomes. */
-    {
-    struct bbiChromInfo *next;
-    char *name;		/* Chromosome name */
-    bits32 id;		/* Chromosome ID - a small number usually */
-    bits32 size;	/* Chromosome size in bases */
-    };
-
-struct bbiChromInfo *bbiChromList(struct bbiFile *bbi);
-/* Return all chromosomes in file.  Dispose of this with bbiChromInfoFreeList. */
-
-void bbiChromInfoFreeList(struct bbiChromInfo **pList);
-/* Free a list of bbiChromInfo's */
-
-bits32 bbiChromSize(struct bbiFile *bbi, char *chrom);
-/* Returns size of given chromosome. */
-
-void bbiChromInfoKey(const void *va, char *keyBuf);
-/* Get key field out of bbiChromInfo. */
-
-void *bbiChromInfoVal(const void *va);
-/* Get val field out of bbiChromInfo. */
-
-char *bbiCachedChromLookup(struct bbiFile *bbi, int chromId, int lastChromId,
-    char *chromBuf, int chromBufSize);
-/* Return chromosome name corresponding to chromId.  Because this is a bit expensive,
- * if you are doing this repeatedly pass in the chromId used in the previous call to
- * this in lastChromId,  which will save it from doing the lookup again on the same
- * chromosome.  Pass in -1 to lastChromId if this is the first time or if you can't be
- * bothered.  The chromBufSize should be at greater or equal to bbi->keySize+1.  */
-
-struct bbiChromUsage
-/* Information on how many items per chromosome etc.  Used by multipass bbiFile writers. */
-    {
-    struct bbiChromUsage *next;
-    char *name;	/* chromosome name. */
-    bits32 itemCount;	/* Number of items for this chromosome. */
-    bits32 id;	/* Unique ID for chromosome. */
-    bits32 size;	/* Size of chromosome. */
-    };
-
-
-enum bbiSummaryType
-/* Way to summarize data. */
-    {
-    bbiSumMean = 0,	/* Average value */
-    bbiSumMax = 1,	/* Maximum value */
-    bbiSumMin = 2,	/* Minimum value */
-    bbiSumCoverage = 3,  /* Bases in region containing actual data. */
-    bbiSumStandardDeviation = 4, /* Standard deviation in window. */
-    };
-
-enum bbiSummaryType bbiSummaryTypeFromString(char *string);
-/* Return summary type given a descriptive string. */
-
-char *bbiSummaryTypeToString(enum bbiSummaryType type);
-/* Convert summary type from enum to string representation. */
-
-struct bbiSummary
-/* A summary type item. */
-    {
-    struct bbiSummary *next;
-    bits32 chromId;		/* ID of associated chromosome. */
-    bits32 start,end;		/* Range of chromosome covered. */
-    bits32 validCount;		/* Count of (bases) with actual data. */
-    float minVal;		/* Minimum value of items */
-    float maxVal;		/* Maximum value of items */
-    float sumData;		/* sum of values for each base. */
-    float sumSquares;		/* sum of squares for each base. */
-    bits64 fileOffset;		/* Offset of summary in file. */
-    };
-
-#define bbiSummaryFreeList slFreeList
-
-
-struct bbiSummaryOnDisk
-/* The part of the summary that ends up on disk - in the same order written to disk. */
-    {
-    bits32 chromId;		/* ID of associated chromosome. */
-    bits32 start,end;		/* Range of chromosome covered. */
-    bits32 validCount;		/* Count of (bases) with actual data. */
-    float minVal;		/* Minimum value of items */
-    float maxVal;		/* Maximum value of items */
-    float sumData;		/* sum of values for each base. */
-    float sumSquares;		/* sum of squares for each base. */
-    };
-
-struct bbiInterval
-/* Data on a single interval. */
-    {
-    struct bbiInterval *next;	/* Next in list. */
-    bits32 start, end;			/* Position in chromosome, half open. */
-    double val;				/* Value at that position. */
-    };
-
-typedef struct bbiInterval *(*BbiFetchIntervals)(struct bbiFile *bbi, char *chrom, 
-					    bits32 start, bits32 end, struct lm *lm);
-/* A callback function that returns a bbiInterval list. */
-
-void bbiAttachUnzoomedCir(struct bbiFile *bbi);
-/* Make sure unzoomed cir is attached. */
-
-struct bbiSummaryElement
-/* An element of a summary from the user side. */
-    {
-    bits64 validCount;		/* Count of (bases) with actual data. */
-    double minVal;		/* Minimum value of items */
-    double maxVal;		/* Maximum value of items */
-    double sumData;		/* sum of values for each base. */
-    double sumSquares;		/* sum of squares for each base. */
-    };
-
-boolean bbiSummaryArrayExtended(struct bbiFile *bbi, char *chrom, bits32 start, bits32 end,
-	BbiFetchIntervals fetchIntervals,
-	int summarySize, struct bbiSummaryElement *summary);
-/* Fill in summary with  data from indicated chromosome range in bigWig/bigBed file. 
- * Returns FALSE if no data at that position. */
-
-boolean bbiSummaryArray(struct bbiFile *bbi, char *chrom, bits32 start, bits32 end,
-	BbiFetchIntervals fetchIntervals,
-	enum bbiSummaryType summaryType, int summarySize, double *summaryValues);
-/* Fill in summaryValues with  data from indicated chromosome range in bigWig file.
- * Be sure to initialize summaryValues to a default value, which will not be touched
- * for regions without data in file.  (Generally you want the default value to either
- * be 0.0 or nan("") depending on the application.)  Returns FALSE if no data
- * at that position. */
-
-struct bbiSummaryElement bbiTotalSummary(struct bbiFile *bbi);
-/* Return summary of entire file! */
-
-/****** Write side of things - implemented in bbiWrite.c.  Few people need this. ********/
-
-struct bbiBoundsArray
-/* Minimum info needed for r-tree indexer - where a section lives on disk and the
- * range it covers. */
-    {
-    bits64 offset;		/* Offset within file. */
-    struct cirTreeRange range;	/* What is covered. */
-    };
-
-struct cirTreeRange bbiBoundsArrayFetchKey(const void *va, void *context);
-/* Fetch bbiBoundsArray key for r-tree */
-
-bits64 bbiBoundsArrayFetchOffset(const void *va, void *context);
-/* Fetch bbiBoundsArray file offset for r-tree */
-
-struct bbiSumOutStream
-/* Buffer output to file so have a chance to compress. */
-    {
-    struct bbiSummaryOnDisk *array;
-    int elCount;
-    int allocCount;
-    FILE *f;
-    boolean doCompress;
-    };
-
-struct bbiSumOutStream *bbiSumOutStreamOpen(int allocCount, FILE *f, boolean doCompress);
-/* Open new bbiSumOutStream. */
-
-void bbiSumOutStreamClose(struct bbiSumOutStream **pStream);
-/* Free up bbiSumOutStream */
-
-void bbiSumOutStreamWrite(struct bbiSumOutStream *stream, struct bbiSummary *sum);
-/* Write out next one to stream. */
-
-void bbiOutputOneSummaryFurtherReduce(struct bbiSummary *sum, 
-	struct bbiSummary **pTwiceReducedList, 
-	int doubleReductionSize, struct bbiBoundsArray **pBoundsPt, 
-	struct bbiBoundsArray *boundsEnd, struct lm *lm, 
-	struct bbiSumOutStream *stream);
-/* Write out sum to file, keeping track of minimal info on it in *pBoundsPt, and also adding
- * it to second level summary. */
-
-struct bbiSummary *bbiSummarySimpleReduce(struct bbiSummary *list, int reduction, struct lm *lm);
-/* Do a simple reduction - where among other things the reduction level is an integral
- * multiple of the previous reduction level, and the list is sorted. Allocate result out of lm. */
-
-void bbiWriteDummyHeader(FILE *f);
-/* Write out all-zero header, just to reserve space for it. */
-
-void bbiWriteDummyZooms(FILE *f);
-/* Write out zeroes to reserve space for ten zoom levels. */
-
-void bbiSummaryElementWrite(FILE *f, struct bbiSummaryElement *sum);
-/* Write out summary element to file. */
-
-void bbiWriteChromInfo(struct bbiChromUsage *usageList, int blockSize, FILE *f);
-/* Write out information on chromosomes to file. */
-
-void bbiWriteFloat(FILE *f, float val);
-/* Write out floating point val to file.  Mostly to convert from double... */
-
-struct hash *bbiChromSizesFromFile(char *fileName);
-/* Read two column file into hash keyed by chrom. */
-
-bits64 bbiTotalSummarySize(struct bbiSummary *list);
-/* Return size on disk of all summaries. */
-
-void bbiChromUsageFree(struct bbiChromUsage **pUsage);
-/* free a single bbiChromUsage structure */
-
-void bbiChromUsageFreeList(struct bbiChromUsage **pList);
-/* free a list of bbiChromUsage structures */
-
-struct bbNamedFileChunk 
-/* A name associated with an offset into a possibly large file.  Used for extra
- * indexes in bigBed files. */
-    {
-    char *name;	    /* Name of chunk. */
-    bits64 offset;  /* Start in file. */
-    bits64 size;    /* Size in file. */
-    };
-
-struct bbExIndexMaker
-/* A helper structure to make indexes beyond primary one.  Just used for bigBeds */
-    {
-    bits16 indexCount;          /* Number of extra indexes. */
-        /* Kind of wish next four fields,  all of which are arrays indexed
-         * by the same thing,  were a single array of a structure instead. */
-    bits16 *indexFields;        /* array of field ids, one for each extra index. */
-    int *maxFieldSize;          /* array of maximum sizes seen for this field. */
-    struct bbNamedFileChunk **chunkArrayArray; /* where we keep name/start/size triples */
-    bits64 *fileOffsets;        /* array of file offsets where indexes starts. */
-    int recordCount;            /* number of records in file. */
-    };
-
-struct bbiChromUsage *bbiChromUsageFromBedFile(struct lineFile *lf, struct hash *chromSizesHash, 
-	struct bbExIndexMaker *eim, int *retMinDiff, double *retAveSize, bits64 *retBedCount);
-/* Go through bed file and collect chromosomes and statistics.  If eim parameter is non-NULL
- * collect max field sizes there too. */
-
-#define bbiMaxZoomLevels 10	/* Max number of zoom levels */
-#define bbiResIncrement 4	/* Amount to reduce at each zoom level */
-
-int bbiCalcResScalesAndSizes(int aveSize, 
-    int resScales[bbiMaxZoomLevels], int resSizes[bbiMaxZoomLevels]);
-/* Fill in resScales with amount to zoom at each level, and zero out resSizes based
- * on average span. Returns the number of zoom levels we actually will use. */
-
-typedef struct bbiSummary *bbiWriteReducedOnceReturnReducedTwice(
-	struct bbiChromUsage *usageList, int fieldCount,
-	struct lineFile *lf, bits32 initialReduction, bits32 initialReductionCount, 
-	int zoomIncrement, int blockSize, int itemsPerSlot, boolean doCompress,
-	struct lm *lm, FILE *f, bits64 *retDataStart, bits64 *retIndexStart,
-	struct bbiSummaryElement *totalSum);
-/* Typedef for a function that writes out data reduced by factor of initial reduction, and
- * also returns an array of bbiSummaries for the next reduction level. */
-
-int bbiWriteZoomLevels(
-    struct lineFile *lf,    /* Input file. */
-    FILE *f,		    /* Output. */
-    int blockSize,	    /* Size of index block */
-    int itemsPerSlot,	    /* Number of data points bundled at lowest level. */
-    bbiWriteReducedOnceReturnReducedTwice writeReducedOnceReturnReducedTwice,   /* callback */
-    int fieldCount,	    /* Number of fields in bed (4 for bedGraph) */
-    boolean doCompress,	    /* Do we compress.  Answer really should be yes! */
-    bits64 dataSize,	    /* Size of data on disk (after compression if any). */
-    struct bbiChromUsage *usageList, /* Result from bbiChromUsageFromBedFile */
-    int resTryCount, int resScales[], int resSizes[],   /* How much to zoom at each level */
-    bits32 zoomAmounts[bbiMaxZoomLevels],      /* Fills in amount zoomed at each level. */
-    bits64 zoomDataOffsets[bbiMaxZoomLevels],  /* Fills in where data starts for each zoom level. */
-    bits64 zoomIndexOffsets[bbiMaxZoomLevels], /* Fills in where index starts for each level. */
-    struct bbiSummaryElement *totalSum);
-/* Write out all the zoom levels and return the number of levels written.  Writes 
- * actual zoom amount and the offsets of the zoomed data and index in the last three
- * parameters.  Sorry for all the parameters - it was this or duplicate a big chunk of
- * code between bedToBigBed and bedGraphToBigWig. */
-
-int bbiCountSectionsNeeded(struct bbiChromUsage *usageList, int itemsPerSlot);
-/* Count up number of sections needed for data. */
-
-void bbiAddToSummary(bits32 chromId, bits32 chromSize, bits32 start, bits32 end, 
-	bits32 validCount, double minVal, double maxVal, double sumData, double sumSquares,  
-	int reduction, struct bbiSummary **pOutList);
-/* Add data range to summary - putting it onto top of list if possible, otherwise
- * expanding list. */
-
-void bbiAddRangeToSummary(bits32 chromId, bits32 chromSize, bits32 start, bits32 end, 
-	double val, int reduction, struct bbiSummary **pOutList);
-/* Add chromosome range to summary - putting it onto top of list if possible, otherwise
- * expanding list. */
-
-struct bbiSummary *bbiReduceSummaryList(struct bbiSummary *inList, 
-	struct bbiChromInfo *chromInfoArray, int reduction);
-/* Reduce summary list to another summary list. */
-
-bits64 bbiWriteSummaryAndIndex(struct bbiSummary *summaryList, 
-	int blockSize, int itemsPerSlot, boolean doCompress, FILE *f);
-/* Write out summary and index to summary, returning start position of
- * summary index. */
-
-boolean bbiFileCheckSigs(char *fileName, bits32 sig, char *typeName);
-/* check file signatures at beginning and end of file */
-
-time_t bbiUpdateTime(struct bbiFile *bbi);
-/* return bbi->udc->updateTime */
-
-struct bbiSummary *bbiSummariesInRegion(struct bbiZoomLevel *zoom, struct bbiFile *bbi,
-        int chromId, bits32 start, bits32 end);
-/* Return list of all summaries in region at given zoom level of bbiFile. */
-
-#endif /* BBIFILE_H */
diff --git a/gbtools/src/include/blatSrc/bigBed.h b/gbtools/src/include/blatSrc/bigBed.h
deleted file mode 100644
index 8031299..0000000
--- a/gbtools/src/include/blatSrc/bigBed.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* bigBed - interface to binary file with bed-style values (that is a bunch of
- * possibly overlapping regions.
- *
- * This shares a lot with the bigWig module. 
- *
- * Most of the functions here are concerned with reading bigBed files.  There's
- * two common things you want to do with a bigBed,  either stream through everything in it,
- * or just read the parts that overlap a interval within the genome.  The files
- * are optimized for interval queries, but streaming through them is not difficult either.
- * 
- * To query an interval:
- *    struct bbiFile *bbi = bigBedFileOpen(fileName);
- *    struct lm *lm = lmInit(0); // Memory pool to hold returned list
- *    struct bigBedInterval *list = bigBedIntervalQuery(bbi, chrom, start, end, 0, lm);
- *    struct bigBedInterval *el;
- *    for (el = list; el != NULL; el = el->next)
- *        // do something involving chrom, el->start, el->end
- *    lmCleanup(&lm);         // typically do this after each query
- *    bigBedFileClose(&bbi);  // typically only do this when finished all queries
- *
- * To stream through whole file
- *    struct bbiFile *bbi = bigBedFileOpen(fileName);
- *    struct bbiChromInfo *chrom, *chromList = bbiChromList(bbi);
- *    for (chrom = chromList; chrom != NULL; chrom = chrom->next)
- *        {
- *        struct lm *lm = lmInit(0);
- *        struct bigBedInterval *list = bigBedIntervalQuery(bbi,chrom->name,0,chrom->size,0,lm);
- *        struct bigBedInterval *el;
- *        for (el = list; el != NULL; el = el->next)
- *            // do something involving chrom, el->start, el->end
- *        lmCleanup(&lm);
- *        }
- *    bigBedFileClose(&bbi);
- *
- * The processes for streaming through or doing interval queries on a bigWig file are very 
- * similar. */
-
-#ifndef BIGBED_H
-#define BIGBED_H
-
-#include "asParse.h"
-
-#ifndef BBIFILE
-#include "bbiFile.h"
-#endif
-
-struct bigBedInterval
-/* A partially parsed out bed record plus some extra fields.  Use this directly
- * or convert it to an array of characters with bigBedIntervalToRow. */
-    {
-    struct bigBedInterval *next;	/* Next in list. */
-    bits32 start, end;		/* Range inside chromosome - half open zero based. */
-    char *rest;			/* Rest of line. May be NULL*/
-    bits32 chromId;             /* ID of chromosome.  */
-    };
-
-/*** Routines to open & close bigBed files, and to do chromosome range queries on them. ***/
-
-struct bbiFile *bigBedFileOpen(char *fileName);
-/* Open up big bed file.   Free this up with bbiFileClose. */
-
-#define bigBedFileClose(a) bbiFileClose(a)
-
-struct bigBedInterval *bigBedIntervalQuery(struct bbiFile *bbi, char *chrom,
-	bits32 start, bits32 end, int maxItems, struct lm *lm);
-/* Get data for interval.  Return list allocated out of lm.  Set maxItems to maximum
- * number of items to return, or to 0 for all items. */
-
-int bigBedIntervalToRow(struct bigBedInterval *interval, char *chrom, char *startBuf, char *endBuf,
-	char **row, int rowSize);
-/* Convert bigBedInterval into an array of chars equivalent to what you'd get by
- * parsing the bed file. The startBuf and endBuf are used to hold the ascii representation of
- * start and end.  Note that the interval->rest string will have zeroes inserted as a side effect.
- * Returns number of fields in row.  */
-
-boolean bigBedSummaryArray(struct bbiFile *bbi, char *chrom, bits32 start, bits32 end,
-	enum bbiSummaryType summaryType, int summarySize, double *summaryValues);
-/* Fill in summaryValues with  data from indicated chromosome range in bigBed file.
- * Be sure to initialize summaryValues to a default value, which will not be touched
- * for regions without data in file.  (Generally you want the default value to either
- * be 0.0 or nan("") depending on the application.)  Returns FALSE if no data
- * at that position. */
-
-boolean bigBedSummaryArrayExtended(struct bbiFile *bbi, char *chrom, bits32 start, bits32 end,
-	int summarySize, struct bbiSummaryElement *summary);
-/* Get extended summary information for summarySize evenely spaced elements into
- * the summary array. */
-
-/*** Some routines for accessing bigBed items via name. ***/
-
-struct bigBedInterval *bigBedNameQuery(struct bbiFile *bbi, struct bptFile *index,
-    int fieldIx, char *name, struct lm *lm);
-/* Return list of intervals matching file. These intervals will be allocated out of lm. */
-
-struct bigBedInterval *bigBedMultiNameQuery(struct bbiFile *bbi, struct bptFile *index,
-    int fieldIx, char **names, int nameCount, struct lm *lm);
-/* Fetch all records matching any of the names. Using given index on given field.
- * Return list is allocated out of lm. */
-
-int bigBedIntervalToRowLookupChrom(struct bigBedInterval *interval, 
-    struct bigBedInterval *prevInterval, struct bbiFile *bbi,
-    char *chromBuf, int chromBufSize, char *startBuf, char *endBuf, char **row, int rowSize);
-/* Convert bigBedInterval to array of chars equivalend to what you'd get by parsing the
- * bed file.  If you already know what chromosome the interval is on use the simpler
- * bigBedIntervalToRow.  This one will look up the chromosome based on the chromId field
- * of the interval,  which is relatively time consuming.  To avoid doing this unnecessarily
- * pass in a non-NULL prevInterval,  and if the chromId is the same on prevInterval as this,
- * it will avoid the lookup.  The chromBufSize should be at greater or equal to 
- * bbi->chromBpt->keySize+1.  The startBuf and endBuf are used to hold the ascii representation of
- * start and end, and should be 16 bytes.  Note that the interval->rest string will have zeroes 
- * inserted as a side effect.  Returns number of fields in row.  */
-
-void bigBedIntervalListToBedFile(struct bbiFile *bbi, struct bigBedInterval *intervalList, FILE *f);
-/* Write out big bed interval list to bed file, looking up chromosome. */
-
-/** Routines to access other data from a bigBed file. */
-
-bits64 bigBedItemCount(struct bbiFile *bbi);
-/* Return total items in file. */
-
-char *bigBedAutoSqlText(struct bbiFile *bbi);
-/* Get autoSql text if any associated with file.  Do a freeMem of this when done. */
-
-struct asObject *bigBedAs(struct bbiFile *bbi);
-/* Get autoSql object definition if any associated with file. */
-
-struct asObject *bigBedAsOrDefault(struct bbiFile *bbi);
-// Get asObject associated with bigBed - if none exists in file make it up from field counts.
-
-struct asObject *bigBedFileAsObjOrDefault(char *fileName);
-// Get asObject associated with bigBed file, or the default.
-
-boolean bigBedFileCheckSigs(char *fileName);
-/* check file signatures at beginning and end of file */
-
-struct bptFile *bigBedOpenExtraIndex(struct bbiFile *bbi, char *fieldName, int *retFieldIx);
-/* Return index associated with fieldName.  Aborts if no such index.  Optionally return
- * index in a row of this field. */
-
-struct slName *bigBedListExtraIndexes(struct bbiFile *bbi);
-/* Return list of names of extra indexes beyond primary chrom:start-end one" */
-
-#endif /* BIGBED_H */
-
diff --git a/gbtools/src/include/blatSrc/bigWig.h b/gbtools/src/include/blatSrc/bigWig.h
deleted file mode 100644
index 211bf30..0000000
--- a/gbtools/src/include/blatSrc/bigWig.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* bigWig - interface to binary file with wiggle-style values (that is a bunch of
- * small non-overlapping regions each associated with a floating point value. 
- *
- * There are several ways to use this module.   To create a new bigWig file use the
- * bigWigCreate function, which takes as input an ascii file in fixedStep, variableStep
- * or bedGraph format.
- *
- * To get a section of of a bigWig for display on a browser, use the bigWigSummaryArray
- * function, which will fill in an array of doubles with on value for each pixel that
- * you want to display.
- *
- * To read all the data out of a bigWig get the chromosome info with bbiChromList
- * and then fetch all of it for each chromosome using bigWigIntervalQuery.
- *
- * See also the module bbiFile that has a description of they structure of
- * a bigWig file, and lower level routines used to implement this interface.
- */
-
-#ifndef BIGWIG_H
-#define BIGWIG_H
-
-#ifndef BBIFILE
-#include "bbiFile.h"
-#endif
-
-#ifndef BITS_H
-#include "bits.h"
-#endif
-
-void bigWigFileCreateEx(
-	char *inName, 		/* Input file in ascii wiggle format. */
-	char *chromSizes, 	/* Two column tab-separated file: <chromosome> <size>. */
-	int blockSize,		/* Number of items to bundle in r-tree.  1024 is good. */
-	int itemsPerSlot,	/* Number of items in lowest level of tree.  512 is good. */
-	boolean clipDontDie,	/* If TRUE then clip items off end of chrom rather than dying. */
-	boolean compress,	/* If TRUE then compress data. */
-	boolean keepAllChromosomes,	/* If TRUE then store all chromosomes in chromosomal b-tree. */
-	boolean fixedSummaries,	/* If TRUE then impose fixed summary levels. */
-	char *outName);
-/* Convert ascii format wig file (in fixedStep, variableStep or bedGraph format) 
- * to binary big wig format. */
-void bigWigFileCreate(
-	char *inName, 		/* Input file in ascii wiggle format. */
-	char *chromSizes, 	/* Two column tab-separated file: <chromosome> <size>. */
-	int blockSize,		/* Number of items to bundle in r-tree.  1024 is good. */
-	int itemsPerSlot,	/* Number of items in lowest level of tree.  512 is good. */
-	boolean clipDontDie,	/* If TRUE then clip items off end of chrom rather than dying. */
-	boolean compress,	/* If TRUE then compress data. */
-	char *outName);
-/* Convert ascii format wig file (in fixedStep, variableStep or bedGraph format) 
- * to binary big wig format. */
-
-struct bbiFile *bigWigFileOpen(char *fileName);
-/* Open up big wig file.   Free this up with bbiFileClose */
-
-#define bigWigFileClose(a) bbiFileClose(a)
-
-struct bbiInterval *bigWigIntervalQuery(struct bbiFile *bwf, char *chrom, bits32 start, bits32 end,
-	struct lm *lm);
-/* Get data for interval.  Return list allocated out of lm. */
-
-int bigWigIntervalDump(struct bbiFile *bwf, char *chrom, bits32 start, bits32 end, int maxCount,
-	FILE *out);
-/* Print out info on bigWig parts that intersect chrom:start-end.   Set maxCount to 0 if you 
- * don't care how many are printed.  Returns number printed. */
-
-boolean bigWigSummaryArray(struct bbiFile *bwf, char *chrom, bits32 start, bits32 end,
-	enum bbiSummaryType summaryType, int summarySize, double *summaryValues);
-/* Fill in summaryValues with  data from indicated chromosome range in bigWig file.
- * Be sure to initialize summaryValues to a default value, which will not be touched
- * for regions without data in file.  (Generally you want the default value to either
- * be 0.0 or nan(0) depending on the application.)  Returns FALSE if no data
- * at that position. */
-
-boolean bigWigSummaryArrayExtended(struct bbiFile *bwf, char *chrom, bits32 start, bits32 end,
-	int summarySize, struct bbiSummaryElement *summary);
-/* Get extended summary information for summarySize evenely spaced elements into
- * the summary array. */
-
-double bigWigSingleSummary(struct bbiFile *bwf, char *chrom, int start, int end,
-    enum bbiSummaryType summaryType, double defaultVal);
-/* Return the summarized single value for a range. */
-
-boolean isBigWig(char *fileName);
-/* Peak at a file to see if it's bigWig */
-
-boolean bigWigFileCheckSigs(char *fileName);
-/* check file signatures at beginning and end of file */
-
-/* bigWigValsOnChrom - a little system for optimizing bigWig use when doing a pass over the
- * whole chromosome.   How it is used typically is:
- *      struct bigWigValsOnChrom *chromVals = bigWigValsOnChromNew();
- *      for (chrom = chromList; chrom != NULL; chrom = chrom->next)
- *          {
- *          if (bigWigValsOnChromFetchData(chromVals, chrom->name, bigWig))
- *              // do stuff using the valBuf, or covBuf fields which have
- *              // the big wig data unpacked into them. Can use chromSize and chrom too 
- *          }
- *       bigWigValsOnChromFree(&chromVals);  */
-
-struct bigWigValsOnChrom
-/* Object for bulk access a chromosome at a time.  This is faster than
- * doing bigWigInterval queries when you have ~3000 or more queries. */
-     {
-     struct bigWigValsOnChrom *next;
-     char *chrom;	/* Current chromosome. */
-     long chromSize;	/* Size of current chromosome. */
-     long bufSize;	/* Size of allocated buffer */
-     double *valBuf;	/* A value for each base on chrom. Zero where no data. */
-     Bits *covBuf;	/* A bit for each base with data. */
-     };
-
-struct bigWigValsOnChrom *bigWigValsOnChromNew();
-/* Allocate new empty bigWigValsOnChromStructure. */
-
-void bigWigValsOnChromFree(struct bigWigValsOnChrom **pChromVals);
-/* Free up bigWigValsOnChrom */
-
-boolean bigWigValsOnChromFetchData(struct bigWigValsOnChrom *chromVals, char *chrom, 
-	struct bbiFile *bigWig);
-/* Fetch data for chromosome from bigWig. Returns FALSE if not data on that chrom. */
-
-#endif /* BIGWIG_H */
-
diff --git a/gbtools/src/include/blatSrc/binRange.h b/gbtools/src/include/blatSrc/binRange.h
deleted file mode 100644
index 4727dc7..0000000
--- a/gbtools/src/include/blatSrc/binRange.h
+++ /dev/null
@@ -1,120 +0,0 @@
-#ifndef BINRANGE_H
-#define BINRANGE_H
-
-/* binRange Stuff to handle binning - which helps us restrict 
- * our attention to the parts of database that contain info
- * about a particular window on a chromosome. This scheme
- * will work without modification for chromosome sizes up
- * to half a gigaBase.  The finest sized bin is 128k (1<<17).
- * The next coarsest is 8x as big (1<<13).  There's a hierarchy
- * of bins with the chromosome itself being the final bin.
- * Features are put in the finest bin they'll fit in. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#define BINRANGE_MAXEND_512M (512*1024*1024)
-#define _binOffsetOldToExtended  4681
-
-int binLevelsExtended();
-/* Return number of levels to bins. */
-
-int binLevels();
-/* Return number of levels to bins. */
-
-int binFirstShift();
-/* Return amount to shift a number to get to finest bin. */
-
-int binNextShift();
-/* Return amount to shift a number to get to next coarser bin. */
-
-int binOffsetExtended(int level);
-/* Return offset for bins of a given level. */
-
-int binOffset(int level);
-/* Return offset for bins of a given level. */
-
-/*****  And now for some higher level stuff - useful for binning
- *****  things in memory. ******/
-
-int binFromRange(int start, int end);
-/* Given start,end in chromosome coordinates assign it
- * a bin.   There's a bin for each 128k segment, for each
- * 1M segment, for each 8M segment, for each 64M segment,
- * and for each chromosome (which is assumed to be less than
- * 512M.)  A range goes into the smallest bin it will fit in. */
-
-struct binElement
-/* An element in a bin. */
-    {
-    struct binElement *next;
-    int start, end;		/* 0 based, half open range */
-    void *val;			/* Actual bin item. */
-    };
-
-int binElementCmpStart(const void *va, const void *vb);
-/* Compare to sort based on start. */
-
-struct binKeeper
-/* This keeps things in bins in memory */
-    {
-    struct binKeeper *next;
-    int minPos;		/* Minimum position to bin. */
-    int maxPos;		/* Maximum position to bin. */
-    int binCount;	/* Count of bins. */
-    struct binElement **binLists; /* A list for each bin. */
-    };
-
-struct binKeeperCookie
-/* used by binKeeperFirst/binKeeperNext in tracking location in traversing bins */
-    {
-    struct binKeeper *bk;       /* binKeeper we are associated with */
-    int blIdx;                  /* current bin list index */
-    struct binElement *nextBel; /* next binElement */
-    };
-
-struct binKeeper *binKeeperNew(int minPos, int maxPos);
-/* Create new binKeeper that can cover range. */
-
-void binKeeperFree(struct binKeeper **pBk);
-/* Free up a bin keeper. */
-
-void binKeeperAdd(struct binKeeper *bk, int start, int end, void *val);
-/* Add item to binKeeper. */ 
-
-void binKeeperRemove(struct binKeeper *bk, int start, int end, void *val);
-/* Remove item from binKeeper. */ 
-
-struct binElement *binKeeperFind(struct binKeeper *bk, int start, int end);
-/* Return a list of all items in binKeeper that intersect range.
- * Free this list with slFreeList. */
-
-struct binElement *binKeeperFindSorted(struct binKeeper *bk, int start, int end);
-/* Like binKeeperFind, but sort list on start coordinates. */
-
-struct binElement *binKeeperFindAll(struct binKeeper *bk);
-/* Get all elements sorted. */
-
-boolean binKeeperAnyOverlap(struct binKeeper *bk, int start, int end);
-/* Return TRUE if start/end overlaps with any items in binKeeper. */
-
-void binKeeperReplaceVal(struct binKeeper *bk, int start, int end,
-	void *oldVal, void *newVal);
-/* Replace occurences of old val in range from start->end with newVal */
-
-struct binElement *binKeeperFindLowest(struct binKeeper *bk, int start, int end);
-/* Find the lowest overlapping range. Quick even if search range large */
-
-void binKeeperRemove(struct binKeeper *bk, int start, int end, void *val);
-/* Remove item from binKeeper. */ 
-
-struct binKeeperCookie binKeeperFirst(struct binKeeper *bk);
-/* Return an object to use by binKeeperNext() to traverse the binElements.
- * The first call to binKeeperNext() will return the first entry in the
- * table. */
-
-struct binElement* binKeeperNext(struct binKeeperCookie *cookie);
-/* Return the next entry in the binKeeper table.  */
-
-#endif /* BINRANGE_H */
-
diff --git a/gbtools/src/include/blatSrc/bits.h b/gbtools/src/include/blatSrc/bits.h
deleted file mode 100644
index fea9323..0000000
--- a/gbtools/src/include/blatSrc/bits.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* bits - handle operations on arrays of bits. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef BITS_H
-#define BITS_H
-
-#include "localmem.h"
-
-typedef unsigned char Bits;
-
-#define bitToByteSize(bitSize) ((bitSize+7)/8)
-/* Convert number of bits to number of bytes needed to store bits. */
-
-Bits *bitAlloc(int bitCount);
-/* Allocate bits. */
-
-Bits *bitRealloc(Bits *b, int bitCount, int newBitCount);
-/* Resize a bit array.  If b is null, allocate a new array */
-
-Bits *bitClone(Bits* orig, int bitCount);
-/* Clone bits. */
-
-void bitFree(Bits **pB);
-/* Free bits. */
-
-Bits *lmBitAlloc(struct lm *lm,int bitCount);
-// Allocate bits.  Must supply local memory.
-
-Bits *lmBitRealloc(struct lm *lm, Bits *b, int bitCount, int newBitCount);
-// Resize a bit array.  If b is null, allocate a new array.  Must supply local memory.
-
-Bits *lmBitClone(struct lm *lm, Bits* orig, int bitCount);
-// Clone bits.  Must supply local memory.
-
-void bitSetOne(Bits *b, int bitIx);
-/* Set a single bit. */
-
-void bitClearOne(Bits *b, int bitIx);
-/* Clear a single bit. */
-
-void bitSetRange(Bits *b, int startIx, int bitCount);
-/* Set a range of bits. */
-
-boolean bitReadOne(Bits *b, int bitIx);
-/* Read a single bit. */
-
-int bitCountRange(Bits *b, int startIx, int bitCount);
-/* Count number of bits set in range. */
-
-int bitFindSet(Bits *b, int startIx, int bitCount);
-/* Find the index of the the next set bit. */
-
-int bitFindClear(Bits *b, int startIx, int bitCount);
-/* Find the index of the the next clear bit. */
-
-void bitClear(Bits *b, int bitCount);
-/* Clear many bits (possibly up to 7 beyond bitCount). */
-
-void bitClearRange(Bits *b, int startIx, int bitCount);
-/* Clear a range of bits. */
-
-void bitAnd(Bits *a, Bits *b, int bitCount);
-/* And two bitmaps.  Put result in a. */
-
-int bitAndCount(Bits *a, Bits *b, int bitCount);
-// Without altering 2 bitmaps, count the AND bits.
-
-void bitOr(Bits *a, Bits *b, int bitCount);
-/* Or two bitmaps.  Put result in a. */
-
-int bitOrCount(Bits *a, Bits *b, int bitCount);
-// Without altering 2 bitmaps, count the OR'd bits.
-
-void bitXor(Bits *a, Bits *b, int bitCount);
-/* Xor two bitmaps.  Put result in a. */
-
-int bitXorCount(Bits *a, Bits *b, int bitCount);
-// Without altering 2 bitmaps, count the XOR'd bits.
-
-void bitNot(Bits *a, int bitCount);
-/* Flip all bits in a. */
-
-void bitReverseRange(Bits *bits, int startIx, int bitCount);
-// Reverses bits in range (e.g. 110010 becomes 010011)
-
-void bitPrint(Bits *a, int startIx, int bitCount, FILE* out);
-/* Print part or all of bit map as a string of 0s and 1s.  Mostly useful for
- * debugging */
-
-void bitsOut(FILE* out, Bits *bits, int startIx, int bitCount, boolean onlyOnes);
-// Print part or all of bit map as a string of 0s and 1s.
-// If onlyOnes, enclose result in [] and use ' ' instead of '0'.
-
-Bits *bitsIn(struct lm *lm,char *bitString, int len);
-// Returns a bitmap from a string of 1s and 0s.  Any non-zero, non-blank char sets a bit.
-// Returned bitmap is the size of len even if that is longer than the string.
-// Optionally supply local memory.  Note does NOT handle enclosing []s printed with bitsOut().
-
-extern int bitsInByte[256];
-/* Lookup table for how many bits are set in a byte. */
-
-void bitsInByteInit();
-/* Initialize bitsInByte array. */
-
-#endif /* BITS_H */
-
diff --git a/gbtools/src/include/blatSrc/blastParse.h b/gbtools/src/include/blatSrc/blastParse.h
deleted file mode 100644
index c6d87a8..0000000
--- a/gbtools/src/include/blatSrc/blastParse.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* blastParse - read in blast output into C data structure. */
-
-#ifndef BLASTPARSE_H
-#define BLASTPARSE_H
-
-struct blastFile
-/* All the info in a single file. */
-    {
-    struct blastFile *next;
-    char *fileName;			/* Name of file this is in. */
-    char *program;                      /* Blastp, blastx, blastn, etc. */
-    char *version;                      /* Version of program. */
-    char *buildDate;                    /* Build date of program. */
-    struct lineFile *lf;                /* File blast is in. */
-    struct blastQuery *queries;         /* List of queries. */
-    };
-
-struct blastQuery
-/* Info on one query. */
-    {
-    struct blastQuery *next;
-    char *query;                        /* Name of query sequence. */
-    int queryBaseCount;                 /* Number of bases in query. */
-    char *database;                     /* Name of database. */
-    int dbSeqCount;                     /* Number of sequences in database. */
-    int dbBaseCount;                    /* Number of bases in database. */
-    int psiRounds;                      /* PSI BLAST rounds, or 0 if not PSI blast */
-    struct blastGappedAli *gapped;      /* List of gapped alignments. */
-    };
-
-struct blastGappedAli
-/* Info about a gapped alignment. */
-    {
-    struct blastGappedAli *next;
-    struct blastQuery *query;           /* Query associated with this alignment (not owned here). */
-    int psiRound;                       /* PSI BLAST round, or 0 if not PSI blast */
-    char *targetName;                   /* Name of target sequence. */
-    int targetSize;                     /* Size of target sequence. */
-    struct blastBlock *blocks;          /* List of aligning blocks (no big gaps). */
-    };
-
-struct blastBlock
-/* Info about a single block of gapped alignment. */
-    {
-    struct blastBlock *next;
-    struct blastGappedAli *gappedAli;   /* gapped ali associated with block */
-    double bitScore;                    /* About 2 bits per aligning nucleotide. */
-    double eVal;                        /* Expected number of alignments in database. */
-    int matchCount;                     /* Number of matching nucleotides. */
-    int totalCount;                     /* Total number of nucleotides. */
-    int insertCount;                    /* Number of inserts. */
-    BYTE qStrand;                       /* Query strand (+1 or -1) */
-    BYTE tStrand;                       /* Target strand (+1 or -1) */
-    BYTE qFrame;                        /* Frames for tblastn, +/- 1, 2, 3, or */
-    BYTE tFrame;                        /* 0 if none. */
-    int qStart;                         /* Query start position. [0..n) */
-    int tStart;                         /* Target start position. [0..n) */
-    int qEnd;                           /* Query end position. */
-    int tEnd;                           /* Target end position. */
-    char *qSym;                         /* Query letters (including '-') */
-    char *tSym;                         /* Target letters (including '-') */
-    };
-
-struct blastFile *blastFileReadAll(char *fileName);
-/* Read all blast alignment in file. */
-
-struct blastFile *blastFileOpenVerify(char *fileName);
-/* Open file, read and verify header. */
-
-struct blastQuery *blastFileNextQuery(struct blastFile *bf);
-/* Read all alignments associated with next query.  Return NULL at EOF. */
-
-struct blastGappedAli *blastFileNextGapped(struct blastFile *bf, struct blastQuery *bq);
-/* Read in next gapped alignment.   Does *not* put it on bf->gapped list. 
- * Return NULL at EOF or end of query. */
-
-struct blastBlock *blastFileNextBlock(struct blastFile *bf, 
-	struct blastQuery *bq, struct blastGappedAli *bga);
-/* Read in next blast block.  Return NULL at EOF or end of
- * gapped alignment. */
-
-void blastFileFree(struct blastFile **pBf);
-/* Free blast file. */
-
-void blastFileFreeList(struct blastFile **pList);
-/* Free list of blast files. */
-
-void blastQueryFree(struct blastQuery **pBq);
-/* Free single blastQuery. */
-
-void blastQueryFreeList(struct blastQuery **pList);
-/* Free list of blastQuery's. */
-
-void blastGappedAliFree(struct blastGappedAli **pBga);
-/* Free blastGappedAli. */
-
-void blastGappedAliFreeList(struct blastGappedAli **pList);
-/* Free blastGappedAli list. */
-
-void blastBlockFree(struct blastBlock **pBb);
-/* Free a single blastBlock. */
-
-void blastBlockFreeList(struct blastBlock **pList);
-/* Free a list of blastBlocks. */
-
-void blastBlockPrint(struct blastBlock* bb, FILE* out);
-/* print a BLAST block for debugging purposes  */
-
-void blastGappedAliPrint(struct blastGappedAli* ba, FILE* out);
-/* print a BLAST gapped alignment for debugging purposes  */
-
-void blastQueryPrint(struct blastQuery *bq, FILE* out);
-/* print a BLAST query for debugging purposes  */
-
-#endif /* BLASTPARSE_H */
-
diff --git a/gbtools/src/include/blatSrc/boxClump.h b/gbtools/src/include/blatSrc/boxClump.h
deleted file mode 100644
index 93d0c7e..0000000
--- a/gbtools/src/include/blatSrc/boxClump.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* boxClump - put together 2 dimensional boxes that
- * overlap with each other into clumps. */
-
-#ifndef BOXCLUMP_H
-#define BOXCLUMP_H
-
-struct boxIn
-/* Input to box clumper. */
-    {
-    struct boxIn *next;		 /* Next in list. */
-    void *data;			 /* Some user-associated data. */
-    int qStart, qEnd;		 /* Range covered in query. */
-    int tStart, tEnd;		 /* Range covered in target. */
-    };
-
-struct boxClump
-/* Output of box clumper. */
-    {
-    struct boxClump *next;	 /* Next in list. */
-    struct boxIn *boxList;	 /* List of boxes in this clump. */
-    int boxCount;		 /* Count of boxes in this clump. */
-    int qStart, qEnd;		 /* Expanse of clump in query. */
-    int tStart, tEnd;		 /* Expanse of clump in target. */
-    };
-
-void boxClumpFree(struct boxClump **pClump);
-/* Free boxClump. */
-
-void boxClumpFreeList(struct boxClump **pList);
-/* Free list of boxClumps. */
-
-int boxClumpCmpCount(const void *va, const void *vb);
-/* Compare to sort based on count of boxes. */
-
-struct boxClump *boxFindClumps(struct boxIn **pBoxList);
-/* Convert list of boxes to a list of clumps.  Clumps
- * are collections of boxes that overlap.  Note that
- * the original boxList is overwritten as the boxes
- * are moved from it to the clumps. */
-
-#endif /* BOXCLUMP_H */
diff --git a/gbtools/src/include/blatSrc/boxLump.h b/gbtools/src/include/blatSrc/boxLump.h
deleted file mode 100644
index 55d5ae9..0000000
--- a/gbtools/src/include/blatSrc/boxLump.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* boxLump - This will lump together boxes that overlap into the smallest
- * box that encompasses the overlap.  It will put other boxes that 
- * fit in the encompassing box in there too. 
- *   It works by projecting the box list along one dimension at a
- * time looking for gaps between boxes. This is similar in function
- * to boxFindClumps, but a bit less precise, and quite a bit faster.
- * in some important cases. */
-
-#ifndef BOXLUMP_H
-#define BOXLUMP_H
-
-#ifndef BOXCLUMP_H
-#include "boxClump.h"
-#endif
-
-struct boxClump *boxLump(struct boxIn **pBoxList);
-/* Convert list of boxes to a list of lumps.  The lumps
- * are a smaller number of boxes that between them contain
- * all of the input boxes.  Note that
- * the original boxList is overwritten as the boxes
- * are moved from it to the lumps. */
-
-#endif /* BOXLUMP_H */
-
-
diff --git a/gbtools/src/include/blatSrc/bwgInternal.h b/gbtools/src/include/blatSrc/bwgInternal.h
deleted file mode 100644
index d32a475..0000000
--- a/gbtools/src/include/blatSrc/bwgInternal.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* bwgInternal - stuff to create and use bigWig files.  Generally you'll want to use the
- * simpler interfaces in the bigWig module instead.  This file is good reading though
- * if you want to extend the bigWig interface, or work with bigWig files directly
- * without going through the Kent library. */
-
-#ifndef BIGWIGFILE_H
-#define BIGWIGFILE_H
-
-enum bwgSectionType 
-/* Code to indicate section type. */
-    {
-    bwgTypeBedGraph=1,
-    bwgTypeVariableStep=2,
-    bwgTypeFixedStep=3,
-    };
-
-struct bwgBedGraphItem
-/* An bedGraph-type item in a bwgSection. */
-    {
-    struct bwgBedGraphItem *next;	/* Next in list. */
-    bits32 start,end;		/* Range of chromosome covered. */
-    float val;			/* Value. */
-    };
-
-struct bwgVariableStepItem
-/* An variableStep type item in a bwgSection. */
-    {
-    struct bwgVariableStepItem *next;	/* Next in list. */
-    bits32 start;		/* Start position in chromosome. */
-    float val;			/* Value. */
-    };
-
-struct bwgVariableStepPacked
-/* An variableStep type item in a bwgSection. */
-    {
-    bits32 start;		/* Start position in chromosome. */
-    float val;			/* Value. */
-    };
-
-struct bwgFixedStepItem
-/* An fixedStep type item in a bwgSection. */
-    {
-    struct bwgFixedStepItem *next;	/* Next in list. */
-    float val;			/* Value. */
-    };
-
-struct bwgFixedStepPacked
-/* An fixedStep type item in a bwgSection. */
-    {
-    float val;			/* Value. */
-    };
-
-union bwgItem
-/* Union of item pointers for all possible section types. */
-    {
-    struct bwgBedGraphItem *bedGraphList;		/* A linked list */
-    struct bwgFixedStepPacked *fixedStepPacked;		/* An array */
-    struct bwgVariableStepPacked *variableStepPacked;	/* An array */
-    /* No packed format for bedGraph... */
-    };
-
-struct bwgSection
-/* A section of a bigWig file - all on same chrom.  This is a somewhat fat data
- * structure used by the bigWig creation code.  See also bwgSection for the
- * structure returned by the bigWig reading code. */
-    {
-    struct bwgSection *next;		/* Next in list. */
-    char *chrom;			/* Chromosome name. */
-    bits32 start,end;			/* Range of chromosome covered. */
-    enum bwgSectionType type;
-    union bwgItem items;		/* List/array of items in this section. */
-    bits32 itemStep;			/* Step within item if applicable. */
-    bits32 itemSpan;			/* Item span if applicable. */
-    bits16 itemCount;			/* Number of items in section. */
-    bits32 chromId;			/* Unique small integer value for chromosome. */
-    bits64 fileOffset;			/* Offset of section in file. */
-    };
-
-struct bwgSectionHead
-/* A header from a bigWig file section - similar to above bug what is on disk. */
-    {
-    bits32 chromId;	/* Chromosome short identifier. */
-    bits32 start,end;	/* Range covered. */
-    bits32 itemStep;	/* For some section types, the # of bases between items. */
-    bits32 itemSpan;	/* For some section types, the # of bases in each item. */
-    UBYTE type;		/* Type byte. */
-    UBYTE reserved;	/* Always zero for now. */
-    bits16 itemCount;	/* Number of items in block. */
-    };
-
-void bwgSectionHeadFromMem(char **pPt, struct bwgSectionHead *head, boolean isSwapped);
-/* Read section header. */
-
-
-int bwgSectionCmp(const void *va, const void *vb);
-/* Compare to sort based on chrom,start,end.  */
-
-struct bwgSection *bwgParseWig(
-	char *fileName,       /* Name of ascii wig file. */
-	boolean clipDontDie,  /* Skip items outside chromosome rather than aborting. */
-	struct hash *chromSizeHash,  /* If non-NULL items checked to be inside chromosome. */
-	int maxSectionSize,   /* Biggest size of a section.  100 - 100,000 is usual range. */
-	struct lm *lm);	      /* Memory pool to allocate from. */
-/* Parse out ascii wig file - allocating memory in lm. */
-
-int bwgAverageResolution(struct bwgSection *sectionList);
-/* Return the average resolution seen in sectionList. */
-
-struct bbiSummary *bwgReduceSectionList(struct bwgSection *sectionList, 
-	struct bbiChromInfo *chromInfoArray, int reduction);
-/* Return summary of section list reduced by given amount. */
-
-void bwgCreate(struct bwgSection *sectionList, struct hash *chromSizeHash, 
-	int blockSize, int itemsPerSlot, boolean doCompress, boolean keepAllChromosomes,
-        boolean fixedSummaries, char *fileName);
-/* Create a bigWig file out of a sorted sectionList.  A lower level routine
- * than the one above. */
-
-#endif /* BIGWIGFILE_H */
diff --git a/gbtools/src/include/blatSrc/cda.h b/gbtools/src/include/blatSrc/cda.h
deleted file mode 100644
index 049c1f0..0000000
--- a/gbtools/src/include/blatSrc/cda.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* cda.h - cDNA Alignment structure.  This stores all the info except
- * the bases themselves on an cDNA alignment. */
-
-#ifndef CDA_H
-#define CDA_H
-
-#ifndef MEMGFX_H
-#include "memgfx.h"
-#endif 
-
-#ifndef FUZZYFIND_H
-#include "fuzzyFind.h"
-#endif
-
-struct cdaBlock
-    {
-    int nStart, nEnd;           /* Start and end position in cDNA. */
-    int hStart, hEnd;           /* Start and end position on chromosome. */
-    UBYTE startGood, endGood;   /* Number of bases matching perfectly on end */
-    UBYTE midScore;             /* 0-255  255 is perfect. */
-    };
-
-struct cdaAli
-    {
-    struct cdaAli *next;
-    char *name;
-    int baseCount;
-    short milliScore;               /* Score 0-1000 */
-    bits16 chromIx;                 /* On disk as just a UBYTE */
-    char strand;                    /* Strand of chromosome cDNA aligns with + or - */
-    char direction;                 /* Direction of cDNA relative to transcription + or - */
-    UBYTE isEmbryonic;
-    UBYTE hasIntrons;
-    int orientation;                /* +1 or -1 depending on whether *clone* is + or - WRT chrom . */
-                                    /* New and perhaps not always respected. */
-    int chromStart, chromEnd;
-    short blockCount;               /* Number of blocks. */
-    struct cdaBlock *blocks;        /* Dynamically allocated array. */
-    };
-
-boolean cdaCloneIsReverse(struct cdaAli *cda);
-/* Returns TRUE if clone (.3/.5 pair) aligns on reverse strand. */
-
-char cdaCloneStrand(struct cdaAli *cda);
-/* Return '+' or '-' depending on the strand that clone (.3/.5 pair) aligns on. */
-
-char cdaDirChar(struct cdaAli *cda, char chromStrand);
-/* Return '>' or '<' or ' ' depending whether cDNA is going same, opposite, or
- * unknown alignment as the chromosome strand. */
-
-char *cdaLoadString(FILE *f);
-/* Load in a string from CDA file. */
-
-void cdaReadBlock(FILE *f, struct cdaBlock *block);
-/* Read one block from cda file. */
-
-FILE *cdaOpenVerify(char *fileName);
-/* Call this to open file and verify signature, then call cdaLoadOne
- * which returns NULL at EOF. This file type is created by binGood.exe. */
-
-struct cdaAli *cdaLoadOne(FILE *f);
-/* Load one cdaAli from file.  Assumes file pointer is correctly positioned.
- * either by cdaOpenVerify or a previous cdaLoadOne.  Returns NULL at EOF. */
-
-void cdaFixChromStartEnd(struct cdaAli *cda);
-/* Loop through blocks and figure out and fill in chromStart
- * and chromEnd. */
-
-void cdaCoalesceBlocks(struct cdaAli *ca);
-/* Coalesce blocks separated by small amounts of noise. */
-
-void cdaCoalesceFast(struct cdaAli *ca);
-/* Coalesce blocks as above, but don't update the score. */
-
-void cdaShowAlignmentTrack(struct memGfx *mg, 
-    int xOff, int yOff, int width, int height,  Color goodColor, Color badColor,
-    int dnaSize, int dnaOffset, struct cdaAli *cda, char repeatChar);
-/* Draw alignment on a horizontal track of picture. */
-
-void cdaRcOne(struct cdaAli *cda, int dnaStart, int baseCount);
-/* Reverse complement one cda. DnaStart is typically display window start. */
-
-void cdaRcList(struct cdaAli *cdaList, int dnaStart, int baseCount);
-/* Reverse complement cda list. */
-
-void cdaFreeAli(struct cdaAli *ca);
-/* Free a single cdaAli. */
-
-void cdaFreeAliList(struct cdaAli **pList);
-/* Free list of cdaAli. */
-
-struct cdaAli *cdaAliFromFfAli(struct ffAli *aliList, 
-    DNA *needle, int needleSize, DNA *hay, int haySize, boolean isRc);
-/* Convert from ffAli to cdaAli format. */
-
-void cdaWrite(char *fileName, struct cdaAli *cdaList);
-/* Write out a cdaList to a cda file. */
-
-#endif /* CDA_H */
diff --git a/gbtools/src/include/blatSrc/cgi_build_rules.mk b/gbtools/src/include/blatSrc/cgi_build_rules.mk
deleted file mode 100644
index 0bcc251..0000000
--- a/gbtools/src/include/blatSrc/cgi_build_rules.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-#	Common set of build rules for CGI binaries
-
-ifeq (${CGI_BIN_USER},)
-    CGI_BIN_USER=${CGI_BIN}-${USER}
-endif
-
-ifeq (${CGI_BIN_BETA},)
-    CGI_BIN_BETA=${CGI_BIN}-beta
-endif
-
-my:: compile
-	chmod a+rx $A${EXE}
-	rm -f ${CGI_BIN_USER}/$A
-	mv $A${EXE} ${CGI_BIN_USER}/$A
-
-alpha:: strip
-	rm -f ${CGI_BIN}/$A
-	mv $A${EXE} ${CGI_BIN}/$A
-
-beta:: strip
-	rm -f ${CGI_BIN_BETA}/$A
-	mv $A${EXE} ${CGI_BIN_BETA}/$A
-
-# don't actually strip so we can get stack traces
-strip::  compile
-	chmod g+w $A${EXE}
-	chmod a+rx $A${EXE}
-
-install::  strip
-	@if [ ! -d "${DESTDIR}${CGI_BIN}" ]; then \
-		${MKDIR} "${DESTDIR}${CGI_BIN}"; \
-	fi
-	rm -f ${DESTDIR}${CGI_BIN}/$A
-	mv $A${EXE} ${DESTDIR}${CGI_BIN}/$A
-
-debug:: $O
-	${CC} ${COPT} ${CFLAGS} $O ${MYLIBS} ${L}
-	rm -f $A${EXE}
-	mv ${AOUT} $A${EXE}
-
-lib::
-	cd ../../lib; make
-
-clean::
-	rm -f $O $A${EXE}
-
-tags::
-	ctags *.h *.c ../lib/*.c ../inc/*.h ../../lib/*.c ../../inc/*.h
diff --git a/gbtools/src/include/blatSrc/chain.h b/gbtools/src/include/blatSrc/chain.h
deleted file mode 100644
index 6be0f2a..0000000
--- a/gbtools/src/include/blatSrc/chain.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* chain - pairwise alignments that can include gaps in both
- * sequences at once.  This is similar in many ways to psl,
- * but more suitable to cross species genomic comparisons. */
-
-#ifndef CHAIN_H
-#define CHAIN_H
-
-#ifndef LINEFILE_H
-#include "linefile.h"
-#endif
-
-
-#ifndef BITS_H
-#include "bits.h"
-#endif
-
-struct cBlock
-/* A gapless part of a chain. */
-    {
-    struct cBlock *next;	/* Next in list. */
-    int tStart,tEnd;		/* Range covered in target. */
-    int qStart,qEnd;		/* Range covered in query. */
-    int score;	 	 	/* Score of block. */
-    void *data;			/* Some associated data pointer. */
-    };
-
-int cBlockCmpQuery(const void *va, const void *vb);
-/* Compare to sort based on query start. */
-
-int cBlockCmpTarget(const void *va, const void *vb);
-/* Compare to sort based on target start. */
-
-int cBlockCmpBoth(const void *va, const void *vb);
-/* Compare to sort based on query, then target. */
-
-int cBlockCmpDiagQuery(const void *va, const void *vb);
-/* Compare to sort based on diagonal, then query. */
-
-void cBlocksAddOffset(struct cBlock *blockList, int qOff, int tOff);
-/* Add offsets to block list. */
-
-struct cBlock *cBlocksFromAliSym(int symCount, char *qSym, char *tSym, 
-        int qPos, int tPos);
-/* Convert alignment from alignment symbol (bases and dashes) format 
- * to a list of chain blocks.  The qPos and tPos correspond to the start
- * in the query and target sequences of the first letter in  qSym and tSym. */
-
-struct chain
-/* A chain of blocks.  Used for output of chainBlocks. */
-    {
-    struct chain *next;	  	  /* Next in list. */
-    struct cBlock *blockList;      /* List of blocks. */
-    double score;	  	  /* Total score for chain. */
-    char *tName;		  /* target name, allocated here. */
-    int tSize;			  /* Overall size of target. */
-    /* tStrand always + */
-    int tStart,tEnd;		  /* Range covered in target. */
-    char *qName;		  /* query name, allocated here. */
-    int qSize;			  /* Overall size of query. */
-    char qStrand;		  /* Query strand. */
-    int qStart,qEnd;		  /* Range covered in query. */
-    int id;			  /* ID of chain in file. */
-    };
-
-void chainFree(struct chain **pChain);
-/* Free up a chain. */
-
-void chainFreeList(struct chain **pList);
-/* Free a list of dynamically allocated chain's */
-
-int chainCmpScore(const void *va, const void *vb);
-/* Compare to sort based on score. */
-
-int chainCmpScoreDesc(const void *va, const void *vb);
-/* Compare to sort based on score descending. */
-
-int chainCmpTarget(const void *va, const void *vb);
-/* Compare to sort based on target position. */
-
-int chainCmpQuery(const void *va, const void *vb);
-/* Compare to sort based on query chrom and start osition. */
-
-void chainWrite(struct chain *chain, FILE *f);
-/* Write out chain to file in dense format. */
-
-void chainWriteAll(struct chain *chainList, FILE *f);
-/* Write all chains to file. */
-
-void chainWriteLong(struct chain *chain, FILE *f);
-/* Write out chain to file in more verbose format. */
-
-void chainWriteHead(struct chain *chain, FILE *f);
-/* Write chain before block/insert list. */
-
-struct chain *chainRead(struct lineFile *lf);
-/* Read next chain from file.  Return NULL at EOF. 
- * Note that chain block scores are not filled in by
- * this. */
-
-struct chain *chainReadChainLine(struct lineFile *lf);
-/* Read line that starts with chain.  Allocate memory
- * and fill in values.  However don't read link lines. */
-
-void chainReadBlocks(struct lineFile *lf, struct chain *chain);
-/* Read in chain blocks from file. */
-
-void chainIdReset();
-/* Reset chain id. */
-
-void chainIdNext(struct chain *chain);
-/* Add id to chain. */
-
-void chainSwap(struct chain *chain);
-/* Swap target and query side of chain. */
-
-struct hash *chainReadUsedSwap(char *fileName, boolean swapQ, Bits *bits);
-/* Read chains that are marked as used in the 
- * bits array (which may be NULL) into a hash keyed by id. */
-
-struct hash *chainReadAllSwap(char *fileName, boolean swapQ);
-/* Read chains into a hash keyed by id. 
- * Set swapQ to True to read chain by query. */
-    
-struct hash *chainReadAll(char *fileName);
-/* Read chains into a hash keyed by id. */
-    
-struct hash *chainReadAllWithMeta(char *fileName, FILE *f);
-/* Read chains into a hash keyed by id and outputs meta data */
-
-struct chain *chainFind(struct hash *hash, int id);
-/* Find chain in hash, return NULL if not found */
-
-struct chain *chainLookup(struct hash *hash, int id);
-/* Find chain in hash. */
-
-void chainSubsetOnT(struct chain *chain, int subStart, int subEnd, 
-    struct chain **retSubChain,  struct chain **retChainToFree);
-/* Get subchain of chain bounded by subStart-subEnd on 
- * target side.  Return result in *retSubChain.  In some
- * cases this may be the original chain, in which case
- * *retChainToFree is NULL.  When done call chainFree on
- * *retChainToFree.  The score and id fields are not really
- * properly filled in. */
-
-void chainFastSubsetOnT(struct chain *chain, struct cBlock *firstBlock,
-	int subStart, int subEnd, struct chain **retSubChain,  struct chain **retChainToFree);
-/* Get subchain as in chainSubsetOnT. Pass in initial block that may
- * be known from some index to speed things up. */
-
-void chainSubsetOnQ(struct chain *chain, int subStart, int subEnd, 
-    struct chain **retSubChain,  struct chain **retChainToFree);
-/* Get subchain of chain bounded by subStart-subEnd on 
- * query side.  Return result in *retSubChain.  In some
- * cases this may be the original chain, in which case
- * *retChainToFree is NULL.  When done call chainFree on
- * *retChainToFree.  The score and id fields are not really
- * properly filled in. */
-
-void chainRangeQPlusStrand(struct chain *chain, int *retQs, int *retQe);
-/* Return range of bases covered by chain on q side on the plus
- * strand. */
-
-#endif /* CHAIN_H */
diff --git a/gbtools/src/include/blatSrc/chainBlock.h b/gbtools/src/include/blatSrc/chainBlock.h
deleted file mode 100644
index f9158de..0000000
--- a/gbtools/src/include/blatSrc/chainBlock.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* chainBlock - Chain together scored blocks from an alignment
- * into scored chains.  Internally this uses a kd-tree and a
- * varient of an algorithm suggested by Webb Miller and further
- * developed by Jim Kent. */
-
-#ifndef CHAINBLOCK_H
-#define CHAINBLOCK_H
-
-#ifndef CHAIN_H
-#include "chain.h"
-#endif
-
-typedef int (*GapCost)(int dq, int dt, void *gapData);
-/* A function that returns gap cost (gaps can be in both dimensions
- * at once!) */
-
-typedef int (*ConnectCost)(struct cBlock *a, struct cBlock *b, void *gapData);
-/* A function that returns gap cost as well as any penalty
- * from a and b overlapping. */
-
-struct chain *chainBlocks(
-	char *qName, int qSize, char qStrand,	/* Info on query sequence */
-	char *tName, int tSize, 		/* Info on target. */
-	struct cBlock **pBlockList, 		/* Unordered ungapped alignments. */
-	ConnectCost connectCost, 		/* Calculate cost to connect nodes. */
-	GapCost gapCost, 			/* Cost for non-overlapping nodes. */
-	void *gapData, 				/* Passed through to connect/gapCosts */
-	FILE *details);				/* NULL except for debugging */
-/* Create list of chains from list of blocks.  The blockList will get
- * eaten up as the blocks are moved from the list to the chain. 
- * The list of chains returned is sorted by score. 
- *
- * The details FILE may be NULL, and is where additional information
- * about the chaining is put.
- *
- * Note that the connectCost needs to adjust for possibly partially 
- * overlapping blocks, and that these need to be taken out of the
- * resulting chains in general.  This can get fairly complex.  Also
- * the chains will need some cleanup at the end.  Use the chainConnect
- * module to help with this.  See hg/mouseStuff/axtChain for example usage. */
-
-#endif /* CHAINBLOCK_H */
diff --git a/gbtools/src/include/blatSrc/chainConnect.h b/gbtools/src/include/blatSrc/chainConnect.h
deleted file mode 100644
index 0ee85d7..0000000
--- a/gbtools/src/include/blatSrc/chainConnect.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* chainConnect - Modules to figure out cost of connecting two blocks
- * in a chain, and to help clean up overlapping blocks in a chain after
- * main chainBlock call is done. */
-
-#ifndef CHAINCONNECT_H
-#define CHAINCONNECT_H
-
-struct chainConnect
-/* Structure to help figure out chain connection costs. */
-    {
-    struct dnaSeq *query;
-    struct dnaSeq *target;
-    struct axtScoreScheme *ss;
-    struct gapCalc *gapCalc;
-    };
-
-
-int chainConnectCost(struct cBlock *a, struct cBlock *b, 
-	struct chainConnect *cc);
-/* Calculate connection cost - including gap score
- * and overlap adjustments if any. */
-
-int chainConnectGapCost(int dq, int dt, struct chainConnect *cc);
-/* Calculate cost of non-overlapping gap. */
-
-void chainRemovePartialOverlaps(struct chain *chain, 
-	struct dnaSeq *qSeq, struct dnaSeq *tSeq, int matrix[256][256]);
-/* If adjacent blocks overlap then find crossover points between them. */
-
-void chainMergeAbutting(struct chain *chain);
-/* Merge together blocks in a chain that abut each
- * other exactly. */
-
-double chainScoreBlock(char *q, char *t, int size, int matrix[256][256]);
-/* Score block through matrix. */
-
-double chainCalcScore(struct chain *chain, struct axtScoreScheme *ss, 
-	struct gapCalc *gapCalc, struct dnaSeq *query, struct dnaSeq *target);
-/* Calculate chain score freshly. */
-
-double chainCalcScoreSubChain(struct chain *chain, struct axtScoreScheme *ss, 
-	struct gapCalc *gapCalc, struct dnaSeq *query, struct dnaSeq *target);
-/* Calculate chain score assuming query and target 
-   span the chained region rather than entire chrom. */
-
-void chainCalcBounds(struct chain *chain);
-/* Recalculate chain boundaries - setting qStart/qEnd/tStart/tEnd from
- * a scan of blockList. */
-
-void cBlockFindCrossover(struct cBlock *left, struct cBlock *right,
-	struct dnaSeq *qSeq, struct dnaSeq *tSeq,  
-	int overlap, int matrix[256][256], int *retPos, int *retScoreAdjustment);
-/* Find ideal crossover point of overlapping blocks.  That is
- * the point where we should start using the right block rather
- * than the left block.  This point is an offset from the start
- * of the overlapping region (which is the same as the start of the
- * right block). */
-
-#endif /* CHAINCONNECT_H */
-
diff --git a/gbtools/src/include/blatSrc/chainToAxt.h b/gbtools/src/include/blatSrc/chainToAxt.h
deleted file mode 100644
index 3ac938b..0000000
--- a/gbtools/src/include/blatSrc/chainToAxt.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* chainToAxt - convert from chain to axt format. */
-
-#ifndef CHAINTOAXT_H
-#define CHAINTOAXT_H
-
-struct axt *chainToAxt(struct chain *chain, 
-	struct dnaSeq *qSeq, int qOffset,
-	struct dnaSeq *tSeq, int tOffset, int maxGap, int maxChain);
-/* Convert a chain to a list of axt's.  This will break
- * where there is a double-sided gap in chain, or 
- * where there is a single-sided gap greater than maxGap, or 
- * where there is a chain longer than maxChain.
- */
-
-#endif /* CHAINTOAXT_H */
diff --git a/gbtools/src/include/blatSrc/chainToPsl.h b/gbtools/src/include/blatSrc/chainToPsl.h
deleted file mode 100644
index e5ed5b2..0000000
--- a/gbtools/src/include/blatSrc/chainToPsl.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* chainToPsl - convert between chains and psl.  Both of these
- * are alignment formats that can handle gaps in both strands
- * and do not include the sequence itself. */
-
-#ifndef CHAINTOPSL_H
-#define CHAINTOPSL_H
-
-#ifndef PSL_H
-#include "psl.h"
-#endif
-
-#ifndef CHAINBLOCK_H
-#include "chainBlock.h"
-#endif
-
-struct psl *chainToPsl(struct chain *chain);
-/* chainToPsl - convert chain to psl.  This does not fill in
- * the match, repMatch, mismatch, and N fields since it needs
- * the sequence for that.  It does fill in the rest though. */
-
-struct psl *chainToFullPsl(struct chain *chain, 
-	struct dnaSeq *query,   /* Forward query sequence. */
-	struct dnaSeq *rQuery,	/* Reverse complemented query sequence. */
-	struct dnaSeq *target);
-/* Convert chainList to pslList, filling in matches, N's etc. */
-
-#endif /* CHAINTOPSL_H */
-
diff --git a/gbtools/src/include/blatSrc/cheapcgi.h b/gbtools/src/include/blatSrc/cheapcgi.h
deleted file mode 100644
index da6b102..0000000
--- a/gbtools/src/include/blatSrc/cheapcgi.h
+++ /dev/null
@@ -1,564 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* Cheapcgi.h - turns variables passed from the web form into
- * something that C understands. */
-
-#ifndef CHEAPCGI_H
-#define CHEAPCGI_H
-
-#ifndef DYSTRING_H
-#include "dystring.h"
-#endif
-
-#ifndef HASH_H
-#include "hash.h"
-#endif
-
-#define COLOR_BG_DEFAULT         "#FFFEE8"
-#define COLOR_BG_ALTDEFAULT      "#FFF9D2"
-#define COLOR_BG_DEFAULT_DARKER  "#FCECC0"
-#define COLOR_BG_DEFAULT_DARKEST "#EED5B7"
-#define COLOR_BG_GHOST           "#EEEEEE"
-#define COLOR_BG_PALE            "#F8F8F8"
-#define COLOR_BG_HEADER_LTBLUE   "#D9E4F8"
-#define COLOR_DARKGREEN          "#008800"
-#define COLOR_LTGREEN            "#CCFFCC"
-#define COLOR_DARKBLUE           "#000088"
-#define COLOR_BLUE_BUTTON        "#91B3E6"
-#define COLOR_DARKGREY           "#666666"
-#define COLOR_LTGREY             "#CCCCCC"
-#define COLOR_YELLOW             "#FFFF00"
-#define COLOR_LTYELLOW           "#FFF380"
-#define COLOR_WHITE              "#FFFFFF"
-#define COLOR_RED                "#AA0000"
-#define COLOR_TRACKLIST_LEVEL1   COLOR_BG_DEFAULT
-#define COLOR_TRACKLIST_LEVEL2   COLOR_BG_ALTDEFAULT
-#define COLOR_TRACKLIST_LEVEL3   COLOR_BG_DEFAULT_DARKER
-#define COLOR_TRACKLIST_LEVEL4   COLOR_BG_DEFAULT_DARKEST
-
-void initSigHandlers(boolean dumpStack);
-/* set handler for various terminal signals for logging purposes.
- * if dumpStack is TRUE, attempt to dump the stack. */
-
-struct cgiVar
-/* Info on one cgi variable. */
-    {
-    struct cgiVar *next;	/* Next in list. */
-    char *name;			/* Name - allocated in hash. */
-    char *val;  		/* Value - also not allocated here. */
-    boolean saved;		/* True if saved. */
-    };
-
-struct cgiVar* cgiVarList();
-/* return the list of cgiVar's */
-
-struct cgiDictionary
-/* Stuff to encapsulate parsed out CGI vars. */
-    {
-    struct cgiDictionary *next;	    /* Next in list if we have multiple */
-    char *stringData;		    /* Where values if cgi-vars live. */
-    struct hash *hash;		    /* Keyed by cgi-var name, value is cgiVar */
-    struct cgiVar *list;	    /* List of all vars. */
-    };
-
-void cgiDictionaryFree(struct cgiDictionary **pD);
-/* Free up resources associated with dictionary. */
-
-void cgiDictionaryFreeList(struct cgiDictionary **pList);
-/* Free up a whole list of cgiDictionaries */
-
-struct cgiDictionary *cgiDictionaryFromEncodedString(char *encodedString);
-/* Giving a this=that&this=that string,  return cgiDictionary parsed out from it. 
- * This does *not* destroy input like the lower level cgiParse functions do. */
-
-char *findCookieData(char *varName);
-/* Get the string associated with varName from the cookie string. */
-
-void dumpCookieList();
-/* Print out the cookie list. */
-
-boolean cgiIsOnWeb();
-/* Return TRUE if looks like we're being run as a CGI. */
-
-char *cgiRequestMethod();
-/* Return CGI REQUEST_METHOD (such as 'GET/POST/PUT/DELETE/HEAD') */
-
-char *cgiRequestUri();
-/* Return CGI REQUEST_URI */
-
-char *cgiRequestContentLength();
-/* Return HTTP REQUEST CONTENT_LENGTH if available*/
-
-char *cgiScriptName();
-/* Return name of script so libs can do context-sensitive stuff. */
-
-char *cgiServerName();
-/* Return name of server, better to use cgiServerNamePort() for
-   actual URL construction */
-
-char *cgiServerPort();
-/* Return port number of server */
-
-char *cgiServerNamePort();
-/* Return name of server with port if different than 80 */
-
-boolean cgiServerHttpsIsOn();
-/* Return true if HTTPS is on */
-
-char *cgiAppendSForHttps();
-/* if running on https, add the letter s to the url protocol */
-
-char *cgiRemoteAddr();
-/* Return IP address of client (or "unknown"). */
-
-char *cgiUserAgent();
-/* Return remote user agent (HTTP_USER_AGENT) or NULL if remote user agent is not known */
-
-enum browserType
-/* How to look at a track. */
-    {
-    btUnknown=0, // Not yet known
-    btOpera=1,   // Opera
-    btIE=2,      // MS Internet Explorer
-    btFF=3,      // Firefox
-    btChrome=4,  // Google Chrome
-    btSafari=5,  // Safari
-    btOther=6    // Anything else
-    };
-
-enum osType
-/* How to look at a track. */
-    {
-    osUnknown=0, // Not yet known
-    osWindows=1, // The evil empire
-    osLinux=2,   // Workhorse
-    osMac=3,     // ashion or Religion
-    osOther=4    // Anything else
-    };
-
-enum browserType cgiClientBrowser(char **browserQualifier, enum osType *clientOs, 
-                                  char **clientOsQualifier);
-/* These routines abort the html output if the input isn't
- * there or is misformatted. */
-#define cgiBrowser() cgiClientBrowser(NULL,NULL,NULL)
-
-char *cgiString(char *varName);
-int cgiInt(char *varName);
-double cgiDouble(char *varName);
-
-boolean cgiBoolean(char *varName);
-/* The cgiBoolean is a little problematic.  If the variable
- * is TRUE it exists, but if it is false it is simply not
- * defined.   cgiBoolean() thus returns FALSE if the CGI
- * variable doesn't exist or if it is set to FALSE.  To
- * work around this when need be use cgiBooleanDefined(),
- * which relies on the fact that when we define a boolean
- * variable we also define a hidden variable. */
-
-boolean cgiBooleanDefined(char *name);
-/* Return TRUE if boolean variable is defined (by
- * checking for shadow). */
-
-char *cgiBooleanShadowPrefix();
-/* Prefix for shadow variable set with boolean variables. */
-
-void cgiMakeHiddenBoolean(char *name, boolean on);
-/* Make hidden boolean variable. Also make a shadow hidden variable so we
- * can distinguish between variable not present and
- * variable set to false. */
-
-char *cgiMultListShadowPrefix();
-/* Prefix for shadow variable set with multi-select inputs. */
-
-int cgiIntExp(char *varName);
-/* Evaluate an integer expression in varName and
- * return value. */
-
-char *cgiOptionalString(char *varName);
-/* Return value of string if it exists in cgi environment, else NULL */
-
-char *cgiUsualString(char *varName, char *usual);
-/* Return value of string if it exists in cgi environment.
- * Otherwiser return 'usual' */
-
-struct slName *cgiStringList(char *varName);
-/* Find list of cgi variables with given name.  This
- * may be empty.  Free result with slFreeList(). */
-
-int cgiOptionalInt(char *varName, int defaultVal);
-/* This returns value of varName if it exists in cgi environment,
- * otherwise it returns defaultVal. */
-
-double cgiOptionalDouble(char *varName, double defaultVal);
-/* Returns double value. */
-
-#define cgiUsualInt cgiOptionalInt
-#define cgiUsualDouble cgiOptionalDouble
-
-struct cgiChoice
-/* Choice table */
-    {
-    char *name;
-    int value;
-    };
-
-int cgiOneChoice(char *varName, struct cgiChoice *choices, int choiceSize);
-/* Returns value associated with string variable in choice table. */
-
-boolean cgiVarExists(char *varName);
-/* Returns TRUE if the variable was passed in. */
-
-void cgiBadVar(char *varName);
-/* Complain about a variable that's not there. */
-
-void cgiDecode(char *in, char *out, int inLength);
-/* Decode from cgi pluses-for-spaces format to normal.
- * Out will be a little shorter than in typically. */
-
-void cgiDecodeFull(char *in, char *out, int inLength);
-/* Out will be a cgi-decoded version of in (no space from plus!).
- * Out will be a little shorter than in typically, and
- * can be the same buffer. */
-
-char *cgiEncode(char *inString);
-/* Return a cgi-encoded version of inString.
- * Alphanumerics kept as is, space translated to plus,
- * and all other characters translated to %hexVal.
- * You can free return value with freeMem(). */
-
-char *cgiEncodeFull(char *inString);
-/* Return a cgi-encoded version of inString (no + for space!).
- * Alphanumerics/./_ kept as is and all other characters translated to
- * %hexVal. */
-
-void cgiMakeButtonWithMsg(char *name, char *value, char *msg);
-/* Make 'submit' type button. Display msg on mouseover, if present*/
-
-void cgiMakeButtonWithOnClick(char *name, char *value, char *msg, char *onClick);
-/* Make 'submit' type button, with onclick javascript */
-
-void cgiMakeButton(char *name, char *value);
-/* Make 'submit' type button. */
-
-void cgiMakeOnClickButton(char *command, char *value);
-/* Make 'push' type button with client side onClick (java)script. */
-
-void cgiMakeOnClickSubmitButton(char *command, char *name, char *value);
-/* Make submit button with both variable name and value with client side
- * onClick (java)script. */
-
-void cgiMakeOptionalButton(char *name, char *value, boolean disabled);
-/* Make 'submit' type button that can be disabled. */
-
-void cgiMakeRadioButton(char *name, char *value, boolean checked);
-/* Make radio type button.  A group of radio buttons should have the
- * same name but different values.   The default selection should be
- * sent with checked on. */
-
-void cgiMakeOnClickRadioButton(char *name, char *value, boolean checked,
-                                        char *command);
-/* Make radio type button with onClick command.
- *  A group of radio buttons should have the
- * same name but different values.   The default selection should be
- * sent with checked on. */
-
-void cgiMakeCheckBoxUtil(char *name, boolean checked, char *msg, char *id);
-/* Make check box - can be called directly, though it was originally meant
- * as the common code for all lower level checkbox routines.
- * However, it's util functionality has been taken over by
- * cgiMakeCheckBoxWithIdAndOptionalHtml() */
-
-void cgiMakeCheckBox(char *name, boolean checked);
-/* Make check box. */
-
-void cgiMakeCheckBoxWithMsg(char *name, boolean checked, char *msg);
-/* Make check box, which includes a msg. */
-
-void cgiMakeCheckBoxWithId(char *name, boolean checked, char *id);
-/* Make check box, which includes an ID. */
-
-void cgiMakeCheckBoxJS(char *name, boolean checked, char *javascript);
-/* Make check box with javascript */
-
-void cgiMakeCheckBoxIdAndJS(char *name, boolean checked, char *id, char *javascript);
-/* Make check box with ID and javascript. */
-
-void cgiMakeCheckBoxFourWay(char *name, boolean checked, boolean enabled, char *id, 
-                            char *classes, char *moreHtml);
-/* Make check box - with fourWay functionality (checked/unchecked by enabled/disabled
- * Also makes a shadow hidden variable that supports the 2 boolean states. */
-
-void cgiMakeTextArea(char *varName, char *initialVal, int rowCount, int columnCount);
-/* Make a text area with area rowCount X columnCount and with text: intialVal. */
-
-void cgiMakeTextAreaDisableable(char *varName, char *initialVal, int rowCount, int columnCount, boolean disabled);
-/* Make a text area that can be disabled. The rea has rowCount X
- * columnCount and with text: intialVal */
-
-void cgiMakeTextVar(char *varName, char *initialVal, int charSize);
-/* Make a text control filled with initial value.  If charSize
- * is zero it's calculated from initialVal size. */
-
-void cgiMakeTextVarWithExtraHtml(char *varName, char *initialVal, int width, char *extra);
-/* Make a text control filled with initial value. */
-
-void cgiMakeOnKeypressTextVar(char *varName, char *initialVal, int charSize,
-			      char *script);
-/* Make a text control filled with initial value, with a (java)script
- * to execute every time a key is pressed.  If charSize is zero it's
- * calculated from initialVal size. */
-
-void cgiMakeIntVar(char *varName, int initialVal, int maxDigits);
-/* Make a text control filled with initial integer value.  */
-
-#define NO_VALUE            -96669
-void cgiMakeIntVarInRange(char *varName, int initialVal, char *title, int width, 
-                          char *min, char *max);
-/* Make a integer control filled with initial value.
-   If min and/or max are non-NULL will enforce range
-   Requires utils.js jQuery.js and inputBox class */
-void cgiMakeIntVarWithLimits(char *varName, int initialVal, char *title, int width, 
-                             int min, int max);
-void cgiMakeIntVarWithMin(char *varName, int initialVal, char *title, int width, int min);
-void cgiMakeIntVarWithMax(char *varName, int initialVal, char *title, int width, int max);
-#define cgiMakeIntVarNoLimits(varName,initialVal,title,width) \
-        cgiMakeIntVarInRange(varName,initialVal,title,width,NULL,NULL)
-/* All four of these call cgiMakeIntVarInRange() and therefore require utils.js */
-
-void cgiMakeDoubleVar(char *varName, double initialVal, int maxDigits);
-/* Make a text control filled with initial floating-point value.  */
-
-void cgiMakeDoubleVarInRange(char *varName, double initialVal, char *title, int width, 
-                             char *min, char *max);
-/* Make a floating point control filled with initial value.
-   If min and/or max are non-NULL will enforce range
-   Requires utils.js jQuery.js and inputBox class */
-void cgiMakeDoubleVarWithLimits(char *varName, double initialVal, char *title, int width, 
-                                double min, double max);
-void cgiMakeDoubleVarWithMin(char *varName, double initialVal, char *title, int width, double min);
-void cgiMakeDoubleVarWithMax(char *varName, double initialVal, char *title, int width, double max);
-#define cgiMakeDoubleVarNoLimits(varName,initialVal,title,width) \
-        cgiMakeDoubleVarInRange(varName,initialVal,title,width,NULL,NULL)
-/* All four of these call cgiMakeDoubleVarInRange() and therefore require utils.js */
-
-void cgiMakeDropListClass(char *name, char *menu[], int menuSize, char *checked, char *class);
-/* Make a drop-down list with names and style sheet class. */
-
-void cgiMakeDropList(char *name, char *menu[], int menuSize, char *checked);
-/* Make a drop-down list with names.
- * uses style "normalText" */
-
-void cgiMakeDropListClassWithStyleAndJavascript(char *name, char *menu[],
-                                                int menuSize, char *checked, char *class,
-                                                char *style,char *javascript);
-/* Make a drop-down list with names, text class, style and javascript. */
-
-void cgiMakeDropListClassWithStyle(char *name, char *menu[],
-	int menuSize, char *checked, char *class, char *style);
-/* Make a drop-down list with names, text class and style. */
-
-void cgiMakeDropListWithVals(char *name, char *menu[], char *values[],
-                         int menuSize, char *checked);
-/* Make a drop-down list with names and values. In this case checked
- * corresponds to a value, not a menu. */
-
-void cgiMakeDropListFull(char *name, char *menu[], char *values[], int menuSize, char *checked, char *extraAttribs);
-/* Make a drop-down list with names and values. */
-
-void cgiDropDownWithTextValsAndExtra(char *name, char *text[], char *values[],
-                                     int count, char *selected, char *extra);
-/* Make a drop-down list with both text and values. */
-
-char *cgiMakeSelectDropList(boolean multiple, char *name, struct slPair *valsAndLabels,
-                            char *selected, char *anyAll,char *extraClasses, char *extraHtml);
-// Returns allocated string of HTML defining a drop-down select
-// (if multiple, REQUIRES ui-dropdownchecklist.js)
-// valsAndLabels: val (pair->name) must be filled in but label (pair->val) may be NULL.
-// selected: if not NULL is a val found in the valsAndLabels (multiple then comma delimited list).
-//           If null and anyAll not NULL, that will be selected
-// anyAll: if not NULL is the string for an initial option. It can contain val and label,
-//         delimited by a comma
-// extraHtml: if not NULL contains id, javascript calls and style.
-//            It does NOT contain class definitions
-#define cgiMakeMultiSelectDropList(name,valsAndLabels,selected,anyAll,extraClasses,extraHtml) \
-        cgiMakeSelectDropList(TRUE,(name),(valsAndLabels),(selected),(anyAll),\
-                              (extraClasses),(extraHtml))
-#define cgiMakeSingleSelectDropList(name,valsAndLabels,selected,anyAll,extraClasses,extraHtml) \
-        cgiMakeSelectDropList(FALSE,(name),(valsAndLabels),(selected),(anyAll),\
-                              (extraClasses),(extraHtml))
-
-void cgiMakeMultList(char *name, char *menu[], int menuSize, struct slName *checked, int length);
-/* Make a list of names which can have multiple selections.
- * Same as drop-down list except "multiple" is added to select tag */
-
-void cgiMakeCheckboxGroup(char *name, char *menu[], int menuSize, struct slName *checked,
-			  int tableColumns);
-/* Make a table of checkboxes that have the same variable name but different
- * values (same behavior as a multi-select input). */
-
-void cgiMakeCheckboxGroupWithVals(char *name, char *menu[], char *values[], int menuSize,
-				  struct slName *checked, int tableColumns);
-/* Make a table of checkboxes that have the same variable name but different
- * values (same behavior as a multi-select input), with nice labels in menu[]. */
-
-void cgiMakeHiddenVarWithExtra(char *varName, char *string, char *extra);
-/* Store string in hidden input for next time around. */
-
-#define cgiMakeHiddenVar(name,val) cgiMakeHiddenVarWithExtra((name),(val),NULL)
-/* Store string in hidden input for next time around. */
-
-void cgiContinueHiddenVar(char *varName);
-/* Write CGI var back to hidden input for next time around.
- * (if it exists). */
-
-void cgiContinueAllVars();
-/* Write back all CGI vars as hidden input for next time around. */
-
-void cgiVarExclude(char *varName);
-/* If varName exists, remove it. */
-
-void cgiVarExcludeExcept(char **varNames);
-/* Exclude all variables except for those in NULL
- * terminated array varNames.  varNames may be NULL
- * in which case nothing is excluded. */
-
-void cgiVarSet(char *varName, char *val);
-/* Set a cgi variable to a particular value. */
-
-struct dyString *cgiUrlString();
-/* Get URL-formatted that expresses current CGI variable state. */
-
-void cgiEncodeIntoDy(char *var, char *val, struct dyString *dy);
-/* Add a CGI-encoded &var=val string to dy. */
-
-boolean cgiSpoof(int *pArgc, char *argv[]);
-/* Use the command line to set up things as if we were a CGI program.
- * User types in command line (assuming your program called cgiScript)
- * like:
- *        cgiScript nonCgiArg1 var1=value1 var2=value2 var3=value3 nonCgiArg2
- * or like
- *        cgiScript nonCgiArg1 var1=value1&var2=value2&var3=value3 nonCgiArg2
- * (The non-cgi arguments can occur anywhere.  The cgi arguments (all containing
- * the character '=') are erased from argc/argv.  Normally you call this
- *        cgiSpoof(&argc, argv);
- */
-
-boolean cgiFromCommandLine(int *pArgc, char *argv[], boolean preferWeb);
-/* Use the command line to set up things as if we were a CGI program.
- * If preferWeb is TRUE will choose real CGI variables over command
- * line ones. */
-
-void useTempFile();
-/* tell cheapcgi to use temp files */
-
-boolean cgiFromFile(char *fileName);
-/* Set up a cgi environment using parameters stored in a file.
- * Takes file with arguments in the form:
- *       argument1=someVal
- *       # This is a comment
- *       argument2=someOtherVal
- *       ...
- * and puts them into the cgi environment so that the usual
- * cgiGetVar() commands can be used. Useful when a program
- * has a lot of possible parameters.
- */
-
-boolean cgiParseInput(char *input, struct hash **retHash,
-	struct cgiVar **retList);
-/* Parse cgi-style input into a hash table and list.  This will alter
- * the input data.  The hash table will contain references back
- * into input, so please don't free input until you're done with
- * the hash. Prints message and returns FALSE if there's an error.
- * To clean up - slFreeList, hashFree, and only then free input. */
-
-void cgiParseInputAbort(char *input, struct hash **retHash,
-        struct cgiVar **retList);
-/* Parse cgi-style input into a hash table and list as above but abort if there's an error. */
-
-char *cgiStringNewValForVar(char *cgiIn, char *varName, char *newVal);
-/* Return a cgi-encoded string with newVal in place of what was oldVal.
- * It is an error for var not to exist.   Do a freeMem of this string
- * when you are through. */
-
-void cgiSimpleTableStart();
-/* start HTML table  -- no customization. Leaves room
- * for a fancier implementation */
-
-void cgiTableEnd();
-/* end HTML table */
-
-void cgiMakeSubmitButton();
-/* Make 'submit' type button. */
-
-void cgiMakeResetButton();
-/* Make 'reset' type button. */
-
-void cgiMakeClearButton(char *form, char *field);
-/* Make button to clear a text field. */
-
-void cgiMakeFileEntry(char *name);
-/* Make file entry box/browser */
-
-void cgiSimpleTableRowStart();
-/* Start table row */
-
-void cgiTableRowEnd();
-/* End table row */
-
-void cgiSimpleTableFieldStart();
-/* Start table field */
-
-void cgiTableFieldStartAlignRight();
-/* Start table field */
-
-void cgiTableFieldEnd();
-/* End table field */
-
-void cgiTableField(char *text);
-/* Make table field entry */
-
-void cgiTableFieldWithMsg(char *text, char *msg);
-/* Make table field entry with mouseover */
-
-void cgiParagraph(char *text);
-/* Make text paragraph */
-
-void logCgiToStderr();
-/* Log useful CGI info to stderr */
-
-void cgiResetState();
-/* This is for reloading CGI settings multiple times in the same program
- * execution.  No effect if state has not yet been initialized. */
-
-void cgiDown(float lines);
-// Drop down a certain number of lines (may be fractional)
-
-char *commonCssStyles();
-/* Returns a string of common CSS styles */
-
-char *javaScriptLiteralEncode(char *inString);
-/* Use backslash escaping on newline
- * and quote chars, backslash and others.
- * Intended that the encoded string will be
- * put between quotes at a higher level and
- * then interpreted by Javascript. */
-
-struct cgiParsedVars
-/* A parsed out cgi variable string */
-    {
-    struct cgiParsedVars *next;	/* In case want to make a list of these. */
-    char *stringBuf;		/* Holds strings inside vars. */
-    struct cgiVar *list;    /* List of variables. */
-    struct hash *hash;	    /* Keyed by varName, value is just value, not cgiVar. */
-    };
-
-struct cgiParsedVars *cgiParsedVarsNew(char *cgiString);
-/* Build structure containing parsed out cgiString */
-
-void cgiParsedVarsFree(struct cgiParsedVars **pTags);
-/* Free up memory associated with cgiParsedVars */
-
-#endif /* CHEAPCGI_H */
diff --git a/gbtools/src/include/blatSrc/cirTree.h b/gbtools/src/include/blatSrc/cirTree.h
deleted file mode 100644
index f30fcd2..0000000
--- a/gbtools/src/include/blatSrc/cirTree.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* cirTree chromosome id r tree.  Part of a system to index chromosome ranges - things of
- * form chrN:start-end.  Generally you'll be using the crTree module - which
- * makes use of this module and the bPlusTree module - rather than this module directly.
- * This module works with chromosomes mapped to small integers rather than chromosomes
- * as strings, saving space and speeding things up in the process, but requiring the
- * separate bPlusTree to map the names to IDs. 
- *   This module implements a one dimensional R-tree index treating the chromosome ID
- * as the most significant part of a two-part key, and the base position as the least 
- * significant part of the key.  */
-
-#ifndef CIRTREE_H
-#define CIRTREE_H
-
-struct cirTreeFile
-/* R tree index file handle. */
-    {
-    struct cirTreeFile *next;	/* Next in list of index files if any. */
-    char *fileName;		/* Name of file - for error reporting. */
-    struct udcFile *udc;			/* Open file pointer. */
-    boolean isSwapped;		/* If TRUE need to byte swap everything. */
-    bits64 rootOffset;		/* Offset of root block. */
-    bits32 blockSize;		/* Size of block. */
-    bits64 itemCount;		/* Number of items indexed. */
-    bits32 startChromIx;	/* First chromosome in file. */
-    bits32 startBase;		/* Starting base position. */
-    bits32 endChromIx;		/* Ending chromosome in file. */
-    bits32 endBase;		/* Ending base position. */
-    bits64 fileSize;		/* Total size of index file. */
-    bits32 itemsPerSlot;	/* Max number of items to put in each index slot at lowest level. */
-    };
-
-struct cirTreeFile *cirTreeFileOpen(char *fileName);
-/* Open up r-tree index file - reading header and verifying things. */
-
-void cirTreeFileClose(struct cirTreeFile **pCrt);
-/* Close and free up cirTree file opened with cirTreeFileAttach. */
-
-struct cirTreeFile *cirTreeFileAttach(char *fileName, struct udcFile *udc);
-/* Open up r-tree index file on previously open file, with cirTree
- * header at current file position. */
-
-void cirTreeFileDetach(struct cirTreeFile **pCrt);
-/* Detach and free up cirTree file opened with cirTreeFileAttach. */
-
-struct fileOffsetSize *cirTreeFindOverlappingBlocks(struct cirTreeFile *crf, 
-	bits32 chromIx, bits32 start, bits32 end);
-/* Return list of file blocks that between them contain all items that overlap
- * start/end on chromIx.  Also there will be likely some non-overlapping items
- * in these blocks too. When done, use slListFree to dispose of the result. */
-
-struct fileOffsetSize *cirTreeEnumerateBlocks(struct cirTreeFile *crf);
-/* Return list of file blocks. When done, use slListFree to dispose of the result. */
-
-struct cirTreeRange
-/* A chromosome id and an interval inside it. */
-    {
-    bits32 chromIx;	/* Chromosome id. */
-    bits32 start;	/* Start position in chromosome. */
-    bits32 end;		/* One past last base in interval in chromosome. */
-    };
-
-void cirTreeFileBulkIndexToOpenFile(
-	void *itemArray, int itemSize, bits64 itemCount, 
-	bits32 blockSize, bits32 itemsPerSlot,
-	void *context,
-	struct cirTreeRange (*fetchKey)(const void *va, void *context),
-	bits64 (*fetchOffset)(const void *va, void *context), 
-	bits64 endFileOffset, FILE *f);
-/* Create a r tree index from a sorted array, writing output starting at current position
- * of an already open file.  See cirTreeFileCreate for explanation of parameters. */
-
-void cirTreeFileCreate(
-	void *itemArray, 	/* Sorted array of things to index.  Sort on chromIx,start. */
-	int itemSize, 		/* Size of each element in array. */
-	bits64 itemCount, 	/* Number of elements in array. */
-	bits32 blockSize,	/* R tree block size - # of children for each node. */
-	bits32 itemsPerSlot,	/* Number of items to put in each index slot at lowest level. */
-	void *context,		/* Context pointer for use by fetch call-back functions. */
-	struct cirTreeRange (*fetchKey)(const void *va, void *context),/* Given item, return key. */
-	bits64 (*fetchOffset)(const void *va, void *context), /* Given item, return file offset */
-	bits64 endFileOffset,				 /* Last position in file we index. */
-	char *fileName);                                 /* Name of output file. */
-/* Create a r tree index file from a sorted array. */
-
-#endif /* CIRTREE_H */
diff --git a/gbtools/src/include/blatSrc/codebias.h b/gbtools/src/include/blatSrc/codebias.h
deleted file mode 100644
index f9b3e00..0000000
--- a/gbtools/src/include/blatSrc/codebias.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* codebias.h - stuff for managing codon bias and finding frame. */
-#ifndef CODEBIAS_H
-#define CODEBIAS_H
-
-#ifndef DNAUTIL_H
-#include "dnautil.h"
-#endif
-
-
-struct codonBias
-/* Tendency of codons to occur in a particular region. 
- * Tables are in scaled log probability format. */
-    {
-    int mark0[64];
-    int mark1[64][64];
-    };
-
-struct codonBias *codonLoadBias(char *fileName);
-/* Create scaled log codon bias tables based on .cod file.  
- * You can freeMem it when you're done. */
-
- int codonFindFrame(DNA *dna, int dnaSize, struct codonBias *forBias);
-/* Assuming a stretch of DNA is an exon, find most likely frame that it's in. 
- * Beware this routine will replace N's with T's in the input dna.*/
-
-
-#endif /* CODEBIAS_H */
-
diff --git a/gbtools/src/include/blatSrc/common.h b/gbtools/src/include/blatSrc/common.h
deleted file mode 100644
index 35c32d3..0000000
--- a/gbtools/src/include/blatSrc/common.h
+++ /dev/null
@@ -1,1483 +0,0 @@
-/* Common.h - functions that are commonly used.  Includes
- * routines for managing singly linked lists, some basic
- * string manipulation stuff, and other stuff of the
- * short but useful nature.
- *
- * This file is copyright 2002-2005 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef COMMON_H	/* Wrapper to avoid including this twice. */
-#define COMMON_H
-
-/* Some stuff to support large files in Linux. */
-#ifndef _LARGEFILE_SOURCE
-#define _LARGEFILE_SOURCE 1
-#endif
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#ifndef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS 64
-#endif
-
-/* Some stuff for safer pthreads. */
-#ifndef _REENTRANT
-#define _REENTRANT
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <strings.h>
-#include <fcntl.h>
-#include <assert.h>
-#include <setjmp.h>
-#include <time.h>
-#include <math.h>
-#include <errno.h>
-#include <unistd.h>
-#include <libgen.h>
-
-#if defined(MACHTYPE_ppc)
-#include <sys/wait.h>
-#endif
-
-#if defined(__APPLE__)
-#if defined(__i686__)
-/* The i686 apple math library defines warn. */
-#define warn jkWarn
-#endif
-#endif
-
-#ifdef __CYGWIN32__
-#include <mingw/math.h>
-#endif
-
-#ifndef NAN
-#define NAN (0.0 / 0.0)
-#endif
-
-#ifndef WIFEXITED
-#define WIFEXITED(stat)  (((*((int *) &(stat))) & 0xff) == 0)
-#endif
-
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(stat) (short)(((*((int *) &(stat))) >> 8) & 0xffff)
-#endif
-
-#ifndef WIFSIGNALED
-#define WIFSIGNALED(stat) (((*((int *) &(stat)))) && ((*((int *) &(stat))) == ((*((int *) &(stat))) &0x00ff)))
-#endif
-
-#ifndef WTERMSIG
-#define WTERMSIG(stat)    ((*((int *) &(stat))) & 0x7f)
-#endif
-
-#ifndef WIFSTOPPED
-#define WIFSTOPPED(stat)  (((*((int *) &(stat))) & 0xff) == 0177)
-#endif
-
-#ifndef WSTOPSIG
-#define WSTOPSIG(stat)    (((*((int *) &(stat))) >> 8) & 0xff)
-#endif
-
-#ifndef HUGE
-#define HUGE MAXFLOAT
-#endif
-
-
-/* Let's pretend C has a boolean type. */
-#define TRUE 1
-#define FALSE 0
-#define boolean int
-#ifndef	__cplusplus
-#ifndef bool
-#define bool char
-#endif
-#endif
-
-/* Some other type synonyms */
-#define UBYTE unsigned char   /* Wants to be unsigned 8 bits. */
-#define BYTE signed char      /* Wants to be signed 8 bits. */
-#define UWORD unsigned short  /* Wants to be unsigned 16 bits. */
-#define WORD short	      /* Wants to be signed 16 bits. */
-#define bits64 unsigned long long  /* Wants to be unsigned 64 bits. */
-#define bits32 unsigned       /* Wants to be unsigned 32 bits. */
-#define bits16 unsigned short /* Wants to be unsigned 16 bits. */
-#define bits8 unsigned char   /* Wants to be unsigned 8 bits. */
-#define signed32 int	      /* Wants to be signed 32 bits. */
-#define bits8 unsigned char   /* Wants to be unsigned 8 bits. */
-
-#define BIGNUM 0x3fffffff	/* A really big number */
-#define BIGDOUBLE 1.7E+308	/* Close to biggest double-precision number */
-
-#define LIMIT_2or8GB (2147483647 * ((sizeof(size_t)/4)*(sizeof(size_t)/4)))
-/*      == 2 Gb for 32 bit machines, 8 Gb for 64 bit machines */
-#define LIMIT_2or6GB (2147483647 + (2147483647 * ((sizeof(size_t)/4)-1)) + \
-	(2147483647 * ((sizeof(size_t)/4)-1)))
-/*      == 2 Gb for 32 bit machines, 6 Gb for 64 bit machines */
-
-/* Default size of directory path, file name and extension string buffers */
-#define PATH_LEN 512
-#define FILENAME_LEN 128
-#define FILEEXT_LEN 64
-
-/* inline functions: To declare a function inline, place the entire function
- * in a header file and prefix it with the INLINE macro.  If used with a
- * compiler that doesn't support inline, change the INLINE marco to be simply
- * `static'.
- */
-#ifndef INLINE
-#define INLINE static inline
-#endif
-
-/* stdargs compatibility: in a unix universe a long time ago, types of va_list
- * were passed by value.  It was assume one could do things like:
- *
- *     va_start(args);
- *     vfprintf(fh1, fmt, args);
- *     vfprintf(fh2, fmt, args);
- *     va_end(args);
- *
- * and life would good.  However this is not true on some modern systems (for
- * instance gcc/glibc on x86_64), where va_args can be a pointer to some type
- * of object).  The second call to vfprintf() would then crash, since the
- * first call modified the object that va_args was pointing to. C99 adds a
- * va_copy macro that to address this issue.  Many non-C99 system include this
- * macro, sometimes called __va_copy.  Here we ensure that va_copy is defined.
- * If if doesn't exist, we try to define it in terms of __va_copy.  If that is
- * not available, we make the assumption that va_list can be copied by value
- * and create our own.  Our implementation is the same as used on Solaris.
- */
-#if defined(__va_copy) && !defined(va_copy)
-#   define va_copy __va_copy
-#endif
-#if !defined(va_copy)
-#   define va_copy(to, from) ((to) = (from))
-#endif
-
-/* Cast a pointer to a long long. Use to printf format points as long-longs
- * in a 32/64bit portable manner.  Format should use %llx for the result.
- * Needed because casting a pointer to a different sized number cause a
- * warning with gcc */
-#define ptrToLL(p) ((long long)((size_t)p))
-
-/* How big is this array? */
-#define ArraySize(a) (sizeof(a)/sizeof((a)[0]))
-
-#define uglyf printf  /* debugging printf */
-#define uglyAbort errAbort /* debugging error abort. */
-#define uglyOut stdout /* debugging fprintf target. */
-
-void *needMem(size_t size);
-/* Need mem calls abort if the memory allocation fails. The memory
- * is initialized to zero. */
-
-void *needLargeMem(size_t size);
-/* This calls abort if the memory allocation fails. The memory is
- * not initialized to zero. */
-
-void *needLargeZeroedMem(size_t size);
-/* Request a large block of memory and zero it. */
-
-void *needLargeMemResize(void* vp, size_t size);
-/* Adjust memory size on a block, possibly relocating it.  If vp is NULL,
- * a new memory block is allocated.  Memory not initted. */
-
-void *needLargeZeroedMemResize(void* vp, size_t oldSize, size_t newSize);
-/* Adjust memory size on a block, possibly relocating it.  If vp is NULL, a
- * new memory block is allocated.  If block is grown, new memory is zeroed. */
-
-void *needHugeMem(size_t size);
-/* No checking on size.  Memory not initted to 0. */
-
-void *needHugeZeroedMem(size_t size);
-/* Request a large block of memory and zero it. */
-
-void *needHugeMemResize(void* vp, size_t size);
-/* Adjust memory size on a block, possibly relocating it.  If vp is NULL,
- * a new memory block is allocated.  No checking on size.  Memory not
- * initted. */
-
-void *needHugeZeroedMemResize(void* vp, size_t oldSize, size_t newSize);
-/* Adjust memory size on a block, possibly relocating it.  If vp is NULL, a
- * new memory block is allocated.  No checking on size.  If block is grown,
- * new memory is zeroed. */
-
-void *needMoreMem(void *old, size_t copySize, size_t newSize);
-/* Allocate a new buffer, copy old buffer to it, free old buffer. */
-
-void *cloneMem(void *pt, size_t size);
-/* Allocate a new buffer of given size, and copy pt to it. */
-
-#define CloneVar(pt) cloneMem(pt, sizeof((pt)[0]))
-/* Allocate copy of a structure. */
-
-void *wantMem(size_t size);
-/* Want mem just calls malloc - no zeroing of memory, no
- * aborting if request fails. */
-
-void freeMem(void *pt);
-/* Free memory will check for null before freeing. */
-
-void freez(void *ppt);
-/* Pass address of pointer.  Will free pointer and set it
- * to NULL. Typical use:
- *     s = needMem(1024);
- *          ...
- *     freez(&s); */
-
-#define AllocVar(pt) (pt = needMem(sizeof(*pt)))
-/* Shortcut to allocating a single variable on the heap and
- * assigning pointer to it. */
-
-#define AllocArray(pt, size) (pt = needLargeZeroedMem(sizeof(*pt) * (size)))
-
-#define AllocA(type) needMem(sizeof(type))
-/* Shortcut to allocating a variable on heap of a specific type. */
-
-#define AllocN(type,count) ((type*)needLargeZeroedMem(sizeof(type) * (count)))
-/* Shortcut to allocating an array on the heap of a specific type. */
-
-#define ExpandArray(array, oldCount, newCount) \
-  (array = needMoreMem((array), (oldCount)*sizeof((array)[0]), (newCount)*sizeof((array)[0])))
-/* Expand size of dynamically allocated array. */
-
-#define CopyArray(source, dest,count) memcpy(dest,source,(count)*sizeof(dest[0]))
-/* Copy count elements of array from source to dest. */
-
-#define CloneArray(a, count) cloneMem(a, (count)*sizeof(a[0]))
-/* Make new dynamic array initialized with  count elements of a */
-
-void errAbort(char *format, ...)
-/* Abort function, with optional (printf formatted) error message. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-void errnoAbort(char *format, ...)
-/* Prints error message from UNIX errno first, then does errAbort. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-#define internalErr()  errAbort("Internal error %s %d", __FILE__, __LINE__)
-/* Generic internal error message */
-
-void warn(char *format, ...)
-/* Issue a warning message. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-void warnWithBackTrace(char *format, ...)
-/* Issue a warning message and append backtrace. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-void verbose(int verbosity, char *format, ...)
-/* Write printf formatted message to log (which by
- * default is stdout) if global verbose variable
- * is set to verbosity or higher.  Default level is 1. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 2, 3)))
-#endif
-    ;
-
-void verboseTimeInit(void);
-/* Initialize or reinitialize the previous time for use by verboseTime. */
-
-void verboseTime(int verbosity, char *label, ...)
-/* Print label and how long it's been since last call.  Start time can be
- * initialized with verboseTimeInit, otherwise the elapsed time will be
- * zero. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 2, 3)))
-#endif
-    ;
-
-void verboseDot();
-/* Write I'm alive dot (at verbosity level 1) */
-
-int verboseLevel();
-/* Get verbosity level. */
-
-void verboseSetLevel(int verbosity);
-/* Set verbosity level in log.  0 for no logging,
- * higher number for increasing verbosity. */
-
-INLINE void zeroBytes(void *vpt, int count)
-/* fill a specified area of memory with zeroes */
-{
-memset(vpt, '\0', count);
-}
-
-#define ZeroVar(v) zeroBytes(v, sizeof(*v))
-
-void reverseBytes(char *bytes, long length);
-/* Reverse the order of the bytes. */
-
-void reverseInts(int *a, int length);
-/* Reverse the order of the integer array. */
-
-void reverseUnsigned(unsigned *a, int length);
-/* Reverse the order of the unsigned array. */
-
-void reverseDoubles(double *a, int length);
-/* Reverse the order of the double array. */
-
-void reverseStrings(char **a, int length);
-/* Reverse the order of the char* array. */
-
-void swapBytes(char *a, char *b, int length);
-/* Swap buffers a and b. */
-
-/******* Some things to manage simple lists - structures that begin ******
- ******* with a pointer to the next element in the list.            ******/
-struct slList
-    {
-    struct slList *next;
-    };
-
-int slCount(const void *list);
-/* Return # of elements in list.  */
-
-void *slElementFromIx(void *list, int ix);
-/* Return the ix'th element in list.  Returns NULL
- * if no such element. */
-
-int slIxFromElement(void *list, void *el);
-/* Return index of el in list.  Returns -1 if not on list. */
-
-INLINE void slAddHead(void *listPt, void *node)
-/* Add new node to start of list.
- * Usage:
- *    slAddHead(&list, node);
- * where list and nodes are both pointers to structure
- * that begin with a next pointer.
- */
-{
-struct slList **ppt = (struct slList **)listPt;
-struct slList *n = (struct slList *)node;
-n->next = *ppt;
-*ppt = n;
-}
-
-INLINE void slSafeAddHead(void *listPt, void *node)
-/* Add new node to start of list.  Now that slAddHead is an inline instead of
- * a macro, this function is obsolete.
- */
-{
-slAddHead(listPt, node);
-}
-
-void slAddTail(void *listPt, void *node);
-/* Add new node to tail of list.
- * Usage:
- *    slAddTail(&list, node);
- * where list and nodes are both pointers to structure
- * that begin with a next pointer. This is sometimes
- * convenient but relatively slow.  For longer lists
- * it's better to slAddHead, and slReverse when done.
- */
-
-void *slPopHead(void *listPt);
-/* Return head of list and remove it from list. (Fast) */
-
-void *slPopTail(void *listPt);
-/* Return tail of list and remove it from list. (Not so fast) */
-
-void *slCat(void *a, void *b);
-/* Return concatenation of lists a and b.
- * Example Usage:
- *   struct slName *a = getNames("a");
- *   struct slName *b = getNames("b");
- *   struct slName *ab = slCat(a,b)
- * After this it is no longer safe to use a or b.
- */
-
-void *slLastEl(void *list);
-/* Returns last element in list or NULL if none. */
-
-void slReverse(void *listPt);
-/* Reverse order of a list.
- * Usage:
- *    slReverse(&list);
- */
-
-typedef int CmpFunction(const void *elem1, const void *elem2);
-
-void slSort(void *pList, CmpFunction *compare);
-/* Sort a singly linked list with Qsort and a temporary array.
- * The arguments to the compare function in real, non-void, life
- * are pointers to pointers. */
-
-void slUniqify(void *pList, CmpFunction *compare, void (*free)());
-/* Return sorted list with duplicates removed.
- * Compare should be same type of function as slSort's compare (taking
- * pointers to pointers to elements.  Free should take a simple
- * pointer to dispose of duplicate element, and can be NULL. */
-
-void slSortMerge(void *pA, void *b, CmpFunction *compare);
-// Merges and sorts a pair of singly linked lists using slSort.
-
-void slSortMergeUniq(void *pA, void *b, CmpFunction *compare, void (*free)());
-// Merges and sorts a pair of singly linked lists leaving only unique
-// items via slUniqufy.  duplicate itens are defined by the compare routine
-// returning 0. If free is provided, items dropped from list can disposed of.
-
-boolean slRemoveEl(void *vpList, void *vToRemove);
-/* Remove element from singly linked list.  Usage:
- *    slRemove(&list, el);
- * Returns TRUE if element in list.  */
-
-void slFreeList(void *listPt);
-/* Free all elements in list and set list pointer to null.
- * Usage:
- *    slFreeList(&list);
- */
-
-/******* slInt - an int on a list - the first of many singly linked list structures *******/
-
-struct slInt
-/* List of integers. */
-    {
-    struct slInt *next;	/* Next in list. */
-    int val;		/* Integer value. */
-    };
-
-struct slInt *slIntNew(int x);
-#define newSlInt slIntNew
-/* Return a new double. */
-
-int slIntCmp(const void *va, const void *vb);
-/* Compare two slInts. */
-
-int slIntCmpRev(const void *va, const void *vb);
-/* Compare two slInts in reverse direction. */
-
-struct slInt * slIntFind(struct slInt *list, int target);
-/* Find target in slInt list or return NULL */
-
-struct slUnsigned
-/* List of unsigned */
-    {
-    struct slUnsigned *next;  /* Next in list */
-    unsigned val;	      /* Unsigned value */
-    };
-
-struct slUnsigned *slUnsignedNew(unsigned x);
-/* Return a new slUnsigned. */
-
-/******* slDouble - a double on a list *******/
-
-struct slDouble
-/* List of double-precision numbers. */
-    {
-    struct slDouble *next;	/* Next in list. */
-    double val;			/* Double-precision value. */
-    };
-
-struct slDouble *slDoubleNew(double x);
-#define newSlDouble slDoubleNew
-/* Return a new int. */
-
-int slDoubleCmp(const void *va, const void *vb);
-/* Compare two slDoubles. */
-
-double slDoubleMedian(struct slDouble *list);
-/* Return median value on list. */
-
-/******* slName - a zero terminated string on a list *******/
-
-struct slName
-/* List of names. The name array is allocated to accommodate full name
- */
-    {
-    struct slName *next;	/* Next in list. */
-    char name[1];               /* Allocated at run time to length of string. */
-    };
-
-struct slName *newSlName(char *name);
-
-#define slNameNew newSlName
-/* Return a new slName. */
-
-#define slNameFree freez
-/* Free a single slName */
-
-#define slNameFreeList slFreeList
-/* Free a list of slNames */
-
-struct slName *slNameNewN(char *name, int size);
-/* Return new slName of given size. */
-
-int slNameCmpCase(const void *va, const void *vb);
-/* Compare two slNames, ignore case. */
-
-int slNameCmp(const void *va, const void *vb);
-/* Compare two slNames. */
-
-int slNameCmpStringsWithEmbeddedNumbers(const void *va, const void *vb);
-/* Compare strings such as gene names that may have embedded numbers,
- * so that bmp4a comes before bmp14a */
-
-void slNameSortCase(struct slName **pList);
-/* Sort slName list, ignore case. */
-
-void slNameSort(struct slName **pList);
-/* Sort slName list. */
-
-boolean slNameInList(struct slName *list, char *string);
-/* Return true if string is in name list -- case insensitive. */
-
-boolean slNameInListUseCase(struct slName *list, char *string);
-/* Return true if string is in name list -- case sensitive. */
-
-void *slNameFind(void *list, char *string);
-/* Return first element of slName list (or any other list starting
- * with next/name fields) that matches string. */
-
-int slNameFindIx(struct slName *list, char *string);
-/* Return index of first element of slName list (or any other
- * list starting with next/name fields) that matches string.
- * ... Return -1 if not found. */
-
-char *slNameStore(struct slName **pList, char *string);
-/* Put string into list if it's not there already.
- * Return the version of string stored in list. */
-
-struct slName *slNameAddHead(struct slName **pList, char *name);
-/* Add name to start of list and return it. */
-
-struct slName *slNameAddTail(struct slName **pList, char *name);
-/* Add name to end of list (not efficient for long lists),
- * and return it. */
-
-struct slName *slNameCloneList(struct slName *list);
-/* Return clone of list. */
-
-struct slName *slNameListFromString(char *s, char delimiter);
-/* Return list of slNames gotten from parsing delimited string.
- * The final delimiter is optional. a,b,c  and a,b,c, are equivalent
- * for comma-delimited lists. */
-
-#define slNameListFromComma(s) slNameListFromString(s, ',')
-/* Parse out comma-separated list. */
-
-struct slName *slNameListOfUniqueWords(char *text,boolean respectQuotes);
-// Return list of unique words found by parsing string delimited by whitespace.
-// If respectQuotes then ["Lucy and Ricky" 'Fred and Ethyl'] will yield 2 slNames no quotes
-
-struct slName *slNameListFromStringArray(char *stringArray[], int arraySize);
-/* Return list of slNames from an array of strings of length arraySize.
- * If a string in the array is NULL, the array will be treated as
- * NULL-terminated. */
-
-char *slNameListToString(struct slName *list, char delimiter);
-/* Return string created by joining all names with the delimiter. */
-
-struct slName *slNameLoadReal(char *fileName);
-/* load file lines that are not blank or start with a '#' into a slName
- * list */
-
-struct slName *slNameIntersection(struct slName *a, struct slName *b);
-/* return intersection of two slName lists.  */
-
-/******* slRef - a void pointer on a list *******/
-
-struct slRef
-/* Singly linked list of generic references. */
-    {
-    struct slRef *next;	/* Next in list. */
-    void *val;		/* A reference to something. */
-    };
-
-struct slRef *slRefNew(void *val);
-/* Create new slRef element. */
-
-struct slRef *refOnList(struct slRef *refList, void *val);
-/* Return ref if val is already on list, otherwise NULL. */
-
-void refAdd(struct slRef **pRefList, void *val);
-/* Add reference to list. */
-
-void refAddUnique(struct slRef **pRefList, void *val);
-/* Add reference to list if not already on list. */
-
-void slRefFreeListAndVals(struct slRef **pList);
-/* Free up (with simple freeMem()) each val on list, and the list itself as well. */
-
-struct slRef *refListFromSlList(void *list);
-/* Make a reference list that mirrors a singly-linked list. */
-
-/******* slPair - a name/value pair on list where value not always a string *******/
-
-struct slPair
-/* A name/value pair. */
-    {
-    struct slPair *next;	/* Next in list. */
-    char *name;			/* Name of item. */
-    void *val;			/* Pointer to item data. */
-    };
-
-struct slPair *slPairNew(char *name, void *val);
-/* Allocate new name/value pair. */
-
-void slPairAdd(struct slPair **pList, char *name, void *val);
-/* Add new slPair to head of list. */
-
-void slPairFree(struct slPair **pEl);
-/* Free up struct and name.  (Don't free up values.) */
-
-void slPairFreeList(struct slPair **pList);
-/* Free up list.  (Don't free up values.) */
-
-void slPairFreeVals(struct slPair *list);
-/* Free up all values on list. */
-
-void slPairFreeValsAndList(struct slPair **pList);
-/* Free up all values on list and list itself */
-
-struct slPair *slPairFind(struct slPair *list, char *name);
-/* Return list element of given name, or NULL if not found. */
-
-void *slPairFindVal(struct slPair *list, char *name);
-/* Return value associated with name in list, or NULL if not found. */
-
-struct slPair *slPairListFromString(char *str,boolean respectQuotes);
-// Return slPair list parsed from list in string like:  [name1=val1 name2=val2 ...]
-// if respectQuotes then string can have double quotes: [name1="val 1" "name 2"=val2 ...]
-//    resulting pair strips quotes: {name1}={val 1},{name 2}={val2}
-// Returns NULL if parse error.  Free this up with slPairFreeValsAndList.
-#define slPairFromString(s) slPairListFromString(s,FALSE)
-
-char *slPairListToString(struct slPair *list,boolean quoteIfSpaces);
-// Returns an allocated string of pairs in form of [name1=val1 name2=val2 ...]
-// If requested, will wrap name or val in quotes if contain spaces: [name1="val 1" "name 2"=val2]
-
-char *slPairNameToString(struct slPair *list, char delimiter,boolean quoteIfSpaces);
-// Return string created by joining all names (ignoring vals) with the delimiter.
-// If requested, will wrap name in quotes if contain spaces: [name1,"name 2" ...]
-
-int slPairCmpCase(const void *va, const void *vb);
-/* Compare two slPairs, ignore case. */
-
-void slPairSortCase(struct slPair **pList);
-/* Sort slPair list, ignore case. */
-
-int slPairCmp(const void *va, const void *vb);
-/* Compare two slPairs. */
-
-int slPairValCmpCase(const void *va, const void *vb);
-/* Case insensitive compare two slPairs on their values (must be string). */
-
-int slPairValCmp(const void *va, const void *vb);
-/* Compare two slPairs on their values (must be string). */
-
-void slPairValSortCase(struct slPair **pList);
-/* Sort slPair list on values (must be string), ignore case. */
-
-void slPairValSort(struct slPair **pList);
-/* Sort slPair list on values (must be string). */
-
-int slPairIntCmp(const void *va, const void *vb);
-// Compare two slPairs on their integer values.
-
-void slPairIntSort(struct slPair **pList);
-// Sort slPair list on integer values.
-
-int slPairAtoiCmp(const void *va, const void *vb);
-// Compare two slPairs on their strings interpreted as integer values.
-
-void slPairValAtoiSort(struct slPair **pList);
-// Sort slPair list on string values interpreted as integers.
-
-
-
-/******* Some old stuff maybe we could trim. *******/
-
-void gentleFree(void *pt);
-/* check pointer for NULL before freeing.
- * (Actually plain old freeMem does that these days.) */
-
-/******* Some math stuff *******/
-
-void doubleSort(int count, double *array);
-/* Sort an array of doubles. */
-
-double doubleMedian(int count, double *array);
-/* Return median value in array.  This will sort
- * the array as a side effect. */
-
-void doubleBoxWhiskerCalc(int count, double *array, double *retMin,
-	double *retQ1, double *retMedian, double *retQ3, double *retMax);
-/* Calculate what you need to draw a box and whiskers plot from an array of doubles. */
-
-void slDoubleBoxWhiskerCalc(struct slDouble *list, double *retMin,
-	double *retQ1, double *retMedian, double *retQ3, double *retMax);
-/* Calculate what you need to draw a box and whiskers plot from a list of slDoubles. */
-
-int intMedian(int count, int *array);
-/* Return median value in array.  This will sort
- * the array as a side effect. */
-
-void intSort(int count, int *array);
-/* Sort an array of ints. */
-
-
-/*******  Some stuff for processing strings. *******/
-
-char *cloneStringZ(const char *s, int size);
-/* Make a zero terminated copy of string in memory */
-
-char *cloneString(const char *s);
-/* Make copy of string in dynamic memory */
-
-char *cloneLongString(char *s);
-/* Make clone of long string. */
-
-char *catTwoStrings(char *a, char *b);
-/* Allocate new string that is a concatenation of two strings. */
-
-int differentWord(char *s1, char *s2);
-/* strcmp ignoring case - returns zero if strings are
- * the same (ignoring case) otherwise returns difference
- * between first non-matching characters. */
-
-#define sameWord(a,b) (!differentWord(a,b))
-/* Return TRUE if two strings are same ignoring case */
-
-#define differentString(a,b) (strcmp(a,b))
-/* Returns FALSE if two strings same. */
-
-int differentStringNullOk(char *a, char *b);
-/* Returns 0 if two strings (either of which may be NULL)
- * are the same.  Otherwise it returns a positive or negative
- * number depending on the alphabetical order of the two
- * strings.
- * This is basically a strcmp that can handle NULLs in
- * the input.  If used in a sort the NULLs will end
- * up before any of the cases with data.   */
-
-#define sameOk(a,b) (differentStringNullOk(a,b) == 0)
-/* returns TRUE if two strings same, NULLs OK */
-
-#define sameString(a,b) (strcmp(a,b)==0)
-/* Returns TRUE if two strings same. */
-
-#define sameStringN(a,b,c) (strncmp(a,b,c)==0)
-/* Returns TRUE if two strings start with the same c characters. */
-
-#define isEmpty(string) ((string) == NULL || (string)[0] == 0)
-#define isNotEmpty(string) (! isEmpty(string))
-
-int cmpStringsWithEmbeddedNumbers(const char *a, const char *b);
-/* Compare strings such as gene names that may have embedded numbers,
- * so that bmp4a comes before bmp14a */
-
-int cmpWordsWithEmbeddedNumbers(const char *a, const char *b);
-/* Case insensitive version of cmpStringsWithEmbeddedNumbers. */
-
-boolean startsWith(const char *start, const char *string);
-/* Returns TRUE if string begins with start. */
-
-boolean startsWithWord(char *firstWord, char *line);
-/* Return TRUE if first white-space-delimited word in line
- * is same as firstWord.  Comparison is case sensitive. */
-
-boolean startsWithWordByDelimiter(char *firstWord,char delimit, char *line);
-/* Return TRUE if first word in line is same as firstWord as delimited by delimit.
-   Comparison is case sensitive. Delimit of ' ' uses isspace() */
-
-#define stringIn(needle, haystack) strstr(haystack, needle)
-/* Returns position of needle in haystack or NULL if it's not there. */
-/*        char *stringIn(char *needle, char *haystack);      */
-
-char *rStringIn(char *needle, char *haystack);
-/* Return last position of needle in haystack, or NULL if it's not there. */
-
-char *stringBetween(char *start, char *end, char *haystack);
-/* Return string between start and end strings, or NULL if
- * none found.  The first such instance is returned.
- * String must be freed by caller. */
-
-char * findWordByDelimiter(char *word,char delimit, char *line);
-/* Return pointer to first word in line matching 'word' and delimited
-   by 'delimit'. Comparison is case sensitive. Delimit of ' ' uses isspace() */
-
-boolean endsWith(char *string, char *end);
-/* Returns TRUE if string ends with end. */
-
-char lastChar(char *s);
-/* Return last character in string. */
-
-void trimLastChar(char *s);
-/* Erase last character in string. */
-
-char *lastNonwhitespaceChar(char *s);
-// Return pointer to last character in string that is not whitespace.
-
-char *matchingCharBeforeInLimits(char *limit, char *s, char c);
-/* Look for character c sometime before s, but going no further than limit.
- * Return NULL if not found. */
-
-boolean wildMatch(const char *wildCard, const char *string);
-/* does a case insensitive wild card match with a string.
- * * matches any string or no character.
- * ? matches any single character.
- * anything else etc must match the character exactly. */
-
-boolean sqlMatchLike(char *wildCard, char *string);
-/* Match using % and _ wildcards. */
-
-boolean anyWild(const char *string);
-/* Return TRUE if any wild card characters in string. */
-
-char *memMatch(char *needle, int nLen, char *haystack, int hLen);
-/* Returns first place where needle (of nLen chars) matches
- * haystack (of hLen chars) */
-
-void toUpperN(char *s, int n);
-/* Convert a section of memory to upper case. */
-
-void toLowerN(char *s, int n);
-/* Convert a section of memory to lower case. */
-
-void toggleCase(char *s, int size);
-/* toggle upper and lower case chars in string. */
-
-char *strUpper(char *s);
-#define touppers(s) (void)strUpper(s)
-/* Convert entire string to upper case. */
-
-char *strLower(char *s);
-#define tolowers(s) (void)strLower(s)
-/* Convert entire string to lower case */
-
-char *replaceChars(char *string, char *oldStr, char *newStr);
-/*
-  Replaces the old with the new.
- The old and new string need not be of equal size
- Can take any length string.
- Return value needs to be freeMem'd.
-*/
-
-int strSwapStrs(char *string, int sz,char *oldStr, char *newStr);
-/* Swaps all occurrences of the oldStr with the newStr in string. Need not be same size
-   Swaps in place but restricted by sz.  Returns count of swaps or -1 for sz failure.*/
-
-char * memSwapChar(char *s, int len, char oldChar, char newChar);
-/* Substitute newChar for oldChar throughout memory of given length.
-   old or new may be null */
-#define strSwapChar(s,old,new)   memSwapChar((s),strlen(s),(old),(new))
-#define subChar(s,old,new) (void)memSwapChar((s),strlen(s),(old),(new))
-/* Substitute newChar for oldChar throughout string s. */
-
-void stripChar(char *s, char c);
-/* Remove all occurences of c from s. */
-
-char *stripEnclosingChar(char *inout,char encloser);
-// Removes enclosing char if found at both beg and end, preserving pointer
-// Note: handles brackets '(','{' and '[' by complement at end
-#define stripEnclosingDoubleQuotes(inout) stripEnclosingChar((inout),'"')
-#define stripEnclosingSingleQuotes(inout) stripEnclosingChar((inout),'\'')
-
-void stripString(char *s, char *strip);
-/* Remove all occurences of strip from s. */
-
-int countCase(char *s,boolean upper);
-// Count letters with case (upper or lower)
-
-int countChars(char *s, char c);
-/* Return number of characters c in string s. */
-
-int countCharsN(char *s, char c, int size);
-/* Return number of characters c in string s of given size. */
-
-int countLeadingChars(char *s, char c);
-/* Count number of characters c at start of string. */
-
-int countLeadingDigits(const char *s);
-/* Return number of leading digits in s */
-
-int countLeadingNondigits(const char *s);
-/* Count number of leading non-digit characters in s. */
-
-int countSame(char *a, char *b);
-/* Count number of characters that from start in a,b that are same. */
-
-int countSeparatedItems(char *string, char separator);
-/* Count number of items in string you would parse out with given
- * separator,  assuming final separator is optional. */
-
-int chopString(char *in, char *sep, char *outArray[], int outSize);
-/* int chopString(in, sep, outArray, outSize); */
-/* This chops up the input string (cannabilizing it)
- * into an array of zero terminated strings in
- * outArray.  It returns the number of strings.
- * If you pass in NULL for outArray, it will just
- * return the number of strings that it *would*
- * chop. */
-
-extern char crLfChopper[];
-extern char whiteSpaceChopper[];
-/* Some handy predefined separators. */
-
-int chopByWhite(char *in, char *outArray[], int outSize);
-/* Like chopString, but specialized for white space separators. */
-
-#define chopLine(line, words) chopByWhite(line, words, ArraySize(words))
-/* Chop line by white space. */
-
-int chopByWhiteRespectDoubleQuotes(char *in, char *outArray[], int outSize);
-/* Like chopString, but specialized for white space separators.
- * Further, any doubleQuotes (") are respected.
- * If doubleQuote encloses whole string, then they are removed:
- *   "Fred and Ethyl" results in word [Fred and Ethyl]
- * If doubleQuotes exist inside string they are retained:
- *   Fred "and Ethyl" results in word [Fred "and Ethyl"]
- * Special note "" is a valid, though empty word. */
-
-int chopByChar(char *in, char chopper, char *outArray[], int outSize);
-/* Chop based on a single character. */
-
-#define chopTabs(string, words) chopByChar(string, '\t', words, ArraySize(words))
-/* Chop string by tabs. */
-
-#define chopCommas(string, words) chopByChar(string, ',', words, ArraySize(words))
-/* Chop string by commas. */
-
-
-char *skipBeyondDelimit(char *s,char delimit);
-/* Returns NULL or pointer to first char beyond one (or more contiguous) delimit char.
-   If delimit is ' ' then skips beyond first patch of whitespace. */
-
-char *skipLeadingSpaces(char *s);
-/* Return first white space or NULL if none.. */
-
-char *skipToSpaces(char *s);
-/* Return first white space. */
-
-void eraseTrailingSpaces(char *s);
-/* Replace trailing white space with zeroes. */
-
-void eraseWhiteSpace(char *s);
-/* Remove white space from a string */
-
-void eraseNonAlphaNum(char *s);
-/* Remove non-alphanumeric chars from string */
-
-char *trimSpaces(char *s);
-/* Remove leading and trailing white space. */
-
-void repeatCharOut(FILE *f, char c, int count);
-/* Write character to file repeatedly. */
-
-void spaceOut(FILE *f, int count);
-/* Put out some spaces to file. */
-
-void starOut(FILE *f, int count);
-/* Put out some asterisks to file. */
-
-boolean hasWhiteSpace(char *s);
-/* Return TRUE if there is white space in string. */
-
-char *firstWordInLine(char *line);
-/* Returns first word in line if any (white space separated).
- * Puts 0 in place of white space after word. */
-
-char *lastWordInLine(char *line);
-/* Returns last word in line if any (white space separated).
- * Returns NULL if string is empty.  Removes any terminating white space
- * from line. */
-
-char *nextWord(char **pLine);
-/* Return next word in *pLine and advance *pLine to next
- * word. Returns NULL when no more words. */
-
-char *nextWordRespectingQuotes(char **pLine);
-// return next word but respects single or double quotes surrounding sets of words.
-
-char *cloneFirstWord(char *line);
-/* Clone first word in line */
-
-char *nextTabWord(char **pLine);
-/* Return next tab-separated word. */
-
-char *cloneFirstWordByDelimiter(char *line,char delimit);
-/* Returns a cloned first word, not harming the memory passed in
-   Delimiter of ' ' will delimit by isspace() */
-#define cloneFirstWordInLine(line) cloneFirstWordByDelimiter((line),' ')
-#define cloneFirstWordByTab(line)  cloneFirstWordByDelimiter((line),'\t')
-/* Returns a cloned first word, not harming the memory passed in */
-
-char *cloneNextWordByDelimiter(char **line,char delimit);
-/* Returns a cloned first word, advancing the line pointer
-   but not harming memory passed in. Delimit ' ' uses isspace() */
-#define cloneNextWord(line)      cloneNextWordByDelimiter((line),' ')
-#define cloneNextWordByTab(line) cloneNextWordByDelimiter((line),'\t')
-
-char *nextStringInList(char **pStrings);
-/* returns pointer to the first string and advances pointer to next in
-   list of strings dilimited by 1 null and terminated by 2 nulls. */
-
-int cntStringsInList(char *pStrings);
-/* returns count of strings in a
-   list of strings dilimited by 1 null and terminated by 2 nulls. */
-
-int stringArrayIx(char *string, char *array[], int arraySize);
-/* Return index of string in array or -1 if not there. */
-
-int ptArrayIx(void *pt, void *array, int arraySize);
-/* Return index of pt in array or -1 if not there. */
-
-#define stringIx(string, array) stringArrayIx( (string), (array), ArraySize(array))
-
-/* Some stuff that is left out of GNU .h files!? */
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-
-#ifndef SEEK_CUR
-#define SEEK_CUR 1
-#endif
-
-#ifndef SEEK_END
-#define SEEK_END 2
-#endif
-
-#ifndef FILEPATH_H
-void splitPath(char *path, char dir[PATH_LEN], char name[FILENAME_LEN],
-	       char extension[FILEEXT_LEN]);
-/* Split a full path into components.  The dir component will include the
- * trailing / if any.  The extension component will include the starting
- * . if any.   Pass in NULL for dir, name, or extension if you don't care about
- * that part. */
-#endif /* FILEPATH_H */
-
-char *addSuffix(char *head, char *suffix);
-/* Return a needMem'd string containing "headsuffix". Should be free'd
- when finished. */
-
-void chopSuffix(char *s);
-/* Remove suffix (last . in string and beyond) if any. */
-
-void chopSuffixAt(char *s, char c);
-/* Remove end of string from last occurrence of char c.
- * chopSuffixAt(s, '.') is equivalent to regular chopSuffix. */
-
-char *chopPrefix(char *s);
-/* This will replace the first '.' in a string with
- * 0, and return the character after this.  If there
- * is no '.' in the string this will just return the
- * unchanged s passed in. */
-
-char *chopPrefixAt(char *s, char c);
-/* Like chopPrefix, but can chop on any character, not just '.' */
-
-FILE *mustOpen(char *fileName, char *mode);
-/* Open a file - or squawk and die. */
-
-void mustWrite(FILE *file, void *buf, size_t size);
-/* Write to file or squawk and die. */
-
-#define writeOne(file, var) mustWrite((file), &(var), sizeof(var))
-/* Write out one variable to file. */
-
-void mustRead(FILE *file, void *buf, size_t size);
-/* Read size bytes from a file or squawk and die. */
-
-#define mustReadOne(file, var) mustRead((file), &(var), sizeof(var))
-/* Read one variable from file or die. */
-
-void mustGetLine(FILE *file, char *buf, int charCount);
-/* Read at most charCount-1 bytes from file, but stop after newline if one is
- * encountered.  The string in buf is '\0'-terminated.  (See man 3 fgets.)
- * Die if there is an error. */
-
-int mustOpenFd(char *fileName, int flags);
-/* Open a file descriptor (see man 2 open) or squawk and die. */
-
-void mustReadFd(int fd, void *buf, size_t size);
-/* Read size bytes from a file descriptor or squawk and die. */
-
-void mustWriteFd(int fd, void *buf, size_t size);
-/* Write size bytes to file descriptor fd or die.  (See man 2 write.) */
-
-off_t mustLseek(int fd, off_t offset, int whence);
-/* Seek to given offset, relative to whence (see man lseek) in file descriptor fd or errAbort.
- * Return final offset (e.g. if this is just an (fd, 0, SEEK_CUR) query for current position). */
-
-void mustCloseFd(int *pFd);
-/* Close file descriptor *pFd if >= 0, abort if there's an error, set *pFd = -1. */
-
-#define writeOneFd(fd, var) mustWriteFd((fd), &(var), sizeof(var))
-/* Write out one variable to file descriptor fd. */
-
-#define readOne(file, var) (fread(&(var), sizeof(var), 1, (file)) == 1)
-/* Read one variable from file. Returns FALSE if can't do it. */
-
-#define readOneFd(fd, var) (read((fd), &(var), sizeof(var)) == sizeof(var))
-/* Read one variable from file. Returns FALSE if can't do it. */
-
-#define mustReadOneFd(fd, var) mustReadFd((fd), &(var), sizeof(var))
-/* Read one variable from file or die. */
-
-#define memReadOne(pPt, var) memRead((pPt), &(var), sizeof(var))
-/* Read one variable from memory. */
-
-void writeString(FILE *f, char *s);
-/* Write a 255 or less character string to a file.
- * This will write the length of the string in the first
- * byte then the string itself. */
-
-char *readString(FILE *f);
-/* Read a string (written with writeString) into
- * memory.  freeMem the result when done. Returns
- * NULL at EOF. */
-
-char *mustReadString(FILE *f);
-/* Read a string.  Squawk and die at EOF or if any problem. */
-
-boolean fastReadString(FILE *f, char buf[256]);
-/* Read a string into buffer, which must be long enough
- * to hold it.  String is in 'writeString' format.
- * Returns FALSE at EOF. */
-
-void msbFirstWriteBits64(FILE *f, bits64 x);
-/* Write out 64 bit number in manner that is portable across architectures */
-
-bits64 msbFirstReadBits64(FILE *f);
-/* Write out 64 bit number in manner that is portable across architectures */
-
-void carefulClose(FILE **pFile);
-/* Close file if open and null out handle to it. */
-
-boolean carefulCloseWarn(FILE **pFile);
-/* Close file if open and null out handle to it.
- * Return FALSE and print a warning message if there
- * is a problem.*/
-
-char *firstWordInFile(char *fileName, char *wordBuf, int wordBufSize);
-/* Read the first word in file into wordBuf. */
-
-struct fileOffsetSize
-/* A piece of a file. */
-   {
-   struct fileOffsetSize *next;	/* Next in list. */
-   bits64	offset;		/* Start offset of block. */
-   bits64	size;		/* Size of block. */
-   };
-
-int fileOffsetSizeCmp(const void *va, const void *vb);
-/* Help sort fileOffsetSize by offset. */
-
-struct fileOffsetSize *fileOffsetSizeMerge(struct fileOffsetSize *inList);
-/* Returns a new list which is inList transformed to have adjacent blocks
- * merged.  Best to use this with a sorted list. */
-
-void fileOffsetSizeFindGap(struct fileOffsetSize *list,
-	struct fileOffsetSize **pBeforeGap, struct fileOffsetSize **pAfterGap);
-/* Starting at list, find all items that don't have a gap between them and the previous item.
- * Return at gap, or at end of list, returning pointers to the items before and after the gap. */
-
-void mustSystem(char *cmd);
-/* Execute cmd using "sh -c" or die.  (See man 3 system.) fail on errors */
-
-int roundingScale(int a, int p, int q);
-/* returns rounded a*p/q */
-
-int intAbs(int a);
-/* Return integer absolute value */
-
-#define logBase2(x)(log(x)/log(2))
-/* return log base two of number */
-
-#define round(a) ((int)((a)+0.5))
-/* Round floating point val to nearest integer. */
-
-#define roundll(a) ((long long)((a)+0.5))
-/* Round floating point val to nearest long long. */
-
-#ifndef min
-#define min(a,b) ( (a) < (b) ? (a) : (b) )
-/* Return min of a and b. */
-#endif
-
-#ifndef max
-#define max(a,b) ( (a) > (b) ? (a) : (b) )
-/* Return max of a and b. */
-#endif
-
-int  rangeIntersection(int start1, int end1, int start2, int end2);
-/* Return amount of bases two ranges intersect over, 0 or negative if no
- * intersection. */
-
-int  positiveRangeIntersection(int start1, int end1, int start2, int end2);
-/* Return amount of bases two ranges intersect over, 0 if no
- * intersection. */
-
-INLINE void memRead(char **pPt, void *buf, int size)
-/* Copy memory from *pPt to buf, and advance *pPt by size. */
-{
-memcpy(buf, *pPt, size);
-*pPt += size;
-}
-
-INLINE void memWrite(char **pPt, void *buf, int size)
-/* Copy memory from buf to *pPt and advance *pPt by size. */
-{
-memcpy(*pPt, buf, size);
-*pPt += size;
-}
-
-#define memWriteOne(pPt, var) memWrite((pPt), &(var), sizeof(var))
-/* Write out one variable to memory stream. */
-
-INLINE void memWriteFloat(char **pPt, float val)
-/* Write out floating point val to file.  Mostly to convert from double... */
-{
-memWriteOne(pPt, val);
-}
-
-bits64 byteSwap64(bits64 a);
-/* Swap from intel to sparc order of a 64 bit quantity. */
-
-bits64 readBits64(FILE *f, boolean isSwapped);
-/* Read and optionally byte-swap 64 bit entity. */
-
-bits64 fdReadBits64(int fd, boolean isSwapped);
-/* Read and optionally byte-swap 64 bit entity. */
-
-bits64 memReadBits64(char **pPt, boolean isSwapped);
-/* Read and optionally byte-swap 64 bit entity from memory buffer pointed to by
- * *pPt, and advance *pPt past read area. */
-
-bits32 byteSwap32(bits32 a);
-/* Swap from intel to sparc order of a 32 bit quantity. */
-
-bits32 readBits32(FILE *f, boolean isSwapped);
-/* Read and optionally byte-swap 32 bit entity. */
-
-bits32 fdReadBits32(int fd, boolean isSwapped);
-/* Read and optionally byte-swap 32 bit entity. */
-
-bits32 memReadBits32(char **pPt, boolean isSwapped);
-/* Read and optionally byte-swap 32 bit entity from memory buffer pointed to by
- * *pPt, and advance *pPt past read area. */
-
-bits16 byteSwap16(bits16 a);
-/* Swap from intel to sparc order of a 16 bit quantity. */
-
-bits16 readBits16(FILE *f, boolean isSwapped);
-/* Read and optionally byte-swap 16 bit entity. */
-
-bits16 fdReadBits16(int fd, boolean isSwapped);
-/* Read and optionally byte-swap 16 bit entity. */
-
-bits16 memReadBits16(char **pPt, boolean isSwapped);
-/* Read and optionally byte-swap 32 bit entity from memory buffer pointed to by
- * *pPt, and advance *pPt past read area. */
-
-double byteSwapDouble(double a);
-/* Return byte-swapped version of a */
-
-double readDouble(FILE *f, boolean isSwapped);
-/* Read and optionally byte-swap double-precision floating point entity. */
-
-double memReadDouble(char **pPt, boolean isSwapped);
-/* Read and optionally byte-swap double-precision floating point entity
- * from memory buffer pointed to by *pPt, and advance *pPt past read area. */
-
-float byteSwapFloat(float a);
-/* Return byte-swapped version of a */
-
-float readFloat(FILE *f, boolean isSwapped);
-/* Read and optionally byte-swap single-precision floating point entity. */
-
-float memReadFloat(char **pPt, boolean isSwapped);
-/* Read and optionally byte-swap single-precision floating point entity
- * from memory buffer pointed to by *pPt, and advance *pPt past read area. */
-
-void removeReturns(char* dest, char* src);
-/* Removes the '\r' character from a string.
- * the source and destination strings can be the same,
- * if there are no threads */
-
-int intExp(char *text);
-/* Convert text to integer expression and evaluate.
- * Throws if it finds a non-number. */
-
-double doubleExp(char *text);
-/* Convert text to floating point expression and
- * evaluate. */
-
-char* readLine(FILE* fh);
-/* Read a line of any size into dynamic memory, return null on EOF */
-
-off_t fileSize(char *fileName);
-/* The size of a file. */
-
-boolean fileExists(char *fileName);
-/* Does a file exist? */
-
-/*
- Friendly name for strstrNoCase
-*/
-char *containsStringNoCase(char *haystack, char *needle);
-
-char *strstrNoCase(char *haystack, char *needle);
-/* A case-insensitive strstr */
-
-int vasafef(char* buffer, int bufSize, char *format, va_list args);
-/* Format string to buffer, vsprintf style, only with buffer overflow
- * checking.  The resulting string is always terminated with zero byte. */
-
-int safef(char* buffer, int bufSize, char *format, ...)
-/* Format string to buffer, vsprintf style, only with buffer overflow
- * checking.  The resulting string is always terminated with zero byte. */
-#ifdef __GNUC__
-__attribute__((format(printf, 3, 4)))
-#endif
-;
-
-void safecpy(char *buf, size_t bufSize, const char *src);
-/* copy a string to a buffer, with bounds checking.*/
-
-void safencpy(char *buf, size_t bufSize, const char *src, size_t n);
-/* copy n characters from a string to a buffer, with bounds checking.
- * Unlike strncpy, always null terminates the result */
-
-void safecat(char *buf, size_t bufSize, const char *src);
-/* Append  a string to a buffer, with bounds checking.*/
-
-void safencat(char *buf, size_t bufSize, const char *src, size_t n);
-/* append n characters from a string to a buffer, with bounds checking. */
-
-char *naForNull(char *s);
-/* Return 'n/a' if s is NULL, otherwise s. */
-
-char *naForEmpty(char *s);
-/* Return n/a if s is "" or NULL, otherwise s. */
-
-char *emptyForNull(char *s);
-/* Return "" if s is NULL, otherwise s. */
-
-char *nullIfAllSpace(char *s);
-/* Return NULL if s is all spaces, otherwise s. */
-
-char *trueFalseString(boolean b);
-/* Return "true" or "false" */
-
-void uglyTime(char *label, ...);
-/* Print label and how long it's been since last call.  Call with
- * a NULL label to initialize. */
-
-/*	In case the development environment does not supply INFINITY	*/
-#if !defined(INFINITY)
-#define INFINITY (1.0/0.0)
-#endif
-
-void makeDirs(char* path);
-/* make a directory, including parent directories */
-
-char *skipNumeric(char *s);
-/* Return first char of s that's not a digit */
-
-char *skipToNumeric(char *s);
-/* skip up to where numeric digits appear */
-
-char *splitOffNonNumeric(char *s);
-/* Split off non-numeric part, e.g. mm of mm8. Result should be freed when done */
-
-char *splitOffNumber(char *db);
-/* Split off number part, e.g. 8 of mm8. Result should be freed when done */
-
-
-void childExecFailedExit(char *msg);
-/* Child exec failed, so quit without atexit cleanup */
-
-void vaDumpStack(char *format, va_list args);
-/* debugging function to run the pstack program on the current process. In
- * prints a message, following by a new line, and then the stack track.  Just
- * prints errors to stderr rather than aborts. For debugging purposes
- * only.  */
-
-void dumpStack(char *format, ...)
-/* debugging function to run the pstack program on the current process. In
- * prints a message, following by a new line, and then the stack track.  Just
- * prints errors to stderr rather than aborts. For debugging purposes
- * only.  */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-// SETTING_ON set of macros are frequently used comparisons of string values for boolean questions.
-// Notice the subtle difference between NOT_ON and IS_OFF.
-//        NOT_ON could be NULL but IS_OFF must be explicitly set
-#define SETTING_IS_ON(setting) (  setting && (sameWord(setting,"on") || sameWord(setting,"true") \
-                               || sameWord(setting,"yes") || sameWord(setting,"enabled") \
-                               || atoi(setting) != 0) )
-#define SETTING_NOT_ON(setting)   (!SETTING_IS_ON(setting))
-#define SETTING_IS_OFF(setting) (  setting && (sameWord(setting,"off") \
-                                || sameWord(setting,"false") || sameWord(setting,"no") \
-                                || sameWord(setting,"disabled") || sameWord(setting,"0")) )
-
-// Standard bit mask macros
-#define BITS_ADD(    flags,bits) ((flags) = ((flags) |  (bits)))
-#define BITS_REMOVE( flags,bits) ((flags) = ((flags) & ~(bits)))
-#define BITS_ARE_ON( flags,bits) (((flags) & (bits)) == (bits))
-#define BITS_ARE_OFF(flags,bits) (((flags) & (bits)) == 0)
-
-// It is sometimes useful to distinguish between 3 "boolean" states: TRUE, FALSE and UNKNOWN
-enum enumBool
-    {
-    beUnknown=0,              // Not yet set
-    ebYes=1,                  // already set to TRUE
-    ebNo=-1                   // already set to FALSE
-    };
-#define SET_TO_YES(ebool) { (ebool) = ebYes; }
-#define SET_TO_NO(ebool)  { (ebool) = ebNo; }
-#define IS_YES(ebool)     ((ebool) == ebYes)
-#define IS_NO(ebool)      ((ebool) == ebNo)
-#define IS_KNOWN(ebool)   (IS_YES(ebool) || IS_NO(ebool))
-#define IS_TRUE           IS_YES
-#define IS_FALSE          IS_NO
-
-time_t mktimeFromUtc (struct tm *t);
-/* Return time_t for tm in UTC (GMT)
- * Useful for stuff like converting to time_t the
- * last-modified HTTP response header
- * which is always GMT. Returns -1 on failure of mktime */
-
-
-time_t dateToSeconds(const char *date,const char*format);
-// Convert a string date to time_t
-
-boolean dateIsOld(const char *date,const char*format);
-// Is this string date older than now?
-
-boolean dateIsOlderBy(const char *date,const char*format, time_t seconds);
-// Is this string date older than now by this many seconds?
-
-char *dateAddTo(char *date,char *format,int addYears,int addMonths,int addDays);
-/* Add years,months,days to a formatted date and returns the new date as a cloned string
-*  format is a strptime/strftime format: %F = yyyy-mm-dd */
-
-boolean haplotype(const char *name);
-/* Is this name a haplotype name ?  _hap or _alt in the name */
-
-#endif /* COMMON_H */
diff --git a/gbtools/src/include/blatSrc/common.mk b/gbtools/src/include/blatSrc/common.mk
deleted file mode 100644
index 35ad0d1..0000000
--- a/gbtools/src/include/blatSrc/common.mk
+++ /dev/null
@@ -1,411 +0,0 @@
-CC=gcc
-# to build on sundance: CC=gcc -mcpu=v9 -m64
-ifeq (${COPT},)
-    COPT=-O -g
-endif
-ifeq (${CFLAGS},)
-    CFLAGS=
-endif
-ifeq (${MACHTYPE},)
-    MACHTYPE:=$(shell uname -m)
-#    $(info MACHTYPE was empty, set to: ${MACHTYPE})
-endif
-ifneq (,$(findstring -,$(MACHTYPE)))
-#    $(info MACHTYPE has - sign ${MACHTYPE})
-    MACHTYPE:=$(shell uname -m)
-#    $(info MACHTYPE has - sign set to: ${MACHTYPE})
-endif
-
-HG_DEFS=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DMACHTYPE_${MACHTYPE}
-HG_INC=-I../inc -I../../inc -I../../../inc -I../../../../inc -I../../../../../inc
-
-# to check for Mac OSX Darwin specifics:
-UNAME_S := $(shell uname -s)
-# to check for builds on hgwdev
-FULLWARN = $(shell uname -n)
-
-#global external libraries 
-L=
-
-# pthreads is required
-ifneq ($(UNAME_S),Darwin)
-  L+=-pthread
-endif
-
-# autodetect if openssl is installed
-ifeq (${SSLDIR},)
-  SSLDIR = /usr/include/openssl
-endif
-ifeq (${USE_SSL},)
-  ifneq ($(wildcard ${SSLDIR}),)
-     USE_SSL=1
-  endif
-endif
-
-
-# autodetect UCSC installation of hal:
-ifeq (${HALDIR},)
-    HALDIR = /hive/groups/browser/hal
-    ifneq ($(wildcard ${HALDIR}),)
-        ifeq (${USE_HAL},)
-          USE_HAL=1
-        endif
-    endif
-endif
-
-ifeq (${USE_HAL},1)
-    HALLIBS=${HALDIR}/hal/lib/halMaf.a ${HALDIR}/hal/lib/halChain.a ${HALDIR}/hal/lib/halMaf.a ${HALDIR}/hal/lib/halLiftover.a ${HALDIR}/hal/lib/halLod.a ${HALDIR}/hal/lib/halLib.a ${HALDIR}/sonLib/lib/sonLib.a ${HALDIR}/hdf5-1.8.11/hdf5//lib/libhdf5_cpp.a ${HALDIR}/hdf5-1.8.11/hdf5//lib/libhdf5.a ${HALDIR}/hdf5-1.8.11/hdf5//lib/libhdf5_hl.a 
-    HG_DEFS+=-DUSE_HAL
-    HG_INC+=-I${HALDIR}/hal/chain/inc/
-endif
-
-
-# libssl: disabled by default
-ifeq (${USE_SSL},1)
-    ifneq (${SSL_DIR}, "/usr/include/openssl")
-      ifneq ($(UNAME_S),Darwin)
-        L+=-L${SSL_DIR}/lib
-      endif
-        HG_INC+=-I${SSL_DIR}/include
-    endif
-    # on hgwdev, already using the static library with mysqllient.
-    ifeq (${FULLWARN},hgwdev)
-       L+=/usr/lib64/libssl.a /usr/lib64/libcrypto.a -lkrb5
-    else
-       L+=-lssl -lcrypto
-    endif
-    HG_DEFS+=-DUSE_SSL
-endif
-
-# autodetect where png is installed
-ifeq (${PNGLIB},)
-  ifneq ($(wildcard /usr/lib64/libpng.a),)
-      PNGLIB=/usr/lib64/libpng.a
-  endif
-endif
-ifeq (${PNGLIB},)
-  ifneq ($(wildcard /usr/lib/libpng.a),)
-      PNGLIB=/usr/lib/libpng.a
-  endif
-endif
-ifeq (${PNGLIB},)
-  ifneq ($(wildcard /opt/local/lib/libpng.a),)
-      PNGLIB=/opt/local/lib/libpng.a
-  endif
-endif
-ifeq (${PNGLIB},)
-  ifneq ($(wildcard /usr/local/lib/libpng.a),)
-      PNGLIB=/usr/local/lib/libpng.a
-  endif
-endif
-ifeq (${PNGLIB},)
-      PNGLIB := $(shell libpng-config --ldflags  || true)
-endif
-ifeq (${PNGLIB},)
-  PNGLIB=-lpng
-endif
-ifeq (${PNGINCL},)
-  ifneq ($(wildcard /opt/local/include/png.h),)
-      PNGINCL=-I/opt/local/include
-  else
-      PNGINCL := $(shell libpng-config --I_opts  || true)
-#       $(info using libpng-config to set PNGINCL: ${PNGINCL})
-  endif
-endif
-
-# autodetect where mysql includes and libraries are installed
-# do not need to do this during 'clean' target (this is very slow for 'clean')
-ifneq ($(MAKECMDGOALS),clean)
-  # on hgwdev, use the static library.
-  ifeq (${FULLWARN},hgwdev)
-    MYSQLINC=/usr/include/mysql
-    MYSQLLIBS=/usr/lib64/libssl.a /usr/lib64/libcrypto.a /usr/lib64/mysql/libmysqlclient.a -lkrb5
-  endif
-  # this does *not* work on Mac OSX with the dynamic libraries
-  ifneq ($(UNAME_S),Darwin)
-    ifeq (${MYSQLLIBS},)
-      MYSQLLIBS := $(shell mysql_config --libs || true)
-#        $(info using mysql_config to set MYSQLLIBS: ${MYSQLLIBS})
-    endif
-  endif
-
-  ifeq (${MYSQLINC},)
-    MYSQLINC := $(shell mysql_config --include | sed -e 's/-I//' || true)
-#        $(info using mysql_config to set MYSQLINC: ${MYSQLINC})
-  endif
-  ifeq (${MYSQLINC},)
-    ifneq ($(wildcard /usr/local/mysql/include/mysql.h),)
-	  MYSQLINC=/usr/local/mysql/include
-    endif
-  endif
-  ifeq (${MYSQLINC},)
-    ifneq ($(wildcard /usr/include/mysql/mysql.h),)
-	  MYSQLINC=/usr/include/mysql
-    endif
-  endif
-  ifeq (${MYSQLINC},)
-    ifneq ($(wildcard /opt/local/include/mysql55/mysql/mysql.h),)
-	  MYSQLINC=/opt/local/include/mysql55/mysql
-    endif
-  endif
-  ifeq (${MYSQLLIBS},)
-    ifneq ($(wildcard /usr/lib64/mysql/libmysqlclient.a),)
-	  MYSQLLIBS=/usr/lib64/mysql/libmysqlclient.a
-    endif
-  endif
-  ifeq (${MYSQLLIBS},)
-    ifneq ($(wildcard /usr/local/mysql/lib/libmysqlclient.a),)
-	  MYSQLLIBS=/usr/local/mysql/lib/libmysqlclient.a
-    endif
-  endif
-  ifeq (${MYSQLLIBS},)
-    ifneq ($(wildcard /usr/local/mysql/lib/libmysqlclient.a),)
-	  MYSQLLIBS=/usr/local/mysql/lib/libmysqlclient.a
-    endif
-  endif
-  ifeq (${MYSQLLIBS},)
-    ifneq ($(wildcard /usr/lib64/mysql/libmysqlclient.so),)
-	  MYSQLLIBS=/usr/lib64/mysql/libmysqlclient.so
-    endif
-  endif
-  ifeq (${MYSQLLIBS},)
-    ifneq ($(wildcard /usr/lib/libmysqlclient.a),)
-	  MYSQLLIBS=/usr/lib/libmysqlclient.a
-    endif
-  endif
-  ifeq (${MYSQLLIBS},)
-    ifneq ($(wildcard /opt/local/lib/mysql55/mysql/libmysqlclient.a),)
-	  MYSQLLIBS=/opt/local/lib/mysql55/mysql/libmysqlclient.a
-    endif
-  endif
-  ifeq (${MYSQLLIBS},)
-    ifneq ($(wildcard /usr/local/Cellar/mysql/5.6.19/lib/libmysqlclient.a),)
-	  MYSQLLIBS=/usr/local/Cellar/mysql/5.6.19/lib/libmysqlclient.a
-    endif
-  endif
-  ifeq (${MYSQLLIBS},)
-    ifneq ($(wildcard /usr/local/Cellar/mysql/5.6.16/lib/libmysqlclient.a),)
-	  MYSQLLIBS=/usr/local/Cellar/mysql/5.6.16/lib/libmysqlclient.a
-    endif
-  endif
-  ifeq ($(findstring src/hg/,${CURDIR}),src/hg/)
-    ifeq (${MYSQLINC},)
-        $(error can not find installed mysql development system)
-    endif
-  endif
-    # last resort, hoping the compiler can find it in standard locations
-  ifeq (${MYSQLLIBS},)
-      MYSQLLIBS="-lmysqlclient"
-  endif
-endif
-
-# $(info have MYSQLINC: ${MYSQLINC})
-# $(info have MYSQLLIBS: ${MYSQLLIBS})
-
-# OK to add -lstdc++ to all MYSQLLIBS just in case it is
-#    MySQL version 5.6 libraries, but no 'librt' on Mac OSX
-ifeq (${FULLWARN},hgwdev)
-  MYSQLLIBS += /usr/lib/gcc/x86_64-redhat-linux/4.4.4/libstdc++.a /usr/lib/debug/usr/lib64/librt.a
-else
-  ifeq ($(UNAME_S),Darwin)
-    MYSQLLIBS += -lstdc++
-  else
-    MYSQLLIBS += -lstdc++ -lrt
-  endif
-endif
-
-L+=${PNGLIB}
-HG_INC+=${PNGINCL}
-
-# 32-bit color enabled by default
-ifneq (${COLOR32},0)
-    HG_DEFS+=-DCOLOR32
-endif
-
-# autodetect UCSC installation of samtabix:
-ifeq (${SAMTABIXDIR},)
-    SAMTABIXDIR = /hive/data/outside/samtabix/${MACHTYPE}
-    ifneq ($(wildcard ${SAMTABIXDIR}),)
-        ifeq (${USE_SAMTABIX},)
-          USE_SAMTABIX=1
-        endif
-    endif
-endif
-
-# pass through COREDUMP
-ifneq (${COREDUMP},)
-    HG_DEFS+=-DCOREDUMP
-endif
-
-# autodetect UCSC additional source code with password for some external tracks on gbib
-GBIBDIR = /hive/groups/browser/gbib/
-ifneq ($(wildcard ${GBIBDIR}/*.c),)
-  HG_DEFS+=-DUSE_GBIB_PWD
-  HG_INC += -I${GBIBDIR}
-endif
-
-# libsamtabix (samtools + tabix + Angie's KNETFILE_HOOKS extension to it): disabled by default
-ifeq (${USE_SAMTABIX},1)
-    KNETFILE_HOOKS=1
-    USE_BAM=1
-    USE_TABIX=1
-    ifeq (${SAMTABIXINC},)
-        SAMTABIXINC = ${SAMTABIXDIR}
-    endif
-    ifeq (${SAMTABIXLIB},)
-        SAMTABIXLIB = ${SAMTABIXDIR}/libsamtabix.a
-    endif
-    HG_INC += -I${SAMTABIXINC}
-    L+=${SAMTABIXLIB} -lz
-    HG_DEFS+=-DUSE_SAMTABIX -DUSE_BAM -DUSE_TABIX -DKNETFILE_HOOKS
-else
-  # Deprecated but supported for mirrors, for now: independent samtools and tabix libs
-
-  # libbam (samtools, and Angie's KNETFILE_HOOKS extension to it): disabled by default
-  ifeq (${USE_BAM},1)
-      ifeq (${SAMINC},)
-          SAMINC = ${SAMDIR}
-      endif
-      ifeq (${SAMLIB},)
-          SAMLIB = ${SAMDIR}/libbam.a
-      endif
-      HG_INC += -I${SAMINC}
-      L+=${SAMLIB}
-      HG_DEFS+=-DUSE_BAM
-      ifeq (${KNETFILE_HOOKS},1)
-          HG_DEFS+=-DKNETFILE_HOOKS
-      endif
-  endif
-
-  # libtabix and Angie's KNETFILE_HOOKS extension to it: disabled by default
-  ifeq (${USE_TABIX},1)
-      ifeq (${TABIXINC},)
-          TABIXINC = ${TABIXDIR}
-      endif
-      ifeq (${TABIXLIB},)
-          TABIXLIB = ${TABIXDIR}/libtabix.a
-      endif
-      HG_INC += -I${TABIXINC}
-      L+=${TABIXLIB} -lz
-      HG_DEFS+=-DUSE_TABIX
-      ifeq (${KNETFILE_HOOKS},1)
-	HG_DEFS+=-DKNETFILE_HOOKS
-      endif
-  endif
-endif
-
-SYS = $(shell uname -s)
-
-ifeq (${HG_WARN},)
-  ifeq (${SYS},Darwin)
-      HG_WARN = -Wall -Wno-unused-variable -Wno-deprecated-declarations
-      HG_WARN_UNINIT=
-  else
-    ifeq (${SYS},SunOS)
-      HG_WARN = -Wall -Wformat -Wimplicit -Wreturn-type
-      HG_WARN_UNINIT=-Wuninitialized
-    else
-      ifeq (${FULLWARN},hgwdev)
-        HG_WARN = -Wall -Werror -Wformat -Wformat-security -Wimplicit -Wreturn-type -Wempty-body
-        HG_WARN_UNINIT=-Wuninitialized
-      else
-        HG_WARN = -Wall -Wformat -Wimplicit -Wreturn-type
-        HG_WARN_UNINIT=-Wuninitialized
-      endif
-    endif
-  endif
-  # -Wuninitialized generates a warning without optimization
-  ifeq ($(findstring -O,${COPT}),-O)
-     HG_WARN += ${HG_WARN_UNINIT}
-  endif
-endif
-
-# this is to hack around many make files not including HG_WARN in
-# the link line
-CFLAGS += ${HG_WARN}
-
-ifeq (${SCRIPTS},)
-    SCRIPTS=${HOME}/bin/scripts
-endif
-ifeq (${CGI_BIN},)
-    CGI_BIN=/usr/local/apache/cgi-bin
-endif
-ifeq (${DOCUMENTROOT},)
-    DOCUMENTROOT=/usr/local/apache/htdocs
-endif
-ifeq (${BINDIR},)
-    BINDIR = ${HOME}/bin/${MACHTYPE}
-endif
-ifeq (${ENCODE_PIPELINE_BIN},)
-    ENCODE_PIPELINE_BIN=/cluster/data/encode/pipeline/bin
-endif
-
-# avoid an extra leading slash when DESTDIR is empty
-ifeq (${DESTDIR},)
-  DESTBINDIR=${BINDIR}
-else
-  DESTBINDIR=${DESTDIR}/${BINDIR}
-endif
-
-# location of stringify program
-STRINGIFY = ${DESTBINDIR}/stringify
-
-MKDIR=mkdir -p
-ifeq (${STRIP},)
-   STRIP=true
-endif
-CVS=cvs
-GIT=git
-
-# portable naming of compiled executables: add ".exe" if compiled on 
-# Windows (with cygwin).
-ifeq (${OS}, Windows_NT)
-  AOUT=a
-  EXE=.exe
-else
-  AOUT=a.out
-  EXE=
-endif
-
-#Lowelab defines
-#The lowelab specific code will be included in compilation if the following conditions are satistied
-LOWELAB_WIKI_DEF=
-LOWELAB_DEF=
-ifdef LOWELAB
-    LOWELAB_WIKI=1
-    LOWELAB_DEF=-DLOWELAB
-endif
-ifdef LOWELAB_WIKI
-    LOWELAB_WIKI_DEF=-DLOWELAB_WIKI
-endif
-LOWELAB_DEFS=${LOWELAB_DEF} ${LOWELAB_WIKI_DEF}
-
-ifdef LOWELAB
-    ifeq (${SCRIPTS},/cluster/bin/scripts)
-        SCRIPTS=${HOME}/scripts
-    endif
-    ifeq (${CGI_BIN},/usr/local/apache/cgi-bin)
-        CGI_BIN=/www/cgi-bin
-    endif
-    ifeq (${DOCUMENTROOT},/usr/local/apache/htdocs)
-        DOCUMENTROOT=/www/browser-docs
-    endif
-endif
-
-#ENCODE COMMON VARIABLES
-CONFIG_FILES = \
-	fields.ra \
-	labs.ra
-CV = cv.ra
-CVDIR=${HOME}/kent/src/hg/makeDb/trackDb/cv/alpha
-PIPELINE_PATH=/hive/groups/encode/dcc/pipeline
-CONFIG_DIR = ${PIPELINE_PATH}/${PIPELINE_DIR}/config
-ENCODEDCC_DIR = ${PIPELINE_PATH}/downloads/encodeDCC
-
-%.o: %.c
-	${CC} ${COPT} ${CFLAGS} ${HG_DEFS} ${LOWELAB_DEFS} ${HG_WARN} ${HG_INC} ${XINC} -o $@ -c $<
-
-# jshint: off unless JSHINT is already in environment
-ifeq (${JSHINT},)
-    JSHINT=true
-endif
diff --git a/gbtools/src/include/blatSrc/correlate.h b/gbtools/src/include/blatSrc/correlate.h
deleted file mode 100644
index 7bb4858..0000000
--- a/gbtools/src/include/blatSrc/correlate.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* correlate - calculate r, also known as Pearson's correlation
- * coefficient.  r*r has the nice property that it explains
- * how much of one variable's variation can be explained as
- * a linear function of the other variable's variation. */
-#ifndef CORRELATE_H
-#define CORRELATE_H
-
-struct correlate
-/* This helps manage correlations. */
-    {
-    struct correlate *next;	/* Next in list */
-    double sumX;		/* Sum of all X's so far. */
-    double sumY;		/* Sum of all Y's so far. */
-    double sumXY;		/* Sum of all X*Y */
-    double sumXX;		/* Sum of all X*X */
-    double sumYY;		/* Sum of all Y*Y */
-    long long n;		/* Number of samples. */
-    };
-
-struct correlate *correlateNew();
-/* Return new correlation handler. */
-
-void correlateFree(struct correlate **pC);
-/* Free up correlator. */
-
-void correlateNext(struct correlate *c, double x, double y);
-/* Add next sample to correlation. */
-
-void correlateNextMulti(struct correlate *c, double x, double y, int count);
-/* Do same thing as calling correlateNext with x and y count times. */
-
-double correlateResult(struct correlate *c);
-/* Returns correlation (aka R) */
-
-double correlateArrays(double *x, double *y, int size);
-/* Return correlation of two arrays of doubles. */
-
-#endif /* CORRELATE_H */
-
diff --git a/gbtools/src/include/blatSrc/crTree.h b/gbtools/src/include/blatSrc/crTree.h
deleted file mode 100644
index 1e8643b..0000000
--- a/gbtools/src/include/blatSrc/crTree.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* crTree chromosome r tree. This module creates and uses a disk-based index that can find items
- * that overlap with a chromosome range - something of the form chrN:start-end - with a
- * minimum of disk access.  It is implemented with a combination of bPlusTrees and r-trees. 
- * The items being indexed can overlap with each other.  
- * 
- * There's two main sides to using this module - creating an index, and using it.
- *
- * The first step of index creation is actually to insure that the file being indexed
- * is ordered by chromosome,start,end.  For a .bed file you can insure this
- * with the command:
- *     sort -k1,1 -k2,2n -k3,3n unsorted.bed > sorted.bed
- * Note that the the chromosome field is sorted alphabetically and the start and end
- * fields are sorted numerically.
- *
- * Once this is done then the index creation program scans the input file, and
- * makes a list of crTreeItems, one for each item in the file. A crTreeItem just 
- * contains the chromosome range and file offset for an item. In the process of scanning, 
- * build up a hash containing the chromosome names (using hashStoreName) rather than allocating
- * a separate string for each chromosome name in each item.  Pass the list and the
- * hash to crTreeFileCreate.
- *
- * Using an index is done in two steps.  First you open the index with crTreeFileOpen,
- * and then you use crTreeFindOverlappingBlocks to find parts of the file the overlap
- * with your query range.  The result of a crTreeFindOverlappingBlocks call is a list
- * of regions in the file.  These regions typically include some non-overlapping items
- * as well.  It is up to the caller to parse through the resulting region list to
- * convert it from just bytes on disk into the memory data structure.  During this
- * parsing you should ignore items that don't overlap your range of interest.
- *
- * The programs crTreeIndexBed and crTreeSearchBed create and search a crTree index
- * for a bed file, and are useful examples to view for other programs that want to
- * use the crTree system. */
-
-#ifndef CRTREE_H
-#define CRTREE_H
-
-struct crTreeFile
-/* Chromosome R tree index file handle. */
-    {
-    struct crTreeFile *next;	/* Next in list of index files if any. */
-    char *fileName;		/* Name of file - for better error reporting. */
-    struct udcFile *udc;			/* Open file handle. */
-    struct bptFile *chromBpt;	/* Index of chromosomes. */
-    struct cirTreeFile *cir;	/* Index of ranges. */
-    boolean isSwapped;		/* If TRUE need to byte swap everything. */
-    bits64 chromOffset;		/* Offset of chromosome index. */
-    bits64 cirOffset;		/* Offset of range index. */
-    };
-
-struct crTreeFile *crTreeFileOpen(char *fileName);
-/* Open up r-tree index file - reading headers and verifying things. */
-
-void crTreeFileClose(struct crTreeFile **pCrt);
-/* Close and free up crTree file opened with crTreeFileAttach. */
-
-struct fileOffsetSize *crTreeFindOverlappingBlocks(struct crTreeFile *crt, 
-	char *chrom, bits32 start, bits32 end);
-/* Return list of file blocks that between them contain all items that overlap
- * start/end on chromIx.  Also there will be likely some non-overlapping items
- * in these blocks too. When done, use slListFree to dispose of the result. */
-
-struct crTreeItem
-/* A chromosome and an interval inside it. */
-    {
-    struct crTreeItem *next;  /* Next in singly linked list. */
-    char *chrom;	/* Name of chromosome not allocated here. */
-    bits32 start;	/* Start position in chromosome. */
-    bits32 end;	/* One past last base in interval in chromosome. */
-    bits64 fileOffset;	/* Offset of item in file we are indexing. */
-    };
-
-void crTreeFileCreateInputCheck(struct crTreeItem *itemList, struct hash *chromHash, 
-	bits32 blockSize, bits32 itemsPerSlot, bits64 endPosition, char *fileName);
-/* Do sanity checking on itemList and chromHash and endPosition.  Make sure that itemList is
- * sorted properly mostly. */
-
-void crTreeFileCreate(
-	struct crTreeItem *itemList,  /* List of all items - sorted here and in underlying file. */
-	struct hash *chromHash,	      /* Hash of all chromosome names. */
-	bits32 blockSize,	/* R tree block size - # of children for each node. 1024 is good. */
-	bits32 itemsPerSlot,	/* Number of items to put in each index slot at lowest level.
-				 * Typically either blockSize/2 or 1. */
-	bits64 endPosition,	/* File offset after have read all items in file. */
-	char *fileName);        /* Name of output file. */
-/* Create a cr tree index of file. The itemList contains the position of each item in the
- * chromosome and in the file being indexed.  Both the file and the itemList must be sorted
- * by chromosome (alphabetic), start (numerical), end (numerical). */
-
-#endif /* CRTREE_H */
-
diff --git a/gbtools/src/include/blatSrc/crudeali.h b/gbtools/src/include/blatSrc/crudeali.h
deleted file mode 100644
index 41f0cb7..0000000
--- a/gbtools/src/include/blatSrc/crudeali.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* crudeAli.h - Interface to the fast, crude blast-like aligner. */
-
-#ifndef CRUDEALI_H
-#define CRUDEALI_H
-
-struct crudeAli
-/* Stored info on a crude alignment. */
-    {
-    struct crudeAli *next;
-    int chromIx;
-    int start, end;
-    int score;
-    char strand;
-    int qStart, qEnd;
-    };
-
-struct crudeAli *crudeAliFind(DNA *probe, int probeSize, struct nt4Seq **chrome, int chromeCount, int tileSize, int minScore);
-/* Returns a list of crude alignments.  (You can free this with slFreeList() */
-
-#endif /* CRUDEALI_H */
-
diff --git a/gbtools/src/include/blatSrc/diGraph.h b/gbtools/src/include/blatSrc/diGraph.h
deleted file mode 100644
index 58f43f4..0000000
--- a/gbtools/src/include/blatSrc/diGraph.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/* diGraph - Directed graph routines. */
-#ifndef DIGRAPH_H
-#define DIGRAPH_H
-
-#ifndef DLIST_H
-#include "dlist.h"
-#endif
-
-struct diGraph
-/* A directed graph. */
-    {
-    struct dgNode *nodeList;
-    struct hash *nodeHash;
-    struct dlList *edgeList;
-    };
-
-struct dgNode
-/* A node on a directed graph */
-    {
-    struct dgNode *next;   /* Next in master node list. */
-    char *name;            /* Name of node (allocated in hash). */
-    void *val;             /* Value of node. */
-    struct dgConnection *nextList;  /* Ways out of node. */
-    struct dgConnection *prevList;  /* Ways into node. */
-    int topoOrder;      /* Topographical order after call to dgTopoSort. */
-    int component;      /* Connected component number after call to dgConnectedComponents. */
-    int priority;       /* Node priority. */
-    struct dgNode *tempEntry;  /* Way in for breadth first search */
-    bool visited;       /* Visit order in depth first traversal. */
-    bool conn;	        /* Flag for connection algorithms. */
-    bool flagA;         /* Flag used in rangeGraph algorithms. */
-    bool flagB;         /* Currently unused flag. */
-    };
-
-struct dgEdge
-/* An edge on graph */
-    {
-    void *val;		/* Value of edge. */
-    struct dgNode *a;   /* Node on incoming side. */
-    struct dgNode *b;   /* Node on outgoing side. */
-    };
-
-struct dgConnection
-/* Connects one node to another. Linked to edge. */
-    {
-    struct dgConnection *next;  /* Next in list. */
-    struct dgNode *node;        /* Node this connects to. */
-    struct dlNode *edgeOnList;  /* Associated edge. */
-    };
-
-struct dgNodeRef
-/* A reference to a node. */
-    {
-    struct dgNodeRef *next;	/* Next in list. */
-    struct dgNode *node;        /* Pointer to node. */
-    };
-
-struct dgEdgeRef
-/* A reference to an edge. */
-    {
-    struct dgEdgeRef *next;	/* Next in list. */
-    struct dgEdge *edge;        /* Reference to edge. */
-    };
-
-struct diGraph *dgNew();
-/* Return a new directed graph object. */
-
-void dgFree(struct diGraph **pGraph);
-/* Free a directed graph. */
-
-struct dgNode *dgAddNode(struct diGraph *dg, char *name, void *val);
-/* Create new node in graph. */
-
-struct dgNode *dgAddNumberedNode(struct diGraph *dg, int id, void *val);
-/* Create new node with a number instead of a name. */
- 
-struct dgNode *dgFindNode(struct diGraph *dg, char *name);
-/* Find existing node in graph. */
-
-struct dgNode *dgFindNumberedNode(struct diGraph *dg, int id);
-/* Find node given number. */
-
-void *dgNodeVal(struct dgNode *node);
-/* Return value associated with node. */
-
-void *dgNodeName(struct dgNode *node);
-/* Return name associated with node. */
-
-int dgNodeNumber(struct dgNode *node);
-/* Return number of node.  (Will likely return 0 if node
- * was added with a name rather than a number). */
-
-struct dgEdge *dgConnect(struct diGraph *dg, struct dgNode *a, struct dgNode *b);
-/* Connect node a to node b.  Returns connecting edge. */
-
-struct dgEdge *dgConnectWithVal(struct diGraph *dg, struct dgNode *a, struct dgNode *b, void *val);
-/* Connect node a to node b and put val on edge. */
-
-void dgDisconnect(struct diGraph *dg, struct dgNode *a, struct dgNode *b);
-/* Disconnect nodes a and b. */
-
-struct dgEdge *dgDirectlyFollows(struct diGraph *dg, struct dgNode *a, struct dgNode *b);
-/* Return TRUE if b directly follows a. */
-
-boolean dgPathExists(struct diGraph *dg, struct dgNode *a, struct dgNode *b);
-/* Return TRUE if there's a path from a to b. */
-
-struct dgNodeRef *dgFindPath(struct diGraph *dg, struct dgNode *a, struct dgNode *b);
-/* Find shortest path from a to b.  Return NULL if can't be found. */
-
-struct dgNodeRef *dgFindConnectedToNode(struct diGraph *dg, struct dgNode *a);
-/* Return reference list of all nodes connected to a, including a.
- * slFreeList this list when done. */
-
-struct dgNodeRef *dgFindNewConnected(struct diGraph *dg, struct dgNode *a);
-/* Find a connected component guaranteed not to be covered before 
- * that includes a. */
-
-struct dgNodeRef *dgFindNewConnectedWithVals(struct diGraph *dg, struct dgNode *a);
-/* Find a connected component guaranteed not to be covered before 
- * that includes a.  Connected components must have values*/
-
-struct dgNodeRef *dgFindNextConnected(struct diGraph *dg);
-/* Return list of nodes that make up next connected component,
- * or NULL if no more components.  slFreeList this when
- * done.  Call "dgClearConnFlags" before first call to this.
- * Do not call dgFindConnectedToNode between dgFindFirstConnected 
- * and this as they use the same flag variables to keep track of
- * what vertices are used. */
-
-struct dgNodeRef *dgFindNextConnectedWithVals(struct diGraph *dg);
-/* Like dgFindConnected, but only considers graph nodes that
- * have a val attached. */
-
-int dgConnectedComponents(struct diGraph *dg);
-/* Count number of connected components and set component field
- * of each node to reflect which component it is in. */
-
-int dgConnectedComponentsWithVals(struct diGraph *dg);
-/* Count number of connected components and set component field
- * of each node to reflect which component it is in. Only
- * consider components with values. */
-
-void dgTopoSort(struct diGraph *dg);
-/* Fill in topological order of nodes. */
-
-boolean dgHasCycles(struct diGraph *dg);
-/* Return TRUE if directed graph has cycles. */
-
-boolean dgParentsAllVisited(struct dgNode *node);
-/* Return TRUE if all parents of node have  been visited. */
-
-struct dgNodeRef *dgConstrainedPriorityOrder(struct diGraph *dg);
-/* Return traversal of graph in priority order subject to
- * constraint that all parents must be output before
- * their children regardless of node priority. 
- * Graph must be cycle free. */
-
-boolean dgRangesConsistent(struct diGraph *rangeGraph,
-   boolean (*findEdgeRange)(struct dgEdge *edge, int *retMin, int *retMax) );
-/* Return TRUE if graph with a range of allowable distances associated
- * with each edge is internally consistent. */
-
-boolean dgAddedRangeConsistent(struct diGraph *rangeGraph,
-   struct dgNode *a, struct dgNode *b, int abMin, int abMax,
-   boolean (*findEdgeRange)(struct dgEdge *edge, int *retMin, int *retMax) );
-/* Return TRUE if graph with a range of allowable distances associated
- * with each edge would be internally consistent if add edge from a to b
- * with given min/max values. */
-
-struct dgEdgeRef *dgFindSubEdges(struct diGraph *dg, struct dgNodeRef *subGraph);
-/* Return list of edges in graph that connected together nodes in subGraph. */
-
-void dgSwapEdges(struct diGraph *dg, struct dgEdgeRef *erList);
-/* Swap polarity of all edges in erList.  (Assumes you don't have
- * edges going both directions in graph.) */
-
-void dgClearConnFlags(struct diGraph *dg);
-/* Clear out conn flags. */
-
-void dgClearVisitFlags(struct diGraph *dg);
-/* Clear out visit order flags. */
-
-struct dgNodeRef *dgFindNodeInRefList(struct dgNodeRef *refList, struct dgNode *node);
-/* Return reference to node if in list, or NULL if not. */
-
-struct dgConnection *dgFindNodeInConList(struct dgConnection *conList, struct dgNode *node);
-/* Return connection to node if in list, or NULL if not. */
-
-struct dgConnection *dgNextList(struct dgNode *node);
-/* Return list of connections out of this node. Don't free (or rearrange)
- * this list please. */
-
-struct dgConnection *dgPrevList(struct dgNode *node);
-/* Return list of connections into this node. Don't free (or rearrange)
- * this list please. */
-
-void dgDumpGraph(struct diGraph *dg, FILE *out, boolean hideIsolated);
-/* Dump info on graph to output. */
-
-#endif /* DIGRAPH_H */
-
diff --git a/gbtools/src/include/blatSrc/diGraph.h.97 b/gbtools/src/include/blatSrc/diGraph.h.97
deleted file mode 100644
index f8fc310..0000000
--- a/gbtools/src/include/blatSrc/diGraph.h.97
+++ /dev/null
@@ -1,210 +0,0 @@
-/* diGraph - Directed graph routines. */
-#ifndef DIGRAPH_H
-#define DIGRAPH_H
-
-#ifndef DLIST_H
-#include "dlist.h"
-#endif
-
-struct diGraph
-/* A directed graph. */
-    {
-    struct dgNode *nodeList;
-    struct hash *nodeHash;
-    struct dlList *edgeList;
-    };
-
-struct dgNode
-/* A node on a directed graph */
-    {
-    struct dgNode *next;   /* Next in master node list. */
-    char *name;            /* Name of node (allocated in hash). */
-    void *val;             /* Value of node. */
-    struct dgConnection *nextList;  /* Ways out of node. */
-    struct dgConnection *prevList;  /* Ways into node. */
-    int topoOrder;      /* Topographical order after call to dgTopoSort. */
-    int component;      /* Connected component number after call to dgConnectedComponents. */
-    int priority;       /* Node priority. */
-    struct dgNode *tempEntry;  /* Way in for breadth first search */
-    bool visited;       /* Visit order in depth first traversal. */
-    bool conn;	        /* Flag for connection algorithms. */
-    bool flagA;         /* Flag used in rangeGraph algorithms. */
-    bool flagB;         /* Currently unused flag. */
-    };
-
-struct dgEdge
-/* An edge on graph */
-    {
-    void *val;		/* Value of edge. */
-    struct dgNode *a;   /* Node on incoming side. */
-    struct dgNode *b;   /* Node on outgoing side. */
-    bool unflippable;	/* True if can't flip this edge (specialized ooGreedy thing really) */
-    };
-
-struct dgConnection
-/* Connects one node to another. Linked to edge. */
-    {
-    struct dgConnection *next;  /* Next in list. */
-    struct dgNode *node;        /* Node this connects to. */
-    struct dlNode *edgeOnList;  /* Associated edge. */
-    };
-
-struct dgNodeRef
-/* A reference to a node. */
-    {
-    struct dgNodeRef *next;	/* Next in list. */
-    struct dgNode *node;        /* Pointer to node. */
-    };
-
-struct dgEdgeRef
-/* A reference to an edge. */
-    {
-    struct dgEdgeRef *next;	/* Next in list. */
-    struct dgEdge *edge;        /* Reference to edge. */
-    };
-
-struct diGraph *dgNew();
-/* Return a new directed graph object. */
-
-void dgFree(struct diGraph **pGraph);
-/* Free a directed graph. */
-
-struct dgNode *dgAddNode(struct diGraph *dg, char *name, void *val);
-/* Create new node in graph. */
-
-struct dgNode *dgAddNumberedNode(struct diGraph *dg, int id, void *val);
-/* Create new node with a number instead of a name. */
- 
-struct dgNode *dgFindNode(struct diGraph *dg, char *name);
-/* Find existing node in graph. */
-
-struct dgNode *dgFindNumberedNode(struct diGraph *dg, int id);
-/* Find node given number. */
-
-void *dgNodeVal(struct dgNode *node);
-/* Return value associated with node. */
-
-void *dgNodeName(struct dgNode *node);
-/* Return name associated with node. */
-
-int dgNodeNumber(struct dgNode *node);
-/* Return number of node.  (Will likely return 0 if node
- * was added with a name rather than a number). */
-
-struct dgEdge *dgConnect(struct diGraph *dg, struct dgNode *a, struct dgNode *b);
-/* Connect node a to node b.  Returns connecting edge. */
-
-struct dgEdge *dgConnectWithVal(struct diGraph *dg, struct dgNode *a, struct dgNode *b, void *val);
-/* Connect node a to node b and put val on edge. */
-
-struct dgEdge *dgConnectUnflippable(struct diGraph *dg, struct dgNode *a, struct dgNode *b,
-    void *val);
-/* Connect a to b with an edge than can't be flipped. */
-
-void dgDisconnect(struct diGraph *dg, struct dgNode *a, struct dgNode *b);
-/* Disconnect nodes a and b. */
-
-struct dgEdge *dgDirectlyFollows(struct diGraph *dg, struct dgNode *a, struct dgNode *b);
-/* Return TRUE if b directly follows a. */
-
-boolean dgPathExists(struct diGraph *dg, struct dgNode *a, struct dgNode *b);
-/* Return TRUE if there's a path from a to b. */
-
-struct dgNodeRef *dgFindPath(struct diGraph *dg, struct dgNode *a, struct dgNode *b);
-/* Find shortest path from a to b.  Return NULL if can't be found. */
-
-struct dgNodeRef *dgFindConnectedToNode(struct diGraph *dg, struct dgNode *a);
-/* Return reference list of all nodes connected to a, including a.
- * slFreeList this list when done. */
-
-struct dgNodeRef *dgFindNewConnected(struct diGraph *dg, struct dgNode *a);
-/* Find a connected component guaranteed not to be covered before 
- * that includes a. */
-
-struct dgNodeRef *dgFindNewFlippableConnected(struct diGraph *dg, struct dgNode *a);
-/* Find a connected component guaranteed not to be covered before 
- * that includes a.  Connected components must be connected by flippable
- * edges. */
-
-struct dgNodeRef *dgFindNextConnected(struct diGraph *dg);
-/* Return list of nodes that make up next connected component,
- * or NULL if no more components.  slFreeList this when
- * done.  Call "dgClearConnFlags" before first call to this.
- * Do not call dgFindConnectedToNode between dgFindFirstConnected 
- * and this as they use the same flag variables to keep track of
- * what vertices are used. */
-
-struct dgNodeRef *dgFindNextFlippableConnected(struct diGraph *dg);
-/* Like dgFindConnected, but only considers graph nodes that
- * are conencted by a flippable edge. */
-
-int dgConnectedComponents(struct diGraph *dg);
-/* Count number of connected components and set component field
- * of each node to reflect which component it is in. */
-
-int dgConnectedFlippableComponents(struct diGraph *dg);
-/* Count number of connected components and set component field
- * of each node to reflect which component it is in. Only
- * consider components connected by flippable edges. */
-
-void dgTopoSort(struct diGraph *dg);
-/* Fill in topological order of nodes. */
-
-boolean dgHasCycles(struct diGraph *dg);
-/* Return TRUE if directed graph has cycles. */
-
-boolean dgParentsAllVisited(struct dgNode *node);
-/* Return TRUE if all parents of node have  been visited. */
-
-struct dgNodeRef *dgConstrainedPriorityOrder(struct diGraph *dg);
-/* Return traversal of graph in priority order subject to
- * constraint that all parents must be output before
- * their children regardless of node priority. 
- * Graph must be cycle free. */
-
-boolean dgRangesConsistent(struct diGraph *rangeGraph,
-   boolean (*findEdgeRange)(struct dgEdge *edge, int *retMin, int *retMax) );
-/* Return TRUE if graph with a range of allowable distances associated
- * with each edge is internally consistent. */
-
-boolean dgAddedRangeConsistent(struct diGraph *rangeGraph,
-   struct dgNode *a, struct dgNode *b, int abMin, int abMax,
-   boolean (*findEdgeRange)(struct dgEdge *edge, int *retMin, int *retMax) );
-/* Return TRUE if graph with a range of allowable distances associated
- * with each edge would be internally consistent if add edge from a to b
- * with given min/max values. */
-
-struct dgEdgeRef *dgFindSubEdges(struct diGraph *dg, struct dgNodeRef *subGraph,
-	boolean onlyFlippable);
-/* Return list of edges in graph that connected together nodes in subGraph. 
- * Optionally return only flippable edges. */
-
-void dgSwapEdges(struct diGraph *dg, struct dgEdgeRef *erList);
-/* Swap polarity of all edges in erList.  (Assumes you don't have
- * edges going both directions in graph.) */
-
-void dgClearConnFlags(struct diGraph *dg);
-/* Clear out conn flags. */
-
-void dgClearVisitFlags(struct diGraph *dg);
-/* Clear out visit order flags. */
-
-struct dgNodeRef *dgFindNodeInRefList(struct dgNodeRef *refList, struct dgNode *node);
-/* Return reference to node if in list, or NULL if not. */
-
-struct dgConnection *dgFindNodeInConList(struct dgConnection *conList, struct dgNode *node);
-/* Return connection to node if in list, or NULL if not. */
-
-struct dgConnection *dgNextList(struct dgNode *node);
-/* Return list of connections out of this node. Don't free (or rearrange)
- * this list please. */
-
-struct dgConnection *dgPrevList(struct dgNode *node);
-/* Return list of connections into this node. Don't free (or rearrange)
- * this list please. */
-
-void dgDumpGraph(struct diGraph *dg, FILE *out, boolean hideIsolated);
-/* Dump info on graph to output. */
-
-#endif /* DIGRAPH_H */
-
diff --git a/gbtools/src/include/blatSrc/dlist.h b/gbtools/src/include/blatSrc/dlist.h
deleted file mode 100644
index 27cd226..0000000
--- a/gbtools/src/include/blatSrc/dlist.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* dlist.h - Headers for generic doubly-linked list routines. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef DLIST_H
-#define DLIST_H
-
-#ifndef COMMON_H
-#include "common.h"
-#endif
-
-struct dlNode
-/* An element on a doubly linked list. */
-    {
-    struct dlNode *next;
-    struct dlNode *prev;
-    void *val;
-    };
-
-struct dlList
-/* A doubly linked list. */
-    {
-    struct dlNode *head;
-    struct dlNode *nullMiddle;
-    struct dlNode *tail;
-    };
-
-#define dlEnd(node) (node->next == NULL)
-/* True if node past end. */
-
-#define dlStart(node) (node->prev == NULL)
-/* True if node before start. */
-
-/* Iterate on a doubly linked list as so:
-    for (el = list->head; !dlEnd(el); el = el->next)
-        val = el->val;
-   or
-    for (el = list->tail; !dlStart(el); el = el->prev)
-        val = el->val;
- */
-
-struct dlList *newDlList();
-/* Return a new doubly linked list. */
-
-#define dlListNew newDlList
-/* Add object-first synonym. */
-
-void dlListInit(struct dlList *dl);
-/* Initialize list to be empty */
-
-void dlListReset(struct dlList *dl);
-/* Reset a list to the empty state (does not free values)  */
-
-void freeDlList(struct dlList **pList);
-/* Free up a doubly linked list and it's nodes (but not the node values). */
-#define dlListFree freeDlList
-
-void freeDlListAndVals(struct dlList **pList);
-/* Free all values in doubly linked list and the list itself.  (Just calls
- * freeMem on all values. */
-#define dlListFreeAndVals freeDlListAndVals
-
-void dlAddBefore(struct dlNode *anchor, struct dlNode *newNode);
-/* Add a node to list before anchor member. */
-
-void dlAddAfter(struct dlNode *anchor, struct dlNode *newNode);
-/* Add a node to list after anchor member. */
-
-void dlAddHead(struct dlList *list, struct dlNode *newNode);
-/* Add a node to head of list. */
-
-void dlAddTail(struct dlList *list, struct dlNode *newNode);
-/* Add a node to tail of list. */
-
-struct dlNode *dlAddValBefore(struct dlNode *anchor, void *val);
-/* Create a node containing val and add to list before anchor member. */
-
-struct dlNode *dlAddValAfter(struct dlNode *anchor, void *val);
-/* Create a node containing val and add to list after anchor member. */
-
-struct dlNode *dlAddValHead(struct dlList *list, void *val);
-/* Create a node containing val and add to head of list. */
-
-struct dlNode *dlAddValTail(struct dlList *list, void *val);
-/* Create a node containing val and add to tail of list. */
-
-void dlRemove(struct dlNode *node);
-/* Removes a node from list. Node is not freed. */
-
-void dlRemoveHead(struct dlList *list);
-/* Removes head from list. Node is not freed. */
-
-void dlRemoveTail(struct dlList *list);
-/* Remove tail from list. Node is not freed.  */
-
-struct dlNode *dlPopHead(struct dlList *list);
-/* Remove first node from list and return it. */
-
-struct dlNode *dlPopTail(struct dlList *list);
-/* Remove last node from list and return it. */
-
-void dlDelete(struct dlNode **nodePtr);
-/* Removes a node from list and frees it. */
-
-int dlCount(struct dlList *list);
-/* Return length of list. */
-
-boolean dlEmpty(struct dlList *list);
-/* Return TRUE if list is empty. */
-
-#define dlIsEmpty(list) ((list)->head->next == NULL)
-/* Return TRUE if list is empty.  Macro version of above. */
-
-struct dlNode *dlGetBeforeHead(struct dlList *list);
-/* Get the node before the head of the list */
-
-struct dlNode *dlGetAfterTail(struct dlList *list);
-/* Get the node after the tail of the list */
-
-void dlSort(struct dlList *list, int (*compare )(const void *elem1,  const void *elem2));
-/* Sort a doubly linked list with Qsort and a temporary array. 
- * The arguments to the compare function in real, non-void, life
- * are pointers to pointers of the type that is in the val field of 
- * the nodes of the list. */
-
-void *dlListToSlList(struct dlList *dList);
-/* Return slList from dlList. */
-
-void dlCat(struct dlList *a, struct dlList *b);
-/* Move items from b to end of a. */
-
-struct dlNode *dlValInList(struct dlList *list, void *val);
-/* Return node on list if any that has associated val. */
-
-#endif /* DLIST_H */
-
-
diff --git a/gbtools/src/include/blatSrc/dnaLoad.h b/gbtools/src/include/blatSrc/dnaLoad.h
deleted file mode 100644
index dcd798b..0000000
--- a/gbtools/src/include/blatSrc/dnaLoad.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* dnaLoad - Load dna from a variaty of file formats. */
-
-#ifndef DNALOAD_H
-#define DNALOAD_H
-
-struct dnaLoad;		/* Structure we keep private. */
-
-struct dnaLoad *dnaLoadOpen(char *fileName);
-/* Return new DNA loader.  Call dnaLoadNext() on this until
- * you get a NULL return, then dnaLoadClose(). */
-
-struct dnaSeq *dnaLoadNext(struct dnaLoad *dl);
-/* Return next dna sequence. */
-
-int dnaLoadCurStart(struct dnaLoad *dl);
-/* Returns the start offset of current sequence within a larger
- * sequence.  Useful for programs that want to auto-lift
- * nib and 2bit fragments.  Please call only after a
- * sucessful dnaLoadNext. */
-
-int dnaLoadCurEnd(struct dnaLoad *dl);
-/* Returns the end offset of current sequence within a larger
- * sequence.  Useful for programs that want to auto-lift
- * nib and 2bit fragments.  Please call only after a
- * sucessful dnaLoadNext. */
-
-int dnaLoadCurSize(struct dnaLoad *dl);
-/* Returns the size of the parent sequence.  Useful for
- * auto-lift programs.  Please call only after dnaLoadNext. */
-
-void dnaLoadClose(struct dnaLoad **pDl);
-/* Free up resources associated with dnaLoad. */
-
-struct dnaSeq *dnaLoadAll(char *fileName);
-/* Return list of all DNA referenced in file.  File
- * can be either a single fasta file, a single .2bit
- * file, a .nib file, or a text file containing
- * a list of the above files. DNA is mixed case. */
-
-#endif /* DNALOAD_H */
diff --git a/gbtools/src/include/blatSrc/dnaMarkov.h b/gbtools/src/include/blatSrc/dnaMarkov.h
deleted file mode 100644
index 552422f..0000000
--- a/gbtools/src/include/blatSrc/dnaMarkov.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* dnaMarkov - stuff to build 1st, 2nd, 3rd, and coding
- * 3rd degree Markov models for DNA. */
-
-#ifndef DNAMARKOV_H
-#define DNAMARKOV_H
-
-void dnaMark0(struct dnaSeq *seqList, double mark0[5], int slogMark0[5]);
-/* Figure out frequency of bases in input.  Results go into
- * mark0 and optionally in scaled log form into slogMark0.
- * Order is N, T, C, A, G.  (TCAG is our normal order) */
-
-void dnaMark1(struct dnaSeq *seqList, double mark0[5], int slogMark0[5], 
-	double mark1[5][5], int slogMark1[5][5]);
-/* Make up 1st order Markov model - probability that one nucleotide
- * will follow another. Input is sequence and 0th order Markov models.
- * Output is first order Markov model. slogMark1 can be NULL. */
-
-void dnaMark2(struct dnaSeq *seqList, double mark0[5], int slogMark0[5],
-	double mark1[5][5], int slogMark1[5][5],
-	double mark2[5][5][5], int slogMark2[5][5][5]);
-/* Make up 1st order Markov model - probability that one nucleotide
- * will follow the previous two. */
-
-void dnaMarkTriple(struct dnaSeq *seqList, 
-    double mark0[5], int slogMark0[5],
-    double mark1[5][5], int slogMark1[5][5],
-    double mark2[5][5][5], int slogMark2[5][5][5],
-    int offset, int advance, int earlyEnd);
-/* Make up a table of how the probability of a nucleotide depends on the previous two.
- * Depending on offset and advance parameters this could either be a straight 2nd order
- * Markov model, or a model for a particular coding frame. */
-
-char *dnaMark2Serialize(double mark2[5][5][5]);
-// serialize a 2nd order markov model
-
-void dnaMark2Deserialize(char *buf, double mark2[5][5][5]);
-// deserialize a 2nd order markov model from buf which was serialized with dnaMark2Serialize
-
-void dnaMarkMakeLog2(double mark2[5][5][5]);
-// convert a 2nd-order markov array to log2
-
-#endif /* DNAMARKOV_H */
-
diff --git a/gbtools/src/include/blatSrc/dnaMotif.h b/gbtools/src/include/blatSrc/dnaMotif.h
deleted file mode 100644
index 6d4f7b1..0000000
--- a/gbtools/src/include/blatSrc/dnaMotif.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* dnaMotif.h was originally generated by the autoSql program, which also 
- * generated dnaMotif.c and dnaMotif.sql.  This header links the database and
- * the RAM representation of objects. */
-
-#ifndef DNAMOTIF_H
-#define DNAMOTIF_H
-
-#ifndef DNAUTIL_H
-#include "dnautil.h"
-#endif
-
-struct dnaMotif
-/* A gapless DNA motif */
-{
-    struct dnaMotif *next;  /* Next in singly linked list. */
-    char *name; /* Motif name. */
-    int columnCount;    /* Count of columns in motif. */ 
-    float *aProb;       /* Probability of A's in each column. */ 
-    float *cProb;       /* Probability of C's in each column. */
-    float *gProb;       /* Probability of G's in each column. */
-    float *tProb;       /* Probability of T's in each column. */
-};
-
-struct dnaMotif *dnaMotifCommaIn(char **pS, struct dnaMotif *ret);
-/* Create a dnaMotif out of a comma separated string. 
- * This will fill in ret if non-null, otherwise will
- * return a new dnaMotif */
-
-void dnaMotifFree(struct dnaMotif **pEl);
-/* Free a single dynamically allocated dnaMotif such as created
- * with dnaMotifLoad(). */
-
-void dnaMotifFreeList(struct dnaMotif **pList);
-/* Free a list of dynamically allocated dnaMotif's */
-
-void dnaMotifOutput(struct dnaMotif *el, FILE *f, char sep, char lastSep);
-/* Print out dnaMotif.  Separate fields with sep. Follow last field with lastSep. */
-
-#define dnaMotifTabOut(el,f) dnaMotifOutput(el,f,'\t','\n');
-/* Print out dnaMotif as a line in a tab-separated file. */
-
-#define dnaMotifCommaOut(el,f) dnaMotifOutput(el,f,',',',');
-/* Print out dnaMotif as a comma separated list including final comma. */
-
-float dnaMotifSequenceProb(struct dnaMotif *motif, DNA *dna);
-/* Return probability of dna according to motif.  Make sure
- * motif is probabalistic (with call to dnaMotifMakeProbabalistic
- * if you're not sure) before calling this. */
-
-char dnaMotifBestStrand(struct dnaMotif *motif, DNA *dna);
-/* Figure out which strand of DNA is better for probabalistic motif. */
-
-double dnaMotifBitScore(struct dnaMotif *motif, DNA *dna);
-/* Return logBase2-odds score of dna given a probabalistic motif. */
-
-double dnaMotifBitScoreWithMark0Bg(struct dnaMotif *motif, DNA *dna, double mark0[5]);
-/* Return logBase2-odds score of dna given a probabalistic motif and using a 0-order markov model for the background. */
-
-double dnaMotifBitScoreWithMarkovBg(struct dnaMotif *motif, DNA *dna, double mark2[5][5][5]);
-/* Return logBase2-odds score of dna given a probabalistic motif using a 2nd-order markov model for the background.
-   motif and markd2 must be in log2 format.
-   Seq must contain an extra two bases at the front (i.e. we start scoring from dna + 2). */
-
-void dnaMotifMakeLog2(struct dnaMotif *motif);
-
-void dnaMotifNormalize(struct dnaMotif *motif);
-/* Make all columns of motif sum to one. */
-
-boolean dnaMotifIsScoreBased(struct dnaMotif *motif);
-/* Return TRUE if dnaMotif is score-based (which we decide by
- * the presense of negative values. */
-
-void dnaMotifScoreToProb(struct dnaMotif *motif);
-/* Convert motif that is log-odds score based to motif
- * that is probability based.  This assumes that the
- * background distribution is simple: 25% for each base */
-
-void dnaMotifMakeProbabalistic(struct dnaMotif *motif);
-/* Change motif, which may be score or count based, to 
- * probabalistic one, where each column adds to 1.0 */
-
-double dnaMotifBitsOfInfo(struct dnaMotif *motif, int pos);
-/* Return bits of information at position. */
-
-void dnaMotifPrintProb(struct dnaMotif *motif, FILE *f);
-/* Print DNA motif probabilities. */
-
-void dnaMotifToLogoPs2(struct dnaMotif *motif, double widthPerBase, double height, 
-                       double minHeight, char *fileName);
-/* Write logo corresponding to motif to postScript file, with extended options. minHeight
- * is the minimum height that is excluded from information content scaling.  This allows
- * something to show up in columns with very little information content.  Setting this
- * to be the same as height creates an frequency-based logo.
- */
-
-void dnaMotifToLogoPs(struct dnaMotif *motif, double widthPerBase, double height, 
-	char *fileName);
-/* Write logo corresponding to motif to postScript file. */
-
-void dnaMotifToLogoPsW(struct dnaMotif *motif, double widthPerBase, double width,
-	double height, char *fileName);
-/* Write logo corresponding to motif to postScript file. 
- * use the whole window width, rather than just incrementing
- * by widthPerBase */
-
-void dnaMotifToLogoPng(
-	struct dnaMotif *motif,	/* Motif to draw. */
-	double widthPerBase, 	/* Width of each base. */
-	double height, 		/* Max height. */
-	char *gsExe, 		/* ghostscript executable, NULL for default */
-	char *tempDir,          /* temp dir , NULL for default */
-	char *fileName);	/* output png file name. */
-/* Write logo corresponding to motif to png file. */
-
-void dnaMotifToLogoPGM(
-	struct dnaMotif *motif,	/* Motif to draw. */
-	double widthPerBase, 	/* Width of each base. */
-	double width, 		/* Max width. */
-	double height, 		/* Max height. */
-	char *gsExe, 		/* ghostscript executable, NULL for default */
-	char *tempDir,          /* temp dir , NULL for default */
-	char *fileName);	/* output png file name. */
-/* Write logo corresponding to motif to PGM file. */
-
-#endif /* DNAMOTIF_H */
-
diff --git a/gbtools/src/include/blatSrc/dnaseq.h b/gbtools/src/include/blatSrc/dnaseq.h
deleted file mode 100644
index 164b1e9..0000000
--- a/gbtools/src/include/blatSrc/dnaseq.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* dnaSeq - stuff to manage DNA sequences. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef DNASEQ_H
-#define DNASEQ_H
-
-#ifndef DNAUTIL_H
-#include "dnautil.h"
-#endif
-
-#ifndef BITS_H
-#include "bits.h"
-#endif
-
-struct dnaSeq
-/* A dna sequence in one-character per base format. */
-    {
-    struct dnaSeq *next;  /* Next in list. */
-    char *name;           /* Name of sequence. */
-    DNA *dna;             /* Sequence base by base. */
-    int size;             /* Size of sequence. */
-    Bits* mask;           /* Repeat mask (optional) */
-    };
-
-typedef struct dnaSeq bioSeq;	/* Preferred use if either DNA or protein. */
-typedef struct dnaSeq aaSeq;	/* Preferred use if protein. */
-
-struct dnaSeq *newDnaSeq(DNA *dna, int size, char *name);
-/* Create a new DNA seq. */
-
-struct dnaSeq *cloneDnaSeq(struct dnaSeq *seq);
-/* Duplicate dna sequence in RAM. */
-
-void freeDnaSeq(struct dnaSeq **pSeq);
-/* Free up DNA seq.  */
-#define dnaSeqFree freeDnaSeq
-
-void freeDnaSeqList(struct dnaSeq **pSeqList);
-/* Free up list of DNA sequences. */
-#define dnaSeqFreeList freeDnaSeqList
-
-aaSeq *translateSeqN(struct dnaSeq *inSeq, unsigned offset, unsigned size, boolean stop);
-/* Return a translated sequence.  Offset is position of first base to
- * translate. If size is 0 then use length of inSeq. */
-
-aaSeq *translateSeq(struct dnaSeq *inSeq, unsigned offset, boolean stop);
-/* Return a translated sequence.  Offset is position of first base to
- * translate. If stop is TRUE then stop at first stop codon.  (Otherwise 
- * represent stop codons as 'Z'). */
-
-boolean seqIsDna(bioSeq *seq);
-/* Make educated guess whether sequence is DNA or protein. */
-
-boolean seqIsLower(bioSeq *seq);
-/* Return TRUE if sequence is all lower case. */
-
-bioSeq *whichSeqIn(bioSeq **seqs, int seqCount, char *letters);
-/* Figure out which if any sequence letters is in. */
-
-Bits *maskFromUpperCaseSeq(bioSeq *seq);
-/* Allocate a mask for sequence and fill it in based on
- * sequence case. */
-
-struct hash *dnaSeqHash(struct dnaSeq *seqList);
-/* Return hash of sequences keyed by name. */
-
-int dnaSeqCmpName(const void *va, const void *vb);
-/* Compare to sort based on sequence name. */
-
-#endif /* DNASEQ_H */
-
diff --git a/gbtools/src/include/blatSrc/dnautil.h b/gbtools/src/include/blatSrc/dnautil.h
deleted file mode 100644
index 2a9b15f..0000000
--- a/gbtools/src/include/blatSrc/dnautil.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/* Some stuff that you'll likely need in any program that works with
- * DNA.  Includes stuff for amino acids as well. 
- *
- * Assumes that DNA is stored as a character.
- * The DNA it generates will include the bases 
- * as lowercase tcag.  It will generally accept
- * uppercase as well, and also 'n' or 'N' or '-'
- * for unknown bases. 
- *
- * Amino acids are stored as single character upper case. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-
-#ifndef DNAUTIL_H
-#define DNAUTIL_H
-
-void dnaUtilOpen(); /* Good idea to call this before using any arrays
-		     * here.  */
-
-/* Numerical values for bases. */
-#define T_BASE_VAL 0
-#define U_BASE_VAL 0
-#define C_BASE_VAL 1
-#define A_BASE_VAL 2
-#define G_BASE_VAL 3
-#define N_BASE_VAL 4   /* Used in 1/2 byte representation. */
-
-typedef char DNA;
-typedef char AA;
-typedef char BIOPOL;	/* Biological polymer. */
-
-/* A little array to help us decide if a character is a 
- * nucleotide, and if so convert it to lower case. 
- * Contains zeroes for characters that aren't used
- * in DNA sequence. */
-extern DNA ntChars[256];
-extern AA aaChars[256];
-
-/* An array that converts alphabetical DNA representation
- * to numerical one: X_BASE_VAL as above.  For charaters
- * other than [atgcATGC], has -1. */
-extern int ntVal[256];
-extern int aaVal[256];
-extern int ntValLower[256];	/* NT values only for lower case. */
-extern int ntValUpper[256];	/* NT values only for upper case. */
-
-/* Like ntVal, but with T_BASE_VAL in place of -1 for nonexistent nucleotides. */
-extern int ntValNoN[256];     
-
-/* Like ntVal but with N_BASE_VAL in place of -1 for 'n', 'x', '-', etc. */
-extern int ntVal5[256];
-
-/* Inverse array - takes X_BASE_VAL int to a DNA char
- * value. */
-extern DNA valToNt[];
-
-/* Similar array that doesn't convert to lower case. */
-extern DNA ntMixedCaseChars[256];
-
-/* Another array to help us do complement of DNA  */
-extern DNA ntCompTable[256];
-
-/* Arrays to convert between lower case indicating repeat masking, and
- * a 1/2 byte representation where the 4th bit indicates if the characeter
- * is masked. Uses N_BASE_VAL for `n', `x', etc.
-*/
-#define MASKED_BASE_BIT 8
-extern int ntValMasked[256];
-extern DNA valToNtMasked[256];
-
-/*Complement DNA (not reverse)*/
-void complement(DNA *dna, long length);
-
-/* Reverse complement DNA. */
-void reverseComplement(DNA *dna, long length);
-
-
-/* Reverse offset - return what will be offset (0 based) to
- * same member of array after array is reversed. */
-long reverseOffset(long offset, long arraySize);
-
-/* Switch start/end (zero based half open) coordinates
- * to opposite strand. */
-void reverseIntRange(int *pStart, int *pEnd, int size);
-
-/* Switch start/end (zero based half open) coordinates
- * to opposite strand. */
-void reverseUnsignedRange(unsigned *pStart, unsigned *pEnd, int size); 
-
-char *reverseComplementSlashSeparated(char *alleleStr);
-/* Given a slash-separated series of sequences (a common representation of variant alleles),
- * returns a slash-sep series with the reverse complement of each sequence (if it is a
- * nucleotide sequence), also reversing the order of sequences. */
-
-enum dnaCase {dnaUpper,dnaLower,dnaMixed,};
-/* DNA upper, lower, or mixed case? */
-
-/* Convert T's to U's */
-void toRna(DNA *dna);
-
-int cmpDnaStrings(DNA *a, DNA *b);
-/* Compare using screwy non-alphabetical DNA order TCGA */
-
-typedef char Codon; /* Our codon type. */
-
-/* Return single letter code (upper case) for protein.
- * Returns X for bad input, 0 for stop codon.
- * The "Standard" Code */
-AA lookupCodon(DNA *dna); 
-
-AA lookupUniqCodon(DNA *dna);
-
-boolean isStopCodon(DNA *dna);
-/* Return TRUE if it's a stop codon. */
-
-boolean isKozak(char *dna, int dnaSize, int pos);
-/* Return TRUE if it's a Kozak compatible start, using a relatively
- * weak definition (either A/G 3 bases before or G after) . */
-
-boolean isReallyStopCodon(char *dna, boolean selenocysteine);
-/* Return TRUE if it's really a stop codon, even considering
- * possibilility of selenocysteine. */
-
-/* Returns one letter code for protein, 
- * 0 for stop codon or X for bad input,
- * Vertebrate Mitochondrial Code */
-AA lookupMitoCodon(DNA *dna);
-
-Codon codonVal(DNA *start);
-/* Return value from 0-63 of codon starting at start. 
- * Returns -1 if not a codon. */
-
-DNA *valToCodon(int val);
-/* Return  codon corresponding to val (0-63) */
-
-extern char *aaAbbr(int i);
-/* return pointer to AA abbrevation */
-
-extern char aaLetter(int i);
-/* return AA letter */
-
-void dnaTranslateSome(DNA *dna, char *out, int outSize);
-/* Translate DNA upto a stop codon or until outSize-1 amino acids, 
- * whichever comes first. Output will be zero terminated. */
-
-char *skipIgnoringDash(char *a, int size, bool skipTrailingDash);
-/* Count size number of characters, and any 
- * dash characters. */
-
-int countNonDash(char *a, int size);
-/* Count number of non-dash characters. */
-
-int nextPowerOfFour(long x);
-/* Return next power of four that would be greater or equal to x.
- * For instance if x < 4, return 1, if x < 16 return 2.... 
- * (From biological point of view how many bases are needed to
- * code this number.) */
-
-long dnaFilteredSize(char *rawDna);
-/* Return how long DNA will be after non-DNA is filtered out. */
-
-long aaFilteredSize(char *rawDna);
-/* Return how long peptide will be after non-peptide is filtered out. */
-
-void dnaFilter(char *in, DNA *out);
-/* Filter out non-DNA characters. */
-
-void aaFilter(char *in, DNA *out);
-/* Filter out non-peptide characters. */
-
-void dnaFilterToN(char *in, DNA *out);
-/* Change all non-DNA characters to N. */
-
-void upperToN(char *s, int size);
-/* Turn upper case letters to N's. */
-
-void lowerToN(char *s, int size);
-/* Turn lower case letters to N's. */
-
-void dnaBaseHistogram(DNA *dna, int dnaSize, int histogram[4]);
-/* Count up frequency of occurance of each base and store 
- * results in histogram. Use X_BASE_VAL to index histogram. */
-
-void dnaMixedCaseFilter(char *in, DNA *out);
-/* Filter out non-DNA characters but leave case intact. */
-
-bits64 basesToBits64(char *dna, int size);
-/* Convert dna of given size (up to 32) to binary representation */
-
-bits32 packDna16(DNA *in);
-/* pack 16 bases into a word */
-
-bits16 packDna8(DNA *in);
-/* Pack 8 bases into a short word */
-
-UBYTE packDna4(DNA *in);
-/* Pack 4 bases into a UBYTE */
-
-void unpackDna(bits32 *tiles, int tileCount, DNA *out);
-/* Unpack DNA. Expands to 16x tileCount in output. */
-
-void unpackDna4(UBYTE *tiles, int byteCount, DNA *out);
-/* Unpack DNA. Expands to 4x byteCount in output. */
-
-void unalignedUnpackDna(bits32 *tiles, int start, int size, DNA *unpacked);
-/* Unpack into out, even though not starting/stopping on tile 
- * boundaries. */
-
-int intronOrientationMinSize(DNA *iStart, DNA *iEnd, int minIntronSize);
-/* Given a gap in genome from iStart to iEnd, return 
- * Return 1 for GT/AG intron between left and right, -1 for CT/AC, 0 for no
- * intron. */
-
-int intronOrientation(DNA *iStart, DNA *iEnd);
-/* Given a gap in genome from iStart to iEnd, return 
- * Return 1 for GT/AG intron between left and right, -1 for CT/AC, 0 for no
- * intron.  Assumes minIntronSize of 32. */
-
-int dnaScore2(DNA a, DNA b);
-/* Score match between two bases (relatively crudely). */
-
-int dnaScoreMatch(DNA *a, DNA *b, int size);
-/* Compare two pieces of DNA base by base. Total mismatches are
- * subtracted from total matches and returned as score. 'N's 
- * neither hurt nor help score. */
-
-int aaScore2(AA a, AA b);
-/* Score match between two bases (relatively crudely). */
-
-int aaScoreMatch(AA *a, AA *b, int size);
-/* Compare two peptides aa by aa. */
-
-int  dnaOrAaScoreMatch(char *a, char *b, int size, int matchScore, int mismatchScore, 
-	char ignore);
-/* Compare two sequences (without inserts or deletions) and score. */
-
-void writeSeqWithBreaks(FILE *f, char *letters, int letterCount, int maxPerLine);
-/* Write out letters with newlines every maxLine. */
-
-int tailPolyASizeLoose(DNA *dna, int size);
-/* Return size of PolyA at end (if present).  This allows a few non-A's as 
- * noise to be trimmed too, but skips first two aa for taa stop codon. 
- * It is less conservative in extending the polyA region than maskTailPolyA. */
-
-int headPolyTSizeLoose(DNA *dna, int size);
-/* Return size of PolyT at start (if present).  This allows a few non-T's as 
- * noise to be trimmed too, but skips last two tt for revcomp'd taa stop 
- * codon.  
- * It is less conservative in extending the polyA region than maskHeadPolyT. */
-
-int maskTailPolyA(DNA *dna, int size);
-/* Convert PolyA at end to n.  This allows a few non-A's as noise to be 
- * trimmed too.  Returns number of bases trimmed.  */
-
-int maskHeadPolyT(DNA *dna, int size);
-/* Convert PolyT at start.  This allows a few non-T's as noise to be 
- * trimmed too.  Returns number of bases trimmed.  */
-
-boolean isDna(char *poly, int size);
-/* Return TRUE if letters in poly are at least 90% ACGTNU- */
-
-boolean isAllDna(char *poly, int size);
-/* Return TRUE if size is great than 1 and all letters in poly are 100% ACGTNU- */
-
-boolean isAllNt(char *seq, int size);
-/* Return TRUE if all letters in seq are ACGTNU-. */
-
-#endif /* DNAUTIL_H */
diff --git a/gbtools/src/include/blatSrc/dtdParse.h b/gbtools/src/include/blatSrc/dtdParse.h
deleted file mode 100644
index 2acb1a3..0000000
--- a/gbtools/src/include/blatSrc/dtdParse.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* dtdParse - parse an XML DTD file.  Actually this only
- * parses a relatively simple subset of DTD's.  It's still
- * useful for autoXml and xmlToSql. */
-
-#ifndef DTDPARSE_H
-#define DTDPARSE_H
-
-struct dtdElement
-/* An element in an XML file. */
-    {
-    struct dtdElement *next;	/* Next in list. */
-    char *name;			/* Element Name. */
-    char *mixedCaseName;	/* Name converted from EL_NAME or el-name to elName. */
-    struct dtdElChild *children;     /* Child elements. */
-    struct dtdAttribute *attributes; /* Attributes. */
-    int lineIx;			/* Line where element occurs in dtd file. */
-    char *textType;		/* Text between tags if any. */
-    };
-
-struct dtdElChild
-/* A reference to a child element. */
-   {
-   struct dtdElChild *next;	/* Next in list. */
-   char *name;			/* Name of element. */
-   char copyCode;		/* '1', '+', '?', or '*' */
-   boolean isOr;                /* Is this part of a ( n | m ) "or" list? */
-   struct dtdElement *el;	/* Element definition. */
-   };
-
-struct dtdAttribute
-/* An attribute of some sort. */
-    {
-    struct dtdAttribute *next;	/* Next in list. */
-    char *name;			/* Name of attribute. */
-    char *mixedCaseName;	/* Name converted from EL_NAME or el-name to elName. */
-    char *type;			/* Element type - CDATA, INT, FLOAT, etc. */
-    boolean required;		/* True if required. */
-    char *usual;		/* Default value (or NULL if none) */
-    };
-
-void dtdParse(char *fileName, char *prefix, char *textField,
-	struct dtdElement **retList, struct hash **retHash);
-/* Parse out a dtd file into elements that are returned in retList,
- * and for your convenience also in retHash (which is keyed by the
- * name of the element.  Note that XML element names can include the '-'
- * character.  For this and other reasons in addition to the element
- * name as it appears in the XML tag, the element has a mixedCaseName
- * that strips '-' and '_' chars, and tries to convert the name to
- * a mixed-case convention style name.  The prefix if any will be
- * prepended to mixed-case names.  The textField is what to name
- * the field that contains the letters between tags.  By default
- * (if NULL) it is "text." */
-
-void dtdElementDump(struct dtdElement *el, FILE *f);
-/* Dump info on element. */
-
-#endif /* DTDPARSE_H */
diff --git a/gbtools/src/include/blatSrc/dyOut.h b/gbtools/src/include/blatSrc/dyOut.h
deleted file mode 100644
index ba84fe3..0000000
--- a/gbtools/src/include/blatSrc/dyOut.h
+++ /dev/null
@@ -1,141 +0,0 @@
-// dyOut - DYnamic string stack based OUTput
-//
-// CAUTION: Inclusion of this header will convert printfs to dyOutPrintfs!!!
-//          This is an Experimental/Test strategy only.  When dyOut is adopted,
-//          direct calls to dyOut functions should be used and printf macros removed.
-//
-// This module relies upon a dyString based stack of buffers which accumulate output
-// for later printing.  As a stack, only the top buffer can be filled and flushed out
-// (duOutFlush).  When flushing, the top buffer's content is appended to the next
-// lower buffer, unless explicitly requested otherwise (dyOutDirectly).
-// If the stack is empty, dyOutPrintf will be equivalent to printf.
-//
-// Output goes to STDOUT unless a single alternative out file is registered.
-
-#ifdef DSPRINT_H      // NEVER INCLUDE TWICE.  ONLY INCLUDE DIRECTLY IN C FILES.
-#error Including dyOut.h twice! Only include directly in C files as this redefines printf !!!
-#else//ifndef DSPRINT_H
-#define DSPRINT_H
-
-#include "common.h"
-#include "dystring.h"
-
-int dyOutOpen(int initialBufSize);
-// Allocate dynamic string and puts at top of stack
-// returns token to be used for later stack accounting asserts
-
-int dyOutPrintf(char *format, ...);
-// Prints into end of the top ds buffer, and return resulting string length
-// If there is no current buffer, this acts like a simple printf and returns -1
-#define dyOutPuts(str) dyOutPrintf("%s\n",str)
-#define dyOutPutc(chr) dyOutPrintf("%c",chr)
-#define SWAP_PRINTF
-#ifdef SWAP_PRINTF
-#define printf dyOutPrintf
-#define puts dyOutPuts
-#undef putc
-#define putc dyOutPutc
-#endif//def SWAP_PRINTF
-
-int dyOutPrintDirectly(int token,FILE *file);
-// Prints the contents of the top buffer directly to a file.
-// Will leave the filled buffer at top of stack
-// Returns the length printed.
-
-int dyOutFlush(int token);
-// Flushes the top buffer to the next lower one and empties top buffer.
-// If there is no lower buffer then the content is printed to STDOUT (or registered out).
-// Returns the length flushed.
-
-int dyOutClose(int token);
-// Abandons the top buffer and its content, freeing memory.
-// Returns the length abandoned.
-#define dyOutAbandon(token) dyOutClose(token)
-
-int dyOutFlushAndClose(int token);
-// Flushes the top buffer to the next lower one and frees the top buffer.
-// If there is no lower buffer then the content is printed to STDOUT (or registered out).
-// Returns the length flushed.
-
-int dyOutFlushAndCloseAll();
-// CAUTION: Bad practice to not Open/Close levels in turn!
-// flushes, frees and closes all stacked buffers
-// returns length flushed
-
-char * dyOutContent(int token);
-// returns the content of the current buffer as a string, but does not flush or free it
-// NOTE: returned pointer is not cloned memory and will be changed by successive dyOut calls
-
-int dyOutEmpty(int token);
-// Empties the top buffer in stack (abandoning content), but leave buffer in place
-// Returns the length abandoned.
-#define dyOutAbandonContent(token) dyOutEmpty(token)
-
-int dyOutSize(int token);
-// Returns the current length of the buffer starting at the level corresponding to token.
-// Unlike other cases, the token does not have to correspond to the top of the stack!
-#define dyOutIsEmpty(token) (dyOutSize(token) == 0)
-
-int dyOutSizeAll();
-// returns combined current size of all buffers
-#define dyOutIsAllEmpty(token) (dyOutSizeAll() == 0)
-
-int dyOutStackDepth();
-// Returns the current dyOut buffer stack depth
-#define dyOutIsOpen() (dyOutStackDepth() > 0)
-
-void dyOutRegisterAltStream(FILE *out);
-// Registers an alternative to STDOUT.  After registering, all dyOut out goes to this file.
-// NOTE: There is no stack. Register/Unregister serially.
-
-void dyOutUnregisterAltStream(FILE *out);
-// Unregisters the alternative to STDOUT.  After unregistering all dyOut out goes to STDOUT.
-// NOTE: There is no stack. Register/Unregister serially.
-
-char *dyOutCannibalizeAndClose(int token);
-// Closes the top stack buffer returning content.  Returned string should be freed.
-
-char *dyOutCannibalizeAndCloseAll();
-// CAUTION: Bad practice to not Open/Close levels in turn!
-// Closes all stack buffers and returns a single string that is the full content.  
-// Returned string should be freed.
-
-void *dyOutStackPop(int token);
-// CAUTION: Not for the faint of heart: print buffer surgery is no substitute for proper coding.
-// Returns a pointer which can be dyOutStackPush'd back into place.
-// Pop/Push is useful for inserting print immediately before a dyOutOpen'd print buffer
-
-void dyOutStackPush(int token,void *dyOutPointer);
-// CAUTION: Not for the faint of heart: print buffer surgery is no substitute for proper coding.
-// Push a previously dyOutStackPop'd print buffer back onto the stack
-// Pop/Push is useful for inserting print immediately before a dyOutOpen'd print buffer
-
-
-#ifdef NOT_NOW
-// Requires regex function added to dystring.c which has been successfully tested.
-boolean dyOutRegexReplace(int token, char *regExpression, char *replaceWith);
-// CAUTION: Not for the faint of heart: print buffer surgery is no substitute for proper coding.
-// Looks for and replaces a single instance of a wildcard match in the current dyOut print buffer
-// regex follows normal EXTENDED (egrep) rules except:
-// ^ - at beginning of the regExpression only and matches beginning of buffer (not of line)
-// $ - at end of regExpression only and matches end of buffer (not end of line)
-// \n - newlines in the body of the regExpression will match newlines in the current print buffer
-// Returns TRUE on success
-// CAUTION: Wildcards match largest sub-string [w.*d] matches all of "wild wild world"
-
-
-//void dyOutTest();
-// Tests of dyOut functions
-#endif///def NOT_NOW
-
-/* Next steps:
- * 1) DONE WITH MACROS: in cheapCgi.c replace all printfs with dyOutPrintf
- * 2) DONE WITH MACROS: in hui.c replace all printfs with dyOutPrintf
- * 3) DONE WITH MACROS: in hgTrackUi replace all printfs with dyOutPrintf
- * 4) DONE: After 1-3, add opens and closes to hgTrackUi
- * 5) DONE: Handle boxing cfg with dyOutPrintf (successful test)
- * 6) Handle isConfigurable tests with dyOutPrintf and throw away results
- *    This one will require making hgTrackUi Cfgs all lib code.
- */
-
-#endif /* DSPRINT_H */
diff --git a/gbtools/src/include/blatSrc/dystring.h b/gbtools/src/include/blatSrc/dystring.h
deleted file mode 100644
index 892fb7a..0000000
--- a/gbtools/src/include/blatSrc/dystring.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* dystring - dynamically resizing string.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef DYSTRING_H	/* Wrapper to avoid including this twice. */
-#define DYSTRING_H
-
-#include "common.h"
-
-struct dyString
-/* Dynamically resizable string that you can do formatted
- * output to. */
-    {
-    struct dyString *next;	/* Next in list. */
-    char *string;		/* Current buffer. */
-    int bufSize;		/* Size of buffer. */
-    int stringSize;		/* Size of string. */
-    };
-
-struct dyString *newDyString(int initialBufSize);
-/* Allocate dynamic string with initial buffer size.  (Pass zero for default) */
-
-#define dyStringNew newDyString
-
-void freeDyString(struct dyString **pDs);
-/* Free up dynamic string. */
-
-#define dyStringFree(a) freeDyString(a);
-
-void freeDyStringList(struct dyString **pDs);
-/* Free up a list of dynamic strings */
-
-#define dyStringFreeList(a) freeDyStringList(a);
-
-void dyStringAppend(struct dyString *ds, char *string);
-/* Append zero terminated string to end of dyString. */
-
-void dyStringAppendN(struct dyString *ds, char *string, int stringSize);
-/* Append string of given size to end of string. */
-
-char dyStringAppendC(struct dyString *ds, char c);
-/* Append char to end of string. */
-
-void dyStringAppendMultiC(struct dyString *ds, char c, int n);
-/* Append N copies of char to end of string. */
-
-void dyStringAppendEscapeQuotes(struct dyString *dy, char *string,
-	char quot, char esc);
-/* Append escaped-for-quotation version of string to dy. */
-
-#define dyStringWriteOne(dy, var) dyStringAppendN(dy, (char *)(&var), sizeof(var))
-/* Write one variable (binary!) to dyString - for cases when want to treat string like
- * a file stream. */
-
-void dyStringVaPrintf(struct dyString *ds, char *format, va_list args);
-/* VarArgs Printf to end of dyString. */
-
-void dyStringPrintf(struct dyString *ds, char *format, ...)
-/*  Printf to end of dyString. */
-#ifdef __GNUC__
-__attribute__((format(printf, 2, 3)))
-#endif
-    ;
-
-struct dyString *dyStringCreate(char *format, ...);
-/*  Create a dyString with a printf style initial content */
-
-#define dyStringClear(ds) (ds->string[0] = ds->stringSize = 0)
-/* Clear string. */
-
-struct dyString * dyStringSub(char *orig, char *in, char *out);
-/* Make up a duplicate of orig with all occurences of in substituted
- * with out. */
-
-void dyStringBumpBufSize(struct dyString *ds, int size);
-/* Force dyString buffer to be at least given size. */
-
-char *dyStringCannibalize(struct dyString **pDy);
-/* Kill dyString, but return the string it is wrapping
- * (formerly dy->string).  This should be free'd at your
- * convenience. */
-
-#define dyStringContents(ds) (ds)->string
-/* return raw string. */
-
-#define dyStringLen(ds) ds->stringSize
-/* return raw string length. */
-
-void dyStringResize(struct dyString *ds, int newSize);
-/* resize a string, if the string expands, blanks are appended */
-
-void dyStringQuoteString(struct dyString *dy, char quotChar, char *text);
-/* Append quotChar-quoted text (with any internal occurrences of quotChar
- * \-escaped) onto end of dy. */
-
-#endif /* DYSTRING_H */
-
diff --git a/gbtools/src/include/blatSrc/elmTree.h b/gbtools/src/include/blatSrc/elmTree.h
deleted file mode 100644
index 92c5df0..0000000
--- a/gbtools/src/include/blatSrc/elmTree.h
+++ /dev/null
@@ -1,122 +0,0 @@
-// elmTree.c/.h - Extensible local memory tree grown from an slList of objects, via
-// NEIGHBOR JOINING and a supplied compare routine.  Unlike hacTree, this is not a binary tree
-// and any node can have original content, a single parent and N children.  Superficially similar
-// to running slSort(), running elmTreeGrow() creates a tree from a single "root".  All branches
-// and leaves are represented as "tree nodes" which contain pointers to a user defined object,
-// a single parent, a first child (if the node is not a leaf) and a next sibling.  All nodes are
-// additionally joined together as an slList with the single "root" as the first member.  Thus
-// the tree can be traversed linerarly through node->next or hierarchically through recursive
-// node->firstChild,child->sibling access.
-// The tree is grown through neighbor joins and involves figuring out whether each successive 
-// content should be attached as a branch node or leaf node to the existing tree.  To facilitate
-// neighbor joining, each node has cumulative content from the single root node (whcih has NULL
-// content).  An example might be a tree of bitmaps where each node contains all the bits of its
-// parent plus additional bits.
-// Since an elmTree is build with local memory, free the tree by lmCleanup().
-
-#ifndef ELMTREE_H
-#define ELMTREE_H
-
-#include "common.h"
-#include "localmem.h"
-
-struct elmNode {
-// A tree node may be either a leaf or a branch, with branches having children
-// NOTE the root of the tree always has NULL content.
-    struct elmNode * next;       // slList of all nodes in tree starting with root
-    struct elmNode * parent;     // NULL: root of tree, else only one parent allowed
-    struct elmNode * firstChild; // NULL: leaf, or firstChild (successive are siblings)
-    struct elmNode * sibling;    // children are singly linked as on "next" sibling
-    int selfAndDescendants;      // count of self and descendants, but not siblings and parents
-    void *content; // Content of node, such as bitMap that defines node.
-};
-
-enum elmNodeOverlap {
-    enoExcluding  =    0,   // Nothing in common between 2 elements
-    enoEqual      =    1,   // Two node elements are identical
-    enoSuperset   =    2,   // First element completely covers second
-    enoSubset     =    3,   // First element is a subset of second
-    enoMixed      =    4    // Elements match some and differ some (use weight to distinguish)
-};
-
-
-// - - - - - growing a tree:
-typedef enum elmNodeOverlap (elmNodeCompareFunction)(const struct slList *elA,
-                                                     const struct slList *elB,
-                                                     int *joinWeight, void *extra);
-// Prototype of variable compare routines.  Caller may request joinWeight.  Fill this with a
-// weight of the commonality between two elements, with a greater weight representing a better
-// possible join.  An example might be bit compares and the weight being the number of bits
-// that match with the max being the number of possible matches.  This value will be used to
-// help decide what branch a new node should join.
-
-typedef struct slList *(elmNodeJoiningFunction)(const struct slList *elA,
-                                                const struct slList *elB,void *extra);
-// Prototype of function for creating the common content of 2 elements that are part of a tree.
-// As the tree grows, elements will get attached to common branches and those branches will
-// have content created by this function.  An example application might be two of your bitmaps
-// representing actual data being used to create a third bitmap with is the common bits set
-// but not representing one of your original element bitmaps (actual data).
-
-struct elmNode *elmTreeGrow(struct lm *lm,struct slList *collection, void *extra,
-                            elmNodeCompareFunction *neighborCmp,
-                            elmNodeJoiningFunction *neighborJoin);
-// Given a collection of content and a function to compare elements of the content,
-// returns a tree based on neighbor joining.  The nodes of the tree will have content
-// which is cumulative out to the leaves: the root node has null content, while any child
-// has content that is the superset of all it's parents.  Fill 'extra' with anything (like lm)
-// that you want passed into your compare and joining functions.
-
-
-// - - - - - picking nodes from a tree:
-typedef boolean (elmNodePickFunction)(struct slList *element,
-                                      struct slList *parent,void *extra,
-                                      struct slList **result);
-// Prototype for picking nodes by using recursive tree climbing routine.  This user provided 
-// function receives the content of a node and any extra structure provided.
-// The routine can return a result if desired.  When the function returns a result, then the
-// result of the nearest "parent" (if applicable) will be provided as well.  All results will
-// ultimately be strung together in a list in traversal order.  The routine should
-// return TRUE to keep traversing the tree and FALSE if tree traversal should stop.  
-
-boolean rElmTreeClimb(const struct elmNode *node, struct slList *parent, void *extra,
-                      elmNodePickFunction *elmPick, struct slList **results);
-// Recursively climbs tree and examines every node using the supplied function.
-// Each call on a node iterates through its siblings, recursively calling itself on any children.
-// This function might be used to build a list of objects from each or a subset of nodes.
-// If all examinations resulted in a structure, then the list will be in REVERSE traversal order.
-// If you immediately slReverse(results) then the list will ascend to the furthest leaf before
-// moving on to sibling leaves, twigs and branches.
-// Note: if results are returned, then "parent" is filled with nearest parent's result.
-// Return FALSE from the elmPick function to stop the traversal.  Thus, a complete traversal
-// returns TRUE, but one that has been stopped (after finding one node?) returns FALSE.
-
-
-// - - - - - general tree examination
-INLINE int elmNodeCountSiblings(const struct elmNode *node)
-// Counts siblings, including current
-{
-int count = 0;
-const struct elmNode *sibling = node;
-for (;sibling != NULL; sibling = sibling->sibling)
-    count++;
-return count;
-}
-#define elmNodeCountChildren(node) elmNodeCountSiblings((node)->firstChild)
-
-INLINE int elmNodeCountGenerations(const struct elmNode *node)
-// Counts direct generations (first children only), including current
-{
-int count = 0;
-const struct elmNode *child = node;
-for (;child != NULL; child = child->firstChild)
-    count++;
-return count;
-}
-
-#define elmNodeIsBranch(node) (node->firstChild != NULL)
-#define elmNodeIsLeaf(node)   (node->firstChild == NULL)
-#define elmNodeIsRoot(node)   (node->parent     == NULL)
-
-
-#endif//ndef ELMTREE_H
diff --git a/gbtools/src/include/blatSrc/emblParse.h b/gbtools/src/include/blatSrc/emblParse.h
deleted file mode 100644
index ff87f15..0000000
--- a/gbtools/src/include/blatSrc/emblParse.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Parse EMBL formatted files. EMBL files are basically line
- * oriented.  Each line begins with a short (usually two letter)
- * type word.  Adjacent lines with the same type are generally
- * considered logical extensions of each other.  In many cases
- * lines can be considered fields in an EMBL database.  Records
- * are separated by lines starting with '//'  Generally lines
- * starting with XX are empty and used to make the records more
- * human readable.   Here is an example record:
- 
- C  M00001
- XX
- ID  V$MYOD_01
- XX
- NA  MyoD
- XX
- DT  EWI (created); 19.10.92.
- DT  ewi (updated); 22.06.95.
- XX
- PO     A     C     G     T
- 01     0     0     0     0
- 02     0     0     0     0
- 03     1     2     2     0
- 04     2     1     2     0
- 05     3     0     1     1
- 06     0     5     0     0
- 07     5     0     0     0
- 08     0     0     4     1
- 09     0     1     4     0
- 10     0     0     0     5
- 11     0     0     5     0
- 12     0     1     2     2
- 13     0     2     0     3
- 14     1     0     3     1
- 15     0     0     0     0
- 16     0     0     0     0
- 17     0     0     0     0
- XX
- BF  T00526; MyoD                         ; mouse
- XX
- BA  5 functional elements in 3 genes
- XX
- XX
- //
- */
-
-#ifndef EMBLPARSE_H
-#define EMBLPARSE_H
-
-#ifndef HASH_H
-#include "hash.h"
-#endif
-
-#ifndef DYSTRING_H
-#include "dystring.h"
-#endif
-
-#ifndef LINEFILE_H
-#include "linefile.h"
-#endif
-
-boolean emblLineGroup(struct lineFile *lf, char type[16], struct dyString *val);
-/* Read next line of embl file.  Read line after that too if it
- * starts with the same type field. Return FALSE at EOF. */
-
-struct hash *emblRecord(struct lineFile *lf);
-/* Read next record and return it in hash.   (Free this
- * hash with freeHashAndVals.)   Hash is keyed by type
- * and has string values. */
-
-struct lineFile *emblOpen(char *fileName, char type[256]);
-/* Open up embl file, verify format and optionally  return 
- * type (VV line).  Close this with lineFileClose(). */
-
-#endif /* EMBLPARSE_H */
-
diff --git a/gbtools/src/include/blatSrc/ens.h b/gbtools/src/include/blatSrc/ens.h
deleted file mode 100644
index b48dfa4..0000000
--- a/gbtools/src/include/blatSrc/ens.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* ens.h - Interface to ensEMBL database. */
-#ifndef ENS_H
-#define ENS_H
-
-#ifndef DNAUTIL_H
-#include "dnautil.h"
-#endif 
-
-#ifndef DLIST_H
-#include "dlist.h"
-#endif 
-
-#ifndef UNFIN_H
-#include "unfin.h"
-#endif
-
-struct ensAnalysis
-/* A category of a feature. */
-    {
-    struct ensAnalysis *next;	/* Next in list */
-    int id;			/* Unique id for this feature type. */
-    char *db;			/* Database used. */
-    char *dbVersion;		/* Version of database. */
-    char *program;		/* Program used. */
-    char *programVersion;	/* Version of program. */
-    char *gffSource;		/* Source field from GFF. */
-    char *gffFeature;		/* Feature field from GFF. */
-    char *shortName;		/* 15 letter summary. */
-    };
-
-struct ensFeature
-/* An ensemble feature. */
-    {
-    struct ensFeature *next;	   /* Next in list. */
-    struct contigTree *tContig;    /* Name of target (genomic) sequence */
-    int tStart, tEnd;              /* Position in genomic sequence. */
-    int score;                     /* Score (I don't know units) */
-    int orientation;               /* +1 or -1.  Strand relative to contig. */
-    int type;                      /* Index into analysis table describing type of feature. */
-    char *typeName;                /* Subtype of type really. May be NULL. Not alloced here. */ 
-    int qStart, qEnd;              /* Query (cDNA, protein, etc.) sequence position. */
-    char *qName;                   /* Query sequence name. */
-    };
-
-struct ensExon
-/* An ensemble exon.  Since multiple transcripts can
- * use the same exon, this is stored as a reference on
- * a dlList in the transcript and as an instance in the
- * slList in the gene. */
-    {
-    struct ensExon *next;		/* Next in list (in ensGene) */
-    char *id;				/* Ensemble ID (not allocated here). */
-    struct contigTree *contig;	        /* Contig within clone this is in. (Not allocated here).*/
-    char phase;				/* AKA Frame - codon position of 1st base. */
-    char endPhase;                      /* Codon position of last base. */
-    int orientation;                    /* +1 or -1. Strand relative to contig. */
-    int seqStart;			/* Start position. */
-    int seqEnd;				/* End position. */
-    };
-
-struct ensTranscript
-/* A transcript (isoform) of a gene. */
-    {
-    struct ensTranscript *next;		/* Next in list. */
-    char *id;				/* Ensemble ID. */
-    struct dlList *exonList;		/* Ordered list of exon references. */
-    struct ensExon *startExon;          /* Reference to first coding exon. */
-    struct ensExon *endExon;            /* Reference to last coding exon. */
-    int startSeq, endSeq;               /* Start, end of coding region. */
-    };
-
-struct ensGene
-/* A gene.  A collection of exons and how they
- * are put together. */
-    {
-    struct ensGene *next;		  /* Next in list. */
-    char *id;				  /* Ensemble ID with many zeroes. */
-    struct ensTranscript *transcriptList; /* List of ways to transcribe and splice. */
-    struct hash *exonIdHash;		  /* Fast lookup of exons from exon ids. */
-    struct ensExon *exonList;		  /* Total exons in all transcripts. */
-    };
-
-void ensGetAnalysisTable(struct ensAnalysis ***retTable, int *retCount);
-/* Returns analysis table (array of different things a feature can be). 
- * No need to free this, it's managed by system. */
-
-struct dnaSeq *ensDnaInBacRange(char *clone, int start, int end, enum dnaCase dnaCase);
-/* Get DNA for range of clone in browser coordinates, including NNNs between contigs. */
-
-struct dnaSeq *ensDnaInBac(char *clone, enum dnaCase dnaCase);
-/* Get DNA for clone in browser coordinates, including NNNs between contigs. */
-
-
-struct ensFeature *ensGetFeature(char *featureId);
-/* Get a single feature of the given ID.  Returns NULL if no such feature.  */
-
-struct ensFeature *ensFeaturesInBac(char *clone);
-/* Get list of features associated with BAC clone. */
-
-struct ensFeature *ensFeaturesInBacRange(char *clone, int start, int end);
-/* Get list of features associated a section of BAC clone. */
-
-void ensFreeFeature(struct ensFeature **pFeature);
-/* Free up a single feature. */
-
-void ensFreeFeatureList(struct ensFeature **pFeatureList);
-/* Free up a list of features. */
-
-
-
-struct slName *ensGeneNamesInBac(char *bacName);
-/* Get list of all gene names in bac. */
-
-struct ensGene *ensGetGene(char *geneName);
-/* Get named gene. This can also be viewed as a list of one genes. */
-
-struct ensGene *ensGenesInBac(char *bacName);
-/* Get list of all genes in bac. */
-
-struct ensGene *ensGenesInBacRange(char *bacName, int start, int end);
-/* Get list of genes in a section of a BAC clone.  The start/end are
- * in browser coordinates. */
-
-void ensFreeGene(struct ensGene **pGene);
-/* Free up a single gene. */
-
-void ensFreeGeneList(struct ensGene **pGeneList);
-/* Free up a list of genes. */
-
-
-
-void ensParseContig(char *combined, char retBac[32], int *retContig);
-/* Parse combined bac.contig into two separate values. */
-
-int ensBrowserCoordinates(struct contigTree *contig, int x);
-/* Return x in browser coordinates. */
-
-int ensSubmitCoordinates(struct contigTree *contig, int x);
-/* Return x in GenBank/EMBL submission coordinates. */
-
-int ensBacBrowserLength(char *clone);
-/* Return size of clone in browser coordinate space. */
-
-int ensBacSubmitLength(char *clone);
-/* Return size of clone in GenBank/EMBL submission  coordinate space. */
-
-struct contigTree *ensBacContigs(char *bacId);
-/* Return contigTree rooted at Bac.  Do not free this or modify it, 
- * the system takes care of it. */
-
-struct contigTree *ensGetContig(char *contigId);
-/* Return contig associated with contigId. Do not free this, system
- * takes care of it. */
-
-void ensTranscriptBounds(struct ensTranscript *trans, int *retStart, int *retEnd);
-/* Find beginning and end of transcript in browser coordinates. */
-
-void ensGeneBounds(struct ensGene *gene, int *retStart, int *retEnd);
-/* Find beginning and end of gene in browser coordinates. */
-
-#endif /* ENS_H */
-
-
diff --git a/gbtools/src/include/blatSrc/errAbort.h b/gbtools/src/include/blatSrc/errAbort.h
deleted file mode 100644
index 4fd645b..0000000
--- a/gbtools/src/include/blatSrc/errAbort.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* ErrAbort.h - our error handler. 
- *
- * This maintains two stacks - a warning message printer
- * stack, and a "abort handler" stack.
- *
- * By default the warnings will go to stderr, and
- * aborts will exit the program.  You can push a
- * function on to the appropriate stack to change
- * this behavior.  The top function on the stack
- * gets called.
- *
- * Most functions in this library will call errAbort()
- * if they run out of memory.  
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef ERRABORT_H
-#define ERRABORT_H
-
-boolean isErrAbortInProgress();  
-/* Flag to indicate that an error abort is in progress.
- * Needed so that a warn handler can tell if it's really
- * being called because of a warning or an error. */
-
-void errAbort(char *format, ...)
-/* Abort function, with optional (printf formatted) error message. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-void vaErrAbort(char *format, va_list args);
-/* Abort function, with optional (vprintf formatted) error message. */
-
-void errnoAbort(char *format, ...)
-/* Prints error message from UNIX errno first, then does errAbort. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-typedef void (*AbortHandler)();
-/* Function that can abort. */
-
-void pushAbortHandler(AbortHandler handler);
-/* Set abort handler */
-
-void popAbortHandler();
-/* Revert to old abort handler. */
-
-void noWarnAbort();
-/* Abort without message. */
-
-void pushDebugAbort();
-/* Push abort handler that will invoke debugger. */
-
-void vaWarn(char *format, va_list args);
-/* Call top of warning stack to issue warning. */
-
-void warn(char *format, ...)
-/* Issue a warning message. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-void errnoWarn(char *format, ...)
-/* Prints error message from UNIX errno first, then does rest of warning. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-typedef void (*WarnHandler)(char *format, va_list args);
-/* Function that can warn. */
-
-void pushWarnHandler(WarnHandler handler);
-/* Set warning handler */
-
-void popWarnHandler();
-/* Revert to old warn handler. */
-
-void pushWarnAbort();
-/* Push handler that will abort on warnings. */
-
-void pushSilentWarnHandler();
-/* Set warning handler to be quiet.  Do a popWarnHandler to restore. */
-
-void errAbortDebugnPushPopErr();
-/*  generate stack dump if there is a error in the push/pop functions */
-
-#endif /* ERRABORT_H */
diff --git a/gbtools/src/include/blatSrc/errCatch.h b/gbtools/src/include/blatSrc/errCatch.h
deleted file mode 100644
index bcaec62..0000000
--- a/gbtools/src/include/blatSrc/errCatch.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* errCatch - help catch errors so that errAborts aren't
- * fatal, and warn's don't necessarily get printed immediately. 
- * Note that error conditions caught this way will tend to
- * leak resources unless there are additional wrappers. 
- *
- * Typical usage is
- * errCatch = errCatchNew();
- * if (errCatchStart(errCatch))
- *     doFlakyStuff();
- * errCatchEnd(errCatch);
- * if (errCatch->gotError)
- *     warn("Flaky stuff failed: %s", errCatch->message->string);
- * errCatchFree(&errCatch); 
- * cleanupFlakyStuff();
- */
-#ifndef ERRCATCH_H
-#define ERRCATCH_H
-
-#ifndef DYSTRING_H
-    #include "dystring.h"
-#endif
-
-struct errCatch
-/* Something to help catch errors.   */
-    {
-    struct errCatch *next;	 /* Next in stack. */
-    jmp_buf jmpBuf;		 /* Where to jump back to for recovery. */
-    struct dyString *message; /* Error message if any */
-    boolean gotError;		 /* Some sort of error was caught. */
-    boolean gotWarning;		 /* Some sort of error warning was raised. */
-    };
-
-struct errCatch *errCatchNew();
-/* Return new error catching structure. */
-
-void errCatchFree(struct errCatch **pErrCatch);
-/* Free up resources associated with errCatch */
-
-#define errCatchStart(e) (errCatchPushHandlers(e) && setjmp(e->jmpBuf) == 0)
-/* Little wrapper around setjmp.  This returns TRUE
- * on the main execution thread, FALSE after abort. */
-
-
-boolean errCatchPushHandlers(struct errCatch *errCatch);
-/* Push error handlers.  Not usually called directly. 
- * but rather through errCatchStart() macro.  Always
- * returns TRUE. */
-
-void errCatchEnd(struct errCatch *errCatch);
-/* Restore error handlers and pop self off of catching stack. */
-
-void errCatchReWarn(struct errCatch *errCatch);
-/* Re-warn any warnings that happened even though no abort happened 
- * to make them visible. */
-
-boolean errCatchFinish(struct errCatch **pErrCatch);
-/* Finish up error catching.  Report error if there is a
- * problem and return FALSE.  If no problem return TRUE.
- * This handles errCatchEnd and errCatchFree. */
-#endif /* ERRCATCH_H */
-
diff --git a/gbtools/src/include/blatSrc/fa.h b/gbtools/src/include/blatSrc/fa.h
deleted file mode 100644
index 02971b6..0000000
--- a/gbtools/src/include/blatSrc/fa.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Routines for reading and writing fasta format sequence files.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef FA_H
-#define FA_H
-
-#ifndef DNASEQ_H
-#include "dnaseq.h"
-#endif
-
-#ifndef LINEFILE_H
-#include "linefile.h"
-#endif
-
-struct dnaSeq *faReadDna(char *fileName);
-/* Open fa file and read a single dna sequence from it. */
-
-aaSeq *faReadAa(char *fileName);
-/* Open fa file and read a single dna sequence from it. */
-
-bioSeq *faReadSeq(char *fileName, boolean isDna);
-/* Read a dna or protein sequence. */
-
-struct dnaSeq *faReadAllDna(char *fileName);
-/* Return list of all DNA sequences in FA file. */
-
-struct dnaSeq *faReadAllPep(char *fileName);
-/* Return list of all Peptide sequences in FA file. */
-
-struct dnaSeq *faReadAllSeq(char *fileName, boolean isDna);
-/* Return list of all sequences in FA file. */
-
-struct dnaSeq *faReadAllMixed(char *fileName);
-/* Read in mixed case fasta file, preserving case. */
-
-struct hash *faReadAllIntoHash(char *fileName, enum dnaCase dnaCase);
-/* Return hash of all sequences in FA file.  */
-
-struct dnaSeq *faReadAllMixedInLf(struct lineFile *lf);
-/* Read in mixed case sequence from open fasta file. */
-
-struct dnaSeq *faReadOneDnaSeq(FILE *f, char *name, boolean mustStartWithSign);
-/* Read one sequence from FA file. Assumes positioned at or before
- * the '>' at start of sequence. */  
-
-boolean faReadNext(FILE *f, char *defaultName, boolean mustStartWithComment, 
-    char **retCommentLine, struct dnaSeq **retSeq);
-/* Read next sequence from .fa file. Return sequence in retSeq.  If retCommentLine is non-null
- * return the '>' line in retCommentLine.   The whole thing returns FALSE at end of file. 
- * Assumes positioned at or before the '>' at start of sequence.  File must have been
- * opened in binary mode! Note: sequence is mapped to lower case */
-
-boolean faReadMixedNext(FILE *f, boolean preserveCase, char *defaultName, 
-    boolean mustStartWithComment, char **retCommentLine, struct dnaSeq **retSeq);
-/* Read next sequence from .fa file. Return sequence in retSeq.  If retCommentLine is non-null
- * return the '>' line in retCommentLine.   The whole thing returns FALSE at end of file. Provides flag for preserving case in sequence */
-
-struct dnaSeq *faFromMemText(char *text);
-/* Return a sequence from a .fa file that's been read into
- * a string in memory. This cannabalizes text, which should
- * be allocated with needMem.  This buffer becomes part of
- * the returned dnaSeq, which may be freed normally with
- * freeDnaSeq. */
-
-bioSeq *faSeqFromMemText(char *text, boolean isDna);
-/* Convert fa in memory to bioSeq. This cannabalizes text
- * as does faFromMemText above. */
-
-bioSeq *faNextSeqFromMemText(char **pText, boolean isDna);
-/* Convert fa in memory to bioSeq.  Update *pText to point to next
- * record.  Returns NULL when no more sequences left. */
-
-bioSeq *faNextSeqFromMemTextRaw(char **pText);
-/* Same as faNextSeqFromMemText, but will leave in 
- * letters even if they aren't in DNA or protein alphabed. */
-
-bioSeq *faSeqListFromMemText(char *text, boolean isDna);
-/* Convert fa's in memory into list of dnaSeqs. */
-
-bioSeq *faSeqListFromMemTextRaw(char *text);
-/* Convert fa's in memory into list of dnaSeqs without
- * converting chars to N's. */
-
-boolean faFastReadNext(FILE *f, DNA **retDna, int *retSize, char **retName);
-/* Read in next FA entry as fast as we can. Return FALSE at EOF. 
- * The returned DNA and name will be overwritten by the next call
- * to this function. */
-
-boolean faSpeedReadNext(struct lineFile *lf, DNA **retDna, int *retSize, char **retName);
-/* Read in next FA entry as fast as we can. Faster than that old,
- * pokey faFastReadNext. Return FALSE at EOF. 
- * The returned DNA and name will be overwritten by the next call
- * to this function. */
-
-boolean faPepSpeedReadNext(struct lineFile *lf, DNA **retDna, int *retSize, char **retName);
-/* Read in next peptide FA entry as fast as we can.  */
-
-boolean faSomeSpeedReadNext(struct lineFile *lf, DNA **retDna, int *retSize, char **retName, boolean isDna);
-/* Read in DNA or Peptide FA record. */
-
-boolean faMixedSpeedReadNext(struct lineFile *lf, DNA **retDna, int *retSize, char **retName);
-/* Read in DNA or Peptide FA record in mixed case.   Allow any upper or lower case
- * letter, or the dash character in. */
-
-void faToProtein(char *poly, int size);
-/* Convert possibly mixed-case protein to upper case.  Also
- * convert any strange characters to 'X'.  Does not change size.
- * of sequence. */
-
-void faToDna(char *poly, int size);
-/* Convert possibly mixed-case DNA to lower case.  Also turn
- * any strange characters to 'n'.  Does not change size.
- * of sequence. */
-
-void faFreeFastBuf();
-/* Free up buffers used in fa fast and speedreading. */
-
-void faWrite(char *fileName, char *startLine, DNA *dna, int dnaSize);
-/* Write out FA file or die trying. */
-
-void faWriteNext(FILE *f, char *startLine, DNA *dna, int dnaSize);
-/* Write next sequence to fa file. */
-
-void faWriteAll(char *fileName, bioSeq *seqList);
-/* Write out all sequences in list to file. */
-
-#endif /* FA_H */
diff --git a/gbtools/src/include/blatSrc/fieldedTable.h b/gbtools/src/include/blatSrc/fieldedTable.h
deleted file mode 100644
index c212ce3..0000000
--- a/gbtools/src/include/blatSrc/fieldedTable.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* fieldedTable - a table composed of untyped strings in memory.  Includes names for each
- * field. This is a handy way of storing small-to-medium tab-separated files that begin
- * with a "#list of fields" line among other things. */
-
-#ifndef FIELDEDTABLE_H
-#define FIELDEDTABLE_H
-
-struct fieldedRow
-/* An array of strings with a little extra info, can be hung on a list. */
-    {
-    struct fieldedRow *next;
-    char **row; // Array of strings
-    int id;	// In the file case this is the line of file row starts in
-    };
-
-struct fieldedTable
-/* A table with a name for each field. */
-    {
-    struct fieldedTable *next;
-    char *name;	    /* Often the file name */
-    struct lm *lm;  /* All allocations done out of this memory pool. */
-    int fieldCount; /* Number of fields. */
-    char **fields;  /* Names of fields. */
-    struct fieldedRow *rowList;  /* list of parsed out fields. */
-    struct fieldedRow **cursor;  /* Pointer to where we add next item to list. */
-    };
-
-struct fieldedTable *fieldedTableNew(char *name, char **fields, int fieldCount);
-/* Create a new empty fieldedTable with given name, often a file name. */
-
-void fieldedTableFree(struct fieldedTable **pTable);
-/* Free up memory resources associated with table. */
-
-struct fieldedRow *fieldedTableAdd(struct fieldedTable *table,  char **row, int rowSize, int id);
-/* Create a new row and add it to table.  Return row. */
-
-struct fieldedTable *fieldedTableFromTabFile(char *fileName, char *url, char *requiredFields[], int requiredCount);
-/* Read table from tab-separated file with a #header line that defines the fields.  Ensures
- * all requiredFields (if any) are present.  The url is just used for error reporting and 
- * should be the same as fileName for most purposes.  This is used by edwSubmit though which
- * first copies to a local file, and we want to report errors from the url. */
-
-#endif /* FIELDEDTABLE_H */
-
diff --git a/gbtools/src/include/blatSrc/filePath.h b/gbtools/src/include/blatSrc/filePath.h
deleted file mode 100644
index ca4ddb5..0000000
--- a/gbtools/src/include/blatSrc/filePath.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* filePath - stuff to handle file name parsing. */
-#ifndef FILEPATH_H
-#define FILEPATH_H
-
-#include "common.h"
-
-void splitPath(char *path, char dir[PATH_LEN], char name[FILENAME_LEN],
-	       char extension[FILEEXT_LEN]);
-/* Split a full path into components.  The dir component will include the
- * trailing / if any.  The extension component will include the starting
- * . if any.   Pass in NULL for dir, name, or extension if you don't care about
- * that part. */
-
-char *expandRelativePath(char *baseDir, char *relPath);
-/* Expand relative path to more absolute one. */
-
-char *pathRelativeToFile(char *baseFile, char *relPath);
-/* Given a base file name and a path relative to that, return
- * relative path interpreted as if it were seen from the
- * same directory holding the baseFile.  
- *   An example of using this would be in processing include
- * files.  In this case the baseFile would be the current
- * source file, and the relPath would be from the include
- * statement.  The returned result could then be used to
- * open the include file. */
-
-void undosPath(char *path);
-/* Convert '\' to '/' in path. (DOS/Windows is typically ok with
- * this actually.) */
-
-#endif /* FILEPATH_H */
diff --git a/gbtools/src/include/blatSrc/flydna.h b/gbtools/src/include/blatSrc/flydna.h
deleted file mode 100644
index bdbd2a0..0000000
--- a/gbtools/src/include/blatSrc/flydna.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* flydna.h - routines for accessing fly genome and cDNA sequences. */
-
-#ifndef FLYDNA_H
-#define FLYDNA_H
-
-void flyLoadNt4Genome(struct nt4Seq ***retNt4Seq, int *retNt4Count);
-/* Load up entire packed fly genome into memory. */
-
-void flyFreeNt4Genome(struct nt4Seq ***pNt4Seq);
-/* Free up packed fly genome. */
-
-void flyChromNames(char ***retNames, int *retNameCount);
-/* Get list of fly chromosome names. */
-
-boolean flyCdnaSeq(char *name, struct dnaSeq **retDna, struct wormCdnaInfo *retInfo);
-/* Get a single fly cDNA sequence. Optionally (if retInfo is non-null) get additional
- * info about the sequence. */
-
-char *flyFeaturesDir();
-/* Return the features directory. (Includes trailing slash.) */
-
-FILE *flyOpenGoodAli();
-/* Opens good alignment file and reads signature. 
- * (You can then cdaLoadOne() it.) */
-
-#endif /* FLYDNA_H */
-
diff --git a/gbtools/src/include/blatSrc/fof.h b/gbtools/src/include/blatSrc/fof.h
deleted file mode 100644
index af2d27a..0000000
--- a/gbtools/src/include/blatSrc/fof.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* fof.h - Manages a fof-type index file.  This index refers
- * to records in multiple external files. */
-
-struct fofPos
-/* This holds the result of a FOF search. */
-    {
-    FILE *f;              /* File. */
-    bits32 offset;        /* Offset within file. */
-    bits32 size;          /* Size within file. */
-    int indexIx;          /* Position within index. */
-    char *fileName;       /* File name. */
-    };
-
-
-struct fof *fofOpen(char *fofName, char *fofDir);
-/* Open up the named fof. fofDir may be NULL.  It should include 
- * trailing '/' if non-null. */
-
-void fofClose(struct fof **pFof);
-/* Close down the named fof. */
-
-int fofElementCount(struct fof *fof);
-/* How many names are in fof file? */
-
-void fofMake(char *inFiles[], int inCount, char *outName, 
-    boolean (*readHeader)(FILE *inFile, void *data),
-    boolean (*nextRecord)(FILE *inFile, void *data, char **rName, int *rNameLen), 
-    void *data, boolean dupeOk);
-/* Make an index file
- * Inputs:
- *     inFiles - List of files that you're indexing with header read and verified.
- *     inCount - Size of file list.
- *     outName - name of index file to create
- *     readHeader - function that sets up file to read first record.  May be NULL.
- *     nextRecord - function that reads next record in file you're indexing
- *                  and returns the name of that record.  Returns FALSE at
- *                  end of file.  Can set *rNameLen to zero you want indexer
- *                  to ignore the record. 
- *     data - void pointer passed through to nextRecord.
- *     dupeOk - set to TRUE if you want dupes to not cause squawking
- */
-
-boolean fofFindFirst(struct fof *fof, char *prefix, 
-    int prefixSize, struct fofPos *retPos);
-/* Find first element with key starting with prefix. */
-
-boolean fofFind(struct fof *fof, char *name, struct fofPos *retPos);
-/* Find element corresponding with name.  Returns FALSE if no such name
- * in the index file. */
-
-void *fofFetch(struct fof *fof, char *name, int *retSize);
-/* Lookup element in index, allocate memory for it, and read
- * it.  Returns buffer with element in it, which should be
- * freeMem'd when done. Aborts if element isn't there. */
-
-char *fofFetchString(struct fof *fof, char *name, int *retSize);
-/* Lookup element in index, allocate memory for it, read it.
- * Returns zero terminated string with element in it, which 
- * should be freeMem'd when done. Aborts if element isn't there. */
-
-struct fofBatch
-/* A structure for doing batch FOF searches.  Client fills
- * in key and data members.  fofBatchSearch then fills in
- * file, offset, and size members.  The list on return is
- * sorted by file position for fast i/o. */
-    {
-    struct fofBatch *next;  /* Next in list. */
-    char *key;              /* Lookup key - filled in by client. Not allocate here. */
-    void *data;             /* Data associated with key - filled in by client. */
-    FILE *f;                /* File - filled in by server. */
-    bits32 offset;          /* Offset in file - filled in by server. */
-    bits32 size;            /* Size in file - filled in by server. */
-    };
- 
-struct fofBatch *fofBatchFind(struct fof *fof, struct fofBatch *list);
-/* Look up all of members on list. */
-
diff --git a/gbtools/src/include/blatSrc/fq.h b/gbtools/src/include/blatSrc/fq.h
deleted file mode 100644
index 22b04f4..0000000
--- a/gbtools/src/include/blatSrc/fq.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* fq - stuff for doing i/o on fastq files. */
-
-#ifndef FQ_H
-#define FQ_H
-
-struct fq
-/* Representation of record as 3 lines of text, not further parsed.  We omit the 1 of 4 lines in the
- * fastq record, using '+' as a marker between dna and quality. */
-    {
-    struct fq *next;
-    char *header;   // This line starts with @ and contains the sequence name plus other stuff
-    char *dna;  // ACGT and on occassional N normally
-    unsigned char *quality; // Might be 33-based (Sanger) or 64 based (Solexa)
-    };
-
-struct fq *fqReadNext(struct lineFile *lf);
-/* Read next record, return a fq struct. */
-
-void fqFree(struct fq **pFq);
-/* Free up *pFq and set it to NULL */
-
-void fqWriteNext(struct fq *input, FILE *f);
-/*  Writes a single fastq structure to the file provided. */
-
-#endif /* FQ_H */
-
diff --git a/gbtools/src/include/blatSrc/fuzzyFind.h b/gbtools/src/include/blatSrc/fuzzyFind.h
deleted file mode 100644
index c54ee8a..0000000
--- a/gbtools/src/include/blatSrc/fuzzyFind.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* fuzzyFind.h - This is the interface to the fuzzyFind
- * DNA sequence aligner.  This just returns a single
- * alignment - the one the algorithm thinks is best.
- * The algorithm is heuristic, but pretty good.  (See
- * comments in the fuzzyFind.c file for more details.) It
- * is not good for finding distant homologies, but it
- * will fairly reliably align a somewhat noisy cDNA
- * sequence with genomic sequence.
- *
- * The main data structure is the ffAli - which is
- * a node in a doubly linked list.  The finder algorithm
- * returns a pointer to the leftmost node in the list.
- * When you're done with the alignment you can dispose
- * of it via ffFreeAli.
- *
- * The finder supports three levels of stringency.
- * Generally you're best off using "ffTight".  "ffLoose"
- * will allow for more distant matches, but at the 
- * expense of very often taking several seconds to
- * return a garbage alignment.  "ffExact" requires
- * an exact match - which is quick, but in the
- * real world not so often useful.
- *
- * If you want to compare alignments use ffScore.
- */
-
-#ifndef FUZZYFIND_H
-#define FUZZYFIND_H
-
-#ifndef MEMGFX_H
-#include "memgfx.h"
-#endif 
-
-#ifndef DNAUTIL_H
-#include "dnautil.h"
-#endif
-
-#ifndef LOCALMEM_H
-#include "localmem.h"
-#endif
-
-#ifndef ALITYPE_H
-#include "aliType.h"
-#endif
-
-struct ffAli
-/* Node of a doubly linked list that will contain one
- * alignment. Contains information on a matching
- * set of DNA between needle and haystack. */
-    {
-    struct ffAli *left;   /* Neighboring intervals. */
-    struct ffAli *right;
-    char *nStart, *nEnd;          /* Needle start and end. (1/2 open interval) */
-    char *hStart, *hEnd;          /* Haystack start and end. */
-    int startGood, endGood; /* Number that match perfectly on ends. */
-    };
-
-/* maximum intron size for fuzzy find functions */
-
-#define ffIntronMaxDefault 750000	/* Default maximum intron size */
-
-extern int ffIntronMax;
-
-void setFfIntronMax(int value);         /* change max intron size */
-void setFfExtendThroughN(boolean val);	/* Set whether or not can extend through N's. */
-
-/************* lib/ffAli.c routines - using alignments ************/
-
-void ffFreeAli(struct ffAli **pAli);
-/* Dispose of memory gotten from fuzzyFind(). */
-
-int ffOneIntronOrientation(struct ffAli *left, struct ffAli *right);
-/* Return 1 for GT/AG intron between left and right, -1 for CT/AC, 0 for no
- * intron. */
-
-int ffIntronOrientation(struct ffAli *ali);
-/* Return + for positive orientation overall, - for negative,
- * 0 if can't tell. */
-
-int ffScoreIntron(DNA a, DNA b, DNA y, DNA z, int orientation);
-/* Return a better score the closer an intron is to
- * consensus. Max score is 4. */
-
-struct ffAli *ffRightmost(struct ffAli *ff);
-/* Return rightmost block of alignment. */
-
-struct ffAli *ffMakeRightLinks(struct ffAli *rightMost);
-/* Given a pointer to the rightmost block in an alignment
- * which has all of the left pointers filled in, fill in
- * the right pointers and return the leftmost block. */
- 
-void ffCountGoodEnds(struct ffAli *aliList);
-/* Fill in the goodEnd and badEnd scores. */
-
-int ffAliCount(struct ffAli *d);
-/* How many blocks in alignment? */
-
-struct ffAli *ffAliFromSym(int symCount, char *nSym, char *hSym,
-	struct lm *lm, char *nStart, char *hStart);
-/* Convert symbol representation of alignments (letters plus '-')
- * to ffAli representation.  If lm is nonNULL, ffAli result 
- * will be lmAlloced, else it will be needMemed. This routine
- * depends on nSym/hSym being zero terminated. */
-
-/************* lib/ffScore.c routines - scoring alignments ************/
-
-int ffScoreMatch(DNA *a, DNA *b, int size);
-/* Compare two pieces of DNA base by base. Total mismatches are
- * subtracted from total matches and returned as score. 'N's 
- * neither hurt nor help score. */
-
-int ffScoreCdna(struct ffAli *ali);
-/* Return score of alignment.  A perfect alignment score will
- * be the number of bases in needle. */
-
-int ffScore(struct ffAli *ali, enum ffStringency stringency);
-/* Score DNA based alignment. */
-
-int ffScoreProtein(struct ffAli *ali, enum ffStringency stringency);
-/* Figure out overall score of protein alignment. */
-
-int ffScoreSomething(struct ffAli *ali, enum ffStringency stringency,
-   boolean isProt);
-/* Score any alignment. */
-
-int ffScoreSomeAlis(struct ffAli *ali, int count, enum ffStringency stringency);
-/* Figure out score of count consecutive alis. */
-
-int ffCalcGapPenalty(int hGap, int nGap, enum ffStringency stringency);
-/* Return gap penalty for given h and n gaps. */
-
-int ffCalcCdnaGapPenalty(int hGap, int nGap);
-/* Return gap penalty for given h and n gaps in cDNA. */
-
-int ffGapPenalty(struct ffAli *ali, struct ffAli *right, enum ffStringency stringency);
-/* Calculate gap penaltly for alignment. */
-
-int ffCdnaGapPenalty(struct ffAli *ali, struct ffAli *right);
-/* Calculate gap penaltly for cdna alignment. */
-
-/************* jkOwnLib/ffAliHelp -helpers for alignment producers. ****************/
-
-boolean ffSlideIntrons(struct ffAli *ali);
-/* Slide introns (or spaces between aligned blocks)
- * to match consensus.  Return TRUE if any slid. */
-
-boolean ffSlideOrientedIntrons(struct ffAli *ali, int orient);
-/* Slide introns (or spaces between aligned blocks)
- * to match consensus on given strand (usually from ffIntronOrientation). */
-
-struct ffAli *ffRemoveEmptyAlis(struct ffAli *ali, boolean doFree);
-/* Remove empty blocks from list. Optionally free empties too. */
-
-struct ffAli *ffMergeHayOverlaps(struct ffAli *ali);
-/* Remove overlaps in haystack that perfectly abut in needle.
- * These are transformed into perfectly abutting haystacks
- * that have a gap in the needle. */
-
-struct ffAli *ffMergeNeedleAlis(struct ffAli *ali, boolean doFree);
-/* Remove overlapping areas needle in alignment. Assumes ali is sorted on
- * ascending nStart field. Also merge perfectly abutting neighbors.*/
-
-void ffExpandExactRight(struct ffAli *ali, DNA *needleEnd, DNA *hayEnd);
-/* Expand aligned segment to right as far as can exactly. */
-
-void ffExpandExactLeft(struct ffAli *ali, DNA *needleStart, DNA *hayStart);
-/* Expand aligned segment to left as far as can exactly. */
-
-struct ffAli *ffMergeClose(struct ffAli *aliList, 
-	DNA *needleStart, DNA *hayStart);
-/* Remove overlapping areas needle in alignment. Assumes ali is sorted on
- * ascending nStart field. Also merge perfectly abutting neighbors or
- * ones that could be merged at the expense of just a few mismatches.*/
-
-void ffAliSort(struct ffAli **pList, 
-	int (*compare )(const void *elem1,  const void *elem2));
-/* Sort a doubly linked list of ffAlis. */
-
-void ffCat(struct ffAli **pA, struct ffAli **pB);
-/* Concatenate B to the end of A. Eat up second list
- * in process. */
-
-int ffCmpHitsHayFirst(const void *va, const void *vb);
-/* Compare function to sort hit array by ascending
- * target offset followed by ascending query offset. */
-
-int ffCmpHitsNeedleFirst(const void *va, const void *vb);
-/* Compare function to sort hit array by ascending
- * query offset followed by ascending target offset. */
-
-/************* jkOwnLib/fuzzyFind - old local cDNA alignment. ****************/
-
-struct ffAli *ffFind(DNA *needleStart, DNA *needleEnd, DNA *hayStart, DNA *hayEnd,
-    enum ffStringency stringency);
-/* Return an alignment of needle in haystack. (Returns left end of doubly
- * linked alignment list.) The input DNA is all expected to be lower case
- * characters - a, c, g, t, or n. */
-
-boolean ffFindEitherStrand(DNA *needle, DNA *haystack, enum ffStringency stringency,
-    struct ffAli **pAli, boolean *pRcNeedle);
-/* Return TRUE if find an alignment using needle, or reverse complement of 
- * needle to search haystack. DNA must be lower case. Needle and haystack
- * are zero terminated. */
-
-boolean ffFindEitherStrandN(DNA *needle, int needleSize, DNA *haystack, int haySize,
-    enum ffStringency stringency, struct ffAli **pAli, boolean *pRcNeedle);
-/* Return TRUE if find an alignment using needle, or reverse complement of 
- * needle to search haystack. DNA must be lower case. */
-
-boolean ffFindAndScore(DNA *needle, int needleSize, DNA *haystack, int haySize,
-    enum ffStringency stringency, struct ffAli **pAli, boolean *pRcNeedle, int *pScore);
-/* Return TRUE if find an alignment using needle, or reverse complement of 
- * needle to search haystack. DNA must be lower case. If pScore is non-NULL returns
- * score of alignment. */
-
-/************* lib/fuzzyShow - display alignments. ****************/
-
-void ffShowSideBySide(FILE *f, struct ffAli *leftAli, DNA *needle, int needleNumOffset,
-		      DNA *haystack, int hayNumOffset, int haySize, int hayOffStart, int hayOffEnd,
-		      int blockMaxGap, boolean rcHaystack, boolean initialNewline);
-/* Print HTML side-by-side alignment of needle and haystack (no title or labels) to f.
- * {hay,needle}NumOffset are the coords at which the DNA sequence begins.
- * hayOff{Start,End} are the range of coords *relative to hayNumOffset* to which the 
- * alignment display will be clipped -- pass in {0,haySize} for no clipping. */
-
-int ffShAliPart(FILE *f, struct ffAli *aliList, 
-    char *needleName, DNA *needle, int needleSize, int needleNumOffset,
-    char *haystackName, DNA *haystack, int haySize, int hayNumOffset,
-    int blockMaxGap, boolean rcNeedle, boolean rcHaystack,
-    boolean showJumpTable, 
-    boolean showNeedle, boolean showHaystack,
-    boolean showSideBySide, boolean upcMatch,
-    int cdsS, int cdsE, int hayPartS, int hayPartE);
-/* Display parts of alignment on html page.  If hayPartS..hayPartE is a 
- * smaller subrange of the alignment, highlight that part of the alignment 
- * in both needle and haystack with underline & bold, and show only that 
- * part of the haystack (plus padding).  Returns number of blocks (after
- * merging blocks separated by blockMaxGap or less). */
-
-int ffShAli(FILE *f, struct ffAli *aliList, 
-    char *needleName, DNA *needle, int needleSize, int needleNumOffset,
-    char *haystackName, DNA *haystack, int haySize, int hayNumOffset,
-    int blockMaxGap,
-    boolean rcNeedle);
-/* Display alignment on html page.  Returns number of blocks (after
- * merging blocks separated by blockMaxGap or less). */
-
-void ffShowAli(struct ffAli *aliList, 
-    char *needleName, DNA *needle, int needleNumOffset,
-    char *haystackName, DNA *haystack, int hayNumOffset,
-    boolean rcNeedle);
-/* Display alignment on html page to stdout. */
-
-#endif /* FUZZYFIND_H */
-
diff --git a/gbtools/src/include/blatSrc/gapCalc.h b/gbtools/src/include/blatSrc/gapCalc.h
deleted file mode 100644
index 8da6208..0000000
--- a/gbtools/src/include/blatSrc/gapCalc.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* gapCalc - Stuff to calculate complex (but linear) gap costs quickly,
- * and read specifications from a file. */
-
-#ifndef GAPCALC_H
-#define GAPCALC_H
-
-    
-struct gapCalc;	  /* Predeclare structure.  It's complex and private though, so
-                   * real declaration is in gapCalc.c. */
-
-struct gapCalc *gapCalcDefault();
-/* Return default gapCalc. */
-
-struct gapCalc *gapCalcRnaDna();
-/* Return gaps suitable for RNA queries vs. DNA targets */
-
-struct gapCalc *gapCalcCheap();
-/* Return cheap gap costs. */
-
-struct gapCalc *gapCalcOriginal();
-/* Return gap costs from original paper. */
-
-struct gapCalc *gapCalcFromFile(char *fileName);
-/* Return gapCalc from file. */
-
-struct gapCalc *gapCalcFromString(char *s);
-/* Return gapCalc from description string. */
-
-struct gapCalc *gapCalcRead(struct lineFile *lf);
-/* Create gapCalc from open file. */
-
-void gapCalcFree(struct gapCalc **pGapCalc);
-/* Free up resources associated with gapCalc. */
-
-int gapCalcCost(struct gapCalc *gapCalc, int dq, int dt);
-/* Figure out gap costs. */
-
-char *gapCalcSampleFileContents();
-/* Return contents of a sample linear gap file. */
-
-void gapCalcTest(struct gapCalc *gapCalc);
-/* Print out gap cost info. */
-
-#endif /* GAPCALC_H */
diff --git a/gbtools/src/include/blatSrc/gdf.h b/gbtools/src/include/blatSrc/gdf.h
deleted file mode 100644
index 07380df..0000000
--- a/gbtools/src/include/blatSrc/gdf.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* gdf - Intronerator Gene Description File. */
-
-#ifndef GDF_H
-#define GDF_H
-
-#ifndef DNAUTIL_H
-#include "dnautil.h"
-#endif
-
-struct gdfDataPoint
-/* This stores data at each exon/intron boundary. */
-    {
-    int start;
-    };
-
-struct gdfGene
-/* One structure of these for each gene (each isoform of each gene
- * actually. */
-    {
-    struct gdfGene *next;
-    char *name;
-    int dataCount;
-    struct gdfDataPoint *dataPoints;
-    char strand;
-    UBYTE chromIx;
-    };
-
-struct gdfGene *newGdfGene(char *name, int nameSize, int exonCount, char strand, UBYTE chromIx);
-/* Return a new gene. */
-
-void gdfFreeGene(struct gdfGene *gene);
-/* Free a gene. */
-
-void gdfFreeGeneList(struct gdfGene **pList);
-/* Free a whole list of genes. */
-
-struct gdfGene *gdfReadOneGene(FILE *f);
-/* Read one entry from a Gdf file.  Assumes that the file pointer
- * is in the right place. */
-
-void gdfGeneExtents(struct gdfGene *gene, long *pMin, long *pMax);
-/* Figure out first and last base in gene. */
-
-void gdfOffsetGene(struct gdfGene *gene, int offset);
-/* Add offset to each point in gene */
-
-void gdfRcGene(struct gdfGene *gene, int size);
-/* Flip gene to other strand. Assumes dataPoints are already
- * moved into range from 0-size */
-
-void gdfUpcExons(struct gdfGene *gene, int geneOffset, DNA *dna, int dnaSize, int dnaOffset);
-/* Uppercase exons in DNA. */
-
-
-#endif /* GDF_H */
-
diff --git a/gbtools/src/include/blatSrc/genoFind.h b/gbtools/src/include/blatSrc/genoFind.h
deleted file mode 100644
index 856c3d2..0000000
--- a/gbtools/src/include/blatSrc/genoFind.h
+++ /dev/null
@@ -1,385 +0,0 @@
-/* genoFind.h - Interface to modules for fast finding of sequence
- * matches. */
-/* Copyright 2001-2002 Jim Kent.  All rights reserved. */
-
-#ifndef GENOFIND_H
-#define GENOFIND_H
-
-#ifndef DNASEQ_H
-#include "dnaseq.h"
-#endif
-
-#ifndef FUZZYFIND_H
-#include "fuzzyFind.h"
-#endif
-
-#ifndef HASH_H
-#include "hash.h"
-#endif
-
-#ifndef ALITYPE_H
-#include "aliType.h"
-#endif
-
-#ifndef LOCALMEM_H
-#include "localmem.h"
-#endif 
-
-#ifndef BITS_H
-#include "bits.h"
-#endif
-
-#ifndef AXT_H
-#include "axt.h"
-#endif
-
-enum gfConstants {
-    gfMinMatch = 2,
-    gfMaxGap = 2,
-    gfTileSize = 11,
-    gfMaxTileUse = 1024,
-    gfPepMaxTileUse = 30000,
-};
-
-struct gfSeqSource
-/* Where a block of sequence comes from. */
-    {
-    struct gfSeqSource *next;
-    char *fileName;	/* Name of file. */
-    bioSeq *seq;	/* Sequences.  Usually either this or fileName is NULL. */
-    bits32 start,end;	/* Position within merged sequence. */
-    Bits *maskedBits;	/* If non-null contains repeat-masking info. */
-    };
-
-struct gfHit
-/* A genoFind hit. */
-   {
-   struct gfHit *next;
-   bits32 qStart;		/* Where it hits in query. */
-   bits32 tStart;		/* Where it hits in target. */
-   bits32 diagonal;		/* tStart + qSize - qStart. */
-   };
-
-/* gfHits are free'd with simple freeMem or slFreeList. */
-
-struct gfClump
-/* A clump of hits. */
-/* Note: for clumps from regular (blat) queries, tStart and tEnd include 
- * target->start, but for clumps from gfPcrClumps(), tStart and tEnd have 
- * already had target->start subtracted.  So tStart and tEnd in PCR clumps 
- * are relative to that target sequence (not the collection of all target 
- * sequences). */
-    {
-    struct gfClump *next;	/* Next clump. */
-    bits32 qStart, qEnd;	/* Position in query. */
-    struct gfSeqSource *target;	/* Target source sequence. */
-    bits32 tStart, tEnd;	/* Position in target. */
-    int hitCount;		/* Number of hits. */
-    struct gfHit *hitList;	/* List of hits. Not allocated here. */
-    int queryCoverage;		/* Number of bases covered in query (thx AG!) */
-    };
-
-void gfClumpFree(struct gfClump **pClump);
-/* Free a single clump. */
-
-void gfClumpFreeList(struct gfClump **pList);
-/* Free a list of dynamically allocated gfClump's */
-
-struct genoFind
-/* An index of all K-mers in the genome. */
-    {
-    int maxPat;                          /* Max # of times pattern can occur
-                                          * before it is ignored. */
-    int minMatch;                        /* Minimum number of tile hits needed
-                                          * to trigger a clump hit. */
-    int maxGap;                          /* Max gap between tiles in a clump. */
-    int tileSize;			 /* Size of each N-mer. */
-    int stepSize;			 /* Spacing between N-mers. */
-    int tileSpaceSize;                   /* Number of N-mer values. */
-    int tileMask;			 /* 1-s for each N-mer. */
-    int sourceCount;			 /* Count of source files. */
-    struct gfSeqSource *sources;         /* List of sequence sources. */
-    bool isPep;			 	 /* Is a peptide. */
-    bool allowOneMismatch;		 /* Allow a single mismatch? */
-    int segSize;			 /* Index is segmented if non-zero. */
-    bits32 totalSeqSize;		 /* Total size of all sequences. */
-    bits32 *listSizes;                   /* Size of list for each N-mer */
-    void *allocated;                     /* Storage space for all lists. */
-    bits32 **lists;                      /* A list for each N-mer. Used if
-                                          * isSegmented is false. */
-    bits16 **endLists;                   /* A more complex list for each N-mer.
-                                          * Used if isSegmented is true.
-					  * Values come in groups of threes.
-					  * The first is the packed last few
-					  * letters of the tile.  The next two
-					  * are the offset in the genome.  This
-					  * would be a struct but that would take
-					  * 8 bytes instead of 6, or nearly an
-					  * extra gigabyte of RAM. */
-    };
-
-void genoFindFree(struct genoFind **pGenoFind);
-/* Free up a genoFind index. */
-
-struct gfSeqSource *gfFindNamedSource(struct genoFind *gf, char *name);
-/* Find target of given name.  Return NULL if none. */
-
-/* ---  Stuff for saving results ---- */
-
-
-struct gfOutput
-/* A polymorphic object to help us write many file types. */
-    {
-    struct gfOutput *next;
-    void *data;		/* Type-specific data pointer.  Must be freeMem'able */
-    void (*out)(char *chromName, int chromSize, int chromOffset,
-	    struct ffAli *ali, bioSeq *tSeq, struct hash *t3Hash, bioSeq *qSeq, 
-	    boolean qIsRc, boolean tIsRc,
-	    enum ffStringency stringency, int minMatch, struct gfOutput *out);
-    /* This is the type of a client provided function to save an alignment. 
-     * The parameters are:
-     *     chromName - name of target (aka genomic or database) sequence.
-     *     chromSize - size of target sequence.
-     *     chromOffset - offset of genoSequence in target.
-     *     ffAli - alignment with pointers into tSeq/qSeq or in
-     *             translated target case, into t3Hash.
-     *     tSeq - part of target sequence in normal case.   In translated
-     *             target case look at t3Hash instead.
-     *     t3Hash - used only in translated target case.  A hash keyed by
-     *             target sequence name with values *lists* of trans3 structures.
-     *             This hash can be searched to find both the translated and
-     *             untranslated versions of the bits of the target that are in 
-     *             memory.  (You can assume at this point all parts needed for
-     *             output are indeed in memory.)
-     *     qSeq - query sequence (this isn't segmented at all). 
-     *     isRc - True if query is reverse complemented.
-     *     stringency - ffCdna, etc.  I'm hoping to move this elsewhere.
-     *     minMatch - minimum score to output.  Also should be moved elsewhere.
-     *     outputData - custom data for specific output function.
-     * The interface is a bit complex - partly from the demands of translated
-     * output, and partly from trying not to have the entire target sequence in
-     * memory.
-     */
-    void (*queryOut)(struct gfOutput *out, FILE *f); 
-    /* Called for each query */
-
-    void (*fileHead)(struct gfOutput *out, FILE *f);
-    /* Write file header if any */
-
-    boolean reportTargetStrand; /* Report target as well as query strand? */
-    struct hash *maskHash;	/* associates target sequence name and mask. */
-    int minGood;		/* Minimum sequence identity in thousandths. */
-    boolean qIsProt;		/* Query is peptide. */
-    boolean tIsProt;		/* Target is peptide. */
-    int queryIx;		/* Index of query */
-    boolean includeTargetFile;	/* Prefix file: to target sequence name. */
-    };
-
-struct gfOutput *gfOutputAny(char *format, 
-	int goodPpt, boolean qIsProt, boolean tIsProt, 
-	boolean noHead, char *databaseName,
-	int databaseSeqCount, double databaseLetters,
-	double minIdentity, FILE *f);
-/* Initialize output in a variety of formats in file or memory. 
- * Parameters:
- *    format - either 'psl', 'pslx', 'blast', 'wublast', 'axt'
- *    goodPpt - minimum identity of alignments to output in parts per thousand
- *    qIsProt - true if query side is a protein.
- *    tIsProt - true if target (database) side is a protein.
- *    noHead - if true suppress header in psl/pslx output.
- *    databaseName - name of database.  Only used for blast output
- *    databaseSeq - number of sequences in database - only for blast
- *    databaseLetters - number of bases/aas in database - only blast
- *    FILE *f - file.  
- */
-
-struct gfOutput *gfOutputPsl(int goodPpt, 
-	boolean qIsProt, boolean tIsProt, FILE *f, 
-	boolean saveSeq, boolean noHead);
-/* Set up psl/pslx output */
-
-struct gfOutput *gfOutputAxt(int goodPpt, boolean qIsProt, 
-	boolean tIsProt, FILE *f);
-/* Setup output for axt format. */
-
-struct gfOutput *gfOutputAxtMem(int goodPpt, boolean qIsProt, 
-	boolean tIsProt);
-/* Setup output for in memory axt output. */
-
-struct gfOutput *gfOutputBlast(int goodPpt, 
-	boolean qIsProt, boolean tIsProt, 
-	char *databaseName, int databaseSeqCount, double databaseLetters,
-	char *blastType, /* blast, blast8, blast9, wublast, or xml */
-	double minIdentity, FILE *f);
-/* Setup output for blast/wublast format. */
-
-void gfOutputQuery(struct gfOutput *out, FILE *f);
-/* Finish writing out results for a query to file. */
-
-void gfOutputHead(struct gfOutput *out, FILE *f);
-/* Write out header if any. */
-
-void gfOutputFree(struct gfOutput **pOut);
-/* Free up output. */
-
-/* -------- Routines to build up index ------------ */
-
-void gfCheckTileSize(int tileSize, boolean isPep);
-/* Check that tile size is legal.  Abort if not. */
-
-struct genoFind *gfIndexSeq(bioSeq *seqList,
-	int minMatch, int maxGap, int tileSize, int maxPat, char *oocFile,
-	boolean isPep, boolean allowOneMismatch, boolean maskUpper,
-	int stepSize);
-/* Make index for all seqs in list. 
- *      minMatch - minimum number of matching tiles to trigger alignments
- *      maxGap   - maximum deviation from diagonal of tiles
- *      tileSize - size of tile in nucleotides
- *      maxPat   - maximum use of tile to not be considered a repeat
- *      oocFile  - .ooc format file that lists repeat tiles.  May be NULL. 
- *      isPep    - TRUE if indexing proteins, FALSE for DNA. 
- *      maskUpper - Mask out upper case sequence (currently only for nucleotides).
- *      stepSize - space between tiles.  Zero means default (which is tileSize). 
- * For DNA sequences upper case bits will be unindexed. */
-
-struct genoFind *gfIndexNibsAndTwoBits(int fileCount, char *fileNames[],
-	int minMatch, int maxGap, int tileSize, int maxPat, char *oocFile, 
-	boolean allowOneMismatch, int stepSize);
-/* Make index for all .nib and .2bits in list. 
- *      minMatch - minimum number of matching tiles to trigger alignments
- *      maxGap   - maximum deviation from diagonal of tiles
- *      tileSize - size of tile in nucleotides
- *      maxPat   - maximum use of tile to not be considered a repeat
- *      oocFile  - .ooc format file that lists repeat tiles.  May be NULL. 
- *      allowOneMismatch - allow one mismatch in a tile.  
- *      stepSize - space between tiles.  Zero means default (which is tileSize). */
-
-void gfIndexTransNibsAndTwoBits(struct genoFind *transGf[2][3], 
-    int fileCount, char *fileNames[], 
-    int minMatch, int maxGap, int tileSize, int maxPat, char *oocFile,
-    boolean allowOneMismatch, boolean mask, int stepSize);
-/* Make translated (6 frame) index for all .nib and .2bit files. */
-
-/* -------- Routines to scan index for homolgous areas ------------ */
-
-struct gfClump *gfFindClumps(struct genoFind *gf, struct dnaSeq *seq, 
-	struct lm *lm, int *retHitCount);
-/* Find clumps associated with one sequence. */
-
-struct gfClump *gfFindClumpsWithQmask(struct genoFind *gf, bioSeq *seq, 
-        Bits *qMaskBits, int qMaskOffset,
-	struct lm *lm, int *retHitCount);
-/* Find clumps associated with one sequence soft-masking seq according to qMaskBits */
-
-struct gfHit *gfFindHitsInRegion(struct genoFind *gf, bioSeq *seq, 
-	Bits *qMaskBits, int qMaskOffset, struct lm *lm, 
-	struct gfSeqSource *target, int tMin, int tMax);
-/* Find hits restricted to one particular region. 
- * The hits returned by this will be in target sequence
- * coordinates rather than concatenated whole genome
- * coordinates as hits inside of clumps usually are.  */
-
-void gfTransFindClumps(struct genoFind *gfs[3], aaSeq *seq, struct gfClump *clumps[3], struct lm *lm, int *retHitCount);
-/* Find clumps associated with one sequence in three translated reading frames. */
-
-void gfTransTransFindClumps(struct genoFind *gfs[3], aaSeq *seqs[3], 
-	struct gfClump *clumps[3][3], struct lm *lm, int *retHitCount);
-/* Find clumps associated with three sequences in three translated 
- * reading frames. Used for translated/translated protein comparisons. */
-
-void gfClumpDump(struct genoFind *gf, struct gfClump *clump, FILE *f);
-/* Print out info on clump.  This routine subtracts clump->target->start 
- * from clump->tStart and from clump->tEnd for printing, so that printed 
- * coords are relative to that target sequence. */
-
-
-void gfAlignAaClumps(struct genoFind *gf,  struct gfClump *clumpList, aaSeq *seq,
-    boolean isRc,  int minMatch,  struct gfOutput *out);
-/* Convert gfClumps to an actual alignment that gets saved via 
- * outFunction/outData. */
-
-void gfFindAlignAaTrans(struct genoFind *gfs[3], aaSeq *qSeq, struct hash *t3Hash, 
-	boolean tIsRc, int minMatch, struct gfOutput *out);
-/* Look for qSeq alignment in three translated reading frames. Save alignment
- * via outFunction/outData. */
-
-
-/* ---  Some routines for dealing with gfServer at a low level ---- */
-
-char *gfSignature();
-/* Return signature that starts each command to gfServer. Helps defend 
- * server from confused clients. */
-
-void gfCatchPipes();
-/* Set up to catch broken pipe signals. */
-
-int gfReadMulti(int sd, void *vBuf, size_t size);
-/* Read in until all is read or there is an error. */
-
-/* ---  Some routines for dealing with gfServer at a high level ---- */
-
-struct hash *gfFileCacheNew();
-/* Create hash for storing info on .nib and .2bit files. */
-
-void gfFileCacheFree(struct hash **pCache);
-/* Free up resources in cache. */
-
-void gfAlignStrand(int *pConn, char *nibDir, struct dnaSeq *seq,
-    boolean isRc,  int minMatch, 
-    struct hash *tFileCache, struct gfOutput *out);
-/* Search genome on server with one strand of other sequence to find homology. 
- * Then load homologous bits of genome locally and do detailed alignment.
- * Call 'outFunction' with each alignment that is found.  gfSavePsl is a handy
- * outFunction to use. */
-
-void gfAlignTrans(int *pConn, char *nibDir, aaSeq *seq,
-    int minMatch, struct hash *tFileHash, struct gfOutput *out);
-/* Search indexed translated genome on server with an amino acid sequence. 
- * Then load homologous bits of genome locally and do detailed alignment.
- * Call 'outFunction' with each alignment that is found. */
-
-void gfAlignTransTrans(int *pConn, char *nibDir, struct dnaSeq *seq, 
-	boolean qIsRc, int minMatch, struct hash *tFileCache, 
-	struct gfOutput *out, boolean isRna);
-/* Search indexed translated genome on server with an dna sequence.  Translate
- * this sequence in three frames. Load homologous bits of genome locally
- * and do detailed alignment.  Call 'outFunction' with each alignment
- * that is found. */
-
-int gfConnect(char *hostName, char *portName);
-/* Set up our network connection to server. */
-
-int gfDefaultRepMatch(int tileSize, int stepSize, boolean protTiles);
-/* Figure out appropriate step repMatch value. */
-
-void gfMakeOoc(char *outName, char *files[], int fileCount, 
-	int tileSize, bits32 maxPat, enum gfType tType);
-/* Count occurences of tiles in seqList and make a .ooc file. */
-
-void gfLongDnaInMem(struct dnaSeq *query, struct genoFind *gf, 
-   boolean isRc, int minScore, Bits *qMaskBits, struct gfOutput *out,
-   boolean fastMap, boolean band);
-/* Chop up query into pieces, align each, and stitch back
- * together again. */
-
-void gfLongTransTransInMem(struct dnaSeq *query, struct genoFind *gfs[3], 
-   struct hash *t3Hash, boolean qIsRc, boolean tIsRc, boolean qIsRna,
-   int minScore, struct gfOutput *out);
-/* Chop up query into pieces, align each in translated space, and stitch back
- * together again as nucleotides. */
-
-struct gfClump *gfPcrClumps(struct genoFind *gf, 
-        char *fPrimer, int fPrimerSize, char *rPrimer, int rPrimerSize,
-	int minDistance, int maxDistance);
-/* Find possible PCR hits.  The fPrimer and rPrimer are on opposite strands.
- * Note: unlike clumps from other query functions, PCR clumps from this 
- * function have already had clump->target->start subtracted from 
- * clump->tStart and clump->tEnd so that the coords are relative to that 
- * target sequence (not the collection of all target sequences). */
-
-#define MAXSINGLEPIECESIZE 5000 /* maximum size of a single piece */
-
-#define gfVersion "36"	/* Current BLAT version number */
-
-#endif /* GENOFIND_H */
-
diff --git a/gbtools/src/include/blatSrc/genomeRangeTree.h b/gbtools/src/include/blatSrc/genomeRangeTree.h
deleted file mode 100644
index 66d1e46..0000000
--- a/gbtools/src/include/blatSrc/genomeRangeTree.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* genomeRangeTree - This module is a way of keeping track of
- * non-overlapping ranges (half-open intervals) across a whole
- * genome (multiple chromosomes or scaffolds). 
- * It is a hash table container mapping chrom to rangeTree.
- * Most of the work is performed by rangeTree, this container
- * enables local memory and stack to be shared by many rangeTrees
- * so it should be able to handle genomes with a very large 
- * number of scaffolds. See rangeTree for more information. */
-
-#ifndef GENOMERANGETREE_H
-#define GENOMERANGETREE_H
-
-#ifndef HASH_H
-#include "hash.h"
-#endif
-
-#ifndef DYSTRING_H
-#include "dystring.h"
-#endif
-
-#ifndef RANGETREE_H
-#include "rangeTree.h"
-#endif
-
-struct genomeRangeTree
-/* A structure that allows efficient random access of ranges of bases covered
- * by a particular feature genome-wide.  Implemented as a range tree for each
- * scaffold or chromosome in a genome. */
-    {
-    struct genomeRangeTree *next;  /* Next genomeRangeTree in list if any. */
-    struct hash *hash;             /* Hash of rangeTrees keyed by chromosome/scaffold name. */
-    struct rbTreeNode *stack[128]; /* Stack for binary search. */
-    struct lm *lm;                 /* Local memory pool for tree nodes and ranges. */
-    };
-
-struct genomeRangeTree *genomeRangeTreeNew();
-/* Create a new, empty, genomeRangeTree. Uses the default hash size.
- * Free with genomeRangeTreeFree. */
-
-struct genomeRangeTree *genomeRangeTreeNewSize(int hashPowerOfTwoSize);
-/* Create a new, empty, genomeRangeTree. 
- * Free with genomeRangeTreeFree. */
-
-void genomeRangeTreeFree(struct genomeRangeTree **pTree);
-/* Free up genomeRangeTree. */
-
-struct rbTree *genomeRangeTreeFindRangeTree(struct genomeRangeTree *tree, char *chrom);
-/* Find the rangeTree for this chromosome, if any. Returns NULL if chrom not found.
- * Free with genomeRangeTreeFree. */
-
-struct rbTree *genomeRangeTreeFindOrAddRangeTree(struct genomeRangeTree *tree, char *chrom);
-/* Find the rangeTree for this chromosome, or add new chrom and empty rangeTree if not found.
- * Free with genomeRangeTreeFree. */
-
-struct range *genomeRangeTreeAdd(struct genomeRangeTree *tree, char *chrom, int start, int end);
-/* Add range to tree, merging with existing ranges if need be. 
- * Adds new rangeTree if chrom not found. */
-
-struct range *genomeRangeTreeAddVal(struct genomeRangeTree *tree, char *chrom, int start, int end, void *val, void *(*mergeVals)(void *existing, void*new));
-/* Add range to tree, merging with existing ranges if need be. 
- * Adds new rangeTree if chrom not found. 
- * If this is a new range, set the value to this val.
- * If there are existing items for this range, and if mergeVals function is not null, 
- * apply mergeVals to the existing values and this new val, storing the result as the val
- * for this range (see rangeTreeAddValCount() and rangeTreeAddValList() below for examples). */
-
-struct range *genomeRangeTreeAddValCount(struct genomeRangeTree *tree, char *chrom, int start, int end);
-/* Add range to tree, merging with existing ranges if need be. 
- * Adds new rangeTree if chrom not found. 
- * Set range val to count of elements in the range. Counts are pointers to 
- * ints allocated in tree localmem */
-
-struct range *genomeRangeTreeAddValList(struct genomeRangeTree *tree, char *chrom, int start, int end, void *val);
-/* Add range to tree, merging with existing ranges if need be. 
- * Adds new rangeTree if chrom not found. 
- * Add val to the list of values (if any) in each range.
- * val must be valid argument to slCat (ie, be a struct with a 'next' pointer as its first member) */
-
-boolean genomeRangeTreeOverlaps(struct genomeRangeTree *tree, char *chrom, int start, int end);
-/* Return TRUE if start-end overlaps anything in tree. */
-
-int genomeRangeTreeOverlapSize(struct genomeRangeTree *tree, char *chrom, int start, int end);
-/* Return the total size of intersection between interval
- * from start to end, and items in range tree. Sadly not
- * thread-safe. */
-
-struct range *genomeRangeTreeFindEnclosing(struct genomeRangeTree *tree, char *chrom, int start, int end);
-/* Find item in range tree that encloses range between start and end 
- * if there is any such item. */
-
-struct range *genomeRangeTreeAllOverlapping(struct genomeRangeTree *tree, char *chrom, int start, int end);
-/* Return list of all items in range tree that overlap interval start-end.
- * Do not free this list, it is owned by tree.  However it is only good until
- * next call to rangeTreeFindInRange or rangeTreeList. Not thread safe. */
-
-struct range *genomeRangeTreeMaxOverlapping(struct genomeRangeTree *tree, char *chrom, int start, int end);
-/* Return item that overlaps most with start-end. Not thread safe.  Trashes list used
- * by rangeTreeAllOverlapping. */
-
-struct range *genomeRangeTreeList(struct genomeRangeTree *tree, char *chrom);
-/* Return list of all ranges in single rangeTree in order.  Not thread safe. 
- * No need to free this when done, memory is local to tree. */
-
-struct dyString *genomeRangeTreeToString(struct genomeRangeTree *tree);
-/* Return a string representation of the genomeRangeTree.
- * Useful for testing.
- * Not thread-safe; uses globals */
-
-long long genomeRangeTreeSumRanges(struct genomeRangeTree *grt);
-/* Sum up all ranges in tree. */
-
-#endif /* GENOMERANGETREE_H */
-
diff --git a/gbtools/src/include/blatSrc/gfClientLib.h b/gbtools/src/include/blatSrc/gfClientLib.h
deleted file mode 100644
index 7f67a97..0000000
--- a/gbtools/src/include/blatSrc/gfClientLib.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* gfClientLib - stuff that both blat and pcr clients of
- * genoFind use. */
-
-#ifndef GFCLIENTLIB_H
-#define GFCLIENTLIB_H
-
-void gfClientFileArray(char *fileName, char ***retFiles, int *retFileCount);
-/* Check if file if .2bit or .nib or .fa.  If so return just that
- * file in a list of one.  Otherwise read all file and treat file
- * as a list of filenames.  */
-
-bioSeq *gfClientSeqList(int fileCount, char *files[], 
-	boolean isProt, boolean isTransDna, char *maskType, 
-	float minRepDivergence, boolean showStatus);
-/* From an array of .fa and .nib file names, create a
- * list of dnaSeqs, which are set up so that upper case is masked and lower case
- * is unmasked sequence. (This is the opposite of the input, but set so that
- * we can use lower case as our primary DNA sequence, which historically predates
- * our use of lower case masking.)  Protein sequence on the other hand is
- * all upper case. */
-
-void gfClientUnmask(struct dnaSeq *seqList);
-/* Unmask all sequences. */
-
-#endif /* GFCLIENTLIB_H */
-
diff --git a/gbtools/src/include/blatSrc/gfPcrLib.h b/gbtools/src/include/blatSrc/gfPcrLib.h
deleted file mode 100644
index e35137c..0000000
--- a/gbtools/src/include/blatSrc/gfPcrLib.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* gfPcrLib - Routines to help do in silico PCR.
- * Copyright 2004 Jim Kent.  All rights reserved. */
-
-#ifndef GFPCRLIB_H
-#define GFPCRLIB_H
-
-struct gfPcrInput
-/* Info for input to one PCR experiment. */
-    {
-    struct gfPcrInput *next;  /* Next in singly linked list. */
-    char *name;	/* Name of experiment */
-    char *fPrimer;	/* Forward primer - 15-30 bases */
-    char *rPrimer;	/* Reverse primer - after fPrimer and on opposite strand */
-    };
-
-void gfPcrInputStaticLoad(char **row, struct gfPcrInput *ret);
-/* Load a row from gfPcrInput table into ret.  The contents of ret will
- * be replaced at the next call to this function. */
-
-struct gfPcrInput *gfPcrInputLoad(char **row);
-/* Load a gfPcrInput from row fetched with select * from gfPcrInput
- * from database.  Dispose of this with gfPcrInputFree(). */
-
-struct gfPcrInput *gfPcrInputLoadAll(char *fileName);
-/* Load all gfPcrInput from a whitespace-separated file.
- * Dispose of this with gfPcrInputFreeList(). */
-
-void gfPcrInputFree(struct gfPcrInput **pEl);
-/* Free a single dynamically allocated gfPcrInput such as created
- * with gfPcrInputLoad(). */
-
-void gfPcrInputFreeList(struct gfPcrInput **pList);
-/* Free a list of dynamically allocated gfPcrInput's */
-
-struct gfPcrOutput
-/* Output of PCR experiment. */
-    {
-    struct gfPcrOutput *next;	/* Next in list */
-    char *name;			/* Name of experiment. */
-    char *fPrimer;	/* Forward primer - 15-30 bases */
-    char *rPrimer;	/* Reverse primer - after fPrimer and on opposite strand */
-    char *seqName;	/* Name of sequence (chromosome maybe) that gets amplified. */
-    int seqSize;	/* Size of sequence (chromosome maybe) */
-    int fPos;		/* Position of forward primer in seq. */
-    int rPos;		/* Position of reverse primer in seq. */
-    char strand;	/* Strand of amplified sequence. */
-    char *dna;		/* Fragment of sequence that gets amplified.
-                         * Note in some senses you'll want to replace
-			 * start and ends of this with fPrimer/rPrimer to
-			 * be strictly accurate.  */
-    };
-
-void gfPcrOutputFree(struct gfPcrOutput **pOut);
-/* Free up a gfPcrOutput structure. */
-
-void gfPcrOutputFreeList(struct gfPcrOutput **pList);
-/* Free up a list of gfPcrOutputs. */
-
-
-
-
-void gfPcrLocal(char *pcrName, 
-	struct dnaSeq *seq, int seqOffset, char *seqName, int seqSize,
-	int maxSize, char *fPrimer, int fPrimerSize, char *rPrimer, int rPrimerSize,
-	int minPerfect, int minGood, char strand, struct gfPcrOutput **pOutList);
-/* Do detailed PCR scan on DNA already loaded into memory and put results
- * (in reverse order) on *pOutList. */
-
-struct gfRange *gfPcrGetRanges(char *host, char *port, char *fPrimer, char *rPrimer,
-	int maxSize);
-/* Query gfServer with primers and convert response to a list of gfRanges. */
-
-struct gfPcrOutput *gfPcrViaNet(char *host, char *port, char *seqDir, 
-	struct gfPcrInput *inList,
-	int maxSize, int minPerfect, int minGood);
-/* Do PCRs using gfServer index, returning list of results. */
-
-void gfPcrOutputWriteOne(struct gfPcrOutput *out, char *outType, 
-	char *url, FILE *f);
-/* Write a single output in specified format (either "fa" or "bed") 
- * to file.  If url is non-null it should be a printf formatted
- * string that takes %s, %d, %d for chromosome, start, end. */
-
-void gfPcrOutputWriteList(struct gfPcrOutput *outList, char *outType, 
-	char *url, FILE *f);
-/* Write list of outputs in specified format (either "fa" or "bed") 
- * to file.  If url is non-null it should be a printf formatted
- * string that takes %s, %d, %d for chromosome, start, end. */
-
-void gfPcrOutputWriteAll(struct gfPcrOutput *outList, 
-	char *outType, char *url, char *fileName);
-/* Create file of outputs in specified format (either "fa" or "bed") 
- * to file.  If url is non-null it should be a printf formatted
- * string that takes %s, %d, %d for chromosome, start, end. */
-
-char *gfPcrMakePrimer(char *s);
-/* Make primer (lowercased DNA) out of text.  Complain if
- * it is too short or too long. */
-
-#endif /* GFPCRLIB_H */
diff --git a/gbtools/src/include/blatSrc/gfWebLib.h b/gbtools/src/include/blatSrc/gfWebLib.h
deleted file mode 100644
index 0ba8990..0000000
--- a/gbtools/src/include/blatSrc/gfWebLib.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* gfWebLib - stuff shared by gfWebBlat and gfWebPcr - little web programs
- * that query gfServer in different ways. */
-
-struct gfServerAt
-/* A gfServer with an in-memory index. */
-    {
-    struct gfServerAt *next;
-    char *host;		/* IP Address of machine running server. */
-    char *port;		/* IP Port on host. */
-    char *seqDir;	/* Where associated sequence lives. */
-    char *name;		/* Name user sees. */
-    };
-
-struct gfServerAt *gfWebFindServer(struct gfServerAt *serverList, char *varName);
-/* Find active server (that matches contents of CGI variable varName). */
-
-struct gfWebConfig
-/* A parsed out configuration file. */
-    {
-    char *company;	/* Company name if any. */
-    char *background;	/* Web page background if any. */
-    struct gfServerAt *serverList;  /* List of servers. */
-    struct gfServerAt *transServerList;  /* List of translated servers. */
-    char *tempDir;	/* Where to put temporary files. */
-    };
-
-struct gfWebConfig *gfWebConfigRead(char *fileName);
-/* Read configuration file into globals. */
diff --git a/gbtools/src/include/blatSrc/gff.h b/gbtools/src/include/blatSrc/gff.h
deleted file mode 100644
index 15f7c3d..0000000
--- a/gbtools/src/include/blatSrc/gff.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* gff.h Parse a GFF or GTF file. */
-
-#ifndef GFF_H
-#define GFF_H
-
-struct gffLine
-/* A parsed line in a GFF file. */
-    {
-    struct gffLine *next;  /* Next line in file */
-    char *seq;      /* Name of sequence. */
-    char *source;   /* Program that made this line.  Not allocated here. */
-    char *feature;  /* Type field. (Intron, CDS, etc). Not allocated here. */
-    int start;      /* Start of feature in sequence. Starts with 0, not 1 */
-    int end;        /* End of feature in sequence. End is not included. */
-    double score;   /* Score. */
-    char strand;    /* Strand of sequence feature is on. + or - or .*/
-    char frame;     /* Frame feature is in. 1, 2, 3, or . */
-    char *group;    /* Group line is in. Not allocated here.  Corresponds to transcript_id in GTF */
-    char *geneId;    /* gene_id in GTF, NULL in GFF.  Not allocated here. */
-    char *exonId;       /* exon_id in GTF, NULL in GFF. Not allocated here. */
-    int exonNumber; /* O in GFF or if missing in GTF.  Otherwise exon number. */
-    char *intronId;       /* intron_id in GTF, NULL in GFF. Not allocated here. */
-    char *intronStatus;   /* intron status. Not allocated here. */
-    char *proteinId;      /* protein_id in GTF, NULL in GFF. Not allocated here. */
-    char *geneName;       /* gene_name or NULL in GTF, NULL in GFF. Not allocated here. */
-    char *transcriptName; /* transcript_name or NULL in GTF, NULL in GFF. Not allocated here. */
-    };
-
-struct gffGroup
-/* A group of lines in a GFF file (all that share the same group field). */
-    {
-    struct gffGroup *next;   /* Next group in file. */
-    char *name;     /* Name of group. Not allocated here. */
-    char *seq;      /* Name of sequence. Not allocated here. */
-    char *source;      /* Name of source program. Not allocated here. */
-    /* The next three fields are only valid after call to gffGroupLines() */
-    int start;      /* Start of feature in sequence. Starts with 0, not 1 */
-    int end;        /* End of feature in sequence. End is not included. */
-    char strand;    /* Strand of sequence. */
-    struct gffLine *lineList;  /* List of lines in group. */
-    };
-
-struct gffSource
-/* A list of sources. */
-    {
-    struct gffSource *next; /* Next in list. */
-    char *name;	  /* Name, not allocated here. */
-    unsigned int id;   /* Database ID (or just 0) */
-    };
-
-struct gffFeature
-/* A list of types in GFF file. */
-    {
-    struct gffFeature *next; /* Next in list. */
-    char *name;	  /* Name, not allocated here. */
-    int count;	  /* Number of times feature is seen */
-    };
-
-struct gffSeqName
-/* A list of sequence. */
-    {
-    struct gffSeqName *next;  /* Next in list. */
-    char *name;   /* Name, not allocated here. */
-    };
-
-struct gffGeneId
-/* A list of genes. */
-    {
-    struct gffGeneId *next;  /* Next in list. */
-    char *name;   /* Name, not allocated here. */
-    };
-
-struct gffFile
-/* This keeps information on a fully parsed GFF file. */
-    {
-    struct gffFile *next;
-    char *fileName;             /* Name of file (allocated here) */
-    struct hash *seqHash;	/* A name only hash of the sequence. */
-    struct hash *sourceHash;	/* A name only hash of gff sources. */
-    struct hash *featureHash;   /* A name only hash of gff types. */
-    struct hash *groupHash;	/* Associates group names and gffGroups. */
-    struct hash *geneIdHash;    /* Hash of all geneIds. */
-    struct hash *strPool;       /* hash used to allocate strings */
-    struct gffLine *lineList;   /* List of lines - lines may be in groupList instead. */
-    struct gffSeqName *seqList; /* List of sequences in file. */
-    struct gffSource *sourceList; /* List of all sources in file. */
-    struct gffFeature *featureList; /* List of all types in file. */
-    struct gffGroup *groupList; /* A list of groups. */
-    struct gffGeneId *geneIdList;  /* List of all gene ID's. */
-    bool isGtf;			/* Is this a GTF file? */
-    bool typeKnown;		/* Is 'isGtf' known? */
-    };
-
-void gffGroupFree(struct gffGroup **pGroup);
-/* Free up a gffGroup including lineList. */
-
-void gffGroupFreeList(struct gffGroup **pList);
-/* Free up a list of gffGroups. */
-
-void gffGroupLines(struct gffFile *gff);
-/* Group lines of gff file together, in process mofing
- * gff->lineList to gffGroup->lineList. */
-
-struct gffFile *gffRead(char *fileName);
-/* Create a gffFile structure from a GFF file. */
-
-struct gffFile *gffFileNew(char *fileName);
-/* Create a new gffFile structure. */
-
-void gffFileAdd(struct gffFile *gff, char *fileName, int baseOffset);
-/* Add file to gffFile. */
-
-void gffFileAddRow(struct gffFile *gff, int baseOffset, char *words[], int wordCount, 
-		char *fileName, int lineIx);
-/* Process one row of GFF file (a non-comment line parsed by tabs normally). */
-
-void gffFileFree(struct gffFile **pGff);
-/* Free up a gff file. */
-
-int gffLineCmp(const void *va, const void *vb);
-/* Compare two gffLines (for use in slSort, etc.) . */
-
-void gffOutput(struct gffLine *el, FILE *f, char sep, char lastSep);
-/* Print out GTF.  Separate fields with sep. Follow last field with lastSep. */
-
-boolean gffHasGtfGroup(char *line);
-/* Return TRUE if line has a GTF group field */
-
-#define gffTabOut(el,f) gffOutput(el,f,'\t','\n');
-/* Print out GTF as a line in a tab-separated file. */
-
-#define gffCommaOut(el,f) gffOutput(el,f,',',',');
-/* Print out GTF as a comma separated list including final comma. */
-
-
-#endif /* GFF_H */
-
diff --git a/gbtools/src/include/blatSrc/gff3.h b/gbtools/src/include/blatSrc/gff3.h
deleted file mode 100644
index a047f14..0000000
--- a/gbtools/src/include/blatSrc/gff3.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Object for accessing GFF3 files
- * See GFF3 specification for details of file format:
- *   http://www.sequenceontology.org/gff3.shtml
- */
-#ifndef gff3_h
-#define gff3_h
-
-struct gff3Ann
-/* Annotation record from a GFF3 file.  Attributes define in the spec (those
- * starting with upper case letters) are parsed into fields of this
- * object. User defined attributes (starting with lower-case characters) are
- * stored as in a list, along with a copy of the string versions of the spec
- * attributes. All strings stored in the object have been un-escaped.
- * All storage for the object is allocated by the gff3File object.
- * For discontinuous features, there are multiple gff3Ann objects.
- * These objects are stored in a double-linked list, and all references
- * point to the first one in ascending start order.*/
-{
-    struct gff3Ann *prevPart; /* Discontinuous features have linked annotation */
-    struct gff3Ann *nextPart; /* field name next not used to avoid confusion */
-    char *seqid;   /* The ID of the landmark used to establish the coordinate
-                    * system for the current feature. IDs may contain any
-                    * characters. */
-    char *source;  /* The source is a free text qualifier intended to describe
-                    * the algorithm or operating procedure that generated this
-                    * feature.  Typically this is the name of a piece of
-                    * software, such as "Genescan" or a database name, such as
-                    * "Genbank."  In effect, the source is used to extend the
-                    * feature ontology by adding a qualifier to the type
-                    * creating a new composite type that is a subclass of the
-                    * type in the type column. */
-
-    char *type; /* The type of the feature (previously called the "method").
-                 * This is constrained to be either: (a) a term from the
-                 * "lite" sequence ontology, SOFA; or (b) a SOFA accession
-                 * number.  The latter alternative is distinguished using the
-                 * syntax SO:000000. */
-
-    int start; /* The start and end of the feature, in 0-based, half open
-                * integer coordinates, relative to the landmark given in
-                * seqid.  Start is always less than or equal to end.  For
-                * zero-length features, such as insertion sites, start equals
-                * end and the implied site is to the right of the indicated
-                * base in the direction of the landmark.*/
-    int end;
-    float score; /* The score of the feature, a floating point number.  As in
-                    earlier versions of the format, the semantics of the score
-                    are ill-defined.  It is strongly recommended that E-values
-                    be used for sequence similarity features, and that
-                    P-values be used for ab initio gene prediction features. */
-    boolean haveScore;  /* was score specified? */
-
-    char *strand; /* The strand of the feature.  '+' for positive strand
-                   * (relative to the landmark), '-' for minus strand, and
-                   * NULL for features that are not stranded.  In addition,
-                   * '?' can be used for features whose strandedness is
-                   * relevant, but unknown. */
-
-    int phase; /* For features of type "CDS", the phase indicates where the
-                * feature begins with reference to the reading frame.  The
-                * phase is one of the integers 0, 1, or 2, indicating the
-                * number of bases that should be removed from the beginning of
-                * this feature to reach the first base of the next codon. In
-                * other words, a phase of 0 indicates that the next codon
-                * begins at the first base of the region described by the
-                * current line, a phase of 1 indicates that the next codon
-                * begins at the second base of this region, and a phase of 2
-                * indicates that the codon begins at the third base of this
-                * region. This is NOT to be confused with the frame, which is
-                * simply start modulo 3.  For forward strand features, phase
-                * is counted from the start field. For reverse strand
-                * features, phase is counted from the end field. The phase is
-                * REQUIRED for all CDS features. and -1 for other features. */
-
-    /* The remaining fields are the attributes.  Attributes defined by the
-     * GFF3 spec (starting with an upper-case letter) are stored in the fields
-     * below.  Application-specific attributes (starting with a lower-case
-     * letter) are stored in the attrs list.  */
-
-    char *id;  /* Indicates the name of the feature.  IDs must be unique
-                * within the scope of the GFF file.*/
-    char *name;  /* Display name for the feature.  This is the name to be
-                  * displayed to the user.  Unlike IDs, there is no requirement
-                  * that the Name be unique within the file. */
-
-    struct slName *aliases; /* A secondary names for the feature.  It is
-                             * suggested that this tag be used whenever a
-                             * secondary identifier for the feature is needed,
-                             * such as locus names and accession numbers.
-                             * Unlike ID, there is no requirement that Alias
-                             * be unique within the file. */
-    
-    struct slName *parentIds; /* Indicates the parent of the feature.  A parent
-                               * ID can be used to group exons into transcripts,
-                               * transcripts into genes, an so forth.  A feature
-                               * may have multiple parents.  Parent can *only* be
-                               * used to indicate a partof relationship. */
-    struct gff3AnnRef *parents; /* Parent objects for parentIds */
-                                      
-
-    char *targetId; /* Indicates the target of a nucleotide-to-nucleotide or
-                       protein-to-nucleotide alignment.  NULL if not specified. */
-    int targetStart; /* target start/end, in 0-based, half open coordinates */
-    int targetEnd;
-    char *targetStrand; /* optional target strand, or NULL if none. */
-
-    char *gap; /* The alignment of the feature to the target if the two are
-                * not collinear (e.g. contain gaps).  The alignment format is
-                * taken from the CIGAR format.  See "THE GAP ATTRIBUTE"
-                * section of GFF3 specification for a description of this
-                * format.*/
-
-    char *derivesFromId; /* Used to disambiguate the relationship between one
-                          * feature and another when the relationship is a
-                          * temporal one rather than a purely structural "part
-                          * of" one.  This is needed for polycistronic
-                          * genes. */
-    struct gff3Ann *derivesFrom; /* Object for derivesFromId */
-
-    struct slName *notes;  /* free text notes. */
-
-    boolean isCircular;  /* is this item circular */
-
-    struct slName *dbxrefs; /* database cross references. */
-
-    struct slName *ontologyTerms; /* cross reference to ontology terms. */
-
-    struct gff3Attr *attrs;  /* attributes, both user-define and spec-defined,
-                                  * parsed into one or more values */
-
-    struct gff3AnnRef *children;  /* child nodes */
-
-    struct gff3SeqRegion *seqRegion;  /* start/end of sequence region, taken
-                                       * from ##sequence-region records, or
-                                       * NULL if not specified.*/
-
-    struct gff3File *file;  /* file this record is associated with */
-    int lineNum;            /* line number of record in file, or -1
-                             * if not known */
-};
-
-struct gff3AnnRef
-/* A reference to a gff3Ann object */
-{
-    struct gff3AnnRef *next;   /* next link in the chain */
-    struct gff3Ann *ann;       /* reference to object */
-};
-
-struct gff3Attr
-/* an attribute and string values */
-{
-    struct gff3Attr *next;     /* next attribute in the list */
-    char *tag;                 /* name of attribute */
-   struct slName *vals;       /* values for the attribute */
-};
-
-struct gff3SeqRegion
-/* start/end of a sequence region, taken from ##sequence-region record.*/
-{
-    struct gff3SeqRegion *next;     /* next region */
-    char *seqid;    /* sequence if of region */
-    int start;      /* bounds of region */
-    int end;
-};
-
-struct gff3File
-/* Object representing a GFF file. Manages all memory for related objects. */
-{
-    char *fileName;       /* path of file that was parsed */
-    struct hash *byId;    /* index of gff3Ann object by id.  Links to first object of link discontinuous features */
-    struct gff3AnnRef *anns;   /* all records in the file. Includes all parts of discontinuous features */
-    struct gff3AnnRef *roots;  /* all records without parents. */
-    struct hash *pool;         /* used to allocate string values that tend to
-                                * be repeated in the files.  localMem is also 
-                                * to allocated memory for all other objects. */
-    struct gff3SeqRegion *seqRegions;  /* list of gff3SeqRegion objects. */
-    struct hash *seqRegionMap;  /* map of seqId to gff3SeqRegion objects. NULL
-                                 * if none are specified */
-
-    struct slName *featureOntologies;    /* feature ontology URIs */
-    struct slName *attributeOntologies;  /* attribute ontology URIs */
-    struct slName *sourceOntologies;     /* source ontology URIs */
-    struct slName *species;              /* Species, usually NCBI Taxonomy
-                                          * URI */
-    char *genomeBuildSource;             /* source of genome build */
-    char *genomeBuildName;               /* name or version of genome build */
-    struct dnaSeq *seqs;                 /* list of sequences */
-    struct hash *seqMap;                 /* map of sequence ids to sequence
-                                          * string from ##FASTA section or
-                                          * NULL if none specified */
-    struct lineFile *lf;                 /* only set while parsing */
-    FILE *errFh;            /* write errors to this file */
-    int maxErr;             /* maximum number of errors before aborting */
-    int errCnt;             /* error count */
-};
-
-
-/* standard attribute tags */
-extern char *gff3AttrID;
-extern char *gff3AttrName;
-extern char *gff3AttrAlias;
-extern char *gff3AttrParent;
-extern char *gff3AttrTarget;
-extern char *gff3AttrGap;
-extern char *gff3AttrDerivesFrom;
-extern char *gff3AttrNote;
-extern char *gff3AttrDbxref;
-extern char *gff3AttrOntologyTerm;
-
-/* commonly used features names */
-extern char *gff3FeatGene;
-extern char *gff3FeatMRna;
-extern char *gff3FeatExon;
-extern char *gff3FeatCDS;
-extern char *gff3FeatThreePrimeUTR;
-extern char *gff3FeatFivePrimeUTR;
-extern char *gff3FeatStartCodon;
-extern char *gff3FeatStopCodon;
-extern char *gff3FeatTranscript;
-
-struct gff3File *gff3FileOpen(char *fileName, int maxErr, FILE *errFh);
-/* Parse a GFF3 file into a gff3File object.  If maxErr not zero, then
- * continue to parse until this number of error have been reached.  A maxErr
- * less than zero does not stop reports all errors. Write errors to errFh,
- * if NULL, use stderr. */
-
-void gff3FileFree(struct gff3File **g3fPtr);
-/* Free a gff3File object */
-
-struct gff3Ann *gff3FileFindAnn(struct gff3File *g3f, char *id);
-/* find an annotation record by id, or NULL if not found. */
-
-struct gff3Attr *gff3AnnFindAttr(struct gff3Ann *g3a, char *tag);
-/* find a user attribute, or NULL */
-
-void gff3FileWrite(struct gff3File *g3f, char *fileName);
-/* write contents of an GFF3File object to a file */
-
-INLINE struct gff3AnnRef *gff3AnnRefNew(struct gff3Ann *g3a)
-/* Allocate a gff3AnnRef object from the heap.  Not used by the parsing code, as 
- * all data is contained in localMem objects */
-{
-struct gff3AnnRef *ref;
-AllocVar(ref);
-ref->ann = g3a;
-return ref;
-}
-
-int gff3AnnRefLocCmp(const void *va, const void *vb);
-/* sort compare function for location of two gff3AnnRef objects */
-
-INLINE int gff3PhaseToFrame(int phase)
-/* convert a phase to a frame */
-{
-switch (phase)
-    {
-    case 0:
-        return 0;
-    case 1:
-        return 2;
-    case 2:
-        return 1;
-    }
-return -1;
-}
-
-#endif
diff --git a/gbtools/src/include/blatSrc/gfxPoly.h b/gbtools/src/include/blatSrc/gfxPoly.h
deleted file mode 100644
index 7e363c7..0000000
--- a/gbtools/src/include/blatSrc/gfxPoly.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* gfxPoly - two dimensional polygon. */
-
-#ifndef GFXPOLY_H
-#define GFXPOLY_H
-
-struct gfxPoint
-/* A two-dimensional point, typically in pixel coordinates. */
-    {
-    struct gfxPoint *next;
-    int x, y;		/* Position */
-    };
-
-struct gfxPoly
-/* A two-dimensional polygon */
-    {
-    struct gfxPoly *next;
-    int ptCount;		/* Number of points. */
-    struct gfxPoint *ptList;	/* First point in list, which is circular. */
-    struct gfxPoint *lastPoint;	/* Last point in list. */
-    };
-
-struct gfxPoly *gfxPolyNew();
-/* Create new (empty) polygon */
-
-void gfxPolyFree(struct gfxPoly **pPoly);
-/* Free up resources associated with polygon */
-
-void gfxPolyAddPoint(struct gfxPoly *poly, int x, int y);
-/* Add point to polygon. */
-
-#endif /* GFXPOLY_H */
diff --git a/gbtools/src/include/blatSrc/gifLabel.h b/gbtools/src/include/blatSrc/gifLabel.h
deleted file mode 100644
index 462f8f2..0000000
--- a/gbtools/src/include/blatSrc/gifLabel.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* gifLabel - create labels as GIF files. */
-
-int gifLabelMaxWidth(char **labels, int labelCount);
-/* Return maximum pixel width of labels.  It's ok to have
- * NULLs in labels array. */
-
-void gifLabelVerticalText(char *fileName, char **labels, int labelCount, 
-	int height);
-/* Make a gif file with given labels.  This will check to see if fileName
- * exists already, and if so do nothing. */
diff --git a/gbtools/src/include/blatSrc/hacTree.h b/gbtools/src/include/blatSrc/hacTree.h
deleted file mode 100644
index 1bf994b..0000000
--- a/gbtools/src/include/blatSrc/hacTree.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* hacTree - Hierarchical Agglomerative Clustering a list of inputs into a binary tree */
-/*
- * This clustering algorithm can be used for problems with high
- * dimensionality, such as clustering sequences by similarity.  It can
- * be used for problems with low dimensionality too, such as
- * clustering a sequence of numbers (1-dimensional: points along the
- * number line), but there are more efficient algorithms for problems
- * with low dimensionality.
- *
- * In order to use this, you need to provide functions that operate on a
- * pair of input items (and extra data pointer):
- * 1. a distance function that takes two input items and returns a number,
- *    small for short distances/high similarity and large for long
- *    distances/low similarity
- * 2. a merging function that takes two input items and returns a new item
- *    that represents both of them.  Therefore the data structure that
- *    represents an input item must also be capable of representing a
- *    cluster of input items.  Usually this is done by combining values
- *    from input items into a new value that will compare properly with
- *    other items or clusters in the distance function.
- *
- * Then pass in an slList of items, pointers to those two functions, and
- * a pointer to data used in your distance and merging functions (or NULL).
- * You get back a pointer to the root node of a binary tree structure
- * where each leaf node contains one of your items and each node above
- * that contains a cluster.  The root node contains the cluster of all items.
- *
- * If a significant proportion of input items are identical to each other,
- * you can also pass in a comparison function that will be used to sort the
- * items before clustering.  After sorting, adjacent identical items will
- * be pre-clustered in order to reduce the number of inputs to the main
- * clustering step.
- *
- * kent/src/lib/tests/hacTreeTest.c contains a couple simple examples.
- *
- * To get the top k clusters, perform a breadth-first,
- * lowest-distance-child-first search of the tree to find the top k
- * nodes/clusters with the smallest distances from the root node/cluster.
- * [It would be nice for this module to provide that function, if/when a need for it arises.]
- */
-#ifndef HACTREE_H
-#define HACTREE_H
-
-#include "localmem.h"
-
-/* Caller-provided function to measure distance between two items or clusters */
-/* Note: this must be able to handle identical inputs or NULL inputs */
-/* Note: this should be monotonic and nonnegative, *not* a + or -
- * difference (as would be used for comparing/ordering/sorting) */
-typedef double hacDistanceFunction(const struct slList *item1, const struct slList *item2,
-				   void *extraData);
-
-/* Caller-provided function to merge two items or clusters into a new cluster */
-/* Note: this must be able to handle NULL inputs */
-typedef struct slList *(hacMergeFunction)(const struct slList *item1, const struct slList *item2,
-					  void *extraData);
-
-/* Optional caller-provided function to compare two items or clusters for pre-sorting
- * and pre-clustering of identical items. */
-typedef int hacCmpFunction(const struct slList *item1, const struct slList *item2,
-			   void *extraData);
-
-/* Structure of nodes of the binary tree that contains a hierarchical clustering of inputs */
-struct hacTree
-    {
-    struct hacTree *next;       // Can have an unordered list of these
-    struct hacTree *parent;     // Cluster that contains this cluster, NULL for root node
-    struct hacTree *left;       // Left child, NULL for leaf node
-    struct hacTree *right;      // Right child, NULL for leaf node
-    double childDistance;       // Result of distance function on left and right kids
-    struct slList *itemOrCluster;  // If leaf node, one of the items passed in;
-                                // otherwise, result of merging left and right kids' itemOrClusters
-    };
-
-struct hacTree *hacTreeFromItems(const struct slList *itemList, struct lm *localMem,
-				 hacDistanceFunction *distF, hacMergeFunction *mergeF,
-				 hacCmpFunction *cmpF, void *extraData);
-/* Using distF, mergeF, optionally cmpF and binary tree operations,
- * perform a hierarchical agglomerative (bottom-up) clustering of
- * items.  To free the resulting tree, lmCleanup(&localMem). */
-
-struct hacTree *hacTreeMultiThread(int threadCount, struct slList *itemList, struct lm *localMem,
-				 hacDistanceFunction *distF, hacMergeFunction *mergeF,
-				 void *extraData, struct hash *precalcDistanceHash);
-/* Construct hacTree minimizing number of merges called, and doing distance calls
- * in parallel when possible.   Do a lmCleanup(localMem) to free returned tree. 
- * The inputs are
- *	threadCount - number of threads - at least one, recommended no more than 15
- *	itemList - list of items to tree up.  Format can vary, but must start with a
- *	           pointer to next item in list.
- *	localMem - memory pool where hacTree and a few other things are allocated from
- *	distF - function that calculates distance between two items, passed items and extraData
- *	mergeF - function that creates a new item in same format as itemList from two passed
- *	         in items and the extraData.  Typically does average of two input items
- *	extraData - parameter passed through to distF and mergeF, otherwise unused, may be NULL
- *	precalcDistanceHash - a hash containing at least some of the pairwise distances
- *	            between items on itemList, set with hacTreeDistanceHashAdd. 
- *	            As a side effect this hash will be expanded to include all distances 
- *	            including those between intermediate nodes.  May be NULL. */
-
-void hacTreeDistanceHashAdd(struct hash *hash, void *itemA, void *itemB, double distance);
-/* Add an item to distance hash */
-
-double * hacTreeDistanceHashLookup(struct hash *hash, void *itemA, void *itemB);
-/* Look up pair in distance hash.  Returns NULL if not found, otherwise pointer to
- * distance */
-
-#endif//def HACTREE_H
diff --git a/gbtools/src/include/blatSrc/hash.h b/gbtools/src/include/blatSrc/hash.h
deleted file mode 100644
index 6cd50b3..0000000
--- a/gbtools/src/include/blatSrc/hash.h
+++ /dev/null
@@ -1,285 +0,0 @@
-/* Hash - a simple hash table that provides name/value pairs. 
- * The most common usage is to create a hash as so:
- *    struct hash *hash = hashNew(0);
- * to add elements to a hash as so:
- *    hashAdd(hash, name, value);
- * and to retrieve a named element as so:
- *    value = hashFindVal(hash, name);
- * The hashFindVal function will return NULL if the name does not
- * appear in the hash.  Alternatively you can use:
- *    value = hashMustFindVal(hash, name);
- * which will abort if name is not in the hash.  When done with a hash do:
- *     hashFree(&hash);
- *
- * The hash does support multiple values for the same key.  To use
- * this functionality, try the loop:
- *     struct hashEl *hel;
- *     for (hel = hashLookup(hash, name); hel != NULL; hel = hashLookupNext(hel))
- *         {
- *         value = hel->val;
- *         // Further processing here.
- * The order of elements retrieved this way will be most-recently-added first.
- * The hashLookup function is _slightly_ faster than the hashFindVal function,
- * so sometimes it is used just to test for the presence of an element in the
- * hash when not interested in the value associated with it.
- *
- * One can iterate through all the elements in a hash in three ways.  One can
- * get a list of all things in the hash as so:
- *     struct hashEl *hel, *helList = hashElListHash(hash);
- *     for (hel = helList; hel != NULL; hel = hel->next)
- *        {
- *        value = hel->val;
- *        // Further processing of value here. 
- *        }
- *     hashElFreeList(&helList);
- * One can avoid the overhead of creating a list by using an iterator object
- * and function:
- *    struct hashEl *hel;
- *    struct hashCookie cookie = hashFirst(hash);
- *    while ((hel = hashNext(&cookie)) != NULL)
- *        {
- *        value = hel->val;
- * Finally one can use hashTraverseEls or hashTraverseVals with a callback 
- * function that takes a hashEl, or the void *value as parameter respectively.
- *
- * There are various other functions involving hashes in this module as well
- * that provide various short cuts.  For information on these and additional
- * details of the functions described, please read the full hash.h file, and
- * if so inclined the hash.c file as well.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef HASH_H
-#define HASH_H
-
-struct hashEl
-/* An element in a hash list. */
-    {
-    struct hashEl *next;
-    char *name;
-    void *val;
-    bits32 hashVal;
-    };
-
-struct hash
-    {
-    struct hash *next;	/* Next in list. */
-    bits32 mask;	/* Mask hashCrc with this to get it to fit table. */
-    struct hashEl **table;	/* Hash buckets. */
-    int powerOfTwoSize;		/* Size of table as a power of two. */
-    int size;			/* Size of table. */
-    struct lm *lm;	/* Local memory pool. */
-    int elCount;		/* Count of elements. */
-    boolean autoExpand;         /* Automatically expand hash */
-    float expansionFactor;      /* Expand when elCount > size*expansionFactor */
-    int numResizes;             /* number of times resize was called */
-    };
-
-#define defaultExpansionFactor 1.0
-
-#define hashMaxSize 28 
-
-struct hashCookie
-/* used by hashFirst/hashNext in tracking location in traversing hash */
-    {
-    struct hash *hash;      /* hash we are associated with */
-    int idx;                /* current index in hash */
-    struct hashEl *nextEl;  /* current element in hash */
-    };
-
-bits32 hashString(char *string);
-/* Compute a hash value of a string. */
-
-bits32 hashCrc(char *string);
-/* Returns a CRC value on string. */
-
-struct hashEl *hashLookup(struct hash *hash, char *name);
-/* Looks for name in hash table. Returns associated element,
- * if found, or NULL if not.  If there are multiple entries
- * for name, the last one added is returned (LIFO behavior).
- */
-
-struct hashEl *hashLookupUpperCase(struct hash *hash, char *name);
-/* Lookup upper cased name in hash. (Assumes all elements of hash
- * are themselves already in upper case.) */
-
-struct hashEl *hashLookupNext(struct hashEl *hashEl);
-/* Find the next occurance of name that may occur in the table multiple times,
- * or NULL if not found.  Use hashLookup to find the first occurrence.  Elements
- * are returned in LIFO order.
- */
-
-struct hashEl *hashAdd(struct hash *hash, char *name, void *val);
-/* Add new element to hash table.  If an item with name, already exists, a new
- * item is added in a LIFO manner.  The last item added for a given name is
- * the one returned by the hashLookup functions.  hashLookupNext must be used
- * to find the preceding entries for a name.
- */
-
-struct hashEl *hashAddN(struct hash *hash, char *name, int nameSize, void *val);
-/* Add name of given size to hash (no need to be zero terminated) */
-
-void *hashRemove(struct hash *hash, char *name);
-/* Remove item of the given name from hash table. 
- * Returns value of removed item, or NULL if not in the table.
- * If their are multiple entries for name, the last one added
- * is removed (LIFO behavior).
- */
-
-struct hashEl *hashAddUnique(struct hash *hash, char *name, void *val);
-/* Add new element to hash table. Squawk and die if is already in table. */
-
-struct hashEl *hashAddSaveName(struct hash *hash, char *name, void *val, char **saveName);
-/* Add new element to hash table.  Save the name of the element, which is now
- * allocated in the hash table, to *saveName.  A typical usage would be:
- *    AllocVar(el);
- *    hashAddSaveName(hash, name, el, &el->name);
- */
-
-struct hashEl *hashStore(struct hash *hash, char *name);
-/* If element in hash already return it, otherwise add it
- * and return it. */
-
-char  *hashStoreName(struct hash *hash, char *name);
-/* Put name into hash table. */
-
-char *hashMustFindName(struct hash *hash, char *name);
-/* Return name as stored in hash table (in hel->name). 
- * Abort if not found. */
-
-void *hashMustFindVal(struct hash *hash, char *name);
-/* Lookup name in hash and return val.  Abort if not found. */
-
-void *hashFindVal(struct hash *hash, char *name);
-/* Look up name in hash and return val or NULL if not found. */
-
-void *hashOptionalVal(struct hash *hash, char *name, void *usual);
-/* Look up name in hash and return val, or usual if not found. */
-
-void *hashFindValUpperCase(struct hash *hash, char *name);
-/* Lookup upper cased name in hash and return val or return NULL if not found.
- * (Assumes all elements of hash are themselves already in upper case.) */
-
-struct hashEl *hashAddInt(struct hash *hash, char *name, int val);
-/* Store integer value in hash */
-
-void hashIncInt(struct hash *hash, char *name);
-/* Increment integer value in hash */
-
-int hashIntVal(struct hash *hash, char *name);
-/* Return integer value associated with name in a simple 
- * hash of ints. */
-
-int hashIntValDefault(struct hash *hash, char *name, int defaultInt);
-/* Return integer value associated with name in a simple 
- * hash of ints or defaultInt if not found. */
-
-long long hashIntSum(struct hash *hash);
-/* Return sum of all the ints in a hash of ints. */
-
-void hashTraverseEls(struct hash *hash, void (*func)(struct hashEl *hel));
-/* Apply func to every element of hash with hashEl as parameter. */
-
-void hashTraverseVals(struct hash *hash, void (*func)(void *val));
-/* Apply func to every element of hash with hashEl->val as parameter. */
-
-struct hashEl *hashElListHash(struct hash *hash);
-/* Return a list of all elements of hash.   Free return with hashElFreeList. */
-
-int hashElCmp(const void *va, const void *vb);
-/* Compare two hashEl by name. */
-
-int hashElCmpWithEmbeddedNumbers(const void *va, const void *vb);
-/* Compare two hashEl by name sorting including numbers within name,
- * suitable for chromosomes, genes, etc. */
-
-void *hashElFindVal(struct hashEl *list, char *name);
-/* Look up name in hashEl list and return val or NULL if not found. */
-
-void hashElFree(struct hashEl **pEl);
-/* Free hash el list returned from hashListAll.  */
-
-void hashElFreeList(struct hashEl **pList);
-/* Free hash el list returned from hashListAll.  (Don't use
- * this internally. */
-
-struct hashCookie hashFirst(struct hash *hash);
-/* Return an object to use by hashNext() to traverse the hash table.
- * The first call to hashNext will return the first entry in the table. */
-
-struct hashEl* hashNext(struct hashCookie *cookie);
-/* Return the next entry in the hash table, or NULL if no more. Do not modify
- * hash table while this is being used. (see note in code if you want to fix
- * this) */
-
-void *hashNextVal(struct hashCookie *cookie);
-/* Return the next value in the hash table, or NULL if no more. Do not modify
- * hash table while this is being used. */
-
-char *hashNextName(struct hashCookie *cookie);
-/* Return the next name in the hash table, or NULL if no more. Do not modify
- * hash table while this is being used. */
-
-struct hash *newHashExt(int powerOfTwoSize, boolean useLocalMem);
-/* Returns new hash table. Uses local memory optionally. */
-#define hashNewExt(a) newHashExt(a)	/* Synonym */
-
-#define newHash(a) newHashExt(a, TRUE)
-/* Returns new hash table using local memory. */
-#define hashNew(a) newHash(a)	/* Synonym */
-
-void hashResize(struct hash *hash, int powerOfTwoSize);
-/* Resize the hash to a new size */
-
-struct hash *hashFromSlNameList(void *list);
-/* Create a hash out of a list of slNames. */
-
-struct hash *hashSetFromSlNameList(void *list);
-/* Create a hashSet (hash without values) out of a list of slNames. */
-
-void freeHash(struct hash **pHash);
-/* Free up hash table. */
-#define hashFree(a) freeHash(a)	/* Synonym */
-
-void freeHashAndVals(struct hash **pHash);
-/* Free up hash table and all values associated with it.
- * (Just calls freeMem on each hel->val) */
-
-void hashFreeWithVals(struct hash **pHash, void (freeFunc)());
-/* Free up hash table and all values associated with it. freeFunc is a
- * function to free an entry, should take a pointer to a pointer to an
- * entry. */
-
-void hashFreeList(struct hash **pList);
-/* Free up a list of hashes. */
-
-void hashHisto(struct hash *hash, char *fname);
-/* Output bucket usage counts to a file for producing a histogram  */
-
-void hashPrintStats(struct hash *hash, char *label, FILE *fh);
-/* print statistic about a hash table */
-
-struct hashEl *hashReplace(struct hash *hash, char *name, void *val);
-/* Replace an existing element in hash table, or add it if not present. */
-
-boolean hashMayRemove(struct hash *hash, char *name);
-/* Remove item of the given name from hash table, if present.
- * Return true if it was present */
-
-void hashMustRemove(struct hash *hash, char *name);
-/* Remove item of the given name from hash table, or error
- * if not present */
-
-char *hashToRaString(struct hash *hash);
-/* Convert hash to string in ra format. */
-
-int hashNumEntries(struct hash *hash);
-/* count the number of entries in a hash */
-
-struct hash *hashFromString(char *string);
-/* parse a whitespace-separated string with tuples in the format name=val or
- * name="val" to a hash name->val */
-
-#endif /* HASH_H */
-
diff --git a/gbtools/src/include/blatSrc/hex.h b/gbtools/src/include/blatSrc/hex.h
deleted file mode 100644
index 8948b37..0000000
--- a/gbtools/src/include/blatSrc/hex.h
+++ /dev/null
@@ -1,27 +0,0 @@
-
-#ifndef HEX_H
-#define HEX_H
-
-char nibbleToHex(char n);
-/* convert nibble to hexidecimal character. 0 <= n <= 15. */
-
-void byteToHex(unsigned char n, char *hex);
-/* convert byte to two hexidecimal characters. 0 <= n <= 255. */
-
-char *byteToHexString(unsigned char n);
-/* convert byte to hexidecimal string. 0 <= n <= 255. */
-
-void hexBinaryString(unsigned char *in, int inSize, char *out, int outSize);
-/* Convert possibly long binary string to hex string.
- * Out size needs to be at least 2x inSize+1 */
-
-/* Reverse Functions */
-
-char hexToNibble(char n);
-/* convert hexidecimal character to nibble. 0-9a-f. */
-
-unsigned char hexToByte(char *hex);
-/* convert byte to hexidecimal characters. 0 <= n <= 255. */
-
-#endif /* HEX_H */
-
diff --git a/gbtools/src/include/blatSrc/hgGene.h b/gbtools/src/include/blatSrc/hgGene.h
deleted file mode 100644
index ba9752b..0000000
--- a/gbtools/src/include/blatSrc/hgGene.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* hgGene.h was originally generated by the autoSql program, which also 
- * generated hgGene.c and hgGene.sql.  This header links the database and the RAM 
- * representation of objects. */
-
-struct geneFinder
-/* A gene finding program. */
-    {
-    struct geneFinder *next;  /* Next in singly linked list. */
-    unsigned id;	/* Unique ID */
-    char *name;	/* Name of gene finder */
-    };
-
-void geneFinderStaticLoad(char **row, struct geneFinder *ret);
-/* Load a row from geneFinder table into ret.  The contents of ret will
- * be replaced at the next call to this function. */
-
-struct geneFinder *geneFinderLoad(char **row);
-/* Load a geneFinder from row fetched with select * from geneFinder
- * from database.  Dispose of this with geneFinderFree(). */
-
-struct geneFinder *geneFinderCommaIn(char **pS);
-/* Create a geneFinder out of a comma separated string. */
-
-void geneFinderFree(struct geneFinder **pEl);
-/* Free a single dynamically allocated geneFinder such as created
- * with geneFinderLoad(). */
-
-void geneFinderFreeList(struct geneFinder **pList);
-/* Free a list of dynamically allocated geneFinder's */
-
-void geneFinderOutput(struct geneFinder *el, FILE *f, char sep, char lastSep);
-/* Print out geneFinder.  Separate fields with sep. Follow last field with lastSep. */
-
-#define geneFinderTabOut(el,f) geneFinderOutput(el,f,'\t','\n');
-/* Print out geneFinder as a line in a tab-separated file. */
-
-#define geneFinderCommaOut(el,f) geneFinderOutput(el,f,',',',');
-/* Print out geneFinder as a comma separated list including final comma. */
-
-struct hgGene
-/* A gene prediction */
-    {
-    struct hgGene *next;  /* Next in singly linked list. */
-    unsigned id;	/* Unique ID */
-    char *name;	/* Name of gene */
-    unsigned geneFinder;	/* Program that made prediction */
-    unsigned startBac;	/* Bac this starts in */
-    unsigned startPos;	/* Position within bac where starts */
-    unsigned endBac;	/* Bac this ends in */
-    unsigned endPos;	/* Position withing bac where ends */
-    signed char orientation;	/* Orientation relative to start bac */
-    unsigned transcriptCount;	/* Number of transcripts */
-    unsigned *transcripts;	/* Array of transcripts */
-    };
-
-struct hgGene *hgGeneLoad(char **row);
-/* Load a hgGene from row fetched with select * from hgGene
- * from database.  Dispose of this with hgGeneFree(). */
-
-struct hgGene *hgGeneCommaIn(char **pS);
-/* Create a hgGene out of a comma separated string. */
-
-void hgGeneFree(struct hgGene **pEl);
-/* Free a single dynamically allocated hgGene such as created
- * with hgGeneLoad(). */
-
-void hgGeneFreeList(struct hgGene **pList);
-/* Free a list of dynamically allocated hgGene's */
-
-void hgGeneOutput(struct hgGene *el, FILE *f, char sep, char lastSep);
-/* Print out hgGene.  Separate fields with sep. Follow last field with lastSep. */
-
-#define hgGeneTabOut(el,f) hgGeneOutput(el,f,'\t','\n');
-/* Print out hgGene as a line in a tab-separated file. */
-
-#define hgGeneCommaOut(el,f) hgGeneOutput(el,f,',',',');
-/* Print out hgGene as a comma separated list including final comma. */
-
-struct hgTranscript
-/* A transcript prediction */
-    {
-    struct hgTranscript *next;  /* Next in singly linked list. */
-    unsigned id;	/* Unique ID */
-    char *name;	/* Name of transcript */
-    unsigned hgGene;	/* Gene this is in */
-    unsigned startBac;	/* Bac this starts in */
-    unsigned startPos;	/* Position within bac where starts */
-    unsigned endBac;	/* Bac this ends in */
-    unsigned endPos;	/* Position withing bac where ends */
-    unsigned cdsStartBac;	/* Start of coding region. */
-    unsigned cdsStartPos;	/* Start of coding region. */
-    unsigned cdsEndBac;	/* End of coding region. */
-    unsigned cdsEndPos;	/* End of coding region. */
-    signed char orientation;	/* Orientation relative to start bac */
-    unsigned exonCount;	/* Number of exons */
-    unsigned *exonStartBacs;	/* Exon start positions */
-    unsigned *exonStartPos;	/* Exon start positions */
-    unsigned *exonEndBacs;	/* Exon start positions */
-    unsigned *exonEndPos;	/* Exon start positions */
-    };
-
-struct hgTranscript *hgTranscriptLoad(char **row);
-/* Load a hgTranscript from row fetched with select * from hgTranscript
- * from database.  Dispose of this with hgTranscriptFree(). */
-
-struct hgTranscript *hgTranscriptCommaIn(char **pS);
-/* Create a hgTranscript out of a comma separated string. */
-
-void hgTranscriptFree(struct hgTranscript **pEl);
-/* Free a single dynamically allocated hgTranscript such as created
- * with hgTranscriptLoad(). */
-
-void hgTranscriptFreeList(struct hgTranscript **pList);
-/* Free a list of dynamically allocated hgTranscript's */
-
-void hgTranscriptOutput(struct hgTranscript *el, FILE *f, char sep, char lastSep);
-/* Print out hgTranscript.  Separate fields with sep. Follow last field with lastSep. */
-
-#define hgTranscriptTabOut(el,f) hgTranscriptOutput(el,f,'\t','\n');
-/* Print out hgTranscript as a line in a tab-separated file. */
-
-#define hgTranscriptCommaOut(el,f) hgTranscriptOutput(el,f,',',',');
-/* Print out hgTranscript as a comma separated list including final comma. */
-
diff --git a/gbtools/src/include/blatSrc/hgap.h b/gbtools/src/include/blatSrc/hgap.h
deleted file mode 100644
index 4af14b7..0000000
--- a/gbtools/src/include/blatSrc/hgap.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* HGAP - Human Genome Annotation Project database. */
-#ifndef HGAP_H
-#define HGAP_H
-
-#ifndef DNASEQ_H
-#include "dnaseq.h"
-#endif 
-
-#ifndef UNFIN_H
-#include "unfin.h"
-#endif
-
-#ifndef JKSQL_H
-#include "jksql.h"
-#endif
-
-typedef unsigned int HGID;	/* A database ID. */
-
-void hgSetDb(char *dbName);
-/* Set the database name. */
-
-char *hgGetDb();
-/* Return the current database name. */
-
-struct sqlConnection *hgAllocConn();
-/* Get free connection if possible. If not allocate a new one. */
-
-struct sqlConnection *hgFreeConn(struct sqlConnection **pConn);
-/* Put back connection for reuse. */
-
-
-HGID hgIdQuery(struct sqlConnection *conn, char *query);
-/* Return first field of first table as HGID. 0 return ok. */
-
-HGID hgRealIdQuery(struct sqlConnection *conn, char *query);
-/* Return first field of first table as HGID- abort if 0. */
-
-
-struct sqlConnection *hgStartUpdate();
-/* Get a connection for an update.  (Starts allocating id's) */
-
-void hgEndUpdate(struct sqlConnection **pConn, char *comment, ...);
-/* Finish up connection with a printf format comment. */
-
-HGID hgNextId();
-/* Get next unique id.  (Should only be called after hgStartUpdate). */
-
-FILE *hgCreateTabFile(char *tableName);
-/* Open a tab file with name corresponding to tableName.  This
- * may just be fclosed when done. (Currently just makes
- * tableName.tab in the current directory.) */
-
-void hgLoadTabFile(struct sqlConnection *conn, char *tableName);
-/* Load tab delimited file corresponding to tableName. 
- * Should only be used after hgCreatTabFile, and only after
- * file closed. */
-
-
-enum 
-/* Various constants used. */
-    {
-    hgContigPad = 800,	  /* Number of N's between contigs. */
-    };
-
-struct hgBac
-/* This represents a sequenced clone (BAC/PAC/cosmid) */
-    {
-    struct hgBac *next;	      /* Next in list. */
-    struct hgNest *nest;      /* Coordinate space. */
-    HGID id;		      /* HGAP ID. */
-    char name[16];            /* GenBank accession. */
-    int contigCount;          /* Number of contigs. */
-    struct hgContig *contigs; /* Contig list. */
-    };
-
-struct hgContig
-/* This represents a contig within a BAC. */
-    {
-    struct hgContig *next;    /* Next in list. */
-    struct hgNest *nest;      /* Coordinate space. */
-    HGID id;		      /* HGAP ID. */
-    char name[20];            /* Name like AC000007.24 */
-    struct hgBac *bac;        /* Bac this is in. */
-    int ix;                   /* Contig index. */
-    int submitOffset;         /* Position in genBank submission. */
-    int size;                 /* Size in bases. */
-    };
-
-struct hgNest
-/* This structure describes the contig tree
- * chromosomes->chromosome contigs->bacs->
- * bac contigs.  */
-    {
-    struct hgNest *next;	/* Pointer to next sibling. */
-    struct hgNest *children;	/* Children. */
-    struct hgNest *parent;      /* Parent if any. */
-    HGID id;		        /* HGAP ID. */
-    int orientation;            /* +1 or -1 relative to parent. */
-    int offset;			/* Offset relative to parent. */
-    int size;                   /* Size in bases. */
-    struct hgContig *contig;    /* Associated contig if any. */
-    };
-
-struct hgBac *hgGetBac(char *acc);
-/* Load BAC with given accession into memory. Don't free this, it's
- * managed by system. */
-
-struct hgContig *hgGetContig(char *acc, int contigIx);
-/* Get contig.  contigIx is position in submission, not position in
- * ordering. */
-
-struct dnaSeq *hgContigSeq(struct hgContig *contig);
-/* Return DNA associated with contig. */
-
-struct dnaSeq *hgRnaSeq(char *acc);
-/* Return sequence for RNA. */
-
-void hgRnaSeqAndId(char *acc, struct dnaSeq **retSeq, HGID *retId);
-/* Return sequence for RNA and it's database ID. */
-
-struct dnaSeq *hgBacOrderedSeq(struct hgBac *bac);
-/* Return DNA associated with BAC including NNN's between
- * contigs in ordered coordinates. */
-
-struct dnaSeq *hgBacSubmittedSeq(char *acc);
-/* Returns DNA associated with BAC in submitted ordering
- * and coordinates. */
-
-struct dnaSeq *hgBacContigSeq(char *acc);
-/* Returns list of sequences, one for each contig in BAC. */
-
-int hgOffset(struct hgNest *source, int offset, struct hgNest *dest);
-/* Translate offset from source to destination coordinate space.
- * Destination has to be an ancestor (or the same) as source. */
-
-/* The following is a series of nested structures for
- * describing a range of DNA. The later structures include
- * the first fields of the earlier ones.  Routines that
- * work on the earlier structures will also work on
- * the later.  This is a crude but effective form of single 
- * inheritance. */
-
-struct hgRange
-/* Just start/end locations somewhere... */
-    {
-    struct hgRange *next; /* Next in list. */
-    int tStart, tEnd;	  /* Position in target or only sequence tStart <= x < tEnd */
-    };
-
-int hgCmpTStart(const void *va, const void *vb);
-/* Compare function to sort by tStart, then by tEnd. */
-
-struct hgHit
-/* A simple hit - an interesting range of a sequence. */
-    {
-    struct hgHit *next;   /* Next in list. */
-    int tStart, tEnd;	  /* Position in target or only sequence tStart <= x < tEnd */
-    int tOrientation;	  /* +1 or -1 orientation. */
-    char *target;	  /* Name of target seq. (Not allocated here.) */
-    };
-
-int hgCmpTarget(const void *va, const void *vb);
-/* Compare function to sort by target, orientaation, tStart, then tEnd. */
-
-struct hgScoredHit
-/* A hit with a log odds score. */
-    {
-    struct hgScoredHit *next;
-    int tStart, tEnd;	  /* Position in target or only sequence tStart <= x < tEnd */
-    int tOrientation;	  /* +1 or -1 orientation. */
-    char *target;	  /* Name of target seq. (Not allocated here.) */
-    int logOdds;          /* Log odds style score - scaled x 1000. */
-    };
-
-int hgCmpScore(const void *va, const void *vb);
-/* Compare function to sort logOdds score. */
-
-struct hgAliHit
-/* A hit representing an alignment between two sequences without inserts. */
-    {
-    struct hgAliHit *next;
-    int tStart, tEnd;	  /* Position in target or only sequence tStart <= x < tEnd */
-    int tOrientation;	  /* +1 or -1 orientation. */
-    char *target;	  /* Name of target seq. (Not allocated here.) */
-    int logOdds;          /* Log odds style score - scaled x 1000. */
-    int qStart, qEnd;     /* Position in query sequence. */
-    int qOrientation;	  /* +1 or -1 query orientation. */
-    char *query;	  /* Name of query seq. (Not allocated here.) */
-    };
-
-int hgCmpQStart(const void *va, const void *vb);
-/* Compare function to sort by qStart, then by qEnd. */
-
-int hgCmpQuery(const void *va, const void *vb);
-/* Compare function to sort by query, orientation, qStart, then qEnd. */
-
-struct hgBoundedHit
-/* An alignment hit that can have soft or hard edges. */
-    {
-    struct hgBoundedHit *next;
-    int tStart, tEnd;	  /* Position in target or only sequence tStart <= x < tEnd */
-    int tOrientation;	  /* +1 or -1 orientation. */
-    char *target;	  /* Name of target seq. (Not allocated here.) */
-    int logOdds;          /* Log odds style score - scaled x 1000. */
-    int qStart, qEnd;     /* Position in query sequence. */
-    int qOrientation;	  /* +1 or -1 query orientation. */
-    char *query;	  /* Name of query seq. (Not allocated here.) */
-    bool hardStart;       /* Start position known */
-    bool hardEnd;         /* End position known */
-    };
-
-struct hgAlignment
-/* An alignment with gaps. */
-    {
-    struct hgAlignment *next;
-    int tStart, tEnd;	  /* Position in target or only sequence tStart <= x < tEnd */
-    int tOrientation;	  /* +1 or -1 orientation. */
-    char *target;	  /* Name of target seq. (Not allocated here.) */
-    int logOdds;          /* Log odds style score - scaled x 1000. */
-    int qStart, qEnd;     /* Position in query sequence. */
-    int qOrientation;     /* +1 or -1 orientation. */
-    bool hardStart;       /* Start position known */
-    bool hardEnd;         /* End position known */
-    struct hgBoundedHit *hitList;  /*  Subalignments. */
-    };
-
-#endif /* HGAP_H */
-
diff --git a/gbtools/src/include/blatSrc/hgdb.h b/gbtools/src/include/blatSrc/hgdb.h
deleted file mode 100644
index 8df0d28..0000000
--- a/gbtools/src/include/blatSrc/hgdb.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* hgdb - Stuff to access human genome database. */
-#ifndef HGDB_H
-#define HGDB_H
-
-char *hgdbRootDir();
-/* Return root directory of human genome database. */
-
-struct dnaSeq *hgdbRnaSeq(char *accession);
-/* Return mRNA or EST sequence from an accession number. */
-
-struct fof *hgdbRnaFof();
-/* Return index for RNA sequences. */
-
-struct dnaSeq *hgdbShortSeq(char *accession);
-/* Return mRNA, EST, BACend or STS sequence based on
- * accession number. */
-
-struct fof *hgdbShortFof();
-/* Return index for short sequences. */
-
-struct dnaSeq *hgdbFinishedSeq(char *accession);
-/* Return finished BAC sequence. */
-
-struct dnaSeq *hgdbUnfinishedSeq(char *accession);
-/* Return unfinished BAC sequence. May be in 
- * several contigs (dnaSeq returned may be a list.) */
-
-struct dnaSeq *hgdbGetSeq(char *accession);
-/* Return sequence from any source. */
-
-char *hgdbKeyText(char *accession);
-/* Get key-value lines about accession number. */
-
-struct fof *hgdbKeyFof();
-/* Return index for key-values indexed by accession. */
-
-boolean hgdbSmallKey(char *accession, char *key, char *valBuf, int valBufSize);
-/* Get value of small key.  Returns FALSE if key doesn't exist. */
-
-#endif /* HGDB_H */
-
diff --git a/gbtools/src/include/blatSrc/histogram.h b/gbtools/src/include/blatSrc/histogram.h
deleted file mode 100644
index 2aff1bc..0000000
--- a/gbtools/src/include/blatSrc/histogram.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* histogram function for data array in memory	*/
-
-#if !defined(HISTOGRAM_H)
-#define HISTOGRAM_H
-
-#define	DEFAULT_BIN_COUNT	26
-/*	ARBITRARY default choice of # of bins	*/
-
-struct histoResult {
-    struct histoResult *next;	/*	might be a list of them	*/
-    float binSize;		/*	size of a bin	*/
-    unsigned binCount;		/*	number of bins	*/
-    unsigned count;		/*	number of values	*/
-    float binZero;		/*	bin 0 starts at this value	*/
-    unsigned *binCounts;	/*	array binCounts[binCount]	*/
-    float *pValues;		/*	array pValues[binCount]		*/
-};
-
-void freeHistoGram(struct histoResult **histoResults);
-/*      free the histoResults list	*/
-
-struct histoResult *histoGram(float *values, size_t N, float binSize,
-	unsigned binCount, float minValue, float min, float max,
-	struct histoResult *accumHisto);
-/*	construct histogram of data in values[N] array.	*/
-#endif
diff --git a/gbtools/src/include/blatSrc/hmac.h b/gbtools/src/include/blatSrc/hmac.h
deleted file mode 100644
index 7360234..0000000
--- a/gbtools/src/include/blatSrc/hmac.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Calculate an openssl keyed-hash message authentication code (HMAC) */
-
-#ifndef HMAC_H
-#define HMAC_H
-
-char *hmacSha1(char *key, char *data);
-/* Calculate a openssl SHA1 keyed-hash message authentication code (HMAC) */
-
-char *hmacMd5(char *key, char *data);
-/* Calculate a openssl MD5 keyed-hash message authentication code (HMAC) */
-
-#endif /* HMAC_H */
diff --git a/gbtools/src/include/blatSrc/hmmPfamParse.h b/gbtools/src/include/blatSrc/hmmPfamParse.h
deleted file mode 100644
index f9c6c9d..0000000
--- a/gbtools/src/include/blatSrc/hmmPfamParse.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* hmmpfamParse - Parse hmmpfam files.. */
-
-#ifndef HMMPFAMPARSE_H
-#define HMMPFAMPARSE_H
-
-struct hpfDomain
-/* Describes amino acids covered by one use of model. */
-    {
-    struct hpfDomain *next;
-    int qStart, qEnd;	/* Where this is in query sequence. */
-    int hmmStart, hmmEnd; /* Where this is in profile HMM. */
-    double score;	/* Some sort of bit score. */
-    double eVal;	/* Expectation value. */
-    };
-
-struct hpfModel 
-/* Results for a single model for a single query */
-    {
-    struct hpfModel *next;
-    char *name;	/* Model name */
-    char *description; /* Longer description */
-    double score;	/* Some sort of bit score. */
-    double eVal;	/* Expectation value. */
-    struct hpfDomain *domainList;	/* All places model occurs in query */
-    };
-
-void hpfModelFree(struct hpfModel **pMod);
-/* Free memory associated with hpfModel */
-
-void hpfModelFreeList (struct hpfModel **pList);
-/* Free memory associated with list of hpfModels.  */
-
-struct hpfResult
-/* Result for a single query sequence. */
-    {
-    struct hpfResult *next;
-    char *name;	/* Query sequence name. */
-    struct hpfModel *modelList;  /* All models that hit query */
-    };
-
-void hpfResultFree(struct hpfResult **pHr);
-/* Free memory associated with hpfResult */
-
-void hpfResultFreeList(struct hpfResult **pList);
-/* Free memory associated with list of hpfResults. */
-
-
-struct hpfModel *hpfFindResultInModel(struct hpfResult *hr, char *modName);
-/* Look for named result in model. */
-
-struct hpfResult *hpfNext(struct lineFile *lf);
-/* Parse out next record in hmmpfam result file. */
-
-
-#endif /* HMMPFAMPARSE_H */
diff --git a/gbtools/src/include/blatSrc/hmmstats.h b/gbtools/src/include/blatSrc/hmmstats.h
deleted file mode 100644
index 7db9bde..0000000
--- a/gbtools/src/include/blatSrc/hmmstats.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* hmmstats.h - Stuff for doing statistical analysis in general and 
- * hidden Markov models in particular. */
-#ifndef HMMSTATS_H
-#define HMMSTATS_H
-
-int scaledLog(double val);
-/* Return scaled log of val. */
-
-#define logScaleFactor 1000
-/* Amount we scale logs by. */
-
-double simpleGaussean(double x);
-/* Gaussean distribution with standard deviation 1 and mean 0. */
-
-double gaussean(double x, double mean, double sd);
-/* Gaussean distribution with mean and standard deviation at point x  */
-
-double calcVarianceFromSums(double sum, double sumSquares, bits64 n);
-/* Calculate variance. */
-
-double calcStdFromSums(double sum, double sumSquares, bits64 n);
-/* Calculate standard deviation. */
-
-#endif /* HMMSTATS_H */
-
diff --git a/gbtools/src/include/blatSrc/htmlPage.h b/gbtools/src/include/blatSrc/htmlPage.h
deleted file mode 100644
index 735c8ea..0000000
--- a/gbtools/src/include/blatSrc/htmlPage.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/* htmlPage - stuff to read, parse, and submit  htmlPages and forms. 
- *
- * typical usage is:
- *   struct htmlPage *page = htmlPageGet(url);
- *   htmlPageValidateOrAbort(page);
- *   var = htmlPageGetVar(page, page->forms, "org");
- *   if (var != NULL)
- *      printf("Organism = %s\n", var->curVal);
- *   htmlPageSetVar(page, page->forms, "org", "Human");
- *   newPage = htmlPageFromForm(page, page->forms, "submit", "Go");
- */
-
-#ifndef HTMLPAGE_H
-#define HTMLPAGE_H
-
-#ifndef DYSTRING_H
-#include "dystring.h"
-#endif
-
-struct htmlStatus
-/* HTTP version and status code. */
-    {
-    struct htmlStatus *next;	/* Next in list. */
-    char *version;		/* Usually something like HTTP/1.1 */
-    int status;			/* HTTP status code.  200 is good. */
-    };
-
-struct htmlCookie
-/* A cookie - stored by browser usually.  We need to echo it
- * back when we post forms. */
-    {
-    struct htmlCookie *next;	/* Next in list. */
-    char *name;			/* Cookie name. */
-    char *value;		/* Cookie value. */
-    char *domain;		/* The set of web domains this applies to. */
-    char *path;			/* Cookie applies below this path I guess. */
-    char *expires;		/* Expiration date. */
-    boolean secure;		/* Is it a secure cookie? */
-    };
-
-struct htmlAttribute
-/* An html attribute - part of a set of name/values pairs in a tag. */
-    {
-    struct htmlAttribute *next;
-    char *name;		/* Attribute name. */
-    char *val;		/* Attribute value. */
-    };
-
-struct htmlTag
-/* A html tag - includes attribute list and parent, but no text. */
-    {
-    struct htmlTag *next;
-    char *name;	/* Tag name. */
-    struct htmlAttribute *attributes;  /* Attribute list. */
-    char *start;  /* Start of this tag.  Not allocated here.*/
-    char *end;	  /* End of tag (one past closing '>')  Not allocated here.*/
-    };
-
-struct htmlFormVar
-/* A variable within an html form - from input, button, etc. */
-    {
-    struct htmlFormVar *next;	/* Next in list. */
-    char *name;			/* Variable name.  Not allocated here.*/
-    char *tagName;		/* Name of tag.  Not allocated here. */
-    char *type;			/* Variable type. Not allocated here. */
-    char *curVal;		/* Current value if any.  Allocated here. */
-    struct slName *values;	/* List of available values.  Null if textBox. */
-    struct slRef *tags;	        /* List of references associated tags. */
-    };
-
-struct htmlForm
-/* A form within an html page. */
-    {
-    struct htmlForm *next;	/* Next form in list. */
-    char *name;			/* Name (n/a if not defined).  Not allocated here. */
-    char *action;		/* Action attribute value.  Not allocated here. */
-    char *method;		/* Defaults to "GET". Not allocated here.  */
-    struct htmlTag *startTag;	/* Tag that holds <FORM>. Not allocated here.  */
-    struct htmlTag *endTag;	/* Tag one past </FORM> . Not allocated here. */
-    struct htmlFormVar *vars; /* List of form variables. */
-    };
-
-struct htmlPage
-/* A complete html page parsed out. */
-    {
-    struct htmlPage *next;
-    char *url;				/* Url that produced this page. */
-    struct htmlStatus *status;		/* Version and status. */
-    struct hash *header;		/* Hash of header lines (cookies, etc.) */
-    struct htmlCookie *cookies;		/* Associated cookies if any. */
-    char *fullText;			/* Full unparsed text including headers. */
-    char *htmlText;			/* Text unparsed after header.  Same mem as fullText. */
-    struct htmlTag *tags;		/* List of tags in this page. */
-    struct htmlForm *forms;		/* List of all forms. */
-    };
-
-void htmlStatusFree(struct htmlStatus **pStatus);
-/* Free up resources associated with status */
-
-void htmlStatusFreeList(struct htmlStatus **pList);
-/* Free a list of dynamically allocated htmlStatus's */
-
-struct htmlStatus *htmlStatusParse(char **pText);
-/* Read in status from first line.  Update pText to point to next line. 
- * Note unlike many routines here, this does not insert zeros into text. */
-
-void htmlCookieFree(struct htmlCookie **pCookie);
-/* Free memory associated with cookie. */
-
-void htmlCookieFreeList(struct htmlCookie **pList);
-/* Free a list of dynamically allocated htmlCookie's */
-
-struct htmlCookie *htmlCookieFileRead(char *fileName);
-/* Read cookies from a line oriented file.  First word in line
- * is the cookie name, the rest of the line the cookie value. */
-
-void htmlAttributeFree(struct htmlAttribute **pAttribute);
-/* Free up resources associated with attribute. */
-
-void htmlAttributeFreeList(struct htmlAttribute **pList);
-/* Free a list of dynamically allocated htmlAttribute's */
-
-char *htmlTagAttributeVal(struct htmlPage *page, struct htmlTag *tag, 
-	char *name, char *defaultVal);
-/* Return value of named attribute, or defaultVal if attribute doesn't exist. */
-
-char *htmlTagAttributeNeeded(struct htmlPage *page, struct htmlTag *tag, char *name);
-/* Return named tag attribute.  Complain and return "n/a" if it
- * doesn't exist. */
-
-void htmlTagFree(struct htmlTag **pTag);
-/* Free up resources associated with tag. */
-
-void htmlTagFreeList(struct htmlTag **pList);
-/* Free a list of dynamically allocated htmlTag's */
-
-void htmlFormVarFree(struct htmlFormVar **pVar);
-/* Free up resources associated with form variable. */
-
-void htmlFormVarFreeList(struct htmlFormVar **pList);
-/* Free a list of dynamically allocated htmlFormVar's */
-
-void htmlFormVarPrint(struct htmlFormVar *var, FILE *f, char *prefix);
-/* Print out variable to file, prepending prefix. */
-
-void htmlFormFree(struct htmlForm **pForm);
-/* Free up resources associated with form variable. */
-
-void htmlFormFreeList(struct htmlForm **pList);
-/* Free a list of dynamically allocated htmlForm's */
-
-void htmlFormPrint(struct htmlForm *form, FILE *f);
-/* Print out form structure. */
-
-char *htmlFormCgiVars(struct htmlPage *page, struct htmlForm *form, 
-	char *buttonName, char *buttonVal, struct dyString *dyHeader);
-/* Return cgi vars in name=val format from use having pressed
- * submit button of given name and value. */
-
-struct htmlForm *htmlFormGet(struct htmlPage *page, char *name);
-/* Get named form. */
-
-struct htmlFormVar *htmlFormVarGet(struct htmlForm *form, char *name);
-/* Get named variable. */
-
-void htmlFormVarSet(struct htmlForm *form, char *name, char *val);
-/* Set variable to given value.  */
-
-struct htmlFormVar *htmlPageGetVar(struct htmlPage *page, struct htmlForm *form, char *name);
-/* Get named variable.  If form is NULL, first form in page is used. */
-
-void htmlPageSetVar(struct htmlPage *page, struct htmlForm *form, char *name, char *val);
-/* Set variable to given value.  If form is NULL, first form in page is used. */
-
-void htmlPageFree(struct htmlPage **pPage);
-/* Free up resources associated with htmlPage. */
-
-void htmlPageFreeList(struct htmlPage **pList);
-/* Free a list of dynamically allocated htmlPage's */
-
-char *expandUrlOnBase(char *base, char *url);
-/* Figure out first character past host name. Load up
- * return string with protocol (if any) and host name. 
- * It is assumed that url is relative to base and does not contain a protocol.*/
-
-char *htmlExpandUrl(char *base, char *url);
-/* Expand URL that is relative to base to stand on it's own. 
- * Return NULL if it's not http or https. */
-
-char *htmlNextCrLfLine(char **pS);
-/* Return zero-terminated line and advance *pS to start of
- * next line.  Return NULL at end of file.  Warn if there is
- * no <CR>. */
-
-struct slName *htmlPageScanAttribute(struct htmlPage *page, 
-	char *tagName, char *attribute);
-/* Scan page for values of particular attribute in particular tag.
- * if tag is NULL then scans in all tags. */
-
-struct slName *htmlPageLinks(struct htmlPage *page);
-/* Scan through tags list and pull out HREF attributes. */
-
-void htmlPageFormOrAbort(struct htmlPage *page);
-/* Aborts if no FORM found */
-
-void htmlPageValidateOrAbort(struct htmlPage *page);
-/* Do some basic validations.  Aborts if there is a problem. */
-
-char *htmlSlurpWithCookies(char *url, struct htmlCookie *cookies);
-/* Send get message to url with cookies, and return full response as
- * a dyString.  This is not parsed or validated, and includes http
- * header lines.  Typically you'd pass this to htmlPageParse() to
- * get an actual page. */
-
-struct htmlPage *htmlPageParse(char *url, char *fullText);
-/* Parse out page and return.  Warn and return NULL if problem. */
-
-struct htmlPage *htmlPageParseOk(char *url, char *fullText);
-/* Parse out page and return only if status ok. */
-
-struct htmlPage *htmlPageParseNoHead(char *url, char *htmlText);
-/* Parse out page in memory (past http header if any) and return. */
-
-struct htmlPage *htmlPageFromForm(struct htmlPage *origPage, struct htmlForm *form, 
-	char *buttonName, char *buttonVal);
-/* Return a new htmlPage based on response to pressing indicated button
- * on indicated form in origPage. */
-
-struct htmlPage *htmlPageGetWithCookies(char *url, struct htmlCookie *cookies);
-/* Get page from URL giving server the given cookies.   Note only the
- * name and value parts of the cookies need to be filled in. */
-
-struct htmlPage *htmlPageGet(char *url);
-/* Get page from URL (may be a file). */
-
-struct htmlPage *htmlPageForwarded(char *url, struct htmlCookie *cookies);
-/* Get html page.  If it's just a forwarding link then get do the
- * forwarding.  Cookies is a possibly empty list of cookies with
- * name and value parts filled in. */
-
-struct htmlPage *htmlPageForwardedNoAbort(char *url, struct htmlCookie *cookies);
-/* Try and get an HTML page.  Print warning and return NULL if there's a problem. */
-
-struct htmlTag *findNextMatchingTag(struct htmlTag *list, char *name);
-/* Return first tag in list that is of type name or NULL if not found. */
-
-#endif /* HTMLPAGE_H */
-
diff --git a/gbtools/src/include/blatSrc/htmshell.h b/gbtools/src/include/blatSrc/htmshell.h
deleted file mode 100644
index 96e4422..0000000
--- a/gbtools/src/include/blatSrc/htmshell.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/* Htmshell.h - stuff to make it easier to generate HTML files on
- * the fly.  Typically included with cheapcgi.h in almost any
- * CGI program.
- *
- * To use this generally you should call the function htmShell()
- * very early inside of main().  You pass htmShell() a routine
- * which does most of the work of your web server-side applet.
- *
- * These routines will throw errors, which are caught by
- * htmShell, which then returns.  For the most part you just
- * want an error to cause an error message to be printed and
- * then terminate your CGI program, so this works fine.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-void htmlSetCookie(char* name, char* value, char* expires, char* path, char* domain, boolean isSecure);
-/* create a cookie with the given stats */
-
-void htmlParagraph(char *line, ...);
-/* Print a line in it's own paragraph. */
-
-void htmlVaParagraph(char *line, va_list args);
-/* Print a line in it's own paragraph. */
-
-void htmlCenterParagraph(char *line, ...);
-/* Center a line in it's own paragraph. */
-
-void htmlHorizontalLine();
-/* Print a horizontal line. */
-
-void htmlNbSpaces(int count);
-/* Print a number of non-breaking spaces. */
-
-void htmHorizontalLine(FILE *f);
-/* Print a horizontal line. */
-
-void htmTextOut(FILE *f, char *s);
-/* Print out string to file, if necessary replacing > with > and the like */
-
-void htmlTextOut(char *s);
-/* Print out string, if necessary replacing > with > and the like */
-
-char *htmlTextStripTags(char *s);
-/* Returns a cloned string with all html tags stripped out */
-
-char *htmlTextReplaceTagsWithChar(char *s, char ch);
-/* Returns a cloned string with all html tags replaced with given char (useful for tokenizing) */
-
-char *htmlEncodeText(char *s, boolean tagsOkay);
-/* Returns a cloned string with quotes replaced by html codes.
-   Changes ',",\n and if not tagsOkay >,<,& to code equivalents.
-   This differs from cgiEncode as it handles text that will
-   be displayed in an html page or tooltip style title.  */
-#define htmlEncode(s) htmlEncodeText(s,FALSE)
-
-char *attributeEncode(char *str);
-// encode double and single quotes in a string to be used as an element attribute
-
-void htmlMemDeath();
-/* Complain about lack of memory and abort.  */
-
-void htmlStart(char *title);
-/* Write the start of a cgi-generated html file */
-
-void htmStart(FILE *f, char *title);
-/* Write the start of a stand alone .html file. */
-
-void printBodyTag(FILE *f);
-// print starting BODY tag, including any appropriate attributes (class, background and bgcolor). 
-
-void htmStartWithHead(FILE *f, char *head, char *title);
-/* Write the start of a stand alone .html file, plus head info */
-
-void htmStartDirDepth(FILE *f, char *title, int dirDepth);
-/* Write the start of a stand alone .html file.  dirDepth is the number of levels
- * beneath apache root that caller's HTML will appear to the web client.
- * E.g. if writing HTML from cgi-bin, dirDepth is 1; if trash/body/, 2. */
-
-void htmlEnd();
-/* Write the end of a cgi-generated html file */
-
-void htmEnd(FILE *f);
-/* Write the end of a stand-alone html file */
-
-extern char *htmlStyleUndecoratedLink;
-/* Style that gets rid of underline of links. */
-
-void htmlSetStyle(char *style);
-/* Set document wide style. A favorite style to
- * use for many purposes is htmlStyleUndecoratedLink
- * which will remove underlines from links.
- * Needs to be called before htmlStart or htmShell. */
-
-void htmlSetStyleSheet(char *styleSheet);
-/* Set document wide style sheet by adding css name to HEAD part.
- * Needs to be called before htmlStart or htmShell. */
-
-void htmlSetFormClass(char *formClass);
-/* Set class in the BODY part. */
-
-
-void htmlSetStyleTheme(char *style);
-/* Set theme style, these styles can overwrite document wide styles.
- * Needs to be called before htmlStart or htmShell. */
-
-void htmlSetBackground(char *imageFile);
-/* Set background image - needs to be called before htmlStart
- * or htmShell. */
-
-void htmlSetBgColor(int color);
-/* Set background color - needs to be called before htmlStart
- * or htmShell. */
-
-void htmlBadVar(char *varName);
-/* Complain about input variables. */
-
-void htmlImage(char *fileName, int width, int height);
-/* Display centered image file. */
-
-jmp_buf htmlRecover;  /* Error recovery jump. Exposed for cart's use. */
-
-void htmlVaWarn(char *format, va_list args);
-/* Write an error message.  (Generally you just call warn() or errAbort().
- * This is exposed mostly for the benefit of the cart.) */
-
-char *htmlWarnStartPattern();
-/* Return starting pattern for warning message. */
-
-char *htmlWarnEndPattern();
-/* Return ending pattern for warning message. */
-
-void htmlWarnBoxSetup(FILE *f);
-/* Creates an invisible, empty warning box than can be filled with errors
- * and then made visible. */
-
-void htmlAbort();
-/* Terminate HTML file.  Exposed for cart's use. */
-
-void htmlPushEarlyHandlers();
-/* Push stuff to close out web page to make sensible error
- * message during initialization. */
-
-/* Wrap error recovery around call to doMiddle. */
-void htmErrOnlyShell(void (*doMiddle)());
-
-/* Wrap error recovery and and input processing around call to doMiddle. */
-void htmEmptyShell(void (*doMiddle)(), char *method);
-
-/* Wrap an html file around the passed in function.
- * The passed in function is already in the body. It
- * should just make paragraphs and return.
- * Method should be "query" or "get" or "post" (or NULL
- * if you don't care)..
- */
-void htmShell( char *title, void (*doMiddle)(), char *method);
-
-/* Wrap an html file around the passed in function.
- * The passed in function is already in the body. It
- * should just make paragraphs and return.
- * Method should be "query" or "get" or "post".
-param title - The HTML page title
-param head - The head text: can be a refresh directive or javascript
-param method - The function pointer to execute in the middle
-param method - The browser request method to use
- */
-void htmShellWithHead( char *title, char *head, void (*doMiddle)(), char *method);
-
-/* tell htmlOut to not escape special HTML chars '<', '>' */
-void htmlNoEscape();
-
-/* tell htmlOut to escape special HTML chars '<', '>' */
-void htmlDoEscape();
-
-/* Include an HTML file in a CGI.
- *   The file path is relative to the web server document root */
-void htmlIncludeWebFile(char *file);
-
-/* Include an HTML file in a CGI */
-void htmlIncludeFile(char *path);
diff --git a/gbtools/src/include/blatSrc/https.h b/gbtools/src/include/blatSrc/https.h
deleted file mode 100644
index 7197d0e..0000000
--- a/gbtools/src/include/blatSrc/https.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Connect via https. */
-
-#ifndef NET_HTTPS_H
-#define NET_HTTPS_H
-
-int netConnectHttps(char *hostName, int port);
-/* Return socket for https connection with server or -1 if error. */
-
-#endif//ndef NET_HTTPS_H
diff --git a/gbtools/src/include/blatSrc/intValTree.h b/gbtools/src/include/blatSrc/intValTree.h
deleted file mode 100644
index 07203bb..0000000
--- a/gbtools/src/include/blatSrc/intValTree.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* intValTree - a binary tree with integer keys and void values.  This is based on the 
- * red/black self-balancing binary tree algorithm in the rbTree module. */
-
-#ifndef INTVALTREE_H
-#define INTVALTREE_H
-
-#ifndef RBTREE_H
-#include "rbTree.h"
-#endif
-
-struct rbTree *intValTreeNew();
-/* Create a new, empty, tree with integer keys and void values. */
-
-#define intValTreeFree(a) rbTreeFree(a)
-/* Free up intVal tree.  */
-
-struct intVal
-/* An integer coupled with a void value. */
-    {
-    int key;
-    void *val;
-    };
-
-int intValCmp(void *va, void *vb);
-/* Return -1 if a before b,  0 if a and b overlap,
- * and 1 if a after b. */
-
-struct intVal *intValTreeAdd(struct rbTree *tree, int key, void *val);
-/* Add to binary tree.  Will abort if key is already in tree. */
-
-struct intVal *intValTreeUpdate(struct rbTree *tree, int key, void *val);
-/* Add to binary tree. If key is already in tree just updates it with val. */
-
-struct intVal *intValTreeRemove(struct rbTree *tree, int key);
-/* Removes given tree from key. */
-
-struct intVal *intValTreeLookup(struct rbTree *tree, int key);
-/* Returns intVal associated with given key, or NULL if none exists. */
-
-void *intValTreeFind(struct rbTree *tree, int key);
-/* Returns value associated with given key, or NULL if none exists. */
-
-void *intValTreeMustFind(struct rbTree *tree, int key);
-/* Return value associated with given key. Aborts if none exists. */
-
-int *intValTreeKeys(struct rbTree *tree);
-/* Returns array of keys (size is tree->n).  You freeMem this when done. */
-
-#endif /* INTVALTREE_H */
-
diff --git a/gbtools/src/include/blatSrc/internet.h b/gbtools/src/include/blatSrc/internet.h
deleted file mode 100644
index 1633799..0000000
--- a/gbtools/src/include/blatSrc/internet.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* internet - some stuff for routines that use the internet
- * and aren't afraid to include some internet specific structures
- * and the like.   See also net for stuff that is higher level. */
-
-#ifndef INTERNET_H
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-
-bits32 internetHostIp(char *hostName);
-/* Get IP v4 address (in host byte order) for hostName.
- * Warn and return 0 if there's a problem. */
-
-boolean internetFillInAddress(char *hostName, int port, 
-	struct sockaddr_in *address);
-/* Fill in address. Warn and return FALSE if can't.  */
-
-boolean internetIpToDottedQuad(bits32 ip, char dottedQuad[17]);
-/* Convert IP4 address in host byte order to dotted quad 
- * notation.  Warn and return FALSE if there's a 
- * problem. */
-
-boolean internetDottedQuadToIp(char *dottedQuad, bits32 *retIp);
-/* Convert dotted quad format address to IP4 address in
- * host byte order.  Warn and return FALSE if there's a 
- * problem. */
-
-boolean internetIsDottedQuad(char *s);
-/* Returns TRUE if it looks like s is a dotted quad. */
-
-void internetParseDottedQuad(char *dottedQuad, unsigned char quad[4]);
-/* Parse dotted quads into quad */
-
-void internetUnpackIp(bits32 packed, unsigned char unpacked[4]);
-/* Convert from 32 bit to 4-byte format with most significant
- * byte first. */
-
-boolean internetIpInSubnet(unsigned char unpackedIp[4], 
-	unsigned char subnet[4]);
-/* Return true if unpacked IP address is in subnet. */
-
-#endif /* INTERNET_H */
diff --git a/gbtools/src/include/blatSrc/itsa.h b/gbtools/src/include/blatSrc/itsa.h
deleted file mode 100644
index b460430..0000000
--- a/gbtools/src/include/blatSrc/itsa.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* itsa - indexed traversable suffix array.  Used for doing quick genomic searches.
- * Use itsaMake utility to create one of these files , and the routines here to access it.  
- * See comment by itsaFileHeader for file format. See src/shortReads/itsaMake/itsa.doc as well 
- * for an explanation of the data structures, particularly the traverse array. */
-/* This file is copyright 2008 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef ITSA_H
-#define ITSA_H
-
-struct itsaFileHeader
-/* Short read index file binary file header.  A itsa file starts with this fixed 128 byte
- * structure.  It is followed by the following sections:
- *    chromosome name strings - zero terminated.  Padded with zero to 4 byte boundary 
- *    chromosome sizes (32 bits each)
- *    chromosome DNA - one byte per base lower case.  A zero between each chrom, and a zero before
- *                     and after (to make some end conditions easier).  Padded if need be with
- *                     additional zeroes to 4 base boundary.
- *    suffix array -   32 bits for each indexed base. Alphabetical offsets into DNA
- *    traverse array - Also 32 bits per indexed base. Helper info to traverse array like a tree. 
- *    index13 - index of all 13-base prefixes in the suffix array.  4**13 32 bit values.  
- *              Will have zeros in positions where there is no data for this slot.
- *              Index+1 of suffix array where there is data (to free up zero for no data). 
- *    cursors13 - cursor position at each of the index13 positions*/
-    {
-    bits32 magic;	 /* Always ITSA_MAGIC */
-    bits16 majorVersion; /* This version changes when backward compatibility breaks. */
-    bits16 minorVersion; /* This version changes whenever a feature is added. */
-    bits64 size;	 /* Total size to memmap, including header. */
-    bits32 chromCount;	 /* Total count of chromosomes/contigs in file. */
-    bits32 chromNamesSize;	/* Size of names of all contigs (including zeroes at end),
-    				   padded to 4 byte boundary as needed). */
-    bits64 arraySize;	 /* Total number of bases actually indexed (non-N, unmasked). */
-    bits64 dnaDiskSize;	 /* Size of DNA on disk with zero separators. Padded to 4 byte boundary  */
-    bits64 reserved[11];/* All zeroes for now. */
-    };
-
-struct itsa 
-/* Suffix array in memory */
-    {
-    struct itsa *next;
-    boolean isMapped;	/* True if memory mapped. */
-    struct itsaFileHeader *header;	/* File header. */
-    char **chromNames;	/* Name of each chromosome. */
-    bits32 *chromSizes;    /* Size of each chromosome.  No deallocation required (in memmap) */
-    bits32 *chromOffsets;  /* Offset of each chromosome's DNA */
-    char *allDna;	/* All DNA from each contig/chromosome with zero separators. */
-    bits32 *array;	/* Alphabetized offsets into allDna.  The suffix array. */
-    bits32 *traverse;	/* Offsets to position in array where current prefix changes. */
-    bits32 *index13;	/* Look up the first 13 bases of the query sequence here to find the corresponding
-                         * offset into the suffix array.  0 indicates empty slot.  Subtract 1 to get
-			 * offset (to free up zero for this meaning). */
-    UBYTE *cursors13;	/* Cursor positions in suffix array at index positions. */
-    };
-
-struct itsa *itsaRead(char *fileName, boolean memoryMap);
-/* Read in a itsa from a file.  Does this via memory mapping if you like,
- * which will be faster typically for about 100 reads, and slower for more
- * than that (_much_ slower for thousands of reads and more). */
-
-void itsaFree(struct itsa **pSufx);
-/* Free up resources associated with index. */
-
-int itsaOffsetToChromIx(struct itsa *itsa, bits32 tOffset);
-/* Figure out index of chromosome containing tOffset */
-
-/** Stuff to define ITSA files **/
-#define ITSA_MAGIC 0x600BA3A1	/* Magic number at start of ITSA file */
-#define ITSA_MAJOR_VERSION 0	
-#define ITSA_MINOR_VERSION 0
-
-/* Number of slots in itsa index. */
-#define itsaSlotCount (1<<(13*2))
-
-/* Base values in _alphabetical_ order. Unfortunately the ones in dnautil.h are not.... */
-#define ITSA_A 0
-#define ITSA_C 1
-#define ITSA_G 2
-#define ITSA_T 3
-
-/* Table to convert letters to one of the above values. Call itsaBaseToValInit() before using. */
-extern int itsaBaseToVal[256];
-
-void itsaBaseToValInit();
-/* Initialize itsaBaseToVal array */
-
-int itsaDnaToBinary(char *dna, int size);
-/* Convert dna to binary representation. Call itsaBaseToValInit() first. */
-
-#endif /* ITSA_H */
diff --git a/gbtools/src/include/blatSrc/iupac.h b/gbtools/src/include/blatSrc/iupac.h
deleted file mode 100644
index 2ff3318..0000000
--- a/gbtools/src/include/blatSrc/iupac.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* iupac - routines to help cope with IUPAC ambiguity codes in DNA sequence. */
-
-#ifndef IUPAC_H
-#define IUPAC_H
-
-boolean iupacMatch(char iupac, char dna);
-/* See if iupac ambiguity code matches dna character */
-
-boolean iupacMatchLower(char iupac, char dna);
-/* See if iupac ambiguity code matches dna character where
- * both are lower case */
-
-boolean isIupac(char c);
-/* See if iupac c is a legal iupac char */
-
-boolean isIupacLower(char c);
-/* See if iupac c is a legal (lower case) iupac char */
-
-void iupacFilter(char *in, char *out);
-/* Filter out non-DNA non-UIPAC ambiguity code characters and change to lower case. */
-
-boolean anyIupac(char *s);
-/* Return TRUE if there are any IUPAC ambiguity codes in s */
-
-char iupacComplementBaseLower(char iupac);
-/* Return IUPAC complement for a single base */
-
-void iupacComplementLower(char *iupac, int iuSize);
-/* Return IUPAC complement many bases. Assumes iupac is lower case. */
-
-void iupacReverseComplement(char *iu, int iuSize);
-/* Reverse complement a string containing DNA and IUPAC codes. Result will be always
- * lower case. */
-
-boolean iupacMatchStart(char *iupacPrefix, char *dnaString);
-/* Return TRUE if start of DNA is compatible with iupac */
-
-char *iupacIn(char *needle, char *haystack);
-/* Return first place in haystack (DNA) that matches needle that may contain IUPAC codes. */
-
-#endif /* IUPAC_H */
-
diff --git a/gbtools/src/include/blatSrc/jointalign.h b/gbtools/src/include/blatSrc/jointalign.h
deleted file mode 100644
index c9d9fe0..0000000
--- a/gbtools/src/include/blatSrc/jointalign.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2002 Ryan Weber.  This source code may be freely used       *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Ryan Weber (weber at cse.ucsc.edu) *
- *****************************************************************************/
-/* jointalign.h - routines for printing a joint alignment in html. */
-
-#ifndef JOINTALIGN_H
-#define JOINTALIGN_H
-
-void htmlPrintJointAlignment( char *seq1, char *seq2, int columnNum, 
-        int start, int end, char *strand );
-/* Print sequences 1 and 2 (assumed to be a joint alignment),
- * formatted for html output. Coordinates are printed based on
- * the start and end positions and oriented according to the
- * strand the sequences are on (+ or -).*/
-
-boolean ucaseMatch( char a, char b );
-/* Case insensitive character matching */
-
-void validateSeqs( char *seq1, char *seq2 );
-/*Make sure sequences are the same length*/
-
-void htmlPrintJointAlignmentLine( char *seq1, char *seq2, int start, int end);
-/* Prints one line of the joint alignment between seq1 and seq2,
- * from seq[start] to seq[end-1].*/
-
-
-#endif /* JOINTALIGN */
-
diff --git a/gbtools/src/include/blatSrc/jpegSize.h b/gbtools/src/include/blatSrc/jpegSize.h
deleted file mode 100644
index c74f242..0000000
--- a/gbtools/src/include/blatSrc/jpegSize.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* jpegSize - read a jpeg header and figure out dimensions of image.
- * Adapted by Galt Barber from Matthias Wandel's jhead program */
-
-#ifndef JPEGSIZE_H
-
-void jpegSize(char *fileName, int *width, int *height);
-/* Read image width and height.
- * Parse marker stream until SOS or EOI; */
-
-#endif /* JPEGSIZE_H */
-
diff --git a/gbtools/src/include/blatSrc/jsonParse.h b/gbtools/src/include/blatSrc/jsonParse.h
deleted file mode 100644
index e356ed9..0000000
--- a/gbtools/src/include/blatSrc/jsonParse.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* jsonParse - routines to parse JSON strings and traverse and pick things out of the
- * resulting object tree. */
-
-#ifndef JSONPARSE_H
-#define JSONPARSE_H
-
-/* JSON Element code let's you build up a DOM like data structure in memory and then serialize it into
-   html for communication with client side code.
- */
-
-// supported types
-
-typedef enum _jsonElementType
-{
-    jsonList     = 0,
-    jsonObject   = 1,
-    jsonNumber   = 2,
-    jsonDouble   = 3,
-    jsonBoolean  = 4,
-    jsonString   = 5
-} jsonElementType;
-
-union jsonElementVal
-{
-    struct slRef *jeList;
-    struct hash *jeHash;
-    long jeNumber;
-    double jeDouble;
-    boolean jeBoolean;
-    char *jeString;
-};
-
-struct jsonElement
-{
-    jsonElementType type;
-    union jsonElementVal val;
-};
-
-// constructors for each jsonElementType
-
-struct jsonElement *newJsonString(char *str);
-struct jsonElement *newJsonBoolean(boolean val);
-struct jsonElement *newJsonNumber(long val);
-struct jsonElement *newJsonDouble(double val);
-struct jsonElement *newJsonObject(struct hash *h);
-struct jsonElement *newJsonList(struct slRef *list);
-
-void jsonObjectAdd(struct jsonElement *h, char *name, struct jsonElement *ele);
-// Add a new element to a jsonObject; existing values are replaced.
-
-void jsonListAdd(struct jsonElement *list, struct jsonElement *ele);
-// Add a new element to a jsonList
-
-struct jsonElement *jsonParse(char *str);
-// parse string into an in-memory json representation
-
-char *jsonStringEscape(char *inString);
-/* backslash escape a string for use in a double quoted json string.
- * More conservative than javaScriptLiteralEncode because
- * some json parsers complain if you escape & or ' */
-
-void jsonFindNameRecurse(struct jsonElement *ele, char *jName, struct slName **pList);
-// Search the JSON tree recursively to find all the values associated to
-// the name, and add them to head of the list.  
-
-struct slName *jsonFindName(struct jsonElement *json, char *jName);
-// Search the JSON tree to find all the values associated to the name
-// and add them to head of the list. 
-
-struct slName *jsonFindNameUniq(struct jsonElement *json, char *jName);
-// Search the JSON tree to find all the values associated to the name
-// and add them to head of the list. 
-
-void jsonElementRecurse(struct jsonElement *ele, char *name, boolean isLast,
-    void (*startCallback)(struct jsonElement *ele, char *name, boolean isLast, void *context),  
-    // Called at element start
-    void (*endCallback)(struct jsonElement *ele, char *name, boolean isLast, void *context),    
-    // Called at element end
-    void *context);
-/* Recurse through JSON tree calling callback functions with element and context.
- * Either startCallback or endCallback may be NULL, as can be name. */
-
-void jsonPrintOneStart(struct jsonElement *ele, char *name, boolean isLast, int indent, FILE *f);
-/* Print the start of one json element - just name and maybe an opening brace or bracket.
- * Recursion is handled elsewhere. */
-
-void jsonPrintOneEnd(struct jsonElement *ele, char *name, boolean isLast, boolean indent, FILE *f);
-/* Print object end */
-
-void jsonPrintToFile(struct jsonElement *root, char *name, FILE *f, int indentPer);
-/* Print out JSON object and all children nicely indented to f as JSON objects. 
- * Name may be NULL.  Implemented via jsonPrintOneStart/jsonPrintOneEnd. */
-
-/** Routines that check json type and return corresponding value. **/
-
-struct slRef *jsonListVal(struct jsonElement *ele, char *name);
-/* Enforce element is type jsonList.  Return list value */
-
-struct hash *jsonObjectVal(struct jsonElement *ele, char *name);
-/* Enforce object is type jsonObject.  Return object hash */
-
-long jsonNumberVal(struct jsonElement *ele, char *name);
-/* Enforce element is type jsonNumber and return value. */
-
-double jsonDoubleVal(struct jsonElement *ele, char *name);
-/* Enforce element is type jsonDouble and return value. */
-
-boolean jsonBooleanVal(struct jsonElement *ele, char *name);
-/* Enforce element is type jsonBoolean and return value. */
-
-char *jsonStringVal(struct jsonElement *ele, char *eleName);
-/* Enforce element is type jsonString and return value. */
-
-/** Routines that help work with json objects (bracket enclosed key/val pairs **/
-
-struct jsonElement *jsonFindNamedField(struct jsonElement *object, 
-    char *objectName, char *field);
-/* Find named field of object or return NULL if not found.  Abort if object
- * is not actually an object. */
-
-struct jsonElement *jsonMustFindNamedField(struct jsonElement *object, 
-    char *objectName, char *field);
-/* Find named field of object or die trying. */
-
-char *jsonOptionalStringField(struct jsonElement *object, char *field, char *defaultVal);
-/* Return string valued field of object, or defaultVal if it doesn't exist. */
-
-char *jsonStringField(struct jsonElement *object, char *field);
-/* Return string valued field of object or abort if field doesn't exist. */
-
-#endif /* JSONPARSE_H */
diff --git a/gbtools/src/include/blatSrc/jsonWrite.h b/gbtools/src/include/blatSrc/jsonWrite.h
deleted file mode 100644
index 2a888ec..0000000
--- a/gbtools/src/include/blatSrc/jsonWrite.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* jsonWrite - Helper routines for writing out JSON. */
-
-#ifndef JSONWRITE_H
-#define JSONWRITE_H
-
-struct jsonWrite
-/* Object to help output JSON */
-     {
-     struct jsonWrite *next;
-     struct dyString *dy;	/* Most of this module is building json text in here */
-     bool objStack[128];	/* We need stack deep enough to handle nested objects and lists */
-     int stackIx;		/* Current index in stack */
-     };
-
-struct jsonWrite *jsonWriteNew();
-/* Return new empty jsonWrite struct. */
-
-void jsonWriteFree(struct jsonWrite **pJw);
-/* Free up a jsonWrite object. */
-
-void jsonWriteTag(struct jsonWrite *jw, char *var);
-/* Print out quoted tag followed by colon. Print out preceding comma if need be.  */
-
-void jsonWriteEndLine(struct jsonWrite *jw);
-/* Write comma if in middle, and then newline regardless. */
-
-void jsonWriteString(struct jsonWrite *jw, char *var, char *string);
-/* Print out "var": "val".  If var is NULL then just print out "val" */
-
-void jsonWriteDateFromUnix(struct jsonWrite *jw, char *var, long long unixTimeVal);
-/* Add "var": YYYY-MM-DDT-HH:MM:SSZ given a Unix time stamp. Var may be NULL. */
-
-void jsonWriteNumber(struct jsonWrite *jw, char *var, long long val);
-/* print out "var": val as number. Var may be NULL. */
-
-void jsonWriteLink(struct jsonWrite *jw, char *var, char *objRoot, char *name);
-/* Print out the jsony type link to another object.  objRoot will start and end with a '/'
- * and may have additional slashes in this usage. Var may be NULL. */
-
-void jsonWriteLinkNum(struct jsonWrite *jw, char *var, char *objRoot, long long id);
-/* Print out the jsony type link to another object with a numerical id.  objRoot will start 
- * and end with a '/' and may have additional slashes in this usage. Var may be NULL */
-
-void jsonWriteListStart(struct jsonWrite *jw, char *var);
-/* Start an array in JSON. Var may be NULL */
-
-void jsonWriteListEnd(struct jsonWrite *jw);
-/* End an array in JSON */
-
-void jsonWriteObjectStart(struct jsonWrite *dy);
-/* Print start of object */
-
-void jsonWriteObjectEnd(struct jsonWrite *jw);
-/* End object in JSON */
-
-#endif /* JSONWRITE_H */
diff --git a/gbtools/src/include/blatSrc/keys.h b/gbtools/src/include/blatSrc/keys.h
deleted file mode 100644
index d12f45d..0000000
--- a/gbtools/src/include/blatSrc/keys.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* keys.h - Stuff to manage a little key/value table and
- * evaluate expressions on it. */
-#ifndef KEYS_H
-#define KEYS_H
-
-struct keyVal
-/* A key/value pair of strings. */
-    {
-    char *key;
-    char *val;
-    };
-
-struct kvt *newKvt(int size);
-/* Get a new key value table. */
-
-void freeKvt(struct kvt **pKvt);
-/* Free up key value table. */
-
-void kvtClear(struct kvt *kvt);
-/* Clear the keys table. */
-
-struct keyVal *kvtAdd(struct kvt *kvt, char *key, char *val);
-/* Add in new key. */
-
-struct keyVal* kvtGet(struct kvt *kvt, char *key);
-/* get the keyVal for the specified key, of NULL if not found. */
-
-char *kvtLookup(struct kvt *kvt, char *key);
-/* Search table for key.  Return key value, or NULL if
- * key not found. */
-
-void kvtWriteAll(struct kvt *kvt, FILE *f, struct slName *hideList);
-/* Write all keys to file except the ones in hideList */
-
-void kvtParseAdd(struct kvt *kvt, char *text);
-/* Add in keys from text.  Text is in format:
- *     key val
- * for each line of text. Text gets many of it's
- * space characters and newlines replaced by 0's
- * and should persist until call to keysClear(). */
-
-struct keyExp
-/* A handle on a parsed expression which can be
- * quickly evaluated.  */
-    {
-    void *rootExp;       /* Internally struct exp. */
-    void *tokenList;     /* Internally struct tok. */
-    };
-
-boolean keyExpEval(struct keyExp *exp, struct kvt *kvt);
-/* Recursively evaluate expression. */
-
-struct keyExp *keyExpParse(char *text);
-/* Parse text into key expression.  Squawk and die if it
- * fails. */
-
-boolean keyTextScan(char *text, char *key, char *valBuf, int valBufSize);
-/* Get value of key in text. Return FALSE if key doesn't exist. */
-
-#endif /* KEYS_H */
-
diff --git a/gbtools/src/include/blatSrc/knetUdc.h b/gbtools/src/include/blatSrc/knetUdc.h
deleted file mode 100644
index f2af578..0000000
--- a/gbtools/src/include/blatSrc/knetUdc.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* knetUdc -- install udc i/o functions in knetfile interface in Heng Li's samtools lib. */
-/* As of 2/23/10, the KNETFILE_HOOKS extension is a UCSC-local modification of samtools. */
-
-#ifndef KNETUDC_H
-#define KNETUDC_H
-
-void knetUdcInstall();
-/* install udc i/o functions in knetfile interface in Heng Li's samtools lib. */
-
-#endif//ndef KNETUDC_H
diff --git a/gbtools/src/include/blatSrc/kxTok.h b/gbtools/src/include/blatSrc/kxTok.h
deleted file mode 100644
index 717b5bb..0000000
--- a/gbtools/src/include/blatSrc/kxTok.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* kxTok - quick little tokenizer for stuff first
- * loaded into memory.  Originally developed for
- * "Key eXpression" evaluator. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef KXTOK_H
-#define KXTOK_H
-
-enum kxTokType
-    {
-    kxtEnd,
-    kxtString,
-    kxtWildString,
-    kxtEquals,
-    kxtGT,      /* Greater Than */
-    kxtGE,      /* Greater Than or Equal */
-    kxtLT,      /* Less Than */
-    kxtLE,      /* Less Than or Equal */
-    kxtAnd,
-    kxtOr,
-    kxtXor,
-    kxtNot,
-    kxtOpenParen,
-    kxtCloseParen,
-    kxtAdd,
-    kxtSub,
-    kxtDiv,
-    kxtMul,
-    kxtDot,
-    kxtMod,
-    kxtPunct,
-    };
-
-struct kxTok
-/* A key expression token.   Input text is tokenized
- * into a list of these. */
-    {
-    struct kxTok *next;
-    enum kxTokType type;
-    bool spaceBefore;	/* True if there is a space before */
-    char string[1];  /* Allocated at run time */
-    };
-
-struct kxTok *kxTokenize(char *text, boolean wildAst);
-/* Convert text to stream of tokens. If 'wildAst' is
- * TRUE then '*' character will be treated as wildcard
- * rather than multiplication sign. */
-
-struct kxTok *kxTokenizeFancy(char *text, boolean wildAst,
-			      boolean wildPercent, boolean includeHyphen);
-/* Convert text to stream of tokens. If 'wildAst' is
- * TRUE then '*' character will be treated as wildcard
- * rather than multiplication sign.  
- * If wildPercent is TRUE then the '%' character will be treated as a 
- * wildcard (as in SQL) rather than a modulo (kxtMod) or percent sign.
- * If includeHyphen is TRUE then a '-' character in the middle of a String 
- * token will be treated as a hyphen (part of the String token) instead of 
- * a new kxtSub token. */
-
-void kxTokIncludeQuotes(boolean val);
-/* Pass in TRUE if kxTok should include quote characters in string tokens. */
-
-#endif /* KXTOK_K */
diff --git a/gbtools/src/include/blatSrc/linefile.h b/gbtools/src/include/blatSrc/linefile.h
deleted file mode 100644
index 5eb5df1..0000000
--- a/gbtools/src/include/blatSrc/linefile.h
+++ /dev/null
@@ -1,296 +0,0 @@
-/* lineFile - stuff to rapidly read text files and parse them into
- * lines.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef LINEFILE_H
-#define LINEFILE_H
-
-#include "dystring.h"
-#include "udc.h"
-
-#ifdef USE_TABIX
-#include "tabix.h"
-#endif
-
-#define LF_BOGUS_FILE_PREFIX "somefile."
-
-enum nlType {
- nlt_undet, /* undetermined */
- nlt_unix,  /* lf   */
- nlt_dos,   /* crlf */
- nlt_mac    /* cr   */
-};
-
-struct metaOutput
-/* struct to store list of file handles to output meta data to
- * meta data is text after # */
-    {
-    struct metaOutput *next;    /* next file handle */
-    FILE *metaFile;             /* file to write metadata to */
-    };
-
-struct lineFile
-/* Structure to handle fast, line oriented
- * fileIo. */
-    {
-    struct lineFile *next;	/* Might need to be on a list. */
-    char *fileName;		/* Name of file. */
-    int fd;			/* File handle.  -1 for 'memory' files. */
-    int bufSize;		/* Size of buffer. */
-    off_t bufOffsetInFile;	/* Offset in file of first buffer byte. */
-    int bytesInBuf;		/* Bytes read into buffer. */
-    int reserved;		/* Reserved (zero for now). */
-    int lineIx;			/* Current line. */
-    int lineStart;		/* Offset of line in buffer. */
-    int lineEnd;		/* End of line in buffer. */
-    bool zTerm;			/* Replace '\n' with zero? */
-    enum nlType nlType;         /* type of line endings: dos, unix, mac or undet */
-    bool reuse;			/* Set if reusing input. */
-    char *buf;			/* Buffer. */
-    struct pipeline *pl;        /* pipeline if reading compressed */
-    struct metaOutput *metaOutput;   /* list of FILE handles to write metaData to */
-    bool isMetaUnique;          /* if set, do not repeat comments in output */
-    struct hash *metaLines;     /* save lines to suppress repetition */
-#ifdef USE_TABIX
-    tabix_t *tabix;		/* A tabix-compressed file and its binary index file (.tbi) */
-    ti_iter_t tabixIter;	/* An iterator to get decompressed indexed lines of text */
-#endif
-    struct udcFile *udcFile;    /* udc file if using caching */
-    struct dyString *fullLine;  // Filled with full line when a lineFileNextFull is called
-    struct dyString *rawLines;  // Filled with raw lines used to create the full line
-    boolean fullLineReuse;      // If TRUE, next call to lineFileNextFull will get
-                                // already built fullLine
-    void *dataForCallBack;                                 // ptr to data needed for callbacks
-    void(*checkSupport)(struct lineFile *lf, char *where); // check if operation supported 
-    boolean(*nextCallBack)(struct lineFile *lf, char **retStart, int *retSize); // next line callback
-    void(*closeCallBack)(struct lineFile *lf);             // close callback
-    };
-
-char *getFileNameFromHdrSig(char *m);
-/* Check if header has signature of supported compression stream,
-   and return a phoney filename for it, or NULL if no sig found. */
-
-struct lineFile *lineFileDecompressFd(char *name, bool zTerm, int fd);
-/* open a linefile with decompression from a file or socket descriptor */
-
-struct lineFile *lineFileDecompressMem(bool zTerm, char *mem, long size);
-/* open a linefile with decompression from a memory stream */
-
-struct lineFile *lineFileMayOpen(char *fileName, bool zTerm);
-/* Try and open up a lineFile. If fileName ends in .gz, .Z, or .bz2,
- * it will be read from a decompress pipeline. */
-
-struct lineFile *lineFileUdcMayOpen(char *fileName, bool zTerm);
-/* Open a lineFile through the UDC */
-
-struct lineFile *lineFileOpen(char *fileName, bool zTerm);
-/* Open up a lineFile or die trying If fileName ends in .gz, .Z, or .bz2,
- * it will be read from a decompress pipeline.. */
-
-struct lineFile *lineFileAttach(char *fileName, bool zTerm, int fd);
-/* Wrap a line file around an open'd file. */
-
-struct lineFile *lineFileStdin(bool zTerm);
-/* Wrap a line file around stdin. */
-
-struct lineFile *lineFileOnString(char *name, bool zTerm, char *s);
-/* Wrap a line file object around string in memory. This buffer
- * have zeroes written into it if zTerm is non-zero.  It will
- * be freed when the line file is closed. */
-
-struct lineFile *lineFileOnBigBed(char *bigBedFileName);
-/* Wrap a line file object around a BigBed. */
-
-void lineFileClose(struct lineFile **pLf);
-/* Close up a line file. */
-
-void lineFileCloseList(struct lineFile **pList);
-/* Close up a list of line files. */
-
-boolean lineFileNext(struct lineFile *lf, char **retStart, int *retSize);
-/* Fetch next line from file. */
-
-boolean lineFileNextFull(struct lineFile *lf, char **retFull, int *retFullSize,
-                        char **retRaw, int *retRawSize);
-// Fetch next line from file joining up any that are continued by ending '\'
-// If requested, and was joined, the unjoined raw lines are also returned
-// NOTE: comment lines can't be continued!  ("# comment \ \n more comment" is 2 lines.)
-
-boolean lineFileNextReal(struct lineFile *lf, char **retStart);
-/* Fetch next line from file that is not blank and
- * does not start with a '#'. */
-
-boolean lineFileNextFullReal(struct lineFile *lf, char **retStart);
-// Fetch next line from file that is not blank and does not start with a '#'.
-// Continuation lines (ending in '\') are joined into a single line.
-
-void lineFileNeedNext(struct lineFile *lf, char **retStart, int *retSize);
-/* Fetch next line from file.  Squawk and die if it's not there. */
-
-void lineFileReuse(struct lineFile *lf);
-/* Reuse current line. */
-
-void lineFileReuseFull(struct lineFile *lf);
-// Reuse last full line read.  Unlike lineFileReuse,
-// lineFileReuseFull only works with previous lineFileNextFull call
-
-#define lineFileString(lf) ((lf)->buf + (lf)->lineStart)
-/* Current string in line file. */
-
-#define lineFileTell(lf) ((lf)->bufOffsetInFile + (lf)->lineStart)
-/* Current offset (of string start) in file. */
-
-void lineFileSeek(struct lineFile *lf, off_t offset, int whence);
-/* Seek to read next line from given position. */
-
-void lineFileRewind(struct lineFile *lf);
-/* Return lineFile to start. */
-
-void lineFileAbort(struct lineFile *lf, char *format, ...)
-/* Print file name, line number, and error message, and abort. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 2, 3)))
-#endif
-;
-
-void lineFileVaAbort(struct lineFile *lf, char *format, va_list args);
-/* Print file name, line number, and error message, and abort. */
-
-void lineFileUnexpectedEnd(struct lineFile *lf);
-/* Complain about unexpected end of file. */
-
-void lineFileExpectWords(struct lineFile *lf, int expecting, int got);
-/* Check line has right number of words. */
-
-void lineFileExpectAtLeast(struct lineFile *lf, int expecting, int got);
-/* Check line has right number of words. */
-
-void lineFileShort(struct lineFile *lf);
-/* Complain that line is too short. */
-
-boolean lineFileNextRow(struct lineFile *lf, char *words[], int wordCount);
-/* Return next non-blank line that doesn't start with '#' chopped into words.
- * Returns FALSE at EOF.  Aborts on error. */
-
-#define lineFileRow(lf, words) lineFileNextRow(lf, words, ArraySize(words))
-/* Read in line chopped into fixed size word array. */
-
-boolean lineFileNextCharRow(struct lineFile *lf, char sep, char *words[], int wordCount);
-/* Return next non-blank line that doesn't start with '#' chopped into words
- * delimited by sep. Returns FALSE at EOF.  Aborts on error. */
-
-boolean lineFileNextRowTab(struct lineFile *lf, char *words[], int wordCount);
-/* Return next non-blank line that doesn't start with '#' chopped into words
- * at tabs. Returns FALSE at EOF.  Aborts on error. */
-
-#define lineFileRowTab(lf, words) \
-	lineFileNextRowTab(lf, words, ArraySize(words))
-/* Read in line chopped by tab into fixed size word array. */
-
-int lineFileChopNext(struct lineFile *lf, char *words[], int maxWords);
-/* Return next non-blank line that doesn't start with '#' chopped into words. */
-
-#define lineFileChop(lf, words) lineFileChopNext(lf, words, ArraySize(words))
-/* Ease-of-usef macro for lineFileChopNext above. */
-
-int lineFileChopCharNext(struct lineFile *lf, char sep, char *words[], int maxWords);
-/* Return next non-blank line that doesn't start with '#' chopped into
-   words delimited by sep. */
-
-int lineFileChopNextTab(struct lineFile *lf, char *words[], int maxWords);
-/* Return next non-blank line that doesn't start with '#' chopped into words
- * on tabs */
-
-#define lineFileChopTab(lf, words) lineFileChopNextTab(lf, words, ArraySize(words))
-/* Ease-of-usef macro for lineFileChopNext above. */
-
-int lineFileCheckAllIntsNoAbort(char *s, void *val, 
-    boolean isSigned, int byteCount, char *typeString, boolean noNeg, 
-    char *errMsg, int errMsgSize);
-/* Convert string to (signed) integer of the size specified.  
- * Unlike atol assumes all of string is number, no trailing trash allowed.
- * Returns 0 if conversion possible, and value is returned in 'val'
- * Otherwise 1 for empty string or trailing chars, and 2 for numeric overflow,
- * and 3 for (-) sign in unsigned number.
- * Error messages if any are written into the provided buffer.
- * Pass NULL val if you only want validation.
- * Use noNeg if negative values are not allowed despite the type being signed,
- * returns 4. */
-
-void lineFileAllInts(struct lineFile *lf, char *words[], int wordIx, void *val,
-  boolean isSigned,  int byteCount, char *typeString, boolean noNeg);
-/* Returns long long integer from converting the input string. Aborts on error. */
-
-int lineFileAllIntsArray(struct lineFile *lf, char *words[], int wordIx, void *array, int arraySize,
-  boolean isSigned,  int byteCount, char *typeString, boolean noNeg);
-/* Convert comma separated list of numbers to an array.  Pass in
- * array and max size of array. Aborts on error. Returns number of elements in parsed array. */
-
-int lineFileNeedNum(struct lineFile *lf, char *words[], int wordIx);
-/* Make sure that words[wordIx] is an ascii integer, and return
- * binary representation of it. */
-
-int lineFileNeedFullNum(struct lineFile *lf, char *words[], int wordIx);
-/* Make sure that words[wordIx] is an ascii integer, and return
- * binary representation of it. Require all chars in word to be digits.*/
-
-double lineFileNeedDouble(struct lineFile *lf, char *words[], int wordIx);
-/* Make sure that words[wordIx] is an ascii double value, and return
- * binary representation of it. */
-
-void lineFileSkip(struct lineFile *lf, int lineCount);
-/* Skip a number of lines. */
-
-char *lineFileSkipToLineStartingWith(struct lineFile *lf, char *start, int maxCount);
-/* Skip to next line that starts with given string.  Return NULL
- * if no such line found, otherwise return the line. */
-
-char *lineFileReadAll(struct lineFile *lf);
-/* Read remainder of lineFile and return it as a string. */
-
-boolean lineFileParseHttpHeader(struct lineFile *lf, char **hdr,
-				boolean *chunked, int *contentLength);
-/* Extract HTTP response header from lf into hdr, tell if it's
- * "Transfer-Encoding: chunked" or if it has a contentLength. */
-
-struct dyString *lineFileSlurpHttpBody(struct lineFile *lf,
-				       boolean chunked, int contentLength);
-/* Return a dyString that contains the http response body in lf.  Handle
- * chunk-encoding and content-length. */
-
-void lineFileSetMetaDataOutput(struct lineFile *lf, FILE *f);
-/* set file to write meta data to,
- * should be called before reading from input file */
-
-void lineFileSetUniqueMetaData(struct lineFile *lf);
-/* suppress duplicate lines in metadata */
-
-void lineFileExpandBuf(struct lineFile *lf, int newSize);
-/* Expand line file buffer. */
-
-void lineFileRemoveInitialCustomTrackLines(struct lineFile *lf);
-/* remove initial browser and track lines */
-
-/*----- Optionally-compiled wrapper on tabix (compression + indexing): -----*/
-
-#define COMPILE_WITH_TABIX "%s: Sorry, this functionality is available only when\n" \
-    "you have installed the tabix library from\n" \
-     "http://samtools.sourceforge.net/ and rebuilt kent/src with USE_TABIX=1\n" \
-     "(see http://genomewiki.ucsc.edu/index.php/Build_Environment_Variables)."
-
-struct lineFile *lineFileTabixMayOpen(char *fileOrUrl, bool zTerm);
-/* Wrap a line file around a data file that has been compressed and indexed
- * by the tabix command line program.  The index file <fileName>.tbi must be
- * readable in addition to fileName. If there's a problem, warn & return NULL.
- * This works only if kent/src has been compiled with USE_TABIX=1 and linked
- * with the tabix C library. */
-
-boolean lineFileSetTabixRegion(struct lineFile *lf, char *seqName, int start, int end);
-/* Assuming lf was created by lineFileTabixMayOpen, tell tabix to seek to the specified region
- * and return TRUE (or if there are no items in region, return FALSE). */
-
-#endif /* LINEFILE_H */
-
-
diff --git a/gbtools/src/include/blatSrc/localEnvironment.mk b/gbtools/src/include/blatSrc/localEnvironment.mk
deleted file mode 100644
index e69de29..0000000
diff --git a/gbtools/src/include/blatSrc/localmem.h b/gbtools/src/include/blatSrc/localmem.h
deleted file mode 100644
index 3a58581..0000000
--- a/gbtools/src/include/blatSrc/localmem.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* LocalMem.h - local memory routines. 
- * 
- * These routines are meant for the sort of scenario where
- * a lot of little to medium size pieces of memory are
- * allocated, and then disposed of all at once.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef LOCALMEM_H
-#define LOCALMEM_H
-
-struct lm *lmInit(int blockSize);
-/* Create a local memory pool. Parameters are:
- *      blockSize - how much system memory to allocate at a time.  Can
- *                  pass in zero and a reasonable default will be used.
- */
-
-void lmCleanup(struct lm **pLm);
-/* Clean up a local memory pool. */
-
-size_t lmAvailable(struct lm *lm);
-// Returns currently available memory in pool
-
-size_t lmSize(struct lm *lm);
-// Returns current size of pool, even for memory already allocated
-
-void *lmAlloc(struct lm *lm, size_t size);
-/* Allocate memory from local pool. */
-
-void *lmAllocMoreMem(struct lm *lm, void *pt, size_t oldSize, size_t newSize);
-/* Adjust memory size on a block, possibly relocating it.  If block is grown,
- * new memory is zeroed. NOTE: in RARE cases, same pointer may be returned. */
-
-void *lmCloneMem(struct lm *lm, void *pt, size_t size);
-/* Return a local mem copy of memory block. */
-
-
-char *lmCloneStringZ(struct lm *lm, char *string, int size);
-/* Return local mem copy of string of given size, adding null terminator. */
-
-char *lmCloneString(struct lm *lm, char *string);
-/* Return local mem copy of string. */
-
-char *lmCloneFirstWord(struct lm *lm, char *line);
-/* Clone first word in line */
-
-char *lmCloneSomeWord(struct lm *lm, char *line, int wordIx);
-/* Return a clone of the given space-delimited word within line.  Returns NULL if
- * not that many words in line. */
-
-struct slName *lmSlName(struct lm *lm, char *name);
-/* Return slName in memory. */
-
-#define lmAllocVar(lm, pt) (pt = lmAlloc(lm, sizeof(*pt)));
-/* Shortcut to allocating a single variable in local mem and
- * assigning pointer to it. */
-
-#define lmCloneVar(lm, pt) lmCloneMem(lm, pt, sizeof((pt)[0]))
-/* Allocate copy of a structure. */
-
-#define lmAllocArray(lm, pt, size) (pt = lmAlloc(lm, sizeof(*pt) * (size)))
-/* Shortcut to allocating an array in local mem and
- * assigning pointer to it. */
-
-#endif//ndef LOCALMEM_H
diff --git a/gbtools/src/include/blatSrc/log.h b/gbtools/src/include/blatSrc/log.h
deleted file mode 100644
index 4c2474c..0000000
--- a/gbtools/src/include/blatSrc/log.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* log.h - logging for servers, can log to a file and/or syslog.  Compile with
- * -DNO_SYSLOG for systems without syslog. */
-
-#ifndef LOG_H
-#define LOG_H
-
-void logOpenSyslog(char* program, char *facility);
-/* Initialize syslog using the specified facility.  Facility is the syslog
- * facility as specified in syslog.conf.  If facility is NULL, local0 is used.
- * This adds a warn and errAbort handlers that do logging.  If custom handlers
- * are added, they should call logErrorVa().
- */
-
-void logOpenFile(char* program, char *logFile);
-/* Initialize logging to the specified file.  Append to the file if it exists.
- * This adds a warn and errAbort handlers that do logging.  If custom handlers
- * are added, they should call logErrorVa(). 
- */
-
-void logSetMinPriority(char *minPriority);
-/* set minimum priority to log, which is one of the syslog priority names,
- * even when logging to a file */
-
-FILE *logGetFile();
-/* Returns the log FILE object if file logging is enabled, or NULL if it
- * isn't. This is useful for logging debugging data that doesn't fit the log
- * message paradigm, For example, logging fasta records. */
-
-void logErrorVa(char *format, va_list args);
-/* Variable args logError. */
-
-void logError(char *format, ...)
-/* Log an error message. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-void logWarnVa(char *format, va_list args);
-/* Variable args logWarn. */
-
-void logWarn(char *format, ...)
-/* Log a warn message. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-void logInfoVa(char *format, va_list args);
-/* Variable args logInfo. */
-
-void logInfo(char *format, ...)
-/* Log an info message. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-void logDebugVa(char *format, va_list args);
-/* Variable args logDebug. */
-
-void logDebug(char *format, ...)
-/* Log a debug message. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 1, 2)))
-#endif
-;
-
-void logDaemonize(char *progName);
-/* daemonize server process: closing open file descriptors and
- * starting logging based on the -logFacility and -log command line options .
- * if -debug is supplied , don't fork. */
-
-#endif
diff --git a/gbtools/src/include/blatSrc/longToList.h b/gbtools/src/include/blatSrc/longToList.h
deleted file mode 100644
index 3c951c0..0000000
--- a/gbtools/src/include/blatSrc/longToList.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* longToList - this is a way of associating a generic list with a long key.
- * You can retrieve back the list given the key,  and add to lists associated with
- * any given tree. The list can be any sort of singly-linked object that starts with
- * a next field. 
- *
- * Under the hood this uses a balanced binary tree to handle the key/list
- * association. */
-
-#ifndef LONGLISTTREE_H
-
-struct longToList
-/* A long and a opaquely typed list */
-    {
-    struct longToList *next;  /* In case this list is part of a regular list */
-    struct rbTree *tree;    /* Self balancing tree with long val/list key */
-    struct lm *lm;	    /* Optimized memory allocation thing */
-    };
-
-struct llKeyList
-/* These are what inhabit a longToList->tree.  They are generally allocated out of a lm,
- * so don't look for a free routine. */
-    {
-    long key;	 /* Some sort of binary key value */
-    struct slRef *list;  /* Some sort of singly linked list */
-    };
-
-struct longToList *longToListNew();
-/* Return new empty longToList */
-
-void longToListFree(struct longToList **pLl);
-/* Free up memory associated with longToList. */
-
-struct llKeyList *longToListAdd(struct longToList *ll, long key, void *item);
-/* Add item to key-associated record in ll.  May make up new record if the
- * key has never been seen before.  If record already exists item will be prepended
- * to any existing items. Returns llKeyList associated with key, but most people just
- * ignore that. */
-
-struct llKeyList *longToListLookup(struct longToList *ll, long key);
-/* Given a key return llKeyList associated with it if any, may return NULL */
-
-struct slRef *longToListFindVal(struct longToList *ll, long key);
-/* Returns the list associated with this key, or NULL if key not in container. */
-
-struct slRef *longToListMustFindVal(struct longToList *ll, long key);
-/* Returns the list associated with this key. Aborts if key not found in container. */
-
-
-
-
-#endif /* LONGLISTTREE_H */
-
diff --git a/gbtools/src/include/blatSrc/maDbRep.h b/gbtools/src/include/blatSrc/maDbRep.h
deleted file mode 100644
index 77fce3d..0000000
--- a/gbtools/src/include/blatSrc/maDbRep.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-#ifndef MADBREP_H
-#define MADBREP_H
-
-/* maDbRep.h was originally generated by the autoSql program, which also 
- * generated maDbRep.c and maDbRep.sql.  This header links the database and the RAM 
- * representation of objects. */
-
-struct mrnaAli
-/* An mRNA/genomic alignment */
-    {
-    struct mrnaAli *next;  /* Next in singly linked list. */
-    unsigned id;	/* Unique ID */
-    signed char readDir;	/* Read direction of mRNA +1 or -1 */
-    signed char orientation;	/* Orientation relative to first BAC */
-    unsigned char hasIntrons;	/* True if alignment has introns */
-    unsigned char isEst;	/* True if an EST. */
-    int score;	/* Score in something like log-odds form */
-    char qAcc[13];	/* GenBank Accession for mRNA sequence */
-    unsigned qId;	/* Database ID of mRNA sequence */
-    unsigned qTotalSize;	/* Total bases (not just aligned) in mRNA */
-    unsigned qStart;	/* Start in mRNA sequence */
-    unsigned qEnd;	/* End in mRNA sequence */
-    unsigned tStartBac;	/* ID of first genomic BAC in alignment */
-    unsigned tStartPos;	/* Start position within first BAC */
-    unsigned tEndBac;	/* ID of last genomic BAC in alignment */
-    unsigned tEndPos;	/* End position within last BAC */
-    unsigned blockCount;	/* Number of aligned blocks */
-    unsigned *blockSizes;	/* Size of each block */
-    unsigned *qBlockStarts;	/* Start of each block in mRNA */
-    unsigned *tBlockBacs;	/* BAC each block starts in */
-    unsigned *tBlockStarts;	/* Position within BAC of each block start */
-    unsigned short *startGoods;	/* Number of perfect bases at start of block */
-    unsigned short *endGoods;	/* Number of perfect bases at end of block */
-    };
-
-struct mrnaAli *mrnaAliLoad(char **row);
-/* Load a mrnaAli from row fetched with select * from mrnaAli
- * from database.  Dispose of this with mrnaAliFree(). */
-
-void mrnaAliFree(struct mrnaAli **pEl);
-/* Free a single dynamically allocated mrnaAli such as created
- * with mrnaAliLoad(). */
-
-void mrnaAliFreeList(struct mrnaAli **pList);
-/* Free a list of dynamically allocated mrnaAli's */
-
-void mrnaAliOutput(struct mrnaAli *el, FILE *f, char sep, char lastSep);
-/* Print out mrnaAli.  Separate fields with sep. Follow last field with lastSep. */
-
-#define mrnaAliTabOut(el,f) mrnaAliOutput(el,f,'\t','\n');
-/* Print out mrnaAli as a line in a tab-separated file. */
-
-#define mrnaAliCommaOut(el,f) mrnaAliOutput(el,f,',',',');
-/* Print out mrnaAli as a comma separated list including final comma. */
-
-#endif /* MADBREP_H */
-
diff --git a/gbtools/src/include/blatSrc/maToFf.h b/gbtools/src/include/blatSrc/maToFf.h
deleted file mode 100644
index 18b8aa7..0000000
--- a/gbtools/src/include/blatSrc/maToFf.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-#ifndef MATOFF_H
-#define MATOFF_H
-
-/* Convert between mrnaAli and ffAli representations of an alignment. */
-
-struct mrnaAli *ffToMa(struct ffAli *ffLeft, 
-	struct dnaSeq *mrnaSeq, char *mrnaAcc,
-	struct dnaSeq *genoSeq, char *genoAcc, 
-	boolean isRc, boolean isEst);
-/* Convert ffAli structure to mrnaAli. */
-
-struct ffAli *maToFf(struct mrnaAli *ma, DNA *needle, DNA *haystack);
-/* Convert from database to internal representation of alignment. */
-
-#endif /* MATOFF_H */
-
diff --git a/gbtools/src/include/blatSrc/maf.h b/gbtools/src/include/blatSrc/maf.h
deleted file mode 100644
index 3e3f06b..0000000
--- a/gbtools/src/include/blatSrc/maf.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/* maf.h - Multiple alignment format.  */
-#ifndef MAF_H
-#define MAF_H
-
-#ifndef COMMON_H
-#include "common.h"
-#endif
-
-#ifndef AXT_H
-#include "axt.h"
-#endif
-
-struct mafFile
-/* A file full of multiple alignments. */
-    {
-    struct mafFile *next;
-    int version;	 /* Required */
-    char *scoring;	 /* Optional (may be NULL). Name of  scoring scheme. */
-    struct mafAli *alignments;	/* Possibly empty list of alignments. */
-    struct lineFile *lf; /* Open line file if any. NULL except while parsing. */
-    };
-
-void mafFileFree(struct mafFile **pObj);
-/* Free up a maf file including closing file handle if necessary. */
-
-void mafFileFreeList(struct mafFile **pList);
-/* Free up a list of maf files. */
-
-struct mafAli
-/* A multiple alignment. */
-    {
-    struct mafAli *next;
-    double score;        /* Score.  Meaning depends on mafFile.scoring.  0.0 if no scoring. */
-    struct mafComp *components;	/* List of components of alignment */
-    int textSize;         /* Size of text in each component. */
-    struct mafRegDef *regDef; /* source of region definitions (r line) */
-    };
-
-void mafAliFree(struct mafAli **pObj);
-/* Free up a maf alignment. */
-
-void mafAliFreeList(struct mafAli **pList);
-/* Free up a list of maf alignmentx. */
-
-/* the set of syntenic relationships that the previous and
- * following alignments have with the current one */
-#define	MAF_INVERSE_STATUS		'V'
-#define	MAF_INSERT_STATUS		'I'
-#define	MAF_CONTIG_STATUS		'C'
-#define	MAF_CONTIG_NESTED_STATUS	'c'
-#define	MAF_NEW_STATUS			'N'
-#define	MAF_NEW_NESTED_STATUS		'n'
-#define	MAF_MAYBE_NEW_STATUS		'S'
-#define	MAF_MAYBE_NEW_NESTED_STATUS	's'
-#define	MAF_MISSING_STATUS		'M'
-#define	MAF_TANDEM_STATUS		'T'
-
-struct mafComp
-/* A component of a multiple alignment. */
-    {
-    struct mafComp *next;
-    char *src;	 /* Name of sequence source.  */
-    int srcSize; /* Size of sequence source.  */
-    char strand; /* Strand of sequence.  Either + or -*/
-    int start;	 /* Start within sequence. Zero based. If strand is - is relative to src end. */
-    int size;	 /* Size in sequence (does not include dashes).  */
-    char *text;  /* The sequence including dashes. */
-    char *quality;  /* The quality data (same length as text, or NULL). */
-    char leftStatus; /* the syntenic status of the alignment before us vis a vis ourselves */
-    int leftLen;     /* length related information for the previous alignment for the species */
-    char rightStatus; /* the syntenic status of the alignment after us vis a vis ourselves */
-    int rightLen;     /* length related information for the following alignment for the species */
-    };
-
-void mafCompFree(struct mafComp **pObj);
-/* Free up a maf component. */
-
-void mafCompFreeList(struct mafComp **pList);
-/* Free up a list of maf components. */
-
-char *mafCompGetSrcDb(struct mafComp *mc, char *buf, int bufSize);
-/* parse the srcDb name from the mafComp src name, return NULL if no srcDb */
-
-char *mafCompGetSrcName(struct mafComp *mc);
-/* parse the src sequence name from the mafComp src name */
-
-struct mafRegDef
-/* MAF region definition (r line) */
-{
-    char *type;   // type of definition, one of constants below (not malloced)
-    int size;     // region size
-    char *id;     // identifiers
-};
-extern char *mafRegDefTxUpstream;  // transcription start size upstream region
-
-struct mafRegDef *mafRegDefNew(char *type, int size, char *id);
-/* construct a new mafRegDef object */
-
-void mafRegDefFree(struct mafRegDef **mrdPtr);
-/* Free a mafRegDef object */
-
-int mafPlusStart(struct mafComp *comp);
-/* Return start relative to plus strand of src. */
-
-struct mafFile *mafOpen(char *fileName);
-/* Open up a .maf file for reading.  Read header and
- * verify. Prepare for subsequent calls to mafNext().
- * Prints error message and aborts if there's a problem. */
-
-struct mafFile *mafMayOpen(char *fileName);
-/* Like mafOpen above, but returns NULL rather than aborting 
- * if file does not exist. */
-
-void mafRewind(struct mafFile *mf);
-/* Seek to beginning of open maf file */
-
-struct mafAli *mafNext(struct mafFile *mafFile);
-/* Return next alignment in file or NULL if at end. 
- * This will close the open file handle at end as well. */
-
-struct mafAli *mafNextWithPos(struct mafFile *mf, off_t *retOffset);
-/* Return next alignment in FILE or NULL if at end.  If retOffset is
- * non-NULL, return start offset of record in file. */
-
-struct mafFile *mafReadAll(char *fileName);
-/* Read in full maf file */
-
-void mafWriteStart(FILE *f, char *scoring);
-/* Write maf header and scoring scheme name (may be null) */
-
-void mafWrite(FILE *f, struct mafAli *maf);
-/* Write next alignment to file. */
-
-void mafWriteEnd(FILE *f);
-/* Write end tag of maf file. */
-
-void mafWriteAll(struct mafFile *mf, char *fileName);
-/* Write out full mafFile. */
-
-struct mafComp *mafMayFindComponent(struct mafAli *maf, char *src);
-/* Find component of given source. Return NULL if not found. */
-
-struct mafComp *mafMayFindComponentDb(struct mafAli *maf, char *db);
-/* Find component of given database or source. Return NULL if not found. */
-
-struct mafComp *mafFindComponent(struct mafAli *maf, char *src);
-/* Find component of given source or die trying. */
-
-struct mafComp *mafMayFindCompSpecies(struct mafAli *maf, char *species, char sepChar);
-/* Find component of given source that starts with species followed by sepChar or '\0'
-   Return NULL if not found. */
-
-struct mafComp *mafFindCompSpecies(struct mafAli *maf, char *species, char sepChar);
-/* Find component of given source that starts with species followed by sepChar or '\0'
-   or die trying. */
-
-struct mafComp *mafMayFindCompPrefix(struct mafAli *maf, char *pre, char *sep);
-/* Find component of given source that starts with pre followed by sep.
-   Return NULL if not found. */
-
-struct mafComp *mafFindCompPrefix(struct mafAli *maf, char *pre, char *sep);
-/* Find component of given source that starts with pre followed by sep
-   or die trying. */
-
-boolean mafMayFindAllComponents(struct mafAli *maf, struct hash *cHash);
-/* Check to see if all components in hash are in maf block.  Return FALSE if not found. */
-
-struct mafComp *mafMayFindComponentInHash(struct mafAli *maf, struct hash *cHash);
-/* Find arbitrary component of given source that matches any string in the cHash.
-   Return NULL if not found. */
-
-struct mafComp *mafMayFindSpeciesInHash(struct mafAli *maf, struct hash *cHash, char sepChar);
-/* Find arbitrary component of given who's source prefix (ended by sep)
-   matches matches any string in the cHash.  Return NULL if not found. */
-
-void mafMoveComponentToTop(struct mafAli *maf, char *componentSource);
-/* Move given component to head of component list. */
-
-struct mafAli *mafFromAxt(struct axt *pAxt, int tSize, 
-	char *tPrefix, int qSize, char *qPrefix);
-/* Make up a maf file from axt.  Slower than mafFromAxtTemp,
- * but the axt and maf are independent afterwards. */
-
-void mafFromAxtTemp(struct axt *axt, int tSize, int qSize,
-	struct mafAli *temp);
-/* Make a maf out of axt,  parasiting on the memory in axt.
- * Do *not* mafFree this temp.  The memory it has in pointers
- * is still owned by the axt.  Furthermore the next call to
- * this function will invalidate the previous temp value.
- * It's sort of a kludge, but quick to run and easy to implement. */
-
-struct mafAli *mafSubset(struct mafAli *maf, char *componentSource,
-	int newStart, int newEnd);
-/* see mafSubsetE below  (called with getInitialDases = FALSE */
-
-struct mafAli *mafSubsetE(struct mafAli *maf, char *componentSource,
-	int newStart, int newEnd, bool getInitialDashes);
-/* Extract subset of maf that intersects a given range
- * in a component sequence.  The newStart and newEnd
- * are given in the forward strand coordinates of the
- * component sequence.  The componentSource is typically
- * something like 'mm3.chr1'.  This will return NULL
- * if maf does not intersect range.  The score field
- * in the returned maf will not be filled in (since
- * we don't know which scoring scheme to use). 
- * If getInitialDashes is TRUE then the initial -'s
- * in the reference sequence are *not* removed*/
-
-boolean mafNeedSubset(struct mafAli *maf, char *componentSource,
-	int newStart, int newEnd);
-/* Return TRUE if maf only partially fits between newStart/newEnd
- * in given component. */
-
-double mafScoreMultiz(struct mafAli *maf);
-/* Return score of a maf (calculated rather than what is
- * stored in the structure. */
-
-double mafScoreRangeMultiz(struct mafAli *maf, int start, int size);
-/* Return score of a subset of an alignment.  Parameters are:
- *    maf - the alignment
- *    start - the (zero based) offset to start calculating score
- *    size - the size of the subset
- * The following relationship should hold:
- *   scoreRange(maf,start,size) =
- *	scoreRange(maf,0,start+size) - scoreRange(maf,0,start)
- */
-
-void mafScoreUseSimple();
-/* use a simple scoring system useful for finding mismatches */
-
-void mafScoreUseTraditional();
-/* use the tradition HOX scoring system */
-
-double mafScoreMultizMaxCol(int species);
-/* Return maximum possible score for a column. */
-
-void mafColMinMaxScore(struct mafAli *maf, 
-	double *retMin, double *retMax);
-/* Get min/max maf scores for a column. */
-
-void mafFlipStrand(struct mafAli *maf);
-/* Reverse complement maf. */
-
-void mafSrcDb(char *name, char *retDb, int retDbSize);
-/* Parse out just database part of name (up to but not including
- * first dot). If dot found, return entire name */
-
-boolean mafColumnEmpty(struct mafAli *maf, int col);
-/* Return TRUE if the column is all '-' or '.' */
-
-void mafStripEmptyColumns(struct mafAli *maf);
-/* Remove columns that are all '-' or '.' from  maf. */
-
-boolean isContigOrTandem(char status);
-/* is status MAF_CONTIG_STATUS or MAF_TANDEM_STATUS */
-
-struct mafComp *mafCompClone(struct mafComp *srcComp);
-/* clone a mafComp */
-
-struct mafAli *mafAliClone(struct mafAli *srcAli);
-/* clone a mafAli */
-
-#endif /* MAF_H */
-
diff --git a/gbtools/src/include/blatSrc/mailViaPipe.h b/gbtools/src/include/blatSrc/mailViaPipe.h
deleted file mode 100644
index ec33990..0000000
--- a/gbtools/src/include/blatSrc/mailViaPipe.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* mailViaPipe - sendmail via pipeline.  */
-#ifndef MAILVIAPIPE_H
-#define MAILVIAPIPE_H
-
-int mailViaPipe(char *toAddress, char *theSubject, char *theBody, char *fromAddress);
-/* sendmail via pipeline */
-
-#endif
diff --git a/gbtools/src/include/blatSrc/md5.h b/gbtools/src/include/blatSrc/md5.h
deleted file mode 100644
index e8f1215..0000000
--- a/gbtools/src/include/blatSrc/md5.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* md5 calculating functions and the like.  Just wrappers for md5sum program */
-
-#ifndef MD5_H
-#define MD5_H
-
-char *md5HexForFile(char * fileName);
-/* Calculate md5 on file and return in hex format.  Use freeMem on result when done. */
-
-char *md5HexForBuf(char *buf, size_t bufSize);
-/* Return md5 sum of buffer. Use freeMem on result when done. */
-
-char *md5HexForString(char *string);
-/* Return md5 sum of zero-terminated string. Use freeMem on result when done. */
-
-void md5ForFile(char * fileName, unsigned char md5[16]);
-/* Return MD5 sum for file in md5 in binary rather than hex format. */
-
-void md5HexToMd5(char hexIn[32], unsigned char md5Out[16]);
-/* Convert hexadecimal representation of md5 back to binary */
-
-char *md5ToHex(unsigned char md5[16]);
-/* Convert binary representation of md5 to hex string. Do a freeMem on result when done. */
-
-void md5HexToMd5(char hexIn[32], unsigned char md5Out[16]);
-/* Convert hexadecimal representation of md5 back to binary */
-
-struct hash *md5FileHash(char *fileName);
-/* Read md5sum file and return a hash keyed by file names with md5sum values. */
-
-#endif /* MD5_H */
-
-
diff --git a/gbtools/src/include/blatSrc/memalloc.h b/gbtools/src/include/blatSrc/memalloc.h
deleted file mode 100644
index eaa0799..0000000
--- a/gbtools/src/include/blatSrc/memalloc.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Let the user redirect where memory allocation/deallocation
- * happens.  'careful' routines help debug scrambled heaps. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef MEMALLOC_H
-#define MEMALLOC_H
-
-struct memHandler
-    {
-    struct memHandler *next;
-    void * (*alloc)(size_t size);
-    void (*free)(void *vpt);
-    void * (*realloc)(void* vpt, size_t size);
-    };
-
-struct memHandler *pushMemHandler(struct memHandler *newHandler);
-/* Use newHandler for memory requests until matching popMemHandler.
- * Returns previous top of memory handler stack. */
-
-struct memHandler *popMemHandler();
-/* Removes top element from memHandler stack and returns it. */
-
-void setDefaultMemHandler();
-/* Sets memHandler to the default. */
-
-void pushCarefulMemHandler(size_t maxAlloc);
-/* Push the careful (paranoid, conservative, checks everything)
- * memory handler  top of the memHandler stack and use it. */
-
-void carefulCheckHeap();
-/* Walk through allocated memory and make sure that all cookies are
- * in place. Only walks through what's been done since 
- * pushCarefulMemHandler(). */
-
-int carefulCountBlocksAllocated();
-/* How many memory items are allocated? (Since called
- * pushCarefulMemHandler(). */
-
-size_t carefulTotalAllocated();
-/* Return total bases allocated */
-
-void setMaxAlloc(size_t s);
-/* Set large allocation limit. */
-
-void memTrackerStart();
-/* Push memory handler that will track blocks allocated so that
- * they can be automatically released with memTrackerEnd().  */
-
-void memTrackerEnd();
-/* Free any remaining blocks and pop tracker memory handler. */
-
-#endif /* MEMALLOC_H */
-
diff --git a/gbtools/src/include/blatSrc/memgfx.h b/gbtools/src/include/blatSrc/memgfx.h
deleted file mode 100644
index 1eb7b6e..0000000
--- a/gbtools/src/include/blatSrc/memgfx.h
+++ /dev/null
@@ -1,398 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* Memgfx - stuff to do graphics in memory buffers.
- * Typically will just write these out as .gif or .png files.
- * This stuff is byte-a-pixel for simplicity.
- * It can do 256 colors.
- */
-#ifndef MEMGFX_H
-#define MEMGFX_H
-
-#ifndef GFXPOLY_H
-#include "gfxPoly.h"
-#endif
-
-#ifdef COLOR32
-typedef unsigned int Color;
-
-// BIGENDIAN machines:
-
-#if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(sparc) || defined(__ppc__) || defined(__s390__) || defined(__s390x__)
-
-#define MEMGFX_BIGENDIAN	1
-#define MG_WHITE   0xffffffff
-#define MG_BLACK   0x000000ff
-#define MG_RED     0xff0000ff
-#define MG_GREEN   0x00ff00ff
-#define MG_BLUE    0x0000ffff
-#define MG_CYAN    0x00ffffff
-#define MG_MAGENTA 0xff00ffff
-#define MG_YELLOW  0xffff00ff
-#define MG_GRAY    0x808080ff
-
-#define MAKECOLOR_32(r,g,b) (((unsigned int)0xff) | ((unsigned int)b<<8) | ((unsigned int)g << 16) | ((unsigned int)r << 24))
-#define COLOR_32_RED(c) (((c)>>24)&0xff)
-#define COLOR_32_GREEN(c) (((c)>>16)&0xff)
-#define COLOR_32_BLUE(c) (((c)>>8)&0xff)
-
-#else
-
-#define MG_WHITE   0xffffffff
-#define MG_BLACK   0xff000000
-#define MG_RED     0xff0000ff
-#define MG_GREEN   0xff00ff00
-#define MG_BLUE    0xffff0000
-#define MG_CYAN    0xffffff00
-#define MG_MAGENTA 0xffff00ff
-#define MG_YELLOW  0xff00ffff
-#define MG_GRAY    0xff808080
-
-#define MAKECOLOR_32(r,g,b) (((unsigned int)0xff<<24) | ((unsigned int)b<<16) | ((unsigned int)g << 8) | (unsigned int)r)
-#define COLOR_32_RED(c) ((c)&0xff)
-#define COLOR_32_GREEN(c) (((c)>>8)&0xff)
-#define COLOR_32_BLUE(c) (((c)>>16)&0xff)
-#endif
-
-#else /* 8-bit color */
-typedef unsigned char Color;
-
-#define MG_WHITE 0
-#define MG_BLACK 1
-#define MG_RED 2
-#define MG_GREEN 3
-#define MG_BLUE 4
-#define MG_CYAN 5
-#define MG_MAGENTA 6
-#define MG_YELLOW 7
-#define MG_GRAY 8
-#define MG_FREE_COLORS_START 9
-
-#endif /* COLOR32 */
-
-#define MG_WRITE_MODE_NORMAL    0
-#define MG_WRITE_MODE_MULTIPLY  (1 << 0)
-
-struct rgbColor
-    {
-    unsigned char r, g, b;
-    };
-
-/* HSV and HSL structs can be used for changing lightness, darkness, or
- * color of RGB colors. Convert RGB->HS[LV], modify hue, saturation, or
- * value/lightness, then convert back to RGB.
- * The datatypes were chosen to be fast but also give accurate conversion
- * back to RGB.
- * Hue is a float [0,360) degrees 0=red, 120=green, 240=blue
- * S/V/L are integers [0,1000]
- */
-
-struct hsvColor
-    {
-    double h;
-    unsigned short s, v;
-    };
-
-struct hslColor
-    {
-    double h;
-    unsigned short s, l;
-    };
-
-extern struct rgbColor mgFixedColors[9];  /* Contains MG_WHITE - MG_GRAY */
-
-struct memGfx
-    {
-    Color *pixels;
-    int width, height;
-    struct rgbColor colorMap[256];
-    int colorsUsed;
-    int clipMinX, clipMaxX;
-    int clipMinY, clipMaxY;
-    struct colHash *colorHash;	/* Hash for fast look up of color. */
-    unsigned int writeMode;
-    };
-
-struct memGfx *mgNew(int width, int height);
-/* Get a new thing to draw on in memory. */
-
-void mgFree(struct memGfx **pmg);
-/* Free up memory raster. */
-
-void mgClearPixelsTrans(struct memGfx *mg);
-/* Set all pixels to transparent. */
-
-void mgClearPixels(struct memGfx *mg);
-/* Set all pixels to background. */
-
-void mgSetClip(struct memGfx *mg, int x, int y, int width, int height);
-/* Set clipping rectangle. */
-
-void mgUnclip(struct memGfx *mg);
-/* Set clipping rect cover full thing. */
-
-Color mgFindColor(struct memGfx *mg, unsigned char r, unsigned char g, unsigned char b);
-/* Returns closest color in color map to rgb values.  If it doesn't
- * already exist in color map and there's room, it will create
- * exact color in map. */
-
-Color mgClosestColor(struct memGfx *mg, unsigned char r, unsigned char g, unsigned char b);
-/* Returns closest color in color map to r,g,b */
-
-Color mgAddColor(struct memGfx *mg, unsigned char r, unsigned char g, unsigned char b);
-/* Adds color to end of color map if there's room. */
-
-int mgColorsFree(struct memGfx *mg);
-/* Returns # of unused colors in color map. */
-
-
-#define _mgBpr(mg) ((mg)->width)
-/* Get what to add to get to next line */
-
-#define _mgPixAdr(mg,x,y) ((mg)->pixels+_mgBpr(mg) * (y) + (x))
-/* Get pixel address */
-
-#define _mgPutDot(mg, x, y, color) (*_mgPixAdr(mg,x,y) = (color))
-/* Unclipped plot a dot */
-
-#define _mgGetDot(mg, x, y) (*_mgPixAdr(mg,x,y))
-/* Unclipped get a dot, you do not want to use this, this is special for
- * verticalText only */
-
-void _mgPutDotMultiply(struct memGfx *mg, int x, int y,Color color);
-
-INLINE void mgPutDot(struct memGfx *mg, int x, int y,Color color)
-{
-if ((x)>=(mg)->clipMinX && (x) < (mg)->clipMaxX && (y)>=(mg)->clipMinY  && (y) < (mg)->clipMaxY) 
-    {
-        switch(mg->writeMode)
-        {
-        case MG_WRITE_MODE_NORMAL:
-            {
-            _mgPutDot(mg,x,y,color);
-            }
-            break;
-        case MG_WRITE_MODE_MULTIPLY:
-            {
-            _mgPutDotMultiply(mg,x,y,color);
-            }
-            break;
-        }
-    }
-}
-/* Clipped put dot */
-
-#define mgGetDot(mg,x,y) ((x)>=(mg)->clipMinX && (x) < (mg)->clipMaxX && (y)>=(mg)->clipMinY  && (y) < (mg)->clipMaxY) ? _mgGetDot(mg,x,y) : 0
-/* Clipped get dot, you do not want to use this, this is special for
- * verticalText only */
-
-void mgPutSeg(struct memGfx *mg, int x, int y, int width, Color *dots);
-/* Put a series of dots starting at x, y and going to right width pixels. */
-
-void mgPutSegZeroClear(struct memGfx *mg, int x, int y, int width, Color *dots);
-/* Put a series of dots starting at x, y and going to right width pixels.
- * Don't put zero dots though. */
-
-void mgDrawBox(struct memGfx *mg, int x, int y, int width, int height, Color color);
-/* Draw a (horizontal) box */
-
-void mgDrawLine(struct memGfx *mg, int x1, int y1, int x2, int y2, Color color);
-/* Draw a line from one point to another. */
-
-void mgDrawHorizontalLine(struct memGfx *mg, int y1, Color color);
-/*special case of mgDrawLine*/
-
-void mgLineH(struct memGfx *mg, int y, int x1, int x2, Color color);
-/* Draw horizizontal line width pixels long starting at x/y in color */
-
-void mgSavePng(struct memGfx *mg, char *filename, boolean useTransparency);
-/* Save memory bitmap to filename as a PNG.
- * If useTransparency, then the first color in memgfx's colormap/palette is
- * assumed to be the image background color, and pixels of that color
- * are made transparent. */
-
-boolean mgSaveToPng(FILE *png_file, struct memGfx *mg, boolean useTransparency);
-/* Save PNG to an already open file.
- * If useTransparency, then the first color in memgfx's colormap/palette is
- * assumed to be the image background color, and pixels of that color
- * are made transparent. */
-
-typedef void (*TextBlit)(int bitWidth, int bitHeight, int bitX, int bitY,
-	unsigned char *bitData, int bitDataRowBytes, 
-	struct memGfx *dest, int destX, int destY, 
-	Color color, Color backgroundColor);
-/* This defines the type of a function that takes a rectangular
- * area of a bitplane and expands it into a rectangular area
- * of a full color screen. */
-
-void mgTextBlit(int bitWidth, int bitHeight, int bitX, int bitY,
-	unsigned char *bitData, int bitDataRowBytes, 
-	struct memGfx *dest, int destX, int destY, 
-	Color color, Color backgroundColor);
-/* This function leaves the background as it was. */
-
-void mgTextBlitSolid(int bitWidth, int bitHeight, int bitX, int bitY,
-	unsigned char *bitData, int bitDataRowBytes, 
-	struct memGfx *dest, int destX, int destY, 
-	Color color, Color backgroundColor);
-/* This function sets the background to the background color. */
-
-typedef struct font_hdr MgFont;
-/* Type of our font.  */
-
-/* Collection of fonts from here and there.  The mgTinyFont() and mgSmallFont() are uniq
- * here.  The rest are synonyms at this point for the adobe fonts below. */
-MgFont *mgTinyFont();
-MgFont *mgSmallFont();
-MgFont *mgMediumFont();
-MgFont *mgLargeFont();
-MgFont *mgHugeFont();
-MgFont *mgTinyBoldFont();
-MgFont *mgSmallBoldFont();
-MgFont *mgMediumBoldFont();
-MgFont *mgLargeBoldFont();
-MgFont *mgHugeBoldFont();
-MgFont *mgTinyFixedFont();
-MgFont *mgSmallFixedFont();
-MgFont *mgMediumFixedFont();
-MgFont *mgLargeFixedFont();
-MgFont *mgHugeFixedFont();
-
-/* Adobe fonts from xfree project. */
-MgFont *mgCourier8Font();
-MgFont *mgCourier10Font();
-MgFont *mgCourier12Font();
-MgFont *mgCourier14Font();
-MgFont *mgCourier18Font();
-MgFont *mgCourier24Font();
-MgFont *mgCourier34Font();
-MgFont *mgHelvetica8Font();
-MgFont *mgHelvetica10Font();
-MgFont *mgHelvetica12Font();
-MgFont *mgHelvetica14Font();
-MgFont *mgHelvetica18Font();
-MgFont *mgHelvetica24Font();
-MgFont *mgHelvetica34Font();
-MgFont *mgHelveticaBold8Font();
-MgFont *mgHelveticaBold10Font();
-MgFont *mgHelveticaBold12Font();
-MgFont *mgHelveticaBold14Font();
-MgFont *mgHelveticaBold18Font();
-MgFont *mgHelveticaBold24Font();
-MgFont *mgHelveticaBold34Font();
-MgFont *mgTimes8Font();
-MgFont *mgTimes10Font();
-MgFont *mgTimes12Font();
-MgFont *mgTimes14Font();
-MgFont *mgTimes18Font();
-MgFont *mgTimes24Font();
-MgFont *mgTimes34Font();
-
-/* free Meslo font */
-MgFont *mgMenloMediumFont();
-
-void mgText(struct memGfx *mg, int x, int y, Color color, 
-	MgFont *font, char *text);
-/* Draw a line of text with upper left corner x,y. */
-
-void mgTextCentered(struct memGfx *mg, int x, int y, int width, int height, 
-	Color color, MgFont *font, char *text);
-/* Draw a line of text centered in box defined by x/y/width/height */
-
-void mgTextRight(struct memGfx *mg, int x, int y, int width, int height, 
-	Color color, MgFont *font, char *text);
-/* Draw a line of text right justified in box defined by x/y/width/height */
-
-int mgFontPixelHeight(MgFont *font);
-/* How high in pixels is font? */
-
-int mgFontLineHeight(MgFont *font);
-/* How many pixels to next line ideally? */
-
-int mgFontWidth(MgFont *font, char *chars, int charCount);
-/* How wide are a couple of letters? */
-
-int mgFontStringWidth(MgFont *font, char *string);
-/* How wide is a string? */
-
-int mgFontCharWidth(MgFont *font, char c);
-/* How wide is a character? */
-
-char *mgFontSizeBackwardsCompatible(char *size);
-/* Given "size" argument that may be in old tiny/small/medium/big/huge format,
- * return it in new numerical string format. Do NOT free the return string*/
-
-MgFont *mgFontForSizeAndStyle(char *textSize, char *fontType);
-/* Get a font of given size and style.  Abort with error message if not found.
- * The textSize should be 6,8,10,12,14,18,24 or 34.  For backwards compatibility
- * textSizes of "tiny" "small", "medium", "large" and "huge" are also ok.
- * The fontType should be "medium", "bold", or "fixed" */
-
-MgFont *mgFontForSize(char *textSize);
-/* Get a font of given size and style.  Abort with error message if not found.
- * The textSize should be 6,8,10,12,14,18,24 or 34.  For backwards compatibility
- * textSizes of "tiny" "small", "medium", "large" and "huge" are also ok. */
-
-void mgFillUnder(struct memGfx *mg, int x1, int y1, int x2, int y2, 
-	int bottom, Color color);
-/* Draw a 4 sided filled figure that has line x1/y1 to x2/y2 at
- * it's top, a horizontal line at bottom at it's bottom,  and
- * vertical lines from the bottom to y1 on the left and bottom to
- * y2 on the right. */
-
-struct memGfx *mgRotate90(struct memGfx *in);
-/* Create a copy of input that is rotated 90 degrees clockwise. */
-
-void mgCircle(struct memGfx *mg, int xCen, int yCen, int rad, 
-	Color color, boolean filled);
-/* Draw a circle using a stepping algorithm.  Doesn't correct
- * for non-square pixels. */
-
-void mgDrawPoly(struct memGfx *mg, struct gfxPoly *poly, Color color,
-	boolean filled);
-/* Draw polygon, possibly filled in color. */
-
-struct hslColor mgRgbToHsl(struct rgbColor rgb);
-/* Convert RGB to HSL colorspace (see http://en.wikipedia.org/wiki/HSL_and_HSV) 
- * In HSL, Hue is the color in the range [0,360) with 0=red 120=green 240=blue,
- * Saturation goes from a shade of grey (0) to fully saturated color (1000), and
- * Lightness goes from black (0) through the hue (500) to white (1000). */
-
-struct hsvColor mgRgbToHsv(struct rgbColor rgb);
-/* Convert RGB to HSV colorspace (see http://en.wikipedia.org/wiki/HSL_and_HSV)
- * In HSV, Hue is the color in the range [0,360) with 0=red 120=green 240=blue,
- * Saturation goes from white (0) to fully saturated color (1000), and
- * Value goes from black (0) through to the hue (1000). */
-#define hsvValMax 1000
-#define hsvSatMax 1000
-
-struct rgbColor mgHslToRgb(struct hslColor hsl);
-/* Convert HSL to RGB colorspace (see http://en.wikipedia.org/wiki/HSL_and_HSV) */
-
-struct rgbColor mgHsvToRgb(struct hsvColor hsv);
-/* Convert HSV to RGB colorspace (see http://en.wikipedia.org/wiki/HSL_and_HSV) */
-
-struct rgbColor mgRgbTransformHsl(struct rgbColor in, double h, double s, double l);
-/* Transform rgb 'in' value using
- *   hue shift 'h' (0..360 degrees), 
- *   saturation scale 's', and 
- *   lightness scale 'l'
- * Returns the transformed rgb value 
- * Use H=0, S=L=1 for identity transformation
- */
-
-struct rgbColor mgRgbTransformHsv(struct rgbColor in, double h, double s, double v);
-/* Transform rgb 'in' value using
- *   hue shift 'h' (0..360 degrees), 
- *   saturation scale 's', and 
- *   value scale 'v'
- * Returns the transformed rgb value 
- * Use H=0, S=V=1 for identity transformation
- */
-
-struct rgbColor mgColorIxToRgb(struct memGfx *mg, int colorIx);
-/* Return rgb value at color index. */
-
-#endif /* MEMGFX_H */
diff --git a/gbtools/src/include/blatSrc/meta.h b/gbtools/src/include/blatSrc/meta.h
deleted file mode 100644
index b9bc371..0000000
--- a/gbtools/src/include/blatSrc/meta.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* metaRa - stuff to parse and interpret a genome-hub meta.txt file, which is in 
- * a hierarchical ra format.  That is something like:
- *     meta topLevel
- *     cellLine HELA
- *
- *         meta midLevel
- *         target H3K4Me3
- *         antibody abCamAntiH3k4me3
- *       
- *            meta lowLevel
- *            fileName hg19/chipSeq/helaH3k4me3.narrowPeak.bigBed
- * The file is interpreted so that lower level stanzas inherit tags from higher level ones.
- */
-
-#ifndef META_H
-#define META_H
-
-struct metaTagVal
-/* A tag/value pair. */
-    {
-    struct metaTagVal *next;	/* Next in list. */
-    char *tag;	/* Tag name. */
-    char *val;	/* Tag value. */
-    };
-
-struct metaTagVal *metaTagValNew(char *tag, char *val);
-/* Create new meta tag/val */
-
-void metaTagValFree(struct metaTagVal **pMtv);
-/* Free up metaTagVal. */
-
-void metaTagValFreeList(struct metaTagVal **pList);
-/* Free a list of dynamically allocated metaTagVal's */
-
-int metaTagValCmp(const void *va, const void *vb);
-/* Compare to sort based on tag name . */
-
-struct meta
-/* A node in the metadata tree */
-    {
-    struct meta *next;  /* Pointer to next younger sibling. */
-    struct meta *children;	/* Pointer to eldest child. */
-    struct meta *parent;	/* Pointer to parent. */
-    char *name;		    /* Same as val of meta tag. Not allocated here. */
-    struct metaTagVal *tagList;	/* All tags, including the "meta" one. */
-    int indent;                 /* Indentation level - generally only set if read from file. */
-    };
-
-struct meta *metaLoadAll(char *fileName, char *keyTag, char *parentTag,
-    boolean ignoreOtherStanzas, boolean ignoreIndent);
-/* Loads in all ra stanzas from file and turns them into a list of meta, some of which
- * may have children.  The keyTag parameter is optional.  If non-null it should be set to
- * the tag name that starts a stanza.   If null, the first tag of the first stanza will be used.
- * The parentTag if non-NULL will be a tag name used to define the parent of a stanza.
- * The ignoreOtherStanzas flag if set will ignore stanzas that start with other tags.  
- * If not set the routine will abort on such stanzas.  The ignoreIndent if set will
- * use the parentTag (which must be set) to define the hierarchy.  Otherwise the program
- * will look at the indentation, and if there is a parentTag complain about any
- * disagreements between indentation and parentTag. */
-
-void metaFree(struct meta **pMeta);
-/* Free up memory associated with a meta. */
-
-void metaFreeForest(struct meta **pForest);
-/* Free up all metas in forest and their children. */ 
-
-void metaFreeList(struct meta **pList);
-/* Free a list of dynamically allocated meta's. Use metaFreeForest to free children too. */
-
-#define META_DEFAULT_INDENT 4	/* Default size for meta indentation */
-
-void metaWriteAll(struct meta *metaList, char *fileName, int indent, boolean withParent);
-/* Write out metadata, including children, optionally adding meta tag.   By convention
- * for out meta.txt/meta.ra files, indent is 4, withParent is FALSE. */
-
-char *metaLocalTagVal(struct meta *meta, char *tag);
-/* Return value of tag found in this node, not going up to parents. */
-
-char *metaTagVal(struct meta *meta, char *tag);
-/* Return value of tag found in this node or if its not there in parents.
- * Returns NULL if tag not found. */
-
-void metaAddTag(struct meta *meta, char *tag, char *val);
-/* Add tag/val to meta. */
-
-void metaSortTags(struct meta *meta);
-/* Do canonical sort so that the first tag stays first but the
- * rest are alphabetical. */
-
-struct hash *metaHash(struct meta *forest);
-/* Return hash of meta at all levels of heirarchy keyed by meta value. */
-
-#endif /* META_H */
diff --git a/gbtools/src/include/blatSrc/metaWig.h b/gbtools/src/include/blatSrc/metaWig.h
deleted file mode 100644
index 7856e39..0000000
--- a/gbtools/src/include/blatSrc/metaWig.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Interface class so that wigs and bigWigs look similar */
-
-#ifndef METAWIG_H
-#define METAWIG_H
-
-#ifndef BBIFILE_H
-#include "bbiFile.h"
-#endif
-
-enum metaWigType 
-    {
-    mwtSections,
-    mwtBigWig,
-    };
-
-struct metaWig
-/* Interface class so that wigs and bigWigs look similar */
-    {
-    struct metaWig *next;
-    enum metaWigType type;
-
-    /* For type mwtSections */
-    struct bwgSection *sectionList;	/* List of all sections. */
-    struct hash *chromHash; 		/* Hash value is first section in that chrom */
-    struct lm *lm;			/* Where sectionList is allocated. */
-
-    /* For type mwtBigWig */
-    struct bbiFile *bwf;
-    };
-
-struct metaWig *metaWigOpen(char *fileName);
-/* Wrap self around file.  Read all of it if it's wig, just header if bigWig. */
-
-void metaWigClose(struct metaWig **pMw);
-/* Close up metaWig file */
-
-struct slName *metaWigChromList(struct metaWig *mw);
-/* Return list of chromosomes covered in wig. */
-
-struct bbiInterval *metaIntervalsForChrom(struct metaWig *mw, char *chrom, struct lm *lm);
-/* Get sorted list of all intervals with data on chromosome. */
-
-#endif /* METAWIG_H */
-
diff --git a/gbtools/src/include/blatSrc/mime.h b/gbtools/src/include/blatSrc/mime.h
deleted file mode 100644
index 6ff937c..0000000
--- a/gbtools/src/include/blatSrc/mime.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*****************************************************************************
- * This file is copyright 2005 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. 
- *****************************************************************************/
-/* mime.h - parses MIME messages, especially from a cgi from a multipart web form */
-
-#ifndef HASH_H
-#include "hash.h"
-#endif 
-
-#define MIMEBUFSIZE 32*1024  /* size of buffer for mime input */
-
-struct mimePart
-/* structure for an element of a MIME (multipart) message */
-    {
-    struct mimePart *next; /* next (sibling) if is part of multipart */
-    struct hash *hdr;      /* hash of part headers */
-    off_t size;     /* determines if local mem or saved to tempfile */
-      /* only one of the next 3 pointers will be non-null, and that is the type */
-    char* data;     /* if size< MAXPARTSIZE and does not contain null */
-    char* fileName; /* if size>=MAXPARTSIZE or data contains null */
-    boolean binary; /* if contains 0 chars, cannot store as a c-string */
-    struct mimePart *multi;/* points to head of child list if itself contains multiparts */
-    };
-
-struct mimeBuf
-/* structure for buffering a MIME message during parsing */
-    {
-    int d;                  /* descriptor (file,socket,etc) */
-    char buf[MIMEBUFSIZE];  /* actual buffer */
-    char *i;                /* index into buffer, current location */
-    char *eop;              /* end of part or -1 */
-    char *boundary;         /* boundary pattern for marking end of mime part */
-    int  blen;              /* boundary pattern length (strlen) */
-    char *eod;              /* end of data = eoi-(blen-1) */
-    char *eoi;              /* end of input or -1 */
-    char *eom;              /* end of memory just buf+MIMEBUFSIZE */
-    };
-
-char *getMimeHeaderMainVal(char *header);
-/* Parse a typical mime header line returning the first
- * main value up to whitespace, punctuation, or end. 
- * freeMem the returned string when done */
-
-char *getMimeHeaderFieldVal(char *header, char *field);
-/* Parse a typical mime header line looking for field=
- * and return the value which may be quoted.
- * freeMem the returned string when done */
-
-struct mimeBuf * initMimeBuf(int d);
-/* d is a descriptor for a file or socket or some other descriptor 
-   that the MIME input can be read from. 
-   Initializes the mimeBuf structure. */
-
-struct mimePart *parseMultiParts(struct mimeBuf *b, char *altHeader);
-/* This is a recursive function.  It parses multipart MIME messages.
-   Data that are binary or too large will be saved in mimePart->filename
-   otherwise saved as a c-string in mimePart->data.  If multipart,
-   then first child is mimePart->child, subsequent sibs are in child->next.
-   altHeader is a string of headers that can be fed in if the headers have
-   already been read off the stream by an earlier process, i.e. apache.
- */
diff --git a/gbtools/src/include/blatSrc/net.h b/gbtools/src/include/blatSrc/net.h
deleted file mode 100644
index b00dea4..0000000
--- a/gbtools/src/include/blatSrc/net.h
+++ /dev/null
@@ -1,267 +0,0 @@
-/* Net.h some stuff to wrap around net communications. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-
-#ifndef NET_H
-#define NET_H
-
-#include "linefile.h"
-#include "dystring.h"
-
-#define DEFAULTCONNECTTIMEOUTMSEC 10000  /* default connect timeout for tcp in milliseconds */
-#define DEFAULTREADWRITETTIMEOUTSEC 120  /* default read/write timeout for tcp in seconds */
-
-int setReadWriteTimeouts(int sd, int seconds);
-/* Set read and write timeouts on socket sd 
- * Return -1 if there are any errors, 0 if successful. */
-
-/* add a failure to connFailures[]
- *  which can save time and avoid more timeouts */
-int netConnect(char *hostName, int port);
-/* Start connection with a server having resolved port. Return < 0 if error. */
-
-int netMustConnect(char *hostName, int port);
-/* Start connection with server or die. */
-
-int netMustConnectTo(char *hostName, char *portName);
-/* Start connection with a server and a port that needs to be converted to integer */
-
-int netAcceptingSocket(int port, int queueSize);
-/* Create a socket for to accept connections. */
-
-int netAcceptingSocketFrom(int port, int queueSize, char *host);
-/* Create a socket that can accept connections from a 
- * IP address on the current machine if the current machine
- * has multiple IP addresses. */
-
-int netAccept(int sd);
-/* Accept incoming connection from socket descriptor. */
-
-int netAcceptFrom(int sd, unsigned char subnet[4]);
-/* Wait for incoming connection from socket descriptor
- * from IP address in subnet.  Subnet is something
- * returned from netParseDottedQuad.  */
-
-FILE *netFileFromSocket(int socket);
-/* Wrap a FILE around socket.  This should be fclose'd
- * and separately the socket close'd. */
-
-int netWaitForData(int sd, int microseconds);
-/* Wait for descriptor to have some data to read, up to given number of
- * microseconds.  Returns amount of data there or zero if timed out. */
-
-void netBlockBrokenPipes();
-/* Make it so a broken pipe doesn't kill us. */
-
-ssize_t netReadAll(int sd, void *vBuf, ssize_t size);
-/* Read given number of bytes into buffer.
- * Don't give up on first read! */
-
-ssize_t netMustReadAll(int sd, void *vBuf, ssize_t size);
-/* Read given number of bytes into buffer or die.
- * Don't give up if first read is short! */
-
-boolean netSendString(int sd, char *s);
-/* Send a string down a socket - length byte first. */
-
-boolean netSendLongString(int sd, char *s);
-/* Send a string down a socket - up to 64k characters. */
-
-boolean netSendHugeString(int sd, char *s);
-/* Send a string down a socket - up to 4G characters. */
-
-char *netRecieveString(int sd, char buf[256]);
-/* Read string into buf and return it.  If buf is NULL
- * an internal buffer will be used. Abort if any problem. */
-
-char *netRecieveLongString(int sd);
-/* Read string up to 64k and return it.  freeMem
- * the result when done. Abort if any problem*/
-
-char *netRecieveHugeString(int sd);
-/* Read string up to 4G and return it.  freeMem
- * the result when done. Abort if any problem*/
-
-char *netGetString(int sd, char buf[256]);
-/* Read string into buf and return it.  If buf is NULL
- * an internal buffer will be used. Print warning message
- * and return NULL if any problem. */
-
-char *netGetLongString(int sd);
-/* Read string up to 64k and return it.  freeMem
- * the result when done.  Print warning message and
- * return NULL if any problem. */
-
-char *netGetHugeString(int sd);
-/* Read string up to 4 gig and return it.  freeMem
- * the result when done.  Print warning message and
- * return NULL if any problem. */
-
-void netCatchPipes();
-/* Set up to catch broken pipe signals. */
-
-boolean netPipeIsBroken();
-/* Return TRUE if pipe is broken */
-
-void  netClearPipeFlag();
-/* Clear broken pipe flag. */
-
-void netParseSubnet(char *in, unsigned char out[4]);
-/* Parse subnet, which is a prefix of a normal dotted quad form.
- * Out will contain 255's for the don't care bits. */
-
-struct netParsedUrl
-/* A parsed URL. */
-   {
-   char protocol[16];	/* Protocol - http or ftp, etc. */
-   char user[128];	/* User name (optional)  */
-   char password[128];	/* Password  (optional)  */
-   char host[128];	/* Name of host computer - www.yahoo.com, etc. */
-   char port[16];       /* Port, usually 80 or 8080. */
-   char file[1024];	/* Remote file name/query string, starts with '/' */
-   ssize_t byteRangeStart; /* Start of byte range, use -1 for none */
-   ssize_t byteRangeEnd;   /* End of byte range use -1 for none */
-   };
-
-void netParseUrl(char *url, struct netParsedUrl *parsed);
-/* Parse a URL into components.   A full URL is made up as so:
- *   http://user:password@hostName:port/file;byterange=0-499
- * User and password may be cgi-encoded.
- * This is set up so that the http:// and the port are optional. 
- */
-
-char *urlFromNetParsedUrl(struct netParsedUrl *npu);
-/* Build URL from netParsedUrl structure */
-
-int netUrlOpen(char *url);
-/* Return socket descriptor (low-level file handle) for read()ing url data,
- * or -1 if error.  Just close(result) when done. Errors from this routine
- * from web urls are rare, because this just opens up enough to read header,
- * which may just say "file not found." Consider using netUrlMustOpenPastHeader
- * instead .*/
-
-int netUrlMustOpenPastHeader(char *url);
-/* Get socket descriptor for URL.  Process header, handling any forwarding and
- * the like.  Do errAbort if there's a problem, which includes anything but a 200
- * return from http after forwarding. */
-
-int netUrlOpenSockets(char *url, int *retCtrlSocket);
-/* Return socket descriptor (low-level file handle) for read()ing url data,
- * or -1 if error. 
- * If retCtrlSocket is non-NULL and url is FTP, set *retCtrlSocket
- * to the FTP control socket which is left open for a persistent connection.
- * close(result) (and close(*retCtrlSocket) if applicable) when done. */
-
-struct hash;
-
-int netUrlHeadExt(char *url, char *method, struct hash *hash);
-/* Go get head and return status.  Return negative number if
- * can't get head. If hash is non-null, fill it with header
- * lines with upper cased keywords for case-insensitive lookup,
- * including hopefully CONTENT-TYPE: . */
-
-int netUrlHead(char *url, struct hash *hash);
-/* Go get head and return status.  Return negative number if
- * can't get head. If hash is non-null, fill it with header
- * lines with upper cased keywords for case-insensitive lookup, 
- * including hopefully CONTENT-TYPE: . */
-
-long long netUrlSizeByRangeResponse(char *url);
-/* Use byteRange as a work-around alternate method to get file size (content-length).  
- * Return negative number if can't get. */
-
-struct lineFile *netLineFileOpen(char *url);
-/* Return a lineFile attached to url.  This one
- * will skip any headers.   Free this with
- * lineFileClose(). */
-
-struct lineFile *netLineFileMayOpen(char *url);
-/* Same as netLineFileOpen, but warns and returns
- * null rather than aborting on problems. */
-
-struct lineFile *netLineFileSilentOpen(char *url);
-/* Open a lineFile on a URL.  Just return NULL without any user
- * visible warning message if there's a problem. */
-
-struct dyString *netSlurpFile(int sd);
-/* Slurp file into dynamic string and return.  Result will include http headers and
- * the like. */
-
-struct dyString *netSlurpUrl(char *url);
-/* Go grab all of URL and return it as dynamic string.  Result will include http headers
- * and the like. This will errAbort if there's a problem. */
-
-char *netReadTextFileIfExists(char *url);
-/* Read entire URL and return it as a string.  URL should be text (embedded zeros will be
- * interpreted as end of string).  If the url doesn't exist or has other problems,
- * returns NULL. Does *not* include http headers. */
-
-struct lineFile *netHttpLineFileMayOpen(char *url, struct netParsedUrl **npu);
-/* Parse URL and open an HTTP socket for it but don't send a request yet. */
-
-void netHttpGet(struct lineFile *lf, struct netParsedUrl *npu,
-		boolean keepAlive);
-/* Send a GET request, possibly with Keep-Alive. */
-
-int netOpenHttpExt(char *url, char *method, char *optionalHeader);
-/* Return a file handle that will read the url.  optionalHeader
- * may by NULL or may contain cookies and other info. */
-
-int netHttpConnect(char *url, char *method, char *protocol, char *agent, char *optionalHeader);
-/* Parse URL, connect to associated server on port, and send most of
- * the request to the server.  If specified in the url send user name
- * and password too.  Typically the "method" will be "GET" or "POST"
- * and the agent will be the name of your program or
- * library. optionalHeader may be NULL or contain additional header
- * lines such as cookie info. 
- * Proxy support via hg.conf httpProxy or env var http_proxy
- * Return data socket, or -1 if error.*/
-
-int netHttpGetMultiple(char *url, struct slName *queries, void *userData,
-		       void (*responseCB)(void *userData, char *req,
-					  char *hdr, struct dyString *body));
-/* Given an URL which is the base of all requests to be made, and a 
- * linked list of queries to be appended to that base and sent in as 
- * requests, send the requests as a batch and read the HTTP response 
- * headers and bodies.  If not all the requests get responses (i.e. if 
- * the server is ignoring Keep-Alive or is imposing a limit), try again 
- * until we can't connect or until all requests have been served. 
- * For each HTTP response, do a callback. */
-
-
-boolean netSkipHttpHeaderLinesWithRedirect(int sd, char *url, char **redirectedUrl);
-/* Skip http header lines. Return FALSE if there's a problem.
- * The input is a standard sd or fd descriptor.
- * This is meant to be able work even with a re-passable stream handle,
- * e.g. can pass it to the pipes routines, which means we can't
- * attach a linefile since filling its buffer reads in more than just the http header.
- * Handles 300, 301, 302, 303, 307 http redirects by setting *redirectedUrl to
- * the new location. */
-
-boolean netSkipHttpHeaderLinesHandlingRedirect(int sd, char *url, int *redirectedSd, char **redirectedUrl);
-/* Skip http headers lines, returning FALSE if there is a problem.  Generally called as
- *    netSkipHttpHeaderLine(sd, url, &sd, &url);
- * where sd is a socket (file) opened with netUrlOpen(url), and url is in dynamic memory.
- * If the http header indicates that the file has moved, then it will update the *redirectedSd and
- * *redirectedUrl with the new socket and URL, first closing sd.
- * If for some reason you want to detect whether the forwarding has occurred you could
- * call this as:
- *    char *newUrl = NULL;
- *    int newSd = 0;
- *    netSkipHttpHeaderLine(sd, url, &newSd, &newUrl);
- *    if (newUrl != NULL)
- *          // Update sd with newSd, free url if appropriate and replace it with newUrl, etc.
- *          //  free newUrl when finished.
- * This routine handles up to 5 steps of redirection.
- * The logic to this routine is also complicated a little to make it work in a pipe, which means we
- * can't attach a lineFile since filling the lineFile buffer reads in more than just the http header. */
-
-boolean netGetFtpInfo(char *url, long long *retSize, time_t *retTime);
-/* Return date in UTC and size of ftp url file */
-
-boolean hasProtocol(char *urlOrPath);
-/* Return TRUE if it looks like it has http://, ftp:// etc. */
-#endif /* NET_H */
-
diff --git a/gbtools/src/include/blatSrc/nib.h b/gbtools/src/include/blatSrc/nib.h
deleted file mode 100644
index 622a213..0000000
--- a/gbtools/src/include/blatSrc/nib.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* nib.h - interface to nucleotides stored 4 bits per base (so have
- * room for N. */
-#ifndef NIB_H
-#define NIB_H
-
-#ifndef DNAUTIL_H
-#include "dnautil.h"
-#endif 
-
-#ifndef HASH_H
-#include "hash.h"
-#endif
-
-/** Options for controlling masking  */
-#define NIB_MASK_MIXED    0x01 /* Read uses case to indicate masking.
-                                * Write sets mask bit for lower-case */
-#define NIB_MASK_MAP      0x02 /* Read builds dnaSeq->mask bit map. Write
-                                * uses mask to set mask bases.  Note: the
-                                * bit map indicates which bases are not repeats
-                                */
-#define NIB_BASE_NAME     0x04 /* Return a sequence name that is the base name
-                                * the file. */
-
-void nibOpenVerify(char *fileName, FILE **retFile, int *retSize);
-/* Open file and verify it's in good nibble format. */
-
-struct dnaSeq *nibLoadPart(char *fileName, int start, int size);
-/* Load part of an .nib file. */
-
-struct dnaSeq *nibLoadPartMasked(int options, char *fileName, int start, int size);
-/* Load part of an .nib file, with control over handling of masked positions */
-
-struct dnaSeq *nibLdPart(char *fileName, FILE *f, int seqSize, int start, int size);
-/* Load part of an open .nib file. */
-
-struct dnaSeq *nibLdPartMasked(int options, char *fileName, FILE *f, int seqSize, int start, int size);
-/* Load part of an open .nib file, with control over handling of masked
- * positions. */
-
-struct dnaSeq *nibLoadAll(char *fileName);
-/* Load all of a nib file. */
-
-struct dnaSeq *nibLoadAllMasked(int options, char *fileName);
-/* Load part of a .nib file, with control over handling of masked
- * positions. Subranges of nib files may specified in the file name
- * using the syntax:
- *    /path/file.nib:seqid:start-end
- * or\n"
- *    /path/file.nib:start-end
- * With the first form, seqid becomes the id of the subrange, with the second
- * form, a sequence id of file:start-end will be used.
- */
-
-void nibWrite(struct dnaSeq *seq, char *fileName);
-/* Write out file in format of four bits per nucleotide. */
-
-void nibWriteMasked(int options, struct dnaSeq *seq, char *fileName);
-/* Write out file in format of four bits per nucleotide, with control over
- * handling of masked positions. */
-
-boolean nibIsFile(char *fileName);
-/* Return TRUE if file is a nib file. */
-
-boolean nibIsRange(char *fileName);
-/* Return TRUE if file specifies a subrange of a nib file. */
-
-void nibParseName(unsigned options, char *fileSpec, char *filePath,
-                         char *name, unsigned *start, unsigned *end);
-/* Parse the nib name, getting the file name, seq name to use, and
- * optionally the start and end positions. Zero is return for start
- * and end if they are not specified. Return the path to the file
- * and the name to use for the sequence. */
-
-struct nibStream *nibStreamOpen(char *fileName);
-/* Create a new nib stream.  Open file and stuff. */
-
-void nibStreamClose(struct nibStream **pNs);
-/* Close a nib stream.  Flush last nibble if need be.  Fix up header. */
-
-void nibStreamOne(struct nibStream *ns, DNA base);
-/* Write out one base to nibStream. */
-
-void nibStreamMany(struct nibStream *ns, DNA *dna, int size);
-/* Write many bases to nibStream. */
-
-struct nibInfo
-/* Info on a nib file. */
-    {
-    struct nibInfo *next;
-    char *fileName;	/* Name of nib file. */
-    int size;		/* Number of bases in nib. */
-    FILE *f;		/* Open file. */
-    };
-
-struct nibInfo *nibInfoNew(char *path);
-/* Make a new nibInfo with open nib file. */
-
-void nibInfoFree(struct nibInfo **pNib);
-/* Free up nib info and close file if open. */
-
-struct nibInfo *nibInfoFromCache(struct hash *hash, char *nibDir, char *nibName);
-/* Get nibInfo on nibDir/nibName.nib from cache, filling cache if need be. */
-
-int nibGetSize(char* nibFile);
-/* Get the number of nucleotides in a nib */
-
-#endif /* NIB_H */
-
diff --git a/gbtools/src/include/blatSrc/nibTwo.h b/gbtools/src/include/blatSrc/nibTwo.h
deleted file mode 100644
index c9466ce..0000000
--- a/gbtools/src/include/blatSrc/nibTwo.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* nibTwo - Something to let you transparently access either
- * .2bit or .nib files. */
-
-#ifndef NIBTWO_H
-#define NIBTWO_H
-
-#ifndef NIB_H
-#include "nib.h"
-#endif
-
-#ifndef TWOBIT_H
-#include "twoBit.h"
-#endif
-
-struct nibTwoCache
-/* This is a cache for either a directory full of nib files or a .2bit file. */
-    {
-    struct nibTwoCache *next;	/* Next in list */
-    char *pathName;		/* Nib dir name or .2bit file name. */
-    boolean isTwoBit;		/* True if this is a .2bit file. */
-    struct twoBitFile *tbf;	/* Two bit file handle if any. */
-    struct hash *nibHash;	/* Hash of nibInfo's if any. */
-    };
-
-struct nibTwoCache *nibTwoCacheNew(char *pathName);
-/* Get something that will more or less transparently get sequence from 
- * nib files or .2bit. */ 
-
-void nibTwoCacheFree(struct nibTwoCache **pNtc);
-/* Free up resources associated with nibTwoCache. */
-
-struct dnaSeq *nibTwoCacheSeq(struct nibTwoCache *ntc, char *seqName);
-/* Return all of sequence. This will have repeats in lower case. */
-
-struct dnaSeq *nibTwoCacheSeqPartExt(struct nibTwoCache *ntc, char *seqName, int start, int size,
-                                     boolean doMask, int *retFullSeqSize);
-/* Return part of sequence. If *retFullSeqSize is non-null then return full
- * size of sequence (not just loaded part) there.   Sequence will be lower
- * case if doMask is false, mixed case (repeats in lower)
- * if doMask is true. */
-
-struct dnaSeq *nibTwoCacheSeqPart(struct nibTwoCache *ntc, char *seqName, 
-	int start, int size, int *retFullSeqSize);
-/* Return part of sequence. If *retFullSeqSize is non-null then return full size of
- * sequence (not just loaded part) there. This will have repeats in lower case. */
-
-struct dnaSeq *nibTwoLoadOne(char *pathName, char *seqName);
-/* Return sequence from a directory full of nibs or a .2bit file. 
- * The sequence will have repeats in lower case. */
-
-int nibTwoGetSize(struct nibTwoCache *ntc, char *seqName);
-/* Return size of sequence. */
-
-#endif /* NIBTWO_H */
-
diff --git a/gbtools/src/include/blatSrc/nt4.h b/gbtools/src/include/blatSrc/nt4.h
deleted file mode 100644
index a04e382..0000000
--- a/gbtools/src/include/blatSrc/nt4.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-#ifndef NT4_H
-#define NT4_H
-
-#ifndef DNAUTIL_H
-#include "dnautil.h"
-#endif
-
-struct nt4Seq
-/* A packed (2 bits per nucleotide) sequence.  'N's are
- * converted to 'T's. */
-    {
-    struct nt4Seq *next;	/* Next in list. */
-    bits32 *bases;              /* Packed bases. */
-    int baseCount;              /* Number of bases. */
-    char *name;                 /* Name of sequence. */
-    };
-
-struct nt4Seq *newNt4(DNA *dna, int size, char *name);
-/* Create a new DNA seq with 2 bits per base pair. */
-
-void freeNt4(struct nt4Seq **pSeq);
-/* Free up DNA seq with 2 bits per base pair */
-
-struct nt4Seq *loadNt4(char *fileName, char *seqName);
-/* Load up an nt4 sequence from a file. */
-
-void  saveNt4(char *fileName, DNA *dna, bits32 dnaSize);
-/* Save dna in an NT4 file. */
-
-int nt4BaseCount(char *fileName);
-/* Return number of bases in NT4 file. */
-
-DNA *nt4Unpack(struct nt4Seq *n, int start, int size);
-/* Create an unpacked section of nt4 sequence.  */
-
-DNA *nt4LoadPart(char *nt4FileName, int start, int size);
-/* Load part of an nt4 file. */
-
-#endif /* _4NT_H */
-
diff --git a/gbtools/src/include/blatSrc/obscure.h b/gbtools/src/include/blatSrc/obscure.h
deleted file mode 100644
index 0142093..0000000
--- a/gbtools/src/include/blatSrc/obscure.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/* Obscure.h  - stuff that's relatively rarely used
- * but still handy. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef OBSCURE_H
-#define OBSCURE_H
-
-long incCounterFile(char *fileName);
-/* Increment a 32 bit value on disk. */
-
-int digitsBaseTwo(unsigned long x);
-/* Return base two # of digits. */
-
-int digitsBaseTen(int x);
-/* Return number of digits base 10. */
-
-void sprintLongWithCommas(char *s, long long l);
-/* Print out a long number with commas a thousands, millions, etc. */
-
-void printLongWithCommas(FILE *f, long long l);
-/* Print out a long number with commas a thousands, millions, etc. */
-
-void sprintWithGreekByte(char *s, int slength, long long size);
-/* Numbers formatted with PB, TB, GB, MB, KB, B */
-
-void writeGulp(char *file, char *buf, int size);
-/* Write out a bunch of memory. */
-
-void readInGulp(char *fileName, char **retBuf, size_t *retSize);
-/* Read whole file in one big gulp. */
-
-void readAllWords(char *fileName, char ***retWords, int *retWordCount, char **retBuf);
-/* Read in whole file and break it into words. You need to freeMem both
- * *retWordCount and *retBuf when done. */
-
-int countWordsInFile(char *fileName);
-/* Count number of words in file. */
-
-struct slName *readAllLines(char *fileName);
-/* Read all lines of file into a list.  (Removes trailing carriage return.) */
-
-void copyFile(char *source, char *dest);
-/* Copy file from source to dest. */
-
-void copyOpenFile(FILE *inFh, FILE *outFh);
-/* copy an open stdio file */
-
-void cpFile(int s, int d);
-/* Copy from source file to dest until reach end of file. */
-
-void *intToPt(int i);
-/* Convert integer to pointer. Use when really want to store an
- * int in a pointer field. */
-
-int ptToInt(void *pt);
-/* Convert pointer to integer.  Use when really want to store a
- * pointer in an int. */
-
-void *sizetToPt(size_t i);
-/* Convert size_t to pointer. Use when really want to store a
- * size_t in a pointer. */
-
-size_t ptToSizet(void *pt);
-/* Convert pointer to size_t.  Use when really want to store a
- * pointer in a size_t. */
-
-boolean parseQuotedStringNoEscapes( char *in, char *out, char **retNext);
-/* Read quoted string from in (which should begin with first quote).
- * Write unquoted string to out, which may be the same as in.
- * Return pointer to character past end of string in *retNext. 
- * Return FALSE if can't find end.
- * Unlike parseQuotedString() do not treat backslash as an escape
- *	character, merely pass it on through.
- */
-
-boolean parseQuotedString( char *in, char *out, char **retNext);
-/* Read quoted string from in (which should begin with first quote).
- * Write unquoted string to out, which may be the same as in.
- * Return pointer to character past end of string in *retNext. 
- * Return FALSE if can't find end. */
-
-char *nextQuotedWord(char **pLine);
-/* Generalization of nextWord.  Returns next quoted
- * string or if no quotes next word.  Updates *pLine
- * to point past word that is returned. Does not return
- * quotes. */
-
-char *makeQuotedString(char *in, char quoteChar);
-/* Create a string surrounded by quoteChar, with internal
- * quoteChars escaped.  freeMem result when done. */
-
-char *makeEscapedString(char *in, char toEscape);
-/* Return string that is a copy of in, but with all
- * toEscape characters preceded by '\' 
- * When done freeMem result. */
-
-void escCopy(char *in, char *out, char toEscape, char escape);
-/* Copy in to out, escaping as needed.  Out better be big enough. 
- * (Worst case is strlen(in)*2 + 1.) */
-
-struct slName *stringToSlNames(char *string);
-/* Convert string to a list of slNames separated by
- * white space, but allowing multiple words in quotes.
- * Quotes if any are stripped.  */
-
-struct slName *commaSepToSlNames(char *commaSep);
-/* Convert comma-separated list of items to slName list. */
-
-struct slName *charSepToSlNames(char *string, char c);
-/* Convert character-separated list of items to slName list. 
- * Note that the last occurence of c is optional.  (That
- * is for a comma-separated list a,b,c and a,b,c, are
- * equivalent. */
-
-struct hash *hashVarLine(char *line, int lineIx);
-/* Return a symbol table from a line of form:
- *   var1=val1 var2='quoted val2' var3="another val" */
-
-struct hash *hashThisEqThatLine(char *line, int lineIx, boolean firstStartsWithLetter);
-/* Return a symbol table from a line of form:
- *   1-this1=val1 2-this='quoted val2' var3="another val" 
- * If firstStartsWithLetter is true, then the left side of the equals must start with
- * and equals. */
-
-struct hash *hashWordsInFile(char *fileName, int hashSize);
-/* Create a hash of space delimited words in file. 
- * hashSize is as in hashNew() - pass 0 for default. */
-
-struct hash *hashNameIntFile(char *fileName);
-/* Given a two column file (name, integer value) return a
- * hash keyed by name with integer values */
-
-struct hash *hashTwoColumnFile(char *fileName);
-/* Given a two column file (key, value) return a hash. */
-
-void shuffleArrayOfChars(char *array, int arraySize);
-/* Shuffle array of characters of given size given number of times. */
-
-void shuffleArrayOfInts(int *array, int arraySize);
-/* Shuffle array of ints of given size given number of times. */
-
-void shuffleArrayOfPointers(void *pointerArray, int arraySize);
-/* Shuffle array of pointers of given size given number of times. */
-
-void shuffleList(void *pList);
-/* Randomize order of slList.  Usage:
- *     shuffleList(&list)
- * where list is a pointer to a structure that
- * begins with a next field. */
-
-void *slListRandomReduce(void *list, double reduceRatio);
-/* Reduce list to approximately reduceRatio times original size. Destroys original list. */
-
-void *slListRandomSample(void *list, int maxCount);
-/* Return a sublist of list with at most maxCount. Destroy list in process */
-
-char *stripCommas(char *position);
-/* make a new string with commas stripped out */
-
-void dotForUserInit(int dotMod);
-/* Set how often dotForUser() outputs a dot. */
-
-void dotForUser();
-/* Write out a dot every _dotForUserMod times this is called. */
-
-void spaceToUnderbar(char *s);
-/* Convert white space to underbar. */
-
-void rangeRoundUp(double start, double end, double *retStart, double *retEnd);
-/* Round start and end so that they cover a slightly bigger range, but with more round
- * numbers.  For instance 0.23:9.89 becomes 0:10 */
-
-void rangeFromMinMaxMeanStd(double minVal, double maxVal, double mean, double std,
-	double *retStart, double *retEnd);
-/* Given some basic statistical properties, set a range that will be good on a wide
- * range of biological data. */
-
-void printVmPeak();
-/* print to stderr peak Vm memory usage (if /proc/ business exists) */
-
-boolean nameInCommaList(char *name, char *commaList);
-/* Return TRUE if name is in comma separated list. */
-#endif /* OBSCURE_H */
diff --git a/gbtools/src/include/blatSrc/oldGff.h b/gbtools/src/include/blatSrc/oldGff.h
deleted file mode 100644
index 550e9cc..0000000
--- a/gbtools/src/include/blatSrc/oldGff.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* oldGff.h - This reads a *special* type of .GFF file.  
- * Some of the routines herein expect the gff file to include
- * both DNA and gene/intron/exon info.  They expect the
- * genes to be named by the group field. */
-#ifndef OLDGFF_H
-#define OLDGFF_H
-
-struct gff
-/* This is the structure that holds info on a gff file.
- */
-    {
-    char fileName[256];
-    FILE *file;
-    long fileSize;
-    char buf[256];
-    int bufSize;
-    int bytesInBuf;
-    int readIx;
-    int lineNumber;
-    struct lm *memPool;
-    char *dna;
-    long dnaSize;
-    char dnaName[128];
-    struct gffGene *genes;
-    };
-
-/* An intron or exon - just an offset into a DNA array. */
-struct gffSegment
-    {
-    struct gffSegment *next;	/* This must be first field! */
-    long start, end;
-    int frame;
-    };
-typedef struct gffSegment GffIntron;
-typedef struct gffSegment GffExon;
-
-struct gffGene
-/* At the end of a GFF file are a number of genes, each of which 
- * is a list of exons/introns. */
-    {
-    struct gffGene *next;	/* This must be first field! */
-    long start, end;
-    int frame;
-    char strand;	/* + or - */
-    char name[64];
-    GffExon *exons;
-    GffIntron *introns;
-    DNA *dna;
-    long dnaSize;
-    };
-
-
-boolean gffOpen(struct gff *gff, char *fileName);
-/* Initialize gff structure and open file for it. */
-
-boolean gffOpenAndRead(struct gff *gff, char *fileName);
-/* Open up gff file and read everything in it. */
-
-void gffClose(struct gff *gff);
-/* Close down gff structure. */
-
-boolean gffReadDna(struct gff *gff);
-/* Read all the DNA in a file. */
-
-struct gffGene *gffFindGene(struct gff *gff, char *geneName);
-/* Find gene with given name.  Case sensitive. */
-
-struct gffGene *gffFindGeneIgnoreCase(struct gff *gff, char *geneName);
-/* Find gene with given name.  Not case sensitive. */
-
-void gffPrintInfo(struct gff *gff, FILE *out);
-/* Print summary info about file. */
-
-boolean gffReadGenes(struct gff *gff);
-/* Read all the gene (as opposed to base) info in file. */
-
-struct gffGene *gffDupeGene(struct gff *gff, struct gffGene *oldGene);
-/* Make a duplicate of gene (with it's own DNA). gffFreeGene it when done. */
-
-struct gffGene *gffDupeGeneAndSurrounds(struct gff *gff, struct gffGene *oldGene,
-    int leftExtra, int rightExtra);
-/* Make a duplicate of gene with extra DNA around coding region. 
- * gffFreeGene it when done. */
-
-struct gffGene *gffGeneWithOwnDna(struct gff *gff, char *geneName);
-/* Find gene with given name.  Case sensitive. */
-
-void gffFreeGene(struct gffGene **pGene);
-/* Free a gene returned with dupeGene or geneWithOwnDna. 
- * (You don't want to free the ones returned by findGene,
- * they are still owned by the gff.)
- */
-
-struct dnaSeq *gffReadDnaSeq(char *fileName);
-/* Open gff file and read DNA sequence from it. */
-
-#endif /* GFF_H */
-
diff --git a/gbtools/src/include/blatSrc/oligoTm.h b/gbtools/src/include/blatSrc/oligoTm.h
deleted file mode 100644
index d2490bd..0000000
--- a/gbtools/src/include/blatSrc/oligoTm.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* oligoTm - calculate melting temperature of relatively short DNA sequences.
- * This is based on the nearest-neighbor thermodynamics of bases from Breslauer,
- * Frank, Bloecker, and Markey, Proc. Natl. Acad. Sci. USA, vol 83, page 3748,
- * and uses work from see Rychlik, Spencer, Roads, Nucleic Acids Research, vol 18, 
- * no 21.  This code was imported from the oligotm module of Whitehead Institute's
- * primer3 program, and adapted into UCSC conventions by Jim Kent.  Any redistribution
- * of this code should contain the following copyright notice from Whitehead:
- *
- * Copyright (c) 1996,1997,1998,1999,2000,2001,2004
- *         Whitehead Institute for Biomedical Research. All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 
- * 1.      Redistributions must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the  documentation
- * and/or other materials provided with the distribution.  Redistributions of
- * source code must also reproduce this information in the source code itself.
- * 
- * 2.      If the program is modified, redistributions must include a notice
- * (in the same places as above) indicating that the redistributed program is
- * not identical to the version distributed by Whitehead Institute.
- * 
- * 3.      All advertising materials mentioning features or use of this
- * software  must display the following acknowledgment:
- *         This product includes software developed by the
- *         Whitehead Institute for Biomedical Research.
- * 
- * 4.      The name of the Whitehead Institute may not be used to endorse or
- * promote products derived from this software without specific prior written
- * permission.
- * 
- * We also request that use of this software be cited in publications as 
- * 
- *   Rozen, S., Skaletsky, H.  \"Primer3 on the WWW for general users
- *   and for biologist programmers.\"  In S. Krawetz and S. Misener, eds.
- *   Bioinformatics Methods and Protocols in the series Methods in 
- *   Molecular Biology.  Humana Press, Totowa, NJ, 2000, pages 365-386.
- *   Code available at
- *   http://fokker.wi.mit.edu/primer3/.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE WHITEHEAD INSTITUTE ``AS IS'' AND  ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE  IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE  ARE
- * DISCLAIMED. IN NO EVENT SHALL THE WHITEHEAD INSTITUTE BE LIABLE  FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS  OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)  HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE. */
-
-#ifndef OLIGOTM_H
-#define OLIGOTM_H
-
-double oligoTm(char *dna, double DNA_nM, double K_mM);
-/* Calculate melting point of short DNA sequence given DNA concentration in 
- * nanomoles, and salt concentration in millimoles.  This is calculated using eqn
- * (ii) in Rychlik, Spencer, Roads, Nucleic Acids Research, vol 18, no 21, page
- * 6410, with tables of nearest-neighbor thermodynamics for DNA bases as
- * provided in Breslauer, Frank, Bloecker, and Markey,
- * Proc. Natl. Acad. Sci. USA, vol 83, page 3748. */
-
-double oligoDg(char *dna);
-/* Calculate dg (change in Gibb's free energy) from melting oligo
- * the nearest neighbor model. Seq should be relatively short, given 
- * the characteristics of the nearest neighbor model (36 bases or less
- * is best). */
-
-double longSeqTm(char *s, int start, int len, double salt_conc);
-/* Calculate the melting temperature of substr(seq, start, length) using the
- * formula from Bolton and McCarthy, PNAS 84:1390 (1962) as presented in
- * Sambrook, Fritsch and Maniatis, Molecular Cloning, p 11.46 (1989, CSHL
- * Press).
- *
- * Tm = 81.5 + 16.6(log10([Na+])) + .41*(%GC) - 600/length
- *
- * Where [Na+] is the molar sodium concentration, (%GC) is the percent of Gs
- * and Cs in the sequence, and length is the length of the sequence.
- *
- * A similar formula is used by the prime primer selection program in GCG
- * (http://www.gcg.com), which instead uses 675.0 / length in the last term
- * (after F. Baldino, Jr, M.-F. Chesselet, and M.E.  Lewis, Methods in
- * Enzymology 168:766 (1989) eqn (1) on page 766 without the mismatch and
- * formamide terms).  The formulas here and in Baldino et al. assume Na+ rather
- * than K+.  According to J.G. Wetmur, Critical Reviews in BioChem. and
- * Mol. Bio. 26:227 (1991) 50 mM K+ should be equivalent in these formulae to .2
- * M Na+.
- *
- * This function takes salt_conc to be the millimolar (mM) concentration,
- * since mM is the usual units in PCR applications.  */
-
-double seqTm(char *seq, double dna_conc, double salt_conc);
-/* Figure out melting temperature of sequence of any length given
- * dna and salt concentration. */
-#endif /* OLIGOTM_H */
-
diff --git a/gbtools/src/include/blatSrc/ooc.h b/gbtools/src/include/blatSrc/ooc.h
deleted file mode 100644
index 5b0bd9b..0000000
--- a/gbtools/src/include/blatSrc/ooc.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* ooc.h - Stuff to handle overused N-mers (tiles) in genome
- * indexing schemes. */
-/* Copyright 2001-2002 Jim Kent.  All rights reserved. */
-
-#ifndef OOC_H
-#define OOC_H
-
-void oocMaskCounts(char *oocFile, bits32 *tileCounts, int tileSize, bits32 maxPat);
-/* Set items of tileCounts to maxPat if they are in oocFile. 
- * Effectively masks this out of index.*/
-
-void oocMaskSimpleRepeats(bits32 *tileCounts, int seedSize, bits32 maxPat);
-/* Mask out simple repeats in index . */
-
-#endif /* OOC_H */
-
diff --git a/gbtools/src/include/blatSrc/options.h b/gbtools/src/include/blatSrc/options.h
deleted file mode 100644
index 7a385a7..0000000
--- a/gbtools/src/include/blatSrc/options.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Stuff to process options out of command line. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef OPTIONS_H
-#define OPTIONS_H
-
-#include "common.h"
-
-/* Types for options */
-#define OPTION_BOOLEAN    0x01
-#define OPTION_STRING     0x02
-#define OPTION_INT        0x04
-#define OPTION_FLOAT      0x10
-#define OPTION_LONG_LONG  0x20
-#define OPTION_MULTI      0x40
-#define OPTION_DOUBLE	  0x80
-
-/* Mask for option types (excluding OPTION_MULTI) */
-#define OPTION_TYPE_MASK (OPTION_BOOLEAN|OPTION_STRING|OPTION_INT|OPTION_FLOAT|OPTION_LONG_LONG|OPTION_DOUBLE)
-
-struct optionSpec
-/* Specification of a single option.  An array of these are passed
- * to optionInit() to validate options. */
-{
-    char *name;      /* option name */
-    unsigned flags;  /* Flags for option, specifies types */
-};
-
-char *optionVal(char *name, char *defaultVal);
-/* Return named option if in options hash, otherwise default. */
-
-int optionInt(char *name, int defaultVal);
-/* Return integer value of named option, or default value
- * if not set. */
-
-long long optionLongLong(char *name, long long defaultVal);
-/* Return long long value of named option, or default value
- * if not set. */
-
-float optionFloat(char *name, float defaultVal);
-/* Return floating point value or default value if not set. */
-
-struct slName *optionMultiVal(char *name, struct slName *defaultVal);
-/* Returns a list of the values assocated with a named option if in options hash, otherwise default. */
-
-double optionDouble(char *name, double defaultVal);
-/* Return double value or default value if not set */
-
-boolean optionExists(char *name);
-/* Return TRUE if option has been set. */
-
-void optionMustExist(char *name);
-/* Abort if option has not been set. */
-
-void optionInit(int *pArgc, char *argv[], struct optionSpec *optionSpecs);
-/* Read options in command line into options hash.
- * Options come in three forms:
- *      -option         words starting with dash
- *      option=val      words with = in the middle
- *      -option=val     combining the two.
- * The resulting hash will be keyed by the option name with the val
- * string for value.  For '-option' types the value is 'on'.
- * The words in argv are parsed in assending order.  If a word of
- * "--" is encountered, argument parsing stops.
- * If optionSpecs is not NULL, it is an array of optionSpec that are
- * used to validate the options.  An option must exist in the array
- * and the value must be convertable to the type specified in flags.
- * Boolean options have must no value, all other options must have one.
- * Array is terminated by a optionSpec with a NULL name.
- * If array NULL, no validation is done.
- */
-
-void optionHash(int *pArgc, char *argv[]);
-/* Read options in command line into options hash.   
- * Options come in three forms:
- *      -option         words starting with dash
- *      option=val      words with = in the middle
- *      -option=val     combining the two.
- * The resulting hash will be keyed by the option name with the val
- * string for value.  For '-option' types the value is 'on'.
- * The words in argv are parsed in assending order.  If a word of
- * "--" is encountered, argument parsing stops. */
-
-void optionHashSome(int *pArgc, char *argv[], boolean justFirst);
-/* Set up option hash from command line, optionally only adding
- * up to first non-optional word. */
-
-struct hash *optionParseIntoHash(int *pArgc, char *argv[], boolean justFirst);
-/* Read options in argc/argv into a hash of your own choosing. */
-
-struct hash *optionParseIntoHashExceptNumbers(int *pArgc, char *argv[], boolean justFirst);
-/* Read options in argc/argv into a hash (except negative numbers) of your own choosing. */
-
-void optionFree();
-/* free the option hash */
-
-#endif /* OPTIONS_H */
-
diff --git a/gbtools/src/include/blatSrc/pairDistance.h b/gbtools/src/include/blatSrc/pairDistance.h
deleted file mode 100644
index 4dc9280..0000000
--- a/gbtools/src/include/blatSrc/pairDistance.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* pairDistance - help manage systems where you have a list of distances between pairs of
- * elements */
-
-#ifndef PAIRDISTANCE_H
-#define PAIRDISTANCE_H
-
-struct pairDistance
-/* A pair of items and the distance between them. */
-    {
-    struct pairDistance *next;
-    char *a;	/* First in pair */
-    char *b;	/* Second in pair */
-    double distance;  /* Distance between two */
-    };
-
-struct pairDistance *pairDistanceReadAll(char *fileName);
-/* Read in file of format <a> <b> <distance> into list of pairs */
-
-struct hash *pairDistanceHashList(struct pairDistance *pairList);
-/* Return hash of all pairs keyed by pairName function on pair with pair values */
-
-double pairDistanceHashLookup(struct hash *pairHash, char *aName, char *bName);
-/* Return distance between a and b. */
-
-void pairDistanceInvert(struct pairDistance *list);
-/* Go through and reverse distances, and make them positive. */
-
-char *pairDistanceName(char *a, char *b, char *outBuf, int outBufSize);
-/* Return name for pair */
-
-#endif /* PAIRDISTANCE_H */
diff --git a/gbtools/src/include/blatSrc/pairHmm.h b/gbtools/src/include/blatSrc/pairHmm.h
deleted file mode 100644
index a054006..0000000
--- a/gbtools/src/include/blatSrc/pairHmm.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* pairHmm - stuff to help implement pairwise hidden markov models,
- * which are useful ways of aligning two sequences. 
- *
- * This file is copyright 2000-2004 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef PAIRHMM_H
-#define PAIRHMM_H
-
-/* Mommy coding scheme - this is how one cell in the dynamic programming table
- * points to it's parent (mommy) cell.  Since these tables are really big,
- * rather than use a simple pointer costing four bytes, we use a encoding
- * scheme that requires only one byte. 
- *
- * Bits 0-4  the "hidden" state of the mommy.  Lets us have 32 hidden states.
- *           currently only using 7.
- * Bit  5    whether or not mommy is in previous cell in query
- * Bit  6    whether or not mommy is in previous cell in target
- * Bit  7    set during trace back for cells along optimal path
- *
- * Since the query and target advancing bits (5 and 6) are never both zero,
- * it is safe to use the value of all-bits-zero as an indicator of
- * no mommy. */
-
-/* Compress state, query, and target offset into one byte. */
-#define phmmPackMommy(stateIx, qOff, tOff) ((UBYTE)((stateIx) + ((-(qOff))<<5) + ((-(tOff))<<6)))
-
-/* Traceback sets this, really just for debugging. */
-#define phmmMommyTraceBit (1<<7)
-
-struct phmmMommy
-/* This contains the parent info for a single state of the matrix. */
-    {
-    UBYTE mommy; /* Unlike a parent, you can only have one mommy! */
-    };
-
-extern UBYTE phmmNullMommy; /* mommy value for orphans.... */
-
-struct phmmState
-/* This corresponds to a hidden Markov state.  Each one of
- * these has a two dimensional array[targetSize+1][querySize+1]
- * of cells. */
-    {
-    struct phmmMommy *cells;	/* The 2-D array containing traceback info. */
-    int *scores;		/* Scores for the current row. */
-    int *lastScores;		/* Scores for the previous row. */
-    int stateIx;		/* Numerical handle on state. */
-    char *name;			/* Name of state. */
-    char emitLetter;		/* Single letter representing state. */
-    };
-
-struct phmmMatrix
-/* The alignment matrix - has an array of states. */
-    {
-    char *query;	/* One sequence to align- all lower case. */
-    char *target;    	/* Other sequence to align. */
-    int querySize;	/* Size of query. */
-    int targetSize;	/* Size of target. */
-    int qDim;		/* One plus size of query - dimension of matrix. */
-    int tDim;		/* One plus size of target - dimension of matrix. */
-    int stateCount;	/* Number of hidden states in HMM. */
-    int stateSize;	/* Number of cells in each state's matrix. */
-    int stateByteSize;	/* Number of bytes used by each state's matrix. */
-    struct phmmState *states;  /* Array of states. */
-    struct phmmMommy *allCells; /* Memory for all matrices. */
-    int *allScores;	      /* Memory for two rows of scores. */
-    };
-
-struct phmmMatrix *phmmMatrixNew(int stateCount,
-    char *query, int querySize, char *target, int targetSize);
-/* Allocate all memory required for an phmmMatrix. Set up dimensions. */
-
-void phmmMatrixFree(struct phmmMatrix **pAm);
-/* Free up memory required for an phmmMatrix and make sure
- * nobody reuses it. */
-
-struct phmmState *phmmNameState(struct phmmMatrix *am, int stateIx, 
-	char *name, char emitLetter);
-/* Give a name to a state and return a pointer to it. */
-
-struct phmmAliPair *phmmTraceBack(struct phmmMatrix *am, struct phmmMommy *end);
-/* Create list of alignment pair by tracing back through matrix from end
- * state back to a start.*/
-
-void phmmPrintTrace(struct phmmMatrix *am, struct phmmAliPair *pairList, 
-	boolean showStates, FILE *f, boolean extraAtEnds);
-/* Print out trace to file. */
-
-struct axt *phhmTraceToAxt(struct phmmMatrix *am, struct phmmAliPair *pairList, 
-	int score, char *qName, char *tName);
-/* Convert alignment from traceback format to axt. */
-
-#endif /* PAIRHMM_H */
-
diff --git a/gbtools/src/include/blatSrc/paraFetch.h b/gbtools/src/include/blatSrc/paraFetch.h
deleted file mode 100644
index 2b096d0..0000000
--- a/gbtools/src/include/blatSrc/paraFetch.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* paraFetch - fetch things from remote URLs in parallel. */
-
-#ifndef PARAFETCH_H
-#define PARAFETCH_H
-
-boolean parallelFetch(char *url, char *outPath, int numConnections, int numRetries, boolean newer, boolean progress);
-/* Open multiple parallel connections to URL to speed downloading */
-
-boolean parallelFetchInterruptable(char *url, char *outPath, int numConnections, int numRetries, 
-    boolean newer, boolean progress,
-    boolean (*interrupt)(void *context),  void *context);
-/* Open multiple parallel connections to URL to speed downloading.  If interrupt function 
- * is non-NULL,  then it gets called passing the context parameter,  and if it returns
- * TRUE the fetch is interrupted. */
-
-void parallelFetchRemovePartial(char *destName);
-/* Remove any files associated with partial downloads of file of given name. 
- * This is needed after a FALSE return from parallelFetch or parallelFetchInterruptable
- * unless you want to leave temp file there to try to restart. */
-
-struct parallelConn
-/* struct to information on a parallel connection */
-    {
-    struct parallelConn *next;  /* next connection */
-    int sd;                     /* socket descriptor */
-    off_t rangeStart;           /* where does the range start */
-    off_t partSize;             /* range size */
-    off_t received;             /* bytes received */
-    };
-
-boolean paraFetchReadStatus(char *origPath, 
-    struct parallelConn **pPcList, char **pUrl, off_t *pFileSize, 
-    char **pDateString, off_t *pTotalDownloaded);
-/* Read a status file - which is just origPath plus .paraFetchStatus.  This is updated during 
- * transit by parallelFetch. Returns FALSE if status file not there - possibly because
- * transfer is finished.  Any of the return parameters (pThis and pThat) may be NULL */
-
-time_t paraFetchTempUpdateTime(char *origPath);
-/* Return last mod date of temp file - which is useful to see if process has stalled. */
-
-#endif /* PARAFETCH_H */
diff --git a/gbtools/src/include/blatSrc/patSpace.h b/gbtools/src/include/blatSrc/patSpace.h
deleted file mode 100644
index 03a0ccd..0000000
--- a/gbtools/src/include/blatSrc/patSpace.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* patSpace - a homology finding algorithm that occurs mostly in 
- * pattern space (as opposed to offset space). */
-
-#ifndef PATSPACE_H
-#define PATSPACE_H
-
-#ifndef DNASEQ_H
-#include "dnaseq.h"
-#endif
-
-struct patSpace *makePatSpace(
-    struct dnaSeq **seqArray,       /* Array of sequence lists. */
-    int seqArrayCount,              /* Size of above array. */
-    int seedSize,	            /* Alignment seed size - 10 or 11. Must match oocFileName */
-    char *oocFileName,              /* File with tiles to filter out, may be NULL. */
-    int minMatch,                   /* Minimum # of matching tiles.  4 is good. */
-    int maxGap                      /* Maximum gap size - 32k is good for 
-                                       cDNA (introns), 500 is good for DNA assembly. */
-    );
-/* Allocate a pattern space and fill from sequences.  (Each element of
-   seqArray is a list of sequences. */
-
-void freePatSpace(struct patSpace **pPatSpace);
-/* Free up a pattern space. */
-
-struct patClump
-/* This holds pattern space output - a list of homologous clumps. */
-    {
-    struct patClump *next;     /* Link to next in list. */
-    int bacIx;                 /* Index of .fa file where hit occurs. */
-    int seqIx;                 /* Index of contig where hit occurs. */
-    struct dnaSeq *seq;        /* Sequence in which hit occurs. */
-    int start;                 /* Start offset within sequence. */
-    int size;                  /* Size of block within sequence. */
-    };
-
-struct patClump *patSpaceFindOne(struct patSpace *ps, DNA *dna, int dnaSize);
-/* Find occurrences of DNA in patSpace. The resulting list can be
- * freed with slFreeList. */
-
-
-#endif /* PATSPACE_H */
-
diff --git a/gbtools/src/include/blatSrc/peakCluster.h b/gbtools/src/include/blatSrc/peakCluster.h
deleted file mode 100644
index e65823a..0000000
--- a/gbtools/src/include/blatSrc/peakCluster.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* peakCluster - cluster peak calls from different sources. */
-
-#ifndef PEAKCLUSTER_H
-#define PEAKCLUSTER_H
-
-struct peakDim
-/* A peak dimension */
-    {
-    int colIx;		/* Column index in table. */
-    char *label;	/* Label */
-    };
-
-struct peakSource 
-/* A source of peak information */
-    {
-    struct peakSource *next;
-    char *dataSource;		/* File (or table) */
-    int chromColIx;		/* Chromosome column index. */
-    int startColIx;		/* Start coordinate column index. */
-    int endColIx;		/* End ccoordinate column ix. */
-    int scoreColIx;		/* Index for score column. */
-    double normFactor;		/* Multiply this to get browser score. */
-    char **labels;		/* Label for each dimension */
-    int minColCount;		/* Minimum number of columns. */
-    };
-
-struct peakItem
-/* An item in a peak track */
-    {
-    struct peakItem *next;
-    char *chrom;		/* Chromosome. Not allocated here. */
-    int chromStart,chromEnd;	/* Half open coordinates. */
-    double score;		/* Ideally something like -log(p). */
-    struct peakSource *source;   /* Source track/file for item. */
-    char *asciiLine;		/* Ascii representation of line. */
-    };
-
-struct peakCluster
-/* A cluster of items. */
-    {
-    struct peakCluster *next;
-    char *chrom;		/* Chromosome.  Not allocated here. */
-    int chromStart, chromEnd;	/* Half open coordinates. */
-    double score;		/* Sum of component scores. */
-    double maxSubScore;		/* Max of component scores. */
-    struct slRef *itemRefList;	/* List of references to component items. */
-    };
-
-struct peakClusterMaker
-/* Help make a cluster of peaks on multiple-chromosome data sets. */
-    {
-    struct peakClusterMaker *next;
-    struct hash *chromHash;	   /* Key is chromosome, value is a rbTree of items. */
-    struct rbTreeNode *stack[128]; /* Stack for rbTree evaluations. */
-    };
-
-struct peakClusterMaker *peakClusterMakerNew();
-/* Return a new peakClusterMaker. */
-
-void peakClusterMakerFree(struct peakClusterMaker **pMaker);
-/* Free up a peakClusterMaker. */
-
-struct hashEl *peakClusterMakerChromList(struct peakClusterMaker *maker);
-/* Return list of chromosomes.  In hashEl format where the hashEl val is
- * a rangeTree filled with items. Do a slFreeList when done. */
-
-struct peakSource *peakSourceLoadAll(char *fileName, int dimCount);
-/* Read file, parse it line by line and return list of peakSources. */
-
-void peakClusterMakerAddFromSource(struct peakClusterMaker *maker, struct peakSource *source);
-/* Read through data source and add items to it to rangeTrees in maker */
-
-struct peakCluster *peakClusterItems(struct lm *lm, struct peakItem *itemList, 
-	double forceJoinScore, double weakLevel);
-/* Convert a list of items to a list of clusters of items.  This may break up clusters that
- * have weakly linked parts. 
-      [                ]
-      AAAAAAAAAAAAAAAAAA 
-       BBBBBB   DDDDDD
-        CCCC     EEEE
-   gets tranformed into
-       [    ]   [    ]
-      AAAAAAAAAAAAAAAAAA 
-       BBBBBB   DDDDDD
-        CCCC     EEEE
-   The strategy is to build a rangeTree of coverage, which might look something like so:
-      123333211123333211 
-   then define cluster ends that exceed the minimum limit, which is either 10% of the highest
-   or forceJoinScore if 10% of the highest is more than forceJoinScore.  This will go to
-   something like so:
-        [---]   [----]   
-   Finally the items that are overlapping a cluster are assigned to it.  Note that this
-   may mean that an item may be in multiple clusters.
-        [ABC]   [ ADE]
- */
-
-#endif /* PEAKCLUSTER_H */
-
diff --git a/gbtools/src/include/blatSrc/phyloTree.h b/gbtools/src/include/blatSrc/phyloTree.h
deleted file mode 100644
index 70ad89a..0000000
--- a/gbtools/src/include/blatSrc/phyloTree.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* phlyogenetic trees */
-
-
-#ifndef PHYLOTREE_H
-#define PHYLOTREE_H
-
-#include "linefile.h"
-
-struct phyloName
-{
-    char *name;		/* name of this node */
-    double length;	/* length of the branch to this node */
-};
-
-struct phyloTree
-{
-    struct phyloTree *next;		/* next in single linked list */
-    struct phyloTree *parent;		/* the parent of this node */
-    struct phyloTree **edges;
-    struct phyloName *ident;		/* the name and branch length */
-    struct phyloTree *mark;		/* probably the favorite child */
-    bool isDup;				/* is this a duplication node */
-    int numEdges;
-    int allocedEdges;
-
-    void *priv;
-};
-
-extern struct phyloTree *phyloOpenTree(char *fileName);
-/* opens an NH tree file */
-
-extern struct phyloTree *phyloReadTree(struct lineFile *lf);
-/* reads a phyloTree from lineFile (first line only) */
-
-extern struct phyloTree *phyloParseString(char *string);
-/* build a phyloTree from a string */
-
-extern void phyloPrintTree( struct phyloTree *,FILE *f);
-/* print a phyloTree to f in Newick format */
-
-extern void phyloDebugTree( struct phyloTree *,FILE *f);
-/* print a phyloTree to f */
-
-extern char *phyloFindPath(struct phyloTree *tree, char *ref, char *cross);
-/* find the shortest path from ref to cross (returns a list
- * of the node names separated by spaces */
-
-extern char *phyloNodeNames(struct phyloTree *tree);
-/* return list of all the node names separated by spaces */
-
-extern struct phyloTree *phyloFindName( struct phyloTree *tree,char *name );
-/* find the node with this name */
-
-extern struct phyloTree *phyloReRoot(struct phyloTree *inTree);
-/* return a tree whose root is inTree and what were parents are now "right" children */
-
-extern void phyloDeleteEdge(struct phyloTree *tree, struct phyloTree *edge);
-/* delete an edge from a node.  Aborts on error */
-
-extern struct phyloTree *phyloAddEdge(struct phyloTree *parent, struct phyloTree *child);
-/* add an edge to a phyloTree node */
-
-extern void phyloClearTreeMarks(struct phyloTree *tree);
-/* clear the favorite child marks */
-
-extern struct phyloTree *phyloFindMarkUpTree(struct phyloTree *tree);
-/* find a marked node somewhere above this node */
-
-extern void phyloMarkUpTree(struct phyloTree *tree);
-/* mark all the nodes from this one up to the top of the tree */
-
-extern void phyloPrintTreeNoDups( struct phyloTree *tree,FILE *f);
-/* print out phylogenetic tree in Newick format (only speciation nodes) */
-
-extern int phyloCountLeaves( struct phyloTree *tree);
-
-#endif
diff --git a/gbtools/src/include/blatSrc/pipeline.h b/gbtools/src/include/blatSrc/pipeline.h
deleted file mode 100644
index 27f6f37..0000000
--- a/gbtools/src/include/blatSrc/pipeline.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* pipeline.h - create a process pipeline that can be used for reading or
- * writing.  These pipeline objects don't go through the shell, so they
- * avoid many of the obscure problems associated with system() and popen().
- *
- * Read pipelines are pipelines where a program reads output written by the
- * pipeline, and write pipelines are where the program writes data to the
- * pipeline.  The type of pipeline is specified in the set of option flags
- * passed to pipelineOpen().  The file at the other end of the pipeline is
- * specified in the otherEndFile argument of pipelineOpen(), as shown here:
- *
- * pipelineRead:
- *
- *   otherEndFile --> cmd[0] --> ... --> cmd[n] --> pipelineLf() etc.
- *
- * pipelineWrite:
- *
- *   pipeLineFile() --> cmd[0] --> ... --> cmd[n] --> otherEndFile
- *
- * Specify otherEndFile as "/dev/null" for no input or no output (or to
- * discard output).  If otherEndFile is NULL, then either stdin or stdout are
- * inherited from the current process.
- * 
- * I/O to the pipeline is done by using the result of pipelineFd(),
- * pipelineFile(), or pipelineLineFile().
- *
- * An example that reads a compressed file, sorting it numerically by the 
- * first column:
- *    
- *    static char *cmd1[] = {"gzip", "-dc", NULL};
- *    static char *cmd2[] = {"sort", "-k", "1,1n", NULL};
- *    static char **cmds[] = {cmd1, cmd2, NULL};
- *    
- *    struct pipeline *pl = pipelineOpen(cmds, pipelineRead, inFilePath, stderrFd);
- *    struct lineFile *lf = pipelineLineFile(pl);
- *    char *line;
- *    
- *    while (lineFileNext(lf, &line, NULL))
- *        {
- *        ...
- *        }
- *    pipelineClose(&pl);
- *
- * A similar example that generates data and writes a compressed file, sorting
- * it numerically by the first column:
- *    
- *    
- *    static char *cmd1[] = {"sort", "-k", "1,1n", NULL};
- *    static char *cmd2[] = {"gzip", "-c3", NULL};
- *    static char **cmds[] = {cmd1, cmd2, NULL};
- *    
- *    struct pipeline *pl = pipelineOpen(cmds, pipelineWrite, outFilePath, stderrFd);
- *    char *line;
- *    
- *    while ((line = makeNextRow()) != NULL)
- *        fprintf(fh, "%s\n", line);
- *    
- *    pipelineClose(&pl);
- *
- * To append to an output file, use pipelineWrite|pipelineAppend:
- *    
- *    struct pipeline *pl = pipelineOpen(cmds, pipelineWrite|pipelineAppend, outFilePath, stderrFd);
- */
-#ifndef PIPELINE_H
-#define PIPELINE_H
-#include <stdio.h>
-struct linefile;
-struct pipeline;
-
-enum pipelineOpts
-/* pipeline options bitset */
-    {
-    pipelineRead       = 0x01, /* read from pipeline */
-    pipelineWrite      = 0x02, /* write to pipeline */
-    pipelineNoAbort    = 0x04, /* don't abort if a process exits non-zero,
-                                * wait will return exit code instead.
-                                * Still aborts if process signals. */
-    pipelineMemInput   = 0x08, /* pipeline takes input from memory (internal) */
-    pipelineAppend     = 0x10, /* Append to output file (used only with pipelineWrite) */
-    pipelineSigpipe    = 0x20  /* enable sigpipe in the children and don't treat
-                                  as an error in the parent */
-    };
-
-struct pipeline *pipelineOpenFd(char ***cmds, unsigned opts,
-                                int otherEndFd, int stderrFd);
-/* Create a pipeline from an array of commands.  Each command is an array of
- * arguments.  Shell expansion is not done on the arguments.  If pipelineRead
- * is specified, the output of the pipeline is readable from the pipeline
- * object.  If pipelineWrite is specified, the input of the pipeline is
- * writable from the pipeline object. */
-
-struct pipeline *pipelineOpen(char ***cmds, unsigned opts,
-                              char *otherEndFile, char *stderrFile);
-/* Create a pipeline from an array of commands.  Each command is an array of
- * arguments.  Shell expansion is not done on the arguments.  If pipelineRead
- * is specified, the output of the pipeline is readable from the pipeline
- * object.  If pipelineWrite is specified, the input of the pipeline is
- * writable from the pipeline object.  If stderrFile is NULL, stderr is inherited,
- * otherwise it is redirected to this file.
- */
-
-void pipelineDumpCmds(char ***cmds);
-/* Dump out pipeline-formatted commands to stdout for debugging. */
-
-struct pipeline *pipelineOpenMem(char ***cmds, unsigned opts,
-                                 void *otherEndBuf, size_t otherEndBufSize,
-                                 int stderrFd);
-/* Create a pipeline from an array of commands, with the pipeline input/output
- * in a memory buffer.  See pipeline.h for full documentation.  Currently only
- * input to a read pipeline is supported  */
-
-struct pipeline *pipelineOpenFd1(char **cmd, unsigned opts,
-                                 int otherEndFd, int stderrFd);
-/* like pipelineOpenFd(), only takes a single command */
-
-struct pipeline *pipelineOpen1(char **cmd, unsigned opts,
-                               char *otherEndFile, char *stderrFile);
-/* like pipelineOpen(), only takes a single command */
-
-struct pipeline *pipelineOpenMem1(char **cmd, unsigned opts,
-                                  void *otherEndBuf, size_t otherEndBufSize,
-                                  int stderrFd);
-/* like pipelineOpenMem(), only takes a single command */
-
-char *pipelineDesc(struct pipeline *pl);
-/* Get the desciption of a pipeline for use in error messages */
-
-int pipelineFd(struct pipeline *pl);
-/* Get the file descriptor for a pipeline */
-
-FILE *pipelineFile(struct pipeline *pl);
-/* Get a FILE object wrapped around the pipeline.  Do not close the FILE, is
- * owned by the pipeline object.  A FILE is created on first call to this
- * function.  Subsequent calls return the same FILE.*/
-
-struct lineFile *pipelineLineFile(struct pipeline *pl);
-/* Get a lineFile object wrapped around the pipeline.  Do not close the
- * lineFile, is owned by the pipeline object.  A lineFile is created on first
- * call to this function.  Subsequent calls return the same object.*/
-
-int pipelineWait(struct pipeline *pl);
-/* Wait for processes in a pipeline to complete; normally aborts if any
- * process exists non-zero.  If pipelineNoAbort was specified, return the exit
- * code of the first process exit non-zero, or zero if none failed. */
-
-void pipelineFree(struct pipeline **plPtr);
-/* free a pipeline object */
-
-int pipelineClose(struct pipeline **pPl);
-/* Wait for pipeline to finish and free it. Same as pipelineWait then pipelineClose.
- * Returns pipelineWait result (normally 0). */
-
-#endif
-/*
- * Local Variables:
- * c-file-style: "jkent-c"
- * End:
- */
diff --git a/gbtools/src/include/blatSrc/portable.h b/gbtools/src/include/blatSrc/portable.h
deleted file mode 100644
index 2952a40..0000000
--- a/gbtools/src/include/blatSrc/portable.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/* portable.h - wrappers around things that vary from server
- * to server and operating system to operating system. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef PORTABLE_H
-#define PORTABLE_H
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-struct slName *listDir(char *dir, char *pattern);
-/* Return an alphabetized list of all files that match 
- * the wildcard pattern in directory. */
-
-struct slName *listDirRegEx(char *dir, char *regEx, int flags);
-/* Return an alphabetized list of all files that match 
- * the regular expression pattern in directory.
- * See REGCOMP(3) for flags (e.g. REG_ICASE)  */
-
-
-struct fileInfo 
-/* Info about a file. */
-    {
-    struct fileInfo  *next;	/* Next in list. */
-    off_t size;		/* Size in bytes. */
-    bool isDir;		/* True if file is a directory. */
-    int statErrno;	/* Result of stat (e.g. bad symlink). */
-    time_t lastAccess;  /* Last access time. */
-    char name[1];	/* Allocated at run time. */
-    };
-
-struct fileInfo *newFileInfo(char *name, off_t size, bool isDir, int statErrno, 
-	time_t lastAccess);
-/* Return a new fileInfo. */
-
-struct fileInfo *listDirXExt(char *dir, char *pattern, boolean fullPath, boolean ignoreStatFailures);
-/* Return list of files matching wildcard pattern with
- * extra info. If full path is true then the path will be
- * included in the name of each file.  You can free the
- * resulting list with slFreeList. */
-
-struct fileInfo *listDirX(char *dir, char *pattern, boolean fullPath);
-/* Return list of files matching wildcard pattern with
- * extra info. If full path is true then the path will be
- * included in the name of each file.  You can free the
- * resulting list with slFreeList. */
-
-char *getCurrentDir();
-/* Return current directory.  Abort if it fails. */
-
-void setCurrentDir(char *newDir);
-/* Set current directory.  Abort if it fails. */
-
-boolean maybeSetCurrentDir(char *newDir);
-/* Change directory, return FALSE (and set errno) if fail. */
-
-boolean makeDir(char *dirName);
-/* Make dir.  Returns TRUE on success.  Returns FALSE
- * if failed because directory exists.  Prints error
- * message and aborts on other error. */
-
-void makeDirsOnPath(char *pathName);
-/* Create directory specified by pathName.  If pathName contains
- * slashes, create directory at each level of path if it doesn't
- * already exist.  Abort with error message if there's a problem.
- * (It's not considered a problem for the directory to already
- * exist. ) */
-
-char *simplifyPathToDir(char *path);
-/* Return path with ~ (for home) and .. taken out.   freeMem result when done. */
-
-long clock1000();
-/* 1000 hz clock */
-
-void sleep1000(int milli);
-/* Sleep for given number of milliseconds. */
-
-long clock1();
-/* A 1 hz clock. */
-
-char *rTempName(char *dir, char *base, char *suffix);
-/* Make a temp name that's almost certainly unique. */
-
-/* This structure helps us generate temp names and use
- * them.  Since different servers locate where the cgi
- * runs from differently, and where the generated html
- * file runs from - this is necessary for portable code. */
-struct tempName
-	{
-	char forCgi[128];
-	char forHtml[128];
-	};
-
-void makeTempName(struct tempName *tn, char *base, char *suffix);
-/* Make a good name for a temp file. */
-
-void mustRename(char *oldName, char *newName);
-/* Rename file or die trying. */
-
-void mustRemove(char *path);
-/* Remove file or die trying */
-
-char *semiUniqName(char *base);
-/* Figure out a name likely to be unique.
- * Name will have no periods.  Returns a static
- * buffer, so best to clone result unless using
- * immediately. */
-
-char *cgiDir();
-/* Return directory to look for cgi in. */
-
-char *trashDir();
-/* Return directory for relative path to trash from cgi binaries */
-
-void mkdirTrashDirectory(char *prefix);
-/*	create the specified trash directory if it doesn't exist */
-
-double machineSpeed();
-/* Return relative speed of machine.  UCSC CSE dept. 1999 web server is 1.0 */
-
-char *mysqlHost();
-/* Return host computer on network for mySQL database. */
-
-char *getHost();
-/* Get name of this machine. */
-
-void uglyfBreak();
-/* Invoke the debugger. */
-
-char *getUser();
-/* Get user name */
-
-void envUpdate(char *name, char *value);
-/* Update an environment string */
-
-int mustFork();
-/* Fork or abort. */
-
-int rawKeyIn();
-/* Read in an unbuffered, unechoed character from keyboard. */
-
-time_t fileModTime(char *pathName);
-/* Return file last modification time.  The units of
- * these may vary from OS to OS, but you can depend on
- * later files having a larger time. */
-
-
-boolean isPipe(int fd);
-/* determine in an open file is a pipe  */
-
-boolean maybeTouchFile(char *fileName);
-/* If file exists, set its access and mod times to now.  If it doesn't exist, create it.
- * Return FALSE if we have a problem doing so. */
-
-boolean isRegularFile(char *fileName);
-/* Return TRUE if fileName is a regular file. */
-
-void makeSymLink(char *oldName, char *newName);
-/* Return a symbolic link from newName to oldName or die trying */
-
-long long freeSpaceOnFileSystem(char *path);
-/* Given a path to a file or directory on a file system,  return free space
- * in bytes. */
-
-#endif /* PORTABLE_H */
-
diff --git a/gbtools/src/include/blatSrc/psGfx.h b/gbtools/src/include/blatSrc/psGfx.h
deleted file mode 100644
index 9d04cb2..0000000
--- a/gbtools/src/include/blatSrc/psGfx.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* PostScript graphics - 
- * This provides a bit of a shell around writing graphics to
- * a postScript file.  Perhaps the most important thing it
- * does is convert 0,0 from being at the bottom left to
- * being at the top left. */
-
-#ifndef PSGFX_H
-#define PSGFX_H
-
-#include "psPoly.h"
-
-struct psGfx 
-/* A postScript output file. */
-    {
-    FILE *f;                      /* File to write to. */
-    double userWidth, userHeight; /* Size of image in virtual pixels. */
-    double ptWidth, ptHeight;     /* Size of image in points (1/72 of an inch) */
-    double xScale, yScale;        /* Conversion from pixels to points. */
-    double xOff, yOff;            /* Offset from pixels to points. */
-    double fontHeight;		  /* Height of current font. */
-    };
-
-struct psGfx *psOpen(char *fileName, 
-	double userWidth, double userHeight, /* Dimension of image in user's units. */
-	double ptWidth, double ptHeight,     /* Dimension of image in points. */
-	double ptMargin);                    /* Image margin in points. */
-/* Open up a new postscript file.  If ptHeight is 0, it will be
- * calculated to keep pixels square. */
-
-void psClose(struct psGfx **pPs);
-/* Close out postScript file. */
-
-void psTranslate(struct psGfx *ps, double xTrans, double yTrans);
-/* add a constant to translate all coordinates */
-
-void psSetLineWidth(struct psGfx *ps, double factor);
-/* Set line width to factor * a single pixel width. */
-
-void psClipRect(struct psGfx *ps, double x, double y, 
-	double width, double height);
-/* Set clipping rectangle. */
-
-void psDrawBox(struct psGfx *ps, double x, double y, 
-	double width, double height);
-/* Draw a filled box in current color. */
-
-void psDrawLine(struct psGfx *ps, double x1, double y1, 
-	double x2, double y2);
-/* Draw a line from x1/y1 to x2/y2 */
-
-void psFillUnder(struct psGfx *ps, double x1, double y1, 
-	double x2, double y2, double bottom);
-/* Draw a 4 sided filled figure that has line x1/y1 to x2/y2 at
- * it's top, a horizontal line at bottom at it's bottom,  and
- * vertical lines from the bottom to y1 on the left and bottom to
- * y2 on the right. */
-
-void psXyOut(struct psGfx *ps, double x, double y);
-/* Output x,y position transformed into PostScript space. 
- * Useful if you're mixing direct PostScript with psGfx
- * functions. */
-
-void psWhOut(struct psGfx *ps, double width, double height);
-/* Output width/height transformed into PostScript space. */
-
-void psMoveTo(struct psGfx *ps, double x, double y);
-/* Move PostScript position to given point. */
-
-void psTextAt(struct psGfx *ps, double x, double y, char *text);
-/* Output text in current font at given position. */
-
-void psTextBox(struct psGfx *ps, double x, double y, char *text);
-/* Fill a box the size of the text at the given position*/
-
-void psTextDown(struct psGfx *ps, double x, double y, char *text);
-/* Output text going downwards rather than across at position. */
-
-void psTextRight(struct psGfx *mg, double x, double y, 
-	double width, double height, char *text);
-/* Draw a line of text right justified in box defined by x/y/width/height */
-
-void psTextCentered(struct psGfx *mg, double x, double y, 
-	double width, double height, char *text);
-/* Draw a line of text centered in box defined by x/y/width/height */
-
-void psTimesFont(struct psGfx *ps, double size);
-/* Set font to times of a certain size. */
-
-void psSetColor(struct psGfx *ps, int r, int g, int b);
-/* Set current color. r/g/b values are between 0 and 255. */
-
-void psSetGray(struct psGfx *ps, double grayVal);
-/* Set gray value (between 0.0 and 1.0. */
-
-void psPushG(struct psGfx *ps);
-/* Save graphics state on stack. */
-
-void psPopG(struct psGfx *ps);
-/* Pop off saved graphics state. */
-
-void psDrawPoly(struct psGfx *ps, struct psPoly *poly, boolean filled);
-/* Draw a possibly filled polygon */
-
-void psFillEllipse(struct psGfx *ps, double x, double y, double xrad, double yrad);
-/* Draw a filled ellipse */
-
-void psDrawEllipse(struct psGfx *ps, double x, double y, double xrad, double yrad,
-    double startAngle, double endAngle);
-/* Draw an ellipse outline */
-
-char * convertEpsToPdf(char *epsFile);
-/* Convert EPS to PDF and return filename, or NULL if failure. */
-
-void psLineTo(struct psGfx *ps, double x, double y);
-/* Draw line from current point to given point,
- * and make given point new current point. */
-#endif /* PSGFX_H */
-
diff --git a/gbtools/src/include/blatSrc/psPoly.h b/gbtools/src/include/blatSrc/psPoly.h
deleted file mode 100644
index a39cb93..0000000
--- a/gbtools/src/include/blatSrc/psPoly.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* psPoly - two dimensional polygon. */
-
-#ifndef PSPOLY_H
-#define PSPOLY_H
-
-struct psPoint
-/* A two-dimensional point, typically in pixel coordinates. */
-    {
-    struct psPoint *next;
-    double x, y;		/* Position */
-    };
-
-struct psPoly
-/* A two-dimensional polygon */
-    {
-    struct psPoly *next;
-    int ptCount;		/* Number of points. */
-    struct psPoint *ptList;	/* First point in list, which is circular. */
-    struct psPoint *lastPoint;	/* Last point in list. */
-    };
-
-struct psPoly *psPolyNew();
-/* Create new (empty) polygon */
-
-void psPolyFree(struct psPoly **pPoly);
-/* Free up resources associated with polygon */
-
-void psPolyAddPoint(struct psPoly *poly, double x, double y);
-/* Add point to polygon. */
-
-#endif /* PSPOLY_H */
diff --git a/gbtools/src/include/blatSrc/pscmGfx.h b/gbtools/src/include/blatSrc/pscmGfx.h
deleted file mode 100644
index b5d13c3..0000000
--- a/gbtools/src/include/blatSrc/pscmGfx.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* pscmGfx - routines for making postScript output seem a
- * lot like 256 color bitmap output. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef PSCMGFX_H
-#define PSCMGFX_H
-
-#include "memgfx.h"
-
-struct pscmGfx 
-/* Structure to simululate 256 color image
- * in postScript - so to make it easier to
- * swap between memGfx/gif output and PostScript
- * output */
-    {
-    struct pscmGfx *next;
-    struct psGfx *ps;	  /* Underlying postScript object. */
-    int colAlloc;	  /* Colors allocated. */
-    int colUsed;	  /* Colors used. */
-    void *curFont;	  /* Current font. */
-    int curColor;	  /* Current color. */
-    struct colHash *colorHash;	/* Hash for fast look up of color. */
-    struct rgbColor colorMap[256]; /* The color map. */
-    int colorsUsed;		/* Number of colors actually used. */
-    int clipMinX, clipMaxX;     /* Clipping region upper left corner. */
-    int clipMinY, clipMaxY;     /* lower right, not inclusive */
-    struct hash *hints;   /* Hints to guide behavior */
-    int writeMode;        /* current write mode */
-    };
-
-struct pscmGfx *pscmOpen(int width, int height, char *file);
-/* Return new pscmGfx. */
-
-void pscmClose(struct pscmGfx **ppscm);
-/* Finish writing out and free structure. */
-
-void pscmSetClip(struct pscmGfx *pscm, int x, int y, int width, int height);
-/* Set clipping rectangle. */
-
-void pscmUnclip(struct pscmGfx *pscm);
-/* Set clipping rect cover full thing. */
-
-int pscmFindColorIx(struct pscmGfx *pscm, int r, int g, int b);
-/* Find color index for rgb. */
-
-void pscmSetColor(struct pscmGfx *pscm, Color color);
-/* Set current color to Color. */
-
-void pscmBox(struct pscmGfx *pscm, int x, int y, 
-	int width, int height, int colorIx);
-/* Draw a box. */
-
-void pscmLine(struct pscmGfx *pscm, 
-	int x1, int y1, int x2, int y2, int colorIx);
-/* Draw a line from one point to another. */
-
-void pscmText(struct pscmGfx *pscm, int x, int y, int colorIx, 
-	MgFont *font, char *text);
-/* Draw a line of text with upper left corner x,y. */
-
-void pscmTextRight(struct pscmGfx *pscm, int x, int y, int width, int height,
-	int color, MgFont *font, char *text);
-/* Draw a line of text right justified in box defined by x/y/width/height */
-
-void pscmTextCentered(struct pscmGfx *pscm, int x, int y, 
-	int width, int height, int color, MgFont *font, char *text);
-/* Draw a line of text centered in box defined by x/y/width/height */
-
-#endif /* PSCMGFX_H */
diff --git a/gbtools/src/include/blatSrc/psl.h b/gbtools/src/include/blatSrc/psl.h
deleted file mode 100644
index 0557228..0000000
--- a/gbtools/src/include/blatSrc/psl.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/* psl.h was originally generated by the autoSql program, which also 
- * generated psl.c and psl.sql.  This header links the database and 
- * the RAM representation of objects.   Additional functions were
- * added later. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef PSL_H
-#define PSL_H
-
-#ifndef LOCALMEM_H
-#include "localmem.h"
-#endif 
-
-#ifndef LINEFILE_H
-#include "linefile.h"
-#endif
-
-#ifndef FUZZYFIND_H
-#include "fuzzyFind.h"
-#endif
-
-#ifndef DNASEQ_H
-#include "dnaseq.h"
-#endif
-
-/* Some forward declarations of structures used but not defined here. */
-struct rbTree;
-
-#define PSL_NUM_COLS  21  /* number of columns in a PSL */
-#define PSLX_NUM_COLS 23  /* number of columns in a PSLX */
-
-#define PSL_XA_FORMAT 0x04  /* add XA format columns */
-
-/* options for pslFromAlign */
-#define PSL_IS_SOFTMASK 0x01 /* lower case are mask */
-
-struct psl
-/* Summary info about a patSpace alignment */
-    {
-    struct psl *next;  /* Next in singly linked list. */
-    unsigned match;	/* Number of bases that match that aren't repeats */
-    unsigned misMatch;	/* Number of bases that don't match */
-    unsigned repMatch;	/* Number of bases that match but are part of repeats */
-    unsigned nCount;	/* Number of 'N' bases */
-    unsigned qNumInsert;	/* Number of inserts in query */
-    int qBaseInsert;	/* Number of bases inserted in query */
-    unsigned tNumInsert;	/* Number of inserts in target */
-    int tBaseInsert;	/* Number of bases inserted in target */
-    char strand[3];	/* + or - for strand */
-    char *qName;	/* Query sequence name */
-    unsigned qSize;	/* Query sequence size */
-    int qStart;	/* Alignment start position in query */
-    int qEnd;	/* Alignment end position in query */
-    char *tName;	/* Target sequence name */
-    unsigned tSize;	/* Target sequence size */
-    int tStart;	/* Alignment start position in target */
-    int tEnd;	/* Alignment end position in target */
-    unsigned blockCount;	/* Number of blocks in alignment */
-    unsigned *blockSizes;	/* Size of each block */
-    unsigned *qStarts;	/* Start of each block in query. */
-    unsigned *tStarts;	/* Start of each block in target. */
-
-    char **qSequence;  /* query sequence for each block */
-    char **tSequence;  /* target sequence for each block */
-    };
-
-struct psl *pslxLoad(char **row);
-/* Load a pslx from row fetched with select * from psl
- * from database.  Dispose of this with pslFree(). */
-
-struct psl *pslLoad(char **row);
-/* Load a psl from row fetched with select * from psl
- * from database.  Dispose of this with pslFree(). */
-
-struct psl *pslCommaIn(char **pS, struct psl *ret);
-/* Create a psl out of a comma separated string. 
- * This will fill in ret if non-null, otherwise will
- * return a new psl */
-
-void pslFree(struct psl **pEl);
-/* Free a single dynamically allocated psl such as created
- * with pslLoad(). */
-
-void pslFreeList(struct psl **pList);
-/* Free a list of dynamically allocated psl's */
-
-void pslOutput(struct psl *el, FILE *f, char sep, char lastSep);
-/* Print out psl.  Separate fields with sep. Follow last field with lastSep. */
-
-#define pslTabOut(el,f) pslOutput(el,f,'\t','\n')
-/* Print out psl as a line in a tab-separated file. */
-
-#define pslCommaOut(el,f) pslOutput(el,f,',',',')
-/* Print out psl as a comma separated list including final comma. */
-
-/* ----- end autoSql generated part --------------- */
-
-void pslOutFormat(struct psl *el, FILE *f, char sep, char lastSep);
-/* Print out selected psl values.  Separate fields with sep. Follow last field with lastSep. */
-/* Prints out a better format with bold field headings followed by value */
-/* Requires further upstream work to ensure that only the field headers */
-/* declared here are printed if replacing an existing psl print function*/
-
-struct psl *pslLoadAll(char *fileName);
-/* Load all psl's in file. */
-
-struct psl *pslNext(struct lineFile *lf);
-/* Read next line from file and convert it to psl.  Return
- * NULL at eof. */
-
-struct psl *pslxLoadLm(char **row, struct lm *lm);
-/* Load row into local memory pslx. */
-
-struct psl *pslLoadLm(char **row, struct lm *lm);
-/* Load row into local memory psl. */
-
-void pslWriteHead(FILE *f);
-/* Write head of psl. */
-
-void pslxWriteHead(FILE *f, enum gfType qType, enum gfType tType);
-/* Write head of pslx (extended psl). */
-
-void pslWriteAll(struct psl *pslList, char *fileName, boolean writeHeader);
-/* Write a psl file from list. */
-
-struct lineFile *pslFileOpen(char *fileName);
-/* Read header part of psl and make sure it's right. 
- * Return line file handle to it. */
-
-struct lineFile *pslFileOpenWithMeta(char *fileName, FILE *f);
-/* Read header part of psl and make sure it's right. 
- * Return line file handle to it and send meta data to output file f */
-
-struct lineFile *pslFileOpenWithUniqueMeta(char *fileName, FILE *f);
-/* Read header part of psl and make sure it's right. 
-* Set flag to suppress duplicate header comments.
-* Return line file handle to it. */
-
-void pslxFileOpen(char *fileName, enum gfType *retQueryType, 
-	enum gfType *retTargetType, struct lineFile **retLf);
-/* Read header part of psl and make sure it's right.  Return
- * sequence types and file handle. */
-
-void pslxFileOpenWithMeta(char *fileName, enum gfType *retQueryType, enum gfType *retTargetType, struct lineFile **retLf, FILE *f);
-/* Read header part of psl and make sure it's right.  Return
- * sequence types and file handle and send meta data to output file f */
-
-void pslxFileOpenWithUniqueMeta(char *fileName, enum gfType *retQueryType, enum gfType *retTargetType, struct lineFile **retLf, FILE *f);
-/* Read header part of psl and make sure it's right.  Return
-* sequence types and file handle and send only unique meta data to output f */
-
-int pslCmpQuery(const void *va, const void *vb);
-/* Compare to sort based on query. */
-
-int pslCmpTarget(const void *va, const void *vb);
-/* Compare to sort based on target. */
-
-int pslCmpTargetAndStrand(const void *va, const void *vb);
-/* Compare to sort based on target, strand,  tStart. */
-
-int pslCmpScore(const void *va, const void *vb);
-/* Compare to sort based on score (descending). */
-
-int pslCmpQueryScore(const void *va, const void *vb);
-/* Compare to sort based on query then score (descending). */
-
-int pslCalcMilliBad(struct psl *psl, boolean isMrna);
-/* Calculate badness in parts per thousand. */
-
-int pslCmpScoreDesc(const void *va, const void *vb);
-/* Compare to sort based on score descending. */
-
-int pslCmpMatch(const void *va, const void *vb);
-/* Compare to sort based on match. */
-
-int pslScore(const struct psl *psl);
-/* Return score for psl. */
-
-struct ffAli *pslToFfAli(struct psl *psl, struct dnaSeq *query, struct dnaSeq *target,
-	int targetOffset);
-/* Convert from psl to ffAli format. */
-
-struct ffAli *pslToFakeFfAli(struct psl *psl, DNA *needle, DNA *haystack);
-/* Convert from psl to ffAli format.  In some cases you can pass NULL
- * for needle and haystack - depending what the post-processing is going
- * to be. */
-
-struct psl *pslFromFakeFfAli(struct ffAli *ff, 
-	DNA *needle, DNA *haystack, char strand,
-	char *qName, int qSize, char *tName, int tSize);
-/* This will create a basic psl structure from a sorted series of ffAli
- * blocks.  The fields that would need actual sequence to be filled in
- * are left zero however - fields including match, repMatch, mismatch. */
-
-int pslOrientation(struct psl *psl);
-/* Translate psl strand + or - to orientation +1 or -1 */
-
-/* marcos to get query and target strand.  Target returns implied + when
- * it's not specific  */
-#define pslQStrand(p) ((p)->strand[0])
-#define pslTStrand(p) (((p)->strand[1] != '-') ? '+' : '-')
-
-int pslWeightedIntronOrientation(struct psl *psl, struct dnaSeq *genoSeq, int offset);
-/* Return >0 if introns make it look like alignment is on + strand,
- *        <0 if introns make it look like alignment is on - strand,
- *        0 if can't tell.  The absolute value of the return indicates
- * how many splice sites we've seen supporting the orientation.
- * Sequence should NOT be reverse complemented.  */
-
-int pslIntronOrientation(struct psl *psl, struct dnaSeq *genoSeq, int offset);
-/* Return 1 if introns make it look like alignment is on + strand,
- *       -1 if introns make it look like alignment is on - strand,
- *        0 if can't tell.
- * Sequence should NOT be reverse complemented.  */
-
-boolean pslHasIntron(struct psl *psl, struct dnaSeq *seq, int seqOffset);
-/* Return TRUE if there's a probable intron. Sequence should NOT be
- * reverse complemented. */
-
-void pslTailSizes(struct psl *psl, int *retStartTail, int *retEndTail);
-/* Find the length of "tails" (rather than extensions) implied by psl. */
-
-void pslRc(struct psl *psl);
-/* Reverse-complement a PSL alignment.  This makes the target strand explicit. */
-
-void pslSwap(struct psl *psl, boolean noRc);
-/* swap query and target in psl.  If noRc is TRUE, don't reverse-complement
- * PSL if needed, instead make target strand explict. */
-
-void pslTargetOffset(struct psl *psl, int offset);
-/* Add offset to target positions in psl. */
-
-void pslDump(struct psl *psl, FILE *f);
-/* Dump most of PSL to file - for debugging. */
-
-struct psl *pslTrimToTargetRange(struct psl *oldPsl, int tMin, int tMax);
-/* Return psl trimmed to fit inside tMin/tMax.  Note this does not
- * update the match/misMatch and related fields. */
-
-struct psl *pslTrimToQueryRange(struct psl *oldPsl, int qMin, int qMax);
-/* Return psl trimmed to fit inside qMin/qMax.  Note this does not
- * update the match/misMatch and related fields. */
-
-int pslCheck(char *pslDesc, FILE* out, struct psl* psl);
-/* Validate a PSL for consistency.  pslDesc is printed the error messages
- * to file out (open /dev/null to discard). Return count of errors. */
-
-int pslCountBlocks(struct psl *target, struct psl *query, int maxBlockGap);
-/* count the number of blocks in the query that overlap the target */
-/* merge blocks that are closer than maxBlockGap */
-
-struct hash *readPslToBinKeeper(char *sizeFileName, char *pslFileName);
-/* read a list of psls and return results in hash of binKeeper structure for fast query*/
-
-boolean pslIsProtein(const struct psl *psl);
-/* is psl a protein psl (are it's blockSizes and scores in protein space) */
-
-struct psl* pslFromAlign(char *qName, int qSize, int qStart, int qEnd, char *qString,
-                         char *tName, int tSize, int tStart, int tEnd, char *tString,
-                         char* strand, unsigned options);
-/* Create a PSL from an alignment.  Options PSL_IS_SOFTMASK if lower case
- * bases indicate repeat masking.  Returns NULL if alignment is empty after
- * triming leading and trailing indels.*/
-
-int pslShowAlignment(struct psl *psl, boolean isProt,
-	char *qName, bioSeq *qSeq, int qStart, int qEnd,
-	char *tName, bioSeq *tSeq, int tStart, int tEnd, FILE *f);
-/* Show protein/DNA alignment or translated DNA alignment in HTML format. */
-
-int pslGenoShowAlignment(struct psl *psl, boolean isProt,
-		      char *qName, bioSeq *qSeq, int qStart, int qEnd,
-		      char *tName, bioSeq *tSeq, int tStart, int tEnd, int exnStarts[], int exnEnds[], int exnCnt, FILE *f);
-/* Show protein/DNA alignment or translated DNA alignment in HTML format. */
-
-struct psl* pslNew(char *qName, unsigned qSize, int qStart, int qEnd,
-                   char *tName, unsigned tSize, int tStart, int tEnd,
-                   char *strand, unsigned blockSpace, unsigned opts);
-/* create a new psl with space for the specified number of blocks allocated.
- * pslGrow maybe used to expand this space if needed.  Valid options are
- * PSL_XA_FORMAT. */
-
-void pslGrow(struct psl *psl, int *blockSpacePtr);
-/* Increase memory allocated to a psl to hold more blocks.  blockSpacePtr
- * should point the the current maximum number of blocks and will be
- * updated to with the new amount of space. */
-
-struct psl* pslFromGff3Cigar(char *qName, int qSize, int qStart, int qEnd,
-                             char *tName, int tSize, int tStart, int tEnd,
-                             char* strand, char *cigar);
-/* create a PSL from a GFF3-style cigar formatted alignment */
-
-int pslRangeTreeOverlap(struct psl *psl, struct rbTree *rangeTree);
-/* Return amount that psl overlaps (on target side) with rangeTree. */
-
-float pslIdent(struct psl *psl);
-/* computer fraction identity */
-
-float pslQueryAligned(struct psl *psl);
-/* compute fraction of query that was aligned */
-
-INLINE unsigned pslQEnd(struct psl *psl, int blkIdx)
-/* return query end for the given block */
-{
-return psl->qStarts[blkIdx] + psl->blockSizes[blkIdx];
-}
-
-INLINE unsigned pslTEnd(struct psl *psl, int blkIdx)
-/* return target end for the given block */
-{
-return psl->tStarts[blkIdx] + psl->blockSizes[blkIdx];
-}
-
-#endif /* PSL_H */
-
diff --git a/gbtools/src/include/blatSrc/pslTbl.h b/gbtools/src/include/blatSrc/pslTbl.h
deleted file mode 100644
index b1d1b7f..0000000
--- a/gbtools/src/include/blatSrc/pslTbl.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* table of psl alignments, grouped by query */
-#ifndef PSLTBL_H
-#define PSLTBL_H
-
-struct psl;
-struct hash;
-
-struct pslQuery
-/* object containing PSLs for a single query */
-{
-    struct pslQuery *next;
-    char *qName;          /* qName, memory not owned here */
-    struct psl *psls;     /* alignments */
-};
-
-struct pslTbl
-/* table of psl alignments */
-{
-    struct pslTbl *next;               /* next psl table in a list */
-    char *setName;                     /* name identifying the set of psl.
-                                        * maybe file name, or  other name */
-    struct hash *queryHash;            /* hash of pslQuery objects */
-};
-
-struct pslTbl *pslTblNew(char *pslFile, char *setName);
-/* construct a new object, loading the psl file.  If setName is NULL, the file
-* name is saved as the set name. */
-
-void pslTblFree(struct pslTbl **pslTblPtr);
-/* free object */
-
-void pslTblFreeList(struct pslTbl **pslTblList);
-/* free list of pslTbls */
-
-#endif
-
-/*
- * Local Variables:
- * c-file-style: "jkent-c"
- * End:
- */
-
diff --git a/gbtools/src/include/blatSrc/pslTransMap.h b/gbtools/src/include/blatSrc/pslTransMap.h
deleted file mode 100644
index 0f53035..0000000
--- a/gbtools/src/include/blatSrc/pslTransMap.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* pslTransMap - transitive mapping of an alignment another sequence, via a
- * common alignment */
-#ifndef PSLTRANSMAP_H
-#define PSLTRANSMAP_H
-
-enum pslTransMapOpts
-/* option set for pslTransMap */
-{
-    pslTransMapNoOpts     = 0x00,  /* no options */
-    pslTransMapKeepTrans  = 0x01   /* keep translated alignment strand */
-};
-
-struct psl* pslTransMap(unsigned opts, struct psl *inPsl, struct psl *mapPsl);
-/* map a psl via a mapping psl, a single psl is returned, or NULL if it
- * couldn't be mapped. */
-
-#endif
diff --git a/gbtools/src/include/blatSrc/pthreadDoList.h b/gbtools/src/include/blatSrc/pthreadDoList.h
deleted file mode 100644
index 57fc16b..0000000
--- a/gbtools/src/include/blatSrc/pthreadDoList.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* pthreadDoList - do something to all items in list using multiple threads in parallel. */
-
-#ifndef PTHREADDOLIST_H
-#define PTHREADDOLIST_H
-
-/* The general usage of this routine is to make up a singly-linked list of items 
- * with the convention that the first field of the item is the next pointer.
- * Then make a routine that takes a pointer to an item, and optionally a second
- * pointer to a context for data that is constant across the list.  Then call the
- * pthreadDoList routine,  which will return after all items on the list have been
- * processed.  In general the list items will contain output as well as input fields.
- * The routine that works on an item should not alter any variables except for local
- * variables, or output fields for an item.  See below for an example. */
-
-typedef void PthreadListWorker(void *item, void *context);
-/* This gets passed a variable item from list, and a constant context */
-
-void pthreadDoList(int threadCount, void *workList,  PthreadListWorker *worker, void *context);
-/* Work through list with threadCount workers each in own thread. 
- * The worker will be called in parallel with an item from work list and the context
- *       worker(item, context)
- * The context is constant across all threads and items. */
-
-#ifdef EXAMPLE
-
-/* In this example we'll raise each element from 1 to 10 to the 4th power */
-
-struct paraPower
-/* Keep track of a number and it's Nth power in parallel */
-    {
-    struct paraPower *next;
-    double in;	/* Input number */
-    double out;  /* output number */
-    };
-
-void doPowerCalc(void *item, void *context)
-/* This routine does the actual work. */
-{
-struct paraPower *p = item; // Convert item to known type
-double *y = context;        // Convert context to a known type
-p->out = pow(p->in, *y);    // Calculate and save output back in item.
-}
-
-void main()
-{
-/* Make up list of items */
-struct paraPower *list = NULL, *el;
-int i;
-for (i=1; i<=10; ++i)
-    {
-    AllocVar(el);
-    el->in = i;
-    slAddHead(&list, el);
-    }
-
-/* Do parallel 4th powering in 3 threads */
-double context = 4;
-pthreadDoList(3, list, doPowerCalc, &context);
-
-/* Report results */
-for (el = list; el != NULL; el = el->next)
-    printf("%g^%g = %g\n", el->in, context, el->out);
-}
-
-#endif /* EXAMPLE */
-
-#endif /* PTHREADDOLIST_H */
diff --git a/gbtools/src/include/blatSrc/pthreadWrap.h b/gbtools/src/include/blatSrc/pthreadWrap.h
deleted file mode 100644
index 5021bb4..0000000
--- a/gbtools/src/include/blatSrc/pthreadWrap.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* pthreadWrap - error checking wrappers around Posix
- * thread functions.  Most of the errors here are invariably
- * fatal, but shouldn't happen unless the kernal or
- * the program is hosed. */
-
-#ifndef PTHREADWRAP_H
-#define PTHREADWRAP_H
-
-#include <pthread.h>
-
-void pthreadCreate(pthread_t *thread, const pthread_attr_t *attr,
-	void *(*start_routine)(void *), void *arg);
-/* Create a thread or squawk and die. */
-
-boolean pthreadMayCreate(pthread_t *thread, const pthread_attr_t *attr,
-	void *(*start_routine)(void *), void *arg);
-/* Create a thread.  Warn and return FALSE if there is a problem. */
-
-void pthreadMutexInit(pthread_mutex_t *mutex);
-/* Initialize mutex or die trying */
-
-void pthreadMutexDestroy(pthread_mutex_t *mutex);
-/* Free up mutex. */
-
-void pthreadMutexLock(pthread_mutex_t *mutex);
-/* Lock a mutex to gain exclusive access or die trying. */
-
-void pthreadMutexUnlock(pthread_mutex_t *mutex);
-/* Unlock a mutex or die trying. */
-
-void pthreadCondInit(pthread_cond_t *cond);
-/* Initialize pthread conditional. */
-
-void pthreadCondDestroy(pthread_cond_t *cond);
-/* Free up conditional. */
-
-void pthreadCondSignal(pthread_cond_t *cond);
-/* Set conditional signal to wake up a sleeping thread, or
- * die trying. */
-
-void pthreadCondWait(pthread_cond_t *cond, pthread_mutex_t *mutex);
-/* Wait for conditional signal. */
-
-#endif /* PTHREADWRAP_H */
-
diff --git a/gbtools/src/include/blatSrc/qa.h b/gbtools/src/include/blatSrc/qa.h
deleted file mode 100644
index 016db68..0000000
--- a/gbtools/src/include/blatSrc/qa.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* qa - Module to help do testing, especially on html based apps. */
-
-#ifndef QA_H
-#define QA_H
-
-#ifndef HTMLPAGE_H
-#include "htmlPage.h"
-#endif
-
-char *qaStringBetween(char *text, char *startPattern, char *endPattern);
-/* Return text that occurs between startPattern and endPattern,
- * or NULL if no startPattern.  (Will return up to 100 characters
- * after startPattern if there is no endPattern) */
-
-char *qaScanForErrorMessage(char *text);
-/* Scan text for error message.  If one exists then
- * return copy of it.  Else return NULL. */
-
-int qaCountBetween(char *s, char *startPattern, char *endPattern, 
-	char *midPattern);
-
-struct slName *qaRandomSample(char *db, char *table, char *field, int count);
-/* Get random sample from database. */
-
-
-struct qaStatus
-/* Timing and other info about fetching a web page. */
-    {
-    struct qaStatus *next;
-    int milliTime;	/* Time page fetch took. */
-    char *errMessage;	/* Error message if any. */
-    boolean hardError;	/* Crash of some sort. */
-    };
-
-struct qaStatus *qaPageGet(char *url, struct htmlPage **retPage);
-/* Get info on given url, (and return page if retPage non-null). */
-
-struct qaStatus *qaPageFromForm(struct htmlPage *origPage, struct htmlForm *form, 
-	char *buttonName, char *buttonVal, struct htmlPage **retPage);
-/* Get update to form based on pressing a button. */
-
-void qaStatusSoftError(struct qaStatus *qs, char *format, ...);
-/* Add error message for something less than a crash. */
-
-void qaStatusReportOne(FILE *f, struct qaStatus *qs, char *format, ...);
-/* Report status */
-
-struct qaStatistics
-/* Stats on one set of tests. */
-    {
-    struct qaStatistics *next;
-    int testCount;	/* Number of tests. */
-    int softCount;	/* Soft error count. */
-    int hardCount;	/* Hard error count. */
-    long milliTotal;	/* Time tests took. */
-    };
-
-void qaStatisticsAdd(struct qaStatistics *stats, struct qaStatus *qs);
-/* Add test results to totals */
-
-void qaStatisticsReport(struct qaStatistics *stats, char *label, FILE *f);
-/* Write a line of stats to file. */
-
-#endif /* QA_H */
-
diff --git a/gbtools/src/include/blatSrc/quickHeap.h b/gbtools/src/include/blatSrc/quickHeap.h
deleted file mode 100644
index 8dfdb9b..0000000
--- a/gbtools/src/include/blatSrc/quickHeap.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* quickHeap - Heap implemented as an array for speed.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial.
- *
- *    The array can be resized as it grows.
- *  By preserving the relationship that the children of n are at 2n+1 and 2n+2,
- *  and therefore the parent of n is at (n-1)/2, we can save alot of pointer
- *  manipulation and get some speed.  
- *    This routine could for instance be used at the heart of a multi-way mergesort
- *  or other situation such as a priority queue.
- *
- */
-
-struct quickHeap 
-/* A quick array heap. */
-    {
-    void **heap;
-    int heapCount;
-    int heapMax;
-    int (*compareFunc)(const void *elem1, const void *elem2);
-    };
-
-struct quickHeap *newQuickHeap(int initSize, 
-   int (*compare )(const void *elem1,  const void *elem2));
-/* Create a new array quick heap of initial size specified,
- * The compare function must return > 0 if elem1 > elem2, etc.*/
-
-void freeQuickHeap(struct quickHeap **pH);
-/* Heap needs more space, double the size of the array preserving elements */
-
-void addToQuickHeap(struct quickHeap *h, void *elem);
-/* add to heap at end (expands array if needed), rebalance */
-
-void quickHeapTopChanged(struct quickHeap *h);
-/* only the value of the top element has changed, now rebalance */
-
-boolean quickHeapEmpty(struct quickHeap *h);
-/* return TRUE if quick heap is empty, otherwise FALSE */
-
-boolean removeFromQuickHeapByElem(struct quickHeap *h, void *elem);
-/* Do a linear search in heap array for elem,
- * then remove it by position n. Return TRUE
- * if found and removed, otherwise return FALSE. */
-
-void *peekQuickHeapTop(struct quickHeap *h);
-/* return the top element or NULL if empty */
-
-void *removeQuickHeapTop(struct quickHeap *h);
-/* Return elem (pointer) in heap array[0]
- * which will be NULL if heap is empty.
- * Then that top element if found is removed. */
-
diff --git a/gbtools/src/include/blatSrc/quotedP.h b/gbtools/src/include/blatSrc/quotedP.h
deleted file mode 100644
index f483a33..0000000
--- a/gbtools/src/include/blatSrc/quotedP.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Quoted Printable encoding and decoding.
- * by Galt Barber */
-
-#ifndef QUOTEDP_H
-#define QUOTEDP_H
-
-char *quotedPrintableEncode(char *input);
-/* Use Quoted-Printable standard to encode a string.
- */
-
-boolean quotedPCollapse(char *line);
-/* Use Quoted-Printable standard to decode a string.
- * Return true if the line does not end in '='
- * which indicate continuation. */
-
-char *quotedPrintableDecode(char *input);
-/* Use Quoted-Printable standard to decode a string.  Return decoded
- * string which will be freeMem'd. */
-
-#endif /* QUOTEDP_H */
-
diff --git a/gbtools/src/include/blatSrc/ra.h b/gbtools/src/include/blatSrc/ra.h
deleted file mode 100644
index 96d38bc..0000000
--- a/gbtools/src/include/blatSrc/ra.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Stuff to parse .ra files. Ra files are simple text databases.
- * The database is broken into records by blank lines.
- * Each field takes a line.  The name of the field is the first
- * word in the line.  The value of the field is the rest of the line.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef RA_H
-
-struct hash *raNextStanza(struct lineFile *lf);
-// Return a hash containing next record.
-// Will ignore '#' comments and joins continued lines (ending in '\').
-// Returns NULL at end of file.  freeHash this when done.
-// Note this will free the hash keys and values as well,
-// so you'll have to cloneMem them if you want them for later.
-#define raNextRecord(lf)  raNextStanza(lf)
-
-struct slPair *raNextStanzAsPairs(struct lineFile *lf);
-// Return ra stanza as an slPair list instead of a hash.  Handy to preserve the
-// order.  Will ignore '#' comments and joins continued lines (ending in '\').
-#define raNextRecordAsSlPairList(lf)  raNextStanzAsPairs(lf)
-
-struct slPair *raNextStanzaLinesAndUntouched(struct lineFile *lf);
-// Return list of lines starting from current position, up through last line of next stanza.
-// May return a few blank/comment lines at end with no real stanza.
-// Will join continuation lines, allocating memory as needed.
-// returns pairs with name=joined line and if joined,
-// val will contain raw lines '\'s and linefeeds, else val will be NULL.
-
-boolean raSkipLeadingEmptyLines(struct lineFile *lf, struct dyString *dy);
-/* Skip leading empty lines and comments.  Returns FALSE at end of file.
- * Together with raNextTagVal you can construct your own raNextRecord....
- * If dy parameter is non-null, then the text parsed gets placed into dy. */
-
-boolean raNextTagVal(struct lineFile *lf, char **retTag, char **retVal, struct dyString  *dy);
-// Read next line.  Return FALSE at end of file or blank line.  Otherwise fill in
-// *retTag and *retVal and return TRUE.  If dy parameter is non-null, then the text parsed
-// gets appended to dy. Continuation lines in RA file will be joined to produce tag and val,
-// but dy will be filled with the unedited multiple lines containing the continuation chars.
-
-struct hash *raFromString(char *string);
-/* Return hash of key/value pairs from string.
- * As above freeHash this when done. */
-
-boolean raFoldInOne(struct lineFile *lf, struct hash *hashOfHash);
-/* Fold in one record from ra file into hashOfHash.
- * This will add ra's and ra fields to whatever already
- * exists in the hashOfHash,  overriding fields of the
- * same name if they exist already. */
-
-void raFoldIn(char *fileName, struct hash *hashOfHash);
-/* Read ra's in file name and fold them into hashOfHash.
- * This will add ra's and ra fields to whatever already
- * exists in the hashOfHash,  overriding fields of the
- * same name if they exist already. */
-
-struct hash *raReadSingle(char *fileName);
-/* Read in first ra record in file and return as hash. */
-
-struct hash *raReadAll(char *fileName, char *keyField);
-/* Return hash that contains all ra records in file keyed
- * by given field, which must exist.  The values of the
- * hash are themselves hashes. */
-
-struct hash *raReadWithFilter(char *fileName, char *keyField,char *filterKey,char *filterValue);
-/* Return hash that contains all filtered ra records in file keyed by given field, which must exist.
- * The values of the hash are themselves hashes.  The filter is a key/value pair that must exist.
- * Example raReadWithFilter(file,"term","type","antibody"): returns hash of hashes of every term with type=antibody */
-
-struct hash *raReadThreeLevels(char *fileName, char *lowKeyField, char *middleKeyField);
-/* Return 3 level hash that contains all ra records in file keyed by lowKeyField, which must exist.
- * and broken into sub hashes based upon middleKeyField that must exist.
- * Example raReadThreeLevels("cv.ra","term","type"):
- *         returns hash of 'type' hashes of 'term' hashes of every stanza in cv.ra */
-
-struct hash *raTagVals(char *fileName, char *tag);
-/* Return a hash of all values of given tag seen in any stanza of ra file. */
-
-#endif /* RA_H */
-
diff --git a/gbtools/src/include/blatSrc/raToStruct.h b/gbtools/src/include/blatSrc/raToStruct.h
deleted file mode 100644
index 48e3347..0000000
--- a/gbtools/src/include/blatSrc/raToStruct.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* raToStruct - stuff to help read ra files into C structures.  Works with raToStructGen
- * which makes parsers based on .as files. */
-
-#ifndef RATOSTRUCT_H
-
-struct raToStructReader
-/* Something to help us parse RAs into C structures. */
-    {
-    struct raToStructReader *next;
-    char *name;		      /* Name of structure */
-    int fieldCount;	      /* Number of fields. */
-    char **fields;	      /* Names of all fields - not allocated here. */
-    char **requiredFields;    /* Names of required fields - not allocated here */
-    int requiredFieldCount;   /* Count of required fields. */
-    struct hash *fieldIds;    /* So we can do hashLookup/switch instead of strcmp chain */
-    int *requiredFieldIds;    /* An array of IDs of required fields. */
-    bool *fieldsObserved;  /* An entry for each field we've observed. */
-    };
-
-struct raToStructReader *raToStructReaderNew(char *name,  int fieldCount, char **fields,  
-    int requiredFieldCount, char **requiredFields);
-/* Create a helper object for parsing an ra file into a C structure. */
-
-void raToStructReaderFree(struct raToStructReader **pReader);
-/* Free up memory associated with reader. */
-
-void raToStructReaderCheckRequiredFields(struct raToStructReader *reader, struct lineFile *lf);
-/* Make sure that all required files have been seen in the stanza we just parsed. */
-
-void raToStructArraySignedSizer(struct lineFile *lf, int curSize, int *pSize, char *fieldName);
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-
-void raToStructArrayUnsignedSizer(struct lineFile *lf, unsigned curSize, 
-    unsigned *pSize, char *fieldName);
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-
-void raToStructArrayShortSizer(struct lineFile *lf, short curSize, 
-    short *pSize, char *fieldName);
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-
-void raToStructArrayUshortSizer(struct lineFile *lf, unsigned short curSize, 
-    unsigned short *pSize, char *fieldName);
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-
-void raToStructArrayByteSizer(struct lineFile *lf, signed char curSize, 
-    signed char *pSize, char *fieldName);
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-
-void raToStructArrayUbyteSizer(struct lineFile *lf, unsigned char curSize, 
-    unsigned char *pSize, char *fieldName);
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-
-void raToStructArrayLongLongSizer(struct lineFile *lf, long long curSize, 
-    long long *pSize, char *fieldName);
-/* If *pSize is zero,  set it to curSize,  othersize check that it is the same as curSize.
- * The lf and fieldName are for error reporting. */
-
-#endif /* RATOSTRUCT_H */
diff --git a/gbtools/src/include/blatSrc/rainbow.h b/gbtools/src/include/blatSrc/rainbow.h
deleted file mode 100644
index faa080d..0000000
--- a/gbtools/src/include/blatSrc/rainbow.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* rainbow - stuff to generate rainbow colors. */
-
-#ifndef RAINBOW_H
-#define RAINBOW_H
-
-#ifndef MEMGFX_H
-#include "memgfx.h"
-#endif
-
-struct rgbColor saturatedRainbowAtPos(double pos);
-/* Given pos, a number between 0 and 1, return a saturated rainbow rgbColor
- * where 0 maps to red,  0.1 is orange, and 0.9 is violet and 1.0 is back to red */
-
-struct rgbColor lightRainbowAtPos(double pos);
-/* Given pos, a number between 0 and 1, return a lightish rainbow rgbColor
- * where 0 maps to red,  0.1 is orange, and 0.9 is violet and 1.0 is back to red */
-
-struct rgbColor veryLightRainbowAtPos(double pos);
-/* Given pos, a number between 0 and 1, return a light rainbow rgbColor
- * where 0 maps to red,  0.1 is orange, and 0.9 is violet and 1.0 is back to red */
-
-#endif /* RAINBOW_H */
diff --git a/gbtools/src/include/blatSrc/rangeTree.h b/gbtools/src/include/blatSrc/rangeTree.h
deleted file mode 100644
index 7361d02..0000000
--- a/gbtools/src/include/blatSrc/rangeTree.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* rangeTree - This module is a way of keeping track of
- * non-overlapping ranges (half-open intervals). It is
- * based on the self-balancing rbTree code.  Use it in
- * place of a bitmap when the total number of ranges
- * is significantly smaller than the number of bits would
- * be. */
-
-#ifndef RANGETREE_H
-#define RANGETREE_H
-
-#ifndef RBTREE_H
-#include "rbTree.h"
-#endif
-
-struct range
-/* An interval in a list of intervals. */
-    {
-    struct range *next;
-    int start,end;	/* Zero based half open interval. */
-    void *val;		/* Some value associated with range. */
-    };
-
-struct rbTree *rangeTreeNew();
-/* Create a new, empty, rangeTree.  Free with rbFreeTree. */
-
-#define rangeTreeFree(a) rbTreeFree(a)
-/* Free up range tree.  */
-
-int rangeCmp(void *va, void *vb);
-/* Return -1 if a before b,  0 if a and b overlap,
- * and 1 if a after b. */
-
-
-struct range *rangeTreeAddVal(struct rbTree *tree, int start, int end, void *val, void *(*mergeVals)(void *existingVal, void *newVal) );
-/* Add range to tree, merging with existing ranges if need be. 
- * If this is a new range, set the value to this val.
- * If there are existing items for this range, and if mergeVals function is not null, 
- * apply mergeVals to the existing values and this new val, storing the result as the val
- * for this range (see rangeTreeAddValCount() and rangeTreeAddValList() below for examples). */
-
-struct range *rangeTreeAdd(struct rbTree *tree, int start, int end);
-/* Add range to tree, merging with existing ranges if need be. */
-
-struct range *rangeTreeAddValCount(struct rbTree *tree, int start, int end);
-/* Add range to tree, merging with existing ranges if need be. 
- * Set range val to count of elements in the range. Counts are pointers to 
- * ints allocated in tree localmem */
-
-struct range *rangeTreeAddValList(struct rbTree *tree, int start, int end, void *val);
-/* Add range to tree, merging with existing ranges if need be. 
- * Add val to the list of values (if any) in each range.
- * val must be valid argument to slCat (ie, be a struct with a 'next' pointer as its first member) */
-
-void rangeTreeAddToCoverageDepth(struct rbTree *tree, int start, int end);
-/* Add area from start to end to a tree that is being built up to store the
- * depth of coverage.  Recover coverage back out by looking at ptToInt(range->val)
- * on tree elements. */
-
-boolean rangeTreeOverlaps(struct rbTree *tree, int start, int end);
-/* Return TRUE if start-end overlaps anything in tree */
-
-int rangeTreeOverlapSize(struct rbTree *tree, int start, int end);
-/* Return the total size of intersection between interval
- * from start to end, and items in range tree. Sadly not
- * thread-safe.
- * On 32 bit machines be careful not to overflow
- * range of start, end or total size return value. */
-
-int rangeTreeOverlapTotalSize(struct rbTree *tree);
-/* Return the total size of all ranges in range tree.
- * Sadly not thread-safe. 
- * On 32 bit machines be careful not to overflow
- * range of start, end or total size return value. */
-
-struct range *rangeTreeFindEnclosing(struct rbTree *tree, int start, int end);
-/* Find item in range tree that encloses range between start and end 
- * if there is any such item. */
-
-struct range *rangeTreeAllOverlapping(struct rbTree *tree, int start, int end);
-/* Return list of all items in range tree that overlap interval start-end.
- * Do not free this list, it is owned by tree.  However it is only good until
- * next call to rangeTreeFindInRange or rangTreeList. Not thread safe. */
-
-struct range *rangeTreeMaxOverlapping(struct rbTree *tree, int start, int end);
-/* Return item that overlaps most with start-end. Not thread safe.  Trashes list used
- * by rangeTreeAllOverlapping. */
-
-void rangeTreeSumRangeCallback(void *item, void *context);
-/* This is a callback for rbTreeTraverse with context.  It just adds up
- * end-start */
-
-long long rangeTreeSumRanges(struct rbTree *tree);
-/* Return sum of end-start of all items. */
-
-struct range *rangeTreeList(struct rbTree *tree);
-/* Return list of all ranges in tree in order.  Not thread safe. 
- * No need to free this when done, memory is local to tree. */
-
-struct rbTree *rangeTreeNewDetailed(struct lm *lm, struct rbTreeNode *stack[128]);
-/* Allocate rangeTree on an existing local memory & stack.  This is for cases
- * where you want a lot of trees, and don't want the overhead for each one. 
- * Note, to clean these up, just do freez(&rbTree) rather than rbFreeTree(&rbTree). */
-
-#endif /* RANGETREE_H */
-
diff --git a/gbtools/src/include/blatSrc/rbTree.h b/gbtools/src/include/blatSrc/rbTree.h
deleted file mode 100644
index c42c328..0000000
--- a/gbtools/src/include/blatSrc/rbTree.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* rbTree - rbTreeRed-rbTreeBlack Tree - a type of binary tree which 
- * automatically keeps relatively balanced during
- * inserts and deletions.
- *   original author: Shane Saunders
- *   adapted into local conventions: Jim Kent
- */
-#ifndef RBTREE_H
-#define RBTREE_H
-
-typedef enum {rbTreeRed,rbTreeBlack} rbTreeColor;
-
-
-/* Structure type for nodes in the red-black tree. */
-struct rbTreeNode 
-    {
-    struct rbTreeNode *left, *right;		/* Children. */
-    rbTreeColor color;				/* Heart of algorithm. */
-    void *item;					/* Item stored in tree */
-    };
-
-/* Structure type for the red-black tree. */
-struct rbTree 
-    {
-    struct rbTree *next;			/* Next tree in list. */
-    struct rbTreeNode *root;			/* Root of tree */
-    int n;					/* Number of items in tree. */
-    int (* compare)(void *, void *);/* Comparison function */
-    struct rbTreeNode **stack;                  /* Ancestor stack. */
-    struct lm *lm;	                        /* Local memory pool. */
-    struct rbTreeNode *freeList;		/* List of nodes to reuse. */
-    };
-
-struct rbTree *rbTreeNew(int (*compare)(void *, void *));
-/* Allocates space for a red-black tree and returns a pointer
- * to it.  The function compare compares they keys of two items, and returns a
- * negative, zero, or positive integer depending on whether the first item is
- * less than, equal to, or greater than the second. */
-
-void rbTreeFree(struct rbTree **pTree);
-/* Frees space used by the red-black tree pointed to by t. */
-
-void rbTreeFreeList(struct rbTree **pList);
-/* Free up a list of rbTrees. */
-
-struct rbTree *rbTreeNewDetailed(int (*compare)(void *, void *), struct lm *lm, 
-	struct rbTreeNode *stack[128]);
-/* Allocate rbTree on an existing local memory & stack.  This is for cases
- * where you want a lot of trees, and don't want the overhead for each one. 
- * Note, to clean these up, just do freez(&rbTree) rather than rbFreeTree(&rbTree). */
-
-void *rbTreeAdd(struct rbTree *t, void *item);
-/* Inserts an item into the red-black tree pointed to by t,
- * according the the value its key.  The key of an item in the red-black
- * tree must be unique among items in the tree.  If an item with the same key
- * already exists in the tree, a pointer to that item is returned.  Otherwise,
- * NULL is returned, indicating insertion was successful.
- */
-
-void *rbTreeFind(struct rbTree *t, void *item);
-/* Find an item in the red-black tree with the same key as the
- * item pointed to by `item'.  Returns a pointer to the item found, or NULL
- * if no item was found.
- */
-
-void *rbTreeRemove(struct rbTree *t, void *item);
-/* rbTreeRemove() - Delete an item in the red-black tree with the same key as
- * the item pointed to by `item'.  Returns a pointer to the  deleted item,
- * and NULL if no item was found.
- */
-
-void rbTreeTraverseRange(struct rbTree *tree, void *minItem, void *maxItem,
-	void (*doItem)(void *item));
-/* Apply doItem function to all items in tree such that
- * minItem <= item <= maxItem */
-
-struct slRef *rbTreeItemsInRange(struct rbTree *tree, void *minItem, void *maxItem);
-/* Return a sorted list of references to items in tree between range.
- * slFreeList this list when done. */
-
-void rbTreeTraverse(struct rbTree *tree, void (*doItem)(void *item));
-/* Apply doItem function to all items in tree */
-
-void rbTreeTraverseWithContext(struct rbTree *tree, 
-	void (*doItem)(void *item, void *context), void *context);
-/* Traverse tree calling doItem on every item with context pointer passed through to doItem.
- * This often avoids having to declare global or static variables for the doItem callback to use. */
-
-struct slRef *rbTreeItems(struct rbTree *tree);
-/* Return sorted list of items.  slFreeList this when done.*/
-
-void rbTreeDump(struct rbTree *tree, FILE *f, 
-	void (*dumpItem)(void *item, FILE *f));
-/* Dump out rb tree to file, mostly for debugging. */
-
-int rbTreeCmpString(void *a, void *b);	
-/* Set up rbTree so as to work on strings. */
-
-int rbTreeCmpWord(void *a, void *b);	
-/* Set up rbTree so as to work on case-insensitive strings. */
-
-#endif /* RBTREE_H */
-
diff --git a/gbtools/src/include/blatSrc/regexHelper.h b/gbtools/src/include/blatSrc/regexHelper.h
deleted file mode 100644
index 37c5e70..0000000
--- a/gbtools/src/include/blatSrc/regexHelper.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* regexHelper: easy wrappers on POSIX Extended Regular Expressions (man 7 regex, man 3 regex) */
-
-#ifndef REGEXHELPER_H
-#define REGEXHELPER_H
-
-#include "common.h"
-#include <regex.h>
-
-const regex_t *regexCompile(const char *exp, const char *description, int compileFlags);
-/* Compile exp (or die with an informative-as-possible error message).
- * Cache pre-compiled regex's internally (so don't free result after use). */
-
-boolean regexMatch(const char *string, const char *exp);
-/* Return TRUE if string matches regular expression exp (case sensitive). */
-
-boolean regexMatchNoCase(const char *string, const char *exp);
-/* Return TRUE if string matches regular expression exp (case insensitive). */
-
-boolean regexMatchSubstr(const char *string, const char *exp,
-			 regmatch_t substrArr[], size_t substrArrSize);
-/* Return TRUE if string matches regular expression exp (case sensitive);
- * regexec fills in substrArr with substring offsets. */
-
-boolean regexMatchSubstrNoCase(const char *string, const char *exp,
-			       regmatch_t substrArr[], size_t substrArrSize);
-/* Return TRUE if string matches regular expression exp (case insensitive);
- * regexec fills in substrArr with substring offsets. */
-
-#endif // REGEXHELPER_H
diff --git a/gbtools/src/include/blatSrc/repMask.h b/gbtools/src/include/blatSrc/repMask.h
deleted file mode 100644
index 6e25563..0000000
--- a/gbtools/src/include/blatSrc/repMask.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* repMask.h was originally generated by the autoSql program, which also 
- * generated repMask.c and repMask.sql.  This header links the database and the RAM 
- * representation of objects. */
-
-#ifndef REPMASK_H
-#define REPMASK_H
-
-struct repeatMaskOut
-/* Repeat Masker out format */
-    {
-    struct repeatMaskOut *next;  /* Next in singly linked list. */
-    unsigned score;	/* Smith-Waterman score. */
-    float percDiv;	/* Percentage base divergence. */
-    float percDel;	/* Percentage deletions. */
-    float percInc;	/* Percentage inserts. */
-    char *qName;	/* Name of query. */
-    int qStart;	/* Start query position. */
-    int qEnd;	/* End query position. */
-    char *qLeft;	/* Bases left in query. */
-    char strand[2];	/* Query strand (+ or C) */
-    char *rName;	/* Repeat name */
-    char *rFamily;	/* Repeat name */
-    char *rStart;	/* Start position in repeat. */
-    unsigned rEnd;	/* End position in repeat. */
-    char *rLeft;	/* Bases left in repeat. */
-    };
-
-void repeatMaskOutStaticLoad(char **row, struct repeatMaskOut *ret);
-/* Load a row from repeatMaskOut table into ret.  The contents of ret will
- * be replaced at the next call to this function. */
-
-struct repeatMaskOut *repeatMaskOutLoad(char **row);
-/* Load a repeatMaskOut from row fetched with select * from repeatMaskOut
- * from database.  Dispose of this with repeatMaskOutFree(). */
-
-struct repeatMaskOut *repeatMaskOutCommaIn(char **pS);
-/* Create a repeatMaskOut out of a comma separated string. */
-
-void repeatMaskOutFree(struct repeatMaskOut **pEl);
-/* Free a single dynamically allocated repeatMaskOut such as created
- * with repeatMaskOutLoad(). */
-
-void repeatMaskOutFreeList(struct repeatMaskOut **pList);
-/* Free a list of dynamically allocated repeatMaskOut's */
-
-void repeatMaskOutOutput(struct repeatMaskOut *el, FILE *f, char sep, char lastSep);
-/* Print out repeatMaskOut.  Separate fields with sep. Follow last field with lastSep. */
-
-#define repeatMaskOutTabOut(el,f) repeatMaskOutOutput(el,f,'\t','\n');
-/* Print out repeatMaskOut as a line in a tab-separated file. */
-
-#define repeatMaskOutCommaOut(el,f) repeatMaskOutOutput(el,f,',',',');
-/* Print out repeatMaskOut as a comma separated list including final comma. */
-
-#endif /* REPMASK_H */
-
diff --git a/gbtools/src/include/blatSrc/rle.h b/gbtools/src/include/blatSrc/rle.h
deleted file mode 100644
index 7a08188..0000000
--- a/gbtools/src/include/blatSrc/rle.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* rle - byte oriented run length encoding. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef RLE_H
-#define RLE_H
-
-int rleCompress(void *in, int inSize, signed char *out);
-/* Compress in to out.  Out should be at least inSize * 1.5. 
- * Returns compressed size. */
-
-void rleUncompress(signed char *in, int inSize, void *out, int outSize);
-/* Uncompress in to out. */
-
-#endif /* RLE_H */
diff --git a/gbtools/src/include/blatSrc/rnautil.h b/gbtools/src/include/blatSrc/rnautil.h
deleted file mode 100644
index 4905edb..0000000
--- a/gbtools/src/include/blatSrc/rnautil.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* rnautil.h - functions for dealing with RNA and RNA secondary structure.  */
-#ifndef RNAUTIL_H
-#define RNAUTIL_H
-
-#ifndef COMMON_H
-#include "common.h"
-#endif
-
-extern const char *RNA_PAIRS[];
-/* Null terminated array of rna pairs */
-
-void dna2rna(char *s);
-/* Replace 't' with 'u' and 'T' with 'U'. */
-
-bool rnaPair(char a, char b);
-/* Returns TRUE if a and b can pair, and false otherwise */
-
-void reverseFold(char *s);
-/* Reverse the order of the parenthesis defining an RNA secondary structure annotation. */
-
-void fold2pairingList(char *fold, int len, int **p2pairList);
-/* take a parenthesis string, allocate and return an array of pairing
-   positions: pairList[i] = j <=> i pair with j and pairList[i] = -1
-   <=> i does not pair.*/
-
-void mkPairPartnerSymbols(int * pairList, char * pairSymbols, int size);
-/* Make a symbol string indicating pairing partner */
-
-char * projectString(char * s, char * ref, char refChar, char insertChar);
-/* Insert 'insertChar' in 's' at every positin 'ref' has 'refChar'. */
-
-char * gapAdjustFold(char * s, char * ref);
-/* Insert space in s when there is a gap ('-') in ref. */
-
-int * projectIntArray(int * in, char * ref, char refChar, int insertInt);
-/* Insert 'insertChar' in 's' at every positin 'ref' has 'refChar'. */
-
-int * gapIntArrayAdjust(int * in, char * ref);
-/* Insert space in s when there is a gap ('-') in ref. */
-
-void markCompensatoryMutations(char *s, char *ref, int * pairList, int *markList);
-/* Compares s to ref and pairList and sets values in markList
- * according to pairing properties. The value of markList[i] specifies
- * the pairing property of the i'th position. The following values are
- * used: -1: default; 0: ref[i] = s[i] and both compatible with
- * pairList, 1: ref[i] != s[i] and both compatible with pairList; 2:
- * s[i] not compatible with pairList;
- */
-
-int assignBin(double val, double minVal, double maxVal, int binCount);
-/* Divide range given by minVal and maxVal into maxBin+1 intervals
-   (bins), and return index of the bin val falls into. */
-
-#endif /* RNAUTIL_H */
-
diff --git a/gbtools/src/include/blatSrc/rql.h b/gbtools/src/include/blatSrc/rql.h
deleted file mode 100644
index 8dd934f..0000000
--- a/gbtools/src/include/blatSrc/rql.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* rql.h - interface to RQL (Ra Query Language - similar in syntax to SQL) parser and
- * interpreter. */
-
-#ifndef RQL_H
-#define RQL_H
-
-#ifndef TOKENIZER_H
-#include "tokenizer.h"
-#endif
-
-enum rqlOp
-/* An operation in the parse tree. */
-    {
-    rqlOpUnknown,	/* Should not occur */
-    rqlOpLiteral,        /* Literal string or number. */
-    rqlOpSymbol,	/* A symbol name. */
-
-    /* Type casts. */
-    rqlOpStringToBoolean,	
-    rqlOpIntToBoolean,
-    rqlOpDoubleToBoolean,
-    rqlOpStringToInt,
-    rqlOpDoubleToInt,
-    rqlOpBooleanToInt,
-    rqlOpStringToDouble,
-    rqlOpBooleanToDouble,
-    rqlOpIntToDouble,
-
-    /* Comparisons. */
-    rqlOpEq,	/* An equals comparison */
-    rqlOpNe,	/* A not equals comparison */
-    rqlOpGt,  /* Greater than comparison. */
-    rqlOpLt,  /* Less than comparison. */
-    rqlOpGe,  /* Greater than or equals comparison. */
-    rqlOpLe,  /* Less than or equals comparison. */
-    rqlOpLike, /* SQL wildcard compare. */
-
-    /* Logic ops. */
-    rqlOpAnd,     /* An and */
-    rqlOpOr,      /* An or */
-    rqlOpNot,	  /* A unary not. */
-
-    /* Leading minus. */
-    rqlOpUnaryMinusInt,
-    rqlOpUnaryMinusDouble,
-
-    /* Fancy ops to fetch sub-parts. */
-    rqlOpArrayIx,	/* An array with an index. */
-    };
-
-char *rqlOpToString(enum rqlOp op);
-/* Return string representation of parse op. */
-
-enum rqlType
-/* A type */
-    {
-    rqlTypeBoolean = 1,
-    rqlTypeString = 2,
-    rqlTypeInt = 3,
-    rqlTypeDouble = 4,
-    };
-
-union rqlVal
-/* Some value of arbirary type that can be of any type corresponding to rqlType */
-    {
-    boolean b;
-    char *s;
-    int i;
-    double x;
-    };
-
-struct rqlEval
-/* Result of evaluation of parse tree. */
-    {
-    enum rqlType type;
-    union rqlVal val;
-    };
-
-struct rqlParse
-/* A rql parse-tree. */
-    {
-    struct rqlParse *next;	/* Points to younger sibling if any. */
-    struct rqlParse *children;	/* Points to oldest child if any. */
-    enum rqlOp op;		/* Operation at this node. */
-    enum rqlType type;		/* Return type of this operation. */
-    union rqlVal val;		/* Return value of this operation. */
-    };
-
-struct rqlStatement
-/* A parsed out RQL statement */
-    {
-    char *next;		/* Next in list */
-    char *command;	/* Generally the first word in the statement. */
-    struct slName *fieldList;	/* List of fields if any. */
-    struct slName *tableList;	/* List of tables if any. */
-    struct rqlParse *whereClause;	/* Where clause if any - in parse tree. */
-    struct slName *whereVarList;	/* List of variables used in where clause. */
-    int limit;		/* If >= 0 then limits # of records returned. */
-    };
-
-void rqlValDump(union rqlVal val, enum rqlType type, FILE *f);
-/* Dump out value to file. */
-
-void rqlParseDump(struct rqlParse *p, int depth, FILE *f);
-/* Dump out rqlParse tree and children. */
-
-struct rqlParse *rqlParseExpression(struct tokenizer *tkz);
-/* Parse out a clause, usually a where clause. */
-
-struct rqlStatement *rqlStatementParse(struct lineFile *lf);
-/* Parse an RQL statement out of text */
-
-void rqlStatementFree(struct rqlStatement **pRql);
-/* Free up an rql statement. */
-
-void rqlStatementDump(struct rqlStatement *rql, FILE *f);
-/* Print out statement to file. */
-
-typedef char* (*RqlEvalLookup)(void *record, char *key);
-/* Callback for rqlEvalOnRecord to lookup a variable value. */
-
-struct rqlEval rqlEvalOnRecord(struct rqlParse *p, void *record, RqlEvalLookup lookup,
-	struct lm *lm);
-/* Evaluate parse tree on record, using lm for memory for string operations. */
-
-struct rqlEval rqlEvalCoerceToBoolean(struct rqlEval r);
-/* Return TRUE if it's a nonempty string or a non-zero number. */
-
-#endif /* RQL_H */
-
diff --git a/gbtools/src/include/blatSrc/rudp.h b/gbtools/src/include/blatSrc/rudp.h
deleted file mode 100644
index 6bec32e..0000000
--- a/gbtools/src/include/blatSrc/rudp.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/* rudp - (semi) reliable UDP communication.  This adds an
- * acknowledgement and resend layer on top of UDP. 
- *
- * UDP is a packet based rather than stream based internet communication 
- * protocol. Messages sent by UDP are checked for integrety by the UDP layer, 
- * and discarded if transmission errors are detected.  However packets are
- * not necessarily received in the same order that they are sent,
- * and packets may be duplicated or lost.  
- 
- * Using rudp packets are only very rarely lost, and the sender is 
- * notified if they are.  After rudp there are still duplicate
- * packets that may arrive out of order.  Aside from the duplicates
- * the packets are in order though.
- *
- * For many, perhaps most applications, TCP/IP is a saner choice
- * than UDP or rudp.  If the communication channel is between just 
- * two computers you can pretty much just treat TCP/IP as a fairly
- * reliable pipe.   However if the communication involves many
- * computers sometimes UDP can be a better choice.  It is possible to
- * do broadcast and multicast with UDP but not with TCP/IP.  Also
- * for systems like parasol, where a server may be making and breaking
- * connections rapidly to thousands of computers, TCP paradoxically
- * can end up less reliable than UDP.  Though TCP is relatively 
- * robust when a connection is made,  it can relatively easily fail
- * to make a connection in the first place, and spend quite a long
- * time figuring out that the connection can't be made.  Moreover at
- * the end of each connection TCP goes into a 'TIMED_WAIT' state,  which
- * prevents another connection from coming onto the same port for a
- * time that can be as long as 255 seconds.  Since there are only
- * about 15000 available ports,  this limits TCP/IP to 60 connections
- * per second in some cases.  Generally the system does not handle
- * running out of ports gracefully, and this did occur with the 
- * TCP/IP based version of Parasol.
- *
- * This module puts a thin layer around UDP to make it a little bit more
- * reliable.  Currently the interface is geared towards Parasol rather
- * than broadcast type applications.  This module will try to send
- * a message a limited number of times before giving up.  It puts
- * a small header containing a message ID and timestamp on each message.   
- * This header is echoed back in acknowledgment by the reciever. This
- * echo lets the sender know if it needs to resend the message, and
- * lets it know how long a message takes to get to the destination and
- * back.  It uses this round trip time information to figure out how
- * long to wait between resends. 
- *
- * Much of this code is based on the 'Adding Reliability to a UDP Application
- * section in volume I, chapter 20, section 5, of _UNIX Network Programming_
- * by W. Richard Stevens. */
-
-#ifndef RUDP_H
-#define RUDP_H
-
-#ifndef INTERNET_H
-#include "internet.h"
-#endif
-
-#include "hash.h"
-#include "dlist.h"
-
-struct rudp
-/* A UDP socket and a little bit of stuff to help keep track
- * of how often we should resend unacknowledged messages. */
-    {
-    int socket;		/* The associated UDP socket. */
-    int rttLast;	/* Last round trip time (RTT) for a message/ack in microseconds. */
-    int rttAve;		/* Approximate average of recent RTTs. */
-    int rttVary;	/* Approximate variation of recent RTTs. */
-    int timeOut;	/* Ideal timeout for next receive. */
-    int receiveCount;	/* Number of packets attempted to receive. */
-    int sendCount;	/* Number of packets attempted to send. */
-    int resendCount;	/* Number of resends. */
-    int failCount;	/* Number of failures. */
-    bits32 lastId;	/* Id number of last message sent. */
-    int maxRetries;	/* Maximum number of retries per message. */
-    bits32 lastIdReceived; /* Id number of last message received. */
-    boolean resend;     /* TRUE if the packet is a re-send */
-    int pid;                 /* sender process id - helps filter out duplicate received packets */
-    int connId;              /* sender conn id - helps filter out duplicate received packets */
-    struct hash *recvHash;   /* hash of data received - helps filter out duplicate received packets */
-    struct dlList *recvList; /* list of data received - helps filter out duplicate received packets */
-    int recvCount;           /* number in list clean */
-    };
-
-enum rudpType
-    {
-    rudpAck = 199,	/* Acknowledge message. */
-    rudpData = 200,	/* Message with some data. */
-    };
-
-struct rudpHeader
-/* The header to a rudp message.  */
-    {
-    bits32 id;		/* Message id.  Returned with ack. */
-    bits32 sendSec;	/* Time sent in seconds.  Returned with ack. */
-    bits32 sendMicro;	/* Time sent microseconds. Returned with ack. */
-    bits8 type;		/* One of rudpType above. */
-    bits8 reserved1;	/* Reserved, always zero for now. */
-    bits8 reserved2;	/* Reserved, always zero for now. */
-    bits8 reserved3;	/* Reserved, always zero for now. */
-    int pid;            /* sender process id - helps filter out duplicate received packets */
-    int connId;         /* sender conn id - helps filter out duplicate received packets */
-    };
-
-struct packetSeen
-/* A packet was last seen when? */
-    {
-    char *recvHashKey;          /* hash key */
-    time_t lastChecked;		/* Last time we checked machine in seconds past 1972 */
-    struct dlNode *node;        /* List node of packetSeen. */
-    };
-
-typedef bits32 rudpHost;  /* The IP address (in host order) of another computer. */
-
-#define udpEthMaxSize 1444
-    /* Max data size that will fit into a single ethernet packet after UDP and IP
-     * headers.  Things are faster & more reliable if you stay below this */
-
-#define rudpMaxSize (udpEthMaxSize - sizeof(struct rudpHeader)  )
-
-struct rudp *rudpNew(int socket);
-/* Wrap a rudp around a socket. Call rudpFree when done, or
- * rudpClose if you also want to close(socket). */
-
-void rudpFree(struct rudp **pRu);
-/* Free up rudp.  Note this does *not* close the associated socket. */
-
-struct rudp *rudpOpen();
-/* Open up an unbound rudp.   This is suitable for
- * writing to and for reading responses.  However 
- * you'll want to rudpOpenBound if you want to listen for
- * incoming messages.   Call rudpClose() when done 
- * with this one.  Warns and returns NULL if there is
- * a problem. */
-
-struct rudp *rudpMustOpen();
-/* Open up unbound rudp.  Warn and die if there is a problem. */
-
-struct rudp *rudpOpenBound(struct sockaddr_in *sai);
-/* Open up a rudp socket bound to a particular port and address.
- * Use this rather than rudpOpen if you want to wait for
- * messages at a specific address in a server or the like. */
-
-struct rudp *rudpMustOpenBound(struct sockaddr_in *sai);
-/* Open up a rudp socket bound to a particular port and address
- * or die trying. */
-
-void rudpClose(struct rudp **pRu);
-/* Close socket and free memory. */
-
-int rudpSend(struct rudp *ru, struct sockaddr_in *sai, void *message, int size);
-/* Send message of given size to port at host via rudp.  Prints a warning and
- * sets errno and returns -1 if there's a problem. */
-
-int rudpReceive(struct rudp *ru, void *messageBuf, int bufSize);
-/* Read message into buffer of given size.  Returns actual size read on
- * success. On failure prints a warning, sets errno, and returns -1. */
-
-int rudpReceiveFrom(struct rudp *ru, void *messageBuf, int bufSize, 
-	struct sockaddr_in *retFrom);
-/* Read message into buffer of given size.  Returns actual size read on
- * success. On failure prints a warning, sets errno, and returns -1. 
- * Also returns ip address of message source. */
-
-int rudpReceiveTimeOut(struct rudp *ru, void *messageBuf, int bufSize, 
-	struct sockaddr_in *retFrom, int timeOut);
-/* Like rudpReceive from above, but with a timeOut (in microseconds)
- * parameter.  If timeOut is zero then it will wait forever. */
-
-void rudpPrintStatus(struct rudp *ru);
-/* Print out status info. */
-
-void rudpTest();
-/* Test out rudp stuff. */
-
-#endif /* RUDP_H */
diff --git a/gbtools/src/include/blatSrc/scoreWindow.h b/gbtools/src/include/blatSrc/scoreWindow.h
deleted file mode 100644
index 43fec29..0000000
--- a/gbtools/src/include/blatSrc/scoreWindow.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* scoreWindow - find window with most matches to a given char */
-
-/* simple program to find max scoring window representing string of char c in a string s of size size */
-/* index of max score is returned , match and misMatch are the scores to assign, suggested defaults are match=1 and misMatch=1*/
-/* when used for scoring polyA tails, set c='A' for positive strand  or c='T' for neg strand */
-/* start, end are returned pointing to the start and end of the highest scoring window in s */
-int scoreWindow(char c, char *s, int size, int *score, int *start, int *end, int match, int misMatch);
diff --git a/gbtools/src/include/blatSrc/seg.h b/gbtools/src/include/blatSrc/seg.h
deleted file mode 100644
index 940639c..0000000
--- a/gbtools/src/include/blatSrc/seg.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* seg.h - Segment file format. */
-#ifndef SEG_H
-#define SEG_H
-
-#include "common.h"
-
-struct segComp
-/* A genomic segment. */
-	{
-	struct segComp *next;
-	char *src;		/* Name of segment source. */
-	int start;		/* Start of segment. Zero based. If strand is - it is */
-					/*   relative to source end.*/
-	int size;		/* Size of segment. */
-	char strand;	/* Strand of segment. Either + or -. */
-	int srcSize;	/* Size of segment source. */
-	};
-
-struct segBlock
-/* A list of genomic segments. */
-	{
-	struct segBlock *next;
-	struct segBlock *prev;
-	char *name;					/* Name of this segment list. */
-	int val;					/* Integer value for this segment list. */
-	struct segComp *components;	/* List of segments in this segment list. */
-	};
-
-struct segFile
-/* A file full of genomic segments. */
-	{
-	struct segFile *next;
-	int version;				/* segFile version. */
-	struct segBlock *blocks;	/* Possibly empty list of segment blocks. */
-	struct lineFile *lf;		/* Open lineFile if any. */
-	};
-
-void segCompFree(struct segComp **pObj);
-/* Free up a segment component. */
-
-void segCompFreeList(struct segComp **pList);
-/* Free up a list of segment components. */
-
-void segBlockFree(struct segBlock **pObj);
-/* Free up a segment block. */
-
-void segBlockFreeList(struct segBlock **pList);
-/* Free up a list of segment blocks. */
-
-void segFileFree(struct segFile **pObj);
-/* Free up a segment file including closing file handle if necessary. */
-
-void segFileFreeList(struct segFile **pList);
-/* Free up a list of segment files. */
-
-struct segFile *segMayOpen(char *fileName);
-/* Open up a segment file for reading. Read header and verify. Prepare
- * for subsequent calls to segNext(). Return NULL if file does not exist. */
-
-struct segFile *segOpen(char *fileName);
-/* Like segMayOpen() above, but prints an error message and aborts if
- * there is a problem. */
-
-void segRewind(struct segFile *sf);
-/* Seek to beginning of open segment file */
-
-struct segBlock *segNextWithPos(struct segFile *sf, off_t *retOffset);
-/* Return next segment in segment file or NULL if at end. If retOffset
- * is not NULL, return start offset of record in file. */
-
-struct segBlock *segNext(struct segFile *sf);
-/* Return next segment in segment file or NULL if at end.  This will
- * close the open file handle at the end as well. */
-
-struct segFile *segReadAll(char *fileName);
-/* Read in full segment file */
-
-void segWriteStart(FILE *f);
-/* Write segment file header to the file. */
-
-void segWrite(FILE *f, struct segBlock *block);
-/* Write next segment block to the file. */
-
-void segWriteEnd(FILE *f);
-/* Write segment file end tag to the file. */
-
-struct segComp *segMayFindCompSpecies(struct segBlock *sb, char *src,
-	char sepChar);
-/* Find component with a source that matches src up to and possibly
-   including sepChar. Return NULL if not found. */
-
-struct segComp *segFindCompSpecies(struct segBlock *sb, char *src,
-	char sepChar);
-/* Find component with a source that matches src up to and possibly
-   including sepChar or die trying. */
-
-struct segComp *cloneSegComp(struct segComp *sc);
-/* Return a copy of the argument segment component. */
-
-char *segFirstCompSpecies(struct segBlock *sb, char sepChar);
-/* Return the species possibly followed by sepChar of the first component
-   of the argument block. Return NULL if the block has no components. */
-
-struct slName *segSecSpeciesList(struct segBlock *sb, struct segComp *refComp,
-	char sepChar);
-/* Return a name list containing the species possibly followed by sepChar
-of all components other than refComp on the block. */
-
-#endif /* SEG_H */
diff --git a/gbtools/src/include/blatSrc/seqOut.h b/gbtools/src/include/blatSrc/seqOut.h
deleted file mode 100644
index f3daf29..0000000
--- a/gbtools/src/include/blatSrc/seqOut.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* seqOut - stuff to output sequences and alignments in web 
- * or ascii viewable form. */
-
-
-struct cfm
-/* Colored web character output formatter. */
-    {
-    int wordLen;	/* Number of characters between spaces (often 10) */
-    int lineLen;        /* Number of characters between lines (often 50) */
-    int inWord, inLine; /* Position in word and line. */
-    bool lineNumbers;   /* True if write position at end of line. */
-    bool countDown;     /* True if want numbers counting down. */
-    long charCount;     /* Number of characters written total. */
-    FILE *out;          /* File to write to. */
-    int numOff;         /* Number to start with. */
-    int color;          /* Cache last color here. */
-    bool underline;	/* Underline? */
-    bool bold;		/* Font in bold. */
-    bool italic;	/* Italic? */
-    };
-
-struct cfm *cfmNew(int wordLen, int lineLen, 
-	boolean lineNumbers, boolean countDown, FILE *out, int numOff);
-/* Set up colored sequence formatting for html. */
-
-void cfmOut(struct cfm *cfm, char c, int color);
-/* Write out a byte, and depending on color formatting extras  */
-
-void cfmOutExt(struct cfm *cfm, char c, int color, boolean underline, boolean bold, boolean italic);
-/* Write out a byte, and formatting extras  */
-
-void cfmFree(struct cfm **pCfm);
-/* Finish and free up cfm formatting job. */
-
-enum seqOutColor
-/* Symbolic color for sequence output. */
-    {
-    socBlack = 0,		/* Not aligning. */
-    socBlue = 1,		/* Aligning. */
-    socBrightBlue = 2,		/* End of an aligning block. */
-    socRed = 3, 		/* Aligning UTR. */
-    socOrange = 4,		/* End of an aligning UTR block. */
-    };
-extern int seqOutColorLookup[];		/* Converts these to html format colors. */
-
-struct baf
-/* Block allignment formatter. */
-    {
-    char nChars[256];
-    char hChars[256];
-    int cix;
-    int nLineStart;
-    int hLineStart;
-    int nCurPos;
-    int hCurPos;
-    DNA *needle, *haystack;
-    int nNumOff, hNumOff;
-    FILE *out;
-    int lineSize;
-    bool hCountDown;     /* True if want numbers counting down. */
-    bool isTrans;	 /* True if haystack is translated. */
-    bool nCountDown;	 /* True if want needle numbers counting down. */
-    };
-
-void bafInit(struct baf *baf, DNA *needle, int nNumOff, boolean nCountDown,
-	DNA *haystack, int hNumOff, boolean hCountDown, 
-	FILE *out, int lineSize, boolean isTrans);
-/* Initialize block alignment formatter. */
-
-void bafSetAli(struct baf *baf, struct ffAli *ali);
-/* Set up block formatter around an ffAli block. */
-
-void bafSetPos(struct baf *baf, int nStart, int hStart);
-/* Set up block formatter starting at nStart/hStart. */
-
-void bafStartLine(struct baf *baf);
-/* Set up block formatter to start new line at current position. */
-
-void bafWriteLine(struct baf *baf);
-/* Write out a line of an alignment (which takes up
- * three lines on the screen. */
-
-void bafOut(struct baf *baf, char n, char h);
-/* Write a pair of character to block alignment. */
-
-void bafFlushLineNoHr(struct baf *baf);
-/* Write out alignment line if it has any characters in it (no <HR>). */
-
-void bafFlushLine(struct baf *baf);
-/* Write out alignment line if it has any characters in it, and an <HR>. */
-
diff --git a/gbtools/src/include/blatSrc/seqStats.h b/gbtools/src/include/blatSrc/seqStats.h
deleted file mode 100644
index 427804a..0000000
--- a/gbtools/src/include/blatSrc/seqStats.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* seqStats - some sequence statistics functions that need
- * math libraries. */
-
-#ifndef SEQSTATS_H
-#define SEQSTATS_H
-
-double dnaMatchEntropy(DNA *query, DNA *target, int baseCount);
-/* Return entropy of matching bases - a number between 0 and 1, with
- * higher numbers the more diverse the matching bases. */
-
-#endif /* SEQSTATS_H */
diff --git a/gbtools/src/include/blatSrc/shaRes.h b/gbtools/src/include/blatSrc/shaRes.h
deleted file mode 100644
index 07a1a10..0000000
--- a/gbtools/src/include/blatSrc/shaRes.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Shared Resource file 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef SHARES_H
-#define SHARES_H
-
-struct shaResNode
-/* A shared resource node. */
-    {
-    struct shaResNode *next;
-    struct shaResNode *prev;
-    int links;
-    char *name;
-    struct shaResList *list;
-    void *data;
-    };
-
-struct shaResList
-/* A shared resource list. */
-    {
-    struct shaResNode *head;
-    void (*freeData)(void *pData);
-    };
-
-
-void shaUnlink(struct shaResNode *node);
-/* Decrement link count and free if down to zero. */
-
-void shaLink(struct shaResNode *node);
-/* Increment link count. */
-
-struct shaResNode *shaNewNode(struct shaResList *list, char *name, void *data);
-/* Create a new node with link count of one. */
-
-void shaCleanup(struct shaResList *list);
-/* Free every node on list. */
-
-void shaInit(struct shaResList *list, void (*freeData)(void *pData));
-/* Start up resource list. */
-#endif /* SHARES_H */
-
-
-
diff --git a/gbtools/src/include/blatSrc/sig.h b/gbtools/src/include/blatSrc/sig.h
deleted file mode 100644
index 881cdde..0000000
--- a/gbtools/src/include/blatSrc/sig.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* Sig.h - signatures that start various binary files. */
-#ifndef SIG_H
-#define SIG_H
-
-#define aliSig 0xCDAB8245
-/* Binary alignment file. */
-
-#define alxSig 0xA1B1C1D3
-/* Index into binary alignment file, sorted by start base offset. */
-
-#define pgoSig 0x690
-/* Index into GDF file, sorted by start base offset. Signature is 32 bit. */
-
-#define cdoSig 0xCD01
-/* Index into c2g text file, sorted by start base offset. 32 bit signature. */
-
-#define xaoSig 0xA0B0C0D0
-/* Index into xeno alignment, sorted by start base offset.  32 bit signature. */
-
-#define glSig 0xF1E2D3C4
-/* Binary gene file, sorted by chromosome and then starting offset. */
-
-/* IX sig is int ixSig[4] = {0x693F8ED1, 0x7EDA1C32, 0x4BA58983, 0x277CB89C,};
- * These are made by snofMake, and are indexes sorted by name. */
-
-/* XI - same as IX but on big-endian (or is it little-endian) archetectures. */
-
-#define nt4Signature 0x12345678
-/* Signature at the beginning of an nt4 file - 2 bit a nucleotide binary file. */
-
-#define lm2Signature 0x12131416
-/* Signature at the beginning of a lm2 file - a 2nd order markov model for nucleotides. */
-
-#define oocSig 0x584155f2
-/* Signature of file that contains over-represented oligomers for patSpace
- * algorithm. */
-
-#define oocSigSwapped 0xf2554158
-/* Signature of file that contains over-represented oligomers for patSpace
- * algorithm. */
-
-#define fofSig 0x13410da8
-/* Signature into fof type index file (that can index multiple external files). */
-
-#define nibSig 0x6BE93D3A
-/* Signature into nib file (4 bits per nucleotide DNA file) */
-
-#define qacSig 0x32b67998
-/* Signature of qac file (compressed quality file) */
-
-#define caqSig 0x9879b632
-/* Signature of byte-swapped qac file. */
-
-#define twoBitSig 0x1A412743
-/* Signature into 2bit file (2 bits per nucleotide DNA file) plus
- * information on N and masked bases. */
-
-#define twoBitSwapSig 0x4327411A
-/* Signature of byte-swapped two-bit file. */
-
-#define chromGraphSig 0x4528421C
-/* Signature of chromGraph binary data file */
-
-#define chromGraphSwapSig 0x1C422845
-/* Signature of byte-swapped chromGraph binary data file */
-
-#define genomeRangeTreeSig     0xf7fb8104
-/* Signature of genomeRangeTree binary data file */
-
-#define genomeRangeTreeSwapSig 0x0481fbf7
-/* Signature of genomeRangeTree binary data file */
-
-#define bptSig 0x78CA8C91
-/* Signature of generic b+ tree index file. */
-
-#define bptSwapped 0x918CCA78
-/* Signature of generic b+ tree index file. */
-
-#define cirTreeSig 0x2468ACE0
-/* Signature of a chromosome id r-tree index file. */
-
-#define crTreeSig 0x2369ADE1
-/* Signature of a chromosome r-tree index file. */
-
-#define bigWigSig 0x888FFC26
-/* Signature for a big wig file. */
-
-#define bigBedSig 0x8789F2EB
-/* Signature for a big bed file. */
-
-#define udcBitmapSig 0x4187E2F6
-/* Signature for a url data cache bitmap file. */
-
-#endif /* SIG_H */
-
-
diff --git a/gbtools/src/include/blatSrc/slog.h b/gbtools/src/include/blatSrc/slog.h
deleted file mode 100644
index 5563606..0000000
--- a/gbtools/src/include/blatSrc/slog.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* slog - fixed point scaled logarithm stuff. */
-#ifndef SLOG_H
-#define SLOG_H
-
-extern double fSlogScale;	/* Convert to fixed point by multiplying by this. */
-extern double invSlogScale;	/* To convert back to floating point use this. */
-
-int slog(double val);
-/* Return scaled log. */
-
-int carefulSlog(double val);
-/* Returns scaled log that makes sure there's no int overflow. */
-
-double invSlog(int scaledLog);
-/* Inverse of slog. */
-
-#endif /* SLOG_H */
-
diff --git a/gbtools/src/include/blatSrc/snof.h b/gbtools/src/include/blatSrc/snof.h
deleted file mode 100644
index dfeec55..0000000
--- a/gbtools/src/include/blatSrc/snof.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* snof.h - Sorted Name Offset File - stuff to handle a simple
- * indexed file.
- *
- * This accesses a file of name/offset pairs that are sorted by
- * name.  Does a binary search of file to find the offset given name.
- * Most typically this is used to do a quick lookup given an index file. 
- */ 
-
-struct snof
-/* Sorted Name Offset File structure.  Get one from snofOpen.  Use
- * with snofFindOffset.  Finish up with snofClose. */
-    {
-    FILE *file;
-    int maxNameSize;
-    int itemSize;
-    int headSize;
-    int endIx;
-    char *first;
-    char *last;
-    char *less;
-    char *mid;
-    char *more;
-    };
-
-struct snof *snofOpen(char *indexName);
-/* Open up the index file.  Returns NULL if there's any problem. */
-
-struct snof *snofMustOpen(char *indexName);
-/* Open up index file or die. */
-
-void snofClose(struct snof **pSnof);
-/* Close down the index file. */
-
-int snofElementCount(struct snof *snof);
-/* How many names are in snof file? */
-
-long snofOffsetAtIx(struct snof *snof, int ix);
-/* The offset of a particular index in file. */
-
-char *snofNameAtIx(struct snof *snof, int ix);
-/* The name at a particular index in file.  (This will be overwritten by
- * later calls to snof system. Strdup if you want to keep it.)
- */
-
-void snofNameOffsetAtIx(struct snof *snof, int ix, char **pName, long *pOffset);
-/* Get both name and offset for an index. */
-
-boolean snofFindFirstStartingWith(struct snof *snof, char *prefix, int prefixSize,
-    int *pSnofIx);
-/* Find first index in snof file whose name begins with prefix. */
-
-boolean snofFindOffset(struct snof *snof, char *name, long *pOffset);
-/* Find offset corresponding with name.  Returns FALSE if no such name
- * in the index file. */
-
diff --git a/gbtools/src/include/blatSrc/snofmake.h b/gbtools/src/include/blatSrc/snofmake.h
deleted file mode 100644
index 406d04f..0000000
--- a/gbtools/src/include/blatSrc/snofmake.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-
-boolean snofMakeIndex(FILE *inFile, char *outName, 
-    boolean (*nextRecord)(FILE *inFile, void *data, char **rName, int *rNameLen), 
-    void *data);
-/* Make an index file - name/offset pairs that are sorted by name.
- * Inputs:
- *     inFile - open file that you're indexing with header read and verified.
- *     outName - name of index file to create
- *     nextRecord - function that reads next record in file you're indexing
- *                  and returns the name of that record.  Returns FALSE at
- *                  end of file.  Can set *rNameLen to zero you want indexer
- *                  to ignore the record. 
- *     data - void pointer passed through to nextRecord.
- *
- * Writes diagnostic output to stderr and returns FALSE if there's a problem.
- */
-
-boolean snofDupeOkIndex(FILE *inFile, char *outName, 
-    boolean (*nextRecord)(FILE *inFile, void *data, char **rName, int *rNameLen), 
-    void *data, boolean dupeOk);
-/* Make an index file, as in snofMakeIndex, but optionally allow duplicates
- * without complaining. */
-
-void snofSignature(char **rSig, int *rSigSize);
-/* The get signature that should be at start of a snof indexed 
- * file. */
-
-boolean isSnofSig(void *sig);
-/* Return true if sig is right. */
-
diff --git a/gbtools/src/include/blatSrc/spaceSaver.h b/gbtools/src/include/blatSrc/spaceSaver.h
deleted file mode 100644
index ea23473..0000000
--- a/gbtools/src/include/blatSrc/spaceSaver.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* spaceSaver - routines that help layout 1-D objects into a
- * minimum number of tracks so that no two objects overlap
- * within a single track. */
-#ifndef SPACESAVER_H
-#define SPACESAVER_H
-
-struct spaceSaver
-/* Help layout 1-D objects onto multiple tracks so that
- * no two objects overlap on a single track. */
-    {
-    struct spaceSaver *next;	/* Next in list. */
-    struct spaceNode *nodeList; /* List of things put in space saver. */
-    struct spaceRowTracker *rowList; /* List of rows. */
-    int rowCount;             /* Number of rows. */
-    int winStart,winEnd;      /* Start and end of area we're modeling. */
-    int cellsInRow;           /* Number of cells per row. */
-    double scale;             /* What to scale by to get to cell coordinates. */
-    int maxRows;	      /* Maximum number of rows.  */
-    boolean isFull;	      /* Set to true if can't fit data into maxRows. */
-    };
-
-struct spaceNode
-/* Which row is this one on? */
-    {
-    struct spaceNode *next;	/* Next in list. */
-    int row;			/* Which row, starting at zero. */
-    void *val;
-    };
-
-struct spaceRowTracker 
-/* Keeps track of how much of row is used. */
-    {
-    struct spaceRowTracker *next;	/* Next in list. */
-    bool *used;                 /* A flag for each spot used. */
-    };
-
-struct spaceSaver *spaceSaverMaxCellsNew(int winStart, int winEnd, int maxRows, int maxCells);
-/* Create a new space saver around the given window.   */
-
-struct spaceSaver *spaceSaverNew(int winStart, int winEnd, int maxRows);
-/* Create a new space saver around the given window.   */
-
-void spaceSaverFree(struct spaceSaver **pSs);
-/* Free up a space saver. */
-
-struct spaceNode *spaceSaverAdd(struct spaceSaver *ss, int start, int end, void *val);
-/* Add a new node to space saver. */
-
-
-struct spaceNode *spaceSaverAddOverflow(struct spaceSaver *ss, int start, int end, 
-					void *val, boolean allowOverflow);
-/* Add a new node to space saver. Returns NULL if can't fit item in
- * and allowOverflow == FALSE. If allowOverflow == TRUE then put items
- * that won't fit in first row (ends up being last row after
- * spaceSaverFinish()). */
-
-void spaceSaverFinish(struct spaceSaver *ss);
-/* Tell spaceSaver done adding nodes. */
-#endif /* SPACESAVER_H */
-
diff --git a/gbtools/src/include/blatSrc/spacedColumn.h b/gbtools/src/include/blatSrc/spacedColumn.h
deleted file mode 100644
index f294c0a..0000000
--- a/gbtools/src/include/blatSrc/spacedColumn.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* spacedColumn - stuff to handle parsing text files where fields are
- * fixed width rather than tab delimited. */
-
-#ifndef SPACEDCOLUMN_H
-#define SPACEDCOLUMN_H
-
-struct spacedColumn
-/* Specs on a column. */
-    {
-    struct spacedColumn *next;
-    int start;	/* Starting index. */
-    int size;	/* Size of column. */
-    };
-
-#define spacedColumnFreeList slFreeList
-
-struct spacedColumn *spacedColumnFromWidthArray(int array[], int size);
-/* Return a list of spaced columns corresponding to widths in array.
- * The final char in each column should be whitespace. */
-
-struct spacedColumn *spacedColumnFromSample(char *sample);
-/* Return spaced column list from a sample line , which is assumed to
- * have no spaces except between columns */
-
-struct spacedColumn *spacedColumnFromSizeCommaList(char *commaList);
-/* Given an comma-separated list of widths in ascii, return
- * a list of spacedColumns. */
-
-struct spacedColumn *spacedColumnFromLineFile(struct lineFile *lf);
-/* Scan through lineFile and figure out column spacing. Assumes
- * file contains nothing but columns. */
-
-struct spacedColumn *spacedColumnFromFile(char *fileName);
-/* Read file and figure out where columns are. */
-
-int spacedColumnBiggestSize(struct spacedColumn *colList);
-/* Return size of biggest column. */
-
-boolean spacedColumnParseLine(struct spacedColumn *colList, 
-	char *line, char *row[]);
-/* Parse line into row according to colList.  This will
- * trim leading and trailing spaces. It will write 0's
- * into line.  Returns FALSE if there's a problem (like
- * line too short.) */
-
-#endif /* SPACEDCOLUMN_H */
diff --git a/gbtools/src/include/blatSrc/spacedSeed.h b/gbtools/src/include/blatSrc/spacedSeed.h
deleted file mode 100644
index 8548790..0000000
--- a/gbtools/src/include/blatSrc/spacedSeed.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* spacedSeed - stuff to help with spaced seeds for alignments. */
-
-#ifndef SPACEDSEED_H
-#define SPACEDSEED_H
-
-extern char *spacedSeeds[];
-/* Array of spaced seeds in format with '1' for cares, '0' for don't care. */
-
-int spacedSeedMaxWeight();
-/* Return max weight of spaced seed. */
-
-int *spacedSeedOffsets(int weight);
-/* Return array with offsets for seed of given weight. */
-
-int spacedSeedSpan(int weight);
-/* Return span of seed of given weight */
-
-#endif /*SPACEDSEED_H */
-
diff --git a/gbtools/src/include/blatSrc/splatAli.h b/gbtools/src/include/blatSrc/splatAli.h
deleted file mode 100644
index 002c70b..0000000
--- a/gbtools/src/include/blatSrc/splatAli.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* splatAli.h was originally generated by the autoSql program, which also 
- * generated splatAli.c and splatAli.sql.  This header links the database and
- * the RAM representation of objects. */
-/* This file is copyright 2008 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef SPLATALI_H
-#define SPLATALI_H
-
-#define SPLATALI_NUM_COLS 7
-
-struct splatAli
-/* A parsed out splat format alignment. */
-    {
-    struct splatAli *next;  /* Next in singly linked list. */
-    char *chrom;	/* Chromosome mapped to */
-    int chromStart;	/* Start position in chromosome (zero based) */
-    int chromEnd;	/* End position in genome (one based) */
-    char *alignedBases;	/* Tag bases - in upper case for match, -/^ for insert/delete */
-    int score;	/* Mapping score. 1000/placesMapped */
-    char strand[2];	/* + or - for strand */
-    char *readName;	/* Name of read */
-    };
-
-void splatAliStaticLoad(char **row, struct splatAli *ret);
-/* Load a row from splatAli table into ret.  The contents of ret will
- * be replaced at the next call to this function. */
-
-struct splatAli *splatAliLoad(char **row);
-/* Load a splatAli from row fetched with select * from splatAli
- * from database.  Dispose of this with splatAliFree(). */
-
-struct splatAli *splatAliLoadAll(char *fileName);
-/* Load all splatAli from whitespace-separated file.
- * Dispose of this with splatAliFreeList(). */
-
-struct splatAli *splatAliLoadAllByChar(char *fileName, char chopper);
-/* Load all splatAli from chopper separated file.
- * Dispose of this with splatAliFreeList(). */
-
-#define splatAliLoadAllByTab(a) splatAliLoadAllByChar(a, '\t');
-/* Load all splatAli from tab separated file.
- * Dispose of this with splatAliFreeList(). */
-
-struct splatAli *splatAliCommaIn(char **pS, struct splatAli *ret);
-/* Create a splatAli out of a comma separated string. 
- * This will fill in ret if non-null, otherwise will
- * return a new splatAli */
-
-void splatAliFree(struct splatAli **pEl);
-/* Free a single dynamically allocated splatAli such as created
- * with splatAliLoad(). */
-
-void splatAliFreeList(struct splatAli **pList);
-/* Free a list of dynamically allocated splatAli's */
-
-void splatAliOutput(struct splatAli *el, FILE *f, char sep, char lastSep);
-/* Print out splatAli.  Separate fields with sep. Follow last field with lastSep. */
-
-#define splatAliTabOut(el,f) splatAliOutput(el,f,'\t','\n');
-/* Print out splatAli as a line in a tab-separated file. */
-
-#define splatAliCommaOut(el,f) splatAliOutput(el,f,',',',');
-/* Print out splatAli as a comma separated list including final comma. */
-
-/* -------------------------------- End autoSql Generated Code -------------------------------- */
-
-int splatAliCmpReadName(const void *va, const void *vb);
-/* Compare two based on readName. Also separate secondarily on chrom position. */
-
-int splatAliScore(char *ali);
-/* Score splat-encoded alignment. */
-
-void splatAliLookForBest(struct splatAli *start, struct splatAli *end, 
-	int *retBestScore, int *retBestCount);
-/* Scan through list from start up to but not including end (which may be NULL)
- * and figure out best score and number of elements in list with that score. */
-
-#endif /* SPLATALI_H */
-
diff --git a/gbtools/src/include/blatSrc/splix.h b/gbtools/src/include/blatSrc/splix.h
deleted file mode 100644
index fabd4f0..0000000
--- a/gbtools/src/include/blatSrc/splix.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* splix - splat (speedy local alignment tool)  index.  Index that helps map short reads
- * quickly to the genome. */
-/* This file is copyright 2008 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef SPLIX_H
-#define SPLIX_H
-
-struct splixFileHeader
-/* Short read index file binary file header.  A splix file starts with this fixed 128 byte
- * structure.  It is followed by the following sections:
- *    chromosome name strings - zero terminated
- *    chromosome sizes (32 bits each)
- *    chromosome DNA - one byte per base lower case.  A zero between each chrom.
- *    indexSlotSizes (4^^12 32 bit words containing size of each index slot
- *    indexSlots - explained more below
- * Each of these sections is padded with zeroes to end on an 8 byte (64 bit) boundary.
- * The index section consists of 4^^12 (16 million roughly) index slots.  Each slot 
- * corresponds to a DNA 12-mer.  The format of a slot is:
- *    hexesBefore1 - size # of 16 bit words, each containing 6 bases of DNA 2 bits/base 
- *                   and 4 bits of zero (most significant bits are zero).  These represent
- *                   the sixmers found before the 12-mer.  They are sorted numerically.
- *    hexesBefore2 - as hexesBefore, but contains sixmer six before the 12-mer.
- *    hexesAfter1 - sixmers after the 12-mer.
- *    hexesAfter2 - sixmers six after the 12-mer.
- *    offsetsBefore1 - 32 bit offsets into indexed DNA corresponding with hexBefore1
- *    offsetsBefore2 - 32 bit offsets into indexed DNA corresponding with hexBefore2
- *    offsetsAfter1 - 32 bit offsets corresponding ith hexesAfter1
- *    offsetsAfter2 - 32 bit offsets corresponding ith hexesAfter2
- * The splix files are structured so that they can be memory mapped relatively easily,
- * and so that on program load, and for a particular read, most of the action happens
- * in a few isolated piece of memory rather than scattered all over. */
-    {
-    bits32 magic;	/* Always SPLIX_MAGIC */
-    bits16 majorVersion; /* This version changes when backward compatibility breaks. */
-    bits16 minorVersion; /* This version changes whenever a feature is added. */
-    bits64 size;	/* Total size to memmap, including header. */
-    bits32 chromCount;	/* Total count of chromosomes/contigs in file. */
-    bits32 chromNamesSize;	/* Size of names of all contigs (including zeroes at end),
-    				   padded to 8 byte boundary as needed). */
-    bits64 basesIndexed;/* Total number of bases actually indexed (non-N, unmasked). */
-    bits64 dnaDiskSize;	/* Size of DNA on disk including zero separators and 8 byte padding */
-    bits64 reserved[11];/* All zeroes for now. */
-    };
-
-struct splix 
-/* Short read index in memory */
-    {
-    struct splix *next;
-    boolean isMapped;	/* True if memory mapped. */
-    struct splixFileHeader *header;	/* File header. */
-    char **chromNames;	/* Name of each chromosome. */
-    bits32 *chromSizes;    /* Size of each chromosome.  No deallocation required (in memmap) */
-    bits32 *chromOffsets;	/* Offset of each chromosome's DNA */
-    char *allDna;	/* All DNA from each contig/chromosome with zero separators. */
-    bits32 *slotSizes;	/* 4^^12 array of slot sizes.  No deallocation required (in memmap) */
-    char **slots;  	/* 16 M slots corresponding to 12 bases. Actual format of slot is
-                         * explained in indexSlots section of splixFileHeader */
-    };
-
-#define splixSlotCount (1<<(12*2))
-#define splixMinQuerySize 24
-
-struct splix *splixRead(char *fileName, boolean memoryMap);
-/* Read in a splix from a file.  Does this via memory mapping if you like,
- * which will be faster typically for about 100 reads, and slower for more
- * than that (_much_ slower for thousands of reads and more). */
-
-void splixFree(struct splix **pSplix);
-/* Free up resources associated with index. */
-
-int splixOffsetToChromIx(struct splix *splix, bits32 tOffset);
-/* Figure out index of chromosome containing tOffset */
-
-/** Stuff to define SPLIX files **/
-#define SPLIX_MAGIC 0x5616A283	/* Magic number at start of SPLIX file */
-#define SPLIX_MAJOR_VERSION 0	
-#define SPLIX_MINOR_VERSION 0
-
-#endif /* SPLIX_H */
diff --git a/gbtools/src/include/blatSrc/sqlList.h b/gbtools/src/include/blatSrc/sqlList.h
deleted file mode 100644
index 1de0832..0000000
--- a/gbtools/src/include/blatSrc/sqlList.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Stuff for processing comma separated lists .
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef SQLLIST_H
-#define SQLLIST_H
-struct hash;
-
-int sqlDoubleArray(char *s, double *array, int maxArraySize);
-int sqlFloatArray(char *s, float *array, int maxArraySize);
-int sqlUnsignedArray(char *s, unsigned *array, int maxArraySize);
-int sqlSignedArray(char *s, int *array, int maxArraySize);
-int sqlShortArray(char *s, short *array, int arraySize);
-int sqlUshortArray(char *s, unsigned short *array, int arraySize);
-int sqlByteArray(char *s, signed char *array, int arraySize);
-int sqlUbyteArray(char *s, unsigned char *array, int arraySize);
-int sqlCharArray(char *s, char *array, int arraySize);
-int sqlLongLongArray(char *s, long long *array, int arraySize);
-/* Convert comma separated list of numbers to an array.  Pass in 
- * array and max size of array.  Returns actual array size.*/
-
-void sqlDoubleStaticArray(char *s, double **retArray, int *retSize);
-void sqlFloatStaticArray(char *s, float **retArray, int *retSize);
-void sqlUnsignedStaticArray(char *s, unsigned **retArray, int *retSize);
-void sqlSignedStaticArray(char *s, int **retArray, int *retSize);
-void sqlShortStaticArray(char *s, short **retArray, int *retSize);
-void sqlUshortStaticArray(char *s, unsigned short **retArray, int *retSize);
-void sqlByteStaticArray(char *s, signed char **retArray, int *retSize);
-void sqlUbyteStaticArray(char *s, unsigned char **retArray, int *retSize);
-void sqlCharStaticArray(char *s, char **retArray, int *retSize);
-void sqlLongLongStaticArray(char *s, long long **array, int *retSize);
-/* Convert comma separated list of numbers to an array which will be
- * overwritten next call to this function or to sqlXxxxxxDynamicArray,
- * but need not be freed. */
-
-void sqlDoubleDynamicArray(char *s, double **retArray, int *retSize);
-void sqlFloatDynamicArray(char *s, float **retArray, int *retSize);
-void sqlUnsignedDynamicArray(char *s, unsigned **retArray, int *retSize);
-void sqlSignedDynamicArray(char *s, int **retArray, int *retSize);
-void sqlShortDynamicArray(char *s, short **retArray, int *retSize);
-void sqlUshortDynamicArray(char *s, unsigned short **retArray, int *retSize);
-void sqlByteDynamicArray(char *s, signed char **retArray, int *retSize);
-void sqlUbyteDynamicArray(char *s, unsigned char **retArray, int *retSize);
-void sqlCharDynamicArray(char *s, char **retArray, int *retSize);
-void sqlLongLongDynamicArray(char *s, long long **retArray, int *retSize);
-/* Convert comma separated list of numbers to an dynamically allocated
- * array, which should be freeMem()'d when done. */
-
-
-int sqlStringArray(char *s, char **array, int maxArraySize);
-/* Convert comma separated list of strings to an array.  Pass in 
- * array and max size of array.  Returns actual size.  This will
- * only persist as long as s persists.... Use sqlStringDynamicArray
- * if calling repeatedly. */
-
-void sqlStringStaticArray(char *s, char  ***retArray, int *retSize);
-/* Convert comma separated list of strings to an array which will be
- * overwritten next call to this function or to sqlUnsignedDynamicArray,
- * but need not be freed. */
-
-void sqlStringDynamicArray(char *s, char ***retArray, int *retSize);
-/* Convert comma separated list of strings to an dynamically allocated
- * array, which should be freeMem()'d when done. */
-
-void sqlStringFreeDynamicArray(char ***pArray);
-/* Free up a dynamic array (ends up freeing array and first string on it.) */
-
-char *sqlDoubleArrayToString( double *array, int arraySize);
-char *sqlFloatArrayToString( float *array, int arraySize);
-char *sqlUnsignedArrayToString( unsigned *array, int arraySize);
-char *sqlSignedArrayToString( int *array, int arraySize);
-char *sqlShortArrayToString( short *array, int arraySize);
-char *sqlUshortArrayToString( unsigned short *array, int arraySize);
-char *sqlByteArrayToString( signed char *array, int arraySize);
-char *sqlUbyteArrayToString( unsigned char *array, int arraySize);
-char *sqlCharArrayToString( char *array, int arraySize);
-char *sqlLongLongArrayToString( long long *array, int arraySize);
-char *sqlStringArrayToString( char **array, int arraySize);
-/* Convert arrays into comma separated strings. The char *'s returned
- * should be freeMem()'d when done */
-
-char *sqlEscapeString(const char *orig);
-/* Prepares string for inclusion in a SQL statement . Remember to free
- * returned string.  returned string contains strlen(length)*2+1 as many bytes
- * as orig because in worst case every character has to be escaped.
- * Example 1: The Gene's Name -> The Gene''s Name
- * Example 2: he said "order and orient" -> he said ""order and orient"" */
-
-char *sqlEscapeString2(char *to, const char* from);
-/* Prepares a string for inclusion in a sql statement.  Output string
- * must be 2*strlen(from)+1 */
-
-int sqlUnsignedComma(char **pS);
-/* Return signed number at *pS.  Advance *pS past comma at end.
- * This function is used by the system that automatically loads
- * structured object from longblobs. */
-
-int sqlSignedComma(char **pS);
-/* Return signed number at *pS.  Advance *pS past comma at end */
-
-char sqlCharComma(char **pS);
-/* Return char at *pS.  Advance *pS past comma after char */
-
-long long sqlLongLongComma(char **pS);
-/* Return long long number at *pS.  Advance *pS past comma at end */
-
-double sqlDoubleComma(char **pS);
-/* Return double floating number at *pS.  Advance *pS past comma at end */
-
-float sqlFloatComma(char **pS);
-/* Return floating point number at *pS.  Advance *pS past comma at end */
-
-char *sqlStringComma(char **pS);
-/* Return string at *pS.  (Either quoted or not.)  Advance *pS. */
-
-void sqlFixedStringComma(char **pS, char *buf, int bufSize);
-/* Copy string at *pS to buf.  Advance *pS. */
-
-char *sqlEatChar(char *s, char c);
-/* Make sure next character is 'c'.  Return past next char */
-
-unsigned sqlEnumParse(char *valStr, char **values, struct hash **valHashPtr);
-/* parse an enumerated column value */
-
-unsigned sqlEnumComma(char **pS, char **values, struct hash **valHashPtr);
-/* Return enum at *pS.  (Either quoted or not.)  Advance *pS. */
-
-void sqlEnumPrint(FILE *f, unsigned value, char **values);
-/* print an enumerated column value */
-
-unsigned sqlSetParse(char *valStr, char **values, struct hash **valHashPtr);
-/* parse a set column value */
-
-unsigned sqlSetComma(char **pS, char **values, struct hash **valHashPtr);
-/* Return set at *pS.  (Either quoted or not.)  Advance *pS. */
-
-void sqlSetPrint(FILE *f, unsigned value, char **values);
-/* print a set column value */
-
-#endif /* SQLLIST_H */
-
diff --git a/gbtools/src/include/blatSrc/sqlNum.h b/gbtools/src/include/blatSrc/sqlNum.h
deleted file mode 100644
index ff3f056..0000000
--- a/gbtools/src/include/blatSrc/sqlNum.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* sqlNum.h - routines to convert from ascii to
- * unsigned/integer a bit more quickly than atoi. 
- * Called sqlNum because it was first developed for use with
- * SQL databases, which tend to require a lot of conversion from
- * string to binary representation of numbers. In particular the
- * code generator AutoSQL puts in lots of calls to these routines
- * into it's parsers.  Other parser in the source tree have come
- * to use these too though since they are fast and have good error
- * checking.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef SQLNUM_H
-#define SQLNUM_H
-
-/* get off_t */
-#include <sys/types.h>
-
-unsigned sqlUnsigned(char *s);
-/* Convert series of digits to unsigned integer about
- * twice as fast as atoi (by not having to skip white 
- * space or stop except at the null byte.) */
-
-unsigned sqlUnsignedInList(char **pS);
-/* Convert series of digits to unsigned integer about
- * twice as fast as atoi (by not having to skip white 
- * space or stop except at the null byte.) 
- * All of string is number. Number may be delimited by a comma. 
- * Returns the position of the delimiter or the terminating 0. */
-
-unsigned long sqlUnsignedLong(char *s);
-/* Convert series of digits to unsigned long about
- * twice as fast as atol (by not having to skip white 
- * space or stop except at the null byte.) */
-
-unsigned long sqlUnsignedLongInList(char **pS);
-/* Convert series of digits to unsigned long about
- * twice as fast as atol (by not having to skip white 
- * space or stop except at the null byte.) 
- * All of string is number. Number may be delimited by a comma. 
- * Returns the position of the delimiter or the terminating 0. */
-
-int sqlSigned(char *s);
-/* Convert string to signed integer.  Unlike atol assumes 
- * all of string is number. */
-
-int sqlSignedInList(char **pS);
-/* Convert string to signed integer.  Unlike atol assumes 
- * all of string is number. Number may be delimited by a comma. 
- * Returns the position of the delimiter or the terminating 0. */
-
-long long sqlLongLong(char *s);
-/* Convert string to a long long.  Unlike atol assumes all of string is
- * number. */
-
-long long sqlLongLongInList(char **pS);
-/* Convert string to a long long.  Unlike atol, assumes 
- * all of string is number. Number may be delimited by a comma. 
- * Returns the position of the delimiter or the terminating 0. */
-
-float sqlFloat(char *s);
-/* Convert string to a float.  Assumes all of string is number
- * and aborts on an error. */
-
-float sqlFloatInList(char **pS);
-/* Convert string to a float.  Assumes all of string is number
- * and aborts on an error. 
- * Number may be delimited by a comma. 
- * Returns the position of the delimiter or the terminating 0. */
-
-double sqlDouble(char *s);
-/* Convert string to a double.  Assumes all of string is number
- * and aborts on an error. */
-
-double sqlDoubleInList(char **pS);
-/* Convert string to a double.  Assumes all of string is number
- * and aborts on an error.
- * Number may be delimited by a comma.
- * Returns the position of the delimiter or the terminating 0. */
-
-#endif /* SQLNUM_H */
- 
diff --git a/gbtools/src/include/blatSrc/subText.h b/gbtools/src/include/blatSrc/subText.h
deleted file mode 100644
index 555d8eb..0000000
--- a/gbtools/src/include/blatSrc/subText.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* subText.h - perform text substitutions. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef SUBTEXT_H
-#define SUBTEXT_H
-
-struct subText
-/* Structure that holds data for a single substitution to be made.
- * The subText routines work mostly on lists of these. */
-    {
-    struct subText *next;	/* pointer to next substitution */
-    char *in;			/* source side of substitution */
-    char *out;			/* dest side of substitution */
-    int inSize;			/* length of in string */
-    int outSize;		/* length of out string */
-    };
-
-struct subText *subTextNew(char *in, char *out);
-/* Make new substitution structure. */
-
-void subTextFree(struct subText **pSub);
-/* Free a subText. */
-
-void subTextFreeList(struct subText **pList);
-/* Free a list of dynamically allocated subText's */
-
-int subTextSizeAfter(struct subText *subList, char *in);
-/* Return size string will be after substitutions. */
-
-void subTextStatic(struct subText *subList, char *in, char *out, int outMaxSize);
-/* Do substition to output buffer of given size.  Complain
- * and die if not big enough. */
-
-char *subTextString(struct subText *subList, char *in);
-/* Return string with substitutions in list performed.  freeMem
- * this string when done. */
-
-#endif /* SUBTEXT_H */
-
diff --git a/gbtools/src/include/blatSrc/sufa.h b/gbtools/src/include/blatSrc/sufa.h
deleted file mode 100644
index 5538968..0000000
--- a/gbtools/src/include/blatSrc/sufa.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* sufa - suffix array for genome.  Use sufaMake utility to create one of these, and
- * the routines here to access it.  See comment by sufaFileHeader for file format. */
-/* This file is copyright 2008 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef SUFA_H
-#define SUFA_H
-
-struct sufaFileHeader
-/* Short read index file binary file header.  A sufa file starts with this fixed 128 byte
- * structure.  It is followed by the following sections:
- *    chromosome name strings - zero terminated.  Padded with zero to 4 byte boundary 
- *    chromosome sizes (32 bits each)
- *    chromosome DNA - one byte per base lower case.  A zero between each chrom, and a zero before
- *                     and after (to make some end conditions easier).  Padded if need be with
- *                     additional zeroes to 4 base boundary.
- *    suffixArray - 32 bits for each indexed base */
-    {
-    bits32 magic;	/* Always SUFA_MAGIC */
-    bits16 majorVersion; /* This version changes when backward compatibility breaks. */
-    bits16 minorVersion; /* This version changes whenever a feature is added. */
-    bits64 size;	/* Total size to memmap, including header. */
-    bits32 chromCount;	/* Total count of chromosomes/contigs in file. */
-    bits32 chromNamesSize;	/* Size of names of all contigs (including zeroes at end),
-    				   padded to 4 byte boundary as needed). */
-    bits64 arraySize;   /* Total number of bases actually indexed (non-N, unmasked). */
-    bits64 dnaDiskSize;	/* Size of DNA on disk with zero separators. Padded to 4 byte boundary  */
-    bits64 reserved[11];/* All zeroes for now. */
-    };
-
-struct sufa 
-/* Suffix array in memory */
-    {
-    struct sufa *next;
-    boolean isMapped;	/* True if memory mapped. */
-    struct sufaFileHeader *header;	/* File header. */
-    char **chromNames;	/* Name of each chromosome. */
-    bits32 *chromSizes;    /* Size of each chromosome.  No deallocation required (in memmap) */
-    bits32 *chromOffsets;  /* Offset of each chromosome's DNA */
-    char *allDna;	/* All DNA from each contig/chromosome with zero separators. */
-    bits32 *array;	/* Alphabetized offsets into allDna. */
-    };
-
-struct sufa *sufaRead(char *fileName, boolean memoryMap);
-/* Read in a sufa from a file.  Does this via memory mapping if you like,
- * which will be faster typically for about 100 reads, and slower for more
- * than that (_much_ slower for thousands of reads and more). */
-
-void sufaFree(struct sufa **pSufa);
-/* Free up resources associated with index. */
-
-int sufaOffsetToChromIx(struct sufa *sufa, bits32 tOffset);
-/* Figure out index of chromosome containing tOffset */
-
-/** Stuff to define SUFA files **/
-#define SUFA_MAGIC 0x6727B283	/* Magic number at start of SUFA file */
-#define SUFA_MAJOR_VERSION 0	
-#define SUFA_MINOR_VERSION 0
-
-#endif /* SUFA_H */
diff --git a/gbtools/src/include/blatSrc/sufx.h b/gbtools/src/include/blatSrc/sufx.h
deleted file mode 100644
index 6c588fc..0000000
--- a/gbtools/src/include/blatSrc/sufx.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* sufx - suffix array with traversal extension for genome.  Use sufxMake utility to 
- * create one of these files , and the routines here to access it.  See comment by 
- * sufxFileHeader for file format. See src/shortReads/sufxMake/sufx.doc as well for
- * an explanation of the data structures, particularly the traverse array. */
-/* This file is copyright 2008 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef SUFX_H
-#define SUFX_H
-
-struct sufxFileHeader
-/* Short read index file binary file header.  A sufx file starts with this fixed 128 byte
- * structure.  It is followed by the following sections:
- *    chromosome name strings - zero terminated.  Padded with zero to 4 byte boundary 
- *    chromosome sizes (32 bits each)
- *    chromosome DNA - one byte per base lower case.  A zero between each chrom, and a zero before
- *                     and after (to make some end conditions easier).  Padded if need be with
- *                     additional zeroes to 4 base boundary.
- *    suffix array -   32 bits for each indexed base. Alphabetical offsets into DNA
- *    traverse array - Also 32 bits per indexed base. Helper info to traverse array like a tree. */
-    {
-    bits32 magic;	 /* Always SUFX_MAGIC */
-    bits16 majorVersion; /* This version changes when backward compatibility breaks. */
-    bits16 minorVersion; /* This version changes whenever a feature is added. */
-    bits64 size;	 /* Total size to memmap, including header. */
-    bits32 chromCount;	 /* Total count of chromosomes/contigs in file. */
-    bits32 chromNamesSize;	/* Size of names of all contigs (including zeroes at end),
-    				   padded to 4 byte boundary as needed). */
-    bits64 arraySize;	 /* Total number of bases actually indexed (non-N, unmasked). */
-    bits64 dnaDiskSize;	 /* Size of DNA on disk with zero separators. Padded to 4 byte boundary  */
-    bits64 reserved[11];/* All zeroes for now. */
-    };
-
-struct sufx 
-/* Suffix array in memory */
-    {
-    struct sufx *next;
-    boolean isMapped;	/* True if memory mapped. */
-    struct sufxFileHeader *header;	/* File header. */
-    char **chromNames;	/* Name of each chromosome. */
-    bits32 *chromSizes;    /* Size of each chromosome.  No deallocation required (in memmap) */
-    bits32 *chromOffsets;  /* Offset of each chromosome's DNA */
-    char *allDna;	/* All DNA from each contig/chromosome with zero separators. */
-    bits32 *array;	/* Alphabetized offsets into allDna. */
-    bits32 *traverse;	/* Offsets to position in array where current prefix changes. */
-    };
-
-struct sufx *sufxRead(char *fileName, boolean memoryMap);
-/* Read in a sufx from a file.  Does this via memory mapping if you like,
- * which will be faster typically for about 100 reads, and slower for more
- * than that (_much_ slower for thousands of reads and more). */
-
-void sufxFree(struct sufx **pSufx);
-/* Free up resources associated with index. */
-
-int sufxOffsetToChromIx(struct sufx *sufx, bits32 tOffset);
-/* Figure out index of chromosome containing tOffset */
-
-/** Stuff to define SUFX files **/
-#define SUFX_MAGIC 0x600BA3A1	/* Magic number at start of SUFX file */
-#define SUFX_MAJOR_VERSION 0	
-#define SUFX_MINOR_VERSION 0
-
-#endif /* SUFX_H */
diff --git a/gbtools/src/include/blatSrc/supStitch.h b/gbtools/src/include/blatSrc/supStitch.h
deleted file mode 100644
index 3ef0d63..0000000
--- a/gbtools/src/include/blatSrc/supStitch.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* supStitch stitches together a bundle of ffAli alignments that share
- * a common query and target sequence into larger alignments if possible.
- * This is commonly used when the query sequence was broken up into
- * overlapping blocks in the initial alignment, and also to look for
- * introns larger than fuzzyFinder can handle. */
-
-#ifndef SUPSTITCH_H
-#define SUPSTITCH_H
-
-#ifndef DNASEQ_H
-#include "dnaseq.h"
-#endif
-
-#ifndef FUZZYFIND_H
-#include "fuzzyFind.h"
-#endif
-
-#ifndef PATSPACE_H
-#include "patSpace.h"
-#endif
-
-struct ssFfItem
-/* A list of fuzzy finder alignments. */
-    {
-    struct ssFfItem *next;      /* Next in list. */
-    struct ffAli *ff;		/* Alignment (owned by ssFfItem) */
-    };
-
-void ssFfItemFree(struct ssFfItem **pEl);
-/* Free a single ssFfItem. */
-
-void ssFfItemFreeList(struct ssFfItem **pList);
-/* Free a list of ssFfItems. */
-
-struct ssBundle
-/* A bunch of alignments all with the same query sequence.  This
- * is the input to the stitcher.*/
-    {
-    struct ssBundle *next;	/* Next in list. */
-    struct ssFfItem *ffList;    /* Item list - memory owned by bundle. */
-    bioSeq *qSeq;        /* Query sequence (not owned by bundle.) */
-    bioSeq *genoSeq;     /* Genomic sequence (not owned by bundle.) */
-    int genoIx;                 /* Index of bac in associated PatSpace. */
-    int genoContigIx;           /* Index of contig inside of seq. */
-    void *data;			/* User defined data pointer. */
-    boolean isProt;		/* True if it's a protein based bundle. */
-    struct trans3 *t3List;	/* Sometimes set to three translated frames. */
-    boolean avoidFuzzyFindKludge;	/* Temporary flag to avoid call to fuzzyFind. */
-    };
-
-void ssBundleFree(struct ssBundle **pEl);
-/* Free up one ssBundle */
-
-void ssBundleFreeList(struct ssBundle **pList);
-/* Free up list of ssBundles */
-
-
-void ssStitch(struct ssBundle *bundle, enum ffStringency stringency, 
-	int minScore, int maxToReturn);
-/* Glue together mrnas in bundle as much as possible. 
- * Updates bundle->ffList with stitched together version. */
-
-struct ssBundle *ssFindBundles(struct patSpace *ps, struct dnaSeq *cSeq, 
-	char *cName, enum ffStringency stringency, boolean avoidSelfSelf);
-/* Find patSpace alignments on cSeq and bundle them together. */
-
-#endif /* SUPSTITCH_H */
-
diff --git a/gbtools/src/include/blatSrc/synQueue.h b/gbtools/src/include/blatSrc/synQueue.h
deleted file mode 100644
index a79088a..0000000
--- a/gbtools/src/include/blatSrc/synQueue.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* synQueue - a sychronized message queue for messages between
- * threads. */
-
-#ifndef SYNQUEUE_H
-#define SYNQUEUE_H
-
-struct synQueue *synQueueNew();
-/* Make a new, empty, synQueue. */
-
-void synQueueFree(struct synQueue **pSq);
-/* Free up synQueue.  Be sure no other threads are using
- * it first though! This will not free any dynamic memory
- * in the messages.  Use synQueueFreeAndVals for that. */
-
-void synQueueFreeAndVals(struct synQueue **pSq);
-/* Free up synQueue.  Be sure no other threads are using
- * it first though! This will freeMem all the messages */
-
-void synQueuePut(struct synQueue *sq, void *message);
-/* Add message to end of queue. */
-
-void synQueuePutUnprotected(struct synQueue *sq, void *message);
-/* Add message to end of queue without protecting against multithreading
- * contention - used before pthreads are launched perhaps. */
-
-void *synQueueGet(struct synQueue *sq);
-/* Get message off start of queue.  Wait until there is
- * a message if queue is empty. */
-
-void *synQueueGrab(struct synQueue *sq);
-/* Get message off start of queue.  Return NULL immediately 
- * if queue is empty. */
-
-int synQueueSize(struct synQueue *sq);
-/* Return number of messages currently on queue. */
-
-#endif /* SYNQUEUE_H */
-
diff --git a/gbtools/src/include/blatSrc/tabRow.h b/gbtools/src/include/blatSrc/tabRow.h
deleted file mode 100644
index cc5b583..0000000
--- a/gbtools/src/include/blatSrc/tabRow.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* tabRow - a row from a database or a tab-separated file held in
- * memory.   Just a light wrapper around an array of strings. 
- * Also some routines to convert slLines to tabRows. */
-
-#ifndef TABROW_H
-#define TABROW_H
-
-struct tabRow
-/* A parsed out tableRow. */
-    {
-    struct tabRow *next;
-    int colCount;
-    char *columns[1];
-    };
-
-struct tabRow *tabRowNew(int colCount);
-/* Return new row. */
-
-int tabRowMaxColCount(struct tabRow *rowList);
-/* Return largest column count */
-
-struct tabRow *tabRowByWhite(struct slName *lineList, char *fileName,
-	boolean varCol);
-/* Convert lines to rows based on spaces.  If varCol is TRUE then not
- * all rows need to have same number of columns. */
-
-struct tabRow *tabRowByChar(struct slName *lineList, char c, char *fileName,
-	boolean varCol);
-/* Convert lines to rows based on character separation.  If varCol is TRUE then not
- * all rows need to have same number of columns. */
-
-struct tabRow *tabRowByFixedOffsets(struct slName *lineList, struct slInt *offList,
-	char *fileName);
-/* Return rows parsed into fixed width fields whose starts are defined by
- * offList. */
-
-struct tabRow *tabRowByFixedGuess(struct slName *lineList, char *fileName);
-/* Return rows parsed into fixed-width fields. */
-
-struct slInt *tabRowGuessFixedOffsets(struct slName *lineList, char *fileName);
-/* Return our best guess list of starting positions for space-padded fixed
- * width fields. */
-
-#endif /* TABROW_H */
-
diff --git a/gbtools/src/include/blatSrc/textOut.h b/gbtools/src/include/blatSrc/textOut.h
deleted file mode 100644
index 2775f66..0000000
--- a/gbtools/src/include/blatSrc/textOut.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* textOut - set up stdout to be HTTP text, file or compressed file. */
-
-#ifndef TEXTOUT_H
-#define TEXTOUT_H
-
-#include "pipeline.h"
-
-/* Supported compression types: */
-#define textOutCompressNone "none"
-#define textOutCompressBzip2 "bzip2"
-#define textOutCompressCompress "compress"
-#define textOutCompressGzip "gzip"
-#define textOutCompressZip "zip"
-
-/* Menu and values for passing to cgiMakeDropListFull: */
-/* (not declaring the static char *[]'s here because those can lead to 
- * "variable defined but not used" warnings -- declare locally.) */
-#define textOutCompressMenuContents { "plain text",\
-				       "gzip compressed (.gz)",\
-				       "bzip2 compressed (.bz2)",\
-				       "LZW compressed (.Z)",\
-				       "zip compressed (.zip)",\
-				       NULL\
-				     }
-
-#define textOutCompressValuesContents { textOutCompressNone,\
-					 textOutCompressGzip,\
-					 textOutCompressBzip2,\
-					 textOutCompressCompress,\
-					 textOutCompressZip,\
-					 NULL\
-				       }
-
-char *getCompressSuffix(char *compressType);
-/* Return the file dot-suffix (including the dot) for compressType. */
-
-struct pipeline *textOutInit(char *fileName, char *compressType, int *saveStdout);
-/* Set up stdout to be HTTP text, file (if fileName is specified), or 
- * compressed file (if both fileName and a supported compressType are 
- * specified). 
- * Return NULL if no compression, otherwise a pipeline handle on which 
- * textOutClose should be called when we're done writing stdout. */
-
-void textOutClose(struct pipeline **pCompressPipeline, int *saveStdout);
-/* Flush and close stdout, wait for the pipeline to finish, and then free 
- * the pipeline object. */
-
-#endif /* TEXTOUT_H */
diff --git a/gbtools/src/include/blatSrc/tokenizer.h b/gbtools/src/include/blatSrc/tokenizer.h
deleted file mode 100644
index d1ce9d9..0000000
--- a/gbtools/src/include/blatSrc/tokenizer.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* tokenizer - A tokenizer structure that will chop up file into
- * tokens.  It is aware of quoted strings and otherwise tends to return
- * white-space or punctuated-separated words, with punctuation in
- * a separate token.  This is used by autoSql. */
-
-#ifndef TOKENIZER_H
-#define TOKENIZER_H
-
-struct tokenizer
-/* This handles reading in tokens. */
-    {
-    bool reuse;	         /* True if want to reuse this token. */
-    bool eof;            /* True at end of file. */
-    int leadingSpaces;	 /* Number of leading spaces before token. */
-    struct lineFile *lf; /* Underlying file. */
-    char *curLine;       /* Current line of text. */
-    char *linePt;        /* Start position within current line. */
-    char *string;        /* String value of token */
-    int sSize;           /* Size of string. */
-    int sAlloc;          /* Allocated string size. */
-      /* Some variables set after tokenizerNew to control details of
-       * parsing. */
-    bool leaveQuotes;	 /* Leave quotes in string. */
-    bool uncommentC;	 /* Take out C (and C++) style comments. */
-    bool uncommentShell; /* Take out # style comments. */
-    };
-
-struct tokenizer *tokenizerNew(char *fileName);
-/* Return a new tokenizer. */
-
-struct tokenizer *tokenizerOnLineFile(struct lineFile *lf);
-/* Create a new tokenizer on open lineFile. */
-
-void tokenizerFree(struct tokenizer **pTkz);
-/* Tear down a tokenizer. */
-
-void tokenizerReuse(struct tokenizer *tkz);
-/* Reuse token. */
-
-int tokenizerLineCount(struct tokenizer *tkz);
-/* Return line of current token. */
-
-char *tokenizerFileName(struct tokenizer *tkz);
-/* Return name of file. */
-
-char *tokenizerNext(struct tokenizer *tkz);
-/* Return token's next string (also available as tkz->string) or
- * NULL at EOF. This string will be overwritten with the next call
- * to tokenizerNext, so cloneString if you need to save it. */
-
-void tokenizerErrAbort(struct tokenizer *tkz, char *format, ...);
-/* Print error message followed by file and line number and
- * abort. */
-
-void tokenizerNotEnd(struct tokenizer *tkz);
-/* Squawk if at end. */
-
-char *tokenizerMustHaveNext(struct tokenizer *tkz);
-/* Get next token, which must be there. */
-
-void tokenizerMustMatch(struct tokenizer *tkz, char *string);
-/* Require next token to match string.  Return next token
- * if it does, otherwise abort. */
-
-#endif /* TOKENIZER_H */
-
diff --git a/gbtools/src/include/blatSrc/trans3.h b/gbtools/src/include/blatSrc/trans3.h
deleted file mode 100644
index 61f0f0c..0000000
--- a/gbtools/src/include/blatSrc/trans3.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* trans3 - a sequence and three translated reading frames. 
- * In the gfServer/gfClient system these are found in a
- * t3Hash that has as values lists of trans3.  These reflect
- * the fragments of the genome actually loaded in memory
- * to perform the alignment. */
-
-#ifndef TRANS3_H
-#define TRANS3_H
-
-#ifndef DNASEQ_H
-#include "dnaseq.h"
-#endif
-
-#ifndef HASH_H
-#include "hash.h"
-#endif
-
-struct trans3
-/* A sequence and three translations of it. */
-     {
-     struct trans3 *next;		/* Next in list. */
-     char *name;			/* Name (not allocated here) */
-     struct dnaSeq *seq;		/* Untranslated sequence.  Not allocated here. */
-     aaSeq *trans[3];			/* Translated sequences.  Allocated here*/
-     int start,end;			/* Start/end of sequence in a larger context. */
-     int nibSize;			/* Size of nib file this is embedded in. */
-     boolean isRc;			/* Has been reverse complemented? */
-     };
-
-struct trans3 *trans3New(struct dnaSeq *seq);
-/* Create a new set of translated sequences. */
-
-void trans3Free(struct trans3 **pT3);
-/* Free a trans3 structure. */
-
-void trans3FreeList(struct trans3 **pList);
-/* Free a list of dynamically allocated trans3's */
-
-struct trans3 *trans3Find(struct hash *t3Hash, char *name, int start, int end);
-/* Find trans3 in hash which corresponds to sequence of given name and includes
- * bases between start and end. */
-
-void trans3Offset(struct trans3 *t3List, AA *aa, int *retOffset, int *retFrame);
-/* Figure out offset of peptide in context of larger sequences. */
-
-int trans3GenoPos(char *pt, bioSeq *seq, struct trans3 *t3List, boolean isEnd);
-/* Convert from position in one of three translated frames in
- * t3List to genomic offset. If t3List is NULL then just use seq
- * instead. */
-
-int trans3Frame(char *pt, struct trans3 *t3List);
-/* Figure out which frame pt is in or 0 if no frame. */
-
-#endif /* TRANS3_H */
diff --git a/gbtools/src/include/blatSrc/trix.h b/gbtools/src/include/blatSrc/trix.h
deleted file mode 100644
index 740580b..0000000
--- a/gbtools/src/include/blatSrc/trix.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* trix - text retrieval index.  Stuff for fast two level index
- * of text for fast word searches.  Generally you use the ixIxx program
- * to make the indexes. */
-
-struct trix
-/* A two level index */
-    {
-    struct lineFile *lf;	/* Open file on first level index. */
-    struct trixIxx *ixx;	/* Second level index in memory. */
-    int ixxSize;		/* Size of second level index. */
-    int ixxAlloc;	        /* Space allocated for index. */
-    struct hash *wordHitHash;	/* Hash of word hitsLists, so search on "the the the" works fast. */
-    boolean useUdc;            /* are we using UDC or lineFile */
-    };
-
-struct trixSearchResult
-/* Result of a trix search. */
-    {
-    struct trixSearchResult *next;
-    char *itemId;               /* ID of matching item */
-    int unorderedSpan;          /* Minimum span in single doc with words in any order. */
-    int orderedSpan;            /* Minimum span in single doc with words in search order. */
-    int wordPos;		/* Position of word in doc more or less. */
-    int leftoverLetters;	/* Number of leftover letters in words. */
-    };
-
-#define trixPrefixSize 5	/* Size of prefix in second level index. */
-
-struct trix *trixOpen(char *ixFile);
-/* Open up index.  Load second level index in memory. */
-
-void trixClose(struct trix **pTrix);
-/* Close up index and free up associated resources. */
-
-struct trixSearchResult *trixSearch(struct trix *trix, int wordCount, char **words,
-	boolean expand);
-/* Return a list of items that match all words.  This will be sorted so that
- * multiple-word matches where the words are closer to each other and in the
- * right order will be first.  Single word matches will be prioritized so that those
- * closer to the start of the search text will appear before those later.
- * Do a trixSearchResultFreeList when done.  If expand is TRUE then this will match not 
- * only the input words, but also additional words that start with the input words. */
-
-void trixSearchResultFree(struct trixSearchResult **pTsr);
-/* Free up data associated with trixSearchResult. */
-
-void trixSearchResultFreeList(struct trixSearchResult **pList);
-/* Free up a list of trixSearchResults. */
diff --git a/gbtools/src/include/blatSrc/twoBit.h b/gbtools/src/include/blatSrc/twoBit.h
deleted file mode 100644
index 02a33c7..0000000
--- a/gbtools/src/include/blatSrc/twoBit.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* twoBit - DNA sequence represented as two bits per pixel
- * with associated list of regions containing N's, and
- * masked regions. */
-
-#ifndef TWOBIT_H
-#define TWOBIT_H
-
-struct twoBit
-/* Two bit representation of DNA. */
-    {
-    struct twoBit *next;	/* Next sequence in list */
-    char *name;			/* Name of sequence. */
-    UBYTE *data;		/* DNA at two bits per base. */
-    bits32 size;		/* Size of this sequence. */
-    bits32 nBlockCount;		/* Count of blocks of Ns. */
-    bits32 *nStarts;		/* Starts of blocks of Ns. */
-    bits32 *nSizes;		/* Sizes of blocks of Ns. */
-    bits32 maskBlockCount;	/* Count of masked blocks. */
-    bits32 *maskStarts;		/* Starts of masked regions. */
-    bits32 *maskSizes;		/* Sizes of masked regions. */
-    bits32 reserved;		/* Reserved for future expansion. */
-    };
-
-struct twoBitIndex
-/* An entry in twoBit index. */
-    {
-    struct twoBitIndex *next;	/* Next in list. */
-    char *name;			/* Name - allocated in hash */
-    bits32 offset;		/* Offset in file. */
-    };
-
-struct twoBitFile
-/* Holds header and index info from .2bit file. */
-    {
-    struct twoBitFile *next;
-    char *fileName;	/* Name of this file, for error reporting. */
-    void *f;            /* Open file. */
-    boolean isSwapped;	/* Is byte-swapping needed. */
-    bits32 version;	/* Version of .2bit file */
-    bits32 seqCount;	/* Number of sequences. */
-    bits32 reserved;	/* Reserved, always zero for now. */
-    struct twoBitIndex *indexList;	/* List of sequence. */
-    struct hash *hash;	/* Hash of sequences. */
-    struct bptFile *bpt;	/* Alternative index. */
-
-    /* the routines we use to access the twoBit.
-     * These may be UDC routines, or stdio
-     */
-    void (*ourSeek)(void *file, bits64 offset);
-    void (*ourSeekCur)(void *file, bits64 offset);
-    bits32 (*ourReadBits32)(void *f, boolean isSwapped);
-    void (*ourClose)(void *pFile);
-    boolean (*ourFastReadString)(void *f, char buf[256]);
-    void (*ourMustRead)(void *file, void *buf, size_t size);
-    };
-
-struct twoBitSpec
-/* parsed .2bit file and sequence specs */
-{
-    char *fileName;                 /* path to file */
-    struct twoBitSeqSpec *seqs;     /* list of sequences and subsequences */
-};
-
-struct twoBitSeqSpec
-/* specification for a seq or subsequence in a .2bit file */
-{
-    struct twoBitSeqSpec *next;
-    char *name;                 /* name of sequence */
-    bits32 start;              /* start of subsequence 0 */
-    bits32 end;                /* end of subsequence;
-                                 * 0 if not a subsequence */
-};
-
-struct twoBitFile *twoBitOpen(char *fileName);
-/* Open file, read in header and index.  
- * Squawk and die if there is a problem. */
-
-struct twoBitFile *twoBitOpenExternalBptIndex(char *twoBitName, char *bptName);
-/* Open file, read in header, but not regular index.  Instead use
- * bpt index.   Beware if you use this the indexList field will be NULL
- * as will the hash. */
-
-void twoBitClose(struct twoBitFile **pTbf);
-/* Free up resources associated with twoBitFile. */
-
-int twoBitSeqSize(struct twoBitFile *tbf, char *name);
-/* Return size of sequence in two bit file in bases. */
-
-long long twoBitTotalSize(struct twoBitFile *tbf);
-/* Return total size of all sequences in two bit file. */
-
-struct dnaSeq *twoBitReadSeqFragExt(struct twoBitFile *tbf, char *name,
-                                    int fragStart, int fragEnd, boolean doMask, int *retFullSize);
-/* Read part of sequence from .2bit file.  To read full
- * sequence call with start=end=0.  Sequence will be lower
- * case if doMask is false, mixed case (repeats in lower)
- * if doMask is true. */
-
-struct dnaSeq *twoBitReadSeqFrag(struct twoBitFile *tbf, char *name,
-	int fragStart, int fragEnd);
-/* Read part of sequence from .2bit file.  To read full
- * sequence call with start=end=0.  Note that sequence will
- * be mixed case, with repeats in lower case and rest in
- * upper case. */
-
-struct dnaSeq *twoBitReadSeqFragLower(struct twoBitFile *tbf, char *name,
-	int fragStart, int fragEnd);
-/* Same as twoBitReadSeqFrag, but sequence is returned in lower case. */
-
-struct dnaSeq *twoBitLoadAll(char *spec);
-/* Return list of all sequences matching spec, which is in
- * the form:
- *
- *    file/path/input.2bit[:seqSpec1][,seqSpec2,...]
- *
- * where seqSpec is either
- *     seqName
- *  or
- *     seqName:start-end */
-
-struct slName *twoBitSeqNames(char *fileName);
-/* Get list of all sequences in twoBit file. */
-
-struct twoBit *twoBitFromDnaSeq(struct dnaSeq *seq, boolean doMask);
-/* Convert dnaSeq representation in memory to twoBit representation.
- * If doMask is true interpret lower-case letters as masked. */
-
-struct twoBit *twoBitFromFile(char *fileName);
-/* Get twoBit list of all sequences in twoBit file. */
-
-struct twoBit *twoBitOneFromFile(struct twoBitFile *tbf, char *name);
-/* Get single sequence as two bit. */
-
-void twoBitFree(struct twoBit **pTwoBit);
-/* Free up a two bit structure. */
-
-void twoBitFreeList(struct twoBit **pList);
-/* Free a list of dynamically allocated twoBit's */
-
-
-void twoBitWriteOne(struct twoBit *twoBit, FILE *f);
-/* Write out one twoBit sequence to binary file. 
- * Note this does not include the name, which is
- * stored only in index. */
-
-void twoBitWriteHeader(struct twoBit *twoBitList, FILE *f);
-/* Write out header portion of twoBit file, including initial
- * index */
-
-boolean twoBitIsFile(char *fileName);
-/* Return TRUE if file is in .2bit format. */
-
-boolean twoBitParseRange(char *rangeSpec, char **retFile, 
-	char **retSeq, int *retStart, int *retEnd);
-/* Parse out something in format
- *    file/path/name:seqName:start-end
- * or
- *    file/path/name:seqName
- * This will destroy the input 'rangeSpec' in the process.
- * Returns FALSE if it doesn't fit this format. 
- * If it is the shorter form then start and end will both
- * be returned as zero, which is ok by twoBitReadSeqFrag. */
-
-boolean twoBitIsRange(char *rangeSpec);
-/* Return TRUE if it looks like a two bit range specifier. */
-
-boolean twoBitIsFileOrRange(char *spec);
-/* Return TRUE if it is a two bit file or subrange. */
-
-boolean twoBitIsSpec(char *spec);
-/* Return TRUE spec is a valid 2bit spec (see twoBitSpecNew) */
-
-struct twoBitSpec *twoBitSpecNew(char *specStr);
-/* Parse a .2bit file and sequence spec into an object.
- * The spec is a string in the form:
- *
- *    file/path/input.2bit[:seqSpec1][,seqSpec2,...]
- *
- * where seqSpec is either
- *     seqName
- *  or
- *     seqName:start-end
- *
- * free result with twoBitSpecFree().
- */
-
-struct twoBitSpec *twoBitSpecNewFile(char *twoBitFile, char *specFile);
-/* parse a file containing a list of specifications for sequences in the
- * specified twoBit file. Specifications are one per line in forms:
- *     seqName
- *  or
- *     seqName:start-end
- */
-
-void twoBitSpecFree(struct twoBitSpec **specPtr);
-/* free a twoBitSpec object */
-
-void twoBitOutNBeds(struct twoBitFile *tbf, char *seqName, FILE *outF);
-/* output a series of bed3's that enumerate the number of N's in a sequence*/
-
-int twoBitSeqSizeNoNs(struct twoBitFile *tbf, char *seqName);
-/* return the length of the sequence, not counting N's */
-
-long long twoBitTotalSizeNoN(struct twoBitFile *tbf);
-/* return the size of the all the sequence in file, not counting N's*/
-
-boolean twoBitIsSequence(struct twoBitFile *tbf, char *chromName);
-/* Return TRUE if chromName is in 2bit file. */
-#endif /* TWOBIT_H */
diff --git a/gbtools/src/include/blatSrc/udc.h b/gbtools/src/include/blatSrc/udc.h
deleted file mode 100644
index b7db8f6..0000000
--- a/gbtools/src/include/blatSrc/udc.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/* udc - url data cache - a caching system that keeps blocks of data fetched from URLs in
- * sparse local files for quick use the next time the data is needed. 
- *
- * This cache is enormously simplified by there being no local _write_ to the cache,
- * just reads.  
- *
- * The overall strategy of the implementation is to have a root cache directory
- * with a subdir for each file being cached.  The directory for a single cached file
- * contains two files - "bitmap" and "sparseData" that contains information on which
- * parts of the URL are cached and the actual cached data respectively. The subdirectory name
- * associated with the file is constructed from the URL in a straightforward manner.
- *     http://genome.ucsc.edu/cgi-bin/hgGateway
- * gets mapped to:
- *     rootCacheDir/http/genome.ucsc.edu/cgi-bin/hgGateway/
- * The URL protocol is the first directory under the root, and the remainder of the
- * URL, with some necessary escaping, is used to define the rest of the cache directory
- * structure, with each '/' after the protocol line translating into another directory
- * level.
- *    
- * The bitmap file contains time stamp and size data as well as an array with one bit
- * for each block of the file that has been fetched.  Currently the block size is 8K. */
-
-#ifndef UDC_H
-#define UDC_H
-
-struct udcFile;
-/* Handle to a cached file.  Inside of structure mysterious unless you are udc.c. */
-
-struct udcFile *udcFileMayOpen(char *url, char *cacheDir);
-/* Open up a cached file. cacheDir may be null in which case udcDefaultDir() will be
- * used.  Return NULL if file doesn't exist. */
-
-struct udcFile *udcFileOpen(char *url, char *cacheDir);
-/* Open up a cached file.  cacheDir may be null in which case udcDefaultDir() will be
- * used.  Abort if if file doesn't exist. */
-
-void udcFileClose(struct udcFile **pFile);
-/* Close down cached file. */
-
-bits64 udcRead(struct udcFile *file, void *buf, bits64 size);
-/* Read a block from file.  Return amount actually read. */
-
-#define udcReadOne(file, var) udcRead(file, &(var), sizeof(var))
-/* Read one variable from file or die. */
-
-void udcMustRead(struct udcFile *file, void *buf, bits64 size);
-/* Read a block from file.  Abort if any problem, including EOF before size is read. */
-
-#define udcMustReadOne(file, var) udcMustRead(file, &(var), sizeof(var))
-/* Read one variable from file or die. */
-
-bits64 udcReadBits64(struct udcFile *file, boolean isSwapped);
-/* Read and optionally byte-swap 64 bit entity. */
-
-bits32 udcReadBits32(struct udcFile *file, boolean isSwapped);
-/* Read and optionally byte-swap 32 bit entity. */
-
-bits16 udcReadBits16(struct udcFile *file, boolean isSwapped);
-/* Read and optionally byte-swap 16 bit entity. */
-
-float udcReadFloat(struct udcFile *file, boolean isSwapped);
-/* Read and optionally byte-swap floating point number. */
-
-double udcReadDouble(struct udcFile *file, boolean isSwapped);
-/* Read and optionally byte-swap double-precision floating point number. */
-
-int udcGetChar(struct udcFile *file);
-/* Get next character from file or die trying. */
-
-char *udcReadLine(struct udcFile *file);
-/* Fetch next line from udc cache. */
-
-char *udcReadStringAndZero(struct udcFile *file);
-/* Read in zero terminated string from file.  Do a freeMem of result when done. */
-
-char *udcFileReadAll(char *url, char *cacheDir, size_t maxSize, size_t *retSize);
-/* Read a complete file via UDC. The cacheDir may be null in which case udcDefaultDir()
- * will be used.  If maxSize is non-zero, check size against maxSize
- * and abort if it's bigger.  Returns file data (with an extra terminal for the
- * common case where it's treated as a C string).  If retSize is non-NULL then
- * returns size of file in *retSize. Do a freeMem or freez of the returned buffer
- * when done. */
-
-struct lineFile *udcWrapShortLineFile(char *url, char *cacheDir, size_t maxSize);
-/* Read in entire short (up to maxSize) url into memory and wrap a line file around it.
- * The cacheDir may be null in which case udcDefaultDir() will be used.  If maxSize
- * is zero then a default value (currently 64 meg) will be used. */
-
-void udcSeek(struct udcFile *file, bits64 offset);
-/* Seek to a particular (absolute) position in file. */
-
-void udcSeekCur(struct udcFile *file, bits64 offset);
-/* Seek to a particular (from current) position in file. */
-
-bits64 udcTell(struct udcFile *file);
-/* Return current file position. */
-
-bits64 udcCleanup(char *cacheDir, double maxDays, boolean testOnly);
-/* Remove cached files older than maxDays old. If testOnly is set
- * no clean up is done, but the size of the files that would be
- * cleaned up is still. */
-
-void udcParseUrl(char *url, char **retProtocol, char **retAfterProtocol, char **retColon);
-/* Parse the URL into components that udc treats separately. 
- * *retAfterProtocol is Q-encoded to keep special chars out of filenames.  
- * Free all *ret's except *retColon when done. */
-
-void udcParseUrlFull(char *url, char **retProtocol, char **retAfterProtocol, char **retColon,
-		     char **retAuth);
-/* Parse the URL into components that udc treats separately.
- * *retAfterProtocol is Q-encoded to keep special chars out of filenames.  
- * Free all *ret's except *retColon when done. */
-
-char *udcDefaultDir();
-/* Get default directory for cache.  Use this for the udcFileOpen call if you
- * don't have anything better.... */
-
-void udcSetDefaultDir(char *path);
-/* Set default directory for cache */
-
-#define udcDevicePrefix "udc:"
-/* Prefix used by convention to indicate a file should be accessed via udc.  This is
- * followed by the local path name or a url, so in common practice you see things like:
- *     udc:http://genome.ucsc.edu/goldenPath/hg18/tracks/someTrack.bb */
-
-struct slName *udcFileCacheFiles(char *url, char *cacheDir);
-/* Return low-level list of files used in cache. */
-
-char *udcPathToUrl(const char *path, char *buf, size_t size, char *cacheDir);
-/* Translate path into an URL, store in buf, return pointer to buf if successful
- * and NULL if not. */
-
-long long int udcSizeFromCache(char *url, char *cacheDir);
-/* Look up the file size from the local cache bitmap file, or -1 if there
- * is no cache for url. */
-
-unsigned long udcCacheAge(char *url, char *cacheDir);
-/* Return the age in seconds of the oldest cache file.  If a cache file is
- * missing, return the current time (seconds since the epoch). */
-
-int udcCacheTimeout();
-/* Get cache timeout (if local cache files are newer than this many seconds,
- * we won't ping the remote server to check the file size and update time). */
-
-void udcSetCacheTimeout(int timeout);
-/* Set cache timeout (if local cache files are newer than this many seconds,
- * we won't ping the remote server to check the file size and update time). */
-
-time_t udcUpdateTime(struct udcFile *udc);
-/* return udc->updateTime */
-
-boolean udcFastReadString(struct udcFile *f, char buf[256]);
-/* Read a string into buffer, which must be long enough
- * to hold it.  String is in 'writeString' format. */
-
-off_t udcFileSize(char *url);
-/* fetch remote or loca file size from given URL or path */
-
-boolean udcExists(char *url);
-/* return true if a remote or local file exists */
-
-boolean udcIsLocal(char *url);
-/* return true if url is not a http or ftp file, just a normal local file path */
-
-#endif /* UDC_H */
diff --git a/gbtools/src/include/blatSrc/unfin.h b/gbtools/src/include/blatSrc/unfin.h
deleted file mode 100644
index dd2d11e..0000000
--- a/gbtools/src/include/blatSrc/unfin.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* unfin - things to help handle unfinished (fragmented) DNA sequences). */
-#ifndef UNFIN_H
-#define UNFIN_H
-
-enum {contigPad = 800,};
-/* How may N's between contigs. */
-
-struct contigTree
-/* A hierarchical structure of contigs.  A forest of these is
- * maintained by the system.  (No need to free these.) */
-    {
-    struct contigTree  *next;    /* Sibling. */
-    struct contigTree *children; /* Sub-contigs. */
-    struct contigTree *parent;   /* Parent of contig. */
-    char *id;	       /* Ensemble ID. (Not allocated here.) */
-    int submitLength;  /* Number of bases in submission. */
-    int submitOffset;  /* Offset relative to parent in genBank submission. */
-    int orientation;   /* +1 or -1. Strand relative to parent.*/
-    int corder;        /* Order of contig in genBank submission. */
-    int browserOffset; /* Offset relative to parent for browser, ordered by ensemble, with
-                        * ensContigPad N's between each contig. */ 
-    int browserLength; /* Size including padding. */
-    };
-
-#endif /* UNFIN_H */
-
diff --git a/gbtools/src/include/blatSrc/userApp.mk b/gbtools/src/include/blatSrc/userApp.mk
deleted file mode 100644
index 257fa88..0000000
--- a/gbtools/src/include/blatSrc/userApp.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-########################################################################
-# user App rules, typical three-line makefile to use this rule set,
-#   the binary program file name is specified by the 'A' variable:
-#	kentSrc = ../..
-#	A = aveCols
-#	include ${kentSrc}/inc/userApp.mk
-#
-# for more than one object file for the resulting 'A' program, use
-#       extraObjects = second.o third.o fourth.o etc.o
-#
-# to use object files built elsewhere:
-#       externObjects = ../path/other.o
-#
-# use other libraries BEFORE jkweb.a
-#     preMyLibs += path/to/lib/other.a
-#
-include ${kentSrc}/inc/localEnvironment.mk
-include ${kentSrc}/inc/common.mk
-
-DEPLIBS = ${preMyLibs} ${kentSrc}/lib/${MACHTYPE}/jkweb.a
-ifeq ($(findstring src/hg/,${CURDIR}),src/hg/)
-  DEPLIBS = ${preMyLibs} ${kentSrc}/lib/${MACHTYPE}/jkhgap.a ${kentSrc}/lib/${MACHTYPE}/jkweb.a
-endif
-
-LINKLIBS = ${DEPLIBS} ${MYSQLLIBS} -lm
-
-O = ${A}.o
-objects = ${O} ${extraObjects} ${externObjects}
-
-${DESTDIR}${BINDIR}/${A}${EXE}: ${DEPLIBS} ${O} ${extraObjects}
-	${CC} ${COPT} -o ${DESTDIR}${BINDIR}/${A}${EXE} ${objects} ${LINKLIBS} ${L} -lm
-	${STRIP} ${DESTDIR}${BINDIR}/${A}${EXE}
-
-compile:: ${DEPLIBS} ${O} ${extraObjects}
-	${CC} ${COPT} ${CFLAGS} -o ${A}${EXE} ${objects} ${LINKLIBS} ${L} -lm
-
-install:: compile
-	rm -f ${DESTDIR}${BINDIR}/${A}${EXE}
-	cp -p ${A}${EXE} ${DESTDIR}${BINDIR}/${A}${EXE}
-	${STRIP} ${A}${EXE} ${DESTDIR}${BINDIR}/${A}${EXE}
-	rm -f ${O} ${A}${EXE}
-
-clean::
-	rm -f ${O} ${extraObjects} ${A}${EXE}
-	@if test -d tests -a -s tests/makefile; then cd tests && ${MAKE} clean; fi
-
-test::
-	@if test -d tests -a -s tests/makefile; then (cd tests && ${MAKE} test); \
-	else echo "# no tests directory (or perhaps no tests/makefile) in $(CURDIR)"; fi
diff --git a/gbtools/src/include/blatSrc/vGfx.h b/gbtools/src/include/blatSrc/vGfx.h
deleted file mode 100644
index 63dd864..0000000
--- a/gbtools/src/include/blatSrc/vGfx.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* vGfx - interface to polymorphic graphic object
- * that currently can either be a memory buffer or
- * a postScript file. */
-
-#ifndef VGFX_H
-#define VGFX_H
-
-#ifndef MEMGFX_H
-#include "memgfx.h"
-#endif
-
-struct vGfx
-/* Virtual graphic object - mostly a bunch of function
- * pointers. */
-    {
-    struct vGfx *next;	/* Next in list. */
-    void *data;		/* Type specific data. */
-    boolean pixelBased; /* Real pixels, not PostScript or something. */
-    int width, height;  /* Virtual pixel dimensions. */
-
-    void (*close)(void **pV);
-    /* Finish writing out and free structure. */
-
-    void (*dot)(void *v, int x, int y, int colorIx);
-    /* Draw a single pixel.  Try to work at a higher level
-     * when possible! */
-
-    int (*getDot)(void *v, int x, int y);
-    /* Fetch a single pixel.  Please do not use this, this is special
-     * for verticalText only. */
-
-    void (*box)(void *v, int x, int y, 
-	    int width, int height, int colorIx);
-    /* Draw a box. */
-
-    void (*line)(void *v, 
-	    int x1, int y1, int x2, int y2, int colorIx);
-    /* Draw a line from one point to another. */
-
-    void (*text)(void *v, int x, int y, int colorIx, void *font, char *text);
-    /* Draw a line of text with upper left corner x,y. */
-
-    void (*textRight)(void *v, int x, int y, int width, int height,
-    	int colorIx, void *font, char *text);
-   /* Draw a line of text right justified in box defined by x/y/width/height */
-
-    void (*textCentered)(void *v, int x, int y, int width, int height,
-    	int colorIx, void *font, char *text);
-    /* Draw a line of text in middle of box. */
-
-    int (*findColorIx)(void *v, int r, int g, int b);
-    /* Find color in map if possible, otherwise create new color or
-     * in a pinch a close color. */
-
-    struct rgbColor (*colorIxToRgb)(void *v, int colorIx);
-    /* Return rgb values for given color index. */
-
-    void (*setWriteMode)(void *v, unsigned int writeMode);
-    /* Set write mode. */
-
-    void (*setClip)(void *v, int x, int y, int width, int height);
-    /* Set clipping rectangle. */
-
-    void (*unclip)(void *v);
-    /* Set clipping rect cover full thing. */
-
-    void (*verticalSmear)(void *v,
-	    int xOff, int yOff, int width, int height, 
-	    Color *dots, boolean zeroClear);
-    /* Put a series of one 'pixel' width vertical lines. */
-
-    void (*fillUnder)(void *v, int x1, int y1, int x2, int y2, 
-	    int bottom, Color color);
-    /* Draw a 4 sided filled figure that has line x1/y1 to x2/y2 at
-     * it's top, a horizontal line at bottom at it's bottom,  and
-     * vertical lines from the bottom to y1 on the left and bottom to
-     * y2 on the right. */
-
-    void (*drawPoly)(void *v, struct gfxPoly *poly, Color color, 
-    	boolean filled);
-    /* Draw polygon, possibly filled in color. */
-
-    void (*setHint)(void *v, char *hint, char *value);
-    /* Set hint */
-
-    char * (*getHint)(void *v, char *hint);
-    /* Get hint */
-
-    int (*getFontPixelHeight)(void *v, void *font);
-    /* How high in pixels is font? */
-
-    int (*getFontStringWidth)(void *v, void *font, char *string);
-    /* How wide is a string? */
-    };
-
-struct vGfx *vgOpenPng(int width, int height, char *fileName, boolean useTransparency);
-/* Open up something that will write out a PNG file upon vgClose.  
- * If useTransparency, then the first color in memgfx's colormap/palette is
- * assumed to be the image background color, and pixels of that color
- * are made transparent. */
-
-struct vGfx *vgOpenPostScript(int width, int height, char *fileName);
-/* Open up something that will someday be a PostScript file. */
-
-void vgClose(struct vGfx **pVg);
-/* Close down virtual graphics object, and finish writing it to file. */
-
-#define vgDot(v,x,y, color) v->dot(v->data,x,y,color)
-/* Draw a single pixel.  Try to work at a higher level
- * when possible! */
-
-#define vgGetDot(v,x,y) v->getDot(v->data,x,y)
-/* Fetch a single pixel.  Please do not use this, this is special for
- * verticalText only */
-
-#define vgBox(v,x,y,width,height,color) v->box(v->data,x,y,width,height,color)
-/* Draw a box. */
-
-#define vgLine(v,x1,y1,x2,y2,color) v->line(v->data,x1,y1,x2,y2,color)
-/* Draw a line from one point to another. */
-
-#define vgText(v,x,y,color,font,string) v->text(v->data,x,y,color,font,string)
-/* Draw a line of text with upper left corner x,y. */
-
-#define vgTextRight(v,x,y,width,height,color,font,string) \
-	v->textRight(v->data,x,y,width,height,color,font,string)
-/* Draw a line of text right justified in box defined by x/y/width/height */
-
-#define vgTextCentered(v,x,y,width,height,color,font,string) \
-	v->textCentered(v->data,x,y,width,height,color,font,string)
-/* Draw a line of text in middle of box. */
-
-#define vgFindColorIx(v,r,g,b) v->findColorIx(v->data, r, g, b)
-/* Find index of RGB color.  */
-
-#define vgColorIxToRgb(v,colorIx) v->colorIxToRgb(v->data, colorIx)
-/* Return rgb values for given color index. */
-
-#define vgSetWriteMode(v, writeMode)    \
-	v->setWriteMode(v->data, writeMode)
-/* Set write mode. */
-
-#define vgSetClip(v,x,y,width,height) \
-	v->setClip(v->data, x, y, width, height)
-/* Set clipping rectangle. */
-
-#define vgUnclip(v) v->unclip(v->data);
-/* Get rid of clipping rectangle.  Note this is not completely
- * the same in PostScript and the memory images.  PostScript
- * demands that vgSetClip/vgUnclip come in pairs, and that
- * vgSetClip just further restrict a previous vgSetClip call.
- * The only portable way to do this is to strictly pair up
- * the setClip/unclip calls and not to nest them. */
-
-#define vgVerticalSmear(v,x,y,w,h,dots,zeroClear) \
-	v->verticalSmear(v->data,x,y,w,h,dots,zeroClear)
-/* Take array of dots and smear them vertically. */
-
-#define vgFillUnder(v,x1,y1,x2,y2,bottom,color) \
-	v->fillUnder(v->data,x1,y1,x2,y2,bottom,color)
-    /* Draw a 4 sided filled figure that has line x1/y1 to x2/y2 at
-     * it's top, a horizontal line at bottom at it's bottom,  and
-     * vertical lines from the bottom to y1 on the left and bottom to
-     * y2 on the right. */
-
-#define vgDrawPoly(v,poly,color,filled) \
-	v->drawPoly(v->data,poly,color,filled)
-    /* Draw a polygon in color, optionally filled. */
-
-#define vgSetHint(v,hint,value) \
-	v->setHint(v->data,hint,value)
-    /* Set hint */
-
-#define vgGetHint(v,hint) \
-	v->getHint(v->data,hint)
-    /* Get hint */
-
-#define vgGetFontPixelHeight(v,font) \
-	v->getFontPixelHeight(v->data,font)
-    /* How high in pixels is font? */
-
-#define vgGetFontStringWidth(v,font,string) \
-	v->getFontStringWidth(v->data,font,string)
-    /* How wide is a string? */
-
-int vgFindRgb(struct vGfx *vg, struct rgbColor *rgb);
-/* Find color index corresponding to rgb color. */
-
-Color vgContrastingColor(struct vGfx *vg, int backgroundIx);
-/* Return black or white whichever would be more visible over
- * background. */
-
-#endif /* VGFX_H */
diff --git a/gbtools/src/include/blatSrc/vcf.h b/gbtools/src/include/blatSrc/vcf.h
deleted file mode 100644
index 103a7d0..0000000
--- a/gbtools/src/include/blatSrc/vcf.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/* VCF: Variant Call Format, version 4.0 / 4.1
- * http://www.1000genomes.org/wiki/Analysis/Variant%20Call%20Format/vcf-variant-call-format-version-40
- * http://www.1000genomes.org/wiki/Analysis/Variant%20Call%20Format/vcf-variant-call-format-version-41
- * The vcfFile object borrows many memory handling and error reporting tricks from MarkD's
- * gff3File; any local deficiencies are not to reflect poorly on Mark's fine work! :) */
-
-#ifndef vcf_h
-#define vcf_h
-
-#include "limits.h"
-#include "hash.h"
-#include "linefile.h"
-#include "asParse.h"
-
-enum vcfInfoType
-/* VCF header defines INFO column components; each component has one of these types: */
-    {
-    vcfInfoNoType,	// uninitialized value (0) or unrecognized type name
-    vcfInfoInteger,
-    vcfInfoFloat,
-    vcfInfoFlag,
-    vcfInfoCharacter,
-    vcfInfoString,
-    };
-
-union vcfDatum
-/* Container for a value whose type is specified by an enum vcfInfoType. */
-    {
-    int datInt;
-    double datFloat;
-    boolean datFlag;
-    char datChar;
-    char *datString;
-    };
-
-struct vcfInfoDef
-/* Definition of INFO column component from VCF header: */
-    {
-    struct vcfInfoDef *next;
-    char *key;			// A short identifier, e.g. MQ for mapping quality
-    int fieldCount;		// The number of values to follow the id, or -1 if it varies
-    enum vcfInfoType type;	// The type of values that follow the id
-    char *description;		// Brief description of info
-    };
-
-struct vcfInfoElement
-/* A single INFO column component; each row's INFO column may contain multiple components. */
-    {
-    char *key;			// An identifier described by a struct vcfInfoDef
-    int count;			// Number of data values following id
-    union vcfDatum *values;	// Array of data values following id
-    bool *missingData;		// Array of flags for missing data values ("." instead of number)
-    };
-
-struct vcfGenotype
-/* A single component of the optional GENOTYPE column. */
-    {
-    char *id;			// Name of individual/sample (pointer to vcfFile genotypeIds) or .
-    char hapIxA;		// Index of one haplotype's allele: 0=reference, 1=alt, 2=other alt
-				// *or* if negative, missing data
-    char hapIxB;		// Index of other haplotype's allele, or if negative, missing data
-    bool isPhased;		// True if haplotypes are phased
-    bool isHaploid;		// True if there is only one haplotype (e.g. chrY)
-    int infoCount;		// Number of components named in FORMAT column
-    struct vcfInfoElement *infoElements;	// Array of info components for this genotype call
-    };
-
-struct vcfRecord
-/* A VCF data row (or list of rows). */
-{
-    struct vcfRecord *next;
-    char *chrom;		// Reference assembly sequence name
-    unsigned int chromStart;	// Start offset in chrom
-    unsigned int chromEnd;	// End offset in chrom
-    char *name;			// Variant name from ID column
-    int alleleCount;		// Number of alleles (reference + alternates)
-    char **alleles;		// Alleles: reference first then alternate alleles
-    char *qual;			// . or Phred-scaled score, i.e. -10log_10 P(call in ALT is wrong)
-    int filterCount;		// Number of ;-separated filter codes in FILTER column
-    char **filters;		// Code(s) described in header for failed filters (or PASS or .)
-    int infoCount;		// Number of components of INFO column
-    struct vcfInfoElement *infoElements;	// Array of INFO column components
-    char *format;		// Optional column containing ordered list of genotype components
-    char **genotypeUnparsedStrings;	// Temporary array of unparsed optional genotype columns
-    struct vcfGenotype *genotypes;	// If built, array of parsed genotype components;
-					// call vcfParseGenotypes(record) to build.
-    struct vcfFile *file;	// Pointer back to parent vcfFile
-};
-
-struct vcfFile
-/* Info extracted from a VCF file.  Manages all memory for contents.
- * Clearly borrowing structure from MarkD's gff3File. :) */
-{
-    char *fileOrUrl;		// VCF local file path or URL
-    char *headerString;		// Complete original header including newlines.
-    int majorVersion;		// 4 etc.
-    int minorVersion;		// 0, 1 etc.
-    struct vcfInfoDef *infoDefs;	// Header's definitions of INFO column components
-    struct vcfInfoDef *filterDefs;	// Header's definitions of FILTER column failure codes
-    struct vcfInfoDef *altDefs;	// Header's defs of symbolic alternate alleles (e.g. DEL, INS)
-    struct vcfInfoDef *gtFormatDefs;	// Header's defs of GENOTYPE compnts. listed in FORMAT col.
-    int genotypeCount;		// Number of optional genotype columns described in header
-    char **genotypeIds;		// Array of optional genotype column names described in header
-    struct vcfRecord *records;	// VCF data rows, sorted by position
-    struct hash *byName;		// Hash records by name -- not populated until needed.
-    struct hash *pool;		// Used to allocate string values that tend to
-				// be repeated in the files.  hash's localMem is also used to
-				// allocated memory for all other objects (if recordPool null)
-    struct lm *reusePool;       // If created with vcfFileMakeReusePool, non-shared record data is
-                                // allocated from this pool. Useful when walking through huge files.
-    struct lineFile *lf;	// Used only during parsing
-    int maxErr;			// Maximum number of errors before aborting
-    int errCnt;			// Error count
-};
-
-/* Reserved but optional INFO keys: */
-extern const char *vcfInfoAncestralAllele;
-extern const char *vcfInfoPerAlleleGtCount;	// allele count in genotypes, for each ALT allele,
-						// in the same order as listed
-extern const char *vcfInfoAlleleFrequency;  	// allele frequency for each ALT allele in the same
-						// order as listed: use this when estimated from
-						// primary data, not called genotypes
-extern const char *vcfInfoNumAlleles;		// total number of alleles in called genotypes
-extern const char *vcfInfoBaseQuality;		// RMS base quality at this position
-extern const char *vcfInfoCigar;		// cigar string describing how to align an
-						// alternate allele to the reference allele
-extern const char *vcfInfoIsDbSnp;		// dbSNP membership
-extern const char *vcfInfoDepth;		// combined depth across samples, e.g. DP=154
-extern const char *vcfInfoEnd;			// end position of the variant described in this
-						// record (esp. for CNVs)
-extern const char *vcfInfoIsHapMap2;		// membership in hapmap2
-extern const char *vcfInfoIsHapMap3;		// membership in hapmap3
-extern const char *vcfInfoIs1000Genomes;	// membership in 1000 Genomes
-extern const char *vcfInfoMappingQuality;	// RMS mapping quality, e.g. MQ=52
-extern const char *vcfInfoMapQual0Count;	// number of MAPQ == 0 reads covering this record
-extern const char *vcfInfoNumSamples;		// Number of samples with data
-extern const char *vcfInfoStrandBias;		// strand bias at this position
-extern const char *vcfInfoIsSomatic;		// indicates that the record is a somatic mutation,
-						// for cancer genomics
-extern const char *vcfInfoIsValidated;		// validated by follow-up experiment
-
-/* Reserved but optional per-genotype keys: */
-extern const char *vcfGtGenotype;	// numeric allele values separated by "/" (unphased)
-					// or "|" (phased). Allele values are 0 for
-					// reference allele, 1 for the first allele in ALT,
-					// 2 for the second allele in ALT and so on.
-extern const char *vcfGtDepth;		// read depth at this position for this sample
-extern const char *vcfGtFilter;		// analogous to variant's FILTER field
-extern const char *vcfGtLikelihoods;	// three floating point log10-scaled likelihoods for
-					// AA,AB,BB genotypes where A=ref and B=alt;
-					// not applicable if site is not biallelic.
-extern const char *vcfGtPhred;		// Phred-scaled genotype likelihoods rounded to closest int
-extern const char *vcfGtConditionalQual;	// Conditional genotype quality
-					// i.e. phred quality -10log_10 P(genotype call is wrong,
-					// conditioned on the site's being variant)
-extern const char *vcfGtHaplotypeQualities;	// Two phred qualities comma separated
-extern const char *vcfGtPhaseSet;	// Set of phased genotypes to which this genotype belongs
-extern const char *vcfGtPhasingQuality;	// Phred-scaled P(alleles ordered wrongly in heterozygote)
-extern const char *vcfGtExpectedAltAlleleCount;	// Typically used in association analyses
-
-INLINE void vcfPrintDatum(FILE *f, const union vcfDatum datum, const enum vcfInfoType type)
-/* Print datum to f in the format determined by type. */
-{
-switch (type)
-    {
-    case vcfInfoInteger:
-	fprintf(f, "%d", datum.datInt);
-	break;
-    case vcfInfoFloat:
-	fprintf(f, "%f", datum.datFloat);
-	break;
-    case vcfInfoFlag:
-	fprintf(f, "%s", datum.datString); // Flags could have values in older VCF
-	break;
-    case vcfInfoCharacter:
-	fprintf(f, "%c", datum.datChar);
-	break;
-    case vcfInfoString:
-	fprintf(f, "%s", datum.datString);
-	break;
-    default:
-	errAbort("vcfPrintDatum: Unrecognized type %d", type);
-	break;
-    }
-}
-
-#define VCF_IGNORE_ERRS (INT_MAX - 1)
-
-struct vcfFile *vcfFileNew();
-/* Return a new, empty vcfFile object. */
-
-struct vcfFile *vcfFileMayOpen(char *fileOrUrl, char *chrom, int start, int end,
-			       int maxErr, int maxRecords, boolean parseAll);
-/* Open fileOrUrl and parse VCF header; return NULL if unable.
- * If chrom is non-NULL, scan past any variants that precede {chrom, chromStart}.
- * Note: this is very inefficient -- it's better to use vcfTabix if possible!
- * If parseAll, then read in all lines in region, parse and store in
- * vcff->records; if maxErr >= zero, then continue to parse until
- * there are maxErr+1 errors.  A maxErr less than zero does not stop
- * and reports all errors. Set maxErr to VCF_IGNORE_ERRS for silence. */
-
-struct vcfFile *vcfTabixFileMayOpen(char *fileOrUrl, char *chrom, int start, int end,
-				    int maxErr, int maxRecords);
-/* Open a VCF file that has been compressed and indexed by tabix and
- * parse VCF header, or return NULL if unable.  If chrom is non-NULL,
- * seek to the position range and parse all lines in range into
- * vcff->records.  If maxErr >= zero, then continue to parse until
- * there are maxErr+1 errors.  A maxErr less than zero does not stop
- * and reports all errors. Set maxErr to VCF_IGNORE_ERRS for silence. */
-
-int vcfTabixBatchRead(struct vcfFile *vcff, char *chrom, int start, int end,
-                      int maxErr, int maxRecords);
-// Reads a batch of records from an opened and indexed VCF file, adding them to
-// vcff->records and returning the count of new records added in this batch.
-// Note: vcff->records will continue to be sorted, even if batches are loaded
-// out of order.  Additionally, resulting vcff->records will contain no duplicates
-// so returned count refects only the new records added, as opposed to all records
-// in range.  If maxErr >= zero, then continue to parse until there are maxErr+1
-// errors.  A maxErr less than zero does not stop and reports all errors.  Set
-// maxErr to VCF_IGNORE_ERRS for silence.
-
-void vcfFileMakeReusePool(struct vcfFile *vcff, int initialSize);
-// Creates a separate memory pool for records.  Establishing this pool allows
-// using vcfFileFlushRecords to abandon previously read records and free
-// the associated memory. Very useful when reading an entire file in batches.
-#define vcfFileLm(vcff) ((vcff)->reusePool ? (vcff)->reusePool : (vcff)->pool->lm)
-
-void vcfFileFlushRecords(struct vcfFile *vcff);
-// Abandons all previously read vcff->records and flushes the reuse pool (if it exists).
-// USE WITH CAUTION.  All previously allocated record pointers are now invalid.
-
-struct vcfRecord *vcfNextRecord(struct vcfFile *vcff);
-/* Parse the words in the next line from vcff into a vcfRecord. Return NULL at end of file.
- * Note: this does not store record in vcff->records! */
-
-struct vcfRecord *vcfRecordFromRow(struct vcfFile *vcff, char **words);
-/* Parse words from a VCF data line into a VCF record structure. */
-
-unsigned int vcfRecordTrimIndelLeftBase(struct vcfRecord *rec);
-/* For indels, VCF includes the left neighboring base; for example, if the alleles are
- * AA/- following a G base, then the VCF record will start one base to the left and have
- * "GAA" and "G" as the alleles.  That is not nice for display for two reasons:
- * 1. Indels appear one base wider than their dbSNP entries.
- * 2. In pgSnp display mode, the two alleles are always the same color.
- * However, for hgTracks' mapBox we need the correct chromStart for identifying the
- * record in hgc -- so return the original chromStart. */
-
-unsigned int vcfRecordTrimAllelesRight(struct vcfRecord *rec);
-/* Some tools output indels with extra base to the right, for example ref=ACC, alt=ACCC
- * which should be ref=A, alt=AC.  When the extra bases make the variant extend from an
- * intron (or gap) into an exon, it can cause a false appearance of a frameshift.
- * To avoid this, when all alleles have identical base(s) at the end, trim all of them,
- * and update rec->chromEnd.
- * For hgTracks' mapBox we need the correct chromStart for identifying the record in hgc,
- * so return the original chromEnd. */
-
-int vcfRecordCmp(const void *va, const void *vb);
-/* Compare to sort based on position. */
-
-void vcfFileFree(struct vcfFile **vcffPtr);
-/* Free a vcfFile object. */
-
-const struct vcfRecord *vcfFileFindVariant(struct vcfFile *vcff, char *variantId);
-/* Return all records with name=variantId, or NULL if not found. */
-
-const struct vcfInfoElement *vcfRecordFindInfo(const struct vcfRecord *record, char *key);
-/* Find an INFO element, or NULL. */
-
-struct vcfInfoDef *vcfInfoDefForKey(struct vcfFile *vcff, const char *key);
-/* Return infoDef for key, or NULL if it wasn't specified in the header or VCF spec. */
-
-void vcfParseGenotypes(struct vcfRecord *record);
-/* Translate record->genotypesUnparsedStrings[] into proper struct vcfGenotype[].
- * This destroys genotypesUnparsedStrings. */
-
-const struct vcfGenotype *vcfRecordFindGenotype(struct vcfRecord *record, char *sampleId);
-/* Find the genotype and associated info for the individual, or return NULL.
- * This calls vcfParseGenotypes if it has not already been called. */
-
-struct vcfInfoDef *vcfInfoDefForGtKey(struct vcfFile *vcff, const char *key);
-/* Look up the type of genotype FORMAT component key, in the definitions from the header,
- * and failing that, from the keys reserved in the spec. */
-
-char *vcfFilePooledStr(struct vcfFile *vcff, char *str);
-/* Allocate memory for a string from vcff's shared string pool. */
-
-#define VCF_NUM_COLS 10
-
-struct asObject *vcfAsObj();
-// Return asObject describing fields of VCF
-
-char *vcfGetSlashSepAllelesFromWords(char **words, struct dyString *dy);
-/* Overwrite dy with a /-separated allele string from VCF words,
- * skipping the extra initial base that VCF requires for indel alleles if necessary.
- * Return dy->string for convenience. */
-
-#endif // vcf_h
diff --git a/gbtools/src/include/blatSrc/vcfBits.h b/gbtools/src/include/blatSrc/vcfBits.h
deleted file mode 100644
index 477ac05..0000000
--- a/gbtools/src/include/blatSrc/vcfBits.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* vcfBits.c/.h: Variant Call Format, analysis by bit maps.
- * The routines found here are dependent upon vcf.c/.h for accessing vcf records.
- * They allow analysis of a set of vcf records by bit maps with one bit map per variant
- * location and where each haplotype covered by the vcf record is represented by a single
- * bit (or pair of bits). Additional analysis can be performed by creating haplotype based
- * bit maps from variant bit maps.  There is one haplotype bit map for each haplotype
- * (subject chromosome) with one (or two) bits for each variant location in the set of records. */
-
-#ifndef vcfBits_h
-#define vcfBits_h
-
-#include "vcf.h"
-#include "bits.h"
-#include "elmTree.h"
-
-enum variantType
-/* VCF header defines INFO column components; each component has one of these types: */
-    {
-    vtNoType    = 0,   // uninitialized value (0) or unrecognized type name
-    vtSNP       = 1,   // Single Nucleotide polymorphism (most)
-    vtInsertion = 2,   // Insertion relative to reference genome
-    vtDeletion  = 3,   // Insertion relative to reference genome
-    };
-
-struct variantBits
-// all genotypes/haplotypes/alleles for one record are converted to a bit map
-// One struct per variant record in vcff->records.  One slot per genotype containing
-// 2 slots for haplotypes and then 1 or 2 bits per allele.
-    {
-    struct variantBits *next;
-    struct vcfRecord *record;     // keep track of record for later interpretation
-    enum variantType vType;       // Might as well know this up front
-    int genotypeSlots;            // subjects covered in vcf file
-    unsigned char haplotypeSlots; // 2 unless haploid or homozygous only
-    unsigned char alleleSlots;    // 1 for 1 alt allele, 2 for 2 or 3 alt alleles >3 unsupported
-    int bitsOn;                   // count of bits on.
-    Bits *bits;                   // allele bits genotype x haplotype x allele
-    Bits *unphased;               // unphased bits (1 bit per genotype) if requested, else NULL
-    void **variants;              // special purposes array of variants filled and used by caller
-    };
-
-#define genoIxFromGenoHapIx(vBits,genoHaploIx)  (genoHaploIx / vBits->haplotypeSlots)
-#define hapIxFromGenoHapIx(vBits,genoHaploIx)   (genoHaploIx % vBits->haplotypeSlots)
-#define genoHapIx(vBits,genoIx,hapIx)          ((genoIx * vBits->haplotypeSlots) + hapIx)
-#define vBitsSlot(vBits,genoIx,hapIx,variantIx) \
-        ( (genoHapIx(vBits,genoIx,hapIx) * vBits->alleleSlots) + variantIx)
-#define vBitsSlotCount(vBits) \
-        ((vBits)->genotypeSlots * (vBits)->haplotypeSlots * (vBits)->alleleSlots)
-#define vcfBitsSubjectCount(vBits) ((vBits)->genotypeSlots)
-
-struct variantBits *vcfRecordsToVariantBits(struct vcfFile *vcff, struct vcfRecord *records,
-                                            boolean phasedOnly, boolean homozygousOnly,
-                                            boolean unphasedBits);
-// Returns list of bit arrays covering all genotypes/haplotype/alleles per record for each record
-// provided.  If records is NULL will use vcff->records. Bit map has one slot per genotype
-// containing 2 slots for haplotypes and 1 or 2 bits per allele. The normal (simple) case of
-// 1 reference and 1 alternate allele results in 1 allele bit with 0:ref. Two or three alt alleles
-// is represented by two bits per allele (>3 non-reference alleles unsupported).
-// If phasedOnly, unphased haplotype bits will be set only if both agree (00 is uninterpretable)
-// Haploid genotypes (e.g. chrY) and homozygousOnly bitmaps contain 1 haplotype slot.
-// If unphasedBits, then vBits->unphased will contain a bitmap with 1s for all unphased genotypes.
-// NOTE: allocated from vcff pool, so closing file or flushing reusePool will invalidate this.
-
-Bits *vcfRecordHaploidBits(struct vcfFile *vcff, struct vcfRecord *record);
-// Returns array (1 bit per genotype) for each haploid genotype.
-// This is useful for interpreting chrX.
-
-int vBitsHaploidCount(struct variantBits *vBits);
-// Returns the number of subjects in the VCF dataset that are haploid at this location
-
-//#define vBitsSubjectChromCount(vBits) ((vBits)->genotypeSlots * (vBits)->haplotypeSlots)
-int vBitsSubjectChromCount(struct variantBits *vBits);
-// Returns the chromosomes in the VCF dataset that are covered at this location
-
-int vcfVariantBitsDropSparse(struct variantBits **vBitsList, int haploGenomeMin,
-                             boolean dropRefMissing);
-// Drops vBits found in less than a minimum number of haplotype genomes.  Supplying 1 will
-// drop variants found in no haplotype genomes.  Declaring dropRefMissing will drop variants
-// in all haplotype genomes (variants where reference is not represented in dataset and
-// *might* be in error). Returns count of vBits structure that were dropped.
-
-int vcfVariantBitsAlleleOccurs(struct variantBits *vBits, unsigned char alleleIx,
-                               boolean homozygousOrHaploid);
-// Counts the number of times a particular allele occurs in the subjects*chroms covered.
-// If homozygousOrHaploid then the allele must occur in both chroms to be counted
-
-int vcfVariantBitsReferenceOccurs(struct vcfFile *vcff, struct variantBits *vBitsList,
-                                  boolean homozygousOrHaploid);
-// For an entire list of vBits structs, counts the times the reference allele occurs.
-// If homozygousOrHaploid then the reference allele must occur in both chroms to be counted
-
-
-int vcfVariantMostPopularCmp(const void *va, const void *vb);
-// Compare to sort variantBits based upon how many genomes/chrom has the variant
-// This can be used to build haploBits in most populous order for tree building
-
-struct haploBits
-// all variants/haplotypes/genotypes for a set of records are converted to a bit map
-// One struct per haplotype genome covering vcff->records.  One slot per variant
-// and 1 or 2 bits per allele.  NOTE: variant slots will all be normalized to max.
-    {
-    struct haploBits *next;
-    char *ids;                 // comma separated lists of genotype names and haplotypes
-    int haploGenomes;          // count of haploid genomes this structure covers
-    int genomeIx;              // genome sample index (allows later lookups)
-    unsigned char haploidIx;   // haploid index [0,1] (allows later  lookups)
-    int variantSlots;          // count of variants covered in set of vcf records
-    unsigned char alleleSlots; // 1 for 1 alt allele, 2 for 2 or 3 alt alleles >3 unsupported
-    int bitsOn;                // count of bits on.
-    Bits *bits;                // allele bits variant x allele
-    };
-
-#define vcfRecordIxFromBitIx(hBits,bitIx)  (bitIx / hBits->alleleSlots)
-#define variantSlotFromBitIx(hBits,bitIx)  (vcfRecordIxFromBitIx(hBits,bitIx) * hBits->alleleSlots)
-#define variantNextFromBitIx(hBits,bitIx)  (variantSlotFromBitIx(hBits,bitIx) + hBits->alleleSlots)
-#define hBitsSlot(hBits,variantIx,alleleIx) ((hBits->alleleSlots * variantIx) + alleleIx)
-#define hBitsSlotCount(hBits) ((hBits)->variantSlots * (hBits)->alleleSlots)
-
-// An hBits struct is "Real" if it is generated from variants.  It may also be a subset.
-#define hBitsIsSubset(hBits)    ((hBits)->haploGenomes == 0)
-#define hBitsIsReal(hBits)      ((hBits)->haploGenomes >  0)
-
-struct haploBits *vcfVariantBitsToHaploBits(struct vcfFile *vcff, struct variantBits *vBitsList,
-                                            boolean ignoreReference);
-// Converts a set of variant bits to haplotype bits, resulting in one bit struct
-// per haplotype genome that has non-reference variations.  If ignoreReference, only
-// haplotype genomes with at lone non-reference variant are returned.
-// A haploBit array has one variant slot per vBit struct and one or more bits per allele.
-// NOTE: allocated from vcff pool, so closing file or flushing reusePool will invalidate this.
-
-int vcfHaploBitsListCollapseIdentical(struct vcfFile *vcff, struct haploBits **phBitsList,
-                                      int haploGenomeMin);
-// Collapses a list of haploBits based upon identical bit arrays.
-// If haploGenomeMin > 1, will drop all hBits structs covering less than N haploGenomes.
-// Returns count of hBit structs removed.
-
-INLINE struct variantBits *vcfHaploBitIxToVariantBits(struct haploBits *hBits, int bitIx,
-                                                      struct variantBits *vBitsList)
-// Returns appropriate vBits from vBits list associated with a given bit in an hBits struct.
-// Assumes vBitsList is in same order as hBits bit array.  Note vBits->record has full vcf details.
-{
-return slElementFromIx(vBitsList,vcfRecordIxFromBitIx(hBits,bitIx));
-}
-
-unsigned char vcfHaploBitsToVariantAlleleIx(struct haploBits *hBits,int bitIx);
-// Given a hBits struct and bitIx, what is the actual variant allele ix
-// to use when accessing the vcfRecord?
-
-enum elmNodeOverlap vcfHaploBitsCmp(const struct slList *elA, const struct slList *elB,
-                                    int *matchWeight, void *extra);
-// HaploBits compare routine for building tree of relations using elmTreeGrow().
-
-struct slList *vcfHaploBitsMatching(const struct slList *elA, const struct slList *elB,
-                                    void *extra);
-// Returns a HaploBits structure representing the common parts of elements A and B.
-// Used with elmTreeGrow() to create nodes that are the common parts between leaves/branches.
-
-#endif // vcfBits_h
diff --git a/gbtools/src/include/blatSrc/verbose.h b/gbtools/src/include/blatSrc/verbose.h
deleted file mode 100644
index 4dd68b7..0000000
--- a/gbtools/src/include/blatSrc/verbose.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* verbose.h - write out status messages according to the
- * current verbosity level.  These messages go to stderr. */
-
-#ifndef VERBOSE_H
-#define VERBOSE_H
-
-void verbose(int verbosity, char *format, ...)
-/* Write printf formatted message to log (which by
- * default is stderr) if global verbose variable
- * is set to verbosity or higher. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 2, 3)))
-#endif
-    ;
-
-void verboseVa(int verbosity, char *format, va_list args);
-/* Log with at given verbosity vprintf formatted args. */
-
-void verboseTimeInit(void);
-/* Initialize or reinitialize the previous time for use by verboseTime. */
-
-void verboseTime(int verbosity, char *label, ...)
-/* Print label and how long it's been since last call.  Start time can be
- * initialized with verboseTimeInit, otherwise the elapsed time will be
- * zero. */
-#if defined(__GNUC__)
-__attribute__((format(printf, 2, 3)))
-#endif
-    ;
-
-void verboseDot();
-/* Write I'm alive dot (at verbosity level 1) */
-
-boolean verboseDotsEnabled();
-/* check if outputting of happy dots are enabled.  They will be enabled if the
- * verbosity is > 0, stderr is a tty and we don't appear to be running an
- * emacs shell. */
-
-int verboseLevel(void);
-/* Get verbosity level. */
-
-void verboseSetLevel(int verbosity);
-/* Set verbosity level in log.  0 for no logging,
- * higher number for increasing verbosity. */
-
-void verboseSetLogFile(char *name);
-/* Set logFile for verbose messages overrides stderr. */
-
-FILE *verboseLogFile();
-/* Get the verbose log file. */
-
-#endif /* VERBOSE_H */
-
diff --git a/gbtools/src/include/blatSrc/wormdna.h b/gbtools/src/include/blatSrc/wormdna.h
deleted file mode 100644
index 6610600..0000000
--- a/gbtools/src/include/blatSrc/wormdna.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* WormDNA - stuff that finds C. elegans sequence data. */
-#ifndef WORMDNA_H
-#define WORMDNA_H
-
-#ifndef DNAUTIL_H
-#include "dnautil.h"
-#endif
-
-#ifndef DNASEQ_H
-#include "dnaseq.h"
-#endif 
-
-#ifndef NT4_H
-#include "nt4.h"
-#endif 
-
-#ifndef GDF_H
-#include "gdf.h"
-#endif
-
-
-struct wormCdnaInfo 
-/* Extra info stored in cDNA database other than string. */
-    {
-    char *motherString;         /* Holds memory for other strings. */
-    char *name;                 /* Name of cDNA. */
-    char *gene;                 /* Something like unc-1 */
-    char orientation;           /* + or - (relative to gene transcription direction) */
-    char *product;              /* Something like "cyclin-dependent kinase" */
-    int cdsStart, cdsEnd;       /* Start and stop of coding region within cDNA. */
-    boolean knowStart, knowEnd; /* Start known?  End known? */
-    boolean isEmbryonic;        /* True if derived from embryo culture. */
-    boolean isAdult;            /* True if derived from adult culture. */
-    boolean isMale;             /* True if males only. */
-    boolean isHermaphrodite;    /* True if hermaphrodites only. */
-    char *description;          /* One line description. */
-    };
-
-boolean wormCdnaInfo(char *name, struct wormCdnaInfo *retInfo);
-/* Get info about cDNA sequence. */
-
-void wormFaCommentIntoInfo(char *faComment, struct wormCdnaInfo *retInfo);
-/* Process line from .fa file containing information about cDNA into binary
- * structure. */
-
-void wormFreeCdnaInfo(struct wormCdnaInfo *ci);
-/* Free the mother string in the cdnaInfo.  (The info structure itself normally isn't
- * dynamically allocated. */
-
-boolean wormInfoForGene(char *orfName, struct wormCdnaInfo *retInfo);
-/* Return info if any on gene/ORF, or NULL if none exists. wormFreeCdnaInfo retInfo when done.
- */
-
-
-boolean wormCdnaSeq(char *name, struct dnaSeq **retDna, struct wormCdnaInfo *retInfo);
-/* Get a single worm cDNA sequence. Optionally (if retInfo is non-null) get additional
- * info about the sequence. */
-
-void wormCdnaUncache();
-/* Get rid of any resources used caching or quickly accessing
- * worm cDNA */
-
-
-/* Stuff for searching entire database of worm cDNA */
-
-struct wormCdnaIterator
-    {
-    FILE *faFile;
-    };
-
-boolean wormSearchAllCdna(struct wormCdnaIterator **retSi);
-/* Set up to search entire database or worm cDNA */
-
-void freeWormCdnaIterator(struct wormCdnaIterator **pIt);
-/* Free up iterator returned by wormSearchAllCdna() */
-
-struct dnaSeq *nextWormCdna(struct wormCdnaIterator *it);
-/* Return next sequence in database */
-
-boolean nextWormCdnaAndInfo(struct wormCdnaIterator *it, struct dnaSeq **retSeq, struct wormCdnaInfo *retInfo);
-/* Return next sequence and associated info from database. */
-
-char *wormFeaturesDir();
-/* Return the features directory. (Includes trailing slash.) */
-
-char *wormChromDir();
-/* Return the directory with the chromosomes. */
-
-char *wormCdnaDir();
-/* Return directory with cDNA data. */
-
-char *wormSangerDir();
-/* Return directory with Sanger specific gene predictions. */
-
-char *wormGenieDir();
-/* Return directory with Genie specific gene predictions. */
-
-char *wormXenoDir();
-/* Return directory with cross-species alignments. */
-
-boolean wormIsGeneName(char *name);
-/* See if it looks like a worm gene name - that is
- *   abc-12
- * letters followed by a dash followed by a number. */
-
-boolean wormIsOrfName(char *in);
-/* Check to see if the input is formatted correctly to be
- * an ORF. */
-
-struct slName *wormGeneToOrfNames(char *name);
-/* Returns list of cosmid.N type ORF names that are known by abc-12 type name. */
-
-char *wormGeneFirstOrfName(char *geneName);
-/* Return first ORF synonym to gene. */
-
-boolean wormGeneForOrf(char *orfName, char *geneNameBuf, int bufSize);
-/* Look for gene type (unc-12 or something) synonym for cosmid.N name. */
-
-boolean getWormGeneExonDna(char *name, DNA **retDna);
-/* get the exon sequence for a gene */
-
-boolean getWormGeneDna(char *name, DNA **retDna, boolean upcExons);
-/* Get the DNA associated with a gene.  Optionally upper case exons. */
-
-void wormLoadNt4Genome(struct nt4Seq ***retNt4Seq, int *retNt4Count);
-/* Load up entire packed worm genome into memory. */
-
-void wormFreeNt4Genome(struct nt4Seq ***pNt4Seq);
-/* Free up packed worm genome. */
-
-int wormChromSize(char *chrom);
-/* Return size of worm chromosome. */
-
-DNA *wormChromPart(char *chromId, int start, int size);
-/* Return part of a worm chromosome. */
-
-DNA *wormChromPartExonsUpper(char *chromId, int start, int size);
-/* Return part of a worm chromosome with exons in upper case. */
-
-void wormChromNames(char ***retNames, int *retNameCount);
-/* Get list of worm chromosome names. */
-
-int wormChromIx(char *name);
-/* Return index of worm chromosome. */
-
-char *wormChromForIx(int ix);
-/* Given ix, return worm chromosome official name. */
-
-char *wormOfficialChromName(char *name);
-/* This returns a pointer to our official string for the chromosome name.
- * (This allows some routines to do directo pointer comparisons rather
- * than string comparisons.) */
-
-boolean wormGeneRange(char *name, char **retChromId, char *retStrand, int *retStart, int *retEnd);
-/* Return chromosome position of a gene, ORF,  nameless cluster, or cosmid. Returns
- * FALSE if no such gene/cluster. */
-
-boolean wormParseChromRange(char *in, char **retChromId, int *retStart, int *retEnd);
-/* Chop up a string representation of a range within a chromosome and put the
- * pieces into the return variables. Return FALSE if it isn't formatted right. */
-
-boolean wormIsChromRange(char *in);
-/* Check to see if the input is formatted correctly to be
- * a range of a chromosome. */
-
-void wormClipRangeToChrom(char *chrom, int *pStart, int *pEnd);
-/* Make sure that we stay inside chromosome. */
-
-boolean wormIsNamelessCluster(char *name);
-/* Returns true if name is of correct format to be a nameless cluster. */
-
-DNA *wormGetNamelessClusterDna(char *name);
-/* Get DNA associated with nameless cluster */
-
-struct wormFeature
-/* This holds info on where something is in the genome. */
-    {
-    struct wormFeature *next;
-    char *chrom;    /* One of names returned by */
-    int start, end;
-    char typeByte;
-    char name[1];   /* Allocated to fit. */
-    };
-
-struct wormFeature *newWormFeature(char *name, char *chrom, int start, int end, char typeByte);
-/* Allocate a new feature. */
-
-struct wormFeature *wormCdnasInRange(char *chromId, int start, int end);
-/* Get info on all cDNAs that overlap the range. */
-
-struct wormFeature *wormGenesInRange(char *chromId, int start, int end);
-/* Get info on all genes that overlap the range. */
-
-struct wormFeature *wormSomeGenesInRange(char *chromId, int start, int end, char *gdfDir);
-/* Get info on genes that overlap range in a particular set of gene predictions. */
-
-struct wormFeature *wormCosmidsInRange(char *chromId, int start, int end);
-/* Get info on all cosmids that overlap the range. */
-
-struct cdaAli *wormCdaAlisInRange(char *chromId, int start, int end);
-/* Return list of cdna alignments that overlap range. */
-
-FILE *wormOpenGoodAli();
-/* Opens good alignment file and reads signature. 
- * (You can then cdaLoadOne() it.) */
-
-struct wormGdfCache
-/* Helps managed fast indexed access to gene predictions. */
-    {
-    char **pDir;
-    struct snof *snof;
-    FILE *file;
-    };
-extern struct wormGdfCache wormSangerGdfCache;
-extern struct wormGdfCache wormGenieGdfCache;
-
-struct gdfGene *wormGetGdfGene(char *name);
-/* Get the named gdfGene. */
-
-struct gdfGene *wormGetSomeGdfGene(char *name, struct wormGdfCache *cache);
-/* Get a single gdfGene of given name. */
-
-struct gdfGene *wormGetGdfGeneList(char *baseName, int baseNameSize);
-/* Get all gdfGenes that start with a given name. */
-
-struct gdfGene *wormGetSomeGdfGeneList(char *baseName, int baseNameSize, struct wormGdfCache *cache);
-/* Get all gdfGenes that start with a given name. */
-
-struct gdfGene *wormGdfGenesInRange(char *chrom, int start, int end, 
-    struct wormGdfCache *geneFinder);
-/* Get list of genes in range according to given gene finder. */
-
-void wormUncacheGdf();
-/* Free up resources associated with fast GDF access. */
-
-void wormUncacheSomeGdf(struct wormGdfCache *cache);
-/* Uncache some gene prediction set. */
-
-#endif /* WORMDNA_H */
-
diff --git a/gbtools/src/include/blatSrc/xAli.h b/gbtools/src/include/blatSrc/xAli.h
deleted file mode 100644
index 205823e..0000000
--- a/gbtools/src/include/blatSrc/xAli.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* xAli.h was originally generated by the autoSql program, which also 
- * generated xAli.c and xAli.sql.  This header links the database and
- * the RAM representation of objects. */
-
-#ifndef XALI_H
-#define XALI_H
-
-struct xAli
-/* An alignment - like psl but includes the sequence itself */
-    {
-    struct xAli *next;  /* Next in singly linked list. */
-    unsigned match;	/* Number of bases that match that aren't repeats */
-    unsigned misMatch;	/* Number of bases that don't match */
-    unsigned repMatch;	/* Number of bases that match but are part of repeats */
-    unsigned nCount;	/* Number of 'N' bases */
-    unsigned qNumInsert;	/* Number of inserts in query */
-    int qBaseInsert;	/* Number of bases inserted in query */
-    unsigned tNumInsert;	/* Number of inserts in target */
-    int tBaseInsert;	/* Number of bases inserted in target */
-    char strand[3];	/* + or - for strand. First character query, second target (optional) */
-    char *qName;	/* Query sequence name */
-    unsigned qSize;	/* Query sequence size */
-    unsigned qStart;	/* Alignment start position in query */
-    unsigned qEnd;	/* Alignment end position in query */
-    char *tName;	/* Target sequence name */
-    unsigned tSize;	/* Target sequence size */
-    unsigned tStart;	/* Alignment start position in target */
-    unsigned tEnd;	/* Alignment end position in target */
-    unsigned blockCount;	/* Number of blocks in alignment */
-    unsigned *blockSizes;	/* Size of each block */
-    unsigned *qStarts;	/* Start of each block in query. */
-    unsigned *tStarts;	/* Start of each block in target. */
-    char **qSeq;	/* Query sequence for each block. */
-    char **tSeq;	/* Target sequence for each block. */
-    };
-
-struct xAli *xAliLoad(char **row);
-/* Load a xAli from row fetched with select * from xAli
- * from database.  Dispose of this with xAliFree(). */
-
-struct xAli *xAliLoadAll(char *fileName);
-/* Load all xAli from a tab-separated file.
- * Dispose of this with xAliFreeList(). */
-
-struct xAli *xAliCommaIn(char **pS, struct xAli *ret);
-/* Create a xAli out of a comma separated string. 
- * This will fill in ret if non-null, otherwise will
- * return a new xAli */
-
-void xAliFree(struct xAli **pEl);
-/* Free a single dynamically allocated xAli such as created
- * with xAliLoad(). */
-
-void xAliFreeList(struct xAli **pList);
-/* Free a list of dynamically allocated xAli's */
-
-void xAliOutput(struct xAli *el, FILE *f, char sep, char lastSep);
-/* Print out xAli.  Separate fields with sep. Follow last field with lastSep. */
-
-#define xAliTabOut(el,f) xAliOutput(el,f,'\t','\n');
-/* Print out xAli as a line in a tab-separated file. */
-
-#define xAliCommaOut(el,f) xAliOutput(el,f,',',',');
-/* Print out xAli as a comma separated list including final comma. */
-
-/* ----------------  Start human generated code. ------------------ */
-
-struct xAli *xAliNext(struct lineFile *lf);
-/* Read next line from file and convert it to xAli.  Return
- * NULL at eof. */
-
-#endif /* XALI_H */
-
diff --git a/gbtools/src/include/blatSrc/xa.h b/gbtools/src/include/blatSrc/xa.h
deleted file mode 100644
index 0a8fe34..0000000
--- a/gbtools/src/include/blatSrc/xa.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* xa.h - manage cross species alignments stored in database. */
-#ifndef XA_H
-#define XA_H
-
-struct xaAli
-/* This contains information about one xeno alignment. */
-    {
-    struct xaAli *next;
-    char *name;
-    char *query;
-    int qStart, qEnd;
-    char qStrand;
-    char *target;
-    int tStart, tEnd;
-    char tStrand;
-    int milliScore;
-    int symCount;
-    char *qSym, *tSym, *hSym;
-    };
-
-void xaAliFree(struct xaAli *xa);
-/* Free up a single xaAli. */
-
-void xaAliFreeList(struct xaAli **pXa);
-/* Free up a list of xaAlis. */
-
-int xaAliCmpTarget(const void *va, const void *vb);
-/* Compare two xaAli's to sort by ascending target positions. */
-
-FILE *xaOpenVerify(char *fileName);
-/* Open file, verify it's the right type, and
- * position file pointer for first xaReadNext(). */
-
-FILE *xaIxOpenVerify(char *fileName);
-/* Open file, verify that it's a good xa index. */
-
-struct xaAli *xaReadNext(FILE *f, boolean condensed);
-/* Read next xaAli from file. If condensed
- * don't fill int query, target, qSym, tSym, or hSym. */
-
-struct xaAli *xaReadRange(char *rangeIndexFileName, char *dataFileName, 
-    int start, int end, boolean condensed);
-/* Return list of all xaAlis that range from start to end.  If condensed
- * don't fill int query, qSym, tSym, or hSym. */
-
-struct xaAli *xaRdRange(FILE *ix, FILE *data, 
-    int start, int end, boolean condensed);
-/* Like xaReadRange but pass in open files rather than file names. */
-
-char *xaAlignSuffix();
-/* Return suffix of file with actual alignments. */
-
-char *xaChromIxSuffix();
-/* Return suffix of files that index xa's by chromosome position. */
-
-
-#endif /* XA_H */
-
diff --git a/gbtools/src/include/blatSrc/xap.h b/gbtools/src/include/blatSrc/xap.h
deleted file mode 100644
index 7183240..0000000
--- a/gbtools/src/include/blatSrc/xap.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* xap - XML Automatic Parser - together with autoXml this helps automatically
- * read in automatically generated data structures. 
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef XAP_H
-#define XAP_H
-
-#ifndef DYSTRING_H
-#include "dystring.h"
-#endif
-
-struct xapStack
-/* An element of parse stack. */
-   {
-   void *object;	/* Object being parsed. */
-   char *elName;	/* Name of tag. */
-   struct dyString *text;	/* The text section. */
-   };
-
-struct xap
-/* A parser with a stack built in and other conveniences. */
-   {
-   struct xapStack *stack;			/* Top of stack of open tags. */
-   struct xapStack stackBuf[128];		/* Stack buffer. */
-   struct xapStack *endStack;			/* End of stack. */
-   int stackDepth;				/* Number of elements in stack. */
-   int skipDepth;				/* Depth beneath which we skip. */
-   void *(*startHandler)(struct xap *xap, char *name, char **atts);	/* Handler for start tags. */
-   void (*endHandler)(struct xap *xap, char *name);	/* Handler for end tags. */
-   struct xp *xp;				        /* Pointer to lower level parser. */
-   char *fileName;				/* Name of file being parsed - valid after xapParse. */
-   char *topType;				/* Top level type name - valid after xapParse. */
-   void *topObject;				/* Top level object - valid after xapParse. */
-   FILE *f;					/* File. */
-   };
-
-struct xap *xapNew(void *(*startHandler)(struct xap *xap, char *name, char **atts),
-	void (*endHandler)(struct xap *xap, char *name) ,
-	char *fileName);
-/* Create a new parse stack.  FileName may be NULL. */
-
-void xapFree(struct xap **pXp);
-/* Free up a parse stack. */
-
-void xapParseFile(struct xap *xap, char *fileName);
-/* Open up file and parse it all. */
-
-void xapError(struct xap *xap, char *format, ...);
-/* Issue an error message and abort*/
-
-void xapIndent(int count, FILE *f);
-/* Write out some spaces. */
-
-void xapSkip(struct xap *xap);
-/* Skip current tag and any children.  Called from startHandler. */
-
-void xapParseAny(char *fileName, char *type, 
-	void *(*startHandler)(struct xap *xap, char *name, char **atts),
-	void (*endHandler)(struct xap *xap, char *name),
-	char **retType, void *retObj);
-/* Parse any object out of an XML file. 
- * If type parameter is non-NULL, force type.
- * example:
- *     xapParseAny("file.xml", "das", dasStartHandler, dasEndHandler, &type, &obj); */
-
-struct xap *xapOpen(char *fileName, 
-	void *(*startHandler)(struct xap *xap, char *name, char **atts),
-	void (*endHandler)(struct xap *xap, char *name));
-/* Open up an xml file, but don't start parsing it yet.
- * Instead call xapNext to get the elements you want out of
- * the file.  When all done call xapFree. */
-
-void *xapNext(struct xap *xap, char *tag);
-/* Return next item matching tag (and all of it's children). */
-#endif /* XAP_H */
-
diff --git a/gbtools/src/include/blatSrc/xenalign.h b/gbtools/src/include/blatSrc/xenalign.h
deleted file mode 100644
index 21455b7..0000000
--- a/gbtools/src/include/blatSrc/xenalign.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*****************************************************************************
- * Copyright (C) 2000 Jim Kent.  This source code may be freely used         *
- * for personal, academic, and non-profit purposes.  Commercial use          *
- * permitted only by explicit agreement with Jim Kent (jim_kent at pacbell.net) *
- *****************************************************************************/
-/* xenalign.h - Do cross-species DNA alignments from scratch. */
-#ifndef XENALIGN_H
-#define XENALIGN_H
-
-#ifndef NT4_H
-#include "nt4.h"
-#endif
-
-int xenAlignSmall(DNA *query, int querySize, DNA *target, int targetSize, 
-    FILE *f, boolean printExtraAtEnds);
-/* Use dynamic programming to do small scale 
- * (querySize * targetSize < 10,000,000)
- * alignment of DNA. Write results into f.*/
-
-void xenStitch(char *inName, FILE *out, int stitchMinScore, 
-    boolean compactOutput);
-/* Do the big old stitching run putting together contents of inName
- * into contigs in out.  Create output in newer format. */
-
-void xenStitcher(char *inName, FILE *out, int stitchMinScore, boolean 
-    compactOutput);
-/* Do the big old stitching run putting together contents of inName
- * into contigs in out. Create output in older format. */
-
-void xenAlignBig(DNA *query, int qSize, DNA *target, int tSize, FILE *f, boolean forHtml);
-/* Do a big alignment - one that has to be stitched together. 
- * Write results into f. */
-
-void xenShowAli(char *qSym, char *tSym, char *hSym, int symCount, FILE *f,
-   int qOffset, int tOffset, char qStrand, char tStrand, int maxLineSize);
-/* Print alignment and HMM symbols maxLineSize bases at a time to file. */
-
-void xenAlignWorm(DNA *query, int qSize, FILE *f, boolean forHtml);
-/* Do alignment against worm genome. */
-
-#endif /* XENALIGN_H */
diff --git a/gbtools/src/include/blatSrc/xmlEscape.h b/gbtools/src/include/blatSrc/xmlEscape.h
deleted file mode 100644
index f02a860..0000000
--- a/gbtools/src/include/blatSrc/xmlEscape.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Handle escaping for XML files.  Deal with things like
- * & and &quot. */
-
-#ifndef XMLESCAPE_H
-#define XMLESCAPE_H
-
-struct hash *xmlEscapeSymHash();
-/* Return hash of predefined xml character symbols to lookup. */
-
-void xmlEscapeBytesToFile(unsigned char *buffer, int len, FILE *f);
-/* Write buffer of given length to file, escaping as need be. */
-
-void xmlEscapeStringToFile(char *s, FILE *f);
-/* Write escaped zero-terminated string to file. */
-
-#endif /* XMLESCAPE_H */
-
diff --git a/gbtools/src/include/blatSrc/xp.h b/gbtools/src/include/blatSrc/xp.h
deleted file mode 100644
index 1439657..0000000
--- a/gbtools/src/include/blatSrc/xp.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* xp - A minimal non-verifying xml parser.  It's
- * stream oriented much like expat.
- *
- * This file is copyright 2002 Jim Kent, but license is hereby
- * granted for all use - public, private or commercial. */
-
-#ifndef XP_H
-#define XP_H
-
-#ifndef DYSTRING_H
-#include "dystring.h"
-#endif
-
-struct xpStack
-/* A context stack for parser. */
-    {
-    struct dyString *tag;   /* Name of tag. */
-    struct dyString *text;  /* Contains text if any. */
-    };
-
-struct xp
-/* A minimal non-verifying xml parser. */
-    {
-    struct xp *next;	/* Next in list. */
-    struct xpStack *stack;		/* Current top of stack. */
-    struct xpStack stackBuf[64];	/* Stack buffer and start of stack. */
-    struct xpStack *stackBufEnd;	/* End of stack buffer. */
-    struct dyString *attDyBuf[128];	/* Attribute buffer as dynamic string. */
-    char *attBuf[128];    	        /* Attribute buffer as regular string. */
-    struct dyString *endTag;		/* Buffer for an end tag. */
-    void *userData;			/* Pointer to user's data structure. */
-    void (*atStartTag)(void *userData, char *name, char **atts);  /* Got start and attributes. */
-    void (*atEndTag)(void *userData, char *name, char *text);   /* Got end. */
-    int (*read)(void *userData, char *buf, int bufSize);   /* Read some more. */
-    char *fileName;			/* File name. */
-    int lineIx;				/* Number of current line. */
-    char inBuf[16*1024];		/* Text input buffer. */
-    char *inBufEnd;			/* Pointer to end of input buffer. */
-    char *in;				/* Next character to parse. */
-    struct hash *symHash;		/* Hash of > < etc. */
-    };
-
-struct xp *xpNew(void *userData, 
-   void (*atStartTag)(void *userData, char *name, char **atts),
-   void (*atEndTag)(void *userData, char *name, char *text),
-   int (*read)(void *userData, char *buf, int bufSize),
-   char *fileName);
-/* Form a new xp parser.  File name may be NULL - just used for
- * error reporting. */
-
-void xpFree(struct xp **pXp);
-/* Free up an xp parser. */
-
-int xpLineIx(struct xp *xp);
-/* Return current line number. */
-
-char *xpFileName(struct xp *xp);
-/* Return current file name. */
-
-int xpReadFromFile(void *userData, char *buf, int bufSize);
-/* This is a function you can pass to xpNew as a read handler.
- * It assumes you've passed an open FILE in as userData. */
-
-void xpError(struct xp *xp, char *format, ...);
-/* Output an error message with filename and line number included. */
-
-boolean xpParseNext(struct xp *xp, char *tag);
-/* Skip through file until get given tag.  Then parse out the
- * tag and all of it's children (calling atStartTag/atEndTag).
- * You can call this repeatedly to process all of a given tag
- * in file. */
-
-void xpParse(struct xp *xp);
-/* Parse from start tag to end tag.  Throw error if a problem.
- * Returns FALSE if nothing left to parse. */
-
-#endif /* XP_H */
-
diff --git a/gbtools/src/include/blatSrc/zlibFace.h b/gbtools/src/include/blatSrc/zlibFace.h
deleted file mode 100644
index 1b9d027..0000000
--- a/gbtools/src/include/blatSrc/zlibFace.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Wrappers around zlib to make interfacing to it a bit easier. */
-
-#ifndef ZLIBFACE_H
-#define ZLIBFACE_H
-
-size_t zCompress(
-	void *uncompressed, 	/* Start of area to compress. */
-	size_t uncompressedSize,  /* Size of area to compress. */
-	void *compBuf,       /* Where to put compressed bits */
-	size_t compBufSize); /* Size of compressed bits - calculate using zCompBufSize */
-/* Compress data from memory to memory.  Returns size after compression. */
-
-size_t zCompBufSize(size_t uncompressedSize);
-/* Return size of buffer needed to compress something of given size uncompressed. */
-
-size_t zUncompress(
-        void *compressed,	/* Compressed area */
-	size_t compressedSize,	/* Size after compression */
-	void *uncompBuf,	/* Where to put uncompressed bits */
-	size_t uncompBufSize);	/* Max size of uncompressed bits. */
-/* Uncompress data from memory to memory.  Returns size after decompression. */
-
-void zSelfTest(int count);
-/* Run an internal diagnostic. */
-
-#endif /* ZLIBFACE_H */
diff --git a/gbtools/src/include/json/json-forwards.h b/gbtools/src/include/json/json-forwards.h
deleted file mode 100644
index cff5fa9..0000000
--- a/gbtools/src/include/json/json-forwards.h
+++ /dev/null
@@ -1,319 +0,0 @@
-/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/).
-/// It is intended to be used with #include "json/json-forwards.h"
-/// This header provides forward declaration for all JsonCpp types.
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: LICENSE
-// //////////////////////////////////////////////////////////////////////
-
-/*
-The JsonCpp library's source code, including accompanying documentation, 
-tests and demonstration applications, are licensed under the following
-conditions...
-
-The author (Baptiste Lepilleur) explicitly disclaims copyright in all 
-jurisdictions which recognize such a disclaimer. In such jurisdictions, 
-this software is released into the Public Domain.
-
-In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
-2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
-released under the terms of the MIT License (see below).
-
-In jurisdictions which recognize Public Domain property, the user of this 
-software may choose to accept it either as 1) Public Domain, 2) under the 
-conditions of the MIT License (see below), or 3) under the terms of dual 
-Public Domain/MIT License conditions described here, as they choose.
-
-The MIT License is about as close to Public Domain as a license can get, and is
-described in clear, concise terms at:
-
-   http://en.wikipedia.org/wiki/MIT_License
-   
-The full text of the MIT License follows:
-
-========================================================================
-Copyright (c) 2007-2010 Baptiste Lepilleur
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use, copy,
-modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-========================================================================
-(END LICENSE TEXT)
-
-The MIT license is compatible with both the GPL and commercial
-software, affording one all of the rights of Public Domain with the
-minor nuisance of being required to keep the above copyright notice
-and license text in the source code. Note also that by accepting the
-Public Domain "license" you can re-license your copy using whatever
-license you like.
-
-*/
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: LICENSE
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED
-# define JSON_FORWARD_AMALGATED_H_INCLUDED
-/// If defined, indicates that the source file is amalgated
-/// to prevent private header inclusion.
-#define JSON_IS_AMALGAMATION
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: include/json/config.h
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef JSON_CONFIG_H_INCLUDED
-#define JSON_CONFIG_H_INCLUDED
-#include <stddef.h>
-#include <string> //typdef String
-
-/// If defined, indicates that json library is embedded in CppTL library.
-//# define JSON_IN_CPPTL 1
-
-/// If defined, indicates that json may leverage CppTL library
-//#  define JSON_USE_CPPTL 1
-/// If defined, indicates that cpptl vector based map should be used instead of
-/// std::map
-/// as Value container.
-//#  define JSON_USE_CPPTL_SMALLMAP 1
-
-// If non-zero, the library uses exceptions to report bad input instead of C
-// assertion macros. The default is to use exceptions.
-#ifndef JSON_USE_EXCEPTION
-#define JSON_USE_EXCEPTION 1
-#endif
-
-/// If defined, indicates that the source file is amalgated
-/// to prevent private header inclusion.
-/// Remarks: it is automatically defined in the generated amalgated header.
-// #define JSON_IS_AMALGAMATION
-
-#ifdef JSON_IN_CPPTL
-#include <cpptl/config.h>
-#ifndef JSON_USE_CPPTL
-#define JSON_USE_CPPTL 1
-#endif
-#endif
-
-#ifdef JSON_IN_CPPTL
-#define JSON_API CPPTL_API
-#elif defined(JSON_DLL_BUILD)
-#if defined(_MSC_VER) || defined(__MINGW32__)
-#define JSON_API __declspec(dllexport)
-#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
-#endif // if defined(_MSC_VER)
-#elif defined(JSON_DLL)
-#if defined(_MSC_VER) || defined(__MINGW32__)
-#define JSON_API __declspec(dllimport)
-#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
-#endif // if defined(_MSC_VER)
-#endif // ifdef JSON_IN_CPPTL
-#if !defined(JSON_API)
-#define JSON_API
-#endif
-
-// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
-// integer
-// Storages, and 64 bits integer support is disabled.
-// #define JSON_NO_INT64 1
-
-#if defined(_MSC_VER) // MSVC
-#  if _MSC_VER <= 1200 // MSVC 6
-    // Microsoft Visual Studio 6 only support conversion from __int64 to double
-    // (no conversion from unsigned __int64).
-#    define JSON_USE_INT64_DOUBLE_CONVERSION 1
-    // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
-    // characters in the debug information)
-    // All projects I've ever seen with VS6 were using this globally (not bothering
-    // with pragma push/pop).
-#    pragma warning(disable : 4786)
-#  endif // MSVC 6
-
-#  if _MSC_VER >= 1500 // MSVC 2008
-    /// Indicates that the following function is deprecated.
-#    define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
-#  endif
-
-#endif // defined(_MSC_VER)
-
-#if defined(_MSC_VER) && _MSC_VER <= 1600 // MSVC <= 2010
-# define JSONCPP_OVERRIDE
-#else
-# define JSONCPP_OVERRIDE override
-#endif // MSVC <= 2010
-
-
-#ifndef JSON_HAS_RVALUE_REFERENCES
-
-#if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
-#define JSON_HAS_RVALUE_REFERENCES 1
-#endif // MSVC >= 2010
-
-#ifdef __clang__
-#if __has_feature(cxx_rvalue_references)
-#define JSON_HAS_RVALUE_REFERENCES 1
-#endif  // has_feature
-
-#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
-#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
-#define JSON_HAS_RVALUE_REFERENCES 1
-#endif  // GXX_EXPERIMENTAL
-
-#endif // __clang__ || __GNUC__
-
-#endif // not defined JSON_HAS_RVALUE_REFERENCES
-
-#ifndef JSON_HAS_RVALUE_REFERENCES
-#define JSON_HAS_RVALUE_REFERENCES 0
-#endif
-
-#ifdef __clang__
-#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
-#  if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
-#    define JSONCPP_DEPRECATED(message)  __attribute__ ((deprecated(message)))
-#  elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
-#    define JSONCPP_DEPRECATED(message)  __attribute__((__deprecated__))
-#  endif  // GNUC version
-#endif // __clang__ || __GNUC__
-
-#if !defined(JSONCPP_DEPRECATED)
-#define JSONCPP_DEPRECATED(message)
-#endif // if !defined(JSONCPP_DEPRECATED)
-
-#if __GNUC__ >= 6
-#  define JSON_USE_INT64_DOUBLE_CONVERSION 1
-#endif
-
-#if !defined(JSON_IS_AMALGAMATION)
-
-# include "version.h"
-
-# if JSONCPP_USING_SECURE_MEMORY
-#  include "allocator.h" //typedef Allocator
-# endif
-
-#endif // if !defined(JSON_IS_AMALGAMATION)
-
-namespace Json {
-typedef int Int;
-typedef unsigned int UInt;
-#if defined(JSON_NO_INT64)
-typedef int LargestInt;
-typedef unsigned int LargestUInt;
-#undef JSON_HAS_INT64
-#else                 // if defined(JSON_NO_INT64)
-// For Microsoft Visual use specific types as long long is not supported
-#if defined(_MSC_VER) // Microsoft Visual Studio
-typedef __int64 Int64;
-typedef unsigned __int64 UInt64;
-#else                 // if defined(_MSC_VER) // Other platforms, use long long
-typedef long long int Int64;
-typedef unsigned long long int UInt64;
-#endif // if defined(_MSC_VER)
-typedef Int64 LargestInt;
-typedef UInt64 LargestUInt;
-#define JSON_HAS_INT64
-#endif // if defined(JSON_NO_INT64)
-#if JSONCPP_USING_SECURE_MEMORY
-#define JSONCPP_STRING        std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
-#define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
-#define JSONCPP_OSTREAM       std::basic_ostream<char, std::char_traits<char>>
-#define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
-#define JSONCPP_ISTREAM       std::istream
-#else
-#define JSONCPP_STRING        std::string
-#define JSONCPP_OSTRINGSTREAM std::ostringstream
-#define JSONCPP_OSTREAM       std::ostream
-#define JSONCPP_ISTRINGSTREAM std::istringstream
-#define JSONCPP_ISTREAM       std::istream
-#endif // if JSONCPP_USING_SECURE_MEMORY
-} // end namespace Json
-
-#endif // JSON_CONFIG_H_INCLUDED
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: include/json/config.h
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: include/json/forwards.h
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef JSON_FORWARDS_H_INCLUDED
-#define JSON_FORWARDS_H_INCLUDED
-
-#if !defined(JSON_IS_AMALGAMATION)
-#include "config.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-
-namespace Json {
-
-// writer.h
-class FastWriter;
-class StyledWriter;
-
-// reader.h
-class Reader;
-
-// features.h
-class Features;
-
-// value.h
-typedef unsigned int ArrayIndex;
-class StaticString;
-class Path;
-class PathArgument;
-class Value;
-class ValueIteratorBase;
-class ValueIterator;
-class ValueConstIterator;
-
-} // namespace Json
-
-#endif // JSON_FORWARDS_H_INCLUDED
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: include/json/forwards.h
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED
diff --git a/gbtools/src/include/json/json.h b/gbtools/src/include/json/json.h
deleted file mode 100644
index c702436..0000000
--- a/gbtools/src/include/json/json.h
+++ /dev/null
@@ -1,2241 +0,0 @@
-/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).
-/// It is intended to be used with #include "json/json.h"
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: LICENSE
-// //////////////////////////////////////////////////////////////////////
-
-/*
-The JsonCpp library's source code, including accompanying documentation, 
-tests and demonstration applications, are licensed under the following
-conditions...
-
-The author (Baptiste Lepilleur) explicitly disclaims copyright in all 
-jurisdictions which recognize such a disclaimer. In such jurisdictions, 
-this software is released into the Public Domain.
-
-In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
-2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
-released under the terms of the MIT License (see below).
-
-In jurisdictions which recognize Public Domain property, the user of this 
-software may choose to accept it either as 1) Public Domain, 2) under the 
-conditions of the MIT License (see below), or 3) under the terms of dual 
-Public Domain/MIT License conditions described here, as they choose.
-
-The MIT License is about as close to Public Domain as a license can get, and is
-described in clear, concise terms at:
-
-   http://en.wikipedia.org/wiki/MIT_License
-   
-The full text of the MIT License follows:
-
-========================================================================
-Copyright (c) 2007-2010 Baptiste Lepilleur
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use, copy,
-modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-========================================================================
-(END LICENSE TEXT)
-
-The MIT license is compatible with both the GPL and commercial
-software, affording one all of the rights of Public Domain with the
-minor nuisance of being required to keep the above copyright notice
-and license text in the source code. Note also that by accepting the
-Public Domain "license" you can re-license your copy using whatever
-license you like.
-
-*/
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: LICENSE
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-#ifndef JSON_AMALGATED_H_INCLUDED
-# define JSON_AMALGATED_H_INCLUDED
-/// If defined, indicates that the source file is amalgated
-/// to prevent private header inclusion.
-#define JSON_IS_AMALGAMATION
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: include/json/version.h
-// //////////////////////////////////////////////////////////////////////
-
-// DO NOT EDIT. This file (and "version") is generated by CMake.
-// Run CMake configure step to update it.
-#ifndef JSON_VERSION_H_INCLUDED
-# define JSON_VERSION_H_INCLUDED
-
-# define JSONCPP_VERSION_STRING "1.7.2"
-# define JSONCPP_VERSION_MAJOR 1
-# define JSONCPP_VERSION_MINOR 7
-# define JSONCPP_VERSION_PATCH 2
-# define JSONCPP_VERSION_QUALIFIER
-# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
-
-#ifdef JSONCPP_USING_SECURE_MEMORY
-#undef JSONCPP_USING_SECURE_MEMORY
-#endif
-#define JSONCPP_USING_SECURE_MEMORY 0
-// If non-zero, the library zeroes any memory that it has allocated before
-// it frees its memory.
-
-#endif // JSON_VERSION_H_INCLUDED
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: include/json/version.h
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: include/json/allocator.h
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED
-#define CPPTL_JSON_ALLOCATOR_H_INCLUDED
-
-#include <cstring>
-#include <memory>
-
-namespace Json {
-template<typename T>
-class SecureAllocator {
-	public:
-		// Type definitions
-		using value_type      = T;
-		using pointer         = T*;
-		using const_pointer   = const T*;
-		using reference       = T&;
-		using const_reference = const T&;
-		using size_type       = std::size_t;
-		using difference_type = std::ptrdiff_t;
-
-		/**
-		 * Allocate memory for N items using the standard allocator.
-		 */
-		pointer allocate(size_type n) {
-			// allocate using "global operator new"
-			return static_cast<pointer>(::operator new(n * sizeof(T)));
-		}
-
-		/**
-		 * Release memory which was allocated for N items at pointer P.
-		 *
-		 * The memory block is filled with zeroes before being released.
-		 * The pointer argument is tagged as "volatile" to prevent the
-		 * compiler optimizing out this critical step.
-		 */
-		void deallocate(volatile pointer p, size_type n) {
-			std::memset(p, 0, n * sizeof(T));
-			// free using "global operator delete"
-			::operator delete(p);
-		}
-
-		/**
-		 * Construct an item in-place at pointer P.
-		 */
-		template<typename... Args>
-		void construct(pointer p, Args&&... args) {
-			// construct using "placement new" and "perfect forwarding"
-			::new (static_cast<void*>(p)) T(std::forward<Args>(args)...);
-		}
-
-		size_type max_size() const {
-			return size_t(-1) / sizeof(T);
-		}
-
-		pointer address( reference x ) const {
-			return std::addressof(x);
-		}
-
-		const_pointer address( const_reference x ) const {
-			return std::addressof(x);
-		}
-
-		/**
-		 * Destroy an item in-place at pointer P.
-		 */
-		void destroy(pointer p) {
-			// destroy using "explicit destructor"
-			p->~T();
-		}
-
-		// Boilerplate
-		SecureAllocator() {}
-		template<typename U> SecureAllocator(const SecureAllocator<U>&) {}
-		template<typename U> struct rebind { using other = SecureAllocator<U>; };
-};
-
-
-template<typename T, typename U>
-bool operator==(const SecureAllocator<T>&, const SecureAllocator<U>&) {
-	return true;
-}
-
-template<typename T, typename U>
-bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
-	return false;
-}
-
-} //namespace Json
-
-#endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: include/json/allocator.h
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: include/json/config.h
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef JSON_CONFIG_H_INCLUDED
-#define JSON_CONFIG_H_INCLUDED
-#include <stddef.h>
-#include <string> //typdef String
-
-/// If defined, indicates that json library is embedded in CppTL library.
-//# define JSON_IN_CPPTL 1
-
-/// If defined, indicates that json may leverage CppTL library
-//#  define JSON_USE_CPPTL 1
-/// If defined, indicates that cpptl vector based map should be used instead of
-/// std::map
-/// as Value container.
-//#  define JSON_USE_CPPTL_SMALLMAP 1
-
-// If non-zero, the library uses exceptions to report bad input instead of C
-// assertion macros. The default is to use exceptions.
-#ifndef JSON_USE_EXCEPTION
-#define JSON_USE_EXCEPTION 1
-#endif
-
-/// If defined, indicates that the source file is amalgated
-/// to prevent private header inclusion.
-/// Remarks: it is automatically defined in the generated amalgated header.
-// #define JSON_IS_AMALGAMATION
-
-#ifdef JSON_IN_CPPTL
-#include <cpptl/config.h>
-#ifndef JSON_USE_CPPTL
-#define JSON_USE_CPPTL 1
-#endif
-#endif
-
-#ifdef JSON_IN_CPPTL
-#define JSON_API CPPTL_API
-#elif defined(JSON_DLL_BUILD)
-#if defined(_MSC_VER) || defined(__MINGW32__)
-#define JSON_API __declspec(dllexport)
-#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
-#endif // if defined(_MSC_VER)
-#elif defined(JSON_DLL)
-#if defined(_MSC_VER) || defined(__MINGW32__)
-#define JSON_API __declspec(dllimport)
-#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
-#endif // if defined(_MSC_VER)
-#endif // ifdef JSON_IN_CPPTL
-#if !defined(JSON_API)
-#define JSON_API
-#endif
-
-// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
-// integer
-// Storages, and 64 bits integer support is disabled.
-// #define JSON_NO_INT64 1
-
-#if defined(_MSC_VER) // MSVC
-#  if _MSC_VER <= 1200 // MSVC 6
-    // Microsoft Visual Studio 6 only support conversion from __int64 to double
-    // (no conversion from unsigned __int64).
-#    define JSON_USE_INT64_DOUBLE_CONVERSION 1
-    // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
-    // characters in the debug information)
-    // All projects I've ever seen with VS6 were using this globally (not bothering
-    // with pragma push/pop).
-#    pragma warning(disable : 4786)
-#  endif // MSVC 6
-
-#  if _MSC_VER >= 1500 // MSVC 2008
-    /// Indicates that the following function is deprecated.
-#    define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
-#  endif
-
-#endif // defined(_MSC_VER)
-
-#if defined(_MSC_VER) && _MSC_VER <= 1600 // MSVC <= 2010
-# define JSONCPP_OVERRIDE
-#else
-# define JSONCPP_OVERRIDE override
-#endif // MSVC <= 2010
-
-
-#ifndef JSON_HAS_RVALUE_REFERENCES
-
-#if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
-#define JSON_HAS_RVALUE_REFERENCES 1
-#endif // MSVC >= 2010
-
-#ifdef __clang__
-#if __has_feature(cxx_rvalue_references)
-#define JSON_HAS_RVALUE_REFERENCES 1
-#endif  // has_feature
-
-#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
-#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
-#define JSON_HAS_RVALUE_REFERENCES 1
-#endif  // GXX_EXPERIMENTAL
-
-#endif // __clang__ || __GNUC__
-
-#endif // not defined JSON_HAS_RVALUE_REFERENCES
-
-#ifndef JSON_HAS_RVALUE_REFERENCES
-#define JSON_HAS_RVALUE_REFERENCES 0
-#endif
-
-#ifdef __clang__
-#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
-#  if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
-#    define JSONCPP_DEPRECATED(message)  __attribute__ ((deprecated(message)))
-#  elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
-#    define JSONCPP_DEPRECATED(message)  __attribute__((__deprecated__))
-#  endif  // GNUC version
-#endif // __clang__ || __GNUC__
-
-#if !defined(JSONCPP_DEPRECATED)
-#define JSONCPP_DEPRECATED(message)
-#endif // if !defined(JSONCPP_DEPRECATED)
-
-#if __GNUC__ >= 6
-#  define JSON_USE_INT64_DOUBLE_CONVERSION 1
-#endif
-
-#if !defined(JSON_IS_AMALGAMATION)
-
-# include "version.h"
-
-# if JSONCPP_USING_SECURE_MEMORY
-#  include "allocator.h" //typedef Allocator
-# endif
-
-#endif // if !defined(JSON_IS_AMALGAMATION)
-
-namespace Json {
-typedef int Int;
-typedef unsigned int UInt;
-#if defined(JSON_NO_INT64)
-typedef int LargestInt;
-typedef unsigned int LargestUInt;
-#undef JSON_HAS_INT64
-#else                 // if defined(JSON_NO_INT64)
-// For Microsoft Visual use specific types as long long is not supported
-#if defined(_MSC_VER) // Microsoft Visual Studio
-typedef __int64 Int64;
-typedef unsigned __int64 UInt64;
-#else                 // if defined(_MSC_VER) // Other platforms, use long long
-typedef long long int Int64;
-typedef unsigned long long int UInt64;
-#endif // if defined(_MSC_VER)
-typedef Int64 LargestInt;
-typedef UInt64 LargestUInt;
-#define JSON_HAS_INT64
-#endif // if defined(JSON_NO_INT64)
-#if JSONCPP_USING_SECURE_MEMORY
-#define JSONCPP_STRING        std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
-#define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
-#define JSONCPP_OSTREAM       std::basic_ostream<char, std::char_traits<char>>
-#define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
-#define JSONCPP_ISTREAM       std::istream
-#else
-#define JSONCPP_STRING        std::string
-#define JSONCPP_OSTRINGSTREAM std::ostringstream
-#define JSONCPP_OSTREAM       std::ostream
-#define JSONCPP_ISTRINGSTREAM std::istringstream
-#define JSONCPP_ISTREAM       std::istream
-#endif // if JSONCPP_USING_SECURE_MEMORY
-} // end namespace Json
-
-#endif // JSON_CONFIG_H_INCLUDED
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: include/json/config.h
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: include/json/forwards.h
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef JSON_FORWARDS_H_INCLUDED
-#define JSON_FORWARDS_H_INCLUDED
-
-#if !defined(JSON_IS_AMALGAMATION)
-#include "config.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-
-namespace Json {
-
-// writer.h
-class FastWriter;
-class StyledWriter;
-
-// reader.h
-class Reader;
-
-// features.h
-class Features;
-
-// value.h
-typedef unsigned int ArrayIndex;
-class StaticString;
-class Path;
-class PathArgument;
-class Value;
-class ValueIteratorBase;
-class ValueIterator;
-class ValueConstIterator;
-
-} // namespace Json
-
-#endif // JSON_FORWARDS_H_INCLUDED
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: include/json/forwards.h
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: include/json/features.h
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef CPPTL_JSON_FEATURES_H_INCLUDED
-#define CPPTL_JSON_FEATURES_H_INCLUDED
-
-#if !defined(JSON_IS_AMALGAMATION)
-#include "forwards.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-
-namespace Json {
-
-/** \brief Configuration passed to reader and writer.
- * This configuration object can be used to force the Reader or Writer
- * to behave in a standard conforming way.
- */
-class JSON_API Features {
-public:
-  /** \brief A configuration that allows all features and assumes all strings
-   * are UTF-8.
-   * - C & C++ comments are allowed
-   * - Root object can be any JSON value
-   * - Assumes Value strings are encoded in UTF-8
-   */
-  static Features all();
-
-  /** \brief A configuration that is strictly compatible with the JSON
-   * specification.
-   * - Comments are forbidden.
-   * - Root object must be either an array or an object value.
-   * - Assumes Value strings are encoded in UTF-8
-   */
-  static Features strictMode();
-
-  /** \brief Initialize the configuration like JsonConfig::allFeatures;
-   */
-  Features();
-
-  /// \c true if comments are allowed. Default: \c true.
-  bool allowComments_;
-
-  /// \c true if root must be either an array or an object value. Default: \c
-  /// false.
-  bool strictRoot_;
-
-  /// \c true if dropped null placeholders are allowed. Default: \c false.
-  bool allowDroppedNullPlaceholders_;
-
-  /// \c true if numeric object key are allowed. Default: \c false.
-  bool allowNumericKeys_;
-};
-
-} // namespace Json
-
-#endif // CPPTL_JSON_FEATURES_H_INCLUDED
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: include/json/features.h
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: include/json/value.h
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef CPPTL_JSON_H_INCLUDED
-#define CPPTL_JSON_H_INCLUDED
-
-#if !defined(JSON_IS_AMALGAMATION)
-#include "forwards.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-#include <string>
-#include <vector>
-#include <exception>
-
-#ifndef JSON_USE_CPPTL_SMALLMAP
-#include <map>
-#else
-#include <cpptl/smallmap.h>
-#endif
-#ifdef JSON_USE_CPPTL
-#include <cpptl/forwards.h>
-#endif
-
-//Conditional NORETURN attribute on the throw functions would:
-// a) suppress false positives from static code analysis 
-// b) possibly improve optimization opportunities.
-#if !defined(JSONCPP_NORETURN)
-#  if defined(_MSC_VER)
-#    define JSONCPP_NORETURN __declspec(noreturn)
-#  elif defined(__GNUC__)
-#    define JSONCPP_NORETURN __attribute__ ((__noreturn__))
-#  else
-#    define JSONCPP_NORETURN
-#  endif
-#endif
-
-// Disable warning C4251: <data member>: <type> needs to have dll-interface to
-// be used by...
-#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
-#pragma warning(push)
-#pragma warning(disable : 4251)
-#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
-
-/** \brief JSON (JavaScript Object Notation).
- */
-namespace Json {
-
-/** Base class for all exceptions we throw.
- *
- * We use nothing but these internally. Of course, STL can throw others.
- */
-class JSON_API Exception : public std::exception {
-public:
-  Exception(JSONCPP_STRING const& msg);
-  ~Exception() throw() JSONCPP_OVERRIDE;
-  char const* what() const throw() JSONCPP_OVERRIDE;
-protected:
-  JSONCPP_STRING msg_;
-};
-
-/** Exceptions which the user cannot easily avoid.
- *
- * E.g. out-of-memory (when we use malloc), stack-overflow, malicious input
- * 
- * \remark derived from Json::Exception
- */
-class JSON_API RuntimeError : public Exception {
-public:
-  RuntimeError(JSONCPP_STRING const& msg);
-};
-
-/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
- *
- * These are precondition-violations (user bugs) and internal errors (our bugs).
- * 
- * \remark derived from Json::Exception
- */
-class JSON_API LogicError : public Exception {
-public:
-  LogicError(JSONCPP_STRING const& msg);
-};
-
-/// used internally
-JSONCPP_NORETURN void throwRuntimeError(JSONCPP_STRING const& msg);
-/// used internally
-JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const& msg);
-
-/** \brief Type of the value held by a Value object.
- */
-enum ValueType {
-  nullValue = 0, ///< 'null' value
-  intValue,      ///< signed integer value
-  uintValue,     ///< unsigned integer value
-  realValue,     ///< double value
-  stringValue,   ///< UTF-8 string value
-  booleanValue,  ///< bool value
-  arrayValue,    ///< array value (ordered list)
-  objectValue    ///< object value (collection of name/value pairs).
-};
-
-enum CommentPlacement {
-  commentBefore = 0,      ///< a comment placed on the line before a value
-  commentAfterOnSameLine, ///< a comment just after a value on the same line
-  commentAfter, ///< a comment on the line after a value (only make sense for
-  /// root value)
-  numberOfCommentPlacement
-};
-
-//# ifdef JSON_USE_CPPTL
-//   typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
-//   typedef CppTL::AnyEnumerator<const Value &> EnumValues;
-//# endif
-
-/** \brief Lightweight wrapper to tag static string.
- *
- * Value constructor and objectValue member assignement takes advantage of the
- * StaticString and avoid the cost of string duplication when storing the
- * string or the member name.
- *
- * Example of usage:
- * \code
- * Json::Value aValue( StaticString("some text") );
- * Json::Value object;
- * static const StaticString code("code");
- * object[code] = 1234;
- * \endcode
- */
-class JSON_API StaticString {
-public:
-  explicit StaticString(const char* czstring) : c_str_(czstring) {}
-
-  operator const char*() const { return c_str_; }
-
-  const char* c_str() const { return c_str_; }
-
-private:
-  const char* c_str_;
-};
-
-/** \brief Represents a <a HREF="http://www.json.org">JSON</a> value.
- *
- * This class is a discriminated union wrapper that can represents a:
- * - signed integer [range: Value::minInt - Value::maxInt]
- * - unsigned integer (range: 0 - Value::maxUInt)
- * - double
- * - UTF-8 string
- * - boolean
- * - 'null'
- * - an ordered list of Value
- * - collection of name/value pairs (javascript object)
- *
- * The type of the held value is represented by a #ValueType and
- * can be obtained using type().
- *
- * Values of an #objectValue or #arrayValue can be accessed using operator[]()
- * methods.
- * Non-const methods will automatically create the a #nullValue element
- * if it does not exist.
- * The sequence of an #arrayValue will be automatically resized and initialized
- * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue.
- *
- * The get() methods can be used to obtain default value in the case the
- * required element does not exist.
- *
- * It is possible to iterate over the list of a #objectValue values using
- * the getMemberNames() method.
- *
- * \note #Value string-length fit in size_t, but keys must be < 2^30.
- * (The reason is an implementation detail.) A #CharReader will raise an
- * exception if a bound is exceeded to avoid security holes in your app,
- * but the Value API does *not* check bounds. That is the responsibility
- * of the caller.
- */
-class JSON_API Value {
-  friend class ValueIteratorBase;
-public:
-  typedef std::vector<JSONCPP_STRING> Members;
-  typedef ValueIterator iterator;
-  typedef ValueConstIterator const_iterator;
-  typedef Json::UInt UInt;
-  typedef Json::Int Int;
-#if defined(JSON_HAS_INT64)
-  typedef Json::UInt64 UInt64;
-  typedef Json::Int64 Int64;
-#endif // defined(JSON_HAS_INT64)
-  typedef Json::LargestInt LargestInt;
-  typedef Json::LargestUInt LargestUInt;
-  typedef Json::ArrayIndex ArrayIndex;
-
-  static const Value& null;  ///< We regret this reference to a global instance; prefer the simpler Value().
-  static const Value& nullRef;  ///< just a kludge for binary-compatibility; same as null
-  /// Minimum signed integer value that can be stored in a Json::Value.
-  static const LargestInt minLargestInt;
-  /// Maximum signed integer value that can be stored in a Json::Value.
-  static const LargestInt maxLargestInt;
-  /// Maximum unsigned integer value that can be stored in a Json::Value.
-  static const LargestUInt maxLargestUInt;
-
-  /// Minimum signed int value that can be stored in a Json::Value.
-  static const Int minInt;
-  /// Maximum signed int value that can be stored in a Json::Value.
-  static const Int maxInt;
-  /// Maximum unsigned int value that can be stored in a Json::Value.
-  static const UInt maxUInt;
-
-#if defined(JSON_HAS_INT64)
-  /// Minimum signed 64 bits int value that can be stored in a Json::Value.
-  static const Int64 minInt64;
-  /// Maximum signed 64 bits int value that can be stored in a Json::Value.
-  static const Int64 maxInt64;
-  /// Maximum unsigned 64 bits int value that can be stored in a Json::Value.
-  static const UInt64 maxUInt64;
-#endif // defined(JSON_HAS_INT64)
-
-private:
-#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
-  class CZString {
-  public:
-    enum DuplicationPolicy {
-      noDuplication = 0,
-      duplicate,
-      duplicateOnCopy
-    };
-    CZString(ArrayIndex index);
-    CZString(char const* str, unsigned length, DuplicationPolicy allocate);
-    CZString(CZString const& other);
-#if JSON_HAS_RVALUE_REFERENCES
-    CZString(CZString&& other);
-#endif
-    ~CZString();
-    CZString& operator=(CZString other);
-    bool operator<(CZString const& other) const;
-    bool operator==(CZString const& other) const;
-    ArrayIndex index() const;
-    //const char* c_str() const; ///< \deprecated
-    char const* data() const;
-    unsigned length() const;
-    bool isStaticString() const;
-
-  private:
-    void swap(CZString& other);
-
-    struct StringStorage {
-      unsigned policy_: 2;
-      unsigned length_: 30; // 1GB max
-    };
-
-    char const* cstr_;  // actually, a prefixed string, unless policy is noDup
-    union {
-      ArrayIndex index_;
-      StringStorage storage_;
-    };
-  };
-
-public:
-#ifndef JSON_USE_CPPTL_SMALLMAP
-  typedef std::map<CZString, Value> ObjectValues;
-#else
-  typedef CppTL::SmallMap<CZString, Value> ObjectValues;
-#endif // ifndef JSON_USE_CPPTL_SMALLMAP
-#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
-
-public:
-  /** \brief Create a default Value of the given type.
-
-    This is a very useful constructor.
-    To create an empty array, pass arrayValue.
-    To create an empty object, pass objectValue.
-    Another Value can then be set to this one by assignment.
-This is useful since clear() and resize() will not alter types.
-
-    Examples:
-\code
-Json::Value null_value; // null
-Json::Value arr_value(Json::arrayValue); // []
-Json::Value obj_value(Json::objectValue); // {}
-\endcode
-  */
-  Value(ValueType type = nullValue);
-  Value(Int value);
-  Value(UInt value);
-#if defined(JSON_HAS_INT64)
-  Value(Int64 value);
-  Value(UInt64 value);
-#endif // if defined(JSON_HAS_INT64)
-  Value(double value);
-  Value(const char* value); ///< Copy til first 0. (NULL causes to seg-fault.)
-  Value(const char* begin, const char* end); ///< Copy all, incl zeroes.
-  /** \brief Constructs a value from a static string.
-
-   * Like other value string constructor but do not duplicate the string for
-   * internal storage. The given string must remain alive after the call to this
-   * constructor.
-   * \note This works only for null-terminated strings. (We cannot change the
-   *   size of this class, so we have nowhere to store the length,
-   *   which might be computed later for various operations.)
-   *
-   * Example of usage:
-   * \code
-   * static StaticString foo("some text");
-   * Json::Value aValue(foo);
-   * \endcode
-   */
-  Value(const StaticString& value);
-  Value(const JSONCPP_STRING& value); ///< Copy data() til size(). Embedded zeroes too.
-#ifdef JSON_USE_CPPTL
-  Value(const CppTL::ConstString& value);
-#endif
-  Value(bool value);
-  /// Deep copy.
-  Value(const Value& other);
-#if JSON_HAS_RVALUE_REFERENCES
-  /// Move constructor
-  Value(Value&& other);
-#endif
-  ~Value();
-
-  /// Deep copy, then swap(other).
-  /// \note Over-write existing comments. To preserve comments, use #swapPayload().
-  Value& operator=(Value other);
-  /// Swap everything.
-  void swap(Value& other);
-  /// Swap values but leave comments and source offsets in place.
-  void swapPayload(Value& other);
-
-  ValueType type() const;
-
-  /// Compare payload only, not comments etc.
-  bool operator<(const Value& other) const;
-  bool operator<=(const Value& other) const;
-  bool operator>=(const Value& other) const;
-  bool operator>(const Value& other) const;
-  bool operator==(const Value& other) const;
-  bool operator!=(const Value& other) const;
-  int compare(const Value& other) const;
-
-  const char* asCString() const; ///< Embedded zeroes could cause you trouble!
-#if JSONCPP_USING_SECURE_MEMORY
-  unsigned getCStringLength() const; //Allows you to understand the length of the CString
-#endif
-  JSONCPP_STRING asString() const; ///< Embedded zeroes are possible.
-  /** Get raw char* of string-value.
-   *  \return false if !string. (Seg-fault if str or end are NULL.)
-   */
-  bool getString(
-      char const** begin, char const** end) const;
-#ifdef JSON_USE_CPPTL
-  CppTL::ConstString asConstString() const;
-#endif
-  Int asInt() const;
-  UInt asUInt() const;
-#if defined(JSON_HAS_INT64)
-  Int64 asInt64() const;
-  UInt64 asUInt64() const;
-#endif // if defined(JSON_HAS_INT64)
-  LargestInt asLargestInt() const;
-  LargestUInt asLargestUInt() const;
-  float asFloat() const;
-  double asDouble() const;
-  bool asBool() const;
-
-  bool isNull() const;
-  bool isBool() const;
-  bool isInt() const;
-  bool isInt64() const;
-  bool isUInt() const;
-  bool isUInt64() const;
-  bool isIntegral() const;
-  bool isDouble() const;
-  bool isNumeric() const;
-  bool isString() const;
-  bool isArray() const;
-  bool isObject() const;
-
-  bool isConvertibleTo(ValueType other) const;
-
-  /// Number of values in array or object
-  ArrayIndex size() const;
-
-  /// \brief Return true if empty array, empty object, or null;
-  /// otherwise, false.
-  bool empty() const;
-
-  /// Return isNull()
-  bool operator!() const;
-
-  /// Remove all object members and array elements.
-  /// \pre type() is arrayValue, objectValue, or nullValue
-  /// \post type() is unchanged
-  void clear();
-
-  /// Resize the array to size elements.
-  /// New elements are initialized to null.
-  /// May only be called on nullValue or arrayValue.
-  /// \pre type() is arrayValue or nullValue
-  /// \post type() is arrayValue
-  void resize(ArrayIndex size);
-
-  /// Access an array element (zero based index ).
-  /// If the array contains less than index element, then null value are
-  /// inserted
-  /// in the array so that its size is index+1.
-  /// (You may need to say 'value[0u]' to get your compiler to distinguish
-  ///  this from the operator[] which takes a string.)
-  Value& operator[](ArrayIndex index);
-
-  /// Access an array element (zero based index ).
-  /// If the array contains less than index element, then null value are
-  /// inserted
-  /// in the array so that its size is index+1.
-  /// (You may need to say 'value[0u]' to get your compiler to distinguish
-  ///  this from the operator[] which takes a string.)
-  Value& operator[](int index);
-
-  /// Access an array element (zero based index )
-  /// (You may need to say 'value[0u]' to get your compiler to distinguish
-  ///  this from the operator[] which takes a string.)
-  const Value& operator[](ArrayIndex index) const;
-
-  /// Access an array element (zero based index )
-  /// (You may need to say 'value[0u]' to get your compiler to distinguish
-  ///  this from the operator[] which takes a string.)
-  const Value& operator[](int index) const;
-
-  /// If the array contains at least index+1 elements, returns the element
-  /// value,
-  /// otherwise returns defaultValue.
-  Value get(ArrayIndex index, const Value& defaultValue) const;
-  /// Return true if index < size().
-  bool isValidIndex(ArrayIndex index) const;
-  /// \brief Append value to array at the end.
-  ///
-  /// Equivalent to jsonvalue[jsonvalue.size()] = value;
-  Value& append(const Value& value);
-
-  /// Access an object value by name, create a null member if it does not exist.
-  /// \note Because of our implementation, keys are limited to 2^30 -1 chars.
-  ///  Exceeding that will cause an exception.
-  Value& operator[](const char* key);
-  /// Access an object value by name, returns null if there is no member with
-  /// that name.
-  const Value& operator[](const char* key) const;
-  /// Access an object value by name, create a null member if it does not exist.
-  /// \param key may contain embedded nulls.
-  Value& operator[](const JSONCPP_STRING& key);
-  /// Access an object value by name, returns null if there is no member with
-  /// that name.
-  /// \param key may contain embedded nulls.
-  const Value& operator[](const JSONCPP_STRING& key) const;
-  /** \brief Access an object value by name, create a null member if it does not
-   exist.
-
-   * If the object has no entry for that name, then the member name used to store
-   * the new entry is not duplicated.
-   * Example of use:
-   * \code
-   * Json::Value object;
-   * static const StaticString code("code");
-   * object[code] = 1234;
-   * \endcode
-   */
-  Value& operator[](const StaticString& key);
-#ifdef JSON_USE_CPPTL
-  /// Access an object value by name, create a null member if it does not exist.
-  Value& operator[](const CppTL::ConstString& key);
-  /// Access an object value by name, returns null if there is no member with
-  /// that name.
-  const Value& operator[](const CppTL::ConstString& key) const;
-#endif
-  /// Return the member named key if it exist, defaultValue otherwise.
-  /// \note deep copy
-  Value get(const char* key, const Value& defaultValue) const;
-  /// Return the member named key if it exist, defaultValue otherwise.
-  /// \note deep copy
-  /// \note key may contain embedded nulls.
-  Value get(const char* begin, const char* end, const Value& defaultValue) const;
-  /// Return the member named key if it exist, defaultValue otherwise.
-  /// \note deep copy
-  /// \param key may contain embedded nulls.
-  Value get(const JSONCPP_STRING& key, const Value& defaultValue) const;
-#ifdef JSON_USE_CPPTL
-  /// Return the member named key if it exist, defaultValue otherwise.
-  /// \note deep copy
-  Value get(const CppTL::ConstString& key, const Value& defaultValue) const;
-#endif
-  /// Most general and efficient version of isMember()const, get()const,
-  /// and operator[]const
-  /// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
-  Value const* find(char const* begin, char const* end) const;
-  /// Most general and efficient version of object-mutators.
-  /// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
-  /// \return non-zero, but JSON_ASSERT if this is neither object nor nullValue.
-  Value const* demand(char const* begin, char const* end);
-  /// \brief Remove and return the named member.
-  ///
-  /// Do nothing if it did not exist.
-  /// \return the removed Value, or null.
-  /// \pre type() is objectValue or nullValue
-  /// \post type() is unchanged
-  /// \deprecated
-  Value removeMember(const char* key);
-  /// Same as removeMember(const char*)
-  /// \param key may contain embedded nulls.
-  /// \deprecated
-  Value removeMember(const JSONCPP_STRING& key);
-  /// Same as removeMember(const char* begin, const char* end, Value* removed),
-  /// but 'key' is null-terminated.
-  bool removeMember(const char* key, Value* removed);
-  /** \brief Remove the named map member.
-
-      Update 'removed' iff removed.
-      \param key may contain embedded nulls.
-      \return true iff removed (no exceptions)
-  */
-  bool removeMember(JSONCPP_STRING const& key, Value* removed);
-  /// Same as removeMember(JSONCPP_STRING const& key, Value* removed)
-  bool removeMember(const char* begin, const char* end, Value* removed);
-  /** \brief Remove the indexed array element.
-
-      O(n) expensive operations.
-      Update 'removed' iff removed.
-      \return true iff removed (no exceptions)
-  */
-  bool removeIndex(ArrayIndex i, Value* removed);
-
-  /// Return true if the object has a member named key.
-  /// \note 'key' must be null-terminated.
-  bool isMember(const char* key) const;
-  /// Return true if the object has a member named key.
-  /// \param key may contain embedded nulls.
-  bool isMember(const JSONCPP_STRING& key) const;
-  /// Same as isMember(JSONCPP_STRING const& key)const
-  bool isMember(const char* begin, const char* end) const;
-#ifdef JSON_USE_CPPTL
-  /// Return true if the object has a member named key.
-  bool isMember(const CppTL::ConstString& key) const;
-#endif
-
-  /// \brief Return a list of the member names.
-  ///
-  /// If null, return an empty list.
-  /// \pre type() is objectValue or nullValue
-  /// \post if type() was nullValue, it remains nullValue
-  Members getMemberNames() const;
-
-  //# ifdef JSON_USE_CPPTL
-  //      EnumMemberNames enumMemberNames() const;
-  //      EnumValues enumValues() const;
-  //# endif
-
-  /// \deprecated Always pass len.
-  JSONCPP_DEPRECATED("Use setComment(JSONCPP_STRING const&) instead.")
-  void setComment(const char* comment, CommentPlacement placement);
-  /// Comments must be //... or /* ... */
-  void setComment(const char* comment, size_t len, CommentPlacement placement);
-  /// Comments must be //... or /* ... */
-  void setComment(const JSONCPP_STRING& comment, CommentPlacement placement);
-  bool hasComment(CommentPlacement placement) const;
-  /// Include delimiters and embedded newlines.
-  JSONCPP_STRING getComment(CommentPlacement placement) const;
-
-  JSONCPP_STRING toStyledString() const;
-
-  const_iterator begin() const;
-  const_iterator end() const;
-
-  iterator begin();
-  iterator end();
-
-  // Accessors for the [start, limit) range of bytes within the JSON text from
-  // which this value was parsed, if any.
-  void setOffsetStart(ptrdiff_t start);
-  void setOffsetLimit(ptrdiff_t limit);
-  ptrdiff_t getOffsetStart() const;
-  ptrdiff_t getOffsetLimit() const;
-
-private:
-  void initBasic(ValueType type, bool allocated = false);
-
-  Value& resolveReference(const char* key);
-  Value& resolveReference(const char* key, const char* end);
-
-  struct CommentInfo {
-    CommentInfo();
-    ~CommentInfo();
-
-    void setComment(const char* text, size_t len);
-
-    char* comment_;
-  };
-
-  // struct MemberNamesTransform
-  //{
-  //   typedef const char *result_type;
-  //   const char *operator()( const CZString &name ) const
-  //   {
-  //      return name.c_str();
-  //   }
-  //};
-
-  union ValueHolder {
-    LargestInt int_;
-    LargestUInt uint_;
-    double real_;
-    bool bool_;
-    char* string_;  // actually ptr to unsigned, followed by str, unless !allocated_
-    ObjectValues* map_;
-  } value_;
-  ValueType type_ : 8;
-  unsigned int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
-                               // If not allocated_, string_ must be null-terminated.
-  CommentInfo* comments_;
-
-  // [start, limit) byte offsets in the source JSON text from which this Value
-  // was extracted.
-  ptrdiff_t start_;
-  ptrdiff_t limit_;
-};
-
-/** \brief Experimental and untested: represents an element of the "path" to
- * access a node.
- */
-class JSON_API PathArgument {
-public:
-  friend class Path;
-
-  PathArgument();
-  PathArgument(ArrayIndex index);
-  PathArgument(const char* key);
-  PathArgument(const JSONCPP_STRING& key);
-
-private:
-  enum Kind {
-    kindNone = 0,
-    kindIndex,
-    kindKey
-  };
-  JSONCPP_STRING key_;
-  ArrayIndex index_;
-  Kind kind_;
-};
-
-/** \brief Experimental and untested: represents a "path" to access a node.
- *
- * Syntax:
- * - "." => root node
- * - ".[n]" => elements at index 'n' of root node (an array value)
- * - ".name" => member named 'name' of root node (an object value)
- * - ".name1.name2.name3"
- * - ".[0][1][2].name1[3]"
- * - ".%" => member name is provided as parameter
- * - ".[%]" => index is provied as parameter
- */
-class JSON_API Path {
-public:
-  Path(const JSONCPP_STRING& path,
-       const PathArgument& a1 = PathArgument(),
-       const PathArgument& a2 = PathArgument(),
-       const PathArgument& a3 = PathArgument(),
-       const PathArgument& a4 = PathArgument(),
-       const PathArgument& a5 = PathArgument());
-
-  const Value& resolve(const Value& root) const;
-  Value resolve(const Value& root, const Value& defaultValue) const;
-  /// Creates the "path" to access the specified node and returns a reference on
-  /// the node.
-  Value& make(Value& root) const;
-
-private:
-  typedef std::vector<const PathArgument*> InArgs;
-  typedef std::vector<PathArgument> Args;
-
-  void makePath(const JSONCPP_STRING& path, const InArgs& in);
-  void addPathInArg(const JSONCPP_STRING& path,
-                    const InArgs& in,
-                    InArgs::const_iterator& itInArg,
-                    PathArgument::Kind kind);
-  void invalidPath(const JSONCPP_STRING& path, int location);
-
-  Args args_;
-};
-
-/** \brief base class for Value iterators.
- *
- */
-class JSON_API ValueIteratorBase {
-public:
-  typedef std::bidirectional_iterator_tag iterator_category;
-  typedef unsigned int size_t;
-  typedef int difference_type;
-  typedef ValueIteratorBase SelfType;
-
-  bool operator==(const SelfType& other) const { return isEqual(other); }
-
-  bool operator!=(const SelfType& other) const { return !isEqual(other); }
-
-  difference_type operator-(const SelfType& other) const {
-    return other.computeDistance(*this);
-  }
-
-  /// Return either the index or the member name of the referenced value as a
-  /// Value.
-  Value key() const;
-
-  /// Return the index of the referenced Value, or -1 if it is not an arrayValue.
-  UInt index() const;
-
-  /// Return the member name of the referenced Value, or "" if it is not an
-  /// objectValue.
-  /// \note Avoid `c_str()` on result, as embedded zeroes are possible.
-  JSONCPP_STRING name() const;
-
-  /// Return the member name of the referenced Value. "" if it is not an
-  /// objectValue.
-  /// \deprecated This cannot be used for UTF-8 strings, since there can be embedded nulls.
-  JSONCPP_DEPRECATED("Use `key = name();` instead.")
-  char const* memberName() const;
-  /// Return the member name of the referenced Value, or NULL if it is not an
-  /// objectValue.
-  /// \note Better version than memberName(). Allows embedded nulls.
-  char const* memberName(char const** end) const;
-
-protected:
-  Value& deref() const;
-
-  void increment();
-
-  void decrement();
-
-  difference_type computeDistance(const SelfType& other) const;
-
-  bool isEqual(const SelfType& other) const;
-
-  void copy(const SelfType& other);
-
-private:
-  Value::ObjectValues::iterator current_;
-  // Indicates that iterator is for a null value.
-  bool isNull_;
-
-public:
-  // For some reason, BORLAND needs these at the end, rather
-  // than earlier. No idea why.
-  ValueIteratorBase();
-  explicit ValueIteratorBase(const Value::ObjectValues::iterator& current);
-};
-
-/** \brief const iterator for object and array value.
- *
- */
-class JSON_API ValueConstIterator : public ValueIteratorBase {
-  friend class Value;
-
-public:
-  typedef const Value value_type;
-  //typedef unsigned int size_t;
-  //typedef int difference_type;
-  typedef const Value& reference;
-  typedef const Value* pointer;
-  typedef ValueConstIterator SelfType;
-
-  ValueConstIterator();
-  ValueConstIterator(ValueIterator const& other);
-
-private:
-/*! \internal Use by Value to create an iterator.
- */
-  explicit ValueConstIterator(const Value::ObjectValues::iterator& current);
-public:
-  SelfType& operator=(const ValueIteratorBase& other);
-
-  SelfType operator++(int) {
-    SelfType temp(*this);
-    ++*this;
-    return temp;
-  }
-
-  SelfType operator--(int) {
-    SelfType temp(*this);
-    --*this;
-    return temp;
-  }
-
-  SelfType& operator--() {
-    decrement();
-    return *this;
-  }
-
-  SelfType& operator++() {
-    increment();
-    return *this;
-  }
-
-  reference operator*() const { return deref(); }
-
-  pointer operator->() const { return &deref(); }
-};
-
-/** \brief Iterator for object and array value.
- */
-class JSON_API ValueIterator : public ValueIteratorBase {
-  friend class Value;
-
-public:
-  typedef Value value_type;
-  typedef unsigned int size_t;
-  typedef int difference_type;
-  typedef Value& reference;
-  typedef Value* pointer;
-  typedef ValueIterator SelfType;
-
-  ValueIterator();
-  explicit ValueIterator(const ValueConstIterator& other);
-  ValueIterator(const ValueIterator& other);
-
-private:
-/*! \internal Use by Value to create an iterator.
- */
-  explicit ValueIterator(const Value::ObjectValues::iterator& current);
-public:
-  SelfType& operator=(const SelfType& other);
-
-  SelfType operator++(int) {
-    SelfType temp(*this);
-    ++*this;
-    return temp;
-  }
-
-  SelfType operator--(int) {
-    SelfType temp(*this);
-    --*this;
-    return temp;
-  }
-
-  SelfType& operator--() {
-    decrement();
-    return *this;
-  }
-
-  SelfType& operator++() {
-    increment();
-    return *this;
-  }
-
-  reference operator*() const { return deref(); }
-
-  pointer operator->() const { return &deref(); }
-};
-
-} // namespace Json
-
-
-namespace std {
-/// Specialize std::swap() for Json::Value.
-template<>
-inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); }
-}
-
-
-#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
-#pragma warning(pop)
-#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
-
-#endif // CPPTL_JSON_H_INCLUDED
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: include/json/value.h
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: include/json/reader.h
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef CPPTL_JSON_READER_H_INCLUDED
-#define CPPTL_JSON_READER_H_INCLUDED
-
-#if !defined(JSON_IS_AMALGAMATION)
-#include "features.h"
-#include "value.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-#include <deque>
-#include <iosfwd>
-#include <stack>
-#include <string>
-#include <istream>
-
-// Disable warning C4251: <data member>: <type> needs to have dll-interface to
-// be used by...
-#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
-#pragma warning(push)
-#pragma warning(disable : 4251)
-#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
-
-namespace Json {
-
-/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a
- *Value.
- *
- * \deprecated Use CharReader and CharReaderBuilder.
- */
-class JSON_API Reader {
-public:
-  typedef char Char;
-  typedef const Char* Location;
-
-  /** \brief An error tagged with where in the JSON text it was encountered.
-   *
-   * The offsets give the [start, limit) range of bytes within the text. Note
-   * that this is bytes, not codepoints.
-   *
-   */
-  struct StructuredError {
-    ptrdiff_t offset_start;
-    ptrdiff_t offset_limit;
-    JSONCPP_STRING message;
-  };
-
-  /** \brief Constructs a Reader allowing all features
-   * for parsing.
-   */
-  Reader();
-
-  /** \brief Constructs a Reader allowing the specified feature set
-   * for parsing.
-   */
-  Reader(const Features& features);
-
-  /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
-   * document.
-   * \param document UTF-8 encoded string containing the document to read.
-   * \param root [out] Contains the root value of the document if it was
-   *             successfully parsed.
-   * \param collectComments \c true to collect comment and allow writing them
-   * back during
-   *                        serialization, \c false to discard comments.
-   *                        This parameter is ignored if
-   * Features::allowComments_
-   *                        is \c false.
-   * \return \c true if the document was successfully parsed, \c false if an
-   * error occurred.
-   */
-  bool
-  parse(const std::string& document, Value& root, bool collectComments = true);
-
-  /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
-   document.
-   * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the
-   document to read.
-   * \param endDoc Pointer on the end of the UTF-8 encoded string of the
-   document to read.
-   *               Must be >= beginDoc.
-   * \param root [out] Contains the root value of the document if it was
-   *             successfully parsed.
-   * \param collectComments \c true to collect comment and allow writing them
-   back during
-   *                        serialization, \c false to discard comments.
-   *                        This parameter is ignored if
-   Features::allowComments_
-   *                        is \c false.
-   * \return \c true if the document was successfully parsed, \c false if an
-   error occurred.
-   */
-  bool parse(const char* beginDoc,
-             const char* endDoc,
-             Value& root,
-             bool collectComments = true);
-
-  /// \brief Parse from input stream.
-  /// \see Json::operator>>(std::istream&, Json::Value&).
-  bool parse(JSONCPP_ISTREAM& is, Value& root, bool collectComments = true);
-
-  /** \brief Returns a user friendly string that list errors in the parsed
-   * document.
-   * \return Formatted error message with the list of errors with their location
-   * in
-   *         the parsed document. An empty string is returned if no error
-   * occurred
-   *         during parsing.
-   * \deprecated Use getFormattedErrorMessages() instead (typo fix).
-   */
-  JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.")
-  JSONCPP_STRING getFormatedErrorMessages() const;
-
-  /** \brief Returns a user friendly string that list errors in the parsed
-   * document.
-   * \return Formatted error message with the list of errors with their location
-   * in
-   *         the parsed document. An empty string is returned if no error
-   * occurred
-   *         during parsing.
-   */
-  JSONCPP_STRING getFormattedErrorMessages() const;
-
-  /** \brief Returns a vector of structured erros encounted while parsing.
-   * \return A (possibly empty) vector of StructuredError objects. Currently
-   *         only one error can be returned, but the caller should tolerate
-   * multiple
-   *         errors.  This can occur if the parser recovers from a non-fatal
-   *         parse error and then encounters additional errors.
-   */
-  std::vector<StructuredError> getStructuredErrors() const;
-
-  /** \brief Add a semantic error message.
-   * \param value JSON Value location associated with the error
-   * \param message The error message.
-   * \return \c true if the error was successfully added, \c false if the
-   * Value offset exceeds the document size.
-   */
-  bool pushError(const Value& value, const JSONCPP_STRING& message);
-
-  /** \brief Add a semantic error message with extra context.
-   * \param value JSON Value location associated with the error
-   * \param message The error message.
-   * \param extra Additional JSON Value location to contextualize the error
-   * \return \c true if the error was successfully added, \c false if either
-   * Value offset exceeds the document size.
-   */
-  bool pushError(const Value& value, const JSONCPP_STRING& message, const Value& extra);
-
-  /** \brief Return whether there are any errors.
-   * \return \c true if there are no errors to report \c false if
-   * errors have occurred.
-   */
-  bool good() const;
-
-private:
-  enum TokenType {
-    tokenEndOfStream = 0,
-    tokenObjectBegin,
-    tokenObjectEnd,
-    tokenArrayBegin,
-    tokenArrayEnd,
-    tokenString,
-    tokenNumber,
-    tokenTrue,
-    tokenFalse,
-    tokenNull,
-    tokenArraySeparator,
-    tokenMemberSeparator,
-    tokenComment,
-    tokenError
-  };
-
-  class Token {
-  public:
-    TokenType type_;
-    Location start_;
-    Location end_;
-  };
-
-  class ErrorInfo {
-  public:
-    Token token_;
-    JSONCPP_STRING message_;
-    Location extra_;
-  };
-
-  typedef std::deque<ErrorInfo> Errors;
-
-  bool readToken(Token& token);
-  void skipSpaces();
-  bool match(Location pattern, int patternLength);
-  bool readComment();
-  bool readCStyleComment();
-  bool readCppStyleComment();
-  bool readString();
-  void readNumber();
-  bool readValue();
-  bool readObject(Token& token);
-  bool readArray(Token& token);
-  bool decodeNumber(Token& token);
-  bool decodeNumber(Token& token, Value& decoded);
-  bool decodeString(Token& token);
-  bool decodeString(Token& token, JSONCPP_STRING& decoded);
-  bool decodeDouble(Token& token);
-  bool decodeDouble(Token& token, Value& decoded);
-  bool decodeUnicodeCodePoint(Token& token,
-                              Location& current,
-                              Location end,
-                              unsigned int& unicode);
-  bool decodeUnicodeEscapeSequence(Token& token,
-                                   Location& current,
-                                   Location end,
-                                   unsigned int& unicode);
-  bool addError(const JSONCPP_STRING& message, Token& token, Location extra = 0);
-  bool recoverFromError(TokenType skipUntilToken);
-  bool addErrorAndRecover(const JSONCPP_STRING& message,
-                          Token& token,
-                          TokenType skipUntilToken);
-  void skipUntilSpace();
-  Value& currentValue();
-  Char getNextChar();
-  void
-  getLocationLineAndColumn(Location location, int& line, int& column) const;
-  JSONCPP_STRING getLocationLineAndColumn(Location location) const;
-  void addComment(Location begin, Location end, CommentPlacement placement);
-  void skipCommentTokens(Token& token);
-
-  typedef std::stack<Value*> Nodes;
-  Nodes nodes_;
-  Errors errors_;
-  JSONCPP_STRING document_;
-  Location begin_;
-  Location end_;
-  Location current_;
-  Location lastValueEnd_;
-  Value* lastValue_;
-  JSONCPP_STRING commentsBefore_;
-  Features features_;
-  bool collectComments_;
-};  // Reader
-
-/** Interface for reading JSON from a char array.
- */
-class JSON_API CharReader {
-public:
-  virtual ~CharReader() {}
-  /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
-   document.
-   * The document must be a UTF-8 encoded string containing the document to read.
-   *
-   * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the
-   document to read.
-   * \param endDoc Pointer on the end of the UTF-8 encoded string of the
-   document to read.
-   *        Must be >= beginDoc.
-   * \param root [out] Contains the root value of the document if it was
-   *             successfully parsed.
-   * \param errs [out] Formatted error messages (if not NULL)
-   *        a user friendly string that lists errors in the parsed
-   * document.
-   * \return \c true if the document was successfully parsed, \c false if an
-   error occurred.
-   */
-  virtual bool parse(
-      char const* beginDoc, char const* endDoc,
-      Value* root, JSONCPP_STRING* errs) = 0;
-
-  class JSON_API Factory {
-  public:
-    virtual ~Factory() {}
-    /** \brief Allocate a CharReader via operator new().
-     * \throw std::exception if something goes wrong (e.g. invalid settings)
-     */
-    virtual CharReader* newCharReader() const = 0;
-  };  // Factory
-};  // CharReader
-
-/** \brief Build a CharReader implementation.
-
-Usage:
-\code
-  using namespace Json;
-  CharReaderBuilder builder;
-  builder["collectComments"] = false;
-  Value value;
-  JSONCPP_STRING errs;
-  bool ok = parseFromStream(builder, std::cin, &value, &errs);
-\endcode
-*/
-class JSON_API CharReaderBuilder : public CharReader::Factory {
-public:
-  // Note: We use a Json::Value so that we can add data-members to this class
-  // without a major version bump.
-  /** Configuration of this builder.
-    These are case-sensitive.
-    Available settings (case-sensitive):
-    - `"collectComments": false or true`
-      - true to collect comment and allow writing them
-        back during serialization, false to discard comments.
-        This parameter is ignored if allowComments is false.
-    - `"allowComments": false or true`
-      - true if comments are allowed.
-    - `"strictRoot": false or true`
-      - true if root must be either an array or an object value
-    - `"allowDroppedNullPlaceholders": false or true`
-      - true if dropped null placeholders are allowed. (See StreamWriterBuilder.)
-    - `"allowNumericKeys": false or true`
-      - true if numeric object keys are allowed.
-    - `"allowSingleQuotes": false or true`
-      - true if '' are allowed for strings (both keys and values)
-    - `"stackLimit": integer`
-      - Exceeding stackLimit (recursive depth of `readValue()`) will
-        cause an exception.
-      - This is a security issue (seg-faults caused by deeply nested JSON),
-        so the default is low.
-    - `"failIfExtra": false or true`
-      - If true, `parse()` returns false when extra non-whitespace trails
-        the JSON value in the input string.
-    - `"rejectDupKeys": false or true`
-      - If true, `parse()` returns false when a key is duplicated within an object.
-    - `"allowSpecialFloats": false or true`
-      - If true, special float values (NaNs and infinities) are allowed 
-        and their values are lossfree restorable.
-
-    You can examine 'settings_` yourself
-    to see the defaults. You can also write and read them just like any
-    JSON Value.
-    \sa setDefaults()
-    */
-  Json::Value settings_;
-
-  CharReaderBuilder();
-  ~CharReaderBuilder() JSONCPP_OVERRIDE;
-
-  CharReader* newCharReader() const JSONCPP_OVERRIDE;
-
-  /** \return true if 'settings' are legal and consistent;
-   *   otherwise, indicate bad settings via 'invalid'.
-   */
-  bool validate(Json::Value* invalid) const;
-
-  /** A simple way to update a specific setting.
-   */
-  Value& operator[](JSONCPP_STRING key);
-
-  /** Called by ctor, but you can use this to reset settings_.
-   * \pre 'settings' != NULL (but Json::null is fine)
-   * \remark Defaults:
-   * \snippet src/lib_json/json_reader.cpp CharReaderBuilderDefaults
-   */
-  static void setDefaults(Json::Value* settings);
-  /** Same as old Features::strictMode().
-   * \pre 'settings' != NULL (but Json::null is fine)
-   * \remark Defaults:
-   * \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode
-   */
-  static void strictMode(Json::Value* settings);
-};
-
-/** Consume entire stream and use its begin/end.
-  * Someday we might have a real StreamReader, but for now this
-  * is convenient.
-  */
-bool JSON_API parseFromStream(
-    CharReader::Factory const&,
-    JSONCPP_ISTREAM&,
-    Value* root, std::string* errs);
-
-/** \brief Read from 'sin' into 'root'.
-
- Always keep comments from the input JSON.
-
- This can be used to read a file into a particular sub-object.
- For example:
- \code
- Json::Value root;
- cin >> root["dir"]["file"];
- cout << root;
- \endcode
- Result:
- \verbatim
- {
- "dir": {
-     "file": {
-     // The input stream JSON would be nested here.
-     }
- }
- }
- \endverbatim
- \throw std::exception on parse error.
- \see Json::operator<<()
-*/
-JSON_API JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM&, Value&);
-
-} // namespace Json
-
-#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
-#pragma warning(pop)
-#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
-
-#endif // CPPTL_JSON_READER_H_INCLUDED
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: include/json/reader.h
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: include/json/writer.h
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef JSON_WRITER_H_INCLUDED
-#define JSON_WRITER_H_INCLUDED
-
-#if !defined(JSON_IS_AMALGAMATION)
-#include "value.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-#include <vector>
-#include <string>
-#include <ostream>
-
-// Disable warning C4251: <data member>: <type> needs to have dll-interface to
-// be used by...
-#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
-#pragma warning(push)
-#pragma warning(disable : 4251)
-#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
-
-namespace Json {
-
-class Value;
-
-/**
-
-Usage:
-\code
-  using namespace Json;
-  void writeToStdout(StreamWriter::Factory const& factory, Value const& value) {
-    std::unique_ptr<StreamWriter> const writer(
-      factory.newStreamWriter());
-    writer->write(value, &std::cout);
-    std::cout << std::endl;  // add lf and flush
-  }
-\endcode
-*/
-class JSON_API StreamWriter {
-protected:
-  JSONCPP_OSTREAM* sout_;  // not owned; will not delete
-public:
-  StreamWriter();
-  virtual ~StreamWriter();
-  /** Write Value into document as configured in sub-class.
-      Do not take ownership of sout, but maintain a reference during function.
-      \pre sout != NULL
-      \return zero on success (For now, we always return zero, so check the stream instead.)
-      \throw std::exception possibly, depending on configuration
-   */
-  virtual int write(Value const& root, JSONCPP_OSTREAM* sout) = 0;
-
-  /** \brief A simple abstract factory.
-   */
-  class JSON_API Factory {
-  public:
-    virtual ~Factory();
-    /** \brief Allocate a CharReader via operator new().
-     * \throw std::exception if something goes wrong (e.g. invalid settings)
-     */
-    virtual StreamWriter* newStreamWriter() const = 0;
-  };  // Factory
-};  // StreamWriter
-
-/** \brief Write into stringstream, then return string, for convenience.
- * A StreamWriter will be created from the factory, used, and then deleted.
- */
-JSONCPP_STRING JSON_API writeString(StreamWriter::Factory const& factory, Value const& root);
-
-
-/** \brief Build a StreamWriter implementation.
-
-Usage:
-\code
-  using namespace Json;
-  Value value = ...;
-  StreamWriterBuilder builder;
-  builder["commentStyle"] = "None";
-  builder["indentation"] = "   ";  // or whatever you like
-  std::unique_ptr<Json::StreamWriter> writer(
-      builder.newStreamWriter());
-  writer->write(value, &std::cout);
-  std::cout << std::endl;  // add lf and flush
-\endcode
-*/
-class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
-public:
-  // Note: We use a Json::Value so that we can add data-members to this class
-  // without a major version bump.
-  /** Configuration of this builder.
-    Available settings (case-sensitive):
-    - "commentStyle": "None" or "All"
-    - "indentation":  "<anything>"
-    - "enableYAMLCompatibility": false or true
-      - slightly change the whitespace around colons
-    - "dropNullPlaceholders": false or true
-      - Drop the "null" string from the writer's output for nullValues.
-        Strictly speaking, this is not valid JSON. But when the output is being
-        fed to a browser's Javascript, it makes for smaller output and the
-        browser can handle the output just fine.
-    - "useSpecialFloats": false or true
-      - If true, outputs non-finite floating point values in the following way:
-        NaN values as "NaN", positive infinity as "Infinity", and negative infinity
-        as "-Infinity".
-
-    You can examine 'settings_` yourself
-    to see the defaults. You can also write and read them just like any
-    JSON Value.
-    \sa setDefaults()
-    */
-  Json::Value settings_;
-
-  StreamWriterBuilder();
-  ~StreamWriterBuilder() JSONCPP_OVERRIDE;
-
-  /**
-   * \throw std::exception if something goes wrong (e.g. invalid settings)
-   */
-  StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE;
-
-  /** \return true if 'settings' are legal and consistent;
-   *   otherwise, indicate bad settings via 'invalid'.
-   */
-  bool validate(Json::Value* invalid) const;
-  /** A simple way to update a specific setting.
-   */
-  Value& operator[](JSONCPP_STRING key);
-
-  /** Called by ctor, but you can use this to reset settings_.
-   * \pre 'settings' != NULL (but Json::null is fine)
-   * \remark Defaults:
-   * \snippet src/lib_json/json_writer.cpp StreamWriterBuilderDefaults
-   */
-  static void setDefaults(Json::Value* settings);
-};
-
-/** \brief Abstract class for writers.
- * \deprecated Use StreamWriter. (And really, this is an implementation detail.)
- */
-class JSON_API Writer {
-public:
-  virtual ~Writer();
-
-  virtual JSONCPP_STRING write(const Value& root) = 0;
-};
-
-/** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format
- *without formatting (not human friendly).
- *
- * The JSON document is written in a single line. It is not intended for 'human'
- *consumption,
- * but may be usefull to support feature such as RPC where bandwith is limited.
- * \sa Reader, Value
- * \deprecated Use StreamWriterBuilder.
- */
-class JSON_API FastWriter : public Writer {
-
-public:
-  FastWriter();
-  ~FastWriter() JSONCPP_OVERRIDE {}
-
-  void enableYAMLCompatibility();
-
-  /** \brief Drop the "null" string from the writer's output for nullValues.
-   * Strictly speaking, this is not valid JSON. But when the output is being
-   * fed to a browser's Javascript, it makes for smaller output and the
-   * browser can handle the output just fine.
-   */
-  void dropNullPlaceholders();
-
-  void omitEndingLineFeed();
-
-public: // overridden from Writer
-  JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
-
-private:
-  void writeValue(const Value& value);
-
-  JSONCPP_STRING document_;
-  bool yamlCompatiblityEnabled_;
-  bool dropNullPlaceholders_;
-  bool omitEndingLineFeed_;
-};
-
-/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
- *human friendly way.
- *
- * The rules for line break and indent are as follow:
- * - Object value:
- *     - if empty then print {} without indent and line break
- *     - if not empty the print '{', line break & indent, print one value per
- *line
- *       and then unindent and line break and print '}'.
- * - Array value:
- *     - if empty then print [] without indent and line break
- *     - if the array contains no object value, empty array or some other value
- *types,
- *       and all the values fit on one lines, then print the array on a single
- *line.
- *     - otherwise, it the values do not fit on one line, or the array contains
- *       object or non empty array, then print one value per line.
- *
- * If the Value have comments then they are outputed according to their
- *#CommentPlacement.
- *
- * \sa Reader, Value, Value::setComment()
- * \deprecated Use StreamWriterBuilder.
- */
-class JSON_API StyledWriter : public Writer {
-public:
-  StyledWriter();
-  ~StyledWriter() JSONCPP_OVERRIDE {}
-
-public: // overridden from Writer
-  /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
-   * \param root Value to serialize.
-   * \return String containing the JSON document that represents the root value.
-   */
-  JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
-
-private:
-  void writeValue(const Value& value);
-  void writeArrayValue(const Value& value);
-  bool isMultineArray(const Value& value);
-  void pushValue(const JSONCPP_STRING& value);
-  void writeIndent();
-  void writeWithIndent(const JSONCPP_STRING& value);
-  void indent();
-  void unindent();
-  void writeCommentBeforeValue(const Value& root);
-  void writeCommentAfterValueOnSameLine(const Value& root);
-  bool hasCommentForValue(const Value& value);
-  static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text);
-
-  typedef std::vector<JSONCPP_STRING> ChildValues;
-
-  ChildValues childValues_;
-  JSONCPP_STRING document_;
-  JSONCPP_STRING indentString_;
-  unsigned int rightMargin_;
-  unsigned int indentSize_;
-  bool addChildValues_;
-};
-
-/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
- human friendly way,
-     to a stream rather than to a string.
- *
- * The rules for line break and indent are as follow:
- * - Object value:
- *     - if empty then print {} without indent and line break
- *     - if not empty the print '{', line break & indent, print one value per
- line
- *       and then unindent and line break and print '}'.
- * - Array value:
- *     - if empty then print [] without indent and line break
- *     - if the array contains no object value, empty array or some other value
- types,
- *       and all the values fit on one lines, then print the array on a single
- line.
- *     - otherwise, it the values do not fit on one line, or the array contains
- *       object or non empty array, then print one value per line.
- *
- * If the Value have comments then they are outputed according to their
- #CommentPlacement.
- *
- * \param indentation Each level will be indented by this amount extra.
- * \sa Reader, Value, Value::setComment()
- * \deprecated Use StreamWriterBuilder.
- */
-class JSON_API StyledStreamWriter {
-public:
-  StyledStreamWriter(JSONCPP_STRING indentation = "\t");
-  ~StyledStreamWriter() {}
-
-public:
-  /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
-   * \param out Stream to write to. (Can be ostringstream, e.g.)
-   * \param root Value to serialize.
-   * \note There is no point in deriving from Writer, since write() should not
-   * return a value.
-   */
-  void write(JSONCPP_OSTREAM& out, const Value& root);
-
-private:
-  void writeValue(const Value& value);
-  void writeArrayValue(const Value& value);
-  bool isMultineArray(const Value& value);
-  void pushValue(const JSONCPP_STRING& value);
-  void writeIndent();
-  void writeWithIndent(const JSONCPP_STRING& value);
-  void indent();
-  void unindent();
-  void writeCommentBeforeValue(const Value& root);
-  void writeCommentAfterValueOnSameLine(const Value& root);
-  bool hasCommentForValue(const Value& value);
-  static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text);
-
-  typedef std::vector<JSONCPP_STRING> ChildValues;
-
-  ChildValues childValues_;
-  JSONCPP_OSTREAM* document_;
-  JSONCPP_STRING indentString_;
-  unsigned int rightMargin_;
-  JSONCPP_STRING indentation_;
-  bool addChildValues_ : 1;
-  bool indented_ : 1;
-};
-
-#if defined(JSON_HAS_INT64)
-JSONCPP_STRING JSON_API valueToString(Int value);
-JSONCPP_STRING JSON_API valueToString(UInt value);
-#endif // if defined(JSON_HAS_INT64)
-JSONCPP_STRING JSON_API valueToString(LargestInt value);
-JSONCPP_STRING JSON_API valueToString(LargestUInt value);
-JSONCPP_STRING JSON_API valueToString(double value);
-JSONCPP_STRING JSON_API valueToString(bool value);
-JSONCPP_STRING JSON_API valueToQuotedString(const char* value);
-
-/// \brief Output using the StyledStreamWriter.
-/// \see Json::operator>>()
-JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root);
-
-} // namespace Json
-
-#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
-#pragma warning(pop)
-#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
-
-#endif // JSON_WRITER_H_INCLUDED
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: include/json/writer.h
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: include/json/assertions.h
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
-#define CPPTL_JSON_ASSERTIONS_H_INCLUDED
-
-#include <stdlib.h>
-#include <sstream>
-
-#if !defined(JSON_IS_AMALGAMATION)
-#include "config.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-
-/** It should not be possible for a maliciously designed file to
- *  cause an abort() or seg-fault, so these macros are used only
- *  for pre-condition violations and internal logic errors.
- */
-#if JSON_USE_EXCEPTION
-
-// @todo <= add detail about condition in exception
-# define JSON_ASSERT(condition)                                                \
-  {if (!(condition)) {Json::throwLogicError( "assert json failed" );}}
-
-# define JSON_FAIL_MESSAGE(message)                                            \
-  {                                                                            \
-    JSONCPP_OSTRINGSTREAM oss; oss << message;                                    \
-    Json::throwLogicError(oss.str());                                          \
-    abort();                                                                   \
-  }
-
-#else // JSON_USE_EXCEPTION
-
-# define JSON_ASSERT(condition) assert(condition)
-
-// The call to assert() will show the failure message in debug builds. In
-// release builds we abort, for a core-dump or debugger.
-# define JSON_FAIL_MESSAGE(message)                                            \
-  {                                                                            \
-    JSONCPP_OSTRINGSTREAM oss; oss << message;                                    \
-    assert(false && oss.str().c_str());                                        \
-    abort();                                                                   \
-  }
-
-
-#endif
-
-#define JSON_ASSERT_MESSAGE(condition, message)                                \
-  if (!(condition)) {                                                          \
-    JSON_FAIL_MESSAGE(message);                                                \
-  }
-
-#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: include/json/assertions.h
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-#endif //ifndef JSON_AMALGATED_H_INCLUDED
diff --git a/gbtools/src/jsoncpp/Makefile.am b/gbtools/src/jsoncpp/Makefile.am
deleted file mode 100644
index d5903cb..0000000
--- a/gbtools/src/jsoncpp/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-
-include $(top_srcdir)/src/Makefile.am.common
-
-SUBDIRS = .
-
-noinst_LTLIBRARIES = libjsoncpp.la
-
-libjsoncpp_la_SOURCES = \
-jsoncpp.cpp \
-$(NULL) 
-
-# Extra files to remove for the maintainer-clean target.
-#
-MAINTAINERCLEANFILES = $(top_srcdir)/src/jsoncpp/Makefile.in
-
diff --git a/gbtools/src/jsoncpp/Makefile.in b/gbtools/src/jsoncpp/Makefile.in
deleted file mode 100644
index 1316242..0000000
--- a/gbtools/src/jsoncpp/Makefile.in
+++ /dev/null
@@ -1,723 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-# Common includes for all compiles.....
-#
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
-  case $${target_option-} in \
-      ?) ;; \
-      *) echo "am__make_running_with_option: internal error: invalid" \
-              "target option '$${target_option-}' specified" >&2; \
-         exit 1;; \
-  esac; \
-  has_opt=no; \
-  sane_makeflags=$$MAKEFLAGS; \
-  if $(am__is_gnu_make); then \
-    sane_makeflags=$$MFLAGS; \
-  else \
-    case $$MAKEFLAGS in \
-      *\\[\ \	]*) \
-        bs=\\; \
-        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
-          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
-    esac; \
-  fi; \
-  skip_next=no; \
-  strip_trailopt () \
-  { \
-    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
-  }; \
-  for flg in $$sane_makeflags; do \
-    test $$skip_next = yes && { skip_next=no; continue; }; \
-    case $$flg in \
-      *=*|--*) continue;; \
-        -*I) strip_trailopt 'I'; skip_next=yes;; \
-      -*I?*) strip_trailopt 'I';; \
-        -*O) strip_trailopt 'O'; skip_next=yes;; \
-      -*O?*) strip_trailopt 'O';; \
-        -*l) strip_trailopt 'l'; skip_next=yes;; \
-      -*l?*) strip_trailopt 'l';; \
-      -[dEDm]) skip_next=yes;; \
-      -[JT]) skip_next=yes;; \
-    esac; \
-    case $$flg in \
-      *$$target_option*) has_opt=yes; break;; \
-    esac; \
-  done; \
-  test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-DIST_COMMON = $(top_srcdir)/src/Makefile.am.common \
-	$(srcdir)/Makefile.in $(srcdir)/Makefile.am \
-	$(top_srcdir)/config/depcomp
-subdir = src/jsoncpp
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
-	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
-	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
-	$(top_srcdir)/./gbtools_version.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libjsoncpp_la_LIBADD =
-am_libjsoncpp_la_OBJECTS = jsoncpp.lo
-libjsoncpp_la_OBJECTS = $(am_libjsoncpp_la_OBJECTS)
-AM_V_lt = $(am__v_lt_ at AM_V@)
-am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-AM_V_P = $(am__v_P_ at AM_V@)
-am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_ at AM_V@)
-am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN     " $@;
-am__v_GEN_1 = 
-AM_V_at = $(am__v_at_ at AM_V@)
-am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 = 
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/config/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
-	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-	$(AM_CXXFLAGS) $(CXXFLAGS)
-AM_V_CXX = $(am__v_CXX_ at AM_V@)
-am__v_CXX_ = $(am__v_CXX_ at AM_DEFAULT_V@)
-am__v_CXX_0 = @echo "  CXX     " $@;
-am__v_CXX_1 = 
-CXXLD = $(CXX)
-CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
-	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CXXLD = $(am__v_CXXLD_ at AM_V@)
-am__v_CXXLD_ = $(am__v_CXXLD_ at AM_DEFAULT_V@)
-am__v_CXXLD_0 = @echo "  CXXLD   " $@;
-am__v_CXXLD_1 = 
-SOURCES = $(libjsoncpp_la_SOURCES)
-DIST_SOURCES = $(libjsoncpp_la_SOURCES)
-RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
-	ctags-recursive dvi-recursive html-recursive info-recursive \
-	install-data-recursive install-dvi-recursive \
-	install-exec-recursive install-html-recursive \
-	install-info-recursive install-pdf-recursive \
-	install-ps-recursive install-recursive installcheck-recursive \
-	installdirs-recursive pdf-recursive ps-recursive \
-	tags-recursive uninstall-recursive
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
-  esac
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
-  distclean-recursive maintainer-clean-recursive
-am__recursive_targets = \
-  $(RECURSIVE_TARGETS) \
-  $(RECURSIVE_CLEAN_TARGETS) \
-  $(am__extra_recursive_targets)
-AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-	distdir
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-am__relativize = \
-  dir0=`pwd`; \
-  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
-  sed_rest='s,^[^/]*/*,,'; \
-  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
-  sed_butlast='s,/*[^/]*$$,,'; \
-  while test -n "$$dir1"; do \
-    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
-    if test "$$first" != "."; then \
-      if test "$$first" = ".."; then \
-        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
-        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
-      else \
-        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
-        if test "$$first2" = "$$first"; then \
-          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
-        else \
-          dir2="../$$dir2"; \
-        fi; \
-        dir0="$$dir0"/"$$first"; \
-      fi; \
-    fi; \
-    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
-  done; \
-  reldir="$$dir2"
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DEPS_CFLAGS = @DEPS_CFLAGS@
-DEPS_LIBS = @DEPS_LIBS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIBTOOL_DEPS = @LIBTOOL_DEPS@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_BLATSRC = @USE_BLATSRC@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-AM_CPPFLAGS = \
-$(DEPS_CFLAGS) \
--I$(top_srcdir)/src/include \
--I$(top_srcdir)/src/include/blatSrc
-
-AM_CXXFLAGS = -std=c++11 -g -Wall
-SUBDIRS = .
-noinst_LTLIBRARIES = libjsoncpp.la
-libjsoncpp_la_SOURCES = \
-jsoncpp.cpp \
-$(NULL) 
-
-
-# Extra files to remove for the maintainer-clean target.
-#
-MAINTAINERCLEANFILES = $(top_srcdir)/src/jsoncpp/Makefile.in
-all: all-recursive
-
-.SUFFIXES:
-.SUFFIXES: .cpp .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/src/Makefile.am.common $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-	        && { if test -f $@; then exit 0; else break; fi; }; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/jsoncpp/Makefile'; \
-	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign src/jsoncpp/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-$(top_srcdir)/src/Makefile.am.common:
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-clean-noinstLTLIBRARIES:
-	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
-	@list='$(noinst_LTLIBRARIES)'; \
-	locs=`for p in $$list; do echo $$p; done | \
-	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
-	      sort -u`; \
-	test -z "$$locs" || { \
-	  echo rm -f $${locs}; \
-	  rm -f $${locs}; \
-	}
-
-libjsoncpp.la: $(libjsoncpp_la_OBJECTS) $(libjsoncpp_la_DEPENDENCIES) $(EXTRA_libjsoncpp_la_DEPENDENCIES) 
-	$(AM_V_CXXLD)$(CXXLINK)  $(libjsoncpp_la_OBJECTS) $(libjsoncpp_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/jsoncpp.Plo at am__quote@
-
-.cpp.o:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ $<
-
-.cpp.obj:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.cpp.lo:
- at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run 'make' without going through this Makefile.
-# To change the values of 'make' variables: instead of editing Makefiles,
-# (1) if the variable is set in 'config.status', edit 'config.status'
-#     (which will cause the Makefiles to be regenerated when you run 'make');
-# (2) otherwise, pass the desired values on the 'make' command line.
-$(am__recursive_targets):
-	@fail=; \
-	if $(am__make_keepgoing); then \
-	  failcom='fail=yes'; \
-	else \
-	  failcom='exit 1'; \
-	fi; \
-	dot_seen=no; \
-	target=`echo $@ | sed s/-recursive//`; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	for subdir in $$list; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    dot_seen=yes; \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done; \
-	if test "$$dot_seen" = "no"; then \
-	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
-	fi; test -z "$$fail"
-
-ID: $(am__tagged_files)
-	$(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-recursive
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	set x; \
-	here=`pwd`; \
-	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
-	  include_option=--etags-include; \
-	  empty_fix=.; \
-	else \
-	  include_option=--include; \
-	  empty_fix=; \
-	fi; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    test ! -f $$subdir/TAGS || \
-	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
-	  fi; \
-	done; \
-	$(am__define_uniq_tagged_files); \
-	shift; \
-	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  if test $$# -gt 0; then \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      "$$@" $$unique; \
-	  else \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      $$unique; \
-	  fi; \
-	fi
-ctags: ctags-recursive
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	$(am__define_uniq_tagged_files); \
-	test -z "$(CTAGS_ARGS)$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && $(am__cd) $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-recursive
-
-cscopelist-am: $(am__tagged_files)
-	list='$(am__tagged_files)'; \
-	case "$(srcdir)" in \
-	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-	  *) sdir=$(subdir)/$(srcdir) ;; \
-	esac; \
-	for i in $$list; do \
-	  if test -f "$$i"; then \
-	    echo "$(subdir)/$$i"; \
-	  else \
-	    echo "$$sdir/$$i"; \
-	  fi; \
-	done >> $(top_builddir)/cscope.files
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d "$(distdir)/$$file"; then \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-	    fi; \
-	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-	  else \
-	    test -f "$(distdir)/$$file" \
-	    || cp -p $$d/$$file "$(distdir)/$$file" \
-	    || exit 1; \
-	  fi; \
-	done
-	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    $(am__make_dryrun) \
-	      || test -d "$(distdir)/$$subdir" \
-	      || $(MKDIR_P) "$(distdir)/$$subdir" \
-	      || exit 1; \
-	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
-	    $(am__relativize); \
-	    new_distdir=$$reldir; \
-	    dir1=$$subdir; dir2="$(top_distdir)"; \
-	    $(am__relativize); \
-	    new_top_distdir=$$reldir; \
-	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
-	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
-	    ($(am__cd) $$subdir && \
-	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$new_top_distdir" \
-	        distdir="$$new_distdir" \
-		am__remove_distdir=: \
-		am__skip_length_check=: \
-		am__skip_mode_fix=: \
-	        distdir) \
-	      || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-recursive
-all-am: Makefile $(LTLIBRARIES)
-installdirs: installdirs-recursive
-installdirs-am:
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-clean: clean-recursive
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
-	mostlyclean-am
-
-distclean: distclean-recursive
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-html-am:
-
-info: info-recursive
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-recursive
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-recursive
-
-install-html-am:
-
-install-info: install-info-recursive
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-pdf-am:
-
-install-ps: install-ps-recursive
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
-	-rm -rf ./$(DEPDIR)
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: $(am__recursive_targets) install-am install-strip
-
-.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
-	check-am clean clean-generic clean-libtool \
-	clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \
-	distclean-compile distclean-generic distclean-libtool \
-	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-	uninstall-am
-
-
-# these don't work....or maybe they do...try again...???
-#libgbtools_la_CPPFLAGS =  $(DEPS_CFLAGS)
-#libgbtools_la_CXXFLAGS = -g  -Wall -std=c++0x
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/gbtools/src/jsoncpp/jsoncpp.cpp b/gbtools/src/jsoncpp/jsoncpp.cpp
deleted file mode 100644
index 6fd52e9..0000000
--- a/gbtools/src/jsoncpp/jsoncpp.cpp
+++ /dev/null
@@ -1,5247 +0,0 @@
-/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/).
-/// It is intended to be used with #include "json/json.h"
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: LICENSE
-// //////////////////////////////////////////////////////////////////////
-
-/*
-The JsonCpp library's source code, including accompanying documentation, 
-tests and demonstration applications, are licensed under the following
-conditions...
-
-The author (Baptiste Lepilleur) explicitly disclaims copyright in all 
-jurisdictions which recognize such a disclaimer. In such jurisdictions, 
-this software is released into the Public Domain.
-
-In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
-2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
-released under the terms of the MIT License (see below).
-
-In jurisdictions which recognize Public Domain property, the user of this 
-software may choose to accept it either as 1) Public Domain, 2) under the 
-conditions of the MIT License (see below), or 3) under the terms of dual 
-Public Domain/MIT License conditions described here, as they choose.
-
-The MIT License is about as close to Public Domain as a license can get, and is
-described in clear, concise terms at:
-
-   http://en.wikipedia.org/wiki/MIT_License
-   
-The full text of the MIT License follows:
-
-========================================================================
-Copyright (c) 2007-2010 Baptiste Lepilleur
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use, copy,
-modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-========================================================================
-(END LICENSE TEXT)
-
-The MIT license is compatible with both the GPL and commercial
-software, affording one all of the rights of Public Domain with the
-minor nuisance of being required to keep the above copyright notice
-and license text in the source code. Note also that by accepting the
-Public Domain "license" you can re-license your copy using whatever
-license you like.
-
-*/
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: LICENSE
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-#include "json/json.h"
-
-#ifndef JSON_IS_AMALGAMATION
-#error "Compile with -I PATH_TO_JSON_DIRECTORY"
-#endif
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: src/lib_json/json_tool.h
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
-#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
-
-/* This header provides common string manipulation support, such as UTF-8,
- * portable conversion from/to string...
- *
- * It is an internal header that must not be exposed.
- */
-
-namespace Json {
-
-/// Converts a unicode code-point to UTF-8.
-static inline JSONCPP_STRING codePointToUTF8(unsigned int cp) {
-  JSONCPP_STRING result;
-
-  // based on description from http://en.wikipedia.org/wiki/UTF-8
-
-  if (cp <= 0x7f) {
-    result.resize(1);
-    result[0] = static_cast<char>(cp);
-  } else if (cp <= 0x7FF) {
-    result.resize(2);
-    result[1] = static_cast<char>(0x80 | (0x3f & cp));
-    result[0] = static_cast<char>(0xC0 | (0x1f & (cp >> 6)));
-  } else if (cp <= 0xFFFF) {
-    result.resize(3);
-    result[2] = static_cast<char>(0x80 | (0x3f & cp));
-    result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
-    result[0] = static_cast<char>(0xE0 | (0xf & (cp >> 12)));
-  } else if (cp <= 0x10FFFF) {
-    result.resize(4);
-    result[3] = static_cast<char>(0x80 | (0x3f & cp));
-    result[2] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
-    result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 12)));
-    result[0] = static_cast<char>(0xF0 | (0x7 & (cp >> 18)));
-  }
-
-  return result;
-}
-
-/// Returns true if ch is a control character (in range [1,31]).
-static inline bool isControlCharacter(char ch) { return ch > 0 && ch <= 0x1F; }
-
-enum {
-  /// Constant that specify the size of the buffer that must be passed to
-  /// uintToString.
-  uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1
-};
-
-// Defines a char buffer for use with uintToString().
-typedef char UIntToStringBuffer[uintToStringBufferSize];
-
-/** Converts an unsigned integer to string.
- * @param value Unsigned interger to convert to string
- * @param current Input/Output string buffer.
- *        Must have at least uintToStringBufferSize chars free.
- */
-static inline void uintToString(LargestUInt value, char*& current) {
-  *--current = 0;
-  do {
-    *--current = static_cast<char>(value % 10U + static_cast<unsigned>('0'));
-    value /= 10;
-  } while (value != 0);
-}
-
-/** Change ',' to '.' everywhere in buffer.
- *
- * We had a sophisticated way, but it did not work in WinCE.
- * @see https://github.com/open-source-parsers/jsoncpp/pull/9
- */
-static inline void fixNumericLocale(char* begin, char* end) {
-  while (begin < end) {
-    if (*begin == ',') {
-      *begin = '.';
-    }
-    ++begin;
-  }
-}
-
-} // namespace Json {
-
-#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: src/lib_json/json_tool.h
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: src/lib_json/json_reader.cpp
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2011 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#if !defined(JSON_IS_AMALGAMATION)
-#include <json/assertions.h>
-#include <json/reader.h>
-#include <json/value.h>
-#include "json_tool.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-#include <utility>
-#include <cstdio>
-#include <cassert>
-#include <cstring>
-#include <istream>
-#include <sstream>
-#include <memory>
-#include <set>
-#include <limits>
-
-#if defined(_MSC_VER)
-#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above 
-#define snprintf sprintf_s
-#elif _MSC_VER >= 1900 // VC++ 14.0 and above
-#define snprintf std::snprintf
-#else
-#define snprintf _snprintf
-#endif
-#elif defined(__ANDROID__) || defined(__QNXNTO__)
-#define snprintf snprintf
-#elif __cplusplus >= 201103L
-#if !defined(__MINGW32__) && !defined(__CYGWIN__)
-#define snprintf std::snprintf
-#endif
-#endif
-
-#if defined(__QNXNTO__)
-#define sscanf std::sscanf
-#endif
-
-#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
-// Disable warning about strdup being deprecated.
-#pragma warning(disable : 4996)
-#endif
-
-static int const stackLimit_g = 1000;
-static int       stackDepth_g = 0;  // see readValue()
-
-namespace Json {
-
-#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520)
-typedef std::unique_ptr<CharReader> CharReaderPtr;
-#else
-typedef std::auto_ptr<CharReader>   CharReaderPtr;
-#endif
-
-// Implementation of class Features
-// ////////////////////////////////
-
-Features::Features()
-    : allowComments_(true), strictRoot_(false),
-      allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) {}
-
-Features Features::all() { return Features(); }
-
-Features Features::strictMode() {
-  Features features;
-  features.allowComments_ = false;
-  features.strictRoot_ = true;
-  features.allowDroppedNullPlaceholders_ = false;
-  features.allowNumericKeys_ = false;
-  return features;
-}
-
-// Implementation of class Reader
-// ////////////////////////////////
-
-static bool containsNewLine(Reader::Location begin, Reader::Location end) {
-  for (; begin < end; ++begin)
-    if (*begin == '\n' || *begin == '\r')
-      return true;
-  return false;
-}
-
-// Class Reader
-// //////////////////////////////////////////////////////////////////
-
-Reader::Reader()
-    : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
-      lastValue_(), commentsBefore_(), features_(Features::all()),
-      collectComments_() {}
-
-Reader::Reader(const Features& features)
-    : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
-      lastValue_(), commentsBefore_(), features_(features), collectComments_() {
-}
-
-bool
-Reader::parse(const std::string& document, Value& root, bool collectComments) {
-  JSONCPP_STRING documentCopy(document.data(), document.data() + document.capacity());
-  std::swap(documentCopy, document_);
-  const char* begin = document_.c_str();
-  const char* end = begin + document_.length();
-  return parse(begin, end, root, collectComments);
-}
-
-bool Reader::parse(std::istream& sin, Value& root, bool collectComments) {
-  // std::istream_iterator<char> begin(sin);
-  // std::istream_iterator<char> end;
-  // Those would allow streamed input from a file, if parse() were a
-  // template function.
-
-  // Since JSONCPP_STRING is reference-counted, this at least does not
-  // create an extra copy.
-  JSONCPP_STRING doc;
-  std::getline(sin, doc, (char)EOF);
-  return parse(doc.data(), doc.data() + doc.size(), root, collectComments);
-}
-
-bool Reader::parse(const char* beginDoc,
-                   const char* endDoc,
-                   Value& root,
-                   bool collectComments) {
-  if (!features_.allowComments_) {
-    collectComments = false;
-  }
-
-  begin_ = beginDoc;
-  end_ = endDoc;
-  collectComments_ = collectComments;
-  current_ = begin_;
-  lastValueEnd_ = 0;
-  lastValue_ = 0;
-  commentsBefore_ = "";
-  errors_.clear();
-  while (!nodes_.empty())
-    nodes_.pop();
-  nodes_.push(&root);
-
-  stackDepth_g = 0;  // Yes, this is bad coding, but options are limited.
-  bool successful = readValue();
-  Token token;
-  skipCommentTokens(token);
-  if (collectComments_ && !commentsBefore_.empty())
-    root.setComment(commentsBefore_, commentAfter);
-  if (features_.strictRoot_) {
-    if (!root.isArray() && !root.isObject()) {
-      // Set error location to start of doc, ideally should be first token found
-      // in doc
-      token.type_ = tokenError;
-      token.start_ = beginDoc;
-      token.end_ = endDoc;
-      addError(
-          "A valid JSON document must be either an array or an object value.",
-          token);
-      return false;
-    }
-  }
-  return successful;
-}
-
-bool Reader::readValue() {
-  // This is a non-reentrant way to support a stackLimit. Terrible!
-  // But this deprecated class has a security problem: Bad input can
-  // cause a seg-fault. This seems like a fair, binary-compatible way
-  // to prevent the problem.
-  if (stackDepth_g >= stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue().");
-  ++stackDepth_g;
-
-  Token token;
-  skipCommentTokens(token);
-  bool successful = true;
-
-  if (collectComments_ && !commentsBefore_.empty()) {
-    currentValue().setComment(commentsBefore_, commentBefore);
-    commentsBefore_ = "";
-  }
-
-  switch (token.type_) {
-  case tokenObjectBegin:
-    successful = readObject(token);
-    currentValue().setOffsetLimit(current_ - begin_);
-    break;
-  case tokenArrayBegin:
-    successful = readArray(token);
-    currentValue().setOffsetLimit(current_ - begin_);
-    break;
-  case tokenNumber:
-    successful = decodeNumber(token);
-    break;
-  case tokenString:
-    successful = decodeString(token);
-    break;
-  case tokenTrue:
-    {
-    Value v(true);
-    currentValue().swapPayload(v);
-    currentValue().setOffsetStart(token.start_ - begin_);
-    currentValue().setOffsetLimit(token.end_ - begin_);
-    }
-    break;
-  case tokenFalse:
-    {
-    Value v(false);
-    currentValue().swapPayload(v);
-    currentValue().setOffsetStart(token.start_ - begin_);
-    currentValue().setOffsetLimit(token.end_ - begin_);
-    }
-    break;
-  case tokenNull:
-    {
-    Value v;
-    currentValue().swapPayload(v);
-    currentValue().setOffsetStart(token.start_ - begin_);
-    currentValue().setOffsetLimit(token.end_ - begin_);
-    }
-    break;
-  case tokenArraySeparator:
-  case tokenObjectEnd:
-  case tokenArrayEnd:
-    if (features_.allowDroppedNullPlaceholders_) {
-      // "Un-read" the current token and mark the current value as a null
-      // token.
-      current_--;
-      Value v;
-      currentValue().swapPayload(v);
-      currentValue().setOffsetStart(current_ - begin_ - 1);
-      currentValue().setOffsetLimit(current_ - begin_);
-      break;
-    } // Else, fall through...
-  default:
-    currentValue().setOffsetStart(token.start_ - begin_);
-    currentValue().setOffsetLimit(token.end_ - begin_);
-    return addError("Syntax error: value, object or array expected.", token);
-  }
-
-  if (collectComments_) {
-    lastValueEnd_ = current_;
-    lastValue_ = &currentValue();
-  }
-
-  --stackDepth_g;
-  return successful;
-}
-
-void Reader::skipCommentTokens(Token& token) {
-  if (features_.allowComments_) {
-    do {
-      readToken(token);
-    } while (token.type_ == tokenComment);
-  } else {
-    readToken(token);
-  }
-}
-
-bool Reader::readToken(Token& token) {
-  skipSpaces();
-  token.start_ = current_;
-  Char c = getNextChar();
-  bool ok = true;
-  switch (c) {
-  case '{':
-    token.type_ = tokenObjectBegin;
-    break;
-  case '}':
-    token.type_ = tokenObjectEnd;
-    break;
-  case '[':
-    token.type_ = tokenArrayBegin;
-    break;
-  case ']':
-    token.type_ = tokenArrayEnd;
-    break;
-  case '"':
-    token.type_ = tokenString;
-    ok = readString();
-    break;
-  case '/':
-    token.type_ = tokenComment;
-    ok = readComment();
-    break;
-  case '0':
-  case '1':
-  case '2':
-  case '3':
-  case '4':
-  case '5':
-  case '6':
-  case '7':
-  case '8':
-  case '9':
-  case '-':
-    token.type_ = tokenNumber;
-    readNumber();
-    break;
-  case 't':
-    token.type_ = tokenTrue;
-    ok = match("rue", 3);
-    break;
-  case 'f':
-    token.type_ = tokenFalse;
-    ok = match("alse", 4);
-    break;
-  case 'n':
-    token.type_ = tokenNull;
-    ok = match("ull", 3);
-    break;
-  case ',':
-    token.type_ = tokenArraySeparator;
-    break;
-  case ':':
-    token.type_ = tokenMemberSeparator;
-    break;
-  case 0:
-    token.type_ = tokenEndOfStream;
-    break;
-  default:
-    ok = false;
-    break;
-  }
-  if (!ok)
-    token.type_ = tokenError;
-  token.end_ = current_;
-  return true;
-}
-
-void Reader::skipSpaces() {
-  while (current_ != end_) {
-    Char c = *current_;
-    if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
-      ++current_;
-    else
-      break;
-  }
-}
-
-bool Reader::match(Location pattern, int patternLength) {
-  if (end_ - current_ < patternLength)
-    return false;
-  int index = patternLength;
-  while (index--)
-    if (current_[index] != pattern[index])
-      return false;
-  current_ += patternLength;
-  return true;
-}
-
-bool Reader::readComment() {
-  Location commentBegin = current_ - 1;
-  Char c = getNextChar();
-  bool successful = false;
-  if (c == '*')
-    successful = readCStyleComment();
-  else if (c == '/')
-    successful = readCppStyleComment();
-  if (!successful)
-    return false;
-
-  if (collectComments_) {
-    CommentPlacement placement = commentBefore;
-    if (lastValueEnd_ && !containsNewLine(lastValueEnd_, commentBegin)) {
-      if (c != '*' || !containsNewLine(commentBegin, current_))
-        placement = commentAfterOnSameLine;
-    }
-
-    addComment(commentBegin, current_, placement);
-  }
-  return true;
-}
-
-static JSONCPP_STRING normalizeEOL(Reader::Location begin, Reader::Location end) {
-  JSONCPP_STRING normalized;
-  normalized.reserve(static_cast<size_t>(end - begin));
-  Reader::Location current = begin;
-  while (current != end) {
-    char c = *current++;
-    if (c == '\r') {
-      if (current != end && *current == '\n')
-         // convert dos EOL
-         ++current;
-      // convert Mac EOL
-      normalized += '\n';
-    } else {
-      normalized += c;
-    }
-  }
-  return normalized;
-}
-
-void
-Reader::addComment(Location begin, Location end, CommentPlacement placement) {
-  assert(collectComments_);
-  const JSONCPP_STRING& normalized = normalizeEOL(begin, end);
-  if (placement == commentAfterOnSameLine) {
-    assert(lastValue_ != 0);
-    lastValue_->setComment(normalized, placement);
-  } else {
-    commentsBefore_ += normalized;
-  }
-}
-
-bool Reader::readCStyleComment() {
-  while (current_ != end_) {
-    Char c = getNextChar();
-    if (c == '*' && *current_ == '/')
-      break;
-  }
-  return getNextChar() == '/';
-}
-
-bool Reader::readCppStyleComment() {
-  while (current_ != end_) {
-    Char c = getNextChar();
-    if (c == '\n')
-      break;
-    if (c == '\r') {
-      // Consume DOS EOL. It will be normalized in addComment.
-      if (current_ != end_ && *current_ == '\n')
-        getNextChar();
-      // Break on Moc OS 9 EOL.
-      break;
-    }
-  }
-  return true;
-}
-
-void Reader::readNumber() {
-  const char *p = current_;
-  char c = '0'; // stopgap for already consumed character
-  // integral part
-  while (c >= '0' && c <= '9')
-    c = (current_ = p) < end_ ? *p++ : 0;
-  // fractional part
-  if (c == '.') {
-    c = (current_ = p) < end_ ? *p++ : 0;
-    while (c >= '0' && c <= '9')
-      c = (current_ = p) < end_ ? *p++ : 0;
-  }
-  // exponential part
-  if (c == 'e' || c == 'E') {
-    c = (current_ = p) < end_ ? *p++ : 0;
-    if (c == '+' || c == '-')
-      c = (current_ = p) < end_ ? *p++ : 0;
-    while (c >= '0' && c <= '9')
-      c = (current_ = p) < end_ ? *p++ : 0;
-  }
-}
-
-bool Reader::readString() {
-  Char c = 0;
-  while (current_ != end_) {
-    c = getNextChar();
-    if (c == '\\')
-      getNextChar();
-    else if (c == '"')
-      break;
-  }
-  return c == '"';
-}
-
-bool Reader::readObject(Token& tokenStart) {
-  Token tokenName;
-  JSONCPP_STRING name;
-  Value init(objectValue);
-  currentValue().swapPayload(init);
-  currentValue().setOffsetStart(tokenStart.start_ - begin_);
-  while (readToken(tokenName)) {
-    bool initialTokenOk = true;
-    while (tokenName.type_ == tokenComment && initialTokenOk)
-      initialTokenOk = readToken(tokenName);
-    if (!initialTokenOk)
-      break;
-    if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
-      return true;
-    name = "";
-    if (tokenName.type_ == tokenString) {
-      if (!decodeString(tokenName, name))
-        return recoverFromError(tokenObjectEnd);
-    } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) {
-      Value numberName;
-      if (!decodeNumber(tokenName, numberName))
-        return recoverFromError(tokenObjectEnd);
-      name = JSONCPP_STRING(numberName.asCString());
-    } else {
-      break;
-    }
-
-    Token colon;
-    if (!readToken(colon) || colon.type_ != tokenMemberSeparator) {
-      return addErrorAndRecover(
-          "Missing ':' after object member name", colon, tokenObjectEnd);
-    }
-    Value& value = currentValue()[name];
-    nodes_.push(&value);
-    bool ok = readValue();
-    nodes_.pop();
-    if (!ok) // error already set
-      return recoverFromError(tokenObjectEnd);
-
-    Token comma;
-    if (!readToken(comma) ||
-        (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator &&
-         comma.type_ != tokenComment)) {
-      return addErrorAndRecover(
-          "Missing ',' or '}' in object declaration", comma, tokenObjectEnd);
-    }
-    bool finalizeTokenOk = true;
-    while (comma.type_ == tokenComment && finalizeTokenOk)
-      finalizeTokenOk = readToken(comma);
-    if (comma.type_ == tokenObjectEnd)
-      return true;
-  }
-  return addErrorAndRecover(
-      "Missing '}' or object member name", tokenName, tokenObjectEnd);
-}
-
-bool Reader::readArray(Token& tokenStart) {
-  Value init(arrayValue);
-  currentValue().swapPayload(init);
-  currentValue().setOffsetStart(tokenStart.start_ - begin_);
-  skipSpaces();
-  if (*current_ == ']') // empty array
-  {
-    Token endArray;
-    readToken(endArray);
-    return true;
-  }
-  int index = 0;
-  for (;;) {
-    Value& value = currentValue()[index++];
-    nodes_.push(&value);
-    bool ok = readValue();
-    nodes_.pop();
-    if (!ok) // error already set
-      return recoverFromError(tokenArrayEnd);
-
-    Token token;
-    // Accept Comment after last item in the array.
-    ok = readToken(token);
-    while (token.type_ == tokenComment && ok) {
-      ok = readToken(token);
-    }
-    bool badTokenType =
-        (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd);
-    if (!ok || badTokenType) {
-      return addErrorAndRecover(
-          "Missing ',' or ']' in array declaration", token, tokenArrayEnd);
-    }
-    if (token.type_ == tokenArrayEnd)
-      break;
-  }
-  return true;
-}
-
-bool Reader::decodeNumber(Token& token) {
-  Value decoded;
-  if (!decodeNumber(token, decoded))
-    return false;
-  currentValue().swapPayload(decoded);
-  currentValue().setOffsetStart(token.start_ - begin_);
-  currentValue().setOffsetLimit(token.end_ - begin_);
-  return true;
-}
-
-bool Reader::decodeNumber(Token& token, Value& decoded) {
-  // Attempts to parse the number as an integer. If the number is
-  // larger than the maximum supported value of an integer then
-  // we decode the number as a double.
-  Location current = token.start_;
-  bool isNegative = *current == '-';
-  if (isNegative)
-    ++current;
-  // TODO: Help the compiler do the div and mod at compile time or get rid of them.
-  Value::LargestUInt maxIntegerValue =
-      isNegative ? Value::LargestUInt(Value::maxLargestInt) + 1
-                 : Value::maxLargestUInt;
-  Value::LargestUInt threshold = maxIntegerValue / 10;
-  Value::LargestUInt value = 0;
-  while (current < token.end_) {
-    Char c = *current++;
-    if (c < '0' || c > '9')
-      return decodeDouble(token, decoded);
-    Value::UInt digit(static_cast<Value::UInt>(c - '0'));
-    if (value >= threshold) {
-      // We've hit or exceeded the max value divided by 10 (rounded down). If
-      // a) we've only just touched the limit, b) this is the last digit, and
-      // c) it's small enough to fit in that rounding delta, we're okay.
-      // Otherwise treat this number as a double to avoid overflow.
-      if (value > threshold || current != token.end_ ||
-          digit > maxIntegerValue % 10) {
-        return decodeDouble(token, decoded);
-      }
-    }
-    value = value * 10 + digit;
-  }
-  if (isNegative && value == maxIntegerValue)
-    decoded = Value::minLargestInt;
-  else if (isNegative)
-    decoded = -Value::LargestInt(value);
-  else if (value <= Value::LargestUInt(Value::maxInt))
-    decoded = Value::LargestInt(value);
-  else
-    decoded = value;
-  return true;
-}
-
-bool Reader::decodeDouble(Token& token) {
-  Value decoded;
-  if (!decodeDouble(token, decoded))
-    return false;
-  currentValue().swapPayload(decoded);
-  currentValue().setOffsetStart(token.start_ - begin_);
-  currentValue().setOffsetLimit(token.end_ - begin_);
-  return true;
-}
-
-bool Reader::decodeDouble(Token& token, Value& decoded) {
-  double value = 0;
-  JSONCPP_STRING buffer(token.start_, token.end_);
-  JSONCPP_ISTRINGSTREAM is(buffer);
-  if (!(is >> value))
-    return addError("'" + JSONCPP_STRING(token.start_, token.end_) +
-                        "' is not a number.",
-                    token);
-  decoded = value;
-  return true;
-}
-
-bool Reader::decodeString(Token& token) {
-  JSONCPP_STRING decoded_string;
-  if (!decodeString(token, decoded_string))
-    return false;
-  Value decoded(decoded_string);
-  currentValue().swapPayload(decoded);
-  currentValue().setOffsetStart(token.start_ - begin_);
-  currentValue().setOffsetLimit(token.end_ - begin_);
-  return true;
-}
-
-bool Reader::decodeString(Token& token, JSONCPP_STRING& decoded) {
-  decoded.reserve(static_cast<size_t>(token.end_ - token.start_ - 2));
-  Location current = token.start_ + 1; // skip '"'
-  Location end = token.end_ - 1;       // do not include '"'
-  while (current != end) {
-    Char c = *current++;
-    if (c == '"')
-      break;
-    else if (c == '\\') {
-      if (current == end)
-        return addError("Empty escape sequence in string", token, current);
-      Char escape = *current++;
-      switch (escape) {
-      case '"':
-        decoded += '"';
-        break;
-      case '/':
-        decoded += '/';
-        break;
-      case '\\':
-        decoded += '\\';
-        break;
-      case 'b':
-        decoded += '\b';
-        break;
-      case 'f':
-        decoded += '\f';
-        break;
-      case 'n':
-        decoded += '\n';
-        break;
-      case 'r':
-        decoded += '\r';
-        break;
-      case 't':
-        decoded += '\t';
-        break;
-      case 'u': {
-        unsigned int unicode;
-        if (!decodeUnicodeCodePoint(token, current, end, unicode))
-          return false;
-        decoded += codePointToUTF8(unicode);
-      } break;
-      default:
-        return addError("Bad escape sequence in string", token, current);
-      }
-    } else {
-      decoded += c;
-    }
-  }
-  return true;
-}
-
-bool Reader::decodeUnicodeCodePoint(Token& token,
-                                    Location& current,
-                                    Location end,
-                                    unsigned int& unicode) {
-
-  if (!decodeUnicodeEscapeSequence(token, current, end, unicode))
-    return false;
-  if (unicode >= 0xD800 && unicode <= 0xDBFF) {
-    // surrogate pairs
-    if (end - current < 6)
-      return addError(
-          "additional six characters expected to parse unicode surrogate pair.",
-          token,
-          current);
-    unsigned int surrogatePair;
-    if (*(current++) == '\\' && *(current++) == 'u') {
-      if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) {
-        unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF);
-      } else
-        return false;
-    } else
-      return addError("expecting another \\u token to begin the second half of "
-                      "a unicode surrogate pair",
-                      token,
-                      current);
-  }
-  return true;
-}
-
-bool Reader::decodeUnicodeEscapeSequence(Token& token,
-                                         Location& current,
-                                         Location end,
-                                         unsigned int& ret_unicode) {
-  if (end - current < 4)
-    return addError(
-        "Bad unicode escape sequence in string: four digits expected.",
-        token,
-        current);
-  int unicode = 0;
-  for (int index = 0; index < 4; ++index) {
-    Char c = *current++;
-    unicode *= 16;
-    if (c >= '0' && c <= '9')
-      unicode += c - '0';
-    else if (c >= 'a' && c <= 'f')
-      unicode += c - 'a' + 10;
-    else if (c >= 'A' && c <= 'F')
-      unicode += c - 'A' + 10;
-    else
-      return addError(
-          "Bad unicode escape sequence in string: hexadecimal digit expected.",
-          token,
-          current);
-  }
-  ret_unicode = static_cast<unsigned int>(unicode);
-  return true;
-}
-
-bool
-Reader::addError(const JSONCPP_STRING& message, Token& token, Location extra) {
-  ErrorInfo info;
-  info.token_ = token;
-  info.message_ = message;
-  info.extra_ = extra;
-  errors_.push_back(info);
-  return false;
-}
-
-bool Reader::recoverFromError(TokenType skipUntilToken) {
-  size_t const errorCount = errors_.size();
-  Token skip;
-  for (;;) {
-    if (!readToken(skip))
-      errors_.resize(errorCount); // discard errors caused by recovery
-    if (skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream)
-      break;
-  }
-  errors_.resize(errorCount);
-  return false;
-}
-
-bool Reader::addErrorAndRecover(const JSONCPP_STRING& message,
-                                Token& token,
-                                TokenType skipUntilToken) {
-  addError(message, token);
-  return recoverFromError(skipUntilToken);
-}
-
-Value& Reader::currentValue() { return *(nodes_.top()); }
-
-Reader::Char Reader::getNextChar() {
-  if (current_ == end_)
-    return 0;
-  return *current_++;
-}
-
-void Reader::getLocationLineAndColumn(Location location,
-                                      int& line,
-                                      int& column) const {
-  Location current = begin_;
-  Location lastLineStart = current;
-  line = 0;
-  while (current < location && current != end_) {
-    Char c = *current++;
-    if (c == '\r') {
-      if (*current == '\n')
-        ++current;
-      lastLineStart = current;
-      ++line;
-    } else if (c == '\n') {
-      lastLineStart = current;
-      ++line;
-    }
-  }
-  // column & line start at 1
-  column = int(location - lastLineStart) + 1;
-  ++line;
-}
-
-JSONCPP_STRING Reader::getLocationLineAndColumn(Location location) const {
-  int line, column;
-  getLocationLineAndColumn(location, line, column);
-  char buffer[18 + 16 + 16 + 1];
-  snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
-  return buffer;
-}
-
-// Deprecated. Preserved for backward compatibility
-JSONCPP_STRING Reader::getFormatedErrorMessages() const {
-  return getFormattedErrorMessages();
-}
-
-JSONCPP_STRING Reader::getFormattedErrorMessages() const {
-  JSONCPP_STRING formattedMessage;
-  for (Errors::const_iterator itError = errors_.begin();
-       itError != errors_.end();
-       ++itError) {
-    const ErrorInfo& error = *itError;
-    formattedMessage +=
-        "* " + getLocationLineAndColumn(error.token_.start_) + "\n";
-    formattedMessage += "  " + error.message_ + "\n";
-    if (error.extra_)
-      formattedMessage +=
-          "See " + getLocationLineAndColumn(error.extra_) + " for detail.\n";
-  }
-  return formattedMessage;
-}
-
-std::vector<Reader::StructuredError> Reader::getStructuredErrors() const {
-  std::vector<Reader::StructuredError> allErrors;
-  for (Errors::const_iterator itError = errors_.begin();
-       itError != errors_.end();
-       ++itError) {
-    const ErrorInfo& error = *itError;
-    Reader::StructuredError structured;
-    structured.offset_start = error.token_.start_ - begin_;
-    structured.offset_limit = error.token_.end_ - begin_;
-    structured.message = error.message_;
-    allErrors.push_back(structured);
-  }
-  return allErrors;
-}
-
-bool Reader::pushError(const Value& value, const JSONCPP_STRING& message) {
-  ptrdiff_t const length = end_ - begin_;
-  if(value.getOffsetStart() > length
-    || value.getOffsetLimit() > length)
-    return false;
-  Token token;
-  token.type_ = tokenError;
-  token.start_ = begin_ + value.getOffsetStart();
-  token.end_ = end_ + value.getOffsetLimit();
-  ErrorInfo info;
-  info.token_ = token;
-  info.message_ = message;
-  info.extra_ = 0;
-  errors_.push_back(info);
-  return true;
-}
-
-bool Reader::pushError(const Value& value, const JSONCPP_STRING& message, const Value& extra) {
-  ptrdiff_t const length = end_ - begin_;
-  if(value.getOffsetStart() > length
-    || value.getOffsetLimit() > length
-    || extra.getOffsetLimit() > length)
-    return false;
-  Token token;
-  token.type_ = tokenError;
-  token.start_ = begin_ + value.getOffsetStart();
-  token.end_ = begin_ + value.getOffsetLimit();
-  ErrorInfo info;
-  info.token_ = token;
-  info.message_ = message;
-  info.extra_ = begin_ + extra.getOffsetStart();
-  errors_.push_back(info);
-  return true;
-}
-
-bool Reader::good() const {
-  return !errors_.size();
-}
-
-// exact copy of Features
-class OurFeatures {
-public:
-  static OurFeatures all();
-  bool allowComments_;
-  bool strictRoot_;
-  bool allowDroppedNullPlaceholders_;
-  bool allowNumericKeys_;
-  bool allowSingleQuotes_;
-  bool failIfExtra_;
-  bool rejectDupKeys_;
-  bool allowSpecialFloats_;
-  int stackLimit_;
-};  // OurFeatures
-
-// exact copy of Implementation of class Features
-// ////////////////////////////////
-
-OurFeatures OurFeatures::all() { return OurFeatures(); }
-
-// Implementation of class Reader
-// ////////////////////////////////
-
-// exact copy of Reader, renamed to OurReader
-class OurReader {
-public:
-  typedef char Char;
-  typedef const Char* Location;
-  struct StructuredError {
-    ptrdiff_t offset_start;
-    ptrdiff_t offset_limit;
-    JSONCPP_STRING message;
-  };
-
-  OurReader(OurFeatures const& features);
-  bool parse(const char* beginDoc,
-             const char* endDoc,
-             Value& root,
-             bool collectComments = true);
-  JSONCPP_STRING getFormattedErrorMessages() const;
-  std::vector<StructuredError> getStructuredErrors() const;
-  bool pushError(const Value& value, const JSONCPP_STRING& message);
-  bool pushError(const Value& value, const JSONCPP_STRING& message, const Value& extra);
-  bool good() const;
-
-private:
-  OurReader(OurReader const&);  // no impl
-  void operator=(OurReader const&);  // no impl
-
-  enum TokenType {
-    tokenEndOfStream = 0,
-    tokenObjectBegin,
-    tokenObjectEnd,
-    tokenArrayBegin,
-    tokenArrayEnd,
-    tokenString,
-    tokenNumber,
-    tokenTrue,
-    tokenFalse,
-    tokenNull,
-    tokenNaN,
-    tokenPosInf,
-    tokenNegInf,
-    tokenArraySeparator,
-    tokenMemberSeparator,
-    tokenComment,
-    tokenError
-  };
-
-  class Token {
-  public:
-    TokenType type_;
-    Location start_;
-    Location end_;
-  };
-
-  class ErrorInfo {
-  public:
-    Token token_;
-    JSONCPP_STRING message_;
-    Location extra_;
-  };
-
-  typedef std::deque<ErrorInfo> Errors;
-
-  bool readToken(Token& token);
-  void skipSpaces();
-  bool match(Location pattern, int patternLength);
-  bool readComment();
-  bool readCStyleComment();
-  bool readCppStyleComment();
-  bool readString();
-  bool readStringSingleQuote();
-  bool readNumber(bool checkInf);
-  bool readValue();
-  bool readObject(Token& token);
-  bool readArray(Token& token);
-  bool decodeNumber(Token& token);
-  bool decodeNumber(Token& token, Value& decoded);
-  bool decodeString(Token& token);
-  bool decodeString(Token& token, JSONCPP_STRING& decoded);
-  bool decodeDouble(Token& token);
-  bool decodeDouble(Token& token, Value& decoded);
-  bool decodeUnicodeCodePoint(Token& token,
-                              Location& current,
-                              Location end,
-                              unsigned int& unicode);
-  bool decodeUnicodeEscapeSequence(Token& token,
-                                   Location& current,
-                                   Location end,
-                                   unsigned int& unicode);
-  bool addError(const JSONCPP_STRING& message, Token& token, Location extra = 0);
-  bool recoverFromError(TokenType skipUntilToken);
-  bool addErrorAndRecover(const JSONCPP_STRING& message,
-                          Token& token,
-                          TokenType skipUntilToken);
-  void skipUntilSpace();
-  Value& currentValue();
-  Char getNextChar();
-  void
-  getLocationLineAndColumn(Location location, int& line, int& column) const;
-  JSONCPP_STRING getLocationLineAndColumn(Location location) const;
-  void addComment(Location begin, Location end, CommentPlacement placement);
-  void skipCommentTokens(Token& token);
-
-  typedef std::stack<Value*> Nodes;
-  Nodes nodes_;
-  Errors errors_;
-  JSONCPP_STRING document_;
-  Location begin_;
-  Location end_;
-  Location current_;
-  Location lastValueEnd_;
-  Value* lastValue_;
-  JSONCPP_STRING commentsBefore_;
-  int stackDepth_;
-
-  OurFeatures const features_;
-  bool collectComments_;
-};  // OurReader
-
-// complete copy of Read impl, for OurReader
-
-OurReader::OurReader(OurFeatures const& features)
-    : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
-      lastValue_(), commentsBefore_(),
-      stackDepth_(0),
-      features_(features), collectComments_() {
-}
-
-bool OurReader::parse(const char* beginDoc,
-                   const char* endDoc,
-                   Value& root,
-                   bool collectComments) {
-  if (!features_.allowComments_) {
-    collectComments = false;
-  }
-
-  begin_ = beginDoc;
-  end_ = endDoc;
-  collectComments_ = collectComments;
-  current_ = begin_;
-  lastValueEnd_ = 0;
-  lastValue_ = 0;
-  commentsBefore_ = "";
-  errors_.clear();
-  while (!nodes_.empty())
-    nodes_.pop();
-  nodes_.push(&root);
-
-  stackDepth_ = 0;
-  bool successful = readValue();
-  Token token;
-  skipCommentTokens(token);
-  if (features_.failIfExtra_) {
-    if (token.type_ != tokenError && token.type_ != tokenEndOfStream) {
-      addError("Extra non-whitespace after JSON value.", token);
-      return false;
-    }
-  }
-  if (collectComments_ && !commentsBefore_.empty())
-    root.setComment(commentsBefore_, commentAfter);
-  if (features_.strictRoot_) {
-    if (!root.isArray() && !root.isObject()) {
-      // Set error location to start of doc, ideally should be first token found
-      // in doc
-      token.type_ = tokenError;
-      token.start_ = beginDoc;
-      token.end_ = endDoc;
-      addError(
-          "A valid JSON document must be either an array or an object value.",
-          token);
-      return false;
-    }
-  }
-  return successful;
-}
-
-bool OurReader::readValue() {
-  if (stackDepth_ >= features_.stackLimit_) throwRuntimeError("Exceeded stackLimit in readValue().");
-  ++stackDepth_;
-  Token token;
-  skipCommentTokens(token);
-  bool successful = true;
-
-  if (collectComments_ && !commentsBefore_.empty()) {
-    currentValue().setComment(commentsBefore_, commentBefore);
-    commentsBefore_ = "";
-  }
-
-  switch (token.type_) {
-  case tokenObjectBegin:
-    successful = readObject(token);
-    currentValue().setOffsetLimit(current_ - begin_);
-    break;
-  case tokenArrayBegin:
-    successful = readArray(token);
-    currentValue().setOffsetLimit(current_ - begin_);
-    break;
-  case tokenNumber:
-    successful = decodeNumber(token);
-    break;
-  case tokenString:
-    successful = decodeString(token);
-    break;
-  case tokenTrue:
-    {
-    Value v(true);
-    currentValue().swapPayload(v);
-    currentValue().setOffsetStart(token.start_ - begin_);
-    currentValue().setOffsetLimit(token.end_ - begin_);
-    }
-    break;
-  case tokenFalse:
-    {
-    Value v(false);
-    currentValue().swapPayload(v);
-    currentValue().setOffsetStart(token.start_ - begin_);
-    currentValue().setOffsetLimit(token.end_ - begin_);
-    }
-    break;
-  case tokenNull:
-    {
-    Value v;
-    currentValue().swapPayload(v);
-    currentValue().setOffsetStart(token.start_ - begin_);
-    currentValue().setOffsetLimit(token.end_ - begin_);
-    }
-    break;
-  case tokenNaN:
-    {
-    Value v(std::numeric_limits<double>::quiet_NaN());
-    currentValue().swapPayload(v);
-    currentValue().setOffsetStart(token.start_ - begin_);
-    currentValue().setOffsetLimit(token.end_ - begin_);
-    }
-    break;
-  case tokenPosInf:
-    {
-    Value v(std::numeric_limits<double>::infinity());
-    currentValue().swapPayload(v);
-    currentValue().setOffsetStart(token.start_ - begin_);
-    currentValue().setOffsetLimit(token.end_ - begin_);
-    }
-    break;
-  case tokenNegInf:
-    {
-    Value v(-std::numeric_limits<double>::infinity());
-    currentValue().swapPayload(v);
-    currentValue().setOffsetStart(token.start_ - begin_);
-    currentValue().setOffsetLimit(token.end_ - begin_);
-    }
-    break;
-  case tokenArraySeparator:
-  case tokenObjectEnd:
-  case tokenArrayEnd:
-    if (features_.allowDroppedNullPlaceholders_) {
-      // "Un-read" the current token and mark the current value as a null
-      // token.
-      current_--;
-      Value v;
-      currentValue().swapPayload(v);
-      currentValue().setOffsetStart(current_ - begin_ - 1);
-      currentValue().setOffsetLimit(current_ - begin_);
-      break;
-    } // else, fall through ...
-  default:
-    currentValue().setOffsetStart(token.start_ - begin_);
-    currentValue().setOffsetLimit(token.end_ - begin_);
-    return addError("Syntax error: value, object or array expected.", token);
-  }
-
-  if (collectComments_) {
-    lastValueEnd_ = current_;
-    lastValue_ = &currentValue();
-  }
-
-  --stackDepth_;
-  return successful;
-}
-
-void OurReader::skipCommentTokens(Token& token) {
-  if (features_.allowComments_) {
-    do {
-      readToken(token);
-    } while (token.type_ == tokenComment);
-  } else {
-    readToken(token);
-  }
-}
-
-bool OurReader::readToken(Token& token) {
-  skipSpaces();
-  token.start_ = current_;
-  Char c = getNextChar();
-  bool ok = true;
-  switch (c) {
-  case '{':
-    token.type_ = tokenObjectBegin;
-    break;
-  case '}':
-    token.type_ = tokenObjectEnd;
-    break;
-  case '[':
-    token.type_ = tokenArrayBegin;
-    break;
-  case ']':
-    token.type_ = tokenArrayEnd;
-    break;
-  case '"':
-    token.type_ = tokenString;
-    ok = readString();
-    break;
-  case '\'':
-    if (features_.allowSingleQuotes_) {
-    token.type_ = tokenString;
-    ok = readStringSingleQuote();
-    break;
-    } // else continue
-  case '/':
-    token.type_ = tokenComment;
-    ok = readComment();
-    break;
-  case '0':
-  case '1':
-  case '2':
-  case '3':
-  case '4':
-  case '5':
-  case '6':
-  case '7':
-  case '8':
-  case '9':
-    token.type_ = tokenNumber;
-    readNumber(false);
-    break;
-  case '-':
-    if (readNumber(true)) {
-      token.type_ = tokenNumber;
-    } else {
-      token.type_ = tokenNegInf;
-      ok = features_.allowSpecialFloats_ && match("nfinity", 7);
-    }
-    break;
-  case 't':
-    token.type_ = tokenTrue;
-    ok = match("rue", 3);
-    break;
-  case 'f':
-    token.type_ = tokenFalse;
-    ok = match("alse", 4);
-    break;
-  case 'n':
-    token.type_ = tokenNull;
-    ok = match("ull", 3);
-    break;
-  case 'N':
-    if (features_.allowSpecialFloats_) {
-      token.type_ = tokenNaN;
-      ok = match("aN", 2);
-    } else {
-      ok = false;
-    }
-    break;
-  case 'I':
-    if (features_.allowSpecialFloats_) {
-      token.type_ = tokenPosInf;
-      ok = match("nfinity", 7);
-    } else {
-      ok = false;
-    }
-    break;
-  case ',':
-    token.type_ = tokenArraySeparator;
-    break;
-  case ':':
-    token.type_ = tokenMemberSeparator;
-    break;
-  case 0:
-    token.type_ = tokenEndOfStream;
-    break;
-  default:
-    ok = false;
-    break;
-  }
-  if (!ok)
-    token.type_ = tokenError;
-  token.end_ = current_;
-  return true;
-}
-
-void OurReader::skipSpaces() {
-  while (current_ != end_) {
-    Char c = *current_;
-    if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
-      ++current_;
-    else
-      break;
-  }
-}
-
-bool OurReader::match(Location pattern, int patternLength) {
-  if (end_ - current_ < patternLength)
-    return false;
-  int index = patternLength;
-  while (index--)
-    if (current_[index] != pattern[index])
-      return false;
-  current_ += patternLength;
-  return true;
-}
-
-bool OurReader::readComment() {
-  Location commentBegin = current_ - 1;
-  Char c = getNextChar();
-  bool successful = false;
-  if (c == '*')
-    successful = readCStyleComment();
-  else if (c == '/')
-    successful = readCppStyleComment();
-  if (!successful)
-    return false;
-
-  if (collectComments_) {
-    CommentPlacement placement = commentBefore;
-    if (lastValueEnd_ && !containsNewLine(lastValueEnd_, commentBegin)) {
-      if (c != '*' || !containsNewLine(commentBegin, current_))
-        placement = commentAfterOnSameLine;
-    }
-
-    addComment(commentBegin, current_, placement);
-  }
-  return true;
-}
-
-void
-OurReader::addComment(Location begin, Location end, CommentPlacement placement) {
-  assert(collectComments_);
-  const JSONCPP_STRING& normalized = normalizeEOL(begin, end);
-  if (placement == commentAfterOnSameLine) {
-    assert(lastValue_ != 0);
-    lastValue_->setComment(normalized, placement);
-  } else {
-    commentsBefore_ += normalized;
-  }
-}
-
-bool OurReader::readCStyleComment() {
-  while (current_ != end_) {
-    Char c = getNextChar();
-    if (c == '*' && *current_ == '/')
-      break;
-  }
-  return getNextChar() == '/';
-}
-
-bool OurReader::readCppStyleComment() {
-  while (current_ != end_) {
-    Char c = getNextChar();
-    if (c == '\n')
-      break;
-    if (c == '\r') {
-      // Consume DOS EOL. It will be normalized in addComment.
-      if (current_ != end_ && *current_ == '\n')
-        getNextChar();
-      // Break on Moc OS 9 EOL.
-      break;
-    }
-  }
-  return true;
-}
-
-bool OurReader::readNumber(bool checkInf) {
-  const char *p = current_;
-  if (checkInf && p != end_ && *p == 'I') {
-    current_ = ++p;
-    return false;
-  }
-  char c = '0'; // stopgap for already consumed character
-  // integral part
-  while (c >= '0' && c <= '9')
-    c = (current_ = p) < end_ ? *p++ : 0;
-  // fractional part
-  if (c == '.') {
-    c = (current_ = p) < end_ ? *p++ : 0;
-    while (c >= '0' && c <= '9')
-      c = (current_ = p) < end_ ? *p++ : 0;
-  }
-  // exponential part
-  if (c == 'e' || c == 'E') {
-    c = (current_ = p) < end_ ? *p++ : 0;
-    if (c == '+' || c == '-')
-      c = (current_ = p) < end_ ? *p++ : 0;
-    while (c >= '0' && c <= '9')
-      c = (current_ = p) < end_ ? *p++ : 0;
-  }
-  return true;
-}
-bool OurReader::readString() {
-  Char c = 0;
-  while (current_ != end_) {
-    c = getNextChar();
-    if (c == '\\')
-      getNextChar();
-    else if (c == '"')
-      break;
-  }
-  return c == '"';
-}
-
-
-bool OurReader::readStringSingleQuote() {
-  Char c = 0;
-  while (current_ != end_) {
-    c = getNextChar();
-    if (c == '\\')
-      getNextChar();
-    else if (c == '\'')
-      break;
-  }
-  return c == '\'';
-}
-
-bool OurReader::readObject(Token& tokenStart) {
-  Token tokenName;
-  JSONCPP_STRING name;
-  Value init(objectValue);
-  currentValue().swapPayload(init);
-  currentValue().setOffsetStart(tokenStart.start_ - begin_);
-  while (readToken(tokenName)) {
-    bool initialTokenOk = true;
-    while (tokenName.type_ == tokenComment && initialTokenOk)
-      initialTokenOk = readToken(tokenName);
-    if (!initialTokenOk)
-      break;
-    if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
-      return true;
-    name = "";
-    if (tokenName.type_ == tokenString) {
-      if (!decodeString(tokenName, name))
-        return recoverFromError(tokenObjectEnd);
-    } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) {
-      Value numberName;
-      if (!decodeNumber(tokenName, numberName))
-        return recoverFromError(tokenObjectEnd);
-      name = numberName.asString();
-    } else {
-      break;
-    }
-
-    Token colon;
-    if (!readToken(colon) || colon.type_ != tokenMemberSeparator) {
-      return addErrorAndRecover(
-          "Missing ':' after object member name", colon, tokenObjectEnd);
-    }
-    if (name.length() >= (1U<<30)) throwRuntimeError("keylength >= 2^30");
-    if (features_.rejectDupKeys_ && currentValue().isMember(name)) {
-      JSONCPP_STRING msg = "Duplicate key: '" + name + "'";
-      return addErrorAndRecover(
-          msg, tokenName, tokenObjectEnd);
-    }
-    Value& value = currentValue()[name];
-    nodes_.push(&value);
-    bool ok = readValue();
-    nodes_.pop();
-    if (!ok) // error already set
-      return recoverFromError(tokenObjectEnd);
-
-    Token comma;
-    if (!readToken(comma) ||
-        (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator &&
-         comma.type_ != tokenComment)) {
-      return addErrorAndRecover(
-          "Missing ',' or '}' in object declaration", comma, tokenObjectEnd);
-    }
-    bool finalizeTokenOk = true;
-    while (comma.type_ == tokenComment && finalizeTokenOk)
-      finalizeTokenOk = readToken(comma);
-    if (comma.type_ == tokenObjectEnd)
-      return true;
-  }
-  return addErrorAndRecover(
-      "Missing '}' or object member name", tokenName, tokenObjectEnd);
-}
-
-bool OurReader::readArray(Token& tokenStart) {
-  Value init(arrayValue);
-  currentValue().swapPayload(init);
-  currentValue().setOffsetStart(tokenStart.start_ - begin_);
-  skipSpaces();
-  if (*current_ == ']') // empty array
-  {
-    Token endArray;
-    readToken(endArray);
-    return true;
-  }
-  int index = 0;
-  for (;;) {
-    Value& value = currentValue()[index++];
-    nodes_.push(&value);
-    bool ok = readValue();
-    nodes_.pop();
-    if (!ok) // error already set
-      return recoverFromError(tokenArrayEnd);
-
-    Token token;
-    // Accept Comment after last item in the array.
-    ok = readToken(token);
-    while (token.type_ == tokenComment && ok) {
-      ok = readToken(token);
-    }
-    bool badTokenType =
-        (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd);
-    if (!ok || badTokenType) {
-      return addErrorAndRecover(
-          "Missing ',' or ']' in array declaration", token, tokenArrayEnd);
-    }
-    if (token.type_ == tokenArrayEnd)
-      break;
-  }
-  return true;
-}
-
-bool OurReader::decodeNumber(Token& token) {
-  Value decoded;
-  if (!decodeNumber(token, decoded))
-    return false;
-  currentValue().swapPayload(decoded);
-  currentValue().setOffsetStart(token.start_ - begin_);
-  currentValue().setOffsetLimit(token.end_ - begin_);
-  return true;
-}
-
-bool OurReader::decodeNumber(Token& token, Value& decoded) {
-  // Attempts to parse the number as an integer. If the number is
-  // larger than the maximum supported value of an integer then
-  // we decode the number as a double.
-  Location current = token.start_;
-  bool isNegative = *current == '-';
-  if (isNegative)
-    ++current;
-  // TODO: Help the compiler do the div and mod at compile time or get rid of them.
-  Value::LargestUInt maxIntegerValue =
-      isNegative ? Value::LargestUInt(-Value::minLargestInt)
-                 : Value::maxLargestUInt;
-  Value::LargestUInt threshold = maxIntegerValue / 10;
-  Value::LargestUInt value = 0;
-  while (current < token.end_) {
-    Char c = *current++;
-    if (c < '0' || c > '9')
-      return decodeDouble(token, decoded);
-    Value::UInt digit(static_cast<Value::UInt>(c - '0'));
-    if (value >= threshold) {
-      // We've hit or exceeded the max value divided by 10 (rounded down). If
-      // a) we've only just touched the limit, b) this is the last digit, and
-      // c) it's small enough to fit in that rounding delta, we're okay.
-      // Otherwise treat this number as a double to avoid overflow.
-      if (value > threshold || current != token.end_ ||
-          digit > maxIntegerValue % 10) {
-        return decodeDouble(token, decoded);
-      }
-    }
-    value = value * 10 + digit;
-  }
-  if (isNegative)
-    decoded = -Value::LargestInt(value);
-  else if (value <= Value::LargestUInt(Value::maxInt))
-    decoded = Value::LargestInt(value);
-  else
-    decoded = value;
-  return true;
-}
-
-bool OurReader::decodeDouble(Token& token) {
-  Value decoded;
-  if (!decodeDouble(token, decoded))
-    return false;
-  currentValue().swapPayload(decoded);
-  currentValue().setOffsetStart(token.start_ - begin_);
-  currentValue().setOffsetLimit(token.end_ - begin_);
-  return true;
-}
-
-bool OurReader::decodeDouble(Token& token, Value& decoded) {
-  double value = 0;
-  const int bufferSize = 32;
-  int count;
-  ptrdiff_t const length = token.end_ - token.start_;
-
-  // Sanity check to avoid buffer overflow exploits.
-  if (length < 0) {
-    return addError("Unable to parse token length", token);
-  }
-  size_t const ulength = static_cast<size_t>(length);
-
-  // Avoid using a string constant for the format control string given to
-  // sscanf, as this can cause hard to debug crashes on OS X. See here for more
-  // info:
-  //
-  //     http://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Incompatibilities.html
-  char format[] = "%lf";
-
-  if (length <= bufferSize) {
-    Char buffer[bufferSize + 1];
-    memcpy(buffer, token.start_, ulength);
-    buffer[length] = 0;
-    count = sscanf(buffer, format, &value);
-  } else {
-    JSONCPP_STRING buffer(token.start_, token.end_);
-    count = sscanf(buffer.c_str(), format, &value);
-  }
-
-  if (count != 1)
-    return addError("'" + JSONCPP_STRING(token.start_, token.end_) +
-                        "' is not a number.",
-                    token);
-  decoded = value;
-  return true;
-}
-
-bool OurReader::decodeString(Token& token) {
-  JSONCPP_STRING decoded_string;
-  if (!decodeString(token, decoded_string))
-    return false;
-  Value decoded(decoded_string);
-  currentValue().swapPayload(decoded);
-  currentValue().setOffsetStart(token.start_ - begin_);
-  currentValue().setOffsetLimit(token.end_ - begin_);
-  return true;
-}
-
-bool OurReader::decodeString(Token& token, JSONCPP_STRING& decoded) {
-  decoded.reserve(static_cast<size_t>(token.end_ - token.start_ - 2));
-  Location current = token.start_ + 1; // skip '"'
-  Location end = token.end_ - 1;       // do not include '"'
-  while (current != end) {
-    Char c = *current++;
-    if (c == '"')
-      break;
-    else if (c == '\\') {
-      if (current == end)
-        return addError("Empty escape sequence in string", token, current);
-      Char escape = *current++;
-      switch (escape) {
-      case '"':
-        decoded += '"';
-        break;
-      case '/':
-        decoded += '/';
-        break;
-      case '\\':
-        decoded += '\\';
-        break;
-      case 'b':
-        decoded += '\b';
-        break;
-      case 'f':
-        decoded += '\f';
-        break;
-      case 'n':
-        decoded += '\n';
-        break;
-      case 'r':
-        decoded += '\r';
-        break;
-      case 't':
-        decoded += '\t';
-        break;
-      case 'u': {
-        unsigned int unicode;
-        if (!decodeUnicodeCodePoint(token, current, end, unicode))
-          return false;
-        decoded += codePointToUTF8(unicode);
-      } break;
-      default:
-        return addError("Bad escape sequence in string", token, current);
-      }
-    } else {
-      decoded += c;
-    }
-  }
-  return true;
-}
-
-bool OurReader::decodeUnicodeCodePoint(Token& token,
-                                    Location& current,
-                                    Location end,
-                                    unsigned int& unicode) {
-
-  if (!decodeUnicodeEscapeSequence(token, current, end, unicode))
-    return false;
-  if (unicode >= 0xD800 && unicode <= 0xDBFF) {
-    // surrogate pairs
-    if (end - current < 6)
-      return addError(
-          "additional six characters expected to parse unicode surrogate pair.",
-          token,
-          current);
-    unsigned int surrogatePair;
-    if (*(current++) == '\\' && *(current++) == 'u') {
-      if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) {
-        unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF);
-      } else
-        return false;
-    } else
-      return addError("expecting another \\u token to begin the second half of "
-                      "a unicode surrogate pair",
-                      token,
-                      current);
-  }
-  return true;
-}
-
-bool OurReader::decodeUnicodeEscapeSequence(Token& token,
-                                         Location& current,
-                                         Location end,
-                                         unsigned int& ret_unicode) {
-  if (end - current < 4)
-    return addError(
-        "Bad unicode escape sequence in string: four digits expected.",
-        token,
-        current);
-  int unicode = 0;
-  for (int index = 0; index < 4; ++index) {
-    Char c = *current++;
-    unicode *= 16;
-    if (c >= '0' && c <= '9')
-      unicode += c - '0';
-    else if (c >= 'a' && c <= 'f')
-      unicode += c - 'a' + 10;
-    else if (c >= 'A' && c <= 'F')
-      unicode += c - 'A' + 10;
-    else
-      return addError(
-          "Bad unicode escape sequence in string: hexadecimal digit expected.",
-          token,
-          current);
-  }
-  ret_unicode = static_cast<unsigned int>(unicode);
-  return true;
-}
-
-bool
-OurReader::addError(const JSONCPP_STRING& message, Token& token, Location extra) {
-  ErrorInfo info;
-  info.token_ = token;
-  info.message_ = message;
-  info.extra_ = extra;
-  errors_.push_back(info);
-  return false;
-}
-
-bool OurReader::recoverFromError(TokenType skipUntilToken) {
-  size_t errorCount = errors_.size();
-  Token skip;
-  for (;;) {
-    if (!readToken(skip))
-      errors_.resize(errorCount); // discard errors caused by recovery
-    if (skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream)
-      break;
-  }
-  errors_.resize(errorCount);
-  return false;
-}
-
-bool OurReader::addErrorAndRecover(const JSONCPP_STRING& message,
-                                Token& token,
-                                TokenType skipUntilToken) {
-  addError(message, token);
-  return recoverFromError(skipUntilToken);
-}
-
-Value& OurReader::currentValue() { return *(nodes_.top()); }
-
-OurReader::Char OurReader::getNextChar() {
-  if (current_ == end_)
-    return 0;
-  return *current_++;
-}
-
-void OurReader::getLocationLineAndColumn(Location location,
-                                      int& line,
-                                      int& column) const {
-  Location current = begin_;
-  Location lastLineStart = current;
-  line = 0;
-  while (current < location && current != end_) {
-    Char c = *current++;
-    if (c == '\r') {
-      if (*current == '\n')
-        ++current;
-      lastLineStart = current;
-      ++line;
-    } else if (c == '\n') {
-      lastLineStart = current;
-      ++line;
-    }
-  }
-  // column & line start at 1
-  column = int(location - lastLineStart) + 1;
-  ++line;
-}
-
-JSONCPP_STRING OurReader::getLocationLineAndColumn(Location location) const {
-  int line, column;
-  getLocationLineAndColumn(location, line, column);
-  char buffer[18 + 16 + 16 + 1];
-  snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
-  return buffer;
-}
-
-JSONCPP_STRING OurReader::getFormattedErrorMessages() const {
-  JSONCPP_STRING formattedMessage;
-  for (Errors::const_iterator itError = errors_.begin();
-       itError != errors_.end();
-       ++itError) {
-    const ErrorInfo& error = *itError;
-    formattedMessage +=
-        "* " + getLocationLineAndColumn(error.token_.start_) + "\n";
-    formattedMessage += "  " + error.message_ + "\n";
-    if (error.extra_)
-      formattedMessage +=
-          "See " + getLocationLineAndColumn(error.extra_) + " for detail.\n";
-  }
-  return formattedMessage;
-}
-
-std::vector<OurReader::StructuredError> OurReader::getStructuredErrors() const {
-  std::vector<OurReader::StructuredError> allErrors;
-  for (Errors::const_iterator itError = errors_.begin();
-       itError != errors_.end();
-       ++itError) {
-    const ErrorInfo& error = *itError;
-    OurReader::StructuredError structured;
-    structured.offset_start = error.token_.start_ - begin_;
-    structured.offset_limit = error.token_.end_ - begin_;
-    structured.message = error.message_;
-    allErrors.push_back(structured);
-  }
-  return allErrors;
-}
-
-bool OurReader::pushError(const Value& value, const JSONCPP_STRING& message) {
-  ptrdiff_t length = end_ - begin_;
-  if(value.getOffsetStart() > length
-    || value.getOffsetLimit() > length)
-    return false;
-  Token token;
-  token.type_ = tokenError;
-  token.start_ = begin_ + value.getOffsetStart();
-  token.end_ = end_ + value.getOffsetLimit();
-  ErrorInfo info;
-  info.token_ = token;
-  info.message_ = message;
-  info.extra_ = 0;
-  errors_.push_back(info);
-  return true;
-}
-
-bool OurReader::pushError(const Value& value, const JSONCPP_STRING& message, const Value& extra) {
-  ptrdiff_t length = end_ - begin_;
-  if(value.getOffsetStart() > length
-    || value.getOffsetLimit() > length
-    || extra.getOffsetLimit() > length)
-    return false;
-  Token token;
-  token.type_ = tokenError;
-  token.start_ = begin_ + value.getOffsetStart();
-  token.end_ = begin_ + value.getOffsetLimit();
-  ErrorInfo info;
-  info.token_ = token;
-  info.message_ = message;
-  info.extra_ = begin_ + extra.getOffsetStart();
-  errors_.push_back(info);
-  return true;
-}
-
-bool OurReader::good() const {
-  return !errors_.size();
-}
-
-
-class OurCharReader : public CharReader {
-  bool const collectComments_;
-  OurReader reader_;
-public:
-  OurCharReader(
-    bool collectComments,
-    OurFeatures const& features)
-  : collectComments_(collectComments)
-  , reader_(features)
-  {}
-  bool parse(
-      char const* beginDoc, char const* endDoc,
-      Value* root, JSONCPP_STRING* errs) JSONCPP_OVERRIDE {
-    bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_);
-    if (errs) {
-      *errs = reader_.getFormattedErrorMessages();
-    }
-    return ok;
-  }
-};
-
-CharReaderBuilder::CharReaderBuilder()
-{
-  setDefaults(&settings_);
-}
-CharReaderBuilder::~CharReaderBuilder()
-{}
-CharReader* CharReaderBuilder::newCharReader() const
-{
-  bool collectComments = settings_["collectComments"].asBool();
-  OurFeatures features = OurFeatures::all();
-  features.allowComments_ = settings_["allowComments"].asBool();
-  features.strictRoot_ = settings_["strictRoot"].asBool();
-  features.allowDroppedNullPlaceholders_ = settings_["allowDroppedNullPlaceholders"].asBool();
-  features.allowNumericKeys_ = settings_["allowNumericKeys"].asBool();
-  features.allowSingleQuotes_ = settings_["allowSingleQuotes"].asBool();
-  features.stackLimit_ = settings_["stackLimit"].asInt();
-  features.failIfExtra_ = settings_["failIfExtra"].asBool();
-  features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool();
-  features.allowSpecialFloats_ = settings_["allowSpecialFloats"].asBool();
-  return new OurCharReader(collectComments, features);
-}
-static void getValidReaderKeys(std::set<JSONCPP_STRING>* valid_keys)
-{
-  valid_keys->clear();
-  valid_keys->insert("collectComments");
-  valid_keys->insert("allowComments");
-  valid_keys->insert("strictRoot");
-  valid_keys->insert("allowDroppedNullPlaceholders");
-  valid_keys->insert("allowNumericKeys");
-  valid_keys->insert("allowSingleQuotes");
-  valid_keys->insert("stackLimit");
-  valid_keys->insert("failIfExtra");
-  valid_keys->insert("rejectDupKeys");
-  valid_keys->insert("allowSpecialFloats");
-}
-bool CharReaderBuilder::validate(Json::Value* invalid) const
-{
-  Json::Value my_invalid;
-  if (!invalid) invalid = &my_invalid;  // so we do not need to test for NULL
-  Json::Value& inv = *invalid;
-  std::set<JSONCPP_STRING> valid_keys;
-  getValidReaderKeys(&valid_keys);
-  Value::Members keys = settings_.getMemberNames();
-  size_t n = keys.size();
-  for (size_t i = 0; i < n; ++i) {
-    JSONCPP_STRING const& key = keys[i];
-    if (valid_keys.find(key) == valid_keys.end()) {
-      inv[key] = settings_[key];
-    }
-  }
-  return 0u == inv.size();
-}
-Value& CharReaderBuilder::operator[](JSONCPP_STRING key)
-{
-  return settings_[key];
-}
-// static
-void CharReaderBuilder::strictMode(Json::Value* settings)
-{
-//! [CharReaderBuilderStrictMode]
-  (*settings)["allowComments"] = false;
-  (*settings)["strictRoot"] = true;
-  (*settings)["allowDroppedNullPlaceholders"] = false;
-  (*settings)["allowNumericKeys"] = false;
-  (*settings)["allowSingleQuotes"] = false;
-  (*settings)["stackLimit"] = 1000;
-  (*settings)["failIfExtra"] = true;
-  (*settings)["rejectDupKeys"] = true;
-  (*settings)["allowSpecialFloats"] = false;
-//! [CharReaderBuilderStrictMode]
-}
-// static
-void CharReaderBuilder::setDefaults(Json::Value* settings)
-{
-//! [CharReaderBuilderDefaults]
-  (*settings)["collectComments"] = true;
-  (*settings)["allowComments"] = true;
-  (*settings)["strictRoot"] = false;
-  (*settings)["allowDroppedNullPlaceholders"] = false;
-  (*settings)["allowNumericKeys"] = false;
-  (*settings)["allowSingleQuotes"] = false;
-  (*settings)["stackLimit"] = 1000;
-  (*settings)["failIfExtra"] = false;
-  (*settings)["rejectDupKeys"] = false;
-  (*settings)["allowSpecialFloats"] = false;
-//! [CharReaderBuilderDefaults]
-}
-
-//////////////////////////////////
-// global functions
-
-bool parseFromStream(
-    CharReader::Factory const& fact, JSONCPP_ISTREAM& sin,
-    Value* root, JSONCPP_STRING* errs)
-{
-  JSONCPP_OSTRINGSTREAM ssin;
-  ssin << sin.rdbuf();
-  JSONCPP_STRING doc = ssin.str();
-  char const* begin = doc.data();
-  char const* end = begin + doc.size();
-  // Note that we do not actually need a null-terminator.
-  CharReaderPtr const reader(fact.newCharReader());
-  return reader->parse(begin, end, root, errs);
-}
-
-JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM& sin, Value& root) {
-  CharReaderBuilder b;
-  JSONCPP_STRING errs;
-  bool ok = parseFromStream(b, sin, &root, &errs);
-  if (!ok) {
-    fprintf(stderr,
-            "Error from reader: %s",
-            errs.c_str());
-
-    throwRuntimeError(errs);
-  }
-  return sin;
-}
-
-} // namespace Json
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: src/lib_json/json_reader.cpp
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: src/lib_json/json_valueiterator.inl
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-// included by json_value.cpp
-
-namespace Json {
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class ValueIteratorBase
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-ValueIteratorBase::ValueIteratorBase()
-    : current_(), isNull_(true) {
-}
-
-ValueIteratorBase::ValueIteratorBase(
-    const Value::ObjectValues::iterator& current)
-    : current_(current), isNull_(false) {}
-
-Value& ValueIteratorBase::deref() const {
-  return current_->second;
-}
-
-void ValueIteratorBase::increment() {
-  ++current_;
-}
-
-void ValueIteratorBase::decrement() {
-  --current_;
-}
-
-ValueIteratorBase::difference_type
-ValueIteratorBase::computeDistance(const SelfType& other) const {
-#ifdef JSON_USE_CPPTL_SMALLMAP
-  return other.current_ - current_;
-#else
-  // Iterator for null value are initialized using the default
-  // constructor, which initialize current_ to the default
-  // std::map::iterator. As begin() and end() are two instance
-  // of the default std::map::iterator, they can not be compared.
-  // To allow this, we handle this comparison specifically.
-  if (isNull_ && other.isNull_) {
-    return 0;
-  }
-
-  // Usage of std::distance is not portable (does not compile with Sun Studio 12
-  // RogueWave STL,
-  // which is the one used by default).
-  // Using a portable hand-made version for non random iterator instead:
-  //   return difference_type( std::distance( current_, other.current_ ) );
-  difference_type myDistance = 0;
-  for (Value::ObjectValues::iterator it = current_; it != other.current_;
-       ++it) {
-    ++myDistance;
-  }
-  return myDistance;
-#endif
-}
-
-bool ValueIteratorBase::isEqual(const SelfType& other) const {
-  if (isNull_) {
-    return other.isNull_;
-  }
-  return current_ == other.current_;
-}
-
-void ValueIteratorBase::copy(const SelfType& other) {
-  current_ = other.current_;
-  isNull_ = other.isNull_;
-}
-
-Value ValueIteratorBase::key() const {
-  const Value::CZString czstring = (*current_).first;
-  if (czstring.data()) {
-    if (czstring.isStaticString())
-      return Value(StaticString(czstring.data()));
-    return Value(czstring.data(), czstring.data() + czstring.length());
-  }
-  return Value(czstring.index());
-}
-
-UInt ValueIteratorBase::index() const {
-  const Value::CZString czstring = (*current_).first;
-  if (!czstring.data())
-    return czstring.index();
-  return Value::UInt(-1);
-}
-
-JSONCPP_STRING ValueIteratorBase::name() const {
-  char const* keey;
-  char const* end;
-  keey = memberName(&end);
-  if (!keey) return JSONCPP_STRING();
-  return JSONCPP_STRING(keey, end);
-}
-
-char const* ValueIteratorBase::memberName() const {
-  const char* cname = (*current_).first.data();
-  return cname ? cname : "";
-}
-
-char const* ValueIteratorBase::memberName(char const** end) const {
-  const char* cname = (*current_).first.data();
-  if (!cname) {
-    *end = NULL;
-    return NULL;
-  }
-  *end = cname + (*current_).first.length();
-  return cname;
-}
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class ValueConstIterator
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-ValueConstIterator::ValueConstIterator() {}
-
-ValueConstIterator::ValueConstIterator(
-    const Value::ObjectValues::iterator& current)
-    : ValueIteratorBase(current) {}
-
-ValueConstIterator::ValueConstIterator(ValueIterator const& other)
-    : ValueIteratorBase(other) {}
-
-ValueConstIterator& ValueConstIterator::
-operator=(const ValueIteratorBase& other) {
-  copy(other);
-  return *this;
-}
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class ValueIterator
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-ValueIterator::ValueIterator() {}
-
-ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current)
-    : ValueIteratorBase(current) {}
-
-ValueIterator::ValueIterator(const ValueConstIterator& other)
-    : ValueIteratorBase(other) {
-  throwRuntimeError("ConstIterator to Iterator should never be allowed.");
-}
-
-ValueIterator::ValueIterator(const ValueIterator& other)
-    : ValueIteratorBase(other) {}
-
-ValueIterator& ValueIterator::operator=(const SelfType& other) {
-  copy(other);
-  return *this;
-}
-
-} // namespace Json
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: src/lib_json/json_valueiterator.inl
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: src/lib_json/json_value.cpp
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2011 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#if !defined(JSON_IS_AMALGAMATION)
-#include <json/assertions.h>
-#include <json/value.h>
-#include <json/writer.h>
-#endif // if !defined(JSON_IS_AMALGAMATION)
-#include <math.h>
-#include <sstream>
-#include <utility>
-#include <cstring>
-#include <cassert>
-#ifdef JSON_USE_CPPTL
-#include <cpptl/conststring.h>
-#endif
-#include <cstddef> // size_t
-#include <algorithm> // min()
-
-#define JSON_ASSERT_UNREACHABLE assert(false)
-
-namespace Json {
-
-// This is a walkaround to avoid the static initialization of Value::null.
-// kNull must be word-aligned to avoid crashing on ARM.  We use an alignment of
-// 8 (instead of 4) as a bit of future-proofing.
-#if defined(__ARMEL__)
-#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
-#else
-#define ALIGNAS(byte_alignment)
-#endif
-static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = { 0 };
-const unsigned char& kNullRef = kNull[0];
-const Value& Value::null = reinterpret_cast<const Value&>(kNullRef);
-const Value& Value::nullRef = null;
-
-const Int Value::minInt = Int(~(UInt(-1) / 2));
-const Int Value::maxInt = Int(UInt(-1) / 2);
-const UInt Value::maxUInt = UInt(-1);
-#if defined(JSON_HAS_INT64)
-const Int64 Value::minInt64 = Int64(~(UInt64(-1) / 2));
-const Int64 Value::maxInt64 = Int64(UInt64(-1) / 2);
-const UInt64 Value::maxUInt64 = UInt64(-1);
-// The constant is hard-coded because some compiler have trouble
-// converting Value::maxUInt64 to a double correctly (AIX/xlC).
-// Assumes that UInt64 is a 64 bits integer.
-static const double maxUInt64AsDouble = 18446744073709551615.0;
-#endif // defined(JSON_HAS_INT64)
-const LargestInt Value::minLargestInt = LargestInt(~(LargestUInt(-1) / 2));
-const LargestInt Value::maxLargestInt = LargestInt(LargestUInt(-1) / 2);
-const LargestUInt Value::maxLargestUInt = LargestUInt(-1);
-
-#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
-template <typename T, typename U>
-static inline bool InRange(double d, T min, U max) {
-  // The casts can lose precision, but we are looking only for
-  // an approximate range. Might fail on edge cases though. ~cdunn
-  //return d >= static_cast<double>(min) && d <= static_cast<double>(max);
-  return d >= min && d <= max;
-}
-#else  // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
-static inline double integerToDouble(Json::UInt64 value) {
-  return static_cast<double>(Int64(value / 2)) * 2.0 + static_cast<double>(Int64(value & 1));
-}
-
-template <typename T> static inline double integerToDouble(T value) {
-  return static_cast<double>(value);
-}
-
-template <typename T, typename U>
-static inline bool InRange(double d, T min, U max) {
-  return d >= integerToDouble(min) && d <= integerToDouble(max);
-}
-#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
-
-/** Duplicates the specified string value.
- * @param value Pointer to the string to duplicate. Must be zero-terminated if
- *              length is "unknown".
- * @param length Length of the value. if equals to unknown, then it will be
- *               computed using strlen(value).
- * @return Pointer on the duplicate instance of string.
- */
-static inline char* duplicateStringValue(const char* value,
-                                         size_t length)
-{
-  // Avoid an integer overflow in the call to malloc below by limiting length
-  // to a sane value.
-  if (length >= static_cast<size_t>(Value::maxInt))
-    length = Value::maxInt - 1;
-
-  char* newString = static_cast<char*>(malloc(length + 1));
-  if (newString == NULL) {
-    throwRuntimeError(
-        "in Json::Value::duplicateStringValue(): "
-        "Failed to allocate string value buffer");
-  }
-  memcpy(newString, value, length);
-  newString[length] = 0;
-  return newString;
-}
-
-/* Record the length as a prefix.
- */
-static inline char* duplicateAndPrefixStringValue(
-    const char* value,
-    unsigned int length)
-{
-  // Avoid an integer overflow in the call to malloc below by limiting length
-  // to a sane value.
-  JSON_ASSERT_MESSAGE(length <= static_cast<unsigned>(Value::maxInt) - sizeof(unsigned) - 1U,
-                      "in Json::Value::duplicateAndPrefixStringValue(): "
-                      "length too big for prefixing");
-  unsigned actualLength = length + static_cast<unsigned>(sizeof(unsigned)) + 1U;
-  char* newString = static_cast<char*>(malloc(actualLength));
-  if (newString == 0) {
-    throwRuntimeError(
-        "in Json::Value::duplicateAndPrefixStringValue(): "
-        "Failed to allocate string value buffer");
-  }
-  *reinterpret_cast<unsigned*>(newString) = length;
-  memcpy(newString + sizeof(unsigned), value, length);
-  newString[actualLength - 1U] = 0; // to avoid buffer over-run accidents by users later
-  return newString;
-}
-inline static void decodePrefixedString(
-    bool isPrefixed, char const* prefixed,
-    unsigned* length, char const** value)
-{
-  if (!isPrefixed) {
-    *length = static_cast<unsigned>(strlen(prefixed));
-    *value = prefixed;
-  } else {
-    *length = *reinterpret_cast<unsigned const*>(prefixed);
-    *value = prefixed + sizeof(unsigned);
-  }
-}
-/** Free the string duplicated by duplicateStringValue()/duplicateAndPrefixStringValue().
- */
-#if JSONCPP_USING_SECURE_MEMORY
-static inline void releasePrefixedStringValue(char* value) {
-  unsigned length = 0;
-  char const* valueDecoded;
-  decodePrefixedString(true, value, &length, &valueDecoded);
-  size_t const size = sizeof(unsigned) + length + 1U;
-  memset(value, 0, size);
-  free(value);
-}
-static inline void releaseStringValue(char* value, unsigned length) {
-  // length==0 => we allocated the strings memory
-  size_t size = (length==0) ? strlen(value) : length;
-  memset(value, 0, size);
-  free(value);
-}
-#else // !JSONCPP_USING_SECURE_MEMORY
-static inline void releasePrefixedStringValue(char* value) {
-  free(value);
-}
-static inline void releaseStringValue(char* value, unsigned) {
-  free(value);
-}
-#endif // JSONCPP_USING_SECURE_MEMORY
-
-} // namespace Json
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// ValueInternals...
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-#if !defined(JSON_IS_AMALGAMATION)
-
-#include "json_valueiterator.inl"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-
-namespace Json {
-
-Exception::Exception(JSONCPP_STRING const& msg)
-  : msg_(msg)
-{}
-Exception::~Exception() throw()
-{}
-char const* Exception::what() const throw()
-{
-  return msg_.c_str();
-}
-RuntimeError::RuntimeError(JSONCPP_STRING const& msg)
-  : Exception(msg)
-{}
-LogicError::LogicError(JSONCPP_STRING const& msg)
-  : Exception(msg)
-{}
-JSONCPP_NORETURN void throwRuntimeError(JSONCPP_STRING const& msg)
-{
-  throw RuntimeError(msg);
-}
-JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const& msg)
-{
-  throw LogicError(msg);
-}
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class Value::CommentInfo
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-Value::CommentInfo::CommentInfo() : comment_(0)
-{}
-
-Value::CommentInfo::~CommentInfo() {
-  if (comment_)
-    releaseStringValue(comment_, 0u);
-}
-
-void Value::CommentInfo::setComment(const char* text, size_t len) {
-  if (comment_) {
-    releaseStringValue(comment_, 0u);
-    comment_ = 0;
-  }
-  JSON_ASSERT(text != 0);
-  JSON_ASSERT_MESSAGE(
-      text[0] == '\0' || text[0] == '/',
-      "in Json::Value::setComment(): Comments must start with /");
-  // It seems that /**/ style comments are acceptable as well.
-  comment_ = duplicateStringValue(text, len);
-}
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class Value::CZString
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-// Notes: policy_ indicates if the string was allocated when
-// a string is stored.
-
-Value::CZString::CZString(ArrayIndex aindex) : cstr_(0), index_(aindex) {}
-
-Value::CZString::CZString(char const* str, unsigned ulength, DuplicationPolicy allocate)
-    : cstr_(str) {
-  // allocate != duplicate
-  storage_.policy_ = allocate & 0x3;
-  storage_.length_ = ulength & 0x3FFFFFFF;
-}
-
-Value::CZString::CZString(const CZString& other) {
-  cstr_ = (other.storage_.policy_ != noDuplication && other.cstr_ != 0
-				 ? duplicateStringValue(other.cstr_, other.storage_.length_)
-				 : other.cstr_);
-  storage_.policy_ = static_cast<unsigned>(other.cstr_
-                 ? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
-                     ? noDuplication : duplicate)
-                 : static_cast<DuplicationPolicy>(other.storage_.policy_)) & 3U;
-  storage_.length_ = other.storage_.length_;
-}
-
-#if JSON_HAS_RVALUE_REFERENCES
-Value::CZString::CZString(CZString&& other)
-  : cstr_(other.cstr_), index_(other.index_) {
-  other.cstr_ = nullptr;
-}
-#endif
-
-Value::CZString::~CZString() {
-  if (cstr_ && storage_.policy_ == duplicate) {
-	  releaseStringValue(const_cast<char*>(cstr_), storage_.length_ + 1u); //+1 for null terminating character for sake of completeness but not actually necessary
-  }
-}
-
-void Value::CZString::swap(CZString& other) {
-  std::swap(cstr_, other.cstr_);
-  std::swap(index_, other.index_);
-}
-
-Value::CZString& Value::CZString::operator=(CZString other) {
-  swap(other);
-  return *this;
-}
-
-bool Value::CZString::operator<(const CZString& other) const {
-  if (!cstr_) return index_ < other.index_;
-  //return strcmp(cstr_, other.cstr_) < 0;
-  // Assume both are strings.
-  unsigned this_len = this->storage_.length_;
-  unsigned other_len = other.storage_.length_;
-  unsigned min_len = std::min(this_len, other_len);
-  JSON_ASSERT(this->cstr_ && other.cstr_);
-  int comp = memcmp(this->cstr_, other.cstr_, min_len);
-  if (comp < 0) return true;
-  if (comp > 0) return false;
-  return (this_len < other_len);
-}
-
-bool Value::CZString::operator==(const CZString& other) const {
-  if (!cstr_) return index_ == other.index_;
-  //return strcmp(cstr_, other.cstr_) == 0;
-  // Assume both are strings.
-  unsigned this_len = this->storage_.length_;
-  unsigned other_len = other.storage_.length_;
-  if (this_len != other_len) return false;
-  JSON_ASSERT(this->cstr_ && other.cstr_);
-  int comp = memcmp(this->cstr_, other.cstr_, this_len);
-  return comp == 0;
-}
-
-ArrayIndex Value::CZString::index() const { return index_; }
-
-//const char* Value::CZString::c_str() const { return cstr_; }
-const char* Value::CZString::data() const { return cstr_; }
-unsigned Value::CZString::length() const { return storage_.length_; }
-bool Value::CZString::isStaticString() const { return storage_.policy_ == noDuplication; }
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class Value::Value
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-/*! \internal Default constructor initialization must be equivalent to:
- * memset( this, 0, sizeof(Value) )
- * This optimization is used in ValueInternalMap fast allocator.
- */
-Value::Value(ValueType vtype) {
-  initBasic(vtype);
-  switch (vtype) {
-  case nullValue:
-    break;
-  case intValue:
-  case uintValue:
-    value_.int_ = 0;
-    break;
-  case realValue:
-    value_.real_ = 0.0;
-    break;
-  case stringValue:
-    value_.string_ = 0;
-    break;
-  case arrayValue:
-  case objectValue:
-    value_.map_ = new ObjectValues();
-    break;
-  case booleanValue:
-    value_.bool_ = false;
-    break;
-  default:
-    JSON_ASSERT_UNREACHABLE;
-  }
-}
-
-Value::Value(Int value) {
-  initBasic(intValue);
-  value_.int_ = value;
-}
-
-Value::Value(UInt value) {
-  initBasic(uintValue);
-  value_.uint_ = value;
-}
-#if defined(JSON_HAS_INT64)
-Value::Value(Int64 value) {
-  initBasic(intValue);
-  value_.int_ = value;
-}
-Value::Value(UInt64 value) {
-  initBasic(uintValue);
-  value_.uint_ = value;
-}
-#endif // defined(JSON_HAS_INT64)
-
-Value::Value(double value) {
-  initBasic(realValue);
-  value_.real_ = value;
-}
-
-Value::Value(const char* value) {
-  initBasic(stringValue, true);
-  value_.string_ = duplicateAndPrefixStringValue(value, static_cast<unsigned>(strlen(value)));
-}
-
-Value::Value(const char* beginValue, const char* endValue) {
-  initBasic(stringValue, true);
-  value_.string_ =
-      duplicateAndPrefixStringValue(beginValue, static_cast<unsigned>(endValue - beginValue));
-}
-
-Value::Value(const JSONCPP_STRING& value) {
-  initBasic(stringValue, true);
-  value_.string_ =
-      duplicateAndPrefixStringValue(value.data(), static_cast<unsigned>(value.length()));
-}
-
-Value::Value(const StaticString& value) {
-  initBasic(stringValue);
-  value_.string_ = const_cast<char*>(value.c_str());
-}
-
-#ifdef JSON_USE_CPPTL
-Value::Value(const CppTL::ConstString& value) {
-  initBasic(stringValue, true);
-  value_.string_ = duplicateAndPrefixStringValue(value, static_cast<unsigned>(value.length()));
-}
-#endif
-
-Value::Value(bool value) {
-  initBasic(booleanValue);
-  value_.bool_ = value;
-}
-
-Value::Value(Value const& other)
-    : type_(other.type_), allocated_(false)
-      ,
-      comments_(0), start_(other.start_), limit_(other.limit_)
-{
-  switch (type_) {
-  case nullValue:
-  case intValue:
-  case uintValue:
-  case realValue:
-  case booleanValue:
-    value_ = other.value_;
-    break;
-  case stringValue:
-    if (other.value_.string_ && other.allocated_) {
-      unsigned len;
-      char const* str;
-      decodePrefixedString(other.allocated_, other.value_.string_,
-          &len, &str);
-      value_.string_ = duplicateAndPrefixStringValue(str, len);
-      allocated_ = true;
-    } else {
-      value_.string_ = other.value_.string_;
-      allocated_ = false;
-    }
-    break;
-  case arrayValue:
-  case objectValue:
-    value_.map_ = new ObjectValues(*other.value_.map_);
-    break;
-  default:
-    JSON_ASSERT_UNREACHABLE;
-  }
-  if (other.comments_) {
-    comments_ = new CommentInfo[numberOfCommentPlacement];
-    for (int comment = 0; comment < numberOfCommentPlacement; ++comment) {
-      const CommentInfo& otherComment = other.comments_[comment];
-      if (otherComment.comment_)
-        comments_[comment].setComment(
-            otherComment.comment_, strlen(otherComment.comment_));
-    }
-  }
-}
-
-#if JSON_HAS_RVALUE_REFERENCES
-// Move constructor
-Value::Value(Value&& other) {
-  initBasic(nullValue);
-  swap(other);
-}
-#endif
-
-Value::~Value() {
-  switch (type_) {
-  case nullValue:
-  case intValue:
-  case uintValue:
-  case realValue:
-  case booleanValue:
-    break;
-  case stringValue:
-    if (allocated_)
-      releasePrefixedStringValue(value_.string_);
-    break;
-  case arrayValue:
-  case objectValue:
-    delete value_.map_;
-    break;
-  default:
-    JSON_ASSERT_UNREACHABLE;
-  }
-
-  if (comments_)
-    delete[] comments_;
-
-  value_.uint_ = 0;
-}
-
-Value& Value::operator=(Value other) {
-  swap(other);
-  return *this;
-}
-
-void Value::swapPayload(Value& other) {
-  ValueType temp = type_;
-  type_ = other.type_;
-  other.type_ = temp;
-  std::swap(value_, other.value_);
-  int temp2 = allocated_;
-  allocated_ = other.allocated_;
-  other.allocated_ = temp2 & 0x1;
-}
-
-void Value::swap(Value& other) {
-  swapPayload(other);
-  std::swap(comments_, other.comments_);
-  std::swap(start_, other.start_);
-  std::swap(limit_, other.limit_);
-}
-
-ValueType Value::type() const { return type_; }
-
-int Value::compare(const Value& other) const {
-  if (*this < other)
-    return -1;
-  if (*this > other)
-    return 1;
-  return 0;
-}
-
-bool Value::operator<(const Value& other) const {
-  int typeDelta = type_ - other.type_;
-  if (typeDelta)
-    return typeDelta < 0 ? true : false;
-  switch (type_) {
-  case nullValue:
-    return false;
-  case intValue:
-    return value_.int_ < other.value_.int_;
-  case uintValue:
-    return value_.uint_ < other.value_.uint_;
-  case realValue:
-    return value_.real_ < other.value_.real_;
-  case booleanValue:
-    return value_.bool_ < other.value_.bool_;
-  case stringValue:
-  {
-    if ((value_.string_ == 0) || (other.value_.string_ == 0)) {
-      if (other.value_.string_) return true;
-      else return false;
-    }
-    unsigned this_len;
-    unsigned other_len;
-    char const* this_str;
-    char const* other_str;
-    decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
-    decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str);
-    unsigned min_len = std::min(this_len, other_len);
-    JSON_ASSERT(this_str && other_str);
-    int comp = memcmp(this_str, other_str, min_len);
-    if (comp < 0) return true;
-    if (comp > 0) return false;
-    return (this_len < other_len);
-  }
-  case arrayValue:
-  case objectValue: {
-    int delta = int(value_.map_->size() - other.value_.map_->size());
-    if (delta)
-      return delta < 0;
-    return (*value_.map_) < (*other.value_.map_);
-  }
-  default:
-    JSON_ASSERT_UNREACHABLE;
-  }
-  return false; // unreachable
-}
-
-bool Value::operator<=(const Value& other) const { return !(other < *this); }
-
-bool Value::operator>=(const Value& other) const { return !(*this < other); }
-
-bool Value::operator>(const Value& other) const { return other < *this; }
-
-bool Value::operator==(const Value& other) const {
-  // if ( type_ != other.type_ )
-  // GCC 2.95.3 says:
-  // attempt to take address of bit-field structure member `Json::Value::type_'
-  // Beats me, but a temp solves the problem.
-  int temp = other.type_;
-  if (type_ != temp)
-    return false;
-  switch (type_) {
-  case nullValue:
-    return true;
-  case intValue:
-    return value_.int_ == other.value_.int_;
-  case uintValue:
-    return value_.uint_ == other.value_.uint_;
-  case realValue:
-    return value_.real_ == other.value_.real_;
-  case booleanValue:
-    return value_.bool_ == other.value_.bool_;
-  case stringValue:
-  {
-    if ((value_.string_ == 0) || (other.value_.string_ == 0)) {
-      return (value_.string_ == other.value_.string_);
-    }
-    unsigned this_len;
-    unsigned other_len;
-    char const* this_str;
-    char const* other_str;
-    decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
-    decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str);
-    if (this_len != other_len) return false;
-    JSON_ASSERT(this_str && other_str);
-    int comp = memcmp(this_str, other_str, this_len);
-    return comp == 0;
-  }
-  case arrayValue:
-  case objectValue:
-    return value_.map_->size() == other.value_.map_->size() &&
-           (*value_.map_) == (*other.value_.map_);
-  default:
-    JSON_ASSERT_UNREACHABLE;
-  }
-  return false; // unreachable
-}
-
-bool Value::operator!=(const Value& other) const { return !(*this == other); }
-
-const char* Value::asCString() const {
-  JSON_ASSERT_MESSAGE(type_ == stringValue,
-                      "in Json::Value::asCString(): requires stringValue");
-  if (value_.string_ == 0) return 0;
-  unsigned this_len;
-  char const* this_str;
-  decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
-  return this_str;
-}
-
-#if JSONCPP_USING_SECURE_MEMORY
-unsigned Value::getCStringLength() const {
-  JSON_ASSERT_MESSAGE(type_ == stringValue,
-	                  "in Json::Value::asCString(): requires stringValue");
-  if (value_.string_ == 0) return 0;
-  unsigned this_len;
-  char const* this_str;
-  decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
-  return this_len;
-}
-#endif
-
-bool Value::getString(char const** str, char const** cend) const {
-  if (type_ != stringValue) return false;
-  if (value_.string_ == 0) return false;
-  unsigned length;
-  decodePrefixedString(this->allocated_, this->value_.string_, &length, str);
-  *cend = *str + length;
-  return true;
-}
-
-JSONCPP_STRING Value::asString() const {
-  switch (type_) {
-  case nullValue:
-    return "";
-  case stringValue:
-  {
-    if (value_.string_ == 0) return "";
-    unsigned this_len;
-    char const* this_str;
-    decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
-    return JSONCPP_STRING(this_str, this_len);
-  }
-  case booleanValue:
-    return value_.bool_ ? "true" : "false";
-  case intValue:
-    return valueToString(value_.int_);
-  case uintValue:
-    return valueToString(value_.uint_);
-  case realValue:
-    return valueToString(value_.real_);
-  default:
-    JSON_FAIL_MESSAGE("Type is not convertible to string");
-  }
-}
-
-#ifdef JSON_USE_CPPTL
-CppTL::ConstString Value::asConstString() const {
-  unsigned len;
-  char const* str;
-  decodePrefixedString(allocated_, value_.string_,
-      &len, &str);
-  return CppTL::ConstString(str, len);
-}
-#endif
-
-Value::Int Value::asInt() const {
-  switch (type_) {
-  case intValue:
-    JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
-    return Int(value_.int_);
-  case uintValue:
-    JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
-    return Int(value_.uint_);
-  case realValue:
-    JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt),
-                        "double out of Int range");
-    return Int(value_.real_);
-  case nullValue:
-    return 0;
-  case booleanValue:
-    return value_.bool_ ? 1 : 0;
-  default:
-    break;
-  }
-  JSON_FAIL_MESSAGE("Value is not convertible to Int.");
-}
-
-Value::UInt Value::asUInt() const {
-  switch (type_) {
-  case intValue:
-    JSON_ASSERT_MESSAGE(isUInt(), "LargestInt out of UInt range");
-    return UInt(value_.int_);
-  case uintValue:
-    JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range");
-    return UInt(value_.uint_);
-  case realValue:
-    JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt),
-                        "double out of UInt range");
-    return UInt(value_.real_);
-  case nullValue:
-    return 0;
-  case booleanValue:
-    return value_.bool_ ? 1 : 0;
-  default:
-    break;
-  }
-  JSON_FAIL_MESSAGE("Value is not convertible to UInt.");
-}
-
-#if defined(JSON_HAS_INT64)
-
-Value::Int64 Value::asInt64() const {
-  switch (type_) {
-  case intValue:
-    return Int64(value_.int_);
-  case uintValue:
-    JSON_ASSERT_MESSAGE(isInt64(), "LargestUInt out of Int64 range");
-    return Int64(value_.uint_);
-  case realValue:
-    JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt64, maxInt64),
-                        "double out of Int64 range");
-    return Int64(value_.real_);
-  case nullValue:
-    return 0;
-  case booleanValue:
-    return value_.bool_ ? 1 : 0;
-  default:
-    break;
-  }
-  JSON_FAIL_MESSAGE("Value is not convertible to Int64.");
-}
-
-Value::UInt64 Value::asUInt64() const {
-  switch (type_) {
-  case intValue:
-    JSON_ASSERT_MESSAGE(isUInt64(), "LargestInt out of UInt64 range");
-    return UInt64(value_.int_);
-  case uintValue:
-    return UInt64(value_.uint_);
-  case realValue:
-    JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64),
-                        "double out of UInt64 range");
-    return UInt64(value_.real_);
-  case nullValue:
-    return 0;
-  case booleanValue:
-    return value_.bool_ ? 1 : 0;
-  default:
-    break;
-  }
-  JSON_FAIL_MESSAGE("Value is not convertible to UInt64.");
-}
-#endif // if defined(JSON_HAS_INT64)
-
-LargestInt Value::asLargestInt() const {
-#if defined(JSON_NO_INT64)
-  return asInt();
-#else
-  return asInt64();
-#endif
-}
-
-LargestUInt Value::asLargestUInt() const {
-#if defined(JSON_NO_INT64)
-  return asUInt();
-#else
-  return asUInt64();
-#endif
-}
-
-double Value::asDouble() const {
-  switch (type_) {
-  case intValue:
-    return static_cast<double>(value_.int_);
-  case uintValue:
-#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
-    return static_cast<double>(value_.uint_);
-#else  // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
-    return integerToDouble(value_.uint_);
-#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
-  case realValue:
-    return value_.real_;
-  case nullValue:
-    return 0.0;
-  case booleanValue:
-    return value_.bool_ ? 1.0 : 0.0;
-  default:
-    break;
-  }
-  JSON_FAIL_MESSAGE("Value is not convertible to double.");
-}
-
-float Value::asFloat() const {
-  switch (type_) {
-  case intValue:
-    return static_cast<float>(value_.int_);
-  case uintValue:
-#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
-    return static_cast<float>(value_.uint_);
-#else  // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
-    // This can fail (silently?) if the value is bigger than MAX_FLOAT.
-    return static_cast<float>(integerToDouble(value_.uint_));
-#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
-  case realValue:
-    return static_cast<float>(value_.real_);
-  case nullValue:
-    return 0.0;
-  case booleanValue:
-    return value_.bool_ ? 1.0f : 0.0f;
-  default:
-    break;
-  }
-  JSON_FAIL_MESSAGE("Value is not convertible to float.");
-}
-
-bool Value::asBool() const {
-  switch (type_) {
-  case booleanValue:
-    return value_.bool_;
-  case nullValue:
-    return false;
-  case intValue:
-    return value_.int_ ? true : false;
-  case uintValue:
-    return value_.uint_ ? true : false;
-  case realValue:
-    // This is kind of strange. Not recommended.
-    return (value_.real_ != 0.0) ? true : false;
-  default:
-    break;
-  }
-  JSON_FAIL_MESSAGE("Value is not convertible to bool.");
-}
-
-bool Value::isConvertibleTo(ValueType other) const {
-  switch (other) {
-  case nullValue:
-    return (isNumeric() && asDouble() == 0.0) ||
-           (type_ == booleanValue && value_.bool_ == false) ||
-           (type_ == stringValue && asString() == "") ||
-           (type_ == arrayValue && value_.map_->size() == 0) ||
-           (type_ == objectValue && value_.map_->size() == 0) ||
-           type_ == nullValue;
-  case intValue:
-    return isInt() ||
-           (type_ == realValue && InRange(value_.real_, minInt, maxInt)) ||
-           type_ == booleanValue || type_ == nullValue;
-  case uintValue:
-    return isUInt() ||
-           (type_ == realValue && InRange(value_.real_, 0, maxUInt)) ||
-           type_ == booleanValue || type_ == nullValue;
-  case realValue:
-    return isNumeric() || type_ == booleanValue || type_ == nullValue;
-  case booleanValue:
-    return isNumeric() || type_ == booleanValue || type_ == nullValue;
-  case stringValue:
-    return isNumeric() || type_ == booleanValue || type_ == stringValue ||
-           type_ == nullValue;
-  case arrayValue:
-    return type_ == arrayValue || type_ == nullValue;
-  case objectValue:
-    return type_ == objectValue || type_ == nullValue;
-  }
-  JSON_ASSERT_UNREACHABLE;
-  return false;
-}
-
-/// Number of values in array or object
-ArrayIndex Value::size() const {
-  switch (type_) {
-  case nullValue:
-  case intValue:
-  case uintValue:
-  case realValue:
-  case booleanValue:
-  case stringValue:
-    return 0;
-  case arrayValue: // size of the array is highest index + 1
-    if (!value_.map_->empty()) {
-      ObjectValues::const_iterator itLast = value_.map_->end();
-      --itLast;
-      return (*itLast).first.index() + 1;
-    }
-    return 0;
-  case objectValue:
-    return ArrayIndex(value_.map_->size());
-  }
-  JSON_ASSERT_UNREACHABLE;
-  return 0; // unreachable;
-}
-
-bool Value::empty() const {
-  if (isNull() || isArray() || isObject())
-    return size() == 0u;
-  else
-    return false;
-}
-
-bool Value::operator!() const { return isNull(); }
-
-void Value::clear() {
-  JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue ||
-                          type_ == objectValue,
-                      "in Json::Value::clear(): requires complex value");
-  start_ = 0;
-  limit_ = 0;
-  switch (type_) {
-  case arrayValue:
-  case objectValue:
-    value_.map_->clear();
-    break;
-  default:
-    break;
-  }
-}
-
-void Value::resize(ArrayIndex newSize) {
-  JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue,
-                      "in Json::Value::resize(): requires arrayValue");
-  if (type_ == nullValue)
-    *this = Value(arrayValue);
-  ArrayIndex oldSize = size();
-  if (newSize == 0)
-    clear();
-  else if (newSize > oldSize)
-    (*this)[newSize - 1];
-  else {
-    for (ArrayIndex index = newSize; index < oldSize; ++index) {
-      value_.map_->erase(index);
-    }
-    JSON_ASSERT(size() == newSize);
-  }
-}
-
-Value& Value::operator[](ArrayIndex index) {
-  JSON_ASSERT_MESSAGE(
-      type_ == nullValue || type_ == arrayValue,
-      "in Json::Value::operator[](ArrayIndex): requires arrayValue");
-  if (type_ == nullValue)
-    *this = Value(arrayValue);
-  CZString key(index);
-  ObjectValues::iterator it = value_.map_->lower_bound(key);
-  if (it != value_.map_->end() && (*it).first == key)
-    return (*it).second;
-
-  ObjectValues::value_type defaultValue(key, nullRef);
-  it = value_.map_->insert(it, defaultValue);
-  return (*it).second;
-}
-
-Value& Value::operator[](int index) {
-  JSON_ASSERT_MESSAGE(
-      index >= 0,
-      "in Json::Value::operator[](int index): index cannot be negative");
-  return (*this)[ArrayIndex(index)];
-}
-
-const Value& Value::operator[](ArrayIndex index) const {
-  JSON_ASSERT_MESSAGE(
-      type_ == nullValue || type_ == arrayValue,
-      "in Json::Value::operator[](ArrayIndex)const: requires arrayValue");
-  if (type_ == nullValue)
-    return nullRef;
-  CZString key(index);
-  ObjectValues::const_iterator it = value_.map_->find(key);
-  if (it == value_.map_->end())
-    return nullRef;
-  return (*it).second;
-}
-
-const Value& Value::operator[](int index) const {
-  JSON_ASSERT_MESSAGE(
-      index >= 0,
-      "in Json::Value::operator[](int index) const: index cannot be negative");
-  return (*this)[ArrayIndex(index)];
-}
-
-void Value::initBasic(ValueType vtype, bool allocated) {
-  type_ = vtype;
-  allocated_ = allocated;
-  comments_ = 0;
-  start_ = 0;
-  limit_ = 0;
-}
-
-// Access an object value by name, create a null member if it does not exist.
-// @pre Type of '*this' is object or null.
-// @param key is null-terminated.
-Value& Value::resolveReference(const char* key) {
-  JSON_ASSERT_MESSAGE(
-      type_ == nullValue || type_ == objectValue,
-      "in Json::Value::resolveReference(): requires objectValue");
-  if (type_ == nullValue)
-    *this = Value(objectValue);
-  CZString actualKey(
-      key, static_cast<unsigned>(strlen(key)), CZString::noDuplication); // NOTE!
-  ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
-  if (it != value_.map_->end() && (*it).first == actualKey)
-    return (*it).second;
-
-  ObjectValues::value_type defaultValue(actualKey, nullRef);
-  it = value_.map_->insert(it, defaultValue);
-  Value& value = (*it).second;
-  return value;
-}
-
-// @param key is not null-terminated.
-Value& Value::resolveReference(char const* key, char const* cend)
-{
-  JSON_ASSERT_MESSAGE(
-      type_ == nullValue || type_ == objectValue,
-      "in Json::Value::resolveReference(key, end): requires objectValue");
-  if (type_ == nullValue)
-    *this = Value(objectValue);
-  CZString actualKey(
-      key, static_cast<unsigned>(cend-key), CZString::duplicateOnCopy);
-  ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
-  if (it != value_.map_->end() && (*it).first == actualKey)
-    return (*it).second;
-
-  ObjectValues::value_type defaultValue(actualKey, nullRef);
-  it = value_.map_->insert(it, defaultValue);
-  Value& value = (*it).second;
-  return value;
-}
-
-Value Value::get(ArrayIndex index, const Value& defaultValue) const {
-  const Value* value = &((*this)[index]);
-  return value == &nullRef ? defaultValue : *value;
-}
-
-bool Value::isValidIndex(ArrayIndex index) const { return index < size(); }
-
-Value const* Value::find(char const* key, char const* cend) const
-{
-  JSON_ASSERT_MESSAGE(
-      type_ == nullValue || type_ == objectValue,
-      "in Json::Value::find(key, end, found): requires objectValue or nullValue");
-  if (type_ == nullValue) return NULL;
-  CZString actualKey(key, static_cast<unsigned>(cend-key), CZString::noDuplication);
-  ObjectValues::const_iterator it = value_.map_->find(actualKey);
-  if (it == value_.map_->end()) return NULL;
-  return &(*it).second;
-}
-const Value& Value::operator[](const char* key) const
-{
-  Value const* found = find(key, key + strlen(key));
-  if (!found) return nullRef;
-  return *found;
-}
-Value const& Value::operator[](JSONCPP_STRING const& key) const
-{
-  Value const* found = find(key.data(), key.data() + key.length());
-  if (!found) return nullRef;
-  return *found;
-}
-
-Value& Value::operator[](const char* key) {
-  return resolveReference(key, key + strlen(key));
-}
-
-Value& Value::operator[](const JSONCPP_STRING& key) {
-  return resolveReference(key.data(), key.data() + key.length());
-}
-
-Value& Value::operator[](const StaticString& key) {
-  return resolveReference(key.c_str());
-}
-
-#ifdef JSON_USE_CPPTL
-Value& Value::operator[](const CppTL::ConstString& key) {
-  return resolveReference(key.c_str(), key.end_c_str());
-}
-Value const& Value::operator[](CppTL::ConstString const& key) const
-{
-  Value const* found = find(key.c_str(), key.end_c_str());
-  if (!found) return nullRef;
-  return *found;
-}
-#endif
-
-Value& Value::append(const Value& value) { return (*this)[size()] = value; }
-
-Value Value::get(char const* key, char const* cend, Value const& defaultValue) const
-{
-  Value const* found = find(key, cend);
-  return !found ? defaultValue : *found;
-}
-Value Value::get(char const* key, Value const& defaultValue) const
-{
-  return get(key, key + strlen(key), defaultValue);
-}
-Value Value::get(JSONCPP_STRING const& key, Value const& defaultValue) const
-{
-  return get(key.data(), key.data() + key.length(), defaultValue);
-}
-
-
-bool Value::removeMember(const char* key, const char* cend, Value* removed)
-{
-  if (type_ != objectValue) {
-    return false;
-  }
-  CZString actualKey(key, static_cast<unsigned>(cend-key), CZString::noDuplication);
-  ObjectValues::iterator it = value_.map_->find(actualKey);
-  if (it == value_.map_->end())
-    return false;
-  *removed = it->second;
-  value_.map_->erase(it);
-  return true;
-}
-bool Value::removeMember(const char* key, Value* removed)
-{
-  return removeMember(key, key + strlen(key), removed);
-}
-bool Value::removeMember(JSONCPP_STRING const& key, Value* removed)
-{
-  return removeMember(key.data(), key.data() + key.length(), removed);
-}
-Value Value::removeMember(const char* key)
-{
-  JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == objectValue,
-                      "in Json::Value::removeMember(): requires objectValue");
-  if (type_ == nullValue)
-    return nullRef;
-
-  Value removed;  // null
-  removeMember(key, key + strlen(key), &removed);
-  return removed; // still null if removeMember() did nothing
-}
-Value Value::removeMember(const JSONCPP_STRING& key)
-{
-  return removeMember(key.c_str());
-}
-
-bool Value::removeIndex(ArrayIndex index, Value* removed) {
-  if (type_ != arrayValue) {
-    return false;
-  }
-  CZString key(index);
-  ObjectValues::iterator it = value_.map_->find(key);
-  if (it == value_.map_->end()) {
-    return false;
-  }
-  *removed = it->second;
-  ArrayIndex oldSize = size();
-  // shift left all items left, into the place of the "removed"
-  for (ArrayIndex i = index; i < (oldSize - 1); ++i){
-    CZString keey(i);
-    (*value_.map_)[keey] = (*this)[i + 1];
-  }
-  // erase the last one ("leftover")
-  CZString keyLast(oldSize - 1);
-  ObjectValues::iterator itLast = value_.map_->find(keyLast);
-  value_.map_->erase(itLast);
-  return true;
-}
-
-#ifdef JSON_USE_CPPTL
-Value Value::get(const CppTL::ConstString& key,
-                 const Value& defaultValue) const {
-  return get(key.c_str(), key.end_c_str(), defaultValue);
-}
-#endif
-
-bool Value::isMember(char const* key, char const* cend) const
-{
-  Value const* value = find(key, cend);
-  return NULL != value;
-}
-bool Value::isMember(char const* key) const
-{
-  return isMember(key, key + strlen(key));
-}
-bool Value::isMember(JSONCPP_STRING const& key) const
-{
-  return isMember(key.data(), key.data() + key.length());
-}
-
-#ifdef JSON_USE_CPPTL
-bool Value::isMember(const CppTL::ConstString& key) const {
-  return isMember(key.c_str(), key.end_c_str());
-}
-#endif
-
-Value::Members Value::getMemberNames() const {
-  JSON_ASSERT_MESSAGE(
-      type_ == nullValue || type_ == objectValue,
-      "in Json::Value::getMemberNames(), value must be objectValue");
-  if (type_ == nullValue)
-    return Value::Members();
-  Members members;
-  members.reserve(value_.map_->size());
-  ObjectValues::const_iterator it = value_.map_->begin();
-  ObjectValues::const_iterator itEnd = value_.map_->end();
-  for (; it != itEnd; ++it) {
-    members.push_back(JSONCPP_STRING((*it).first.data(),
-                                  (*it).first.length()));
-  }
-  return members;
-}
-//
-//# ifdef JSON_USE_CPPTL
-// EnumMemberNames
-// Value::enumMemberNames() const
-//{
-//   if ( type_ == objectValue )
-//   {
-//      return CppTL::Enum::any(  CppTL::Enum::transform(
-//         CppTL::Enum::keys( *(value_.map_), CppTL::Type<const CZString &>() ),
-//         MemberNamesTransform() ) );
-//   }
-//   return EnumMemberNames();
-//}
-//
-//
-// EnumValues
-// Value::enumValues() const
-//{
-//   if ( type_ == objectValue  ||  type_ == arrayValue )
-//      return CppTL::Enum::anyValues( *(value_.map_),
-//                                     CppTL::Type<const Value &>() );
-//   return EnumValues();
-//}
-//
-//# endif
-
-static bool IsIntegral(double d) {
-  double integral_part;
-  return modf(d, &integral_part) == 0.0;
-}
-
-bool Value::isNull() const { return type_ == nullValue; }
-
-bool Value::isBool() const { return type_ == booleanValue; }
-
-bool Value::isInt() const {
-  switch (type_) {
-  case intValue:
-    return value_.int_ >= minInt && value_.int_ <= maxInt;
-  case uintValue:
-    return value_.uint_ <= UInt(maxInt);
-  case realValue:
-    return value_.real_ >= minInt && value_.real_ <= maxInt &&
-           IsIntegral(value_.real_);
-  default:
-    break;
-  }
-  return false;
-}
-
-bool Value::isUInt() const {
-  switch (type_) {
-  case intValue:
-    return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt);
-  case uintValue:
-    return value_.uint_ <= maxUInt;
-  case realValue:
-    return value_.real_ >= 0 && value_.real_ <= maxUInt &&
-           IsIntegral(value_.real_);
-  default:
-    break;
-  }
-  return false;
-}
-
-bool Value::isInt64() const {
-#if defined(JSON_HAS_INT64)
-  switch (type_) {
-  case intValue:
-    return true;
-  case uintValue:
-    return value_.uint_ <= UInt64(maxInt64);
-  case realValue:
-    // Note that maxInt64 (= 2^63 - 1) is not exactly representable as a
-    // double, so double(maxInt64) will be rounded up to 2^63. Therefore we
-    // require the value to be strictly less than the limit.
-    return value_.real_ >= double(minInt64) &&
-           value_.real_ < double(maxInt64) && IsIntegral(value_.real_);
-  default:
-    break;
-  }
-#endif // JSON_HAS_INT64
-  return false;
-}
-
-bool Value::isUInt64() const {
-#if defined(JSON_HAS_INT64)
-  switch (type_) {
-  case intValue:
-    return value_.int_ >= 0;
-  case uintValue:
-    return true;
-  case realValue:
-    // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a
-    // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we
-    // require the value to be strictly less than the limit.
-    return value_.real_ >= 0 && value_.real_ < maxUInt64AsDouble &&
-           IsIntegral(value_.real_);
-  default:
-    break;
-  }
-#endif // JSON_HAS_INT64
-  return false;
-}
-
-bool Value::isIntegral() const {
-#if defined(JSON_HAS_INT64)
-  return isInt64() || isUInt64();
-#else
-  return isInt() || isUInt();
-#endif
-}
-
-bool Value::isDouble() const { return type_ == realValue || isIntegral(); }
-
-bool Value::isNumeric() const { return isIntegral() || isDouble(); }
-
-bool Value::isString() const { return type_ == stringValue; }
-
-bool Value::isArray() const { return type_ == arrayValue; }
-
-bool Value::isObject() const { return type_ == objectValue; }
-
-void Value::setComment(const char* comment, size_t len, CommentPlacement placement) {
-  if (!comments_)
-    comments_ = new CommentInfo[numberOfCommentPlacement];
-  if ((len > 0) && (comment[len-1] == '\n')) {
-    // Always discard trailing newline, to aid indentation.
-    len -= 1;
-  }
-  comments_[placement].setComment(comment, len);
-}
-
-void Value::setComment(const char* comment, CommentPlacement placement) {
-  setComment(comment, strlen(comment), placement);
-}
-
-void Value::setComment(const JSONCPP_STRING& comment, CommentPlacement placement) {
-  setComment(comment.c_str(), comment.length(), placement);
-}
-
-bool Value::hasComment(CommentPlacement placement) const {
-  return comments_ != 0 && comments_[placement].comment_ != 0;
-}
-
-JSONCPP_STRING Value::getComment(CommentPlacement placement) const {
-  if (hasComment(placement))
-    return comments_[placement].comment_;
-  return "";
-}
-
-void Value::setOffsetStart(ptrdiff_t start) { start_ = start; }
-
-void Value::setOffsetLimit(ptrdiff_t limit) { limit_ = limit; }
-
-ptrdiff_t Value::getOffsetStart() const { return start_; }
-
-ptrdiff_t Value::getOffsetLimit() const { return limit_; }
-
-JSONCPP_STRING Value::toStyledString() const {
-  StyledWriter writer;
-  return writer.write(*this);
-}
-
-Value::const_iterator Value::begin() const {
-  switch (type_) {
-  case arrayValue:
-  case objectValue:
-    if (value_.map_)
-      return const_iterator(value_.map_->begin());
-    break;
-  default:
-    break;
-  }
-  return const_iterator();
-}
-
-Value::const_iterator Value::end() const {
-  switch (type_) {
-  case arrayValue:
-  case objectValue:
-    if (value_.map_)
-      return const_iterator(value_.map_->end());
-    break;
-  default:
-    break;
-  }
-  return const_iterator();
-}
-
-Value::iterator Value::begin() {
-  switch (type_) {
-  case arrayValue:
-  case objectValue:
-    if (value_.map_)
-      return iterator(value_.map_->begin());
-    break;
-  default:
-    break;
-  }
-  return iterator();
-}
-
-Value::iterator Value::end() {
-  switch (type_) {
-  case arrayValue:
-  case objectValue:
-    if (value_.map_)
-      return iterator(value_.map_->end());
-    break;
-  default:
-    break;
-  }
-  return iterator();
-}
-
-// class PathArgument
-// //////////////////////////////////////////////////////////////////
-
-PathArgument::PathArgument() : key_(), index_(), kind_(kindNone) {}
-
-PathArgument::PathArgument(ArrayIndex index)
-    : key_(), index_(index), kind_(kindIndex) {}
-
-PathArgument::PathArgument(const char* key)
-    : key_(key), index_(), kind_(kindKey) {}
-
-PathArgument::PathArgument(const JSONCPP_STRING& key)
-    : key_(key.c_str()), index_(), kind_(kindKey) {}
-
-// class Path
-// //////////////////////////////////////////////////////////////////
-
-Path::Path(const JSONCPP_STRING& path,
-           const PathArgument& a1,
-           const PathArgument& a2,
-           const PathArgument& a3,
-           const PathArgument& a4,
-           const PathArgument& a5) {
-  InArgs in;
-  in.push_back(&a1);
-  in.push_back(&a2);
-  in.push_back(&a3);
-  in.push_back(&a4);
-  in.push_back(&a5);
-  makePath(path, in);
-}
-
-void Path::makePath(const JSONCPP_STRING& path, const InArgs& in) {
-  const char* current = path.c_str();
-  const char* end = current + path.length();
-  InArgs::const_iterator itInArg = in.begin();
-  while (current != end) {
-    if (*current == '[') {
-      ++current;
-      if (*current == '%')
-        addPathInArg(path, in, itInArg, PathArgument::kindIndex);
-      else {
-        ArrayIndex index = 0;
-        for (; current != end && *current >= '0' && *current <= '9'; ++current)
-          index = index * 10 + ArrayIndex(*current - '0');
-        args_.push_back(index);
-      }
-      if (current == end || *current++ != ']')
-        invalidPath(path, int(current - path.c_str()));
-    } else if (*current == '%') {
-      addPathInArg(path, in, itInArg, PathArgument::kindKey);
-      ++current;
-    } else if (*current == '.') {
-      ++current;
-    } else {
-      const char* beginName = current;
-      while (current != end && !strchr("[.", *current))
-        ++current;
-      args_.push_back(JSONCPP_STRING(beginName, current));
-    }
-  }
-}
-
-void Path::addPathInArg(const JSONCPP_STRING& /*path*/,
-                        const InArgs& in,
-                        InArgs::const_iterator& itInArg,
-                        PathArgument::Kind kind) {
-  if (itInArg == in.end()) {
-    // Error: missing argument %d
-  } else if ((*itInArg)->kind_ != kind) {
-    // Error: bad argument type
-  } else {
-    args_.push_back(**itInArg);
-  }
-}
-
-void Path::invalidPath(const JSONCPP_STRING& /*path*/, int /*location*/) {
-  // Error: invalid path.
-}
-
-const Value& Path::resolve(const Value& root) const {
-  const Value* node = &root;
-  for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
-    const PathArgument& arg = *it;
-    if (arg.kind_ == PathArgument::kindIndex) {
-      if (!node->isArray() || !node->isValidIndex(arg.index_)) {
-        // Error: unable to resolve path (array value expected at position...
-      }
-      node = &((*node)[arg.index_]);
-    } else if (arg.kind_ == PathArgument::kindKey) {
-      if (!node->isObject()) {
-        // Error: unable to resolve path (object value expected at position...)
-      }
-      node = &((*node)[arg.key_]);
-      if (node == &Value::nullRef) {
-        // Error: unable to resolve path (object has no member named '' at
-        // position...)
-      }
-    }
-  }
-  return *node;
-}
-
-Value Path::resolve(const Value& root, const Value& defaultValue) const {
-  const Value* node = &root;
-  for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
-    const PathArgument& arg = *it;
-    if (arg.kind_ == PathArgument::kindIndex) {
-      if (!node->isArray() || !node->isValidIndex(arg.index_))
-        return defaultValue;
-      node = &((*node)[arg.index_]);
-    } else if (arg.kind_ == PathArgument::kindKey) {
-      if (!node->isObject())
-        return defaultValue;
-      node = &((*node)[arg.key_]);
-      if (node == &Value::nullRef)
-        return defaultValue;
-    }
-  }
-  return *node;
-}
-
-Value& Path::make(Value& root) const {
-  Value* node = &root;
-  for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
-    const PathArgument& arg = *it;
-    if (arg.kind_ == PathArgument::kindIndex) {
-      if (!node->isArray()) {
-        // Error: node is not an array at position ...
-      }
-      node = &((*node)[arg.index_]);
-    } else if (arg.kind_ == PathArgument::kindKey) {
-      if (!node->isObject()) {
-        // Error: node is not an object at position...
-      }
-      node = &((*node)[arg.key_]);
-    }
-  }
-  return *node;
-}
-
-} // namespace Json
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: src/lib_json/json_value.cpp
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-// //////////////////////////////////////////////////////////////////////
-// Beginning of content of file: src/lib_json/json_writer.cpp
-// //////////////////////////////////////////////////////////////////////
-
-// Copyright 2011 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#if !defined(JSON_IS_AMALGAMATION)
-#include <json/writer.h>
-#include "json_tool.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-#include <iomanip>
-#include <memory>
-#include <sstream>
-#include <utility>
-#include <set>
-#include <cassert>
-#include <cstring>
-#include <cstdio>
-
-#if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1800 // Between VC++ 6.0 and VC++ 11.0
-#include <float.h>
-#define isfinite _finite
-#elif defined(__sun) && defined(__SVR4) //Solaris
-#if !defined(isfinite)
-#include <ieeefp.h>
-#define isfinite finite
-#endif
-#elif defined(_AIX)
-#if !defined(isfinite)
-#include <math.h>
-#define isfinite finite
-#endif
-#elif defined(__hpux)
-#if !defined(isfinite)
-#if defined(__ia64) && !defined(finite)
-#define isfinite(x) ((sizeof(x) == sizeof(float) ? \
-                     _Isfinitef(x) : _IsFinite(x)))
-#else
-#include <math.h>
-#define isfinite finite
-#endif
-#endif
-#else
-#include <cmath>
-#if !(defined(__QNXNTO__)) // QNX already defines isfinite
-#define isfinite std::isfinite
-#endif
-#endif
-
-#if defined(_MSC_VER)
-#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above
-#define snprintf sprintf_s
-#elif _MSC_VER >= 1900 // VC++ 14.0 and above
-#define snprintf std::snprintf
-#else
-#define snprintf _snprintf
-#endif
-#elif defined(__ANDROID__) || defined(__QNXNTO__)
-#define snprintf snprintf
-#elif __cplusplus >= 201103L
-#if !defined(__MINGW32__) && !defined(__CYGWIN__)
-#define snprintf std::snprintf
-#endif
-#endif
-
-#if defined(__BORLANDC__)  
-#include <float.h>
-#define isfinite _finite
-#define snprintf _snprintf
-#endif
-
-#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
-// Disable warning about strdup being deprecated.
-#pragma warning(disable : 4996)
-#endif
-
-namespace Json {
-
-#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520)
-typedef std::unique_ptr<StreamWriter> StreamWriterPtr;
-#else
-typedef std::auto_ptr<StreamWriter>   StreamWriterPtr;
-#endif
-
-static bool containsControlCharacter(const char* str) {
-  while (*str) {
-    if (isControlCharacter(*(str++)))
-      return true;
-  }
-  return false;
-}
-
-static bool containsControlCharacter0(const char* str, unsigned len) {
-  char const* end = str + len;
-  while (end != str) {
-    if (isControlCharacter(*str) || 0==*str)
-      return true;
-    ++str;
-  }
-  return false;
-}
-
-JSONCPP_STRING valueToString(LargestInt value) {
-  UIntToStringBuffer buffer;
-  char* current = buffer + sizeof(buffer);
-  if (value == Value::minLargestInt) {
-    uintToString(LargestUInt(Value::maxLargestInt) + 1, current);
-    *--current = '-';
-  } else if (value < 0) {
-    uintToString(LargestUInt(-value), current);
-    *--current = '-';
-  } else {
-    uintToString(LargestUInt(value), current);
-  }
-  assert(current >= buffer);
-  return current;
-}
-
-JSONCPP_STRING valueToString(LargestUInt value) {
-  UIntToStringBuffer buffer;
-  char* current = buffer + sizeof(buffer);
-  uintToString(value, current);
-  assert(current >= buffer);
-  return current;
-}
-
-#if defined(JSON_HAS_INT64)
-
-JSONCPP_STRING valueToString(Int value) {
-  return valueToString(LargestInt(value));
-}
-
-JSONCPP_STRING valueToString(UInt value) {
-  return valueToString(LargestUInt(value));
-}
-
-#endif // # if defined(JSON_HAS_INT64)
-
-JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int precision) {
-  // Allocate a buffer that is more than large enough to store the 16 digits of
-  // precision requested below.
-  char buffer[32];
-  int len = -1;
-
-  char formatString[6];
-  sprintf(formatString, "%%.%dg", precision);
-
-  // Print into the buffer. We need not request the alternative representation
-  // that always has a decimal point because JSON doesn't distingish the
-  // concepts of reals and integers.
-  if (isfinite(value)) {
-    len = snprintf(buffer, sizeof(buffer), formatString, value);
-  } else {
-    // IEEE standard states that NaN values will not compare to themselves
-    if (value != value) {
-      len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "NaN" : "null");
-    } else if (value < 0) {
-      len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "-Infinity" : "-1e+9999");
-    } else {
-      len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "Infinity" : "1e+9999");
-    }
-    // For those, we do not need to call fixNumLoc, but it is fast.
-  }
-  assert(len >= 0);
-  fixNumericLocale(buffer, buffer + len);
-  return buffer;
-}
-
-JSONCPP_STRING valueToString(double value) { return valueToString(value, false, 17); }
-
-JSONCPP_STRING valueToString(bool value) { return value ? "true" : "false"; }
-
-JSONCPP_STRING valueToQuotedString(const char* value) {
-  if (value == NULL)
-    return "";
-  // Not sure how to handle unicode...
-  if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL &&
-      !containsControlCharacter(value))
-    return JSONCPP_STRING("\"") + value + "\"";
-  // We have to walk value and escape any special characters.
-  // Appending to JSONCPP_STRING is not efficient, but this should be rare.
-  // (Note: forward slashes are *not* rare, but I am not escaping them.)
-  JSONCPP_STRING::size_type maxsize =
-      strlen(value) * 2 + 3; // allescaped+quotes+NULL
-  JSONCPP_STRING result;
-  result.reserve(maxsize); // to avoid lots of mallocs
-  result += "\"";
-  for (const char* c = value; *c != 0; ++c) {
-    switch (*c) {
-    case '\"':
-      result += "\\\"";
-      break;
-    case '\\':
-      result += "\\\\";
-      break;
-    case '\b':
-      result += "\\b";
-      break;
-    case '\f':
-      result += "\\f";
-      break;
-    case '\n':
-      result += "\\n";
-      break;
-    case '\r':
-      result += "\\r";
-      break;
-    case '\t':
-      result += "\\t";
-      break;
-    // case '/':
-    // Even though \/ is considered a legal escape in JSON, a bare
-    // slash is also legal, so I see no reason to escape it.
-    // (I hope I am not misunderstanding something.
-    // blep notes: actually escaping \/ may be useful in javascript to avoid </
-    // sequence.
-    // Should add a flag to allow this compatibility mode and prevent this
-    // sequence from occurring.
-    default:
-      if (isControlCharacter(*c)) {
-        JSONCPP_OSTRINGSTREAM oss;
-        oss << "\\u" << std::hex << std::uppercase << std::setfill('0')
-            << std::setw(4) << static_cast<int>(*c);
-        result += oss.str();
-      } else {
-        result += *c;
-      }
-      break;
-    }
-  }
-  result += "\"";
-  return result;
-}
-
-// https://github.com/upcaste/upcaste/blob/master/src/upcore/src/cstring/strnpbrk.cpp
-static char const* strnpbrk(char const* s, char const* accept, size_t n) {
-  assert((s || !n) && accept);
-
-  char const* const end = s + n;
-  for (char const* cur = s; cur < end; ++cur) {
-    int const c = *cur;
-    for (char const* a = accept; *a; ++a) {
-      if (*a == c) {
-        return cur;
-      }
-    }
-  }
-  return NULL;
-}
-static JSONCPP_STRING valueToQuotedStringN(const char* value, unsigned length) {
-  if (value == NULL)
-    return "";
-  // Not sure how to handle unicode...
-  if (strnpbrk(value, "\"\\\b\f\n\r\t", length) == NULL &&
-      !containsControlCharacter0(value, length))
-    return JSONCPP_STRING("\"") + value + "\"";
-  // We have to walk value and escape any special characters.
-  // Appending to JSONCPP_STRING is not efficient, but this should be rare.
-  // (Note: forward slashes are *not* rare, but I am not escaping them.)
-  JSONCPP_STRING::size_type maxsize =
-      length * 2 + 3; // allescaped+quotes+NULL
-  JSONCPP_STRING result;
-  result.reserve(maxsize); // to avoid lots of mallocs
-  result += "\"";
-  char const* end = value + length;
-  for (const char* c = value; c != end; ++c) {
-    switch (*c) {
-    case '\"':
-      result += "\\\"";
-      break;
-    case '\\':
-      result += "\\\\";
-      break;
-    case '\b':
-      result += "\\b";
-      break;
-    case '\f':
-      result += "\\f";
-      break;
-    case '\n':
-      result += "\\n";
-      break;
-    case '\r':
-      result += "\\r";
-      break;
-    case '\t':
-      result += "\\t";
-      break;
-    // case '/':
-    // Even though \/ is considered a legal escape in JSON, a bare
-    // slash is also legal, so I see no reason to escape it.
-    // (I hope I am not misunderstanding something.)
-    // blep notes: actually escaping \/ may be useful in javascript to avoid </
-    // sequence.
-    // Should add a flag to allow this compatibility mode and prevent this
-    // sequence from occurring.
-    default:
-      if ((isControlCharacter(*c)) || (*c == 0)) {
-        JSONCPP_OSTRINGSTREAM oss;
-        oss << "\\u" << std::hex << std::uppercase << std::setfill('0')
-            << std::setw(4) << static_cast<int>(*c);
-        result += oss.str();
-      } else {
-        result += *c;
-      }
-      break;
-    }
-  }
-  result += "\"";
-  return result;
-}
-
-// Class Writer
-// //////////////////////////////////////////////////////////////////
-Writer::~Writer() {}
-
-// Class FastWriter
-// //////////////////////////////////////////////////////////////////
-
-FastWriter::FastWriter()
-    : yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false),
-      omitEndingLineFeed_(false) {}
-
-void FastWriter::enableYAMLCompatibility() { yamlCompatiblityEnabled_ = true; }
-
-void FastWriter::dropNullPlaceholders() { dropNullPlaceholders_ = true; }
-
-void FastWriter::omitEndingLineFeed() { omitEndingLineFeed_ = true; }
-
-JSONCPP_STRING FastWriter::write(const Value& root) {
-  document_ = "";
-  writeValue(root);
-  if (!omitEndingLineFeed_)
-    document_ += "\n";
-  return document_;
-}
-
-void FastWriter::writeValue(const Value& value) {
-  switch (value.type()) {
-  case nullValue:
-    if (!dropNullPlaceholders_)
-      document_ += "null";
-    break;
-  case intValue:
-    document_ += valueToString(value.asLargestInt());
-    break;
-  case uintValue:
-    document_ += valueToString(value.asLargestUInt());
-    break;
-  case realValue:
-    document_ += valueToString(value.asDouble());
-    break;
-  case stringValue:
-  {
-    // Is NULL possible for value.string_?
-    char const* str;
-    char const* end;
-    bool ok = value.getString(&str, &end);
-    if (ok) document_ += valueToQuotedStringN(str, static_cast<unsigned>(end-str));
-    break;
-  }
-  case booleanValue:
-    document_ += valueToString(value.asBool());
-    break;
-  case arrayValue: {
-    document_ += '[';
-    ArrayIndex size = value.size();
-    for (ArrayIndex index = 0; index < size; ++index) {
-      if (index > 0)
-        document_ += ',';
-      writeValue(value[index]);
-    }
-    document_ += ']';
-  } break;
-  case objectValue: {
-    Value::Members members(value.getMemberNames());
-    document_ += '{';
-    for (Value::Members::iterator it = members.begin(); it != members.end();
-         ++it) {
-      const JSONCPP_STRING& name = *it;
-      if (it != members.begin())
-        document_ += ',';
-      document_ += valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length()));
-      document_ += yamlCompatiblityEnabled_ ? ": " : ":";
-      writeValue(value[name]);
-    }
-    document_ += '}';
-  } break;
-  }
-}
-
-// Class StyledWriter
-// //////////////////////////////////////////////////////////////////
-
-StyledWriter::StyledWriter()
-    : rightMargin_(74), indentSize_(3), addChildValues_() {}
-
-JSONCPP_STRING StyledWriter::write(const Value& root) {
-  document_ = "";
-  addChildValues_ = false;
-  indentString_ = "";
-  writeCommentBeforeValue(root);
-  writeValue(root);
-  writeCommentAfterValueOnSameLine(root);
-  document_ += "\n";
-  return document_;
-}
-
-void StyledWriter::writeValue(const Value& value) {
-  switch (value.type()) {
-  case nullValue:
-    pushValue("null");
-    break;
-  case intValue:
-    pushValue(valueToString(value.asLargestInt()));
-    break;
-  case uintValue:
-    pushValue(valueToString(value.asLargestUInt()));
-    break;
-  case realValue:
-    pushValue(valueToString(value.asDouble()));
-    break;
-  case stringValue:
-  {
-    // Is NULL possible for value.string_?
-    char const* str;
-    char const* end;
-    bool ok = value.getString(&str, &end);
-    if (ok) pushValue(valueToQuotedStringN(str, static_cast<unsigned>(end-str)));
-    else pushValue("");
-    break;
-  }
-  case booleanValue:
-    pushValue(valueToString(value.asBool()));
-    break;
-  case arrayValue:
-    writeArrayValue(value);
-    break;
-  case objectValue: {
-    Value::Members members(value.getMemberNames());
-    if (members.empty())
-      pushValue("{}");
-    else {
-      writeWithIndent("{");
-      indent();
-      Value::Members::iterator it = members.begin();
-      for (;;) {
-        const JSONCPP_STRING& name = *it;
-        const Value& childValue = value[name];
-        writeCommentBeforeValue(childValue);
-        writeWithIndent(valueToQuotedString(name.c_str()));
-        document_ += " : ";
-        writeValue(childValue);
-        if (++it == members.end()) {
-          writeCommentAfterValueOnSameLine(childValue);
-          break;
-        }
-        document_ += ',';
-        writeCommentAfterValueOnSameLine(childValue);
-      }
-      unindent();
-      writeWithIndent("}");
-    }
-  } break;
-  }
-}
-
-void StyledWriter::writeArrayValue(const Value& value) {
-  unsigned size = value.size();
-  if (size == 0)
-    pushValue("[]");
-  else {
-    bool isArrayMultiLine = isMultineArray(value);
-    if (isArrayMultiLine) {
-      writeWithIndent("[");
-      indent();
-      bool hasChildValue = !childValues_.empty();
-      unsigned index = 0;
-      for (;;) {
-        const Value& childValue = value[index];
-        writeCommentBeforeValue(childValue);
-        if (hasChildValue)
-          writeWithIndent(childValues_[index]);
-        else {
-          writeIndent();
-          writeValue(childValue);
-        }
-        if (++index == size) {
-          writeCommentAfterValueOnSameLine(childValue);
-          break;
-        }
-        document_ += ',';
-        writeCommentAfterValueOnSameLine(childValue);
-      }
-      unindent();
-      writeWithIndent("]");
-    } else // output on a single line
-    {
-      assert(childValues_.size() == size);
-      document_ += "[ ";
-      for (unsigned index = 0; index < size; ++index) {
-        if (index > 0)
-          document_ += ", ";
-        document_ += childValues_[index];
-      }
-      document_ += " ]";
-    }
-  }
-}
-
-bool StyledWriter::isMultineArray(const Value& value) {
-  ArrayIndex const size = value.size();
-  bool isMultiLine = size * 3 >= rightMargin_;
-  childValues_.clear();
-  for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
-    const Value& childValue = value[index];
-    isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
-                        childValue.size() > 0);
-  }
-  if (!isMultiLine) // check if line length > max line length
-  {
-    childValues_.reserve(size);
-    addChildValues_ = true;
-    ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
-    for (ArrayIndex index = 0; index < size; ++index) {
-      if (hasCommentForValue(value[index])) {
-        isMultiLine = true;
-      }
-      writeValue(value[index]);
-      lineLength += static_cast<ArrayIndex>(childValues_[index].length());
-    }
-    addChildValues_ = false;
-    isMultiLine = isMultiLine || lineLength >= rightMargin_;
-  }
-  return isMultiLine;
-}
-
-void StyledWriter::pushValue(const JSONCPP_STRING& value) {
-  if (addChildValues_)
-    childValues_.push_back(value);
-  else
-    document_ += value;
-}
-
-void StyledWriter::writeIndent() {
-  if (!document_.empty()) {
-    char last = document_[document_.length() - 1];
-    if (last == ' ') // already indented
-      return;
-    if (last != '\n') // Comments may add new-line
-      document_ += '\n';
-  }
-  document_ += indentString_;
-}
-
-void StyledWriter::writeWithIndent(const JSONCPP_STRING& value) {
-  writeIndent();
-  document_ += value;
-}
-
-void StyledWriter::indent() { indentString_ += JSONCPP_STRING(indentSize_, ' '); }
-
-void StyledWriter::unindent() {
-  assert(indentString_.size() >= indentSize_);
-  indentString_.resize(indentString_.size() - indentSize_);
-}
-
-void StyledWriter::writeCommentBeforeValue(const Value& root) {
-  if (!root.hasComment(commentBefore))
-    return;
-
-  document_ += "\n";
-  writeIndent();
-  const JSONCPP_STRING& comment = root.getComment(commentBefore);
-  JSONCPP_STRING::const_iterator iter = comment.begin();
-  while (iter != comment.end()) {
-    document_ += *iter;
-    if (*iter == '\n' &&
-       (iter != comment.end() && *(iter + 1) == '/'))
-      writeIndent();
-    ++iter;
-  }
-
-  // Comments are stripped of trailing newlines, so add one here
-  document_ += "\n";
-}
-
-void StyledWriter::writeCommentAfterValueOnSameLine(const Value& root) {
-  if (root.hasComment(commentAfterOnSameLine))
-    document_ += " " + root.getComment(commentAfterOnSameLine);
-
-  if (root.hasComment(commentAfter)) {
-    document_ += "\n";
-    document_ += root.getComment(commentAfter);
-    document_ += "\n";
-  }
-}
-
-bool StyledWriter::hasCommentForValue(const Value& value) {
-  return value.hasComment(commentBefore) ||
-         value.hasComment(commentAfterOnSameLine) ||
-         value.hasComment(commentAfter);
-}
-
-// Class StyledStreamWriter
-// //////////////////////////////////////////////////////////////////
-
-StyledStreamWriter::StyledStreamWriter(JSONCPP_STRING indentation)
-    : document_(NULL), rightMargin_(74), indentation_(indentation),
-      addChildValues_() {}
-
-void StyledStreamWriter::write(JSONCPP_OSTREAM& out, const Value& root) {
-  document_ = &out;
-  addChildValues_ = false;
-  indentString_ = "";
-  indented_ = true;
-  writeCommentBeforeValue(root);
-  if (!indented_) writeIndent();
-  indented_ = true;
-  writeValue(root);
-  writeCommentAfterValueOnSameLine(root);
-  *document_ << "\n";
-  document_ = NULL; // Forget the stream, for safety.
-}
-
-void StyledStreamWriter::writeValue(const Value& value) {
-  switch (value.type()) {
-  case nullValue:
-    pushValue("null");
-    break;
-  case intValue:
-    pushValue(valueToString(value.asLargestInt()));
-    break;
-  case uintValue:
-    pushValue(valueToString(value.asLargestUInt()));
-    break;
-  case realValue:
-    pushValue(valueToString(value.asDouble()));
-    break;
-  case stringValue:
-  {
-    // Is NULL possible for value.string_?
-    char const* str;
-    char const* end;
-    bool ok = value.getString(&str, &end);
-    if (ok) pushValue(valueToQuotedStringN(str, static_cast<unsigned>(end-str)));
-    else pushValue("");
-    break;
-  }
-  case booleanValue:
-    pushValue(valueToString(value.asBool()));
-    break;
-  case arrayValue:
-    writeArrayValue(value);
-    break;
-  case objectValue: {
-    Value::Members members(value.getMemberNames());
-    if (members.empty())
-      pushValue("{}");
-    else {
-      writeWithIndent("{");
-      indent();
-      Value::Members::iterator it = members.begin();
-      for (;;) {
-        const JSONCPP_STRING& name = *it;
-        const Value& childValue = value[name];
-        writeCommentBeforeValue(childValue);
-        writeWithIndent(valueToQuotedString(name.c_str()));
-        *document_ << " : ";
-        writeValue(childValue);
-        if (++it == members.end()) {
-          writeCommentAfterValueOnSameLine(childValue);
-          break;
-        }
-        *document_ << ",";
-        writeCommentAfterValueOnSameLine(childValue);
-      }
-      unindent();
-      writeWithIndent("}");
-    }
-  } break;
-  }
-}
-
-void StyledStreamWriter::writeArrayValue(const Value& value) {
-  unsigned size = value.size();
-  if (size == 0)
-    pushValue("[]");
-  else {
-    bool isArrayMultiLine = isMultineArray(value);
-    if (isArrayMultiLine) {
-      writeWithIndent("[");
-      indent();
-      bool hasChildValue = !childValues_.empty();
-      unsigned index = 0;
-      for (;;) {
-        const Value& childValue = value[index];
-        writeCommentBeforeValue(childValue);
-        if (hasChildValue)
-          writeWithIndent(childValues_[index]);
-        else {
-          if (!indented_) writeIndent();
-          indented_ = true;
-          writeValue(childValue);
-          indented_ = false;
-        }
-        if (++index == size) {
-          writeCommentAfterValueOnSameLine(childValue);
-          break;
-        }
-        *document_ << ",";
-        writeCommentAfterValueOnSameLine(childValue);
-      }
-      unindent();
-      writeWithIndent("]");
-    } else // output on a single line
-    {
-      assert(childValues_.size() == size);
-      *document_ << "[ ";
-      for (unsigned index = 0; index < size; ++index) {
-        if (index > 0)
-          *document_ << ", ";
-        *document_ << childValues_[index];
-      }
-      *document_ << " ]";
-    }
-  }
-}
-
-bool StyledStreamWriter::isMultineArray(const Value& value) {
-  ArrayIndex const size = value.size();
-  bool isMultiLine = size * 3 >= rightMargin_;
-  childValues_.clear();
-  for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
-    const Value& childValue = value[index];
-    isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
-                        childValue.size() > 0);
-  }
-  if (!isMultiLine) // check if line length > max line length
-  {
-    childValues_.reserve(size);
-    addChildValues_ = true;
-    ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
-    for (ArrayIndex index = 0; index < size; ++index) {
-      if (hasCommentForValue(value[index])) {
-        isMultiLine = true;
-      }
-      writeValue(value[index]);
-      lineLength += static_cast<ArrayIndex>(childValues_[index].length());
-    }
-    addChildValues_ = false;
-    isMultiLine = isMultiLine || lineLength >= rightMargin_;
-  }
-  return isMultiLine;
-}
-
-void StyledStreamWriter::pushValue(const JSONCPP_STRING& value) {
-  if (addChildValues_)
-    childValues_.push_back(value);
-  else
-    *document_ << value;
-}
-
-void StyledStreamWriter::writeIndent() {
-  // blep intended this to look at the so-far-written string
-  // to determine whether we are already indented, but
-  // with a stream we cannot do that. So we rely on some saved state.
-  // The caller checks indented_.
-  *document_ << '\n' << indentString_;
-}
-
-void StyledStreamWriter::writeWithIndent(const JSONCPP_STRING& value) {
-  if (!indented_) writeIndent();
-  *document_ << value;
-  indented_ = false;
-}
-
-void StyledStreamWriter::indent() { indentString_ += indentation_; }
-
-void StyledStreamWriter::unindent() {
-  assert(indentString_.size() >= indentation_.size());
-  indentString_.resize(indentString_.size() - indentation_.size());
-}
-
-void StyledStreamWriter::writeCommentBeforeValue(const Value& root) {
-  if (!root.hasComment(commentBefore))
-    return;
-
-  if (!indented_) writeIndent();
-  const JSONCPP_STRING& comment = root.getComment(commentBefore);
-  JSONCPP_STRING::const_iterator iter = comment.begin();
-  while (iter != comment.end()) {
-    *document_ << *iter;
-    if (*iter == '\n' &&
-       (iter != comment.end() && *(iter + 1) == '/'))
-      // writeIndent();  // would include newline
-      *document_ << indentString_;
-    ++iter;
-  }
-  indented_ = false;
-}
-
-void StyledStreamWriter::writeCommentAfterValueOnSameLine(const Value& root) {
-  if (root.hasComment(commentAfterOnSameLine))
-    *document_ << ' ' << root.getComment(commentAfterOnSameLine);
-
-  if (root.hasComment(commentAfter)) {
-    writeIndent();
-    *document_ << root.getComment(commentAfter);
-  }
-  indented_ = false;
-}
-
-bool StyledStreamWriter::hasCommentForValue(const Value& value) {
-  return value.hasComment(commentBefore) ||
-         value.hasComment(commentAfterOnSameLine) ||
-         value.hasComment(commentAfter);
-}
-
-//////////////////////////
-// BuiltStyledStreamWriter
-
-/// Scoped enums are not available until C++11.
-struct CommentStyle {
-  /// Decide whether to write comments.
-  enum Enum {
-    None,  ///< Drop all comments.
-    Most,  ///< Recover odd behavior of previous versions (not implemented yet).
-    All  ///< Keep all comments.
-  };
-};
-
-struct BuiltStyledStreamWriter : public StreamWriter
-{
-  BuiltStyledStreamWriter(
-      JSONCPP_STRING const& indentation,
-      CommentStyle::Enum cs,
-      JSONCPP_STRING const& colonSymbol,
-      JSONCPP_STRING const& nullSymbol,
-      JSONCPP_STRING const& endingLineFeedSymbol,
-      bool useSpecialFloats,
-      unsigned int precision);
-  int write(Value const& root, JSONCPP_OSTREAM* sout) JSONCPP_OVERRIDE;
-private:
-  void writeValue(Value const& value);
-  void writeArrayValue(Value const& value);
-  bool isMultineArray(Value const& value);
-  void pushValue(JSONCPP_STRING const& value);
-  void writeIndent();
-  void writeWithIndent(JSONCPP_STRING const& value);
-  void indent();
-  void unindent();
-  void writeCommentBeforeValue(Value const& root);
-  void writeCommentAfterValueOnSameLine(Value const& root);
-  static bool hasCommentForValue(const Value& value);
-
-  typedef std::vector<JSONCPP_STRING> ChildValues;
-
-  ChildValues childValues_;
-  JSONCPP_STRING indentString_;
-  unsigned int rightMargin_;
-  JSONCPP_STRING indentation_;
-  CommentStyle::Enum cs_;
-  JSONCPP_STRING colonSymbol_;
-  JSONCPP_STRING nullSymbol_;
-  JSONCPP_STRING endingLineFeedSymbol_;
-  bool addChildValues_ : 1;
-  bool indented_ : 1;
-  bool useSpecialFloats_ : 1;
-  unsigned int precision_;
-};
-BuiltStyledStreamWriter::BuiltStyledStreamWriter(
-      JSONCPP_STRING const& indentation,
-      CommentStyle::Enum cs,
-      JSONCPP_STRING const& colonSymbol,
-      JSONCPP_STRING const& nullSymbol,
-      JSONCPP_STRING const& endingLineFeedSymbol,
-      bool useSpecialFloats,
-      unsigned int precision)
-  : rightMargin_(74)
-  , indentation_(indentation)
-  , cs_(cs)
-  , colonSymbol_(colonSymbol)
-  , nullSymbol_(nullSymbol)
-  , endingLineFeedSymbol_(endingLineFeedSymbol)
-  , addChildValues_(false)
-  , indented_(false)
-  , useSpecialFloats_(useSpecialFloats)
-  , precision_(precision)
-{
-}
-int BuiltStyledStreamWriter::write(Value const& root, JSONCPP_OSTREAM* sout)
-{
-  sout_ = sout;
-  addChildValues_ = false;
-  indented_ = true;
-  indentString_ = "";
-  writeCommentBeforeValue(root);
-  if (!indented_) writeIndent();
-  indented_ = true;
-  writeValue(root);
-  writeCommentAfterValueOnSameLine(root);
-  *sout_ << endingLineFeedSymbol_;
-  sout_ = NULL;
-  return 0;
-}
-void BuiltStyledStreamWriter::writeValue(Value const& value) {
-  switch (value.type()) {
-  case nullValue:
-    pushValue(nullSymbol_);
-    break;
-  case intValue:
-    pushValue(valueToString(value.asLargestInt()));
-    break;
-  case uintValue:
-    pushValue(valueToString(value.asLargestUInt()));
-    break;
-  case realValue:
-    pushValue(valueToString(value.asDouble(), useSpecialFloats_, precision_));
-    break;
-  case stringValue:
-  {
-    // Is NULL is possible for value.string_?
-    char const* str;
-    char const* end;
-    bool ok = value.getString(&str, &end);
-    if (ok) pushValue(valueToQuotedStringN(str, static_cast<unsigned>(end-str)));
-    else pushValue("");
-    break;
-  }
-  case booleanValue:
-    pushValue(valueToString(value.asBool()));
-    break;
-  case arrayValue:
-    writeArrayValue(value);
-    break;
-  case objectValue: {
-    Value::Members members(value.getMemberNames());
-    if (members.empty())
-      pushValue("{}");
-    else {
-      writeWithIndent("{");
-      indent();
-      Value::Members::iterator it = members.begin();
-      for (;;) {
-        JSONCPP_STRING const& name = *it;
-        Value const& childValue = value[name];
-        writeCommentBeforeValue(childValue);
-        writeWithIndent(valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length())));
-        *sout_ << colonSymbol_;
-        writeValue(childValue);
-        if (++it == members.end()) {
-          writeCommentAfterValueOnSameLine(childValue);
-          break;
-        }
-        *sout_ << ",";
-        writeCommentAfterValueOnSameLine(childValue);
-      }
-      unindent();
-      writeWithIndent("}");
-    }
-  } break;
-  }
-}
-
-void BuiltStyledStreamWriter::writeArrayValue(Value const& value) {
-  unsigned size = value.size();
-  if (size == 0)
-    pushValue("[]");
-  else {
-    bool isMultiLine = (cs_ == CommentStyle::All) || isMultineArray(value);
-    if (isMultiLine) {
-      writeWithIndent("[");
-      indent();
-      bool hasChildValue = !childValues_.empty();
-      unsigned index = 0;
-      for (;;) {
-        Value const& childValue = value[index];
-        writeCommentBeforeValue(childValue);
-        if (hasChildValue)
-          writeWithIndent(childValues_[index]);
-        else {
-          if (!indented_) writeIndent();
-          indented_ = true;
-          writeValue(childValue);
-          indented_ = false;
-        }
-        if (++index == size) {
-          writeCommentAfterValueOnSameLine(childValue);
-          break;
-        }
-        *sout_ << ",";
-        writeCommentAfterValueOnSameLine(childValue);
-      }
-      unindent();
-      writeWithIndent("]");
-    } else // output on a single line
-    {
-      assert(childValues_.size() == size);
-      *sout_ << "[";
-      if (!indentation_.empty()) *sout_ << " ";
-      for (unsigned index = 0; index < size; ++index) {
-        if (index > 0)
-          *sout_ << ", ";
-        *sout_ << childValues_[index];
-      }
-      if (!indentation_.empty()) *sout_ << " ";
-      *sout_ << "]";
-    }
-  }
-}
-
-bool BuiltStyledStreamWriter::isMultineArray(Value const& value) {
-  ArrayIndex const size = value.size();
-  bool isMultiLine = size * 3 >= rightMargin_;
-  childValues_.clear();
-  for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
-    Value const& childValue = value[index];
-    isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
-                        childValue.size() > 0);
-  }
-  if (!isMultiLine) // check if line length > max line length
-  {
-    childValues_.reserve(size);
-    addChildValues_ = true;
-    ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
-    for (ArrayIndex index = 0; index < size; ++index) {
-      if (hasCommentForValue(value[index])) {
-        isMultiLine = true;
-      }
-      writeValue(value[index]);
-      lineLength += static_cast<ArrayIndex>(childValues_[index].length());
-    }
-    addChildValues_ = false;
-    isMultiLine = isMultiLine || lineLength >= rightMargin_;
-  }
-  return isMultiLine;
-}
-
-void BuiltStyledStreamWriter::pushValue(JSONCPP_STRING const& value) {
-  if (addChildValues_)
-    childValues_.push_back(value);
-  else
-    *sout_ << value;
-}
-
-void BuiltStyledStreamWriter::writeIndent() {
-  // blep intended this to look at the so-far-written string
-  // to determine whether we are already indented, but
-  // with a stream we cannot do that. So we rely on some saved state.
-  // The caller checks indented_.
-
-  if (!indentation_.empty()) {
-    // In this case, drop newlines too.
-    *sout_ << '\n' << indentString_;
-  }
-}
-
-void BuiltStyledStreamWriter::writeWithIndent(JSONCPP_STRING const& value) {
-  if (!indented_) writeIndent();
-  *sout_ << value;
-  indented_ = false;
-}
-
-void BuiltStyledStreamWriter::indent() { indentString_ += indentation_; }
-
-void BuiltStyledStreamWriter::unindent() {
-  assert(indentString_.size() >= indentation_.size());
-  indentString_.resize(indentString_.size() - indentation_.size());
-}
-
-void BuiltStyledStreamWriter::writeCommentBeforeValue(Value const& root) {
-  if (cs_ == CommentStyle::None) return;
-  if (!root.hasComment(commentBefore))
-    return;
-
-  if (!indented_) writeIndent();
-  const JSONCPP_STRING& comment = root.getComment(commentBefore);
-  JSONCPP_STRING::const_iterator iter = comment.begin();
-  while (iter != comment.end()) {
-    *sout_ << *iter;
-    if (*iter == '\n' &&
-       (iter != comment.end() && *(iter + 1) == '/'))
-      // writeIndent();  // would write extra newline
-      *sout_ << indentString_;
-    ++iter;
-  }
-  indented_ = false;
-}
-
-void BuiltStyledStreamWriter::writeCommentAfterValueOnSameLine(Value const& root) {
-  if (cs_ == CommentStyle::None) return;
-  if (root.hasComment(commentAfterOnSameLine))
-    *sout_ << " " + root.getComment(commentAfterOnSameLine);
-
-  if (root.hasComment(commentAfter)) {
-    writeIndent();
-    *sout_ << root.getComment(commentAfter);
-  }
-}
-
-// static
-bool BuiltStyledStreamWriter::hasCommentForValue(const Value& value) {
-  return value.hasComment(commentBefore) ||
-         value.hasComment(commentAfterOnSameLine) ||
-         value.hasComment(commentAfter);
-}
-
-///////////////
-// StreamWriter
-
-StreamWriter::StreamWriter()
-    : sout_(NULL)
-{
-}
-StreamWriter::~StreamWriter()
-{
-}
-StreamWriter::Factory::~Factory()
-{}
-StreamWriterBuilder::StreamWriterBuilder()
-{
-  setDefaults(&settings_);
-}
-StreamWriterBuilder::~StreamWriterBuilder()
-{}
-StreamWriter* StreamWriterBuilder::newStreamWriter() const
-{
-  JSONCPP_STRING indentation = settings_["indentation"].asString();
-  JSONCPP_STRING cs_str = settings_["commentStyle"].asString();
-  bool eyc = settings_["enableYAMLCompatibility"].asBool();
-  bool dnp = settings_["dropNullPlaceholders"].asBool();
-  bool usf = settings_["useSpecialFloats"].asBool(); 
-  unsigned int pre = settings_["precision"].asUInt();
-  CommentStyle::Enum cs = CommentStyle::All;
-  if (cs_str == "All") {
-    cs = CommentStyle::All;
-  } else if (cs_str == "None") {
-    cs = CommentStyle::None;
-  } else {
-    throwRuntimeError("commentStyle must be 'All' or 'None'");
-  }
-  JSONCPP_STRING colonSymbol = " : ";
-  if (eyc) {
-    colonSymbol = ": ";
-  } else if (indentation.empty()) {
-    colonSymbol = ":";
-  }
-  JSONCPP_STRING nullSymbol = "null";
-  if (dnp) {
-    nullSymbol = "";
-  }
-  if (pre > 17) pre = 17;
-  JSONCPP_STRING endingLineFeedSymbol = "";
-  return new BuiltStyledStreamWriter(
-      indentation, cs,
-      colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre);
-}
-static void getValidWriterKeys(std::set<JSONCPP_STRING>* valid_keys)
-{
-  valid_keys->clear();
-  valid_keys->insert("indentation");
-  valid_keys->insert("commentStyle");
-  valid_keys->insert("enableYAMLCompatibility");
-  valid_keys->insert("dropNullPlaceholders");
-  valid_keys->insert("useSpecialFloats");
-  valid_keys->insert("precision");
-}
-bool StreamWriterBuilder::validate(Json::Value* invalid) const
-{
-  Json::Value my_invalid;
-  if (!invalid) invalid = &my_invalid;  // so we do not need to test for NULL
-  Json::Value& inv = *invalid;
-  std::set<JSONCPP_STRING> valid_keys;
-  getValidWriterKeys(&valid_keys);
-  Value::Members keys = settings_.getMemberNames();
-  size_t n = keys.size();
-  for (size_t i = 0; i < n; ++i) {
-    JSONCPP_STRING const& key = keys[i];
-    if (valid_keys.find(key) == valid_keys.end()) {
-      inv[key] = settings_[key];
-    }
-  }
-  return 0u == inv.size();
-}
-Value& StreamWriterBuilder::operator[](JSONCPP_STRING key)
-{
-  return settings_[key];
-}
-// static
-void StreamWriterBuilder::setDefaults(Json::Value* settings)
-{
-  //! [StreamWriterBuilderDefaults]
-  (*settings)["commentStyle"] = "All";
-  (*settings)["indentation"] = "\t";
-  (*settings)["enableYAMLCompatibility"] = false;
-  (*settings)["dropNullPlaceholders"] = false;
-  (*settings)["useSpecialFloats"] = false;
-  (*settings)["precision"] = 17;
-  //! [StreamWriterBuilderDefaults]
-}
-
-JSONCPP_STRING writeString(StreamWriter::Factory const& builder, Value const& root) {
-  JSONCPP_OSTRINGSTREAM sout;
-  StreamWriterPtr const writer(builder.newStreamWriter());
-  writer->write(root, &sout);
-  return sout.str();
-}
-
-JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM& sout, Value const& root) {
-  StreamWriterBuilder builder;
-  StreamWriterPtr const writer(builder.newStreamWriter());
-  writer->write(root, &sout);
-  return sout;
-}
-
-} // namespace Json
-
-// //////////////////////////////////////////////////////////////////////
-// End of content of file: src/lib_json/json_writer.cpp
-// //////////////////////////////////////////////////////////////////////
-
-
-
-
-

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/seqtools.git



More information about the debian-med-commit mailing list