geneticFixedEffects: Simulate genetic variant effects.

Description Usage Arguments Value Examples

View source: R/variancecomponentFunctions.R

Description

geneticFixedEffects takes genetic variants which should be added as genetic variant effects to the phenotype. These variants can have the same effects across all traits (shared) or can be independent across traits (independent); in addition, only a certain proportion of traits can be affected by the genetic variants.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
geneticFixedEffects(
  X_causal,
  P,
  N,
  phenoID = "Trait_",
  id_samples = rownames(X_causal),
  id_phenos = NULL,
  pTraitsAffected = 1,
  pIndependentGenetic = 0.4,
  pTraitIndependentGenetic = 0.2,
  keepSameIndependent = FALSE,
  distBeta = "norm",
  mBeta = 0,
  sdBeta = 1,
  verbose = FALSE
)

Arguments

X_causal

[N x NrCausalSNPs] Matrix of [NrCausalSNPs] SNPs from [N] samples.

P

Number [integer] of phenotypes to simulate.

N

Number [integer] of samples to simulate; has to be provided as a dimnesionality check for X_causal and downstream analyses; nrow(X_causal) has to be equal to N.

phenoID

Prefix [string] for naming traits.

id_samples

Vector of [NrSamples] sample IDs [string]; if not provided colnames(X_causal) used.

id_phenos

Vector of [NrTraits] phenotype IDs [string]; if not provided constructed by paste(phenoID, 1:P, sep="").

pTraitsAffected

Proportion [double] of traits affected by the genetic effect. For non-integer results of pTraitsAffected*P, the ceiling of the result is used. Allows to simulate for instance different levels of pleiotropy.

pIndependentGenetic

Proportion [double] of genetic effects (SNPs) to have an independent fixed effect.

pTraitIndependentGenetic

Proportion [double] of traits influenced by independent fixed genetic effects.

keepSameIndependent

[boolean] If set to TRUE, the independent genetic effects always influence the same subset of traits.

distBeta

Vector of name(s) [string] of distribution to use to simulate effect sizes of SNPs; one of "unif" or "norm".

mBeta

Vector of mean/midpoint(s) [double] of normal/uniform distribution for effect sizes of SNPs.

sdBeta

Vector of standard deviation/distance from midpoint [double] of normal/uniform distribution for effect sizes of SNPs.

verbose

[boolean] If TRUE, progress info is printed to standard out

Value

Named list of shared fixed genetic effects (shared: [N x P] matrix), independent fixed genetic effects (independent: [N x P] matrix), the causal SNPs labeled as shared or independent effect (cov: [NrCausalSNPs x N] matrix) and the simulated effect sizes of the causal SNPs (cov_effect: [P x NrCausalSNPs] dataframe).

Examples

1
2
3
4
genotypes <- simulateGenotypes(N=100, NrSNP=20, verbose=FALSE)
causalSNPs <- getCausalSNPs(N=100, genotypes=genotypes$genotypes)
geneticFixed <- geneticFixedEffects(N=100, X_causal=causalSNPs, 
P=10)

PhenotypeSimulator documentation built on July 16, 2021, 5:06 p.m.