phylogenie 3.1.2__tar.gz → 3.1.3__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.

Files changed (47) hide show
  1. {phylogenie-3.1.2 → phylogenie-3.1.3}/PKG-INFO +12 -17
  2. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/draw.py +11 -10
  3. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/io/nexus.py +7 -4
  4. phylogenie-3.1.3/phylogenie.egg-info/PKG-INFO +101 -0
  5. phylogenie-3.1.3/phylogenie.egg-info/SOURCES.txt +44 -0
  6. phylogenie-3.1.3/phylogenie.egg-info/dependency_links.txt +1 -0
  7. phylogenie-3.1.3/phylogenie.egg-info/entry_points.txt +2 -0
  8. phylogenie-3.1.3/phylogenie.egg-info/requires.txt +6 -0
  9. phylogenie-3.1.3/phylogenie.egg-info/top_level.txt +1 -0
  10. phylogenie-3.1.3/pyproject.toml +32 -0
  11. phylogenie-3.1.3/setup.cfg +4 -0
  12. phylogenie-3.1.2/pyproject.toml +0 -32
  13. {phylogenie-3.1.2 → phylogenie-3.1.3}/LICENSE.txt +0 -0
  14. {phylogenie-3.1.2 → phylogenie-3.1.3}/README.md +0 -0
  15. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/__init__.py +0 -0
  16. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/generators/__init__.py +0 -0
  17. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/generators/alisim.py +0 -0
  18. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/generators/configs.py +0 -0
  19. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/generators/dataset.py +0 -0
  20. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/generators/factories.py +0 -0
  21. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/generators/trees.py +0 -0
  22. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/generators/typeguards.py +0 -0
  23. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/io/__init__.py +0 -0
  24. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/io/fasta.py +0 -0
  25. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/main.py +0 -0
  26. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/mixins.py +0 -0
  27. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/msa.py +0 -0
  28. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/py.typed +0 -0
  29. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/skyline/__init__.py +0 -0
  30. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/skyline/matrix.py +0 -0
  31. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/skyline/parameter.py +0 -0
  32. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/skyline/vector.py +0 -0
  33. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/__init__.py +0 -0
  34. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/events/__init__.py +0 -0
  35. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/events/base.py +0 -0
  36. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/events/contact_tracing.py +0 -0
  37. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/events/core.py +0 -0
  38. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/events/mutations.py +0 -0
  39. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/features.py +0 -0
  40. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/gillespie.py +0 -0
  41. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/io/__init__.py +0 -0
  42. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/io/newick.py +0 -0
  43. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/model.py +0 -0
  44. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/tree.py +0 -0
  45. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/treesimulator/utils.py +0 -0
  46. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/typeguards.py +0 -0
  47. {phylogenie-3.1.2 → phylogenie-3.1.3}/phylogenie/typings.py +0 -0
@@ -1,21 +1,17 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: phylogenie
3
- Version: 3.1.2
4
- Summary: Generate phylogenetic datasets with minimal setup effort
5
- Author: Gabriele Marino
6
- Author-email: gabmarino.8601@gmail.com
7
- Requires-Python: >=3.10,<4.0
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.10
10
- Classifier: Programming Language :: Python :: 3.11
11
- Classifier: Programming Language :: Python :: 3.12
12
- Requires-Dist: joblib (>=1.4.2,<2.0.0)
13
- Requires-Dist: matplotlib (>=3.10.6,<4.0.0)
14
- Requires-Dist: pandas (>=2.2.2,<3.0.0)
15
- Requires-Dist: pydantic (>=2.11.5,<3.0.0)
16
- Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
17
- Requires-Dist: tqdm (>=4.66.4,<5.0.0)
3
+ Version: 3.1.3
4
+ Summary: Add your description here
5
+ Requires-Python: >=3.10
18
6
  Description-Content-Type: text/markdown
7
+ License-File: LICENSE.txt
8
+ Requires-Dist: joblib>=1.5.2
9
+ Requires-Dist: matplotlib>=3.10.7
10
+ Requires-Dist: pandas>=2.3.3
11
+ Requires-Dist: pydantic>=2.12.3
12
+ Requires-Dist: pyyaml>=6.0.3
13
+ Requires-Dist: tqdm>=4.67.1
14
+ Dynamic: license-file
19
15
 
