phylogenie 2.1.4__tar.gz → 2.1.5__tar.gz
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.
- {phylogenie-2.1.4 → phylogenie-2.1.5}/PKG-INFO +1 -1
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/generators/alisim.py +3 -5
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/generators/factories.py +9 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/treesimulator/gillespie.py +4 -2
- {phylogenie-2.1.4 → phylogenie-2.1.5}/pyproject.toml +1 -4
- {phylogenie-2.1.4 → phylogenie-2.1.5}/LICENSE.txt +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/README.md +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/__init__.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/generators/__init__.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/generators/configs.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/generators/dataset.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/generators/trees.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/generators/typeguards.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/io.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/main.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/msa.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/py.typed +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/skyline/__init__.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/skyline/matrix.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/skyline/parameter.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/skyline/vector.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/tree.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/treesimulator/__init__.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/treesimulator/events/__init__.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/treesimulator/events/contact_tracing.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/treesimulator/events/core.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/treesimulator/events/mutations.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/treesimulator/model.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/typeguards.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/typings.py +0 -0
- {phylogenie-2.1.4 → phylogenie-2.1.5}/phylogenie/utils.py +0 -0
|
@@ -6,7 +6,7 @@ from typing import Any, Literal
|
|
|
6
6
|
from numpy.random import Generator, default_rng
|
|
7
7
|
|
|
8
8
|
from phylogenie.generators.dataset import DatasetGenerator, DataType
|
|
9
|
-
from phylogenie.generators.factories import data
|
|
9
|
+
from phylogenie.generators.factories import data, string
|
|
10
10
|
from phylogenie.generators.trees import TreeDatasetGeneratorConfig
|
|
11
11
|
from phylogenie.io import dump_newick
|
|
12
12
|
|
|
@@ -19,7 +19,7 @@ class AliSimDatasetGenerator(DatasetGenerator):
|
|
|
19
19
|
trees: TreeDatasetGeneratorConfig
|
|
20
20
|
keep_trees: bool = False
|
|
21
21
|
iqtree_path: str = "iqtree2"
|
|
22
|
-
args: dict[str,
|
|
22
|
+
args: dict[str, Any]
|
|
23
23
|
|
|
24
24
|
def _generate_one_from_tree(
|
|
25
25
|
self, filename: str, tree_file: str, rng: Generator, data: dict[str, Any]
|
|
@@ -35,9 +35,7 @@ class AliSimDatasetGenerator(DatasetGenerator):
|
|
|
35
35
|
]
|
|
36
36
|
|
|
37
37
|
for key, value in self.args.items():
|
|
38
|
-
command.extend(
|
|
39
|
-
[key, value.format(**data) if isinstance(value, str) else str(value)]
|
|
40
|
-
)
|
|
38
|
+
command.extend([key, string(value, data)])
|
|
41
39
|
|
|
42
40
|
command.extend(["-af", "fasta"])
|
|
43
41
|
subprocess.run(command, check=True, stdout=subprocess.DEVNULL)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import re
|
|
1
2
|
from typing import Any
|
|
2
3
|
|
|
3
4
|
import numpy as np
|
|
@@ -53,6 +54,14 @@ def scalar(x: cfg.Scalar, data: dict[str, Any]) -> pgt.Scalar:
|
|
|
53
54
|
return x
|
|
54
55
|
|
|
55
56
|
|
|
57
|
+
def string(s: Any, data: dict[str, Any]) -> str:
|
|
58
|
+
if not isinstance(s, str):
|
|
59
|
+
return str(s)
|
|
60
|
+
return re.sub(
|
|
61
|
+
r"\{([^{}]+)\}", lambda match: str(_eval_expression(match.group(1), data)), s
|
|
62
|
+
) # Match content inside curly braces
|
|
63
|
+
|
|
64
|
+
|
|
56
65
|
def many_scalars(x: cfg.ManyScalars, data: dict[str, Any]) -> pgt.ManyScalars:
|
|
57
66
|
if isinstance(x, str):
|
|
58
67
|
e = _eval_expression(x, data)
|
|
@@ -49,7 +49,9 @@ def simulate_tree(
|
|
|
49
49
|
current_time = 0.0
|
|
50
50
|
change_times = sorted(set(t for e in events for t in e.rate.change_times))
|
|
51
51
|
next_change_time = change_times.pop(0) if change_times else np.inf
|
|
52
|
-
target_n_tips =
|
|
52
|
+
target_n_tips = (
|
|
53
|
+
rng.integers(min_tips, max_tips + 1) if max_time == np.inf else None
|
|
54
|
+
)
|
|
53
55
|
|
|
54
56
|
while current_time < max_time:
|
|
55
57
|
if time.perf_counter() - start_clock > timeout:
|
|
@@ -125,7 +127,7 @@ def generate_trees(
|
|
|
125
127
|
|
|
126
128
|
if os.path.exists(output_dir):
|
|
127
129
|
raise FileExistsError(f"Output directory {output_dir} already exists")
|
|
128
|
-
os.
|
|
130
|
+
os.makedirs(output_dir, exist_ok=True)
|
|
129
131
|
|
|
130
132
|
rng = default_rng(seed)
|
|
131
133
|
jobs = joblib.Parallel(n_jobs=n_jobs, return_as="generator_unordered")(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "phylogenie"
|
|
3
|
-
version = "2.1.
|
|
3
|
+
version = "2.1.5"
|
|
4
4
|
description = "Generate phylogenetic datasets with minimal setup effort"
|
|
5
5
|
authors = ["Gabriele Marino <gabmarino.8601@gmail.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -24,9 +24,6 @@ pytest = "^8.3.5"
|
|
|
24
24
|
phylogenie = "phylogenie.main:main"
|
|
25
25
|
|
|
26
26
|
[tool.pyright]
|
|
27
|
-
include = [
|
|
28
|
-
"phylogenie",
|
|
29
|
-
]
|
|
30
27
|
typeCheckingMode = "strict"
|
|
31
28
|
|
|
32
29
|
[build-system]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|