xSNP2nGenes | R Documentation

## Function to define nearby genes given a list of SNPs

### Description

`xSNP2nGenes` is supposed to define nearby genes given a list of SNPs within certain distance window. The distance weight is calcualted as a decaying function of the gene-to-SNP distance.

### Usage

    xSNP2nGenes(data, distance.max = 2e+05, decay.kernel = c("rapid",
    "slow", "linear", "constant"), decay.exponent = 2,
    GR.SNP = c("dbSNP_GWAS", "dbSNP_Common", "dbSNP_Single"),
    GR.Gene = c("UCSC_knownGene", "UCSC_knownCanonical"),
    include.TAD = c("none", "GM12878", "IMR90", "MSC", "TRO", "H1", "MES",
    "NPC"), verbose = T,
    RData.location = "http://galahad.well.ox.ac.uk/bigdata")

### Arguments

`data` | an input vector containing SNPs. SNPs should be provided as dbSNP ID (ie starting with rs). Alternatively, they can be in the format of 'chrN:xxx', where N is either 1-22 or X, xxx is genomic positional number; for example, 'chr16:28525386'
`distance.max` | the maximum distance between genes and SNPs. Only those genes no far way from this distance will be considered as seed genes. This parameter will influence the distance-component weights calculated for nearby SNPs per gene
`decay.kernel` | a character specifying a decay kernel function. It can be one of 'slow' for slow decay, 'linear' for linear decay, and 'rapid' for rapid decay. If no distance weight is used, please select 'constant'
`decay.exponent` | a numeric specifying a decay exponent. By default, it sets to 2

`GR.SNP`

the genomic regions of SNPs. By default, it is 'dbSNP_GWAS', that is, SNPs from dbSNP (version 146) restricted to GWAS SNPs and their LD SNPs (hg19). It can be 'dbSNP_Common', that is, Common SNPs from dbSNP (version 146) plus GWAS SNPs and their LD SNPs (hg19). Alternatively, the user can specify the customised input. To do so, first save your RData file (containing an GR object) into your local computer, and make sure the GR object content names refer to dbSNP IDs. Then, tell "GR.SNP" with your RData file name (with or without extension), plus specify your file RData path in "RData.location". Note: you can also load your customised GR object directly

`GR.Gene`

the genomic regions of genes. By default, it is 'UCSC_knownGene', that is, UCSC known genes (together with genomic locations) based on human genome assembly hg19. It can be 'UCSC_knownCanonical', that is, UCSC known canonical genes (together with genomic locations) based on human genome assembly hg19. Alternatively, the user can specify the customised input. To do so, first save your RData file (containing an GR object) into your local computer, and make sure the GR object content names refer to Gene Symbols. Then, tell "GR.Gene" with your RData file name (with or without extension), plus specify your file RData path in "RData.location". Note: you can also load your customised GR object directly

`include.TAD`

TAD boundary regions are also included. By default, it is 'none' to disable this option. Otherwise, inclusion of a TAD dataset to pre-filter SNP-nGene pairs (i.e. only those within a TAD region will be kept). TAD datasets can be one of "GM12878" (lymphoblast), "IMR90" (fibroblast), "MSC" (mesenchymal stem cell) ,"TRO" (trophoblasts-like cell), "H1" (embryonic stem cell), "MES" (mesendoderm) and "NPC" (neural progenitor cell). Explanations can be found at http://dx.doi.org/10.1016/j.celrep.2016.10.061

`verbose` | logical to indicate whether the messages will be displayed in the screen. By default, it sets to true for display
`RData.location` | the characters to tell the location of built-in RData files. See `xRDataLoader` for details

### Value

a data frame with following columns:

- `Gene`: nearby genes

- `SNP`: SNPs

- `Dist`: the genomic distance between the gene and the SNP

- `Weight`: the distance weight based on the genomic distance

- `Gap`: the genomic gap between the gene and the SNP (in the form of 'chr:start-end')

- `TAD`: if applied, it can be 'Excluded' or the TAD boundary region (in the form of 'chr:start-end') that the genomic interval falls into. Also if SNP within the gene body, Gap and TAD will be SNP location (in the form of 'chr:start-end')

### Note

For details on the decay kernels, please refer to `xVisKernels`

### See Also

`xRDataLoader`, `xVisKernels`

### Examples

    ## Not run:
    # Load the XGR package and specify the location of built-in data
    library(XGR)
    RData.location <- "http://galahad.well.ox.ac.uk/bigdata"

    # a) provide the seed SNPs with the significance info
    ## load ImmunoBase
    ImmunoBase <- xRDataLoader(RData.customised='ImmunoBase',
    RData.location=RData.location)
    ## get lead SNPs reported in AS GWAS and their significance info (p-values)
    gr <- ImmunoBase$AS$variant
    data <- names(gr)

    # b) define nearby genes
    df_nGenes <- xSNP2nGenes(data=data, distance.max=200000,
    decay.kernel="slow", decay.exponent=2, RData.location=RData.location)

    # c) define nearby genes (considering TAD boundary regions in GM12878)
    df_nGenes <- xSNP2nGenes(data=data, distance.max=200000,
    decay.kernel="slow", decay.exponent=2, include.TAD='GM12878',
    RData.location=RData.location)

    ## End(Not run)