Browse Source

add stats sfs

tforest 2 years ago
parent
commit
a439f0cef6
3 changed files with 23 additions and 2 deletions
  1. 1 1
      __init__.py
  2. 1 1
      customgraphics.py
  3. 21 0
      stats_sfs.py

+ 1 - 1
__init__.py View File

@@ -1 +1 @@
1
-from frst import sfs_tools, customgraphics, vcf_utils, sfs_tools
1
+from frst import sfs_tools, customgraphics, vcf_utils, sfs_tools, stats_sfs

+ 1 - 1
customgraphics.py View File

@@ -234,7 +234,7 @@ def plot_whole_karyotype(recent_variants, mem_clean = False, step = 1, show = Tr
234 234
     if max_chr_id :
235 235
         nb_iter = max_chr_id
236 236
     else:
237
-        nb_iter =  len(recent_variants)
237
+        nb_iter =  len(recent_variants) -1
238 238
     if show :
239 239
         iter_start = min_chr_id + 1
240 240
         if not step :

+ 21 - 0
stats_sfs.py View File

@@ -0,0 +1,21 @@
1
+from frst import vcf_to_sfs
2
+
3
+import math
4
+
5
+if __name__ == "__main__":
6
+
7
+
8
+    sfs_folded_hir = {0: 575935, 1: 346313, 2: 220539, 3: 130150, 4: 69989, 5: 33768, 6: 41031}
9
+
10
+    n = len(sfs_folded_hir.values())
11
+    pi = 0
12
+    s_prime = 0
13
+    for i in range(1, n-1):
14
+        pi += i * (n-1) * sfs_folded_hir[i-1] / math.comb(n, 2)
15
+        #s_prime +=  math.comb() * math.comb() / math.comb()
16
+
17
+
18
+    print(pi)
19
+
20
+
21
+