determine_snp_effect: Determine the effect of a coding variant on the aminoacid...

Description Usage Arguments Value Examples

View source: R/mktest.r

Description

Takes an table corresponding to the contents of the snp_info.txt file from midas_merge.py and adds a column indicating whether the variant is synonymous or non-synonymous

Usage

1
determine_snp_effect(info, nucleotides = c(A = 1, C = 2, G = 3, T = 4))

Arguments

info

A data table corresponding to the contents of the snp_info.txt file produced by midas_merge. It must have columns: 'site_id', 'major_allele', 'minor_allele' and 'amino_acids'. The aminoacid column must contain a string of four comma-separated values indicating the aminoacid encoded for each variant (eg. 'V,L,V,L').

nucleotides

Named vector indicating the position of each nucleotide that corresponds to the amino_acids column in info. The default corresponds to MIDAS v1.3.1 default.

Value

The same data table passed as info with a factor column 'snp_effect' added.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(HMVAR)

# Get file paths
midas_dir <- system.file("toy_example/merged.snps/", package = "HMVAR")
map <- readr::read_tsv(system.file("toy_example/map.txt", package = "HMVAR"),
                       col_types = readr::cols(.default = readr::col_character())) %>%
  dplyr::select(sample = ID, Group)

# Read data
midas_data <- read_midas_data(midas_dir = midas_dir, map = map, cds_only = TRUE)

info <- determine_snp_effect(midas_data$info) %>%
  determine_snp_dist(freq = midas_data$freq,
                     depth = midas_data$depth, map = map,
                     depth_thres = 1, freq_thres = 0.5)
info

mktable <- info %>%
  split(.$gene_id) %>%
  purrr::map_dfr(mkvalues,
                 .id = "gene_id")
mktable

surh/HMVAR documentation built on Aug. 18, 2021, 1:21 a.m.