54406b80d5d435970989acff7b22dd6146c6b411 braney Sat Jan 22 15:24:59 2022 -0800 adding chrom alias support to big files diff --git src/hg/hgc/lrgClick.c src/hg/hgc/lrgClick.c index 1d1b322..38848f4 100644 --- src/hg/hgc/lrgClick.c +++ src/hg/hgc/lrgClick.c @@ -1,29 +1,30 @@ /* lrgClick.c - Locus Reference Genomic (LRG) sequences mapped to genome assembly */ /* Copyright (C) 2013 The Regents of the University of California * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ #include "common.h" #include "hgc.h" #include "bigBed.h" #include "fa.h" #include "genbank.h" #include "hdb.h" #include "trackHub.h" #include "lrg.h" #include "hui.h" +#include "chromAlias.h" INLINE void printStartAndMaybeEnd(uint start, uint end) { if (end == start+1) printf("%d", end); else printf("%d-%d", start+1, end); } static void printLrgDiffs(struct lrg *lrg, struct lrgDiff *diffList) /* Diffstr is a comma-separated list of colon-separated blkStart, lrgStart, assemblySeq, lrgSeq. * Make it more readable as a table with links to position ranges. */ { printf("<TABLE class='stdTbl'>\n" "<TR><TH>%s<BR>location</TH><TH>%s<BR>sequence</TH>" @@ -62,31 +63,31 @@ conn = hAllocConnTrack(database, tdb); char *fileName = bbiNameFromSettingOrTable(tdb, conn, tdb->table); hFreeConn(&conn); if (isEmpty(fileName)) { errAbort("doLrg: missing bigBed fileName for track '%s'", tdb->track); } genericHeader(tdb, item); // Get column urls from trackDb: char *urlsStr = trackDbSetting(tdb, "urls"); struct hash *columnUrls = hashFromString(urlsStr); // Open BigWig file and get interval list. -struct bbiFile *bbi = bigBedFileOpen(fileName); +struct bbiFile *bbi = bigBedFileOpenAlias(fileName, chromAliasGetHash(database)); int bedSize = bbi->definedFieldCount; int fieldCount = bbi->fieldCount; struct lm *lm = lmInit(0); struct bigBedInterval *bbList = bigBedIntervalQuery(bbi, chrom, start, end, 0, lm); boolean found = FALSE; struct bigBedInterval *bb; for (bb = bbList; bb != NULL; bb = bb->next) { if (!(bb->start == start && bb->end == end)) continue; char *fields[fieldCount]; char startBuf[16], endBuf[16]; int bbFieldCount = bigBedIntervalToRow(bb, chrom, startBuf, endBuf, fields, fieldCount); if (bbFieldCount != fieldCount) errAbort("doLrg: inconsistent fieldCount (bbi has %d, row has %d)",