get_lead_snp: Get the lead SNP from the list of SNPs in input data.frame...

View source: R/locuscompare.R

get_lead_snpR Documentation

Get the lead SNP from the list of SNPs in input data.frame The lead SNP is defined as the SNP with the lowest sum of p-values from the two studies.

Description

Get the lead SNP from the list of SNPs in input data.frame The lead SNP is defined as the SNP with the lowest sum of p-values from the two studies.

Usage

get_lead_snp(merged, snp = NULL)

Arguments

merged

(data.frame) Input data.frame, which is a result by merging two association studies.

snp

(string, optional) SNP rsID. If NULL, the function will select the lead SNP based on the sum of p-values from the two studies. If an rsID is supplied, the function will simply return the rsID.

Examples

# Select the lead SNP
in_fn_1 = system.file('extdata', 'gwas.tsv', package = 'locuscomparer')
d1 = read_metal(in_fn_1, marker_col = 'rsid', pval_col = 'pval')
in_fn_2 = system.file('extdata', 'gwas.tsv', package = 'locuscomparer')
d1 = read_metal(in_fn_2, marker_col = 'rsid', pval_col = 'pval')
merged = merge(d1, d2, by = "rsid", suffixes = c("1", "2"), all = FALSE)
get_lead_snp(merged)

boxiangliu/locuscomparer documentation built on Nov. 27, 2022, 7:26 a.m.