9f05f2f4765c7cbf25049b70f2a2a9ebc0f295a6
braney
  Wed Oct 8 12:42:34 2014 -0700
fix problem that resulted in base mode not working in maf display iflooking at the very beginning of a sequence.

diff --git src/hg/hgTracks/wigMafTrack.c src/hg/hgTracks/wigMafTrack.c
index c71ec27..1b25480 100644
--- src/hg/hgTracks/wigMafTrack.c
+++ src/hg/hgTracks/wigMafTrack.c
@@ -304,57 +304,61 @@
 if (fileName == NULL)
     errAbort("cannot find custom maf setting");
 return fileName;
 }
 
 static void loadMafsToTrack(struct track *track)
 /* load mafs in region to track custom pointer */
 {
 struct sqlConnection *conn;
 struct sqlConnection *conn2;
 struct mafPriv *mp = getMafPriv(track);
 
 if (winBaseCount > MAF_SUMMARY_VIEW)
     return;
 
+int begin = winStart - 2;
+if (begin < 0)
+    begin = 0;
+
 /* we open two connections to the database
  * that has the maf track in it.  One is
  * for the scoredRefs, the other to access
  * the extFile database.  We could get away
  * with just one connection, but then we'd
  * have to allocate more memory to hold
  * the scoredRefs (whereas now we just use
  * one statically loaded scoredRef).
  */
 if (mp->ct)
     {
     char *fileName = getCustomMafFile(track);
 
     conn = hAllocConn(CUSTOM_TRASH);
     conn2 = hAllocConn(CUSTOM_TRASH);
     mp->list = wigMafLoadInRegion(conn, conn2, mp->ct->dbTableName,
-				chromName, winStart - 2 , winEnd + 2, fileName);
+				chromName, begin, winEnd + 2, fileName);
     hFreeConn(&conn);
     hFreeConn(&conn2);
     }
 else
     {
     char *fileName = getTrackMafFile(track);  // optional
     conn = hAllocConn(database);
     conn2 = hAllocConn(database);
     mp->list = wigMafLoadInRegion(conn, conn2, track->table,
-				chromName, winStart - 2 , winEnd + 2, fileName);
+				chromName, begin, winEnd + 2, fileName);
     hFreeConn(&conn);
     hFreeConn(&conn2);
     }
 }
 
 static struct wigMafItem *loadBaseByBaseItems(struct track *track)
 /* Make up base-by-base track items. */
 {
 struct wigMafItem *miList = NULL, *speciesList = NULL, *mi;
 int scoreHeight = 0;
 
 bool lowerFirstChar = TRUE;
 char *firstCase;
 
 firstCase = trackDbSetting(track->tdb, ITEM_FIRST_CHAR_CASE);