runPermutations: Calculate observed and permutation p-values for SNPs

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/combineBypathway_Kai_C.R

Description

Calculate observed and permutation p-values for SNPs

Usage

1

Arguments

snp.list

A list describing the SNP data. See snp.list

pheno.list

A list describing the covariate and response data. See pheno.list

family

1 or 2, 1 = logistic regression, 2 = linear regression.

op

List of options. See details.

Details

This function first reads the data stored in the files defined by snp.list and pheno.list. The subject ids in snp.list$file and pheno.list$file are matched and any subject not in both files will be removed from the analysis. Also, any subject with a missing value for the response or covariate will be removed. The function single.marker.test is called for each observed SNP and for each permutation. Depending on the response variable and genotype frequency counts, single.marker.test will call glm.fit, fisher.test or lm.
Running a large number of permutations on a single machine could take a long time. However, if the user has access to multiple machines, then the permutations can be broken up across the different machines for faster computation. A different random seed should be set for each machine, and the output permutation files would need to be combined into a single file before calling ARTP_pathway.

Options list:
Below are the names for the options list op. All names have default values if they are not specified.

obs.outfile will be a comma delimited file containing 5 rows:
Row 1 contains the SNP ids.
Row 2 contains the SNP p-values.
Row 3 contains a value for how the p-value was computed (see the details of single.marker.test).
Row 4 contains the estimate of the SNP main effect.
Row 5 contains the estimated standard error of the SNP main effect.
perm.outfile will be a comma delimited file, where each row are the permutation p-values for all SNPs.

Value

The returned value is NULL, however 2 output files are created as defined by op$obs.outfile and op$perm.outfile.

Author(s)

Kai Yu and William Wheeler

See Also

single.marker.test snp.list pheno.list

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
  # Define snp.list
 geno_file <- system.file("sampleData", "geno_data.txt", package="ARTP")
 snp.list <- list(file=geno_file, file.type=2, delimiter="\t")

 # Define pheno.list
 pheno_file <- system.file("sampleData", "pheno_data.txt", package="ARTP")
 pheno.list <- list(file=pheno_file, delimiter="\t", id.var="ID",
                    response.var="Y", main.vars=c("X1", "X2"))

 # Options list. Change obs.outfile and perm.outfile if needed.
 op <- list(nperm=10, obs.outfile="./obs.txt", perm.outfile="./perm.txt",
            perm.method=2)

 # Not run
 # runPermutations(snp.list, pheno.list, 1, op=op)  

ARTP documentation built on May 2, 2019, 6:51 a.m.