5be304c4bdd41bd4452a4b9f1b8fcf37930079e4 braney Fri Feb 3 11:09:59 2017 -0800 allow arbitrary fields with a bigBed file to be used for labels. #18782 diff --git src/hg/hgTracks/hgTracks.h src/hg/hgTracks/hgTracks.h index 2f3f600..abc0821 100644 --- src/hg/hgTracks/hgTracks.h +++ src/hg/hgTracks/hgTracks.h @@ -267,30 +267,32 @@ struct track *nextWindow; /* Same track in next window's track list. */ struct track *prevWindow; /* Same track in prev window's track list. */ // Fixed-width non-proportional tracks void (*nonPropDrawItemAt)(struct track *tg, void *item, struct hvGfx *hvg, int xOff, int yOff, double scale, MgFont *font, Color color, enum trackVisibility vis); /* Draw a single Non-proportional fixed-width item. Such as gtexGene. * This is method is optional, but if it's here * then you can plug in genericDrawItems into the drawItems, * which takes care of all sorts of things including packing. */ int (*nonPropPixelWidth)(struct track *tg, void *item); /* Return the width in pixels of the non-proportional part of track, e.g. gtexGene graphic */ + + struct slInt *labelColumns; /* The columns in a bigBed that can be used for labels. */ }; struct window // window in multiwindow image { struct window *next; // Next on list. // These two were experimental and will be removed soon: char *organism; /* Name of organism */ char *database; /* Name of database */ char *chromName; int winStart; // in bases int winEnd; int insideX; // in pixels int insideWidth; @@ -371,30 +373,31 @@ struct simpleFeature *components; /* List of component simple features. */ struct simpleFeature *codons; /* If zoomed to CDS or codon level.*/ void *extra; /* Extra info that varies with type. */ void *original; /* The structure that was converted into this (when needed later). */ struct itemAttr *itemAttr; /* itemAttr object for this lf, or NULL */ unsigned highlightColor; /* highlight color,0 if no highlight */ enum highlightMode highlightMode; /* highlight mode,0 if no highlight */ char* mouseOver; /* mouse over text */ char* cds; /* CDS in NCBI format */ #ifdef USE_HAL boolean isHalSnake; struct hal_target_dupe_list_t *dupeList; #endif boolean isBigGenePred; + char *label; /* Label for bigBeds. */ }; struct linkedFeaturesSeries /* series of linked features that are comprised of multiple linked features */ { struct linkedFeaturesSeries *next; char *name; /* name for series of linked features */ int start, end; /* Start/end in browser coordinates. */ int orientation; /* Orientation. */ int grayIx; /* Gray index (average of features) */ boolean noLine; /* if true don't draw line connecting features */ struct linkedFeatures *features; /* linked features for a series */ }; struct knownGenesExtra @@ -813,30 +816,39 @@ /* Return list of intervals in range. */ #define bigBedSelectRange(track, chrom, start, end, lm) \ bigBedSelectRangeExt(track, chrom,start, end, lm, min(BIGBEDMAXIMUMITEMS, maximumTrackItems(track))) /* Return list of intervals in range. */ void bigBedAddLinkedFeaturesFromExt(struct track *track, char *chrom, int start, int end, int scoreMin, int scoreMax, boolean useItemRgb, int fieldCount, struct linkedFeatures **pLfList, int maxItems); /* Read in items in chrom:start-end from bigBed file named in track->bbiFileName, convert * them to linkedFeatures, and add to head of list. */ #define bigBedAddLinkedFeaturesFrom(track, chrom, start, end, scoreMin, scoreMax, useItemRgb, fieldCount, pLfList) \ bigBedAddLinkedFeaturesFromExt(track, chrom, start, end, scoreMin, scoreMax, useItemRgb, fieldCount, pLfList, min(BIGBEDMAXIMUMITEMS, maximumTrackItems(track))) +char *bigBedItemName(struct track *tg, void *item) ; +// return label for simple beds + +char *bigLfItemName(struct track *tg, void *item); +// return label for linked features + +char *makeLabel(struct track *track, struct bigBedInterval *bb); +// Build a label for a bigBedTrack from the requested label fields. +// boolean canDrawBigBedDense(struct track *tg); /* Return TRUE if conditions are such that can do the fast bigBed dense data fetch and * draw. */ void bigBedDrawDense(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, MgFont *font, Color color); /* Use big-bed summary data to quickly draw bigBed. */ void adjustBedScoreGrayLevel(struct trackDb *tdb, struct bed *bed, int scoreMin, int scoreMax); /* For each distinct trackName passed in, check cart for trackName.minGrayLevel; if * that is different from the gray level implied by scoreMin's place in [0..scoreMax], * then linearly transform bed->score from the range of [scoreMin,scoreMax] to * [(cartMinGrayLevel*scoreMax)/maxShade,scoreMax]. * Note: this assumes that scoreMin and scoreMax are constant for each track. */