genetrait: Generate pseudo phenotypic values

View source: R/genetrait.R

genetraitR Documentation

Generate pseudo phenotypic values

Description

This function generates pseudo phenotypic values according to the following formula.

y = X \beta + Z u + e

where effects of major genes are regarded as fixed effects \beta and polygenetic effects are regarded as random effects u. The variances of u and e are automatically determined by the heritability.

Usage

genetrait(
  x,
  sample.sets = NULL,
  candidate = NULL,
  pos = NULL,
  x.par = NULL,
  ZETA = NULL,
  x2 = NULL,
  num.qtn = 3,
  weight = c(2, 1, 1),
  qtn.effect = rep("A", num.qtn),
  prop = 1,
  polygene.weight = 1,
  polygene = TRUE,
  h2 = 0.6,
  h.correction = FALSE,
  seed = NULL,
  plot = TRUE,
  saveAt = NULL,
  subpop = NULL,
  return.all = FALSE,
  seed.env = TRUE
)

Arguments

x

A n \times m genotype matrix where n is sample size and m is the number of markers.

sample.sets

A n.sample x n.mark genotype matrix. Markers with fixed effects (QTNs) are chosen from sample.sets. If sample.sets = NULL, sample.sets = x.

candidate

If you want to fix QTN postitions, please set the number where SNPs to be fixed are located in your data (so not position). If candidate = NULL, QTNs were randomly sampled from sample.sets or x.

pos

A n.mark x 1 vector. Cumulative position (over chromosomes) of each marker.

x.par

If you don't want to match the sampling population and the genotype data to QTN effects, then use this argument as the latter.

ZETA

A list of covariance (relationship) matrix (K: m \times m) and its design matrix (Z: n \times m) of random effects. Please set names of list "Z" and "K"! You can use more than one kernel matrix. For example,

ZETA = list(A = list(Z = Z.A, K = K.A), D = list(Z = Z.D, K = K.D))

Z.A, Z.D

Design matrix (n \times m) for the random effects. So, in many cases, you can use the identity matrix.

K.A, K.D

Different kernels which express some relationships between lines.

For example, K.A is additive relationship matrix for the covariance between lines, and K.D is dominance relationship matrix.

x2

A genotype matrix to calculate additive relationship matrix when Z.ETA = NULL. If Z.ETA = NULL & x2 = NULL, calcGRM(x) will be calculated as kernel matrix.

num.qtn

The number of QTNs

weight

The weights for each QTN by their standard deviations. Negative value is also allowed.

qtn.effect

Additive of dominance for each marker effect. This argument should be the same length as num.qtn.

prop

The proportion of effects of QTNs to polygenetic effects.

polygene.weight

If there are multiple kernels, this argument determines the weights of each kernel effect.

polygene

If polygene = FALSE, pseudo phenotypes with only QTN effects will be generated.

h2

The wide-sense heritability for generating phenotypes. 0 <= h2 < 1

h.correction

If TRUE, this function will generate phenotypes to match the genomic heritability and "h2".

seed

If seed is not NULL, some fixed phenotypic values will be generated according to set.seed(seed)

plot

If TRUE, boxplot for generated phenotypic values will be drawn.

saveAt

When drawing any plot, you can save plots in png format. In saveAt, you should substitute the name you want to save. When saveAt = NULL, the plot is not saved.

subpop

If there is subpopulation structure, you can draw boxpots divide by subpopulations. n.sample x n.subpop matrix. Please indicate the subpopulation information by (0, 1) for each element. (0 means that line doen't belong to that subpopulation, and 1 means that line belongs to that subpopulation)

return.all

If FALSE, only returns generated phenotypic values. If TRUE, this function will return other information such as positions of candidate QTNs.

seed.env

If TRUE, this function will generate different environment effects every time.

Value

trait

Generated phenotypic values

u

Generated genotyope values

e

Generated environmental effects

candidate

The numbers where QTNs are located in your data (so not position).

qtn.position

QTN positions

heritability

Genomic heritability for generated phenotypic values.


RAINBOWR documentation built on Sept. 12, 2023, 9:08 a.m.