ba5f4c097ecdf323f94adab36f4cf52f7f59e8cf
jcasper
  Mon Mar 3 09:47:13 2025 -0800
Initial commit of heatmap code for bigBeds, still plenty to do, refs #31812

diff --git src/hg/hgTracks/hgTracks.h src/hg/hgTracks/hgTracks.h
index 4aa34831e38..78a2ed63124 100644
--- src/hg/hgTracks/hgTracks.h
+++ src/hg/hgTracks/hgTracks.h
@@ -105,31 +105,35 @@
 
     char *(*itemName)(struct track *tg, void *item);
     /* Return name of one of an item to display on left side. */
 
     char *(*mapItemName)(struct track *tg, void *item);
     /* Return name to associate on map. */
 
     int (*totalHeight)(struct track *tg, enum trackVisibility vis);
 	/* Return total height. Called before and after drawItems.
 	 * Must set the following variables. */
     int height;                /* Total height - must be set by above call. */
     int lineHeight;            /* Height per item line including border. */
     int heightPer;             /* Height per item line minus border. */
 
     int (*itemHeight)(struct track *tg, void *item);
-    /* Return height of one item. */
+    /* Return height of one item in pixels. */
+
+    int (*itemHeightRowsForPack)(struct track *tg, void *item);
+    /* If set, allows items to claim they a particular number of rows while being packed.
+     * Useful for tracks with variable-height items.  */
 
     int (*itemRightPixels)(struct track *tg, void *item);
     /* Return number of pixels needed to right of item for additional labeling. (Optional) */
 
     void (*preDrawMultiRegion)(struct track *tg);
     /* Handle multi-region issues after predraw and before draw such as autoScale for wigs. */
 
     void (*preDrawItems)(struct track *tg, int seqStart, int seqEnd,
 	struct hvGfx *hvg, int xOff, int yOff, int width,
 	MgFont *font, Color color, enum trackVisibility vis);
     /* Do PreDraw item list, one per track. */
 
     void (*drawItems)(struct track *tg, int seqStart, int seqEnd,
 	struct hvGfx *hvg, int xOff, int yOff, int width,
 	MgFont *font, Color color, enum trackVisibility vis);
@@ -217,31 +221,31 @@
 
     unsigned short private;	/* True(1) if private, false(0) otherwise. */
     float priority;   /* Tracks are drawn in priority order. */
     float defaultPriority;   /* Tracks are drawn in priority order. */
     char *groupName;	/* Name of group if any. */
     struct group *group;  /* Group this track is associated with. */
     char *defaultGroupName;  /* default Group this track is associated with. */
     boolean canPack;	/* Can we pack the display for this track? */
     struct spaceSaver *ss;  /* Layout when packed. */
 
     struct trackDb *tdb; /*todo:change visibility, etc. to use this */
 
     float expScale;	/* What to scale expression tracks by. */
     char *expTable;	/* Expression table in hgFixed. */
 
-    int sourceCount;	/* Number of sources for factorSource tracks. */
+    long sourceCount;	/* Number of sources for factorSource tracks. */
     struct expRecord **sources;  /* Array of sources */
     int sourceRightPixels;	/* Number of pixels to right we'll need. */
 
     boolean exonArrows;	/* Draw arrows on exons? */
     boolean exonArrowsAlways;	/* Draw arrows on exons even with introns showing? */
     boolean nextExonButtonable; /* Use the next-exon buttons? */
     boolean nextItemButtonable; /* Use the next-gene buttons? */
     struct itemAttrTbl *itemAttrTbl;  /* relational attributes for specific
                                          items (color) */
 
     /* fill in left label drawing area */
     Color labelColor;   /* Fixed color for the track label (optional) */
     void (*drawLeftLabels)(struct track *tg, int seqStart, int seqEnd,
                            struct hvGfx *hvg, int xOff, int yOff, int width, int height,
                            boolean withCenterLabels, MgFont *font,
@@ -1181,33 +1185,37 @@
 /* Set up wig pointers and do some other precalculations on a wig type track. */
 void bedGraphMethods(struct track *track, struct trackDb *tdb,
 	int wordCount, char *words[]);
 void bigWigMethods(struct track *track, struct trackDb *tdb,
 	int wordCount, char *words[]);
 /* Make track group for wig - wiggle tracks. */
 
 void mathWigMethods(struct track *track, struct trackDb *tdb, 
 	int wordCount, char *words[]);
 /* mathWig load and draw methods. */
 
 void bigRmskMethods(struct track *track, struct trackDb *tdb,
                                 int wordCount, char *words[]);
 /* Set up bigRmsk methods. */
 
+void commonBigBedMethods(struct track *track, struct trackDb *tdb,
+                                int wordCount, char *words[]);
+/* Set up common bigBed methods used by several track types that depend on the bigBed format. */
+
 void bigBedMethods(struct track *track, struct trackDb *tdb,
                                 int wordCount, char *words[]);
-/* Set up bigBed methods. */
+/* Set up bigBed methods for tracks that are type bigBed. */
 
 void chromGraphMethods(struct track *tg);
 /* Fill in chromGraph methods for built in track. */
 
 void chromGraphMethodsCt(struct track *tg);
 /* Fill in chromGraph methods for custom track. */
 
 void factorSourceMethods(struct track *track);
 /* Set up special methods for factorSource type tracks. */
 
 void makeItemsMethods(struct track *track);
 /* Set up special methods for makeItems type tracks. */
 
 void makeItemsJsCommand(char *command, struct track *trackList, struct hash *trackHash);
 /* Execute some command sent to us from the javaScript.  All we know for sure is that