src/hg/hgTables/maf.c 1.19

1.19 2010/04/09 00:11:44 braney
always check for mafFile in trackDb settings, and if present, use it.
Index: src/hg/hgTables/maf.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/maf.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -b -B -U 4 -r1.18 -r1.19
--- src/hg/hgTables/maf.c	4 Jan 2010 19:12:22 -0000	1.18
+++ src/hg/hgTables/maf.c	9 Apr 2010 00:11:44 -0000	1.19
@@ -59,17 +59,17 @@
 
 struct sqlConnection *ctConn = NULL;
 struct sqlConnection *ctConn2 = NULL;
 struct customTrack *ct = NULL;
-char *mafFile = NULL;
+struct hash *settings = track->settingsHash;
+char *mafFile = hashFindVal(settings, "mafFile");
 
 if (isCustomTrack(table))
     {
     ctConn = hAllocConn(CUSTOM_TRASH);
     ctConn2 = hAllocConn(CUSTOM_TRASH);
     ct = ctLookupName(table);
-    struct hash *settings = track->settingsHash;
-    if ((mafFile = hashFindVal(settings, "mafFile")) == NULL)
+    if (mafFile == NULL)
 	{
 	/* this shouldn't happen */
 	printf("cannot find custom track file %s\n", mafFile);
 	return;
@@ -95,10 +95,16 @@
 	    bed->chromEnd = region->end;
 	if (bed->chromStart >= bed->chromEnd)
 	    continue;
 	if (ct == NULL)
+	    {
+	    if (mafFile != NULL)
+		mafList = mafLoadInRegion2(conn, conn, table,
+			bed->chrom, bed->chromStart, bed->chromEnd, mafFile);
+	    else
 	    mafList = mafLoadInRegion(conn, table, bed->chrom,
 				      bed->chromStart, bed->chromEnd);
+	    }
 	else
 	    mafList = mafLoadInRegion2(ctConn, ctConn2, ct->dbTableName,
 		    bed->chrom, bed->chromStart, bed->chromEnd, mafFile);
 	for (maf = mafList; maf != NULL; maf = maf->next)