393033d7be69dbfafdcdb2c181fa45c05ee37ba6 braney Sun Aug 25 16:13:12 2013 -0700 use MAXLONG for maximum length of chrom diff --git src/hg/hgTracks/snakeTrack.c src/hg/hgTracks/snakeTrack.c index 553ee9e..2f1296a 100644 --- src/hg/hgTracks/snakeTrack.c +++ src/hg/hgTracks/snakeTrack.c @@ -8,54 +8,55 @@ #include "hash.h" #include "localmem.h" #include "linefile.h" #include "jksql.h" #include "hdb.h" #include "hgTracks.h" #include "chainBlock.h" #include "chainLink.h" #include "chainDb.h" #include "chainCart.h" #include "errCatch.h" #include "twoBit.h" #include "bigWarn.h" #include <pthread.h> #include "trackHub.h" +#include "values.h" #ifdef USE_HAL #include "halBlockViz.h" #endif struct snakeFeature { struct snakeFeature *next; int start, end; /* Start/end in browser coordinates. */ int qStart, qEnd; /* query start/end */ int level; /* level in packed snake */ int orientation; /* strand... -1 is '-', 1 is '+' */ boolean drawn; /* did we draw this feature? */ char *sequence; /* may have sequence, or NULL */ char *qName; /* chrom name on other species */ }; // static machinery to calculate packed snake struct level { boolean init; /* has this level been initialized */ int orientation; /* strand.. see above */ -int edge; /* the leading edge of this level */ +unsigned long edge; /* the leading edge of this level */ int adjustLevel; /* used to compress out the unused levels */ boolean hasBlock; /* are there any blocks in this level */ }; static struct level Levels[1000000]; /* for packing the snake, not re-entrant! */ static int maxLevel = 0; /* deepest level */ /* blocks that make it through the min size filter */ static struct snakeFeature *newList = NULL; static int snakeFeatureCmpQStart(const void *va, const void *vb) /* sort by start position on the query sequence */ { const struct snakeFeature *a = *((struct snakeFeature **)va); const struct snakeFeature *b = *((struct snakeFeature **)vb); @@ -86,31 +87,31 @@ { struct snakeFeature *cb = list; struct snakeFeature *proposedList = NULL; if (level > maxLevel) maxLevel = level; if (level > ArraySize(Levels)) errAbort("too many levels"); if (Levels[level].init == FALSE) { // initialize the level if this is the first time we've seen it Levels[level].init = TRUE; Levels[level].orientation = list->orientation; if (list->orientation == -1) - Levels[level].edge = 1000000000; // bigger than the biggest chrom + Levels[level].edge = MAXLONG; // bigger than the biggest chrom else Levels[level].edge = 0; } // now we step through the blocks and assign them to levels struct snakeFeature *next; struct snakeFeature *insertHead = NULL; for(; cb; cb = next) { // we're going to add this block to a different list // so keep track of the next pointer next = cb->next; // if this block can't fit on this level add to the insert // list and move on to the next block