R/ctwas_harmonize_data.R
harmonize_wgt_ld.Rd
Harmonize z scores from GWAS to match ld reference genotypes. Flip signs when reverse complement matches, remove/recover strand ambiguous SNPs
harmonize_wgt_ld(
wgt.matrix,
snps,
ld_snpinfo,
recover_strand_ambig = T,
ld_pgenfs = NULL,
ld_Rinfo = NULL,
R_wgt = NULL,
wgt = NULL
)
from FUSION weight .Rdat file
from FUSION weight .Rdat file with columns "chrom", "id", "pos", "alt", "ref". The effect allele for FUSION is alt.
a data frame, snp info for LD reference, with columns "chrom", "id", "pos", "alt", "ref".
TRUE/FALSE. If TRUE, a procedure is used to recover strand ambiguous variants. If FALSE, these variants are dropped from the prediction model. This procedure compares correlations between variants in the the LD reference and prediction models, and it can only be used with PredictDB format prediction models, which include this information.
a character vector of .pgen or .bed files. One file for one chromosome, in the order of 1 to 22. Therefore, the length of this vector needs to be 22. If .pgen files are given, then .pvar and .psam are assumed to present in the same directory. If .bed files are given, then .bim and .fam files are assumed to present in the same directory.
a vector of paths to the variant information for all LD matrices
the LD matrix for the variants in wgt.matrix
allele information from the weights
wgt.matrix and snps with alleles flipped to match