onto2nwk: onto2nwk

View source: R/onto2nwk.r

onto2nwkR Documentation

onto2nwk

Description

Converts an ontology (higherarchical categories) into a nwk phylogeny.

Usage

onto2nwk(df)

Arguments

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.

Value

A newick (nwk) format string.

Author(s)

John L. Darcy

Examples

# 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)


darcyj/specificity documentation built on Aug. 1, 2023, 8 a.m.