Function to perform allele flip QC and harmonization on the weights and GWAS against LD for a region. FIXME: GWAS loading function from Haochen for both tabix & column-mapping yml application
Source:R/twas.R
harmonize_twas.RdFunction Conditions: - processes data in the format of either the output from load_twas_weights/generate_twas_db or refined_twas_weights_data from twas pipeline. - For the first format, we expect there is only one gene/events's information, that can be accessed through `region_info_obj` and refined_twas_weights_data contains per region multiple gene/event's refined weights data.
Usage
harmonize_twas(
twas_weights_data,
ld_meta_file_path,
gwas_meta_file,
column_file_path = NULL,
comment_string = "#"
)Arguments
- twas_weights_data
List of list of twas weights output from from generate_twas_db function.
- ld_meta_file_path
A tab-delimited data frame with colname "#chrom", "start", "end", "path", where "path" column contains file paths for both LD matrix and bim file and is separated by ",". Bim file input would expect no headers, while the columns are aligned in the order of "chrom", "variants", "GD", "pos", "A1", "A2", "variance", "allele_freq", "n_nomiss".
- gwas_meta_file
A file path for a dataframe table with column of "study_id", "chrom" (integer), "file_path", "column_mapping_file". Each file in "file_path" column is tab-delimited dataframe of GWAS summary statistics with column name "chrom" (or #chrom" if tabix-indexed), "pos", "A2", "A1".