Skip to contents

Generate a table representing the frequency of unique mutations. In order to ensure confidence in the results, a threshold is provided indicating confidence in genotype calls. All data that do not meet this threshold will be removed from the computation.

Usage

mutation_frequency(data, threshold)

Arguments

data

A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr).

threshold

A minimum UMI count which reflects the confidence in the genotype call. Data with a UMI count of less than the threshold will be filtered out from the analysis.

Value

A tibble with the extra class mut_freq. The output has the following columns:

  • mutation_name: The unique mutation sequenced.

  • frequency: The frequency of the mutation.

See also

plot_mutation_frequency() for plotting the table.

Examples

ref_file <- miplicorn_example("reference_AA_table.csv")
alt_file <- miplicorn_example("alternate_AA_table.csv")
cov_file <- miplicorn_example("coverage_AA_table.csv")
data <- read_tbl_ref_alt_cov(
  ref_file,
  alt_file,
  cov_file,
  gene == "atp6" | gene == "crt"
)
mutation_frequency(data, 5)
#> # A tibble: 16 × 2
#>    mutation_name  frequency
#>    <chr>              <dbl>
#>  1 atp6-Ala623Glu    0     
#>  2 atp6-Glu431Lys    0     
#>  3 atp6-Gly639Asp    0.183 
#>  4 atp6-Ser466Asn    0.129 
#>  5 atp6-Ser769Asn    0     
#>  6 crt-Ala220Ser     0.128 
#>  7 crt-Asn326Asp     0.101 
#>  8 crt-Asn326Ser     0     
#>  9 crt-Asn75Glu      0.0533
#> 10 crt-Cys72Ser      0.146 
#> 11 crt-His97Leu      0     
#> 12 crt-His97Tyr      0     
#> 13 crt-Ile356Leu     0.130 
#> 14 crt-Ile356Thr     0.0507
#> 15 crt-Lys76Thr      0.200 
#> 16 crt-Met74Ile      0.0533