Skip to contents

Uses the binomial distribution to create confidence intervals for mutation frequencies calculated from a single point estimate. Calculating binomial confidence intervals for mutation frequencies is not part of MutSeqR's recommended workflow, but is provided here for users who wish to use it.

Usage

get_binom_ci(
  mf_data,
  sum_col = "sum_min",
  depth_col = "group_depth",
  conf_level = 0.95,
  method = "wilson"
)

Arguments

mf_data

The data frame containing the mutation frequencies per sample. Obtained as an output from calculate_mf.

sum_col

Column name that specifies the mutation count (e.g., sum_min)

depth_col

Column name that specifies the sequencing depth (e.g., total_depth)

conf_level

Confidence interval to calculate, default 95% (0.95)

method

The method used by binom::binom.confint to calculate intervals. Default is "wilson" (recommended).

Value

A mf data frame with added columns indicating the confidence intervals.

Examples

example_file <- system.file("extdata", "Example_files",
                            "example_mutation_data_filtered.rds",
                            package = "MutSeqR")
example_data <- readRDS(example_file)
mf <- calculate_mf(example_data)
#> Performing internal depth correction to prevent double-counting...
#> Internal depth correction complete.
#> Joining with `by = join_by(sample)`
confint <- get_binom_ci(mf_data = mf,
                        sum_col = "sum_min",
                        depth_col = "group_depth")