helpers: Get depth first search of a tree

Description Usage Arguments Examples

Description

Get depth first search of a tree

Widget output function for use in Shiny

Widget render function for use in Shiny

Function to get data frame of pixels

function to get min and max values for each chromosome

function to get chromosome box pixel info

function to get the genome length

function to get the number of base pairs per pixel

function to get information (chr, start, end, mode_cnv) for each pixel

function to get mutation order for targeted data

function to get targeted heatmap information

function to find the mode of a vector

Function to process the user data

Function to check minimum dimensions

Function to check required inputs are present

check alpha value input is correct

check clonal_prev parameter data

check tree_edges parameter data

check genotype_position parameter

check clone_colours parameter

check perturbations parameter

get mutation data

function to replace spaces with underscores in all data frames & keep maps of original names to space-replaced names

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
dfs_tree(edges, cur_root, dfs_arr)

cellscapeOutput(outputId, width = "100%", height = "400px")

renderCnvTree(expr, env = parent.frame(), quoted = FALSE)

getEmptyGrid(hm_sc_ids_ordered, ncols)

getChromBounds(chroms, cnv_data)

getChromBoxInfo(chrom_bounds, n_bp_per_pixel)

getGenomeLength(chrom_bounds)

getNBPPerPixel(ncols, chrom_bounds, genome_length)

getCNVHeatmapForEachSC(cnv_data, chrom_bounds, n_bp_per_pixel)

getMutOrder(mut_data)

getTargetedHeatmapForEachSC(mut_data, mut_order, heatmapWidth)

findMode(x)

processUserData(clonal_prev, tree_edges, mutations, clone_colours, xaxis_title,
  yaxis_title, phylogeny_title, alpha, genotype_position, perturbations, sort,
  show_warnings, width, height)

checkMinDims(mutations, height, width)

checkRequiredInputs(clonal_prev, tree_edges)

checkAlpha(alpha)

checkClonalPrev(clonal_prev)

checkTreeEdges(tree_edges)

checkGtypePositioning(genotype_position)

checkCloneColours(clone_colours)

checkPerts(perturbations)

getMutationsData(mutations, tree_edges, clonal_prev)

replaceSpaces(clonal_prev, tree_edges, clone_colours, mutation_info, mutations,
  mutation_prevalences)

Arguments

edges

– edges of tree

cur_root

– current root of the tree

dfs_arr

– array of depth first search results to be filled

outputId

– id of output

width

– width of output

height

– height of output

expr

– expression for Shiny

env

– environment for Shiny

quoted

– default is FALSE

hm_sc_ids_ordered

– array of single cell ids in order

ncols

– number of columns in heatmap/grid

chroms

– vector of chromosome names

cnv_data

– copy number data

chrom_bounds

– data frame of chromosome boundaries

n_bp_per_pixel

– integer of number of base pairs per pixel

genome_length

– integer of length of the genome

mut_data

– data frame of mutations data

mut_order

– array of order of mutations for heatmap (chromosome:coordinate)

heatmapWidth

– number for width of the heatmap (in pixels)

x

– vector of numbers

clonal_prev

– data frame of Clonal prevalence. Note: timepoints will be alphanumerically sorted in the view. Format: columns are (1) character() "timepoint" - time point (2) character() "clone_id" - clone id (3) numeric() "clonal_prev" - clonal prevalence.

tree_edges

– data frame of Tree edges of a rooted tree. Format: columns are (1) character() "source" - source node id (2) character() "target" - target node id.

mutations

– data frame (Optional) of Mutations occurring at each clone. Any additional field will be shown in the mutation table. Format: columns are (1) character() "chrom" - chromosome number (2) numeric() "coord" - coordinate of mutation on chromosome (3) character() "clone_id" - clone id (4) character() "timepoint" - time point (5) numeric() "VAF" - variant allele frequency of the mutation in the corresponding timepoint.

clone_colours

– data frame (Optional) of Clone ids and their corresponding colours Format: columns are (1) character() "clone_id" - the clone ids (2) character() "colour" - the corresponding Hex colour for each clone id.

xaxis_title

– String (Optional) of x-axis title. Default is "Time Point".

yaxis_title

– String (Optional) of y-axis title. Default is "Clonal Prevalence".

phylogeny_title

– String (Optional) of Legend phylogeny title. Default is "Clonal Phylogeny".

alpha

– Number (Optional) of Alpha value for sweeps, range [0, 100].

genotype_position

– String (Optional) of How to position the genotypes from ["centre", "stack", "space"] "centre" – genotypes are centred with respect to their ancestors "stack" – genotypes are stacked such that no genotype is split at any time point "space" – genotypes are stacked but with a bit of spacing at the bottom

perturbations

– data frame (Optional) of any perturbations that occurred between two time points. Format: columns are (1) character() "pert_name" - the perturbation name (2) character() "prev_tp" - the time point (as labelled in clonal prevalence data) BEFORE perturbation.

