phylogenie 2.0.8__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.
@@ -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)(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: phylogenie
3
- Version: 2.0.8
3
+ Version: 2.0.9
4
4
  Summary: Generate phylogenetic datasets with minimal setup effort
5
5
  Author: Gabriele Marino
6
6
  Author-email: gabmarino.8601@gmail.com
@@ -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=k6RYJpgxOL8a_yMq98WUF-dcJv8TwxaWnde0k13M4J0,2525
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
@@ -21,8 +21,8 @@ phylogenie/treesimulator/gillespie.py,sha256=Fn-PyVICx3pWtpHko7rf6omf_kqOkkpebSJ
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.8.dist-info/LICENSE.txt,sha256=NUrDqElK-eD3I0WqC004CJsy6cs0JgsAoebDv_42-pw,1071
25
- phylogenie-2.0.8.dist-info/METADATA,sha256=VQdW_kK48caMP7UJDFDXi1RoY0vfOXnTSXrB-TXUmPU,5472
26
- phylogenie-2.0.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
27
- phylogenie-2.0.8.dist-info/entry_points.txt,sha256=Rt6_usN0FkBX1ZfiqCirjMN9FKOgFLG8rydcQ8kugeE,51
28
- phylogenie-2.0.8.dist-info/RECORD,,
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,,