Description Usage Arguments Value Examples
Takes SNVs in MIDAS format and produces a McDonald-Kreitman contingency table.
1 | calculate_mktable(info, freq, depth, map, depth_thres = 1, freq_thres = 0.5)
|
info |
A snv x variable data frame or table. Must have columns 'site_id', 'minor_allele', 'major_allele', 'gene_id' and 'amino_acids' as defined in the midas_merge.py snps from MIDAS. |
freq |
A snv x sample data frame or tibble with minor allele frequenncies. Must have a 'site_id' column. |
depth |
A snv x sample data frame or tibble with sequence coverage. Must have a 'site_id' column. |
map |
A sample x group data frame or tibble. Must have columns 'sample' and 'Group'. |
depth_thres |
The minimum number of reads at a position in a given sample for that position in that sample to be included. |
freq_thres |
Frequency cuttoff for minor vs major allele. The value represents the distance from 0 or 1, for a site to be assigned to the major or minor allele respectively. It must be a value in [0,1]. |
A tibble with columns gene_id, Dn, Ds, Pn, and Ps, which correspond to the McDonald-Kreitman contingency table.
1 2 3 4 5 6 7 8 9 10 11 12 | library(tidyverse)
map <- read_tsv(system.file("toy_example/map.txt", package = "HMVAR"),
col_types = cols(.default = col_character())) %>%
select(sample = ID, Group)
midas_data <- read_midas_data(system.file("toy_example/merged.snps/", package = "HMVAR"),
map = map,
genes = NULL,
cds_only = TRUE)
calculate_mktable(info = midas_data$info, freq = midas_data$freq, depth = midas_data$depth, map = map)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.