onto2nwk | R Documentation |
Converts an ontology (higherarchical categories) into a nwk phylogeny.
onto2nwk(df)
df |
a data.frame object where columns represent ontology levels, which are assumed to be nested hierarchically. this function does not check for proper hierarchical nestedness - it is the user's job to check that each node and tip name is monophyletic. Lower levels (e.g. tips) should be the rightmost column of df, and higher levels (e.g. roots) should be leftmost column, with intermediate columns ordered between. |
A newick (nwk) format string.
John L. Darcy
# library(specificity)
# library(ape)
# df <- data.frame(
# l1 = c( "a", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "c", "d"),
# l2 = c( "e", "e", "e", "e", "f", "f", "g", "h", "h", "h", "i", "j", "j", "k", "l"),
# l3 = c( "m", "n", "o", "o", "p", "p", "q", "r", "r", "s", "t", "u", "v", "w", "x")
# )
# nwk_str <- onto2nwk(df)
# a <- ape::read.tree(text=nwk_str)
# plot(a, show.node.label=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.