251299d12265bc22ef7c540884208974d36271de chmalee Thu Dec 1 11:22:04 2022 -0800 Allow hash char in boxplot category names for barChar tracks, refs #30347 diff --git src/hg/hgc/hgcData/barChartBoxplot.R src/hg/hgc/hgcData/barChartBoxplot.R index 1ed5a3e..bd6dafd 100644 --- src/hg/hgc/hgcData/barChartBoxplot.R +++ src/hg/hgc/hgcData/barChartBoxplot.R @@ -126,35 +126,35 @@ colorFile <- args[3] dataFile <- args[4] outFile <- args[5] name2 <- args[6] # this argument can be used by QA to check if the new fonts look very different from the old fonts # see #22838 useOldFonts <- (!is.na(args[7]) && args[7]=="1") if (!useOldFonts && require("showtext",character.only=TRUE, quietly=TRUE)) { library(showtext, quietly=TRUE) showtext_auto() showtext_opts(dpi = 72) } # read colors file -colorDf = read.table(colorFile, sep="\t", header=TRUE) +colorDf = read.table(colorFile, sep="\t", header=TRUE, comment.char="") colorsHex <- paste("#",as.character(as.hexmode(colorDf$color)), sep="") # order categories as in colors file -df <- read.table(dataFile, sep="\t", header=TRUE) +df <- read.table(dataFile, sep="\t", header=TRUE, comment.char="") # ensure colors df and data df have consistent spacing: colorDf$category <- gsub("_", " ", colorDf$category) df$category <- gsub("_", " ", df$category) df$category <- ordered(df$category, levels=colorDf$category) labels <- names(table(df$category)) count <- length(labels) # draw graph # adjust X label height based on length of labels # TODO: scale by number of categories ? if (count < DENSECUTOFF) { png(file=outFile, width=1070, height=600) } else { png(file=outFile, width=1070, height=18*count) }