---
title: "prioGene"
output: rmarkdown::html_vignette
author: "Erqiang Hu"
date: "Revised: 17 July, 2019"
vignette: >
    %\VignetteIndexEntry{my-vignete}
    %\VignetteEngine{knitr::rmarkdown}
    %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
    collapse = TRUE,
    comment = "#>"
)
```

--------


# Introduction
Prioritizing candidate genes for complex non-communicable diseases is critical
to understanding their mechanisms and developing better diagnostics and
treatments.

With the emergence of a great amount of biological data, more and more studies have been
carried out on the identification and sequencing of disease-related genes by
using the calculation method of protein-protein interaction (PPI) network.
In gene sequencing methods, the topological features of PPI networks are often
used, such as ToppNet (https://toppGene.cchmc.org) and Razaghi Moghadam's gene
sequencing method.

In this study, a candidate gene prioritization method was proposed for
non-communicable diseases considering disease risks transferred between genes
in weighted disease PPI networks with weights for nodes and edges based on
functional information.

## Construction of weighted  networks
In biological networks, nodes represented genes and edges represented
interactions between products of these genes. Weights for nodes (genes) and 
edges (interactions) were calculated utilizing functional information
represented by GO terms, respectively.
For each gene g, the gene weight w g was defined as the proportion of
GO terms annotated by g in all GO terms annotated by human genes.
The interaction weight Wgh was defined as the functional similarity of
two interacting genes g and h.

## Prioritization of candidate genes
The prioritization of candidate genes was performed based on disease risk scores
of each gene obtained from an iteration process considering disease risks
transferred between genes.


--------

# Installation

Get the development version from github:

```{r, eval=FALSE, message=FALSE, warning=FALSE}
if(!requireNamespace("devtools", quietly = TRUE))
    install.packages("devtools")
devtools::install_github("huerqiang/prioGene")
```
Or  the released version from CRAN:

``` {r, eval=FALSE, message=FALSE, warning=FALSE}
install.packages("prioGene")
```
-------

# Common operations on prioGene
```{r}
library(prioGene)
```

## 1. Construction of disease  related networks

The function `deal_net` could get a disease-related network by retaining disease-causing genes and their One-step interaction neighbors in a human biological network.
The parameter `net` means a human biological network, a matrix of two columns. The parameter `dise_gene` means a one-column-matrix of gene symbols obtained from the OMIM database or other disease-related databases. They need to be provided by the users.  We provide examples separately in the package: `prioGene::net` and `prioGene::dise_gene`.

```{r}
net_disease <- deal_net(net,dise_gene)
```

##  2.  Calculation of network weights

These five functions form a pipeline to weight the nodes and edges of the network based on functional information. GO function annotation information comes from `org.Hs.eg.db`.

```{r}
genes_mat <- get_gene_mat(net_disease)
terms_mat <- get_term_mat(net_disease)
net_disease_term <- get_net_disease_term(genes_mat,net_disease)
node_weight <- get_node_weight(genes_mat)
edge_weight <- get_edge_weight(net_disease_term,terms_mat)
```

## 3.  Prioritization of candidate genes

The prioritization of candidate genes was performed based on disease risk scores of each gene obtained from an iteration process considering disease risks transferred between genes.

```{r}
R_0<- get_R_0(dise_gene,node_weight,f=1)
result <- get_R(node_weight, net_disease_term, bet = 0.5, R_0 = R_0, threshold = 10^(-9))
```




# Session information

```{r}
sessionInfo()
```

