getVariantsColors {karyoploteR} | R Documentation

## getVariantsColors

### Description

Given the reference and alternative for a set of variants, assigns a color to each of them

### Usage

    getVariantsColors(ref, alt, color.table=NULL, color.schema=c("cell21breast"))

### Arguments

`ref` | (character vector) The reference nucleotides of the variants. It has to have the same length as `alt`.
`alt` | (character vector) The alternative nucleotides of the variants. It has to have the same length as `ref`
`color.table` | (named character vector) if present, its used to assign colors to the nucleotide substitutions.
`color.schema` | (character) The name of the color schema to use: `cell21breast` (the color schema used in "Mutational Processes Molding the Genomes of 21 Breast Cancers" by S. Nik-Zainal, Cell, 2012). (defaults to `cell21breast`)

### Details

The function creates an nucleotide substitution identifier with for each variant and uses it to query the color.table lookup table. If color.table is NULL, a color.table based in the selected color.schema is used. All unkwonwn nucleotide substitutions are assigned a gray color. Color table needs to have entries for C>A, C>G, C>T, T>A, T>C and T>G (and optionally "others"), since other changes can be reverse complemented to these.

### Value

a named character vector with the colors associated to each variant

### See Also

`plotKaryotype`, `kpPlotRainfall`

### Examples

    ref <- c("A", "A", "C", "T", "G", "A")
    alt <- c("G", "C", "T", "A", "A", "-")
    getVariantsColors(ref, alt)

    col.table <- c("C>A"="#FF0000", "C>G"="#000000", "C>T"="#00FF00", "T>A"="#0000FF", "T>C"="#BB00BB", "T>G"="#00BBBB", "other"="#888888")
    getVariantsColors(ref, alt, col.table)

[Package karyoploteR version 1.20.3 Index]