xSNP2eGenes | R Documentation

## Function to define eQTL genes given a list of SNPs or a customised eQTL mapping data

### Description

`xSNP2eGenes` is supposed to define eQTL genes given a list of SNPs or a customised eQTL mapping data. The eQTL weight is calcualted as Cumulative Distribution Function of negative log-transformed eQTL-reported signficance level.

### Usage

    xSNP2eGenes(data, include.eQTL = NA, eQTL.customised = NULL,
    cdf.function = c("empirical", "exponential"), plot = FALSE,
    verbose = TRUE,
    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 number; for example, 'chr16:28525386'
`include.eQTL` | the eQTL supported currently. By default, it is 'NA' to disable this option. Pre-built eQTL datasets are detailed in `xDefineEQTL`

`eQTL.customised`

a user-input matrix or data frame with 4 columns: 1st column for SNPs/eQTLs, 2nd column for Genes, 3rd for eQTL mapping significance level (p-values or FDR), and 4th for contexts (required even though only one context is input). Alternatively, it can be a file containing these 4 columns. It is designed to allow the user analysing their eQTL data. This customisation (if provided) will populate built-in eQTL data

`cdf.function` | a character specifying a Cumulative Distribution Function (cdf). It can be one of 'exponential' based on exponential cdf, 'empirical' for empirical cdf
`plot` | logical to indicate whether the histogram plot (plus density or CDF plot) should be drawn. By default, it sets to false for no plotting
`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`: eQTL-containing genes

- `SNP`: eQTLs

- `Sig`: the eQTL mapping significant level (the best/minimum)

- `Weight`: the eQTL weight

### Note

none

### See Also

`xRDataLoader`

### Examples

    ## Not run:
    # Load the library
    library(Pi)

    ## End(Not run)

    RData.location <- "http://galahad.well.ox.ac.uk/bigdata"
    ## Not run:
    # a) provide the SNPs with the significance info
    data(ImmunoBase)
    gr <- ImmunoBase$AS$variants
    AS <- as.data.frame(GenomicRanges::mcols(gr)[, c('Variant','Pvalue')])

    # b) define eQTL genes
    df_eGenes <- xSNP2eGenes(data=AS[,1], include.eQTL="JKscience_TS2A",
    RData.location=RData.location)

    ## End(Not run)