Skip to content

Bug in ggEvidencePlot() function #3

@pawelqs

Description

@pawelqs

Hi January!

I have been using your package for a quite long time and I found a bug in the new (ggplot) implementation of the evidence plot. Here's the reprex:

library(tmod)
library(tibble)

genesets <- tribble(
  ~gene_symbol, ~geneset,
  "gene1", "diseaseA",
  "gene2", "diseaseA",
  "gene3", "diseaseA",
  "gene4", "diseaseB",
  "gene5", "diseaseB",
  "gene6", "diseaseB",
  "gene7", "diseaseC",
  "gene8", "diseaseC",
  "gene9", "diseaseC",
  "gene10", "diseaseC"
)

tmod_db <- tmod::makeTmodFromDataFrame(
  genesets,
  feature_col = "gene_symbol",
  module_col = "geneset",
  title_col = "geneset"
)

ranked_genes <- paste0("gene", 1:10)res <- tmod::tmodCERNOtest(ranked_genes, mset = tmod_db, qval = 1)

# Function with bug
tmod::ggEvidencePlot(
  ranked_genes,
  m = c("diseaseA", "diseaseB"),
  mset = tmod_db,
  gene.labels = FALSE
)

# Old implementation is correct
tmod::evidencePlot(
  ranked_genes,
  m = c("diseaseA", "diseaseB"), 
  mset = tmod_db, 
  gene.labels = FALSE
)  

Plots:
ggplot version:

Image

original version:

Image

The curves are incorrect in the ggplot version. Is it easy to fix?

Also, there's a warning from the ggplot:

Warning message:
In geom_segment(aes(x = 0, y = 0, xend = length(l_orig), yend = 1),  :
  All aesthetics have length 1, but the data has 16 rows.
ℹ Please consider using `annotate()` or provide this layer with data containing a single row.

Best wishes,
Paweł

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions