Skip to content

Commit 54630b8

Browse files
committed
feat: geom_aggrcoverage (2)
1 parent d0c89d4 commit 54630b8

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

R/geoms.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
#' @name geom_aggrcoverage
88
#' @rdname geom_aggrcoverage
99
#'
10+
#' @param mapping mapping
11+
#' @param data data
12+
#' @param ... ...
13+
#' @param ci ci
14+
#' @param na.rm na.rm
15+
#' @param show.legend show.legend
16+
#' @param inherit.aes inherit.aes
1017
#' @return A `ggplot` object`
1118
#'
1219
#' @import ggplot2
@@ -15,6 +22,7 @@
1522
#' library(rtracklayer)
1623
#' library(plyranges)
1724
#' library(ggplot2)
25+
#' library(purrr)
1826
#' TSSs_bed <- system.file("extdata", "TSSs.bed", package = "tidyCoverage")
1927
#' features <- list(
2028
#' TSS_fwd = import(TSSs_bed) |> filter(strand == '+'),

R/globals.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
utils::globalVariables(c(
22
".",
3+
"ci_low",
4+
"ci_high",
35
"coord",
46
"feature",
57
".feature",

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ CE |>
5252
filter(track %in% c('MNase', 'PolII')) |>
5353
filter(features == 'TSSs') |>
5454
aggregate() |>
55-
ggplot(aes(x = coord, y = mean, ymin = ci_low, ymax = ci_high, fill = track, col = track)) +
56-
geom_ribbon(aes(ymin = ci_low, ymax = ci_high, fill = track), alpha = 0.2) +
57-
geom_line(aes(col = track)) +
55+
ggplot() +
56+
geom_aggrcoverage(aes(col = track)) +
5857
facet_grid(track ~ ., scales = "free") +
5958
labs(x = 'Distance from TSS', y = 'Signal coverage') +
6059
theme_bw() +
@@ -68,8 +67,8 @@ CE |>
6867
```r
6968
CoverageExperiment(tracks, GRanges("II:450001-455000")) |>
7069
expand() |>
71-
ggplot(aes(x = coord, y = coverage)) +
72-
geom_col(aes(fill = track, col = track)) +
70+
ggplot() +
71+
geom_aggrcoverage(aes(col = track)) +
7372
facet_grid(track~., scales = 'free') +
7473
scale_x_continuous(expand = c(0, 0)) +
7574
theme_bw() +

man/geom_aggrcoverage.Rd

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/tidyCoverage.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ AC |>
417417
facet_grid(features ~ .)
418418
```
419419

420-
Nearly there, few cosmethic changes and we are done!
420+
Nearly there, few cosmetic changes and we are done!
421421

422422
```{r}
423423
AC |>

0 commit comments

Comments
 (0)