Description Usage Arguments Value Author(s) See Also Examples
This function creates a random gene set of approximately the same composition (same number of genes with the same number of SNPs) as the specified gene set. As part of a gene set (pathway) analysis, this procedure can be used to calculate a null distribution of association statistics for each pathway being tested.
1 | makeRandomGS(geneSetComp, geneBins)
|
geneSetComp |
A table providing the number of genes of each size in the gene set, as created with the function |
geneBins |
A list containing gene bins and bin boundaries, as created with the function |
Returns a vector of gene IDs randomly selected to approximately match the composition of the specified gene set.
Michael Mooney <mooneymi@ohsu.edu>
makeGeneBins
, getGeneSetComposition
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # This example uses the GRASS algorithm implemented in the SNPath package to calculate association statistics
## Not run:
library(SNPath)
library(snow)
# Create a SNOW cluster for parallel processing
cl <- makeCluster(c("localhost","localhost"), type = "SOCK")
## End(Not run)
data(sampleGSA)
# Get gene sizes, and bin genes by size
snpCounts = getGeneSizes(snpMap)
geneBins = makeGeneBins(snpCounts, 25)
# Get the composition of the target pathway
gsComp = getGeneSetComposition(snpCounts, pathways[[1]])
# Create random pathways (gene sets) that approximately match the composition of the target pathway
numPerms = 100
x = lapply(c(1:numPerms), function(x){gsComp})
names(x) = c(1:numPerms)
randomPathways = lapply(x, function(y){makeRandomGS(y, geneBins=geneBins)})
## Not run:
# Calculate association p-values for each random gene set (see SNPath documentation)
randPathPvals = grass(cl=cl, snp.info=snp.info, gene.info=gene.info, gene.set=randomPathways, y=y, gene.def="abs", dist=1000, nominal.p=T)
stopCluster(cl)
# Assuming the p-value of the target pathway has already been calculated,
# the permutation p-value is calculated as the proportion of random pathways
# with a p-value less than the p-value of the target pathway
permPval = (sum(randPathPvals < targetPathPval)+1)/(numPerms+1)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.