Skip to content

Commit

Permalink
feat: geom_aggrcoverage (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
js2264 committed Jul 11, 2024
1 parent d0c89d4 commit 54630b8
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
8 changes: 8 additions & 0 deletions R/geoms.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
#' @name geom_aggrcoverage
#' @rdname geom_aggrcoverage
#'
#' @param mapping mapping
#' @param data data
#' @param ... ...
#' @param ci ci
#' @param na.rm na.rm
#' @param show.legend show.legend
#' @param inherit.aes inherit.aes
#' @return A `ggplot` object`
#'
#' @import ggplot2
Expand All @@ -15,6 +22,7 @@
#' library(rtracklayer)
#' library(plyranges)
#' library(ggplot2)
#' library(purrr)
#' TSSs_bed <- system.file("extdata", "TSSs.bed", package = "tidyCoverage")
#' features <- list(
#' TSS_fwd = import(TSSs_bed) |> filter(strand == '+'),
Expand Down
2 changes: 2 additions & 0 deletions R/globals.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
utils::globalVariables(c(
".",
"ci_low",
"ci_high",
"coord",
"feature",
".feature",
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ CE |>
filter(track %in% c('MNase', 'PolII')) |>
filter(features == 'TSSs') |>
aggregate() |>
ggplot(aes(x = coord, y = mean, ymin = ci_low, ymax = ci_high, fill = track, col = track)) +
geom_ribbon(aes(ymin = ci_low, ymax = ci_high, fill = track), alpha = 0.2) +
geom_line(aes(col = track)) +
ggplot() +
geom_aggrcoverage(aes(col = track)) +
facet_grid(track ~ ., scales = "free") +
labs(x = 'Distance from TSS', y = 'Signal coverage') +
theme_bw() +
Expand All @@ -68,8 +67,8 @@ CE |>
```r
CoverageExperiment(tracks, GRanges("II:450001-455000")) |>
expand() |>
ggplot(aes(x = coord, y = coverage)) +
geom_col(aes(fill = track, col = track)) +
ggplot() +
geom_aggrcoverage(aes(col = track)) +
facet_grid(track~., scales = 'free') +
scale_x_continuous(expand = c(0, 0)) +
theme_bw() +
Expand Down
16 changes: 16 additions & 0 deletions man/geom_aggrcoverage.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vignettes/tidyCoverage.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ AC |>
facet_grid(features ~ .)
```

Nearly there, few cosmethic changes and we are done!
Nearly there, few cosmetic changes and we are done!

```{r}
AC |>
Expand Down

0 comments on commit 54630b8

Please sign in to comment.