phylogenie 3.1.10__tar.gz → 3.3.1__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.
Files changed (57) hide show
  1. {phylogenie-3.1.10/src/phylogenie.egg-info → phylogenie-3.3.1}/PKG-INFO +8 -9
  2. {phylogenie-3.1.10 → phylogenie-3.3.1}/README.md +7 -8
  3. {phylogenie-3.1.10 → phylogenie-3.3.1}/pyproject.toml +3 -3
  4. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/__init__.py +20 -45
  5. phylogenie-3.3.1/src/phylogenie/_mixins.py +87 -0
  6. phylogenie-3.1.10/src/phylogenie/typeguards.py → phylogenie-3.3.1/src/phylogenie/_typeguards.py +1 -1
  7. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/draw.py +165 -135
  8. phylogenie-3.1.10/src/phylogenie/generators/configs.py → phylogenie-3.3.1/src/phylogenie/generators/_configs.py +21 -9
  9. phylogenie-3.1.10/src/phylogenie/generators/factories.py → phylogenie-3.3.1/src/phylogenie/generators/_factories.py +36 -41
  10. phylogenie-3.1.10/src/phylogenie/generators/typeguards.py → phylogenie-3.3.1/src/phylogenie/generators/_typeguards.py +3 -3
  11. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/generators/alisim.py +5 -4
  12. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/generators/dataset.py +1 -1
  13. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/generators/trees.py +123 -84
  14. phylogenie-3.3.1/src/phylogenie/io/__init__.py +5 -0
  15. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/io/fasta.py +30 -1
  16. {phylogenie-3.1.10/src/phylogenie/treesimulator → phylogenie-3.3.1/src/phylogenie}/io/newick.py +80 -17
  17. {phylogenie-3.1.10/src/phylogenie/treesimulator → phylogenie-3.3.1/src/phylogenie}/io/nexus.py +47 -5
  18. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/main.py +38 -2
  19. phylogenie-3.3.1/src/phylogenie/msa.py +214 -0
  20. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/skyline/matrix.py +104 -2
  21. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/skyline/parameter.py +58 -2
  22. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/skyline/vector.py +78 -2
  23. phylogenie-3.3.1/src/phylogenie/tree_node.py +802 -0
  24. phylogenie-3.3.1/src/phylogenie/treesimulator/__init__.py +47 -0
  25. phylogenie-3.3.1/src/phylogenie/treesimulator/events/__init__.py +40 -0
  26. phylogenie-3.3.1/src/phylogenie/treesimulator/events/base.py +55 -0
  27. phylogenie-3.1.10/src/phylogenie/treesimulator/events/core.py → phylogenie-3.3.1/src/phylogenie/treesimulator/events/unbounded_population.py +40 -25
  28. phylogenie-3.3.1/src/phylogenie/treesimulator/gillespie.py +173 -0
  29. phylogenie-3.3.1/src/phylogenie/treesimulator/models/__init__.py +6 -0
  30. phylogenie-3.3.1/src/phylogenie/treesimulator/models/base.py +45 -0
  31. phylogenie-3.3.1/src/phylogenie/treesimulator/models/unbounded_population.py +104 -0
  32. {phylogenie-3.1.10 → phylogenie-3.3.1/src/phylogenie.egg-info}/PKG-INFO +8 -9
  33. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie.egg-info/SOURCES.txt +13 -16
  34. phylogenie-3.1.10/src/phylogenie/io/__init__.py +0 -3
  35. phylogenie-3.1.10/src/phylogenie/mixins.py +0 -33
  36. phylogenie-3.1.10/src/phylogenie/msa.py +0 -73
  37. phylogenie-3.1.10/src/phylogenie/treesimulator/__init__.py +0 -79
  38. phylogenie-3.1.10/src/phylogenie/treesimulator/events/__init__.py +0 -39
  39. phylogenie-3.1.10/src/phylogenie/treesimulator/events/base.py +0 -39
  40. phylogenie-3.1.10/src/phylogenie/treesimulator/events/contact_tracing.py +0 -140
  41. phylogenie-3.1.10/src/phylogenie/treesimulator/events/mutations.py +0 -105
  42. phylogenie-3.1.10/src/phylogenie/treesimulator/features.py +0 -55
  43. phylogenie-3.1.10/src/phylogenie/treesimulator/gillespie.py +0 -142
  44. phylogenie-3.1.10/src/phylogenie/treesimulator/io/__init__.py +0 -4
  45. phylogenie-3.1.10/src/phylogenie/treesimulator/model.py +0 -130
  46. phylogenie-3.1.10/src/phylogenie/treesimulator/tree.py +0 -206
  47. phylogenie-3.1.10/src/phylogenie/treesimulator/utils.py +0 -119
  48. {phylogenie-3.1.10 → phylogenie-3.3.1}/LICENSE.txt +0 -0
  49. {phylogenie-3.1.10 → phylogenie-3.3.1}/setup.cfg +0 -0
  50. /phylogenie-3.1.10/src/phylogenie/typings.py → /phylogenie-3.3.1/src/phylogenie/_typings.py +0 -0
  51. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/generators/__init__.py +0 -0
  52. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/py.typed +0 -0
  53. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie/skyline/__init__.py +0 -0
  54. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie.egg-info/dependency_links.txt +0 -0
  55. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie.egg-info/entry_points.txt +0 -0
  56. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie.egg-info/requires.txt +0 -0
  57. {phylogenie-3.1.10 → phylogenie-3.3.1}/src/phylogenie.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: phylogenie
