b622d147b7dbac52dbf3ba26928cd18e02d42bd8 braney Sat Feb 26 12:34:37 2022 -0800 add support for using a bigBed as the chromAlias file diff --git src/inc/bbiFile.h src/inc/bbiFile.h index 9db13b1..27808a7 100644 --- src/inc/bbiFile.h +++ src/inc/bbiFile.h @@ -89,63 +89,65 @@ struct bbiZoomLevel /* A zoom level in bigWig file. */ { struct bbiZoomLevel *next; /* Next in list. */ bits32 reductionLevel; /* How many bases per item */ bits32 reserved; /* Zero for now. */ bits64 dataOffset; /* Offset of data for this level in file. */ bits64 indexOffset; /* Offset of index for this level in file. */ }; struct bbiZoomLevel *bbiBestZoom(struct bbiZoomLevel *levelList, int desiredReduction); /* Return zoom level that is the closest one that is less than or equal to * desiredReduction. */ +typedef struct slName *(*aliasFunc) (char *); // A function that passed a native seqName returns a list of aliases + struct bbiFile /* An open bbiFile */ { struct bbiFile *next; /* Next in list. */ char *fileName; /* Name of file - for better error reporting. */ struct udcFile *udc; /* Open UDC file handle. */ - struct hash *aliasHash; /* If non-NULL, constains chrom alias hash. */ + aliasFunc aliasFunc; /* our aliasFunc or NULL. */ bits32 typeSig; /* bigBedSig or bigWigSig for now. */ boolean isSwapped; /* If TRUE need to byte swap everything. */ struct bptFile *chromBpt; /* Index of chromosomes. */ bits16 version; /* Version number - initially 1. */ bits16 zoomLevels; /* Number of zoom levels. */ bits64 chromTreeOffset; /* Offset to chromosome index. */ bits64 unzoomedDataOffset; /* Start of unzoomed data. */ bits64 unzoomedIndexOffset; /* Start of unzoomed index. */ bits16 fieldCount; /* Number of columns in bed version. */ bits16 definedFieldCount; /* Number of columns using bed standard definitions. */ bits64 asOffset; /* Offset to embedded null-terminated AutoSQL file. */ bits64 totalSummaryOffset; /* Offset to total summary information if any. (On older files have to calculate) */ bits32 uncompressBufSize; /* Size of uncompression buffer, 0 if uncompressed */ bits64 extensionOffset; /* Start of header extension block or 0 if none. */ struct cirTreeFile *unzoomedCir; /* Unzoomed data index in memory - may be NULL. */ struct bbiZoomLevel *levelList; /* List of zoom levels. */ /* Fields based on extension block. */ bits16 extensionSize; /* Size of extension block */ bits16 extraIndexCount; /* Number of extra indexes (on fields other than chrom,start,end */ bits64 extraIndexListOffset; /* Offset to list of extra indexes */ }; -struct bbiFile *bbiFileOpenAlias(char *fileName, bits32 sig, char *typeName, struct hash *aliasHash); +struct bbiFile *bbiFileOpenAlias(char *fileName, bits32 sig, char *typeName, aliasFunc aliasFunc); /* Open up big wig or big bed file with chrom alias hash. */ struct bbiFile *bbiFileOpen(char *fileName, bits32 sig, char *typeName); /* Open up big wig or big bed file. */ void bbiFileClose(struct bbiFile **pBwf); /* Close down a big wig/big bed file. */ struct fileOffsetSize *bbiOverlappingBlocks(struct bbiFile *bbi, struct cirTreeFile *ctf, char *chrom, bits32 start, bits32 end, bits32 *retChromId); /* Fetch list of file blocks that contain items overlapping chromosome range. */ struct bbiChromIdSize /* We store an id/size pair in chromBpt bPlusTree */ {