knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

There is basic functionality for creating legends provided in the gene.alignment.tables package. Here's the baked in example:

library("gene.alignment.tables")
coding_region_legend(data = coding_region_colours)

When using many labels it is advisable to change the font.size argument:

sequence_region_colours <- tribble(
  ~label, ~colour, ~appears.in.hbv.pol, ~appears.in.hbv.s,
  "Reverse transcriptase" , "#ccfecc", TRUE, FALSE,
  "RNAse H" , "#f9fd74", TRUE, FALSE,
  "Spacer" , "#f4b084", TRUE, FALSE,
  "terminal protein" , "#bdd7ee", TRUE, FALSE,
  "Pre-S1" , "#fe6600", FALSE, TRUE,
  "Pre-S2" , "#00b0f0", FALSE, TRUE,
  "S" , "#a9d08e", FALSE, TRUE,
  "Mutation" , "#fc1111", TRUE, TRUE
)

coding_region_legend(data = sequence_region_colours, font.size = 4)


martinjhnhadley/gene.alignment.tables documentation built on June 19, 2022, 11:56 a.m.