This example demonstrates how to use gggenomes to compare the genomic architecture of six viral genomes using the built-in example data. It showcases the use of gggenomes() to initialize the plot, sync() to align genome directions, and various geom_* functions to layer genes, sequences, links, and features.
Note: To use the example data, run data(package="gggenomes") after loading the library.
library(gggenomes)
# to inspect the example data shipped with gggenomes
data(package="gggenomes")
gggenomes(
genes = emale_genes, seqs = emale_seqs, links = emale_ava,
feats = list(emale_tirs, ngaros=emale_ngaros, gc=emale_gc)) |>
add_sublinks(emale_prot_ava) |>
sync() + # synchronize genome directions based on links
geom_feat(position="identity", size=6) +
geom_seq() +
geom_link(data=links(2)) +
geom_bin_label() +
geom_gene(aes(fill=name)) +
geom_gene_tag(aes(label=name), nudge_y=0.1, check_overlap = TRUE) +
geom_feat(data=feats(ngaros), alpha=.3, size=10, position="identity") +
geom_feat_note(aes(label="Ngaro-transposon"), data=feats(ngaros),
nudge_y=.1, vjust=0) +
geom_wiggle(aes(z=score, linetype="GC-content"), feats(gc),
fill="lavenderblush4", position=position_nudge(y=-.2), height = .2) +
scale_fill_brewer("Genes", palette="Dark2", na.value="cornsilk3")
ggsave("emales.png", width=8, height=4)