From 0ed0161d8a203f38ac7171b3213eb7b386adcacf Mon Sep 17 00:00:00 2001 From: bvenn Date: Fri, 16 Aug 2019 10:54:43 +0200 Subject: [PATCH] fix OntologyEnrichment numberOfDEsInBin --- .paket/Paket.Restore.targets | 2 +- src/BioFSharp.Stats/OntologyEnrichment.fs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.paket/Paket.Restore.targets b/.paket/Paket.Restore.targets index 8b180290..aed3c3fd 100644 --- a/.paket/Paket.Restore.targets +++ b/.paket/Paket.Restore.targets @@ -116,7 +116,7 @@ - + true false true diff --git a/src/BioFSharp.Stats/OntologyEnrichment.fs b/src/BioFSharp.Stats/OntologyEnrichment.fs index a5bee0a8..c91c42ad 100644 --- a/src/BioFSharp.Stats/OntologyEnrichment.fs +++ b/src/BioFSharp.Stats/OntologyEnrichment.fs @@ -79,10 +79,10 @@ module OntologyEnrichment = let hp = FSharp.Stats.Distributions.Discrete.hypergeometric totalUnivers totalNumberOfDE numberInBin if numberInBin > splitPvalueThreshold then // Calculate normal pValue - 1. - hp.CDF (float (numberOfDEsInBin + 1)) + 1. - hp.CDF (float (numberOfDEsInBin - 1)) else // Calculate split pValue - 0.5 * ((1. - hp.CDF(float(numberOfDEsInBin + 1)) ) + ( (1. - hp.CDF(float(numberOfDEsInBin))) ) ) + 0.5 * ((1. - hp.CDF(float(numberOfDEsInBin - 1)) ) + ( (1. - hp.CDF(float(numberOfDEsInBin))) ) ) else nan