merge_rsids_into_gwas: Method to merge back rsids from a subset of a gwas into a...

Description Usage Arguments Value Examples

Description

Method to merge back rsids from a subset of a gwas into a full gwas where they were missing

Usage

1
merge_rsids_into_gwas(gwas, rsids, validate = TRUE)

Arguments

gwas

a dataframe containing the gwas with CHR POS NEA and EA

rsids

another gwas which contained a subset of the rows in gwas, presumably with some rsids updated. #' @param validate a boolean indicating whether to validate the resulting gwas (TRUE by default) use FALSE for debugging.

Value

original input gwas with available rsids replacing rsids where possible

Examples

1
2
3
4
5
6
7
8
9
any(is.na(demo_data$rsid)) # TRUE
fixed_partial_gwas <- get_unknown_rsids_from_locus(demo_data)
any(is.na(fixed_partial_gwas$rsid)) # FALSE
nrow(fixed_partial_gwas) == nrow(demo_data) # FALSE
fixed_gwas <- merge_rsids_into_gwas(demo_data, fixed_partial_gwas)
nrow(fixed_gwas) == nrow(demo_data) # TRUE

still_demo_data <- merge_rsids_into_gwas(demo_data, subset(fixed_partial_gwas, FALSE)) # same as original
dplyr::all_equal(still_demo_data, demo_data) # TRUE

richardslab/MRutils documentation built on Dec. 22, 2021, 4 p.m.