R/calc_ex_ind.R

Defines functions calc_ex_ind

# Calculate the excess of indels per patient. Input dnds1 is a dndsout object generated by running dndscv on a list of known cancer genes.
calc_ex_ind = function(dnds1) {
  num_patients <- length(as.vector(unique(dnds1$annotmuts$sampleID)))
  excess_ind <- (dnds1$sel_cv$n_ind - dnds1$sel_cv$exp_ind) / num_patients
  excess_ind <- data.frame(gene_name = dnds1$sel_cv$gene_name, ex_ind = as.numeric(as.vector(excess_ind)))
  return(excess_ind)
}
ggruenhagen3/coselens documentation built on April 17, 2025, 11:56 a.m.