Description Usage Arguments Value Author(s) See Also Examples
View source: R/permutationSimpleLmMatrix.R
permutationSimpleLmMatrix is a permutation test to calculate the empirical p values for the weighted simple linear regression model based on the weighted Pearson correlation.
1 2 |
fc |
a vector of numeric values representing the gene expression fold change |
net |
a matrix of numeric values in the size of gene number x gene set number, representing the connectivity betwen genes and gene sets |
weights |
a vector of numeric values representing the weights of permuted genes |
num |
an integer value representing the number of permutations |
step |
an integer value representing the number of permutations in each step |
verbose |
an boolean value indicating whether or not to print output to the screen |
a data frame comprising following columns:
term a vector of character values incidating the name of gene set.
usedGenes a vector of numeric values indicating the number of gene used in the model.
observedCorr a vector of numeric values indicating the observed weighted Pearson correlation coefficients.
empiricalPval a vector of numeric values [0,1] indicating the permutation-based empirical p values.
BayesFactor a vector of numeric values indicating the Bayes Factor for the multiple test correction.
Shijia Zhu, shijia.zhu@mssm.edu
orderedIntersect
; permutationSimpleLm
;
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 | # load data
data(heart.metaXcan)
gene <- heart.metaXcan$gene_name
# extract the imputed Z-score of gene differential expression, which follows
# the normal distribution
fc <- heart.metaXcan$zscore
# use as weights the prediction R^2 and the fraction of imputation-used SNPs
usedFrac <- heart.metaXcan$n_snps_used / heart.metaXcan$n_snps_in_cov
r2 <- heart.metaXcan$pred_perf_r2
weights <- usedFrac*r2
# build a new data frame for the following weighted linear regression-based
# enrichment analysis
data <- data.frame(gene,fc,weights)
head(data)
net <- MSigDB.KEGG.Pathway$net
# intersect the permuted genes with the gene sets of interest
data2 <- orderedIntersect( x = data , by.x = data$gene ,
by.y = rownames(net) )
net2 <- orderedIntersect( x = net , by.x = rownames(net) ,
by.y = data$gene )
all( rownames(net2) == as.character(data2$gene) )
# the SGSEA.res1 uses the weighted simple linear regression model,
# while SGSEA.res2 used the weighted Pearson correlation. The latter one
# takes substantially less time.
# system.time(SGSEA.res1<-permutationSimpleLm(fc=data2$fc, net=net2,
# weights=data2$weights, num=1000))
system.time(SGSEA.res2<-permutationSimpleLmMatrix(fc=data2$fc, net=net2,
weights=data2$weights, num=1000))
head(SGSEA.res2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.