Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/combineBypathway_Kai_C.R
Calculate observed and permutation p-values for SNPs
1 | runPermutations(snp.list, pheno.list, family, op=NULL)
|
snp.list |
A list describing the SNP data. See |
pheno.list |
A list describing the covariate and response data. See |
family |
1 or 2, 1 = logistic regression, 2 = linear regression. |
op |
List of options. See |
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.
The returned value is NULL, however 2 output files are created as defined by op$obs.outfile
and op$perm.outfile
.
Kai Yu and William Wheeler
single.marker.test
snp.list
pheno.list
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.