20
16
  <p align="center">
21
17
  <img src="https://raw.githubusercontent.com/gabriele-marino/phylogenie/main/logo.png" style="width:100%; height:auto;"/>
@@ -103,4 +99,3 @@ This project is licensed under [MIT License](https://raw.githubusercontent.com/g
103
99
  For questions, bug reports, or feature requests, please, consider opening an [issue on GitHub](https://github.com/gabriele-marino/phylogenie/issues), or [contact me directly](mailto:gabmarino.8601@email.com).
104
100
 
105
101
  If you need help with the configuration files, feel free to reach out — I am always very available and happy to assist!
106
-
@@ -48,7 +48,7 @@ def _draw_colored_tree(tree: Tree, ax: Axes, colors: Color | dict[Tree, Color])
48
48
  def draw_tree(
49
49
  tree: Tree,
50
50
  ax: Axes | None = None,
51
- color_by: str | dict[Tree, Any] | None = None,
51
+ color_by: str | dict[str, Any] | None = None,
52
52
  coloring: str | Coloring | None = None,
53
53
  default_color: Color = "black",
54
54
  cmap: str | None = None,
@@ -67,15 +67,16 @@ def draw_tree(
67
67
  if color_by is None:
68
68
  return _draw_colored_tree(tree, ax, colors=default_color)
69
69
 
70
- if isinstance(color_by, dict):
71
- features = {node: color_by[node] for node in tree if node in color_by}
72
- else:
70
+ if isinstance(color_by, str):
73
71
  features = {node: node[color_by] for node in tree if color_by in node.metadata}
72
+ else:
73
+ features = {node: color_by[node.name] for node in tree if node.name in color_by}
74
+ values = list(features.values())
74
75
 
75
76
  if coloring is None:
76
77
  coloring = (
77
78
  Coloring.CONTINUOUS
78
- if any(isinstance(f, float) for f in features.values())
79
+ if any(isinstance(f, float) for f in values)
79
80
  else Coloring.DISCRETE
80
81
  )
81
82
 
@@ -86,14 +87,14 @@ def draw_tree(
86
87
  }
87
88
 
88
89
  if coloring == Coloring.DISCRETE:
89
- if any(isinstance(f, float) for f in features.values()):
90
+ if any(isinstance(f, float) for f in values):
90
91
  raise ValueError(
91
92
  "Discrete coloring selected but feature values are not all categorical."
92
93
  )
93
94
 
94
95
  colormap = plt.get_cmap("tab20" if cmap is None else cmap)
95
96
  feature_colors = {
96
- f: mcolors.to_hex(colormap(i)) for i, f in enumerate(set(features.values()))
97
+ f: mcolors.to_hex(colormap(i)) for i, f in enumerate(set(values))
97
98
  }
98
99
  colors = _get_colors(lambda f: feature_colors[f])
99
100
 
@@ -114,8 +115,8 @@ def draw_tree(
114
115
  return _draw_colored_tree(tree, ax, colors)
115
116
 
116
117
  if coloring == Coloring.CONTINUOUS:
117
- vmin = min(features.values()) if vmin is None else vmin
118
- vmax = max(features.values()) if vmax is None else vmax
118
+ vmin = min(values) if vmin is None else vmin
119
+ vmax = max(values) if vmax is None else vmax
119
120
  norm = mcolors.Normalize(vmin=vmin, vmax=vmax)
120
121
  colormap = plt.get_cmap("viridis" if cmap is None else cmap)
121
122
  colors = _get_colors(lambda f: colormap(norm(float(f))))
@@ -127,7 +128,7 @@ def draw_tree(
127
128
  hist_ax = inset_axes(ax, **default_hist_axes_kwargs) # pyright: ignore
128
129
 
129
130
  hist_kwargs = {} if hist_kwargs is None else hist_kwargs
130
- _, bins, patches = hist_ax.hist(features, **hist_kwargs) # pyright: ignore
131
+ _, bins, patches = hist_ax.hist(values, **hist_kwargs) # pyright: ignore
131
132
 
132
133
  for patch, b0, b1 in zip( # pyright: ignore
133
134
  patches, bins[:-1], bins[1:] # pyright: ignore
@@ -15,9 +15,9 @@ def _parse_translate_block(lines: Iterator[str]) -> dict[str, str]:
15
15
  if ";" in line:
16
16
  return translations
17
17
  else:
18
- raise ValueError(f"Invalid translate line: {line}")
18
+ raise ValueError(f"Invalid translate line. Expected '<num> <name>'.")
19
19
  translations[match.group(1)] = match.group(2)
20
- raise ValueError("Translate block not terminated with ';'")
20
+ raise ValueError("Translate block not terminated with ';'.")
21
21
 
22
22
 
23
23
  def _parse_trees_block(lines: Iterator[str]) -> dict[str, Tree]:
@@ -33,9 +33,12 @@ def _parse_trees_block(lines: Iterator[str]) -> dict[str, Tree]:
33
33
  match = re.match(r"^TREE\s*\*?\s+(\S+)\s*=\s*(.+)$", line, re.IGNORECASE)
34
34
  if match is None:
35
35
  raise ValueError(
36
- f"Invalid tree line. Expected 'TREE <name> = <newick>'"
36
+ f"Invalid tree line. Expected 'TREE <name> = <newick>'."
37
37
  )
38
- trees[match.group(1)] = parse_newick(match.group(2), translations)
38
+ name = match.group(1)
39
+ if name in trees:
40
+ raise ValueError(f"Duplicate tree name found: {name}.")
41
+ trees[name] = parse_newick(match.group(2), translations)
39
42
  raise ValueError("Unterminated TREES block.")
40
43
 
41
44
 
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: phylogenie
3
+ Version: 3.1.3
4
+ Summary: Add your description here
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE.txt
8
+ Requires-Dist: joblib>=1.5.2
9
+ Requires-Dist: matplotlib>=3.10.7
10
+ Requires-Dist: pandas>=2.3.3
11
+ Requires-Dist: pydantic>=2.12.3
12
+ Requires-Dist: pyyaml>=6.0.3
13
+ Requires-Dist: tqdm>=4.67.1
14
+ Dynamic: license-file
15
+
16
+ <p align="center">
17
+ <img src="https://raw.githubusercontent.com/gabriele-marino/phylogenie/main/logo.png" style="width:100%; height:auto;"/>
18
+ </p>
19
+
20
+ ---
21
+
22
+ [![AliSim](https://img.shields.io/badge/Powered%20by-AliSim-orange?style=flat-square)](https://iqtree.github.io/doc/AliSim)
23
+ [![PyPI version](https://img.shields.io/pypi/v/phylogenie)](https://pypi.org/project/phylogenie/)
24
+ ![Downloads](https://img.shields.io/pypi/dm/phylogenie)
25
+
26
+
27
+ Phylogenie is a [Python](https://www.python.org/) package designed to easily simulate phylogenetic datasets—such as trees and multiple sequence alignments (MSAs)—with minimal setup effort. Simply specify the distributions from which your parameters should be sampled, and Phylogenie will handle the rest!
28
+
29
+ ## ✨ Features
30
+
31
+ Phylogenie comes packed with useful features, including:
32
+
33
+ - **Simulate tree and multiple sequence alignment (MSA) datasets from parameter distributions** 🌳🧬
34
+ Define distributions over your parameters and sample a different combination of parameters for each dataset sample.
35
+
36
+ - **Automatic metadata management** 🗂️
37
+ Phylogenie stores each parameter combination sampled during dataset generation in a `.csv` file.
38
+
39
+ - **Generalizable configurations** 🔄
40
+ Easily apply the same configuration across multiple dataset splits (e.g., train, validation, test).
41
+
42
+ - **Multiprocessing support** ⚙️💻
43
+ Simply specify the number of cores to use, and Phylogenie handles multiprocessing automatically.
44
+
45
+ - **Pre-implemented parameterizations** 🎯
46
+ Include canonical, fossilized birth-death, epidemiological, birth-death with exposed-infectious (BDEI), birth-death with superspreading (BDSS), and contact tracing (CT).
47
+
48
+ - **Skyline parameter support** 🪜
49
+ Support for piece-wise constant parameters.
50
+
51
+ - **Arithmetic operations on parameters** 🧮
52
+ Perform flexible arithmetic operations between parameters directly within the config file.
53
+
54
+ ## 📦 Installation
55
+ Phylogenie requires [Python](https://www.python.org/) 3.10 to be installed on your system. There are several ways to install Python and managing different Python versions. One popular option is to use [pyenv](https://github.com/pyenv/pyenv).
56
+
57
+ Once you have Python set up, you can install Phylogenie directly from PyPI:
58
+
59
+ ```bash
60
+ pip install phylogenie
61
+ ```
62
+
63
+ Or install from source:
64
+ ```bash
65
+ git clone https://github.com/gabriele-marino/phylogenie.git
66
+ cd phylogenie
67
+ pip install .
68
+ ```
69
+
70
+ ## 🛠 Backend dependency
71
+
72
+ Phylogenie relies on [AliSim](https://iqtree.github.io/doc/AliSim) for simulating multiple sequence alignments (MSAs). AliSim is a powerful MSAs simulation tool distributed with [IQ-TREE](https://iqtree.github.io/), and requires separate installation to use it as a simulation backend.
73
+
74
+ ## 🚀 Quick Start
75
+
76
+ Once you have installed Phylogenie, check out the [examples](https://github.com/gabriele-marino/phylogenie/tree/main/examples) folder.
77
+ It includes a collection of thoroughly commented configuration files, organized as a step-by-step tutorial. These examples will help you understand how to use Phylogenie in practice and can be easily adapted to fit your own workflow.
78
+
79
+ For quick start, pick your favorite config file and run Phylogenie with:
80
+ ```bash
81
+ phylogenie examples/config_file.yaml
82
+ ```
83
+ This command will create the output dataset in the folder specified inside the configuration file, including data directories and metadata files for each dataset split defined in the config.
84
+
85
+ >❗ *Tip*: Can’t choose just one config file?
86
+ You can run them all at once by pointing Phylogenie to the folder! Just use: `phylogenie examples`. In this mode, Phylogenie will automatically find all `.yaml` files in the folder you specified and run for each of them!
87
+
88
+ ## 📖 Documentation
89
+
90
+ - The [examples](https://github.com/gabriele-marino/phylogenie/tree/main/examples) folder contains many ready-to-use, extensively commented configuration files that serve as a step-by-step tutorial to guide you through using Phylogenie. You can explore them to learn how it works or adapt them directly to your own workflows.
91
+ - A complete user guide and API reference are under development. In the meantime, feel free to [reach out](mailto:gabmarino.8601@email.com) if you have any questions about integrating Phylogenie into your workflows.
92
+
93
+ ## 📄 License
94
+
95
+ This project is licensed under [MIT License](https://raw.githubusercontent.com/gabriele-marino/phylogenie/main/LICENSE.txt).
96
+
97
+ ## 📫 Contact
98
+
99
+ For questions, bug reports, or feature requests, please, consider opening an [issue on GitHub](https://github.com/gabriele-marino/phylogenie/issues), or [contact me directly](mailto:gabmarino.8601@email.com).
100
+
101
+ If you need help with the configuration files, feel free to reach out — I am always very available and happy to assist!
@@ -0,0 +1,44 @@
1
+ LICENSE.txt
2
+ README.md
3
+ pyproject.toml
4
+ phylogenie/__init__.py
5
+ phylogenie/draw.py
6
+ phylogenie/main.py
7
+ phylogenie/mixins.py
8
+ phylogenie/msa.py
9
+ phylogenie/py.typed
10
+ phylogenie/typeguards.py
11
+ phylogenie/typings.py
12
+ phylogenie.egg-info/PKG-INFO
13
+ phylogenie.egg-info/SOURCES.txt
14
+ phylogenie.egg-info/dependency_links.txt
15
+ phylogenie.egg-info/entry_points.txt
16
+ phylogenie.egg-info/requires.txt
17
+ phylogenie.egg-info/top_level.txt
18
+ phylogenie/generators/__init__.py
19
+ phylogenie/generators/alisim.py
20
+ phylogenie/generators/configs.py
21
+ phylogenie/generators/dataset.py
22
+ phylogenie/generators/factories.py
23
+ phylogenie/generators/trees.py
24
+ phylogenie/generators/typeguards.py
25
+ phylogenie/io/__init__.py
26
+ phylogenie/io/fasta.py
27
+ phylogenie/skyline/__init__.py
28
+ phylogenie/skyline/matrix.py
29
+ phylogenie/skyline/parameter.py
30
+ phylogenie/skyline/vector.py
31
+ phylogenie/treesimulator/__init__.py
32
+ phylogenie/treesimulator/features.py
33
+ phylogenie/treesimulator/gillespie.py
34
+ phylogenie/treesimulator/model.py
35
+ phylogenie/treesimulator/tree.py
36
+ phylogenie/treesimulator/utils.py
37
+ phylogenie/treesimulator/events/__init__.py
38
+ phylogenie/treesimulator/events/base.py
39
+ phylogenie/treesimulator/events/contact_tracing.py
40
+ phylogenie/treesimulator/events/core.py
41
+ phylogenie/treesimulator/events/mutations.py
42
+ phylogenie/treesimulator/io/__init__.py
43
+ phylogenie/treesimulator/io/newick.py
44
+ phylogenie/treesimulator/io/nexus.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ phylogenie = phylogenie.main:main
@@ -0,0 +1,6 @@
1
+ joblib>=1.5.2
2
+ matplotlib>=3.10.7
3
+ pandas>=2.3.3
4
+ pydantic>=2.12.3
5
+ pyyaml>=6.0.3
6
+ tqdm>=4.67.1
@@ -0,0 +1 @@
1
+ phylogenie
@@ -0,0 +1,32 @@
1
+ [project]
2
+ name = "phylogenie"
3
+ version = "3.1.3"
4
+ description = "Add your description here"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ dependencies = [
8
+ "joblib>=1.5.2",
9
+ "matplotlib>=3.10.7",
10
+ "pandas>=2.3.3",
11
+ "pydantic>=2.12.3",
12
+ "pyyaml>=6.0.3",
13
+ "tqdm>=4.67.1",
14
+ ]
15
+
16
+ [tool.pyright]
17
+ typeCheckingMode = "strict"
18
+
19
+ [project.scripts]
20
+ phylogenie = "phylogenie.main:main"
21
+
22
+ [build-system]
23
+ requires = ["setuptools>=42"]
24
+ build-backend = "setuptools.build_meta"
25
+
26
+ [dependency-groups]
27
+ dev = [
28
+ "joblib-stubs>=1.5.2.0.20250831",
29
+ "pandas-stubs>=2.3.2.250926",
30
+ "pyright>=1.1.407",
31
+ "pytest>=8.4.2",
32
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -1,32 +0,0 @@
1
- [tool.poetry]
2
- name = "phylogenie"
3
- version = "3.1.2"
4
- description = "Generate phylogenetic datasets with minimal setup effort"
5
- authors = ["Gabriele Marino <gabmarino.8601@gmail.com>"]
6
- readme = "README.md"
7
-
8
- [tool.poetry.dependencies]
9
- python = "^3.10"
10
-
11
- joblib = "^1.4.2"
12
- matplotlib = "^3.10.6"
13
- pandas = "^2.2.2"
14
- pydantic = "^2.11.5"
15
- pyyaml = "^6.0.2"
16
- tqdm = "^4.66.4"
17
-
18
- [tool.poetry.group.dev.dependencies]
19
- joblib-stubs = "^1.5.0.1.20250510"
20
- pandas-stubs = "^2.3.0.250703"
21
- pyright = "^1.1.402"
22
- pytest = "^8.3.5"
23
-
24
- [tool.poetry.scripts]
25
- phylogenie = "phylogenie.main:main"
26
-
27
- [tool.pyright]
28
- typeCheckingMode = "strict"
29
-
30
- [build-system]
31
- requires = ["poetry-core"]
32
- build-backend = "poetry.core.masonry.api"
File without changes
File without changes
File without changes