- if (is_gene) par(oma = c(0, 0, 3, 0))
-
- for (i in 1:n) {
- vec <- readdepth[[tids[i]]]
- if (is.null(vec)) exit_with_error(paste("Unknown transcript detected,", tids[i], "is not included in RSEM's indices."))
- if (is.na(vec[[2]])) wiggle <- rep(0, vec[[1]]) else wiggle <- as.numeric(unlist(strsplit(vec[[2]], split = " ")))
- len <- length(wiggle)
- if (!show_uniq) {
- plot(wiggle, type = "h")
- } else {
- vec <- readdepth_uniq[[tids[i]]]
- stopifnot(!is.null(vec))
- if (is.na(vec[[2]])) wiggle_uniq <- rep(0, vec[[1]]) else wiggle_uniq <- as.numeric(unlist(strsplit(vec[[2]], split = " ")))
- stopifnot(len == length(wiggle_uniq), len == sum(wiggle >= wiggle_uniq))
- heights <- rbind(wiggle_uniq, wiggle - wiggle_uniq)
- barplot(heights, space = 0, border = NA, names.arg = 1:len, col = c("black", "red"))
- }
- title(main = tids[i]) #, xlab = "Position in transcript", ylab = "Read depth")
- }
+ if (is_composite) par(oma = c(0, 0, 3, 0))
+ sapply(ids, make_a_plot)
+ if (is_composite) mtext(title, outer = TRUE, line = 1)
+}