simulate_phenotype: Simulate phenotype

Description Usage Arguments Value References Examples

View source: R/simulation.R

Description

Simulates a phenotype from a GWAS experiment and a specified set of causal SNPs. If the data is qualitative, only controls are used.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
simulate_phenotype(
  gwas,
  snps,
  h2,
  model = "additive",
  effectSize = rnorm(length(snps)),
  qualitative = FALSE,
  ncases,
  ncontrols,
  prevalence
)

Arguments

gwas

A SnpMatrix object with the GWAS information.

snps

Character vector with the SNP ids of the causal SNPs. Must match SNPs in gwas[["map"]][["snp.names"]].

h2

Heritability of the phenotype (between 0 and 1).

model

String specifying the genetic model under the phenotype. Accepted values: "additive".

effectSize

Numeric vector with the same lenght as the number of causal SNPs. It indicates the effect size of each of the SNPs; if absent, they are sampled fron a normal distribution.

qualitative

Bool indicating if the phenotype is qualitative or not (quantitative).

ncases

Integer specifying the number of cases to simulate in a qualitative phenotype. Required if qualitative = TRUE.

ncontrols

Integer specifying the number of controls to simulate in a qualitative phenotype. Required if qualitative = TRUE.

prevalence

Value between 0 and 1 specifying the population prevalence of the disease. Note that ncases cannot be greater than prevalence * number of samples. Required if qualitative = TRUE.

Value

A copy of the GWAS experiment with the new phenotypes in gwas[["fam"]][["affected"]].

References

Inspired from GCTA simulation tool: http://cnsgenomics.com/software/gcta/Simu.html.

Examples

1
2
3
gi <- get_GI_network(minigwas, snpMapping = minisnpMapping, ppi = minippi)
causal <- simulate_causal_snps(gi, ngenes = 2)
simulate_phenotype(minigwas, causal, h2 = 1)

martini documentation built on Nov. 8, 2020, 5:39 p.m.