View source: R/create_custom_trait.R
create_custom_trait | R Documentation |
Create a custom trait in which the phenotype is determined in a custom way and the minor allele frequency is known.
create_custom_trait(
phenotype = "custom",
mafs = 0.25,
n_snps = 1,
calc_phenotype_function = calc_random_phenotype_values
)
phenotype |
one phenotype, named after its genetic background:
|
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 |
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 |
Richèl J.C. Bilderbeek
# Create a custom trait that calculates the phenotypes randomly,
# regardless of the genotype.
# This is the same as using 'create_random_trait'
create_custom_trait(
phenotype = "random",
calc_phenotype_function = calc_random_phenotype_values
)
# Create a custom trait that calculates the phenotypes additively
# This is the same as using 'create_additive_trait'
create_custom_trait(
phenotype = "additive",
calc_phenotype_function = calc_additive_phenotype_values
)
# Create a custom trait that calculates the phenotypes from
# an epistatic interaction
# This is the same as using 'create_epistate_trait'
create_custom_trait(
phenotype = "epistatic",
calc_phenotype_function = calc_epistatic_phenotype_values,
n_snps = 2
)
# A trivial trait, that shows the genotypes worked on
create_custom_trait(
phenotype = "debug",
calc_phenotype_function = function(snvs) {
# Show the input
message(paste0(knitr::kable(snvs), collapse = "\n"))
# Return as much 1s as individuals
rep(1, nrow(snvs))
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.