geom_seq {gggenomes} | R Documentation |
draw seqs
Description
geom_seq()
draws contigs for each sequence/chromosome supplied in the seqs
track.
Several sequences belonging to the same bin will be plotted next to one another.
If seqs
track is empty, sequences are inferred from the feats
or links
track respectively.
(The length of sequences can be deduced from the axis and is typically indicated in base pairs.)
Usage
geom_seq(mapping = NULL, data = seqs(), arrow = NULL, ...)
Arguments
mapping |
Set of aesthetic mappings created by |
data |
seq_layout: Uses the first data frame stored in the |
arrow |
set to non-NULL to generate default arrows |
... |
Other arguments passed on to
|
Details
geom_seq()
uses ggplot2::geom_segment()
under the hood. As a result,
different aesthetics such as alpha, linewidth, color, etc.
can be called upon to modify the visualization of the data.
Note: The seqs
track indicates the length/region of the sequence/contigs that will be plotted.
Feats or links data that falls outside of this region are ignored!
Value
Sequence data drawn as contigs is added as a layer/component to the plot.
Examples
# Simple example of geom_seq
gggenomes(seqs = emale_seqs) +
geom_seq() + # creates contigs
geom_bin_label() # labels bins/sequences
# No sequence information supplied, will inform/warn that seqs are inferred from feats.
gggenomes(genes = emale_genes) +
geom_seq() + # creates contigs
geom_gene() + # draws genes on top of contigs
geom_bin_label() # labels bins/sequences
# Sequence data controls what sequences and/or regions will be plotted.
# Here one sequence is filtered out, Notice that the genes of the removed
# sequence are silently ignored and thus not plotted.
missing_seqs <- emale_seqs |>
dplyr::filter(seq_id != "Cflag_017B") |>
dplyr::arrange(seq_id) # `arrange` to restore alphabetical order.
gggenomes(seqs = missing_seqs, genes = emale_genes) +
geom_seq() + # creates contigs
geom_gene() + # draws genes on top of contigs
geom_bin_label() # labels bins/sequences
# Several sequences belonging to the same *bin* are plotted next to one another
seqs <- tibble::tibble(
bin_id = c("A", "A", "A", "B", "B", "B", "B", "C", "C"),
seq_id = c("A1", "A2", "A3", "B1", "B2", "B3", "B4", "C1", "C2"),
start = c(0, 100, 200, 0, 50, 150, 250, 0, 400),
end = c(100, 200, 400, 50, 100, 250, 300, 300, 500),
length = c(100, 100, 200, 50, 50, 100, 50, 300, 100)
)
gggenomes(seqs = seqs) +
geom_seq() +
geom_bin_label() + # label bins
geom_seq_label() # label individual sequences
# Wrap bins uptill a certain amount.
gggenomes(seqs = seqs, wrap = 300) +
geom_seq() +
geom_bin_label() + # label bins
geom_seq_label() # label individual sequences
# Change the space between sequences belonging to one bin
gggenomes(seqs = seqs, spacing = 100) +
geom_seq() +
geom_bin_label() + # label bins
geom_seq_label() # label individual sequences