bella-companion 0.0.14__py3-none-any.whl → 0.0.15__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/fbd_empirical/beast_config.xml +117 -0
- bella_companion/fbd_empirical/data/traits.csv +122 -122
- bella_companion/fbd_empirical/data/trees.nwk +46 -46
- bella_companion/fbd_empirical/results.py +6 -6
- bella_companion/fbd_empirical/run_beast.py +10 -28
- bella_companion/fbd_empirical/summarize_logs.py +2 -2
- bella_companion/simulations/beast_configs/epi-multitype/GLM.xml +81 -0
- bella_companion/simulations/beast_configs/epi-multitype/MLP.xml +81 -0
- bella_companion/simulations/beast_configs/epi-multitype/Nonparametric.xml +65 -0
- bella_companion/simulations/beast_configs/epi-skyline/GLM.xml +71 -0
- bella_companion/simulations/beast_configs/epi-skyline/MLP.xml +73 -0
- bella_companion/simulations/beast_configs/epi-skyline/Nonparametric.xml +57 -0
- bella_companion/simulations/beast_configs/fbd-2traits/GLM.xml +101 -0
- bella_companion/simulations/beast_configs/fbd-2traits/MLP.xml +98 -0
- bella_companion/simulations/beast_configs/fbd-2traits/Nonparametric.xml +70 -0
- bella_companion/simulations/beast_configs/fbd-no-traits/GLM.xml +88 -0
- bella_companion/simulations/beast_configs/fbd-no-traits/MLP.xml +86 -0
- bella_companion/simulations/beast_configs/fbd-no-traits/Nonparametric.xml +62 -0
- bella_companion/simulations/generate_data.py +3 -3
- bella_companion/simulations/metrics.py +0 -4
- bella_companion/simulations/run_beast.py +5 -4
- {bella_companion-0.0.14.dist-info → bella_companion-0.0.15.dist-info}/METADATA +2 -2
- {bella_companion-0.0.14.dist-info → bella_companion-0.0.15.dist-info}/RECORD +25 -12
- {bella_companion-0.0.14.dist-info → bella_companion-0.0.15.dist-info}/WHEEL +0 -0
- {bella_companion-0.0.14.dist-info → bella_companion-0.0.15.dist-info}/entry_points.txt +0 -0
|
@@ -30,19 +30,19 @@ def _plot_predictions(output_dir: Path):
|
|
|
30
30
|
"diversification": plt.cm.Greens(np.linspace(0.4, 0.9, 4)), # pyright: ignore
|
|
31
31
|
}
|
|
32
32
|
for rate in ["birth", "death", "diversification"]:
|
|
33
|
-
for
|
|
33
|
+
for type in [0, 1, 2, 3]:
|
|
34
34
|
if rate == "diversification":
|
|
35
35
|
estimates = log_summary.select(
|
|
36
36
|
[
|
|
37
|
-
pl.col(f"birthRateSPi{i}_{
|
|
38
|
-
- pl.col(f"deathRateSPi{i}_{
|
|
37
|
+
pl.col(f"birthRateSPi{i}_{type}_median")
|
|
38
|
+
- pl.col(f"deathRateSPi{i}_{type}_median")
|
|
39
39
|
for i in range(len(change_times) + 1)
|
|
40
40
|
]
|
|
41
41
|
).to_numpy()
|
|
42
42
|
else:
|
|
43
43
|
estimates = log_summary.select(
|
|
44
44
|
[
|
|
45
|
-
pl.col(f"{rate}RateSPi{i}_{
|
|
45
|
+
pl.col(f"{rate}RateSPi{i}_{type}_median")
|
|
46
46
|
for i in range(len(change_times) + 1)
|
|
47
47
|
]
|
|
48
48
|
).to_numpy()
|
|
@@ -51,7 +51,7 @@ def _plot_predictions(output_dir: Path):
|
|
|
51
51
|
lower = np.percentile(estimates, 2.5, axis=0)
|
|
52
52
|
upper = np.percentile(estimates, 97.5, axis=0)
|
|
53
53
|
|
|
54
|
-
color = colors[rate][
|
|
54
|
+
color = colors[rate][type]
|
|
55
55
|
|
|
56
56
|
plt.fill_between( # pyright: ignore
|
|
57
57
|
time_bins,
|
|
@@ -68,7 +68,7 @@ def _plot_predictions(output_dir: Path):
|
|
|
68
68
|
)
|
|
69
69
|
|
|
70
70
|
plt.step( # pyright: ignore
|
|
71
|
-
time_bins, [median[0], *median], color=color, label=
|
|
71
|
+
time_bins, [median[0], *median], color=color, label=type
|
|
72
72
|
)
|
|
73
73
|
|
|
74
74
|
ax = plt.gca()
|
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import os
|
|
3
|
-
from itertools import product
|
|
4
3
|
from pathlib import Path
|
|
5
4
|
|
|
6
5
|
import numpy as np
|
|
7
6
|
import polars as pl
|
|
8
|
-
from phylogenie import load_newick
|
|
9
|
-
from phylogenie.utils import get_node_depths
|
|
7
|
+
from phylogenie import get_node_depths, load_newick
|
|
10
8
|
from tqdm import tqdm
|
|
11
9
|
|
|
12
10
|
from bella_companion.utils import submit_job
|
|
13
11
|
|
|
14
12
|
|
|
15
|
-
def _get_migration_rates_init(types: list[str], init_rate: float = 1) -> str:
|
|
16
|
-
mus: list[float] = []
|
|
17
|
-
for t1, t2 in product(types, types):
|
|
18
|
-
if t1 == t2:
|
|
19
|
-
continue
|
|
20
|
-
traits1 = np.array(list(map(int, t1.split("_"))))
|
|
21
|
-
traits2 = np.array(list(map(int, t2.split("_"))))
|
|
22
|
-
mus.append(init_rate if np.sum(np.abs(traits1 - traits2)) == 1 else 0)
|
|
23
|
-
return " ".join(map(str, mus))
|
|
24
|
-
|
|
25
|
-
|
|
26
13
|
def run_beast():
|
|
27
14
|
base_output_dir = Path(os.environ["BELLA_BEAST_OUTPUT_DIR"])
|
|
28
15
|
output_dir = base_output_dir / "fbd-empirical"
|
|
@@ -36,21 +23,15 @@ def run_beast():
|
|
|
36
23
|
trees = load_newick(str(tree_file))
|
|
37
24
|
assert isinstance(trees, list)
|
|
38
25
|
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
types = ["0", "1", "2", "3"]
|
|
41
27
|
change_times = (
|
|
42
28
|
pl.read_csv(change_times_file, has_header=False).to_series().to_numpy()
|
|
43
29
|
)
|
|
44
30
|
time_bins = [0, *change_times]
|
|
45
31
|
T = len(time_bins)
|
|
46
32
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
N = len(types)
|
|
50
|
-
|
|
51
|
-
time_predictor = " ".join(list(map(str, np.repeat(time_bins, N))))
|
|
52
|
-
log10BM_predictor = " ".join([t.split("_")[0] for t in types] * T)
|
|
53
|
-
midlat_predictor = " ".join([t.split("_")[1] for t in types] * T)
|
|
33
|
+
time_predictor = " ".join(list(map(str, np.repeat(time_bins, len(types)))))
|
|
34
|
+
log10BM_predictor = " ".join(types * T)
|
|
54
35
|
|
|
55
36
|
job_ids = {}
|
|
56
37
|
for i, tree in enumerate(tqdm(trees)):
|
|
@@ -59,25 +40,26 @@ def run_beast():
|
|
|
59
40
|
[
|
|
60
41
|
os.environ["BELLA_RUN_BEAST_CMD"],
|
|
61
42
|
f'-D types="{",".join(types)}"',
|
|
62
|
-
f'-D startTypePriorProbs="
|
|
43
|
+
f'-D startTypePriorProbs="0.25 0.25 0.25 0.25"',
|
|
63
44
|
f"-D birthRateUpper=5",
|
|
64
45
|
f"-D deathRateUpper=5",
|
|
46
|
+
f'-D samplingChangeTimes="2.58 5.333 23.03"',
|
|
65
47
|
f"-D samplingRateUpper=5",
|
|
66
|
-
f'-D samplingRateInit="
|
|
48
|
+
f'-D samplingRateInit="2.5 2.5 2.5 2.5"',
|
|
67
49
|
f"-D migrationRateUpper=5",
|
|
68
|
-
f'-D migrationRateInit="
|
|
50
|
+
f'-D migrationRateInit="2.5 0 0 2.5 2.5 0 0 2.5 2.5 0 0 2.5"',
|
|
69
51
|
f'-D nodes="16 8"',
|
|
70
52
|
f'-D layersRange="0,1,2"',
|
|
71
53
|
f"-D treeFile={tree_file}",
|
|
72
54
|
f"-D treeIndex={i}",
|
|
73
55
|
f"-D changeTimesFile={change_times_file}",
|
|
74
56
|
f"-D traitsFile={traits_file}",
|
|
57
|
+
f"-D traitValueCol=3",
|
|
75
58
|
f"-D processLength={process_length}",
|
|
76
59
|
f'-D timePredictor="{time_predictor}"',
|
|
77
60
|
f'-D log10BMPredictor="{log10BM_predictor}"',
|
|
78
|
-
f'-D midlatPredictor="{midlat_predictor}"',
|
|
79
61
|
f"-prefix {output_dir}{os.sep}",
|
|
80
|
-
str(Path(
|
|
62
|
+
str(Path(__file__).parent / "beast_config.xml"),
|
|
81
63
|
]
|
|
82
64
|
)
|
|
83
65
|
job_ids[i] = submit_job(
|
|
@@ -16,10 +16,10 @@ def summarize_logs():
|
|
|
16
16
|
summaries = summarize_logs_dir(
|
|
17
17
|
logs_dir=logs_dir,
|
|
18
18
|
target_columns=[
|
|
19
|
-
f"{rate}RateSPi{i}_{
|
|
19
|
+
f"{rate}RateSPi{i}_{t}"
|
|
20
20
|
for rate in ["birth", "death"]
|
|
21
21
|
for i in range(n_time_bins)
|
|
22
|
-
for
|
|
22
|
+
for t in ["0", "1", "2", "3"]
|
|
23
23
|
],
|
|
24
24
|
)
|
|
25
25
|
weights = read_weights_dir(logs_dir)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<beast
|
|
3
|
+
namespace="
|
|
4
|
+
:beast.base.evolution.operator.kernel
|
|
5
|
+
:beast.base.inference.parameter
|
|
6
|
+
:beast.base.inference.operator.kernel
|
|
7
|
+
:beast.base.inference
|
|
8
|
+
:beast.base.inference.distribution
|
|
9
|
+
:bdmmprime.distribution
|
|
10
|
+
:bdmmprime.parameterization
|
|
11
|
+
:feast.fileio
|
|
12
|
+
:feast.function
|
|
13
|
+
:feast.expressions"
|
|
14
|
+
version="2.5"
|
|
15
|
+
>
|
|
16
|
+
<map name="Normal">beast.base.inference.distribution.Normal</map>
|
|
17
|
+
<map name="Uniform">beast.base.inference.distribution.Uniform</map>
|
|
18
|
+
|
|
19
|
+
<map name="TreeFromNewickFile">feast.fileio.TreeFromNewickFile</map>
|
|
20
|
+
<map name="TaxonSetFromTree">feast.fileio.TaxonSetFromTree</map>
|
|
21
|
+
<map name="TraitSetFromTaxonSet">feast.fileio.TraitSetFromTaxonSet</map>
|
|
22
|
+
<map name="TypeSet">bdmmprime.parameterization.TypeSet</map>
|
|
23
|
+
|
|
24
|
+
<TreeFromNewickFile id="tree" fileName="$(treeFile)" IsLabelledNewick="true" adjustTipHeights='false'/>
|
|
25
|
+
<TaxonSetFromTree id="taxonSet" tree="@tree"/>
|
|
26
|
+
<TraitSetFromTaxonSet id="typeTraitSet" traitname="type" delimiter="|" takeGroup="1" taxa="@taxonSet"/>
|
|
27
|
+
<TypeSet id="typeSet" value="$(types)" typeTraitSet="@typeTraitSet"/>
|
|
28
|
+
|
|
29
|
+
<parameter id="finalSampleOffset" spec="ExpCalculator" value="$(processLength)-$(lastSampleTime)"/>
|
|
30
|
+
|
|
31
|
+
<Normal id="weightsPrior" mean="0" sigma="1"/>
|
|
32
|
+
<Uniform id="migrationRatePrior" upper="$(migrationRateUpper)"/>
|
|
33
|
+
|
|
34
|
+
<run spec="MCMC" chainLength="10000000">
|
|
35
|
+
<state id="state">
|
|
36
|
+
<stateNode spec="RealParameter" id="migrationRateScaler" value="0.01"/>
|
|
37
|
+
<stateNode spec="RealParameter" id="migrationRateW" value="0"/>
|
|
38
|
+
</state>
|
|
39
|
+
|
|
40
|
+
<distribution id="posterior" spec="CompoundDistribution">
|
|
41
|
+
<distribution id="likelihood" spec="CompoundDistribution">
|
|
42
|
+
<distribution spec="BirthDeathMigrationDistribution" tree="@tree" finalSampleOffset="@finalSampleOffset" typeTraitSet="@typeTraitSet">
|
|
43
|
+
<parameterization spec="EpiParameterization" processLength="$(processLength)" typeSet="@typeSet">
|
|
44
|
+
<Re spec="SkylineVectorParameter" skylineValues="$(reproductionNumber)" typeSet="@typeSet"/>
|
|
45
|
+
<becomeUninfectiousRate spec="SkylineVectorParameter" skylineValues="$(becomeUninfectiousRate)" typeSet="@typeSet"/>
|
|
46
|
+
<samplingProportion spec="SkylineVectorParameter" skylineValues="$(samplingProportion)" typeSet="@typeSet"/>
|
|
47
|
+
<migrationRate id="migrationRateSP" spec="SkylineMatrixParameter" typeSet="@typeSet">
|
|
48
|
+
<skylineValues id="migrationRate" spec="glmprior.util.GLMLogLinear" coefficients="@migrationRateW" scaleFactor="@migrationRateScaler" transform="false">
|
|
49
|
+
<predictor spec="RealParameter" value="$(migrationPredictor)"/>
|
|
50
|
+
<predictor spec="RealParameter" value="$(randomPredictor)"/>
|
|
51
|
+
<indicators spec="BooleanParameter" value="1"/>
|
|
52
|
+
</skylineValues>
|
|
53
|
+
</migrationRate>
|
|
54
|
+
<removalProb spec="SkylineVectorParameter" skylineValues="1.0" typeSet="@typeSet"/>
|
|
55
|
+
</parameterization>
|
|
56
|
+
<startTypePriorProbs spec="RealParameter" value="$(startTypePriorProbs)"/>
|
|
57
|
+
</distribution>
|
|
58
|
+
</distribution>
|
|
59
|
+
|
|
60
|
+
<distribution id="prior" spec="CompoundDistribution">
|
|
61
|
+
<distribution spec="Prior" x="@migrationRateScaler" distr="@weightsPrior"/>
|
|
62
|
+
<distribution spec="Prior" x="@migrationRateW" distr="@weightsPrior"/>
|
|
63
|
+
<distribution spec="Prior" x="@migrationRate" distr="@migrationRatePrior"/>
|
|
64
|
+
</distribution>
|
|
65
|
+
|
|
66
|
+
</distribution>
|
|
67
|
+
|
|
68
|
+
<operator spec="BactrianScaleOperator" parameter="@migrationRateScaler" weight="30.0"/>
|
|
69
|
+
<operator spec="BactrianRandomWalkOperator" parameter="@migrationRateW" weight="30.0"/>
|
|
70
|
+
|
|
71
|
+
<logger spec="Logger" fileName="$(treeID).log" logEvery="1000" model="@posterior">
|
|
72
|
+
<log idref="posterior"/>
|
|
73
|
+
<log idref="prior"/>
|
|
74
|
+
<log idref="likelihood"/>
|
|
75
|
+
<log idref="migrationRateSP"/>
|
|
76
|
+
<log idref="migrationRateW"/>
|
|
77
|
+
<log idref="migrationRateScaler"/>
|
|
78
|
+
</logger>
|
|
79
|
+
</run>
|
|
80
|
+
|
|
81
|
+
</beast>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<beast
|
|
3
|
+
namespace="
|
|
4
|
+
:beast.base.inference.parameter
|
|
5
|
+
:beast.base.inference.operator.kernel
|
|
6
|
+
:beast.base.inference
|
|
7
|
+
:beast.base.inference.distribution
|
|
8
|
+
:bdmmprime.distribution
|
|
9
|
+
:bdmmprime.parameterization
|
|
10
|
+
:feast.fileio
|
|
11
|
+
:feast.function
|
|
12
|
+
:feast.expressions"
|
|
13
|
+
version="2.5"
|
|
14
|
+
>
|
|
15
|
+
<map name="Normal">beast.base.inference.distribution.Normal</map>
|
|
16
|
+
|
|
17
|
+
<map name="TreeFromNewickFile">feast.fileio.TreeFromNewickFile</map>
|
|
18
|
+
<map name="TaxonSetFromTree">feast.fileio.TaxonSetFromTree</map>
|
|
19
|
+
<map name="TraitSetFromTaxonSet">feast.fileio.TraitSetFromTaxonSet</map>
|
|
20
|
+
<map name="TypeSet">bdmmprime.parameterization.TypeSet</map>
|
|
21
|
+
|
|
22
|
+
<TreeFromNewickFile id="tree" fileName="$(treeFile)" IsLabelledNewick="true" adjustTipHeights='false'/>
|
|
23
|
+
<TaxonSetFromTree id="taxonSet" tree="@tree"/>
|
|
24
|
+
<TraitSetFromTaxonSet id="typeTraitSet" traitname="type" delimiter="|" takeGroup="1" taxa="@taxonSet"/>
|
|
25
|
+
<TypeSet id="typeSet" value="$(types)" typeTraitSet="@typeTraitSet"/>
|
|
26
|
+
|
|
27
|
+
<parameter id="finalSampleOffset" spec="ExpCalculator" value="$(processLength)-$(lastSampleTime)"/>
|
|
28
|
+
|
|
29
|
+
<Normal id="weightsPrior" mean="0" sigma="1"/>
|
|
30
|
+
|
|
31
|
+
<run spec="MCMC" chainLength="10000000">
|
|
32
|
+
<state id="state">
|
|
33
|
+
<plate var="n" range="$(layersRange)">
|
|
34
|
+
<stateNode spec="RealParameter" name="stateNode" id="migrationRateW$(n)" value="0"/>
|
|
35
|
+
</plate>
|
|
36
|
+
</state>
|
|
37
|
+
|
|
38
|
+
<distribution id="posterior" spec="CompoundDistribution">
|
|
39
|
+
<distribution id="likelihood" spec="CompoundDistribution">
|
|
40
|
+
<distribution spec="BirthDeathMigrationDistribution" tree="@tree" finalSampleOffset="@finalSampleOffset" typeTraitSet="@typeTraitSet">
|
|
41
|
+
<parameterization spec="EpiParameterization" processLength="$(processLength)" typeSet="@typeSet">
|
|
42
|
+
<Re spec="SkylineVectorParameter" skylineValues="$(reproductionNumber)" typeSet="@typeSet"/>
|
|
43
|
+
<becomeUninfectiousRate spec="SkylineVectorParameter" skylineValues="$(becomeUninfectiousRate)" typeSet="@typeSet"/>
|
|
44
|
+
<samplingProportion spec="SkylineVectorParameter" skylineValues="$(samplingProportion)" typeSet="@typeSet"/>
|
|
45
|
+
<migrationRate id="migrationRateSP" spec="SkylineMatrixParameter" typeSet="@typeSet">
|
|
46
|
+
<skylineValues id="migrationRate" spec="bella.BayesMLP" nodes="$(nodes)">
|
|
47
|
+
<predictor spec="RealParameter" value="$(migrationPredictor)"/>
|
|
48
|
+
<predictor spec="RealParameter" value="$(randomPredictor)"/>
|
|
49
|
+
<plate var="n" range="$(layersRange)">
|
|
50
|
+
<weights idref="migrationRateW$(n)"/>
|
|
51
|
+
</plate>
|
|
52
|
+
<activationFunctionsOutput spec="bella.Sigmoid" upper="$(migrationRateUpper)"/>
|
|
53
|
+
</skylineValues>
|
|
54
|
+
</migrationRate>
|
|
55
|
+
<removalProb spec="SkylineVectorParameter" skylineValues="1.0" typeSet="@typeSet"/>
|
|
56
|
+
</parameterization>
|
|
57
|
+
<startTypePriorProbs spec="RealParameter" value="$(startTypePriorProbs)"/>
|
|
58
|
+
</distribution>
|
|
59
|
+
</distribution>
|
|
60
|
+
|
|
61
|
+
<distribution id="prior" spec="CompoundDistribution">
|
|
62
|
+
<plate var="n" range="$(layersRange)">
|
|
63
|
+
<distribution spec="Prior" x="@migrationRateW$(n)" distr="@weightsPrior"/>
|
|
64
|
+
</plate>
|
|
65
|
+
</distribution>
|
|
66
|
+
</distribution>
|
|
67
|
+
|
|
68
|
+
<plate var="n" range="$(layersRange)">
|
|
69
|
+
<operator spec="BactrianRandomWalkOperator" parameter="@migrationRateW$(n)" weight="30.0"/>
|
|
70
|
+
</plate>
|
|
71
|
+
|
|
72
|
+
<logger spec="Logger" fileName="$(treeID).log" logEvery="1000" model="@posterior">
|
|
73
|
+
<log idref="posterior"/>
|
|
74
|
+
<log idref="prior"/>
|
|
75
|
+
<log idref="likelihood"/>
|
|
76
|
+
<log idref="migrationRateSP"/>
|
|
77
|
+
<log idref="migrationRate"/>
|
|
78
|
+
</logger>
|
|
79
|
+
</run>
|
|
80
|
+
|
|
81
|
+
</beast>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<beast
|
|
3
|
+
namespace="
|
|
4
|
+
:beast.base.evolution.operator.kernel
|
|
5
|
+
:beast.base.inference.parameter
|
|
6
|
+
:beast.base.inference
|
|
7
|
+
:beast.base.inference.distribution
|
|
8
|
+
:bdmmprime.distribution
|
|
9
|
+
:bdmmprime.parameterization
|
|
10
|
+
:feast.fileio
|
|
11
|
+
:feast.function
|
|
12
|
+
:feast.expressions"
|
|
13
|
+
version="2.5"
|
|
14
|
+
>
|
|
15
|
+
<map name="Uniform">beast.base.inference.distribution.Uniform</map>
|
|
16
|
+
|
|
17
|
+
<map name="TreeFromNewickFile">feast.fileio.TreeFromNewickFile</map>
|
|
18
|
+
<map name="TaxonSetFromTree">feast.fileio.TaxonSetFromTree</map>
|
|
19
|
+
<map name="TraitSetFromTaxonSet">feast.fileio.TraitSetFromTaxonSet</map>
|
|
20
|
+
<map name="TypeSet">bdmmprime.parameterization.TypeSet</map>
|
|
21
|
+
|
|
22
|
+
<TreeFromNewickFile id="tree" fileName="$(treeFile)" IsLabelledNewick="true" adjustTipHeights='false'/>
|
|
23
|
+
<TaxonSetFromTree id="taxonSet" tree="@tree"/>
|
|
24
|
+
<TraitSetFromTaxonSet id="typeTraitSet" traitname="type" delimiter="|" takeGroup="1" taxa="@taxonSet"/>
|
|
25
|
+
<TypeSet id="typeSet" value="$(types)" typeTraitSet="@typeTraitSet"/>
|
|
26
|
+
|
|
27
|
+
<parameter id="finalSampleOffset" spec="ExpCalculator" value="$(processLength)-$(lastSampleTime)"/>
|
|
28
|
+
|
|
29
|
+
<Uniform id="migrationRatePrior" upper="$(migrationRateUpper)"/>
|
|
30
|
+
|
|
31
|
+
<run spec="MCMC" chainLength="10000000">
|
|
32
|
+
<state id="state">
|
|
33
|
+
<stateNode id="migrationRate" spec="RealParameter" value="$(migrationRateInit)"/>
|
|
34
|
+
</state>
|
|
35
|
+
|
|
36
|
+
<distribution id="posterior" spec="CompoundDistribution">
|
|
37
|
+
<distribution id="likelihood" spec="CompoundDistribution">
|
|
38
|
+
<distribution spec="BirthDeathMigrationDistribution" tree="@tree" finalSampleOffset="@finalSampleOffset" typeTraitSet="@typeTraitSet">
|
|
39
|
+
<parameterization spec="EpiParameterization" processLength="$(processLength)" typeSet="@typeSet">
|
|
40
|
+
<Re spec="SkylineVectorParameter" skylineValues="$(reproductionNumber)" typeSet="@typeSet"/>
|
|
41
|
+
<becomeUninfectiousRate spec="SkylineVectorParameter" skylineValues="$(becomeUninfectiousRate)" typeSet="@typeSet"/>
|
|
42
|
+
<samplingProportion spec="SkylineVectorParameter" skylineValues="$(samplingProportion)" typeSet="@typeSet"/>
|
|
43
|
+
<migrationRate id="migrationRateSP" spec="SkylineMatrixParameter" skylineValues="@migrationRate" typeSet="@typeSet"/>
|
|
44
|
+
<removalProb spec="SkylineVectorParameter" skylineValues="1.0" typeSet="@typeSet"/>
|
|
45
|
+
</parameterization>
|
|
46
|
+
<startTypePriorProbs spec="RealParameter" value="$(startTypePriorProbs)"/>
|
|
47
|
+
</distribution>
|
|
48
|
+
</distribution>
|
|
49
|
+
|
|
50
|
+
<distribution id="prior" spec="CompoundDistribution">
|
|
51
|
+
<distribution spec="Prior" x="@migrationRate" distr="@migrationRatePrior"/>
|
|
52
|
+
</distribution>
|
|
53
|
+
</distribution>
|
|
54
|
+
|
|
55
|
+
<operator spec="BactrianScaleOperator" parameter="@migrationRate" weight="30.0"/>
|
|
56
|
+
|
|
57
|
+
<logger spec="Logger" fileName="$(treeID).log" logEvery="1000" model="@posterior">
|
|
58
|
+
<log idref="posterior"/>
|
|
59
|
+
<log idref="prior"/>
|
|
60
|
+
<log idref="likelihood"/>
|
|
61
|
+
<log idref="migrationRateSP"/>
|
|
62
|
+
</logger>
|
|
63
|
+
</run>
|
|
64
|
+
|
|
65
|
+
</beast>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<beast
|
|
3
|
+
namespace="
|
|
4
|
+
:beast.base.evolution.operator.kernel
|
|
5
|
+
:beast.base.inference.parameter
|
|
6
|
+
:beast.base.inference.operator.kernel
|
|
7
|
+
:beast.base.inference
|
|
8
|
+
:beast.base.inference.distribution
|
|
9
|
+
:bdmmprime.distribution
|
|
10
|
+
:bdmmprime.parameterization
|
|
11
|
+
:feast.fileio
|
|
12
|
+
:feast.expressions"
|
|
13
|
+
version="2.5"
|
|
14
|
+
>
|
|
15
|
+
<map name="Normal">beast.base.inference.distribution.Normal</map>
|
|
16
|
+
<map name="Uniform">beast.base.inference.distribution.Uniform</map>
|
|
17
|
+
|
|
18
|
+
<map name="TreeFromNewickFile">feast.fileio.TreeFromNewickFile</map>
|
|
19
|
+
|
|
20
|
+
<TreeFromNewickFile id="tree" fileName="$(treeFile)" IsLabelledNewick="true" adjustTipHeights='false'/>
|
|
21
|
+
|
|
22
|
+
<parameter id="finalSampleOffset" spec="ExpCalculator" value="$(processLength)-$(lastSampleTime)"/>
|
|
23
|
+
|
|
24
|
+
<Normal id="weightsPrior" mean="0" sigma="1"/>
|
|
25
|
+
<Uniform id="reproductionNumberPrior" upper="$(reproductionNumberUpper)"/>
|
|
26
|
+
|
|
27
|
+
<run spec="MCMC" chainLength="10000000">
|
|
28
|
+
<state id="state">
|
|
29
|
+
<stateNode spec="RealParameter" id="reproductionNumberScaler" value="1"/>
|
|
30
|
+
<stateNode spec="RealParameter" id="reproductionNumberW" value="0"/>
|
|
31
|
+
</state>
|
|
32
|
+
|
|
33
|
+
<distribution id="posterior" spec="CompoundDistribution">
|
|
34
|
+
<distribution id="likelihood" spec="CompoundDistribution">
|
|
35
|
+
<distribution spec="BirthDeathMigrationDistribution" tree="@tree" finalSampleOffset="@finalSampleOffset">
|
|
36
|
+
<parameterization spec="EpiParameterization" processLength="$(processLength)">
|
|
37
|
+
<Re id="reproductionNumberSP" spec="SkylineVectorParameter" changeTimes="$(changeTimes)">
|
|
38
|
+
<skylineValues id="reproductionNumber" spec="glmprior.util.GLMLogLinear" coefficients="@reproductionNumberW" scaleFactor="@reproductionNumberScaler" transform="false">
|
|
39
|
+
<predictor spec="RealParameter" value="$(timePredictor)"/>
|
|
40
|
+
<predictor spec="RealParameter" value="$(randomPredictor)"/>
|
|
41
|
+
<indicators spec="BooleanParameter" value="1"/>
|
|
42
|
+
</skylineValues>
|
|
43
|
+
</Re>
|
|
44
|
+
<becomeUninfectiousRate spec="SkylineVectorParameter" skylineValues="$(becomeUninfectiousRate)"/>
|
|
45
|
+
<samplingProportion spec="SkylineVectorParameter" skylineValues="$(samplingProportion)"/>
|
|
46
|
+
<removalProb spec="SkylineVectorParameter" skylineValues="1.0"/>
|
|
47
|
+
</parameterization>
|
|
48
|
+
</distribution>
|
|
49
|
+
</distribution>
|
|
50
|
+
|
|
51
|
+
<distribution id="prior" spec="CompoundDistribution">
|
|
52
|
+
<distribution spec="Prior" x="@reproductionNumber" distr="@reproductionNumberPrior"/>
|
|
53
|
+
<distribution spec="Prior" x="@reproductionNumberScaler" distr="@weightsPrior"/>
|
|
54
|
+
<distribution spec="Prior" x="@reproductionNumberW" distr="@weightsPrior"/>
|
|
55
|
+
</distribution>
|
|
56
|
+
</distribution>
|
|
57
|
+
|
|
58
|
+
<operator spec="BactrianScaleOperator" parameter="@reproductionNumberScaler" weight="30.0"/>
|
|
59
|
+
<operator spec="BactrianRandomWalkOperator" parameter="@reproductionNumberW" weight="30.0"/>
|
|
60
|
+
|
|
61
|
+
<logger spec="Logger" fileName="$(treeID).log" logEvery="1000" model="@posterior">
|
|
62
|
+
<log idref="posterior"/>
|
|
63
|
+
<log idref="prior"/>
|
|
64
|
+
<log idref="likelihood"/>
|
|
65
|
+
<log idref="reproductionNumberSP"/>
|
|
66
|
+
<log idref="reproductionNumberW"/>
|
|
67
|
+
<log idref="reproductionNumberScaler"/>
|
|
68
|
+
</logger>
|
|
69
|
+
</run>
|
|
70
|
+
|
|
71
|
+
</beast>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<beast
|
|
3
|
+
namespace="
|
|
4
|
+
:beast.base.evolution.operator.kernel
|
|
5
|
+
:beast.base.inference.parameter
|
|
6
|
+
:beast.base.inference.operator.kernel
|
|
7
|
+
:beast.base.inference
|
|
8
|
+
:beast.base.inference.distribution
|
|
9
|
+
:bdmmprime.distribution
|
|
10
|
+
:bdmmprime.parameterization
|
|
11
|
+
:feast.fileio
|
|
12
|
+
:feast.expressions"
|
|
13
|
+
version="2.5"
|
|
14
|
+
>
|
|
15
|
+
<map name="Normal">beast.base.inference.distribution.Normal</map>
|
|
16
|
+
|
|
17
|
+
<map name="TreeFromNewickFile">feast.fileio.TreeFromNewickFile</map>
|
|
18
|
+
|
|
19
|
+
<TreeFromNewickFile id="tree" fileName="$(treeFile)" IsLabelledNewick="true" adjustTipHeights='false'/>
|
|
20
|
+
|
|
21
|
+
<parameter id="finalSampleOffset" spec="ExpCalculator" value="$(processLength)-$(lastSampleTime)"/>
|
|
22
|
+
|
|
23
|
+
<Normal id="weightsPrior" mean="0" sigma="1"/>
|
|
24
|
+
|
|
25
|
+
<run spec="MCMC" chainLength="10000000">
|
|
26
|
+
<state id="state">
|
|
27
|
+
<plate var="n" range="$(layersRange)">
|
|
28
|
+
<stateNode spec="RealParameter" name="stateNode" id="reproductionNumberW$(n)" value="0"/>
|
|
29
|
+
</plate>
|
|
30
|
+
</state>
|
|
31
|
+
|
|
32
|
+
<distribution id="posterior" spec="CompoundDistribution">
|
|
33
|
+
<distribution id="likelihood" spec="CompoundDistribution">
|
|
34
|
+
<distribution spec="BirthDeathMigrationDistribution" tree="@tree" finalSampleOffset="@finalSampleOffset">
|
|
35
|
+
<parameterization spec="EpiParameterization" processLength="$(processLength)">
|
|
36
|
+
<Re id="reproductionNumberSP" spec="SkylineVectorParameter" changeTimes="$(changeTimes)">
|
|
37
|
+
<skylineValues id="reproductionNumber" spec="bella.BayesMLP" nodes="$(nodes)">
|
|
38
|
+
<predictor spec="RealParameter" value="$(timePredictor)"/>
|
|
39
|
+
<predictor spec="RealParameter" value="$(randomPredictor)"/>
|
|
40
|
+
<plate var="n" range="$(layersRange)">
|
|
41
|
+
<weights idref="reproductionNumberW$(n)"/>
|
|
42
|
+
</plate>
|
|
43
|
+
<activationFunctionsOutput spec="bella.Sigmoid" upper="$(reproductionNumberUpper)"/>
|
|
44
|
+
</skylineValues>
|
|
45
|
+
</Re>
|
|
46
|
+
<becomeUninfectiousRate spec="SkylineVectorParameter" skylineValues="$(becomeUninfectiousRate)"/>
|
|
47
|
+
<samplingProportion spec="SkylineVectorParameter" skylineValues="$(samplingProportion)"/>
|
|
48
|
+
<removalProb spec="SkylineVectorParameter" skylineValues="1.0"/>
|
|
49
|
+
</parameterization>
|
|
50
|
+
</distribution>
|
|
51
|
+
</distribution>
|
|
52
|
+
|
|
53
|
+
<distribution id="prior" spec="CompoundDistribution">
|
|
54
|
+
<plate var="n" range="$(layersRange)">
|
|
55
|
+
<distribution spec="Prior" x="@reproductionNumberW$(n)" distr="@weightsPrior"/>
|
|
56
|
+
</plate>
|
|
57
|
+
</distribution>
|
|
58
|
+
</distribution>
|
|
59
|
+
|
|
60
|
+
<plate var="n" range="$(layersRange)">
|
|
61
|
+
<operator spec="BactrianRandomWalkOperator" parameter="@reproductionNumberW$(n)" weight="30.0"/>
|
|
62
|
+
</plate>
|
|
63
|
+
|
|
64
|
+
<logger spec="Logger" fileName="$(treeID).log" logEvery="1000" model="@posterior">
|
|
65
|
+
<log idref="posterior"/>
|
|
66
|
+
<log idref="prior"/>
|
|
67
|
+
<log idref="likelihood"/>
|
|
68
|
+
<log idref="reproductionNumberSP"/>
|
|
69
|
+
<log idref="reproductionNumber"/>
|
|
70
|
+
</logger>
|
|
71
|
+
</run>
|
|
72
|
+
|
|
73
|
+
</beast>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<beast
|
|
3
|
+
namespace="
|
|
4
|
+
:beast.base.evolution.operator.kernel
|
|
5
|
+
:beast.base.inference.parameter
|
|
6
|
+
:beast.base.inference.operator.kernel
|
|
7
|
+
:beast.base.inference
|
|
8
|
+
:beast.base.inference.distribution
|
|
9
|
+
:bdmmprime.distribution
|
|
10
|
+
:bdmmprime.parameterization
|
|
11
|
+
:feast.fileio
|
|
12
|
+
:feast.expressions"
|
|
13
|
+
version="2.5"
|
|
14
|
+
>
|
|
15
|
+
<map name="Uniform">beast.base.inference.distribution.Uniform</map>
|
|
16
|
+
|
|
17
|
+
<map name="TreeFromNewickFile">feast.fileio.TreeFromNewickFile</map>
|
|
18
|
+
|
|
19
|
+
<TreeFromNewickFile id="tree" fileName="$(treeFile)" IsLabelledNewick="true" adjustTipHeights='false'/>
|
|
20
|
+
|
|
21
|
+
<parameter id="finalSampleOffset" spec="ExpCalculator" value="$(processLength)-$(lastSampleTime)"/>
|
|
22
|
+
|
|
23
|
+
<Uniform id="reproductionNumberPrior" upper="$(reproductionNumberUpper)"/>
|
|
24
|
+
|
|
25
|
+
<run spec="MCMC" chainLength="10000000">
|
|
26
|
+
<state id="state">
|
|
27
|
+
<stateNode id="reproductionNumber" spec="RealParameter" value="$(reproductionNumberInit)"/>
|
|
28
|
+
</state>
|
|
29
|
+
|
|
30
|
+
<distribution id="posterior" spec="CompoundDistribution">
|
|
31
|
+
<distribution id="likelihood" spec="CompoundDistribution">
|
|
32
|
+
<distribution spec="BirthDeathMigrationDistribution" tree="@tree" finalSampleOffset="@finalSampleOffset">
|
|
33
|
+
<parameterization spec="EpiParameterization" processLength="$(processLength)">
|
|
34
|
+
<Re id="reproductionNumberSP" spec="SkylineVectorParameter" skylineValues="@reproductionNumber" changeTimes="$(changeTimes)"/>
|
|
35
|
+
<becomeUninfectiousRate spec="SkylineVectorParameter" skylineValues="$(becomeUninfectiousRate)"/>
|
|
36
|
+
<samplingProportion spec="SkylineVectorParameter" skylineValues="$(samplingProportion)"/>
|
|
37
|
+
<removalProb spec="SkylineVectorParameter" skylineValues="1.0"/>
|
|
38
|
+
</parameterization>
|
|
39
|
+
</distribution>
|
|
40
|
+
</distribution>
|
|
41
|
+
|
|
42
|
+
<distribution id="prior" spec="CompoundDistribution">
|
|
43
|
+
<distribution spec="Prior" x="@reproductionNumber" distr="@reproductionNumberPrior"/>
|
|
44
|
+
</distribution>
|
|
45
|
+
</distribution>
|
|
46
|
+
|
|
47
|
+
<operator spec="BactrianScaleOperator" parameter="@reproductionNumber" weight="30.0" scaleFactor="0.75"/>
|
|
48
|
+
|
|
49
|
+
<logger spec="Logger" fileName="$(treeID).log" logEvery="1000" model="@posterior">
|
|
50
|
+
<log idref="posterior"/>
|
|
51
|
+
<log idref="prior"/>
|
|
52
|
+
<log idref="likelihood"/>
|
|
53
|
+
<log idref="reproductionNumberSP"/>
|
|
54
|
+
</logger>
|
|
55
|
+
</run>
|
|
56
|
+
|
|
57
|
+
</beast>
|