Skip to contents

This function takes MR results (involving pQTL/QTL) to look up QTLs in trait GWASs given a P value and linkage disequilibrium (LD) cutoffs. The rationale is that a pQTL may not necessarily be in strong LD with QTL but some other independent signal in the same region. The interest then lands on association signals below a given P value (p_threshold) and above a given LD (r2_threshold) thresholds.

Usage

qtl_lookup(
  d,
  dat,
  panel = "1000Genomes",
  p_threshold = 0.001,
  r2_threshold = 0.8,
  pop = "EUR",
  plink_bin = NULL,
  r = NULL,
  r2 = NULL,
  xlsx = NULL
)

Arguments

d

directory where dat (below) is held.

dat

MR results (protein, id, pqtl,p, qtl, p_qtl) whose proxy, p_proxy and rsq variables will be updated.

panel

reference panel.

p_threshold

cutoff of QTL association from trait GWASs.

r2_threshold

cutoff of r^2.

pop

reference population from 1000Genomes for LD calculation.

plink_bin

PLINK executable file whose binary files are indicated in bfile variable of dat.

r

when specified, the LD(r) is output.

r2

when specified, the LD(r^2) is output.

xlsx

a non-null specification indicates name of an output Excel workbook.

Value

A data.frame containing the looked up loci.

Examples

if (FALSE) {
options(width=200)
INF <- Sys.getenv("INF")
suppressMessages(library(dplyr))
d <- file.path(INF,"mr","gsmr","trait")
inf1 <- select(gap.datasets::inf1,prot,target.short)
gsmr_efo <- read.delim(file.path(INF,"mr","gsmr","gsmr-efo.txt")) %>%
            left_join(inf1,by=c('protein'='target.short')) %>%
            mutate(file_gwas=paste(prot,id,"rsid.txt",sep="-"),
                   bfile=file.path(INF,"INTERVAL","per_chr",
                                   paste0("interval.imputed.olink.chr_",chr)),
                   proxy=NA,p_proxy=NA,rsq=NA)
proxies <- qtl_lookup(d,gsmr_efo,plink_bin="/rds/user/jhz22/hpc-work/bin/plink",
                      xlsx=file.path(INF,"mr","gsmr","r2_INTERVAL.xlsx")) %>%
           select(protein,id,Disease,fdr,pqtl,p,qtl,p_qtl,proxy,p_proxy,rsq)
write.table(proxies,file=file.path(INF,"mr","gsmr","r2_INTERVAL.tsv"),
            row.names=FALSE,quote=FALSE,sep="\t")
}