MKM: KM for Quantitative Traits in Multivariate GWAS Data...

Description Usage Arguments Value Examples

View source: R/MKM.R

Description

This function (MKM) is used to perform KM analysis (Tzeng et al. 2012) for quantitative traits in GWAS multivariate data.

Usage

1
2
3
4
5
6
7
8
9
MKM(
  obj,
  genotypes,
  gid,
  weights = NULL,
  acc = 1e-04,
  append.write = NULL,
  eq.gen.effect = F
)

Arguments

obj

results saved from MKM_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.

gid

A vector of id mapping to samples in genotype file (class: vector). So the order of samples in gid must be the same as the order in genotypes. Make sure it is not a factor. Although gid doesn't have to be in the same order as yid, it is suggested to make them sorted in the same order in order to make all files easily to be tracked. No missing.

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

Value

output: multivariate KM (M-KM) p-value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
###############################################################################
### Examples for Multivariate (two) Continuous Traits in GWAS Data using KM ###
###############################################################################
### Subject IDs are numeric ###
data("MKM_numID")
obj1 <- MKM_Null_Model(phenotype=mkm_n_ph$y, trait=mkm_n_ph$trait, yid=mkm_n_ph$id,
covariates=NULL)
pvalue1 <- MKM(obj=obj1, genotypes=mkm_n_gene, gid=mkm_n_geneid$gid, weights=NULL) 
# Read in a list of genes files instead of a big file containing all genes
obj <- MKM_Null_Model(phenotype=mkm_n_ph$y, trait=mkm_n_ph$trait, yid=mkm_n_ph$id,
covariates=NULL)
gene <- split(mkm_n_gene, mkm_n_gene[,1])
for (k in 1:2) {
  gene[[k]]$gene <- as.character(gene[[k]]$gene)
  pvalue1 <- MKM(obj=obj, genotypes=gene[[k]], gid=mkm_n_geneid$gid, weights=NULL)
}
### Subject IDs are character ###
data("MKM_charID")
obj1 <- MKM_Null_Model(phenotype=mkm_c_ph$y, trait=mkm_c_ph$trait,
yid=as.character(mkm_c_ph$id), covariates=NULL)
pvalue1 <- MKM(obj=obj1, genotypes=mkm_c_gene, gid=as.character(mkm_c_geneid$gid),
weights=NULL)

KMgene documentation built on July 8, 2020, 6:09 p.m.

Related to MKM in KMgene...