be4311c07e14feb728abc6425ee606ffaa611a58 markd Fri Jan 22 06:46:58 2021 -0800 merge with master diff --git src/hg/hgTracks/vcfTrack.c src/hg/hgTracks/vcfTrack.c index 132a41d..15f5dd7 100644 --- src/hg/hgTracks/vcfTrack.c +++ src/hg/hgTracks/vcfTrack.c @@ -1971,31 +1971,31 @@ if (runLength > maxRunLength) { maxRunLength = runLength; maxRunColor = childColors[ix-1]; } if (maxRunLength > (childCount>>1)) return maxRunColor; return defaultCol; } static Color rDrawPhyloTreeInLabelArea(struct phyloTree *node, struct hvGfx *hvg, int x, int yOff, double pxPerHap, MgFont *font, struct hash *highlightSamples, struct hash *sampleColors) /* Recursively draw the tree in the left label area. */ { -const int branchW = 4; +const int branchW = 8; int labelEnd = leftLabelX + leftLabelWidth; Color color = MG_BLACK; if (!sampleColors) { // Misuse the branch length value as RGB color (if it's the typical small number, will still // draw as approximately black): unsigned int rgb = node->ident->length; color = MAKECOLOR_32( ((rgb>>16)&0xff), ((rgb>>8)&0xff), (rgb&0xff) ); } if (node->numEdges > 0) { // Draw each child and a horizontal line to child int minY = -1, maxY = 0; Color childColors[node->numEdges]; int ix; @@ -2141,30 +2141,36 @@ } static void vcfGtHapTreeFileDraw(struct track *tg, int seqStart, int seqEnd, struct hvGfx *hvg, int xOff, int yOff, int width, MgFont *font, Color color, enum trackVisibility vis) /* Draw rows in the same fashion as vcfHapClusterDraw, but instead of clustering, use the * order in which samples appear in the VCF file. */ { struct vcfFile *vcff = tg->extraUiData; enum hapColorMode colorMode; struct seqWindow *gSeqWin; struct txInfo *txiList; if (!vcfHapClusterDrawInit(tg, vcff, hvg, &colorMode, &gSeqWin, &txiList)) return; struct phyloTree *tree = getTreeFromFile(tg->tdb); +if (tree == NULL) + { + warn("No tree in file '%s'", trackDbSetting(tg->tdb, VCF_HAP_METHOD_VAR)); + vcfGtHapFileOrderDraw(tg, seqStart, seqEnd, hvg, xOff, yOff, width, font, color, vis); + return; + } int gtHapCount; unsigned int *leafOrderToHapOrderStart, *leafOrderToHapOrderEnd; unsigned int *gtHapOrder = gtHapOrderFromTree(vcff, tree, &leafOrderToHapOrderStart, &leafOrderToHapOrderEnd, >HapCount); // Figure out rank (vertical position) and depth (horizontal position) of every node in tree: phyloTreeAddNodeCoords(tree, leafOrderToHapOrderStart, leafOrderToHapOrderEnd, 0); int extraPixel = (colorMode == altOnlyMode || colorMode == functionMode) ? 1 : 0; int hapHeight = tg->height - CLIP_PAD - 2*extraPixel; struct hash *highlightSamples = getHighlightSamples(tg->tdb); if (highlightSamples) { double pxPerHap = (double)hapHeight / gtHapCount; rHighlightSampleRows(tree, hvg, yOff+extraPixel, pxPerHap, highlightSamples); }