# NOT RUN {
# }
# NOT RUN {
# Load genomewide gene expression data in GEUVADIS
# 373 individuals
# 23722 genes
data_githubURL <- "https://github.com/audreyqyfu/mrpc_data/raw/master/data_GEUVADIS_allgenes.RData"
load(url(data_githubURL))
PCs <- prcomp(data_GEUVADIS_allgenes,scale=TRUE)
# Extract the PCs matrix
PCs.matrix <- PCs$x
# The eQTL-gene set contains eQTL rs7124238 and genes SBF1-AS1 and SWAP70
data_GEU_Q50 <- data_GEUVADIS$Data_Q50$Data_EUR
colnames(data_GEU_Q50) <- c("rs7124238","SBF2-AS1","SWAP70")
data <- data_GEU_Q50
# Identify associated PCs for this eQTL-gene set
Output <- IdentifyAssociatedPCs(PCs.matrix,no.PCs=10,data,fdr.level=0.05,corr.threshold=TRUE
,corr.value = 0.3)
# Gene SBF2-AS1 is significantly associated with PC2
# Data with PC2 as a potential confounder
data_withPC <- Output$data.withPC
n <- nrow(data_withPC) # Number of rows
V <- colnames(data_withPC) # Column names
# Calculate Pearson correlation for MRPC analysis
suffStat <- list(C = cor(data_withPC,use = "complete.obs"),
n = n)
# Infer the graph by MRPC
MRPC.fit_FDR<- MRPC(data_withPC,
suffStat,
GV = 1,
FDR = 0.05,
indepTest = 'gaussCItest',
labels = V,
FDRcontrol = 'LOND',
verbose = TRUE)
plot(MRPC.fit_FDR, main="MRPC with PCs (potential confounders)")
# }
Run the code above in your browser using DataLab