602fa08316183790dd1e1d633c6d7510ae45d8cb
braney
  Fri Feb 11 15:32:03 2011 -0800
add intersections, identifier filtering, and file length limits to BAM output
diff --git src/hg/hgTables/wiggle.c src/hg/hgTables/wiggle.c
index 2d2cc5d..0fda010 100644
--- src/hg/hgTables/wiggle.c
+++ src/hg/hgTables/wiggle.c
@@ -584,31 +584,31 @@
 	break;
     case wigOutBed:
 	linesOut = wds->bedOut(wds, "stdout", TRUE);/* TRUE == sort output */
 	break;
     default:
     case wigOutData:
 	linesOut = wds->asciiOut(wds, database, "stdout", TRUE, FALSE);
 	break;		/* TRUE == sort output, FALSE == not raw data out */
     };
 
 wiggleDataStreamFree(&wds);
 
 return linesOut;
 }	/*	static int wigOutRegion()	*/
 
-static int wigMaxOutput()
+int bigFileMaxOutput()
 /*	return maxOut value (cart variable defined on curTable)	*/
 {
 char *maxOutputStr = NULL;
 char *name;
 int maxOut;
 char *maxOutput = NULL;
 
 if (isCustomTrack(curTable))
     name = filterFieldVarName("ct", curTable, "_", filterMaxOutputVar);
 else
     name = filterFieldVarName(database, curTable, "_", filterMaxOutputVar);
 
 maxOutputStr = cartOptionalString(cart, name);
 /*	Don't modify(stripChar) the values sitting in the cart hash	*/
 if (NULL == maxOutputStr)
@@ -625,31 +625,31 @@
 
 static void doOutWig(struct trackDb *track, char *table, struct sqlConnection *conn,
 	enum wigOutputType wigOutType)
 {
 struct region *regionList = getRegions(), *region;
 int maxOut = 0, outCount, curOut = 0;
 char *shortLabel = table, *longLabel = table;
 
 if (track == NULL)
     errAbort("Sorry, can't find necessary track information for %s.  "
 	     "If you reached this page by selecting \"All tables\" as the "
 	     "group, please go back and select the same table via a regular "
 	     "track group if possible.",
 	     table);
 
-maxOut = wigMaxOutput();
+maxOut = bigFileMaxOutput();
 
 if (cartUsualBoolean(cart, hgtaDoGreatOutput, FALSE))
     fputs("#", stdout);
 else
     textOpen();
 
 if (track != NULL)
     {
     if (!sameString(track->table, table) && track->subtracks != NULL)
 	{
 	struct slRef *tdbRefList = trackDbListGetRefsToDescendantLeaves(track->subtracks);
 	struct slRef *tdbRef;
 	for (tdbRef = tdbRefList; tdbRef != NULL; tdbRef = tdbRef->next)
 	    {
 	    struct trackDb *tdb = tdbRef->val;
@@ -819,31 +819,31 @@
 struct wiggleDataStream *wds = NULL;
 unsigned long long valuesMatched = 0;
 int operations = wigFetchBed;
 char *dataConstraint;
 double ll = 0.0;
 double ul = 0.0;
 char *table2 = NULL;
 struct bed *intersectBedList = NULL;
 int maxOut;
 
 WIG_INIT;  /* ct, isCustom, hasConstraint, wds and table2 are set here */
 
 if (hasConstraint)
     freeMem(dataConstraint);	/* been cloned into wds */
 
-maxOut = wigMaxOutput();
+maxOut = bigFileMaxOutput();
 
 wds->setMaxOutput(wds, maxOut);
 
 wds->setChromConstraint(wds, region->chrom);
 wds->setPositionConstraint(wds, region->start, region->end);
 
 if (table2)
     intersectBedList = bedTable2(conn, region, table2);
 
 if (isCustom)
     {
     if (ct->dbTrack)
 	{
 	unsigned span = 0;
 	struct sqlConnection *trashConn = hAllocConn(CUSTOM_TRASH);
@@ -896,31 +896,31 @@
     }
 
 wiggleDataStreamFree(&wds);
 
 return bedList;
 }	/*	struct bed *getWiggleAsBed()	*/
 
 struct wigAsciiData *getWiggleAsData(struct sqlConnection *conn, char *table,
 	struct region *region)
 /*	return the wigAsciiData list	*/
 {
 int maxOut = 0;
 struct wigAsciiData *data = NULL;
 int outCount;
 
-maxOut = wigMaxOutput();
+maxOut = bigFileMaxOutput();
 outCount = wigOutRegion(table, conn, region, maxOut, wigDataNoPrint, &data, 0);
 
 return data;
 }
 
 struct wigAsciiData *getWiggleData(struct sqlConnection *conn, char *table,
 	struct region *region, int maxOut, int spanConstraint)
 /*	like getWiggleAsData above, but with specific spanConstraint and
  *	a different data limit count, return the wigAsciiData list	*/
 {
 struct wigAsciiData *data = NULL;
 int outCount;
 
 outCount = wigOutRegion(table, conn, region, maxOut, wigDataNoPrint, &data,
 	spanConstraint);