d3752edc12da1bf08427946150f564dbdd5d2254 angie Thu Oct 24 13:55:51 2019 -0700 bigDbSnp track handler code - initial commit. refs #23283 * dnautil: Added trimRefAltLeft to get left-justified trimming (a la VCF not HGVS). * bigBedClick: do hReplaceGbdb up front in parseDetailsTablUrls instead of waiting until endpoint. * trackDbCustom.c: consolidating type-handling for wig/bigWig vs. bigBed-based big*. diff --git src/hg/hgTracks/bigBedTrack.c src/hg/hgTracks/bigBedTrack.c index 9023ef3..1b45d8a 100644 --- src/hg/hgTracks/bigBedTrack.c +++ src/hg/hgTracks/bigBedTrack.c @@ -14,30 +14,31 @@ #include "hgTracks.h" #include "hmmstats.h" #include "localmem.h" #include "wigCommon.h" #include "bbiFile.h" #include "obscure.h" #include "bigWig.h" #include "bigBed.h" #include "bigWarn.h" #include "errCatch.h" #include "trackHub.h" #include "net.h" #include "bigPsl.h" #include "bigBedFilter.h" #include "bigBedLabel.h" +#include "variation.h" static unsigned getFieldNum(struct bbiFile *bbi, char *field) // get field number for field name in bigBed. errAbort if field not found. { int fieldNum = bbFieldIndex(bbi, field); if (fieldNum < 0) errAbort("error building filter with field %s. Field not found.", field); return fieldNum; } struct bigBedFilter *bigBedMakeNumberFilter(struct cart *cart, struct bbiFile *bbi, struct trackDb *tdb, char *filter, char *defaultLimits, char *field) /* Make a filter on this column if the trackDb or cart wants us to. */ { struct bigBedFilter *ret = NULL; @@ -464,59 +465,69 @@ if (sameString(track->tdb->type, "bigPsl")) { char *seq, *cds; struct psl *psl = pslFromBigPsl(chromName, bb, seqTypeField, &seq, &cds); int sizeMul = pslIsProtein(psl) ? 3 : 1; boolean isXeno = 0; // just affects grayIx boolean nameGetsPos = FALSE; // we want the name to stay the name lf = lfFromPslx(psl, sizeMul, isXeno, nameGetsPos, track); lf->original = psl; if ((seq != NULL) && (lf->orientation == -1)) reverseComplement(seq, strlen(seq)); lf->extra = seq; lf->cds = cds; } + else if (sameString(tdb->type, "bigDbSnp")) + { + // bigDbSnp does not have a score field, but I want to compute the freqSourceIx from + // trackDb and settings one time instead of for each item, so I'm overloading scoreMin. + int freqSourceIx = scoreMin; + lf = lfFromBigDbSnp(tdb, bb, filters, freqSourceIx); + } else { char startBuf[16], endBuf[16]; char *bedRow[bbi->fieldCount]; bigBedIntervalToRow(bb, chromName, startBuf, endBuf, bedRow, ArraySize(bedRow)); if (bigBedFilterInterval(bedRow, filters)) { struct bed *bed = bedLoadN(bedRow, fieldCount); lf = bedMungToLinkedFeatures(&bed, tdb, fieldCount, scoreMin, scoreMax, useItemRgb); } } if (lf == NULL) { filtered++; continue; } + if (lf->label == NULL) lf->label = bigBedMakeLabel(track->tdb, track->labelColumns, bb, chromName); if (sameString(track->tdb->type, "bigGenePred") || startsWith("genePred", track->tdb->type)) { lf->original = genePredFromBigGenePred(chromName, bb); } + if (lf->mouseOver == NULL) + { char* mouseOver = restField(bb, mouseOverIdx); lf->mouseOver = mouseOver; // leaks some memory, cloneString handles NULL ifself - + } slAddHead(pLfList, lf); } if (filtered) labelTrackAsFilteredNumber(track, filtered); lmCleanup(&lm); if (!trackDbSettingClosestToHomeOn(track->tdb, "linkIdInName")) track->itemName = bigLfItemName; bbiFileClose(&bbi); } boolean canDrawBigBedDense(struct track *tg)