43bbf45d9f7b380ea7394b7a8628be0ad3ae1b8e
angie
  Tue Jul 5 16:10:06 2011 -0700
MLQ #4463 (problem w/intersection):enabling intersection for bigWig uncovered a couple new bugs:

1. The secondary-table-fetching code didn't handle the bigWig case.
Fix: added bigWigIntervalsToBed and hooked it up in bitsForIntersectingTable.

2. The code for intersecting w/bigWig primary table had been written
but never tested, and the code for incompletely covered items from the
primary table was incorrect.

diff --git src/hg/hgTables/hgTables.h src/hg/hgTables/hgTables.h
index d7af6be..64fd78f 100644
--- src/hg/hgTables/hgTables.h
+++ src/hg/hgTables/hgTables.h
@@ -744,30 +744,35 @@
  * otherwise return NULL.  Do a freeMem on returned string when done. */
 
 char *bigWigFileName(char *table, struct sqlConnection *conn);
 /* Return file name associated with bigWig.  This handles differences whether it's
  * a custom or built-in track.  Do a freeMem on returned string when done. */
 
 
 int bigWigOutRegion(char *table, struct sqlConnection *conn,
 			     struct region *region, int maxOut,
 			     enum wigOutputType wigOutType);
 /* Write out bigWig for region, doing intersecting and filtering as need be. */
 
 void doSummaryStatsBigWig(struct sqlConnection *conn);
 /* Put up page showing summary stats for bigWig track. */
 
+struct bed *bigWigIntervalsToBed(struct sqlConnection *conn, char *table, struct region *region,
+				 struct lm *lm);
+/* Return a list of unfiltered, unintersected intervals in region as bed (for
+ * secondary table in intersection). */
+
 /* ----------- BigBed business in bigBed.c -------------------- */
 boolean isBigBed(char *database, char *table, struct trackDb *parent, 
 	struct customTrack *(*ctLookupName)(char *table));
 /* Local test to see if something is big bed.  Handles hub tracks unlike hIsBigBed. */
 
 char *bigBedFileName(char *table, struct sqlConnection *conn);
 /* Return file name associated with bigBed.  This handles differences whether it's
  * a custom or built-in track or hub.  Do a freeMem on returned string when done. */
 
 struct hTableInfo *bigBedToHti(char *table, struct sqlConnection *conn);
 /* Get fields of bigBed into hti structure. */
 
 struct asObject *bigBedAsForTable(char *table, struct sqlConnection *conn);
 /* Get asObject associated with bigBed table. */