src/hg/hgTables/intersect.c 1.49

1.49 2009/04/10 20:04:29 tdreszer
Fix many instances of using composite tdb when subtrack tdb is needed
Index: src/hg/hgTables/intersect.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/intersect.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -b -B -U 4 -r1.48 -r1.49
--- src/hg/hgTables/intersect.c	17 Mar 2009 04:28:39 -0000	1.48
+++ src/hg/hgTables/intersect.c	10 Apr 2009 20:04:29 -0000	1.49
@@ -580,27 +580,8 @@
 bitFree(&bits2);
 return intersectedBedList;
 }
 
-static char *getPrimaryType(char *primarySubtrack, struct trackDb *tdb)
-/* Do not free when done. */
-/* Copied in from hui.c...  really isSubtrackMerged should take two tdbs 
- * and incorporate the name and type checking! */
-{
-struct trackDb *subtrack = NULL;
-char *type = NULL;
-if (primarySubtrack)
-    for (subtrack = tdb->subtracks; subtrack != NULL; subtrack = subtrack->next)
-	{
-	if (sameString(subtrack->tableName, primarySubtrack))
-	    {
-	    type = subtrack->type;
-	    break;
-	    }
-	}
-return type;
-}
-
 struct bed *getRegionAsMergedBed(
 	char *db, char *table, 	/* Database and table. */
 	struct region *region,  /* Region to get data for. */
 	char *filter, 		/* Filter to add to SQL where clause if any. */
@@ -619,9 +600,9 @@
     Bits *bits1 = NULL;
     Bits *bits2 = NULL;
     struct bed *bedMerged = NULL;
     struct trackDb *subtrack = NULL;
-    char *primaryType = getPrimaryType(table, curTrack);
+    char *primaryType = findTypeForTable(database,curTrack,table);
     char *op = cartString(cart, hgtaSubtrackMergeOp);
     boolean isBpWise = (sameString(op, "and") || sameString(op, "or"));
     double moreThresh = cartDouble(cart, hgtaSubtrackMergeMoreThreshold);
     double lessThresh = cartDouble(cart, hgtaSubtrackMergeLessThreshold);