add stats sfs

master
tforest 2022-02-14 17:01:12 +01:00
parent 0425fcfa03
commit a439f0cef6
3 changed files with 23 additions and 2 deletions

View File

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

View File

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

21
stats_sfs.py Normal file
View File

@ -0,0 +1,21 @@
from frst import vcf_to_sfs
import math
if __name__ == "__main__":
sfs_folded_hir = {0: 575935, 1: 346313, 2: 220539, 3: 130150, 4: 69989, 5: 33768, 6: 41031}
n = len(sfs_folded_hir.values())
pi = 0
s_prime = 0
for i in range(1, n-1):
pi += i * (n-1) * sfs_folded_hir[i-1] / math.comb(n, 2)
#s_prime += math.comb() * math.comb() / math.comb()
print(pi)