extract_hrchy_string: Extract hierarchy from a string (based on prior knowledge)

View source: R/extract_hrchy_string.R

extract_hrchy_stringR Documentation

Extract hierarchy from a string (based on prior knowledge)

Description

Parse an input string by extracting parent-children relationship.

Usage

extract_hrchy_string(input_string, special_character = "@", plot = T)

Arguments

input_string

An input string with nested labeled parentheses that characterizes hierarchy of annotated cell types. Avoid using comma (','), parentheses ('()') and special character (e.g.'@') in celltype names.

special_character

A character denotes non-leaf node (including root node and internal nodes).

plot

Plot tree structure or not.

Value

A list of hierarchy information:

  • edges: a data frame that documents that parent-children relationship.

  • layout: a data frame that contains id, xy coordiates, label and a leaf indicator for each node.

  • immediate_children: a data frame that captures immediate children for each node.

  • leaves_info: a data frame that summarizes leaf children for each node.

Author(s)

Boyang Zhang <bzhang34@jhu.edu>, Hongkai Ji

Examples

input_string = '@T(@CD4+(CD4_c1,CD4_c2),@CD8+(CD8_c1,CD8_c2))'
extract_hrchy_string(input_string, special_character = '@')

byzhang23/TreeCorTreat documentation built on May 7, 2024, 8:37 a.m.