dominant: Find the latest-occurring mutation shared by at least a...

Description Usage Arguments Value Examples

View source: R/sweepmetrics.R

Description

Find the latest-occurring mutation shared by at least a threshold proportion of cells at a specified time

Usage

1
dominant(anc, pop_df, threshold, generation = NA)

Arguments

anc

Dataframe of ancestries, as generated by "ancestry" function

pop_df

Dataframe with column names including "Identity" and "Population"

threshold

Number between 0 and 1; a genotype must exceed this frequency to be considered dominant

generation

Generation at which to make the measurement (default NA corresponds to the final Generation)

Value

Identity of the dominant genotype.

Examples

1
2
3
4
5
6
7
8
9
library(ggmuller)
library(dplyr)
phylo <- filter(driver_phylo, CellsPerSample == -1)
pop_df <- get_population_df(phylo)
edges <- get_edges(phylo)
anc <- ancestry(edges)
dominant(anc, pop_df, 0.01)
gens_list <- unique(pop_df$Generation)
dominant(anc, pop_df, 0.01, gens_list[round(length(gens_list) / 2)])

robjohnnoble/demonanalysis documentation built on June 30, 2020, 12:47 a.m.