library(ggplot2)
set.seed(3)
N = 30
# Create sample base exon components
starts = sample(1:10000, size = N, replace = TRUE)
sample.df <- data.frame(start = starts,
end = starts + sample(100:500, size = N),
stepping = 1,
type = sample(c("cds", "utr", "gap"),
size = N, replace = TRUE))
# Create sample highlighted exon components
N = 5
starts = sample(1:10000, size = N, replace = TRUE)
sample.sub <- data.frame(start = starts,
end = starts + sample(100:500, size = N),
stepping = 1,
type = sample(c("cds", "utr", "gap"),
size = N, replace = TRUE))
# Using an aes function which evaluates arguments locally without parsing
aesCst <- function(...) {
structure(list(...), class = "uneval")
}
step1 <-ggplot() +
geom_abline(intercept = 1, slope = 0,
aes(xmin = -1, xmax = 1, ymin = 0.5, ymax = 1.5),
color = "dark grey")
step2 <- plotExonRect(plt = step1, component = "cds", comp.df = sample.df,
filt.by.comp = TRUE, size = 0.4, subset.df = sample.sub,
aesCst = aesCst)
plotExonRect(plt = step2, component = "utr", comp.df = sample.df,
filt.by.comp = TRUE, size = 0.15, subset.df = sample.sub,
aesCst = aesCst)
Run the code above in your browser using DataLab