itol_colorstrip: Create itol colorstrip file

View source: R/itol.R

itol_colorstripR Documentation

Create itol colorstrip file

Description

https://itol.embl.de/help.cgi#strip

Usage

itol_colorstrip(
  df,
  dataset_label,
  out_file = "itol_colorstrip.txt",
  out_dir = getwd(),
  legend = NULL
)

Arguments

df

A data.frame, tibble, or data.table (see above)

dataset_label

What to label the itol dataset

out_file

Name of the output file

out_dir

Where to write the output

legend

Custom legend (see the function description)

Details

If a data.frame is provided, the row names must exactly match the tree node labels. The 1st column with be used for plotting. If a data.table or tibble is provided, the first column values must exactly match the tree node labels. The 2nd column will be used for plotting.

Custom Legend: requires a data.frame with the number of rows equaling the number of unique values in the legend.

Examples

# data.frame input
df = data.frame(values = c('x','x','y'), row.names = LETTERS[1:3])
itol_colorstrip(df, 'test_label')
# data.table
dt = data.table(taxa = LETTERS[1:3], values = c('x','x','y'))
itol_colorstrip(dt, 'test_label')
# creating a custom legend
legend = data.frame(unique(iris$Species),
colors = c('#00FF00', '#FFCC33', '#FF0000'),
shapes = rep(1, length(unique(iris$Species))))
print(legend)

leylabmpi/LeyLabRMisc documentation built on Nov. 3, 2022, 3:45 p.m.