genotypic.freq {Ravages} | R Documentation |
Genotypic frequencies calculation for data simulations
Description
Calculates the three genotypic frequencies in the controls group and each group of cases based on MAF in the general population and GRR values
Usage
genotypic.freq(genes.maf = Kryukov, GRR.het, GRR.homo.alt, prev,
genetic.model = c("general", "multiplicative",
"dominant", "recessive"), select.gene,
selected.controls = T)
Arguments
genes.maf |
A file containing the MAF in the general population (column maf) for variants with their associated gene (column gene), by default the file |
GRR.het |
A matrix giving the GRR of the heterozygous genotype compared to the homozygous reference genotype with one row per cases group and one column per variant |
GRR.homo.alt |
A matrix giving the GRR of the homozygous alternative genotype compared to the homozygous reference genotype with one row per cases group and one column per variant, only need if |
prev |
A vector containing the prevalence of each group of cases |
genetic.model |
The genetic model of the disease |
select.gene |
Which gene to choose from |
selected.controls |
Whether controls are selected controls (by default) or controls from the general population |
Details
This function is used to simulate genetic data.
The genetic model of the disease needs to be specified to genetic.model
:
If genetic.model="general"
, there is no link between the GRR associated
to the heterozygous genotype and the GRR associated to the homozygous alternative
genotype. Therefore, the user has to give two matrices of GRR, one for each of these genotypes.
If genetic.model="multiplicative"
, we assume that the GRR associated to the homozygous
alternative genotype is the square of the GRR associated to the heterozygous genotype.
If genetic.model="dominant"
, we assume that the GRR associated to the heterozygous genotype
and the GRR associated to the homozygous alternative genotype are equal.
If genetic.model="recessive"
, we assume that the GRR associated to the heterozygous genotype
is equal to 1: the GRR given is the one associated to the homozygous alternative genotype.
prev
corresponds to the proportion of each sub-group of cases in the population.
It is used only to calculate the MAF in the controls group.
If selected.controls
= T, genotypic frequencies in the control group are computed from genotypic frequencies in the cases groups and the prevalence of the disease.
If FALSE, genotypic frequencies in the control group are computed from allelic frequencies under Hardy-Weinberg equilibrium.
The dataframes Kryukov
or GnomADgenes
available with the package Ravages can be used for the argument genes.maf
.
Value
A matrix of MAF values with one column per variant and one row per group (the first one being the controls group)
See Also
GRR.matrix
, rbm.GRR
, GnomADgenes
, Kryukov
Examples
#Construction of the GRR matrix using the formula from SKAT
#to compute the GRR (higher weights to rarer variants)
#GRR in the second group are twice as high as in the first group
GRR.del <- GRR.matrix(GRR = "SKAT", GRR.multiplicative.factor=2,
select.gene="R1")
#Calculation of frequency in the three groups of individuals
#under a multilpicative model of the disease
geno.freq.groups <- genotypic.freq(genes.maf = Kryukov, GRR.het = GRR.del,
prev = c(0.001, 0.001), select.gene="R1",
genetic.model = "multiplicative")