xPierCor | R Documentation

## Function to calculate correlation between prioritised genes and user-defined external data

### Description

`xPierCor` is supposed to calculate correlation between prioritised genes and user-defined external data.

### Usage

    xPierCor(pNode, list_vec, method = c("pearson", "spearman"),
    pvalue.type = c("nominal", "empirical"), seed = 825, nperm = 2000,
    p.adjust.method = c("BH", "BY", "bonferroni", "holm", "hochberg",
    "hommel"), plot = FALSE)

### Arguments

`pNode` | an object of class "pNode" (or "sTarget" or "dTarget"). Alternatively, it can be a data frame with two columns ('name' and 'priority')
`list_vec` | a named vector containing numeric values for genes (gene symbols). Alternatively it can be a list of named vectors
`method` | the method used to calcualte correlation. It can be 'pearson' for Pearson's correlation or 'spearman' for Spearman rank correlation
`pvalue.type` | the type of the p-value calcualted. It can be 'nominal' for nominal p-value or 'empirical' for empirical p-value
`seed` | an integer specifying the seed
`nperm` | the number of random permutations
`p.adjust.method` | the method used to adjust p-values. It can be one of "BH", "BY", "bonferroni", "holm", "hochberg" and "hommel". The first two methods "BH" (widely used) and "BY" control the false discovery rate (FDR: the expected proportion of false discoveries amongst the rejected hypotheses); the last four methods "bonferroni", "holm", "hochberg" and "hommel" are designed to give strong control of the family-wise error rate (FWER). Notes: FDR is a less stringent condition than FWER
`plot` | logical to indicate whether scatter plot is drawn

### Value

a list with two componets:

- `df_summary`: a data frame of n x 4, where n is the number of named vectors, and the 4 columns are "name", "cor" (i.e. "correlation"), "pval" (i.e. p-value), "fdr"

- `ls_gp`: NULL if the plot is not drawn; otherwise, a list of 'ggplot' objects

### Note

none

### See Also

`xPierCor`

### 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 seed nodes/genes with the weight info
    ## load ImmunoBase
    ImmunoBase <- xRDataLoader(RData.customised='ImmunoBase',
    RData.location=RData.location)
    ## get genes within 500kb away from AS GWAS lead SNPs
    seeds.genes <- ImmunoBase$AS$genes_variants
    ## seeds weighted according to distance away from lead SNPs
    data <- 1- seeds.genes/500000

    # b) perform priority analysis
    pNode <- xPierGenes(data=data, network="PCommonsDN_medium",restart=0.7,
    RData.location=RData.location)

    # c) do correlation
    data <- pNode$priority$priority[1:100]
    name(data) <- pNode$priority$name[1:100]
    ls_res <- xPierCor(pNode, data, method="pearson",
    pvalue.type="empirical", nperm=2000, plot=TRUE)

    ## End(Not run)