phylogenie 2.0.7__py3-none-any.whl → 2.0.9__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/generators/dataset.py +8 -6
- phylogenie/tree.py +0 -8
- {phylogenie-2.0.7.dist-info → phylogenie-2.0.9.dist-info}/METADATA +1 -1
- {phylogenie-2.0.7.dist-info → phylogenie-2.0.9.dist-info}/RECORD +7 -7
- {phylogenie-2.0.7.dist-info → phylogenie-2.0.9.dist-info}/LICENSE.txt +0 -0
- {phylogenie-2.0.7.dist-info → phylogenie-2.0.9.dist-info}/WHEEL +0 -0
- {phylogenie-2.0.7.dist-info → phylogenie-2.0.9.dist-info}/entry_points.txt +0 -0
phylogenie/generators/dataset.py
CHANGED
|
@@ -41,19 +41,21 @@ class DatasetGenerator(ABC, cfg.StrictBaseModel):
|
|
|
41
41
|
self._generate_one(filename=filename, rng=default_rng(seed), data=data)
|
|
42
42
|
|
|
43
43
|
def _generate(self, rng: Generator, n_samples: int, output_dir: str) -> None:
|
|
44
|
-
data_dir = os.path.join(output_dir, DATA_DIRNAME)
|
|
45
|
-
if os.path.exists(data_dir):
|
|
46
|
-
print(f"Output directory {data_dir} already exists. Skipping.")
|
|
47
|
-
return
|
|
48
|
-
os.makedirs(data_dir)
|
|
49
|
-
|
|
50
44
|
data: list[dict[str, Any]] = [{} for _ in range(n_samples)]
|
|
51
45
|
if self.context is not None:
|
|
46
|
+
data_dir = os.path.join(output_dir, DATA_DIRNAME)
|
|
52
47
|
for d, (k, v) in product(data, self.context.items()):
|
|
53
48
|
args = v.model_extra if v.model_extra is not None else {}
|
|
54
49
|
d[k] = np.array(getattr(rng, v.type)(**args)).tolist()
|
|
55
50
|
df = pd.DataFrame([{"file_id": str(i), **d} for i, d in enumerate(data)])
|
|
56
51
|
df.to_csv(os.path.join(output_dir, METADATA_FILENAME), index=False)
|
|
52
|
+
else:
|
|
53
|
+
data_dir = output_dir
|
|
54
|
+
|
|
55
|
+
if os.path.exists(data_dir):
|
|
56
|
+
print(f"Output directory {data_dir} already exists. Skipping.")
|
|
57
|
+
return
|
|
58
|
+
os.makedirs(data_dir)
|
|
57
59
|
|
|
58
60
|
joblib.Parallel(n_jobs=self.n_jobs)(
|
|
59
61
|
joblib.delayed(self.generate_one)(
|
phylogenie/tree.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from collections.abc import Iterator
|
|
2
|
-
from typing import Any
|
|
3
2
|
|
|
4
3
|
|
|
5
4
|
class Tree:
|
|
@@ -8,7 +7,6 @@ class Tree:
|
|
|
8
7
|
self.branch_length = branch_length
|
|
9
8
|
self.parent: Tree | None = None
|
|
10
9
|
self.children: list[Tree] = []
|
|
11
|
-
self._features: dict[str, Any] = {}
|
|
12
10
|
|
|
13
11
|
def add_child(self, child: "Tree") -> "Tree":
|
|
14
12
|
child.parent = self
|
|
@@ -49,12 +47,6 @@ class Tree:
|
|
|
49
47
|
new_tree.add_child(child.copy())
|
|
50
48
|
return new_tree
|
|
51
49
|
|
|
52
|
-
def get(self, key: str, default: Any = None) -> Any:
|
|
53
|
-
return self._features.get(key, default)
|
|
54
|
-
|
|
55
|
-
def set(self, key: str, value: Any) -> None:
|
|
56
|
-
self._features[key] = value
|
|
57
|
-
|
|
58
50
|
def __iter__(self) -> Iterator["Tree"]:
|
|
59
51
|
return self.preorder_traversal()
|
|
60
52
|
|
|
@@ -2,7 +2,7 @@ phylogenie/__init__.py,sha256=1w_0H9lg7hI3b-NLjKuzc34GbJJGyjLq9LrlogecTzI,1759
|
|
|
2
2
|
phylogenie/generators/__init__.py,sha256=zsOxy28-9j9alOQLIgrOAFfmM58NNHO_NEtW-KXQXAY,888
|
|
3
3
|
phylogenie/generators/alisim.py,sha256=dDqlSwLDbRE2u5SZlsq1mArobTBtuk0aeXY3m1N-bWA,2374
|
|
4
4
|
phylogenie/generators/configs.py,sha256=5ZWdKhRUjlNifw7QKXbooKV1fElqfCk_jBGxfcjh8do,969
|
|
5
|
-
phylogenie/generators/dataset.py,sha256=
|
|
5
|
+
phylogenie/generators/dataset.py,sha256=OB51YI9ilo-lrw8ETCDQAFh9iXWtPLBRyLg4JOjMi7c,2577
|
|
6
6
|
phylogenie/generators/factories.py,sha256=O8wqL-PvZps0Dq6mQa_PTi4vBvky5LkQIy1jjfOUm-4,6944
|
|
7
7
|
phylogenie/generators/trees.py,sha256=jukaVXGcPGzDBEYMGJ1MKqWt4XbAB5EEfuHXDpwKTqM,9173
|
|
8
8
|
phylogenie/generators/typeguards.py,sha256=Qph6ZnQ7wDMUNvB0VWQKlq42f8wkKOnM42cfMqhNov4,862
|
|
@@ -14,15 +14,15 @@ 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=
|
|
17
|
+
phylogenie/tree.py,sha256=dk8Sj1tqyGOunVO2crtIqb0LH-ws-PXqA8SuNcYfVHI,1738
|
|
18
18
|
phylogenie/treesimulator/__init__.py,sha256=INPU9LrPdUmt3dYGzWDRoRKrPR9xENcHu44pJVUbyNA,525
|
|
19
19
|
phylogenie/treesimulator/events.py,sha256=X3_0U9qqMpYgh6-7TwQEnlUipANkHz6QTCXlm-qXFQk,9524
|
|
20
20
|
phylogenie/treesimulator/gillespie.py,sha256=Fn-PyVICx3pWtpHko7rf6omf_kqOkkpebSJy56oPKnQ,3216
|
|
21
21
|
phylogenie/treesimulator/model.py,sha256=XpzAicmg2O6K0Trk5YolH-B_HJZxoSauF2wZOMqp-Iw,5559
|
|
22
22
|
phylogenie/typeguards.py,sha256=JtqmbEWJZBRHbWgCvcl6nrWm3VcBfzRbklbTBYHItn0,1325
|
|
23
23
|
phylogenie/typings.py,sha256=O1X6lGKTjJ2YJz3ApQ-rYb_tEJNUIcHdUIeYlSM4s5o,500
|
|
24
|
-
phylogenie-2.0.
|
|
25
|
-
phylogenie-2.0.
|
|
26
|
-
phylogenie-2.0.
|
|
27
|
-
phylogenie-2.0.
|
|
28
|
-
phylogenie-2.0.
|
|
24
|
+
phylogenie-2.0.9.dist-info/LICENSE.txt,sha256=NUrDqElK-eD3I0WqC004CJsy6cs0JgsAoebDv_42-pw,1071
|
|
25
|
+
phylogenie-2.0.9.dist-info/METADATA,sha256=EHn9nzfQMQCfWXzl1Ddb_dTrowodP7Y4dsDQqsna2xw,5472
|
|
26
|
+
phylogenie-2.0.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
27
|
+
phylogenie-2.0.9.dist-info/entry_points.txt,sha256=Rt6_usN0FkBX1ZfiqCirjMN9FKOgFLG8rydcQ8kugeE,51
|
|
28
|
+
phylogenie-2.0.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|