auto_annotate: Automatically format an annotation file

Description Usage Arguments Value

View source: R/annotation.R

Description

This takes an anno file as input at any stage and properly annotates it for compatability with shiny and other scrattch functions. In particular, it ensures that columns have a label, an id, and a color, and that there are no factors. It won't overwrite columns that have already been properly process.

Usage

1
2
3
4
auto_annotate(anno, scale_num = "predicted", na_val_num = 0,
  colorset_num = c("darkblue", "white", "red"), sort_label_cat = TRUE,
  na_val_cat = "ZZ_Missing", colorset_cat = "varibow",
  color_order_cat = "sort")

Arguments

anno

an existing annotation data frame

scale_num

should color scaling of numeric values be "predicted" (default and highly recommended; will return either "linear" or "log10" depending on scaling), "linear","log10","log2", or "zscore".

na_val_num

The value to use to replace NAs for numeric columns. default = 0.

colorset_num

A vector of colors to use for the color gradient. default = c("darkblue","white","red")

sort_label_cat

a logical value to determine if the data in category columns should be arranged alphanumerically before ids are assigned. default = T.

na_val_cat

The value to use to replace NAs in category and factor variables. default = "ZZ_Missing".

colorset_cat

The colorset to use for assigning category and factor colors. Options are "varibow" (default), "rainbow","viridis","inferno","magma", and "terrain"

color_order_cat

The order in which colors should be assigned for cat and factor variables. Options are "sort" and "random". "sort" (default) assigns colors in order; "random" will randomly assign colors.

Value

an updated data frame that has been automatically annotated properly


AllenInstitute/scrattch.io documentation built on Nov. 17, 2021, 10:06 a.m.