src/hg/hgc/bamClick.c 1.8

1.8 2009/09/14 23:44:25 angie
Added bamFileNameFromTable to bamFile.h and changed bamFetch to take a filename, not db+table, so it can be used for CT files someday. bamFileNameFromTable supports an optional seqName column in the db table, for per-chrom BAM files (as we get from 1000Genomes).
Index: src/hg/hgc/bamClick.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/bamClick.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -b -B -U 4 -r1.7 -r1.8
--- src/hg/hgc/bamClick.c	24 Aug 2009 23:47:56 -0000	1.7
+++ src/hg/hgc/bamClick.c	14 Sep 2009 23:44:25 -0000	1.8
@@ -135,9 +135,10 @@
 
 bamIgnoreStrand();
 struct hash *pairHash = isPaired ? hashNew(0) : NULL;
 struct bamTrackData btd = {start, item, pairHash};
-bamFetch(database, tdb->tableName, posForBam, oneBam, &btd);
+char *fileName = bamFileNameFromTable(database, tdb->tableName, seqNameForBam);
+bamFetch(fileName, posForBam, oneBam, &btd);
 if (isPaired && hashNumEntries(pairHash) > 0)
     {
     char *setting = trackDbSettingOrDefault(tdb, "pairSearchRange", "1000");
     int pairSearchRange = atoi(setting);
@@ -149,9 +150,9 @@
 	btd.itemName = hel->name;
 	btd.pairHash = newPairHash;
 	safef(posForBam, sizeof(posForBam), "%s:%d-%d", seqNameForBam,
 	      winStart-pairSearchRange, winEnd+pairSearchRange);
-	bamFetch(database, tdb->tableName, posForBam, oneBam, &btd);
+	bamFetch(fileName, posForBam, oneBam, &btd);
 	if (hashNumEntries(newPairHash) > 0)
 	    {
 	    struct hashCookie cookie2 = hashFirst(pairHash);
 	    while ((hel = hashNext(&cookie2)) != NULL)