Learn R Programming

ARTP (version 2.0.5)

runPermutations: Calculate observed and permutation p-values for SNPs

Description

Calculate observed and permutation p-values for SNPs

Usage

runPermutations(snp.list, pheno.list, family, op=NULL)

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.

Value

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

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.

  • nperm Number of permutations. The default is 100.

  • obs.outfile Output file for the observed results. The default is "obs.txt".

  • perm.outfile Output file for the permuted results. The default is "perm.txt".

  • perm.method 1 or 2 for the type of permutation. 1 is to permute the SNPs. 2 is to generate a new response using the base model. For a continuous response, the residuals from the base model are permuted and then added to the linear predictors from the base model to give the new response vector. For a binary response, the new response vector is rbinom(n, 1, vals), where vals are the fitted values from the base model. The default is 2.

  • min.count See single.marker.test. The default is 5.

  • miss.rate Maximum missing rate to include SNPs. Any SNP with missing rate greater than miss.rate will be excluded. The default is 0.20.

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.

See Also

single.marker.test snp.list pheno.list

Examples

Run this code
# NOT RUN {
  # 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)  

# }

Run the code above in your browser using DataLab