calc.fun: calc.fun

Description Usage Arguments Value See Also Examples

Description

This function calculates the marginal association p-values and test statistics for individual SNPs.

Usage

1
    calc.fun(cl=NULL, snp.dat, y, weights=NULL, snp.method=c("logiReg","chiSq") )

Arguments

cl

Cluster object for parallel computing. We recommand using the ‘snow’ and ‘Rmpi’ libraries to generate the clusters. See examples for illustration. If clusters are not provided, cl=NULL, computing will be conducted on the local machine. Parallel computing is optional but highly recommended.

snp.dat

A matrix with snp data. Data are coded as 0, 1, 2, corresponding to homozygotes for the major allele, heterozygotes, and homozygotes for the minor allele, respectively. Each row of the matrix is one SNP and each column represents one subject.

y

A vector of case/control status. Cases are coded as 1 and controls are coded as 0.

weights

An optional numerical vector specifying each subject’s sample weight, the inverse probability that the subject is selected. Use of weights requires loading the libraries ‘Zelig’ and ‘survey’.

snp.method

An optional character string which specifies the method used to compute statistics for the marginal association analysis of each individual SNP. Two options are provided. By default, snp.method ="logiReg", logistic regression (additive effect model) will be used. If snp.method = "chiSq", chi-square test will be conducted.

Value

Returns a list of two vectors:

pval

A numerical vector of p-values for each SNP.

stat

A numerical vector of test statistics for each SNP.

See Also

aligator , gseaSnp , grass , plinkSet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
  data(simDat)
  
  library(snow)
  cl <- makeCluster(c("localhost","localhost"), type = "SOCK")

  snp.pval <- calc.fun(cl=cl, snp.dat=snpDat, y=y, weights=NULL, snp.method="logiReg" )

  ## weighted analysis
  ## require the library Zelig and survey
  
  library(Zelig)
  library(survey)
  weights <- runif(length(y), 0.5, 1.5)  ## simulate some weights
  snp.pval.w <- calc.fun(cl=cl, snp.dat=snpDat, y=y, weights=weights, snp.method="logiReg" )

lschen-stat/SNPath documentation built on May 30, 2019, 7:14 p.m.