Description Usage Arguments Value Examples
This function (MFKM) is used to perform KM analysis (Yan et al., 2015) for quantitative traits in GWAS multivariate family data.
1 2 3 4 5 6 7 8 |
obj |
results saved from MFKM_Null_Model. |
genotypes |
1st column: gene name; 2nd column: snp name; 3rd-end columns: A matrix of genotypes for each subject (class: data.frame). The order of 3rd-end columns should match unique(yid). Coded as 0, 1, 2 and no missing. This genotype file can be a big file containing all genes or it can be files containing one single gene. |
weights |
1st column: gene name; 2nd column: snp name; 3rd column: A vector with the length equal to the number of variants in the test (class: data.frame). Default is Null indicating equal weight for all markers. |
acc |
Accuracy of numerical integration used in Davies' method. Default 1e-4. |
append.write |
The name of pvalue output file. Write out p-values in real time. Don't need to wait until all genes are processed to get the final output. |
eq.gen.effect |
Whether assume equal genetic effects on different traits (default = False). |
output: multivariate family KM (MF-KM) p-value
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ########################################################################################
### Examples for Multivariate (two) Continuous Traits in Familial GWAS Data using KM ###
########################################################################################
### Subject IDs are numeric ###
data("MFKM_numID")
#If Ninitial=1, the initial value "cor" is always equal to
#correlation(trait1|covariates, trait2|covariates).
obj1 <- MFKM_Null_Model(phenotype=mfkm_n_y$y, trait=mfkm_n_y$trait, yid=mfkm_n_y$id,
gid=mfkm_n_geneid$gid, fa=mfkm_n_geneid$fa, mo=mfkm_n_geneid$mo, covariates=NULL,
Ninitial=1)
#One should try multiple initial values in order to find max log-likelihood. The default
#is 10 times.
#This could be time consuming, depends on the sample size. The good thing is that null
#model only needs to be fitted once for the whole genome, so it's worth trying many
#initial values. The initial value with max logl can be saved in LogLikelihood.txt
#(LL.output="LogLikelihood.txt") for reuse.
pvalue1 <- MFKM(obj=obj1, genotypes=mfkm_n_gene, weights=NULL)
#If one wants to replicate the results, finds the initial value "cor" with the max
#loglikelihood in LogLikelihood.txt that is output by LL.output. The 1st column is
#"cor"; 2nd column is "log-likelihood".
obj1 <- MFKM_Null_Model(phenotype=mfkm_n_y$y, trait=mfkm_n_y$trait, yid=mfkm_n_y$id,
gid=mfkm_n_geneid$gid, fa=mfkm_n_geneid$fa, mo=mfkm_n_geneid$mo, covariates=NULL,
cor=0.687439771651474)
#This "cor" is calcualted based on 3 initial values, "Ninitial=3".
pvalue1 <- MFKM(obj=obj1, genotypes=mfkm_n_gene, weights=NULL)
#Introduce missing into covariates and outcome.
#When samples have missing values in outcome or covariates, those samples are used only for
#kinship calculation.
mfkm_n_covariates[1,] = NA
mfkm_n_y$y[4] = NA
obj1 <- MFKM_Null_Model(phenotype=mfkm_n_y$y, trait=mfkm_n_y$trait, yid=mfkm_n_y$id,
gid=mfkm_n_geneid$gid, fa=mfkm_n_geneid$fa, mo=mfkm_n_geneid$mo, covariates=mfkm_n_covariates,
Ninitial=1)
pvalue1 <- MFKM(obj=obj1, genotypes=mfkm_n_gene, weights=NULL)
#Read in a list of genes files instead of a big file containing all genes
obj <- MFKM_Null_Model(phenotype=mfkm_n_y$y, trait=mfkm_n_y$trait, yid=mfkm_n_y$id,
gid=mfkm_n_geneid$gid, fa=mfkm_n_geneid$fa, mo=mfkm_n_geneid$mo, covariates=NULL,
Ninitial=1)
gene <- split(mfkm_n_gene, mfkm_n_gene[,1])
for (k in 1:2) {
gene[[k]]$gene <- as.character(gene[[k]]$gene)
pvalue1 <- MFKM(obj=obj, genotypes=gene[[k]], weights=NULL)
}
### Subject IDs are character ###
data("MFKM_charID")
obj1 <- MFKM_Null_Model(phenotype=mfkm_c_y$y, trait=mfkm_c_y$trait,
yid=as.character(mfkm_c_y$id),
gid=as.character(mfkm_c_geneid$gid), fa=as.character(mfkm_c_geneid$fa),
mo=as.character(mfkm_c_geneid$mo), covariates=NULL, Ninitial=1)
pvalue1 <- MFKM(obj=obj1, genotypes=mfkm_c_gene, weights=NULL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.