Fix Normalized enrichments scores and repo improvements #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This release fixes a bug for cases where the GSEA enrichment score for a gene set did not share a sign with any of the random permutations.
Previous behavior
Example case: the enrichment score for set$S$ is a negative value. The 1000 permutations had all positive enrichment scores. To calculate the normalized enrichment score (NES), you divide the real score by the average of the random scores that are of the same sign (in this example the average of the negative scores). Since there are no negative random scores, the average would be 0.
To avoid dividing by 0, old WebGestaltR would add 0.000001 to every average. In this example, this would result in multiply the enrichment score by$10^{-5}$ .
The old R package would set the NES to 0 if this happened, but this step was missed in the rust implementation, resulting in a high NES.
New behavior
To avoid this abnormally high normalized score, if there are no permutations with a matched sign, the normalized score is set to 0. This is the same behavior as the original R package.