11e45667d4e291b3038ccda729a1cdf5bcaf004a
braney
  Mon Jul 11 15:46:54 2016 -0700
incorporate htslib in kent src, remove USE_BAM, USE_SAMTABIX, USE_TABIX
defines, modify a bunch of makefiles to include kentSrc variable
pointing to top of the tree.

diff --git src/hg/hgTracks/bamTrack.c src/hg/hgTracks/bamTrack.c
index f632d57..22e1dd4 100644
--- src/hg/hgTracks/bamTrack.c
+++ src/hg/hgTracks/bamTrack.c
@@ -1,22 +1,21 @@
 /* bamTrack -- handlers for alignments in BAM format (produced by MAQ,
  * BWA and some other short-read alignment tools). */
 
 /* Copyright (C) 2014 The Regents of the University of California 
  * See README in this or parent directory for licensing information. */
 
-#ifdef USE_BAM
 
 #include "common.h"
 #include "hCommon.h"
 #include "hash.h"
 #include "linefile.h"
 #include "htmshell.h"
 #include "jksql.h"
 #include "hdb.h"
 #include "hgTracks.h"
 #include "cds.h"
 #include "hgBam.h"
 #include "wigCommon.h"
 #include "knetUdc.h"
 #include "udc.h"
 #include "bigWarn.h"
@@ -290,35 +289,31 @@
 
 boolean passesFilters(const bam1_t *bam, struct bamTrackData *btd)
 /* Return TRUE if bam passes hgTrackUi-set filters. */
 {
 if (bam == NULL)
     return FALSE;
 const bam1_core_t *core = &bam->core;
 // Always reject unmapped items -- nowhere to draw them.
 if (core->flag & BAM_FUNMAP)
     return FALSE;
 if (core->qual < btd->minAliQual)
     return FALSE;
 return TRUE;
 }
 
-#ifdef USE_HTS
 int addBam(const bam1_t *bam, void *data, bam_hdr_t *hdr)
-#else
-int addBam(const bam1_t *bam, void *data)
-#endif
 /* bam_fetch() calls this on each bam alignment retrieved.  Translate each bam
  * into a linkedFeatures item, and add it to tg->items. */
 {
 struct bamTrackData *btd = (struct bamTrackData *)data;
 if (!passesFilters(bam, btd))
     return 0;
 struct linkedFeatures *lf = bamToLf(bam, data);
 if (lf)
     {
     struct track *tg = btd->tg;
     slAddHead(&(tg->items), lf);
     }
 return 0;
 }
 
@@ -343,35 +338,31 @@
 /* Make a linkedFeaturesSeries from one or two linkedFeatures elements. */
 {
 struct linkedFeaturesSeries *lfs;
 AllocVar(lfs);
 lfs->name = cloneString(lf->name);
 lfs->grayIx = lf->grayIx;
 if (lf->next != NULL)
     slSort(&lf, linkedFeaturesCmpStart);
 lfs->orientation = 0;
 lfs->start = lf->start;
 lfs->end = lf->next ? max(lf->next->end, lf->end) : lf->end;
 lfs->features = lf;
 return lfs;
 }
 
-#ifdef USE_HTS
 int addBamPaired(const bam1_t *bam, void *data, bam_hdr_t *header)
-#else
-int addBamPaired(const bam1_t *bam, void *data)
-#endif
 /* bam_fetch() calls this on each bam alignment retrieved.  Translate each bam
  * into a linkedFeaturesSeries item, and either store it until we find its mate
  * or add it to tg->items. */
 {
 const bam1_core_t *core = &bam->core;
 struct bamTrackData *btd = (struct bamTrackData *)data;
 if (! passesFilters(bam, btd))
     return 0;
 struct linkedFeatures *lf = bamToLf(bam, data);
 struct track *tg = btd->tg;
 if (!(core->flag & BAM_FPAIRED) || (core->flag & BAM_FMUNMAP))
     {
     if (lf->start < winEnd && lf->end > winStart)
 	slAddHead(&(tg->items), lfsFromLf(lf));
     if ((core->flag & BAM_FMUNMAP) && sameString(btd->colorMode, BAM_COLOR_MODE_GRAY) &&
@@ -868,35 +859,31 @@
 track->nextItemButtonable = track->nextExonButtonable = FALSE;
 track->nextPrevItem = NULL;
 track->nextPrevExon = NULL;
 if (sameString(colorMode, BAM_COLOR_MODE_GRAY))
     track->colorShades = shadesOfGray;
 }
 
 struct bamWigTrackData
 {
 struct preDrawElement *preDraw;
 double scale;
 int width;
 int preDrawZero;
 };
 
-#ifdef USE_HTS
 static int countBam(const bam1_t *bam, void *data, bam_hdr_t *header)
-#else
-static int countBam(const bam1_t *bam, void *data)
-#endif
 /* bam_fetch() calls this on each bam alignment retrieved.  */
 {
 struct bamWigTrackData *btd = (struct bamWigTrackData *)data;
 const bam1_core_t *core = &bam->core;
 
 int tLength=0, tPos = core->pos, qPos = 0;
 unsigned int *cigar = bam1_cigar(bam);
 int i;
 double scale = btd->scale;
 for (i = 0;  i < core->n_cigar;  i++)
     {
     char op;
     int n = bamUnpackCigarElement(cigar[i], &op);
     switch (op)
 	{
@@ -1004,50 +991,15 @@
 wigDrawPredraw(tg, seqStart, seqEnd, hvg, xOff, yOff, width, font, color, vis,
 	       tg->preDrawContainer, tg->preDrawContainer->preDrawZero, tg->preDrawContainer->preDrawSize, tg->graphUpperLimit, tg->graphLowerLimit);
 
 }
 
 void bamWigMethods(struct track *track, struct trackDb *tdb,
 	int wordCount, char *words[])
 /* Set up bamWig methods. */
 {
 bedGraphMethods(track, tdb, wordCount, words);
 track->loadItems = bamWigLoadItems;
 track->preDrawItems = bamWigPreDrawItems;
 track->preDrawMultiRegion = wigMultiRegionGraphLimits;
 track->drawItems = bamWigDrawItems;
 }
-#else /* no USE_BAM */
-
-#include "common.h"
-#include "hgTracks.h"
-// If code was not built with USE_BAM=1, but there are bam tracks, display a message
-// in place of the tracks (instead of annoying "No track handler" warning messages).
-
-void drawUseBamWarning(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg,
-                 int xOff, int yOff, int width, MgFont *font, Color color,
-                 enum trackVisibility vis)
-/* Draw a message saying that the code needs to be built with USE_BAM=1. */
-{
-char message[512];
-safef(message, sizeof(message),
-      "Get samtools(.sourceforge.net) and recompile kent/src with USE_BAM=1");
-Color yellow = hvGfxFindRgb(hvg, &undefinedYellowColor);
-hvGfxBox(hvg, xOff, yOff, width, tg->heightPer, yellow);
-hvGfxTextCentered(hvg, xOff, yOff, width, tg->heightPer, MG_BLACK, font, message);
-}
-
-void bamMethods(struct track *track)
-/* Methods for BAM alignment files, in absence of USE_BAM (samtools lib). */
-{
-messageLineMethods(track);
-track->drawItems = drawUseBamWarning;
-}
-
-void bamWigMethods(struct track *track, struct trackDb *tdb,
-	int wordCount, char *words[])
-/* Same stub when compiled without USE_BAM. */
-{
-bamMethods(track);
-}
-
-#endif /* no USE_BAM */