knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
In this vignette, we are going to detect associations between genetic information and one binary traits.
We will be using the data from PLINK files, which is small, albeit a bit messy, where 'messy' is defined as that there is not a ideal 1-on-1 relation between genotype and phenotype.
First load plinkr
:
library(plinkr)
This vignette will build whether or not PLINK is installed
if (is_plink_installed()) { message("PLINK is installed") } else { message( "PLINK is not installed \n", " \n", "Tip: run 'plinkr::install_plinks()' to do so" ) }
To do an associationfor one binary trait, we need some parameters:
.map
table or mapping table, which contains the location
of the single-nucleotide polymorphisms (SNPs).ped
table or pedigree table, which contains the pedigree
of the individuals, their SNP values and their binary
trait valuesHere, we get simple set of data and parameters, as to be used in testing, or -in this case- a simple demonstration:
assoc_data <- create_test_assoc_data() assoc_params <- create_test_assoc_params()
knitr::kable(assoc_data$data$map_table)
The PLINK example \code{.ped} contains, among others, the pedigree of the individuals:
knitr::kable(assoc_data$data$ped_table)
The pedigree table has a column called case_control_code
,
which contains our binary trait.
message(assoc_params$maf)
The minor allele frequency (MAF) denotes that alleles that have an occurrence below this MAF will be excluded from the analysis. As we want to analyse all data, the MAF is set to the lowest non-zero value.
With the mapping, pedigree and phenotype table, we can detect the association between genotype and the single trait:
if (is_plink_installed()) { t <- assoc( assoc_data = assoc_data, assoc_params = assoc_params ) knitr::kable(t) }
CHR
: Chromosome numberSNP
: SNP identifierBP
: Physical position (base-pair)A1
: Minor allele name (based on whole sample)F_A
: Frequency of this allele in casesF_U
: Frequency of this allele in controlsA2
: Major allele nameCHISQ
: Basic allelic test chi-square (1df)P
: Asymptotic p-value for this testOR
: Estimated odds ratio (for A1, i.e. A2 is reference)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.