to_diff | R Documentation |
to_diff()
obtains the difference between exons
from a set of transcripts
to a reference transcript (ref_exons
). This can be useful when visualizing
the differences between transcript structure. to_diff()
expects two sets of
input exons; 1. exons
- exons from any number of transcripts that will be
compared to ref_exons
and 2. ref_exons
- exons from a single transcript
which acts as the reference to compare against.
to_diff(exons, ref_exons, group_var = NULL)
exons |
|
ref_exons |
|
group_var |
|
data.frame()
details the differences between exons
and
ref_exons
.
library(magrittr)
library(ggplot2)
# to illustrate the package's functionality
# ggtranscript includes example transcript annotation
sod1_annotation %>% head()
# extract exons
sod1_exons <- sod1_annotation %>% dplyr::filter(type == "exon")
sod1_exons %>% head()
# for this example, let's compare transcripts to the MANE-select transcript
sod1_mane <- sod1_exons %>% dplyr::filter(transcript_name == "SOD1-201")
sod1_not_mane <- sod1_exons %>% dplyr::filter(transcript_name != "SOD1-201")
# to_diff() obtains the differences between the exons as ranges
sod1_diffs <- to_diff(
exons = sod1_not_mane,
ref_exons = sod1_mane,
group_var = "transcript_name"
)
sod1_diffs %>% head()
# using geom_range(), it can be useful to visually overlay
# the differences on top of the transcript annotation
sod1_exons %>%
ggplot(aes(
xstart = start,
xend = end,
y = transcript_name
)) +
geom_range() +
geom_intron(
data = to_intron(sod1_exons, "transcript_name")
) +
geom_range(
data = sod1_diffs,
ggplot2::aes(fill = diff_type),
alpha = 0.2
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.