bd1404d9126eb1575ed20098204038364ea90308
kent
  Tue Mar 5 10:04:23 2013 -0800
Big bed extra indexes seem to work now.  Code still needs a little polish and testing.
diff --git src/inc/bigBed.h src/inc/bigBed.h
index bd7c4db..77335e3 100644
--- src/inc/bigBed.h
+++ src/inc/bigBed.h
@@ -45,36 +45,37 @@
 	enum bbiSummaryType summaryType, int summarySize, double *summaryValues);
 /* Fill in summaryValues with  data from indicated chromosome range in bigBed file.
  * Be sure to initialize summaryValues to a default value, which will not be touched
  * for regions without data in file.  (Generally you want the default value to either
  * be 0.0 or nan("") depending on the application.)  Returns FALSE if no data
  * at that position. */
 
 boolean bigBedSummaryArrayExtended(struct bbiFile *bbi, char *chrom, bits32 start, bits32 end,
 	int summarySize, struct bbiSummaryElement *summary);
 /* Get extended summary information for summarySize evenely spaced elements into
  * the summary array. */
 
 /*** Some routines for accessing bigBed items via name. ***/
 
 struct bigBedInterval *bigBedNameQuery(struct bbiFile *bbi, struct bptFile *index,
-    char *name, struct lm *lm);
+    int fieldIx, char *name, struct lm *lm);
 /* Return list of intervals matching file. These intervals will be allocated out of lm. */
 
 struct bigBedInterval *bigBedMultiNameQuery(struct bbiFile *bbi, struct bptFile *index,
-    char **names, int nameCount, struct lm *lm);
-/* Fetch all records matching any of the names. Return list is allocated out of lm. */
+    int fieldIx, char **names, int nameCount, struct lm *lm);
+/* Fetch all records matching any of the names. Using given index on given field.
+ * Return list is allocated out of lm. */
 
 int bigBedIntervalToRowLookupChrom(struct bigBedInterval *interval, 
     struct bigBedInterval *prevInterval, struct bbiFile *bbi,
     char *chromBuf, int chromBufSize, char *startBuf, char *endBuf, char **row, int rowSize);
 /* Convert bigBedInterval to array of chars equivalend to what you'd get by parsing the
  * bed file.  If you already know what chromosome the interval is on use the simpler
  * bigBedIntervalToRow.  This one will look up the chromosome based on the chromId field
  * of the interval,  which is relatively time consuming.  To avoid doing this unnecessarily
  * pass in a non-NULL prevInterval,  and if the chromId is the same on prevInterval as this,
  * it will avoid the lookup.  The chromBufSize should be at greater or equal to 
  * bbi->chromBpt->keySize+1.  The startBuf and endBuf are used to hold the ascii representation of
  * start and end, and should be 16 bytes.  Note that the interval->rest string will have zeroes 
  * inserted as a side effect.  Returns number of fields in row.  */
 
 void bigBedIntervalListToBedFile(struct bbiFile *bbi, struct bigBedInterval *intervalList, FILE *f);
@@ -88,23 +89,24 @@
 char *bigBedAutoSqlText(struct bbiFile *bbi);
 /* Get autoSql text if any associated with file.  Do a freeMem of this when done. */
 
 struct asObject *bigBedAs(struct bbiFile *bbi);
 /* Get autoSql object definition if any associated with file. */
 
 struct asObject *bigBedAsOrDefault(struct bbiFile *bbi);
 // Get asObject associated with bigBed - if none exists in file make it up from field counts.
 
 struct asObject *bigBedFileAsObjOrDefault(char *fileName);
 // Get asObject associated with bigBed file, or the default.
 
 boolean bigBedFileCheckSigs(char *fileName);
 /* check file signatures at beginning and end of file */
 
-struct bptFile *bigBedOpenExtraIndex(struct bbiFile *bbi, char *fieldName);
-/* Return index associated with fieldName.  Aborts if no such index. */
+struct bptFile *bigBedOpenExtraIndex(struct bbiFile *bbi, char *fieldName, int *retFieldIx);
+/* Return index associated with fieldName.  Aborts if no such index.  Optionally return
+ * index in a row of this field. */
 
 struct slName *bigBedListExtraIndexes(struct bbiFile *bbi);
 /* Return list of names of extra indexes beyond primary chrom:start-end one" */
 
 #endif /* BIGBED_H */