@@ -70,7 +70,11 @@ class ConditionalCoalescentTimes:
70
70
"""
71
71
72
72
def __init__ (
73
- self , precalc_approximation_n , Ne , prior_distr = "lognorm" , progress = False
73
+ self ,
74
+ precalc_approximation_n ,
75
+ population_size ,
76
+ prior_distr = "lognorm" ,
77
+ progress = False ,
74
78
):
75
79
"""
76
80
:param bool precalc_approximation_n: the size of tree used for
@@ -79,7 +83,7 @@ def __init__(
79
83
and therefore do not allow approximate priors to be used
80
84
"""
81
85
self .n_approx = precalc_approximation_n
82
- self .Ne = Ne
86
+ self .population_size = population_size
83
87
self .prior_store = {}
84
88
self .progress = progress
85
89
@@ -177,8 +181,8 @@ def add(self, total_tips, approximate=None):
177
181
priors [1 ] = PriorParams (alpha = 0 , beta = 1 , mean = 0 , var = 0 )
178
182
for var , tips in zip (variances , all_tips ):
179
183
# NB: it should be possible to vectorize this in numpy
180
- var = var * ((2 * self .Ne ) ** 2 )
181
- expectation = self .tau_expect (tips , total_tips ) * 2 * self .Ne
184
+ var = var * ((2 * self .Ne ) ** 2 ) # TODO
185
+ expectation = self .tau_expect (tips , total_tips ) * 2 * self .Ne # TODO
182
186
alpha , beta = self .func_approx (expectation , var )
183
187
priors [tips ] = PriorParams (
184
188
alpha = alpha , beta = beta , mean = expectation , var = var
@@ -947,7 +951,9 @@ def gamma_cdf(t_set, alpha, beta):
947
951
return np .insert (t_set , 0 , 0 )
948
952
949
953
950
- def fill_priors (node_parameters , timepoints , ts , Ne , * , prior_distr , progress = False ):
954
+ def fill_priors (
955
+ node_parameters , timepoints , ts , population_size , * , prior_distr , progress = False
956
+ ):
951
957
"""
952
958
Take the alpha and beta values from the node_parameters array, which contains
953
959
one row for each node in the TS (including fixed nodes)
@@ -993,7 +999,7 @@ def fill_priors(node_parameters, timepoints, ts, Ne, *, prior_distr, progress=Fa
993
999
994
1000
def build_grid (
995
1001
tree_sequence ,
996
- Ne ,
1002
+ population_size ,
997
1003
timepoints = 20 ,
998
1004
* ,
999
1005
approximate_priors = False ,
@@ -1011,9 +1017,11 @@ def build_grid(
1011
1017
1012
1018
:param TreeSequence tree_sequence: The input :class:`tskit.TreeSequence`, treated as
1013
1019
undated.
1014
- :param float Ne: The estimated (diploid) effective population size: must be
1015
- specified. Using standard (unscaled) values for ``Ne`` results in a prior where
1016
- times are measures in generations.
1020
+ :param float population_size: The estimated (diploid) effective population
1021
+ size: must be specified. May be a single value, or a two-column array with
1022
+ epoch breakpoints and effective population sizes. Using standard (unscaled)
1023
+ values for ``population_size`` results in a prior where times are measures
1024
+ in generations.
1017
1025
:param int_or_array_like timepoints: The number of quantiles used to create the
1018
1026
time slices, or manually-specified time slices as a numpy array. Default: 20
1019
1027
:param bool approximate_priors: Whether to use a precalculated approximate prior or
@@ -1033,8 +1041,9 @@ def build_grid(
1033
1041
inference and a discretised time grid
1034
1042
:rtype: base.NodeGridValues Object
1035
1043
"""
1036
- if Ne <= 0 :
1037
- raise ValueError ("Parameter 'Ne' must be greater than 0" )
1044
+ # TODO
1045
+ if population_size <= 0 :
1046
+ raise ValueError ("Parameter 'population_size' must be greater than 0" )
1038
1047
if approximate_priors :
1039
1048
if not approx_prior_size :
1040
1049
approx_prior_size = 1000
@@ -1053,7 +1062,7 @@ def build_grid(
1053
1062
span_data = SpansBySamples (contmpr_ts , progress = progress , allow_unary = allow_unary )
1054
1063
1055
1064
base_priors = ConditionalCoalescentTimes (
1056
- approx_prior_size , Ne , prior_distribution , progress = progress
1065
+ approx_prior_size , population_size , prior_distribution , progress = progress
1057
1066
)
1058
1067
1059
1068
base_priors .add (contmpr_ts .num_samples , approximate_priors )
@@ -1088,7 +1097,7 @@ def build_grid(
1088
1097
prior_params ,
1089
1098
timepoints ,
1090
1099
tree_sequence ,
1091
- Ne ,
1100
+ population_size ,
1092
1101
prior_distr = prior_distribution ,
1093
1102
progress = progress ,
1094
1103
)
0 commit comments