phylogenie 2.1.29__py3-none-any.whl → 3.0.0__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.

Potentially problematic release.


This version of phylogenie might be problematic. Click here for more details.

@@ -0,0 +1,40 @@
1
+ phylogenie/__init__.py,sha256=-4GKO2EKgc2GiOhzVRI0SQk6wQZ4AlP7Ron_Lp-s_r0,2913
2
+ phylogenie/draw.py,sha256=6WHLxXXyTKq6pxuPBfDgZfEZti3UkJVhDory2pJzdIc,5499
3
+ phylogenie/generators/__init__.py,sha256=zsOxy28-9j9alOQLIgrOAFfmM58NNHO_NEtW-KXQXAY,888
4
+ phylogenie/generators/alisim.py,sha256=oizyUz2xNKUdO4HrmZFqtVUfzPBN4BRgxgYczofgeYs,2809
5
+ phylogenie/generators/configs.py,sha256=xDIyDgGxuaqdET9wVkpdrXk02jIbibSp8mgxuIcM5qQ,1489
6
+ phylogenie/generators/dataset.py,sha256=Z3a4Mhh6zMTYmhd-aIT3aCaJMTVg4I_QvWWIrCw2l4E,2121
7
+ phylogenie/generators/factories.py,sha256=2mTFdFbbLyV3v79JaOEVtqLOmxQHaOUv1S-Y3vVo7U0,8480
8
+ phylogenie/generators/trees.py,sha256=8dO1CkU34E6mmMAHrYqiLV_VA8r54cSEOo-UzoHiN20,10467
9
+ phylogenie/generators/typeguards.py,sha256=yj4VkhOaUXJ2OrY-6zhOeY9C4yKIQxjZtk2d-vIxttQ,828
10
+ phylogenie/io/__init__.py,sha256=eWDU6YDqAdx6TZlUMmMbsfO8gP3i5HP_cfUe_-0x2FA,69
11
+ phylogenie/io/fasta.py,sha256=CUFO06m7wClprarsMheZojM4Os2NQf3ALYUXSWzfNL0,869
12
+ phylogenie/main.py,sha256=vtvSpQxBNlYABoFQ25czl-l3fIr4QRo3svWVd-jcArw,1170
13
+ phylogenie/mixins.py,sha256=kwxcHGYSS-Frk-r0nwuyILYS1g6NjSOhbUKEYt2g1B0,1319
14
+ phylogenie/msa.py,sha256=JDGyZUsAq6-m-SQjoCDjAkAZIxfgyl_PDIhdYn5HOow,2064
15
+ phylogenie/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ phylogenie/skyline/__init__.py,sha256=7pF4CUb4ZCLzNYJNhOjpuTOLTRhlK7L6ugfccNqjIGo,620
17
+ phylogenie/skyline/matrix.py,sha256=v4SitY7VbXprqlqQckjWTzW5hwRmCyIF595R6IJMxWw,9268
18
+ phylogenie/skyline/parameter.py,sha256=TVqkqirGXNN-VP8hnIJACPkOxUan6LkGa5o_JcPfwbY,4834
19
+ phylogenie/skyline/vector.py,sha256=60jtp7PieiEaEH0Tp6zNjNKjyzpN_nT5uwBUXbgeATk,7261
20
+ phylogenie/treesimulator/__init__.py,sha256=Qz__cFookXuEjq8AUp1A6XRON0qQ_xX-q2Q5ixP4XUg,1791
21
+ phylogenie/treesimulator/events/__init__.py,sha256=w2tJ0D2WB5AiCbr3CsKN6vdADueiAEMzd_ve0rpa4zg,939
22
+ phylogenie/treesimulator/events/base.py,sha256=JQKYUZmhB2Q-WQOy2ULGKQiabsMz-JvwMVfDoa3ZKyo,1170
23
+ phylogenie/treesimulator/events/contact_tracing.py,sha256=t64omKEO2d-DfN_dhDJlXp_Kg9egy2ZE346yWjV3ZrA,5148
24
+ phylogenie/treesimulator/events/core.py,sha256=bhgQgi5L-oaHsoWJmUOsTTzWxi0POYxVLoF-KrC8AGQ,8179
25
+ phylogenie/treesimulator/events/mutations.py,sha256=8Nqa2fg7fwaVNe5XSkGDSwp9pIKQ7XaBQCCj-LYlfzA,3666
26
+ phylogenie/treesimulator/features.py,sha256=XbuwGw8xjGs2lNhJvvUUvXVtheSTBaSN6qj39tWYEro,1391
27
+ phylogenie/treesimulator/gillespie.py,sha256=ey2hdpJOSpNW88duwK7wTAdYSTnSuTSZ_yhZv9MlNHo,5323
28
+ phylogenie/treesimulator/io/__init__.py,sha256=rfP-zp8SP8baq5_4dPAr10WH0W6KfoMCxdTZDCSXtzE,185
29
+ phylogenie/treesimulator/io/newick.py,sha256=8Pr_jixByPOaVch18w-rFt62HYy0U97YMu0H-QSwIy0,3449
30
+ phylogenie/treesimulator/io/nexus.py,sha256=7g5lHb1GZczdLIXnkOUwjwTYtLZJX_4C-zOD4TW_Dao,1628
31
+ phylogenie/treesimulator/model.py,sha256=L0RsL6H1ynFDPecULniSs4Cs8dvz87ovviQOXFy5Qt0,4580
32
+ phylogenie/treesimulator/tree.py,sha256=-yMW14018x9dw45TonS6nRlzWcwXcaHv3Jn5HYriLQQ,6009
33
+ phylogenie/treesimulator/utils.py,sha256=ZA7gZYTBMDyt6Fjv4dVI1a9HUsAtTtzHvDkLE_jUpIw,3416
34
+ phylogenie/typeguards.py,sha256=JtqmbEWJZBRHbWgCvcl6nrWm3VcBfzRbklbTBYHItn0,1325
35
+ phylogenie/typings.py,sha256=p694PBe_tk25A6N8vGGWxuqoDtt3nHFUsIYJrwR_76Y,494
36
+ phylogenie-3.0.0.dist-info/LICENSE.txt,sha256=NUrDqElK-eD3I0WqC004CJsy6cs0JgsAoebDv_42-pw,1071
37
+ phylogenie-3.0.0.dist-info/METADATA,sha256=j8dRenC33-Ab4NTcgawv6_kRJbpvC6fyDF2AyD-IeEo,5476
38
+ phylogenie-3.0.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
39
+ phylogenie-3.0.0.dist-info/entry_points.txt,sha256=Rt6_usN0FkBX1ZfiqCirjMN9FKOgFLG8rydcQ8kugeE,51
40
+ phylogenie-3.0.0.dist-info/RECORD,,
phylogenie/models.py DELETED
@@ -1,17 +0,0 @@
1
- from typing import Any
2
-
3
- from pydantic import BaseModel, ConfigDict
4
-
5
-
6
- class StrictBaseModel(BaseModel):
7
- model_config = ConfigDict(extra="forbid")
8
-
9
-
10
- class Distribution(BaseModel):
11
- type: str
12
- model_config = ConfigDict(extra="allow")
13
-
14
- @property
15
- def args(self) -> dict[str, Any]:
16
- assert self.model_extra is not None
17
- return self.model_extra
phylogenie/utils.py DELETED
@@ -1,176 +0,0 @@
1
- from itertools import chain
2
- from math import comb
3
-
4
- from phylogenie.tree import Tree
5
-
6
-
7
- def get_node_leaf_counts(tree: Tree) -> dict[Tree, int]:
8
- n_leaves: dict[Tree, int] = {}
9
- for node in tree.postorder_traversal():
10
- n_leaves[node] = sum(n_leaves[child] for child in node.children) or 1
11
- return n_leaves
12
-
13
-
14
- def get_node_depth_levels(tree: Tree) -> dict[Tree, int]:
15
- depth_levels: dict[Tree, int] = {}
16
- for node in tree:
17
- if node.parent is None:
18
- depth_levels[node] = 0
19
- else:
20
- depth_levels[node] = depth_levels[node.parent] + 1
21
- return depth_levels
22
-
23
-
24
- def get_node_depths(tree: Tree) -> dict[Tree, float]:
25
- depths: dict[Tree, float] = {}
26
- for node in tree:
27
- if node.parent is None:
28
- depths[node] = 0 if node.branch_length is None else node.branch_length
29
- else:
30
- if node.branch_length is None:
31
- raise ValueError(f"Branch length of node {node.name} is not set.")
32
- depths[node] = depths[node.parent] + node.branch_length
33
- return depths
34
-
35
-
36
- def get_node_height_levels(tree: Tree) -> dict[Tree, int]:
37
- height_levels: dict[Tree, int] = {}
38
- for node in tree.postorder_traversal():
39
- if node.is_leaf():
40
- height_levels[node] = 0
41
- else:
42
- height_levels[node] = max(
43
- 1 + height_levels[child] for child in node.children
44
- )
45
- return height_levels
46
-
47
-
48
- def get_node_heights(tree: Tree) -> dict[Tree, float]:
49
- heights: dict[Tree, float] = {}
50
- for node in tree.postorder_traversal():
51
- if node.is_leaf():
52
- heights[node] = 0
53
- else:
54
- if any(child.branch_length is None for child in node.children):
55
- raise ValueError(
56
- f"Branch length of one or more children of node {node.name} is not set."
57
- )
58
- heights[node] = max(
59
- child.branch_length + heights[child] # pyright: ignore
60
- for child in node.children
61
- )
62
- return heights
63
-
64
-
65
- def get_mrca(node1: Tree, node2: Tree) -> Tree:
66
- node1_ancestors = set(node1.iter_ancestors())
67
- for node2_ancestor in node2.iter_ancestors():
68
- if node2_ancestor in node1_ancestors:
69
- return node2_ancestor
70
- raise ValueError(f"No common ancestor found between node {node1} and node {node2}.")
71
-
72
-
73
- def get_distance(node1: Tree, node2: Tree) -> float:
74
- mrca = get_mrca(node1, node2)
75
- path = list(chain(node1.iter_ancestors(stop=mrca), node2.iter_ancestors(stop=mrca)))
76
- if any(node.branch_length is None for node in path):
77
- return len(path)
78
- return sum(node.branch_length for node in path) # pyright: ignore
79
-
80
-
81
- def compute_sackin_index(tree: Tree, normalize: bool = False) -> float:
82
- """
83
- Compute the Sackin index of a tree.
84
-
85
- Parameters
86
- ----------
87
- tree : Tree
88
- The input tree.
89
- normalize : bool, optional
90
- Whether to normalize the index between 0 and 1, by default False.
91
-
92
- Returns
93
- -------
94
- float
95
- The Sackin index of the tree.
96
-
97
- References
98
- ----------
99
- - Kwang-Tsao Shao and Robert R Sokal. Tree Balance. Systematic Zoology, 39(3):266, 1990.
100
- """
101
- leaves = tree.get_leaves()
102
- depth_levels = get_node_depth_levels(tree)
103
- sackin_index = sum(depth_levels[leaf] for leaf in leaves)
104
- if normalize:
105
- n = len(leaves)
106
- max_sackin_index = (n + 2) * (n - 1) / 2
107
- return (sackin_index - n) / (max_sackin_index - n)
108
- return sackin_index
109
-
110
-
111
- def compute_colless_index(tree: Tree, normalize: bool = False) -> float:
112
- """
113
- Compute the Colless index of a binary tree.
114
-
115
- Parameters
116
- ----------
117
- tree : Tree
118
- The input binary tree.
119
- normalize : bool, optional
120
- Whether to normalize the index between 0 and 1, by default False.
121
-
122
- Returns
123
- -------
124
- float
125
- The Colless index of the tree.
126
-
127
- References
128
- ----------
129
- - Donald H. Colless. Review of phylogenetics: the theory and practice of phylogenetic systematics. Systematic Zoology, 31(1):100–104, 1982.
130
- """
131
- if not tree.is_binary():
132
- raise ValueError("Colless index is only defined for binary trees.")
133
-
134
- internal_nodes = tree.get_internal_nodes()
135
- if not internal_nodes:
136
- raise ValueError(
137
- "Tree must have at least one internal node to compute the Colless index."
138
- )
139
-
140
- colless_index = 0
141
- leaf_counts = get_node_leaf_counts(tree)
142
- for node in internal_nodes:
143
- left, right = node.children
144
- colless_index += abs(leaf_counts[left] - leaf_counts[right])
145
- if normalize:
146
- n_leaves = len(leaf_counts) - len(internal_nodes)
147
- max_colless_index = comb(n_leaves, 2)
148
- return colless_index / max_colless_index
149
- return colless_index
150
-
151
-
152
- def compute_mean_leaf_pairwise_distance(tree: Tree) -> float:
153
- """
154
- Compute the mean pairwise distance between all pairs of leaves in the tree.
155
-
156
- Parameters
157
- ----------
158
- tree : Tree
159
- The input tree.
160
-
161
- Returns
162
- -------
163
- float
164
- The mean pairwise distance between all pairs of leaves in the tree.
165
- """
166
- leaves = tree.get_leaves()
167
- n_leaves = len(leaves)
168
- if n_leaves < 2:
169
- return 0.0
170
-
171
- total_distance = sum(
172
- get_distance(leaves[i], leaves[j])
173
- for i in range(n_leaves)
174
- for j in range(i + 1, n_leaves)
175
- )
176
- return total_distance / comb(n_leaves, 2)
@@ -1,39 +0,0 @@
1
- phylogenie/__init__.py,sha256=FdNHTw1U1eYDz8w_EOvk9R0rdOXvCMAgbm7ilXs6Fog,2861
2
- phylogenie/draw.py,sha256=jM24oCGkU66IsEm56IAcq0pCSVXC8ltyYJQizNwDJl8,5451
3
- phylogenie/generators/__init__.py,sha256=zsOxy28-9j9alOQLIgrOAFfmM58NNHO_NEtW-KXQXAY,888
4
- phylogenie/generators/alisim.py,sha256=1YQLpOG_Bpn9YqExQqEu-wz1MDGCbpPmTdhrBb6TbWc,2820
5
- phylogenie/generators/configs.py,sha256=zjNnljBBC-d6DTjWjieE8-HnKeE58LAy3moBYiD6NFo,1042
6
- phylogenie/generators/dataset.py,sha256=kY92diePr2IjiLejHLixJoYRc-2LpM-GBt3wkX9SYvA,2109
7
- phylogenie/generators/factories.py,sha256=qSz-s7ltQwUf7R6TPZ-5xFyOnnSHkKn0u5IukeysXVU,8544
8
- phylogenie/generators/trees.py,sha256=zsmL3_YUUwtn-_NrGSvwZVSGIm9kpf8SPHxoQCIT_hE,10168
9
- phylogenie/generators/typeguards.py,sha256=yj4VkhOaUXJ2OrY-6zhOeY9C4yKIQxjZtk2d-vIxttQ,828
10
- phylogenie/io/__init__.py,sha256=gtRYtDdZSTlWCj3I4vmMJSAs93jdz5RySkCakD3sxlQ,214
11
- phylogenie/io/fasta.py,sha256=CUFO06m7wClprarsMheZojM4Os2NQf3ALYUXSWzfNL0,869
12
- phylogenie/io/newick.py,sha256=4j7m9B11erVJijye0GfpbWomk2ttlBXdyHNoBc_fvIg,3435
13
- phylogenie/io/nexus.py,sha256=KGf0rH8sAVAuPnmhokj2XbQTBsiuhPujJflRixUunGY,1583
14
- phylogenie/main.py,sha256=vtvSpQxBNlYABoFQ25czl-l3fIr4QRo3svWVd-jcArw,1170
15
- phylogenie/models.py,sha256=pCg9ob0RpLUHwM49x4knKxL4FNPr3-EU_6zMXsvxtAg,370
16
- phylogenie/msa.py,sha256=JDGyZUsAq6-m-SQjoCDjAkAZIxfgyl_PDIhdYn5HOow,2064
17
- phylogenie/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- phylogenie/skyline/__init__.py,sha256=7pF4CUb4ZCLzNYJNhOjpuTOLTRhlK7L6ugfccNqjIGo,620
19
- phylogenie/skyline/matrix.py,sha256=v4SitY7VbXprqlqQckjWTzW5hwRmCyIF595R6IJMxWw,9268
20
- phylogenie/skyline/parameter.py,sha256=TVqkqirGXNN-VP8hnIJACPkOxUan6LkGa5o_JcPfwbY,4834
21
- phylogenie/skyline/vector.py,sha256=60jtp7PieiEaEH0Tp6zNjNKjyzpN_nT5uwBUXbgeATk,7261
22
- phylogenie/tree.py,sha256=P1uM6s32TsODpvNJQIPMix9oj39vGSw_wsHYp2wmy5U,5246
23
- phylogenie/treesimulator/__init__.py,sha256=0wU1PECAcM5rBg5MmeA3poWgfGDzqHySmSJjJs1wkPw,1088
24
- phylogenie/treesimulator/events/__init__.py,sha256=w2tJ0D2WB5AiCbr3CsKN6vdADueiAEMzd_ve0rpa4zg,939
25
- phylogenie/treesimulator/events/base.py,sha256=Rb9qO0EURKGbFPv_KuRrzZv5Krl1ZEMj8ASHXlBLhbI,1259
26
- phylogenie/treesimulator/events/contact_tracing.py,sha256=QqinLfQmBBi6qF3nFE_Qsiyd6RUG0RJqxiBOKK0nRGE,5196
27
- phylogenie/treesimulator/events/core.py,sha256=bhgQgi5L-oaHsoWJmUOsTTzWxi0POYxVLoF-KrC8AGQ,8179
28
- phylogenie/treesimulator/events/mutations.py,sha256=fGxxeXhiFrMAaS-s_vd42aVBZ6XQiRjpW9uJUATNk1E,3752
29
- phylogenie/treesimulator/features.py,sha256=nNfv0kPudAZnrnufIVuFCR_VEJSP-6fZ2L-VG5_-Fqo,1366
30
- phylogenie/treesimulator/gillespie.py,sha256=3xPeqkSitP71Qa2a8d8vMkdV4CCdLy1rRCdDsNctAug,5732
31
- phylogenie/treesimulator/model.py,sha256=lhDwmBFQ8Qh8qVGZPgED0vehtPC3DE7_CgCV_8rPB-A,4641
32
- phylogenie/typeguards.py,sha256=JtqmbEWJZBRHbWgCvcl6nrWm3VcBfzRbklbTBYHItn0,1325
33
- phylogenie/typings.py,sha256=p694PBe_tk25A6N8vGGWxuqoDtt3nHFUsIYJrwR_76Y,494
34
- phylogenie/utils.py,sha256=ehVk_2kvjW8Q_EyM2kxBPHYiK-KlPmZQx7JeVN6Fh-E,5419
35
- phylogenie-2.1.29.dist-info/LICENSE.txt,sha256=NUrDqElK-eD3I0WqC004CJsy6cs0JgsAoebDv_42-pw,1071
36
- phylogenie-2.1.29.dist-info/METADATA,sha256=mVsGaofekWG_o0Mu2CqYu7RZsEL7MKsY3m5w7wv8hAw,5477
37
- phylogenie-2.1.29.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
38
- phylogenie-2.1.29.dist-info/entry_points.txt,sha256=Rt6_usN0FkBX1ZfiqCirjMN9FKOgFLG8rydcQ8kugeE,51
39
- phylogenie-2.1.29.dist-info/RECORD,,