src/hg/hgTracks/cds.h 1.23
1.23 2009/11/17 20:17:57 angie
bugfix: don't assume we have linkedFeatures in baseColorInitTrack because this is called for linkedFeaturesSeries too. Use tg->drawItems as a proxy for type (lf vs. lfs). Then the proper range is set and we can replace a slow hDnaFromSeq call with getCachedDna.
Index: src/hg/hgTracks/cds.h
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/cds.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -b -B -U 4 -r1.22 -r1.23
--- src/hg/hgTracks/cds.h 20 May 2009 20:50:52 -0000 1.22
+++ src/hg/hgTracks/cds.h 17 Nov 2009 20:17:57 -0000 1.23
@@ -106,12 +106,25 @@
* codon if the codon falls on a gap boundary. sizeMul, isXeno and maxShade
* are for defaulting to one-simpleFeature-per-exon if cds is not found. */
+INLINE boolean baseColorCanDraw(struct track *tg)
+/* baseColor uses tg->drawItems as a proxy for type of tg->items, which must be
+ * linkedFeatures or linkedFeaturesSeries. Return TRUE if tg->drawItems
+ * implies that tg->items is linkedFeatures or linkedFeaturesSeries, and from
+ * a subtype supported by the baseColor code. */
+{
+return (tg->drawItems == linkedFeaturesDraw || tg->drawItems == linkedFeaturesAverageDense ||
+ tg->drawItems == linkedFeaturesAverageDenseOrientEst ||
+ tg->drawItems == linkedFeaturesSeriesDraw);
+
+}
+
void baseColorInitTrack(struct hvGfx *hvg, struct track *tg);
/* Set up base coloring state (e.g. cache genomic sequence) for tg.
* This must be called by tg->drawItems if baseColorDrawSetup is used
- * in tg->drawItemAt. Assumes tg->items is linkedFeatures. */
+ * in tg->drawItemAt, but note that this should be called only if
+ * baseColorCanDraw(tg) (above). */
enum baseColorDrawOpt baseColorDrawSetup(struct hvGfx *hvg, struct track *tg,
struct linkedFeatures *lf,
struct dnaSeq **retMrnaSeq, struct psl **retPsl);