e323d595c241d03570d380d8c60de60e99c1c4ec braney Fri Mar 21 12:36:21 2025 -0700 add support for bigDbSnp to quicklift diff --git src/hg/hgTracks/variation.c src/hg/hgTracks/variation.c index 2d80ead1874..b6fa8a222c9 100644 --- src/hg/hgTracks/variation.c +++ src/hg/hgTracks/variation.c @@ -1,29 +1,30 @@ /* variation.c - hgTracks routines that are specific to the tracks in * the variation group */ /* Copyright (C) 2014 The Regents of the University of California * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ #include "variation.h" #include "imageV2.h" #include "bedCart.h" #include "bigBed.h" #include "bigDbSnp.h" #include "bigWarn.h" #include "hvGfx.h" #include "soTerm.h" +#include "quickLift.h" static double snp125AvHetCutoff = SNP125_DEFAULT_MIN_AVHET; static int snp125WeightCutoff = SNP125_DEFAULT_MAX_WEIGHT; static int snp132MinSubmitters = SNP132_DEFAULT_MIN_SUBMITTERS; static float snp132MinMinorAlFreq = SNP132_DEFAULT_MIN_MINOR_AL_FREQ; static float snp132MaxMinorAlFreq = SNP132_DEFAULT_MAX_MINOR_AL_FREQ; static int snp132MinAlFreq2N = SNP132_DEFAULT_MIN_AL_FREQ_2N; // Globals for caching cart coloring and filtering settings for snp125+ tracks: static enum snp125ColorSource snp125ColorSource = SNP125_DEFAULT_COLOR_SOURCE; static enum snp125Color *snp125LocTypeCart = NULL; static enum snp125Color *snp125ClassCart = NULL; static enum snp125Color *snp125MolTypeCart = NULL; static enum snp125Color *snp125ValidCart = NULL; static struct hash *snp125FuncCartColorHash = NULL; @@ -2784,40 +2785,51 @@ static boolean filterMaf(struct bigDbSnp *bds, int freqSourceIx, double minMaf) /* Return TRUE if bds passes minimum Minor Allele Frequency filter. */ { if (freqSourceIx < 0) return TRUE; if (bds->freqSourceCount > freqSourceIx) { double maf = bds->minorAlleleFreq[freqSourceIx]; if (maf >= minMaf) return TRUE; } return FALSE; } struct linkedFeatures *lfFromBigDbSnp(struct trackDb *tdb, struct bigBedInterval *bb, - struct bigBedFilter *filters, int freqSourceIx, struct bbiFile *bbi) + struct bigBedFilter *filters, int freqSourceIx, struct bbiFile *bbi, struct hash *chainHash) /* Convert one bigDbSnp item to a linkedFeatures for drawing if it passes filter, else NULL. */ { struct linkedFeatures *lf = NULL; char startBuf[16], endBuf[16]; char *bedRow[32]; bigBedIntervalToRow(bb, chromName, startBuf, endBuf, bedRow, ArraySize(bedRow)); if (bigBedFilterInterval(bbi, bedRow, filters)) { struct bigDbSnp *bds = bigDbSnpLoad(bedRow); + char *quickLiftFile = cloneString(trackDbSetting(tdb, "quickLiftUrl")); + if (quickLiftFile) + { + struct bed *bed; + if ((bed = quickLiftIntervalsToBed(bbi, chainHash, bb)) != NULL) + { + bds->chrom = bed->chrom; + bds->chromStart = bed->chromStart; + bds->chromEnd = bed->chromEnd; + } + } double minMaf = cartUsualDoubleClosestToHome(cart, tdb, FALSE, "minMaf", 0.0); if (! filterMaf(bds, freqSourceIx, minMaf)) return NULL; AllocVar(lf); lf->name = cloneString(bds->name); AllocVar(lf->components); lf->start = lf->components->start = bds->chromStart; lf->tallStart = lf->start + bds->shiftBases; lf->tallEnd = lf ->end = lf->components->end = bds->chromEnd; lf->label = bdsLabel(tdb, bds); lf->mouseOver = bdsMouseOver(bds); lf->filterColor = colorFromSoTerm(bds->maxFuncImpact); lf->original = bds; // MNVs in dbSNP are usually linked SNVs; if so, use one sf component for each SNV. if (bds->class == bigDbSnpMnv && bds->chromEnd - bds->chromStart > 2)