src/hg/hgTracks/cds.h 1.21
1.21 2009/04/01 01:33:18 angie
Calls to hDnaFromSeq are rather expensive for 2bit, so cache genomic sequence from a single hDnaFromSeq call covering all of a track's items (even the ones that are only partly in the window). Replaced several strncpy/snprintf calls with memcpy because strncpy/snprintf can include strlen(source) which can be large (cached seq), bad news when called in codon inner loop. Also fixed off-by-one error that caused blue insert line to be drawn 1 base to the left of the end of + strand items (thx Brooke).
Index: src/hg/hgTracks/cds.h
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTracks/cds.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -b -B -U 4 -r1.20 -r1.21
--- src/hg/hgTracks/cds.h 19 Mar 2009 22:21:05 -0000 1.20
+++ src/hg/hgTracks/cds.h 1 Apr 2009 01:33:18 -0000 1.21
@@ -92,14 +92,12 @@
* in trackDb/cart, and gate with zoom level. */
struct simpleFeature *baseColorCodonsFromGenePred(struct linkedFeatures *lf,
- struct genePred *gp, boolean useExonFrames, boolean colorStopStart);
+ struct genePred *gp, boolean colorStopStart);
/* Given an lf and the genePred from which the lf was constructed,
* return a list of simpleFeature elements, one per codon (or partial
- * codon if the codon falls on a gap boundary. If useExonFrames is true,
- * use the frames portion of gp (which should be from a genePredExt);
- * otherwise determine frame from genomic sequence. */
+ * codon if the codon falls on a gap boundary. */
struct simpleFeature *baseColorCodonsFromPsl(struct linkedFeatures *lf,
struct psl *psl, int sizeMul, boolean isXeno, int maxShade,
enum baseColorDrawOpt drawOpt, struct track *tg);
@@ -108,15 +106,22 @@
* 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. */
+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. */
+
enum baseColorDrawOpt baseColorDrawSetup(struct hvGfx *hvg, struct track *tg,
struct linkedFeatures *lf,
struct dnaSeq **retMrnaSeq, struct psl **retPsl);
/* Returns the CDS coloring option, allocates colors if necessary, and
* returns the sequence and psl record for the given item if applicable.
* Note: even if base coloring is not enabled, this will return psl and
- * mrna seq if query insert/polyA display is enabled. */
+ * mrna seq if query insert/polyA display is enabled.
+ * baseColorInitTrack must be called before this (in tg->drawItems) --
+ * this is meant to be called by tg->drawItemAt (i.e. linkedFeaturesDrawAt). */
void baseColorDrawItem(struct track *tg, struct linkedFeatures *lf,
int grayIx, struct hvGfx *hvg, int xOff, int y,
double scale, MgFont *font, int s, int e, int heightPer,