############################################################################################################## # README for WeightFunctions.R # These function is an R-compliant function. # R is a free-downloadable software from http://www.r-project.org/ # # Author: Yen-Yi Ho # Email: yho@umn.edu # Last Modified: April 17, 2013 # Version: 1.0.1 # License information: GNU GENERAL PUBLIC LICENSE version 3 @ http://www.gnu.org/licenses/gpl.html #################################################################################################################### ################ mylm function ########################################################################### Description:It is an internal function. mylm function is for fast calculation of regression coefficient from linear regression model with intercept. Usage: mylm(x=x, y=y) Arguments: X: covariate matrix (n x p), p is the number of covariates Y: (n x 1) matrix, for response variable ################ isna ########################################################################### Description:It is an internal function. ################ WTestt3 function usage############################################################################ Description: WTestt3 is a function for calculating weights using (SNP + E + D) data. Usage: WTestt3(data, ptrim1=sqrt(0.05), ptrim2=sqrt(0.05), floor=1) Arguments: data: a matrix with obervations in rows and (SNP + E +D) in columns. SNP needs to have column names with character string "rs", and E needs to have column names with character string "ILMN" or "X". Disease (phenotype outcome) vector needs to be label as "D". ptrim1: The value to set Wle=floor, if Wle < chisq(1,ptrim1), default is sqrt(0.05) ptrim1: The value to set Wed=floor, if Wed < chisq(1,ptrim2), default is sqrt(0.05) floor: The value of Wld and Wed if Wle< chisq(1, ptrim1) or Wed < chisq(1, ptrim2) Value: WTestt3 returns p x 2 matrix, where p is the number of SNP markers. The first column is GWAS p value, and second column reports weight. Examples: ###################### Example 1: source("WeightFunctions.R") PubL<-read.delim("PubL.txt", header=TRUE, sep="\t") PubE<-read.delim2("PubE.txt", header=TRUE, sep="\t") PubD<-read.delim("PubD.txt", header=TRUE, sep="\t") whL<-grep("rs", colnames(PubL))[1:10] myL<-PubL[,whL] whE<-grep("X", colnames(PubE))[1:10] myE<-PubE[,whE] D<-PubD[,7] data<-cbind(myL, myE, D) WTestt3(data)