ggcoverage icon indicating copy to clipboard operation
ggcoverage copied to clipboard

gene.name="" and gene.name="Ensembl ID" fail

Open ijhoskins opened this issue 11 months ago • 1 comments

geom_transcript fails when gene.name="" or gene.name is an Ensembl ID, even when passing gene.name.type="gene_id" to LoadTrackFile.

Error in if (nrow(data)) {: argument is of length zero
Traceback:

1. add_ggplot(e1, e2, e2name)
2. ggplot_add(object, p, objectname)
3. ggplot_add.transcript(object, p, objectname)
4. geom_arrows(gene.tx.df.exon, color.by, exon.size, arrow.length, 
 .     arrow.angle, arrow.type)
5. .handleSimpleError(function (cnd) 
 . {
 .     watcher$capture_plot_and_output()
 .     cnd <- sanitize_call(cnd)
 .     watcher$push(cnd)
 .     switch(on_error, continue = invokeRestart("eval_continue"), 
 .         stop = invokeRestart("eval_stop"), error = invokeRestart("eval_error", 
 .             cnd))
 . }, "argument is of length zero", base::quote(if (nrow(data)) {
 .     if (!"strand" %in% colnames(data)) {
 .         data$strand <- "+"
 .     }
 .     geom_segment(inherit.aes = TRUE, data = data, mapping = aes(x = .data[["start"]], 
 .         y = .data[["group"]], xend = .data[["end"]], yend = .data[["group"]], 
 .         color = .data[[color]]), arrow = arrow(ends = ifelse(data$strand == 
 .         "+", "last", "first"), angle = arrow_angle, length = unit(arrow_size, 
 .         "points"), type = arrow_type), lineend = "butt", linejoin = "mitre", 
 .         show.legend = FALSE, linewidth = line_width)
 . }))

It would be nice if ggcoverage supported genes that have no gene symbol.

ijhoskins avatar Jan 22 '25 04:01 ijhoskins

As for all the issues you opened, can you paste the code that led to the respective error messages? Ideally a reproducible example -- if this problem can not be reproduced without having your specific data I'm afraid it's difficult to do something about it.

m-jahn avatar Jan 22 '25 08:01 m-jahn