xPierSubnet | R Documentation

## Function to identify a gene network from top prioritised genes

### Description

`xPierSubnet` is supposed to identify maximum-scoring gene subnetwork from a graph with the node information on priority scores, both are part of an object of class "pNode". It returns an object of class "igraph".

### Usage

    xPierSubnet(pNode, priority.quantile = 0.1, network = c(NA,
    "STRING_highest", "STRING_high", "STRING_medium", "STRING_low",
    "PCommonsUN_high", "PCommonsUN_medium", "PCommonsDN_high",
    "PCommonsDN_medium", "PCommonsDN_Reactome", "PCommonsDN_KEGG",
    "PCommonsDN_HumanCyc", "PCommonsDN_PID", "PCommonsDN_PANTHER",
    "PCommonsDN_ReconX", "PCommonsDN_TRANSFAC", "PCommonsDN_PhosphoSite",
    "PCommonsDN_CTD"), network.customised = NULL, subnet.significance =
    0.01,
    subnet.size = NULL, verbose = TRUE,
    RData.location = "http://galahad.well.ox.ac.uk/bigdata")

### Arguments

`pNode` | an object of class "pNode" (or "sTarget" or "dTarget")
`priority.quantile` | the quantile of the top priority genes. By default, 10 analysis. If NULL or NA, all prioritised genes will be used
`network` | the built-in network. Currently two sources of network information are supported: the STRING database (version 10) and the Pathway Commons database (version 7). STRING is a meta-integration of undirect interactions from the functional aspect, while Pathways Commons mainly contains both undirect and direct interactions from the physical/pathway aspect. Both have scores to control the confidence of interactions. Therefore, the user can choose the different quality of the interactions. In STRING, "STRING_highest" indicates interactions with highest confidence (confidence scores>=900), "STRING_high" for interactions with high confidence (confidence scores>=700), "STRING_medium" for interactions with medium confidence (confidence scores>=400), and "STRING_low" for interactions with low confidence (confidence scores>=150). For undirect/physical interactions from Pathways Commons, "PCommonsUN_high" indicates undirect interactions with high confidence (supported with the PubMed references plus at least 2 different sources), "PCommonsUN_medium" for undirect interactions with medium confidence (supported with the PubMed references). For direct (pathway-merged) interactions from Pathways Commons, "PCommonsDN_high" indicates direct interactions with high confidence (supported with the PubMed references plus at least 2 different sources), and "PCommonsUN_medium" for direct interactions with medium confidence (supported with the PubMed references). In addition to pooled version of pathways from all data sources, the user can also choose the pathway-merged network from individual sources, that is, "PCommonsDN_Reactome" for those from Reactome, "PCommonsDN_KEGG" for those from KEGG, "PCommonsDN_HumanCyc" for those from HumanCyc, "PCommonsDN_PID" for those froom PID, "PCommonsDN_PANTHER" for those from PANTHER, "PCommonsDN_ReconX" for those from ReconX, "PCommonsDN_TRANSFAC" for those from TRANSFAC, "PCommonsDN_PhosphoSite" for those from PhosphoSite, and "PCommonsDN_CTD" for those from CTD
`network.customised` | an object of class "igraph". By default, it is NULL. It is designed to allow the user analysing their customised network data that are not listed in the above argument 'network'. This customisation (if provided) has the high priority over built-in network
`subnet.significance` | the given significance threshold. By default, it is set to NULL, meaning there is no constraint on nodes/genes. If given, those nodes/genes with p-values below this are considered significant and thus scored positively. Instead, those p-values above this given significance threshold are considered insigificant and thus scored negatively
`subnet.size` | the desired number of nodes constrained to the resulting subnet. It is not nulll, a wide range of significance thresholds will be scanned to find the optimal significance threshold leading to the desired number of nodes in the resulting subnet. Notably, the given significance threshold will be overwritten by this option
`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 subgraph with a maximum score, an object of class "igraph". It has ndoe attributes: signficance, score, priority (part of the "pNode" object)

### Note

The priority score will be first scaled to the range x=[0 100] and then is converted to pvalue-like significant level: 10^(-x). Next, `xSubneterGenes` is used to identify a maximum-scoring gene subnetwork that contains as many highly prioritised genes as possible but a few lowly prioritised genes as linkers. An iterative procedure of scanning different priority thresholds is also used to identify the network with a desired number of nodes/genes. Notably, the preferential use of the same network as used in gene-level prioritisation is due to the fact that gene-level affinity/priority scores are smoothly distributed over the network after being walked. In other words, the chance of identifying such a gene network enriched with top prioritised genes is much higher.

### See Also

`xSubneterGenes`

### Examples

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

    ## End(Not run)

    RData.location <- "http://galahad.well.ox.ac.uk/bigdata_dev"
    # a) provide the SNPs with the significance info
    ## get lead SNPs reported in AS GWAS and their significance info (p-values)
    #data.file <- "http://galahad.well.ox.ac.uk/bigdata/AS.txt"
    #AS <- read.delim(data.file, header=TRUE, stringsAsFactors=FALSE)
    ImmunoBase <- xRDataLoader(RData.customised='ImmunoBase',
    RData.location=RData.location)
    gr <- ImmunoBase$AS$variants
    AS <- as.data.frame(GenomicRanges::mcols(gr)[, c('Variant','Pvalue')])

    ## Not run:
    # b) perform priority analysis
    pNode <- xPierSNPs(data=AS, include.eQTL="JKng_mono",
    include.HiC='Monocytes', network="PCommonsUN_medium", restart=0.7,
    RData.location=RData.location)

    # c) perform network analysis
    # find maximum-scoring subnet with the desired node number=50
    subnet <- xPierSubnet(pNode, priority.quantile=0.1, subnet.size=50,
    RData.location=RData.location)

    # d) save subnet results to the files called 'subnet_edges.txt' and 'subnet_nodes.txt'
    output <- igraph::get.data.frame(subnet, what="edges")
    utils::write.table(output, file="subnet_edges.txt", sep="\t",
    row.names=FALSE)
    output <- igraph::get.data.frame(subnet, what="vertices")
    utils::write.table(output, file="subnet_nodes.txt", sep="\t",
    row.names=FALSE)

    # e) visualise the identified subnet
    ## do visualisation with nodes colored according to the priority
    xVisNet(g=subnet, pattern=V(subnet)$priority, vertex.shape="sphere")
    ## do visualisation with nodes colored according to pvalue-like signficance
    xVisNet(g=subnet, pattern=-log10(as.numeric(V(subnet)$significance)),
    vertex.shape="sphere", colormap="wyr")

    # f) visualise the identified subnet as a circos plot
    library(RCircos)
    xCircos(g=subnet, entity="Gene", RData.location=RData.location)

    ## End(Not run)