Description Usage Arguments Value Examples
Modify a Ranges object
1 2 |
.data |
a |
... |
Pairs of name-value expressions. The name-value pairs can either create new metadata columns or modify existing ones. |
a Ranges object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | df <- data.frame(start = 1:10,
width = 5,
seqnames = "seq1",
strand = sample(c("+", "-", "*"), 10, replace = TRUE),
gc = runif(10))
rng <- as_granges(df)
# mutate adds new columns
rng %>%
mutate(avg_gc = mean(gc), row_id = 1:n())
# can also compute on newly created columns
rng %>%
mutate(score = gc * width, score2 = score + 1)
# group by partitions the data and computes within each group
rng %>%
group_by(strand) %>%
mutate(avg_gc = mean(gc), row_id = 1:n())
# mutate can be used in conjuction with anchoring to resize ranges
rng %>%
mutate(width = 10)
# by default width modfication fixes by start
rng %>%
anchor_start() %>%
mutate(width = 10)
# fix by end or midpoint
rng %>%
anchor_end() %>%
mutate(width = width + 1)
rng %>%
anchor_center() %>%
mutate(width = width + 1)
# anchoring by strand
rng %>%
anchor_3p() %>%
mutate(width = width * 2)
rng %>%
anchor_5p() %>%
mutate(width = width * 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.