96c4625c9810fd946a852d4e85d343cd2b0e5717 braney Thu Mar 21 16:08:25 2024 -0700 get sequence links from hgc to work with quickLift diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 2a31441..0a1a35d 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -255,30 +255,31 @@ #include "aveStats.h" #include "trix.h" #include "bPlusTree.h" #include "customFactory.h" #include "dupTrack.h" #include "iupac.h" #include "clinvarSubLolly.h" #include "jsHelper.h" #include "errCatch.h" #include "htslib/bgzf.h" #include "htslib/kstring.h" #include "pipeline.h" #include "genark.h" #include "chromAlias.h" #include "dotPlot.h" +#include "quickLift.h" static char *rootDir = "hgcData"; #define LINESIZE 70 /* size of lines in comp seq feature */ #define MAX_DISPLAY_QUERY_SEQ_SIZE 5000000 // Big enough for HLA alts struct cart *cart; /* User's settings. */ char *seqName; /* Name of sequence we're working on. */ int winStart, winEnd; /* Bounds of sequence. */ char *database; /* Name of mySQL database. */ char *organism; /* Colloquial name of organism. */ char *genome; /* common name, e.g. Mouse, Human */ char *scientificName; /* Scientific name of organism. */ /* for earlyBotCheck() function at the beginning of main() */ @@ -9136,36 +9137,54 @@ gp = genePredLoad(row+rowOffset); slAddHead(&gpList, gp); } sqlFreeResult(&sr); hFreeConn(&conn); return gpList; } struct genePred *getGenePredForPositionBigGene(struct trackDb *tdb, char *geneName) /* Find the genePred to the current gene using a bigGenePred. */ { char *fileName = hReplaceGbdb(trackDbSetting(tdb, "bigDataUrl")); struct bbiFile *bbi = bigBedFileOpenAlias(fileName, chromAliasFindAliases); struct lm *lm = lmInit(0); -struct bigBedInterval *bb, *bbList = bigBedIntervalQuery(bbi, seqName, winStart, winEnd, 0, lm); +char *quickLiftFile = cloneString(trackDbSetting(tdb, "quickLiftUrl")); +struct bigBedInterval *bb, *bbList = NULL; +struct hash *chainHash = NULL; +if (quickLiftFile) + bbList = quickLiftIntervals(quickLiftFile, bbi, seqName, winStart, winEnd, &chainHash); +else + bbList = bigBedIntervalQuery(bbi, seqName, winStart, winEnd, 0, lm); struct genePred *gpList = NULL; for (bb = bbList; bb != NULL; bb = bb->next) { - struct genePred *gp = (struct genePred *)genePredFromBigGenePred(seqName, bb); - if (sameString(gp->name, geneName)) + struct genePred *gp = NULL; + if (quickLiftFile) + { + struct bed *bed; + if ((bed = quickLiftBed(bbi, chainHash, bb)) != NULL) + { + struct bed *bedCopy = cloneBed(bed); + gp =(struct genePred *) genePredFromBedBigGenePred(seqName, bedCopy, bb); + } + } + else + gp = (struct genePred *)genePredFromBigGenePred(seqName, bb); + + if ((gp != NULL) && sameString(gp->name, geneName)) slAddHead(&gpList, gp); } lmCleanup(&lm); return gpList; } static struct genePred *getGenePredForPosition(char *table, char *geneName) /* Build a genePred list for the given table and gene name. */ { struct genePred *gpList = NULL; if (isCustomTrack(table)) { struct trackDb *tdb = getCustomTrackTdb(table);