phylogenie 3.1.3__py3-none-any.whl → 3.1.4__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/draw.py CHANGED
@@ -5,6 +5,7 @@ import matplotlib.colors as mcolors
5
5
  import matplotlib.patches as mpatches
6
6
  import matplotlib.pyplot as plt
7
7
  from matplotlib.axes import Axes
8
+ from matplotlib.colors import Colormap
8
9
  from mpl_toolkits.axes_grid1.inset_locator import inset_axes # pyright: ignore
9
10
 
10
11
  from phylogenie.treesimulator import Tree, get_node_depth_levels, get_node_depths
@@ -51,7 +52,7 @@ def draw_tree(
51
52
  color_by: str | dict[str, Any] | None = None,
52
53
  coloring: str | Coloring | None = None,
53
54
  default_color: Color = "black",
54
- cmap: str | None = None,
55
+ colormap: str | Colormap | None = None,
55
56
  vmin: float | None = None,
56
57
  vmax: float | None = None,
57
58
  show_legend: bool = True,
@@ -79,6 +80,10 @@ def draw_tree(
79
80
  if any(isinstance(f, float) for f in values)
80
81
  else Coloring.DISCRETE
81
82
  )
83
+ if colormap is None:
84
+ colormap = "tab20" if coloring == Coloring.DISCRETE else "viridis"
85
+ if isinstance(colormap, str):
86
+ colormap = plt.get_cmap(colormap)
82
87
 
83
88
  def _get_colors(feature_map: Callable[[Any], Color]) -> dict[Tree, Color]:
84
89
  return {
@@ -91,8 +96,6 @@ def draw_tree(
91
96
  raise ValueError(
92
97
  "Discrete coloring selected but feature values are not all categorical."
93
98
  )
94
-
95
- colormap = plt.get_cmap("tab20" if cmap is None else cmap)
96
99
  feature_colors = {
97
100
  f: mcolors.to_hex(colormap(i)) for i, f in enumerate(set(values))
98
101
  }
@@ -118,7 +121,6 @@ def draw_tree(
118
121
  vmin = min(values) if vmin is None else vmin
119
122
  vmax = max(values) if vmax is None else vmax
120
123
  norm = mcolors.Normalize(vmin=vmin, vmax=vmax)
121
- colormap = plt.get_cmap("viridis" if cmap is None else cmap)
122
124
  colors = _get_colors(lambda f: colormap(norm(float(f))))
123
125
 
124
126
  if show_hist:
phylogenie/main.py CHANGED
@@ -15,14 +15,10 @@ def run(config_path: str) -> None:
15
15
  if os.path.isdir(config_path):
16
16
  for config_file in glob(os.path.join(config_path, "**/*.yaml"), recursive=True):
17
17
  with open(config_file, "r") as f:
18
- config = safe_load(f)
19
- generator = adapter.validate_python(config)
20
- generator.generate()
18
+ adapter.validate_python(safe_load(f)).generate()
21
19
  else:
22
20
  with open(config_path, "r") as f:
23
- config = safe_load(f)
24
- generator = adapter.validate_python(config)
25
- generator.generate()
21
+ adapter.validate_python(safe_load(f)).generate()
26
22
 
27
23
 
28
24
  def main() -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: phylogenie
3
- Version: 3.1.3
3
+ Version: 3.1.4
4
4
  Summary: Add your description here
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  phylogenie/__init__.py,sha256=-4GKO2EKgc2GiOhzVRI0SQk6wQZ4AlP7Ron_Lp-s_r0,2913
2
- phylogenie/draw.py,sha256=qAFFA9bZPoVMvaOAceC4S-XzF5CXk-qTU2yIwbrA0Ac,5487
3
- phylogenie/main.py,sha256=vtvSpQxBNlYABoFQ25czl-l3fIr4QRo3svWVd-jcArw,1170
2
+ phylogenie/draw.py,sha256=nT3FOHSm85G23qz2xxYf2MesEDonWRSxfKGJkVboTKY,5580
3
+ phylogenie/main.py,sha256=DstKWUySyDXdcPN_P8O3Mmoau4IjUxCQ4iLWDVuAcws,1054
4
4
  phylogenie/mixins.py,sha256=kwxcHGYSS-Frk-r0nwuyILYS1g6NjSOhbUKEYt2g1B0,1319
5
5
  phylogenie/msa.py,sha256=JDGyZUsAq6-m-SQjoCDjAkAZIxfgyl_PDIhdYn5HOow,2064
6
6
  phylogenie/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -33,9 +33,9 @@ phylogenie/treesimulator/events/mutations.py,sha256=8Nqa2fg7fwaVNe5XSkGDSwp9pIKQ
33
33
  phylogenie/treesimulator/io/__init__.py,sha256=rfP-zp8SP8baq5_4dPAr10WH0W6KfoMCxdTZDCSXtzE,185
34
34
  phylogenie/treesimulator/io/newick.py,sha256=8Pr_jixByPOaVch18w-rFt62HYy0U97YMu0H-QSwIy0,3449
35
35
  phylogenie/treesimulator/io/nexus.py,sha256=tPZRPejnG0OEE7YTorwvyZe2vnZHv4KiC9f-N7Kx6qg,1849
36
- phylogenie-3.1.3.dist-info/licenses/LICENSE.txt,sha256=NUrDqElK-eD3I0WqC004CJsy6cs0JgsAoebDv_42-pw,1071
37
- phylogenie-3.1.3.dist-info/METADATA,sha256=1n5ZhRstpxMfZsQLOamnd82GZGTVgL2_zIAEKtXkcY4,5163
38
- phylogenie-3.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
39
- phylogenie-3.1.3.dist-info/entry_points.txt,sha256=BBH8LoReHnNFnvq4sROEsVFegfkKJ6c_oHZ7bgK7Jl4,52
40
- phylogenie-3.1.3.dist-info/top_level.txt,sha256=1YGZJhKA9tN9qI0Hcj6Cn_sOoDpba0HQlNcgQTjMD-8,11
41
- phylogenie-3.1.3.dist-info/RECORD,,
36
+ phylogenie-3.1.4.dist-info/licenses/LICENSE.txt,sha256=NUrDqElK-eD3I0WqC004CJsy6cs0JgsAoebDv_42-pw,1071
37
+ phylogenie-3.1.4.dist-info/METADATA,sha256=en3CvCPhiUbQPZTAUYWpx8nQze6oqS-KQJJa3xGdvbI,5163
38
+ phylogenie-3.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
39
+ phylogenie-3.1.4.dist-info/entry_points.txt,sha256=BBH8LoReHnNFnvq4sROEsVFegfkKJ6c_oHZ7bgK7Jl4,52
40
+ phylogenie-3.1.4.dist-info/top_level.txt,sha256=1YGZJhKA9tN9qI0Hcj6Cn_sOoDpba0HQlNcgQTjMD-8,11
41
+ phylogenie-3.1.4.dist-info/RECORD,,