Step 1: Calculation of an Enrichment Score.
We calculate an enrichment score (ES) that reflects the degree to which a set S is
overrepresented at the extremes (top or bottom) of the entire ranked
list L. The score is calculated by walking down the list L, increasing
a running-sum statistic when we encounter a gene in S and decreasing
it when we encounter genes not in S. The magnitude of the increment
depends on the correlation of the gene with the phenotype. The
enrichment score is the maximum deviation from zero encountered in the
random walk; it corresponds to a weighted Kolmogorov–Smirnov-like
statistic (ref. 7 and Fig. 1B).