Skip to content

Commit 38493ff

Browse files
awohnshyanwong
authored andcommitted
ancient samples
1 parent c67f8e3 commit 38493ff

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

tsdate/core.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def get_mut_lik_fixed_node(self, edge):
258258

259259
mutations_on_edge = self.mut_edges[edge.id]
260260
child_time = self.ts.node(edge.child).time
261-
assert child_time == 0
261+
#assert child_time == 0
262262
# Temporary hack - we should really take a more precise likelihood
263263
return self._lik(
264264
mutations_on_edge,
@@ -732,10 +732,10 @@ def outside_pass(
732732
if ignore_oldest_root:
733733
if edge.parent == self.ts.num_nodes - 1:
734734
continue
735-
if edge.parent in self.fixednodes:
736-
raise RuntimeError(
737-
"Fixed nodes cannot currently be parents in the TS"
738-
)
735+
#if edge.parent in self.fixednodes:
736+
# raise RuntimeError(
737+
# "Fixed nodes cannot currently be parents in the TS"
738+
# )
739739
# Geometric scaling works exactly for all nodes fixed in graph
740740
# but is an approximation when times are unknown.
741741
spanfrac = edge.span / self.spans[child]
@@ -1065,9 +1065,9 @@ def get_dates(
10651065
:return: tuple(mn_post, posterior, timepoints, eps, nodes_to_date)
10661066
"""
10671067
# Stuff yet to be implemented. These can be deleted once fixed
1068-
for sample in tree_sequence.samples():
1069-
if tree_sequence.node(sample).time != 0:
1070-
raise NotImplementedError("Samples must all be at time 0")
1068+
#for sample in tree_sequence.samples():
1069+
# if tree_sequence.node(sample).time != 0:
1070+
# raise NotImplementedError("Samples must all be at time 0")
10711071
fixed_nodes = set(tree_sequence.samples())
10721072

10731073
# Default to not creating approximate priors unless ts has > 1000 samples

tsdate/prior.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,10 @@ def __init__(self, tree_sequence, *, progress=False, allow_unary=False):
426426

427427
self.ts = tree_sequence
428428
self.sample_node_set = set(self.ts.samples())
429-
if np.any(self.ts.tables.nodes.time[self.ts.samples()] != 0):
430-
raise ValueError(
431-
"The SpansBySamples class needs a tree seq with all samples at time 0"
432-
)
429+
#if np.any(self.ts.tables.nodes.time[self.ts.samples()] != 0):
430+
# raise ValueError(
431+
# "The SpansBySamples class needs a tree seq with all samples at time 0"
432+
# )
433433
self.progress = progress
434434

435435
# We will store the spans in here, and normalize them at the end
@@ -1056,7 +1056,7 @@ def build_grid(
10561056
approx_prior_size, Ne, prior_distribution, progress=progress
10571057
)
10581058

1059-
base_priors.add(contmpr_ts.num_samples, approximate_priors)
1059+
base_priors.add(tree_sequence.num_samples, approximate_priors)
10601060
for total_fixed in span_data.total_fixed_at_0_counts:
10611061
# For missing data: trees vary in total fixed node count => have different priors
10621062
if total_fixed > 0:
@@ -1080,9 +1080,9 @@ def build_grid(
10801080
else:
10811081
raise ValueError("time_slices must be an integer or a numpy array of floats")
10821082

1083-
prior_params_contmpr = base_priors.get_mixture_prior_params(span_data)
1083+
prior_params = base_priors.get_mixture_prior_params(span_data)
10841084
# Map the nodes in the prior params back to the node ids in the original ts
1085-
prior_params = prior_params_contmpr[node_map, :]
1085+
#prior_params = prior_params_contmpr[node_map, :]
10861086
# Set all fixed nodes (i.e. samples) to have 0 variance
10871087
priors = fill_priors(
10881088
prior_params,

0 commit comments

Comments
 (0)