phylogenie 2.1.1__py3-none-any.whl → 2.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
phylogenie/tree.py CHANGED
@@ -73,6 +73,14 @@ class Tree:
73
73
  def delete(self, key: str) -> None:
74
74
  del self._features[key]
75
75
 
76
+ def copy(self):
77
+ new_tree = Tree(self.id, self.branch_length)
78
+ for key, value in self._features.items():
79
+ new_tree.set(key, value)
80
+ for child in self.children:
81
+ new_tree.add_child(child.copy())
82
+ return new_tree
83
+
76
84
  def __iter__(self) -> Iterator["Tree"]:
77
85
  return self.preorder_traversal()
78
86
 
@@ -1,7 +1,6 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from collections import defaultdict
3
3
  from collections.abc import Sequence
4
- from copy import deepcopy
5
4
  from dataclasses import dataclass
6
5
  from typing import Any
7
6
 
@@ -122,7 +121,7 @@ class Model:
122
121
  return self._population[id].state
123
122
 
124
123
  def get_sampled_tree(self) -> Tree:
125
- tree = deepcopy(self._tree)
124
+ tree = self._tree.copy()
126
125
  for node in list(tree.postorder_traversal()):
127
126
  if node.id not in self._sampled and not node.children:
128
127
  if node.parent is None:
@@ -142,7 +141,7 @@ class Model:
142
141
  return tree
143
142
 
144
143
  def get_full_tree(self) -> Tree:
145
- return deepcopy(self._tree)
144
+ return self._tree.copy()
146
145
 
147
146
  def get_population(self, states: str | None = None) -> list[int]:
148
147
  if states is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: phylogenie
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: Generate phylogenetic datasets with minimal setup effort
5
5
  Author: Gabriele Marino
6
6
  Author-email: gabmarino.8601@gmail.com
@@ -14,19 +14,19 @@ phylogenie/skyline/__init__.py,sha256=7pF4CUb4ZCLzNYJNhOjpuTOLTRhlK7L6ugfccNqjIG
14
14
  phylogenie/skyline/matrix.py,sha256=Gl8OgKjtieG0NwPYiPimKI36gefV8fm_OeorjdXxPTs,9146
15
15
  phylogenie/skyline/parameter.py,sha256=EM9qlPt0JhMBy3TbztM0dj24BaGNEy8KWKdTObDKhbI,4644
16
16
  phylogenie/skyline/vector.py,sha256=bJP7_FNX_Klt6wXqsyfj0KX3VNj6-dIhzCKSJuQcOV0,7115
17
- phylogenie/tree.py,sha256=fmCLDNIls3VjY413b-khzj-2jlaQ9rJo7AFN1cz4zXk,2411
17
+ phylogenie/tree.py,sha256=Cum74mTdmgfGXk25dnvUngr4zDYRyWFq5zThBh0QFog,2677
18
18
  phylogenie/treesimulator/__init__.py,sha256=XG_xwETKWgDmCihqNUFCcMHtFg4WvZu5qbqWn9Dndt8,879
19
19
  phylogenie/treesimulator/events/__init__.py,sha256=UGfvXOVJ_ZAkk_8sBPihjmxciiaEnXZEPFIY53sttWI,940
20
20
  phylogenie/treesimulator/events/contact_tracing.py,sha256=_nJ85yhgGkeruQgMHvGpDYoyhheBf8M4LgZWiWdi5dY,4801
21
21
  phylogenie/treesimulator/events/core.py,sha256=JokGmieAv2xEX7KsjBWZr05jHN1jB-XZbpxe9gwdbDA,7953
22
22
  phylogenie/treesimulator/events/mutations.py,sha256=xkXUIppbLIWZqKwVf-hi7d-_pS42TG2EPVfJA_grxBg,3443
23
23
  phylogenie/treesimulator/gillespie.py,sha256=TMDNKBkFwVyAEhBlbwxCTA61GuGwP-42HxpsAVXiU0s,4275
24
- phylogenie/treesimulator/model.py,sha256=bWoFiO-99tTjHtueKPvGV9RSHQKYJ625XP1dvYbP1_Q,5454
24
+ phylogenie/treesimulator/model.py,sha256=0Im6cFTlpMlJrSP4pTTKtvLT9qrQWV8MSTesAsBxT8g,5422
25
25
  phylogenie/typeguards.py,sha256=JtqmbEWJZBRHbWgCvcl6nrWm3VcBfzRbklbTBYHItn0,1325
26
26
  phylogenie/typings.py,sha256=GknvAFXyiaWeeYJ8Lk5d6E2VHT-xW6ONEojYbtJYiB8,476
27
27
  phylogenie/utils.py,sha256=pCg9ob0RpLUHwM49x4knKxL4FNPr3-EU_6zMXsvxtAg,370
28
- phylogenie-2.1.1.dist-info/LICENSE.txt,sha256=NUrDqElK-eD3I0WqC004CJsy6cs0JgsAoebDv_42-pw,1071
29
- phylogenie-2.1.1.dist-info/METADATA,sha256=Ay--Y2G4F1KwK9GgJFhtiTwGyKJ815JUCLYbXMyek1o,5375
30
- phylogenie-2.1.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
31
- phylogenie-2.1.1.dist-info/entry_points.txt,sha256=Rt6_usN0FkBX1ZfiqCirjMN9FKOgFLG8rydcQ8kugeE,51
32
- phylogenie-2.1.1.dist-info/RECORD,,
28
+ phylogenie-2.1.2.dist-info/LICENSE.txt,sha256=NUrDqElK-eD3I0WqC004CJsy6cs0JgsAoebDv_42-pw,1071
29
+ phylogenie-2.1.2.dist-info/METADATA,sha256=RoxXfMaPI6auRdjONAE8HfcfhZjHX0hTmx_oJlrzaws,5375
30
+ phylogenie-2.1.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
31
+ phylogenie-2.1.2.dist-info/entry_points.txt,sha256=Rt6_usN0FkBX1ZfiqCirjMN9FKOgFLG8rydcQ8kugeE,51
32
+ phylogenie-2.1.2.dist-info/RECORD,,