generate_tree: Function to Generate Cell Trees

Description Usage Arguments Value Examples

View source: R/generate_tree.R

Description

This function builds a cell hierarchy tree of a chosen supported type with a given data set, contained in a ctgPHYLset object. Different tree types require data from corresponding slots of the ctgPHYLset object. See vignette for examples, usage details, and instructions on building a ctgPHYLset object.

Usage

1
generate_tree(dataSet, treeType, outputDir = getwd())

Arguments

dataSet

the ctgPHYLset object for creating the cell tree

treeType

the type of tree generated

outputDir

the directory where output should be saved, defaults to the current working directory.

Value

An updated ctgPHYLset object. The generated tree is placed in @treeList[treeType] slot, and can be accessed via treeList(dataSet)$treeType. The function also creates a directory named "CTG-Output" and writes the plot(s) of the generated tree(s) and its SIF file to that directory.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# load data for 'treeType = cellscape'
cs_tree_edges <- read.csv(system.file("extdata", "cnv_tree_edges.csv",
                         package = "cellscape"))
cs_cnv_data <- read.csv(system.file("extdata", "cnv_data.csv",
                                     package = "cellscape"))
cs_sc_annot <- read.csv(system.file("extdata", "cnv_annots.tsv",
                                    package = "cellscape"), sep="\t")
cs_clone_colours <- data.frame(clone_id = c("1","2","3"),
                               colour = c("7fc97f", "beaed4", "fdc086"))

# create example ctgPHYLset and load data into it
ctgPHYLset <- ctgPHYLset()
cellscapeData(ctgPHYLset, "clone_colours") <- cs_clone_colours
cellscapeData(ctgPHYLset, "tree_edges") <- cs_tree_edges
cellscapeData(ctgPHYLset, "cnv_data") <- cs_cnv_data
cellscapeData(ctgPHYLset, "sc_annot") <- cs_sc_annot

# choose output directory
od <- getwd()
# run generate_tree()
ctgPHYLset <- generate_tree(dataSet = ctgPHYLset, treeType = "cellscape", 
                             outputDir = od)

bicbioeng/ctgPHYL documentation built on April 13, 2020, 12:38 a.m.