Below is a subset of results from the association of mQTLs and prostate cancer, showing only results for mQTLs associated with cg03227775 (a CpG in CARD11 associated observationally with shift work).

#setwd("C:/Users/ca16591/Dropbox/Bristol")

CARD11 <- read_delim("C:/Users/ca16591/Dropbox/Bristol/CARDL11.mQTLSNPs.csv","\t", escape_double = FALSE, trim_ws = TRUE)
dim(CARD11)
head(CARD11)
names(CARD11)
CARD11$BP <- CARD11$'SNP Pos'
# Obtain list of unique SNPs, taking just the first in the CARD11. 
#new <- do.call(rbind, lapply(split(CARD11, CARD11$SNP), `[`, 1, ))
#dim(new)
#new$SNP

# Read in the results of the association between prostate cancer incidence and mQTLs
#setwd("Z:/data/protect/_devs/PROTECT_Clinical/data")

sorted_pca <- read_csv("Z:/data/protect/_devs/PROTECT_Clinical/data/sorted_pca_results06-02-2017.csv")
meQTL_list <- read.csv("Z:/data/protect/_devs/PROTECT_Clinical/data/meQTL_list.csv", sep="")
meQTL_list$BP <- meQTL_list$chromStart
BP_start <- sorted_pca[which(sorted_pca$BP %in% meQTL_list$BP),]
#mQTL_PCa_GWAS_results <- write.csv(BP_start, "BP_start.csv")

# Use base position (BP) to identify the set of CARD11-mQTL results in BP_start (the PRACTICAL mQTL and PCa analysis I did a few weeks ago)
CARD11_in_GWAS <- CARD11[which(CARD11$BP %in% BP_start$BP),]

# Subset BP_start by the list of CARD11-mqtl BP

CARD11_mQTL_results_in_PCa_mQTL_Analysis <- BP_start[which(BP_start$BP %in% CARD11_in_GWAS$BP),]
CARD11_mQTL_results_in_PCa_mQTL_Analysis
write.csv(CARD11_mQTL_results_in_PCa_mQTL_Analysis, "C:/Users/ca16591/Dropbox/Bristol/CARD11_mQTL_results_in_PCa_mQTL_Analysis.csv")
X1 X1_1 CHR SNP BP A1 A2 FRQ INFO OR SE P
1 1459881 12 12:10945975:G:A 10945975 G A 0.7524 0.9655 1.0216 0.0121 0.07758
2 899003 7 rs1626708:2952886:C:T 2952886 C T 0.2692 0.8628 0.9890 0.0125 0.37480
3 899004 7 rs1182158:2954387:G:A 2954387 G A 0.2466 0.8937 0.9904 0.0126 0.44310
4 899002 7 rs1628709:2950020:C:T 2950020 C T 0.2418 0.8795 0.9904 0.0128 0.45280
5 899014 7 rs1636167:2972072:A:G 2972072 A G 0.2859 0.8666 0.9948 0.0122 0.66990
6 899012 7 rs1713909:2969508:G:A 2969508 G A 0.2328 0.9848 0.9968 0.0123 0.79670
7 899013 7 rs1621509 2969680 G A 0.2288 0.9964 0.9973 0.0123 0.82570
8 899017 7 rs6945582:2976767:G:A 2976767 G A 0.1930 0.8072 1.0031 0.0145 0.83300
9 899005 7 rs1183080:2958504:G:A 2958504 G A 0.2522 0.9403 0.9983 0.0122 0.88940
10 899011 7 rs11773360:2968871:T:C 2968871 T C 0.2401 0.9724 0.9985 0.0122 0.89930
11 899007 7 rs17257217:2963120:C:T 2963120 C T 0.2501 0.9505 0.9985 0.0122 0.90430
12 899015 7 rs1713927:2973104:C:T 2973104 C T 0.1949 0.8718 0.9986 0.0139 0.91840
13 899009 7 rs1182137:2966138:G:A 2966138 G A 0.2484 0.9444 0.9989 0.0123 0.92640
14 899016 7 rs41404646:2974494:C:A 2974494 C A 0.1931 0.8434 0.9994 0.0142 0.96840
15 899008 7 rs1182139:2965269:C:T 2965269 C T 0.2417 0.9525 0.9995 0.0123 0.96940
16 899006 7 rs1636173:2962014:G:A 2962014 G A 0.2494 0.9479 1.0005 0.0122 0.96960
17 899010 7 rs1182135:2967688:C:T 2967688 C T 0.2434 0.9555 1.0000 0.0122 0.99980