map_snp_to_gene {snpsettest} | R Documentation |
Map SNPs to genes
Description
Annotate SNPs onto their neighboring genes (or arbitrary genomic regions) to perform set-based association tests.
Usage
map_snp_to_gene(
info_snp,
info_gene,
extend_start = 20L,
extend_end = 20L,
only_sets = FALSE
)
Arguments
info_snp |
A data frame with columns: "id", "chr", and "pos".
|
info_gene |
A data frame with columns: "gene.id", "chr", "start", and "end".
If a gene has multiple intervals, SNPs mapped to any of them will be merged into a single set. Please assign unique IDs if you don't want this behavior. |
extend_start |
A single non-negative integer, allowing for a certain kb window before the gene to be included. Default is 20 (= 20kb). |
extend_end |
A single non-negative integer, allowing for a certain kb window after the gene to be included. Default is 20 (= 20kb). |
only_sets |
If |
Value
A nested list containing following components:
sets: a named list where each index represents a separate set of SNPs
map: a data frame containing SNP mapping information
Examples
## GWAS summary statistics
head(exGWAS)
## Gene information data
head(gene.curated.GRCh37)
## Map SNPs to genes
snp_sets <- map_snp_to_gene(exGWAS, gene.curated.GRCh37)
## Better to use harmonized GWAS data for gene mapping
bfile <- system.file("extdata", "example.bed", package = "snpsettest")
x <- read_reference_bed(path = bfile)
hsumstats <- harmonize_sumstats(exGWAS, x)
snp_sets <- map_snp_to_gene(hsumstats, gene.curated.GRCh37)