From cc059e62de0f2a00e27fe774885d542cae59b271 Mon Sep 17 00:00:00 2001 From: Remco Bouckaert Date: Tue, 5 May 2015 08:46:45 +1200 Subject: [PATCH] checkpoint --- src/snap/Data.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/snap/Data.java b/src/snap/Data.java index dd03071..f2e1d64 100644 --- a/src/snap/Data.java +++ b/src/snap/Data.java @@ -500,4 +500,20 @@ protected boolean isEqual(int iSite1, int iSite2) { public int[] getPatternLineagCounts(int id) { return m_nPatternLineageCounts[id]; } + + public double getProportionZeros() { + int zeroCount = 0; + int oneCount = 0; + for (int i = 0; i < sitePatterns.length; i++) { + int [] p = getPattern(i); + int [] n = getPatternLineagCounts(i); + int w = getPatternWeight(i); + for (int j = 0; j < p.length; j++) { + oneCount += w * p[j]; + zeroCount += w * (n[j] - p[j]); + } + } + return (double) zeroCount / ((double) zeroCount + oneCount); + } + }