geom_gene_arrow: A 'ggplot2' geom to draw genes as arrows

Description Usage Arguments Details Aesthetics See Also Examples

View source: R/geom_gene_arrow.R

Description

'geom_gene_arrow' draws genes as arrows, allowing gene maps to be drawn.

Usage

1
2
3
4
5
geom_gene_arrow(mapping = NULL, data = NULL, stat = "identity",
  position = "identity", na.rm = FALSE, show.legend = NA,
  inherit.aes = TRUE, arrowhead_width = grid::unit(4, "mm"),
  arrowhead_height = grid::unit(4, "mm"), arrow_body_height = grid::unit(3,
  "mm"), ...)

Arguments

mapping, data, stat, position, na.rm, show.legend, inherit.aes, ...

As standard for ggplot2.

arrowhead_width

grid::unit object giving the width of the arrowhead. Defaults to 4 mm. If the gene is drawn smaller than this width, only the arrowhead will be drawn, compressed to the length of the gene.

arrowhead_height

grid::unit object giving the height of the arrowhead. Defaults to 4 mm.

arrow_body_height

grid::unit object giving the height of the body of the arrow. Defaults to 3 mm.

Details

This geom draws genes arranged along a horizontal 'string' representing the molecule. The start and end positions of the gene are expressed with the 'xmin' and 'xmax' aesthetics, while the molecule can be specified with the 'y' aesthetic.

Unless the plot is faceted with a free x scale, all the molecules will share a common x-axis. This means that if the genes are in very different numerical positions, they might appear very small and squished together. To get around this, either facet the plot with 'scales = "free_x"', or normalise the gene positions if their exact positions are not important.

See 'make_alignment_dummies' for a method to align genes between molecules.

Aesthetics

See Also

theme_genes, make_alignment_dummies

Examples

1
2
3
4
ggplot2::ggplot(example_genes, ggplot2::aes(xmin = start, xmax = end,
                                            y = molecule, fill = gene)) +
geom_gene_arrow() +
ggplot2::facet_wrap(~ molecule, scales = "free")

YTLogos/gggenes documentation built on May 19, 2019, 4:04 p.m.