Flip GWAS variants to align with SNP correlation matrix (LD) from reference panel or in-sample

alignGWAS(gwas, RPinfo, details = FALSE)

Arguments

gwas

GWAS data.frame with the following columns (any order, could have others but require these): "rsID" (variant ID), "EA" (effect allele), "NEA" (non-effect allele), "beta" (effect size), "EAF" (effect allele frequency)

RPinfo

reference panel (or in-sample) details data.frame with the following columns (any order): "rsID" (variant ID), "allele1", "allele2" (this function will align the gwas to allele1, but either allele1 or allele2 may be used - need consistency for correlation signs)

details

default value is FALSE to return only the aligned GWAS data.frame; TRUE will also return names of excluded snps

Value

if details=FALSE, return only data.frame of gwas aligned to reference panel (RP) or in-sample LD if details=TRUE: a list with three components: gwasA = gwas aligned to reference panel (RP) or in-sample LD; excluded = gwas variants that are excluded (not in RP, incompatible alleles (even if flip)); ind_excl = indices of removed rows from imput gwas

Author

Jenn Asimit