bella-companion 0.0.5__py3-none-any.whl → 0.0.7__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.
Potentially problematic release.
This version of bella-companion might be problematic. Click here for more details.
- bella_companion/cli.py +13 -11
- bella_companion/fbd_empirical/__init__.py +3 -0
- bella_companion/fbd_empirical/run_beast.py +45 -31
- bella_companion/simulations/run_beast.py +1 -0
- {bella_companion-0.0.5.dist-info → bella_companion-0.0.7.dist-info}/METADATA +1 -1
- {bella_companion-0.0.5.dist-info → bella_companion-0.0.7.dist-info}/RECORD +8 -8
- bella_companion/fbd_empirical/params.json +0 -11
- {bella_companion-0.0.5.dist-info → bella_companion-0.0.7.dist-info}/WHEEL +0 -0
- {bella_companion-0.0.5.dist-info → bella_companion-0.0.7.dist-info}/entry_points.txt +0 -0
bella_companion/cli.py
CHANGED
|
@@ -4,12 +4,10 @@ from pathlib import Path
|
|
|
4
4
|
|
|
5
5
|
from dotenv import load_dotenv
|
|
6
6
|
|
|
7
|
-
from bella_companion.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
summarize_logs,
|
|
12
|
-
)
|
|
7
|
+
from bella_companion.fbd_empirical import run_beast as run_fbd_empirical
|
|
8
|
+
from bella_companion.simulations import generate_data, generate_figures
|
|
9
|
+
from bella_companion.simulations import run_beast as run_simulations
|
|
10
|
+
from bella_companion.simulations import summarize_logs
|
|
13
11
|
|
|
14
12
|
|
|
15
13
|
def main():
|
|
@@ -23,20 +21,24 @@ def main():
|
|
|
23
21
|
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
24
22
|
|
|
25
23
|
subparsers.add_parser(
|
|
26
|
-
"
|
|
24
|
+
"sim-data", help="Generate synthetic simulation datasets."
|
|
27
25
|
).set_defaults(func=generate_data)
|
|
28
26
|
|
|
29
27
|
subparsers.add_parser(
|
|
30
|
-
"
|
|
31
|
-
).set_defaults(func=
|
|
28
|
+
"sim-run", help="Run BEAST2 analyses on simulation datasets."
|
|
29
|
+
).set_defaults(func=run_simulations)
|
|
32
30
|
|
|
33
31
|
subparsers.add_parser(
|
|
34
|
-
"
|
|
32
|
+
"sim-summary", help="Summarize BEAST2 log outputs for simulations."
|
|
35
33
|
).set_defaults(func=summarize_logs)
|
|
36
34
|
|
|
37
35
|
subparsers.add_parser(
|
|
38
|
-
"
|
|
36
|
+
"sim-figures", help="Generate plots and figures from simulation results."
|
|
39
37
|
).set_defaults(func=generate_figures)
|
|
40
38
|
|
|
39
|
+
subparsers.add_parser(
|
|
40
|
+
"fbd-empirical-run", help="Run BEAST2 analyses on empirical FBD datasets."
|
|
41
|
+
).set_defaults(func=run_fbd_empirical)
|
|
42
|
+
|
|
41
43
|
args = parser.parse_args()
|
|
42
44
|
args.func()
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import os
|
|
2
3
|
from pathlib import Path
|
|
3
4
|
|
|
@@ -7,48 +8,61 @@ from phylogenie import load_newick
|
|
|
7
8
|
from phylogenie.utils import get_node_depths
|
|
8
9
|
from tqdm import tqdm
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
from src.utils import run_sbatch
|
|
11
|
+
from bella_companion.utils import submit_job
|
|
12
12
|
|
|
13
13
|
THIS_DIR = Path(__file__).parent
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def
|
|
17
|
-
|
|
16
|
+
def run_beast():
|
|
17
|
+
base_output_dir = Path(os.environ["BELLA_BEAST_OUTPUT_DIR"])
|
|
18
|
+
output_dir = base_output_dir / "fbd-empirical"
|
|
18
19
|
os.makedirs(output_dir, exist_ok=True)
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
data_dir = THIS_DIR / "data"
|
|
22
|
+
tree_file = data_dir / "trees.nwk"
|
|
23
|
+
change_times_file = data_dir / "change_times.csv"
|
|
23
24
|
|
|
25
|
+
trees = load_newick(str(tree_file))
|
|
26
|
+
assert isinstance(trees, list)
|
|
24
27
|
change_times = (
|
|
25
28
|
pl.read_csv(change_times_file, has_header=False).to_series().to_numpy()
|
|
26
29
|
)
|
|
27
|
-
time_predictor = " ".join(
|
|
28
|
-
list(map(str, np.repeat(np.insert(change_times, 0, 0), 4)))
|
|
29
|
-
)
|
|
30
|
+
time_predictor = " ".join(list(map(str, np.repeat([0, *change_times], 4))))
|
|
30
31
|
body_mass_predictor = " ".join(["0", "1", "2", "3"] * (len(change_times) + 1))
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
assert isinstance(trees, list)
|
|
33
|
+
job_ids = {}
|
|
34
34
|
for i, tree in enumerate(tqdm(trees)):
|
|
35
35
|
process_length = max(get_node_depths(tree).values())
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
[
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
36
|
+
command = " ".join(
|
|
37
|
+
[
|
|
38
|
+
os.environ["BELLA_RUN_BEAST_CMD"],
|
|
39
|
+
f"-D types=0,1,2,3",
|
|
40
|
+
f'-D startTypePriorProbs="0.25 0.25 0.25 0.25"',
|
|
41
|
+
f"-D birthRateUpper=2",
|
|
42
|
+
f"-D deathRateUpper=2",
|
|
43
|
+
f"-D samplingRateUpper=10",
|
|
44
|
+
f'-D samplingRateInit="5 5 5 5 5 5 5"',
|
|
45
|
+
f"-D migrationRateUpper=10",
|
|
46
|
+
f'-D migrationRateInit="0.5 0 0 0.5 0.5 0 0 0.5 0.5 0 0 0.5"',
|
|
47
|
+
f'-D nodes="16 8"',
|
|
48
|
+
f'-D layersRange="0,1,2"',
|
|
49
|
+
f"-D treeFile={tree_file}",
|
|
50
|
+
f"-D treeIndex={i}",
|
|
51
|
+
f"-D changeTimesFile={change_times_file}",
|
|
52
|
+
f"-D samplingChangeTimesFile={data_dir / 'sampling_change_times.csv'}",
|
|
53
|
+
f"-D typeTraitFile={data_dir / 'body_mass.csv'}",
|
|
54
|
+
f"-D processLength={process_length}",
|
|
55
|
+
f'-D timePredictor="{time_predictor}"',
|
|
56
|
+
f'-D bodyMassPredictor="{body_mass_predictor}"',
|
|
57
|
+
f"-prefix {output_dir}{os.sep}",
|
|
58
|
+
str(Path(os.environ["BELLA_BEAST_CONFIGS_DIR"]) / "fbd-empirical.xml"),
|
|
59
|
+
]
|
|
60
|
+
)
|
|
61
|
+
job_ids[i] = submit_job(
|
|
62
|
+
command,
|
|
63
|
+
Path(os.environ["BELLA_SBATCH_LOG_DIR"]) / "fbd-empirical" / str(i),
|
|
64
|
+
mem_per_cpu="12000",
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
with open(base_output_dir / "fbd_empirical_job_ids.json", "w") as f:
|
|
68
|
+
json.dump(job_ids, f)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
bella_companion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
bella_companion/cli.py,sha256=
|
|
2
|
+
bella_companion/cli.py,sha256=2QM1czJxsfQsOX-miE-OeReXtjMHaR7lX9i73zKki1o,1471
|
|
3
|
+
bella_companion/fbd_empirical/__init__.py,sha256=I-G5rD59c1mNBYuoVNSfq59jD6IuwwJBDkNUCLcY7Qo,87
|
|
3
4
|
bella_companion/fbd_empirical/data/body_mass.csv,sha256=-UkKNtm9m3g4PjY3BcfdP6z5nL_I6p9cq6cgZ-bWKI8,30360
|
|
4
5
|
bella_companion/fbd_empirical/data/change_times.csv,sha256=zmc9_z91-XMwKyIoP9v9dVlLcf4MeIHkQiHLjoMriOo,120
|
|
5
6
|
bella_companion/fbd_empirical/data/sampling_change_times.csv,sha256=Gwi9RcMFy89RyvfxKVZ_MoKVRHOZLuwB_3LEaq8asMQ,32
|
|
6
7
|
bella_companion/fbd_empirical/data/trees.nwk,sha256=zhvLvPLZelhMThVmvOENkmi3p2aPAARb8KMdHTm6mss,4645318
|
|
7
8
|
bella_companion/fbd_empirical/figure.py,sha256=4paOXCB1EcxuHzLPxDSleQU2AQ_ndTedtzS1ugiKICs,1018
|
|
8
9
|
bella_companion/fbd_empirical/notbooks.ipynb,sha256=O45kmz0lZENRDFbKXEWPsIKATfF5GVeS5tCYmrGLnqk,83326
|
|
9
|
-
bella_companion/fbd_empirical/
|
|
10
|
-
bella_companion/fbd_empirical/run_beast.py,sha256=2sV2UmxOfWmbueiU6D0p3lueMYiZyIkSKYoblTMrYuA,1935
|
|
10
|
+
bella_companion/fbd_empirical/run_beast.py,sha256=Y2Mcl7tLer-CIgb5rcpZ0sCq7VL6VUejnbZ9mvkRxkU,2532
|
|
11
11
|
bella_companion/fbd_empirical/summarize_logs.py,sha256=O6rhE606Wa98a8b1KKlLPjUOro1pfyqVTLdQksQMG0g,1439
|
|
12
12
|
bella_companion/simulations/__init__.py,sha256=EBZAcI8skNPKjrA7CjrqH9ea7DTntmydAD0RqsxNUMM,352
|
|
13
13
|
bella_companion/simulations/features.py,sha256=DZOBpJGlQ0UinqUZYbEtoemZ2eQGVLV_i-DfpW31qJI,104
|
|
@@ -22,7 +22,7 @@ bella_companion/simulations/figures/fbd_no_traits_results.py,sha256=O6hx_OZVSHmW
|
|
|
22
22
|
bella_companion/simulations/figures/scenarios.py,sha256=OKh9_-ZvzNgWsO3-Vd0Aw3ndjVf76i_OuCvsKI-5r2s,2795
|
|
23
23
|
bella_companion/simulations/generate_data.py,sha256=H8OV4ZlTGZB-jXaROTPmOsK3UxRiU-GrX40l-shliw8,728
|
|
24
24
|
bella_companion/simulations/generate_figures.py,sha256=layMgoj3Bfl78Ceb1oE7YirAQ8zhjDyD9IrxDRXf6go,657
|
|
25
|
-
bella_companion/simulations/run_beast.py,sha256=
|
|
25
|
+
bella_companion/simulations/run_beast.py,sha256=Sw9wKNe1VlGNvYr-yiYv3LqUYVlcjcMAz_9Pzr-xyL0,3214
|
|
26
26
|
bella_companion/simulations/scenarios/__init__.py,sha256=3Kl1lKcFpfb3vLX64DmSW4XCF5kXU1ZoHtstFH-ZIzU,876
|
|
27
27
|
bella_companion/simulations/scenarios/common.py,sha256=_ddaSuTvEVdttGkXB4HPc2B7IB1F_GBOCW3cVOPZ-ZM,807
|
|
28
28
|
bella_companion/simulations/scenarios/epi_multitype.py,sha256=GWGIiqvYwX_FrT_3RXkZKYGDht9nZ7ceHRBKUvXDPnA,2432
|
|
@@ -36,7 +36,7 @@ bella_companion/utils/beast.py,sha256=5Vsv98VTE9HrY56WzUSMECjD_rIPxHTMRMD1ZzmA6w
|
|
|
36
36
|
bella_companion/utils/explain.py,sha256=uP7HPyn2YiykAI69BQV3RooDpC6qKoCLXfp3Uibp4zk,1475
|
|
37
37
|
bella_companion/utils/plots.py,sha256=dB_GiJ1HGrZ93cqODz6kB-HeDRPwlm2MkMe9rJZGnfs,3117
|
|
38
38
|
bella_companion/utils/slurm.py,sha256=v5DaG7YHVyK8KRFptgGDC6I8jxEhyJuMVK9N08pZSAI,1812
|
|
39
|
-
bella_companion-0.0.
|
|
40
|
-
bella_companion-0.0.
|
|
41
|
-
bella_companion-0.0.
|
|
42
|
-
bella_companion-0.0.
|
|
39
|
+
bella_companion-0.0.7.dist-info/METADATA,sha256=w-O11B88lzyTN6ENgW_0XTR2UhZEuj6Ar9hxmX_JDWs,576
|
|
40
|
+
bella_companion-0.0.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
41
|
+
bella_companion-0.0.7.dist-info/entry_points.txt,sha256=rSeKoAhmjnQqAYFcXBv0gAM2ViJfJe0D8_dD-fWrXeg,50
|
|
42
|
+
bella_companion-0.0.7.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"types": "0,1,2,3",
|
|
3
|
-
"startTypePriorProbs": "0.25 0.25 0.25 0.25",
|
|
4
|
-
"birthRateUpper": 2,
|
|
5
|
-
"deathRateUpper": 2,
|
|
6
|
-
"samplingRateUpper": 10,
|
|
7
|
-
"samplingRateInit": "5 5 5 5 5 5 5",
|
|
8
|
-
"migrationRateUpper": 10,
|
|
9
|
-
"migrationRateInit": "0.5 0 0 0.5 0.5 0 0 0.5 0.5 0 0 0.5",
|
|
10
|
-
"nodes": "16 8"
|
|
11
|
-
}
|
|
File without changes
|
|
File without changes
|