3
- Version: 3.1.10
3
+ Version: 3.3.1
4
4
  Summary: Generate phylogenetic datasets with minimal setup effort
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -23,7 +23,6 @@ Dynamic: license-file
23
23
  [![PyPI version](https://img.shields.io/pypi/v/phylogenie)](https://pypi.org/project/phylogenie/)
24
24
  ![Downloads](https://img.shields.io/pypi/dm/phylogenie)
25
25
 
26
-
27
26
  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
27
 
29
28
  ## ✨ Features
@@ -48,8 +47,8 @@ Phylogenie comes packed with useful features, including:
48
47
  - **Skyline parameter support** 🪜
49
48
  Support for piece-wise constant parameters.
50
49
 
51
- - **Arithmetic operations on parameters** 🧮
52
- Perform flexible arithmetic operations between parameters directly within the config file.
50
+ - **Operations on parameters** 🧮
51
+ Perform flexible operations between parameters directly within the config file.
53
52
 
54
53
  ## 📦 Installation
55
54
  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).
@@ -73,21 +72,21 @@ Phylogenie relies on [AliSim](https://iqtree.github.io/doc/AliSim) for simulatin
73
72
 
74
73
  ## 🚀 Quick Start
75
74
 
76
- Once you have installed Phylogenie, check out the [examples](https://github.com/gabriele-marino/phylogenie/tree/main/examples) folder.
75
+ Once you have installed Phylogenie, check out the [tutorials](https://github.com/gabriele-marino/phylogenie/tree/main/tutorials) folder.
77
76
  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
77
 
79
78
  For quick start, pick your favorite config file and run Phylogenie with:
80
79
  ```bash
81
- phylogenie examples/config_file.yaml
80
+ phylogenie tutorials/config_file.yaml
82
81
  ```
83
82
  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
83
 
85
84
  >❗ *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!
85
+ You can run them all at once by pointing Phylogenie to the folder! Just use: `phylogenie tutorials`. In this mode, Phylogenie will automatically find all `.yaml` files in the folder you specified and run for each of them!
87
86
 
88
87
  ## 📖 Documentation
89
88
 
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.
89
+ - The [tutorials](https://github.com/gabriele-marino/phylogenie/tree/main/tutorials) 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
90
  - 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
91
 
93
92
  ## 📄 License
@@ -98,4 +97,4 @@ This project is licensed under [MIT License](https://raw.githubusercontent.com/g
98
97
 
99
98
  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
99
 
101
- If you need help with the configuration files, feel free to reach out — I am always very available and happy to assist!
100
+ For help with configuration files, don’t hesitate to reach out — I’m happy to assist!
@@ -8,7 +8,6 @@
8
8
  [![PyPI version](https://img.shields.io/pypi/v/phylogenie)](https://pypi.org/project/phylogenie/)
9
9
  ![Downloads](https://img.shields.io/pypi/dm/phylogenie)
10
10
 
11
-
12
11
  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!
13
12
 
14
13
  ## ✨ Features
@@ -33,8 +32,8 @@ Phylogenie comes packed with useful features, including:
33
32
  - **Skyline parameter support** 🪜
34
33
  Support for piece-wise constant parameters.
35
34
 
36
- - **Arithmetic operations on parameters** 🧮
37
- Perform flexible arithmetic operations between parameters directly within the config file.
35
+ - **Operations on parameters** 🧮
36
+ Perform flexible operations between parameters directly within the config file.
38
37
 
39
38
  ## 📦 Installation
40
39
  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).
@@ -58,21 +57,21 @@ Phylogenie relies on [AliSim](https://iqtree.github.io/doc/AliSim) for simulatin
58
57
 
59
58
  ## 🚀 Quick Start
60
59
 
61
- Once you have installed Phylogenie, check out the [examples](https://github.com/gabriele-marino/phylogenie/tree/main/examples) folder.
60
+ Once you have installed Phylogenie, check out the [tutorials](https://github.com/gabriele-marino/phylogenie/tree/main/tutorials) folder.
62
61
  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.
63
62
 
64
63
  For quick start, pick your favorite config file and run Phylogenie with:
65
64
  ```bash
66
- phylogenie examples/config_file.yaml
65
+ phylogenie tutorials/config_file.yaml
67
66
  ```
68
67
  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.
69
68
 
70
69
  >❗ *Tip*: Can’t choose just one config file?
71
- 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!
70
+ You can run them all at once by pointing Phylogenie to the folder! Just use: `phylogenie tutorials`. In this mode, Phylogenie will automatically find all `.yaml` files in the folder you specified and run for each of them!
72
71
 
73
72
  ## 📖 Documentation
74
73
 
75
- - 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.
74
+ - The [tutorials](https://github.com/gabriele-marino/phylogenie/tree/main/tutorials) 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.
76
75
  - 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.
77
76
 
78
77
  ## 📄 License
@@ -83,4 +82,4 @@ This project is licensed under [MIT License](https://raw.githubusercontent.com/g
83
82
 
84
83
  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).
85
84
 
86
- If you need help with the configuration files, feel free to reach out — I am always very available and happy to assist!
85
+ For help with configuration files, don’t hesitate to reach out — I’m happy to assist!
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "phylogenie"
3
- version = "3.1.10"
3
+ version = "3.3.1"
4
4
  description = "Generate phylogenetic datasets with minimal setup effort"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -17,7 +17,7 @@ dependencies = [
17
17
  dev = [
18
18
  "joblib-stubs>=1.5.2.0.20250831",
19
19
  "pandas-stubs>=2.3.2.250926",
20
- "pyright>=1.1.407",
20
+ "pyright>=1.1.408",
21
21
  "pytest>=8.4.2",
22
22
  ]
23
23
 
@@ -29,4 +29,4 @@ phylogenie = "phylogenie.main:main"
29
29
 
30
30
  [build-system]
31
31
  requires = ["setuptools>=42"]
32
- build-backend = "setuptools.build_meta"
32
+ build-backend = "setuptools.build_meta"
@@ -18,7 +18,8 @@ from phylogenie.generators import (
18
18
  FBDTreeDatasetGenerator,
19
19
  TreeDatasetGeneratorConfig,
20
20
  )
21
- from phylogenie.io import dump_fasta, load_fasta
21
+ from phylogenie.io import dump_fasta, dump_newick, load_fasta, load_newick, load_nexus
22
+ from phylogenie.main import run
22
23
  from phylogenie.msa import MSA, Sequence
23
24
  from phylogenie.skyline import (
24
25
  SkylineMatrix,
@@ -32,41 +33,26 @@ from phylogenie.skyline import (
32
33
  skyline_parameter,
33
34
  skyline_vector,
34
35
  )
36
+ from phylogenie.tree_node import TreeNode
35
37
  from phylogenie.treesimulator import (
36
38
  Birth,
37
- BirthWithContactTracing,
38
39
  Death,
39
40
  Event,
40
- EventType,
41
- Feature,
42
41
  Migration,
43
- Mutation,
42
+ Model,
44
43
  Sampling,
45
- SamplingWithContactTracing,
46
- Tree,
47
- compute_mean_leaf_pairwise_distance,
48
- compute_sackin_index,
49
- dump_newick,
44
+ TimedEvent,
45
+ TimedSampling,
46
+ UnboundedPopulationEvent,
47
+ UnboundedPopulationModel,
48
+ UnboundedPopulationTimedEvent,
50
49
  generate_trees,
51
50
  get_BD_events,
52
51
  get_BDEI_events,
53
52
  get_BDSS_events,
54
53
  get_canonical_events,
55
- get_contact_tracing_events,
56
- get_distance,
57
54
  get_epidemiological_events,
58
55
  get_FBD_events,
59
- get_mrca,
60
- get_mutation_id,
61
- get_node_depth_levels,
62
- get_node_depths,
63
- get_node_height_levels,
64
- get_node_heights,
65
- get_node_leaf_counts,
66
- get_node_state,
67
- load_newick,
68
- load_nexus,
69
- set_features,
70
56
  simulate_tree,
71
57
  )
72
58
 
@@ -88,7 +74,11 @@ __all__ = [
88
74
  "FBDTreeDatasetGenerator",
89
75
  "TreeDatasetGeneratorConfig",
90
76
  "dump_fasta",
77
+ "dump_newick",
91
78
  "load_fasta",
79
+ "load_newick",
80
+ "load_nexus",
81
+ "run",
92
82
  "MSA",
93
83
  "Sequence",
94
84
  "SkylineMatrix",
@@ -101,39 +91,24 @@ __all__ = [
101
91
  "skyline_matrix",
102
92
  "skyline_parameter",
103
93
  "skyline_vector",
94
+ "TreeNode",
104
95
  "Birth",
105
- "BirthWithContactTracing",
106
96
  "Death",
107
97
  "Event",
108
- "EventType",
109
- "Feature",
110
98
  "Migration",
111
- "Mutation",
99
+ "Model",
112
100
  "Sampling",
113
- "SamplingWithContactTracing",
114
- "Tree",
115
- "compute_mean_leaf_pairwise_distance",
116
- "compute_sackin_index",
117
- "dump_newick",
101
+ "TimedEvent",
102
+ "TimedSampling",
103
+ "UnboundedPopulationEvent",
104
+ "UnboundedPopulationModel",
105
+ "UnboundedPopulationTimedEvent",
118
106
  "generate_trees",
119
107
  "get_BD_events",
120
108
  "get_BDEI_events",
121
109
  "get_BDSS_events",
122
110
  "get_canonical_events",
123
- "get_contact_tracing_events",
124
- "get_distance",
125
111
  "get_epidemiological_events",
126
112
  "get_FBD_events",
127
- "get_mrca",
128
- "get_mutation_id",
129
- "get_node_depth_levels",
130
- "get_node_depths",
131
- "get_node_height_levels",
132
- "get_node_heights",
133
- "get_node_leaf_counts",
134
- "get_node_state",
135
- "load_newick",
136
- "load_nexus",
137
- "set_features",
138
113
  "simulate_tree",
139
114
  ]
@@ -0,0 +1,87 @@
1
+ from collections.abc import Mapping
2
+ from types import MappingProxyType
3
+ from typing import Any
4
+
5
+
6
+ class MetadataMixin:
7
+ """
8
+ Provide a dictionary-backed metadata interface.
9
+
10
+ This mixin exposes read-only access to metadata and helper methods for
11
+ mutating key/value annotations in a consistent way.
12
+ """
13
+
14
+ def __init__(self):
15
+ self._metadata: dict[str, Any] = {}
16
+
17
+ @property
18
+ def metadata(self) -> Mapping[str, Any]:
19
+ """
20
+ Return a read-only view of metadata.
21
+
22
+ Returns
23
+ --------
24
+ Mapping[str, Any]
25
+ An immutable view of the metadata dictionary.
26
+ """
27
+ return MappingProxyType(self._metadata)
28
+
29
+ def set(self, key: str, value: Any):
30
+ """
31
+ Set a metadata key to a value.
32
+
33
+ Parameters
34
+ -----------
35
+ key : str
36
+ Metadata key to set.
37
+ value : Any
38
+ Value to store under the key.
39
+ """
40
+ self._metadata[key] = value
41
+
42
+ def update(self, metadata: Mapping[str, Any]):
43
+ """
44
+ Merge a mapping of metadata into the existing metadata.
45
+
46
+ Parameters
47
+ -----------
48
+ metadata : Mapping[str, Any]
49
+ Key/value pairs to merge into metadata.
50
+ """
51
+ self._metadata.update(metadata)
52
+
53
+ def get(self, key: str, default: Any = None) -> Any:
54
+ """
55
+ Fetch a metadata value with an optional default.
56
+
57
+ Parameters
58
+ -----------
59
+ key : str
60
+ Metadata key to retrieve.
61
+ default : Any, optional
62
+ Value to return if the key is missing.
63
+ """
64
+ return self._metadata.get(key, default)
65
+
66
+ def delete(self, key: str):
67
+ """
68
+ Delete a metadata key.
69
+
70
+ Parameters
71
+ -----------
72
+ key : str
73
+ Metadata key to delete.
74
+ """
75
+ del self._metadata[key]
76
+
77
+ def clear(self):
78
+ """
79
+ Remove all metadata entries.
80
+ """
81
+ self._metadata.clear()
82
+
83
+ def __getitem__(self, key: str) -> Any:
84
+ return self._metadata[key]
85
+
86
+ def __setitem__(self, key: str, value: Any) -> None:
87
+ self._metadata[key] = value
@@ -1,7 +1,7 @@
1
1
  from collections.abc import Sequence
2
2
  from typing import Any, TypeGuard
3
3
 
4
- import phylogenie.typings as pgt
4
+ import phylogenie._typings as pgt
5
5
 
6
6
 
7
7
  def is_many(x: Any) -> TypeGuard[pgt.Many[Any]]: