NES

Normalized Enrichment Score (NES) is an estimate of the probability that the expression of a gene in the gene set is greater than the expression of a gene outside this set.

$${NES} = 1 - \frac{U}{mn}$$

where m is the number of genes in a gene set, n the number of those outside the gene set,$$U = nm + \frac{{m(m + 1)}}{2} - T$$ and T is the sum of the ranks of the genes in the gene set.


Click here to download NES code.


Running NES

Before using NES, make sure that you have the R language and the R packages readxl, plyr, installed on your computer. If not, after installing R, run the following commands to install the dependencies in R respectively.

Install R Packages

`install.packages("plyr")`
`install.packages("readxl")`


Run NES

Creat a working directory, e.g., ./working
Unzip the downloaded file in the working directory
Run NES:
path-to-Rscript NES.R <Working directory> <Geneset file name> <Expression file name>

Parameters:

Working directory: The folder's path which you put the unziped files in, and where the output files will be located
Geneset file name: Name of the geneset file which first column is genesets. Only support xlsx files.
Click here to download example file.
Expression file name: Name of the expression file which first column is genes, first row is sample/cell. Only support csv files. Click here to download example file.

Example:

/usr/bin/Rscript "/item/NES.R" "/item/" "curatedMarkers.xlsx" "exp.csv"

Citation:

Frattini, V., S.M. Pagnotta, Tala, J.J. Fan, et al., A metabolic function of FGFR3-TACC3 gene fusions in cancer. Nature, 2018. 553(7687): 222-227.
Zhang, J., F.P. Caruso, J.K. Sa, S. Justesen, et al., The combination of neoantigen quality and T lymphocyte infiltrates identifies glioblastomas with the longest survival. Commun Biol, 2019. 2: 135.