Wrapper to run single-trait fine-mapping with FINEMAP on each trait, followed by flashfm and then constuct SNP groups for each approach and summarises results

FLASHFMwithFINEMAP(
  gwas.list,
  corX,
  raf,
  ybar,
  N,
  fstub,
  TOdds = 1,
  covY,
  cpp = 0.99,
  NCORES,
  FMpath
)

Arguments

gwas.list

a list containing a data.frame for each trait; each data.frame has columns "rsid", "chromosome", "position", "allele1", "allele2", "maf", "beta", "se"; this is the same as z file of FINEMAP

corX

genotype correlation matrix (reference or from sample); needs SNP column and row names OR if no names, it takes the names for the raf vector. The SNPs in corX MUST be in the same order as the SNPs in the raf vector.

raf

named vector of reference allele frequencies; the name of each allele frequency is the SNP ID and MUST be in same SNP order as in corX

ybar

vector of trait means; if traits are transformed to be standard Normal, could set ybar as 0-vector

N

vector of sample sizes for each trait; recommended to give effective sample sizes using GWAS summary statistics in Neff function

fstub

file stub for input/output files of FINEMAP, e.g. if fstub="DIRresults/region1", FINEMAP files of the form "DIRresults/region1.z" will be created

TOdds

target odds of no sharing to sharing; default is 1

covY

trait covariance matrix (for at most 5 traits and all traits should have a signal in the region, e.g. min p < 1E-6)

cpp

cumulative posterior probability threshold for selecting top models; default cpp=0.99

NCORES

number of cores for parallel computing; recommend NCORES=M, but if on Windows, use NCORES=1

FMpath

file pathway to FINEMAP software e.g. "/software/finemap_v1.4_x86_64/finemap_v1.4_x86_64"

Value

list with 2 components: mpp.pp, a list with 4 components giving the SNP-level results (mpp.pp$PP,mpp.pp$MPP) and SNP group level results (mpp.pp$MPPg, mpp.pp$PPg); and snpGroups, a list with 2 components giving the SNP groups construced under single-trait (snpGroups[[1]]) and multi-trait fine-mapping (snpGroups[[2]])