Color Schemes and Font Families

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

 protein_sequences <- system.file("extdata", "sample.fasta", package = "ggmsa")
 miRNA_sequences <- system.file("extdata", "seedSample.fa", package = "ggmsa")
 nt_sequences <- system.file("extdata", "LeaderRepeat_All.fa", package = "ggmsa")

library(ggmsa)
library(ggplot2)

Colour Schemes

Several classic color schemes for MSA are shipped in the package. In the same ways, you can use available_volor() to list color schemes currently available. Note that Amino acids and nucleotides have different color schemes.

knitr::include_graphics("../man/figures/schemes.png")

Clustal X Colour Scheme

This is an emulation of the default colors cheme used for alignments in Clustal X, a graphical interface for the ClustalW multiple sequence alignment program. Each residue in the alignment is assigned a color if the amino acid profile of the alignment at that position meets some minimum criteria specific for the residue type.

ggmsa(protein_sequences, start = 320, end = 360, color = "Clustal", show.legend = TRUE)

Color by Chemistry(Default)

Amino acids are colored according to their side-chain chemistry:

ggmsa(protein_sequences, start = 320, end = 360, color = "Chemistry_AA", show.legend = TRUE)

Color by Shapely

This color scheme matches the RasMol amino acid and RasMol nucleotide color schemes, which are, in turn, based on Robert Fletterickā€™s "Shapely models".

ggmsa(protein_sequences, start = 320, end = 360, color = "Shapely_AA", show.legend = TRUE)

Color by Taylor

This color scheme is taken from Taylor and is also used in JalView.

ggmsa(protein_sequences, start = 320, end = 360, color = "Taylor_AA", show.legend = TRUE)

Color by Zappo

This scheme colors residues according to their physicochemical properties, and is also used in JalView.

ggmsa(protein_sequences, start = 320, end = 360, color = "Zappo_AA", show.legend = TRUE)

Color by LETTER

Thanks to ShixiangWang for the color scheme suggestions.

https://en.wikipedia.org/wiki/Help:Distinguishable_colors

ggmsa(protein_sequences, start = 320, end = 360, color = "LETTER", show.legend = TRUE)

Color Customzation

Customizing the color scheme is allowed. Users can create a data frame with two columns named names and color. This data frame includes symbols of character and coloring code (see below).

library(RColorBrewer)
library(pals)
protein_sequences <- system.file("extdata", "sample.fasta", package = "ggmsa")
my_pal <- colorRampPalette(rev(brewer.pal(n = 9, name = "Reds")))
my_cutstom <- data.frame(names = c(LETTERS[1:26],"-"), 
                         color = my_pal(27), 
                         stringsAsFactors = F)
head(my_cutstom)
pals::pal.bands(my_cutstom$color)
ggmsa(protein_sequences, 300, 345, 
      custom_color = my_cutstom, 
      char_width = 0.5, 
      border = "white",
      show.legend = TRUE)

Font Families

Several classic font fors MSA are shipped in the package. In the same ways, you can use available_fonts() to list font currently available

 available_fonts()
ggmsa(protein_sequences, start = 320, end = 360, font = "helvetical")
ggmsa(protein_sequences, start = 320, end = 360, font = "TimesNewRoman")
ggmsa(protein_sequences, start = 320, end = 360, font = "DroidSansMono")

If specify font = NULL, only show colored blocks but not characters.

ggmsa(protein_sequences, start = 320, end = 360, font = NULL)


Try the ggmsa package in your browser

Any scripts or data that you put into this service are public.

ggmsa documentation built on Aug. 3, 2021, 9:06 a.m.