Given a vector of minor-allele frequencies (maf) for a number of markers and a number of markers to assign an effect to, the function randomly selects N markers below or above provided maf threshold (default 1 from Beta distribution with given parameters so that the magnitude of the effect depends on the allele frequency. Desired fraction of the effects will be negative. Monomorphic markers with `maf = 0` will be automatically excluded from sampling!

get_effects(
  maf,
  N,
  get_betas_fun = dbeta,
  get_betas_args = list(shape1 = 1, shape2 = 25),
  thr = 0.01,
  rare = T,
  frac_negative = 0,
  seed = F
)

Arguments

maf

- vector of minor-allele frequencies

N

- number of markers to be assigned an effect

get_betas_fun

- name of a function for getting Beta parameters given a vector x of MAFs. Note, if you want a maf-independent function like rnorm, see .

get_betas_args

- a list with additional function parameters for the function defined in `get_betas`

thr

- threshold for maf. All markers with maf <= thr will be treated as rare.

rare

- a boolean, if TRUE, markers below and equal to the `thr` will be sampled, i.e. the rare variants

frac_negative

- fraction of effects to be set to negative

seed

- set seed for sampling, if FALSE, default `sample` seed will be used

Value

a list with two elements: `marker_idx` is a vector of indices of the markers assigned an effect and `effects` is a vector of effects, one for each marker

Author

Marcin Kierczak marcin.kierczak@scilifelab.se