Parcourir la source

add stats sfs

tforest il y a 2 ans
Parent
révision
a439f0cef6
3 fichiers modifiés avec 23 ajouts et 2 suppressions
  1. 1 1
      __init__.py
  2. 1 1
      customgraphics.py
  3. 21 0
      stats_sfs.py

+ 1 - 1
__init__.py Voir le fichier

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 Voir le fichier

234
     if max_chr_id :
234
     if max_chr_id :
235
         nb_iter = max_chr_id
235
         nb_iter = max_chr_id
236
     else:
236
     else:
237
-        nb_iter =  len(recent_variants)
237
+        nb_iter =  len(recent_variants) -1
238
     if show :
238
     if show :
239
         iter_start = min_chr_id + 1
239
         iter_start = min_chr_id + 1
240
         if not step :
240
         if not step :

+ 21 - 0
stats_sfs.py Voir le fichier

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
+