00a63be1c7c3882e289245feb4418ced6e75741a braney Tue Feb 22 16:40:20 2011 -0800 a comment from Angie's code review that I'll implement when I move to get BAM's to display as wigs automagically. Also, a change to the bamWig predraw array that is still not right. :( diff --git src/hg/hgTracks/bamTrack.c src/hg/hgTracks/bamTrack.c index 4fd5de0..4b5b011 100644 --- src/hg/hgTracks/bamTrack.c +++ src/hg/hgTracks/bamTrack.c @@ -773,30 +773,35 @@ track->colorShades = shadesOfGray; } struct bamWigTrackData { struct preDrawElement *preDraw; double scale; int width; int preDrawZero; }; static void bamWigLoadItems(struct track *tg) { /* Figure out bigWig file name. */ struct sqlConnection *conn = hAllocConnTrack(database, tg->tdb); +/* this should call bamFileNameFromTable with logic from bamLoadItemsCore to + * check the bigDataUrl setting. Fix this if bamWigs end up being + * a supported type. It may be that this code gets rolled into + * normal BAM display... since that's the plan ;-). + */ char *fileName = bbiNameFromSettingOrTable(tg->tdb, conn, tg->table); tg->customPt = fileName; hFreeConn(&conn); } static int countBam(const bam1_t *bam, void *data) /* bam_fetch() calls this on each bam alignment retrieved. */ { struct bamWigTrackData *btd = (struct bamWigTrackData *)data; const bam1_core_t *core = &bam->core; int tLength=0, tPos = core->pos, qPos = 0; unsigned int *cigar = bam1_cigar(bam); int i; double scale = btd->scale; @@ -856,32 +861,32 @@ char posForBam[512]; safef(posForBam, sizeof(posForBam), "%s:%d-%d", chromName, winStart, winEnd); char *fileName = tg->customPt; tg->customPt = NULL; bamFetch(fileName, posForBam, countBam, bwData, NULL); /* fill in rest of predraw */ int i; for (i=0; ipreDraw[i + preDrawZero]; pe->min = pe->count; pe->max = pe->count; - pe->sumData = pe->count; - pe->sumSquares = pe->count * pe->count; + pe->sumData = pe->count / scale; + pe->sumSquares = (pe->count * pe->count)/scale; } AllocVar(preDrawList); preDrawList->preDraw = bwData->preDraw; /* Call actual graphing routine. */ wigDrawPredraw(tg, seqStart, seqEnd, hvg, xOff, yOff, width, font, color, vis, preDrawList, preDrawZero, preDrawSize, &tg->graphUpperLimit, &tg->graphLowerLimit); } void bamWigMethods(struct track *track, struct trackDb *tdb, int wordCount, char *words[]) /* Set up bamWig methods. */ { bedGraphMethods(track, tdb, wordCount, words);