diff --git a/__init__.py b/__init__.py index bd8595f..65f0ffb 100644 --- a/__init__.py +++ b/__init__.py @@ -1 +1 @@ -from frst import sfs_tools, customgraphics, vcf_utils, sfs_tools +from frst import sfs_tools, customgraphics, vcf_utils, sfs_tools, stats_sfs diff --git a/customgraphics.py b/customgraphics.py index 378131b..78743c1 100644 --- a/customgraphics.py +++ b/customgraphics.py @@ -234,7 +234,7 @@ def plot_whole_karyotype(recent_variants, mem_clean = False, step = 1, show = Tr if max_chr_id : nb_iter = max_chr_id else: - nb_iter = len(recent_variants) + nb_iter = len(recent_variants) -1 if show : iter_start = min_chr_id + 1 if not step : diff --git a/stats_sfs.py b/stats_sfs.py new file mode 100644 index 0000000..4c376fb --- /dev/null +++ b/stats_sfs.py @@ -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) + + +