replace_alleles: Replaces the alleles in a GWAS according to the replacement...

Description Usage Arguments Examples

View source: R/proxy_search.R

Description

Replaces the alleles in a GWAS according to the replacement string provided.

Usage

1
replace_alleles(alleles, replacement_string, reverse_direction = FALSE)

Arguments

alleles

a list of alleles that will be transformed according to the "rule" in replacement_string

replacement_string

a set of replacement rules in the format "<CHAR_OLD>=<CHAR_NEW>,..." where the appearances of CHAR_OLD will be replaced by CHAR_NEW.

reverse_direction

a flag indicating that the replacement should occur in the reverse direction

Examples

1
2
3
4
5
6
7
replace_alleles(list("C", "G"), "C=A,G=T") # c("A", "T")
replace_alleles(list("C", "G"), "C=C,G=T") # c("C", "T")
replace_alleles(list("C", "G"), "C=A,G=G") # c("A", "G")
replace_alleles(list("C", "G"), "C=T,G=A") # c("T", "A")
replace_alleles(list("C", "T"), "C=A,T=T") # c("A", "T")
replace_alleles(list("C", "T"), "C=A,T=C") # c("A", "C")
replace_alleles(list("C", "T"), "C=T,T=C") # c("T", "C")

richardslab/MRutils documentation built on Dec. 22, 2021, 4 p.m.