create_trait: Create a trait with a clear genetic architecture and a known...

View source: R/create_trait.R

create_traitR Documentation

Create a trait with a clear genetic architecture and a known minor allele frequency.

Description

Create a trait with a clear genetic architecture and a known minor allele frequency.

Usage

create_trait(
  phenotype,
  mafs = 0.25,
  n_snps = 1,
  calc_phenotype_function = calc_random_phenotype_values
)

Arguments

phenotype

one phenotype, named after its genetic background:

  • random the phenotype is a random value, i.e. there is no association between the genetics and this phenotype

  • additive the phenotype is perfectly additive (the nucleotides used are A and T as these are in the word 'additive'):

    • AA 11.0

    • AT 10.5

    • TT 10.0

mafs

one or more minor allele frequencies. These allele frequencies must be ordered decreasingly, i.e. the MAF is at the first position, where the even rarer alleles are at the second and third positions.

Note that PLINK cannot handle triallelic nor quadallelic SNPs: PLINK will give a warning that it is setting the rarest alleles to missing.

n_snps

the number of SNPs, as can be checked by check_n_snps

calc_phenotype_function

a function that calculate the phenotypes from genotypes. The input is the genetic data as a tibble, in which each row is an individual and the columns are the SNVs. The first two columns are named snv_1a, snv_1b and hold the genetic data for the first SNV of a diploid organism. If there are more SNVs, columns continue with names, snv_2a, snv_2b, snv_3a, snv_3b, etc. Nucleotides are in uppercase. The output must be the phenotypic values, as a numeric vector, which has the same length as the number of individuals. Use check_calc_phenotype_function to check a calc_phenotype_function.

Details

Prefer to use the specialized functions:

  • create_additive_trait

  • create_custom_trait

  • create_epistatic_trait

  • create_random_trait

  • create_random_case_control_trait

Author(s)

Richèl J.C. Bilderbeek

Examples

create_trait(phenotype = "random")
create_trait(phenotype = "random", maf = 0.01)
create_trait(phenotype = "random", n_snps = 2)
create_trait(
  phenotype = "random",
  calc_phenotype_function = calc_random_phenotype_values
)

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