Closed jrcodina closed 2 years ago
@jrcodina96 Thanks for reporting, I will take a look
@jrcodina96 Please install the latest version from GitHub and retry.
The example code shows this bug shall be fixed.
library(sigminer)
load(system.file("extdata", "toy_copynumber.RData",
package = "sigminer", mustWork = TRUE
))
cn2 = cn
cn2@annotation = cn2@annotation[!endsWith(cn2@annotation$location, "pq")]
# Plot distribution
show_cn_distribution(cn2, mode = "cd", scale_chr = FALSE)
show_cn_distribution(cn2, mode = "cd")
show_cn_distribution(cn2, mode = "cd", fill = TRUE)
# It shall work for three types
show_cn_distribution(cn, mode = "cd")
show_cn_distribution(cn, mode = "cd", fill = TRUE)
# Also should work for just one type
cn3 = cn
cn3@annotation = cn3@annotation[endsWith(cn3@annotation$location, "p")]
show_cn_distribution(cn3, mode = "cd")
show_cn_distribution(cn3, mode = "cd", fill = TRUE)
This fixes the bug. I have tried your example and my dataset and works fine with both. Thank you!
@jrcodina96 Great, thanks to your report and contribution on this issue.
In line 40 of the function:
I believe the chromosome number is lost when you create the object "q" :
After this, the "q$x" is treated as the chromosome number but it isn't. To obtain the chromosome number, you can take it from:
(ggplot_build(p)$plot[[1]][,"chromosome"]
I would propose the following correction, but there might be an easier one.
In this same function, I also found that when plotting through
The labels are static. In my data set there is no "pq", however, since the labels are always
labels = c("p", "pq", "q")
it will plot my barplot with labels "p" and "pq" instead of the real value that should be "p" and "q".I am not sure how could I change that.
These problems disappear when you run the function without
scale_chr = T
.