sort

– Boolean (Optional) of whether (TRUE) or not (FALSE) to vertically sort the genotypes by their emergence values (descending). Default is FALSE. Note that genotype sorting will always retain the phylogenetic hierarchy, and this parameter will only affect the ordering of siblings.

show_warnings

– Boolean (Optional) of Whether or not to show any warnings. Default is TRUE.

mutation_info

– processed mutation_info

mutation_prevalences

– mutation_prevalences data from user

chrom_bounds

– data frame of chromosome boundaries

ncols

– integer of number of columns (pixels) to fill

chrom_bounds

– data frame of chromosome boundaries

cnv_data

– data frame of copy number variant segments data

chrom_bounds

– data frame of chromosome boundaries

n_bp_per_pixel

– integer of number of base pairs per pixel

mut_data

– data frame of mutations data

width

– Number (Optional) of width of the plot. Minimum width is 450.

height

– Number (Optional) of height of the plot. Minimum height with and without mutations is 500 and 260, respectively.

mutations

– mutations provided by user

height

– height provided by user

width

– width provided by user

clonal_prev

– clonal_prev provided by user

tree_edges

– tree_edges provided by user

alpha

– alpha provided by user

clonal_prev

– clonal prevalence provided by user

tree_edges

– tree edges provided by user

genotype_position

– genotype_position provided by user

clone_colours

– clone_colours provided by user

perturbations

– perturbations provided by user

mutations

– mutations data from user

tree_edges

– tree edges data from user

clonal_prev

– clonal prevalence data from user

clonal_prev

– clonal_prev data from user

tree_edges

– tree edges data from user

clone_colours

– clone_colours data from user

mutations

– mutations data from user

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
dfs_tree(data.frame(source = c("1","1","2","2","5","6"), target=c("2","5","3","4","6","7")), "1", c())
cellscapeOutput(1, '100%', '300px')
cellscapeOutput(1, '80%', '300px')
findMode(c(1,1,19,1))
checkMinDims(data.frame(chr = c("11"), coord = c(104043), VAF = c(0.1)), "700px", "700px")
checkRequiredInputs(data.frame(timepoint = c(rep("Diagnosis", 6), rep("Relapse", 1)), clone_id = c("1","2","3","4","5","6","7"), clonal_prev = c("0.1","0.22","0.08","0.53","0.009","0.061","1")), 
data.frame(source = c("1","1","2","2","5","6"), target=c("2","5","3","4","6","7")))
checkRequiredInputs(data.frame(timepoint = c(rep("Diagnosis", 6), rep("Relapse", 1)), clone_id = c("1","2","3","4","5","6","7"), clonal_prev = c("0.12","0.12","0.18","0.13","0.009","0.061","1")), 
data.frame(source = c("1","1","2","2","5","6"), target=c("2","5","3","4","6","7")))
checkAlpha(4)
checkAlpha(100)
checkClonalPrev(data.frame(timepoint=c(1), clone_id=c(2), clonal_prev=c(0.1)))
checkTreeEdges(data.frame(source = c("1","1","2","2","5","6"), target=c("2","5","3","4","6","7")))
checkGtypePositioning("centre")
checkCloneColours(data.frame(clone_id = c("1","2","3", "4"), colour = c("#beaed4", "#fdc086", "#beaed4", "#beaed4")))
checkPerts(data.frame(pert_name = c("New Drug"), prev_tp = c("Diagnosis")))
getMutationsData(data.frame(chrom = c("11"), coord = c(104043), VAF = c(0.1), clone_id=c(1), timepoint=c("Relapse")), 
data.frame(source = c("1","1","2","2","5","6"), target=c("2","5","3","4","6","7")), 
data.frame(timepoint = c(rep("Diagnosis", 6), rep("Relapse", 1)), clone_id = c("1","2","3","4","5","6","7"), clonal_prev = c("0.12","0.12","0.18","0.13","0.009","0.061","1")))
replaceSpaces(mutations = data.frame(chrom = c("11"), coord = c(104043), VAF = c(0.1), clone_id=c(1), timepoint=c("Relapse")), 
tree_edges = data.frame(source = c("1","1","2","2","5","6"), target=c("2","5","3","4","6","7")), 
clonal_prev = data.frame(timepoint = c(rep("Diagnosis", 6), rep("Relapse", 1)), clone_id = c("1","2","3","4","5","6","7"), clonal_prev = c("0.12","0.12","0.18","0.13","0.009","0.061","1")),
mutation_prevalences = list("X:6154028" = data.frame(timepoint = c("Diagnosis"), VAF = c(0.5557))), mutation_info=data.frame(clone_id=c(1)),
clone_colours = data.frame(clone_id = c("1","2","3", "4"), colour = c("#beaed4", "#fdc086", "#beaed4", "#beaed4")))

cellscape documentation built on Nov. 8, 2020, 5:02 p.m.