Skip to content

Commit

Permalink
v0.1.21 fixed max_tips in forest generation
Browse files Browse the repository at this point in the history
  • Loading branch information
annazhukova committed Jul 1, 2024
1 parent 00ea487 commit b8969cb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ USER root
RUN apt-get update -y && apt-get install -y bc

# Install treesimulator
RUN cd /usr/local/ && pip3 install --no-cache-dir treesimulator==0.1.20
RUN cd /usr/local/ && pip3 install --no-cache-dir treesimulator==0.1.21

# Switch to your new user in the docker image
USER evolbioinfo
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'Topic :: Software Development',
'Topic :: Software Development :: Libraries :: Python Modules',
],
version='0.1.20',
version='0.1.21',
description='Simulation of rooted phylogenetic trees under a given Multitype Birth–Death model.',
author='Anna Zhukova',
author_email='anna.zhukova@pasteur.fr',
Expand Down
8 changes: 4 additions & 4 deletions treesimulator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def simulate_tree_gillespie(model, max_time=np.inf, min_sampled=0, max_sampled=n
id2current_id = {0: 0}
id2state = {0: root_state}

# logging.info('Aiming for at most {} sampled cases over time {}'.format(max_sampled, max_time))
logging.debug('Aiming for at most {} sampled cases over time {}'.format(max_sampled, max_time))

target_sampled = np.round(np.random.uniform(low=min_sampled, high=max_sampled, size=1)[0], 0)

Expand Down Expand Up @@ -279,7 +279,7 @@ def generate_forest(model, max_time=np.inf, min_tips=1000, max_sampled=np.inf, k
res_ltt = None
while total_n_tips < min_tips:
if ltt:
tree, cur_ltt, _ = simulate_tree_gillespie(model, max_time=max_time, max_sampled=max_sampled, ltt=True,
tree, cur_ltt, _ = simulate_tree_gillespie(model, max_time=max_time, ltt=True,
state_feature=state_feature, state_frequencies=state_frequencies,
max_notified_partners=max_notified_partners)
if res_ltt is None:
Expand All @@ -296,7 +296,7 @@ def generate_forest(model, max_time=np.inf, min_tips=1000, max_sampled=np.inf, k
prev_res = res_ltt[time]
res_ltt[time] = total
else:
tree, _ = simulate_tree_gillespie(model, max_time=max_time, max_sampled=max_sampled,
tree, _ = simulate_tree_gillespie(model, max_time=max_time,
state_feature=state_feature, state_frequencies=state_frequencies,
max_notified_partners=max_notified_partners)
total_trees += 1
Expand Down Expand Up @@ -347,7 +347,7 @@ def generate(model, min_tips, max_tips, T=np.inf, state_frequencies=None, max_no

if T < np.inf:
while True:
forest, ltt = generate_forest(model, max_time=T, min_tips=min_tips,
forest, ltt = generate_forest(model, max_time=T, min_tips=min_tips, max_sampled=max_tips,
keep_nones=True, state_frequencies=state_frequencies, ltt=True,
max_notified_partners=max_notified_partners)
total_trees = len(forest)
Expand Down

0 comments on commit b8969cb

Please sign in to comment.