knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(plinkr)
With create_demo_assoc_qt_data
one can get simulated/ideal data
with known relations between genotype and phenotype.
assoc_qt
can directly use the created data to do a quantitative trait
association analysis.
This vignette shows the versatility of create_demo_assoc_qt_data
,
by calling it in multiple different ways.
The output is left as-is, i.e. no pretty-printing.
create_demo_assoc_qt_data( traits = create_random_trait() )
A random trait is a trait in which there is no relationship between genotype. In this case, the phenotype is randomly and uniformly distributed between zero and one.
create_demo_assoc_qt_data( traits = create_random_trait(), n_individuals = 5 )
You can specify the number of individuals that are created. The rarer the alleles you are looking for, the more individuals you'll need :-)
create_demo_assoc_qt_data( traits = create_random_trait(mafs = 0.1) )
By default, the minor allele frequency is set to a high value, as this is most useful when demonstrating an effect. To investigate an allele that is rare, one can specify the MAF of each allele. Don't forget to increase the number of individuals!
create_demo_assoc_qt_data( traits = create_random_trait(mafs = c(0.2, 0.1)) )
Usually SNPs are bi-allelic, with only two different nucleotides present in the genetic dataset. Sometimes, however, there is a tri-allelic trait. You can simulate such a tri-allelic trait by specifying both the MAF and the frequency of the even rarer nucleotide.
Note that PLINK does not handle tri-allelic traits and will only work on the common and the minor allele.
create_demo_assoc_qt_data( traits = create_random_trait(mafs = c(0.3, 0.2, 0.1)) )
DNA has four nucleotides, so SNPs can be quad-allelic as well. You can simulate such a quad-allelic trait by specifying the allele frequencies of the rarer nucleotides.
Note that PLINK does not handle tri-allelic traits and will only work on the common and the minor allele.
create_demo_assoc_qt_data( traits = create_additive_trait() )
A additive trait is a trait in which the phenotype is linearily (and perfectly) determined by the genotype. The homozygotes of the common allele have the lowest phenotypic value, the homozygotes of the rare allele have the heighest, where the heterozygotes are exactly in between.
See ?calc_additive_phenotype_values
for the exact calculation.
create_demo_assoc_qt_data( traits = create_epistatic_trait() )
create_demo_assoc_qt_data( traits = rep(list(create_random_trait()), 2) )
create_demo_assoc_qt_data( traits = list( create_random_trait(mafs = 0.2), create_additive_trait(mafs = 0.4) ) )
create_demo_assoc_qt_data( traits = list( create_random_trait(), create_additive_trait() ) )
create_demo_assoc_qt_data()
clear_plinkr_cache()
check_empty_plinkr_folder()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.