knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Introduction

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.

Setup

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"
  )
}

Detecting associations for one binary trait

To do an associationfor one binary trait, we need some parameters:

Here, 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()

The mapping table

knitr::kable(assoc_data$data$map_table)

The pedigree 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.

The minor allele frequency (MAF)

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.

Detecting the association

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)
}

Cleanup

clear_plinkr_cache()
check_empty_plinkr_folder()


richelbilderbeek/plinkr documentation built on March 25, 2024, 3:18 p.m.