Description Usage Arguments Examples
View source: R/EvoFreq_funcs.R
get_mutation_df
Converts sizes to the frequency of the mutations in the population
1 | get_mutation_df(clone_size_df, clones, parents)
|
clone_size_df |
Dataframe in a wide format, where each row corrsponds to a single clone, and the columns are the sizes of that clone at each timepoint |
clones |
Array containing the clone ids. The index of each clone must correspond to the same index of the row in |
parents |
Array containing the ids of the parent of each clone in the |
1 2 3 4 5 6 7 8 9 10 11 12 | data("example.easy.wide")
### Split dataframe into clone info and size info using fact timepoint column names can be converted to numeric values
time_col_idx <- suppressWarnings(which(! is.na(as.numeric(colnames(example.easy.wide)))))
attribute_col_idx <-suppressWarnings(which(is.na(as.numeric(colnames(example.easy.wide)))))
attribute_df <- example.easy.wide[, attribute_col_idx]
size_df <- example.easy.wide[, time_col_idx]
parents <- example.easy.wide$parents
clones <- example.easy.wide$clones
### Size data can be converted to mutation counts for additional analyses, like calculating mutation frequencies
mutation_count_df <- get_mutation_df(size_df, clones, parents)
total_chromosomes <- 2*colSums(size_df) ### Calculation assumes that mutations are on a single chromosome
allele_frequency_df <- sweep(mutation_count_df,2,total_chromosomes,"/")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.