coloc.genome: coloc.genome

Description Usage Arguments Value Author(s) Examples

View source: R/genome_wide_moloc.R

Description

Genome-wide co-localization with three traits

Usage

1
2
3
4
coloc.genome(listData, bed, prefix = "pref", save.SNP.info = FALSE,
  cores = 20, have_alleles = TRUE, bychrpos = TRUE,
  prior_var = "default", priors = c(1e-04, 1e-06, 1e-07), min_nsnps = 50,
  takelog = FALSE, write = TRUE, outfolder = "test", forcePVAL = FALSE)

Arguments

listData,

a list of data frames in this order: gwas, and other QTLs The data frames need to have columns: "SNP" or "CHR", "POS"; "BETA", "SE"; "N", "MAF" (to estimate sdY) if a case control: "Ncases" If eqtl/mqtl: "ProbeID" Optionally, "A1", "A2" if want to match alleles

bed,

a data frame with "CHR", "START", "STOP", and "ProbeID" matching either eqtl or mqtl

prefix,

character, name to give to the output file

save.SNP.info,

logical, should info of each SNP be saved? If this option is true, beware that it will takes up a lot of time and space.

cores,

number. See foreach package.

have_alleles,

logical. If TRUE, matches alleles to be the same as gwas data.

bychrpos,

logical. If TRUE, uses "CHR", "POS" columns as SNP id to match across data frames; If TRUE, make sure not to have another column called "SNP".

prior_var,

numeric vector specifying any number of values; These will be used to average the ABF computation across different prior variances.

priors,

numeric vectors with three numbers; First number is the prior of associaion of a SNP with any of the traits; Second number is the prior of a SNP being associated with two traits; Third number is the prior of a SNP being associated with three traits.

min_nsnps,

number. The minimum number of matching SNPs across the three data frames to consider.

outfolder,

path of folder where the results will be written to

Value

results in outfolder: text file with colocalization results for each locus; text file with removed snps; if save.SNP.info = TRUE, a folder called "coloc.output.perSNP" will save a file per locus with SNP information such as ABF (one row per matching SNP)

Author(s)

Claudia Giambartolomei

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(mvtnorm)
library(foreach)
library(doParallel)
library(data.table)

Create bed file with combination of ProbeIDs
library(GenomicRanges)
DT <- as.data.table(data_genome[[3]])
methyl_table <- DT[, list(CHR= unique(CHR), START = min(POS), STOP = max(POS)), by = ProbeID]
bed1.gr <- GRanges(seqnames = bed$CHR,IRanges(start = bed$START, end= bed$STOP))
bed2.gr <- GRanges(seqnames = methyl_table$CHR,IRanges(start =methyl_table$START, end= methyl_table$STOP))
my.overlap <- findOverlaps(query = bed2.gr, subject = bed1.gr)
bed = cbind(bed[my.overlap@subjectHits,], methyl_table[my.overlap@queryHits,])
bed = bed[,c(1,6,7,8,9,10)]
Setting the prior_var to "default" uses coloc defaults
coloc.genome(listData = data_genome, bed, cores=1, have_alleles=TRUE, bychrpos=TRUE, prior_var=NULL, priors=c(1e-04, 1e-06, 1e-07), min_nsnps = 50, write=FALSE, outfolder = "test")

clagiamba/moloc documentation built on Jan. 25, 2021, 2:43 a.m.