#' Ig gene color function
#'
#' Use ggsci color palette to map V and J gene segments. \code{pal_lancet} is used for V gene-segments and
#' \code{pal_simpsons} is used for J gene segments.
#'
#' @param gene gene code can be either V or J.
#' @param type type is either 'fill' or 'color'
#'
#' @importFrom ggsci pal_lancet pal_simpsons
#' @importFrom stats setNames
#' @return
#' @export
#'
#' @examples
scale_color_gene <- function(gene="V", type="color") {
if (gene == "V") {
vec_col <- setNames(pal_lancet()(9), as.character(seq(9)))
}
if (gene == "J") {
vec_col <- setNames(pal_simpsons()(9), as.character(seq(9)))
}
if (type == "color") {
return(scale_color_manual(values = vec_col))
}
if (type == "fill") {
return(scale_fill_manual(values=vec_col))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.