geom_seq() draws contigs for each sequence/chromosome supplied in the
Several sequences belonging to the same bin will be plotted next to one another.
seqs track is empty, sequences are inferred from the
links track respectively.
(The length of sequences can be deduced from the axis and is typically indicated in base pairs.)
geom_seq(mapping = NULL, data = seqs(), arrow = NULL, ...)
Set of aesthetic mappings created by
aes(). If specified and
inherit.aes = TRUE (the default), it is combined with the default mapping
at the top level of the plot. You must supply
mapping if there is no plot
seq_layout: Uses the first data frame stored in the
seqs track, by default.
set to non-NULL to generate default arrows
Other arguments passed on to
layer(). These are
often aesthetics, used to set an aesthetic to a fixed value, like
colour = "red" or
size = 3. They may also be parameters
to the paired geom/stat.
Sequence data drawn as contigs is added as a layer/component to the plot.
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.
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!
# 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 #> No seqs provided, inferring seqs from feats # 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 |> filter(seq_id != "Cflag_017B") |> arrange(seq_id) #`arrange` to restore alphabetical order. #> Error in arrange(filter(emale_seqs, seq_id != "Cflag_017B"), seq_id): could not find function "arrange" 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 #> Error in eval(expr, envir, enclos): object 'missing_seqs' not found # 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