... | ... |
@@ -214,12 +214,6 @@ setMethod("plot_region", |
214 | 214 |
line_size |
215 | 215 |
) { |
216 | 216 |
sample_anno <- samples(x) |
217 |
- exons_anno <- query_exons_region( |
|
218 |
- exons(x), |
|
219 |
- chr = chr, |
|
220 |
- start = start, |
|
221 |
- end = end |
|
222 |
- ) |
|
223 | 217 |
|
224 | 218 |
if (length(window_prop) == 1) { |
225 | 219 |
window_prop <- c(window_prop, window_prop) |
... | ... |
@@ -267,18 +261,30 @@ setMethod("plot_region", |
267 | 261 |
) + |
268 | 262 |
ggplot2::scale_x_continuous(labels = scales::label_number(scale_cut = scales::cut_si("b"))) |
269 | 263 |
|
270 |
- p2 <- plot_gene_annotation(exons_anno, xlim[1], xlim[2]) + |
|
271 |
- ggplot2::coord_cartesian( |
|
272 |
- xlim = xlim, |
|
273 |
- expand = FALSE |
|
274 |
- ) + |
|
275 |
- ggplot2::scale_x_continuous(labels = scales::label_number(scale_cut = scales::cut_si("b"))) |
|
264 |
+ p_out <- p1 |
|
276 | 265 |
|
277 |
- anno_height <- attr(p2, "plot_height") |
|
266 |
+ # if exon anno exists |
|
267 |
+ if (nrow(exons(x)) != 0) { |
|
268 |
+ exons_anno <- query_exons_region( |
|
269 |
+ exons(x), |
|
270 |
+ chr = chr, |
|
271 |
+ start = start, |
|
272 |
+ end = end |
|
273 |
+ ) |
|
274 |
+ |
|
275 |
+ p2 <- plot_gene_annotation(exons_anno, xlim[1], xlim[2]) + |
|
276 |
+ ggplot2::coord_cartesian( |
|
277 |
+ xlim = xlim, |
|
278 |
+ expand = FALSE |
|
279 |
+ ) + |
|
280 |
+ ggplot2::scale_x_continuous(labels = scales::label_number(scale_cut = scales::cut_si("b"))) |
|
281 |
+ anno_height <- attr(p2, "plot_height") |
|
278 | 282 |
|
279 |
- heights <- c(1, 0.075 * anno_height) |
|
280 |
- p_out <- p1 / p2 + patchwork::plot_layout(heights = heights) |
|
283 |
+ heights <- c(1, 0.075 * anno_height) |
|
284 |
+ p_out <- p1 / p2 + patchwork::plot_layout(heights = heights) |
|
285 |
+ } |
|
281 | 286 |
|
287 |
+ # if heatmap requested |
|
282 | 288 |
if (heatmap) { |
283 | 289 |
p_heatmap <- plot_region_heatmap(x, chr, start, end, window_prop = window_prop) + |
284 | 290 |
ggplot2::coord_cartesian( |