adjAF: adjAF

View source: R/adjAF.R

adjAFR Documentation

adjAF

Description

Adjusts allele frequencies for heterogeneous populations in genetic data given proportion of reference groups

Usage

adjAF(
  data,
  reference,
  observed,
  pi.target,
  pi.observed,
  adj_method = "average",
  N_reference = NULL,
  N_observed = NULL,
  filter = TRUE
)

Arguments

data

dataframe of unadjusted allele frequency for observed group, K reference group allele frequencies for N SNPs

reference

character vector of the column names for K reference groups.

observed

character value for the column name of observed data group

pi.target

numeric vector of the mixture proportions for K reference groups in the target individual or group.

pi.observed

numeric vector of the mixture proportions for K reference groups in the observed group.

adj_method

user choice of method for the allele frequency adjustment: options "average" and "leave_one_out" are available. Defaults to "average".

N_reference

numeric vector of the sample sizes for each of the K reference groups.

N_observed

numeric value of the sample size of the observed group.

filter

sets adjusted allele frequencies equal to 1 if > 1, to 0 if > -.005 and < 0, and removes adjusted allele frequencies < -.005.

Value

pi: table of input reference groups, pi.observed, and pi.target

observed.data: name of the data column for the observed group from which adjusted allele frequency is estimated

Nsnps: number of SNPs for which adjusted AF is estimated

adjusted.AF: data frame of original data with an appended column of adjusted allele frequencies

effective.sample.size: The sample size of individuals effectively represented by the adjusted allele frequencies

Author(s)

Adelle Price, adelle.price@cuanschutz.edu

Hayley Wolff, hayley.wolff@cuanschutz.edu

Audrey Hendricks, audrey.hendricks@cuanschutz.edu

References

https://github.com/hendriau/Summix2

See Also

https://github.com/hendriau/Summix2 for further documentation.

Examples

data(ancestryData)
adjusted_data<-adjAF(data   = ancestryData,
    reference  = c("reference_AF_afr", "reference_AF_eur"),
    observed    = "gnomad_AF_afr",
    pi.target   = c(1, 0),
    pi.observed = c(.85, .15),
    adj_method = 'average',
    N_reference = c(704,741),
    N_observed = 20744,
    filter = TRUE)
adjusted_data$adjusted.AF[1:5,]




hendriau/Summix documentation built on Nov. 13, 2024, 6:53 a.m.